@nocobase/plugin-backups 2.1.6 → 2.1.7

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.
Files changed (35) hide show
  1. package/dist/client/components/RestoreFromBackup.d.ts +8 -0
  2. package/dist/client/components/RestoreFromLocal.d.ts +8 -0
  3. package/dist/client/index.js +1 -1
  4. package/dist/client-v2/567.5dc7a93062ea3649.js +10 -0
  5. package/dist/client-v2/index.js +1 -1
  6. package/dist/externalVersion.js +11 -11
  7. package/dist/locale/de-DE.json +1 -1
  8. package/dist/locale/en-US.json +1 -1
  9. package/dist/locale/es-ES.json +1 -1
  10. package/dist/locale/fr-FR.json +1 -1
  11. package/dist/locale/hu-HU.json +1 -1
  12. package/dist/locale/id-ID.json +1 -1
  13. package/dist/locale/it-IT.json +1 -1
  14. package/dist/locale/ja-JP.json +1 -1
  15. package/dist/locale/ko-KR.json +1 -1
  16. package/dist/locale/nl-NL.json +1 -1
  17. package/dist/locale/pt-BR.json +1 -1
  18. package/dist/locale/ru-RU.json +1 -1
  19. package/dist/locale/tr-TR.json +1 -1
  20. package/dist/locale/uk-UA.json +1 -1
  21. package/dist/locale/vi-VN.json +1 -1
  22. package/dist/locale/zh-CN.json +1 -1
  23. package/dist/locale/zh-TW.json +1 -1
  24. package/dist/node_modules/archiver/package.json +1 -1
  25. package/dist/node_modules/cron-parser/package.json +1 -1
  26. package/dist/node_modules/fs-extra/package.json +1 -1
  27. package/dist/node_modules/semver/package.json +1 -1
  28. package/dist/node_modules/yauzl/package.json +1 -1
  29. package/dist/server/adapters/database.d.ts +3 -0
  30. package/dist/server/adapters/database.js +112 -26
  31. package/dist/server/managers/backup.js +5 -1
  32. package/dist/server/managers/restore.js +25 -4
  33. package/dist/server/utils.js +2 -1
  34. package/package.json +2 -2
  35. package/dist/client-v2/567.d39a82a6aa6452a0.js +0 -10
@@ -36,7 +36,7 @@
36
36
  "New backup": "새 백업",
37
37
  "New backup operation started": "새 백업 작업이 시작되었습니다",
38
38
  "Not a valid backup file": "유효한 백업 파일이 아닙니다",
39
- "PG_DUMP_SERVER_VERSION_MISMATCH": "pg_dump 버전이 Postgres 서버 버전보다 낮습니다. 올바른 버전의 pg_dump를 설치해 주세요. 자세한 내용은 다음 참고 문서를 확인하세요: https://docs.nocobase.com/handbook/backups#installation",
39
+ "PG_DUMP_SERVER_VERSION_MISMATCH": "pg_dump 버전이 Postgres 서버 버전보다 낮습니다. 올바른 버전의 pg_dump를 설치해 주세요. 자세한 내용은 다음 참고 문서를 확인하세요: https://docs.nocobase.com/ops-management/backup-manager/",
40
40
  "Please select a backup file": "백업 파일을 선택하세요",
41
41
  "Required if application database schema is different with the backup": "애플리케이션 데이터베이스 스키마{{currentDbSchemaTips}}가 백업과 다를 경우 필요합니다",
42
42
  "Restore": "복원",
@@ -36,7 +36,7 @@
36
36
  "New backup": "New backup",
37
37
  "New backup operation started": "New backup operation started",
38
38
  "Not a valid backup file": "Not a valid backup file",
39
- "PG_DUMP_SERVER_VERSION_MISMATCH": "pg_dump version is lower than postgres server version. Please install the correct version of pg_dump. Check reference here: https://docs.nocobase.com/handbook/backups#installation",
39
+ "PG_DUMP_SERVER_VERSION_MISMATCH": "pg_dump version is lower than postgres server version. Please install the correct version of pg_dump. Check reference here: https://docs.nocobase.com/ops-management/backup-manager/",
40
40
  "Please select a backup file": "Please select a backup file",
41
41
  "Required if application database schema is different with the backup": "Required if application database schema{{currentDbSchemaTips}} is different with the backup",
