@tachybase/module-backup 1.3.25 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(A,g){typeof exports=="object"&&typeof module!="undefined"?g(exports,require("@tachybase/client"),require("react/jsx-runtime"),require("react"),require("@ant-design/icons"),require("@tego/client"),require("antd"),require("react-i18next")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","react/jsx-runtime","react","@ant-design/icons","@tego/client","antd","react-i18next"],g):(A=typeof globalThis!="undefined"?globalThis:A||self,g(A["@tachybase/module-backup"]={},A["@tachybase/client"],A.jsxRuntime,A.react,A["@ant-design/icons"],A["@tego/client"],A.antd,A["react-i18next"]))})(this,function(A,g,n,y,Y,De,k,ie){"use strict";var Zo=Object.defineProperty,_o=Object.defineProperties;var Go=Object.getOwnPropertyDescriptors;var po=Object.getOwnPropertySymbols;var $o=Object.prototype.hasOwnProperty,Yo=Object.prototype.propertyIsEnumerable;var mo=(A,g,n)=>g in A?Zo(A,g,{enumerable:!0,configurable:!0,writable:!0,value:n}):A[g]=n,ae=(A,g)=>{for(var n in g||(g={}))$o.call(g,n)&&mo(A,n,g[n]);if(po)for(var n of po(g))Yo.call(g,n)&&mo(A,n,g[n]);return A},Me=(A,g)=>_o(A,Go(g));var $=(A,g,n)=>new Promise((y,Y)=>{var De=z=>{try{ie(n.next(z))}catch(Q){Y(Q)}},k=z=>{try{ie(n.throw(z))}catch(Q){Y(Q)}},ie=z=>z.done?y(z.value):Promise.resolve(z.value).then(De,k);ie((n=n.apply(A,g)).next())});var z=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},Q={exports:{}},fo=Q.exports,Fe;function yo(){return Fe||(Fe=1,function(e,t){(function(a,o){o()})(fo,function(){function a(i,s){return typeof s=="undefined"?s={autoBom:!1}:typeof s!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),s={autoBom:!s}),s.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(i.type)?new Blob(["\uFEFF",i],{type:i.type}):i}function o(i,s,v){var u=new XMLHttpRequest;u.open("GET",i),u.responseType="blob",u.onload=function(){p(u.response,s,v)},u.onerror=function(){console.error("could not download file")},u.send()}function r(i){var s=new XMLHttpRequest;s.open("HEAD",i,!1);try{s.send()}catch(v){}return 200<=s.status&&299>=s.status}function c(i){try{i.dispatchEvent(new MouseEvent("click"))}catch(v){var s=document.createEvent("MouseEvents");s.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),i.dispatchEvent(s)}}var l=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof z=="object"&&z.global===z?z:void 0,m=l.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),p=l.saveAs||(typeof window!="object"||window!==l?function(){}:"download"in HTMLAnchorElement.prototype&&!m?function(i,s,v){var u=l.URL||l.webkitURL,f=document.createElement("a");s=s||i.name||"download",f.download=s,f.rel="noopener",typeof i=="string"?(f.href=i,f.origin===location.origin?c(f):r(f.href)?o(i,s,v):c(f,f.target="_blank")):(f.href=u.createObjectURL(i),setTimeout(function(){u.revokeObjectURL(f.href)},4e4),setTimeout(function(){c(f)},0))}:"msSaveOrOpenBlob"in navigator?function(i,s,v){if(s=s||i.name||"download",typeof i!="string")navigator.msSaveOrOpenBlob(a(i,v),s);else if(r(i))o(i,s,v);else{var u=document.createElement("a");u.href=i,u.target="_blank",setTimeout(function(){c(u)})}}:function(i,s,v,u){if(u=u||open("","_blank"),u&&(u.document.title=u.document.body.innerText="downloading..."),typeof i=="string")return o(i,s,v);var f=i.type==="application/octet-stream",h=/constructor/i.test(l.HTMLElement)||l.safari,d=/CriOS\/[\d]+/.test(navigator.userAgent);if((d||f&&h||m)&&typeof FileReader!="undefined"){var x=new FileReader;x.onloadend=function(){var B=x.result;B=d?B:B.replace(/^data:[^;]*;/,"data:attachment/file;"),u?u.location.href=B:location=B,u=null},x.readAsDataURL(i)}else{var S=l.URL||l.webkitURL,w=S.createObjectURL(i);u?u.location=w:location.href=w,u=null,setTimeout(function(){S.revokeObjectURL(w)},4e4)}});l.saveAs=p.saveAs=p,e.exports=p})}(Q)),Q.exports}var ho=yo();const le="backup";function R(){return ie.useTranslation([le,"core"],{nsMode:"fallback"})}const vo=e=>g.tval(e,{ns:le}),{Dragger:xo}=k.Upload;function bo(e){const t=o=>{var r;(r=e.onChange)==null||r.call(e,o)},a=g.useAPIClient();return Me(ae({},e),{customRequest({action:o,data:r,file:c,filename:l,headers:m,onError:p,onProgress:i,onSuccess:s,withCredentials:v}){const u=new FormData;return r&&Object.keys(r).forEach(f=>{u.append(f,r[f])}),u.append(l,c),a.axios.post(o,u,{withCredentials:v,headers:m,onUploadProgress:({total:f,loaded:h})=>{i({percent:Math.round(h/f*100).toFixed(2)},c)}}).then(({data:f})=>{s(f,c)}).catch(p).finally(()=>{}),{abort(){console.log("upload progress is aborted.")}}},onChange:t})}const Pe=e=>{const{collectionsData:t}=e,{t:a}=R(),[o,r]=y.useState(!1),[c,l]=y.useState(t);y.useEffect(()=>{l(t)},[t]);const m=g.useAPIClient(),p=g.useCompile(),i=y.useMemo(()=>m.resource("backupFiles"),[m]),s=()=>$(null,null,function*(){if(e.isBackup){const d=yield i.dumpableCollections();l(d==null?void 0:d.data),r(!0)}r(!0)}),v=()=>{r(!1)},u=()=>{r(!1)},f=[{title:a("Collection"),dataIndex:"collection",key:"collection",render:(d,x)=>{const S=p(x.title);return x.name===S?S:n.jsxs("div",{children:[x.name," ",n.jsxs("span",{style:{color:"rgba(0, 0, 0, 0.3)",fontSize:"0.9em"},children:["(",p(x.title),")"]})]})}},{title:a("Origin"),dataIndex:"origin",key:"origin",width:"50%"}],h=Object.keys(c||{}).map(d=>({key:d,label:a(`${d}.title`),children:n.jsxs(n.Fragment,{children:[n.jsx(k.Alert,{style:{marginBottom:16},message:a(`${d}.description`)}),n.jsx(k.Table,{pagination:{pageSize:100},bordered:!0,size:"small",dataSource:c[d],columns:f,scroll:{y:400}})]})}));return n.jsxs(n.Fragment,{children:[n.jsx("a",{onClick:s,children:a("Learn more")}),n.jsx(k.Modal,{title:a("Backup instructions"),width:"80vw",open:o,footer:null,onOk:v,onCancel:u,children:n.jsx(k.Tabs,{defaultActiveKey:"required",items:h})})]})},Te=({ButtonComponent:e=k.Button,title:t,upload:a=!1,fileData:o})=>{const{t:r}=R(),[c,l]=y.useState(["required"]),[m,p]=y.useState(!1),[i,s]=y.useState(null),[v,u]=y.useState(!1),f=g.useAPIClient(),h=y.useMemo(()=>f.resource("backupFiles"),[f]),[d,x]=y.useState([]),S=c.length>0&&c.length<d.length,w=d.length===c.length;y.useEffect(()=>{x(Object.keys((i==null?void 0:i.dumpableCollectionsGroupByGroup)||[]).map(M=>({value:M,label:r(`${M}.title`),disabled:["required","skipped"].includes(M)})))},[i]);const B=()=>$(null,null,function*(){var M,H,P;if(p(!0),!a){u(!0);const{data:E}=yield h.get({filterByTk:o.name});x(Object.keys(((H=(M=E==null?void 0:E.data)==null?void 0:M.meta)==null?void 0:H.dumpableCollectionsGroupByGroup)||[]).map(N=>({value:N,label:r(`${N}.title`),disabled:["required","skipped"].includes(N)}))),s((P=E==null?void 0:E.data)==null?void 0:P.meta),u(!1)}}),K=()=>{h.restore({values:{dataTypes:c,filterByTk:o==null?void 0:o.name,key:i==null?void 0:i.key}}),p(!1)},ee=()=>{p(!1),s(null),l(["required"])},U=M=>{l(M.target.checked?d.map(H=>H.value):["required"])};return n.jsxs(n.Fragment,{children:[n.jsx(e,{onClick:B,children:t}),n.jsx(k.Modal,{title:r("Restore"),width:800,footer:a&&!i?null:void 0,open:m,onOk:K,onCancel:ee,children:n.jsxs(k.Spin,{spinning:v,children:[a&&!i&&n.jsx(ko,{setRestoreData:s}),(!a||i)&&[n.jsxs("strong",{style:{fontWeight:600,display:"block",margin:"16px 0 8px"},children:[r("Select the data to be restored")," (",n.jsx(Pe,{collectionsData:i==null?void 0:i.dumpableCollectionsGroupByGroup}),"):"]},"info"),n.jsx("div",{style:{lineHeight:2,marginBottom:8},children:n.jsxs(De.FormItem,{children:[n.jsx(g.Checkbox.Group,{options:d,style:{flexDirection:"column"},value:c,onChange:M=>l(M)}),n.jsx(k.Divider,{}),n.jsx(g.Checkbox,{indeterminate:S,onChange:U,checked:w,children:r("Check all")})]})},"dataType")]]})})]})},go=({ButtonComponent:e=k.Button,refresh:t})=>{const{t:a}=R(),[o,r]=y.useState(!1),[c,l]=y.useState(["required"]),m=g.useAPIClient(),{notification:p}=k.App.useApp(),[i,s]=y.useState([]),v=c.length>0&&c.length<i.filter(S=>S.value!=="skipped").length,u=i.filter(S=>S.value!=="skipped").length===c.length,f=S=>{l(S.target.checked?i.filter(w=>w.value!=="skipped").map(w=>w.value):["required"])},h=()=>$(null,null,function*(){const{data:S}=yield m.resource("backupFiles").dumpableCollections();s(Object.keys(S||[]).map(w=>({value:w,label:a(`${w}.title`),disabled:["required","skipped"].includes(w)}))),r(!0)}),d=S=>{m.request({url:"backupFiles:create",method:"post",data:{dataTypes:c,method:S}}),p.info({key:"backup",message:n.jsxs("span",{children:[a("Processing..."),"    ",n.jsx(k.Spin,{indicator:n.jsx(Y.LoadingOutlined,{style:{fontSize:24},spin:!0})})]}),duration:0}),r(!1),l(["required"]),setTimeout(()=>{t()},500)},x=()=>{r(!1),l(["required"])};return n.jsxs(n.Fragment,{children:[n.jsx(e,{icon:n.jsx(Y.PlusOutlined,{}),type:"primary",onClick:h,children:a("New backup")}),n.jsxs(k.Modal,{title:a("New backup"),width:800,open:o,onCancel:x,footer:[n.jsxs(k.Row,{gutter:16,justify:"end",align:"middle",children:[n.jsx(k.Col,{children:n.jsx(k.Button,{onClick:x,children:a("Cancel")},"cancel")}),n.jsx(k.Col,{children:n.jsx(k.Dropdown.Button,{type:"primary",onClick:()=>d("priority"),overlay:n.jsxs(k.Menu,{children:[n.jsx(k.Menu.Item,{onClick:()=>d("main"),children:a("Self backup")},"main"),n.jsx(k.Menu.Item,{onClick:()=>d("worker"),children:a("Worker backup")},"worker")]}),children:a("Backup")},"submit")})]})],children:[n.jsxs("strong",{style:{fontWeight:600,display:"block",margin:"16px 0 8px"},children:[a("Select the data to be backed up")," (",n.jsx(Pe,{isBackup:!0}),"):"]}),n.jsxs("div",{style:{lineHeight:2,marginBottom:8},children:[n.jsx(g.Checkbox.Group,{options:i,style:{flexDirection:"column"},onChange:S=>l(S),value:c}),n.jsx(k.Divider,{}),n.jsx(g.Checkbox,{indeterminate:v,onChange:f,checked:u,children:a("Check all")})]})]})]})},ko=e=>{const{t}=R(),a={multiple:!1,action:"/backupFiles:upload",onChange(o){var c,l,m;o.fileList.length>1&&o.fileList.splice(0,o.fileList.length-1);const{status:r}=o.file;r==="done"?(k.message.success(`${o.file.name} `+t("file uploaded successfully")),e.setRestoreData(Me(ae({},(l=(c=o.file.response)==null?void 0:c.data)==null?void 0:l.meta),{key:(m=o.file.response)==null?void 0:m.data.key}))):r==="error"&&k.message.error(`${o.file.name} `+t("file upload failed"))},onDrop(o){console.log("Dropped files",o.dataTransfer.files)}};return n.jsxs(xo,Me(ae({},bo(a)),{children:[n.jsx("p",{className:"ant-upload-drag-icon",children:n.jsx(Y.InboxOutlined,{})}),n.jsxs("p",{className:"ant-upload-text",children:[" ",t("Click or drag file to this area to upload")]})]}))},wo=()=>{const{t:e}=R(),t=g.useAPIClient(),[a,o]=y.useState([]),[r,c]=y.useState(!1),[l,m]=y.useState(!1),{modal:p,notification:i}=k.App.useApp(),s=y.useMemo(()=>t.resource("backupFiles"),[t]),v=y.useCallback(()=>$(null,null,function*(){yield u()}),[]);g.useNoticeSub("backup",d=>{(i[d.level]||i.info)({key:"backup",message:d.msg}),v()}),y.useEffect(()=>{u()},[]);const u=()=>$(null,null,function*(){c(!0);const{data:d}=yield s.list();o(d.data),c(!1)}),f=d=>$(null,null,function*(){m(d.name);const x=yield t.request({url:"backupFiles:download",method:"get",params:{filterByTk:d.name},responseType:"blob",onDownloadProgress:w=>{const B=Math.round(w.loaded*100/w.total);B>=100?i.success({key:"downloadBackup",message:n.jsx("span",{children:e("Downloaded success!")}),duration:1}):i.info({key:"downloadBackup",message:n.jsxs("span",{children:[e("Downloading ")+B+"%","    ",n.jsx(k.Spin,{indicator:n.jsx(Y.LoadingOutlined,{style:{fontSize:24},spin:!0})})]}),duration:0})}});m(!1);const S=new Blob([x.data]);ho.saveAs(S,d.name)}),h=d=>{p.confirm({title:e("Delete record",{ns:"core"}),content:e("Are you sure you want to delete it?",{ns:"core"}),onOk:()=>$(null,null,function*(){yield s.destroy({filterByTk:d.name}),yield u(),k.message.success(e("Deleted successfully"))})})};return n.jsx("div",{children:n.jsxs(k.Card,{bordered:!1,children:[n.jsxs(k.Space,{style:{float:"right",marginBottom:16},children:[n.jsx(k.Button,{onClick:v,icon:n.jsx(Y.ReloadOutlined,{}),children:e("Refresh")}),n.jsx(Te,{upload:!0,title:n.jsxs(n.Fragment,{children:[n.jsx(Y.UploadOutlined,{})," ",e("Restore backup from local")]})}),n.jsx(go,{refresh:v})]}),n.jsx(k.Table,{dataSource:a,loading:r,columns:[{title:e("Backup file"),dataIndex:"name",width:400,onCell:d=>d.inProgress?{colSpan:4}:{},render:(d,x)=>x.inProgress?n.jsxs("div",{style:{color:"rgba(0, 0, 0, 0.88)"},children:[d,"(",e("Backing up"),"...)"]}):x.status==="error"?n.jsxs("div",{style:{color:"red"},children:[d,"(",e("Error"),")"]}):n.jsx("div",{children:d})},{title:e("File size"),dataIndex:"fileSize",onCell:d=>d.inProgress?{colSpan:0}:{}},{title:e("Created at",{ns:"core"}),dataIndex:"createdAt",onCell:d=>d.inProgress?{colSpan:0}:{},render:d=>n.jsx(g.DatePicker.ReadPretty,{value:d,showTime:!0})},{title:e("Actions",{ns:"core"}),dataIndex:"actions",onCell:d=>d.inProgress?{colSpan:0}:{},render:(d,x)=>n.jsxs(k.Space,{split:n.jsx(k.Divider,{type:"vertical"}),children:[x.status!=="error"&&n.jsx(Te,{ButtonComponent:"a",title:e("Restore"),fileData:x}),x.status!=="error"&&n.jsx("a",{type:"link",onClick:()=>f(x),children:e("Download")}),n.jsx("a",{onClick:()=>h(x),children:e("Delete")})]})}]})]})})},Co={dumpRules:"required",name:"autoBackup",shared:!0,createdAt:!0,updatedAt:!0,createdBy:!0,updatedBy:!0,fields:[{type:"string",name:"title",required:!0,uiSchema:{title:'{{ t("Title") }}',type:"string","x-component":"Input",required:!0}},{type:"boolean",name:"enabled",defaultValue:!1,uiSchema:{title:'{{ t("Enabled") }}',type:"boolean","x-component":"Checkbox",required:!0}},{type:"array",name:"dumpRules",uiSchema:{title:'{{ t("Dump rules") }}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"repeat",required:!0,uiSchema:{title:'{{t("Repeat mode")}}',type:"string","x-component":"RepeatField"}},{type:"integer",name:"maxNumber",uiSchema:{title:'{{ t("Max number") }}',type:"integer","x-component":"Input",required:!0}}]};var q=function(){return q=Object.assign||function(e){for(var t,a=1,o=arguments.length;a<o;a++)for(var r in t=arguments[a])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},q.apply(this,arguments)};function je(e,t){var a={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(a[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(a[o[r]]=e[o[r]])}return a}function me(e,t,a){if(a||arguments.length===2)for(var o,r=0,c=t.length;r<c;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var Oo=[{name:"@yearly",value:"0 0 1 1 *"},{name:"@annually",value:"0 0 1 1 *"},{name:"@monthly",value:"0 0 1 * *"},{name:"@weekly",value:"0 0 * * 0"},{name:"@daily",value:"0 0 * * *"},{name:"@midnight",value:"0 0 * * *"},{name:"@hourly",value:"0 * * * *"}],oe=[{type:"minutes",min:0,max:59,total:60},{type:"hours",min:0,max:23,total:24},{type:"month-days",min:1,max:31,total:31},{type:"months",min:1,max:12,total:12,alt:["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]},{type:"week-days",min:0,max:6,total:7,alt:["SUN","MON","TUE","WED","THU","FRI","SAT"]}],C={everyText:"every",emptyMonths:"every month",emptyMonthDays:"every day of the month",emptyMonthDaysShort:"day of the month",emptyWeekDays:"every day of the week",emptyWeekDaysShort:"day of the week",emptyHours:"every hour",emptyMinutes:"every minute",emptyMinutesForHourPeriod:"every",yearOption:"year",monthOption:"month",weekOption:"week",dayOption:"day",hourOption:"hour",minuteOption:"minute",rebootOption:"reboot",prefixPeriod:"Every",prefixMonths:"in",prefixMonthDays:"on",prefixWeekDays:"on",prefixWeekDaysForMonthAndYearPeriod:"and",prefixHours:"at",prefixMinutes:":",prefixMinutesForHourPeriod:"at",suffixMinutesForHourPeriod:"minute(s)",errorInvalidCron:"Invalid cron expression",clearButtonText:"Clear",weekDays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],altWeekDays:["SUN","MON","TUE","WED","THU","FRI","SAT"],altMonths:["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]};function Ee(e,t){for(var a=[],o=e;o<=t;o++)a.push(o);return a}function fe(e){return e.sort(function(t,a){return t-a}),e}function Le(e){var t=[];return e.forEach(function(a){t.indexOf(a)<0&&t.push(a)}),t}function J(e){return Object.entries(e).filter(function(t){var a=t[0],o=t[1];return a&&o}).map(function(t){return t[0]}).join(" ")}function Ie(e,t){e&&e({type:"invalid_cron",description:t.errorInvalidCron||C.errorInvalidCron})}function ye(e){var t=parseInt(e,10),a=Number(e);return t===a?a:NaN}function Ve(e,t,a,o,r,c,l,m,p,i,s,v,u,f){a&&a(void 0),t(!1);var h=!1;if(!e){if(o==="always"||c&&o==="for-default-value")return;h=!0}if(!h){if(m&&(m===!0||m.includes(e))){if(e==="@reboot")return void f("reboot");var d=Oo.find(function(w){return w.name===e});d&&(e=d.value)}try{var x=function(w){if(typeof w!="string")throw new Error("Invalid cron string");var B=w.replace(/\s+/g," ").trim().split(" ");if(B.length===5)return B.map(function(K,ee){return function(U,M){if(U==="*"||U==="*/1")return[];var H=fe(Le(We(function(E,N,Z){if(Z){E=E.toUpperCase();for(var b=0;b<Z.length;b++)E=E.replace(Z[b],"".concat(b+N))}return E}(U,M.min,M.alt).split(",").map(function(E){var N,Z=E.split("/");if(Z.length>2)throw new Error('Invalid value "'.concat(U,' for "').concat(M.type,'"'));var b=Z[0],O=Z[1];N=b==="*"?Ee(M.min,M.max):function(F,T,L){var I=F.split("-");if(I.length===1){var ce=ye(I[0]);if(isNaN(ce))throw new Error('Invalid value "'.concat(T,'" for ').concat(L.type));return[ce]}if(I.length===2){var _=ye(I[0]),ne=ye(I[1]);if(isNaN(_)||isNaN(ne))throw new Error('Invalid value "'.concat(T,'" for ').concat(L.type));if(ne<_)throw new Error('Max range is less than min range in "'.concat(F,'" for ').concat(L.type));return Ee(_,ne)}throw new Error('Invalid value "'.concat(F,'" for ').concat(L.type))}(b,U,M);var D=function(F,T){if(F!==void 0){var L=ye(F);if(isNaN(L)||L<1)throw new Error('Invalid interval step value "'.concat(F,'" for ').concat(T.type));return L}}(O,M),W=function(F,T){if(T){var L=F[0];F=F.filter(function(I){return I%T==L%T||I===L})}return F}(N,D);return W}).flat(),M))),P=ze(H,M);if(P!==void 0)throw new Error('Value "'.concat(P,'" out of range for ').concat(M.type));return H.length===M.total?[]:H}(K,oe[ee])});throw new Error("Invalid cron string format")}(e),S=function(w){return w[3].length>0?"year":w[2].length>0?"month":w[4].length>0?"week":w[1].length>0?"day":w[0].length>0?"hour":"minute"}(x);f(S),p(x[0]),i(x[1]),s(x[2]),v(x[3]),u(x[4])}catch(w){h=!0}}h&&(r.current=e,t(!0),Ie(a,l))}function qe(e,t,a,o,r,c,l){if(e==="reboot")return"@reboot";var m=function(p,i){return p.map(function(s,v){var u=oe[v];return He(Ue(s,u),u,i)})}([e!=="minute"&&c?c:[],e!=="minute"&&e!=="hour"&&r?r:[],e!=="year"&&e!=="month"||!a?[]:a,e==="year"&&t?t:[],e!=="year"&&e!=="month"&&e!=="week"||!o?[]:o],l);return m.join(" ")}function He(e,t,a,o,r){var c="";if(function(m,p){return m.length===p.max-p.min+1}(e,t)||e.length===0)c="*";else{var l=function(m){if(m.length>2){var p=m[1]-m[0];if(p>1)return p}}(e);c=l&&function(m,p){for(var i=1;i<m.length;i++){var s=m[i-1];if(m[i]-s!==p)return!1}return!0}(e,l)?function(m,p,i){var s=Je(m),v=Ze(m),u=m.length===(v-s)/i+1;return!!(s===p.min&&v+i>p.max&&u)}(e,t,l)?"*/".concat(l):"".concat(te(Je(e),t,a,o,r),"-").concat(te(Ze(e),t,a,o,r),"/").concat(l):function(m){var p=[],i=null;return m.forEach(function(s,v,u){s!==u[v+1]-1?i!==null?(p.push([i,s]),i=null):p.push(s):i===null&&(i=s)}),p}(e).map(function(m){return Array.isArray(m)?"".concat(te(m[0],t,a,o,r),"-").concat(te(m[1],t,a,o,r)):te(m,t,a,o,r)}).join(",")}return c}function te(e,t,a,o,r){var c=e.toString(),l=t.type,m=t.alt,p=t.min,i=o&&(o===!0||o.includes(l)),s=r==="24-hour-clock"&&(l==="hours"||l==="minutes");if(a&&l==="week-days"||a&&l==="months"?c=m[e-p]:e<10&&(i||s)&&(c=c.padStart(2,"0")),l==="hours"&&r==="12-hour-clock"){var v=e>=12?"PM":"AM",u=e%12||12;u<10&&i&&(u=u.toString().padStart(2,"0")),c="".concat(u).concat(v)}return c}function Ue(e,t){var a=fe(Le(We(e,t)));if(a.length===0)return a;var o=ze(a,t);if(o!==void 0)throw new Error('Value "'.concat(o,'" out of range for ').concat(t.type));return a}function We(e,t){return t.type==="week-days"&&(e=e.map(function(a){return a===7?0:a})),e}function ze(e,t){var a=e[0],o=e[e.length-1];return a<t.min?a:o>t.max?o:void 0}function Je(e){return e[0]}function Ze(e){return e[e.length-1]}function se(e){var t=e.value,a=e.grid,o=a===void 0||a,r=e.optionsList,c=e.setValue,l=e.locale,m=e.className,p=e.humanizeLabels,i=e.disabled,s=e.readOnly,v=e.leadingZero,u=e.clockFormat,f=e.period,h=e.unit,d=e.periodicityOnDoubleClick,x=e.mode,S=je(e,["value","grid","optionsList","setValue","locale","className","humanizeLabels","disabled","readOnly","leadingZero","clockFormat","period","unit","periodicityOnDoubleClick","mode"]),w=y.useMemo(function(){if(t&&Array.isArray(t))return t.map(function(b){return b.toString()})},[t]),B=y.useMemo(function(){return r?r.map(function(b,O){return{value:(h.min===0?O:O+1).toString(),label:b}}):me([],Array(h.total),!0).map(function(b,O){var D=h.min===0?O:O+1;return{value:D.toString(),label:te(D,h,p,v,u)}})},[r,v,p,u]),K=JSON.stringify(l),ee=y.useCallback(function(b){var O=b.value;if(!t||t[0]!==Number(O))return n.jsx(n.Fragment,{});var D=He(Ue(t,h),h,p,v,u),W=D.match(/^\*\/([0-9]+),?/)||[];return n.jsx("div",{children:W[1]?"".concat(l.everyText||C.everyText," ").concat(W[1]):D})},[t,K,p,v,u]),U=y.useCallback(function(b){var O=Array.isArray(b)?fe(b):[b],D=O;t&&(D=x==="single"?[]:me([],t,!0),O.forEach(function(W){var F=Number(W);D=t.some(function(T){return T===F})?D.filter(function(T){return T!==F}):fe(me(me([],D,!0),[F],!1))})),D.length===h.total?c([]):c(D)},[c,t]),M=y.useCallback(function(b){if(b!==0&&b!==1){for(var O=h.total+h.min,D=[],W=h.min;W<O;W++)W%b==0&&D.push(W);var F=t&&D&&t.length===D.length&&t.every(function(L,I){return L===D[I]}),T=D.length===B.length;c(T||F?[]:D)}else c([])},[t,B,c]),H=y.useRef([]),P=y.useCallback(function(b){if(!s){var O=H.current;O.push({time:new Date().getTime(),value:Number(b)});var D=window.setTimeout(function(){d&&O.length>1&&O[O.length-1].time-O[O.length-2].time<300?O[O.length-1].value===O[O.length-2].value?M(Number(b)):U([O[O.length-2].value,O[O.length-1].value]):U(Number(b)),H.current=[]},300);return function(){window.clearTimeout(D)}}},[H,U,M,s,d]),E=y.useCallback(function(){s||c([])},[c,s]),N=y.useMemo(function(){var b;return J(((b={"react-js-cron-select":!0,"react-js-cron-custom-select":!0})["".concat(m,"-select")]=!!m,b))},[m]),Z=y.useMemo(function(){var b;return J(((b={"react-js-cron-select-dropdown":!0})["react-js-cron-select-dropdown-".concat(h.type)]=!0,b["react-js-cron-custom-select-dropdown"]=!0,b["react-js-cron-custom-select-dropdown-".concat(h.type)]=!0,b["react-js-cron-custom-select-dropdown-minutes-large"]=h.type==="minutes"&&f!=="hour"&&f!=="day",b["react-js-cron-custom-select-dropdown-minutes-medium"]=h.type==="minutes"&&(f==="day"||f==="hour"),b["react-js-cron-custom-select-dropdown-hours-twelve-hour-clock"]=h.type==="hours"&&u==="12-hour-clock",b["react-js-cron-custom-select-dropdown-grid"]=!!o,b["".concat(m,"-select-dropdown")]=!!m,b["".concat(m,"-select-dropdown-").concat(h.type)]=!!m,b))},[m,o,u,f]);return n.jsx(k.Select,q({mode:x!=="single"||d?"multiple":void 0,allowClear:!s,virtual:!1,open:!s&&void 0,value:w,onClear:E,tagRender:ee,className:N,popupClassName:Z,options:B,showSearch:!1,showArrow:!s,menuItemSelectedIcon:null,dropdownMatchSelectWidth:!1,onSelect:P,onDeselect:P,disabled:i,dropdownAlign:h.type!=="minutes"&&h.type!=="hours"||f==="day"||f==="hour"?void 0:{points:["tr","br"]},"data-testid":"custom-select-".concat(h.type)},S))}function So(e){var t=e.value,a=e.setValue,o=e.locale,r=e.className,c=e.disabled,l=e.readOnly,m=e.leadingZero,p=e.clockFormat,i=e.period,s=e.periodicityOnDoubleClick,v=e.mode,u=y.useMemo(function(){var f;return J(((f={"react-js-cron-field":!0,"react-js-cron-hours":!0})["".concat(r,"-field")]=!!r,f["".concat(r,"-hours")]=!!r,f))},[r]);return n.jsxs("div",q({className:u},{children:[o.prefixHours!==""&&n.jsx("span",{children:o.prefixHours||C.prefixHours}),n.jsx(se,{placeholder:o.emptyHours||C.emptyHours,value:t,unit:oe[1],setValue:a,locale:o,className:r,disabled:c,readOnly:l,leadingZero:m,clockFormat:p,period:i,periodicityOnDoubleClick:s,mode:v})]}))}function Mo(e){var t=e.value,a=e.setValue,o=e.locale,r=e.className,c=e.disabled,l=e.readOnly,m=e.leadingZero,p=e.clockFormat,i=e.period,s=e.periodicityOnDoubleClick,v=e.mode,u=y.useMemo(function(){var f;return J(((f={"react-js-cron-field":!0,"react-js-cron-minutes":!0})["".concat(r,"-field")]=!!r,f["".concat(r,"-minutes")]=!!r,f))},[r]);return n.jsxs("div",q({className:u},{children:[i==="hour"?o.prefixMinutesForHourPeriod!==""&&n.jsx("span",{children:o.prefixMinutesForHourPeriod||C.prefixMinutesForHourPeriod}):o.prefixMinutes!==""&&n.jsx("span",{children:o.prefixMinutes||C.prefixMinutes}),n.jsx(se,{placeholder:i==="hour"?o.emptyMinutesForHourPeriod||C.emptyMinutesForHourPeriod:o.emptyMinutes||C.emptyMinutes,value:t,unit:oe[0],setValue:a,locale:o,className:r,disabled:c,readOnly:l,leadingZero:m,clockFormat:p,period:i,periodicityOnDoubleClick:s,mode:v}),i==="hour"&&o.suffixMinutesForHourPeriod!==""&&n.jsx("span",{children:o.suffixMinutesForHourPeriod||C.suffixMinutesForHourPeriod})]}))}function Do(e){var t=e.value,a=e.setValue,o=e.locale,r=e.className,c=e.weekDays,l=e.disabled,m=e.readOnly,p=e.leadingZero,i=e.period,s=e.periodicityOnDoubleClick,v=e.mode,u=!c||c.length===0,f=y.useMemo(function(){var x;return J(((x={"react-js-cron-field":!0,"react-js-cron-month-days":!0,"react-js-cron-month-days-placeholder":!u})["".concat(r,"-field")]=!!r,x["".concat(r,"-month-days")]=!!r,x))},[r,u]),h=JSON.stringify(o),d=y.useMemo(function(){return u?o.emptyMonthDays||C.emptyMonthDays:o.emptyMonthDaysShort||C.emptyMonthDaysShort},[u,h]);return!m||t&&t.length>0||(!t||t.length===0)&&(!c||c.length===0)?n.jsxs("div",q({className:f},{children:[o.prefixMonthDays!==""&&n.jsx("span",{children:o.prefixMonthDays||C.prefixMonthDays}),n.jsx(se,{placeholder:d,value:t,setValue:a,unit:oe[2],locale:o,className:r,disabled:l,readOnly:m,leadingZero:p,period:i,periodicityOnDoubleClick:s,mode:v})]})):null}function Ao(e){var t=e.value,a=e.setValue,o=e.locale,r=e.className,c=e.humanizeLabels,l=e.disabled,m=e.readOnly,p=e.period,i=e.periodicityOnDoubleClick,s=e.mode,v=o.months||C.months,u=y.useMemo(function(){var f;return J(((f={"react-js-cron-field":!0,"react-js-cron-months":!0})["".concat(r,"-field")]=!!r,f["".concat(r,"-months")]=!!r,f))},[r]);return n.jsxs("div",q({className:u},{children:[o.prefixMonths!==""&&n.jsx("span",{children:o.prefixMonths||C.prefixMonths}),n.jsx(se,{placeholder:o.emptyMonths||C.emptyMonths,optionsList:v,grid:!1,value:t,unit:q(q({},oe[3]),{alt:o.altMonths||C.altMonths}),setValue:a,locale:o,className:r,humanizeLabels:c,disabled:l,readOnly:m,period:p,periodicityOnDoubleClick:i,mode:s})]}))}function Bo(e){var t=e.value,a=e.setValue,o=e.locale,r=e.className,c=e.disabled,l=e.readOnly,m=e.shortcuts,p=e.allowedPeriods,i=[];p.includes("year")&&i.push({value:"year",label:o.yearOption||C.yearOption}),p.includes("month")&&i.push({value:"month",label:o.monthOption||C.monthOption}),p.includes("week")&&i.push({value:"week",label:o.weekOption||C.weekOption}),p.includes("day")&&i.push({value:"day",label:o.dayOption||C.dayOption}),p.includes("hour")&&i.push({value:"hour",label:o.hourOption||C.hourOption}),p.includes("minute")&&i.push({value:"minute",label:o.minuteOption||C.minuteOption}),p.includes("reboot")&&m&&(m===!0||m.includes("@reboot"))&&i.push({value:"reboot",label:o.rebootOption||C.rebootOption});var s=y.useCallback(function(h){l||a(h)},[a,l]),v=y.useMemo(function(){var h;return J(((h={"react-js-cron-field":!0,"react-js-cron-period":!0})["".concat(r,"-field")]=!!r,h["".concat(r,"-period")]=!!r,h))},[r]),u=y.useMemo(function(){var h;return J(((h={"react-js-cron-select":!0,"react-js-cron-select-no-prefix":o.prefixPeriod===""})["".concat(r,"-select")]=!!r,h))},[r,o.prefixPeriod]),f=y.useMemo(function(){var h;return J(((h={"react-js-cron-select-dropdown":!0,"react-js-cron-select-dropdown-period":!0})["".concat(r,"-select-dropdown")]=!!r,h["".concat(r,"-select-dropdown-period")]=!!r,h))},[r]);return n.jsxs("div",q({className:v},{children:[o.prefixPeriod!==""&&n.jsx("span",{children:o.prefixPeriod||C.prefixPeriod}),n.jsx(k.Select,{defaultValue:t,value:t,onChange:s,options:i,className:u,popupClassName:f,disabled:c,showArrow:!l,open:!l&&void 0,"data-testid":"select-period"},JSON.stringify(o))]}))}function No(e){var t=e.value,a=e.setValue,o=e.locale,r=e.className,c=e.humanizeLabels,l=e.monthDays,m=e.disabled,p=e.readOnly,i=e.period,s=e.periodicityOnDoubleClick,v=e.mode,u=o.weekDays||C.weekDays,f=i==="week"||!l||l.length===0,h=y.useMemo(function(){var B;return J(((B={"react-js-cron-field":!0,"react-js-cron-week-days":!0,"react-js-cron-week-days-placeholder":!f})["".concat(r,"-field")]=!!r,B["".concat(r,"-week-days")]=!!r,B))},[r,f]),d=JSON.stringify(o),x=y.useMemo(function(){return f?o.emptyWeekDays||C.emptyWeekDays:o.emptyWeekDaysShort||C.emptyWeekDaysShort},[f,d]),S=i==="week"||!p||t&&t.length>0||(!t||t.length===0)&&(!l||l.length===0),w=!p||l&&l.length>0||(!l||l.length===0)&&(!t||t.length===0);return S?n.jsxs("div",q({className:h},{children:[o.prefixWeekDays!==""&&(i==="week"||!w)&&n.jsx("span",{children:o.prefixWeekDays||C.prefixWeekDays}),o.prefixWeekDaysForMonthAndYearPeriod!==""&&i!=="week"&&w&&n.jsx("span",{children:o.prefixWeekDaysForMonthAndYearPeriod||C.prefixWeekDaysForMonthAndYearPeriod}),n.jsx(se,{placeholder:x,optionsList:u,grid:!1,value:t,unit:q(q({},oe[4]),{alt:o.altWeekDays||C.altWeekDays}),setValue:a,locale:o,className:r,humanizeLabels:c,disabled:m,readOnly:p,period:i,periodicityOnDoubleClick:s,mode:v})]})):null}function Fo(e){var t=e.clearButton,a=t===void 0||t,o=e.clearButtonProps,r=o===void 0?{}:o,c=e.clearButtonAction,l=c===void 0?"fill-with-every":c,m=e.locale,p=m===void 0?C:m,i=e.value,s=i===void 0?"":i,v=e.setValue,u=e.displayError,f=u===void 0||u,h=e.onError,d=e.className,x=e.defaultPeriod,S=x===void 0?"day":x,w=e.allowEmpty,B=w===void 0?"for-default-value":w,K=e.humanizeLabels,ee=K===void 0||K,U=e.humanizeValue,M=U!==void 0&&U,H=e.disabled,P=H!==void 0&&H,E=e.readOnly,N=E!==void 0&&E,Z=e.leadingZero,b=Z!==void 0&&Z,O=e.shortcuts,D=O===void 0?["@yearly","@annually","@monthly","@weekly","@daily","@midnight","@hourly"]:O,W=e.clockFormat,F=e.periodicityOnDoubleClick,T=F===void 0||F,L=e.mode,I=L===void 0?"multiple":L,ce=e.allowedDropdowns,_=ce===void 0?["period","months","month-days","week-days","hours","minutes"]:ce,ne=e.allowedPeriods,Uo=ne===void 0?["year","month","week","day","hour","minute","reboot"]:ne,re=y.useRef(s),Ae=y.useRef(S),Xe=y.useState(),X=Xe[0],he=Xe[1],Qe=y.useState(),ue=Qe[0],ve=Qe[1],Re=y.useState(),xe=Re[0],be=Re[1],eo=y.useState(),de=eo[0],ge=eo[1],oo=y.useState(),ke=oo[0],we=oo[1],to=y.useState(),Ce=to[0],Oe=to[1],no=y.useState(!1),Be=no[0],pe=no[1],ro=y.useState(!1),Se=ro[0],ao=ro[1],Wo=function(j){var G=y.useRef(j);return y.useEffect(function(){G.current=j},[j]),G.current}(Se),io=JSON.stringify(p);y.useEffect(function(){Ve(s,pe,h,B,re,!0,p,D,Oe,we,ve,be,ge,he)},[]),y.useEffect(function(){s!==re.current&&Ve(s,pe,h,B,re,!1,p,D,Oe,we,ve,be,ge,he)},[s,re,io,B,D]),y.useEffect(function(){if(!(X||Ce||xe||ue||de||ke)||Se||Wo)Se&&ao(!1);else{var j=X||Ae.current,G=qe(j,xe,ue,de,ke,Ce,M);v(G,{selectedPeriod:j}),re.current=G,h&&h(void 0),pe(!1)}},[X,ue,xe,de,ke,Ce,M,Se]);var lo=y.useCallback(function(){ve(void 0),be(void 0),ge(void 0),we(void 0),Oe(void 0);var j="",G=X!=="reboot"&&X?X:Ae.current;G!==X&&he(G),l==="fill-with-every"&&(j=qe(G,void 0,void 0,void 0,void 0,void 0)),v(j,{selectedPeriod:G}),re.current=j,ao(!0),B==="never"&&l==="empty"?(pe(!0),Ie(h,p)):(h&&h(void 0),pe(!1))},[X,v,h,l]),zo=y.useMemo(function(){var j;return J(((j={"react-js-cron":!0,"react-js-cron-error":Be&&f,"react-js-cron-disabled":P,"react-js-cron-read-only":N})["".concat(d)]=!!d,j["".concat(d,"-error")]=Be&&f&&!!d,j["".concat(d,"-disabled")]=P&&!!d,j["".concat(d,"-read-only")]=N&&!!d,j))},[d,Be,f,P,N]),Ne=r.className,so=je(r,["className"]),co=y.useMemo(function(){var j;return J(((j={"react-js-cron-clear-button":!0})["".concat(d,"-clear-button")]=!!d,j["".concat(Ne)]=!!Ne,j))},[d,Ne]),Jo=JSON.stringify(so),uo=y.useMemo(function(){return a&&!N?n.jsx(k.Button,q({className:co,danger:!0,type:"primary",disabled:P},so,{onClick:lo},{children:p.clearButtonText||C.clearButtonText})):null},[a,N,io,co,P,Jo,lo]),V=X||Ae.current;return n.jsxs("div",q({className:zo},{children:[_.includes("period")&&n.jsx(Bo,{value:V,setValue:he,locale:p,className:d,disabled:P,readOnly:N,shortcuts:D,allowedPeriods:Uo}),V==="reboot"?uo:n.jsxs(n.Fragment,{children:[V==="year"&&_.includes("months")&&n.jsx(Ao,{value:xe,setValue:be,locale:p,className:d,humanizeLabels:ee,disabled:P,readOnly:N,period:V,periodicityOnDoubleClick:T,mode:I}),(V==="year"||V==="month")&&_.includes("month-days")&&n.jsx(Do,{value:ue,setValue:ve,locale:p,className:d,weekDays:de,disabled:P,readOnly:N,leadingZero:b,period:V,periodicityOnDoubleClick:T,mode:I}),(V==="year"||V==="month"||V==="week")&&_.includes("week-days")&&n.jsx(No,{value:de,setValue:ge,locale:p,className:d,humanizeLabels:ee,monthDays:ue,disabled:P,readOnly:N,period:V,periodicityOnDoubleClick:T,mode:I}),n.jsxs("div",{children:[V!=="minute"&&V!=="hour"&&_.includes("hours")&&n.jsx(So,{value:ke,setValue:we,locale:p,className:d,disabled:P,readOnly:N,leadingZero:b,clockFormat:W,period:V,periodicityOnDoubleClick:T,mode:I}),V!=="minute"&&_.includes("minutes")&&n.jsx(Mo,{value:Ce,setValue:Oe,locale:p,period:V,className:d,disabled:P,readOnly:N,leadingZero:b,clockFormat:W,periodicityOnDoubleClick:T,mode:I}),uo]})]})]}))}const Po={"zh-CN":{everyText:"每",emptyMonths:"每月",emptyMonthDays:"每日(月)",emptyMonthDaysShort:"每日",emptyWeekDays:"每天(周)",emptyWeekDaysShort:"每天(周)",emptyHours:"每小时",emptyMinutes:"每分钟",emptyMinutesForHourPeriod:"每",yearOption:"年",monthOption:"月",weekOption:"周",dayOption:"天",hourOption:"小时",minuteOption:"分钟",rebootOption:"重启",prefixPeriod:"每",prefixMonths:"的",prefixMonthDays:"的",prefixWeekDays:"的",prefixWeekDaysForMonthAndYearPeriod:"或者",prefixHours:"的",prefixMinutes:":",prefixMinutesForHourPeriod:"的",suffixMinutesForHourPeriod:"分钟",errorInvalidCron:"不符合 cron 规则的表达式",clearButtonText:"清空",weekDays:["周日","周一","周二","周三","周四","周五","周六"],months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],altWeekDays:["周日","周一","周二","周三","周四","周五","周六"],altMonths:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]}},_e=[{value:"none",text:"No repeat"},{value:6e4,text:"By minute",unitText:"Minutes"},{value:36e5,text:"By hour",unitText:"Hours"},{value:864e5,text:"By day",unitText:"Days"},{value:6048e5,text:"By week",unitText:"Weeks"},{value:"cron",text:"Advanced"}];function Ge(e){return _e.filter(a=>!isNaN(+a.value)).reverse().find(a=>!(e%a.value))}function To(e){if(!e)return"none";if(e&&!isNaN(+e)){const t=Ge(e);return t?t.value:"none"}if(typeof e=="string")return"cron"}function jo({value:e,onChange:t}){const{t:a}=R(),o=Ge(e);return n.jsx(k.InputNumber,{value:e/o.value,onChange:r=>t(r*o.value),min:1,addonBefore:a("Every"),addonAfter:a(o.unitText),className:"auto-width"})}function Eo({value:e=null,onChange:t}){const{t:a}=R(),o=To(e),r=y.useCallback(l=>{if(l==="none"){t(null);return}if(l==="cron"){t("0 * * * * *");return}t(l)},[t]),c=Po[localStorage.getItem("TACHYBASE_LOCALE")||"en-US"];return n.jsxs("fieldset",{className:g.css`
1
+ (function(T,k){typeof exports=="object"&&typeof module!="undefined"?k(exports,require("@tachybase/client"),require("react/jsx-runtime"),require("react"),require("@tego/client"),require("@ant-design/icons"),require("antd"),require("react-i18next")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","react/jsx-runtime","react","@tego/client","@ant-design/icons","antd","react-i18next"],k):(T=typeof globalThis!="undefined"?globalThis:T||self,k(T["@tachybase/module-backup"]={},T["@tachybase/client"],T.jsxRuntime,T.react,T["@tego/client"],T["@ant-design/icons"],T.antd,T["react-i18next"]))})(this,function(T,k,n,f,me,Q,w,ie){"use strict";var Zo=Object.defineProperty,_o=Object.defineProperties;var Go=Object.getOwnPropertyDescriptors;var po=Object.getOwnPropertySymbols;var $o=Object.prototype.hasOwnProperty,Yo=Object.prototype.propertyIsEnumerable;var mo=(T,k,n)=>k in T?Zo(T,k,{enumerable:!0,configurable:!0,writable:!0,value:n}):T[k]=n,ae=(T,k)=>{for(var n in k||(k={}))$o.call(k,n)&&mo(T,n,k[n]);if(po)for(var n of po(k))Yo.call(k,n)&&mo(T,n,k[n]);return T},De=(T,k)=>_o(T,Go(k));var K=(T,k,n)=>new Promise((f,me)=>{var Q=J=>{try{ie(n.next(J))}catch(R){me(R)}},w=J=>{try{ie(n.throw(J))}catch(R){me(R)}},ie=J=>J.done?f(J.value):Promise.resolve(J.value).then(Q,w);ie((n=n.apply(T,k)).next())});var J=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},R={exports:{}},fo=R.exports,Te;function yo(){return Te||(Te=1,function(e,t){(function(i,o){o()})(fo,function(){function i(a,c){return typeof c=="undefined"?c={autoBom:!1}:typeof c!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),c={autoBom:!c}),c.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\uFEFF",a],{type:a.type}):a}function o(a,c,v){var u=new XMLHttpRequest;u.open("GET",a),u.responseType="blob",u.onload=function(){d(u.response,c,v)},u.onerror=function(){console.error("could not download file")},u.send()}function r(a){var c=new XMLHttpRequest;c.open("HEAD",a,!1);try{c.send()}catch(v){}return 200<=c.status&&299>=c.status}function l(a){try{a.dispatchEvent(new MouseEvent("click"))}catch(v){var c=document.createEvent("MouseEvents");c.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),a.dispatchEvent(c)}}var s=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof J=="object"&&J.global===J?J:void 0,m=s.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),d=s.saveAs||(typeof window!="object"||window!==s?function(){}:"download"in HTMLAnchorElement.prototype&&!m?function(a,c,v){var u=s.URL||s.webkitURL,y=document.createElement("a");c=c||a.name||"download",y.download=c,y.rel="noopener",typeof a=="string"?(y.href=a,y.origin===location.origin?l(y):r(y.href)?o(a,c,v):l(y,y.target="_blank")):(y.href=u.createObjectURL(a),setTimeout(function(){u.revokeObjectURL(y.href)},4e4),setTimeout(function(){l(y)},0))}:"msSaveOrOpenBlob"in navigator?function(a,c,v){if(c=c||a.name||"download",typeof a!="string")navigator.msSaveOrOpenBlob(i(a,v),c);else if(r(a))o(a,c,v);else{var u=document.createElement("a");u.href=a,u.target="_blank",setTimeout(function(){l(u)})}}:function(a,c,v,u){if(u=u||open("","_blank"),u&&(u.document.title=u.document.body.innerText="downloading..."),typeof a=="string")return o(a,c,v);var y=a.type==="application/octet-stream",h=/constructor/i.test(s.HTMLElement)||s.safari,p=/CriOS\/[\d]+/.test(navigator.userAgent);if((p||y&&h||m)&&typeof FileReader!="undefined"){var b=new FileReader;b.onloadend=function(){var M=b.result;M=p?M:M.replace(/^data:[^;]*;/,"data:attachment/file;"),u?u.location.href=M:location=M,u=null},b.readAsDataURL(a)}else{var L=s.URL||s.webkitURL,S=L.createObjectURL(a);u?u.location=S:location.href=S,u=null,setTimeout(function(){L.revokeObjectURL(S)},4e4)}});s.saveAs=d.saveAs=d,e.exports=d})}(R)),R.exports}var ho=yo();const le="backup";function ee(){return ie.useTranslation([le,"core"],{nsMode:"fallback"})}const vo=e=>k.tval(e,{ns:le}),{Dragger:bo}=w.Upload;function xo(e){const t=o=>{var r;(r=e.onChange)==null||r.call(e,o)},i=k.useAPIClient();return De(ae({},e),{customRequest({action:o,data:r,file:l,filename:s,headers:m,onError:d,onProgress:a,onSuccess:c,withCredentials:v}){const u=new FormData;return r&&Object.keys(r).forEach(y=>{u.append(y,r[y])}),u.append(s,l),i.axios.post(o,u,{withCredentials:v,headers:m,onUploadProgress:({total:y,loaded:h})=>{a({percent:Math.round(h/y*100).toFixed(2)},l)}}).then(({data:y})=>{c(y,l)}).catch(d).finally(()=>{}),{abort(){console.log("upload progress is aborted.")}}},onChange:t})}const Fe=e=>{const{collectionsData:t}=e,{t:i}=ee(),[o,r]=f.useState(!1),[l,s]=f.useState(t);f.useEffect(()=>{s(t)},[t]);const m=k.useAPIClient(),d=k.useCompile(),a=f.useMemo(()=>m.resource("backupFiles"),[m]),c=()=>K(null,null,function*(){if(e.isBackup){const p=yield a.dumpableCollections();s(p==null?void 0:p.data),r(!0)}r(!0)}),v=()=>{r(!1)},u=()=>{r(!1)},y=[{title:i("Collection"),dataIndex:"collection",key:"collection",render:(p,b)=>{const L=d(b.title);return b.name===L?L:n.jsxs("div",{children:[b.name," ",n.jsxs("span",{style:{color:"rgba(0, 0, 0, 0.3)",fontSize:"0.9em"},children:["(",d(b.title),")"]})]})}},{title:i("Origin"),dataIndex:"origin",key:"origin",width:"50%"}],h=Object.keys(l||{}).map(p=>({key:p,label:i(`${p}.title`),children:n.jsxs(n.Fragment,{children:[n.jsx(w.Alert,{style:{marginBottom:16},message:i(`${p}.description`)}),n.jsx(w.Table,{pagination:{pageSize:100},bordered:!0,size:"small",dataSource:l[p],columns:y,scroll:{y:400}})]})}));return n.jsxs(n.Fragment,{children:[n.jsx("a",{onClick:c,children:i("Learn more")}),n.jsx(w.Modal,{title:i("Backup instructions"),width:"80vw",open:o,footer:null,onOk:v,onCancel:u,children:n.jsx(w.Tabs,{defaultActiveKey:"required",items:h})})]})},Pe=({ButtonComponent:e=w.Button,title:t,upload:i=!1,fileData:o})=>{const{t:r}=ee(),[l,s]=f.useState(["required"]),[m,d]=f.useState(!1),[a,c]=f.useState(null),[v,u]=f.useState(!1),y=k.useAPIClient(),h=f.useMemo(()=>y.resource("backupFiles"),[y]),[p,b]=f.useState([]),L=l.length>0&&l.length<p.length,S=p.length===l.length;f.useEffect(()=>{b(Object.keys((a==null?void 0:a.dumpableCollectionsGroupByGroup)||[]).map(x=>({value:x,label:r(`${x}.title`),disabled:["required","skipped"].includes(x)})))},[a]);const M=()=>K(null,null,function*(){var x,N,j;if(d(!0),!i){u(!0);const{data:V}=yield h.get({filterByTk:o.name});b(Object.keys(((N=(x=V==null?void 0:V.data)==null?void 0:x.meta)==null?void 0:N.dumpableCollectionsGroupByGroup)||[]).map(F=>({value:F,label:r(`${F}.title`),disabled:["required","skipped"].includes(F)}))),c((j=V==null?void 0:V.data)==null?void 0:j.meta),u(!1)}}),_=()=>{h.restore({values:{dataTypes:l,filterByTk:o==null?void 0:o.name,key:a==null?void 0:a.key}}),d(!1)},D=()=>{d(!1),c(null),s(["required"])},A=x=>{s(x.target.checked?p.map(N=>N.value):["required"])};return n.jsxs(n.Fragment,{children:[n.jsx(e,{onClick:M,children:t}),n.jsx(w.Modal,{title:r("Restore"),width:800,footer:i&&!a?null:void 0,open:m,onOk:_,onCancel:D,children:n.jsxs(w.Spin,{spinning:v,children:[i&&!a&&n.jsx(ko,{setRestoreData:c}),(!i||a)&&[n.jsxs("strong",{style:{fontWeight:600,display:"block",margin:"16px 0 8px"},children:[r("Select the data to be restored")," (",n.jsx(Fe,{collectionsData:a==null?void 0:a.dumpableCollectionsGroupByGroup}),"):"]},"info"),n.jsx("div",{style:{lineHeight:2,marginBottom:8},children:n.jsxs(me.FormItem,{children:[n.jsx(k.Checkbox.Group,{options:p,style:{flexDirection:"column"},value:l,onChange:x=>s(x)}),n.jsx(w.Divider,{}),n.jsx(k.Checkbox,{indeterminate:L,onChange:A,checked:S,children:r("Check all")})]})},"dataType")]]})})]})},go=({ButtonComponent:e=w.Button,refresh:t})=>{const{t:i}=ee(),[o,r]=f.useState(!1),[l,s]=f.useState(["required"]),m=k.useAPIClient(),{notification:d}=w.App.useApp(),[a,c]=f.useState([]),v=["required","user","third-party","custom"],u=l.length>0&&l.length<a.filter(D=>D.value!=="skipped").length,y=a.filter(D=>D.value!=="skipped").length===l.length,h=D=>{s(D.target.checked?a.filter(A=>A.value!=="skipped").map(A=>A.value):["required"])},p=D=>{const A=a.filter(x=>v.includes(x.value)&&x.value!=="skipped").map(x=>x.value);if(D.target.checked){const x=[...new Set([...l.filter(N=>N==="required"),...A])];s(x)}else s(["required"])},b=f.useMemo(()=>{const D=a.filter(N=>v.includes(N.value)&&N.value!=="skipped").map(N=>N.value),A=D.filter(N=>l.includes(N)),x=l.filter(N=>N!=="required"&&!D.includes(N));return D.length>0&&A.length===D.length&&x.length===0},[l,a]),L=f.useMemo(()=>{const D=a.filter(x=>v.includes(x.value)&&x.value!=="skipped").map(x=>x.value),A=D.filter(x=>l.includes(x));return A.length>0&&A.length<D.length},[l,a]),S=()=>K(null,null,function*(){const{data:D}=yield m.resource("backupFiles").dumpableCollections();c(Object.keys(D||[]).map(A=>({value:A,label:i(`${A}.title`),disabled:["required","skipped"].includes(A)}))),r(!0)}),M=D=>{m.request({url:"backupFiles:create",method:"post",data:{dataTypes:l,method:D}}),d.info({key:"backup",message:n.jsxs("span",{children:[i("Processing..."),"    ",n.jsx(w.Spin,{indicator:n.jsx(Q.LoadingOutlined,{style:{fontSize:24},spin:!0})})]}),duration:0}),r(!1),s(["required"]),setTimeout(()=>{t()},500)},_=()=>{r(!1),s(["required"])};return n.jsxs(n.Fragment,{children:[n.jsx(e,{icon:n.jsx(Q.PlusOutlined,{}),type:"primary",onClick:S,children:i("New backup")}),n.jsxs(w.Modal,{title:i("New backup"),width:800,open:o,onCancel:_,footer:[n.jsxs(w.Row,{gutter:16,justify:"end",align:"middle",children:[n.jsx(w.Col,{children:n.jsx(w.Button,{onClick:_,children:i("Cancel")},"cancel")}),n.jsx(w.Col,{children:n.jsx(w.Dropdown.Button,{type:"primary",onClick:()=>M("priority"),overlay:n.jsxs(w.Menu,{children:[n.jsx(w.Menu.Item,{onClick:()=>M("main"),children:i("Self backup")},"main"),n.jsx(w.Menu.Item,{onClick:()=>M("worker"),children:i("Worker backup")},"worker")]}),children:i("Backup")},"submit")})]})],children:[n.jsxs("strong",{style:{fontWeight:600,display:"block",margin:"16px 0 8px"},children:[i("Select the data to be backed up")," (",n.jsx(Fe,{isBackup:!0}),"):"]}),n.jsxs("div",{style:{lineHeight:2,marginBottom:8},children:[n.jsx(k.Checkbox.Group,{options:a,style:{flexDirection:"column"},onChange:D=>s(D),value:l}),n.jsx(w.Divider,{}),n.jsxs(w.Space,{children:[n.jsx(k.Checkbox,{indeterminate:L,onChange:p,checked:b,children:i("Check common")}),n.jsx(k.Checkbox,{indeterminate:u,onChange:h,checked:y,children:i("Check all")})]})]})]})]})},ko=e=>{const{t}=ee(),i={multiple:!1,action:"/backupFiles:upload",onChange(o){var l,s,m;o.fileList.length>1&&o.fileList.splice(0,o.fileList.length-1);const{status:r}=o.file;r==="done"?(w.message.success(`${o.file.name} `+t("file uploaded successfully")),e.setRestoreData(De(ae({},(s=(l=o.file.response)==null?void 0:l.data)==null?void 0:s.meta),{key:(m=o.file.response)==null?void 0:m.data.key}))):r==="error"&&w.message.error(`${o.file.name} `+t("file upload failed"))},onDrop(o){console.log("Dropped files",o.dataTransfer.files)}};return n.jsxs(bo,De(ae({},xo(i)),{children:[n.jsx("p",{className:"ant-upload-drag-icon",children:n.jsx(Q.InboxOutlined,{})}),n.jsxs("p",{className:"ant-upload-text",children:[" ",t("Click or drag file to this area to upload")]})]}))},wo=()=>{const{t:e}=ee(),t=k.useAPIClient(),[i,o]=f.useState([]),[r,l]=f.useState(!1),[s,m]=f.useState(!1),{modal:d,notification:a}=w.App.useApp(),c=f.useMemo(()=>t.resource("backupFiles"),[t]),v=f.useCallback(()=>K(null,null,function*(){yield u()}),[]);k.useNoticeSub("backup",p=>{(a[p.level]||a.info)({key:"backup",message:p.msg}),v()}),f.useEffect(()=>{u()},[]);const u=()=>K(null,null,function*(){l(!0);const{data:p}=yield c.list();o(p.data),l(!1)}),y=p=>K(null,null,function*(){m(p.name);const b=yield t.request({url:"backupFiles:download",method:"get",params:{filterByTk:p.name},responseType:"blob",onDownloadProgress:S=>{const M=Math.round(S.loaded*100/S.total);M>=100?a.success({key:"downloadBackup",message:n.jsx("span",{children:e("Downloaded success!")}),duration:1}):a.info({key:"downloadBackup",message:n.jsxs("span",{children:[e("Downloading ")+M+"%","    ",n.jsx(w.Spin,{indicator:n.jsx(Q.LoadingOutlined,{style:{fontSize:24},spin:!0})})]}),duration:0})}});m(!1);const L=new Blob([b.data]);ho.saveAs(L,p.name)}),h=p=>{d.confirm({title:e("Delete record",{ns:"core"}),content:e("Are you sure you want to delete it?",{ns:"core"}),onOk:()=>K(null,null,function*(){yield c.destroy({filterByTk:p.name}),yield u(),w.message.success(e("Deleted successfully"))})})};return n.jsx("div",{children:n.jsxs(w.Card,{bordered:!1,children:[n.jsxs(w.Space,{style:{float:"right",marginBottom:16},children:[n.jsx(w.Button,{onClick:v,icon:n.jsx(Q.ReloadOutlined,{}),children:e("Refresh")}),n.jsx(Pe,{upload:!0,title:n.jsxs(n.Fragment,{children:[n.jsx(Q.UploadOutlined,{})," ",e("Restore backup from local")]})}),n.jsx(go,{refresh:v})]}),n.jsx(w.Table,{dataSource:i,loading:r,columns:[{title:e("Backup file"),dataIndex:"name",width:400,onCell:p=>p.inProgress?{colSpan:4}:{},render:(p,b)=>b.inProgress?n.jsxs("div",{style:{color:"rgba(0, 0, 0, 0.88)"},children:[p,"(",e("Backing up"),"...)"]}):b.status==="error"?n.jsxs("div",{style:{color:"red"},children:[p,"(",e("Error"),")"]}):n.jsx("div",{children:p})},{title:e("File size"),dataIndex:"fileSize",onCell:p=>p.inProgress?{colSpan:0}:{}},{title:e("Created at",{ns:"core"}),dataIndex:"createdAt",onCell:p=>p.inProgress?{colSpan:0}:{},render:p=>n.jsx(k.DatePicker.ReadPretty,{value:p,showTime:!0})},{title:e("Actions",{ns:"core"}),dataIndex:"actions",onCell:p=>p.inProgress?{colSpan:0}:{},render:(p,b)=>n.jsxs(w.Space,{split:n.jsx(w.Divider,{type:"vertical"}),children:[b.status!=="error"&&n.jsx(Pe,{ButtonComponent:"a",title:e("Restore"),fileData:b}),b.status!=="error"&&n.jsx("a",{type:"link",onClick:()=>y(b),children:e("Download")}),n.jsx("a",{onClick:()=>h(b),children:e("Delete")})]})}]})]})})},Co={dumpRules:"required",name:"autoBackup",shared:!0,createdAt:!0,updatedAt:!0,createdBy:!0,updatedBy:!0,fields:[{type:"string",name:"title",required:!0,uiSchema:{title:'{{ t("Title") }}',type:"string","x-component":"Input",required:!0}},{type:"boolean",name:"enabled",defaultValue:!1,uiSchema:{title:'{{ t("Enabled") }}',type:"boolean","x-component":"Checkbox",required:!0}},{type:"array",name:"dumpRules",uiSchema:{title:'{{ t("Dump rules") }}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"repeat",required:!0,uiSchema:{title:'{{t("Repeat mode")}}',type:"string","x-component":"RepeatField"}},{type:"integer",name:"maxNumber",uiSchema:{title:'{{ t("Max number") }}',type:"integer","x-component":"Input",required:!0}}]};var W=function(){return W=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},W.apply(this,arguments)};function je(e,t){var i={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(i[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(i[o[r]]=e[o[r]])}return i}function fe(e,t,i){if(i||arguments.length===2)for(var o,r=0,l=t.length;r<l;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var Oo=[{name:"@yearly",value:"0 0 1 1 *"},{name:"@annually",value:"0 0 1 1 *"},{name:"@monthly",value:"0 0 1 * *"},{name:"@weekly",value:"0 0 * * 0"},{name:"@daily",value:"0 0 * * *"},{name:"@midnight",value:"0 0 * * *"},{name:"@hourly",value:"0 * * * *"}],oe=[{type:"minutes",min:0,max:59,total:60},{type:"hours",min:0,max:23,total:24},{type:"month-days",min:1,max:31,total:31},{type:"months",min:1,max:12,total:12,alt:["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]},{type:"week-days",min:0,max:6,total:7,alt:["SUN","MON","TUE","WED","THU","FRI","SAT"]}],C={everyText:"every",emptyMonths:"every month",emptyMonthDays:"every day of the month",emptyMonthDaysShort:"day of the month",emptyWeekDays:"every day of the week",emptyWeekDaysShort:"day of the week",emptyHours:"every hour",emptyMinutes:"every minute",emptyMinutesForHourPeriod:"every",yearOption:"year",monthOption:"month",weekOption:"week",dayOption:"day",hourOption:"hour",minuteOption:"minute",rebootOption:"reboot",prefixPeriod:"Every",prefixMonths:"in",prefixMonthDays:"on",prefixWeekDays:"on",prefixWeekDaysForMonthAndYearPeriod:"and",prefixHours:"at",prefixMinutes:":",prefixMinutesForHourPeriod:"at",suffixMinutesForHourPeriod:"minute(s)",errorInvalidCron:"Invalid cron expression",clearButtonText:"Clear",weekDays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],altWeekDays:["SUN","MON","TUE","WED","THU","FRI","SAT"],altMonths:["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]};function Ee(e,t){for(var i=[],o=e;o<=t;o++)i.push(o);return i}function ye(e){return e.sort(function(t,i){return t-i}),e}function Ie(e){var t=[];return e.forEach(function(i){t.indexOf(i)<0&&t.push(i)}),t}function Z(e){return Object.entries(e).filter(function(t){var i=t[0],o=t[1];return i&&o}).map(function(t){return t[0]}).join(" ")}function Le(e,t){e&&e({type:"invalid_cron",description:t.errorInvalidCron||C.errorInvalidCron})}function he(e){var t=parseInt(e,10),i=Number(e);return t===i?i:NaN}function Ve(e,t,i,o,r,l,s,m,d,a,c,v,u,y){i&&i(void 0),t(!1);var h=!1;if(!e){if(o==="always"||l&&o==="for-default-value")return;h=!0}if(!h){if(m&&(m===!0||m.includes(e))){if(e==="@reboot")return void y("reboot");var p=Oo.find(function(S){return S.name===e});p&&(e=p.value)}try{var b=function(S){if(typeof S!="string")throw new Error("Invalid cron string");var M=S.replace(/\s+/g," ").trim().split(" ");if(M.length===5)return M.map(function(_,D){return function(A,x){if(A==="*"||A==="*/1")return[];var N=ye(Ie(We(function(V,F,G){if(G){V=V.toUpperCase();for(var g=0;g<G.length;g++)V=V.replace(G[g],"".concat(g+F))}return V}(A,x.min,x.alt).split(",").map(function(V){var F,G=V.split("/");if(G.length>2)throw new Error('Invalid value "'.concat(A,' for "').concat(x.type,'"'));var g=G[0],O=G[1];F=g==="*"?Ee(x.min,x.max):function(P,E,q){var H=P.split("-");if(H.length===1){var ce=he(H[0]);if(isNaN(ce))throw new Error('Invalid value "'.concat(E,'" for ').concat(q.type));return[ce]}if(H.length===2){var $=he(H[0]),ne=he(H[1]);if(isNaN($)||isNaN(ne))throw new Error('Invalid value "'.concat(E,'" for ').concat(q.type));if(ne<$)throw new Error('Max range is less than min range in "'.concat(P,'" for ').concat(q.type));return Ee($,ne)}throw new Error('Invalid value "'.concat(P,'" for ').concat(q.type))}(g,A,x);var B=function(P,E){if(P!==void 0){var q=he(P);if(isNaN(q)||q<1)throw new Error('Invalid interval step value "'.concat(P,'" for ').concat(E.type));return q}}(O,x),z=function(P,E){if(E){var q=P[0];P=P.filter(function(H){return H%E==q%E||H===q})}return P}(F,B);return z}).flat(),x))),j=ze(N,x);if(j!==void 0)throw new Error('Value "'.concat(j,'" out of range for ').concat(x.type));return N.length===x.total?[]:N}(_,oe[D])});throw new Error("Invalid cron string format")}(e),L=function(S){return S[3].length>0?"year":S[2].length>0?"month":S[4].length>0?"week":S[1].length>0?"day":S[0].length>0?"hour":"minute"}(b);y(L),d(b[0]),a(b[1]),c(b[2]),v(b[3]),u(b[4])}catch(S){h=!0}}h&&(r.current=e,t(!0),Le(i,s))}function qe(e,t,i,o,r,l,s){if(e==="reboot")return"@reboot";var m=function(d,a){return d.map(function(c,v){var u=oe[v];return He(Ue(c,u),u,a)})}([e!=="minute"&&l?l:[],e!=="minute"&&e!=="hour"&&r?r:[],e!=="year"&&e!=="month"||!i?[]:i,e==="year"&&t?t:[],e!=="year"&&e!=="month"&&e!=="week"||!o?[]:o],s);return m.join(" ")}function He(e,t,i,o,r){var l="";if(function(m,d){return m.length===d.max-d.min+1}(e,t)||e.length===0)l="*";else{var s=function(m){if(m.length>2){var d=m[1]-m[0];if(d>1)return d}}(e);l=s&&function(m,d){for(var a=1;a<m.length;a++){var c=m[a-1];if(m[a]-c!==d)return!1}return!0}(e,s)?function(m,d,a){var c=Je(m),v=Ze(m),u=m.length===(v-c)/a+1;return!!(c===d.min&&v+a>d.max&&u)}(e,t,s)?"*/".concat(s):"".concat(te(Je(e),t,i,o,r),"-").concat(te(Ze(e),t,i,o,r),"/").concat(s):function(m){var d=[],a=null;return m.forEach(function(c,v,u){c!==u[v+1]-1?a!==null?(d.push([a,c]),a=null):d.push(c):a===null&&(a=c)}),d}(e).map(function(m){return Array.isArray(m)?"".concat(te(m[0],t,i,o,r),"-").concat(te(m[1],t,i,o,r)):te(m,t,i,o,r)}).join(",")}return l}function te(e,t,i,o,r){var l=e.toString(),s=t.type,m=t.alt,d=t.min,a=o&&(o===!0||o.includes(s)),c=r==="24-hour-clock"&&(s==="hours"||s==="minutes");if(i&&s==="week-days"||i&&s==="months"?l=m[e-d]:e<10&&(a||c)&&(l=l.padStart(2,"0")),s==="hours"&&r==="12-hour-clock"){var v=e>=12?"PM":"AM",u=e%12||12;u<10&&a&&(u=u.toString().padStart(2,"0")),l="".concat(u).concat(v)}return l}function Ue(e,t){var i=ye(Ie(We(e,t)));if(i.length===0)return i;var o=ze(i,t);if(o!==void 0)throw new Error('Value "'.concat(o,'" out of range for ').concat(t.type));return i}function We(e,t){return t.type==="week-days"&&(e=e.map(function(i){return i===7?0:i})),e}function ze(e,t){var i=e[0],o=e[e.length-1];return i<t.min?i:o>t.max?o:void 0}function Je(e){return e[0]}function Ze(e){return e[e.length-1]}function se(e){var t=e.value,i=e.grid,o=i===void 0||i,r=e.optionsList,l=e.setValue,s=e.locale,m=e.className,d=e.humanizeLabels,a=e.disabled,c=e.readOnly,v=e.leadingZero,u=e.clockFormat,y=e.period,h=e.unit,p=e.periodicityOnDoubleClick,b=e.mode,L=je(e,["value","grid","optionsList","setValue","locale","className","humanizeLabels","disabled","readOnly","leadingZero","clockFormat","period","unit","periodicityOnDoubleClick","mode"]),S=f.useMemo(function(){if(t&&Array.isArray(t))return t.map(function(g){return g.toString()})},[t]),M=f.useMemo(function(){return r?r.map(function(g,O){return{value:(h.min===0?O:O+1).toString(),label:g}}):fe([],Array(h.total),!0).map(function(g,O){var B=h.min===0?O:O+1;return{value:B.toString(),label:te(B,h,d,v,u)}})},[r,v,d,u]),_=JSON.stringify(s),D=f.useCallback(function(g){var O=g.value;if(!t||t[0]!==Number(O))return n.jsx(n.Fragment,{});var B=He(Ue(t,h),h,d,v,u),z=B.match(/^\*\/([0-9]+),?/)||[];return n.jsx("div",{children:z[1]?"".concat(s.everyText||C.everyText," ").concat(z[1]):B})},[t,_,d,v,u]),A=f.useCallback(function(g){var O=Array.isArray(g)?ye(g):[g],B=O;t&&(B=b==="single"?[]:fe([],t,!0),O.forEach(function(z){var P=Number(z);B=t.some(function(E){return E===P})?B.filter(function(E){return E!==P}):ye(fe(fe([],B,!0),[P],!1))})),B.length===h.total?l([]):l(B)},[l,t]),x=f.useCallback(function(g){if(g!==0&&g!==1){for(var O=h.total+h.min,B=[],z=h.min;z<O;z++)z%g==0&&B.push(z);var P=t&&B&&t.length===B.length&&t.every(function(q,H){return q===B[H]}),E=B.length===M.length;l(E||P?[]:B)}else l([])},[t,M,l]),N=f.useRef([]),j=f.useCallback(function(g){if(!c){var O=N.current;O.push({time:new Date().getTime(),value:Number(g)});var B=window.setTimeout(function(){p&&O.length>1&&O[O.length-1].time-O[O.length-2].time<300?O[O.length-1].value===O[O.length-2].value?x(Number(g)):A([O[O.length-2].value,O[O.length-1].value]):A(Number(g)),N.current=[]},300);return function(){window.clearTimeout(B)}}},[N,A,x,c,p]),V=f.useCallback(function(){c||l([])},[l,c]),F=f.useMemo(function(){var g;return Z(((g={"react-js-cron-select":!0,"react-js-cron-custom-select":!0})["".concat(m,"-select")]=!!m,g))},[m]),G=f.useMemo(function(){var g;return Z(((g={"react-js-cron-select-dropdown":!0})["react-js-cron-select-dropdown-".concat(h.type)]=!0,g["react-js-cron-custom-select-dropdown"]=!0,g["react-js-cron-custom-select-dropdown-".concat(h.type)]=!0,g["react-js-cron-custom-select-dropdown-minutes-large"]=h.type==="minutes"&&y!=="hour"&&y!=="day",g["react-js-cron-custom-select-dropdown-minutes-medium"]=h.type==="minutes"&&(y==="day"||y==="hour"),g["react-js-cron-custom-select-dropdown-hours-twelve-hour-clock"]=h.type==="hours"&&u==="12-hour-clock",g["react-js-cron-custom-select-dropdown-grid"]=!!o,g["".concat(m,"-select-dropdown")]=!!m,g["".concat(m,"-select-dropdown-").concat(h.type)]=!!m,g))},[m,o,u,y]);return n.jsx(w.Select,W({mode:b!=="single"||p?"multiple":void 0,allowClear:!c,virtual:!1,open:!c&&void 0,value:S,onClear:V,tagRender:D,className:F,popupClassName:G,options:M,showSearch:!1,showArrow:!c,menuItemSelectedIcon:null,dropdownMatchSelectWidth:!1,onSelect:j,onDeselect:j,disabled:a,dropdownAlign:h.type!=="minutes"&&h.type!=="hours"||y==="day"||y==="hour"?void 0:{points:["tr","br"]},"data-testid":"custom-select-".concat(h.type)},L))}function So(e){var t=e.value,i=e.setValue,o=e.locale,r=e.className,l=e.disabled,s=e.readOnly,m=e.leadingZero,d=e.clockFormat,a=e.period,c=e.periodicityOnDoubleClick,v=e.mode,u=f.useMemo(function(){var y;return Z(((y={"react-js-cron-field":!0,"react-js-cron-hours":!0})["".concat(r,"-field")]=!!r,y["".concat(r,"-hours")]=!!r,y))},[r]);return n.jsxs("div",W({className:u},{children:[o.prefixHours!==""&&n.jsx("span",{children:o.prefixHours||C.prefixHours}),n.jsx(se,{placeholder:o.emptyHours||C.emptyHours,value:t,unit:oe[1],setValue:i,locale:o,className:r,disabled:l,readOnly:s,leadingZero:m,clockFormat:d,period:a,periodicityOnDoubleClick:c,mode:v})]}))}function Mo(e){var t=e.value,i=e.setValue,o=e.locale,r=e.className,l=e.disabled,s=e.readOnly,m=e.leadingZero,d=e.clockFormat,a=e.period,c=e.periodicityOnDoubleClick,v=e.mode,u=f.useMemo(function(){var y;return Z(((y={"react-js-cron-field":!0,"react-js-cron-minutes":!0})["".concat(r,"-field")]=!!r,y["".concat(r,"-minutes")]=!!r,y))},[r]);return n.jsxs("div",W({className:u},{children:[a==="hour"?o.prefixMinutesForHourPeriod!==""&&n.jsx("span",{children:o.prefixMinutesForHourPeriod||C.prefixMinutesForHourPeriod}):o.prefixMinutes!==""&&n.jsx("span",{children:o.prefixMinutes||C.prefixMinutes}),n.jsx(se,{placeholder:a==="hour"?o.emptyMinutesForHourPeriod||C.emptyMinutesForHourPeriod:o.emptyMinutes||C.emptyMinutes,value:t,unit:oe[0],setValue:i,locale:o,className:r,disabled:l,readOnly:s,leadingZero:m,clockFormat:d,period:a,periodicityOnDoubleClick:c,mode:v}),a==="hour"&&o.suffixMinutesForHourPeriod!==""&&n.jsx("span",{children:o.suffixMinutesForHourPeriod||C.suffixMinutesForHourPeriod})]}))}function Do(e){var t=e.value,i=e.setValue,o=e.locale,r=e.className,l=e.weekDays,s=e.disabled,m=e.readOnly,d=e.leadingZero,a=e.period,c=e.periodicityOnDoubleClick,v=e.mode,u=!l||l.length===0,y=f.useMemo(function(){var b;return Z(((b={"react-js-cron-field":!0,"react-js-cron-month-days":!0,"react-js-cron-month-days-placeholder":!u})["".concat(r,"-field")]=!!r,b["".concat(r,"-month-days")]=!!r,b))},[r,u]),h=JSON.stringify(o),p=f.useMemo(function(){return u?o.emptyMonthDays||C.emptyMonthDays:o.emptyMonthDaysShort||C.emptyMonthDaysShort},[u,h]);return!m||t&&t.length>0||(!t||t.length===0)&&(!l||l.length===0)?n.jsxs("div",W({className:y},{children:[o.prefixMonthDays!==""&&n.jsx("span",{children:o.prefixMonthDays||C.prefixMonthDays}),n.jsx(se,{placeholder:p,value:t,setValue:i,unit:oe[2],locale:o,className:r,disabled:s,readOnly:m,leadingZero:d,period:a,periodicityOnDoubleClick:c,mode:v})]})):null}function Ao(e){var t=e.value,i=e.setValue,o=e.locale,r=e.className,l=e.humanizeLabels,s=e.disabled,m=e.readOnly,d=e.period,a=e.periodicityOnDoubleClick,c=e.mode,v=o.months||C.months,u=f.useMemo(function(){var y;return Z(((y={"react-js-cron-field":!0,"react-js-cron-months":!0})["".concat(r,"-field")]=!!r,y["".concat(r,"-months")]=!!r,y))},[r]);return n.jsxs("div",W({className:u},{children:[o.prefixMonths!==""&&n.jsx("span",{children:o.prefixMonths||C.prefixMonths}),n.jsx(se,{placeholder:o.emptyMonths||C.emptyMonths,optionsList:v,grid:!1,value:t,unit:W(W({},oe[3]),{alt:o.altMonths||C.altMonths}),setValue:i,locale:o,className:r,humanizeLabels:l,disabled:s,readOnly:m,period:d,periodicityOnDoubleClick:a,mode:c})]}))}function Bo(e){var t=e.value,i=e.setValue,o=e.locale,r=e.className,l=e.disabled,s=e.readOnly,m=e.shortcuts,d=e.allowedPeriods,a=[];d.includes("year")&&a.push({value:"year",label:o.yearOption||C.yearOption}),d.includes("month")&&a.push({value:"month",label:o.monthOption||C.monthOption}),d.includes("week")&&a.push({value:"week",label:o.weekOption||C.weekOption}),d.includes("day")&&a.push({value:"day",label:o.dayOption||C.dayOption}),d.includes("hour")&&a.push({value:"hour",label:o.hourOption||C.hourOption}),d.includes("minute")&&a.push({value:"minute",label:o.minuteOption||C.minuteOption}),d.includes("reboot")&&m&&(m===!0||m.includes("@reboot"))&&a.push({value:"reboot",label:o.rebootOption||C.rebootOption});var c=f.useCallback(function(h){s||i(h)},[i,s]),v=f.useMemo(function(){var h;return Z(((h={"react-js-cron-field":!0,"react-js-cron-period":!0})["".concat(r,"-field")]=!!r,h["".concat(r,"-period")]=!!r,h))},[r]),u=f.useMemo(function(){var h;return Z(((h={"react-js-cron-select":!0,"react-js-cron-select-no-prefix":o.prefixPeriod===""})["".concat(r,"-select")]=!!r,h))},[r,o.prefixPeriod]),y=f.useMemo(function(){var h;return Z(((h={"react-js-cron-select-dropdown":!0,"react-js-cron-select-dropdown-period":!0})["".concat(r,"-select-dropdown")]=!!r,h["".concat(r,"-select-dropdown-period")]=!!r,h))},[r]);return n.jsxs("div",W({className:v},{children:[o.prefixPeriod!==""&&n.jsx("span",{children:o.prefixPeriod||C.prefixPeriod}),n.jsx(w.Select,{defaultValue:t,value:t,onChange:c,options:a,className:u,popupClassName:y,disabled:l,showArrow:!s,open:!s&&void 0,"data-testid":"select-period"},JSON.stringify(o))]}))}function No(e){var t=e.value,i=e.setValue,o=e.locale,r=e.className,l=e.humanizeLabels,s=e.monthDays,m=e.disabled,d=e.readOnly,a=e.period,c=e.periodicityOnDoubleClick,v=e.mode,u=o.weekDays||C.weekDays,y=a==="week"||!s||s.length===0,h=f.useMemo(function(){var M;return Z(((M={"react-js-cron-field":!0,"react-js-cron-week-days":!0,"react-js-cron-week-days-placeholder":!y})["".concat(r,"-field")]=!!r,M["".concat(r,"-week-days")]=!!r,M))},[r,y]),p=JSON.stringify(o),b=f.useMemo(function(){return y?o.emptyWeekDays||C.emptyWeekDays:o.emptyWeekDaysShort||C.emptyWeekDaysShort},[y,p]),L=a==="week"||!d||t&&t.length>0||(!t||t.length===0)&&(!s||s.length===0),S=!d||s&&s.length>0||(!s||s.length===0)&&(!t||t.length===0);return L?n.jsxs("div",W({className:h},{children:[o.prefixWeekDays!==""&&(a==="week"||!S)&&n.jsx("span",{children:o.prefixWeekDays||C.prefixWeekDays}),o.prefixWeekDaysForMonthAndYearPeriod!==""&&a!=="week"&&S&&n.jsx("span",{children:o.prefixWeekDaysForMonthAndYearPeriod||C.prefixWeekDaysForMonthAndYearPeriod}),n.jsx(se,{placeholder:b,optionsList:u,grid:!1,value:t,unit:W(W({},oe[4]),{alt:o.altWeekDays||C.altWeekDays}),setValue:i,locale:o,className:r,humanizeLabels:l,disabled:m,readOnly:d,period:a,periodicityOnDoubleClick:c,mode:v})]})):null}function To(e){var t=e.clearButton,i=t===void 0||t,o=e.clearButtonProps,r=o===void 0?{}:o,l=e.clearButtonAction,s=l===void 0?"fill-with-every":l,m=e.locale,d=m===void 0?C:m,a=e.value,c=a===void 0?"":a,v=e.setValue,u=e.displayError,y=u===void 0||u,h=e.onError,p=e.className,b=e.defaultPeriod,L=b===void 0?"day":b,S=e.allowEmpty,M=S===void 0?"for-default-value":S,_=e.humanizeLabels,D=_===void 0||_,A=e.humanizeValue,x=A!==void 0&&A,N=e.disabled,j=N!==void 0&&N,V=e.readOnly,F=V!==void 0&&V,G=e.leadingZero,g=G!==void 0&&G,O=e.shortcuts,B=O===void 0?["@yearly","@annually","@monthly","@weekly","@daily","@midnight","@hourly"]:O,z=e.clockFormat,P=e.periodicityOnDoubleClick,E=P===void 0||P,q=e.mode,H=q===void 0?"multiple":q,ce=e.allowedDropdowns,$=ce===void 0?["period","months","month-days","week-days","hours","minutes"]:ce,ne=e.allowedPeriods,Uo=ne===void 0?["year","month","week","day","hour","minute","reboot"]:ne,re=f.useRef(c),Ae=f.useRef(L),Xe=f.useState(),X=Xe[0],ve=Xe[1],Qe=f.useState(),ue=Qe[0],be=Qe[1],Re=f.useState(),xe=Re[0],ge=Re[1],eo=f.useState(),de=eo[0],ke=eo[1],oo=f.useState(),we=oo[0],Ce=oo[1],to=f.useState(),Oe=to[0],Se=to[1],no=f.useState(!1),Be=no[0],pe=no[1],ro=f.useState(!1),Me=ro[0],ao=ro[1],Wo=function(I){var Y=f.useRef(I);return f.useEffect(function(){Y.current=I},[I]),Y.current}(Me),io=JSON.stringify(d);f.useEffect(function(){Ve(c,pe,h,M,re,!0,d,B,Se,Ce,be,ge,ke,ve)},[]),f.useEffect(function(){c!==re.current&&Ve(c,pe,h,M,re,!1,d,B,Se,Ce,be,ge,ke,ve)},[c,re,io,M,B]),f.useEffect(function(){if(!(X||Oe||xe||ue||de||we)||Me||Wo)Me&&ao(!1);else{var I=X||Ae.current,Y=qe(I,xe,ue,de,we,Oe,x);v(Y,{selectedPeriod:I}),re.current=Y,h&&h(void 0),pe(!1)}},[X,ue,xe,de,we,Oe,x,Me]);var lo=f.useCallback(function(){be(void 0),ge(void 0),ke(void 0),Ce(void 0),Se(void 0);var I="",Y=X!=="reboot"&&X?X:Ae.current;Y!==X&&ve(Y),s==="fill-with-every"&&(I=qe(Y,void 0,void 0,void 0,void 0,void 0)),v(I,{selectedPeriod:Y}),re.current=I,ao(!0),M==="never"&&s==="empty"?(pe(!0),Le(h,d)):(h&&h(void 0),pe(!1))},[X,v,h,s]),zo=f.useMemo(function(){var I;return Z(((I={"react-js-cron":!0,"react-js-cron-error":Be&&y,"react-js-cron-disabled":j,"react-js-cron-read-only":F})["".concat(p)]=!!p,I["".concat(p,"-error")]=Be&&y&&!!p,I["".concat(p,"-disabled")]=j&&!!p,I["".concat(p,"-read-only")]=F&&!!p,I))},[p,Be,y,j,F]),Ne=r.className,so=je(r,["className"]),co=f.useMemo(function(){var I;return Z(((I={"react-js-cron-clear-button":!0})["".concat(p,"-clear-button")]=!!p,I["".concat(Ne)]=!!Ne,I))},[p,Ne]),Jo=JSON.stringify(so),uo=f.useMemo(function(){return i&&!F?n.jsx(w.Button,W({className:co,danger:!0,type:"primary",disabled:j},so,{onClick:lo},{children:d.clearButtonText||C.clearButtonText})):null},[i,F,io,co,j,Jo,lo]),U=X||Ae.current;return n.jsxs("div",W({className:zo},{children:[$.includes("period")&&n.jsx(Bo,{value:U,setValue:ve,locale:d,className:p,disabled:j,readOnly:F,shortcuts:B,allowedPeriods:Uo}),U==="reboot"?uo:n.jsxs(n.Fragment,{children:[U==="year"&&$.includes("months")&&n.jsx(Ao,{value:xe,setValue:ge,locale:d,className:p,humanizeLabels:D,disabled:j,readOnly:F,period:U,periodicityOnDoubleClick:E,mode:H}),(U==="year"||U==="month")&&$.includes("month-days")&&n.jsx(Do,{value:ue,setValue:be,locale:d,className:p,weekDays:de,disabled:j,readOnly:F,leadingZero:g,period:U,periodicityOnDoubleClick:E,mode:H}),(U==="year"||U==="month"||U==="week")&&$.includes("week-days")&&n.jsx(No,{value:de,setValue:ke,locale:d,className:p,humanizeLabels:D,monthDays:ue,disabled:j,readOnly:F,period:U,periodicityOnDoubleClick:E,mode:H}),n.jsxs("div",{children:[U!=="minute"&&U!=="hour"&&$.includes("hours")&&n.jsx(So,{value:we,setValue:Ce,locale:d,className:p,disabled:j,readOnly:F,leadingZero:g,clockFormat:z,period:U,periodicityOnDoubleClick:E,mode:H}),U!=="minute"&&$.includes("minutes")&&n.jsx(Mo,{value:Oe,setValue:Se,locale:d,period:U,className:p,disabled:j,readOnly:F,leadingZero:g,clockFormat:z,periodicityOnDoubleClick:E,mode:H}),uo]})]})]}))}const Fo={"zh-CN":{everyText:"每",emptyMonths:"每月",emptyMonthDays:"每日(月)",emptyMonthDaysShort:"每日",emptyWeekDays:"每天(周)",emptyWeekDaysShort:"每天(周)",emptyHours:"每小时",emptyMinutes:"每分钟",emptyMinutesForHourPeriod:"每",yearOption:"年",monthOption:"月",weekOption:"周",dayOption:"天",hourOption:"小时",minuteOption:"分钟",rebootOption:"重启",prefixPeriod:"每",prefixMonths:"的",prefixMonthDays:"的",prefixWeekDays:"的",prefixWeekDaysForMonthAndYearPeriod:"或者",prefixHours:"的",prefixMinutes:":",prefixMinutesForHourPeriod:"的",suffixMinutesForHourPeriod:"分钟",errorInvalidCron:"不符合 cron 规则的表达式",clearButtonText:"清空",weekDays:["周日","周一","周二","周三","周四","周五","周六"],months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],altWeekDays:["周日","周一","周二","周三","周四","周五","周六"],altMonths:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]}},_e=[{value:"none",text:"No repeat"},{value:6e4,text:"By minute",unitText:"Minutes"},{value:36e5,text:"By hour",unitText:"Hours"},{value:864e5,text:"By day",unitText:"Days"},{value:6048e5,text:"By week",unitText:"Weeks"},{value:"cron",text:"Advanced"}];function Ge(e){return _e.filter(i=>!isNaN(+i.value)).reverse().find(i=>!(e%i.value))}function Po(e){if(!e)return"none";if(e&&!isNaN(+e)){const t=Ge(e);return t?t.value:"none"}if(typeof e=="string")return"cron"}function jo({value:e,onChange:t}){const{t:i}=ee(),o=Ge(e);return n.jsx(w.InputNumber,{value:e/o.value,onChange:r=>t(r*o.value),min:1,addonBefore:i("Every"),addonAfter:i(o.unitText),className:"auto-width"})}function Eo({value:e=null,onChange:t}){const{t:i}=ee(),o=Po(e),r=f.useCallback(s=>{if(s==="none"){t(null);return}if(s==="cron"){t("0 * * * * *");return}t(s)},[t]),l=Fo[localStorage.getItem("TACHYBASE_LOCALE")||"en-US"];return n.jsxs("fieldset",{className:k.css`
2
2
  display: flex;
3
3
  flex-direction: ${o==="cron"?"column":"row"};
4
4
  align-items: flex-start;
@@ -27,4 +27,4 @@
27
27
  }
28
28
  }
29
29
  }
30
- `,children:[n.jsx(k.Select,{value:o,onChange:r,className:"auto-width",options:_e.map(l=>({value:l.value,label:a(l.text)}))}),o&&!isNaN(+o)?n.jsx(jo,{value:e,onChange:t}):null,o==="cron"?n.jsx(Fo,{value:e.trim().split(/\s+/).slice(1).join(" "),setValue:l=>t(`0 ${l}`),clearButton:!1,locale:c}):null]})}const $e={name:{type:"string","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"autoBackup.name","x-component-props":{}},title:{type:"string","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"autoBackup.title","x-component-props":{}},enabled:{type:"boolean","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"autoBackup.enabled","x-component-props":{}},repeat:{type:"string","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"autoBackup.repeat","x-component-props":{}},dumpRules:{title:'{{ t("Dump rules") }}',type:"array","x-component":"Checkbox.Group","x-decorator":"FormItem","x-component-props":{style:{display:"flex",flexDirection:"column"},options:"{{ dumpRuleTypes }}"},"x-reactions":e=>{const t=new Set(e.value||[]);t.add("required"),e.value=Array.from(t)}},maxNumber:{title:'{{ t("Max number") }}',description:'{{ t("Keep only the maximum number and delete the oldest versions with redundant time.") }}',type:"number","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"autoBackup.maxNumber","x-component-props":{}}},Lo={type:"void","x-acl-action-props":{skipScopeCheck:!0},"x-acl-action":"autoBackup:create","x-decorator":"FormBlockProvider","x-use-decorator-props":"useCreateFormBlockDecoratorProps","x-decorator-props":{dataSource:"main",collection:"autoBackup"},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useCreateFormBlockProps",properties:ae({actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}},properties:{submit:{title:'{{t("Submit")}}',"x-action":"submit","x-component":"Action","x-use-component-props":"useCreateActionProps","x-component-props":{type:"primary",htmlType:"submit"},type:"void"}}}},$e)}}},Io={type:"void","x-action":"create","x-acl-action":"create",title:"{{t('Add new')}}","x-component":"Action","x-decorator":"ACLActionProvider","x-component-props":{openMode:"drawer",type:"primary",component:"CreateRecordAction",icon:"PlusOutlined"},"x-align":"right","x-acl-action-props":{skipScopeCheck:!0},properties:{drawer:{type:"void",title:'{{ t("Add record") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{form:Lo}}}},Vo={type:"void",title:'{{ t("Edit") }}',"x-action":"update","x-component":"Action.Link","x-component-props":{openMode:"drawer",icon:"EditOutlined"},"x-decorator":"ACLActionProvider",properties:{drawer:{type:"void",title:'{{ t("Edit record") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{card:{type:"void","x-acl-action-props":{skipScopeCheck:!1},"x-acl-action":"autoBackup:update","x-decorator":"FormBlockProvider","x-use-decorator-props":"useEditFormBlockDecoratorProps","x-decorator-props":{action:"get",dataSource:"main",collection:"autoBackup"},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useEditFormBlockProps",properties:ae({actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}},properties:{submit:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"useUpdateActionProps","x-component-props":{type:"primary",htmlType:"submit"},"x-action-settings":{triggerWorkflows:[],onSuccess:{manualClose:!1,redirecting:!1,successMessage:'{{t("Updated successfully")}}'},isDeltaChanged:!1},type:"void"}}}},$e)}}}}}}},qo={type:"void",properties:{autoBackupTable:{type:"void","x-decorator":"TableBlockProvider","x-acl-action":"autoBackup:list","x-use-decorator-props":"useTableBlockDecoratorProps","x-decorator-props":{collection:"autoBackup",dataSource:"main",action:"list",params:{pageSize:20},rowKey:"id",showIndex:!0,dragSort:!1},"x-component":"CardItem","x-filter-targets":[],properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}},properties:{refresh:{type:"void",title:'{{ t("Refresh") }}',"x-action":"refresh","x-component":"Action","x-settings":"actionSettings:refresh","x-component-props":{icon:"ReloadOutlined"},"x-use-component-props":"useRefreshActionProps"},create:Io}},table:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{title:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{title:{"x-collection-field":"autoBackup.title","x-component":"CollectionField","x-component-props":{ellipsis:!0},"x-read-pretty":!0,"x-decorator":null,"x-decorator-props":{labelStyle:{display:"none"}}}}},enabled:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{enabled:{"x-collection-field":"autoBackup.enabled","x-component":"CollectionField","x-component-props":{ellipsis:!0},"x-read-pretty":!0,"x-decorator":null,"x-decorator-props":{labelStyle:{display:"none"}}}}},maxNumber:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{maxNumber:{"x-collection-field":"autoBackup.maxNumber","x-component":"CollectionField","x-component-props":{ellipsis:!0},"x-read-pretty":!0,"x-decorator":null,"x-decorator-props":{labelStyle:{display:"none"}}}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-action-column":"actions","x-decorator":"TableV2.Column.ActionBar","x-component":"TableV2.Column","x-component-props":{width:100,fixed:"right"},properties:{actions:{type:"void","x-component":"Space",properties:{editAction:Vo,delete:{type:"void",title:"Delete","x-action":"destroy","x-component":"Action.Link","x-component-props":{confirm:{title:"Delete",content:"Are you sure you want to delete it?"}},"x-decorator":"ACLActionProvider","x-use-component-props":"useDestroyActionProps"},clear:{type:"void",title:vo("Clear current times"),"x-action":"clearLimit","x-component":"Action.Link","x-component-props":{confirm:{title:"Clear",content:"Are you sure you want to clear current times?"}},"x-decorator":"ACLActionProvider","x-use-component-props":()=>{const{refresh:e}=g.useDataBlockRequest(),t=g.useDataBlockResource(),a=g.useRecord();return{onClick(){return $(this,null,function*(){yield t.clearLimitExecuted({id:a.id}),e()})}}}}}}}}}}}}}},Ho=()=>{const{t:e}=R(),{data:t,loading:a,refresh:o}=g.useRequest({url:"backupFiles:dumpableCollections"}),r=y.useMemo(()=>t?Object.keys(t).map(c=>({value:c,label:e(`${c}.title`),disabled:["required","skipped"].includes(c)})):[],[t]);return n.jsx(g.ExtendCollectionsProvider,{collections:[Co],children:n.jsx(g.SchemaComponent,{schema:qo,name:"auto-backup-table",components:{RepeatField:Eo},scope:{t:e,dumpRuleTypes:r}})})},Ye=function(e){return n.jsx(g.SchemaComponentOptions,{children:e.children})};Ye.displayName="DuplicatorProvider";class Ke extends g.Plugin{load(){return $(this,null,function*(){this.app.use(Ye),this.app.systemSettingsManager.add("system-services."+le,{title:this.t("Backup & Restore"),icon:"CloudServerOutlined",sort:-50}),this.app.systemSettingsManager.add("system-services."+le+".files",{title:this.t("Backup file"),icon:"CloudServerOutlined",Component:wo,aclSnippet:"pm.backup.restore"}),this.app.systemSettingsManager.add("system-services."+le+".auto",{title:this.t("Auto backup"),icon:"CloudServerOutlined",Component:Ho,aclSnippet:"pm.backup.auto",sort:20})})}}A.PluginBackupRestoreClient=Ke,A.default=Ke,Object.defineProperties(A,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
30
+ `,children:[n.jsx(w.Select,{value:o,onChange:r,className:"auto-width",options:_e.map(s=>({value:s.value,label:i(s.text)}))}),o&&!isNaN(+o)?n.jsx(jo,{value:e,onChange:t}):null,o==="cron"?n.jsx(To,{value:e.trim().split(/\s+/).slice(1).join(" "),setValue:s=>t(`0 ${s}`),clearButton:!1,locale:l}):null]})}const $e={name:{type:"string","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"autoBackup.name","x-component-props":{}},title:{type:"string","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"autoBackup.title","x-component-props":{}},enabled:{type:"boolean","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"autoBackup.enabled","x-component-props":{}},repeat:{type:"string","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"autoBackup.repeat","x-component-props":{}},dumpRules:{title:'{{ t("Dump rules") }}',type:"array","x-component":"Checkbox.Group","x-decorator":"FormItem","x-component-props":{style:{display:"flex",flexDirection:"column"},options:"{{ dumpRuleTypes }}"},"x-reactions":e=>{const t=new Set(e.value||[]);t.add("required"),e.value=Array.from(t)}},maxNumber:{title:'{{ t("Max number") }}',description:'{{ t("Keep only the maximum number and delete the oldest versions with redundant time.") }}',type:"number","x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"autoBackup.maxNumber","x-component-props":{}}},Io={type:"void","x-acl-action-props":{skipScopeCheck:!0},"x-acl-action":"autoBackup:create","x-decorator":"FormBlockProvider","x-use-decorator-props":"useCreateFormBlockDecoratorProps","x-decorator-props":{dataSource:"main",collection:"autoBackup"},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useCreateFormBlockProps",properties:ae({actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}},properties:{submit:{title:'{{t("Submit")}}',"x-action":"submit","x-component":"Action","x-use-component-props":"useCreateActionProps","x-component-props":{type:"primary",htmlType:"submit"},type:"void"}}}},$e)}}},Lo={type:"void","x-action":"create","x-acl-action":"create",title:"{{t('Add new')}}","x-component":"Action","x-decorator":"ACLActionProvider","x-component-props":{openMode:"drawer",type:"primary",component:"CreateRecordAction",icon:"PlusOutlined"},"x-align":"right","x-acl-action-props":{skipScopeCheck:!0},properties:{drawer:{type:"void",title:'{{ t("Add record") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{form:Io}}}},Vo={type:"void",title:'{{ t("Edit") }}',"x-action":"update","x-component":"Action.Link","x-component-props":{openMode:"drawer",icon:"EditOutlined"},"x-decorator":"ACLActionProvider",properties:{drawer:{type:"void",title:'{{ t("Edit record") }}',"x-component":"Action.Container","x-component-props":{className:"tb-action-popup"},properties:{card:{type:"void","x-acl-action-props":{skipScopeCheck:!1},"x-acl-action":"autoBackup:update","x-decorator":"FormBlockProvider","x-use-decorator-props":"useEditFormBlockDecoratorProps","x-decorator-props":{action:"get",dataSource:"main",collection:"autoBackup"},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useEditFormBlockProps",properties:ae({actionBar:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}},properties:{submit:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"useUpdateActionProps","x-component-props":{type:"primary",htmlType:"submit"},"x-action-settings":{triggerWorkflows:[],onSuccess:{manualClose:!1,redirecting:!1,successMessage:'{{t("Updated successfully")}}'},isDeltaChanged:!1},type:"void"}}}},$e)}}}}}}},qo={type:"void",properties:{autoBackupTable:{type:"void","x-decorator":"TableBlockProvider","x-acl-action":"autoBackup:list","x-use-decorator-props":"useTableBlockDecoratorProps","x-decorator-props":{collection:"autoBackup",dataSource:"main",action:"list",params:{pageSize:20},rowKey:"id",showIndex:!0,dragSort:!1},"x-component":"CardItem","x-filter-targets":[],properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}},properties:{refresh:{type:"void",title:'{{ t("Refresh") }}',"x-action":"refresh","x-component":"Action","x-settings":"actionSettings:refresh","x-component-props":{icon:"ReloadOutlined"},"x-use-component-props":"useRefreshActionProps"},create:Lo}},table:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{title:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{title:{"x-collection-field":"autoBackup.title","x-component":"CollectionField","x-component-props":{ellipsis:!0},"x-read-pretty":!0,"x-decorator":null,"x-decorator-props":{labelStyle:{display:"none"}}}}},enabled:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{enabled:{"x-collection-field":"autoBackup.enabled","x-component":"CollectionField","x-component-props":{ellipsis:!0},"x-read-pretty":!0,"x-decorator":null,"x-decorator-props":{labelStyle:{display:"none"}}}}},maxNumber:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{maxNumber:{"x-collection-field":"autoBackup.maxNumber","x-component":"CollectionField","x-component-props":{ellipsis:!0},"x-read-pretty":!0,"x-decorator":null,"x-decorator-props":{labelStyle:{display:"none"}}}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-action-column":"actions","x-decorator":"TableV2.Column.ActionBar","x-component":"TableV2.Column","x-component-props":{width:100,fixed:"right"},properties:{actions:{type:"void","x-component":"Space",properties:{editAction:Vo,delete:{type:"void",title:"Delete","x-action":"destroy","x-component":"Action.Link","x-component-props":{confirm:{title:"Delete",content:"Are you sure you want to delete it?"}},"x-decorator":"ACLActionProvider","x-use-component-props":"useDestroyActionProps"},clear:{type:"void",title:vo("Clear current times"),"x-action":"clearLimit","x-component":"Action.Link","x-component-props":{confirm:{title:"Clear",content:"Are you sure you want to clear current times?"}},"x-decorator":"ACLActionProvider","x-use-component-props":()=>{const{refresh:e}=k.useDataBlockRequest(),t=k.useDataBlockResource(),i=k.useRecord();return{onClick(){return K(this,null,function*(){yield t.clearLimitExecuted({id:i.id}),e()})}}}}}}}}}}}}}},Ho=()=>{const{t:e}=ee(),{data:t,loading:i,refresh:o}=k.useRequest({url:"backupFiles:dumpableCollections"}),r=f.useMemo(()=>t?Object.keys(t).map(l=>({value:l,label:e(`${l}.title`),disabled:["required","skipped"].includes(l)})):[],[t]);return n.jsx(k.ExtendCollectionsProvider,{collections:[Co],children:n.jsx(k.SchemaComponent,{schema:qo,name:"auto-backup-table",components:{RepeatField:Eo},scope:{t:e,dumpRuleTypes:r}})})},Ye=function(e){return n.jsx(k.SchemaComponentOptions,{children:e.children})};Ye.displayName="DuplicatorProvider";class Ke extends k.Plugin{load(){return K(this,null,function*(){this.app.use(Ye),this.app.systemSettingsManager.add("system-services."+le,{title:this.t("Backup & Restore"),icon:"CloudServerOutlined",sort:-50}),this.app.systemSettingsManager.add("system-services."+le+".files",{title:this.t("Backup file"),icon:"CloudServerOutlined",Component:wo,aclSnippet:"pm.backup.restore"}),this.app.systemSettingsManager.add("system-services."+le+".auto",{title:this.t("Auto backup"),icon:"CloudServerOutlined",Component:Ho,aclSnippet:"pm.backup.auto",sort:20})})}}T.PluginBackupRestoreClient=Ke,T.default=Ke,Object.defineProperties(T,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -2,6 +2,6 @@ import { useTranslation } from 'react-i18next';
2
2
  export declare const NAMESPACE = "backup";
3
3
  export declare function lang(key: string): string;
4
4
  export declare function generateNTemplate(key: string): string;
5
- export declare function useDuplicatorTranslation(): import("react-i18next").UseTranslationResponse<[string, string], undefined>;
5
+ export declare function useDuplicatorTranslation(): import("react-i18next").UseTranslationResponse<readonly ["backup", "core"], undefined>;
6
6
  export declare const tval: (key: string) => string;
7
7
  export { useTranslation };
@@ -1,6 +1,6 @@
1
1
  module.exports = {
2
2
  "react": "18.3.1",
3
- "@tachybase/client": "1.3.25",
3
+ "@tachybase/client": "1.4.0",
4
4
  "@ant-design/icons": "5.6.1",
5
5
  "@tego/client": "1.3.52",
6
6
  "antd": "5.22.5",
@@ -8,5 +8,5 @@ module.exports = {
8
8
  "dayjs": "1.11.13",
9
9
  "lodash": "4.17.21",
10
10
  "@tachybase/schema": "1.3.52",
11
- "react-i18next": "15.2.0"
11
+ "react-i18next": "16.2.1"
12
12
  };
@@ -7,6 +7,7 @@
7
7
  "Backup instructions": "Backup instructions",
8
8
  "Business data": "Business data",
9
9
  "Check all": "Check all",
10
+ "Check common": "Check common",
10
11
  "Click or drag file to this area to upload": "Click or drag file to this area to upload",
11
12
  "Configuration": "Configuration",
12
13
  "Delete": "Delete",
@@ -42,5 +43,7 @@
42
43
  "unknown.description": "Data without configured dump rules",
43
44
  "unknown.title": "Unknown",
44
45
  "user.description": "User data",
45
- "user.title": "User data"
46
+ "user.title": "User data",
47
+ "workflow.description": "Workflow execution records",
48
+ "workflow.title": "Workflow execution records"
46
49
  }
@@ -9,6 +9,7 @@ declare const _default: {
9
9
  'Select the data to be backed up': string;
10
10
  'Select the data to be restored': string;
11
11
  'Learn more': string;
12
+ 'Check common': string;
12
13
  'Start backup': string;
13
14
  'Start restore': string;
14
15
  'Backed up successfully': string;
@@ -21,5 +22,7 @@ declare const _default: {
21
22
  'New backup': string;
22
23
  Origin: string;
23
24
  'Backing up': string;
25
+ 'workflow.title': string;
26
+ 'workflow.description': string;
24
27
  };
25
28
  export default _default;
@@ -31,6 +31,7 @@ var ja_JP_default = {
31
31
  "Select the data to be backed up": "\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u3055\u308C\u305F\u30C7\u30FC\u30BF\u306E\u9078\u629E",
32
32
  "Select the data to be restored": "\u30EA\u30B9\u30C8\u30A2\u3055\u308C\u305F\u30C7\u30FC\u30BF\u306E\u9078\u629E",
33
33
  "Learn more": "\u8A73\u7D30",
34
+ "Check common": "\u5171\u901A\u30C7\u30FC\u30BF\u306E\u9078\u629E",
34
35
  "Start backup": "\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306E\u958B\u59CB",
35
36
  "Start restore": "\u30EA\u30B9\u30C8\u30A2\u3092\u958B\u59CB",
36
37
  "Backed up successfully": "\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u6210\u529F",
@@ -41,6 +42,8 @@ var ja_JP_default = {
41
42
  "Backup instructions": "\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u306E\u8AAC\u660E",
42
43
  "File size": "\u30D5\u30A1\u30A4\u30EB\u30B5\u30A4\u30BA",
43
44
  "New backup": "\u65B0\u898F\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7",
44
- "Origin": "\u30BD\u30FC\u30B9",
45
- "Backing up": "\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u4E2D"
45
+ Origin: "\u30BD\u30FC\u30B9",
46
+ "Backing up": "\u30D0\u30C3\u30AF\u30A2\u30C3\u30D7\u4E2D",
47
+ "workflow.title": "\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u5B9F\u884C\u30EC\u30B3\u30FC\u30C9",
48
+ "workflow.description": "\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u5B9F\u884C\u30EC\u30B3\u30FC\u30C9"
46
49
  };
@@ -7,6 +7,8 @@
7
7
  "Backup instructions": "백업 지침",
8
8
  "Basic Data": "기본 데이터",
9
9
  "Business data": "비즈니스 데이터",
10
+ "Check all": "전체 선택",
11
+ "Check common": "일반 선택",
10
12
  "Click or drag file to this area to upload": "여기를 클릭하거나 파일을 끌어다 이곳에 업로드하세요",
11
13
  "Configuration": "구성",
12
14
  "Delete": "삭제",
@@ -46,5 +48,7 @@
46
48
  "unknown.description": "백업 규칙이 설정되지 않은 데이터",
47
49
  "unknown.title": "알 수 없는 데이터",
48
50
  "user.description": "사용자 데이터",
49
- "user.title": "사용자 데이터"
51
+ "user.title": "사용자 데이터",
52
+ "workflow.description": "워크플로우 실행 기록",
53
+ "workflow.title": "워크플로우 실행 기록"
50
54
  }
@@ -13,6 +13,7 @@ declare const locale: {
13
13
  'Start backup': string;
14
14
  'Backed up successfully': string;
15
15
  Plugin: string;
16
+ 'Check common': string;
16
17
  'file uploaded successfully': string;
17
18
  'file upload failed': string;
18
19
  Download: string;
@@ -22,5 +23,7 @@ declare const locale: {
22
23
  'New backup': string;
23
24
  Origin: string;
24
25
  'Backing up': string;
26
+ 'workflow.title': string;
27
+ 'workflow.description': string;
25
28
  };
26
29
  export default locale;
@@ -34,15 +34,18 @@ const locale = {
34
34
  "Start restore": "Iniciar a Restaura\xE7\xE3o",
35
35
  "Start backup": "Iniciar a c\xF3pia de seguran\xE7a",
36
36
  "Backed up successfully": "C\xF3pia de seguran\xE7a bem sucedida",
37
- "Plugin": "Plugins",
37
+ Plugin: "Plugins",
38
+ "Check common": "Selecionar dados comuns",
38
39
  "file uploaded successfully": "O ficheiro foi enviado com sucesso",
39
40
  "file upload failed": "O envio do ficheiro falhou",
40
- "Download": "download",
41
+ Download: "download",
41
42
  "Restore backup from local": "Restaurar a c\xF3pia de seguran\xE7a localmente",
42
43
  "Backup instructions": "Instru\xE7\xF5es de c\xF3pia de seguran\xE7a",
43
44
  "File size": "tamanho do ficheiro",
44
45
  "New backup": "Nova C\xF3pia de Seguran\xE7a",
45
- "Origin": "fonte",
46
- "Backing up": "C\xF3pia de seguran\xE7a em curso"
46
+ Origin: "fonte",
47
+ "Backing up": "C\xF3pia de seguran\xE7a em curso",
48
+ "workflow.title": "Registros de execu\xE7\xE3o do fluxo de trabalho",
49
+ "workflow.description": "Registros de execu\xE7\xE3o do fluxo de trabalho"
47
50
  };
48
51
  var pt_BR_default = locale;
@@ -18,6 +18,7 @@
18
18
  "By week": "按周",
19
19
  "Cancel": "取消",
20
20
  "Check all": "全选",
21
+ "Check common": "选择常用",
21
22
  "Click or drag file to this area to upload": "点击或拖拽文件至此区域即可上传",
22
23
  "Configuration": "配置",
23
24
  "Days": "天",
@@ -80,5 +81,7 @@
80
81
  "unknown.description": "没有配置备份规则的数据",
81
82
  "unknown.title": "未知数据",
82
83
  "user.description": "用户数据",
83
- "user.title": "用户数据"
84
+ "user.title": "用户数据",
85
+ "workflow.description": "工作流执行记录",
86
+ "workflow.title": "工作流执行记录"
84
87
  }
@@ -1 +1 @@
1
- {"name":"@hapi/topo","description":"Topological sorting with grouping support","version":"6.0.2","repository":"git://github.com/hapijs/topo","main":"lib/index.js","types":"lib/index.d.ts","files":["lib"],"keywords":["topological","sort","toposort","topsort"],"eslintConfig":{"extends":["plugin:@hapi/module"]},"dependencies":{"@hapi/hoek":"^11.0.2"},"devDependencies":{"@hapi/code":"^9.0.3","@hapi/eslint-plugin":"*","@hapi/lab":"^25.1.2","@types/node":"^17.0.31","typescript":"~4.6.4"},"scripts":{"test":"lab -a @hapi/code -t 100 -L -Y","test-cov-html":"lab -a @hapi/code -t 100 -L -r html -o coverage.html"},"license":"BSD-3-Clause","_lastModified":"2025-09-02T09:52:20.592Z"}
1
+ {"name":"@hapi/topo","description":"Topological sorting with grouping support","version":"6.0.2","repository":"git://github.com/hapijs/topo","main":"lib/index.js","types":"lib/index.d.ts","files":["lib"],"keywords":["topological","sort","toposort","topsort"],"eslintConfig":{"extends":["plugin:@hapi/module"]},"dependencies":{"@hapi/hoek":"^11.0.2"},"devDependencies":{"@hapi/code":"^9.0.3","@hapi/eslint-plugin":"*","@hapi/lab":"^25.1.2","@types/node":"^17.0.31","typescript":"~4.6.4"},"scripts":{"test":"lab -a @hapi/code -t 100 -L -Y","test-cov-html":"lab -a @hapi/code -t 100 -L -r html -o coverage.html"},"license":"BSD-3-Clause","_lastModified":"2025-11-10T07:32:34.762Z"}
@@ -1 +1 @@
1
- {"name":"archiver","version":"7.0.1","description":"a streaming interface for archive generation","homepage":"https://github.com/archiverjs/node-archiver","author":{"name":"Chris Talkington","url":"http://christalkington.com/"},"repository":{"type":"git","url":"https://github.com/archiverjs/node-archiver.git"},"bugs":{"url":"https://github.com/archiverjs/node-archiver/issues"},"license":"MIT","main":"index.js","files":["index.js","lib"],"engines":{"node":">= 14"},"scripts":{"test":"mocha --reporter dot","bench":"node benchmark/simple/pack-zip.js"},"dependencies":{"archiver-utils":"^5.0.2","async":"^3.2.4","buffer-crc32":"^1.0.0","readable-stream":"^4.0.0","readdir-glob":"^1.1.2","tar-stream":"^3.0.0","zip-stream":"^6.0.1"},"devDependencies":{"archiver-jsdoc-theme":"1.1.3","chai":"4.4.1","jsdoc":"4.0.2","mkdirp":"3.0.1","mocha":"10.3.0","rimraf":"5.0.5","stream-bench":"0.1.2","tar":"6.2.0","yauzl":"3.1.2"},"keywords":["archive","archiver","stream","zip","tar"],"publishConfig":{"registry":"https://registry.npmjs.org/"},"_lastModified":"2025-09-02T09:52:20.484Z"}
1
+ {"name":"archiver","version":"7.0.1","description":"a streaming interface for archive generation","homepage":"https://github.com/archiverjs/node-archiver","author":{"name":"Chris Talkington","url":"http://christalkington.com/"},"repository":{"type":"git","url":"https://github.com/archiverjs/node-archiver.git"},"bugs":{"url":"https://github.com/archiverjs/node-archiver/issues"},"license":"MIT","main":"index.js","files":["index.js","lib"],"engines":{"node":">= 14"},"scripts":{"test":"mocha --reporter dot","bench":"node benchmark/simple/pack-zip.js"},"dependencies":{"archiver-utils":"^5.0.2","async":"^3.2.4","buffer-crc32":"^1.0.0","readable-stream":"^4.0.0","readdir-glob":"^1.1.2","tar-stream":"^3.0.0","zip-stream":"^6.0.1"},"devDependencies":{"archiver-jsdoc-theme":"1.1.3","chai":"4.4.1","jsdoc":"4.0.2","mkdirp":"3.0.1","mocha":"10.3.0","rimraf":"5.0.5","stream-bench":"0.1.2","tar":"6.2.0","yauzl":"3.1.2"},"keywords":["archive","archiver","stream","zip","tar"],"publishConfig":{"registry":"https://registry.npmjs.org/"},"_lastModified":"2025-11-10T07:32:34.609Z"}
@@ -1 +1 @@
1
- {"name":"cron-parser","version":"4.9.0","description":"Node.js library for parsing crontab instructions","main":"lib/parser.js","types":"types/index.d.ts","typesVersions":{"<4.1":{"*":["types/ts3/*"]}},"directories":{"test":"test"},"scripts":{"test:tsd":"tsd","test:unit":"TZ=UTC tap ./test/*.js","test:cover":"TZ=UTC tap --coverage-report=html ./test/*.js","lint":"eslint .","lint:fix":"eslint --fix .","test":"npm run lint && npm run test:unit && npm run test:tsd"},"repository":{"type":"git","url":"https://github.com/harrisiirak/cron-parser.git"},"keywords":["cron","crontab","parser"],"author":"Harri Siirak","contributors":["Nicholas Clawson","Daniel Prentis <daniel@salsitasoft.com>","Renault John Lecoultre","Richard Astbury <richard.astbury@gmail.com>","Meaglin Wasabi <Meaglin.wasabi@gmail.com>","Mike Kusold <hello@mikekusold.com>","Alex Kit <alex.kit@atmajs.com>","Santiago Gimeno <santiago.gimeno@gmail.com>","Daniel <darc.tec@gmail.com>","Christian Steininger <christian.steininger.cs@gmail.com>","Mykola Piskovyi <m.piskovyi@gmail.com>","Brian Vaughn <brian.david.vaughn@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Yasuhiroki <yasuhiroki.duck@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Brendan Warkentin <faazshift@gmail.com>","Charlie Fish <fishcharlie.code@gmail.com>","Ian Graves <ian+diskimage@iangrav.es>","Andy Thompson <me@andytson.com>","Regev Brody <regevbr@gmail.com>"],"license":"MIT","dependencies":{"luxon":"^3.2.1"},"devDependencies":{"eslint":"^8.27.0","sinon":"^15.0.1","tap":"^16.3.3","tsd":"^0.26.0"},"engines":{"node":">=12.0.0"},"browser":{"fs":false},"tap":{"check-coverage":false},"tsd":{"directory":"test","compilerOptions":{"lib":["es2017","dom"]}},"files":["lib","types","LICENSE","README.md"],"_lastModified":"2025-09-02T09:52:21.473Z"}
1
+ {"name":"cron-parser","version":"4.9.0","description":"Node.js library for parsing crontab instructions","main":"lib/parser.js","types":"types/index.d.ts","typesVersions":{"<4.1":{"*":["types/ts3/*"]}},"directories":{"test":"test"},"scripts":{"test:tsd":"tsd","test:unit":"TZ=UTC tap ./test/*.js","test:cover":"TZ=UTC tap --coverage-report=html ./test/*.js","lint":"eslint .","lint:fix":"eslint --fix .","test":"npm run lint && npm run test:unit && npm run test:tsd"},"repository":{"type":"git","url":"https://github.com/harrisiirak/cron-parser.git"},"keywords":["cron","crontab","parser"],"author":"Harri Siirak","contributors":["Nicholas Clawson","Daniel Prentis <daniel@salsitasoft.com>","Renault John Lecoultre","Richard Astbury <richard.astbury@gmail.com>","Meaglin Wasabi <Meaglin.wasabi@gmail.com>","Mike Kusold <hello@mikekusold.com>","Alex Kit <alex.kit@atmajs.com>","Santiago Gimeno <santiago.gimeno@gmail.com>","Daniel <darc.tec@gmail.com>","Christian Steininger <christian.steininger.cs@gmail.com>","Mykola Piskovyi <m.piskovyi@gmail.com>","Brian Vaughn <brian.david.vaughn@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Yasuhiroki <yasuhiroki.duck@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Brendan Warkentin <faazshift@gmail.com>","Charlie Fish <fishcharlie.code@gmail.com>","Ian Graves <ian+diskimage@iangrav.es>","Andy Thompson <me@andytson.com>","Regev Brody <regevbr@gmail.com>"],"license":"MIT","dependencies":{"luxon":"^3.2.1"},"devDependencies":{"eslint":"^8.27.0","sinon":"^15.0.1","tap":"^16.3.3","tsd":"^0.26.0"},"engines":{"node":">=12.0.0"},"browser":{"fs":false},"tap":{"check-coverage":false},"tsd":{"directory":"test","compilerOptions":{"lib":["es2017","dom"]}},"files":["lib","types","LICENSE","README.md"],"_lastModified":"2025-11-10T07:32:35.666Z"}
@@ -1 +1 @@
1
- {"name":"semver","version":"7.7.2","description":"The semantic version parser used by npm.","main":"index.js","scripts":{"test":"tap","snap":"tap","lint":"npm run eslint","postlint":"template-oss-check","lintfix":"npm run eslint -- --fix","posttest":"npm run lint","template-oss-apply":"template-oss-apply --force","eslint":"eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""},"devDependencies":{"@npmcli/eslint-config":"^5.0.0","@npmcli/template-oss":"4.24.3","benchmark":"^2.1.4","tap":"^16.0.0"},"license":"ISC","repository":{"type":"git","url":"git+https://github.com/npm/node-semver.git"},"bin":{"semver":"bin/semver.js"},"files":["bin/","lib/","classes/","functions/","internal/","ranges/","index.js","preload.js","range.bnf"],"tap":{"timeout":30,"coverage-map":"map.js","nyc-arg":["--exclude","tap-snapshots/**"]},"engines":{"node":">=10"},"author":"GitHub Inc.","templateOSS":{"//@npmcli/template-oss":"This file is partially managed by @npmcli/template-oss. Edits may be overwritten.","version":"4.24.3","engines":">=10","distPaths":["classes/","functions/","internal/","ranges/","index.js","preload.js","range.bnf"],"allowPaths":["/classes/","/functions/","/internal/","/ranges/","/index.js","/preload.js","/range.bnf","/benchmarks"],"publish":"true"},"_lastModified":"2025-09-02T09:52:20.855Z"}
1
+ {"name":"semver","version":"7.7.2","description":"The semantic version parser used by npm.","main":"index.js","scripts":{"test":"tap","snap":"tap","lint":"npm run eslint","postlint":"template-oss-check","lintfix":"npm run eslint -- --fix","posttest":"npm run lint","template-oss-apply":"template-oss-apply --force","eslint":"eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""},"devDependencies":{"@npmcli/eslint-config":"^5.0.0","@npmcli/template-oss":"4.24.3","benchmark":"^2.1.4","tap":"^16.0.0"},"license":"ISC","repository":{"type":"git","url":"git+https://github.com/npm/node-semver.git"},"bin":{"semver":"bin/semver.js"},"files":["bin/","lib/","classes/","functions/","internal/","ranges/","index.js","preload.js","range.bnf"],"tap":{"timeout":30,"coverage-map":"map.js","nyc-arg":["--exclude","tap-snapshots/**"]},"engines":{"node":">=10"},"author":"GitHub Inc.","templateOSS":{"//@npmcli/template-oss":"This file is partially managed by @npmcli/template-oss. Edits may be overwritten.","version":"4.24.3","engines":">=10","distPaths":["classes/","functions/","internal/","ranges/","index.js","preload.js","range.bnf"],"allowPaths":["/classes/","/functions/","/internal/","/ranges/","/index.js","/preload.js","/range.bnf","/benchmarks"],"publish":"true"},"_lastModified":"2025-11-10T07:32:35.044Z"}
@@ -1 +1 @@
1
- {"name":"yauzl","version":"3.2.0","description":"yet another unzip library for node","engines":{"node":">=12"},"main":"index.js","scripts":{"test":"node test/test.js"},"repository":{"type":"git","url":"git+https://github.com/thejoshwolfe/yauzl.git"},"keywords":["unzip","zip","stream","archive","file"],"author":"Josh Wolfe <thejoshwolfe@gmail.com>","license":"MIT","bugs":{"url":"https://github.com/thejoshwolfe/yauzl/issues"},"homepage":"https://github.com/thejoshwolfe/yauzl","dependencies":{"buffer-crc32":"~0.2.3","pend":"~1.2.0"},"devDependencies":{"bl":"^6.0.11"},"files":["fd-slicer.js","index.js"],"_lastModified":"2025-09-02T09:52:21.033Z"}
1
+ {"name":"yauzl","version":"3.2.0","description":"yet another unzip library for node","engines":{"node":">=12"},"main":"index.js","scripts":{"test":"node test/test.js"},"repository":{"type":"git","url":"git+https://github.com/thejoshwolfe/yauzl.git"},"keywords":["unzip","zip","stream","archive","file"],"author":"Josh Wolfe <thejoshwolfe@gmail.com>","license":"MIT","bugs":{"url":"https://github.com/thejoshwolfe/yauzl/issues"},"homepage":"https://github.com/thejoshwolfe/yauzl","dependencies":{"buffer-crc32":"~0.2.3","pend":"~1.2.0"},"devDependencies":{"bl":"^6.0.11"},"files":["fd-slicer.js","index.js"],"_lastModified":"2025-11-10T07:32:35.219Z"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tachybase/module-backup",
3
3
  "displayName": "App backup & restore",
4
- "version": "1.3.25",
4
+ "version": "1.4.0",
5
5
  "description": "Backup and restore applications for scenarios such as application replication, migration, and upgrades.",
6
6
  "keywords": [
7
7
  "System management"
@@ -29,13 +29,13 @@
29
29
  "lodash": "4.17.21",
30
30
  "object-path": "^0.11.8",
31
31
  "react": "18.3.1",
32
- "react-i18next": "15.2.0",
32
+ "react-i18next": "16.2.1",
33
33
  "react-js-cron": "^3.2.0",
34
34
  "semver": "7.7.2",
35
35
  "tar": "^7.4.3",
36
36
  "yauzl": "^3.2.0",
37
- "@tachybase/client": "1.3.25",
38
- "@tachybase/module-worker-thread": "1.3.25"
37
+ "@tachybase/client": "1.4.0",
38
+ "@tachybase/module-worker-thread": "1.4.0"
39
39
  },
40
40
  "description.zh-CN": "备份和还原应用,可用于应用的复制、迁移、升级等场景。",
41
41
  "displayName.zh-CN": "应用的备份与还原",