@nocobase/plugin-user-data-sync 1.4.0-alpha
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 +159 -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 +60 -0
- package/dist/locale/en-US.json +21 -0
- package/dist/locale/zh-CN.json +24 -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/error.d.ts +21 -0
- package/dist/server/error.js +58 -0
- package/dist/server/index.d.ts +12 -0
- package/dist/server/index.js +56 -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 +108 -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 +130 -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,64 @@
|
|
|
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_exports = {};
|
|
28
|
+
__export(user_data_exports, {
|
|
29
|
+
default: () => user_data_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(user_data_exports);
|
|
32
|
+
var import_plugin = require("../plugin");
|
|
33
|
+
var user_data_default = {
|
|
34
|
+
listSyncTypes: async (ctx, next) => {
|
|
35
|
+
const plugin = ctx.app.pm.get(import_plugin.PluginUserDataSyncServer);
|
|
36
|
+
ctx.body = plugin.sourceManager.listTypes();
|
|
37
|
+
await next();
|
|
38
|
+
},
|
|
39
|
+
pull: async (ctx, next) => {
|
|
40
|
+
const { name } = ctx.action.params;
|
|
41
|
+
const plugin = ctx.app.pm.get(import_plugin.PluginUserDataSyncServer);
|
|
42
|
+
await plugin.syncService.pull(name, ctx);
|
|
43
|
+
await next();
|
|
44
|
+
},
|
|
45
|
+
push: async (ctx, next) => {
|
|
46
|
+
const data = ctx.action.params.values || {};
|
|
47
|
+
const plugin = ctx.app.pm.get(import_plugin.PluginUserDataSyncServer);
|
|
48
|
+
try {
|
|
49
|
+
const result = await plugin.syncService.push(data);
|
|
50
|
+
ctx.body = { code: 0, message: "success", result };
|
|
51
|
+
} catch (error) {
|
|
52
|
+
ctx.status = 500;
|
|
53
|
+
ctx.body = { code: 500, message: error.message };
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
await next();
|
|
57
|
+
},
|
|
58
|
+
retry: async (ctx, next) => {
|
|
59
|
+
const { sourceId, id } = ctx.action.params;
|
|
60
|
+
const plugin = ctx.app.pm.get(import_plugin.PluginUserDataSyncServer);
|
|
61
|
+
await plugin.syncService.retry(sourceId, id, ctx);
|
|
62
|
+
await next();
|
|
63
|
+
}
|
|
64
|
+
};
|
|
@@ -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,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,21 @@
|
|
|
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 declare class ExternalAPIError extends Error {
|
|
10
|
+
code: number;
|
|
11
|
+
constructor(message: string);
|
|
12
|
+
}
|
|
13
|
+
export declare class ErrorCodes {
|
|
14
|
+
static SUCCESS: number;
|
|
15
|
+
static UNAUTHORIZED: number;
|
|
16
|
+
static EXTERNAL_API_ERROR: number;
|
|
17
|
+
static messages: {
|
|
18
|
+
[x: number]: string;
|
|
19
|
+
};
|
|
20
|
+
static getErrorMessage(code: any): string;
|
|
21
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
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 error_exports = {};
|
|
28
|
+
__export(error_exports, {
|
|
29
|
+
ErrorCodes: () => ErrorCodes,
|
|
30
|
+
ExternalAPIError: () => ExternalAPIError
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(error_exports);
|
|
33
|
+
class ExternalAPIError extends Error {
|
|
34
|
+
code;
|
|
35
|
+
constructor(message) {
|
|
36
|
+
super(message);
|
|
37
|
+
this.name = "ExternalAPIError";
|
|
38
|
+
this.code = ErrorCodes.EXTERNAL_API_ERROR;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
class ErrorCodes {
|
|
42
|
+
static SUCCESS = 0;
|
|
43
|
+
static UNAUTHORIZED = 401;
|
|
44
|
+
static EXTERNAL_API_ERROR = 510;
|
|
45
|
+
static messages = {
|
|
46
|
+
[ErrorCodes.SUCCESS]: "Success",
|
|
47
|
+
[ErrorCodes.UNAUTHORIZED]: "Unauthorized",
|
|
48
|
+
[ErrorCodes.EXTERNAL_API_ERROR]: "External API Error"
|
|
49
|
+
};
|
|
50
|
+
static getErrorMessage(code) {
|
|
51
|
+
return this.messages[code] || "Unknown Error";
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
+
0 && (module.exports = {
|
|
56
|
+
ErrorCodes,
|
|
57
|
+
ExternalAPIError
|
|
58
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
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 { ExternalAPIError, ErrorCodes } from './error';
|
|
11
|
+
export * from './user-data-resource-manager';
|
|
12
|
+
export { default } from './plugin';
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
ErrorCodes: () => import_error.ErrorCodes,
|
|
41
|
+
ExternalAPIError: () => import_error.ExternalAPIError,
|
|
42
|
+
SyncSource: () => import_sync_source.SyncSource,
|
|
43
|
+
default: () => import_plugin.default
|
|
44
|
+
});
|
|
45
|
+
module.exports = __toCommonJS(server_exports);
|
|
46
|
+
var import_sync_source = require("./sync-source");
|
|
47
|
+
var import_error = require("./error");
|
|
48
|
+
__reExport(server_exports, require("./user-data-resource-manager"), module.exports);
|
|
49
|
+
var import_plugin = __toESM(require("./plugin"));
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
ErrorCodes,
|
|
53
|
+
ExternalAPIError,
|
|
54
|
+
SyncSource,
|
|
55
|
+
...require("./user-data-resource-manager")
|
|
56
|
+
});
|
|
@@ -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
|
+
}
|