@nocobase/plugin-backups 2.2.0-beta.6 → 2.2.0-beta.8

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.
@@ -7,4 +7,4 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- "use strict";(self.webpackChunk_nocobase_plugin_backups_client_v2=self.webpackChunk_nocobase_plugin_backups_client_v2||[]).push([["105"],{696:function(e,t,n){n.r(t);var r=n(694),a=n(625),o=n(59),c=n(155),l=n.n(c),u=n(837);n(693);var i=n(488);function s(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,a,o,c){try{var l=e[o](c),u=l.value}catch(e){n(e);return}l.done?t(u):Promise.resolve(u).then(r,a)}function p(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function c(e){f(o,r,a,c,l,"next",e)}function l(e){f(o,r,a,c,l,"throw",e)}c(void 0)})}}function b(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;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],c=!0,l=!1;try{for(a=a.call(e);!(c=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);c=!0);}catch(e){l=!0,r=e}finally{try{c||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(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 s(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 d(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(c,"next",{value:u(0)}),l(c,"throw",{value:u(1)}),l(c,"return",{value:u(2)}),"function"==typeof Symbol&&l(c,Symbol.iterator,{value:function(){return this}}),c;function u(l){return function(u){var i=[l,u];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,i[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&i[0]?r.return:i[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,i[1])).done)return a;switch(r=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,r=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===i[0]||2===i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(6===i[0]&&o.label<a[1]){o.label=a[1],a=i;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(i);break}a[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],r=0}finally{n=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}}var y={scheduled:!1,cron:"0 0 * * *",keep:100,enableFilesBackup:!1},h=function(e){var t,n,r,a=e.onChange,o=e.value,c=function(e,t){if(null==e)return{};var n,r,a,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(a=0,n=Reflect.ownKeys(Object(e));a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,a={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);return a}(e,t),Object.getOwnPropertySymbols)for(a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,["onChange","value"]),i=window.cronLocale;return l().createElement("fieldset",{className:"nb-backup-settings-cron"},l().createElement(u.l4,(t=b({},c),n=n={clearButton:!1,locale:i,value:null!=(r=null!=o?o:y.cron)?r:"",setValue:function(e){null==a||a(e)}},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t)))},g=function(e){return l().createElement("strong",null,e,":")};t.default=function(){var e=(0,r.useFlowContext)(),t=(0,i.k)(),n=o.App.useApp().message,u=m(o.Form.useForm(),1)[0],s=m((0,c.useState)(!1),2),f=s[0],v=s[1],w=o.Form.useWatch("scheduled",u),O=(0,a.useRequest)(function(){return p(function(){var t;return d(this,function(n){switch(n.label){case 0:return[4,e.api.request({url:"backupSettings:get/1"})];case 1:return[2,null==(t=n.sent().data)?void 0:t.data]}})})()},{onSuccess:function(e){u.setFieldsValue(b({},y,e))}}),j=(0,a.useRequest)(function(){return p(function(){var t,n;return d(this,function(r){switch(r.label){case 0:return[4,e.api.request({url:"storages:list"})];case 1:return[2,(null!=(t=null==(n=r.sent().data)?void 0:n.data)?t:[]).filter(function(e){return"local"!==e.type})]}})})()}),k=(0,c.useMemo)(function(){var e;return(null!=(e=j.data)?e:[]).map(function(e){return{label:e.title,value:e.id}})},[j.data]);return l().createElement(o.Card,{bordered:!1},l().createElement("style",null,"\n .nb-backup-settings-cron {\n min-width: 0;\n margin: 0;\n padding: 0;\n border: 0;\n }\n\n .nb-backup-settings-cron .react-js-cron {\n padding: 0.5em 0.5em 0 0.5em;\n border: 1px dashed #ccc;\n }\n\n .nb-backup-settings-cron .react-js-cron .react-js-cron-field {\n flex-shrink: 0;\n margin-bottom: 0.5em;\n }\n\n .nb-backup-settings-cron .react-js-cron .react-js-cron-field > span {\n flex-shrink: 0;\n margin: 0 0.5em 0 0;\n }\n\n .nb-backup-settings-cron .react-js-cron .react-js-cron-field > .react-js-cron-select {\n margin: 0 0.5em 0 0;\n }\n\n .nb-backup-settings-cron\n .react-js-cron\n .react-js-cron-field\n > .react-js-cron-select\n .ant-select-selection-overflow {\n align-items: center;\n flex: initial;\n }\n"),l().createElement(o.Form,{form:u,layout:"vertical",initialValues:y,disabled:O.loading},l().createElement(o.Form.Item,{label:g(t("Automatic backup"))},l().createElement(o.Space,{direction:"vertical",style:{width:"100%"}},l().createElement(o.Form.Item,{name:"scheduled",valuePropName:"checked",noStyle:!0},l().createElement(o.Checkbox,null,t("Run automatic backup on the cron schedule"))),l().createElement(o.Form.Item,{name:"cron",rules:[{required:!!w,message:t("The field value is required")}],style:{marginBottom:0}},l().createElement(h,{disabled:!w})))),l().createElement(o.Form.Item,{name:"keep",label:g(t("Maximum number of backups")),extra:t("The maximum number of backups to keep, older backups are automatically deleted."),required:!0,rules:[{required:!0,message:t("The field value is required")}]},l().createElement(o.InputNumber,{min:1,style:{width:"100%"}})),l().createElement(o.Form.Item,{name:"storageId",label:g(t("Sync backups to cloud storage"))},l().createElement(o.Select,{loading:j.loading,options:k,style:{width:"100%"}})),l().createElement(o.Form.Item,{name:"enableFilesBackup",label:g(t("Backup local storage files")),valuePropName:"checked"},l().createElement(o.Switch,null)),l().createElement(o.Form.Item,{name:"encryptionPassword",label:g(t("Restore password")),extra:t("If a restore password is set, it must be entered when restoring the backup.")},l().createElement(o.Input.Password,{autoComplete:"new-password",style:{width:"100%"}})),l().createElement(o.Form.Item,null,l().createElement(o.Button,{type:"primary",loading:f,onClick:function(){return p(function(){var r,a;return d(this,function(o){switch(o.label){case 0:return[4,u.validateFields()];case 1:r=o.sent(),a=b({},O.data,r),v(!0),o.label=2;case 2:return o.trys.push([2,,4,5]),[4,e.api.request({url:"backupSettings:update/1",method:"post",data:a})];case 3:return o.sent(),O.mutate(a),n.success(t("Saved successfully")),[3,5];case 4:return v(!1),[7];case 5:return[2]}})})()}},t("Submit")))))}},488:function(e,t,n){n.d(t,{k:function(){return o}});var r=n(694),a=n(401);function o(){var e=(0,r.useFlowEngine)();return function(t,n){return e.context.t(t,function(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;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({ns:[a.C,"client"]},n))}}}}]);
10
+ "use strict";(self.webpackChunk_nocobase_plugin_backups_client_v2=self.webpackChunk_nocobase_plugin_backups_client_v2||[]).push([["105"],{696:function(e,t,n){n.r(t);var r=n(694),a=n(625),o=n(59),c=n(155),l=n.n(c),u=n(837);n(693);var i=n(488);function s(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,a,o,c){try{var l=e[o](c),u=l.value}catch(e){n(e);return}l.done?t(u):Promise.resolve(u).then(r,a)}function p(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function c(e){f(o,r,a,c,l,"next",e)}function l(e){f(o,r,a,c,l,"throw",e)}c(void 0)})}}function b(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;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],c=!0,l=!1;try{for(a=a.call(e);!(c=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);c=!0);}catch(e){l=!0,r=e}finally{try{c||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(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 s(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 d(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(c,"next",{value:u(0)}),l(c,"throw",{value:u(1)}),l(c,"return",{value:u(2)}),"function"==typeof Symbol&&l(c,Symbol.iterator,{value:function(){return this}}),c;function u(l){return function(u){var i=[l,u];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,i[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&i[0]?r.return:i[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,i[1])).done)return a;switch(r=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,r=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===i[0]||2===i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(6===i[0]&&o.label<a[1]){o.label=a[1],a=i;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(i);break}a[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],r=0}finally{n=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}}var y={scheduled:!1,cron:"0 0 * * *",keep:100,enableFilesBackup:!1},h=function(e){var t,n,r,a=e.onChange,o=e.value,c=function(e,t){if(null==e)return{};var n,r,a,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(a=0,n=Reflect.ownKeys(Object(e));a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}if(o=function(e,t){if(null==e)return{};var n,r,a={},o=Object.getOwnPropertyNames(e);for(r=0;r<o.length;r++)n=o[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);return a}(e,t),Object.getOwnPropertySymbols)for(a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)r=n[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,["onChange","value"]),i=window.cronLocale;return l().createElement("fieldset",{className:"nb-backup-settings-cron"},l().createElement(u.l4,(t=b({},c),n=n={clearButton:!1,locale:i,value:null!=(r=null!=o?o:y.cron)?r:"",setValue:function(e){null==a||a(e)}},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t)))};t.default=function(){var e=(0,r.useFlowContext)(),t=(0,i.k)(),n=o.App.useApp().message,u=m(o.Form.useForm(),1)[0],s=m((0,c.useState)(!1),2),f=s[0],g=s[1],v=o.Form.useWatch("scheduled",u),w=(0,a.useRequest)(function(){return p(function(){var t;return d(this,function(n){switch(n.label){case 0:return[4,e.api.request({url:"backupSettings:get/1"})];case 1:return[2,null==(t=n.sent().data)?void 0:t.data]}})})()},{onSuccess:function(e){u.setFieldsValue(b({},y,e))}}),O=(0,a.useRequest)(function(){return p(function(){var t,n;return d(this,function(r){switch(r.label){case 0:return[4,e.api.request({url:"storages:list"})];case 1:return[2,(null!=(t=null==(n=r.sent().data)?void 0:n.data)?t:[]).filter(function(e){return"local"!==e.type})]}})})()}),j=(0,c.useMemo)(function(){var e;return(null!=(e=O.data)?e:[]).map(function(e){return{label:e.title,value:e.id}})},[O.data]);return l().createElement(o.Card,{bordered:!1},l().createElement("style",null,"\n .nb-backup-settings-cron {\n min-width: 0;\n margin: 0;\n padding: 0;\n border: 0;\n }\n\n .nb-backup-settings-cron .react-js-cron {\n padding: 0.5em 0.5em 0 0.5em;\n border: 1px dashed #ccc;\n }\n\n .nb-backup-settings-cron .react-js-cron .react-js-cron-field {\n flex-shrink: 0;\n margin-bottom: 0.5em;\n }\n\n .nb-backup-settings-cron .react-js-cron .react-js-cron-field > span {\n flex-shrink: 0;\n margin: 0 0.5em 0 0;\n }\n\n .nb-backup-settings-cron .react-js-cron .react-js-cron-field > .react-js-cron-select {\n margin: 0 0.5em 0 0;\n }\n\n .nb-backup-settings-cron\n .react-js-cron\n .react-js-cron-field\n > .react-js-cron-select\n .ant-select-selection-overflow {\n align-items: center;\n flex: initial;\n }\n"),l().createElement(o.Form,{form:u,layout:"vertical",initialValues:y,disabled:w.loading},l().createElement(o.Form.Item,{label:t("Automatic backup")},l().createElement(o.Space,{direction:"vertical",style:{width:"100%"}},l().createElement(o.Form.Item,{name:"scheduled",valuePropName:"checked",noStyle:!0},l().createElement(o.Checkbox,null,t("Run automatic backup on the cron schedule"))),l().createElement(o.Form.Item,{name:"cron",rules:[{required:!!v,message:t("The field value is required")}],style:{marginBottom:0}},l().createElement(h,{disabled:!v})))),l().createElement(o.Form.Item,{name:"keep",label:t("Maximum number of backups"),extra:t("The maximum number of backups to keep, older backups are automatically deleted."),required:!0,rules:[{required:!0,message:t("The field value is required")}]},l().createElement(o.InputNumber,{min:1,style:{width:"100%"}})),l().createElement(o.Form.Item,{name:"storageId",label:t("Sync backups to cloud storage")},l().createElement(o.Select,{loading:O.loading,options:j,style:{width:"100%"}})),l().createElement(o.Form.Item,{name:"enableFilesBackup",label:t("Backup local storage files"),valuePropName:"checked"},l().createElement(o.Switch,null)),l().createElement(o.Form.Item,{name:"encryptionPassword",label:t("Restore password"),extra:t("If a restore password is set, it must be entered when restoring the backup.")},l().createElement(o.Input.Password,{autoComplete:"new-password",style:{width:"100%"}})),l().createElement(o.Form.Item,null,l().createElement(o.Button,{type:"primary",loading:f,onClick:function(){return p(function(){var r,a;return d(this,function(o){switch(o.label){case 0:return[4,u.validateFields()];case 1:r=o.sent(),a=b({},w.data,r),g(!0),o.label=2;case 2:return o.trys.push([2,,4,5]),[4,e.api.request({url:"backupSettings:update/1",method:"post",data:a})];case 3:return o.sent(),w.mutate(a),n.success(t("Saved successfully")),[3,5];case 4:return g(!1),[7];case 5:return[2]}})})()}},t("Submit")))))}},488:function(e,t,n){n.d(t,{k:function(){return o}});var r=n(694),a=n(401);function o(){var e=(0,r.useFlowEngine)();return function(t,n){return e.context.t(t,function(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;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({ns:[a.C,"client"]},n))}}}}]);
@@ -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
+ (self.webpackChunk_nocobase_plugin_backups_client_v2=self.webpackChunk_nocobase_plugin_backups_client_v2||[]).push([["567"],{574:function(e,t,n){var r,a;void 0===(a="function"==typeof(r=function(){"use strict";function t(e,t,n){var r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){l(r.response,t,n)},r.onerror=function(){console.error("could not download file")},r.send()}function r(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&299>=t.status}function a(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(n){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var o="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof n.g&&n.g.global===n.g?n.g:void 0,u=o.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),l=o.saveAs||("object"!=typeof window||window!==o?function(){}:"download"in HTMLAnchorElement.prototype&&!u?function(e,n,u){var l=o.URL||o.webkitURL,i=document.createElement("a");i.download=n=n||e.name||"download",i.rel="noopener","string"==typeof e?(i.href=e,i.origin===location.origin?a(i):r(i.href)?t(e,n,u):a(i,i.target="_blank")):(i.href=l.createObjectURL(e),setTimeout(function(){l.revokeObjectURL(i.href)},4e4),setTimeout(function(){a(i)},0))}:"msSaveOrOpenBlob"in navigator?function(e,n,o){if(n=n||e.name||"download","string"!=typeof e){var u;navigator.msSaveOrOpenBlob((void 0===(u=o)?u={autoBom:!1}:"object"!=typeof u&&(console.warn("Deprecated: Expected third argument to be a object"),u={autoBom:!u}),u.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e),n)}else if(r(e))t(e,n,o);else{var l=document.createElement("a");l.href=e,l.target="_blank",setTimeout(function(){a(l)})}}:function(e,n,r,a){if((a=a||open("","_blank"))&&(a.document.title=a.document.body.innerText="downloading..."),"string"==typeof e)return t(e,n,r);var l="application/octet-stream"===e.type,i=/constructor/i.test(o.HTMLElement)||o.safari,c=/CriOS\/[\d]+/.test(navigator.userAgent);if((c||l&&i||u)&&"u">typeof FileReader){var s=new FileReader;s.onloadend=function(){var e=s.result;e=c?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),a?a.location.href=e:location=e,a=null},s.readAsDataURL(e)}else{var f=o.URL||o.webkitURL,p=f.createObjectURL(e);a?a.location=p:location.href=p,a=null,setTimeout(function(){f.revokeObjectURL(p)},4e4)}});o.saveAs=l.saveAs=l,e.exports=l})?r.apply(t,[]):r)||(e.exports=a)},258:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return W}});var r=n(694),a=n(625),o=n(59),u=n(155),l=n.n(u),i=n(477),c=n(485),s=n(185),f=n.n(s),p=n(574),d=n(401),b=(0,u.createContext)(null),m=function(){var e=(0,u.useContext)(b);if(!e)throw Error("BackupsContext provider is missing");return e},h=n(488);function v(e,t,n,r,a,o,u){try{var l=e[o](u),i=l.value}catch(e){n(e);return}l.done?t(i):Promise.resolve(i).then(r,a)}var y={database:{dialect:""}},w=function(){var e=(0,r.useFlowContext)(),t=(0,a.useMemoizedFn)(function(){var t;return(t=function(){var t,n;return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(u,"next",{value:i(0)}),l(u,"throw",{value:i(1)}),l(u,"return",{value:i(2)}),"function"==typeof Symbol&&l(u,Symbol.iterator,{value:function(){return this}}),u;function i(l){return function(i){var c=[l,i];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(r){switch(r.label){case 0:return[4,e.api.request({url:"backups:appInfo"})];case 1:return[2,null!=(t=null==(n=r.sent().data)?void 0:n.data)?t:y]}})},function(){var e=this,n=arguments;return new Promise(function(r,a){var o=t.apply(e,n);function u(e){v(o,r,a,u,l,"next",e)}function l(e){v(o,r,a,u,l,"throw",e)}u(void 0)})})()}),n=(0,a.useRequest)(t,{cacheKey:"backupAppInfo",staleTime:-1}).data;return null!=n?n:y},g=function(){var e=(0,r.useFlowEngine)(),t=(0,c.useApp)();return{showCheckBackupMessage:(0,a.useMemoizedFn)(function(){var n=e.context[d.l];n?n.showCheckBackupMessage():("function"==typeof t.setMaintaining?t.setMaintaining(!0):t.maintaining=!0,t.error={command:{name:"APP Restoring"},message:"checking backup...",code:"APP_COMMANDING"})}),hideCheckBackupMessage:(0,a.useMemoizedFn)(function(){var n=e.context[d.l];n?n.hideCheckBackupMessage():"function"==typeof t.setMaintaining?t.setMaintaining(!1):t.maintaining=!1})}};function k(e,t,n,r,a,o,u){try{var l=e[o](u),i=l.value}catch(e){n(e);return}l.done?t(i):Promise.resolve(i).then(r,a)}function E(){var e=(0,r.useFlowContext)(),t=(0,c.useApp)(),n=l().useRef(null),a=o.App.useApp().notification,i=g().hideCheckBackupMessage;return(0,u.useEffect)(function(){var t=setInterval(function(){var t;return(t=function(){var t,r;return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(u,"next",{value:i(0)}),l(u,"throw",{value:i(1)}),l(u,"return",{value:i(2)}),"function"==typeof Symbol&&l(u,Symbol.iterator,{value:function(){return this}}),u;function i(l){return function(i){var c=[l,i];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(o){switch(o.label){case 0:if(!n.current)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,e.api.request({url:"".concat(d.C,":restoreStatus"),method:"get",params:{task:n.current}})];case 2:if(!(r=null==(t=o.sent().data)?void 0:t.data))return[2];return r.inProgress||(n.current=null),r.message&&(i(),a.error({message:r.message,role:"alert"})),[3,4];case 3:return console.error(o.sent()),[3,4];case 4:return[2]}})},function(){var e=this,n=arguments;return new Promise(function(r,a){var o=t.apply(e,n);function u(e){k(o,r,a,u,l,"next",e)}function l(e){k(o,r,a,u,l,"throw",e)}u(void 0)})})()},3e3);return function(){return clearInterval(t)}},[t.maintaining,e.api,i,a]),n}function S(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 C(e,t,n,r,a,o,u){try{var l=e[o](u),i=l.value}catch(e){n(e);return}l.done?t(i):Promise.resolve(i).then(r,a)}function x(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],u=!0,l=!1;try{for(a=a.call(e);!(u=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);u=!0);}catch(e){l=!0,r=e}finally{try{u||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return S(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 S(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.")}()}var A=function(e){var t=e.backup,n=(0,h.k)(),a=(0,r.useFlowContext)(),u=x(l().useState(!1),2),i=u[0],c=u[1],s=x(l().useState(""),2),f=s[0],p=s[1],d=x(l().useState(!1),2),b=d[0],m=d[1],v=x(l().useState(""),2),y=v[0],k=v[1],S=E(),A=g().showCheckBackupMessage,O=w().database,j=O.schema,I=O.dialect,P=function(){p(""),k("")},M=function(){c(!1),P()};return l().createElement(l().Fragment,null,l().createElement(o.Button,{type:"link",size:"small",onClick:function(){c(!0)}},n("Restore")),l().createElement(o.Modal,{title:n("Restore"),open:i,onCancel:M,footer:[l().createElement(o.Button,{key:"back",onClick:M},n("Cancel")),l().createElement(o.Button,{key:"submit",type:"primary",loading:b,onClick:function(){var e;return(e=function(){var e,n,r;return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(u,"next",{value:i(0)}),l(u,"throw",{value:i(1)}),l(u,"return",{value:i(2)}),"function"==typeof Symbol&&l(u,Symbol.iterator,{value:function(){return this}}),u;function i(l){return function(i){var c=[l,i];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(o){switch(o.label){case 0:m(!0),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,a.api.request({url:"backups:restore",method:"post",data:{name:t.name,password:f,dbSchema:y}})];case 2:return S.current=null!=(e=null==(r=o.sent().data)||null==(n=r.data)?void 0:n.task)?e:null,A(),[3,4];case 3:return console.error(o.sent()),[3,4];case 4:return m(!1),c(!1),P(),[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function u(e){C(o,r,a,u,l,"next",e)}function l(e){C(o,r,a,u,l,"throw",e)}u(void 0)})})()}},n("Submit"))]},l().createElement(o.Form,{layout:"vertical",autoComplete:"off"},["postgres","kingbase"].includes(I)&&l().createElement(o.Form.Item,{label:l().createElement("strong",null,n("Confirm the application database schema")),help:n("Required if application database schema is different with the backup",{currentDbSchemaTips:j?"[".concat(j,"]"):""})},l().createElement(o.Input,{autoComplete:"new-password",value:y,onChange:function(e){return k(e.target.value)}})),l().createElement(o.Form.Item,{colon:!0,label:l().createElement("strong",null,n("Restore password"))},l().createElement(o.Input.Password,{value:f,autoComplete:"new-password",onChange:function(e){return p(e.target.value)}})))))};function O(e,t,n,r,a,o,u){try{var l=e[o](u),i=l.value}catch(e){n(e);return}l.done?t(i):Promise.resolve(i).then(r,a)}function j(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function u(e){O(o,r,a,u,l,"next",e)}function l(e){O(o,r,a,u,l,"throw",e)}u(void 0)})}}function I(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(u,"next",{value:i(0)}),l(u,"throw",{value:i(1)}),l(u,"return",{value:i(2)}),"function"==typeof Symbol&&l(u,Symbol.iterator,{value:function(){return this}}),u;function i(l){return function(i){var c=[l,i];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function P(){var e,t,n=(e=["\n .ant-table-tbody > tr > td {\n line-height: ","px;\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return P=function(){return n},n}var M=function(){var e,t=(0,h.k)(),n=(0,r.useFlowContext)(),s=(0,c.useCurrentAppInfo)(),b=o.theme.useToken().token,v=(0,u.useMemo)(function(){return(0,i.css)(P(),b.controlHeight-b.paddingXXS)},[b.controlHeight,b.paddingXXS]),y=o.App.useApp(),w=y.modal,g=y.message,k=m(),E=k.data,S=k.loading,C=k.refreshAsync,x=(0,a.useRequest)(function(e){return j(function(){var t;return I(this,function(r){switch(r.label){case 0:return[4,n.api.request({url:"".concat(d.C,":destroy"),method:"post",params:{filterByTk:e}})];case 1:return[2,null==(t=r.sent().data)?void 0:t.data]}})})()},{manual:!0}).runAsync,O=(0,u.useCallback)(function(e){w.confirm({title:t("Delete record"),content:t("Are you sure you want to delete it?"),onOk:function(){return j(function(){return I(this,function(n){switch(n.label){case 0:return[4,x(e.name)];case 1:return n.sent(),[4,C()];case 2:return n.sent(),g.success(t("The deletion was successful.")),[2]}})})()}})},[x,g,w,C,t]),M=(0,u.useCallback)(function(e){return j(function(){var t,r,a,o,u;return I(this,function(l){switch(l.label){case 0:return a=null!=(t=null==s?void 0:s.name)?t:null==s||null==(r=s.data)?void 0:r.name,o={filterByTk:e.name},a&&(o.__appName=a),[4,n.api.request({url:"backups:download",method:"get",params:o,responseType:"blob"})];case 1:return u=new Blob([l.sent().data]),(0,p.saveAs)(u,e.name),[2]}})})()},[n.api,null==s||null==(e=s.data)?void 0:e.name,null==s?void 0:s.name]),R=function(e){return e.inProgress?{colSpan:0}:{}},T=(0,u.useMemo)(function(){return[{title:t("Backup list"),dataIndex:"name",width:400,ellipsis:!0,onCell:function(e){return e.inProgress?{colSpan:4}:{}},render:function(e,n){return n.inProgress?l().createElement("span",{style:{color:b.colorText}},e,"(",t("Backing up"),"...)"):l().createElement("span",null,e)}},{title:t("File size"),dataIndex:"fileSize",onCell:R},{title:t("Created at"),dataIndex:"createdAt",onCell:R,render:function(e){return e?f()(e).format("YYYY-MM-DD HH:mm:ss"):null}},{title:t("Actions"),dataIndex:"actions",onCell:R,render:function(e,n){return l().createElement(o.Space,{split:l().createElement(o.Divider,{type:"vertical"})},l().createElement(A,{backup:n}),l().createElement("a",{onClick:function(){M(n)}},t("Download")),l().createElement("a",{onClick:function(){return O(n)}},t("Delete")))}}]},[O,M,t,b.colorText]);return l().createElement(c.Table,{rowKey:"name",className:v,dataSource:null==E?void 0:E.data,loading:S,columns:T})},R=n(375);function T(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 B(e,t,n,r,a,o,u){try{var l=e[o](u),i=l.value}catch(e){n(e);return}l.done?t(i):Promise.resolve(i).then(r,a)}function F(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function u(e){B(o,r,a,u,l,"next",e)}function l(e){B(o,r,a,u,l,"throw",e)}u(void 0)})}}function q(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],u=!0,l=!1;try{for(a=a.call(e);!(u=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);u=!0);}catch(e){l=!0,r=e}finally{try{u||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||D(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 _(e){return function(e){if(Array.isArray(e))return T(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||D(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function D(e,t){if(e){if("string"==typeof e)return T(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 T(e,t)}}function L(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(u,"next",{value:i(0)}),l(u,"throw",{value:i(1)}),l(u,"return",{value:i(2)}),"function"==typeof Symbol&&l(u,Symbol.iterator,{value:function(){return this}}),u;function i(l){return function(i){var c=[l,i];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var U=function(){var e=q((0,u.useState)([]),2),t=e[0],n=e[1],i=(0,h.k)(),c=(0,r.useFlowContext)(),s=o.App.useApp(),f=s.message,p=s.notification,b=s.modal,v=m().refreshAsync,y=(0,a.useRequest)(function(){return F(function(){var e;return L(this,function(t){switch(t.label){case 0:return[4,c.api.request({url:"".concat(d.C,":create"),method:"post"})];case 1:return[2,null==(e=t.sent().data)?void 0:e.data]}})})()},{manual:!0,throttleWait:1e3}),w=y.runAsync,g=y.loading,k=(0,a.useRequest)(function(e){return F(function(){var t,n;return L(this,function(r){switch(r.label){case 0:return[4,c.api.request({url:"".concat(d.C,":taskStatus"),method:"get",params:{names:e}})];case 1:return[2,null!=(t=null==(n=r.sent().data)?void 0:n.data)?t:{}]}})})()},{manual:!0}).runAsync;(0,u.useEffect)(function(){if(0!==t.length){var e=setInterval(function(){return F(function(){var e,r,a,o,u,l,c,s,d,b,m,h;return L(this,function(y){switch(y.label){case 0:return[4,k(t)];case 1:e=y.sent(),r=[],a=[],o=!0,u=!1,l=void 0;try{for(c=Object.entries(e)[Symbol.iterator]();!(o=(s=c.next()).done);o=!0)b=(d=q(s.value,2))[0],(m=d[1]).inProgress||(m.message?(a.push(b),p.error({message:m.message,role:"alert"})):r.push(b))}catch(e){u=!0,l=e}finally{try{o||null==c.return||c.return()}finally{if(u)throw l}}if(h=_(r).concat(_(a)),!(r.length>0))return[3,3];return f.success(i("NEW_BACKUPS_CREATED",{names:r.join(", ")})),[4,v()];case 2:y.sent(),y.label=3;case 3:return h.length>0&&n(function(e){return e.filter(function(e){return!h.includes(e)})}),[2]}})})()},3e3);return function(){clearInterval(e)}}},[t,f,p,k,v,i]);var E=g?R.LoadingOutlined:R.PlusOutlined;return l().createElement(o.Button,{icon:l().createElement(E,null),disabled:g,type:"primary",onClick:function(){return F(function(){return L(this,function(e){return b.confirm({title:i("New backup"),content:i("Are you sure you want to create new backup?"),onOk:function(){return F(function(){return L(this,function(e){switch(e.label){case 0:return[4,F(function(){var e;return L(this,function(t){switch(t.label){case 0:return[4,w()];case 1:return(null==(e=t.sent())?void 0:e.name)&&n(function(t){return _(t).concat([e.name])}),f.success(i("New backup operation started")),[4,v()];case 2:return t.sent(),[2]}})})()];case 1:return e.sent(),[2]}})})()}}),[2]})})()}},i("New backup"))},N=function(){var e=(0,h.k)(),t=m(),n=t.refresh,r=t.loading,a=r?R.LoadingOutlined:R.ReloadOutlined;return l().createElement(o.Button,{onClick:n,icon:l().createElement(a,null),disabled:r},e("Refresh"))};function G(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 H(e,t,n,r,a,o,u){try{var l=e[o](u),i=l.value}catch(e){n(e);return}l.done?t(i):Promise.resolve(i).then(r,a)}function z(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],u=!0,l=!1;try{for(a=a.call(e);!(u=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);u=!0);}catch(e){l=!0,r=e}finally{try{u||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return G(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 G(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.")}()}var X=function(){var e=(0,h.k)(),t=(0,r.useFlowContext)(),n=o.App.useApp().notification,a=z((0,u.useState)(!1),2),i=a[0],c=a[1],s=z((0,u.useState)(!1),2),f=s[0],p=s[1],d=z((0,u.useState)(""),2),b=d[0],m=d[1],v=z((0,u.useState)(""),2),y=v[0],k=v[1],S=z((0,u.useState)(null),2),C=S[0],x=S[1],A=z((0,u.useState)([]),2),O=A[0],j=A[1],I=E(),P=g().showCheckBackupMessage,M=w().database,T=M.schema,B=M.dialect,F=function(){m(""),x(null),j([]),k("")},q=function(){c(!1),F()};return l().createElement(l().Fragment,null,l().createElement(o.Button,{icon:l().createElement(R.UploadOutlined,null),onClick:function(){c(!0)}},e("Restore backup from local")),l().createElement(o.Modal,{title:e("Restore backup from local"),open:i,onCancel:q,footer:[l().createElement(o.Button,{key:"back",onClick:q},e("Cancel")),l().createElement(o.Button,{key:"submit",type:"primary",loading:f,onClick:function(){var r;return(r=function(){var r,a,o,u;return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(u,"next",{value:i(0)}),l(u,"throw",{value:i(1)}),l(u,"return",{value:i(2)}),"function"==typeof Symbol&&l(u,Symbol.iterator,{value:function(){return this}}),u;function i(l){return function(i){var c=[l,i];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(l){switch(l.label){case 0:if(!C)return n.error({message:e("Please select a backup file")}),[2];p(!0),(r=new FormData).append("file",C),r.append("password",b),r.append("dbSchema",y),l.label=1;case 1:return l.trys.push([1,3,,4]),[4,t.api.request({url:"backups:upload",method:"post",data:r})];case 2:return I.current=null!=(a=null==(u=l.sent().data)||null==(o=u.data)?void 0:o.task)?a:null,P(),[3,4];case 3:return console.error(l.sent()),[3,4];case 4:return p(!1),c(!1),F(),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,a){var o=r.apply(e,t);function u(e){H(o,n,a,u,l,"next",e)}function l(e){H(o,n,a,u,l,"throw",e)}u(void 0)})})()}},e("Submit"))]},l().createElement(o.Form,{layout:"vertical",autoComplete:"off"},l().createElement(o.Form.Item,null,l().createElement(o.Upload.Dragger,{onRemove:function(){j([]),x(null)},fileList:O,multiple:!1,maxCount:1,beforeUpload:function(e){return x(e),j([e]),!1}},l().createElement("p",{className:"ant-upload-drag-icon"},l().createElement(R.InboxOutlined,null)),l().createElement("p",{className:"ant-upload-text"},e("Click or drag file to this area to upload")))),["postgres","kingbase"].includes(B)&&l().createElement(o.Form.Item,{label:l().createElement("strong",null,e("Confirm the application database schema")),help:e("Required if application database schema is different with the backup",{currentDbSchemaTips:T?"[".concat(T,"]"):""})},l().createElement(o.Input,{autoComplete:"new-password",value:y,onChange:function(e){return k(e.target.value)}})),l().createElement(o.Form.Item,{colon:!0,label:l().createElement("strong",null,e("Restore password"))},l().createElement(o.Input.Password,{autoComplete:"new-password",value:b,onChange:function(e){return m(e.target.value)}})))))};function K(e,t,n,r,a,o,u){try{var l=e[o](u),i=l.value}catch(e){n(e);return}l.done?t(i):Promise.resolve(i).then(r,a)}var Y={data:[]},W=function(){var e=(0,r.useFlowContext)(),t=(0,a.useRequest)(function(){var t;return(t=function(){var t;return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(u,"next",{value:i(0)}),l(u,"throw",{value:i(1)}),l(u,"return",{value:i(2)}),"function"==typeof Symbol&&l(u,Symbol.iterator,{value:function(){return this}}),u;function i(l){return function(i){var c=[l,i];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(n){switch(n.label){case 0:return[4,e.api.request({url:"".concat(d.C,":list"),method:"get"})];case 1:return[2,null!=(t=n.sent().data)?t:Y]}})},function(){var e=this,n=arguments;return new Promise(function(r,a){var o=t.apply(e,n);function u(e){K(o,r,a,u,l,"next",e)}function l(e){K(o,r,a,u,l,"throw",e)}u(void 0)})})()});return l().createElement(b.Provider,{value:t},l().createElement(o.Card,{bordered:!1},l().createElement(o.Space,{style:{float:"right",marginBottom:16}},l().createElement(N,null),l().createElement(X,null),l().createElement(U,null)),l().createElement(M,null)))}},488:function(e,t,n){"use strict";n.d(t,{k:function(){return o}});var r=n(694),a=n(401);function o(){var e=(0,r.useFlowEngine)();return function(t,n){return e.context.t(t,function(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;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({ns:[a.C,"client"]},n))}}}}]);
@@ -7,4 +7,4 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("ahooks"),require("@nocobase/client-v2"),require("dayjs"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("@nocobase/plugin-backups/client-v2",["ahooks","@nocobase/client-v2","dayjs","react","antd","@ant-design/icons","@nocobase/flow-engine"],t):"object"==typeof exports?exports["@nocobase/plugin-backups/client-v2"]=t(require("ahooks"),require("@nocobase/client-v2"),require("dayjs"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine")):e["@nocobase/plugin-backups/client-v2"]=t(e.ahooks,e["@nocobase/client-v2"],e.dayjs,e.react,e.antd,e["@ant-design/icons"],e["@nocobase/flow-engine"])}(self,function(e,t,n,r,o,i,c){return function(){"use strict";var a,u,l,s={401:function(e,t,n){n.d(t,{C:function(){return r},l:function(){return o}});var r="backups",o="backupRestoreRuntime"},375:function(e){e.exports=i},485:function(e){e.exports=t},694:function(e){e.exports=c},625:function(t){t.exports=e},59:function(e){e.exports=o},185:function(e){e.exports=n},155:function(e){e.exports=r}},p={};function f(e){var t=p[e];if(void 0!==t)return t.exports;var n=p[e]={id:e,exports:{}};return s[e].call(n.exports,n,n.exports,f),n.exports}f.m=s,f.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(t,{a:t}),t},f.d=function(e,t){for(var n in t)f.o(t,n)&&!f.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},f.f={},f.e=function(e){return Promise.all(Object.keys(f.f).reduce(function(t,n){return f.f[n](e,t),t},[]))},f.u=function(e){return""+e+"."+({105:"064f69093e98a2dd",346:"45d02ff0f75c76e4",567:"5dc7a93062ea3649"})[e]+".js"},f.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),f.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},b={},f.l=function(e,t,n,r){if(b[e])return void b[e].push(t);if(void 0!==n)for(var o,i,c=document.getElementsByTagName("script"),a=0;a<c.length;a++){var u=c[a];if(u.getAttribute("src")==e||u.getAttribute("data-rspack")=="@nocobase/plugin-backups/client-v2:"+n){o=u;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,f.nc&&o.setAttribute("nonce",f.nc),o.setAttribute("data-rspack","@nocobase/plugin-backups/client-v2:"+n),o.src=e),b[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=b[e];if(delete b[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},f.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.nc=void 0,f.g.importScripts&&(d=f.g.location+"");var b,d,g=f.g.document;if(!d&&g&&(g.currentScript&&"SCRIPT"===g.currentScript.tagName.toUpperCase()&&(d=g.currentScript.src),!d)){var h=g.getElementsByTagName("script");if(h.length)for(var v=h.length-1;v>-1&&(!d||!/^http(s?):/.test(d));)d=h[v--].src}if(!d)throw Error("Automatic publicPath is not supported in this browser");f.p=d.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a={889:0},f.f.j=function(e,t){var n=f.o(a,e)?a[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=a[e]=[t,r]});t.push(n[2]=r);var o=f.p+f.u(e),i=Error();f.l(o,function(t){if(f.o(a,e)&&(0!==(n=a[e])&&(a[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)}},u=function(e,t){var n,r,o=t[0],i=t[1],c=t[2],u=0;if(o.some(function(e){return 0!==a[e]})){for(n in i)f.o(i,n)&&(f.m[n]=i[n]);c&&c(f)}for(e&&e(t);u<o.length;u++)r=o[u],f.o(a,r)&&a[r]&&a[r][0](),a[r]=0},(l=self.webpackChunk_nocobase_plugin_backups_client_v2=self.webpackChunk_nocobase_plugin_backups_client_v2||[]).forEach(u.bind(null,0)),l.push=u.bind(null,l.push.bind(l));var y={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/@nocobase/plugin-backups/dist/client-v2/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-backups/dist/client-v2/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",i="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var c=window.location.pathname||"/",a=c.indexOf(i);e=a>=0?c.slice(0,a+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-backups/dist/client-v2/"}f.p=e}(),!function(){f.r(y),f.d(y,{default:function(){return u}});var e=f(485),t=f(401);function n(e,t,n,r,o,i,c){try{var a=e[i](c),u=a.value}catch(e){n(e);return}a.done?t(u):Promise.resolve(u).then(r,o)}function r(e,t,n){return(r=a()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&i(o,n.prototype),o}).apply(null,arguments)}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t="function"==typeof Map?new Map:void 0;return(c=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return r(e,arguments,o(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),i(n,e)})(e)}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}var u=function(e){var r;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function c(){var e,t;if(!(this instanceof c))throw TypeError("Cannot call a class as a function");return e=c,t=arguments,e=o(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,a()?Reflect.construct(e,t||[],o(this).constructor):e.apply(this,t))}return c.prototype=Object.create(e&&e.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),e&&i(c,e),r=[{key:"load",value:function(){var e;return(e=function(){var e;return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(c,"next",{value:u(0)}),a(c,"throw",{value:u(1)}),a(c,"return",{value:u(2)}),"function"==typeof Symbol&&a(c,Symbol.iterator,{value:function(){return this}}),c;function u(a){return function(u){var l=[a,u];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(n){return e=this.t("Backup manager"),this.flowEngine.context.defineProperty(t.l,{value:this.createBackupRestoreRuntime()}),this.pluginSettingsManager.addMenuItem({key:t.C,title:e,icon:"CloudServerOutlined",showTabs:!0}),this.pluginSettingsManager.addPageTabItem({menuKey:t.C,key:"list",title:this.t("Backup list"),icon:"CloudServerOutlined",aclSnippet:"pm.".concat(t.C),componentLoader:function(){return f.e("567").then(f.bind(f,258))}}),this.pluginSettingsManager.addPageTabItem({menuKey:t.C,key:"settings",title:this.t("Settings"),icon:"SettingOutlined",aclSnippet:"pm.".concat(t.C,".settings"),componentLoader:function(){return Promise.all([f.e("346"),f.e("105")]).then(f.bind(f,696))}}),[2]})},function(){var t=this,r=arguments;return new Promise(function(o,i){var c=e.apply(t,r);function a(e){n(c,o,i,a,u,"next",e)}function u(e){n(c,o,i,a,u,"throw",e)}a(void 0)})}).call(this)}},{key:"createBackupRestoreRuntime",value:function(){var e=this.app;return{showCheckBackupMessage:function(){"function"==typeof e.setMaintaining?e.setMaintaining(!0):e.maintaining=!0,e.error={command:{name:"APP Restoring"},message:"checking backup...",code:"APP_COMMANDING"}},hideCheckBackupMessage:function(){"function"==typeof e.setMaintaining?e.setMaintaining(!1):e.maintaining=!1}}}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(c.prototype,r),c}(c(e.Plugin))}(),y}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("ahooks"),require("@emotion/css"),require("@nocobase/client-v2"),require("dayjs"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("@nocobase/plugin-backups/client-v2",["ahooks","@emotion/css","@nocobase/client-v2","dayjs","react","antd","@ant-design/icons","@nocobase/flow-engine"],t):"object"==typeof exports?exports["@nocobase/plugin-backups/client-v2"]=t(require("ahooks"),require("@emotion/css"),require("@nocobase/client-v2"),require("dayjs"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine")):e["@nocobase/plugin-backups/client-v2"]=t(e.ahooks,e["@emotion/css"],e["@nocobase/client-v2"],e.dayjs,e.react,e.antd,e["@ant-design/icons"],e["@nocobase/flow-engine"])}(self,function(e,t,n,r,o,i,c,a){return function(){"use strict";var u,s,l,p={401:function(e,t,n){n.d(t,{C:function(){return r},l:function(){return o}});var r="backups",o="backupRestoreRuntime"},375:function(e){e.exports=c},477:function(e){e.exports=t},485:function(e){e.exports=n},694:function(e){e.exports=a},625:function(t){t.exports=e},59:function(e){e.exports=i},185:function(e){e.exports=r},155:function(e){e.exports=o}},f={};function d(e){var t=f[e];if(void 0!==t)return t.exports;var n=f[e]={id:e,exports:{}};return p[e].call(n.exports,n,n.exports,d),n.exports}d.m=p,d.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return d.d(t,{a:t}),t},d.d=function(e,t){for(var n in t)d.o(t,n)&&!d.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},d.f={},d.e=function(e){return Promise.all(Object.keys(d.f).reduce(function(t,n){return d.f[n](e,t),t},[]))},d.u=function(e){return""+e+"."+({105:"d20cb8a299876029",346:"45d02ff0f75c76e4",567:"942d36050408575f"})[e]+".js"},d.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),d.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},b={},d.l=function(e,t,n,r){if(b[e])return void b[e].push(t);if(void 0!==n)for(var o,i,c=document.getElementsByTagName("script"),a=0;a<c.length;a++){var u=c[a];if(u.getAttribute("src")==e||u.getAttribute("data-rspack")=="@nocobase/plugin-backups/client-v2:"+n){o=u;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,d.nc&&o.setAttribute("nonce",d.nc),o.setAttribute("data-rspack","@nocobase/plugin-backups/client-v2:"+n),o.src=e),b[e]=[t];var s=function(t,n){o.onerror=o.onload=null,clearTimeout(l);var r=b[e];if(delete b[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},l=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)},d.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.nc=void 0,d.g.importScripts&&(g=d.g.location+"");var b,g,h=d.g.document;if(!g&&h&&(h.currentScript&&"SCRIPT"===h.currentScript.tagName.toUpperCase()&&(g=h.currentScript.src),!g)){var v=h.getElementsByTagName("script");if(v.length)for(var y=v.length-1;y>-1&&(!g||!/^http(s?):/.test(g));)g=v[y--].src}if(!g)throw Error("Automatic publicPath is not supported in this browser");d.p=g.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),u={889:0},d.f.j=function(e,t){var n=d.o(u,e)?u[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=u[e]=[t,r]});t.push(n[2]=r);var o=d.p+d.u(e),i=Error();d.l(o,function(t){if(d.o(u,e)&&(0!==(n=u[e])&&(u[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,r,o=t[0],i=t[1],c=t[2],a=0;if(o.some(function(e){return 0!==u[e]})){for(n in i)d.o(i,n)&&(d.m[n]=i[n]);c&&c(d)}for(e&&e(t);a<o.length;a++)r=o[a],d.o(u,r)&&u[r]&&u[r][0](),u[r]=0},(l=self.webpackChunk_nocobase_plugin_backups_client_v2=self.webpackChunk_nocobase_plugin_backups_client_v2||[]).forEach(s.bind(null,0)),l.push=s.bind(null,l.push.bind(l));var m={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/@nocobase/plugin-backups/dist/client-v2/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-backups/dist/client-v2/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",i="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var c=window.location.pathname||"/",a=c.indexOf(i);e=a>=0?c.slice(0,a+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-backups/dist/client-v2/"}d.p=e}(),!function(){d.r(m),d.d(m,{default:function(){return u}});var e=d(485),t=d(401);function n(e,t,n,r,o,i,c){try{var a=e[i](c),u=a.value}catch(e){n(e);return}a.done?t(u):Promise.resolve(u).then(r,o)}function r(e,t,n){return(r=a()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&i(o,n.prototype),o}).apply(null,arguments)}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t="function"==typeof Map?new Map:void 0;return(c=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return r(e,arguments,o(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),i(n,e)})(e)}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}var u=function(e){var r;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function c(){var e,t;if(!(this instanceof c))throw TypeError("Cannot call a class as a function");return e=c,t=arguments,e=o(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,a()?Reflect.construct(e,t||[],o(this).constructor):e.apply(this,t))}return c.prototype=Object.create(e&&e.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),e&&i(c,e),r=[{key:"load",value:function(){var e;return(e=function(){var e;return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(c,"next",{value:u(0)}),a(c,"throw",{value:u(1)}),a(c,"return",{value:u(2)}),"function"==typeof Symbol&&a(c,Symbol.iterator,{value:function(){return this}}),c;function u(a){return function(u){var s=[a,u];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,s[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,r=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}(this,function(n){return e=this.t("Backup manager"),this.flowEngine.context.defineProperty(t.l,{value:this.createBackupRestoreRuntime()}),this.pluginSettingsManager.addMenuItem({key:t.C,title:e,icon:"CloudServerOutlined",showTabs:!0}),this.pluginSettingsManager.addPageTabItem({menuKey:t.C,key:"list",title:this.t("Backup list"),icon:"CloudServerOutlined",aclSnippet:"pm.".concat(t.C),componentLoader:function(){return d.e("567").then(d.bind(d,258))}}),this.pluginSettingsManager.addPageTabItem({menuKey:t.C,key:"settings",title:this.t("Settings"),icon:"SettingOutlined",aclSnippet:"pm.".concat(t.C,".settings"),componentLoader:function(){return Promise.all([d.e("346"),d.e("105")]).then(d.bind(d,696))}}),[2]})},function(){var t=this,r=arguments;return new Promise(function(o,i){var c=e.apply(t,r);function a(e){n(c,o,i,a,u,"next",e)}function u(e){n(c,o,i,a,u,"throw",e)}a(void 0)})}).call(this)}},{key:"createBackupRestoreRuntime",value:function(){var e=this.app;return{showCheckBackupMessage:function(){"function"==typeof e.setMaintaining?e.setMaintaining(!0):e.maintaining=!0,e.error={command:{name:"APP Restoring"},message:"checking backup...",code:"APP_COMMANDING"}},hideCheckBackupMessage:function(){"function"==typeof e.setMaintaining?e.setMaintaining(!1):e.maintaining=!1}}}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(c.prototype,r),c}(c(e.Plugin))}(),m}()});
@@ -8,17 +8,17 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.2.0-beta.6",
11
+ "@nocobase/client": "2.2.0-beta.8",
12
12
  "react": "18.2.0",
13
- "@nocobase/flow-engine": "2.2.0-beta.6",
14
- "@nocobase/client-v2": "2.2.0-beta.6",
15
- "@nocobase/cache": "2.2.0-beta.6",
16
- "@nocobase/lock-manager": "2.2.0-beta.6",
17
- "@nocobase/server": "2.2.0-beta.6",
13
+ "@nocobase/flow-engine": "2.2.0-beta.8",
14
+ "@nocobase/client-v2": "2.2.0-beta.8",
15
+ "@nocobase/cache": "2.2.0-beta.8",
16
+ "@nocobase/lock-manager": "2.2.0-beta.8",
17
+ "@nocobase/server": "2.2.0-beta.8",
18
18
  "lodash": "4.18.1",
19
- "@nocobase/database": "2.2.0-beta.6",
19
+ "@nocobase/database": "2.2.0-beta.8",
20
20
  "sequelize": "6.35.2",
21
- "@nocobase/test": "2.2.0-beta.6",
21
+ "@nocobase/test": "2.2.0-beta.8",
22
22
  "@formily/antd-v5": "1.2.3",
23
23
  "@formily/react": "2.3.7",
24
24
  "@formily/reactive": "2.3.7",
@@ -26,8 +26,9 @@ module.exports = {
26
26
  "antd": "5.24.2",
27
27
  "@ant-design/icons": "5.6.1",
28
28
  "ahooks": "3.7.8",
29
+ "@emotion/css": "11.13.0",
29
30
  "dayjs": "1.11.13",
30
- "@nocobase/plugin-file-manager": "2.2.0-beta.6",
31
- "@nocobase/resourcer": "2.2.0-beta.6",
32
- "@nocobase/utils": "2.2.0-beta.6"
31
+ "@nocobase/plugin-file-manager": "2.2.0-beta.8",
32
+ "@nocobase/resourcer": "2.2.0-beta.8",
33
+ "@nocobase/utils": "2.2.0-beta.8"
33
34
  };
@@ -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":"2026-06-22T05:35:29.943Z"}
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":"2026-06-29T01:54:32.554Z"}
@@ -1 +1 @@
1
- {"name":"cron-parser","version":"4.4.0","description":"Node.js library for parsing crontab instructions","main":"lib/parser.js","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":"^1.28.0"},"devDependencies":{"eslint":"^8.2.0","sinon":"^10.0.0","tap":"^16.0.1","tsd":"^0.19.0"},"engines":{"node":">=0.8"},"browser":{"fs":false},"tap":{"check-coverage":false},"tsd":{"directory":"test","compilerOptions":{"lib":["es2017","dom"]}},"_lastModified":"2026-06-22T05:35:28.434Z"}
1
+ {"name":"cron-parser","version":"4.4.0","description":"Node.js library for parsing crontab instructions","main":"lib/parser.js","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":"^1.28.0"},"devDependencies":{"eslint":"^8.2.0","sinon":"^10.0.0","tap":"^16.0.1","tsd":"^0.19.0"},"engines":{"node":">=0.8"},"browser":{"fs":false},"tap":{"check-coverage":false},"tsd":{"directory":"test","compilerOptions":{"lib":["es2017","dom"]}},"_lastModified":"2026-06-29T01:54:31.480Z"}
@@ -1 +1 @@
1
- {"name":"fs-extra","version":"9.1.0","description":"fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as recursive mkdir, copy, and remove.","engines":{"node":">=10"},"homepage":"https://github.com/jprichardson/node-fs-extra","repository":{"type":"git","url":"https://github.com/jprichardson/node-fs-extra"},"keywords":["fs","file","file system","copy","directory","extra","mkdirp","mkdir","mkdirs","recursive","json","read","write","extra","delete","remove","touch","create","text","output","move","promise"],"author":"JP Richardson <jprichardson@gmail.com>","license":"MIT","dependencies":{"at-least-node":"^1.0.0","graceful-fs":"^4.2.0","jsonfile":"^6.0.1","universalify":"^2.0.0"},"devDependencies":{"coveralls":"^3.0.0","klaw":"^2.1.1","klaw-sync":"^3.0.2","minimist":"^1.1.1","mocha":"^5.0.5","nyc":"^15.0.0","proxyquire":"^2.0.1","read-dir-files":"^0.1.1","standard":"^14.1.0"},"main":"./lib/index.js","files":["lib/","!lib/**/__tests__/"],"scripts":{"full-ci":"npm run lint && npm run coverage","coverage":"nyc -r lcovonly npm run unit","coveralls":"coveralls < coverage/lcov.info","lint":"standard","test-find":"find ./lib/**/__tests__ -name *.test.js | xargs mocha","test":"npm run lint && npm run unit","unit":"node test.js"},"_lastModified":"2026-06-22T05:35:28.785Z"}
1
+ {"name":"fs-extra","version":"9.1.0","description":"fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as recursive mkdir, copy, and remove.","engines":{"node":">=10"},"homepage":"https://github.com/jprichardson/node-fs-extra","repository":{"type":"git","url":"https://github.com/jprichardson/node-fs-extra"},"keywords":["fs","file","file system","copy","directory","extra","mkdirp","mkdir","mkdirs","recursive","json","read","write","extra","delete","remove","touch","create","text","output","move","promise"],"author":"JP Richardson <jprichardson@gmail.com>","license":"MIT","dependencies":{"at-least-node":"^1.0.0","graceful-fs":"^4.2.0","jsonfile":"^6.0.1","universalify":"^2.0.0"},"devDependencies":{"coveralls":"^3.0.0","klaw":"^2.1.1","klaw-sync":"^3.0.2","minimist":"^1.1.1","mocha":"^5.0.5","nyc":"^15.0.0","proxyquire":"^2.0.1","read-dir-files":"^0.1.1","standard":"^14.1.0"},"main":"./lib/index.js","files":["lib/","!lib/**/__tests__/"],"scripts":{"full-ci":"npm run lint && npm run coverage","coverage":"nyc -r lcovonly npm run unit","coveralls":"coveralls < coverage/lcov.info","lint":"standard","test-find":"find ./lib/**/__tests__ -name *.test.js | xargs mocha","test":"npm run lint && npm run unit","unit":"node test.js"},"_lastModified":"2026-06-29T01:54:33.148Z"}
@@ -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":"2026-06-22T05:35:30.624Z"}
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":"2026-06-29T01:54:33.459Z"}
@@ -1 +1 @@
1
- {"name":"yauzl","version":"3.3.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":"2026-06-22T05:35:28.614Z"}
1
+ {"name":"yauzl","version":"3.3.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":"2026-06-29T01:54:32.945Z"}
@@ -10,6 +10,9 @@ import { DatabaseOptions } from '@nocobase/database';
10
10
  export type DBBackupOptions = {
11
11
  dir: string;
12
12
  skipFdw?: boolean;
13
+ /**
14
+ * @deprecated Prefer excludeTables. includeTables may miss dependent database objects.
15
+ */
13
16
  includeTables?: string[];
14
17
  excludeTables?: string[];
15
18
  };
@@ -17,6 +20,7 @@ export type DBRestoreOptions = {
17
20
  filePath: string;
18
21
  schema?: string;
19
22
  skipDropAllTables?: boolean;
23
+ restoreMode?: 'preserveTables';
20
24
  toolchain?: DBBackupToolchain;
21
25
  };
22
26
  export type DBBackupToolchain = 'postgres' | 'kingbase';
@@ -52,8 +52,15 @@ const D$$ = import_os.default.platform() === "win32" ? "$$" : "\\$\\$";
52
52
  const STREAM_BUFFER_SIZE = 2 * 1024 * 1024;
53
53
  const run = async (command, envVars = {}) => {
54
54
  try {
55
- const { stdout } = await exec(command, { env: { ...process.env, ...envVars } });
56
- return stdout;
55
+ const result = await exec(command, { env: { ...process.env, ...envVars } });
56
+ if (typeof result === "string") {
57
+ return result;
58
+ }
59
+ if (result && typeof result === "object" && "stdout" in result) {
60
+ const { stdout } = result;
61
+ return typeof stdout === "string" ? stdout : String(stdout ?? "");
62
+ }
63
+ return "";
57
64
  } catch (error) {
58
65
  throw new Error(`${error.message}`);
59
66
  }
@@ -68,6 +75,20 @@ const escapeStringLiteral = (value) => String(value).replace(/'/g, "''");
68
75
  const quotePgIdentifier = (value) => `"${String(value).replace(/"/g, '""')}"`;
69
76
  const quoteShellArg = (value) => `'${String(value).replace(/'/g, "'\\''")}'`;
70
77
  const quotePgTablePattern = (table) => quoteShellArg(String(table).split(".").map(quotePgIdentifier).join("."));
78
+ const isPgRestoreSchemaTocEntry = (line) => /^\d+;\s+\d+\s+\d+\s+SCHEMA\s+-\s+/.test(line);
79
+ const parsePgTableReference = (table, defaultSchema) => {
80
+ const parts = String(table).split(".");
81
+ if (parts.length > 1) {
82
+ return {
83
+ schema: parts[0],
84
+ table: parts.slice(1).join(".")
85
+ };
86
+ }
87
+ return {
88
+ schema: defaultSchema,
89
+ table: parts[0]
90
+ };
91
+ };
71
92
  const qualifyPgTablePattern = (table, schema) => {
72
93
  const tablePattern = String(table);
73
94
  if (!schema || tablePattern.includes(".")) {
@@ -153,6 +174,7 @@ class MySQLAdapter extends BaseDBAdapter {
153
174
  "--set-gtid-purged=OFF",
154
175
  "--routines",
155
176
  "--triggers",
177
+ "--events",
156
178
  ...version && version > 7 ? ["--column-statistics=0"] : [],
157
179
  database
158
180
  ];
@@ -245,9 +267,47 @@ class MySQLAdapter extends BaseDBAdapter {
245
267
  return "";
246
268
  }
247
269
  }
248
- async restore({ filePath, skipDropAllTables = false }) {
270
+ async restore({ filePath, skipDropAllTables = false, restoreMode }) {
249
271
  const { username, host, port, database, password } = this.dbOpts;
250
- if (!skipDropAllTables) {
272
+ if (restoreMode === "preserveTables") {
273
+ const dropViewsCommand = `mysql -u ${username} -h ${host} ${port ? `-P ${port}` : ""} --protocol=tcp -D ${database} -e "
274
+ DELIMITER $$
275
+ DROP PROCEDURE IF EXISTS drop_all_views$$
276
+ CREATE PROCEDURE drop_all_views()
277
+ BEGIN
278
+ DECLARE _done INT DEFAULT FALSE;
279
+ DECLARE _viewName VARCHAR(255);
280
+
281
+ DECLARE _cursor CURSOR FOR
282
+ SELECT table_name
283
+ FROM information_schema.VIEWS
284
+ WHERE table_schema = SCHEMA();
285
+
286
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET _done = TRUE;
287
+
288
+ OPEN _cursor;
289
+
290
+ REPEAT
291
+ FETCH _cursor INTO _viewName;
292
+
293
+ IF NOT _done THEN
294
+ SET @stmt_sql = CONCAT('DROP VIEW IF EXISTS ', _viewName);
295
+ PREPARE stmt FROM @stmt_sql;
296
+ EXECUTE stmt;
297
+ DEALLOCATE PREPARE stmt;
298
+ END IF;
299
+
300
+ UNTIL _done END REPEAT;
301
+
302
+ CLOSE _cursor;
303
+ END$$
304
+
305
+ CALL drop_all_views()$$
306
+ DROP PROCEDURE drop_all_views$$
307
+ DELIMITER ;
308
+ "`;
309
+ await run(dropViewsCommand, { MYSQL_PWD: password });
310
+ } else if (!skipDropAllTables) {
251
311
  const dropDataCommand = `mysql -u ${username} -h ${host} ${port ? `-P ${port}` : ""} --protocol=tcp -D ${database} -e "
252
312
  DELIMITER $$
253
313
  DROP PROCEDURE IF EXISTS drop_all_tables_and_triggers$$
@@ -376,15 +436,47 @@ class PostgresAdapter extends BaseDBAdapter {
376
436
  const filePath = `${dir}/data`;
377
437
  const backupSchema = this.getBackupSchema();
378
438
  const schemaOption = backupSchema ? `--schema=${backupSchema}` : "";
439
+ const expandedExcludeTables = Array.isArray(excludeTables) ? [.../* @__PURE__ */ new Set([...excludeTables, ...await this.getOwnedSequenceTables(excludeTables, backupSchema)])] : [];
379
440
  const includeOption = Array.isArray(includeTables) && includeTables.length ? includeTables.map((table) => `-t ${quotePgTablePattern(qualifyPgTablePattern(table, backupSchema))}`).join(" ") : "";
380
- const excludeOption = Array.isArray(excludeTables) && excludeTables.length ? excludeTables.map((table) => `-T ${quotePgTablePattern(qualifyPgTablePattern(table, backupSchema))}`).join(" ") : "";
441
+ const excludeOption = expandedExcludeTables.length ? expandedExcludeTables.map((table) => `-T ${quotePgTablePattern(qualifyPgTablePattern(table, backupSchema))}`).join(" ") : "";
381
442
  const command = `${this.getBackupCommandName()} ${includeOption} ${excludeOption} -U ${username} -h ${host} ${port ? `-p ${port}` : ""} -F c -b --quote-all-identifiers ${schemaOption} -f ${filePath} ${database}`;
382
443
  await run(command, this.getPasswordEnvVars(password));
383
444
  }
445
+ async getOwnedSequenceTables(excludeTables, backupSchema) {
446
+ if (!Array.isArray(excludeTables) || !excludeTables.length) {
447
+ return [];
448
+ }
449
+ const { username, host, port, database, password } = this.dbOpts;
450
+ const tableRefs = excludeTables.map((table) => parsePgTableReference(table, backupSchema)).filter((ref) => ref.table);
451
+ if (!tableRefs.length) {
452
+ return [];
453
+ }
454
+ const values = tableRefs.map((ref) => {
455
+ const schemaValue = ref.schema == null ? "NULL" : `'${escapeStringLiteral(ref.schema)}'`;
456
+ return `(${schemaValue}, '${escapeStringLiteral(ref.table)}')`;
457
+ }).join(",");
458
+ const query = `
459
+ WITH excluded(schema_name, table_name) AS (VALUES ${values})
460
+ SELECT seq_ns.nspname || '.' || seq.relname
461
+ FROM excluded
462
+ JOIN pg_class tbl ON tbl.relname = excluded.table_name
463
+ JOIN pg_namespace tbl_ns ON tbl_ns.oid = tbl.relnamespace
464
+ JOIN pg_depend dep ON dep.refobjid = tbl.oid
465
+ JOIN pg_class seq ON seq.oid = dep.objid AND seq.relkind = 'S'
466
+ JOIN pg_namespace seq_ns ON seq_ns.oid = seq.relnamespace
467
+ WHERE tbl.relkind IN ('r', 'p')
468
+ AND dep.deptype IN ('a', 'i')
469
+ AND (excluded.schema_name IS NULL OR tbl_ns.nspname = excluded.schema_name)
470
+ `;
471
+ const command = `${this.getSqlCommandName()} -U ${username} -h ${host} ${port ? `-p ${port}` : ""} -d ${database} -At -c ${quoteShellArg(query)}`;
472
+ const output = String(await run(command, this.getPasswordEnvVars(password)));
473
+ return output.split("\n").map((line) => line.trim()).filter(Boolean);
474
+ }
384
475
  async restore({
385
476
  filePath,
386
477
  schema,
387
478
  skipDropAllTables = false,
479
+ restoreMode,
388
480
  toolchain = this.backupToolchain
389
481
  }) {
390
482
  const { username, host, port, database, password } = this.dbOpts;
@@ -402,13 +494,34 @@ class PostgresAdapter extends BaseDBAdapter {
402
494
  const j = Math.max(1, Math.floor(cpuCores / 2));
403
495
  const schemaNameCondition = schemaOption ? `WHERE schemaname = '${schemaOption}'` : `WHERE schemaname NOT IN ('pg_catalog', 'information_schema')`;
404
496
  const relnamespaceCondition = schemaOption ? `WHERE relnamespace = '${schemaOption}'::regnamespace` : `WHERE tgrelid IN (SELECT oid FROM pg_class WHERE relnamespace NOT IN (SELECT oid FROM pg_catalog.pg_namespace WHERE nspname IN ('pg_catalog', 'information_schema')))`;
405
- if (!skipDropAllTables) {
497
+ if (restoreMode === "preserveTables") {
498
+ const dropViewsCommand = `${this.getSqlCommandName(toolchain)} -U ${username} -h ${host} ${port ? `-p ${port}` : ""} -d ${database} -c "
499
+ DO ${D$$} DECLARE r RECORD;
500
+ BEGIN
501
+ FOR r IN (
502
+ SELECT schemaname, viewname, false AS materialized FROM pg_views ${schemaNameCondition}
503
+ UNION ALL
504
+ SELECT schemaname, matviewname AS viewname, true AS materialized FROM pg_matviews ${schemaNameCondition}
505
+ ) LOOP
506
+ BEGIN
507
+ IF r.materialized THEN
508
+ EXECUTE 'DROP MATERIALIZED VIEW IF EXISTS ' || quote_ident(r.schemaname) || '.' || quote_ident(r.viewname) || ' CASCADE';
509
+ ELSE
510
+ EXECUTE 'DROP VIEW IF EXISTS ' || quote_ident(r.schemaname) || '.' || quote_ident(r.viewname) || ' CASCADE';
511
+ END IF;
512
+ EXCEPTION
513
+ WHEN OTHERS THEN
514
+ END;
515
+ END LOOP;
516
+ END ${D$$};"`.replace(/\n/g, " ");
517
+ await run(dropViewsCommand, this.getPasswordEnvVars(password, toolchain));
518
+ } else if (!skipDropAllTables) {
406
519
  const dropDataCommand = `${this.getSqlCommandName(toolchain)} -U ${username} -h ${host} ${port ? `-p ${port}` : ""} -d ${database} -c "
407
520
  DO ${D$$} DECLARE r RECORD;
408
521
  BEGIN
409
522
  FOR r IN (SELECT viewname,schemaname FROM pg_views ${schemaNameCondition}) LOOP
410
523
  BEGIN
411
- EXECUTE 'DROP VIEW IF EXISTS ' || quote_ident(r.schemaname) || '.' || quote_ident(r.tablename) || ' CASCADE';
524
+ EXECUTE 'DROP VIEW IF EXISTS ' || quote_ident(r.schemaname) || '.' || quote_ident(r.viewname) || ' CASCADE';
412
525
  EXCEPTION
413
526
  WHEN OTHERS THEN
414
527
  END;
@@ -424,7 +537,7 @@ class PostgresAdapter extends BaseDBAdapter {
424
537
 
425
538
  FOR r IN (SELECT sequencename,schemaname FROM pg_sequences ${schemaNameCondition}) LOOP
426
539
  BEGIN
427
- EXECUTE 'DROP SEQUENCE IF EXISTS ' || quote_ident(r.schemaname) || '.' || quote_ident(r.tablename) || ' CASCADE';
540
+ EXECUTE 'DROP SEQUENCE IF EXISTS ' || quote_ident(r.schemaname) || '.' || quote_ident(r.sequencename) || ' CASCADE';
428
541
  EXCEPTION
429
542
  WHEN OTHERS THEN
430
543
  END;
@@ -446,14 +559,35 @@ class PostgresAdapter extends BaseDBAdapter {
446
559
  await run(dropDataCommand, this.getPasswordEnvVars(password, toolchain));
447
560
  }
448
561
  if (schema === schemaOption || !schemaOption) {
449
- const pgRestoreCommand = `${this.getRestoreCommandName(toolchain)} -U ${username} -h ${host} ${port ? `-p ${port}` : ""} -d ${database} --clean --if-exists --no-owner -j ${j} ${filePath}`;
450
- await run(pgRestoreCommand, this.getPasswordEnvVars(password, toolchain));
562
+ const restoreList = restoreMode === "preserveTables" ? await this.createRestoreListWithoutSchema(filePath, toolchain) : void 0;
563
+ const pgRestoreCommand = `${this.getRestoreCommandName(toolchain)} -U ${username} -h ${host} ${port ? `-p ${port}` : ""} -d ${database} --clean --if-exists --no-owner -j ${j} ${(restoreList == null ? void 0 : restoreList.option) ?? ""} ${filePath}`;
564
+ try {
565
+ await run(pgRestoreCommand, this.getPasswordEnvVars(password, toolchain));
566
+ } finally {
567
+ if (restoreList) {
568
+ await fsPromises.unlink(restoreList.filePath).catch(() => {
569
+ });
570
+ }
571
+ }
451
572
  } else {
452
573
  const srcSchema = schema || "public";
453
574
  const pgRestoreCommand = this.buildSchemaRestoreCommand(srcSchema, schemaOption, filePath, j, toolchain);
454
575
  await this.restoreSchema(srcSchema, schemaOption, pgRestoreCommand, toolchain);
455
576
  }
456
577
  }
578
+ async createRestoreListWithoutSchema(filePath, toolchain = this.backupToolchain) {
579
+ const listOutput = String(await run(`${this.getRestoreCommandName(toolchain)} --list ${quoteShellArg(filePath)}`));
580
+ const filteredList = listOutput.split("\n").filter((line) => !isPgRestoreSchemaTocEntry(line)).join("\n");
581
+ const listFilePath = import_path.default.join(
582
+ import_os.default.tmpdir(),
583
+ `nocobase-pg-restore-${process.pid}-${Date.now()}-${Math.random().toString(16).slice(2)}.list`
584
+ );
585
+ await fsPromises.writeFile(listFilePath, filteredList);
586
+ return {
587
+ option: `-L ${quoteShellArg(listFilePath)}`,
588
+ filePath: listFilePath
589
+ };
590
+ }
457
591
  buildSchemaRestoreCommand(srcSchema, _targetSchema, filePath, jobs, toolchain = this.backupToolchain) {
458
592
  const { username, host, port, database } = this.dbOpts;
459
593
  return `${this.getRestoreCommandName(toolchain)} -U ${username} -h ${host} ${port ? `-p ${port}` : ""} -n ${srcSchema} -d ${database} --clean --if-exists --no-owner -j ${jobs} ${filePath}`;
@@ -9,5 +9,5 @@
9
9
  export { BackupManager } from './managers/backup';
10
10
  export type { BackupSettings, BackupCreator, BackupTaskResult } from './managers/backup';
11
11
  export { RestoreManager, RestoreOptions } from './managers/restore';
12
- export { BACKUP_EXTENSION } from './utils';
12
+ export { BACKUP_EXTENSION, METADATA_EXTENSION, Extractor, compressDirectoryToBackupArchive } from './utils';
13
13
  export { default } from './plugin';
@@ -38,8 +38,11 @@ var server_exports = {};
38
38
  __export(server_exports, {
39
39
  BACKUP_EXTENSION: () => import_utils.BACKUP_EXTENSION,
40
40
  BackupManager: () => import_backup.BackupManager,
41
+ Extractor: () => import_utils.Extractor,
42
+ METADATA_EXTENSION: () => import_utils.METADATA_EXTENSION,
41
43
  RestoreManager: () => import_restore.RestoreManager,
42
44
  RestoreOptions: () => import_restore.RestoreOptions,
45
+ compressDirectoryToBackupArchive: () => import_utils.compressDirectoryToBackupArchive,
43
46
  default: () => import_plugin.default
44
47
  });
45
48
  module.exports = __toCommonJS(server_exports);
@@ -51,6 +54,9 @@ var import_plugin = __toESM(require("./plugin"));
51
54
  0 && (module.exports = {
52
55
  BACKUP_EXTENSION,
53
56
  BackupManager,
57
+ Extractor,
58
+ METADATA_EXTENSION,
54
59
  RestoreManager,
55
- RestoreOptions
60
+ RestoreOptions,
61
+ compressDirectoryToBackupArchive
56
62
  });
@@ -17,10 +17,14 @@ export interface BackupSettings {
17
17
  keep?: number;
18
18
  scheduled: boolean;
19
19
  cron: string;
20
+ /**
21
+ * @deprecated Prefer excludeTables. includeTables may miss dependent database objects.
22
+ */
20
23
  includeTables?: string[];
21
24
  excludeTables?: string[];
22
25
  description?: string;
23
26
  createdBy?: BackupCreator;
27
+ metadata?: Record<string, unknown>;
24
28
  }
25
29
  export interface BackupFile {
26
30
  name: string;
@@ -50,7 +50,7 @@ var import_utils = require("@nocobase/utils");
50
50
  var import_util = require("util");
51
51
  var import_database = require("../adapters/database");
52
52
  var import_utils2 = require("../utils");
53
- const BACKUP_METADATA_VERSION = 1;
53
+ const BACKUP_METADATA_VERSION = 2;
54
54
  class BackupManager {
55
55
  app;
56
56
  ctx;
@@ -190,6 +190,7 @@ class BackupManager {
190
190
  };
191
191
  });
192
192
  const metadata = {
193
+ ...opts.metadata ?? {},
193
194
  metadataVersion: BACKUP_METADATA_VERSION,
194
195
  enableFilesBackup: opts.enableFilesBackup,
195
196
  version: await this.app.version.get(),
@@ -11,6 +11,7 @@ import { ResourcerContext } from '@nocobase/resourcer';
11
11
  export interface RestoreOptions {
12
12
  forceSchemaRestore?: boolean;
13
13
  skipDropAllTables?: boolean;
14
+ restoreMode?: 'preserveTables';
14
15
  }
15
16
  export declare class RestoreManager {
16
17
  #private;
@@ -143,6 +143,7 @@ class RestoreManager {
143
143
  filePath: import_path.default.join(extractedDir, dbFile),
144
144
  schema: metadata.database.schema,
145
145
  skipDropAllTables: (options == null ? void 0 : options.skipDropAllTables) === true,
146
+ restoreMode: options == null ? void 0 : options.restoreMode,
146
147
  toolchain: this.#resolveRestoreToolchain(metadata)
147
148
  });
148
149
  this.ctx.logger.info("Database restored successfully", { module: import_utils2.BACKUPS });
@@ -393,6 +394,7 @@ class RestoreManager {
393
394
  filePath: import_path.default.join(extractedDir, dbFile),
394
395
  schema: metadata.database.schema,
395
396
  skipDropAllTables: (options == null ? void 0 : options.skipDropAllTables) === true,
397
+ restoreMode: options == null ? void 0 : options.restoreMode,
396
398
  toolchain: this.#resolveRestoreToolchain(metadata)
397
399
  });
398
400
  this.ctx.logger.info("Database restored successfully", { module: import_utils2.BACKUPS });
@@ -33,6 +33,7 @@ export declare class Extractor extends Writable {
33
33
  private extract;
34
34
  promise(): Promise<void>;
35
35
  }
36
+ export declare function compressDirectoryToBackupArchive(sourceDir: string, backupFilePath: string): Promise<void>;
36
37
  export declare function humanFileSize(bytes: number, si?: boolean, dp?: number): string;
37
38
  export declare function getDBVersion(db: Database): Promise<string>;
38
39
  export declare function isQsTruly(value?: string | boolean): any;
@@ -48,6 +48,7 @@ __export(utils_exports, {
48
48
  RESTORE_TASKS_CACHE_TTL: () => RESTORE_TASKS_CACHE_TTL,
49
49
  SETTINGS: () => SETTINGS,
50
50
  STORAGE_PATH: () => STORAGE_PATH,
51
+ compressDirectoryToBackupArchive: () => compressDirectoryToBackupArchive,
51
52
  getDBVersion: () => getDBVersion,
52
53
  humanFileSize: () => humanFileSize,
53
54
  isQsTruly: () => isQsTruly,
@@ -56,6 +57,7 @@ __export(utils_exports, {
56
57
  });
57
58
  module.exports = __toCommonJS(utils_exports);
58
59
  var import_stream = require("stream");
60
+ var import_archiver = __toESM(require("archiver"));
59
61
  var import_yauzl = __toESM(require("yauzl"));
60
62
  var import_fs_extra = __toESM(require("fs-extra"));
61
63
  var import_path = __toESM(require("path"));
@@ -196,6 +198,30 @@ class Extractor extends import_stream.Writable {
196
198
  });
197
199
  }
198
200
  }
201
+ async function compressDirectoryToBackupArchive(sourceDir, backupFilePath) {
202
+ const archive = (0, import_archiver.default)("zip", { zlib: { level: 9 } });
203
+ const output = import_fs_extra.default.createWriteStream(backupFilePath);
204
+ const outputClosed = new Promise((resolve, reject) => {
205
+ output.on("close", resolve);
206
+ output.on("error", reject);
207
+ archive.on("error", reject);
208
+ archive.on("warning", (error) => {
209
+ if (error.code === "ENOENT") {
210
+ return;
211
+ }
212
+ reject(error);
213
+ });
214
+ });
215
+ try {
216
+ archive.pipe(output);
217
+ archive.directory(sourceDir, false);
218
+ await archive.finalize();
219
+ await outputClosed;
220
+ } catch (error) {
221
+ await import_fs_extra.default.remove(backupFilePath);
222
+ throw error;
223
+ }
224
+ }
199
225
  function humanFileSize(bytes, si = false, dp = 1) {
200
226
  const thresh = si ? 1e3 : 1024;
201
227
  const units = si ? ["B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"] : ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"];
@@ -319,6 +345,7 @@ class EscapeQuoteTransform extends import_stream.Transform {
319
345
  RESTORE_TASKS_CACHE_TTL,
320
346
  SETTINGS,
321
347
  STORAGE_PATH,
348
+ compressDirectoryToBackupArchive,
322
349
  getDBVersion,
323
350
  humanFileSize,
324
351
  isQsTruly,
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "备份管理器",
5
5
  "description": "Provides backup and restore functionality, supports scheduled backups, and ensures data security and quick recovery.",
6
6
  "description.zh-CN": "提供备份与还原功能,支持定时备份,确保数据安全与快速恢复。",
7
- "version": "2.2.0-beta.6",
7
+ "version": "2.2.0-beta.8",
8
8
  "license": "Apache-2.0",
9
9
  "main": "dist/server/index.js",
10
10
  "nocobase": {
@@ -50,5 +50,5 @@
50
50
  "keywords": [
51
51
  "System management"
52
52
  ],
53
- "gitHead": "dc9246516f8a3efd6056f22fe7b3bc947bd4575b"
53
+ "gitHead": "fa2502c1e9faf6d74b3f51b42dbc6546638d46af"
54
54
  }
@@ -1,10 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- (self.webpackChunk_nocobase_plugin_backups_client_v2=self.webpackChunk_nocobase_plugin_backups_client_v2||[]).push([["567"],{574:function(e,t,n){var r,a;void 0===(a="function"==typeof(r=function(){"use strict";function t(e,t,n){var r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){l(r.response,t,n)},r.onerror=function(){console.error("could not download file")},r.send()}function r(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&299>=t.status}function a(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(n){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var o="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof n.g&&n.g.global===n.g?n.g:void 0,u=o.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),l=o.saveAs||("object"!=typeof window||window!==o?function(){}:"download"in HTMLAnchorElement.prototype&&!u?function(e,n,u){var l=o.URL||o.webkitURL,i=document.createElement("a");i.download=n=n||e.name||"download",i.rel="noopener","string"==typeof e?(i.href=e,i.origin===location.origin?a(i):r(i.href)?t(e,n,u):a(i,i.target="_blank")):(i.href=l.createObjectURL(e),setTimeout(function(){l.revokeObjectURL(i.href)},4e4),setTimeout(function(){a(i)},0))}:"msSaveOrOpenBlob"in navigator?function(e,n,o){if(n=n||e.name||"download","string"!=typeof e){var u;navigator.msSaveOrOpenBlob((void 0===(u=o)?u={autoBom:!1}:"object"!=typeof u&&(console.warn("Deprecated: Expected third argument to be a object"),u={autoBom:!u}),u.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e),n)}else if(r(e))t(e,n,o);else{var l=document.createElement("a");l.href=e,l.target="_blank",setTimeout(function(){a(l)})}}:function(e,n,r,a){if((a=a||open("","_blank"))&&(a.document.title=a.document.body.innerText="downloading..."),"string"==typeof e)return t(e,n,r);var l="application/octet-stream"===e.type,i=/constructor/i.test(o.HTMLElement)||o.safari,c=/CriOS\/[\d]+/.test(navigator.userAgent);if((c||l&&i||u)&&"u">typeof FileReader){var s=new FileReader;s.onloadend=function(){var e=s.result;e=c?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),a?a.location.href=e:location=e,a=null},s.readAsDataURL(e)}else{var f=o.URL||o.webkitURL,p=f.createObjectURL(e);a?a.location=p:location.href=p,a=null,setTimeout(function(){f.revokeObjectURL(p)},4e4)}});o.saveAs=l.saveAs=l,e.exports=l})?r.apply(t,[]):r)||(e.exports=a)},258:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return Y}});var r=n(694),a=n(625),o=n(59),u=n(155),l=n.n(u),i=n(485),c=n(185),s=n.n(c),f=n(574),p=n(401),d=(0,u.createContext)(null),b=function(){var e=(0,u.useContext)(d);if(!e)throw Error("BackupsContext provider is missing");return e},m=n(488);function v(e,t,n,r,a,o,u){try{var l=e[o](u),i=l.value}catch(e){n(e);return}l.done?t(i):Promise.resolve(i).then(r,a)}var h={database:{dialect:""}},y=function(){var e=(0,r.useFlowContext)(),t=(0,a.useMemoizedFn)(function(){var t;return(t=function(){var t,n;return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(u,"next",{value:i(0)}),l(u,"throw",{value:i(1)}),l(u,"return",{value:i(2)}),"function"==typeof Symbol&&l(u,Symbol.iterator,{value:function(){return this}}),u;function i(l){return function(i){var c=[l,i];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(r){switch(r.label){case 0:return[4,e.api.request({url:"backups:appInfo"})];case 1:return[2,null!=(t=null==(n=r.sent().data)?void 0:n.data)?t:h]}})},function(){var e=this,n=arguments;return new Promise(function(r,a){var o=t.apply(e,n);function u(e){v(o,r,a,u,l,"next",e)}function l(e){v(o,r,a,u,l,"throw",e)}u(void 0)})})()}),n=(0,a.useRequest)(t,{cacheKey:"backupAppInfo",staleTime:-1}).data;return null!=n?n:h},w=function(){var e=(0,r.useFlowEngine)(),t=(0,i.useApp)();return{showCheckBackupMessage:(0,a.useMemoizedFn)(function(){var n=e.context[p.l];n?n.showCheckBackupMessage():("function"==typeof t.setMaintaining?t.setMaintaining(!0):t.maintaining=!0,t.error={command:{name:"APP Restoring"},message:"checking backup...",code:"APP_COMMANDING"})}),hideCheckBackupMessage:(0,a.useMemoizedFn)(function(){var n=e.context[p.l];n?n.hideCheckBackupMessage():"function"==typeof t.setMaintaining?t.setMaintaining(!1):t.maintaining=!1})}};function g(e,t,n,r,a,o,u){try{var l=e[o](u),i=l.value}catch(e){n(e);return}l.done?t(i):Promise.resolve(i).then(r,a)}function k(){var e=(0,r.useFlowContext)(),t=(0,i.useApp)(),n=l().useRef(null),a=o.App.useApp().notification,c=w().hideCheckBackupMessage;return(0,u.useEffect)(function(){var t=setInterval(function(){var t;return(t=function(){var t,r;return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(u,"next",{value:i(0)}),l(u,"throw",{value:i(1)}),l(u,"return",{value:i(2)}),"function"==typeof Symbol&&l(u,Symbol.iterator,{value:function(){return this}}),u;function i(l){return function(i){var c=[l,i];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(o){switch(o.label){case 0:if(!n.current)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,e.api.request({url:"".concat(p.C,":restoreStatus"),method:"get",params:{task:n.current}})];case 2:if(!(r=null==(t=o.sent().data)?void 0:t.data))return[2];return r.inProgress||(n.current=null),r.message&&(c(),a.error({message:r.message,role:"alert"})),[3,4];case 3:return console.error(o.sent()),[3,4];case 4:return[2]}})},function(){var e=this,n=arguments;return new Promise(function(r,a){var o=t.apply(e,n);function u(e){g(o,r,a,u,l,"next",e)}function l(e){g(o,r,a,u,l,"throw",e)}u(void 0)})})()},3e3);return function(){return clearInterval(t)}},[t.maintaining,e.api,c,a]),n}function E(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 C(e,t,n,r,a,o,u){try{var l=e[o](u),i=l.value}catch(e){n(e);return}l.done?t(i):Promise.resolve(i).then(r,a)}function S(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],u=!0,l=!1;try{for(a=a.call(e);!(u=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);u=!0);}catch(e){l=!0,r=e}finally{try{u||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return E(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 E(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.")}()}var x=function(e){var t=e.backup,n=(0,m.k)(),a=(0,r.useFlowContext)(),u=S(l().useState(!1),2),i=u[0],c=u[1],s=S(l().useState(""),2),f=s[0],p=s[1],d=S(l().useState(!1),2),b=d[0],v=d[1],h=S(l().useState(""),2),g=h[0],E=h[1],x=k(),A=w().showCheckBackupMessage,O=y().database,j=O.schema,I=O.dialect,P=function(){p(""),E("")},M=function(){c(!1),P()};return l().createElement(l().Fragment,null,l().createElement(o.Button,{type:"link",size:"small",onClick:function(){c(!0)}},n("Restore")),l().createElement(o.Modal,{title:n("Restore"),open:i,onCancel:M,footer:[l().createElement(o.Button,{key:"back",onClick:M},n("Cancel")),l().createElement(o.Button,{key:"submit",type:"primary",loading:b,onClick:function(){var e;return(e=function(){var e,n,r;return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(u,"next",{value:i(0)}),l(u,"throw",{value:i(1)}),l(u,"return",{value:i(2)}),"function"==typeof Symbol&&l(u,Symbol.iterator,{value:function(){return this}}),u;function i(l){return function(i){var c=[l,i];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(o){switch(o.label){case 0:v(!0),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,a.api.request({url:"backups:restore",method:"post",data:{name:t.name,password:f,dbSchema:g}})];case 2:return x.current=null!=(e=null==(r=o.sent().data)||null==(n=r.data)?void 0:n.task)?e:null,A(),[3,4];case 3:return console.error(o.sent()),[3,4];case 4:return v(!1),c(!1),P(),[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function u(e){C(o,r,a,u,l,"next",e)}function l(e){C(o,r,a,u,l,"throw",e)}u(void 0)})})()}},n("Submit"))]},l().createElement(o.Form,{layout:"vertical",autoComplete:"off"},["postgres","kingbase"].includes(I)&&l().createElement(o.Form.Item,{label:l().createElement("strong",null,n("Confirm the application database schema")),help:n("Required if application database schema is different with the backup",{currentDbSchemaTips:j?"[".concat(j,"]"):""})},l().createElement(o.Input,{autoComplete:"new-password",value:g,onChange:function(e){return E(e.target.value)}})),l().createElement(o.Form.Item,{colon:!0,label:l().createElement("strong",null,n("Restore password"))},l().createElement(o.Input.Password,{value:f,autoComplete:"new-password",onChange:function(e){return p(e.target.value)}})))))};function A(e,t,n,r,a,o,u){try{var l=e[o](u),i=l.value}catch(e){n(e);return}l.done?t(i):Promise.resolve(i).then(r,a)}function O(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function u(e){A(o,r,a,u,l,"next",e)}function l(e){A(o,r,a,u,l,"throw",e)}u(void 0)})}}function j(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(u,"next",{value:i(0)}),l(u,"throw",{value:i(1)}),l(u,"return",{value:i(2)}),"function"==typeof Symbol&&l(u,Symbol.iterator,{value:function(){return this}}),u;function i(l){return function(i){var c=[l,i];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var I=function(){var e,t=(0,m.k)(),n=(0,r.useFlowContext)(),c=(0,i.useCurrentAppInfo)(),d=o.theme.useToken().token,v=o.App.useApp(),h=v.modal,y=v.message,w=b(),g=w.data,k=w.loading,E=w.refreshAsync,C=(0,a.useRequest)(function(e){return O(function(){var t;return j(this,function(r){switch(r.label){case 0:return[4,n.api.request({url:"".concat(p.C,":destroy"),method:"post",params:{filterByTk:e}})];case 1:return[2,null==(t=r.sent().data)?void 0:t.data]}})})()},{manual:!0}).runAsync,S=(0,u.useCallback)(function(e){h.confirm({title:t("Delete record"),content:t("Are you sure you want to delete it?"),onOk:function(){return O(function(){return j(this,function(n){switch(n.label){case 0:return[4,C(e.name)];case 1:return n.sent(),[4,E()];case 2:return n.sent(),y.success(t("The deletion was successful.")),[2]}})})()}})},[C,y,h,E,t]),A=(0,u.useCallback)(function(e){return O(function(){var t,r,a,o,u;return j(this,function(l){switch(l.label){case 0:return a=null!=(t=null==c?void 0:c.name)?t:null==c||null==(r=c.data)?void 0:r.name,o={filterByTk:e.name},a&&(o.__appName=a),[4,n.api.request({url:"backups:download",method:"get",params:o,responseType:"blob"})];case 1:return u=new Blob([l.sent().data]),(0,f.saveAs)(u,e.name),[2]}})})()},[n.api,null==c||null==(e=c.data)?void 0:e.name,null==c?void 0:c.name]),I=function(e){return e.inProgress?{colSpan:0}:{}},P=(0,u.useMemo)(function(){return[{title:t("Backup list"),dataIndex:"name",width:400,onCell:function(e){return e.inProgress?{colSpan:4}:{}},render:function(e,n){return n.inProgress?l().createElement("span",{style:{color:d.colorText}},e,"(",t("Backing up"),"...)"):l().createElement("span",null,e)}},{title:t("File size"),dataIndex:"fileSize",onCell:I},{title:t("Created at"),dataIndex:"createdAt",onCell:I,render:function(e){return e?s()(e).format("YYYY-MM-DD HH:mm:ss"):null}},{title:t("Actions"),dataIndex:"actions",onCell:I,render:function(e,n){return l().createElement(o.Space,{split:l().createElement(o.Divider,{type:"vertical"})},l().createElement(x,{backup:n}),l().createElement("a",{onClick:function(){A(n)}},t("Download")),l().createElement("a",{onClick:function(){return S(n)}},t("Delete")))}}]},[S,A,t,d.colorText]);return l().createElement(i.Table,{rowKey:"name",dataSource:null==g?void 0:g.data,loading:k,columns:P})},P=n(375);function M(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 R(e,t,n,r,a,o,u){try{var l=e[o](u),i=l.value}catch(e){n(e);return}l.done?t(i):Promise.resolve(i).then(r,a)}function T(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function u(e){R(o,r,a,u,l,"next",e)}function l(e){R(o,r,a,u,l,"throw",e)}u(void 0)})}}function B(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],u=!0,l=!1;try{for(a=a.call(e);!(u=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);u=!0);}catch(e){l=!0,r=e}finally{try{u||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||q(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 F(e){return function(e){if(Array.isArray(e))return M(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||q(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function q(e,t){if(e){if("string"==typeof e)return M(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 M(e,t)}}function _(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(u,"next",{value:i(0)}),l(u,"throw",{value:i(1)}),l(u,"return",{value:i(2)}),"function"==typeof Symbol&&l(u,Symbol.iterator,{value:function(){return this}}),u;function i(l){return function(i){var c=[l,i];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var D=function(){var e=B((0,u.useState)([]),2),t=e[0],n=e[1],i=(0,m.k)(),c=(0,r.useFlowContext)(),s=o.App.useApp(),f=s.message,d=s.notification,v=s.modal,h=b().refreshAsync,y=(0,a.useRequest)(function(){return T(function(){var e;return _(this,function(t){switch(t.label){case 0:return[4,c.api.request({url:"".concat(p.C,":create"),method:"post"})];case 1:return[2,null==(e=t.sent().data)?void 0:e.data]}})})()},{manual:!0,throttleWait:1e3}),w=y.runAsync,g=y.loading,k=(0,a.useRequest)(function(e){return T(function(){var t,n;return _(this,function(r){switch(r.label){case 0:return[4,c.api.request({url:"".concat(p.C,":taskStatus"),method:"get",params:{names:e}})];case 1:return[2,null!=(t=null==(n=r.sent().data)?void 0:n.data)?t:{}]}})})()},{manual:!0}).runAsync;(0,u.useEffect)(function(){if(0!==t.length){var e=setInterval(function(){return T(function(){var e,r,a,o,u,l,c,s,p,b,m,v;return _(this,function(y){switch(y.label){case 0:return[4,k(t)];case 1:e=y.sent(),r=[],a=[],o=!0,u=!1,l=void 0;try{for(c=Object.entries(e)[Symbol.iterator]();!(o=(s=c.next()).done);o=!0)b=(p=B(s.value,2))[0],(m=p[1]).inProgress||(m.message?(a.push(b),d.error({message:m.message,role:"alert"})):r.push(b))}catch(e){u=!0,l=e}finally{try{o||null==c.return||c.return()}finally{if(u)throw l}}if(v=F(r).concat(F(a)),!(r.length>0))return[3,3];return f.success(i("NEW_BACKUPS_CREATED",{names:r.join(", ")})),[4,h()];case 2:y.sent(),y.label=3;case 3:return v.length>0&&n(function(e){return e.filter(function(e){return!v.includes(e)})}),[2]}})})()},3e3);return function(){clearInterval(e)}}},[t,f,d,k,h,i]);var E=g?P.LoadingOutlined:P.PlusOutlined;return l().createElement(o.Button,{icon:l().createElement(E,null),disabled:g,type:"primary",onClick:function(){return T(function(){return _(this,function(e){return v.confirm({title:i("New backup"),content:i("Are you sure you want to create new backup?"),onOk:function(){return T(function(){return _(this,function(e){switch(e.label){case 0:return[4,T(function(){var e;return _(this,function(t){switch(t.label){case 0:return[4,w()];case 1:return(null==(e=t.sent())?void 0:e.name)&&n(function(t){return F(t).concat([e.name])}),f.success(i("New backup operation started")),[4,h()];case 2:return t.sent(),[2]}})})()];case 1:return e.sent(),[2]}})})()}}),[2]})})()}},i("New backup"))},L=function(){var e=(0,m.k)(),t=b(),n=t.refresh,r=t.loading,a=r?P.LoadingOutlined:P.ReloadOutlined;return l().createElement(o.Button,{onClick:n,icon:l().createElement(a,null),disabled:r},e("Refresh"))};function U(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 G(e,t,n,r,a,o,u){try{var l=e[o](u),i=l.value}catch(e){n(e);return}l.done?t(i):Promise.resolve(i).then(r,a)}function N(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],u=!0,l=!1;try{for(a=a.call(e);!(u=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);u=!0);}catch(e){l=!0,r=e}finally{try{u||null==a.return||a.return()}finally{if(l)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return U(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 U(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.")}()}var H=function(){var e=(0,m.k)(),t=(0,r.useFlowContext)(),n=o.App.useApp().notification,a=N((0,u.useState)(!1),2),i=a[0],c=a[1],s=N((0,u.useState)(!1),2),f=s[0],p=s[1],d=N((0,u.useState)(""),2),b=d[0],v=d[1],h=N((0,u.useState)(""),2),g=h[0],E=h[1],C=N((0,u.useState)(null),2),S=C[0],x=C[1],A=N((0,u.useState)([]),2),O=A[0],j=A[1],I=k(),M=w().showCheckBackupMessage,R=y().database,T=R.schema,B=R.dialect,F=function(){v(""),x(null),j([]),E("")},q=function(){c(!1),F()};return l().createElement(l().Fragment,null,l().createElement(o.Button,{icon:l().createElement(P.UploadOutlined,null),onClick:function(){c(!0)}},e("Restore backup from local")),l().createElement(o.Modal,{title:e("Restore backup from local"),open:i,onCancel:q,footer:[l().createElement(o.Button,{key:"back",onClick:q},e("Cancel")),l().createElement(o.Button,{key:"submit",type:"primary",loading:f,onClick:function(){var r;return(r=function(){var r,a,o,u;return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(u,"next",{value:i(0)}),l(u,"throw",{value:i(1)}),l(u,"return",{value:i(2)}),"function"==typeof Symbol&&l(u,Symbol.iterator,{value:function(){return this}}),u;function i(l){return function(i){var c=[l,i];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(l){switch(l.label){case 0:if(!S)return n.error({message:e("Please select a backup file")}),[2];p(!0),(r=new FormData).append("file",S),r.append("password",b),r.append("dbSchema",g),l.label=1;case 1:return l.trys.push([1,3,,4]),[4,t.api.request({url:"backups:upload",method:"post",data:r})];case 2:return I.current=null!=(a=null==(u=l.sent().data)||null==(o=u.data)?void 0:o.task)?a:null,M(),[3,4];case 3:return console.error(l.sent()),[3,4];case 4:return p(!1),c(!1),F(),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,a){var o=r.apply(e,t);function u(e){G(o,n,a,u,l,"next",e)}function l(e){G(o,n,a,u,l,"throw",e)}u(void 0)})})()}},e("Submit"))]},l().createElement(o.Form,{layout:"vertical",autoComplete:"off"},l().createElement(o.Form.Item,null,l().createElement(o.Upload.Dragger,{onRemove:function(){j([]),x(null)},fileList:O,multiple:!1,maxCount:1,beforeUpload:function(e){return x(e),j([e]),!1}},l().createElement("p",{className:"ant-upload-drag-icon"},l().createElement(P.InboxOutlined,null)),l().createElement("p",{className:"ant-upload-text"},e("Click or drag file to this area to upload")))),["postgres","kingbase"].includes(B)&&l().createElement(o.Form.Item,{label:l().createElement("strong",null,e("Confirm the application database schema")),help:e("Required if application database schema is different with the backup",{currentDbSchemaTips:T?"[".concat(T,"]"):""})},l().createElement(o.Input,{autoComplete:"new-password",value:g,onChange:function(e){return E(e.target.value)}})),l().createElement(o.Form.Item,{colon:!0,label:l().createElement("strong",null,e("Restore password"))},l().createElement(o.Input.Password,{autoComplete:"new-password",value:b,onChange:function(e){return v(e.target.value)}})))))};function z(e,t,n,r,a,o,u){try{var l=e[o](u),i=l.value}catch(e){n(e);return}l.done?t(i):Promise.resolve(i).then(r,a)}var K={data:[]},Y=function(){var e=(0,r.useFlowContext)(),t=(0,a.useRequest)(function(){var t;return(t=function(){var t;return function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(u,"next",{value:i(0)}),l(u,"throw",{value:i(1)}),l(u,"return",{value:i(2)}),"function"==typeof Symbol&&l(u,Symbol.iterator,{value:function(){return this}}),u;function i(l){return function(i){var c=[l,i];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&c[0]?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(n){switch(n.label){case 0:return[4,e.api.request({url:"".concat(p.C,":list"),method:"get"})];case 1:return[2,null!=(t=n.sent().data)?t:K]}})},function(){var e=this,n=arguments;return new Promise(function(r,a){var o=t.apply(e,n);function u(e){z(o,r,a,u,l,"next",e)}function l(e){z(o,r,a,u,l,"throw",e)}u(void 0)})})()});return l().createElement(d.Provider,{value:t},l().createElement(o.Card,{bordered:!1},l().createElement(o.Space,{style:{float:"right",marginBottom:16}},l().createElement(L,null),l().createElement(H,null),l().createElement(D,null)),l().createElement(I,null)))}},488:function(e,t,n){"use strict";n.d(t,{k:function(){return o}});var r=n(694),a=n(401);function o(){var e=(0,r.useFlowEngine)();return function(t,n){return e.context.t(t,function(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;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({ns:[a.C,"client"]},n))}}}}]);