@nocobase/plugin-user-data-sync 1.7.0-beta.2 → 1.7.0-beta.20

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 CHANGED
@@ -1,4 +1,4 @@
1
- Updated Date: February 20, 2025
1
+ Updated Date: April 1, 2025
2
2
 
3
3
  NocoBase License Agreement
4
4
 
@@ -88,7 +88,7 @@ Except for Third-Party Open Source Software, the Company owns all copyrights, tr
88
88
 
89
89
  6.6 Can sell plugins developed for Software in the Marketplace.
90
90
 
91
- 6.7 The User with an Enterprise Edition License can sell Upper Layer Application to their clients.
91
+ 6.7 The User with a Professional or Enterprise Edition License can sell Upper Layer Application to their clients.
92
92
 
93
93
  6.8 Not restricted by the AGPL-3.0 agreement.
94
94
 
@@ -106,9 +106,9 @@ Except for Third-Party Open Source Software, the Company owns all copyrights, tr
106
106
 
107
107
  7.4 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.
108
108
 
109
- 7.5 It is not allowed for the User withot an Enterprise Edition license to sell Upper Layer Application to clients without a Commercial license.
109
+ 7.5 It is not allowed for the User withot a Professional or Enterprise Edition license to sell Upper Layer Application to clients without a Commercial license.
110
110
 
111
- 7.6 It is not allowed for the User with an Enterprise Edition license to sell Upper Layer Application to clients without a Commercial license with access to further development and configuration.
111
+ 7.6 It is not allowed for the User with a Professional or Enterprise Edition license to sell Upper Layer Application to clients without a Commercial license with access to further development and configuration.
112
112
 
113
113
  7.7 It is not allowed to publicly sell plugins developed for Software outside of the Marketplace.
114
114
 
