@nocobase/plugin-user-data-sync 1.4.0-alpha.20240826214041
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/LICENSE.txt +121 -0
- package/README.md +1 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/Options.d.ts +12 -0
- package/dist/client/UserDataSyncSource.d.ts +10 -0
- package/dist/client/index.d.ts +21 -0
- package/dist/client/index.js +10 -0
- package/dist/client/locale/index.d.ts +10 -0
- package/dist/client/schemas/user-data-sync-sources.d.ts +155 -0
- package/dist/client/sourceType.d.ts +24 -0
- package/dist/externalVersion.js +24 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +56 -0
- package/dist/locale/en-US.json +19 -0
- package/dist/locale/zh-CN.json +22 -0
- package/dist/server/actions/user-data.d.ts +16 -0
- package/dist/server/actions/user-data.js +64 -0
- package/dist/server/collections/user-data-sync-records-resources.d.ts +10 -0
- package/dist/server/collections/user-data-sync-records-resources.js +54 -0
- package/dist/server/collections/user-data-sync-records.d.ts +10 -0
- package/dist/server/collections/user-data-sync-records.js +85 -0
- package/dist/server/collections/user-data-sync-sources.d.ts +10 -0
- package/dist/server/collections/user-data-sync-sources.js +109 -0
- package/dist/server/collections/user-data-sync-tasks.d.ts +10 -0
- package/dist/server/collections/user-data-sync-tasks.js +131 -0
- package/dist/server/index.d.ts +11 -0
- package/dist/server/index.js +51 -0
- package/dist/server/models/sync-source.d.ts +15 -0
- package/dist/server/models/sync-source.js +38 -0
- package/dist/server/plugin.d.ts +27 -0
- package/dist/server/plugin.js +100 -0
- package/dist/server/sync-source-manager.d.ts +28 -0
- package/dist/server/sync-source-manager.js +71 -0
- package/dist/server/sync-source.d.ts +42 -0
- package/dist/server/sync-source.js +107 -0
- package/dist/server/user-data-resource-manager.d.ts +103 -0
- package/dist/server/user-data-resource-manager.js +214 -0
- package/dist/server/user-data-sync-service.d.ts +23 -0
- package/dist/server/user-data-sync-service.js +125 -0
- package/dist/swagger/index.d.ts +116 -0
- package/dist/swagger/index.js +138 -0
- package/package.json +18 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var user_data_sync_records_resources_exports = {};
|
|
28
|
+
__export(user_data_sync_records_resources_exports, {
|
|
29
|
+
default: () => user_data_sync_records_resources_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(user_data_sync_records_resources_exports);
|
|
32
|
+
var import_database = require("@nocobase/database");
|
|
33
|
+
var user_data_sync_records_resources_default = (0, import_database.defineCollection)({
|
|
34
|
+
name: "userDataSyncRecordsResources",
|
|
35
|
+
fields: [
|
|
36
|
+
{
|
|
37
|
+
name: "recordId",
|
|
38
|
+
type: "bigInt",
|
|
39
|
+
interface: "id"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "resource",
|
|
43
|
+
interface: "Select",
|
|
44
|
+
type: "string",
|
|
45
|
+
allowNull: false
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "resourcePk",
|
|
49
|
+
interface: "Input",
|
|
50
|
+
type: "string",
|
|
51
|
+
allowNull: true
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
declare const _default: import("@nocobase/database").CollectionOptions;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var user_data_sync_records_exports = {};
|
|
28
|
+
__export(user_data_sync_records_exports, {
|
|
29
|
+
default: () => user_data_sync_records_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(user_data_sync_records_exports);
|
|
32
|
+
var import_database = require("@nocobase/database");
|
|
33
|
+
var user_data_sync_records_default = (0, import_database.defineCollection)({
|
|
34
|
+
dumpRules: {
|
|
35
|
+
group: "third-party"
|
|
36
|
+
},
|
|
37
|
+
shared: true,
|
|
38
|
+
name: "userDataSyncRecords",
|
|
39
|
+
createdAt: true,
|
|
40
|
+
updatedAt: true,
|
|
41
|
+
logging: true,
|
|
42
|
+
fields: [
|
|
43
|
+
{
|
|
44
|
+
name: "id",
|
|
45
|
+
type: "bigInt",
|
|
46
|
+
autoIncrement: true,
|
|
47
|
+
primaryKey: true,
|
|
48
|
+
allowNull: false,
|
|
49
|
+
interface: "id"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: "sourceName",
|
|
53
|
+
interface: "Input",
|
|
54
|
+
type: "string",
|
|
55
|
+
allowNull: false
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "sourceUk",
|
|
59
|
+
interface: "Input",
|
|
60
|
+
type: "string",
|
|
61
|
+
allowNull: false
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "dataType",
|
|
65
|
+
interface: "Select",
|
|
66
|
+
type: "string",
|
|
67
|
+
allowNull: false
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "resources",
|
|
71
|
+
type: "hasMany",
|
|
72
|
+
target: "userDataSyncRecordsResources",
|
|
73
|
+
sourceKey: "id",
|
|
74
|
+
foreignKey: "recordId"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
type: "json",
|
|
78
|
+
name: "metaData"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
type: "json",
|
|
82
|
+
name: "lastMetaData"
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
declare const _default: import("@nocobase/database").CollectionOptions;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var user_data_sync_sources_exports = {};
|
|
28
|
+
__export(user_data_sync_sources_exports, {
|
|
29
|
+
default: () => user_data_sync_sources_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(user_data_sync_sources_exports);
|
|
32
|
+
var import_database = require("@nocobase/database");
|
|
33
|
+
var user_data_sync_sources_default = (0, import_database.defineCollection)({
|
|
34
|
+
dumpRules: {
|
|
35
|
+
group: "third-party"
|
|
36
|
+
},
|
|
37
|
+
shared: true,
|
|
38
|
+
name: "userDataSyncSources",
|
|
39
|
+
title: '{{t("Sync Sources")}}',
|
|
40
|
+
sortable: true,
|
|
41
|
+
model: "SyncSourceModel",
|
|
42
|
+
createdBy: true,
|
|
43
|
+
updatedBy: true,
|
|
44
|
+
logging: true,
|
|
45
|
+
fields: [
|
|
46
|
+
{
|
|
47
|
+
name: "id",
|
|
48
|
+
type: "bigInt",
|
|
49
|
+
autoIncrement: true,
|
|
50
|
+
primaryKey: true,
|
|
51
|
+
allowNull: false,
|
|
52
|
+
interface: "id"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
interface: "input",
|
|
56
|
+
type: "string",
|
|
57
|
+
name: "name",
|
|
58
|
+
allowNull: false,
|
|
59
|
+
unique: true,
|
|
60
|
+
uiSchema: {
|
|
61
|
+
type: "string",
|
|
62
|
+
title: '{{t("Source name")}}',
|
|
63
|
+
"x-component": "Input",
|
|
64
|
+
required: true
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
interface: "input",
|
|
69
|
+
type: "string",
|
|
70
|
+
name: "sourceType",
|
|
71
|
+
allowNull: false,
|
|
72
|
+
uiSchema: {
|
|
73
|
+
type: "string",
|
|
74
|
+
title: '{{t("Source Type")}}',
|
|
75
|
+
"x-component": "Input",
|
|
76
|
+
required: true
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
interface: "input",
|
|
81
|
+
type: "string",
|
|
82
|
+
name: "displayName",
|
|
83
|
+
uiSchema: {
|
|
84
|
+
type: "string",
|
|
85
|
+
title: '{{t("Source display name")}}',
|
|
86
|
+
"x-component": "Input"
|
|
87
|
+
},
|
|
88
|
+
translation: true
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
type: "boolean",
|
|
92
|
+
name: "enabled",
|
|
93
|
+
defaultValue: false
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
type: "json",
|
|
97
|
+
name: "options",
|
|
98
|
+
allowNull: false,
|
|
99
|
+
defaultValue: {}
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
type: "hasMany",
|
|
103
|
+
name: "tasks",
|
|
104
|
+
target: "userDataSyncTasks",
|
|
105
|
+
sourceKey: "id",
|
|
106
|
+
foreignKey: "sourceId"
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
declare const _default: import("@nocobase/database").CollectionOptions;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var user_data_sync_tasks_exports = {};
|
|
28
|
+
__export(user_data_sync_tasks_exports, {
|
|
29
|
+
default: () => user_data_sync_tasks_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(user_data_sync_tasks_exports);
|
|
32
|
+
var import_database = require("@nocobase/database");
|
|
33
|
+
var user_data_sync_tasks_default = (0, import_database.defineCollection)({
|
|
34
|
+
dumpRules: {
|
|
35
|
+
group: "third-party"
|
|
36
|
+
},
|
|
37
|
+
name: "userDataSyncTasks",
|
|
38
|
+
title: '{{t("Sync Tasks")}}',
|
|
39
|
+
sortable: "sort",
|
|
40
|
+
model: "SyncTaskModel",
|
|
41
|
+
createdBy: true,
|
|
42
|
+
updatedBy: true,
|
|
43
|
+
createdAt: true,
|
|
44
|
+
updatedAt: true,
|
|
45
|
+
logging: true,
|
|
46
|
+
shared: true,
|
|
47
|
+
fields: [
|
|
48
|
+
{
|
|
49
|
+
name: "id",
|
|
50
|
+
type: "bigInt",
|
|
51
|
+
autoIncrement: true,
|
|
52
|
+
primaryKey: true,
|
|
53
|
+
allowNull: false,
|
|
54
|
+
interface: "id"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: "batch",
|
|
58
|
+
interface: "input",
|
|
59
|
+
type: "string",
|
|
60
|
+
allowNull: false,
|
|
61
|
+
unique: true,
|
|
62
|
+
uiSchema: {
|
|
63
|
+
type: "string",
|
|
64
|
+
title: '{{t("Batch")}}',
|
|
65
|
+
"x-component": "Input",
|
|
66
|
+
required: true
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "source",
|
|
71
|
+
interface: "input",
|
|
72
|
+
type: "belongsTo",
|
|
73
|
+
target: "userDataSyncSources",
|
|
74
|
+
targetKey: "id",
|
|
75
|
+
foreignKey: "sourceId",
|
|
76
|
+
allowNull: false,
|
|
77
|
+
uiSchema: {
|
|
78
|
+
type: "object",
|
|
79
|
+
title: '{{t("Source")}}',
|
|
80
|
+
"x-component": "AssociationField",
|
|
81
|
+
"x-component-props": {
|
|
82
|
+
fieldNames: {
|
|
83
|
+
value: "id",
|
|
84
|
+
label: "name"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
required: true,
|
|
88
|
+
"x-read-pretty": true
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: "status",
|
|
93
|
+
interface: "Select",
|
|
94
|
+
type: "string",
|
|
95
|
+
allowNull: false,
|
|
96
|
+
uiSchema: {
|
|
97
|
+
type: "string",
|
|
98
|
+
title: '{{t("Status")}}',
|
|
99
|
+
"x-component": "Select",
|
|
100
|
+
required: true
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: "message",
|
|
105
|
+
interface: "input",
|
|
106
|
+
type: "string",
|
|
107
|
+
allowNull: true,
|
|
108
|
+
uiSchema: {
|
|
109
|
+
type: "string",
|
|
110
|
+
title: '{{t("Message")}}',
|
|
111
|
+
"x-component": "Input",
|
|
112
|
+
required: false
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: "cost",
|
|
117
|
+
interface: "input",
|
|
118
|
+
type: "integer",
|
|
119
|
+
allowNull: true,
|
|
120
|
+
uiSchema: {
|
|
121
|
+
type: "integer",
|
|
122
|
+
title: '{{t("Cost")}}',
|
|
123
|
+
"x-component": "InputNumber",
|
|
124
|
+
"x-component-props": {
|
|
125
|
+
precision: 0
|
|
126
|
+
},
|
|
127
|
+
required: false
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export { SyncSource } from './sync-source';
|
|
10
|
+
export * from './user-data-resource-manager';
|
|
11
|
+
export { default } from './plugin';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __create = Object.create;
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __export = (target, all) => {
|
|
17
|
+
for (var name in all)
|
|
18
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(from))
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
29
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
30
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
31
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
32
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
33
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
34
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
35
|
+
mod
|
|
36
|
+
));
|
|
37
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
+
var server_exports = {};
|
|
39
|
+
__export(server_exports, {
|
|
40
|
+
SyncSource: () => import_sync_source.SyncSource,
|
|
41
|
+
default: () => import_plugin.default
|
|
42
|
+
});
|
|
43
|
+
module.exports = __toCommonJS(server_exports);
|
|
44
|
+
var import_sync_source = require("./sync-source");
|
|
45
|
+
__reExport(server_exports, require("./user-data-resource-manager"), module.exports);
|
|
46
|
+
var import_plugin = __toESM(require("./plugin"));
|
|
47
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
+
0 && (module.exports = {
|
|
49
|
+
SyncSource,
|
|
50
|
+
...require("./user-data-resource-manager")
|
|
51
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { Model } from '@nocobase/database';
|
|
10
|
+
export declare class SyncSourceModel extends Model {
|
|
11
|
+
id: number;
|
|
12
|
+
name: string;
|
|
13
|
+
sourceType: string;
|
|
14
|
+
options: any;
|
|
15
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var sync_source_exports = {};
|
|
28
|
+
__export(sync_source_exports, {
|
|
29
|
+
SyncSourceModel: () => SyncSourceModel
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(sync_source_exports);
|
|
32
|
+
var import_database = require("@nocobase/database");
|
|
33
|
+
class SyncSourceModel extends import_database.Model {
|
|
34
|
+
}
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
SyncSourceModel
|
|
38
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { Plugin } from '@nocobase/server';
|
|
10
|
+
import { UserDataResourceManager } from './user-data-resource-manager';
|
|
11
|
+
import { UserDataSyncService } from './user-data-sync-service';
|
|
12
|
+
import { SyncSourceManager } from './sync-source-manager';
|
|
13
|
+
import { Logger } from '@nocobase/logger';
|
|
14
|
+
export declare class PluginUserDataSyncServer extends Plugin {
|
|
15
|
+
sourceManager: SyncSourceManager;
|
|
16
|
+
resourceManager: UserDataResourceManager;
|
|
17
|
+
syncService: UserDataSyncService;
|
|
18
|
+
afterAdd(): Promise<void>;
|
|
19
|
+
beforeLoad(): Promise<void>;
|
|
20
|
+
getLogger(): Logger;
|
|
21
|
+
load(): Promise<void>;
|
|
22
|
+
install(): Promise<void>;
|
|
23
|
+
afterEnable(): Promise<void>;
|
|
24
|
+
afterDisable(): Promise<void>;
|
|
25
|
+
remove(): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
export default PluginUserDataSyncServer;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __create = Object.create;
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __export = (target, all) => {
|
|
17
|
+
for (var name in all)
|
|
18
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(from))
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
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
|
+
));
|
|
36
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
+
var plugin_exports = {};
|
|
38
|
+
__export(plugin_exports, {
|
|
39
|
+
PluginUserDataSyncServer: () => PluginUserDataSyncServer,
|
|
40
|
+
default: () => plugin_default
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(plugin_exports);
|
|
43
|
+
var import_server = require("@nocobase/server");
|
|
44
|
+
var import_user_data_resource_manager = require("./user-data-resource-manager");
|
|
45
|
+
var import_user_data_sync_service = require("./user-data-sync-service");
|
|
46
|
+
var import_user_data = __toESM(require("./actions/user-data"));
|
|
47
|
+
var import_sync_source_manager = require("./sync-source-manager");
|
|
48
|
+
var import_sync_source = require("./models/sync-source");
|
|
49
|
+
class PluginUserDataSyncServer extends import_server.Plugin {
|
|
50
|
+
sourceManager;
|
|
51
|
+
resourceManager;
|
|
52
|
+
syncService;
|
|
53
|
+
async afterAdd() {
|
|
54
|
+
}
|
|
55
|
+
async beforeLoad() {
|
|
56
|
+
this.app.db.registerModels({ SyncSourceModel: import_sync_source.SyncSourceModel });
|
|
57
|
+
this.sourceManager = new import_sync_source_manager.SyncSourceManager();
|
|
58
|
+
this.resourceManager = new import_user_data_resource_manager.UserDataResourceManager();
|
|
59
|
+
}
|
|
60
|
+
getLogger() {
|
|
61
|
+
const logger = this.createLogger({
|
|
62
|
+
dirname: "user-data-sync",
|
|
63
|
+
filename: "%DATE%.log",
|
|
64
|
+
format: "json"
|
|
65
|
+
});
|
|
66
|
+
return logger;
|
|
67
|
+
}
|
|
68
|
+
async load() {
|
|
69
|
+
const logger = this.getLogger();
|
|
70
|
+
this.resourceManager.db = this.app.db;
|
|
71
|
+
this.resourceManager.logger = this.app.logger;
|
|
72
|
+
this.syncService = new import_user_data_sync_service.UserDataSyncService(this.resourceManager, this.sourceManager, logger);
|
|
73
|
+
this.app.resourceManager.define({
|
|
74
|
+
name: "userData",
|
|
75
|
+
actions: {
|
|
76
|
+
listSyncTypes: import_user_data.default.listSyncTypes,
|
|
77
|
+
pull: import_user_data.default.pull,
|
|
78
|
+
push: import_user_data.default.push,
|
|
79
|
+
retry: import_user_data.default.retry
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
this.app.acl.registerSnippet({
|
|
83
|
+
name: `pm.${this.name}`,
|
|
84
|
+
actions: ["userData:*", "userDataSyncSources:*"]
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
async install() {
|
|
88
|
+
}
|
|
89
|
+
async afterEnable() {
|
|
90
|
+
}
|
|
91
|
+
async afterDisable() {
|
|
92
|
+
}
|
|
93
|
+
async remove() {
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
var plugin_default = PluginUserDataSyncServer;
|
|
97
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
98
|
+
0 && (module.exports = {
|
|
99
|
+
PluginUserDataSyncServer
|
|
100
|
+
});
|