@nocobase/plugin-backup-restore 1.5.0-beta.3 → 1.5.0-beta.30

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.
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ "use strict";(self.webpackChunk_nocobase_plugin_backup_restore=self.webpackChunk_nocobase_plugin_backup_restore||[]).push([["97"],{123:function(e,t,n){n.r(t),n.d(t,{BackupAndRestoreList:function(){return C}});var r=n(482),l=n(632),a=n(772),o=n(721),i=n(346),u=n(156),c=n.n(u),s=n(573);function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function f(e,t,n,r,l,a,o){try{var i=e[a](o),u=i.value}catch(e){n(e);return}i.done?t(u):Promise.resolve(u).then(r,l)}function p(e){return function(){var t=this,n=arguments;return new Promise(function(r,l){var a=e.apply(t,n);function o(e){f(a,r,l,o,i,"next",e)}function i(e){f(a,r,l,o,i,"throw",e)}o(void 0)})}}function m(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,l,a;r=e,l=t,a=n[t],l in r?Object.defineProperty(r,l,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[l]=a})}return e}function b(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,l=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=l){var a=[],o=!0,i=!1;try{for(l=l.call(e);!(o=(n=l.next()).done)&&(a.push(n.value),!t||a.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{!o&&null!=l.return&&l.return()}finally{if(i)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){var n,r,l,a,o={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){return function(a){if(n)throw TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(l=2&a[0]?r.return:a[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,a[1])).done)return l;switch(r=0,l&&(a=[2&a[0],l.value]),a[0]){case 0:case 1:l=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(l=(l=o.trys).length>0&&l[l.length-1])&&(6===a[0]||2===a[0])){o=0;continue}if(3===a[0]&&(!l||a[1]>l[0]&&a[1]<l[3])){o.label=a[1];break}if(6===a[0]&&o.label<l[1]){o.label=l[1],l=a;break}if(l&&o.label<l[2]){o.label=l[2],o.ops.push(a);break}l[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=l=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,i])}}}var v=o.Upload.Dragger,g=function(e){var t,n=e.collectionsData,r=(0,s.lV)().t,l=y((0,u.useState)(!1),2),i=l[0],d=l[1],f=y((0,u.useState)(n),2),m=f[0],b=f[1];(0,u.useEffect)(function(){b(n)},[n]);var v=(0,a.useAPIClient)(),g=(0,a.useCompile)(),k=(0,u.useMemo)(function(){return v.resource("backupFiles")},[v]);var E=(t=p(function(){var t;return h(this,function(n){switch(n.label){case 0:if(!e.isBackup)return[3,2];return[4,k.dumpableCollections()];case 1:b(null==(t=n.sent())?void 0:t.data),d(!0),n.label=2;case 2:return d(!0),[2]}})}),function(){return t.apply(this,arguments)}),w=[{title:r("Collection"),dataIndex:"collection",key:"collection",render:function(e,t){var n=g(t.title);return t.name===n?n:c().createElement("div",null,t.name," ",c().createElement("span",{style:{color:"rgba(0, 0, 0, 0.3)",fontSize:"0.9em"}},"(",g(t.title),")"))}},{title:r("Origin"),dataIndex:"origin",key:"origin",width:"50%"}],C=Object.keys(m||{}).map(function(e){return{key:e,label:r("".concat(e,".title")),children:c().createElement(c().Fragment,null,c().createElement(o.Alert,{style:{marginBottom:16},message:r("".concat(e,".description"))}),c().createElement(o.Table,{pagination:{pageSize:100},bordered:!0,size:"small",dataSource:m[e],columns:w,scroll:{y:400}}))}});return c().createElement(c().Fragment,null,c().createElement("a",{onClick:E},r("Learn more")),c().createElement(o.Modal,{title:r("Backup instructions"),width:"80vw",open:i,footer:null,onOk:function(){d(!1)},onCancel:function(){d(!1)}},c().createElement(o.Tabs,{defaultActiveKey:"required",items:C})))},k=function(e){var t,n=e.ButtonComponent,r=void 0===n?o.Button:n,i=e.title,d=e.upload,f=void 0!==d&&d,m=e.fileData,b=(0,s.lV)().t,v=y((0,u.useState)(["required"]),2),k=v[0],E=v[1],C=y((0,u.useState)(!1),2),S=C[0],O=C[1],P=y((0,u.useState)(null),2),B=P[0],x=P[1],j=y((0,u.useState)(!1),2),D=j[0],A=j[1],F=(0,a.useAPIClient)(),I=(0,u.useMemo)(function(){return F.resource("backupFiles")},[F]),T=y((0,u.useState)([]),2),q=T[0],R=T[1];(0,u.useEffect)(function(){R(Object.keys((null==B?void 0:B.dumpableCollectionsGroupByGroup)||[]).map(function(e){return{value:e,label:b("".concat(e,".title")),disabled:["required","skipped"].includes(e)}}))},[B]);var G=(t=p(function(){var e,t,n,r;return h(this,function(l){switch(l.label){case 0:if(O(!0),f)return[3,2];return A(!0),[4,I.get({filterByTk:m.name})];case 1:R(Object.keys((null==(r=l.sent().data)?void 0:null===(t=r.data)||void 0===t?void 0:null===(e=t.meta)||void 0===e?void 0:e.dumpableCollectionsGroupByGroup)||[]).map(function(e){return{value:e,label:b("".concat(e,".title")),disabled:["required","skipped"].includes(e)}})),x(null==r?void 0:null===(n=r.data)||void 0===n?void 0:n.meta),A(!1),l.label=2;case 2:return[2]}})}),function(){return t.apply(this,arguments)});return c().createElement(c().Fragment,null,c().createElement(r,{onClick:G},i),c().createElement(o.Modal,{title:b("Restore"),width:800,footer:f&&!B?null:void 0,open:S,onOk:function(){I.restore({values:{dataTypes:k,filterByTk:null==m?void 0:m.name,key:null==B?void 0:B.key}}),O(!1)},onCancel:function(){O(!1),x(null),E(["required"])}},c().createElement(o.Spin,{spinning:D},f&&!B&&c().createElement(w,{setRestoreData:x}),(!f||B)&&[c().createElement("strong",{style:{fontWeight:600,display:"block",margin:"16px 0 8px"},key:"info"},b("Select the data to be restored")," (",c().createElement(g,{collectionsData:null==B?void 0:B.dumpableCollectionsGroupByGroup}),"):"),c().createElement("div",{style:{lineHeight:2,marginBottom:8},key:"dataType"},c().createElement(l.FormItem,null,c().createElement(a.Checkbox.Group,{options:q,style:{flexDirection:"column"},value:k,onChange:function(e){return E(e)}})))])))},E=function(e){var t,n=e.ButtonComponent,l=void 0===n?o.Button:n,i=e.refresh,d=(0,s.lV)().t,f=y((0,u.useState)(!1),2),m=f[0],b=f[1],v=y((0,u.useState)(["required"]),2),k=v[0],E=v[1],w=(0,a.useAPIClient)(),C=y((0,u.useState)([]),2),S=C[0],O=C[1];var P=(t=p(function(){return h(this,function(e){switch(e.label){case 0:return[4,w.resource("backupFiles").dumpableCollections()];case 1:return O(Object.keys(e.sent().data||[]).map(function(e){return{value:e,label:d("".concat(e,".title")),disabled:["required","skipped"].includes(e)}})),b(!0),[2]}})}),function(){return t.apply(this,arguments)});return c().createElement(c().Fragment,null,c().createElement(l,{icon:c().createElement(r.PlusOutlined,null),type:"primary",onClick:P},d("New backup")),c().createElement(o.Modal,{title:d("New backup"),width:800,open:m,onOk:function(){w.request({url:"backupFiles:create",method:"post",data:{dataTypes:k}}),b(!1),E(["required"]),setTimeout(function(){i()},500)},onCancel:function(){b(!1),E(["required"])}},c().createElement("strong",{style:{fontWeight:600,display:"block",margin:"16px 0 8px"}},d("Select the data to be backed up")," (",c().createElement(g,{isBackup:!0}),"):"),c().createElement("div",{style:{lineHeight:2,marginBottom:8}},c().createElement(a.Checkbox.Group,{options:S,style:{flexDirection:"column"},onChange:function(e){return E(e)},value:k}))))},w=function(e){var t,n,l=(0,s.lV)().t;return c().createElement(v,(t={multiple:!1,action:"/backupFiles:upload",onChange:function(t){t.fileList.length>1&&t.fileList.splice(0,t.fileList.length-1);var n,r,a,i=t.file.status;"done"===i?(o.message.success("".concat(t.file.name," ")+l("file uploaded successfully")),e.setRestoreData(b(m({},null===(r=t.file.response)||void 0===r?void 0:null===(n=r.data)||void 0===n?void 0:n.meta),{key:null===(a=t.file.response)||void 0===a?void 0:a.data.key}))):"error"===i&&o.message.error("".concat(t.file.name," ")+l("file upload failed"))},onDrop:function(e){console.log("Dropped files",e.dataTransfer.files)}},n=(0,a.useAPIClient)(),b(m({},t),{customRequest:function(e){var t=e.action,r=e.data,l=e.file,a=e.filename,o=e.headers,i=e.onError,u=e.onProgress,c=e.onSuccess,s=e.withCredentials,d=new FormData;return r&&Object.keys(r).forEach(function(e){d.append(e,r[e])}),d.append(a,l),n.axios.post(t,d,{withCredentials:s,headers:o,onUploadProgress:function(e){var t=e.total;u({percent:Math.round(e.loaded/t*100).toFixed(2)},l)}}).then(function(e){c(e.data,l)}).catch(i).finally(function(){}),{abort:function(){console.log("upload progress is aborted.")}}},onChange:function(e){var n;null===(n=t.onChange)||void 0===n||n.call(t,e)}})),c().createElement("p",{className:"ant-upload-drag-icon"},c().createElement(r.InboxOutlined,null)),c().createElement("p",{className:"ant-upload-text"}," ",l("Click or drag file to this area to upload")))},C=function(){var e,t,n,l=(0,s.lV)().t,d=(0,a.useAPIClient)(),f=y((0,u.useState)([]),2),m=f[0],b=f[1],v=y((0,u.useState)(!1),2),g=v[0],w=v[1],C=y((0,u.useState)(!1),2),S=(C[0],C[1]),O=o.App.useApp().modal,P=(0,u.useMemo)(function(){return d.resource("backupFiles")},[d]);(0,u.useEffect)(function(){B()},[]);var B=(e=p(function(){return h(this,function(e){switch(e.label){case 0:return w(!0),[4,P.list()];case 1:return b(e.sent().data.data),w(!1),[2]}})}),function(){return e.apply(this,arguments)});var x=(t=p(function(e){var t,n;return h(this,function(r){switch(r.label){case 0:return S(e.name),[4,d.request({url:"backupFiles:download",method:"get",params:{filterByTk:e.name},responseType:"blob"})];case 1:return t=r.sent(),S(!1),n=new Blob([t.data]),(0,i.saveAs)(n,e.name),[2]}})}),function(e){return t.apply(this,arguments)});var j=(n=p(function(){return h(this,function(e){switch(e.label){case 0:return[4,B()];case 1:return e.sent(),[2]}})}),function(){return n.apply(this,arguments)}),D=function(e){O.confirm({title:l("Delete record",{ns:"client"}),content:l("Are you sure you want to delete it?",{ns:"client"}),onOk:p(function(){return h(this,function(t){switch(t.label){case 0:return[4,P.destroy({filterByTk:e.name})];case 1:return t.sent(),[4,B()];case 2:return t.sent(),o.message.success(l("Deleted successfully")),[2]}})})})};return c().createElement("div",null,c().createElement(o.Card,{bordered:!1},c().createElement(o.Space,{style:{float:"right",marginBottom:16}},c().createElement(o.Button,{onClick:j,icon:c().createElement(r.ReloadOutlined,null)},l("Refresh")),c().createElement(k,{upload:!0,title:c().createElement(c().Fragment,null,c().createElement(r.UploadOutlined,null)," ",l("Restore backup from local"))}),c().createElement(E,{refresh:j})),c().createElement(o.Table,{dataSource:m,loading:g,columns:[{title:l("Backup file"),dataIndex:"name",width:400,onCell:function(e){return e.inProgress?{colSpan:4}:{}},render:function(e,t){return t.inProgress?c().createElement("div",{style:{color:"rgba(0, 0, 0, 0.88)"}},e,"(",l("Backing up"),"...)"):c().createElement("div",null,e)}},{title:l("File size"),dataIndex:"fileSize",onCell:function(e){return e.inProgress?{colSpan:0}:{}}},{title:l("Created at",{ns:"client"}),dataIndex:"createdAt",onCell:function(e){return e.inProgress?{colSpan:0}:{}},render:function(e){return c().createElement(a.DatePicker.ReadPretty,{value:e,showTime:!0})}},{title:l("Actions",{ns:"client"}),dataIndex:"actions",onCell:function(e){return e.inProgress?{colSpan:0}:{}},render:function(e,t){return c().createElement(o.Space,{split:c().createElement(o.Divider,{type:"vertical"})},c().createElement(k,{ButtonComponent:"a",title:l("Restore"),fileData:t}),c().createElement("a",{type:"link",onClick:function(){return x(t)}},l("Download")),c().createElement("a",{onClick:function(){return D(t)}},l("Delete")))}}]})))}}}]);
@@ -7,4 +7,4 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- (function(d,i){typeof exports=="object"&&typeof module!="undefined"?i(exports,require("@nocobase/client"),require("react/jsx-runtime"),require("@ant-design/icons"),require("@formily/antd-v5"),require("antd"),require("react"),require("react-i18next")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","react/jsx-runtime","@ant-design/icons","@formily/antd-v5","antd","react","react-i18next"],i):(d=typeof globalThis!="undefined"?globalThis:d||self,i(d["@nocobase/plugin-backup-restore"]={},d["@nocobase/client"],d.jsxRuntime,d["@ant-design/icons"],d["@formily/antd-v5"],d.antd,d.react,d["react-i18next"]))})(this,function(d,i,e,x,q,h,g,E){"use strict";var Z=Object.defineProperty,R=Object.defineProperties;var ee=Object.getOwnPropertyDescriptors;var z=Object.getOwnPropertySymbols;var te=Object.prototype.hasOwnProperty,oe=Object.prototype.propertyIsEnumerable;var W=(d,i,e)=>i in d?Z(d,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):d[i]=e,L=(d,i)=>{for(var e in i||(i={}))te.call(i,e)&&W(d,e,i[e]);if(z)for(var e of z(i))oe.call(i,e)&&W(d,e,i[e]);return d},D=(d,i)=>R(d,ee(i));var S=(d,i,e)=>new Promise((x,q)=>{var h=m=>{try{E(e.next(m))}catch(M){q(M)}},g=m=>{try{E(e.throw(m))}catch(M){q(M)}},E=m=>m.done?x(m.value):Promise.resolve(m.value).then(h,g);E((e=e.apply(d,i)).next())});var m=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},M={exports:{}};(function(a,k){(function(p,l){l()})(m,function(){function p(t,o){return typeof o=="undefined"?o={autoBom:!1}:typeof o!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),o={autoBom:!o}),o.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob(["\uFEFF",t],{type:t.type}):t}function l(t,o,b){var n=new XMLHttpRequest;n.open("GET",t),n.responseType="blob",n.onload=function(){v(n.response,o,b)},n.onerror=function(){console.error("could not download file")},n.send()}function c(t){var o=new XMLHttpRequest;o.open("HEAD",t,!1);try{o.send()}catch(b){}return 200<=o.status&&299>=o.status}function f(t){try{t.dispatchEvent(new MouseEvent("click"))}catch(b){var o=document.createEvent("MouseEvents");o.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(o)}}var u=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof m=="object"&&m.global===m?m:void 0,w=u.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),v=u.saveAs||(typeof window!="object"||window!==u?function(){}:"download"in HTMLAnchorElement.prototype&&!w?function(t,o,b){var n=u.URL||u.webkitURL,r=document.createElement("a");o=o||t.name||"download",r.download=o,r.rel="noopener",typeof t=="string"?(r.href=t,r.origin===location.origin?f(r):c(r.href)?l(t,o,b):f(r,r.target="_blank")):(r.href=n.createObjectURL(t),setTimeout(function(){n.revokeObjectURL(r.href)},4e4),setTimeout(function(){f(r)},0))}:"msSaveOrOpenBlob"in navigator?function(t,o,b){if(o=o||t.name||"download",typeof t!="string")navigator.msSaveOrOpenBlob(p(t,b),o);else if(c(t))l(t,o,b);else{var n=document.createElement("a");n.href=t,n.target="_blank",setTimeout(function(){f(n)})}}:function(t,o,b,n){if(n=n||open("","_blank"),n&&(n.document.title=n.document.body.innerText="downloading..."),typeof t=="string")return l(t,o,b);var r=t.type==="application/octet-stream",s=/constructor/i.test(u.HTMLElement)||u.safari,y=/CriOS\/[\d]+/.test(navigator.userAgent);if((y||r&&s||w)&&typeof FileReader!="undefined"){var C=new FileReader;C.onloadend=function(){var T=C.result;T=y?T:T.replace(/^data:[^;]*;/,"data:attachment/file;"),n?n.location.href=T:location=T,n=null},C.readAsDataURL(t)}else{var B=u.URL||u.webkitURL,A=B.createObjectURL(t);n?n.location=A:location.href=A,n=null,setTimeout(function(){B.revokeObjectURL(A)},4e4)}});u.saveAs=v.saveAs=v,a.exports=v})})(M);var K=M.exports;const I="backup-restore";function P(){return E.useTranslation(I,{nsMode:"fallback"})}const{Dragger:X}=h.Upload;function J(a){const k=l=>{var c;(c=a.onChange)==null||c.call(a,l)},p=i.useAPIClient();return D(L({},a),{customRequest({action:l,data:c,file:f,filename:u,headers:w,onError:v,onProgress:t,onSuccess:o,withCredentials:b}){const n=new FormData;return c&&Object.keys(c).forEach(r=>{n.append(r,c[r])}),n.append(u,f),p.axios.post(l,n,{withCredentials:b,headers:w,onUploadProgress:({total:r,loaded:s})=>{t({percent:Math.round(s/r*100).toFixed(2)},f)}}).then(({data:r})=>{o(r,f)}).catch(v).finally(()=>{}),{abort(){console.log("upload progress is aborted.")}}},onChange:k})}const U=a=>{const{collectionsData:k}=a,{t:p}=P(),[l,c]=g.useState(!1),[f,u]=g.useState(k);g.useEffect(()=>{u(k)},[k]);const w=i.useAPIClient(),v=i.useCompile(),t=g.useMemo(()=>w.resource("backupFiles"),[w]),o=()=>S(this,null,function*(){if(a.isBackup){const y=yield t.dumpableCollections();u(y==null?void 0:y.data),c(!0)}c(!0)}),b=()=>{c(!1)},n=()=>{c(!1)},r=[{title:p("Collection"),dataIndex:"collection",key:"collection",render:(y,C)=>{const B=v(C.title);return C.name===B?B:e.jsxs("div",{children:[C.name," ",e.jsxs("span",{style:{color:"rgba(0, 0, 0, 0.3)",fontSize:"0.9em"},children:["(",v(C.title),")"]})]})}},{title:p("Origin"),dataIndex:"origin",key:"origin",width:"50%"}],s=Object.keys(f||{}).map(y=>({key:y,label:p(`${y}.title`),children:e.jsxs(e.Fragment,{children:[e.jsx(h.Alert,{style:{marginBottom:16},message:p(`${y}.description`)}),e.jsx(h.Table,{pagination:{pageSize:100},bordered:!0,size:"small",dataSource:f[y],columns:r,scroll:{y:400}})]})}));return e.jsxs(e.Fragment,{children:[e.jsx("a",{onClick:o,children:p("Learn more")}),e.jsx(h.Modal,{title:p("Backup instructions"),width:"80vw",open:l,footer:null,onOk:b,onCancel:n,children:e.jsx(h.Tabs,{defaultActiveKey:"required",items:s})})]})},G=({ButtonComponent:a=h.Button,title:k,upload:p=!1,fileData:l})=>{const{t:c}=P(),[f,u]=g.useState(["required"]),[w,v]=g.useState(!1),[t,o]=g.useState(null),[b,n]=g.useState(!1),r=i.useAPIClient(),s=g.useMemo(()=>r.resource("backupFiles"),[r]),[y,C]=g.useState([]);g.useEffect(()=>{C(Object.keys((t==null?void 0:t.dumpableCollectionsGroupByGroup)||[]).map(O=>({value:O,label:c(`${O}.title`),disabled:["required","skipped"].includes(O)})))},[t]);const B=()=>S(this,null,function*(){var O,N,$;if(v(!0),!p){n(!0);const{data:F}=yield s.get({filterByTk:l.name});C(Object.keys(((N=(O=F==null?void 0:F.data)==null?void 0:O.meta)==null?void 0:N.dumpableCollectionsGroupByGroup)||[]).map(j=>({value:j,label:c(`${j}.title`),disabled:["required","skipped"].includes(j)}))),o(($=F==null?void 0:F.data)==null?void 0:$.meta),n(!1)}}),A=()=>{s.restore({values:{dataTypes:f,filterByTk:l==null?void 0:l.name,key:t==null?void 0:t.key}}),v(!1)},T=()=>{v(!1),o(null),u(["required"])};return e.jsxs(e.Fragment,{children:[e.jsx(a,{onClick:B,children:k}),e.jsx(h.Modal,{title:c("Restore"),width:800,footer:p&&!t?null:void 0,open:w,onOk:A,onCancel:T,children:e.jsxs(h.Spin,{spinning:b,children:[p&&!t&&e.jsx(V,{setRestoreData:o}),(!p||t)&&[e.jsxs("strong",{style:{fontWeight:600,display:"block",margin:"16px 0 8px"},children:[c("Select the data to be restored")," (",e.jsx(U,{collectionsData:t==null?void 0:t.dumpableCollectionsGroupByGroup}),"):"]},"info"),e.jsx("div",{style:{lineHeight:2,marginBottom:8},children:e.jsx(q.FormItem,{children:e.jsx(i.Checkbox.Group,{options:y,style:{flexDirection:"column"},value:f,onChange:O=>u(O)})})},"dataType")]]})})]})},Q=({ButtonComponent:a=h.Button,refresh:k})=>{const{t:p}=P(),[l,c]=g.useState(!1),[f,u]=g.useState(["required"]),w=i.useAPIClient(),[v,t]=g.useState([]),o=()=>S(this,null,function*(){const{data:r}=yield w.resource("backupFiles").dumpableCollections();t(Object.keys(r||[]).map(s=>({value:s,label:p(`${s}.title`),disabled:["required","skipped"].includes(s)}))),c(!0)}),b=()=>{w.request({url:"backupFiles:create",method:"post",data:{dataTypes:f}}),c(!1),u(["required"]),setTimeout(()=>{k()},500)},n=()=>{c(!1),u(["required"])};return e.jsxs(e.Fragment,{children:[e.jsx(a,{icon:e.jsx(x.PlusOutlined,{}),type:"primary",onClick:o,children:p("New backup")}),e.jsxs(h.Modal,{title:p("New backup"),width:800,open:l,onOk:b,onCancel:n,children:[e.jsxs("strong",{style:{fontWeight:600,display:"block",margin:"16px 0 8px"},children:[p("Select the data to be backed up")," (",e.jsx(U,{isBackup:!0}),"):"]}),e.jsx("div",{style:{lineHeight:2,marginBottom:8},children:e.jsx(i.Checkbox.Group,{options:v,style:{flexDirection:"column"},onChange:r=>u(r),value:f})})]})]})},V=a=>{const{t:k}=P(),p={multiple:!1,action:"/backupFiles:upload",onChange(l){var f,u,w;l.fileList.length>1&&l.fileList.splice(0,l.fileList.length-1);const{status:c}=l.file;c==="done"?(h.message.success(`${l.file.name} `+k("file uploaded successfully")),a.setRestoreData(D(L({},(u=(f=l.file.response)==null?void 0:f.data)==null?void 0:u.meta),{key:(w=l.file.response)==null?void 0:w.data.key}))):c==="error"&&h.message.error(`${l.file.name} `+k("file upload failed"))},onDrop(l){console.log("Dropped files",l.dataTransfer.files)}};return e.jsxs(X,D(L({},J(p)),{children:[e.jsx("p",{className:"ant-upload-drag-icon",children:e.jsx(x.InboxOutlined,{})}),e.jsxs("p",{className:"ant-upload-text",children:[" ",k("Click or drag file to this area to upload")]})]}))},Y=()=>{const{t:a}=P(),k=i.useAPIClient(),[p,l]=g.useState([]),[c,f]=g.useState(!1),[u,w]=g.useState(!1),{modal:v}=h.App.useApp(),t=g.useMemo(()=>k.resource("backupFiles"),[k]);g.useEffect(()=>{o()},[]);const o=()=>S(this,null,function*(){f(!0);const{data:s}=yield t.list();l(s.data),f(!1)}),b=s=>S(this,null,function*(){w(s.name);const y=yield k.request({url:"backupFiles:download",method:"get",params:{filterByTk:s.name},responseType:"blob"});w(!1);const C=new Blob([y.data]);K.saveAs(C,s.name)}),n=()=>S(this,null,function*(){yield o()}),r=s=>{v.confirm({title:a("Delete record",{ns:"client"}),content:a("Are you sure you want to delete it?",{ns:"client"}),onOk:()=>S(this,null,function*(){yield t.destroy({filterByTk:s.name}),yield o(),h.message.success(a("Deleted successfully"))})})};return e.jsx("div",{children:e.jsxs(h.Card,{bordered:!1,children:[e.jsxs(h.Space,{style:{float:"right",marginBottom:16},children:[e.jsx(h.Button,{onClick:n,icon:e.jsx(x.ReloadOutlined,{}),children:a("Refresh")}),e.jsx(G,{upload:!0,title:e.jsxs(e.Fragment,{children:[e.jsx(x.UploadOutlined,{})," ",a("Restore backup from local")]})}),e.jsx(Q,{refresh:n})]}),e.jsx(h.Table,{dataSource:p,loading:c,columns:[{title:a("Backup file"),dataIndex:"name",width:400,onCell:s=>s.inProgress?{colSpan:4}:{},render:(s,y)=>y.inProgress?e.jsxs("div",{style:{color:"rgba(0, 0, 0, 0.88)"},children:[s,"(",a("Backing up"),"...)"]}):e.jsx("div",{children:s})},{title:a("File size"),dataIndex:"fileSize",onCell:s=>s.inProgress?{colSpan:0}:{}},{title:a("Created at",{ns:"client"}),dataIndex:"createdAt",onCell:s=>s.inProgress?{colSpan:0}:{},render:s=>e.jsx(i.DatePicker.ReadPretty,{value:s,showTime:!0})},{title:a("Actions",{ns:"client"}),dataIndex:"actions",onCell:s=>s.inProgress?{colSpan:0}:{},render:(s,y)=>e.jsxs(h.Space,{split:e.jsx(h.Divider,{type:"vertical"}),children:[e.jsx(G,{ButtonComponent:"a",title:a("Restore"),fileData:y}),e.jsx("a",{type:"link",onClick:()=>b(y),children:a("Download")}),e.jsx("a",{onClick:()=>r(y),children:a("Delete")})]})}]})]})})},_=function(a){return e.jsx(i.SchemaComponentOptions,{children:a.children})};_.displayName="DuplicatorProvider";class H extends i.Plugin{load(){return S(this,null,function*(){this.app.use(_),this.app.pluginSettingsManager.add(I,{title:this.t("Backup & Restore"),icon:"CloudServerOutlined",Component:Y,aclSnippet:"pm.backup-restore"})})}}d.PluginBackupRestoreClient=H,d.default=H,Object.defineProperties(d,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("react"),require("file-saver"),require("@nocobase/client"),require("antd"),require("@ant-design/icons"),require("@formily/antd-v5")):"function"==typeof define&&define.amd?define("@nocobase/plugin-backup-restore",["react-i18next","react","file-saver","@nocobase/client","antd","@ant-design/icons","@formily/antd-v5"],t):"object"==typeof exports?exports["@nocobase/plugin-backup-restore"]=t(require("react-i18next"),require("react"),require("file-saver"),require("@nocobase/client"),require("antd"),require("@ant-design/icons"),require("@formily/antd-v5")):e["@nocobase/plugin-backup-restore"]=t(e["react-i18next"],e.react,e["file-saver"],e["@nocobase/client"],e.antd,e["@ant-design/icons"],e["@formily/antd-v5"])}(self,function(e,t,n,r,o,i,u){return function(){var c,a,f,l,s,p,d={573:function(e,t,n){"use strict";n.d(t,{A7:function(){return o},lV:function(){return i}}),n(772);var r=n(238),o="backup-restore";function i(){return(0,r.useTranslation)(o,{nsMode:"fallback"})}},581:function(e){e.exports=function(e,t){return"undefined"!=typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(e,t),t}},482:function(e){"use strict";e.exports=i},632:function(e){"use strict";e.exports=u},772:function(e){"use strict";e.exports=r},721:function(e){"use strict";e.exports=o},346:function(e){"use strict";e.exports=n},156:function(e){"use strict";e.exports=t},238:function(t){"use strict";t.exports=e}},b={};function y(e){var t=b[e];if(void 0!==t)return t.exports;var n=b[e]={exports:{}};return d[e](n,n.exports,y),n.exports}y.m=d,y.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return y.d(t,{a:t}),t},y.d=function(e,t){for(var n in t)y.o(t,n)&&!y.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},y.f={},y.e=function(e){return Promise.all(Object.keys(y.f).reduce(function(t,n){return y.f[n](e,t),t},[]))},y.u=function(e){return"04e68bac2ed0170d.js"},y.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),y.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},c={},a="@nocobase/plugin-backup-restore:",y.l=function(e,t,n,r){if(c[e]){c[e].push(t);return}if(void 0!==n){for(var o,i,u=document.getElementsByTagName("script"),f=0;f<u.length;f++){var l=u[f];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==a+n){o=l;break}}}!o&&(i=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,y.nc&&o.setAttribute("nonce",y.nc),o.setAttribute("data-webpack",a+n),o.src=e),c[e]=[t];var s=function(t,n){o.onerror=o.onload=null,clearTimeout(p);var r=c[e];if(delete c[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},p=setTimeout(s.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=s.bind(null,o.onerror),o.onload=s.bind(null,o.onload),i&&document.head.appendChild(o)},y.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},y.p=(!(f=window.__nocobase_public_path__||"/").endsWith("/")&&(f+="/"),f+"static/plugins/@nocobase/plugin-backup-restore/dist/client/"),l={909:0},y.f.j=function(e,t){var n=y.o(l,e)?l[e]:void 0;if(0!==n){if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=l[e]=[t,r]});t.push(n[2]=r);var o=y.p+y.u(e),i=Error();y.l(o,function(t){if(y.o(l,e)&&(0!==(n=l[e])&&(l[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}}},s=function(e,t){var n=t[0],r=t[1],o=t[2],i,u,c=0;if(n.some(function(e){return 0!==l[e]})){for(i in r)y.o(r,i)&&(y.m[i]=r[i]);o&&o(y)}for(e&&e(t);c<n.length;c++)u=n[c],y.o(l,u)&&l[u]&&l[u][0](),l[u]=0},(p=self.webpackChunk_nocobase_plugin_backup_restore=self.webpackChunk_nocobase_plugin_backup_restore||[]).forEach(s.bind(null,0)),p.push=s.bind(null,p.push.bind(p));var v={};return!function(){"use strict";y.r(v),y.d(v,{PluginBackupRestoreClient:function(){return b},default:function(){return h}});var e=y("772"),t=y("156"),n=y.n(t),r=function(t){return n().createElement(e.SchemaComponentOptions,null,t.children)};r.displayName="DuplicatorProvider";var o=y("573"),i=y(581);function u(e,t,n,r,o,i,u){try{var c=e[i](u),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}function c(e,t,n){return(c=p()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&l(o,n.prototype),o}).apply(null,arguments)}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(e){var t="function"==typeof Map?new Map:void 0;return(s=function(e){var n;if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return c(e,arguments,f(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),l(r,e)})(e)}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(p=function(){return!!e})()}var d=(0,e.lazy)(function(){return i("imported_-300v59_component",y.e("97").then(y.bind(y,123)))},"BackupAndRestoreList").BackupAndRestoreList,b=function(e){var t,n,i;function c(){var e,t,n;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,c),e=this,t=c,n=arguments,t=f(t),function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,p()?Reflect.construct(t,n||[],f(e).constructor):t.apply(e,n))}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}(c,e),t=c,n=[{key:"load",value:function(){var e,t=this;return(e=function(){return function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}(this,function(e){return t.app.use(r),t.app.pluginSettingsManager.add(o.A7,{title:t.t("Backup & Restore"),icon:"CloudServerOutlined",Component:d,aclSnippet:"pm.backup-restore"}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function c(e){u(i,r,o,c,a,"next",e)}function a(e){u(i,r,o,c,a,"throw",e)}c(void 0)})})()}}],a(t.prototype,n),c}(s(e.Plugin)),h=b}(),v}()});
@@ -10,14 +10,15 @@
10
10
  module.exports = {
11
11
  "@ant-design/icons": "5.2.6",
12
12
  "@formily/antd-v5": "1.1.9",
13
- "@nocobase/client": "1.5.0-beta.3",
13
+ "@nocobase/client": "1.5.0-beta.30",
14
14
  "antd": "5.12.8",
15
+ "file-saver": "2.0.5",
15
16
  "react": "18.2.0",
16
- "@nocobase/server": "1.5.0-beta.3",
17
- "@nocobase/utils": "1.5.0-beta.3",
18
- "@nocobase/database": "1.5.0-beta.3",
17
+ "@nocobase/server": "1.5.0-beta.30",
18
+ "@nocobase/utils": "1.5.0-beta.30",
19
+ "@nocobase/database": "1.5.0-beta.30",
19
20
  "dayjs": "1.11.10",
20
21
  "lodash": "4.17.21",
21
22
  "react-i18next": "11.18.6",
22
- "@nocobase/actions": "1.5.0-beta.3"
23
+ "@nocobase/actions": "1.5.0-beta.30"
23
24
  };
@@ -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":"2024-12-10T07:14:53.320Z"}
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-01-16T03:39:33.392Z"}
@@ -1 +1 @@
1
- {"name":"archiver","version":"5.3.2","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":">= 10"},"scripts":{"test":"mocha --reporter dot","bench":"node benchmark/simple/pack-zip.js"},"dependencies":{"archiver-utils":"^2.1.0","async":"^3.2.4","buffer-crc32":"^0.2.1","readable-stream":"^3.6.0","readdir-glob":"^1.1.2","tar-stream":"^2.2.0","zip-stream":"^4.1.0"},"devDependencies":{"archiver-jsdoc-theme":"^1.1.3","chai":"^4.3.7","jsdoc":"^3.6.4","mkdirp":"^2.1.5","mocha":"^9.0.2","rimraf":"^4.3.1","stream-bench":"^0.1.2","tar":"^6.1.13","yauzl":"^2.9.0"},"keywords":["archive","archiver","stream","zip","tar"],"publishConfig":{"registry":"https://registry.npmjs.org/"},"_lastModified":"2024-12-10T07:14:51.540Z"}
1
+ {"name":"archiver","version":"5.3.2","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":">= 10"},"scripts":{"test":"mocha --reporter dot","bench":"node benchmark/simple/pack-zip.js"},"dependencies":{"archiver-utils":"^2.1.0","async":"^3.2.4","buffer-crc32":"^0.2.1","readable-stream":"^3.6.0","readdir-glob":"^1.1.2","tar-stream":"^2.2.0","zip-stream":"^4.1.0"},"devDependencies":{"archiver-jsdoc-theme":"^1.1.3","chai":"^4.3.7","jsdoc":"^3.6.4","mkdirp":"^2.1.5","mocha":"^9.0.2","rimraf":"^4.3.1","stream-bench":"^0.1.2","tar":"^6.1.13","yauzl":"^2.9.0"},"keywords":["archive","archiver","stream","zip","tar"],"publishConfig":{"registry":"https://registry.npmjs.org/"},"_lastModified":"2025-01-16T03:39:31.534Z"}
@@ -1 +1 @@
1
- {"name":"decompress","version":"4.2.1","description":"Extracting archives made easy","license":"MIT","repository":"kevva/decompress","author":{"name":"Kevin Mårtensson","email":"kevinmartensson@gmail.com","url":"github.com/kevva"},"engines":{"node":">=4"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["bz2","bzip2","decompress","extract","tar","tar.bz","tar.gz","zip","unzip"],"dependencies":{"decompress-tar":"^4.0.0","decompress-tarbz2":"^4.0.0","decompress-targz":"^4.0.0","decompress-unzip":"^4.0.1","graceful-fs":"^4.1.10","make-dir":"^1.0.0","pify":"^2.3.0","strip-dirs":"^2.0.0"},"devDependencies":{"ava":"*","esm":"^3.2.25","is-jpg":"^1.0.0","path-exists":"^3.0.0","pify":"^2.3.0","rimraf":"^3.0.2","xo":"*"},"ava":{"require":["esm"]},"xo":{"rules":{"promise/prefer-await-to-then":"off"}},"_lastModified":"2024-12-10T07:14:53.093Z"}
1
+ {"name":"decompress","version":"4.2.1","description":"Extracting archives made easy","license":"MIT","repository":"kevva/decompress","author":{"name":"Kevin Mårtensson","email":"kevinmartensson@gmail.com","url":"github.com/kevva"},"engines":{"node":">=4"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["bz2","bzip2","decompress","extract","tar","tar.bz","tar.gz","zip","unzip"],"dependencies":{"decompress-tar":"^4.0.0","decompress-tarbz2":"^4.0.0","decompress-targz":"^4.0.0","decompress-unzip":"^4.0.1","graceful-fs":"^4.1.10","make-dir":"^1.0.0","pify":"^2.3.0","strip-dirs":"^2.0.0"},"devDependencies":{"ava":"*","esm":"^3.2.25","is-jpg":"^1.0.0","path-exists":"^3.0.0","pify":"^2.3.0","rimraf":"^3.0.2","xo":"*"},"ava":{"require":["esm"]},"xo":{"rules":{"promise/prefer-await-to-then":"off"}},"_lastModified":"2025-01-16T03:39:33.184Z"}
@@ -1 +1 @@
1
- {"name":"mkdirp","description":"Recursively mkdir, like `mkdir -p`","version":"1.0.4","main":"index.js","keywords":["mkdir","directory","make dir","make","dir","recursive","native"],"repository":{"type":"git","url":"https://github.com/isaacs/node-mkdirp.git"},"scripts":{"test":"tap","snap":"tap","preversion":"npm test","postversion":"npm publish","postpublish":"git push origin --follow-tags"},"tap":{"check-coverage":true,"coverage-map":"map.js"},"devDependencies":{"require-inject":"^1.4.4","tap":"^14.10.7"},"bin":"bin/cmd.js","license":"MIT","engines":{"node":">=10"},"files":["bin","lib","index.js"],"_lastModified":"2024-12-10T07:14:51.659Z"}
1
+ {"name":"mkdirp","description":"Recursively mkdir, like `mkdir -p`","version":"1.0.4","main":"index.js","keywords":["mkdir","directory","make dir","make","dir","recursive","native"],"repository":{"type":"git","url":"https://github.com/isaacs/node-mkdirp.git"},"scripts":{"test":"tap","snap":"tap","preversion":"npm test","postversion":"npm publish","postpublish":"git push origin --follow-tags"},"tap":{"check-coverage":true,"coverage-map":"map.js"},"devDependencies":{"require-inject":"^1.4.4","tap":"^14.10.7"},"bin":"bin/cmd.js","license":"MIT","engines":{"node":">=10"},"files":["bin","lib","index.js"],"_lastModified":"2025-01-16T03:39:31.635Z"}
@@ -1 +1 @@
1
- {"name":"moment","version":"2.29.4","description":"Parse, validate, manipulate, and display dates","homepage":"https://momentjs.com","author":"Iskren Ivov Chernev <iskren.chernev@gmail.com> (https://github.com/ichernev)","contributors":["Tim Wood <washwithcare@gmail.com> (http://timwoodcreates.com/)","Rocky Meza (http://rockymeza.com)","Matt Johnson <mj1856@hotmail.com> (http://codeofmatt.com)","Isaac Cambron <isaac@isaaccambron.com> (http://isaaccambron.com)","Andre Polykanine <andre@oire.org> (https://github.com/oire)"],"keywords":["moment","date","time","parse","format","validate","i18n","l10n","ender"],"main":"./moment.js","jsnext:main":"./dist/moment.js","typings":"./moment.d.ts","typesVersions":{">=3.1":{"*":["ts3.1-typings/*"]}},"engines":{"node":"*"},"repository":{"type":"git","url":"https://github.com/moment/moment.git"},"bugs":{"url":"https://github.com/moment/moment/issues"},"license":"MIT","devDependencies":{"benchmark":"latest","coveralls":"latest","cross-env":"^6.0.3","es6-promise":"latest","eslint":"~6","grunt":"latest","grunt-benchmark":"latest","grunt-cli":"latest","grunt-contrib-clean":"latest","grunt-contrib-concat":"latest","grunt-contrib-copy":"latest","grunt-contrib-uglify":"latest","grunt-contrib-watch":"latest","grunt-env":"latest","grunt-exec":"latest","grunt-karma":"latest","grunt-nuget":"latest","grunt-string-replace":"latest","karma":"latest","karma-chrome-launcher":"latest","karma-firefox-launcher":"latest","karma-qunit":"latest","karma-sauce-launcher":"4.1.4","load-grunt-tasks":"latest","lodash":">=4.17.19","node-qunit":"latest","nyc":"latest","prettier":"latest","qunit":"^2.10.0","rollup":"2.17.1","typescript":"^1.8.10","typescript3":"npm:typescript@^3.1.6","uglify-js":"latest"},"ender":"./ender.js","dojoBuild":"package.js","jspm":{"files":["moment.js","moment.d.ts","locale"],"map":{"moment":"./moment"},"buildConfig":{"uglify":true}},"scripts":{"ts3.1-typescript-test":"cross-env node_modules/typescript3/bin/tsc --project ts3.1-typing-tests","typescript-test":"cross-env node_modules/typescript/bin/tsc --project typing-tests","test":"grunt test","eslint":"eslint Gruntfile.js tasks src","prettier-check":"prettier --check Gruntfile.js tasks src","prettier-fmt":"prettier --write Gruntfile.js tasks src","coverage":"nyc npm test && nyc report","coveralls":"nyc npm test && nyc report --reporter=text-lcov | coveralls"},"spm":{"main":"moment.js","output":["locale/*.js"]},"_lastModified":"2024-12-10T07:14:52.239Z"}
1
+ {"name":"moment","version":"2.29.4","description":"Parse, validate, manipulate, and display dates","homepage":"https://momentjs.com","author":"Iskren Ivov Chernev <iskren.chernev@gmail.com> (https://github.com/ichernev)","contributors":["Tim Wood <washwithcare@gmail.com> (http://timwoodcreates.com/)","Rocky Meza (http://rockymeza.com)","Matt Johnson <mj1856@hotmail.com> (http://codeofmatt.com)","Isaac Cambron <isaac@isaaccambron.com> (http://isaaccambron.com)","Andre Polykanine <andre@oire.org> (https://github.com/oire)"],"keywords":["moment","date","time","parse","format","validate","i18n","l10n","ender"],"main":"./moment.js","jsnext:main":"./dist/moment.js","typings":"./moment.d.ts","typesVersions":{">=3.1":{"*":["ts3.1-typings/*"]}},"engines":{"node":"*"},"repository":{"type":"git","url":"https://github.com/moment/moment.git"},"bugs":{"url":"https://github.com/moment/moment/issues"},"license":"MIT","devDependencies":{"benchmark":"latest","coveralls":"latest","cross-env":"^6.0.3","es6-promise":"latest","eslint":"~6","grunt":"latest","grunt-benchmark":"latest","grunt-cli":"latest","grunt-contrib-clean":"latest","grunt-contrib-concat":"latest","grunt-contrib-copy":"latest","grunt-contrib-uglify":"latest","grunt-contrib-watch":"latest","grunt-env":"latest","grunt-exec":"latest","grunt-karma":"latest","grunt-nuget":"latest","grunt-string-replace":"latest","karma":"latest","karma-chrome-launcher":"latest","karma-firefox-launcher":"latest","karma-qunit":"latest","karma-sauce-launcher":"4.1.4","load-grunt-tasks":"latest","lodash":">=4.17.19","node-qunit":"latest","nyc":"latest","prettier":"latest","qunit":"^2.10.0","rollup":"2.17.1","typescript":"^1.8.10","typescript3":"npm:typescript@^3.1.6","uglify-js":"latest"},"ender":"./ender.js","dojoBuild":"package.js","jspm":{"files":["moment.js","moment.d.ts","locale"],"map":{"moment":"./moment"},"buildConfig":{"uglify":true}},"scripts":{"ts3.1-typescript-test":"cross-env node_modules/typescript3/bin/tsc --project ts3.1-typing-tests","typescript-test":"cross-env node_modules/typescript/bin/tsc --project typing-tests","test":"grunt test","eslint":"eslint Gruntfile.js tasks src","prettier-check":"prettier --check Gruntfile.js tasks src","prettier-fmt":"prettier --write Gruntfile.js tasks src","coverage":"nyc npm test && nyc report","coveralls":"nyc npm test && nyc report --reporter=text-lcov | coveralls"},"spm":{"main":"moment.js","output":["locale/*.js"]},"_lastModified":"2025-01-16T03:39:32.368Z"}
@@ -1 +1 @@
1
- {"name":"semver","version":"7.6.0","description":"The semantic version parser used by npm.","main":"index.js","scripts":{"test":"tap","snap":"tap","lint":"eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"","postlint":"template-oss-check","lintfix":"npm run lint -- --fix","posttest":"npm run lint","template-oss-apply":"template-oss-apply --force"},"devDependencies":{"@npmcli/eslint-config":"^4.0.0","@npmcli/template-oss":"4.21.3","tap":"^16.0.0"},"license":"ISC","repository":{"type":"git","url":"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"},"dependencies":{"lru-cache":"^6.0.0"},"author":"GitHub Inc.","templateOSS":{"//@npmcli/template-oss":"This file is partially managed by @npmcli/template-oss. Edits may be overwritten.","version":"4.21.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"],"publish":"true"},"_lastModified":"2024-12-10T07:14:53.684Z"}
1
+ {"name":"semver","version":"7.6.0","description":"The semantic version parser used by npm.","main":"index.js","scripts":{"test":"tap","snap":"tap","lint":"eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"","postlint":"template-oss-check","lintfix":"npm run lint -- --fix","posttest":"npm run lint","template-oss-apply":"template-oss-apply --force"},"devDependencies":{"@npmcli/eslint-config":"^4.0.0","@npmcli/template-oss":"4.21.3","tap":"^16.0.0"},"license":"ISC","repository":{"type":"git","url":"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"},"dependencies":{"lru-cache":"^6.0.0"},"author":"GitHub Inc.","templateOSS":{"//@npmcli/template-oss":"This file is partially managed by @npmcli/template-oss. Edits may be overwritten.","version":"4.21.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"],"publish":"true"},"_lastModified":"2025-01-16T03:39:33.735Z"}
@@ -47,6 +47,7 @@ var import_path = __toESM(require("path"));
47
47
  var import_promises = __toESM(require("fs/promises"));
48
48
  var import_restorer = require("../restorer");
49
49
  var import_actions = require("@nocobase/actions");
50
+ var import_utils2 = require("../utils");
50
51
  var backup_files_default = {
51
52
  name: "backupFiles",
52
53
  middleware: async (ctx, next) => {
@@ -140,7 +141,7 @@ var backup_files_default = {
140
141
  const dumper = new import_dumper.Dumper(ctx.app);
141
142
  const filePath = dumper.backUpFilePath(filterByTk);
142
143
  const fileState = await import_dumper.Dumper.getFileStatus(filePath);
143
- if (fileState.status !== "ok") {
144
+ if (!filterByTk.endsWith(`.${import_utils2.DUMPED_EXTENSION}`) || fileState.status !== "ok") {
144
145
  throw new Error(`Backup file ${filterByTk} not found`);
145
146
  }
146
147
  ctx.attachment(filePath);
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "应用的备份与还原(废弃)",
5
5
  "description": "Backup and restore applications for scenarios such as application replication, migration, and upgrades.",
6
6
  "description.zh-CN": "备份和还原应用,可用于应用的复制、迁移、升级等场景。",
7
- "version": "1.5.0-beta.3",
7
+ "version": "1.5.0-beta.30",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "homepage": "https://docs.nocobase.com/handbook/backup-restore",
@@ -41,5 +41,5 @@
41
41
  "keywords": [
42
42
  "System management"
43
43
  ],
44
- "gitHead": "81afcf4affdb652faf4636e6d9351828ce8906be"
44
+ "gitHead": "40c48b2ecf3e2315a76dcb729dbda825b6a1331c"
45
45
  }