@@ -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
+ "use strict";(self.webpackChunk_nocobase_plugin_user_data_sync=self.webpackChunk_nocobase_plugin_user_data_sync||[]).push([["157"],{700:function(e,t,o){o.r(t),o.d(t,{UserDataSyncSource:function(){return N}});var n=o(482),r=o(563),c=o(505),i=o(772),a=o(721),s=o(156),l=o.n(s),u=o(60);function p(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},n=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),n.forEach(function(t){var n;n=o[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}var m=function(e){var t,o,n=(0,i.useCollectionRecordData)(),r=(0,i.useRequest)(function(){return Promise.resolve({data:p({},n.options)})},(t=p({},e),o=o={manual:!0},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):(function(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);o.push.apply(o,n)}return o})(Object(o)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}),t)),c=r.run,a=(0,i.useActionContext)();return(0,s.useEffect)(function(){a.visible&&c()},[a.visible,c]),r},y=function(e){var t,o=(0,i.usePlugin)(u.default).sourceTypes.get(e);return null==o||null==(t=o.components)?void 0:t.AdminSettingsForm},d=(0,c.observer)(function(){var e=(0,c.useForm)(),t=(0,i.useCollectionRecordData)(),o=y(e.values.sourceType||t.sourceType);return o?l().createElement(o,null):null},{displayName:"Options"}),f=o(573),b={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"}}]},v={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}}]},x={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"}}}}}}}}}},g={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:v.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":"Message"}}},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","x-component":"Retry"}}}}}}}}}}}}},h={type:"void",name:"userDataSyncSources","x-component":"CardItem","x-decorator":"TableBlockProvider","x-decorator-props":{collection:b.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"},tasks:{type:"void",title:'{{ t("Tasks") }}',"x-component":"Tasks","x-component-props":{type:"primary"}},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"}}}}}}}}},S=(0,s.createContext)({type:""});S.displayName="SourceTypeContext";var C=(0,s.createContext)({types:[]});function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=Array(t);o<t;o++)n[o]=e[o];return n}function w(e,t,o,n,r,c,i){try{var a=e[c](i),s=a.value}catch(e){o(e);return}a.done?t(s):Promise.resolve(s).then(n,r)}function A(e){return function(){var t=this,o=arguments;return new Promise(function(n,r){var c=e.apply(t,o);function i(e){w(c,n,r,i,a,"next",e)}function a(e){w(c,n,r,i,a,"throw",e)}i(void 0)})}}function k(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var o,n,r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var c=[],i=!0,a=!1;try{for(r=r.call(e);!(i=(o=r.next()).done)&&(c.push(o.value),!t||c.length!==t);i=!0);}catch(e){a=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(a)throw n}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return P(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);if("Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o)return Array.from(o);if("Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return P(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function T(e,t){var o,n,r,c,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return c={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function a(c){return function(a){var s=[c,a];if(o)throw TypeError("Generator is already executing.");for(;i;)try{if(o=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,n=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){i.label=s[1];break}if(6===s[0]&&i.label<r[1]){i.label=r[1],r=s;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(s);break}r[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],n=0}finally{o=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}C.displayName="SourceTypesContext";var O=function(){var e=(0,i.useCollectionRecordData)();return{form:(0,s.useMemo)(function(){return(0,r.createForm)({values:e})},[])}},D=function(){var e=(0,i.useActionContext)().setVisible,t=(0,c.useForm)(),o=(0,i.useDataBlockResource)(),n=(0,i.useDataBlockRequestGetter)().getDataBlockRequest,r=(0,i.useCollection)();return{type:"primary",onClick:function(){return A(function(){var c,i;return T(this,function(a){switch(a.label){case 0:return[4,t.submit()];case 1:if(a.sent(),!(i=t.values)[r.filterTargetKey])return[3,3];return[4,o.update({values:i,filterByTk:i[r.filterTargetKey]})];case 2:return a.sent(),[3,5];case 3:return[4,o.create({values:i})];case 4:a.sent(),a.label=5;case 5:return[4,null==(c=n())?void 0:c.runAsync()];case 6:return a.sent(),e(!1),[2]}})})()}}};function E(){var e=(0,i.useCollectionRecordData)(),t=(0,i.useDataBlockResource)(),o=(0,i.useCollection)(),n=(0,i.useDataBlockRequestGetter)().getDataBlockRequest,r=(0,f.S)().t;return{confirm:{title:r("Delete",{ns:f.A}),content:r("Are you sure you want to delete it?",{ns:f.A})},onClick:function(){return A(function(){var r;return T(this,function(c){switch(c.label){case 0:return[4,t.destroy({filterByTk:e[o.filterTargetKey]})];case 1:return c.sent(),[4,null==(r=n())?void 0:r.runAsync()];case 2:return c.sent(),[2]}})})()}}}function j(){var e=a.App.useApp().message,t=(0,i.useCollectionRecordData)(),o=(0,i.useAPIClient)(),n=(0,i.useDataBlockRequestGetter)().getDataBlockRequest,r=(0,f.S)().t;return{hidden:!(null==t?void 0:t.enabled),onClick:function(){return A(function(){var c;return T(this,function(i){switch(i.label){case 0:return[4,o.resource("userData").pull({name:t.name})];case 1:return i.sent(),[4,null==(c=n())?void 0:c.runAsync()];case 2:return i.sent(),e.success(r("The synchronization has started. You can click on 'Tasks' to view the synchronization status.",{ns:f.A})),[2]}})})()}}}var F=function(){var e=(0,s.useContext)(S).type;return{form:(0,s.useMemo)(function(){return(0,r.createForm)({initialValues:{sourceType:e}})},[])}},I=function(){return{params:{pageSize:20,filter:{sourceId:(0,i.useCollectionRecordData)()[(0,i.useCollection)().filterTargetKey]},sort:["-sort"]}}};function R(){var e=(0,i.useCollectionRecordData)(),t=(0,i.useCollection)(),o=(0,i.useAPIClient)(),n=(0,i.useDataBlockRequestGetter)().getDataBlockRequest;return{onClick:function(){return A(function(){var r;return T(this,function(c){switch(c.label){case 0:return[4,o.resource("userData").retry({id:e[t.filterTargetKey],sourceId:e.sourceId})];case 1:return c.sent(),[4,null==(r=n())?void 0:r.runAsync()];case 2:return c.sent(),[2]}})})()}}}var B=function(){var e=(0,f.S)().t,t=(0,i.useAPIClient)(),o=k((0,s.useState)(!1),2),r=o[0],c=o[1],u=k((0,s.useState)(""),2),p=u[0],m=u[1],y=(0,s.useContext)(C).types,d=y.map(function(e){var t,o;return t=function(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},n=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),n.forEach(function(t){var n;n=o[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},e),o=o={onClick:function(){c(!0),m(e.value)}},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):(function(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);o.push.apply(o,n)}return o})(Object(o)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}),t}),b=[{key:"__empty__",label:l().createElement(a.Empty,{image:a.Empty.PRESENTED_IMAGE_SIMPLE,description:l().createElement(l().Fragment,null,e("No user data source plugin installed",{ns:f.A}),l().createElement("br",null)," ",l().createElement("a",{target:"_blank",href:"zh-CN"===t.auth.locale?"https://docs-cn.nocobase.com/handbook/user-data-sync":"https://docs.nocobase.com/handbook/user-data-sync",rel:"noreferrer"},e("View documentation",{ns:f.A})))}),onClick:function(){}}];return l().createElement(i.ActionContextProvider,{value:{visible:r,setVisible:c}},l().createElement(S.Provider,{value:{type:p}},l().createElement(a.Dropdown,{menu:{items:d&&d.length>0?d:b}},l().createElement(a.Button,{icon:l().createElement(n.PlusOutlined,null),type:"primary"},e("Add new")," ",l().createElement(n.DownOutlined,null))),l().createElement(i.SchemaComponent,{scope:{types:y,setType:m,useCustomFormProps:F},schema:x})))},V=function(){var e=(0,f.S)().t,t=(0,i.useCollectionRecordData)();return l().createElement(i.ReadPretty.Input,{value:e(t.message),ellipsis:!0})},q=function(){var e=(0,i.useCollectionRecordData)(),t=(0,f.S)().t,o=k((0,s.useState)(!1),2),n=o[0],r=o[1];return e.enabled?l().createElement(i.ActionContextProvider,{value:{visible:n,setVisible:r}},l().createElement(a.Button,{type:"link",onClick:function(){r(!0)}},t("Tasks")),l().createElement(i.ExtendCollectionsProvider,{collections:[v]},l().createElement(i.SchemaComponent,{scope:{useRetryActionProps:R,useTasksTableBlockProps:I,t:t},components:{Message:V},schema:g}))):null},_=function(){var e=(0,f.S)().t;return"failed"!==(0,i.useCollectionRecordData)().status?null:l().createElement(i.SchemaComponent,{scope:{t:e},schema:{type:"void",properties:{retry:{title:'{{ t("Retry") }}',"x-component":"Action.Link","x-use-component-props":"useRetryActionProps"}}}})},N=function(){var e=(0,f.S)().t,t=k((0,s.useState)([]),2),o=t[0],n=t[1],r=(0,i.useAPIClient)();return(0,i.useRequest)(function(){return r.resource("userData").listSyncTypes().then(function(t){var o;return((null==t||null==(o=t.data)?void 0:o.data)||[]).map(function(t){return{key:t.name,label:c.Schema.compile(t.title||t.name,{t:e}),value:t.name}})})},{onSuccess:function(e){n(e)}}),l().createElement(C.Provider,{value:{types:o}},l().createElement(i.ExtendCollectionsProvider,{collections:[b]},l().createElement(i.SchemaComponent,{schema:h,components:{AddNew:B,Options:d,Tasks:q,Retry:_},scope:{types:o,t:e,useEditFormProps:O,useSubmitActionProps:D,useDeleteActionProps:E,useSyncActionProps:j,useValuesFromOptions:m}})))}}}]);
@@ -7,4 +7,4 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@nocobase/utils/client"),require("@nocobase/client"),require("@formily/core"),require("antd"),require("@ant-design/icons"),require("@formily/react"),require("react")):"function"==typeof define&&define.amd?define("@nocobase/plugin-user-data-sync",["react-i18next","@nocobase/utils/client","@nocobase/client","@formily/core","antd","@ant-design/icons","@formily/react","react"],t):"object"==typeof exports?exports["@nocobase/plugin-user-data-sync"]=t(require("react-i18next"),require("@nocobase/utils/client"),require("@nocobase/client"),require("@formily/core"),require("antd"),require("@ant-design/icons"),require("@formily/react"),require("react")):e["@nocobase/plugin-user-data-sync"]=t(e["react-i18next"],e["@nocobase/utils/client"],e["@nocobase/client"],e["@formily/core"],e.antd,e["@ant-design/icons"],e["@formily/react"],e.react)}(self,function(e,t,n,r,o,i,u,c){return function(){var a,s,l,f,p,d,y={60:function(e,t,n){"use strict";n.r(t),n.d(t,{PluginUserDataSyncClient:function(){return b}});var r=n(772),o=n(584),i=n(573),u=n(581);function c(e,t,n,r,o,i,u){try{var c=e[i](u),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}function a(e,t,n){return(a=d()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&f(o,n.prototype),o}).apply(null,arguments)}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(e){var t="function"==typeof Map?new Map:void 0;return(p=function(e){var n;if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return a(e,arguments,l(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),f(r,e)})(e)}function d(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(d=function(){return!!e})()}var y=(0,r.lazy)(function(){return u("imported_-1c4lqme_component",n.e("157").then(n.bind(n,700)))},"UserDataSyncSource").UserDataSyncSource,b=function(e){var t,n,r;function u(){var e,t,n,r,i,c,a;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,u),t=this,n=u,r=arguments,n=l(n),i=e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(t,d()?Reflect.construct(n,r||[],l(t).constructor):n.apply(t,r)),c="sourceTypes",a=new o.Registry,c in i?Object.defineProperty(i,c,{value:a,enumerable:!0,configurable:!0,writable:!0}):i[c]=a,e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&f(e,t)}(u,e),t=u,n=[{key:"registerType",value:function(e,t){this.sourceTypes.register(e,t)}},{key:"load",value:function(){var e,t=this;return(e=function(){return function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}(this,function(e){return t.app.pluginSettingsManager.add("users-permissions.sync",{title:(0,o.tval)("Synchronize",{ns:i.A}),icon:"SyncOutlined",Component:y,sort:99,aclSnippet:"pm.user-data-sync"}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function u(e){c(i,r,o,u,a,"next",e)}function a(e){c(i,r,o,u,a,"throw",e)}u(void 0)})})()}}],s(t.prototype,n),u}(p(r.Plugin));t.default=b},573:function(e,t,n){"use strict";n.d(t,{A:function(){return o},S:function(){return i}});var r=n(238),o="user-data-sync";function i(){return(0,r.useTranslation)([o,"client"],{nsMode:"fallback"})}},581:function(e){e.exports=function(e,t){return"undefined"!=typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(e,t),t}},482:function(e){"use strict";e.exports=i},563:function(e){"use strict";e.exports=r},505:function(e){"use strict";e.exports=u},772:function(e){"use strict";e.exports=n},584:function(e){"use strict";e.exports=t},721:function(e){"use strict";e.exports=o},156:function(e){"use strict";e.exports=c},238:function(t){"use strict";t.exports=e}},b={};function h(e){var t=b[e];if(void 0!==t)return t.exports;var n=b[e]={exports:{}};return y[e](n,n.exports,h),n.exports}return h.m=y,h.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return h.d(t,{a:t}),t},h.d=function(e,t){for(var n in t)h.o(t,n)&&!h.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},h.f={},h.e=function(e){return Promise.all(Object.keys(h.f).reduce(function(t,n){return h.f[n](e,t),t},[]))},h.u=function(e){return"4dfc6081fd6cc6eb.js"},h.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),h.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a={},s="@nocobase/plugin-user-data-sync:",h.l=function(e,t,n,r){if(a[e]){a[e].push(t);return}if(void 0!==n){for(var o,i,u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var l=u[c];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==s+n){o=l;break}}}!o&&(i=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,h.nc&&o.setAttribute("nonce",h.nc),o.setAttribute("data-webpack",s+n),o.src=e),a[e]=[t];var f=function(t,n){o.onerror=o.onload=null,clearTimeout(p);var r=a[e];if(delete a[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},p=setTimeout(f.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=f.bind(null,o.onerror),o.onload=f.bind(null,o.onload),i&&document.head.appendChild(o)},h.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},h.p=(!(l=window.__nocobase_public_path__||"/").endsWith("/")&&(l+="/"),l+"static/plugins/@nocobase/plugin-user-data-sync/dist/client/"),f={909:0},h.f.j=function(e,t){var n=h.o(f,e)?f[e]:void 0;if(0!==n){if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=f[e]=[t,r]});t.push(n[2]=r);var o=h.p+h.u(e),i=Error();h.l(o,function(t){if(h.o(f,e)&&(0!==(n=f[e])&&(f[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}}},p=function(e,t){var n=t[0],r=t[1],o=t[2],i,u,c=0;if(n.some(function(e){return 0!==f[e]})){for(i in r)h.o(r,i)&&(h.m[i]=r[i]);o&&o(h)}for(e&&e(t);c<n.length;c++)u=n[c],h.o(f,u)&&f[u]&&f[u][0](),f[u]=0},(d=self.webpackChunk_nocobase_plugin_user_data_sync=self.webpackChunk_nocobase_plugin_user_data_sync||[]).forEach(p.bind(null,0)),d.push=p.bind(null,d.push.bind(d)),h("60")}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@formily/core"),require("@nocobase/client"),require("react"),require("@formily/react"),require("@nocobase/utils/client"),require("@ant-design/icons"),require("antd"),require("react-i18next")):"function"==typeof define&&define.amd?define("@nocobase/plugin-user-data-sync",["@formily/core","@nocobase/client","react","@formily/react","@nocobase/utils/client","@ant-design/icons","antd","react-i18next"],t):"object"==typeof exports?exports["@nocobase/plugin-user-data-sync"]=t(require("@formily/core"),require("@nocobase/client"),require("react"),require("@formily/react"),require("@nocobase/utils/client"),require("@ant-design/icons"),require("antd"),require("react-i18next")):e["@nocobase/plugin-user-data-sync"]=t(e["@formily/core"],e["@nocobase/client"],e.react,e["@formily/react"],e["@nocobase/utils/client"],e["@ant-design/icons"],e.antd,e["react-i18next"])}(self,function(e,t,n,r,o,i,u,c){return function(){var a,s,l,f,p,d,y={60:function(e,t,n){"use strict";n.r(t),n.d(t,{PluginUserDataSyncClient:function(){return y}});var r=n(772),o=n(584),i=n(573),u=n(581);function c(e,t,n,r,o,i,u){try{var c=e[i](u),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}function a(e,t,n){return(a=p()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&l(o,n.prototype),o}).apply(null,arguments)}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e){var t="function"==typeof Map?new Map:void 0;return(f=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return a(e,arguments,s(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),l(n,e)})(e)}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(p=function(){return!!e})()}var d=(0,r.lazy)(function(){return u("imported_-1c4lqme_component",n.e("157").then(n.bind(n,700)))},"UserDataSyncSource").UserDataSyncSource,y=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t,r,i,u,c;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=s(t),i=e=function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,p()?Reflect.construct(t,r||[],s(this).constructor):t.apply(this,r)),u="sourceTypes",c=new o.Registry,u in i?Object.defineProperty(i,u,{value:c,enumerable:!0,configurable:!0,writable:!0}):i[u]=c,e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&l(n,e),t=[{key:"registerType",value:function(e,t){this.sourceTypes.register(e,t)}},{key:"load",value:function(){var e,t=this;return(e=function(){return function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){var a=[i,c];if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}}(this,function(e){return t.app.pluginSettingsManager.add("users-permissions.sync",{title:(0,o.tval)("Synchronize",{ns:i.A}),icon:"SyncOutlined",Component:d,sort:99,aclSnippet:"pm.user-data-sync"}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function u(e){c(i,r,o,u,a,"next",e)}function a(e){c(i,r,o,u,a,"throw",e)}u(void 0)})})()}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(f(r.Plugin));t.default=y},573:function(e,t,n){"use strict";n.d(t,{A:function(){return o},S:function(){return i}});var r=n(238),o="user-data-sync";function i(){return(0,r.useTranslation)([o,"client"],{nsMode:"fallback"})}},581:function(e){e.exports=function(e,t){return"undefined"!=typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(e,t),t}},482:function(e){"use strict";e.exports=i},563:function(t){"use strict";t.exports=e},505:function(e){"use strict";e.exports=r},772:function(e){"use strict";e.exports=t},584:function(e){"use strict";e.exports=o},721:function(e){"use strict";e.exports=u},156:function(e){"use strict";e.exports=n},238:function(e){"use strict";e.exports=c}},b={};function h(e){var t=b[e];if(void 0!==t)return t.exports;var n=b[e]={exports:{}};return y[e](n,n.exports,h),n.exports}return h.m=y,h.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return h.d(t,{a:t}),t},h.d=function(e,t){for(var n in t)h.o(t,n)&&!h.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},h.f={},h.e=function(e){return Promise.all(Object.keys(h.f).reduce(function(t,n){return h.f[n](e,t),t},[]))},h.u=function(e){return"92b76c0021d6259c.js"},h.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),h.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a={},s="@nocobase/plugin-user-data-sync:",h.l=function(e,t,n,r){if(a[e])return void a[e].push(t);if(void 0!==n)for(var o,i,u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var l=u[c];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==s+n){o=l;break}}o||(i=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,h.nc&&o.setAttribute("nonce",h.nc),o.setAttribute("data-webpack",s+n),o.src=e),a[e]=[t];var f=function(t,n){o.onerror=o.onload=null,clearTimeout(p);var r=a[e];if(delete a[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},p=setTimeout(f.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=f.bind(null,o.onerror),o.onload=f.bind(null,o.onload),i&&document.head.appendChild(o)},h.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(l=window.__nocobase_public_path__||"/").endsWith("/")||(l+="/"),h.p=l+"static/plugins/@nocobase/plugin-user-data-sync/dist/client/",f={909:0},h.f.j=function(e,t){var n=h.o(f,e)?f[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=f[e]=[t,r]});t.push(n[2]=r);var o=h.p+h.u(e),i=Error();h.l(o,function(t){if(h.o(f,e)&&(0!==(n=f[e])&&(f[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},p=function(e,t){var n,r,o=t[0],i=t[1],u=t[2],c=0;if(o.some(function(e){return 0!==f[e]})){for(n in i)h.o(i,n)&&(h.m[n]=i[n]);u&&u(h)}for(e&&e(t);c<o.length;c++)r=o[c],h.o(f,r)&&f[r]&&f[r][0](),f[r]=0},(d=self.webpackChunk_nocobase_plugin_user_data_sync=self.webpackChunk_nocobase_plugin_user_data_sync||[]).forEach(p.bind(null,0)),d.push=p.bind(null,d.push.bind(d)),h(60)}()});
@@ -10,15 +10,15 @@
10
10
  module.exports = {
11
11
  "react": "18.2.0",
12
12
  "@formily/react": "2.3.0",
13
- "@nocobase/client": "1.7.0-beta.2",
13
+ "@nocobase/client": "1.7.0-beta.20",
14
14
  "@ant-design/icons": "5.6.1",
15
15
  "@formily/core": "2.3.0",
16
- "antd": "5.12.8",
17
- "@nocobase/utils": "1.7.0-beta.2",
18
- "@nocobase/server": "1.7.0-beta.2",
19
- "@nocobase/logger": "1.7.0-beta.2",
20
- "@nocobase/actions": "1.7.0-beta.2",
21
- "dayjs": "1.11.10",
22
- "@nocobase/database": "1.7.0-beta.2",
16
+ "antd": "5.24.2",
17
+ "@nocobase/utils": "1.7.0-beta.20",
18
+ "@nocobase/server": "1.7.0-beta.20",
19
+ "@nocobase/logger": "1.7.0-beta.20",
20
+ "@nocobase/actions": "1.7.0-beta.20",
21
+ "dayjs": "1.11.13",
22
+ "@nocobase/database": "1.7.0-beta.20",
23
23
  "react-i18next": "11.18.6"
24
24
  };
@@ -1,21 +1,22 @@
1
1
  {
2
- "Synchronize": "Synchronize",
3
- "Source name": "Source name",
4
- "Source display name": "Source display name",
2
+ "Synchronize": "Synchroniseren",
3
+ "Source name": "Bronnaam",
4
+ "Source display name": "Weergavenaam van de bron",
5
5
  "Type": "Type",
6
- "Sync": "Sync",
7
- "Tasks": "Tasks",
6
+ "Sync": "Synchroniseren",
7
+ "Tasks": "Taken",
8
8
  "Batch": "Batch",
9
9
  "Status": "Status",
10
- "Message": "Message",
11
- "Init": "Init",
12
- "Processing": "Processing",
13
- "Success": "Success",
14
- "Failed": "Failed",
10
+ "Message": "Bericht",
11
+ "Init": "Initialiseren",
12
+ "Processing": "Verwerken",
13
+ "Success": "Succes",
14
+ "Failed": "Mislukt",
15
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
- "The synchronization has started. You can click on 'Tasks' to view the synchronization status.": "The synchronization has started. You can click on 'Tasks' to view the synchronization status.",
20
- "The sync source API call failed. Please check the logs to troubleshoot the issue.": "The sync source API call failed. Please check the logs to troubleshoot the issue."
21
- }
16
+ "default": "Standaard",
17
+ "Retry": "Opnieuw proberen",
18
+ "No user data source plugin installed": "Geen gebruikersgegevensbron-plugin geïnstalleerd",
19
+ "View documentation": "Bekijk documentatie",
20
+ "The synchronization has started. You can click on 'Tasks' to view the synchronization status.": "De synchronisatie is gestart. Je kunt op 'Taken' klikken om de synchronisatiestatus te bekijken.",
21
+ "The sync source API call failed. Please check the logs to troubleshoot the issue.": "De API-aanroep voor de synchronisatiebron is mislukt. Controleer de logbestanden om het probleem op te lossen."
22
+ }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "用户数据同步",
5
5
  "description": "Reigster and manage extensible user data synchronization sources, with HTTP API provided by default. Support for synchronizing data to resources such as users and departments.",
6
6
  "description.zh-CN": "注册和管理可扩展的用户数据同步来源,默认提供 HTTP API。支持向用户和部门等资源同步数据。",
7
- "version": "1.7.0-beta.2",
7
+ "version": "1.7.0-beta.20",
8
8
  "main": "dist/server/index.js",
9
9
  "peerDependencies": {
10
10
  "@nocobase/client": "1.x",
@@ -14,5 +14,5 @@
14
14
  "keywords": [
15
15
  "Users & permissions"
16
16
  ],
17
- "gitHead": "58b206bdfca521e79a69989ca55dd19075dca523"
17
+ "gitHead": "178910a2afe33bd4850e2519507d32b631a380fc"
18
18
  }
@@ -1,10 +0,0 @@
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
- "use strict";(self.webpackChunk_nocobase_plugin_user_data_sync=self.webpackChunk_nocobase_plugin_user_data_sync||[]).push([["157"],{700:function(e,t,o){o.r(t),o.d(t,{UserDataSyncSource:function(){return N}});var n=o("482"),r=o("563"),c=o("505"),i=o("772"),a=o("721"),s=o("156"),l=o.n(s),u=o("60");function p(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},n=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),n.forEach(function(t){var n,r,c;n=e,r=t,c=o[t],r in n?Object.defineProperty(n,r,{value:c,enumerable:!0,configurable:!0,writable:!0}):n[r]=c})}return e}var m=function(e){var t,o,n=(0,i.useCollectionRecordData)();var r=(0,i.useRequest)(function(){return Promise.resolve({data:p({},n.options)})},(t=p({},e),o=(o={manual:!0},o),Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):(function(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);o.push.apply(o,n)}return o})(Object(o)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}),t)),c=r.run,a=(0,i.useActionContext)();return(0,s.useEffect)(function(){a.visible&&c()},[a.visible,c]),r},y=function(e){var t,o=(0,i.usePlugin)(u.default).sourceTypes.get(e);return null==o?void 0:null===(t=o.components)||void 0===t?void 0:t.AdminSettingsForm},d=(0,c.observer)(function(){var e=(0,c.useForm)(),t=(0,i.useCollectionRecordData)(),o=y(e.values.sourceType||t.sourceType);return o?l().createElement(o,null):null},{displayName:"Options"}),f=o("573"),b={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"}}]},v={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}}]},x={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"}}}}}}}}}},g={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:v.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":"Message"}}},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","x-component":"Retry"}}}}}}}}}}}}},h={type:"void",name:"userDataSyncSources","x-component":"CardItem","x-decorator":"TableBlockProvider","x-decorator-props":{collection:b.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"},tasks:{type:"void",title:'{{ t("Tasks") }}',"x-component":"Tasks","x-component-props":{type:"primary"}},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"}}}}}}}}},S=(0,s.createContext)({type:""});S.displayName="SourceTypeContext";var C=(0,s.createContext)({types:[]});C.displayName="SourceTypesContext";function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=Array(t);o<t;o++)n[o]=e[o];return n}function w(e,t,o,n,r,c,i){try{var a=e[c](i),s=a.value}catch(e){o(e);return}a.done?t(s):Promise.resolve(s).then(n,r)}function A(e){return function(){var t=this,o=arguments;return new Promise(function(n,r){var c=e.apply(t,o);function i(e){w(c,n,r,i,a,"next",e)}function a(e){w(c,n,r,i,a,"throw",e)}i(void 0)})}}function k(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var o,n,r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var c=[],i=!0,a=!1;try{for(r=r.call(e);!(i=(o=r.next()).done)&&(c.push(o.value),!t||c.length!==t);i=!0);}catch(e){a=!0,n=e}finally{try{!i&&null!=r.return&&r.return()}finally{if(a)throw n}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return P(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);if("Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o)return Array.from(o);if("Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return P(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function T(e,t){var o,n,r,c,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return c={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function a(c){return function(a){return function(c){if(o)throw TypeError("Generator is already executing.");for(;i;)try{if(o=1,n&&(r=2&c[0]?n.return:c[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,c[1])).done)return r;switch(n=0,r&&(c=[2&c[0],r.value]),c[0]){case 0:case 1:r=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,n=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!r||c[1]>r[0]&&c[1]<r[3])){i.label=c[1];break}if(6===c[0]&&i.label<r[1]){i.label=r[1],r=c;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(c);break}r[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],n=0}finally{o=r=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}var O=function(){var e=(0,i.useCollectionRecordData)();return{form:(0,s.useMemo)(function(){return(0,r.createForm)({values:e})},[])}},D=function(){var e=(0,i.useActionContext)().setVisible,t=(0,c.useForm)(),o=(0,i.useDataBlockResource)(),n=(0,i.useDataBlockRequestGetter)().getDataBlockRequest,r=(0,i.useCollection)();return{type:"primary",onClick:function(){return A(function(){var c,i;return T(this,function(a){switch(a.label){case 0:return[4,t.submit()];case 1:if(a.sent(),!(i=t.values)[r.filterTargetKey])return[3,3];return[4,o.update({values:i,filterByTk:i[r.filterTargetKey]})];case 2:return a.sent(),[3,5];case 3:return[4,o.create({values:i})];case 4:a.sent(),a.label=5;case 5:return[4,null===(c=n())||void 0===c?void 0:c.runAsync()];case 6:return a.sent(),e(!1),[2]}})})()}}};function E(){var e=(0,i.useCollectionRecordData)(),t=(0,i.useDataBlockResource)(),o=(0,i.useCollection)(),n=(0,i.useDataBlockRequestGetter)().getDataBlockRequest,r=(0,f.S)().t;return{confirm:{title:r("Delete",{ns:f.A}),content:r("Are you sure you want to delete it?",{ns:f.A})},onClick:function(){return A(function(){var r;return T(this,function(c){switch(c.label){case 0:return[4,t.destroy({filterByTk:e[o.filterTargetKey]})];case 1:return c.sent(),[4,null===(r=n())||void 0===r?void 0:r.runAsync()];case 2:return c.sent(),[2]}})})()}}}function j(){var e=a.App.useApp().message,t=(0,i.useCollectionRecordData)(),o=(0,i.useAPIClient)(),n=(0,i.useDataBlockRequestGetter)().getDataBlockRequest,r=(0,f.S)().t;return{hidden:!(null==t?void 0:t.enabled),onClick:function(){return A(function(){var c;return T(this,function(i){switch(i.label){case 0:return[4,o.resource("userData").pull({name:t.name})];case 1:return i.sent(),[4,null===(c=n())||void 0===c?void 0:c.runAsync()];case 2:return i.sent(),e.success(r("The synchronization has started. You can click on 'Tasks' to view the synchronization status.",{ns:f.A})),[2]}})})()}}}var F=function(){var e=(0,s.useContext)(S).type;return{form:(0,s.useMemo)(function(){return(0,r.createForm)({initialValues:{sourceType:e}})},[])}},I=function(){return{params:{pageSize:20,filter:{sourceId:(0,i.useCollectionRecordData)()[(0,i.useCollection)().filterTargetKey]},sort:["-sort"]}}};function R(){var e=(0,i.useCollectionRecordData)(),t=(0,i.useCollection)(),o=(0,i.useAPIClient)(),n=(0,i.useDataBlockRequestGetter)().getDataBlockRequest;return{onClick:function(){return A(function(){var r;return T(this,function(c){switch(c.label){case 0:return[4,o.resource("userData").retry({id:e[t.filterTargetKey],sourceId:e.sourceId})];case 1:return c.sent(),[4,null===(r=n())||void 0===r?void 0:r.runAsync()];case 2:return c.sent(),[2]}})})()}}}var B=function(){var e=(0,f.S)().t,t=(0,i.useAPIClient)(),o=k((0,s.useState)(!1),2),r=o[0],c=o[1],u=k((0,s.useState)(""),2),p=u[0],m=u[1],y=(0,s.useContext)(C).types,d=y.map(function(e){var t,o;return t=function(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},n=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),n.forEach(function(t){var n,r,c;n=e,r=t,c=o[t],r in n?Object.defineProperty(n,r,{value:c,enumerable:!0,configurable:!0,writable:!0}):n[r]=c})}return e}({},e),o=(o={onClick:function(){c(!0),m(e.value)}},o),Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):(function(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);o.push.apply(o,n)}return o})(Object(o)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}),t}),b=[{key:"__empty__",label:l().createElement(a.Empty,{image:a.Empty.PRESENTED_IMAGE_SIMPLE,description:l().createElement(l().Fragment,null,e("No user data source plugin installed",{ns:f.A}),l().createElement("br",null)," ",l().createElement("a",{target:"_blank",href:"zh-CN"===t.auth.locale?"https://docs-cn.nocobase.com/handbook/user-data-sync":"https://docs.nocobase.com/handbook/user-data-sync",rel:"noreferrer"},e("View documentation",{ns:f.A})))}),onClick:function(){}}];return l().createElement(i.ActionContextProvider,{value:{visible:r,setVisible:c}},l().createElement(S.Provider,{value:{type:p}},l().createElement(a.Dropdown,{menu:{items:d&&d.length>0?d:b}},l().createElement(a.Button,{icon:l().createElement(n.PlusOutlined,null),type:"primary"},e("Add new")," ",l().createElement(n.DownOutlined,null))),l().createElement(i.SchemaComponent,{scope:{types:y,setType:m,useCustomFormProps:F},schema:x})))},V=function(){var e=(0,f.S)().t,t=(0,i.useCollectionRecordData)();return l().createElement(i.ReadPretty.Input,{value:e(t.message),ellipsis:!0})},q=function(){var e=(0,i.useCollectionRecordData)(),t=(0,f.S)().t,o=k((0,s.useState)(!1),2),n=o[0],r=o[1];return e.enabled?l().createElement(i.ActionContextProvider,{value:{visible:n,setVisible:r}},l().createElement(a.Button,{type:"link",onClick:function(){r(!0)}},t("Tasks")),l().createElement(i.ExtendCollectionsProvider,{collections:[v]},l().createElement(i.SchemaComponent,{scope:{useRetryActionProps:R,useTasksTableBlockProps:I,t:t},components:{Message:V},schema:g}))):null},_=function(){var e=(0,f.S)().t;return"failed"!==(0,i.useCollectionRecordData)().status?null:l().createElement(i.SchemaComponent,{scope:{t:e},schema:{type:"void",properties:{retry:{title:'{{ t("Retry") }}',"x-component":"Action.Link","x-use-component-props":"useRetryActionProps"}}}})},N=function(){var e=(0,f.S)().t,t=k((0,s.useState)([]),2),o=t[0],n=t[1],r=(0,i.useAPIClient)();return(0,i.useRequest)(function(){return r.resource("userData").listSyncTypes().then(function(t){var o;return((null==t?void 0:null===(o=t.data)||void 0===o?void 0:o.data)||[]).map(function(t){return{key:t.name,label:c.Schema.compile(t.title||t.name,{t:e}),value:t.name}})})},{onSuccess:function(e){n(e)}}),l().createElement(C.Provider,{value:{types:o}},l().createElement(i.ExtendCollectionsProvider,{collections:[b]},l().createElement(i.SchemaComponent,{schema:h,components:{AddNew:B,Options:d,Tasks:q,Retry:_},scope:{types:o,t:e,useEditFormProps:O,useSubmitActionProps:D,useDeleteActionProps:E,useSyncActionProps:j,useValuesFromOptions:m}})))}}}]);