42
42
  "Restore": "Restore",
@@ -36,7 +36,7 @@
36
36
  "New backup": "New backup",
37
37
  "New backup operation started": "New backup operation started",
38
38
  "Not a valid backup file": "Not a valid backup file",
39
- "PG_DUMP_SERVER_VERSION_MISMATCH": "pg_dump version is lower than postgres server version. Please install the correct version of pg_dump. Check reference here: https://docs.nocobase.com/handbook/backups#installation",
39
+ "PG_DUMP_SERVER_VERSION_MISMATCH": "pg_dump version is lower than postgres server version. Please install the correct version of pg_dump. Check reference here: https://docs.nocobase.com/ops-management/backup-manager/",
40
40
  "Please select a backup file": "Please select a backup file",
41
41
  "Required if application database schema is different with the backup": "Required if application database schema{{currentDbSchemaTips}} is different with the backup",
42
42
  "Restore": "Restore",
@@ -36,7 +36,7 @@
36
36
  "New backup": "Новая резервная копия",
37
37
  "New backup operation started": "Запущена операция создания новой резервной копии",
38
38
  "Not a valid backup file": "Недействительный файл резервной копии",
39
- "PG_DUMP_SERVER_VERSION_MISMATCH": "Версия pg_dump ниже версии сервера PostgreSQL. Установите правильную версию pg_dump. См. справку: https://docs.nocobase.com/handbook/backups#installation",
39
+ "PG_DUMP_SERVER_VERSION_MISMATCH": "Версия pg_dump ниже версии сервера PostgreSQL. Установите правильную версию pg_dump. См. справку: https://docs.nocobase.com/ops-management/backup-manager/",
40
40
  "Please select a backup file": "Пожалуйста, выберите файл резервной копии",
41
41
  "Required if application database schema is different with the backup": "Требуется, если схема базы данных приложения {{currentDbSchemaTips}} отличается от резервной копии",
42
42
  "Restore": "Восстановить",
@@ -36,7 +36,7 @@
36
36
  "New backup": "New backup",
37
37
  "New backup operation started": "New backup operation started",
38
38
  "Not a valid backup file": "Not a valid backup file",
39
- "PG_DUMP_SERVER_VERSION_MISMATCH": "pg_dump version is lower than postgres server version. Please install the correct version of pg_dump. Check reference here: https://docs.nocobase.com/handbook/backups#installation",
39
+ "PG_DUMP_SERVER_VERSION_MISMATCH": "pg_dump version is lower than postgres server version. Please install the correct version of pg_dump. Check reference here: https://docs.nocobase.com/ops-management/backup-manager/",
40
40
  "Please select a backup file": "Please select a backup file",
41
41
  "Required if application database schema is different with the backup": "Required if application database schema{{currentDbSchemaTips}} is different with the backup",
42
42
  "Restore": "Restore",
@@ -36,7 +36,7 @@
36
36
  "New backup": "New backup",
37
37
  "New backup operation started": "New backup operation started",
38
38
  "Not a valid backup file": "Not a valid backup file",
39
- "PG_DUMP_SERVER_VERSION_MISMATCH": "pg_dump version is lower than postgres server version. Please install the correct version of pg_dump. Check reference here: https://docs.nocobase.com/handbook/backups#installation",
39
+ "PG_DUMP_SERVER_VERSION_MISMATCH": "pg_dump version is lower than postgres server version. Please install the correct version of pg_dump. Check reference here: https://docs.nocobase.com/ops-management/backup-manager/",
40
40
  "Please select a backup file": "Please select a backup file",
41
41
  "Required if application database schema is different with the backup": "Required if application database schema{{currentDbSchemaTips}} is different with the backup",
42
42
  "Restore": "Restore",
@@ -36,7 +36,7 @@
36
36
  "New backup": "New backup",
37
37
  "New backup operation started": "New backup operation started",
38
38
  "Not a valid backup file": "Not a valid backup file",
39
- "PG_DUMP_SERVER_VERSION_MISMATCH": "pg_dump version is lower than postgres server version. Please install the correct version of pg_dump. Check reference here: https://docs.nocobase.com/handbook/backups#installation",
39
+ "PG_DUMP_SERVER_VERSION_MISMATCH": "pg_dump version is lower than postgres server version. Please install the correct version of pg_dump. Check reference here: https://docs.nocobase.com/ops-management/backup-manager/",
40
40
  "Please select a backup file": "Please select a backup file",
