@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
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
Updated Date: August 15, 2024
|
|
2
|
+
|
|
3
|
+
NocoBase License Agreement
|
|
4
|
+
|
|
5
|
+
NOCOBASE PTE. LTD.,a Singaporean Exempt Private Company Limited by Shares with its principal place of business located at #03-01 ROBINSON 112 ("The Company") https://www.nocobase.com/ issues this License Agreement ("Agreement") to you. You, as an individual or a company ("User"), will be deemed to voluntarily accept all terms of this Agreement by using NocoBase (including but not limited to obtaining NocoBase source code or installation package in any form, installing and using NocoBase, purchasing NocoBase commercial license and services, purchasing NocoBase commercial plugins). If the User does not agree to any term of this Agreement, or cannot accurately understand our interpretation of the relevant terms, please stop using it immediately.
|
|
6
|
+
|
|
7
|
+
This Agreement applies to any use, quotation, contract, invoice, and all software delivered by the Company. The User and the Company or NocoBase's agents can no longer sign a separate license agreement for the sale and delivery of the software.
|
|
8
|
+
|
|
9
|
+
The Company reserves the right to formulate and modify this Agreement from time to time as needed. If there are changes, the Company will announce them in the form of website announcements, without further individual notification. The changed Agreement will automatically take effect once it is announced, becoming part of this Agreement.
|
|
10
|
+
|
|
11
|
+
==============
|
|
12
|
+
1. Definitions
|
|
13
|
+
==============
|
|
14
|
+
|
|
15
|
+
1.1 "Software" refers to the NocoBase kernel and plugins placed in the same code repository as the kernel, including their source code, installation packages, images, and all their modifications, updates, and upgrades.
|
|
16
|
+
|
|
17
|
+
1.2 "Marketplace" refers to the marketplace provided by the Company for selling Software plugins and solutions.
|
|
18
|
+
|
|
19
|
+
1.3 "Commercial Plugin" refers to the paid plugins sold in the Marketplace.
|
|
20
|
+
|
|
21
|
+
1.4 "Upper Layer Application" refers to a specific business use case application serving internal or external customers of the User, developed based on Software and Commercial Plugins, such as ERP/CRM.
|
|
22
|
+
|
|
23
|
+
1.5 "Customer" refers to the clients who purchase the User's Upper Layer Application.
|
|
24
|
+
|
|
25
|
+
1.6 "Third-Party Open Source Software" refers to open source software provided with Software and Commercial Plugins. They are licensed through various published open source software licenses or copyright notices accompanying such software.
|
|
26
|
+
|
|
27
|
+
===================================
|
|
28
|
+
2. Intellectual Property Protection
|
|
29
|
+
===================================
|
|
30
|
+
|
|
31
|
+
Except for Third-Party Open Source Software, the Company owns all copyrights, trademark rights, patent rights, trade secrets, and other intellectual property rights of the Software, and has registered and protected them in relevant countries and regions according to the "Paris Convention" or "TRIPS Agreement", ensuring that the intellectual property rights of the Software and Commercial Plugins are internationally recognized and protected.
|
|
32
|
+
|
|
33
|
+
=============
|
|
34
|
+
3. Disclaimer
|
|
35
|
+
=============
|
|
36
|
+
|
|
37
|
+
3.1 Users shall not use the Software and Commercial Plugins to engage in activities that violate local laws and regulations, religious beliefs. All legal responsibilities and legal consequences arising from the use of Software and Commercial Plugins shall be borne by the User.
|
|
38
|
+
|
|
39
|
+
3.2 The Company shall not be liable for any direct, indirect, special, incidental, or consequential damages (including but not limited to loss of profits, business interruption, data loss, or business information disclosure) caused by the User's use of the Software and Commercial Plugins, even if it has been previously informed of the possibility of such damages.
|
|
40
|
+
|
|
41
|
+
===============
|
|
42
|
+
4. License Type
|
|
43
|
+
===============
|
|
44
|
+
|
|
45
|
+
4.1 The Software uses a dual license type of AGPL-3.0 Open Source License https://www.gnu.org/licenses/agpl-3..en.htm and Commercial License.
|
|
46
|
+
|
|
47
|
+
4.2 Commercial Plugins use Commercial License.
|
|
48
|
+
|
|
49
|
+
================================================
|
|
50
|
+
5. Rights and Obligations of Open Source License
|
|
51
|
+
================================================
|
|
52
|
+
|
|
53
|
+
5.1 The Software can be used for commercial purposes.
|
|
54
|
+
|
|
55
|
+
5.2 User can sell plugins developed for the Software in the Marketplace.
|
|
56
|
+
|
|
57
|
+
5.3 Outside the Marketplace, changes and plugins to the Software developed by User or third parties, and third-party applications developed based on the Software must all be open-sourced under the AGPL-3.0 license.
|
|
58
|
+
|
|
59
|
+
5.4 It is not allowed to remove or change the brand, name, link, version number, license, and other information about NocoBase on the Software interface, except for the main LOGO in the upper left corner of the page.
|
|
60
|
+
|
|
61
|
+
5.5 It is not allowed to remove or change all intellectual property statements about NocoBase in the code.
|
|
62
|
+
|
|
63
|
+
5.6 It is not allowed to provide any form of no-code, zero-code, low-code platform SaaS products to the public using the original or modified Software.
|
|
64
|
+
|
|
65
|
+
5.7 Comply with all requirements of the AGPL-3.0 agreement.
|
|
66
|
+
|
|
67
|
+
===============================
|
|
68
|
+
6. Rights of Commercial License
|
|
69
|
+
===============================
|
|
70
|
+
|
|
71
|
+
6.1 Obtain a permanent commercial license of the Software or Commercial Plugin.
|
|
72
|
+
|
|
73
|
+
6.2 Get 12 months of upgrade and exclusive technical support.
|
|
74
|
+
|
|
75
|
+
6.3 The licensed Software and Commercial Plugins can be used for commercial purposes with no restrictions on the number of applications and users.
|
|
76
|
+
|
|
77
|
+
6.4 Changes and plugins to the Software, and applications integrated with the Software do not need to be open sourced.
|
|
78
|
+
|
|
79
|
+
6.5 Can remove or change the brand, name, link, version number, license, and other information about NocoBase on the Software interface.
|
|
80
|
+
|
|
81
|
+
6.6 Can sell plugins developed for Software in the Marketplace.
|
|
82
|
+
|
|
83
|
+
6.7 Users with a Professional or Enterprise Edition license can sell Upper Layer Application to their clients.
|
|
84
|
+
|
|
85
|
+
6.8 Not restricted by the AGPL-3.0 agreement.
|
|
86
|
+
|
|
87
|
+
6.9 If there are other agreements in the contract for the above rights, the contract agreement shall prevail.
|
|
88
|
+
|
|
89
|
+
====================================
|
|
90
|
+
7. Obligations of Commercial License
|
|
91
|
+
====================================
|
|
92
|
+
|
|
93
|
+
7.1 It is not allowed to remove or change all intellectual property statements about NocoBase in the code.
|
|
94
|
+
|
|
95
|
+
7.2 It is not allowed to sell, transfer, lease, share, or give away the Commercial License.
|
|
96
|
+
|
|
97
|
+
7.3 It is not allowed to provide any form of no-code, zero-code, low-code platform SaaS products to the public using the original or modified Software.
|
|
98
|
+
|
|
99
|
+
7.4 It is not allowed for Users with a standard license to sell Upper Layer Application to clients without a commercial license.
|
|
100
|
+
|
|
101
|
+
7.5 It is not allowed to use reverse engineering, decompilation, and other means to try to discover the source code of Commercial Plugins that have not obtained source code license.
|
|
102
|
+
|
|
103
|
+
7.6 It is not allowed to disclose the source code of Commercial Plugins to any third party.
|
|
104
|
+
|
|
105
|
+
7.7 It is not allowed to publicly sell plugins developed for Software outside of the Marketplace.
|
|
106
|
+
|
|
107
|
+
7.8 If there is a violation of the above obligations or the terms of this Agreement, the rights owned by the User will be immediately terminated, the paid fees will not be refunded, and the Company reserves the right to pursue the User's legal responsibility.
|
|
108
|
+
|
|
109
|
+
7.9 If there are other agreements in the contract for the above obligations, the contract agreement shall prevail.
|
|
110
|
+
|
|
111
|
+
=============================================================
|
|
112
|
+
8. Legal Jurisdiction, Interpretation, and Dispute Resolution
|
|
113
|
+
=============================================================
|
|
114
|
+
|
|
115
|
+
8.1 Except for Mainland China, the interpretation, application, and all matters related to this agreement are subject to the jurisdiction of Singapore law.
|
|
116
|
+
|
|
117
|
+
8.2 Any dispute related to this Agreement should first be resolved through friendly negotiation. If the negotiation fails to resolve the dispute, the dispute should be submitted to the International Chamber of Commerce (ICC) for arbitration. The arbitration venue should be Singapore, conducted in English.
|
|
118
|
+
|
|
119
|
+
8.3 All terms and conditions of this Agreement shall be deemed enforceable to the maximum extent permitted by applicable law. If any term of this Agreement is deemed invalid by any applicable law, the invalidity of that term does not affect the validity of any other term of this Agreement, and it should be deemed that the invalid term has been modified as much as possible to make it valid and enforceable, or if the term cannot be modified, it should be deemed to have been deleted from this Agreement.
|
|
120
|
+
|
|
121
|
+
8.4 The arbitration award is final, binding on both parties, and can be enforced in any court with jurisdiction.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @nocobase/plugin-user-data-sync
|
package/client.d.ts
ADDED
package/client.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/client/index.js');
|
|
@@ -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
|
+
import React from 'react';
|
|
10
|
+
export declare const useValuesFromOptions: (options: any) => import("@nocobase/client").UseRequestResult<unknown>;
|
|
11
|
+
export declare const useAdminSettingsForm: (sourceType: string) => any;
|
|
12
|
+
export declare const Options: React.MemoExoticComponent<import("@formily/react").ReactFC<unknown>>;
|
|
@@ -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
|
+
import React from 'react';
|
|
10
|
+
export declare const UserDataSyncSource: React.FC;
|
|
@@ -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
|
+
import { Plugin } from '@nocobase/client';
|
|
10
|
+
import { ComponentType } from 'react';
|
|
11
|
+
export type SourceOptions = {
|
|
12
|
+
components: Partial<{
|
|
13
|
+
AdminSettingsForm: ComponentType;
|
|
14
|
+
}>;
|
|
15
|
+
};
|
|
16
|
+
export declare class PluginUserDataSyncClient extends Plugin {
|
|
17
|
+
sourceTypes: any;
|
|
18
|
+
registerType(sourceType: string, options: SourceOptions): void;
|
|
19
|
+
load(): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
export default PluginUserDataSyncClient;
|
|
@@ -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
|
+
|
|
10
|
+
(function(o,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("@nocobase/client"),require("@nocobase/utils/client"),require("react-i18next"),require("react/jsx-runtime"),require("antd"),require("react"),require("@ant-design/icons"),require("@formily/react"),require("@formily/core")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","@nocobase/utils/client","react-i18next","react/jsx-runtime","antd","react","@ant-design/icons","@formily/react","@formily/core"],e):(o=typeof globalThis!="undefined"?globalThis:o||self,e(o["@nocobase/plugin-user-data-sync"]={},o["@nocobase/client"],o["@nocobase/utils"],o["react-i18next"],o.jsxRuntime,o.antd,o.react,o["@ant-design/icons"],o["@formily/react"],o["@formily/core"]))})(this,function(o,e,c,g,r,m,a,d,u,y){"use strict";var X=Object.defineProperty,Y=Object.defineProperties;var Z=Object.getOwnPropertyDescriptors;var I=Object.getOwnPropertySymbols;var $=Object.prototype.hasOwnProperty,ee=Object.prototype.propertyIsEnumerable;var k=(o,e,c)=>e in o?X(o,e,{enumerable:!0,configurable:!0,writable:!0,value:c}):o[e]=c,C=(o,e)=>{for(var c in e||(e={}))$.call(e,c)&&k(o,c,e[c]);if(I)for(var c of I(e))ee.call(e,c)&&k(o,c,e[c]);return o},P=(o,e)=>Y(o,Z(e));var B=(o,e,c)=>(k(o,typeof e!="symbol"?e+"":e,c),c);var f=(o,e,c)=>new Promise((g,r)=>{var m=u=>{try{d(c.next(u))}catch(y){r(y)}},a=u=>{try{d(c.throw(u))}catch(y){r(y)}},d=u=>u.done?g(u.value):Promise.resolve(u.value).then(m,a);d((c=c.apply(o,e)).next())});const S="user-data-sync";function T(){return g.useTranslation([S,"client"],{nsMode:"fallback"})}const D={name:"userDataSyncSources",sortable:!0,filterTargetKey:"id",fields:[{name:"id",type:"string",interface:"id"},{interface:"input",type:"string",name:"name",uiSchema:{type:"string",title:'{{t("Source name")}}',"x-component":"Input",required:!0}},{interface:"input",type:"string",name:"sourceType",allowNull:!1,uiSchema:{type:"string",title:'{{t("Type")}}',"x-component":"Select",required:!0,dataSource:"{{ types }}"}},{type:"boolean",name:"enabled",uiSchema:{type:"boolean",title:'{{t("Enabled")}}',"x-component":"Checkbox"}}]},w={name:"userDataSyncTasks",filterTargetKey:"id",fields:[{name:"id",type:"bigInt",interface:"id"},{name:"batch",interface:"input",type:"string",allowNull:!1,uiSchema:{type:"string",title:'{{t("Batch")}}',"x-component":"Input",required:!0}},{name:"source",interface:"input",type:"belongsTo",target:"userDataSyncSources",targetKey:"id",foreignKey:"sourceId",allowNull:!1,uiSchema:{type:"object",title:'{{t("Source")}}',"x-component":"AssociationField","x-component-props":{fieldNames:{value:"id",label:"name"}},required:!0,"x-read-pretty":!0}},{name:"status",interface:"input",type:"string",allowNull:!1,uiSchema:{type:"string",title:'{{t("Status")}}',"x-component":"Select",required:!0,enum:[{label:'{{t("Init")}}',value:"init",color:"default"},{label:'{{t("Processing")}}',value:"processing",color:"processing"},{label:'{{t("Success")}}',value:"success",color:"success"},{label:'{{t("Failed")}}',value:"failed",color:"error"}]}},{name:"message",interface:"input",type:"string",allowNull:!0,uiSchema:{type:"string",title:'{{t("Message")}}',"x-component":"Input",required:!1}},{name:"cost",interface:"input",type:"integer",allowNull:!0,uiSchema:{type:"integer",title:'{{t("Cost")}}',"x-component":"InputNumber","x-component-props":{precision:0},required:!1}}]},q={type:"object",properties:{drawer:{type:"void","x-component":"Action.Drawer",title:'{{t("Add new")}}',properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useCustomFormProps",properties:{name:{"x-component":"CollectionField","x-decorator":"FormItem"},sourceType:{"x-component":"CollectionField","x-decorator":"FormItem","x-component-props":{options:"{{ types }}"}},enabled:{"x-component":"CollectionField","x-decorator":"FormItem"},options:{type:"object","x-component":"Options"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{submit:{title:'{{t("Submit")}}',"x-component":"Action","x-use-component-props":"useSubmitActionProps","x-component-props":{type:"primary"}}}}}}}}}},V={type:"object",properties:{drawer:{type:"void","x-component":"Action.Drawer",title:'{{ t("Tasks") }}',properties:{table:{type:"void","x-decorator":"TableBlockProvider","x-use-decorator-props":"useTasksTableBlockProps","x-decorator-props":{collection:w.name,dragSort:!1,action:"list",showIndex:!0},properties:{table:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id"},properties:{batch:{type:"void",title:'{{ t("Batch") }}',"x-component":"TableV2.Column",properties:{batch:{type:"string","x-component":"CollectionField","x-pattern":"readPretty"}}},status:{type:"void",title:'{{ t("Status") }}',"x-component":"TableV2.Column",properties:{status:{type:"string","x-component":"CollectionField","x-pattern":"readPretty"}}},message:{type:"void",title:'{{ t("Message") }}',"x-component":"TableV2.Column",properties:{message:{type:"string","x-component":"CollectionField","x-pattern":"readPretty"}}},actions:{type:"void",title:'{{t("Actions")}}',"x-decorator":"TableV2.Column.ActionBar","x-component":"TableV2.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{sync:{type:"void",title:'{{ t("Retry") }}',"x-component":"Action.Link","x-use-component-props":"useRetryActionProps","x-display":'{{ $record.status === "failed" ? "visible" : "hidden" }}'}}}}}}}}}}}}},N={type:"void",name:"userDataSyncSources","x-component":"CardItem","x-decorator":"TableBlockProvider","x-decorator-props":{collection:D.name,dragSort:!1,action:"list",params:{pageSize:10},showIndex:!0},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{delete:{type:"void",title:'{{t("Delete")}}',"x-component":"Action","x-use-component-props":"useBulkDestroyActionProps","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"AddNew","x-component-props":{type:"primary"}}}},table:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{name:{type:"void",title:'{{t("Source name")}}',"x-component":"TableV2.Column",properties:{name:{type:"string","x-component":"CollectionField","x-pattern":"readPretty"}}},sourceType:{type:"void",title:'{{t("Type")}}',"x-component":"TableV2.Column",properties:{sourceType:{type:"string","x-component":"Select","x-pattern":"readPretty",enum:"{{ types }}"}}},enabled:{type:"void",title:'{{t("Enabled")}}',"x-component":"TableV2.Column",properties:{enabled:{type:"boolean","x-component":"CollectionField","x-pattern":"readPretty"}}},actions:{type:"void",title:'{{t("Actions")}}',"x-decorator":"TableV2.Column.ActionBar","x-component":"TableV2.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{sync:{type:"void",title:'{{ t("Sync") }}',"x-component":"Action.Link","x-use-component-props":"useSyncActionProps","x-display":'{{ $record.enabled ? "visible" : "hidden" }}'},tasks:{type:"void",title:'{{ t("Tasks") }}',"x-component":"Tasks","x-component-props":{type:"primary"},"x-display":'{{ $record.enabled ? "visible" : "hidden" }}'},edit:{type:"void",title:'{{t("Configure")}}',"x-component":"Action.Link","x-component-props":{type:"primary",openMode:"drawer"},properties:{drawer:{type:"void","x-component":"Action.Drawer",title:'{{t("Configure")}}',properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useEditFormProps",properties:{name:{"x-component":"CollectionField","x-decorator":"FormItem"},sourceType:{"x-component":"CollectionField","x-decorator":"FormItem","x-component-props":{options:"{{ types }}"}},enabled:{"x-component":"CollectionField","x-decorator":"FormItem"},options:{type:"object","x-component":"Options"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{submit:{title:'{{t("Submit")}}',"x-component":"Action","x-use-component-props":"useSubmitActionProps","x-component-props":{type:"primary"}}}}}}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-use-component-props":"useDeleteActionProps"}}}}}}}}},v=a.createContext({type:""});v.displayName="SourceTypeContext";const A=a.createContext({types:[]});A.displayName="SourceTypesContext";const E=()=>{const{types:t}=a.useContext(A);return t},M=t=>{const s=e.useCollectionRecordData(),n=e.useRequest(()=>Promise.resolve({data:C({},s.options)}),P(C({},t),{manual:!0})),{run:i}=n,p=e.useActionContext();return a.useEffect(()=>{p.visible&&i()},[p.visible,i]),n},K=t=>{var i;const n=e.usePlugin(h).sourceTypes.get(t);return(i=n==null?void 0:n.components)==null?void 0:i.AdminSettingsForm},j=u.observer(()=>{const t=u.useForm(),s=e.useCollectionRecordData(),n=K(t.values.sourceType||s.sourceType);return n?r.jsx(n,{}):null},{displayName:"Options"}),O=()=>{const t=e.useCollectionRecordData();return{form:a.useMemo(()=>y.createForm({values:t}),[])}},_=()=>{const{setVisible:t}=e.useActionContext(),{message:s}=m.App.useApp(),n=u.useForm(),i=e.useDataBlockResource(),{runAsync:p}=e.useDataBlockRequest(),x=e.useCollection();return{type:"primary",onClick(){return f(this,null,function*(){yield n.submit();const l=n.values;l[x.filterTargetKey]?yield i.update({values:l,filterByTk:l[x.filterTargetKey]}):yield i.create({values:l}),yield p(),s.success("Saved successfully"),t(!1)})}}};function L(){const{message:t}=m.App.useApp(),s=e.useCollectionRecordData(),n=e.useDataBlockResource(),i=e.useCollection(),{runAsync:p}=e.useDataBlockRequest();return{confirm:{title:"Delete",content:"Are you sure you want to delete it?"},onClick(){return f(this,null,function*(){yield n.destroy({filterByTk:s[i.filterTargetKey]}),yield p(),t.success("Deleted!")})}}}function z(){const{message:t}=m.App.useApp(),s=e.useCollectionRecordData(),n=e.useAPIClient(),{runAsync:i}=e.useDataBlockRequest();return{onClick(){return f(this,null,function*(){yield n.resource("userData").pull({name:s.name}),yield i(),t.success("Synced!")})}}}const U=()=>{const{type:t}=a.useContext(v);return{form:a.useMemo(()=>y.createForm({initialValues:{sourceType:t}}),[])}},R=()=>{const t=e.useCollectionRecordData(),s=e.useCollection();return{params:{pageSize:20,filter:{sourceId:t[s.filterTargetKey]},sort:["-sort"]}}};function G(){const{message:t}=m.App.useApp(),s=e.useCollectionRecordData();e.useDataBlockResource();const n=e.useCollection(),i=e.useAPIClient(),{runAsync:p}=e.useDataBlockRequest();return{onClick(){return f(this,null,function*(){yield i.resource("userData").retry({id:s[n.filterTargetKey],sourceId:s.sourceId}),yield p(),t.success("Successfully")})}}}const H=()=>{const{t}=T(),s=e.useAPIClient(),[n,i]=a.useState(!1),[p,x]=a.useState(""),b=E(),l=b.map(F=>P(C({},F),{onClick:()=>{i(!0),x(F.value)}})),W=[{key:"__empty__",label:r.jsx(m.Empty,{image:m.Empty.PRESENTED_IMAGE_SIMPLE,description:r.jsxs(r.Fragment,{children:[t("No user data source plugin installed",{ns:S}),r.jsx("br",{})," ",r.jsx("a",{target:"_blank",href:s.auth.locale==="zh-CN"?"https://docs-cn.nocobase.com/handbook/user-data-sync":"https://docs.nocobase.com/handbook/user-data-sync",rel:"noreferrer",children:t("View documentation",{ns:S})})]})}),onClick:()=>{}}];return r.jsx(e.ActionContextProvider,{value:{visible:n,setVisible:i},children:r.jsxs(v.Provider,{value:{type:p},children:[r.jsx(m.Dropdown,{menu:{items:l&&l.length>0?l:W},children:r.jsxs(m.Button,{icon:r.jsx(d.PlusOutlined,{}),type:"primary",children:[t("Add new")," ",r.jsx(d.DownOutlined,{})]})}),r.jsx(e.SchemaComponent,{scope:{types:b,setType:x,useCustomFormProps:U},schema:q})]})})},J=()=>{const{t}=T(),[s,n]=a.useState(!1);return r.jsxs(e.ActionContextProvider,{value:{visible:s,setVisible:n},children:[r.jsx(m.Button,{type:"link",onClick:()=>{n(!0)},children:t("Tasks")}),r.jsx(e.ExtendCollectionsProvider,{collections:[w],children:r.jsx(e.SchemaComponent,{scope:{useRetryActionProps:G,useTasksTableBlockProps:R},schema:V})})]})},Q=()=>{const{t}=T(),[s,n]=a.useState([]),i=e.useAPIClient();return e.useRequest(()=>i.resource("userData").listSyncTypes().then(p=>{var b;return(((b=p==null?void 0:p.data)==null?void 0:b.data)||[]).map(l=>({key:l.name,label:u.Schema.compile(l.title||l.name,{t}),value:l.name}))}),{onSuccess:p=>{n(p)}}),r.jsx(A.Provider,{value:{types:s},children:r.jsx(e.ExtendCollectionsProvider,{collections:[D],children:r.jsx(e.SchemaComponent,{schema:N,components:{AddNew:H,Options:j,Tasks:J},scope:{types:s,t,useEditFormProps:O,useSubmitActionProps:_,useDeleteActionProps:L,useSyncActionProps:z,useValuesFromOptions:M}})})})};class h extends e.Plugin{constructor(){super(...arguments);B(this,"sourceTypes",new c.Registry)}registerType(n,i){this.sourceTypes.register(n,i)}load(){return f(this,null,function*(){this.app.pluginSettingsManager.add("users-permissions.sync",{title:c.tval("Synchronize",{ns:S}),icon:"SyncOutlined",Component:Q,sort:99,aclSnippet:"pm.user-data-sync"})})}}o.PluginUserDataSyncClient=h,o.default=h,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
@@ -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
|
+
export declare const NAMESPACE = "user-data-sync";
|
|
10
|
+
export declare function useUserDataSyncSourceTranslation(): import("react-i18next").UseTranslationResponse<("user-data-sync" | "client")[], undefined>;
|
|
@@ -0,0 +1,155 @@
|
|
|
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 { ISchema } from '@nocobase/client';
|
|
10
|
+
export declare const sourceCollection: {
|
|
11
|
+
name: string;
|
|
12
|
+
sortable: boolean;
|
|
13
|
+
filterTargetKey: string;
|
|
14
|
+
fields: ({
|
|
15
|
+
name: string;
|
|
16
|
+
type: string;
|
|
17
|
+
interface: string;
|
|
18
|
+
uiSchema?: undefined;
|
|
19
|
+
allowNull?: undefined;
|
|
20
|
+
} | {
|
|
21
|
+
interface: string;
|
|
22
|
+
type: string;
|
|
23
|
+
name: string;
|
|
24
|
+
uiSchema: {
|
|
25
|
+
type: string;
|
|
26
|
+
title: string;
|
|
27
|
+
'x-component': string;
|
|
28
|
+
required: boolean;
|
|
29
|
+
dataSource?: undefined;
|
|
30
|
+
};
|
|
31
|
+
allowNull?: undefined;
|
|
32
|
+
} | {
|
|
33
|
+
interface: string;
|
|
34
|
+
type: string;
|
|
35
|
+
name: string;
|
|
36
|
+
allowNull: boolean;
|
|
37
|
+
uiSchema: {
|
|
38
|
+
type: string;
|
|
39
|
+
title: string;
|
|
40
|
+
'x-component': string;
|
|
41
|
+
required: boolean;
|
|
42
|
+
dataSource: string;
|
|
43
|
+
};
|
|
44
|
+
} | {
|
|
45
|
+
type: string;
|
|
46
|
+
name: string;
|
|
47
|
+
uiSchema: {
|
|
48
|
+
type: string;
|
|
49
|
+
title: string;
|
|
50
|
+
'x-component': string;
|
|
51
|
+
required?: undefined;
|
|
52
|
+
dataSource?: undefined;
|
|
53
|
+
};
|
|
54
|
+
interface?: undefined;
|
|
55
|
+
allowNull?: undefined;
|
|
56
|
+
})[];
|
|
57
|
+
};
|
|
58
|
+
export declare const taskCollection: {
|
|
59
|
+
name: string;
|
|
60
|
+
filterTargetKey: string;
|
|
61
|
+
fields: ({
|
|
62
|
+
name: string;
|
|
63
|
+
type: string;
|
|
64
|
+
interface: string;
|
|
65
|
+
allowNull?: undefined;
|
|
66
|
+
uiSchema?: undefined;
|
|
67
|
+
target?: undefined;
|
|
68
|
+
targetKey?: undefined;
|
|
69
|
+
foreignKey?: undefined;
|
|
70
|
+
} | {
|
|
71
|
+
name: string;
|
|
72
|
+
interface: string;
|
|
73
|
+
type: string;
|
|
74
|
+
allowNull: boolean;
|
|
75
|
+
uiSchema: {
|
|
76
|
+
type: string;
|
|
77
|
+
title: string;
|
|
78
|
+
'x-component': string;
|
|
79
|
+
required: boolean;
|
|
80
|
+
'x-component-props'?: undefined;
|
|
81
|
+
'x-read-pretty'?: undefined;
|
|
82
|
+
enum?: undefined;
|
|
83
|
+
};
|
|
84
|
+
target?: undefined;
|
|
85
|
+
targetKey?: undefined;
|
|
86
|
+
foreignKey?: undefined;
|
|
87
|
+
} | {
|
|
88
|
+
name: string;
|
|
89
|
+
interface: string;
|
|
90
|
+
type: string;
|
|
91
|
+
target: string;
|
|
92
|
+
targetKey: string;
|
|
93
|
+
foreignKey: string;
|
|
94
|
+
allowNull: boolean;
|
|
95
|
+
uiSchema: {
|
|
96
|
+
type: string;
|
|
97
|
+
title: string;
|
|
98
|
+
'x-component': string;
|
|
99
|
+
'x-component-props': {
|
|
100
|
+
fieldNames: {
|
|
101
|
+
value: string;
|
|
102
|
+
label: string;
|
|
103
|
+
};
|
|
104
|
+
precision?: undefined;
|
|
105
|
+
};
|
|
106
|
+
required: boolean;
|
|
107
|
+
'x-read-pretty': boolean;
|
|
108
|
+
enum?: undefined;
|
|
109
|
+
};
|
|
110
|
+
} | {
|
|
111
|
+
name: string;
|
|
112
|
+
interface: string;
|
|
113
|
+
type: string;
|
|
114
|
+
allowNull: boolean;
|
|
115
|
+
uiSchema: {
|
|
116
|
+
type: string;
|
|
117
|
+
title: string;
|
|
118
|
+
'x-component': string;
|
|
119
|
+
required: boolean;
|
|
120
|
+
enum: {
|
|
121
|
+
label: string;
|
|
122
|
+
value: string;
|
|
123
|
+
color: string;
|
|
124
|
+
}[];
|
|
125
|
+
'x-component-props'?: undefined;
|
|
126
|
+
'x-read-pretty'?: undefined;
|
|
127
|
+
};
|
|
128
|
+
target?: undefined;
|
|
129
|
+
targetKey?: undefined;
|
|
130
|
+
foreignKey?: undefined;
|
|
131
|
+
} | {
|
|
132
|
+
name: string;
|
|
133
|
+
interface: string;
|
|
134
|
+
type: string;
|
|
135
|
+
allowNull: boolean;
|
|
136
|
+
uiSchema: {
|
|
137
|
+
type: string;
|
|
138
|
+
title: string;
|
|
139
|
+
'x-component': string;
|
|
140
|
+
'x-component-props': {
|
|
141
|
+
precision: number;
|
|
142
|
+
fieldNames?: undefined;
|
|
143
|
+
};
|
|
144
|
+
required: boolean;
|
|
145
|
+
'x-read-pretty'?: undefined;
|
|
146
|
+
enum?: undefined;
|
|
147
|
+
};
|
|
148
|
+
target?: undefined;
|
|
149
|
+
targetKey?: undefined;
|
|
150
|
+
foreignKey?: undefined;
|
|
151
|
+
})[];
|
|
152
|
+
};
|
|
153
|
+
export declare const createFormSchema: ISchema;
|
|
154
|
+
export declare const tasksTableBlockSchema: ISchema;
|
|
155
|
+
export declare const userDataSyncSourcesSchema: ISchema;
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
/// <reference types="react" />
|
|
10
|
+
export declare const SourceTypeContext: import("react").Context<{
|
|
11
|
+
type: string;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const SourceTypesContext: import("react").Context<{
|
|
14
|
+
types: {
|
|
15
|
+
key: string;
|
|
16
|
+
label: string;
|
|
17
|
+
value: string;
|
|
18
|
+
}[];
|
|
19
|
+
}>;
|
|
20
|
+
export declare const useSourceTypes: () => {
|
|
21
|
+
key: string;
|
|
22
|
+
label: string;
|
|
23
|
+
value: string;
|
|
24
|
+
}[];
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
module.exports = {
|
|
11
|
+
"react": "18.2.0",
|
|
12
|
+
"@formily/react": "2.3.0",
|
|
13
|
+
"@nocobase/client": "1.4.0-alpha.20240826214041",
|
|
14
|
+
"antd": "5.12.8",
|
|
15
|
+
"@ant-design/icons": "5.2.6",
|
|
16
|
+
"@formily/core": "2.3.0",
|
|
17
|
+
"@nocobase/utils": "1.4.0-alpha.20240826214041",
|
|
18
|
+
"@nocobase/server": "1.4.0-alpha.20240826214041",
|
|
19
|
+
"@nocobase/logger": "1.4.0-alpha.20240826214041",
|
|
20
|
+
"@nocobase/actions": "1.4.0-alpha.20240826214041",
|
|
21
|
+
"dayjs": "1.11.10",
|
|
22
|
+
"@nocobase/database": "1.4.0-alpha.20240826214041",
|
|
23
|
+
"react-i18next": "11.18.6"
|
|
24
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -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
|
+
export * from './server';
|
|
10
|
+
export { default, UserDataResource, FormatUser, SyncAccept, OriginRecord } from './server';
|
package/dist/index.js
ADDED
|
@@ -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 src_exports = {};
|
|
39
|
+
__export(src_exports, {
|
|
40
|
+
FormatUser: () => import_server.FormatUser,
|
|
41
|
+
OriginRecord: () => import_server.OriginRecord,
|
|
42
|
+
SyncAccept: () => import_server.SyncAccept,
|
|
43
|
+
UserDataResource: () => import_server.UserDataResource,
|
|
44
|
+
default: () => import_server.default
|
|
45
|
+
});
|
|
46
|
+
module.exports = __toCommonJS(src_exports);
|
|
47
|
+
__reExport(src_exports, require("./server"), module.exports);
|
|
48
|
+
var import_server = __toESM(require("./server"));
|
|
49
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
+
0 && (module.exports = {
|
|
51
|
+
FormatUser,
|
|
52
|
+
OriginRecord,
|
|
53
|
+
SyncAccept,
|
|
54
|
+
UserDataResource,
|
|
55
|
+
...require("./server")
|
|
56
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Synchronize": "Synchronize",
|
|
3
|
+
"Source name": "Source name",
|
|
4
|
+
"Source display name": "Source display name",
|
|
5
|
+
"Type": "Type",
|
|
6
|
+
"Sync": "Sync",
|
|
7
|
+
"Tasks": "Tasks",
|
|
8
|
+
"Batch": "Batch",
|
|
9
|
+
"Status": "Status",
|
|
10
|
+
"Message": "Message",
|
|
11
|
+
"Init": "Init",
|
|
12
|
+
"Processing": "Processing",
|
|
13
|
+
"Success": "Success",
|
|
14
|
+
"Failed": "Failed",
|
|
15
|
+
"Authenticator": "Authenticator",
|
|
16
|
+
"Retry": "Retry",
|
|
17
|
+
"No user data source plugin installed": "No user data source plugin installed",
|
|
18
|
+
"View documentation": "View documentation"
|
|
19
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Synchronize": "同步",
|
|
3
|
+
"Source name": "数据源名称",
|
|
4
|
+
"Source display name": "数据源展示名称",
|
|
5
|
+
"Type": "类型",
|
|
6
|
+
"Sync": "同步",
|
|
7
|
+
"Tasks": "任务",
|
|
8
|
+
"Batch": "批次",
|
|
9
|
+
"Status": "状态",
|
|
10
|
+
"Message": "信息",
|
|
11
|
+
"Init": "初始化",
|
|
12
|
+
"Processing": "进行中",
|
|
13
|
+
"Success": "成功",
|
|
14
|
+
"Failed": "失败",
|
|
15
|
+
"Authenticator": "用户认证",
|
|
16
|
+
"dingtalk": "钉钉",
|
|
17
|
+
"wecom": "企业微信",
|
|
18
|
+
"default": "默认",
|
|
19
|
+
"Retry": "重试",
|
|
20
|
+
"No user data source plugin installed": "未安装同步数据源",
|
|
21
|
+
"View documentation": "查看文档"
|
|
22
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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 { Context, Next } from '@nocobase/actions';
|
|
10
|
+
declare const _default: {
|
|
11
|
+
listSyncTypes: (ctx: Context, next: Next) => Promise<void>;
|
|
12
|
+
pull: (ctx: Context, next: Next) => Promise<void>;
|
|
13
|
+
push: (ctx: Context, next: Next) => Promise<void>;
|
|
14
|
+
retry: (ctx: Context, next: Next) => Promise<void>;
|
|
15
|
+
};
|
|
16
|
+
export default _default;
|
|
@@ -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;
|