@nocobase/plugin-backups 2.0.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +99 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/components/BackupSettings.d.ts +2 -0
- package/dist/client/components/BackupsManagement.d.ts +2 -0
- package/dist/client/components/BackupsTable.d.ts +16 -0
- package/dist/client/components/NewBackup.d.ts +10 -0
- package/dist/client/components/RefreshBackups.d.ts +10 -0
- package/dist/client/components/RestoreFromBackup.d.ts +5 -0
- package/dist/client/components/RestoreFromLocal.d.ts +2 -0
- package/dist/client/constants.d.ts +1 -0
- package/dist/client/contexts.d.ts +17 -0
- package/dist/client/hooks/useBackupAppInfo.d.ts +8 -0
- package/dist/client/hooks/useCheckBackupMessage.d.ts +4 -0
- package/dist/client/hooks/useRestoreTask.d.ts +2 -0
- package/dist/client/index.d.ts +7 -0
- package/dist/client/index.js +10 -0
- package/dist/client/locale.d.ts +10 -0
- package/dist/externalVersion.js +32 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +48 -0
- package/dist/locale/de-DE.json +52 -0
- package/dist/locale/en-US.json +52 -0
- package/dist/locale/es-ES.json +52 -0
- package/dist/locale/fr-FR.json +52 -0
- package/dist/locale/hu-HU.json +52 -0
- package/dist/locale/id-ID.json +52 -0
- package/dist/locale/it-IT.json +52 -0
- package/dist/locale/ja-JP.json +52 -0
- package/dist/locale/ko-KR.json +52 -0
- package/dist/locale/nl-NL.json +52 -0
- package/dist/locale/pt-BR.json +52 -0
- package/dist/locale/ru-RU.json +52 -0
- package/dist/locale/tr-TR.json +52 -0
- package/dist/locale/uk-UA.json +52 -0
- package/dist/locale/vi-VN.json +52 -0
- package/dist/locale/zh-CN.json +52 -0
- package/dist/locale/zh-TW.json +52 -0
- package/dist/node_modules/archiver/LICENSE +22 -0
- package/dist/node_modules/archiver/index.js +68 -0
- package/dist/node_modules/archiver/lib/core.js +974 -0
- package/dist/node_modules/archiver/lib/error.js +40 -0
- package/dist/node_modules/archiver/lib/plugins/json.js +110 -0
- package/dist/node_modules/archiver/lib/plugins/tar.js +167 -0
- package/dist/node_modules/archiver/lib/plugins/zip.js +120 -0
- package/dist/node_modules/archiver/node_modules/async/all.js +119 -0
- package/dist/node_modules/archiver/node_modules/async/allLimit.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/allSeries.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/any.js +122 -0
- package/dist/node_modules/archiver/node_modules/async/anyLimit.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/anySeries.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/apply.js +11 -0
- package/dist/node_modules/archiver/node_modules/async/applyEach.js +57 -0
- package/dist/node_modules/archiver/node_modules/async/applyEachSeries.js +37 -0
- package/dist/node_modules/archiver/node_modules/async/asyncify.js +118 -0
- package/dist/node_modules/archiver/node_modules/async/auto.js +333 -0
- package/dist/node_modules/archiver/node_modules/async/autoInject.js +182 -0
- package/dist/node_modules/archiver/node_modules/async/bower.json +17 -0
- package/dist/node_modules/archiver/node_modules/async/cargo.js +63 -0
- package/dist/node_modules/archiver/node_modules/async/cargoQueue.js +71 -0
- package/dist/node_modules/archiver/node_modules/async/compose.js +55 -0
- package/dist/node_modules/archiver/node_modules/async/concat.js +115 -0
- package/dist/node_modules/archiver/node_modules/async/concatLimit.js +60 -0
- package/dist/node_modules/archiver/node_modules/async/concatSeries.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/constant.js +14 -0
- package/dist/node_modules/archiver/node_modules/async/detect.js +96 -0
- package/dist/node_modules/archiver/node_modules/async/detectLimit.js +48 -0
- package/dist/node_modules/archiver/node_modules/async/detectSeries.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/dir.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/dist/async.js +6062 -0
- package/dist/node_modules/archiver/node_modules/async/dist/async.min.js +1 -0
- package/dist/node_modules/archiver/node_modules/async/doDuring.js +68 -0
- package/dist/node_modules/archiver/node_modules/async/doUntil.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/doWhilst.js +68 -0
- package/dist/node_modules/archiver/node_modules/async/during.js +78 -0
- package/dist/node_modules/archiver/node_modules/async/each.js +129 -0
- package/dist/node_modules/archiver/node_modules/async/eachLimit.js +50 -0
- package/dist/node_modules/archiver/node_modules/async/eachOf.js +185 -0
- package/dist/node_modules/archiver/node_modules/async/eachOfLimit.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/eachOfSeries.js +39 -0
- package/dist/node_modules/archiver/node_modules/async/eachSeries.js +44 -0
- package/dist/node_modules/archiver/node_modules/async/ensureAsync.js +67 -0
- package/dist/node_modules/archiver/node_modules/async/every.js +119 -0
- package/dist/node_modules/archiver/node_modules/async/everyLimit.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/everySeries.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/filter.js +93 -0
- package/dist/node_modules/archiver/node_modules/async/filterLimit.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/filterSeries.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/find.js +96 -0
- package/dist/node_modules/archiver/node_modules/async/findLimit.js +48 -0
- package/dist/node_modules/archiver/node_modules/async/findSeries.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/flatMap.js +115 -0
- package/dist/node_modules/archiver/node_modules/async/flatMapLimit.js +60 -0
- package/dist/node_modules/archiver/node_modules/async/flatMapSeries.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/foldl.js +153 -0
- package/dist/node_modules/archiver/node_modules/async/foldr.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/forEach.js +129 -0
- package/dist/node_modules/archiver/node_modules/async/forEachLimit.js +50 -0
- package/dist/node_modules/archiver/node_modules/async/forEachOf.js +185 -0
- package/dist/node_modules/archiver/node_modules/async/forEachOfLimit.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/forEachOfSeries.js +39 -0
- package/dist/node_modules/archiver/node_modules/async/forEachSeries.js +44 -0
- package/dist/node_modules/archiver/node_modules/async/forever.js +68 -0
- package/dist/node_modules/archiver/node_modules/async/groupBy.js +108 -0
- package/dist/node_modules/archiver/node_modules/async/groupByLimit.js +71 -0
- package/dist/node_modules/archiver/node_modules/async/groupBySeries.js +36 -0
- package/dist/node_modules/archiver/node_modules/async/index.js +588 -0
- package/dist/node_modules/archiver/node_modules/async/inject.js +153 -0
- package/dist/node_modules/archiver/node_modules/async/internal/DoublyLinkedList.js +92 -0
- package/dist/node_modules/archiver/node_modules/async/internal/Heap.js +120 -0
- package/dist/node_modules/archiver/node_modules/async/internal/applyEach.js +29 -0
- package/dist/node_modules/archiver/node_modules/async/internal/asyncEachOfLimit.js +75 -0
- package/dist/node_modules/archiver/node_modules/async/internal/awaitify.js +28 -0
- package/dist/node_modules/archiver/node_modules/async/internal/breakLoop.js +10 -0
- package/dist/node_modules/archiver/node_modules/async/internal/consoleFunc.js +31 -0
- package/dist/node_modules/archiver/node_modules/async/internal/createTester.js +40 -0
- package/dist/node_modules/archiver/node_modules/async/internal/eachOfLimit.js +90 -0
- package/dist/node_modules/archiver/node_modules/async/internal/filter.js +55 -0
- package/dist/node_modules/archiver/node_modules/async/internal/getIterator.js +11 -0
- package/dist/node_modules/archiver/node_modules/async/internal/initialParams.js +14 -0
- package/dist/node_modules/archiver/node_modules/async/internal/isArrayLike.js +10 -0
- package/dist/node_modules/archiver/node_modules/async/internal/iterator.js +57 -0
- package/dist/node_modules/archiver/node_modules/async/internal/map.js +30 -0
- package/dist/node_modules/archiver/node_modules/async/internal/once.js +17 -0
- package/dist/node_modules/archiver/node_modules/async/internal/onlyOnce.js +15 -0
- package/dist/node_modules/archiver/node_modules/async/internal/parallel.js +34 -0
- package/dist/node_modules/archiver/node_modules/async/internal/promiseCallback.js +23 -0
- package/dist/node_modules/archiver/node_modules/async/internal/queue.js +294 -0
- package/dist/node_modules/archiver/node_modules/async/internal/range.js +14 -0
- package/dist/node_modules/archiver/node_modules/async/internal/reject.js +26 -0
- package/dist/node_modules/archiver/node_modules/async/internal/setImmediate.js +34 -0
- package/dist/node_modules/archiver/node_modules/async/internal/withoutIndex.js +10 -0
- package/dist/node_modules/archiver/node_modules/async/internal/wrapAsync.js +34 -0
- package/dist/node_modules/archiver/node_modules/async/log.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/map.js +142 -0
- package/dist/node_modules/archiver/node_modules/async/mapLimit.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/mapSeries.js +44 -0
- package/dist/node_modules/archiver/node_modules/async/mapValues.js +152 -0
- package/dist/node_modules/archiver/node_modules/async/mapValuesLimit.js +61 -0
- package/dist/node_modules/archiver/node_modules/async/mapValuesSeries.js +37 -0
- package/dist/node_modules/archiver/node_modules/async/memoize.js +91 -0
- package/dist/node_modules/archiver/node_modules/async/nextTick.js +52 -0
- package/dist/node_modules/archiver/node_modules/async/package.json +75 -0
- package/dist/node_modules/archiver/node_modules/async/parallel.js +180 -0
- package/dist/node_modules/archiver/node_modules/async/parallelLimit.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/priorityQueue.js +60 -0
- package/dist/node_modules/archiver/node_modules/async/queue.js +24 -0
- package/dist/node_modules/archiver/node_modules/async/race.js +67 -0
- package/dist/node_modules/archiver/node_modules/async/reduce.js +153 -0
- package/dist/node_modules/archiver/node_modules/async/reduceRight.js +41 -0
- package/dist/node_modules/archiver/node_modules/async/reflect.js +78 -0
- package/dist/node_modules/archiver/node_modules/async/reflectAll.js +93 -0
- package/dist/node_modules/archiver/node_modules/async/reject.js +87 -0
- package/dist/node_modules/archiver/node_modules/async/rejectLimit.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/rejectSeries.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/retry.js +159 -0
- package/dist/node_modules/archiver/node_modules/async/retryable.js +77 -0
- package/dist/node_modules/archiver/node_modules/async/select.js +93 -0
- package/dist/node_modules/archiver/node_modules/async/selectLimit.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/selectSeries.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/seq.js +79 -0
- package/dist/node_modules/archiver/node_modules/async/series.js +186 -0
- package/dist/node_modules/archiver/node_modules/async/setImmediate.js +45 -0
- package/dist/node_modules/archiver/node_modules/async/some.js +122 -0
- package/dist/node_modules/archiver/node_modules/async/someLimit.js +47 -0
- package/dist/node_modules/archiver/node_modules/async/someSeries.js +46 -0
- package/dist/node_modules/archiver/node_modules/async/sortBy.js +190 -0
- package/dist/node_modules/archiver/node_modules/async/timeout.js +89 -0
- package/dist/node_modules/archiver/node_modules/async/times.js +50 -0
- package/dist/node_modules/archiver/node_modules/async/timesLimit.js +43 -0
- package/dist/node_modules/archiver/node_modules/async/timesSeries.js +32 -0
- package/dist/node_modules/archiver/node_modules/async/transform.js +173 -0
- package/dist/node_modules/archiver/node_modules/async/tryEach.js +78 -0
- package/dist/node_modules/archiver/node_modules/async/unmemoize.js +25 -0
- package/dist/node_modules/archiver/node_modules/async/until.js +61 -0
- package/dist/node_modules/archiver/node_modules/async/waterfall.js +105 -0
- package/dist/node_modules/archiver/node_modules/async/whilst.js +78 -0
- package/dist/node_modules/archiver/node_modules/async/wrapSync.js +118 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/errors-browser.js +127 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/errors.js +116 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/experimentalWarning.js +17 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/_stream_duplex.js +126 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/_stream_passthrough.js +37 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/_stream_readable.js +1027 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/_stream_transform.js +190 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/_stream_writable.js +641 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/async_iterator.js +180 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/buffer_list.js +183 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/destroy.js +96 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +86 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/from-browser.js +3 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/from.js +52 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/pipeline.js +86 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/state.js +22 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/stream-browser.js +1 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/lib/internal/streams/stream.js +1 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/package.json +68 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/readable-browser.js +9 -0
- package/dist/node_modules/archiver/node_modules/readable-stream/readable.js +16 -0
- package/dist/node_modules/archiver/node_modules/tar-stream/extract.js +257 -0
- package/dist/node_modules/archiver/node_modules/tar-stream/headers.js +295 -0
- package/dist/node_modules/archiver/node_modules/tar-stream/index.js +2 -0
- package/dist/node_modules/archiver/node_modules/tar-stream/pack.js +255 -0
- package/dist/node_modules/archiver/node_modules/tar-stream/package.json +58 -0
- package/dist/node_modules/archiver/node_modules/tar-stream/sandbox.js +11 -0
- package/dist/node_modules/archiver/package.json +1 -0
- package/dist/node_modules/cron-parser/.eslintrc.json +15 -0
- package/dist/node_modules/cron-parser/.travis.yml +7 -0
- package/dist/node_modules/cron-parser/LICENSE +21 -0
- package/dist/node_modules/cron-parser/component.json +11 -0
- package/dist/node_modules/cron-parser/index.d.ts +1 -0
- package/dist/node_modules/cron-parser/lib/date.js +252 -0
- package/dist/node_modules/cron-parser/lib/expression.js +983 -0
- package/dist/node_modules/cron-parser/lib/field_compactor.js +70 -0
- package/dist/node_modules/cron-parser/lib/field_stringify.js +38 -0
- package/dist/node_modules/cron-parser/lib/parser.js +1 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/build/amd/luxon.js +8489 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/build/cjs-browser/luxon.js +8487 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/build/global/luxon.js +8490 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/build/global/luxon.min.js +1 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/build/node/luxon.js +7522 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/package.json +96 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/datetime.js +2169 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/duration.js +880 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/errors.js +61 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/conversions.js +157 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/diff.js +80 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/digits.js +76 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/english.js +233 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/formats.js +191 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/formatter.js +386 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/invalid.js +14 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/locale.js +482 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/regexParser.js +335 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/tokenParser.js +424 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/util.js +292 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/zoneUtil.js +36 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/info.js +193 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/interval.js +602 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/luxon.js +26 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/luxonFilled.js +13 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/settings.js +137 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/zone.js +88 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/zones/IANAZone.js +191 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/zones/fixedOffsetZone.js +94 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/zones/invalidZone.js +53 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/zones/localZone.js +63 -0
- package/dist/node_modules/cron-parser/package.json +1 -0
- package/dist/node_modules/cron-parser/test/31_of_month.js +17 -0
- package/dist/node_modules/cron-parser/test/bug.js +29 -0
- package/dist/node_modules/cron-parser/test/crondate.js +16 -0
- package/dist/node_modules/cron-parser/test/crontab.example +7 -0
- package/dist/node_modules/cron-parser/test/empty_around_comma.js +22 -0
- package/dist/node_modules/cron-parser/test/expression.js +1489 -0
- package/dist/node_modules/cron-parser/test/field_compactor.js +250 -0
- package/dist/node_modules/cron-parser/test/field_stringify.js +84 -0
- package/dist/node_modules/cron-parser/test/fields.js +32 -0
- package/dist/node_modules/cron-parser/test/increment_on_first_iteration.js +22 -0
- package/dist/node_modules/cron-parser/test/index-ts3.test-d.ts +133 -0
- package/dist/node_modules/cron-parser/test/index.test-d.ts +138 -0
- package/dist/node_modules/cron-parser/test/leap_year.js +17 -0
- package/dist/node_modules/cron-parser/test/parser.js +46 -0
- package/dist/node_modules/cron-parser/test/parser_crondate_formats.js +145 -0
- package/dist/node_modules/cron-parser/test/parser_day_of_month.js +169 -0
- package/dist/node_modules/cron-parser/test/prev_date.js +32 -0
- package/dist/node_modules/cron-parser/test/stringify.js +402 -0
- package/dist/node_modules/cron-parser/test/timezone.js +422 -0
- package/dist/node_modules/cron-parser/types/common.d.ts +131 -0
- package/dist/node_modules/cron-parser/types/index.d.ts +45 -0
- package/dist/node_modules/cron-parser/types/ts3/index.d.ts +28 -0
- package/dist/node_modules/fs-extra/LICENSE +15 -0
- package/dist/node_modules/fs-extra/lib/copy/copy.js +232 -0
- package/dist/node_modules/fs-extra/lib/copy/index.js +6 -0
- package/dist/node_modules/fs-extra/lib/copy-sync/copy-sync.js +166 -0
- package/dist/node_modules/fs-extra/lib/copy-sync/index.js +5 -0
- package/dist/node_modules/fs-extra/lib/empty/index.js +48 -0
- package/dist/node_modules/fs-extra/lib/ensure/file.js +69 -0
- package/dist/node_modules/fs-extra/lib/ensure/index.js +23 -0
- package/dist/node_modules/fs-extra/lib/ensure/link.js +61 -0
- package/dist/node_modules/fs-extra/lib/ensure/symlink-paths.js +99 -0
- package/dist/node_modules/fs-extra/lib/ensure/symlink-type.js +31 -0
- package/dist/node_modules/fs-extra/lib/ensure/symlink.js +63 -0
- package/dist/node_modules/fs-extra/lib/fs/index.js +130 -0
- package/dist/node_modules/fs-extra/lib/index.js +1 -0
- package/dist/node_modules/fs-extra/lib/json/index.js +16 -0
- package/dist/node_modules/fs-extra/lib/json/jsonfile.js +11 -0
- package/dist/node_modules/fs-extra/lib/json/output-json-sync.js +12 -0
- package/dist/node_modules/fs-extra/lib/json/output-json.js +12 -0
- package/dist/node_modules/fs-extra/lib/mkdirs/index.js +14 -0
- package/dist/node_modules/fs-extra/lib/mkdirs/make-dir.js +141 -0
- package/dist/node_modules/fs-extra/lib/move/index.js +6 -0
- package/dist/node_modules/fs-extra/lib/move/move.js +65 -0
- package/dist/node_modules/fs-extra/lib/move-sync/index.js +5 -0
- package/dist/node_modules/fs-extra/lib/move-sync/move-sync.js +47 -0
- package/dist/node_modules/fs-extra/lib/output/index.js +40 -0
- package/dist/node_modules/fs-extra/lib/path-exists/index.js +12 -0
- package/dist/node_modules/fs-extra/lib/remove/index.js +9 -0
- package/dist/node_modules/fs-extra/lib/remove/rimraf.js +302 -0
- package/dist/node_modules/fs-extra/lib/util/stat.js +139 -0
- package/dist/node_modules/fs-extra/lib/util/utimes.js +26 -0
- package/dist/node_modules/fs-extra/package.json +1 -0
- package/dist/node_modules/semver/LICENSE +15 -0
- package/dist/node_modules/semver/bin/semver.js +197 -0
- package/dist/node_modules/semver/classes/comparator.js +141 -0
- package/dist/node_modules/semver/classes/index.js +5 -0
- package/dist/node_modules/semver/classes/range.js +539 -0
- package/dist/node_modules/semver/classes/semver.js +302 -0
- package/dist/node_modules/semver/functions/clean.js +6 -0
- package/dist/node_modules/semver/functions/cmp.js +52 -0
- package/dist/node_modules/semver/functions/coerce.js +60 -0
- package/dist/node_modules/semver/functions/compare-build.js +7 -0
- package/dist/node_modules/semver/functions/compare-loose.js +3 -0
- package/dist/node_modules/semver/functions/compare.js +5 -0
- package/dist/node_modules/semver/functions/diff.js +65 -0
- package/dist/node_modules/semver/functions/eq.js +3 -0
- package/dist/node_modules/semver/functions/gt.js +3 -0
- package/dist/node_modules/semver/functions/gte.js +3 -0
- package/dist/node_modules/semver/functions/inc.js +19 -0
- package/dist/node_modules/semver/functions/lt.js +3 -0
- package/dist/node_modules/semver/functions/lte.js +3 -0
- package/dist/node_modules/semver/functions/major.js +3 -0
- package/dist/node_modules/semver/functions/minor.js +3 -0
- package/dist/node_modules/semver/functions/neq.js +3 -0
- package/dist/node_modules/semver/functions/parse.js +16 -0
- package/dist/node_modules/semver/functions/patch.js +3 -0
- package/dist/node_modules/semver/functions/prerelease.js +6 -0
- package/dist/node_modules/semver/functions/rcompare.js +3 -0
- package/dist/node_modules/semver/functions/rsort.js +3 -0
- package/dist/node_modules/semver/functions/satisfies.js +10 -0
- package/dist/node_modules/semver/functions/sort.js +3 -0
- package/dist/node_modules/semver/functions/valid.js +6 -0
- package/dist/node_modules/semver/index.js +1 -0
- package/dist/node_modules/semver/internal/constants.js +35 -0
- package/dist/node_modules/semver/internal/debug.js +9 -0
- package/dist/node_modules/semver/internal/identifiers.js +23 -0
- package/dist/node_modules/semver/internal/parse-options.js +15 -0
- package/dist/node_modules/semver/internal/re.js +217 -0
- package/dist/node_modules/semver/package.json +1 -0
- package/dist/node_modules/semver/preload.js +2 -0
- package/dist/node_modules/semver/range.bnf +16 -0
- package/dist/node_modules/semver/ranges/gtr.js +4 -0
- package/dist/node_modules/semver/ranges/intersects.js +7 -0
- package/dist/node_modules/semver/ranges/ltr.js +4 -0
- package/dist/node_modules/semver/ranges/max-satisfying.js +25 -0
- package/dist/node_modules/semver/ranges/min-satisfying.js +24 -0
- package/dist/node_modules/semver/ranges/min-version.js +61 -0
- package/dist/node_modules/semver/ranges/outside.js +80 -0
- package/dist/node_modules/semver/ranges/simplify.js +47 -0
- package/dist/node_modules/semver/ranges/subset.js +247 -0
- package/dist/node_modules/semver/ranges/to-comparators.js +8 -0
- package/dist/node_modules/semver/ranges/valid.js +11 -0
- package/dist/node_modules/yauzl/LICENSE +21 -0
- package/dist/node_modules/yauzl/fd-slicer.js +314 -0
- package/dist/node_modules/yauzl/index.js +1 -0
- package/dist/node_modules/yauzl/package.json +1 -0
- package/dist/server/adapters/database.d.ts +9 -0
- package/dist/server/adapters/database.js +486 -0
- package/dist/server/collections/backup-settings.d.ts +2 -0
- package/dist/server/collections/backup-settings.js +67 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +42 -0
- package/dist/server/managers/backup.d.ts +41 -0
- package/dist/server/managers/backup.js +448 -0
- package/dist/server/managers/restore.d.ts +24 -0
- package/dist/server/managers/restore.js +434 -0
- package/dist/server/plugin.d.ts +26 -0
- package/dist/server/plugin.js +251 -0
- package/dist/server/resourcers/backup-cli.d.ts +23 -0
- package/dist/server/resourcers/backup-cli.js +237 -0
- package/dist/server/resourcers/backups.d.ts +24 -0
- package/dist/server/resourcers/backups.js +192 -0
- package/dist/server/types.d.ts +12 -0
- package/dist/server/types.js +24 -0
- package/dist/server/utils.d.ts +48 -0
- package/dist/server/utils.js +323 -0
- package/dist/swagger/index.json +313 -0
- package/package.json +51 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(){var e={794:function(e,r,t){var n=t(300).Buffer;var i=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];if(typeof Int32Array!=="undefined"){i=new Int32Array(i)}function ensureBuffer(e){if(n.isBuffer(e)){return e}var r=typeof n.alloc==="function"&&typeof n.from==="function";if(typeof e==="number"){return r?n.alloc(e):new n(e)}else if(typeof e==="string"){return r?n.from(e):new n(e)}else{throw new Error("input must be buffer, number, or string, received "+typeof e)}}function bufferizeInt(e){var r=ensureBuffer(4);r.writeInt32BE(e,0);return r}function _crc32(e,r){e=ensureBuffer(e);if(n.isBuffer(r)){r=r.readUInt32BE(0)}var t=~~r^-1;for(var o=0;o<e.length;o++){t=i[(t^e[o])&255]^t>>>8}return t^-1}function crc32(){return bufferizeInt(_crc32.apply(null,arguments))}crc32.signed=function(){return _crc32.apply(null,arguments)};crc32.unsigned=function(){return _crc32.apply(null,arguments)>>>0};e.exports=crc32},833:function(e){e.exports=Pend;function Pend(){this.pending=0;this.max=Infinity;this.listeners=[];this.waiting=[];this.error=null}Pend.prototype.go=function(e){if(this.pending<this.max){pendGo(this,e)}else{this.waiting.push(e)}};Pend.prototype.wait=function(e){if(this.pending===0){e(this.error)}else{this.listeners.push(e)}};Pend.prototype.hold=function(){return pendHold(this)};function pendHold(e){e.pending+=1;var r=false;return onCb;function onCb(t){if(r)throw new Error("callback called twice");r=true;e.error=e.error||t;e.pending-=1;if(e.waiting.length>0&&e.pending<e.max){pendGo(e,e.waiting.shift())}else if(e.pending===0){var n=e.listeners;e.listeners=[];n.forEach(cbListener)}}function cbListener(r){r(e.error)}}function pendGo(e,r){r(pendHold(e))}},434:function(e,r,t){var n=t(147);var i=t(837);var o=t(781);var a=o.Readable;var s=o.Writable;var f=o.PassThrough;var l=t(833);var u=t(361).EventEmitter;r.createFromBuffer=createFromBuffer;r.createFromFd=createFromFd;r.BufferSlicer=BufferSlicer;r.FdSlicer=FdSlicer;i.inherits(FdSlicer,u);function FdSlicer(e,r){r=r||{};u.call(this);this.fd=e;this.pend=new l;this.pend.max=1;this.refCount=0;this.autoClose=!!r.autoClose}FdSlicer.prototype.read=function(e,r,t,i,o){var a=this;a.pend.go((function(s){n.read(a.fd,e,r,t,i,(function(e,r,t){s();o(e,r,t)}))}))};FdSlicer.prototype.write=function(e,r,t,i,o){var a=this;a.pend.go((function(s){n.write(a.fd,e,r,t,i,(function(e,r,t){s();o(e,r,t)}))}))};FdSlicer.prototype.createReadStream=function(e){return new ReadStream(this,e)};FdSlicer.prototype.createWriteStream=function(e){return new WriteStream(this,e)};FdSlicer.prototype.ref=function(){this.refCount+=1};FdSlicer.prototype.unref=function(){var e=this;e.refCount-=1;if(e.refCount>0)return;if(e.refCount<0)throw new Error("invalid unref");if(e.autoClose){n.close(e.fd,onCloseDone)}function onCloseDone(r){if(r){e.emit("error",r)}else{e.emit("close")}}};i.inherits(ReadStream,a);function ReadStream(e,r){r=r||{};a.call(this,r);this.context=e;this.context.ref();this.start=r.start||0;this.endOffset=r.end;this.pos=this.start;this.destroyed=false}ReadStream.prototype._read=function(e){var r=this;if(r.destroyed)return;var t=Math.min(r._readableState.highWaterMark,e);if(r.endOffset!=null){t=Math.min(t,r.endOffset-r.pos)}if(t<=0){r.destroyed=true;r.push(null);r.context.unref();return}r.context.pend.go((function(e){if(r.destroyed)return e();var i=Buffer.allocUnsafe(t);n.read(r.context.fd,i,0,t,r.pos,(function(t,n){if(t){r.destroy(t)}else if(n===0){r.destroyed=true;r.push(null);r.context.unref()}else{r.pos+=n;r.push(i.slice(0,n))}e()}))}))};ReadStream.prototype.destroy=function(e){if(this.destroyed)return;e=e||new Error("stream destroyed");this.destroyed=true;this.emit("error",e);this.context.unref()};i.inherits(WriteStream,s);function WriteStream(e,r){r=r||{};s.call(this,r);this.context=e;this.context.ref();this.start=r.start||0;this.endOffset=r.end==null?Infinity:+r.end;this.bytesWritten=0;this.pos=this.start;this.destroyed=false;this.on("finish",this.destroy.bind(this))}WriteStream.prototype._write=function(e,r,t){var i=this;if(i.destroyed)return;if(i.pos+e.length>i.endOffset){var o=new Error("maximum file length exceeded");o.code="ETOOBIG";i.destroy();t(o);return}i.context.pend.go((function(r){if(i.destroyed)return r();n.write(i.context.fd,e,0,e.length,i.pos,(function(e,n){if(e){i.destroy();r();t(e)}else{i.bytesWritten+=n;i.pos+=n;i.emit("progress");r();t()}}))}))};WriteStream.prototype.destroy=function(){if(this.destroyed)return;this.destroyed=true;this.context.unref()};i.inherits(BufferSlicer,u);function BufferSlicer(e,r){u.call(this);r=r||{};this.refCount=0;this.buffer=e;this.maxChunkSize=r.maxChunkSize||Number.MAX_SAFE_INTEGER}BufferSlicer.prototype.read=function(e,r,t,n,i){if(!(0<=r&&r<=e.length))throw new RangeError("offset outside buffer: 0 <= "+r+" <= "+e.length);if(n<0)throw new RangeError("position is negative: "+n);if(r+t>e.length){t=e.length-r}if(n+t>this.buffer.length){t=this.buffer.length-n}if(t<=0){setImmediate((function(){i(null,0)}));return}this.buffer.copy(e,r,n,n+t);setImmediate((function(){i(null,t)}))};BufferSlicer.prototype.write=function(e,r,t,n,i){e.copy(this.buffer,n,r,r+t);setImmediate((function(){i(null,t,e)}))};BufferSlicer.prototype.createReadStream=function(e){e=e||{};var r=new f(e);r.destroyed=false;r.start=e.start||0;r.endOffset=e.end;r.pos=r.endOffset||this.buffer.length;var t=this.buffer.slice(r.start,r.pos);var n=0;while(true){var i=n+this.maxChunkSize;if(i>=t.length){if(n<t.length){r.write(t.slice(n,t.length))}break}r.write(t.slice(n,i));n=i}r.end();r.destroy=function(){r.destroyed=true};return r};BufferSlicer.prototype.createWriteStream=function(e){var r=this;e=e||{};var t=new s(e);t.start=e.start||0;t.endOffset=e.end==null?this.buffer.length:+e.end;t.bytesWritten=0;t.pos=t.start;t.destroyed=false;t._write=function(e,n,i){if(t.destroyed)return;var o=t.pos+e.length;if(o>t.endOffset){var a=new Error("maximum file length exceeded");a.code="ETOOBIG";t.destroyed=true;i(a);return}e.copy(r.buffer,t.pos,0,e.length);t.bytesWritten+=e.length;t.pos=o;t.emit("progress");i()};t.destroy=function(){t.destroyed=true};return t};BufferSlicer.prototype.ref=function(){this.refCount+=1};BufferSlicer.prototype.unref=function(){this.refCount-=1;if(this.refCount<0){throw new Error("invalid unref")}};function createFromBuffer(e,r){return new BufferSlicer(e,r)}function createFromFd(e,r){return new FdSlicer(e,r)}},300:function(e){"use strict";e.exports=require("buffer")},361:function(e){"use strict";e.exports=require("events")},147:function(e){"use strict";e.exports=require("fs")},781:function(e){"use strict";e.exports=require("stream")},837:function(e){"use strict";e.exports=require("util")},796:function(e){"use strict";e.exports=require("zlib")}};var r={};function __nccwpck_require__(t){var n=r[t];if(n!==undefined){return n.exports}var i=r[t]={exports:{}};var o=true;try{e[t](i,i.exports,__nccwpck_require__);o=false}finally{if(o)delete r[t]}return i.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var t={};!function(){var e=t;var r=__nccwpck_require__(147);var n=__nccwpck_require__(796);var i=__nccwpck_require__(434);var o=__nccwpck_require__(794);var a=__nccwpck_require__(837);var s=__nccwpck_require__(361).EventEmitter;var f=__nccwpck_require__(781).Transform;var l=__nccwpck_require__(781).PassThrough;var u=__nccwpck_require__(781).Writable;e.open=open;e.fromFd=fromFd;e.fromBuffer=fromBuffer;e.fromRandomAccessReader=fromRandomAccessReader;e.dosDateTimeToDate=dosDateTimeToDate;e.getFileNameLowLevel=getFileNameLowLevel;e.validateFileName=validateFileName;e.parseExtraFields=parseExtraFields;e.ZipFile=ZipFile;e.Entry=Entry;e.LocalFileHeader=LocalFileHeader;e.RandomAccessReader=RandomAccessReader;function open(e,t,n){if(typeof t==="function"){n=t;t=null}if(t==null)t={};if(t.autoClose==null)t.autoClose=true;if(t.lazyEntries==null)t.lazyEntries=false;if(t.decodeStrings==null)t.decodeStrings=true;if(t.validateEntrySizes==null)t.validateEntrySizes=true;if(t.strictFileNames==null)t.strictFileNames=false;if(n==null)n=defaultCallback;r.open(e,"r",(function(e,i){if(e)return n(e);fromFd(i,t,(function(e,t){if(e)r.close(i,defaultCallback);n(e,t)}))}))}function fromFd(e,t,n){if(typeof t==="function"){n=t;t=null}if(t==null)t={};if(t.autoClose==null)t.autoClose=false;if(t.lazyEntries==null)t.lazyEntries=false;if(t.decodeStrings==null)t.decodeStrings=true;if(t.validateEntrySizes==null)t.validateEntrySizes=true;if(t.strictFileNames==null)t.strictFileNames=false;if(n==null)n=defaultCallback;r.fstat(e,(function(r,o){if(r)return n(r);var a=i.createFromFd(e,{autoClose:true});fromRandomAccessReader(a,o.size,t,n)}))}function fromBuffer(e,r,t){if(typeof r==="function"){t=r;r=null}if(r==null)r={};r.autoClose=false;if(r.lazyEntries==null)r.lazyEntries=false;if(r.decodeStrings==null)r.decodeStrings=true;if(r.validateEntrySizes==null)r.validateEntrySizes=true;if(r.strictFileNames==null)r.strictFileNames=false;var n=i.createFromBuffer(e,{maxChunkSize:65536});fromRandomAccessReader(n,e.length,r,t)}function fromRandomAccessReader(e,r,t,n){if(typeof t==="function"){n=t;t=null}if(t==null)t={};if(t.autoClose==null)t.autoClose=true;if(t.lazyEntries==null)t.lazyEntries=false;if(t.decodeStrings==null)t.decodeStrings=true;var i=!!t.decodeStrings;if(t.validateEntrySizes==null)t.validateEntrySizes=true;if(t.strictFileNames==null)t.strictFileNames=false;if(n==null)n=defaultCallback;if(typeof r!=="number")throw new Error("expected totalSize parameter to be a number");if(r>Number.MAX_SAFE_INTEGER){throw new Error("zip file too large. only file sizes up to 2^52 are supported due to JavaScript's Number type being an IEEE 754 double.")}e.ref();var o=22;var a=20;var s=65535;var f=Math.min(a+o+s,r);var l=c(f);var u=r-l.length;readAndAssertNoEof(e,l,0,f,u,(function(s){if(s)return n(s);for(var u=f-o;u>=0;u-=1){if(l.readUInt32LE(u)!==101010256)continue;var d=l.subarray(u);var p=d.readUInt16LE(4);var m=d.readUInt16LE(10);var h=d.readUInt32LE(16);var y=d.readUInt16LE(20);var E=d.length-o;if(y!==E){return n(new Error("Invalid comment length. Expected: "+E+". Found: "+y+". Are there extra bytes at the end of the file? Or is the end of central dir signature `PK☺☻` in the comment?"))}var v=i?decodeBuffer(d.subarray(22),false):d.subarray(22);if(u-a>=0&&l.readUInt32LE(u-a)===117853008){var w=l.subarray(u-a,u-a+a);var g=readUInt64LE(w,8);var F=c(56);return readAndAssertNoEof(e,F,0,F.length,g,(function(o){if(o)return n(o);if(F.readUInt32LE(0)!==101075792){return n(new Error("invalid zip64 end of central directory record signature"))}p=F.readUInt32LE(16);if(p!==0){return n(new Error("multi-disk zip files are not supported: found disk number: "+p))}m=readUInt64LE(F,32);h=readUInt64LE(F,48);return n(null,new ZipFile(e,h,r,m,v,t.autoClose,t.lazyEntries,i,t.validateEntrySizes,t.strictFileNames))}))}if(p!==0){return n(new Error("multi-disk zip files are not supported: found disk number: "+p))}return n(null,new ZipFile(e,h,r,m,v,t.autoClose,t.lazyEntries,i,t.validateEntrySizes,t.strictFileNames))}n(new Error("End of central directory record signature not found. Either not a zip file, or file is truncated."))}))}a.inherits(ZipFile,s);function ZipFile(e,r,t,n,i,o,a,f,l,u){var d=this;s.call(d);d.reader=e;d.reader.on("error",(function(e){emitError(d,e)}));d.reader.once("close",(function(){d.emit("close")}));d.readEntryCursor=r;d.fileSize=t;d.entryCount=n;d.comment=i;d.entriesRead=0;d.autoClose=!!o;d.lazyEntries=!!a;d.decodeStrings=!!f;d.validateEntrySizes=!!l;d.strictFileNames=!!u;d.isOpen=true;d.emittedError=false;if(!d.lazyEntries)d._readEntry()}ZipFile.prototype.close=function(){if(!this.isOpen)return;this.isOpen=false;this.reader.unref()};function emitErrorAndAutoClose(e,r){if(e.autoClose)e.close();emitError(e,r)}function emitError(e,r){if(e.emittedError)return;e.emittedError=true;e.emit("error",r)}ZipFile.prototype.readEntry=function(){if(!this.lazyEntries)throw new Error("readEntry() called without lazyEntries:true");this._readEntry()};ZipFile.prototype._readEntry=function(){var e=this;if(e.entryCount===e.entriesRead){setImmediate((function(){if(e.autoClose)e.close();if(e.emittedError)return;e.emit("end")}));return}if(e.emittedError)return;var r=c(46);readAndAssertNoEof(e.reader,r,0,r.length,e.readEntryCursor,(function(t){if(t)return emitErrorAndAutoClose(e,t);if(e.emittedError)return;var n=new Entry;var i=r.readUInt32LE(0);if(i!==33639248)return emitErrorAndAutoClose(e,new Error("invalid central directory file header signature: 0x"+i.toString(16)));n.versionMadeBy=r.readUInt16LE(4);n.versionNeededToExtract=r.readUInt16LE(6);n.generalPurposeBitFlag=r.readUInt16LE(8);n.compressionMethod=r.readUInt16LE(10);n.lastModFileTime=r.readUInt16LE(12);n.lastModFileDate=r.readUInt16LE(14);n.crc32=r.readUInt32LE(16);n.compressedSize=r.readUInt32LE(20);n.uncompressedSize=r.readUInt32LE(24);n.fileNameLength=r.readUInt16LE(28);n.extraFieldLength=r.readUInt16LE(30);n.fileCommentLength=r.readUInt16LE(32);n.internalFileAttributes=r.readUInt16LE(36);n.externalFileAttributes=r.readUInt32LE(38);n.relativeOffsetOfLocalHeader=r.readUInt32LE(42);if(n.generalPurposeBitFlag&64)return emitErrorAndAutoClose(e,new Error("strong encryption is not supported"));e.readEntryCursor+=46;r=c(n.fileNameLength+n.extraFieldLength+n.fileCommentLength);readAndAssertNoEof(e.reader,r,0,r.length,e.readEntryCursor,(function(t){if(t)return emitErrorAndAutoClose(e,t);if(e.emittedError)return;n.fileNameRaw=r.subarray(0,n.fileNameLength);var i=n.fileNameLength+n.extraFieldLength;n.extraFieldRaw=r.subarray(n.fileNameLength,i);n.fileCommentRaw=r.subarray(i,i+n.fileCommentLength);try{n.extraFields=parseExtraFields(n.extraFieldRaw)}catch(t){return emitErrorAndAutoClose(e,t)}if(e.decodeStrings){var o=(n.generalPurposeBitFlag&2048)!==0;n.fileComment=decodeBuffer(n.fileCommentRaw,o);n.fileName=getFileNameLowLevel(n.generalPurposeBitFlag,n.fileNameRaw,n.extraFields,e.strictFileNames);var a=validateFileName(n.fileName);if(a!=null)return emitErrorAndAutoClose(e,new Error(a))}else{n.fileComment=n.fileCommentRaw;n.fileName=n.fileNameRaw}n.comment=n.fileComment;e.readEntryCursor+=r.length;e.entriesRead+=1;for(var s=0;s<n.extraFields.length;s++){var f=n.extraFields[s];if(f.id!==1)continue;var l=f.data;var u=0;if(n.uncompressedSize===4294967295){if(u+8>l.length){return emitErrorAndAutoClose(e,new Error("zip64 extended information extra field does not include uncompressed size"))}n.uncompressedSize=readUInt64LE(l,u);u+=8}if(n.compressedSize===4294967295){if(u+8>l.length){return emitErrorAndAutoClose(e,new Error("zip64 extended information extra field does not include compressed size"))}n.compressedSize=readUInt64LE(l,u);u+=8}if(n.relativeOffsetOfLocalHeader===4294967295){if(u+8>l.length){return emitErrorAndAutoClose(e,new Error("zip64 extended information extra field does not include relative header offset"))}n.relativeOffsetOfLocalHeader=readUInt64LE(l,u);u+=8}break}if(e.validateEntrySizes&&n.compressionMethod===0){var d=n.uncompressedSize;if(n.isEncrypted()){d+=12}if(n.compressedSize!==d){var c="compressed/uncompressed size mismatch for stored file: "+n.compressedSize+" != "+n.uncompressedSize;return emitErrorAndAutoClose(e,new Error(c))}}e.emit("entry",n);if(!e.lazyEntries)e._readEntry()}))}))};ZipFile.prototype.openReadStream=function(e,r,t){var n=this;var i=0;var o=e.compressedSize;if(t==null){t=r;r=null}if(r==null){r={}}else{if(r.decodeFileData===false){if(r.decrypt!=null){throw new Error("cannot use options.decrypt when options.decodeFileData === false")}if(r.decompress!=null){throw new Error("cannot use options.decompress when options.decodeFileData === false")}}else{if(r.decrypt!=null){if(!e.isEncrypted()){throw new Error("options.decrypt can only be specified for encrypted entries. See also option decodeFileData.")}if(r.decrypt!==false)throw new Error("invalid options.decrypt value: "+r.decrypt);if(e.isCompressed()){if(r.decompress!==false)throw new Error("entry is encrypted and compressed, and options.decompress !== false. See also option decodeFileData.")}}if(r.decompress!=null){if(!e.isCompressed()){throw new Error("options.decompress can only be specified for compressed entries. See also option decodeFileData.")}if(!(r.decompress===false||r.decompress===true)){throw new Error("invalid options.decompress value: "+r.decompress)}s=r.decompress}}if(r.start!=null){i=r.start;if(i<0)throw new Error("options.start < 0");if(i>e.compressedSize)throw new Error("options.start > entry.compressedSize")}if(r.end!=null){o=r.end;if(o<0)throw new Error("options.end < 0");if(o>e.compressedSize)throw new Error("options.end > entry.compressedSize");if(o<i)throw new Error("options.end < options.start")}}var a=r.decodeFileData===false||(e.compressionMethod===0||e.compressionMethod===8&&r.decompress===false)&&(!e.isEncrypted()||r.decrypt===false);if(r.start!=null||r.end!=null){if(!a)throw new Error("start/end range require options.decodeFileData === false for non-trivial encoded entries.")}if(!n.isOpen)return t(new Error("closed"));if(e.isEncrypted()&&!a){if(r.decrypt!==false)return t(new Error("entry is encrypted, and options.decodeFileData !== false"))}var s;if(a){s=false}else if(e.compressionMethod===8){s=r.decodeFileData!==true}else{return t(new Error("unsupported compression method: "+e.compressionMethod))}n.readLocalFileHeader(e,{minimal:true},(function(r,a){if(r)return t(r);n.openReadStreamLowLevel(a.fileDataStart,e.compressedSize,i,o,s,e.uncompressedSize,t)}))};ZipFile.prototype.openReadStreamLowLevel=function(e,r,t,i,o,a,s){var f=this;var l=e+r;var u=f.reader.createReadStream({start:e+t,end:e+i});var d=u;if(o){var c=false;var p=n.createInflateRaw();u.on("error",(function(e){setImmediate((function(){if(!c)p.emit("error",e)}))}));u.pipe(p);if(f.validateEntrySizes){d=new AssertByteCountStream(a);p.on("error",(function(e){setImmediate((function(){if(!c)d.emit("error",e)}))}));p.pipe(d)}else{d=p}installDestroyFn(d,(function(){c=true;if(p!==d)p.unpipe(d);u.unpipe(p);u.destroy()}))}s(null,d)};ZipFile.prototype.readLocalFileHeader=function(e,r,t){var n=this;if(t==null){t=r;r=null}if(r==null)r={};n.reader.ref();var i=c(30);readAndAssertNoEof(n.reader,i,0,i.length,e.relativeOffsetOfLocalHeader,(function(o){try{if(o)return t(o);var a=i.readUInt32LE(0);if(a!==67324752){return t(new Error("invalid local file header signature: 0x"+a.toString(16)))}var s=i.readUInt16LE(26);var f=i.readUInt16LE(28);var l=e.relativeOffsetOfLocalHeader+30+s+f;if(l+e.compressedSize>n.fileSize){return t(new Error("file data overflows file bounds: "+l+" + "+e.compressedSize+" > "+n.fileSize))}if(r.minimal){return t(null,{fileDataStart:l})}var u=new LocalFileHeader;u.fileDataStart=l;u.versionNeededToExtract=i.readUInt16LE(4);u.generalPurposeBitFlag=i.readUInt16LE(6);u.compressionMethod=i.readUInt16LE(8);u.lastModFileTime=i.readUInt16LE(10);u.lastModFileDate=i.readUInt16LE(12);u.crc32=i.readUInt32LE(14);u.compressedSize=i.readUInt32LE(18);u.uncompressedSize=i.readUInt32LE(22);u.fileNameLength=s;u.extraFieldLength=f;i=c(s+f);n.reader.ref();readAndAssertNoEof(n.reader,i,0,i.length,e.relativeOffsetOfLocalHeader+30,(function(e){try{if(e)return t(e);u.fileName=i.subarray(0,s);u.extraField=i.subarray(s);return t(null,u)}finally{n.reader.unref()}}))}finally{n.reader.unref()}}))};function Entry(){}Entry.prototype.getLastModDate=function(e){if(e==null)e={};if(!e.forceDosFormat){for(var r=0;r<this.extraFields.length;r++){var t=this.extraFields[r];if(t.id===21589){var n=t.data;if(n.length<5)continue;var i=n[0];var o=1;if(!(i&o))continue;var a=n.readInt32LE(1);return new Date(a*1e3)}else if(t.id===10){var n=t.data;if(n.length!==32)continue;if(n.readUInt16LE(4)!==1)continue;if(n.readUInt16LE(6)!==24)continue;var s=n.readUInt32LE(8)+4294967296*n.readInt32LE(12);var f=s/1e4-116444736e5;return new Date(f)}}}return dosDateTimeToDate(this.lastModFileDate,this.lastModFileTime,e.timezone)};Entry.prototype.canDecodeFileData=function(){return!this.isEncrypted()&&(this.compressionMethod===0||this.compressionMethod===8)};Entry.prototype.isEncrypted=function(){return(this.generalPurposeBitFlag&1)!==0};Entry.prototype.isCompressed=function(){return this.compressionMethod===8};function LocalFileHeader(){}function dosDateTimeToDate(e,r,t){var n=e&31;var i=(e>>5&15)-1;var o=(e>>9&127)+1980;var a=0;var s=(r&31)*2;var f=r>>5&63;var l=r>>11&31;if(t==null||t==="local"){return new Date(o,i,n,l,f,s,a)}else if(t==="UTC"){return new Date(Date.UTC(o,i,n,l,f,s,a))}else{throw new Error("unrecognized options.timezone: "+options.timezone)}}function getFileNameLowLevel(e,r,t,n){var i=null;for(var a=0;a<t.length;a++){var s=t[a];if(s.id===28789){if(s.data.length<6){continue}if(s.data.readUInt8(0)!==1){continue}var f=s.data.readUInt32LE(1);if(o.unsigned(r)!==f){continue}i=decodeBuffer(s.data.subarray(5),true);break}}if(i==null){var l=(e&2048)!==0;i=decodeBuffer(r,l)}if(!n){i=i.replace(/\\/g,"/")}return i}function validateFileName(e){if(e.indexOf("\\")!==-1){return"invalid characters in fileName: "+e}if(/^[a-zA-Z]:/.test(e)||/^\//.test(e)){return"absolute path: "+e}if(e.split("/").indexOf("..")!==-1){return"invalid relative path: "+e}return null}function parseExtraFields(e){var r=[];var t=0;while(t<e.length-3){var n=e.readUInt16LE(t+0);var i=e.readUInt16LE(t+2);var o=t+4;var a=o+i;if(a>e.length)throw new Error("extra field length exceeds extra field buffer size");var s=e.subarray(o,a);r.push({id:n,data:s});t=a}return r}function readAndAssertNoEof(e,r,t,n,i,o){if(n===0){return setImmediate((function(){o(null,c(0))}))}e.read(r,t,n,i,(function(e,r){if(e)return o(e);if(r<n){return o(new Error("unexpected EOF"))}o()}))}a.inherits(AssertByteCountStream,f);function AssertByteCountStream(e){f.call(this);this.actualByteCount=0;this.expectedByteCount=e}AssertByteCountStream.prototype._transform=function(e,r,t){this.actualByteCount+=e.length;if(this.actualByteCount>this.expectedByteCount){var n="too many bytes in the stream. expected "+this.expectedByteCount+". got at least "+this.actualByteCount;return t(new Error(n))}t(null,e)};AssertByteCountStream.prototype._flush=function(e){if(this.actualByteCount<this.expectedByteCount){var r="not enough bytes in the stream. expected "+this.expectedByteCount+". got only "+this.actualByteCount;return e(new Error(r))}e()};a.inherits(RandomAccessReader,s);function RandomAccessReader(){s.call(this);this.refCount=0}RandomAccessReader.prototype.ref=function(){this.refCount+=1};RandomAccessReader.prototype.unref=function(){var e=this;e.refCount-=1;if(e.refCount>0)return;if(e.refCount<0)throw new Error("invalid unref");e.close(onCloseDone);function onCloseDone(r){if(r)return e.emit("error",r);e.emit("close")}};RandomAccessReader.prototype.createReadStream=function(e){if(e==null)e={};var r=e.start;var t=e.end;if(r===t){var n=new l;setImmediate((function(){n.end()}));return n}var i=this._readStreamForRange(r,t);var o=false;var a=new RefUnrefFilter(this);i.on("error",(function(e){setImmediate((function(){if(!o)a.emit("error",e)}))}));installDestroyFn(a,(function(){i.unpipe(a);a.unref();i.destroy()}));var s=new AssertByteCountStream(t-r);a.on("error",(function(e){setImmediate((function(){if(!o)s.emit("error",e)}))}));installDestroyFn(s,(function(){o=true;a.unpipe(s);a.destroy()}));return i.pipe(a).pipe(s)};RandomAccessReader.prototype._readStreamForRange=function(e,r){throw new Error("not implemented")};RandomAccessReader.prototype.read=function(e,r,t,n,i){var o=this.createReadStream({start:n,end:n+t});var a=new u;var s=0;a._write=function(t,n,i){t.copy(e,r+s,0,t.length);s+=t.length;i()};a.on("finish",i);o.on("error",(function(e){i(e)}));o.pipe(a)};RandomAccessReader.prototype.close=function(e){setImmediate(e)};a.inherits(RefUnrefFilter,l);function RefUnrefFilter(e){l.call(this);this.context=e;this.context.ref();this.unreffedYet=false}RefUnrefFilter.prototype._flush=function(e){this.unref();e()};RefUnrefFilter.prototype.unref=function(e){if(this.unreffedYet)return;this.unreffedYet=true;this.context.unref()};var d="\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ";function decodeBuffer(e,r){if(r){return e.toString("utf8")}else{var t="";for(var n=0;n<e.length;n++){t+=d[e[n]]}return t}}function readUInt64LE(e,r){var t=e.readUInt32LE(r);var n=e.readUInt32LE(r+4);return n*4294967296+t}var c;if(typeof Buffer.allocUnsafe==="function"){c=function(e){return Buffer.allocUnsafe(e)}}else{c=function(e){return new Buffer(e)}}function installDestroyFn(e,r){if(typeof e.destroy==="function"){e._destroy=function(e,t){r();if(t!=null)t(e)}}else{e.destroy=r}}function defaultCallback(e){if(e)throw e}}();module.exports=t})();
|
|
@@ -0,0 +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-05-21T17:29:14.652Z"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DatabaseOptions } from '@nocobase/database';
|
|
2
|
+
export interface DBAdapter {
|
|
3
|
+
dbOpts: DatabaseOptions;
|
|
4
|
+
backup(dir: string, skipFdw?: boolean): Promise<void>;
|
|
5
|
+
restore(filePath: string, schema?: string): Promise<void>;
|
|
6
|
+
check(op: 'backup' | 'restore'): Promise<void>;
|
|
7
|
+
clientVersion(op: 'backup' | 'restore'): Promise<string | void>;
|
|
8
|
+
}
|
|
9
|
+
export declare function getDBAdapter(dbOpts: DatabaseOptions): DBAdapter;
|
|
@@ -0,0 +1,486 @@
|
|
|
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
|
+
var __create = Object.create;
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __export = (target, all) => {
|
|
17
|
+
for (var name in all)
|
|
18
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(from))
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
36
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
+
var database_exports = {};
|
|
38
|
+
__export(database_exports, {
|
|
39
|
+
getDBAdapter: () => getDBAdapter
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(database_exports);
|
|
42
|
+
var import_child_process = require("child_process");
|
|
43
|
+
var import_fs = require("fs");
|
|
44
|
+
var fsPromises = __toESM(require("fs/promises"));
|
|
45
|
+
var import_os = __toESM(require("os"));
|
|
46
|
+
var import_path = __toESM(require("path"));
|
|
47
|
+
var import_promises = require("stream/promises");
|
|
48
|
+
var import_util = require("util");
|
|
49
|
+
var import_utils = require("../utils");
|
|
50
|
+
const exec = (0, import_util.promisify)(import_child_process.exec);
|
|
51
|
+
const D$$ = import_os.default.platform() === "win32" ? "$$" : "\\$\\$";
|
|
52
|
+
const STREAM_BUFFER_SIZE = 2 * 1024 * 1024;
|
|
53
|
+
const run = async (command, envVars = {}) => {
|
|
54
|
+
try {
|
|
55
|
+
const { stdout } = await exec(command, { env: { ...process.env, ...envVars } });
|
|
56
|
+
return stdout;
|
|
57
|
+
} catch (error) {
|
|
58
|
+
throw new Error(`${error.message}`);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const formatPathInEnv = (path2) => {
|
|
62
|
+
if (path2 && /\s/.test(path2) && !/^".*"$/.test(path2) && !/^'.*'$/.test(path2)) {
|
|
63
|
+
return `"${path2}"`;
|
|
64
|
+
}
|
|
65
|
+
return path2;
|
|
66
|
+
};
|
|
67
|
+
const escapeStringLiteral = (value) => String(value).replace(/'/g, "''");
|
|
68
|
+
class BaseDBAdapter {
|
|
69
|
+
constructor(dbOpts) {
|
|
70
|
+
this.dbOpts = dbOpts;
|
|
71
|
+
}
|
|
72
|
+
async check(_) {
|
|
73
|
+
}
|
|
74
|
+
async clientVersion(_) {
|
|
75
|
+
}
|
|
76
|
+
assertCommand = (command) => {
|
|
77
|
+
try {
|
|
78
|
+
(0, import_child_process.execSync)(`${command} --version`);
|
|
79
|
+
} catch (error) {
|
|
80
|
+
throw new Error(
|
|
81
|
+
`Command ${command} not found, please install it first. Check reference here: https://docs.nocobase.com/handbook/backups#installation`
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
class MySQLAdapter extends BaseDBAdapter {
|
|
87
|
+
#backupCmd = "mysqldump";
|
|
88
|
+
#restoreCmd = "mysql";
|
|
89
|
+
async check(op) {
|
|
90
|
+
switch (op) {
|
|
91
|
+
case "backup":
|
|
92
|
+
this.assertCommand(this.#backupCmd);
|
|
93
|
+
this.assertCommand(this.#restoreCmd);
|
|
94
|
+
break;
|
|
95
|
+
case "restore":
|
|
96
|
+
this.assertCommand(this.#restoreCmd);
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
async clientVersion(op) {
|
|
101
|
+
const cmd = op === "backup" ? this.#backupCmd : this.#restoreCmd;
|
|
102
|
+
try {
|
|
103
|
+
return (0, import_child_process.execSync)(`${cmd} --version`).toString();
|
|
104
|
+
} catch (_error) {
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
async backup(dir, skipFdw = false) {
|
|
108
|
+
const { username, host, port, database, password } = this.dbOpts;
|
|
109
|
+
const filePath = `${dir}/data`;
|
|
110
|
+
const versionStr = await this.clientVersion("backup");
|
|
111
|
+
const versionMatch = (versionStr || "").match(/Ver\s+(\d+\.\d+\.\d+)/i);
|
|
112
|
+
const version = versionMatch ? Number(versionMatch[1].split(".")[0]) : null;
|
|
113
|
+
let createServerSQL = "";
|
|
114
|
+
if (!skipFdw) {
|
|
115
|
+
createServerSQL = await this.#getFederatedServerSQL(username, host, port, database, password);
|
|
116
|
+
}
|
|
117
|
+
const mysqldumpArgs = [
|
|
118
|
+
"-u",
|
|
119
|
+
username,
|
|
120
|
+
"-h",
|
|
121
|
+
host,
|
|
122
|
+
...port ? ["-P", port.toString()] : [],
|
|
123
|
+
"--protocol=tcp",
|
|
124
|
+
"--hex-blob",
|
|
125
|
+
"--single-transaction",
|
|
126
|
+
"--skip-lock-tables",
|
|
127
|
+
"--set-gtid-purged=OFF",
|
|
128
|
+
"--routines",
|
|
129
|
+
"--triggers",
|
|
130
|
+
...version && version > 7 ? ["--column-statistics=0"] : [],
|
|
131
|
+
database
|
|
132
|
+
];
|
|
133
|
+
return new Promise((resolve, reject) => {
|
|
134
|
+
const mysqldumpProcess = (0, import_child_process.spawn)(this.#backupCmd, mysqldumpArgs, {
|
|
135
|
+
env: { ...process.env, MYSQL_PWD: password },
|
|
136
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
137
|
+
});
|
|
138
|
+
const writeStream = (0, import_fs.createWriteStream)(filePath, {
|
|
139
|
+
highWaterMark: STREAM_BUFFER_SIZE
|
|
140
|
+
});
|
|
141
|
+
const escapeTransform = new import_utils.EscapeQuoteTransform();
|
|
142
|
+
mysqldumpProcess.on("error", reject);
|
|
143
|
+
mysqldumpProcess.on("exit", (code) => {
|
|
144
|
+
if (code !== 0) {
|
|
145
|
+
reject(new Error(`mysqldump exited with code ${code}`));
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
writeStream.write("/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;\n");
|
|
149
|
+
writeStream.write("/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;\n");
|
|
150
|
+
writeStream.write("/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;\n");
|
|
151
|
+
writeStream.write("/*!40101 SET NAMES utf8mb4 */;\n\n");
|
|
152
|
+
if (createServerSQL) {
|
|
153
|
+
writeStream.write(`${createServerSQL}
|
|
154
|
+
|
|
155
|
+
`);
|
|
156
|
+
}
|
|
157
|
+
(0, import_promises.pipeline)(
|
|
158
|
+
mysqldumpProcess.stdout,
|
|
159
|
+
escapeTransform,
|
|
160
|
+
writeStream
|
|
161
|
+
).then(() => {
|
|
162
|
+
writeStream.write("\n/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;\n");
|
|
163
|
+
writeStream.write("/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;\n");
|
|
164
|
+
writeStream.write("/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;\n");
|
|
165
|
+
writeStream.end(() => resolve());
|
|
166
|
+
}).catch(reject);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
async #getFederatedServerSQL(username, host, port, database, password) {
|
|
170
|
+
try {
|
|
171
|
+
const fetchFederatedTablesCommand = `mysql -u ${username} -h ${host} ${port ? `-P ${port}` : ""} --protocol=tcp -D ${database} -e "
|
|
172
|
+
SELECT TABLE_NAME
|
|
173
|
+
FROM information_schema.tables
|
|
174
|
+
WHERE table_schema = '${database}'
|
|
175
|
+
AND engine = 'FEDERATED';" -s -N`;
|
|
176
|
+
const federatedTables = (await run(fetchFederatedTablesCommand, { MYSQL_PWD: password })).trim();
|
|
177
|
+
if (!federatedTables) return "";
|
|
178
|
+
let servers = [];
|
|
179
|
+
if (federatedTables) {
|
|
180
|
+
const createTablePromises = federatedTables.split("\n").map(async (entry) => {
|
|
181
|
+
const createTableCommand = `mysql -u ${username} -h ${host} ${port ? `-P ${port}` : ""} --protocol=tcp -D ${database} -e "SHOW CREATE TABLE ${entry}" -s -N`;
|
|
182
|
+
const cmdRet = await run(createTableCommand, { MYSQL_PWD: password });
|
|
183
|
+
const match = cmdRet.match(/ENGINE=FEDERATED\s+.*CONNECTION\s*=\s*'([^']+)\/.*?'/i);
|
|
184
|
+
return match ? match[1] : "";
|
|
185
|
+
});
|
|
186
|
+
servers = await Promise.all(createTablePromises);
|
|
187
|
+
}
|
|
188
|
+
if (servers.filter((s) => s).length === 0) return "";
|
|
189
|
+
const fetchServerInfoCommand = `mysql -u ${username} -h ${host} ${port ? `-P ${port}` : ""} --protocol=tcp -D ${database} -e "
|
|
190
|
+
SELECT Server_name, Host, Db, Username, Password, Port FROM mysql.servers
|
|
191
|
+
WHERE Server_name IN ('${servers.filter((s) => s).join("','")}');" -s -N`;
|
|
192
|
+
const serverInfo = await run(fetchServerInfoCommand, { MYSQL_PWD: password });
|
|
193
|
+
if (!serverInfo) return "";
|
|
194
|
+
let createServerSQL = `
|
|
195
|
+
DELIMITER $$
|
|
196
|
+
DROP PROCEDURE IF EXISTS nocobase_create_server_if_not_exists$$
|
|
197
|
+
CREATE PROCEDURE nocobase_create_server_if_not_exists()
|
|
198
|
+
BEGIN
|
|
199
|
+
`;
|
|
200
|
+
const serverEntries = serverInfo.split("\n").filter((entry) => entry.trim() !== "");
|
|
201
|
+
serverEntries.forEach((entry) => {
|
|
202
|
+
const [Server_name, Host, Db, Username, Password, Port] = entry.split(" ");
|
|
203
|
+
createServerSQL += `
|
|
204
|
+
IF NOT EXISTS (SELECT * FROM mysql.servers WHERE Server_name = '${Server_name}') THEN
|
|
205
|
+
CREATE SERVER ${Server_name} FOREIGN DATA WRAPPER mysql
|
|
206
|
+
OPTIONS (HOST '${Host}', DATABASE '${Db}', USER '${Username}', PASSWORD '${Password}', PORT ${Port});
|
|
207
|
+
END IF;
|
|
208
|
+
`;
|
|
209
|
+
});
|
|
210
|
+
createServerSQL += `
|
|
211
|
+
END$$
|
|
212
|
+
CALL nocobase_create_server_if_not_exists()$$
|
|
213
|
+
DELIMITER ;
|
|
214
|
+
`;
|
|
215
|
+
return createServerSQL;
|
|
216
|
+
} catch (error) {
|
|
217
|
+
return "";
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
async restore(filePath) {
|
|
221
|
+
const { username, host, port, database, password } = this.dbOpts;
|
|
222
|
+
const dropDataCommand = `mysql -u ${username} -h ${host} ${port ? `-P ${port}` : ""} --protocol=tcp -D ${database} -e "
|
|
223
|
+
DELIMITER $$
|
|
224
|
+
DROP PROCEDURE IF EXISTS drop_all_tables_and_triggers$$
|
|
225
|
+
CREATE PROCEDURE drop_all_tables_and_triggers()
|
|
226
|
+
BEGIN
|
|
227
|
+
DECLARE _done INT DEFAULT FALSE;
|
|
228
|
+
DECLARE _tableName VARCHAR(255);
|
|
229
|
+
DECLARE _triggerName VARCHAR(255);
|
|
230
|
+
|
|
231
|
+
-- Cursor for tables and views
|
|
232
|
+
DECLARE _cursor CURSOR FOR
|
|
233
|
+
SELECT table_name
|
|
234
|
+
FROM information_schema.TABLES
|
|
235
|
+
WHERE table_schema = SCHEMA();
|
|
236
|
+
|
|
237
|
+
-- Cursor for triggers
|
|
238
|
+
DECLARE _trigger_cursor CURSOR FOR
|
|
239
|
+
SELECT trigger_name
|
|
240
|
+
FROM information_schema.TRIGGERS
|
|
241
|
+
WHERE trigger_schema = SCHEMA();
|
|
242
|
+
|
|
243
|
+
-- Handler to continue if DROP statement fails
|
|
244
|
+
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET _done = FALSE;
|
|
245
|
+
DECLARE CONTINUE HANDLER FOR NOT FOUND SET _done = TRUE;
|
|
246
|
+
|
|
247
|
+
-- Disable foreign key checks
|
|
248
|
+
SET FOREIGN_KEY_CHECKS = 0;
|
|
249
|
+
|
|
250
|
+
-- Open cursor to drop tables and views
|
|
251
|
+
OPEN _cursor;
|
|
252
|
+
|
|
253
|
+
REPEAT
|
|
254
|
+
FETCH _cursor INTO _tableName;
|
|
255
|
+
|
|
256
|
+
IF NOT _done THEN
|
|
257
|
+
SET @stmt_sql1 = CONCAT('DROP TABLE IF EXISTS ', _tableName);
|
|
258
|
+
SET @stmt_sql2 = CONCAT('DROP VIEW IF EXISTS ', _tableName);
|
|
259
|
+
|
|
260
|
+
PREPARE stmt1 FROM @stmt_sql1;
|
|
261
|
+
PREPARE stmt2 FROM @stmt_sql2;
|
|
262
|
+
|
|
263
|
+
EXECUTE stmt1;
|
|
264
|
+
EXECUTE stmt2;
|
|
265
|
+
|
|
266
|
+
DEALLOCATE PREPARE stmt1;
|
|
267
|
+
DEALLOCATE PREPARE stmt2;
|
|
268
|
+
END IF;
|
|
269
|
+
|
|
270
|
+
UNTIL _done END REPEAT;
|
|
271
|
+
|
|
272
|
+
CLOSE _cursor;
|
|
273
|
+
|
|
274
|
+
-- Reset _done for trigger deletion
|
|
275
|
+
SET _done = FALSE;
|
|
276
|
+
|
|
277
|
+
-- Open cursor to drop triggers
|
|
278
|
+
OPEN _trigger_cursor;
|
|
279
|
+
|
|
280
|
+
REPEAT
|
|
281
|
+
FETCH _trigger_cursor INTO _triggerName;
|
|
282
|
+
|
|
283
|
+
IF NOT _done THEN
|
|
284
|
+
SET @stmt_sql3 = CONCAT('DROP TRIGGER IF EXISTS ', _triggerName);
|
|
285
|
+
PREPARE stmt3 FROM @stmt_sql3;
|
|
286
|
+
EXECUTE stmt3;
|
|
287
|
+
DEALLOCATE PREPARE stmt3;
|
|
288
|
+
END IF;
|
|
289
|
+
|
|
290
|
+
UNTIL _done END REPEAT;
|
|
291
|
+
|
|
292
|
+
CLOSE _trigger_cursor;
|
|
293
|
+
|
|
294
|
+
-- Enable foreign key checks again
|
|
295
|
+
SET FOREIGN_KEY_CHECKS = 1;
|
|
296
|
+
END$$
|
|
297
|
+
|
|
298
|
+
CALL drop_all_tables_and_triggers()$$
|
|
299
|
+
DROP PROCEDURE drop_all_tables_and_triggers$$
|
|
300
|
+
DELIMITER ;
|
|
301
|
+
"`;
|
|
302
|
+
await run(dropDataCommand, { MYSQL_PWD: password });
|
|
303
|
+
const command = `${this.#restoreCmd} -u ${username} -h ${host} ${port ? `-P ${port}` : ""} --protocol=tcp ${database} < ${filePath}`;
|
|
304
|
+
await run(command, { MYSQL_PWD: password });
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
class PostgresAdapter extends BaseDBAdapter {
|
|
308
|
+
get #backupCmd() {
|
|
309
|
+
return formatPathInEnv(process.env.PG_DUMP_PATH) || "pg_dump";
|
|
310
|
+
}
|
|
311
|
+
get #restoreCmd() {
|
|
312
|
+
return formatPathInEnv(process.env.PG_RESTORE_PATH) || "pg_restore";
|
|
313
|
+
}
|
|
314
|
+
async check(op) {
|
|
315
|
+
switch (op) {
|
|
316
|
+
case "backup":
|
|
317
|
+
this.assertCommand(this.#backupCmd);
|
|
318
|
+
break;
|
|
319
|
+
case "restore":
|
|
320
|
+
this.assertCommand(this.#restoreCmd);
|
|
321
|
+
break;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
async clientVersion(op) {
|
|
325
|
+
const cmd = op === "backup" ? this.#backupCmd : this.#restoreCmd;
|
|
326
|
+
try {
|
|
327
|
+
return (0, import_child_process.execSync)(`${cmd} --version`).toString();
|
|
328
|
+
} catch (_error) {
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
async backup(dir) {
|
|
332
|
+
const { username, host, port, database, password, schema: backupSchema } = this.dbOpts;
|
|
333
|
+
const filePath = `${dir}/data`;
|
|
334
|
+
const schemaOption = backupSchema ? `--schema=${backupSchema}` : "";
|
|
335
|
+
const command = `${this.#backupCmd} -U ${username} -h ${host} ${port ? `-p ${port}` : ""} -F c -b --quote-all-identifiers ${schemaOption} -f ${filePath} ${database}`;
|
|
336
|
+
await run(command, { PGPASSWORD: password });
|
|
337
|
+
}
|
|
338
|
+
async restore(filePath, schema) {
|
|
339
|
+
const { username, host, port, database, password } = this.dbOpts;
|
|
340
|
+
let schemaOption = this.dbOpts.schema;
|
|
341
|
+
if (schema && !schemaOption) {
|
|
342
|
+
schemaOption = "public";
|
|
343
|
+
}
|
|
344
|
+
const cpuCores = import_os.default.cpus().length;
|
|
345
|
+
const j = Math.max(1, Math.floor(cpuCores / 2));
|
|
346
|
+
const schemaNameCondition = schemaOption ? `WHERE schemaname = '${schemaOption}'` : `WHERE schemaname NOT IN ('pg_catalog', 'information_schema')`;
|
|
347
|
+
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')))`;
|
|
348
|
+
const dropDataCommand = `psql -U ${username} -h ${host} ${port ? `-p ${port}` : ""} -d ${database} -c "
|
|
349
|
+
DO ${D$$} DECLARE r RECORD;
|
|
350
|
+
BEGIN
|
|
351
|
+
FOR r IN (SELECT viewname,schemaname FROM pg_views ${schemaNameCondition}) LOOP
|
|
352
|
+
BEGIN
|
|
353
|
+
EXECUTE 'DROP VIEW IF EXISTS ' || quote_ident(r.schemaname) || '.' || quote_ident(r.tablename) || ' CASCADE';
|
|
354
|
+
EXCEPTION
|
|
355
|
+
WHEN OTHERS THEN
|
|
356
|
+
END;
|
|
357
|
+
END LOOP;
|
|
358
|
+
|
|
359
|
+
FOR r IN (SELECT tablename,schemaname FROM pg_tables ${schemaNameCondition}) LOOP
|
|
360
|
+
BEGIN
|
|
361
|
+
EXECUTE 'DROP TABLE IF EXISTS ' || quote_ident(r.schemaname) || '.' || quote_ident(r.tablename) || ' CASCADE';
|
|
362
|
+
EXCEPTION
|
|
363
|
+
WHEN OTHERS THEN
|
|
364
|
+
END;
|
|
365
|
+
END LOOP;
|
|
366
|
+
|
|
367
|
+
FOR r IN (SELECT sequencename,schemaname FROM pg_sequences ${schemaNameCondition}) LOOP
|
|
368
|
+
BEGIN
|
|
369
|
+
EXECUTE 'DROP SEQUENCE IF EXISTS ' || quote_ident(r.schemaname) || '.' || quote_ident(r.tablename) || ' CASCADE';
|
|
370
|
+
EXCEPTION
|
|
371
|
+
WHEN OTHERS THEN
|
|
372
|
+
END;
|
|
373
|
+
END LOOP;
|
|
374
|
+
|
|
375
|
+
FOR r IN (
|
|
376
|
+
SELECT tgname, tgrelid::regclass::text AS table_fullname
|
|
377
|
+
FROM pg_trigger
|
|
378
|
+
WHERE tgrelid IN (SELECT oid FROM pg_class ${relnamespaceCondition})
|
|
379
|
+
) LOOP
|
|
380
|
+
BEGIN
|
|
381
|
+
EXECUTE 'DROP TRIGGER IF EXISTS ' || quote_ident(r.tgname) || ' ON ' || quote_ident(r.table_fullname) || ' CASCADE';
|
|
382
|
+
EXCEPTION
|
|
383
|
+
WHEN OTHERS THEN
|
|
384
|
+
END;
|
|
385
|
+
END LOOP;
|
|
386
|
+
|
|
387
|
+
END ${D$$};"`.replace(/\n/g, " ");
|
|
388
|
+
await run(dropDataCommand, { PGPASSWORD: password });
|
|
389
|
+
if (schema === schemaOption || !schemaOption) {
|
|
390
|
+
const pgRestoreCommand = `${this.#restoreCmd} -U ${username} -h ${host} ${port ? `-p ${port}` : ""} -d ${database} --clean --if-exists --no-owner -j ${j} ${filePath}`;
|
|
391
|
+
await run(pgRestoreCommand, { PGPASSWORD: password });
|
|
392
|
+
} else {
|
|
393
|
+
const srcSchema = schema || "public";
|
|
394
|
+
const pgRestoreCommand = `${this.#restoreCmd} -U ${username} -h ${host} ${port ? `-p ${port}` : ""} -n ${srcSchema} -d ${database} --clean --if-exists --no-owner -j ${j} ${filePath}`;
|
|
395
|
+
await this.#restoreSchema(srcSchema, schemaOption, pgRestoreCommand);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
async #restoreSchema(srcSchema, targetSchema, pgRestoreCommand) {
|
|
399
|
+
const { username, host, port, database, password } = this.dbOpts;
|
|
400
|
+
const ts = Date.now();
|
|
401
|
+
const preCommand = `psql -U ${username} -h ${host} ${port ? `-p ${port}` : ""} -d ${database} -c "
|
|
402
|
+
DO ${D$$}
|
|
403
|
+
BEGIN
|
|
404
|
+
IF EXISTS (SELECT 1 FROM information_schema.schemata WHERE schema_name = '${srcSchema}') THEN
|
|
405
|
+
EXECUTE 'ALTER SCHEMA ${srcSchema} RENAME TO ${srcSchema}_${ts}';
|
|
406
|
+
END IF;
|
|
407
|
+
EXECUTE 'CREATE SCHEMA ${srcSchema}';
|
|
408
|
+
END ${D$$};"`.replace(/\n/g, " ");
|
|
409
|
+
const postCommand = `psql -U ${username} -h ${host} ${port ? `-p ${port}` : ""} -d ${database} -c "
|
|
410
|
+
DO ${D$$}
|
|
411
|
+
BEGIN
|
|
412
|
+
EXECUTE 'DROP SCHEMA ${targetSchema} CASCADE';
|
|
413
|
+
EXECUTE 'ALTER SCHEMA ${srcSchema} RENAME TO ${targetSchema}';
|
|
414
|
+
IF EXISTS (SELECT 1 FROM information_schema.schemata WHERE schema_name = '${srcSchema}_${ts}') THEN
|
|
415
|
+
EXECUTE 'ALTER SCHEMA ${srcSchema}_${ts} RENAME TO ${srcSchema}';
|
|
416
|
+
END IF;
|
|
417
|
+
END ${D$$};"`.replace(/\n/g, " ");
|
|
418
|
+
await run(preCommand, { PGPASSWORD: password });
|
|
419
|
+
try {
|
|
420
|
+
await run(pgRestoreCommand, { PGPASSWORD: password });
|
|
421
|
+
} finally {
|
|
422
|
+
await run(postCommand, { PGPASSWORD: password });
|
|
423
|
+
}
|
|
424
|
+
await this.#syncCollectionSchemaMetadata(srcSchema, targetSchema);
|
|
425
|
+
}
|
|
426
|
+
async #syncCollectionSchemaMetadata(srcSchema, targetSchema) {
|
|
427
|
+
const { username, host, port, database, password, tablePrefix } = this.dbOpts;
|
|
428
|
+
const collectionsTable = `${tablePrefix || ""}collections`;
|
|
429
|
+
const targetSchemaLiteral = escapeStringLiteral(targetSchema);
|
|
430
|
+
const srcSchemaLiteral = escapeStringLiteral(srcSchema);
|
|
431
|
+
const collectionsTableLiteral = escapeStringLiteral(collectionsTable);
|
|
432
|
+
const updateCollectionSchemaCommand = `psql -U ${username} -h ${host} ${port ? `-p ${port}` : ""} -d ${database} -c "
|
|
433
|
+
DO ${D$$}
|
|
434
|
+
DECLARE
|
|
435
|
+
collections_table text := '${collectionsTableLiteral}';
|
|
436
|
+
BEGIN
|
|
437
|
+
IF EXISTS (
|
|
438
|
+
SELECT 1 FROM information_schema.columns
|
|
439
|
+
WHERE table_schema = '${targetSchemaLiteral}'
|
|
440
|
+
AND table_name = collections_table
|
|
441
|
+
AND column_name = 'options'
|
|
442
|
+
) THEN
|
|
443
|
+
EXECUTE format(
|
|
444
|
+
'UPDATE %I.%I SET options = jsonb_set(options::jsonb, ''{schema}'', to_jsonb(%L::text), true) WHERE options->>''schema'' = %L',
|
|
445
|
+
'${targetSchemaLiteral}',
|
|
446
|
+
collections_table,
|
|
447
|
+
'${targetSchemaLiteral}',
|
|
448
|
+
'${srcSchemaLiteral}'
|
|
449
|
+
);
|
|
450
|
+
END IF;
|
|
451
|
+
END ${D$$};"`.replace(/\n/g, " ");
|
|
452
|
+
await run(updateCollectionSchemaCommand, { PGPASSWORD: password });
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
class SQLiteAdapter extends BaseDBAdapter {
|
|
456
|
+
async backup(dir) {
|
|
457
|
+
const { storage } = this.dbOpts;
|
|
458
|
+
const filePath = `${dir}/data`;
|
|
459
|
+
const dbFilePath = import_path.default.resolve(storage);
|
|
460
|
+
await fsPromises.copyFile(dbFilePath, filePath);
|
|
461
|
+
}
|
|
462
|
+
async restore(filePath) {
|
|
463
|
+
const { storage } = this.dbOpts;
|
|
464
|
+
const dbFilePath = import_path.default.resolve(storage);
|
|
465
|
+
await fsPromises.copyFile(filePath, dbFilePath, fsPromises.constants.COPYFILE_FICLONE);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
class MariaDBAdapter extends MySQLAdapter {
|
|
469
|
+
}
|
|
470
|
+
const adapterMap = {
|
|
471
|
+
mysql: MySQLAdapter,
|
|
472
|
+
postgres: PostgresAdapter,
|
|
473
|
+
sqlite: SQLiteAdapter,
|
|
474
|
+
mariadb: MariaDBAdapter
|
|
475
|
+
};
|
|
476
|
+
function getDBAdapter(dbOpts) {
|
|
477
|
+
const Adapter = adapterMap[dbOpts.dialect];
|
|
478
|
+
if (!Adapter) {
|
|
479
|
+
throw new Error(`Unsupported database type ${dbOpts.dialect}`);
|
|
480
|
+
}
|
|
481
|
+
return new Adapter(dbOpts);
|
|
482
|
+
}
|
|
483
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
484
|
+
0 && (module.exports = {
|
|
485
|
+
getDBAdapter
|
|
486
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var backup_settings_exports = {};
|
|
28
|
+
__export(backup_settings_exports, {
|
|
29
|
+
default: () => backup_settings_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(backup_settings_exports);
|
|
32
|
+
var import_database = require("@nocobase/database");
|
|
33
|
+
var import_utils = require("../utils");
|
|
34
|
+
var backup_settings_default = (0, import_database.defineCollection)({
|
|
35
|
+
name: `${import_utils.SETTINGS}`,
|
|
36
|
+
dumpRules: "required",
|
|
37
|
+
migrationRules: ["overwrite", "skip"],
|
|
38
|
+
fields: [
|
|
39
|
+
{
|
|
40
|
+
type: "boolean",
|
|
41
|
+
name: "scheduled"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
type: "string",
|
|
45
|
+
name: "cron"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: "integer",
|
|
49
|
+
name: "keep"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
type: "boolean",
|
|
53
|
+
name: "enableFilesBackup"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
type: "belongsTo",
|
|
57
|
+
name: "storage",
|
|
58
|
+
target: "storages",
|
|
59
|
+
targetKey: "id",
|
|
60
|
+
foreignKey: "storageId"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
type: "string",
|
|
64
|
+
name: "encryptionPassword"
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './plugin';
|