41
41
  "Required if application database schema is different with the backup": "Required if application database schema{{currentDbSchemaTips}} is different with the backup",
42
42
  "Restore": "Restore",
@@ -36,7 +36,7 @@
36
36
  "New backup": "新建备份",
37
37
  "New backup operation started": "新建备份操作已开始",
38
38
  "Not a valid backup file": "无效的备份文件",
39
- "PG_DUMP_SERVER_VERSION_MISMATCH": "pg_dump 版本低于 postgres 服务器版本,请安装正确版本的pg_dump。请参考: https://docs-cn.nocobase.com/handbook/backups#installation",
39
+ "PG_DUMP_SERVER_VERSION_MISMATCH": "pg_dump 版本低于 postgres 服务器版本,请安装正确版本的pg_dump。请参考: https://docs.nocobase.com/cn/ops-management/backup-manager/",
40
40
  "Please select a backup file": "请选择一个备份文件",
41
41
  "Required if application database schema is different with the backup": "仅应用数据库 Schema{{currentDbSchemaTips}} 与备份不一致时需要填写",
42
42
  "Restore": "还原",
@@ -36,7 +36,7 @@
36
36
  "New backup": "New backup",
37
37
  "New backup operation started": "New backup operation started",
38
38
  "Not a valid backup file": "Not a valid backup file",
39
- "PG_DUMP_SERVER_VERSION_MISMATCH": "pg_dump version is lower than postgres server version. Please install the correct version of pg_dump. Check reference here: https://docs.nocobase.com/handbook/backups#installation",
39
+ "PG_DUMP_SERVER_VERSION_MISMATCH": "pg_dump version is lower than postgres server version. Please install the correct version of pg_dump. Check reference here: https://docs.nocobase.com/ops-management/backup-manager/",
40
40
  "Please select a backup file": "Please select a backup file",
41
41
  "Required if application database schema is different with the backup": "Required if application database schema{{currentDbSchemaTips}} is different with the backup",
42
42
  "Restore": "Restore",
@@ -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-15T11:37:33.250Z"}
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-17T23:29:55.029Z"}
@@ -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-15T11:37:31.829Z"}
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-17T23:29:53.575Z"}
@@ -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-15T11:37:32.160Z"}
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-17T23:29:53.909Z"}
@@ -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-15T11:37:33.524Z"}
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-17T23:29:55.566Z"}
@@ -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-15T11:37:31.996Z"}
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-17T23:29:53.746Z"}
@@ -17,9 +17,12 @@ export type DBRestoreOptions = {
17
17
  filePath: string;
18
18
  schema?: string;
19
19
  skipDropAllTables?: boolean;
20
+ toolchain?: DBBackupToolchain;
20
21
  };
22
+ export type DBBackupToolchain = 'postgres' | 'kingbase';
21
23
  export interface DBAdapter {
22
24
  dbOpts: DatabaseOptions;
25
+ backupToolchain?: DBBackupToolchain;
23
26
  backup(options: DBBackupOptions): Promise<void>;
24
27
  restore(options: DBRestoreOptions): Promise<void>;
25
28
  check(op: 'backup' | 'restore'): Promise<void>;
@@ -93,10 +93,18 @@ class BaseDBAdapter {
93
93
  (0, import_child_process.execSync)(`${command} --version`);
94
94
  } catch (error) {
95
95
  throw new Error(
96
- `Command ${command} not found, please install it first. Check reference here: https://docs.nocobase.com/handbook/backups#installation`
96
+ `Command ${command} not found, please install it first. Check reference here: https://docs.nocobase.com/ops-management/backup-manager/`
97
97
  );
98
98
  }
99
99
  };
100
+ hasCommand(command) {
101
+ try {
102
+ (0, import_child_process.execSync)(`${command} --version`);
103
+ return true;
104
+ } catch (_error) {
105
+ return false;
106
+ }
107
+ }
100
108
  }
101
109
  class MySQLAdapter extends BaseDBAdapter {
102
110
  #backupCmd = "mysqldump";
@@ -327,24 +335,36 @@ class MySQLAdapter extends BaseDBAdapter {
327
335
  }
328
336
  }
329
337
  class PostgresAdapter extends BaseDBAdapter {
330
- get #backupCmd() {
338
+ get backupToolchain() {
339
+ return "postgres";
340
+ }
341
+ getBackupCommandName(_toolchain = this.backupToolchain) {
331
342
  return formatPathInEnv(process.env.PG_DUMP_PATH) || "pg_dump";
332
343
  }
333
- get #restoreCmd() {
344
+ getRestoreCommandName(_toolchain = this.backupToolchain) {
334
345
  return formatPathInEnv(process.env.PG_RESTORE_PATH) || "pg_restore";
335
346
  }
347
+ getSqlCommandName(_toolchain = this.backupToolchain) {
348
+ return formatPathInEnv(process.env.PSQL_PATH) || "psql";
349
+ }
350
+ getPasswordEnvVars(password, _toolchain = this.backupToolchain) {
351
+ return { PGPASSWORD: password };
352
+ }
353
+ getBackupSchema() {
354
+ return this.dbOpts.schema;
355
+ }
336
356
  async check(op) {
337
357
  switch (op) {
338
358
  case "backup":
339
- this.assertCommand(this.#backupCmd);
359
+ this.assertCommand(this.getBackupCommandName());
340
360
  break;
341
361
  case "restore":
342
- this.assertCommand(this.#restoreCmd);
362
+ this.assertCommand(this.getRestoreCommandName());
343
363
  break;
344
364
  }
345
365
  }
346
366
  async clientVersion(op) {
347
- const cmd = op === "backup" ? this.#backupCmd : this.#restoreCmd;
367
+ const cmd = op === "backup" ? this.getBackupCommandName() : this.getRestoreCommandName();
348
368
  try {
349
369
  return (0, import_child_process.execSync)(`${cmd} --version`).toString();
350
370
  } catch (_error) {
@@ -352,15 +372,21 @@ class PostgresAdapter extends BaseDBAdapter {
352
372
  }
353
373
  }
354
374
  async backup({ dir, includeTables, excludeTables }) {
355
- const { username, host, port, database, password, schema: backupSchema } = this.dbOpts;
375
+ const { username, host, port, database, password } = this.dbOpts;
356
376
  const filePath = `${dir}/data`;
377
+ const backupSchema = this.getBackupSchema();
357
378
  const schemaOption = backupSchema ? `--schema=${backupSchema}` : "";
358
379
  const includeOption = Array.isArray(includeTables) && includeTables.length ? includeTables.map((table) => `-t ${quotePgTablePattern(qualifyPgTablePattern(table, backupSchema))}`).join(" ") : "";
359
380
  const excludeOption = Array.isArray(excludeTables) && excludeTables.length ? excludeTables.map((table) => `-T ${quotePgTablePattern(qualifyPgTablePattern(table, backupSchema))}`).join(" ") : "";
360
- const command = `${this.#backupCmd} ${includeOption} ${excludeOption} -U ${username} -h ${host} ${port ? `-p ${port}` : ""} -F c -b --quote-all-identifiers ${schemaOption} -f ${filePath} ${database}`;
361
- await run(command, { PGPASSWORD: password });
381
+ const command = `${this.getBackupCommandName()} ${includeOption} ${excludeOption} -U ${username} -h ${host} ${port ? `-p ${port}` : ""} -F c -b --quote-all-identifiers ${schemaOption} -f ${filePath} ${database}`;
382
+ await run(command, this.getPasswordEnvVars(password));
362
383
  }
363
- async restore({ filePath, schema, skipDropAllTables = false }) {
384
+ async restore({
385
+ filePath,
386
+ schema,
387
+ skipDropAllTables = false,
388
+ toolchain = this.backupToolchain
389
+ }) {
364
390
  const { username, host, port, database, password } = this.dbOpts;
365
391
  let schemaOption = this.dbOpts.schema;
366
392
  if (schema && !schemaOption) {
@@ -377,7 +403,7 @@ class PostgresAdapter extends BaseDBAdapter {
377
403
  const schemaNameCondition = schemaOption ? `WHERE schemaname = '${schemaOption}'` : `WHERE schemaname NOT IN ('pg_catalog', 'information_schema')`;
378
404
  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')))`;
379
405
  if (!skipDropAllTables) {
380
- const dropDataCommand = `psql -U ${username} -h ${host} ${port ? `-p ${port}` : ""} -d ${database} -c "
406
+ const dropDataCommand = `${this.getSqlCommandName(toolchain)} -U ${username} -h ${host} ${port ? `-p ${port}` : ""} -d ${database} -c "
381
407
  DO ${D$$} DECLARE r RECORD;
382
408
  BEGIN
383
409
  FOR r IN (SELECT viewname,schemaname FROM pg_views ${schemaNameCondition}) LOOP
@@ -417,21 +443,26 @@ class PostgresAdapter extends BaseDBAdapter {
417
443
  END LOOP;
418
444
 
419
445
  END ${D$$};"`.replace(/\n/g, " ");
420
- await run(dropDataCommand, { PGPASSWORD: password });
446
+ await run(dropDataCommand, this.getPasswordEnvVars(password, toolchain));
421
447
  }
422
448
  if (schema === schemaOption || !schemaOption) {
423
- const pgRestoreCommand = `${this.#restoreCmd} -U ${username} -h ${host} ${port ? `-p ${port}` : ""} -d ${database} --clean --if-exists --no-owner -j ${j} ${filePath}`;
424
- await run(pgRestoreCommand, { PGPASSWORD: password });
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));
425
451
  } else {
426
452
  const srcSchema = schema || "public";
427
- const pgRestoreCommand = `${this.#restoreCmd} -U ${username} -h ${host} ${port ? `-p ${port}` : ""} -n ${srcSchema} -d ${database} --clean --if-exists --no-owner -j ${j} ${filePath}`;
428
- await this.#restoreSchema(srcSchema, schemaOption, pgRestoreCommand);
453
+ const pgRestoreCommand = this.buildSchemaRestoreCommand(srcSchema, schemaOption, filePath, j, toolchain);
454
+ await this.restoreSchema(srcSchema, schemaOption, pgRestoreCommand, toolchain);
429
455
  }
430
456
  }
431
- async #restoreSchema(srcSchema, targetSchema, pgRestoreCommand) {
457
+ buildSchemaRestoreCommand(srcSchema, _targetSchema, filePath, jobs, toolchain = this.backupToolchain) {
458
+ const { username, host, port, database } = this.dbOpts;
459
+ return `${this.getRestoreCommandName(toolchain)} -U ${username} -h ${host} ${port ? `-p ${port}` : ""} -n ${srcSchema} -d ${database} --clean --if-exists --no-owner -j ${jobs} ${filePath}`;
460
+ }
461
+ async restoreSchema(srcSchema, targetSchema, pgRestoreCommand, toolchain = this.backupToolchain) {
432
462
  const { username, host, port, database, password } = this.dbOpts;
433
463
  const ts = Date.now();
434
- const preCommand = `psql -U ${username} -h ${host} ${port ? `-p ${port}` : ""} -d ${database} -c "
464
+ const sqlCommandName = this.getSqlCommandName(toolchain);
465
+ const preCommand = `${sqlCommandName} -U ${username} -h ${host} ${port ? `-p ${port}` : ""} -d ${database} -c "
435
466
  DO ${D$$}
436
467
  BEGIN
437
468
  IF EXISTS (SELECT 1 FROM information_schema.schemata WHERE schema_name = '${srcSchema}') THEN
@@ -439,7 +470,7 @@ class PostgresAdapter extends BaseDBAdapter {
439
470
  END IF;
440
471
  EXECUTE 'CREATE SCHEMA ${srcSchema}';
441
472
  END ${D$$};"`.replace(/\n/g, " ");
442
- const postCommand = `psql -U ${username} -h ${host} ${port ? `-p ${port}` : ""} -d ${database} -c "
473
+ const postCommand = `${sqlCommandName} -U ${username} -h ${host} ${port ? `-p ${port}` : ""} -d ${database} -c "
443
474
  DO ${D$$}
444
475
  BEGIN
445
476
  EXECUTE 'DROP SCHEMA ${targetSchema} CASCADE';
@@ -448,21 +479,21 @@ class PostgresAdapter extends BaseDBAdapter {
448
479
  EXECUTE 'ALTER SCHEMA ${srcSchema}_${ts} RENAME TO ${srcSchema}';
449
480
  END IF;
450
481
  END ${D$$};"`.replace(/\n/g, " ");
451
- await run(preCommand, { PGPASSWORD: password });
482
+ await run(preCommand, this.getPasswordEnvVars(password, toolchain));
452
483
  try {
453
- await run(pgRestoreCommand, { PGPASSWORD: password });
484
+ await run(pgRestoreCommand, this.getPasswordEnvVars(password, toolchain));
454
485
  } finally {
455
- await run(postCommand, { PGPASSWORD: password });
486
+ await run(postCommand, this.getPasswordEnvVars(password, toolchain));
456
487
  }
457
- await this.#syncCollectionSchemaMetadata(srcSchema, targetSchema);
488
+ await this.syncCollectionSchemaMetadata(srcSchema, targetSchema, toolchain);
458
489
  }
459
- async #syncCollectionSchemaMetadata(srcSchema, targetSchema) {
490
+ async syncCollectionSchemaMetadata(srcSchema, targetSchema, toolchain = this.backupToolchain) {
460
491
  const { username, host, port, database, password, tablePrefix } = this.dbOpts;
461
492
  const collectionsTable = `${tablePrefix || ""}collections`;
462
493
  const targetSchemaLiteral = escapeStringLiteral(targetSchema);
463
494
  const srcSchemaLiteral = escapeStringLiteral(srcSchema);
464
495
  const collectionsTableLiteral = escapeStringLiteral(collectionsTable);
465
- const updateCollectionSchemaCommand = `psql -U ${username} -h ${host} ${port ? `-p ${port}` : ""} -d ${database} -c "
496
+ const updateCollectionSchemaCommand = `${this.getSqlCommandName(toolchain)} -U ${username} -h ${host} ${port ? `-p ${port}` : ""} -d ${database} -c "
466
497
  DO ${D$$}
467
498
  DECLARE
468
499
  collections_table text := '${collectionsTableLiteral}';
@@ -482,7 +513,61 @@ class PostgresAdapter extends BaseDBAdapter {
482
513
  );
483
514
  END IF;
484
515
  END ${D$$};"`.replace(/\n/g, " ");
485
- await run(updateCollectionSchemaCommand, { PGPASSWORD: password });
516
+ await run(updateCollectionSchemaCommand, this.getPasswordEnvVars(password, toolchain));
517
+ }
518
+ }
519
+ class KingbaseAdapter extends PostgresAdapter {
520
+ get backupToolchain() {
521
+ return this.hasKingbaseToolchain() ? "kingbase" : "postgres";
522
+ }
523
+ getKingbaseBackupCommandName() {
524
+ return formatPathInEnv(process.env.KINGBASE_DUMP_PATH) || "sys_dump";
525
+ }
526
+ getKingbaseRestoreCommandName() {
527
+ return formatPathInEnv(process.env.KINGBASE_RESTORE_PATH) || "sys_restore";
528
+ }
529
+ getKingbaseSqlCommandName() {
530
+ return formatPathInEnv(process.env.KINGBASE_PSQL_PATH) || "ksql";
531
+ }
532
+ hasKingbaseToolchain() {
533
+ return this.hasCommand(this.getKingbaseBackupCommandName()) && this.hasCommand(this.getKingbaseRestoreCommandName()) && this.hasCommand(this.getKingbaseSqlCommandName());
534
+ }
535
+ getBackupCommandName(toolchain = this.backupToolchain) {
536
+ return toolchain === "kingbase" ? this.getKingbaseBackupCommandName() : super.getBackupCommandName(toolchain);
537
+ }
538
+ getRestoreCommandName(toolchain = this.backupToolchain) {
539
+ return toolchain === "kingbase" ? this.getKingbaseRestoreCommandName() : super.getRestoreCommandName(toolchain);
540
+ }
541
+ getSqlCommandName(toolchain = this.backupToolchain) {
542
+ return toolchain === "kingbase" ? this.getKingbaseSqlCommandName() : super.getSqlCommandName(toolchain);
543
+ }
544
+ getPasswordEnvVars(password, toolchain = this.backupToolchain) {
545
+ if (toolchain === "postgres") {
546
+ return super.getPasswordEnvVars(password, toolchain);
547
+ }
548
+ return { KINGBASE_PASSWORD: password };
549
+ }
550
+ getBackupSchema() {
551
+ return this.dbOpts.schema || "public";
552
+ }
553
+ buildSchemaRestoreCommand(srcSchema, targetSchema, filePath, jobs, toolchain = this.backupToolchain) {
554
+ if (toolchain === "postgres") {
555
+ return super.buildSchemaRestoreCommand(srcSchema, targetSchema, filePath, jobs, toolchain);
556
+ }
557
+ const { username, host, port, database } = this.dbOpts;
558
+ return `${this.getRestoreCommandName(toolchain)} -U ${username} -h ${host} ${port ? `-p ${port}` : ""} -g ${srcSchema} -G ${targetSchema} -d ${database} --clean --if-exists --no-owner -j ${jobs} ${filePath}`;
559
+ }
560
+ async restoreSchema(srcSchema, targetSchema, restoreCommand, toolchain = this.backupToolchain) {
561
+ if (toolchain === "postgres") {
562
+ await super.restoreSchema(srcSchema, targetSchema, restoreCommand, toolchain);
563
+ return;
564
+ }
565
+ const { username, host, port, database, password } = this.dbOpts;
566
+ const targetSchemaIdentifier = quotePgIdentifier(targetSchema).replace(/"/g, '\\"');
567
+ const createSchemaCommand = `${this.getSqlCommandName(toolchain)} -U ${username} -h ${host} ${port ? `-p ${port}` : ""} -d ${database} -c "CREATE SCHEMA IF NOT EXISTS ${targetSchemaIdentifier};"`;
568
+ await run(createSchemaCommand, this.getPasswordEnvVars(password, toolchain));
569
+ await run(restoreCommand, this.getPasswordEnvVars(password, toolchain));
570
+ await this.syncCollectionSchemaMetadata(srcSchema, targetSchema, toolchain);
486
571
  }
487
572
  }
488
573
  class SQLiteAdapter extends BaseDBAdapter {
@@ -503,6 +588,7 @@ class MariaDBAdapter extends MySQLAdapter {
503
588
  const adapterMap = {
504
589
  mysql: MySQLAdapter,
505
590
  postgres: PostgresAdapter,
591
+ kingbase: KingbaseAdapter,
506
592
  sqlite: SQLiteAdapter,
507
593
  mariadb: MariaDBAdapter
508
594
  };
@@ -99,7 +99,10 @@ class BackupManager {
99
99
  }
100
100
  async backup(fileBaseName, opts) {
101
101
  const contentPath = import_path.default.join(this.#tempDir, fileBaseName);
102
- return this.#runBackupTask({ ...this.#settings, ...opts ?? {} }, fileBaseName, contentPath);
102
+ const runtimeTables = [...this.app.db.collections.values()].filter((collection) => collection.dataCategory === "runtime").map((collection) => collection.getTableNameWithSchemaAsString());
103
+ const backupOptions = { ...this.#settings, ...opts ?? {} };
104
+ backupOptions.excludeTables = [.../* @__PURE__ */ new Set([...backupOptions.excludeTables ?? [], ...runtimeTables])];
105
+ return this.#runBackupTask(backupOptions, fileBaseName, contentPath);
103
106
  }
104
107
  async destroy(fileName) {
105
108
  const filePath = this.#getValidatedFilePath(fileName);
@@ -194,6 +197,7 @@ class BackupManager {
194
197
  createdBy: opts.createdBy,
195
198
  database: {
196
199
  dialect,
200
+ toolchain: this.#dbAdapter.backupToolchain,
197
201
  underscored,
198
202
  tablePrefix,
199
203
  schema,
@@ -142,7 +142,8 @@ class RestoreManager {
142
142
  await this.#dbAdapter.restore({
143
143
  filePath: import_path.default.join(extractedDir, dbFile),
144
144
  schema: metadata.database.schema,
145
- skipDropAllTables: (options == null ? void 0 : options.skipDropAllTables) === true
145
+ skipDropAllTables: (options == null ? void 0 : options.skipDropAllTables) === true,
146
+ toolchain: this.#resolveRestoreToolchain(metadata)
146
147
  });
147
148
  this.ctx.logger.info("Database restored successfully", { module: import_utils2.BACKUPS });
148
149
  await this.#restoreFilesAndCleanup(restoreUploads, extractedDir);
@@ -195,7 +196,7 @@ class RestoreManager {
195
196
  await this.#restoreFilesAndCleanup(uploadsExist, extractedDir);
196
197
  await this.ctx.app.runCommand("upgrade");
197
198
  } else {
198
- if (!tolerentMode && this.#dbAdapter.dbOpts.dialect === "postgres") {
199
+ if (!tolerentMode && this.#isPostgresLikeDialect(this.#dbAdapter.dbOpts.dialect)) {
199
200
  const backupClientVersion = Number((0, import_utils2.toMajorVersion)(metadata.database.backupClientVersion));
200
201
  const dbServerVersion = Number((0, import_utils2.toMajorVersion)(dbVersion));
201
202
  if (backupClientVersion > 16 && dbServerVersion <= 16) {
@@ -248,7 +249,7 @@ class RestoreManager {
248
249
  if ((metadata.database.tablePrefix || "") !== (tablePrefix || "")) {
249
250
  throw new Error(this.#t("Database table prefix mismatch"));
250
251
  }
251
- const forceSchemaRestore = (options == null ? void 0 : options.forceSchemaRestore) === true && dialect === "postgres";
252
+ const forceSchemaRestore = (options == null ? void 0 : options.forceSchemaRestore) === true && this.#isPostgresLikeDialect(dialect);
252
253
  if (!forceSchemaRestore) {
253
254
  if (((_b = (_a = this.ctx.request) == null ? void 0 : _a.body) == null ? void 0 : _b.dbSchema) && ((_d = (_c = this.ctx.request) == null ? void 0 : _c.body) == null ? void 0 : _d.dbSchema) !== (schema || "public")) {
254
255
  throw new Error(this.#t("Database schema mismatch"));
@@ -289,6 +290,25 @@ class RestoreManager {
289
290
  }
290
291
  return true;
291
292
  }
293
+ #isPostgresLikeDialect(dialect) {
294
+ return dialect === "postgres" || dialect === "kingbase";
295
+ }
296
+ #resolveRestoreToolchain(metadata) {
297
+ if (metadata.database.dialect !== "kingbase") {
298
+ return void 0;
299
+ }
300
+ if (metadata.database.toolchain === "kingbase" || metadata.database.toolchain === "postgres") {
301
+ return metadata.database.toolchain;
302
+ }
303
+ const backupClientVersion = metadata.database.backupClientVersion || "";
304
+ if (/sys_dump/i.test(backupClientVersion)) {
305
+ return "kingbase";
306
+ }
307
+ if (/pg_dump|postgresql/i.test(backupClientVersion)) {
308
+ return "postgres";
309
+ }
310
+ return this.#dbAdapter.backupToolchain;
311
+ }
292
312
  async #decompressFiles(filePath, password) {
293
313
  const fileBaseName = import_path.default.basename(filePath, `.${import_utils2.BACKUP_EXTENSION}`);
294
314
  const outputDir = import_path.default.join(this.#tempDir, fileBaseName);
@@ -372,7 +392,8 @@ class RestoreManager {
372
392
  await this.#dbAdapter.restore({
373
393
  filePath: import_path.default.join(extractedDir, dbFile),
374
394
  schema: metadata.database.schema,
375
- skipDropAllTables: (options == null ? void 0 : options.skipDropAllTables) === true
395
+ skipDropAllTables: (options == null ? void 0 : options.skipDropAllTables) === true,
396
+ toolchain: this.#resolveRestoreToolchain(metadata)
376
397
  });
377
398
  this.ctx.logger.info("Database restored successfully", { module: import_utils2.BACKUPS });
378
399
  if (restoreUploads) {
@@ -210,7 +210,8 @@ const dbVersionCommands = {
210
210
  sqlite: "select sqlite_version() as version",
211
211
  mysql: "select version() as version",
212
212
  mariadb: "select version() as version",
213
- postgres: "select version() as version"
213
+ postgres: "select version() as version",
214
+ kingbase: "select version() as version"
214
215
  };
215
216
  async function getDBVersion(db) {
216
217
  var _a;
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.1.6",
7
+ "version": "2.1.7",
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": "4312d6580cc01378d008072db8285803626dc435"
53
+ "gitHead": "fc3bc8bf6ef0c185a456cb5241abc4716af8c20c"
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"===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"===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))}}}}]);