@tachybase/module-backup 1.5.1 → 1.6.1
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/dist/client/components/BackupProgressCell.d.ts +36 -0
- package/dist/client/hooks/useBackupProgress.d.ts +53 -0
- package/dist/client/hooks/useDownloadProgress.d.ts +40 -0
- package/dist/client/index.js +3 -3
- package/dist/externalVersion.js +5 -5
- package/dist/locale/en-US.json +7 -0
- package/dist/locale/ja-JP.d.ts +6 -0
- package/dist/locale/ja-JP.js +6 -0
- package/dist/locale/ko_KR.json +6 -0
- package/dist/locale/pt-BR.d.ts +6 -0
- package/dist/locale/pt-BR.js +6 -0
- package/dist/locale/zh-CN.json +7 -0
- package/dist/node_modules/@hapi/topo/lib/index.js +1 -1
- package/dist/node_modules/@hapi/topo/package.json +1 -1
- package/dist/node_modules/archiver/package.json +1 -1
- package/dist/node_modules/cron-parser/package.json +1 -1
- package/dist/node_modules/semver/package.json +1 -1
- package/dist/node_modules/yauzl/package.json +1 -1
- package/dist/server/dumper.d.ts +9 -3
- package/dist/server/dumper.js +78 -15
- package/dist/server/progress-tracker.d.ts +76 -0
- package/dist/server/progress-tracker.js +286 -0
- package/dist/server/resourcers/backup-files.js +30 -27
- package/dist/server/server.d.ts +1 -0
- package/dist/server/server.js +49 -1
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";var e={299:function(e,t,r){const n=r(964);const o=r(425);const s=r(32);const i=r(435);const f={};e.exports=function(e,t,r={}){n(e&&typeof e==="object","Invalid defaults value: must be an object");n(!t||t===true||typeof t==="object","Invalid source value: must be true, falsy or an object");n(typeof r==="object","Invalid options: must be an object");if(!t){return null}if(r.shallow){return f.applyToDefaultsWithShallow(e,t,r)}const i=o(e);if(t===true){return i}const c=r.nullOverride!==undefined?r.nullOverride:false;return s(i,t,{nullOverride:c,mergeArrays:false})};f.applyToDefaultsWithShallow=function(e,t,r){const c=r.shallow;n(Array.isArray(c),"Invalid keys");const a=new Map;const u=t===true?null:new Set;for(let r of c){r=Array.isArray(r)?r:r.split(".");const n=i(e,r);if(n&&typeof n==="object"){a.set(n,u&&i(t,r)||n)}else if(u){u.add(r)}}const l=o(e,{},a);if(!u){return l}for(const e of u){f.reachCopy(l,t,e)}const p=r.nullOverride!==undefined?r.nullOverride:false;return s(l,t,{nullOverride:p,mergeArrays:false})};f.reachCopy=function(e,t,r){for(const e of r){if(!(e in t)){return}const r=t[e];if(typeof r!=="object"||r===null){return}t=r}const n=t;let o=e;for(let e=0;e<r.length-1;++e){const t=r[e];if(typeof o[t]!=="object"){o[t]={}}o=o[t]}o[r[r.length-1]]=n}},964:function(e,t,r){const n=r(116);const o=r(561);const s={};const i=e.exports=function(e,...t){if(e){return}if(t.length===1&&t[0]instanceof Error){throw t[0]}const r=t.filter((e=>e!=="")).map((e=>typeof e==="string"?e:e instanceof Error?e.message:o(e)));throw new n(r.join(" "),i)}},116:function(e){const t={};e.exports=class AssertError extends Error{name="AssertError";constructor(e,t){super(e||"Unknown error");if(typeof Error.captureStackTrace==="function"){Error.captureStackTrace(this,t)}}}},62:function(e){const t={};e.exports=t.Bench=class{constructor(){this.ts=0;this.reset()}reset(){this.ts=t.Bench.now()}elapsed(){return t.Bench.now()-this.ts}static now(){const e=process.hrtime();return e[0]*1e3+e[1]/1e6}}},977:function(e,t,r){const n=r(4);const o={};e.exports=function(){return new Promise(n)}},425:function(e,t,r){const n=r(435);const o=r(193);const s=r(685);const i={needsProtoHack:new Set([o.set,o.map,o.weakSet,o.weakMap])};e.exports=i.clone=function(e,t={},r=null){if(typeof e!=="object"||e===null){return e}let n=i.clone;let f=r;if(t.shallow){if(t.shallow!==true){return i.cloneWithShallow(e,t)}n=e=>e}else if(f){const t=f.get(e);if(t){return t}}else{f=new Map}const c=o.getInternalProto(e);switch(c){case o.buffer:return Buffer?.from(e);case o.date:return new Date(e.getTime());case o.regex:case o.url:return new c.constructor(e)}const a=i.base(e,c,t);if(a===e){return e}if(f){f.set(e,a)}if(c===o.set){for(const r of e){a.add(n(r,t,f))}}else if(c===o.map){for(const[r,o]of e){a.set(r,n(o,t,f))}}const u=s.keys(e,t);for(const r of u){if(r==="__proto__"){continue}if(c===o.array&&r==="length"){a.length=e.length;continue}const s=Object.getOwnPropertyDescriptor(e,r);if(s){if(s.get||s.set){Object.defineProperty(a,r,s)}else if(s.enumerable){a[r]=n(e[r],t,f)}else{Object.defineProperty(a,r,{enumerable:false,writable:true,configurable:true,value:n(e[r],t,f)})}}else{Object.defineProperty(a,r,{enumerable:true,writable:true,configurable:true,value:n(e[r],t,f)})}}return a};i.cloneWithShallow=function(e,t){const r=t.shallow;t=Object.assign({},t);t.shallow=false;const o=new Map;for(const t of r){const r=n(e,t);if(typeof r==="object"||typeof r==="function"){o.set(r,r)}}return i.clone(e,t,o)};i.base=function(e,t,r){if(r.prototype===false){if(i.needsProtoHack.has(t)){return new t.constructor}return t===o.array?[]:{}}const n=Object.getPrototypeOf(e);if(n&&n.isImmutable){return e}if(t===o.array){const e=[];if(n!==t){Object.setPrototypeOf(e,n)}return e}if(i.needsProtoHack.has(t)){const e=new n.constructor;if(n!==t){Object.setPrototypeOf(e,n)}return e}return Object.create(n)}},740:function(e,t,r){const n=r(964);const o=r(826);const s=r(6);const i=r(685);const f={};e.exports=function(e,t,r={}){if(typeof t!=="object"){t=[t]}n(!Array.isArray(t)||t.length,"Values array cannot be empty");if(typeof e==="string"){return f.string(e,t,r)}if(Array.isArray(e)){return f.array(e,t,r)}n(typeof e==="object","Reference must be string or an object");return f.object(e,t,r)};f.array=function(e,t,r){if(!Array.isArray(t)){t=[t]}if(!e.length){return false}if(r.only&&r.once&&e.length!==t.length){return false}let n;const o=new Map;for(const e of t){if(!r.deep||!e||typeof e!=="object"){const t=o.get(e);if(t){++t.allowed}else{o.set(e,{allowed:1,hits:0})}}else{n=n??f.compare(r);let t=false;for(const[r,s]of o.entries()){if(n(r,e)){++s.allowed;t=true;break}}if(!t){o.set(e,{allowed:1,hits:0})}}}let s=0;for(const t of e){let e;if(!r.deep||!t||typeof t!=="object"){e=o.get(t)}else{n=n??f.compare(r);for(const[r,s]of o.entries()){if(n(r,t)){e=s;break}}}if(e){++e.hits;++s;if(r.once&&e.hits>e.allowed){return false}}}if(r.only&&s!==e.length){return false}for(const e of o.values()){if(e.hits===e.allowed){continue}if(e.hits<e.allowed&&!r.part){return false}}return!!s};f.object=function(e,t,r){n(r.once===undefined,"Cannot use option once with object");const o=i.keys(e,r);if(!o.length){return false}if(Array.isArray(t)){return f.array(o,t,r)}const s=Object.getOwnPropertySymbols(t).filter((e=>t.propertyIsEnumerable(e)));const c=[...Object.keys(t),...s];const a=f.compare(r);const u=new Set(c);for(const n of o){if(!u.has(n)){if(r.only){return false}continue}if(!a(t[n],e[n])){return false}u.delete(n)}if(u.size){return r.part?u.size<c.length:false}return true};f.string=function(e,t,r){if(e===""){return t.length===1&&t[0]===""||!r.once&&!t.some((e=>e!==""))}const o=new Map;const i=[];for(const e of t){n(typeof e==="string","Cannot compare string reference to non-string value");if(e){const t=o.get(e);if(t){++t.allowed}else{o.set(e,{allowed:1,hits:0});i.push(s(e))}}else if(r.once||r.only){return false}}if(!i.length){return true}const f=new RegExp(`(${i.join("|")})`,"g");const c=e.replace(f,((e,t)=>{++o.get(t).hits;return""}));if(r.only&&c){return false}let a=false;for(const e of o.values()){if(e.hits){a=true}if(e.hits===e.allowed){continue}if(e.hits<e.allowed&&!r.part){return false}if(r.once){return false}}return!!a};f.compare=function(e){if(!e.deep){return f.shallow}const t=e.only!==undefined;const r=e.part!==undefined;const n={prototype:t?e.only:r?!e.part:false,part:t?!e.only:r?e.part:false};return(e,t)=>o(e,t,n)};f.shallow=function(e,t){return e===t}},826:function(e,t,r){const n=r(193);const o={mismatched:null};e.exports=function(e,t,r){r=Object.assign({prototype:true},r);return!!o.isDeepEqual(e,t,r,[])};o.isDeepEqual=function(e,t,r,s){if(e===t){return e!==0||1/e===1/t}const i=typeof e;if(i!==typeof t){return false}if(e===null||t===null){return false}if(i==="function"){if(!r.deepFunction||e.toString()!==t.toString()){return false}}else if(i!=="object"){return e!==e&&t!==t}const f=o.getSharedType(e,t,!!r.prototype);switch(f){case n.buffer:return Buffer&&Buffer.prototype.equals.call(e,t);case n.promise:return e===t;case n.regex:case n.url:return e.toString()===t.toString();case o.mismatched:return false}for(let r=s.length-1;r>=0;--r){if(s[r].isSame(e,t)){return true}}s.push(new o.SeenEntry(e,t));try{return!!o.isDeepEqualObj(f,e,t,r,s)}finally{s.pop()}};o.getSharedType=function(e,t,r){if(r){if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)){return o.mismatched}return n.getInternalProto(e)}const s=n.getInternalProto(e);if(s!==n.getInternalProto(t)){return o.mismatched}return s};o.valueOf=function(e){const t=e.valueOf;if(t===undefined){return e}try{return t.call(e)}catch(e){return e}};o.hasOwnEnumerableProperty=function(e,t){return Object.prototype.propertyIsEnumerable.call(e,t)};o.isSetSimpleEqual=function(e,t){for(const r of Set.prototype.values.call(e)){if(!Set.prototype.has.call(t,r)){return false}}return true};o.isDeepEqualObj=function(e,t,r,s,i){const{isDeepEqual:f,valueOf:c,hasOwnEnumerableProperty:a}=o;const{keys:u,getOwnPropertySymbols:l}=Object;if(e===n.array){if(s.part){for(const e of t){for(const t of r){if(f(e,t,s,i)){return true}}}}else{if(t.length!==r.length){return false}for(let e=0;e<t.length;++e){if(!f(t[e],r[e],s,i)){return false}}return true}}else if(e===n.set){if(t.size!==r.size){return false}if(!o.isSetSimpleEqual(t,r)){const e=new Set(Set.prototype.values.call(r));for(const r of Set.prototype.values.call(t)){if(e.delete(r)){continue}let t=false;for(const n of e){if(f(r,n,s,i)){e.delete(n);t=true;break}}if(!t){return false}}}}else if(e===n.map){if(t.size!==r.size){return false}for(const[e,n]of Map.prototype.entries.call(t)){if(n===undefined&&!Map.prototype.has.call(r,e)){return false}if(!f(n,Map.prototype.get.call(r,e),s,i)){return false}}}else if(e===n.error){if(t.name!==r.name||t.message!==r.message){return false}}const p=c(t);const y=c(r);if((t!==p||r!==y)&&!f(p,y,s,i)){return false}const h=u(t);if(!s.part&&h.length!==u(r).length&&!s.skip){return false}let d=0;for(const e of h){if(s.skip&&s.skip.includes(e)){if(r[e]===undefined){++d}continue}if(!a(r,e)){return false}if(!f(t[e],r[e],s,i)){return false}}if(!s.part&&h.length-d!==u(r).length){return false}if(s.symbols!==false){const e=l(t);const n=new Set(l(r));for(const o of e){if(!s.skip?.includes(o)){if(a(t,o)){if(!a(r,o)){return false}if(!f(t[o],r[o],s,i)){return false}}else if(a(r,o)){return false}}n.delete(o)}for(const e of n){if(a(r,e)){return false}}}return true};o.SeenEntry=class{constructor(e,t){this.obj=e;this.ref=t}isSame(e,t){return this.obj===e&&this.ref===t}}},810:function(e,t,r){const n=r(964);const o={};e.exports=function(e){n(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~\"\\]*$/.test(e),"Bad attribute value ("+e+")");return e.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')}},52:function(e){const t={};e.exports=function(e){if(!e){return""}let r="";for(let n=0;n<e.length;++n){const o=e.charCodeAt(n);if(t.isSafe(o)){r+=e[n]}else{r+=t.escapeHtmlChar(o)}}return r};t.escapeHtmlChar=function(e){const r=t.namedHtml.get(e);if(r){return r}if(e>=256){return"&#"+e+";"}const n=e.toString(16).padStart(2,"0");return`&#x${n};`};t.isSafe=function(e){return t.safeCharCodes.has(e)};t.namedHtml=new Map([[38,"&"],[60,"<"],[62,">"],[34,"""],[160," "],[162,"¢"],[163,"£"],[164,"¤"],[169,"©"],[174,"®"]]);t.safeCharCodes=function(){const e=new Set;for(let t=32;t<123;++t){if(t>=97||t>=65&&t<=90||t>=48&&t<=57||t===32||t===46||t===44||t===45||t===58||t===95){e.add(t)}}return e}()},555:function(e){const t={};e.exports=function(e){if(!e){return""}return e.replace(/[<>&\u2028\u2029]/g,t.escape)};t.escape=function(e){return t.replacements.get(e)};t.replacements=new Map([["<","\\u003c"],[">","\\u003e"],["&","\\u0026"],["\u2028","\\u2028"],["\u2029","\\u2029"]])},6:function(e){const t={};e.exports=function(e){return e.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},742:function(e){const t={};e.exports=t.flatten=function(e,r){const n=r||[];for(const r of e){if(Array.isArray(r)){t.flatten(r,n)}else{n.push(r)}}return n}},4:function(e){const t={};e.exports=function(){}},940:function(e,t,r){t.applyToDefaults=r(299);t.assert=r(964);t.AssertError=r(116);t.Bench=r(62);t.block=r(977);t.clone=r(425);t.contain=r(740);t.deepEqual=r(826);t.escapeHeaderAttribute=r(810);t.escapeHtml=r(52);t.escapeJson=r(555);t.escapeRegex=r(6);t.flatten=r(742);t.ignore=r(4);t.intersect=r(205);t.isPromise=r(569);t.merge=r(32);t.once=r(7);t.reach=r(435);t.reachTemplate=r(481);t.stringify=r(561);t.wait=r(851)},205:function(e){const t={};e.exports=function(e,r,n={}){if(!e||!r){return n.first?null:[]}const o=[];const s=Array.isArray(e)?new Set(e):e;const i=new Set;for(const e of r){if(t.has(s,e)&&!i.has(e)){if(n.first){return e}o.push(e);i.add(e)}}return n.first?null:o};t.has=function(e,t){if(typeof e.has==="function"){return e.has(t)}return e[t]!==undefined}},569:function(e){const t={};e.exports=function(e){return typeof e?.then==="function"}},32:function(e,t,r){const n=r(964);const o=r(425);const s=r(685);const i={};e.exports=i.merge=function(e,t,r){n(e&&typeof e==="object","Invalid target value: must be an object");n(t===null||t===undefined||typeof t==="object","Invalid source value: must be null, undefined, or an object");if(!t){return e}r=Object.assign({nullOverride:true,mergeArrays:true},r);if(Array.isArray(t)){n(Array.isArray(e),"Cannot merge array onto an object");if(!r.mergeArrays){e.length=0}for(let n=0;n<t.length;++n){e.push(o(t[n],{symbols:r.symbols}))}return e}const f=s.keys(t,r);for(let n=0;n<f.length;++n){const s=f[n];if(s==="__proto__"||!Object.prototype.propertyIsEnumerable.call(t,s)){continue}const c=t[s];if(c&&typeof c==="object"){if(e[s]===c){continue}if(!e[s]||typeof e[s]!=="object"||Array.isArray(e[s])!==Array.isArray(c)||c instanceof Date||Buffer&&Buffer.isBuffer(c)||c instanceof RegExp){e[s]=o(c,{symbols:r.symbols})}else{i.merge(e[s],c,r)}}else{if(c!==null&&c!==undefined){e[s]=c}else if(r.nullOverride){e[s]=c}}}return e}},7:function(e){const t={wrapped:Symbol("wrapped")};e.exports=function(e){if(e[t.wrapped]){return e}let r=false;const wrappedFn=function(...t){if(!r){r=true;e(...t)}};wrappedFn[t.wrapped]=true;return wrappedFn}},435:function(e,t,r){const n=r(964);const o={};e.exports=function(e,t,r){if(t===false||t===null||t===undefined){return e}r=r||{};if(typeof r==="string"){r={separator:r}}const s=Array.isArray(t);n(!s||!r.separator,"Separator option is not valid for array-based chain");const i=s?t:t.split(r.separator||".");let f=e;for(let e=0;e<i.length;++e){let s=i[e];const c=r.iterables&&o.iterables(f);if(Array.isArray(f)||c==="set"){const e=Number(s);if(Number.isInteger(e)){s=e<0?f.length+e:e}}if(!f||typeof f==="function"&&r.functions===false||!c&&f[s]===undefined){n(!r.strict||e+1===i.length,"Missing segment",s,"in reach path ",t);n(typeof f==="object"||r.functions===true||typeof f!=="function","Invalid segment",s,"in reach path ",t);f=r.default;break}if(!c){f=f[s]}else if(c==="set"){f=[...f][s]}else{f=f.get(s)}}return f};o.iterables=function(e){if(e instanceof Set){return"set"}if(e instanceof Map){return"map"}}},481:function(e,t,r){const n=r(435);const o={};e.exports=function(e,t,r){return t.replace(/{([^{}]+)}/g,((t,o)=>{const s=n(e,o,r);return s??""}))}},561:function(e){const t={};e.exports=function(...e){try{return JSON.stringify(...e)}catch(e){return"[Cannot display object: "+e.message+"]"}}},193:function(e,t){const r={};t=e.exports={array:Array.prototype,buffer:Buffer&&Buffer.prototype,date:Date.prototype,error:Error.prototype,generic:Object.prototype,map:Map.prototype,promise:Promise.prototype,regex:RegExp.prototype,set:Set.prototype,url:URL.prototype,weakMap:WeakMap.prototype,weakSet:WeakSet.prototype};r.typeMap=new Map([["[object Error]",t.error],["[object Map]",t.map],["[object Promise]",t.promise],["[object Set]",t.set],["[object URL]",t.url],["[object WeakMap]",t.weakMap],["[object WeakSet]",t.weakSet]]);t.getInternalProto=function(e){if(Array.isArray(e)){return t.array}if(Buffer&&e instanceof Buffer){return t.buffer}if(e instanceof Date){return t.date}if(e instanceof RegExp){return t.regex}if(e instanceof Error){return t.error}const n=Object.prototype.toString.call(e);return r.typeMap.get(n)||t.generic}},685:function(e,t){const r={};t.keys=function(e,t={}){return t.symbols!==false?Reflect.ownKeys(e):Object.getOwnPropertyNames(e)}},851:function(e){const t={maxTimer:2**31-1};e.exports=function(e,r,n){if(typeof e==="bigint"){e=Number(e)}if(e>=Number.MAX_SAFE_INTEGER){e=Infinity}if(typeof e!=="number"&&e!==undefined){throw new TypeError("Timeout must be a number or bigint")}return new Promise((o=>{const s=n?n.setTimeout:setTimeout;const activate=()=>{const n=Math.min(e,t.maxTimer);e-=n;s((()=>e>0?activate():o(r)),n)};if(e!==Infinity){activate()}}))}}};var t={};function __nccwpck_require__(r){var n=t[r];if(n!==undefined){return n.exports}var o=t[r]={exports:{}};var s=true;try{e[r](o,o.exports,__nccwpck_require__);s=false}finally{if(s)delete t[r]}return o.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r={};!function(){var e=r;const{assert:t}=__nccwpck_require__(940);const n={};e.Sorter=class{constructor(){this._items=[];this.nodes=[]}add(e,r){r=r??{};const n=[].concat(r.before??[]);const o=[].concat(r.after??[]);const s=r.group??"?";const i=r.sort??0;t(!n.includes(s),`Item cannot come before itself: ${s}`);t(!n.includes("?"),"Item cannot come before unassociated items");t(!o.includes(s),`Item cannot come after itself: ${s}`);t(!o.includes("?"),"Item cannot come after unassociated items");if(!Array.isArray(e)){e=[e]}for(const t of e){const e={seq:this._items.length,sort:i,before:n,after:o,group:s,node:t};this._items.push(e)}if(!r.manual){const e=this._sort();t(e,"item",s!=="?"?`added into group ${s}`:"","created a dependencies error")}return this.nodes}merge(e){if(!Array.isArray(e)){e=[e]}for(const t of e){if(t){for(const e of t._items){this._items.push(Object.assign({},e))}}}this._items.sort(n.mergeSort);for(let e=0;e<this._items.length;++e){this._items[e].seq=e}const r=this._sort();t(r,"merge created a dependencies error");return this.nodes}sort(){const e=this._sort();t(e,"sort created a dependencies error");return this.nodes}_sort(){const e={};const t=Object.create(null);const r=Object.create(null);for(const n of this._items){const o=n.seq;const s=n.group;r[s]=r[s]??[];r[s].push(o);e[o]=n.before;for(const e of n.after){t[e]=t[e]??[];t[e].push(o)}}for(const t in e){const n=[];for(const o in e[t]){const s=e[t][o];r[s]=r[s]??[];n.push(...r[s])}e[t]=n}for(const n in t){if(r[n]){for(const o of r[n]){e[o].push(...t[n])}}}const n={};for(const t in e){const r=e[t];for(const e of r){n[e]=n[e]??[];n[e].push(t)}}const o={};const s=[];for(let e=0;e<this._items.length;++e){let t=e;if(n[e]){t=null;for(let e=0;e<this._items.length;++e){if(o[e]===true){continue}if(!n[e]){n[e]=[]}const r=n[e].length;let s=0;for(let t=0;t<r;++t){if(o[n[e][t]]){++s}}if(s===r){t=e;break}}}if(t!==null){o[t]=true;s.push(t)}}if(s.length!==this._items.length){return false}const i={};for(const e of this._items){i[e.seq]=e}this._items=[];this.nodes=[];for(const e of s){const t=i[e];this.nodes.push(t.node);this._items.push(t)}return true}};n.mergeSort=(e,t)=>e.sort===t.sort?0:e.sort<t.sort?-1:1}();module.exports=r})();
|
|
1
|
+
(function(){"use strict";var e={974:function(e,t,r){const n=r(163);const o=r(864);const s=r(137);const i=r(614);const f={};e.exports=function(e,t,r={}){n(e&&typeof e==="object","Invalid defaults value: must be an object");n(!t||t===true||typeof t==="object","Invalid source value: must be true, falsy or an object");n(typeof r==="object","Invalid options: must be an object");if(!t){return null}if(r.shallow){return f.applyToDefaultsWithShallow(e,t,r)}const i=o(e);if(t===true){return i}const c=r.nullOverride!==undefined?r.nullOverride:false;return s(i,t,{nullOverride:c,mergeArrays:false})};f.applyToDefaultsWithShallow=function(e,t,r){const c=r.shallow;n(Array.isArray(c),"Invalid keys");const a=new Map;const u=t===true?null:new Set;for(let r of c){r=Array.isArray(r)?r:r.split(".");const n=i(e,r);if(n&&typeof n==="object"){a.set(n,u&&i(t,r)||n)}else if(u){u.add(r)}}const l=o(e,{},a);if(!u){return l}for(const e of u){f.reachCopy(l,t,e)}const p=r.nullOverride!==undefined?r.nullOverride:false;return s(l,t,{nullOverride:p,mergeArrays:false})};f.reachCopy=function(e,t,r){for(const e of r){if(!(e in t)){return}const r=t[e];if(typeof r!=="object"||r===null){return}t=r}const n=t;let o=e;for(let e=0;e<r.length-1;++e){const t=r[e];if(typeof o[t]!=="object"){o[t]={}}o=o[t]}o[r[r.length-1]]=n}},163:function(e,t,r){const n=r(277);const o=r(52);const s={};const i=e.exports=function(e,...t){if(e){return}if(t.length===1&&t[0]instanceof Error){throw t[0]}const r=t.filter((e=>e!=="")).map((e=>typeof e==="string"?e:e instanceof Error?e.message:o(e)));throw new n(r.join(" "),i)}},277:function(e){const t={};e.exports=class AssertError extends Error{name="AssertError";constructor(e,t){super(e||"Unknown error");if(typeof Error.captureStackTrace==="function"){Error.captureStackTrace(this,t)}}}},715:function(e){const t={};e.exports=t.Bench=class{constructor(){this.ts=0;this.reset()}reset(){this.ts=t.Bench.now()}elapsed(){return t.Bench.now()-this.ts}static now(){const e=process.hrtime();return e[0]*1e3+e[1]/1e6}}},712:function(e,t,r){const n=r(495);const o={};e.exports=function(){return new Promise(n)}},864:function(e,t,r){const n=r(614);const o=r(876);const s=r(960);const i={needsProtoHack:new Set([o.set,o.map,o.weakSet,o.weakMap]),structuredCloneExists:typeof structuredClone==="function"};e.exports=i.clone=function(e,t={},r=null){if(typeof e!=="object"||e===null){return e}let n=i.clone;let f=r;if(t.shallow){if(t.shallow!==true){return i.cloneWithShallow(e,t)}n=e=>e}else if(f){const t=f.get(e);if(t){return t}}else{f=new Map}const c=o.getInternalProto(e);switch(c){case o.buffer:return Buffer?.from(e);case o.date:return new Date(e.getTime());case o.regex:case o.url:return new c.constructor(e)}const a=i.base(e,c,t);if(a===e){return e}if(f){f.set(e,a)}if(c===o.set){for(const r of e){a.add(n(r,t,f))}}else if(c===o.map){for(const[r,o]of e){a.set(r,n(o,t,f))}}const u=s.keys(e,t);for(const r of u){if(r==="__proto__"){continue}if(c===o.array&&r==="length"){a.length=e.length;continue}if(i.structuredCloneExists&&c===o.error&&r==="stack"){continue}const s=Object.getOwnPropertyDescriptor(e,r);if(s){if(s.get||s.set){Object.defineProperty(a,r,s)}else if(s.enumerable){a[r]=n(e[r],t,f)}else{Object.defineProperty(a,r,{enumerable:false,writable:true,configurable:true,value:n(e[r],t,f)})}}else{Object.defineProperty(a,r,{enumerable:true,writable:true,configurable:true,value:n(e[r],t,f)})}}return a};i.cloneWithShallow=function(e,t){const r=t.shallow;t=Object.assign({},t);t.shallow=false;const o=new Map;for(const t of r){const r=n(e,t);if(typeof r==="object"||typeof r==="function"){o.set(r,r)}}return i.clone(e,t,o)};i.base=function(e,t,r){if(r.prototype===false){if(i.needsProtoHack.has(t)){return new t.constructor}return t===o.array?[]:{}}const n=Object.getPrototypeOf(e);if(n&&n.isImmutable){return e}if(t===o.array){const e=[];if(n!==t){Object.setPrototypeOf(e,n)}return e}else if(t===o.error&&i.structuredCloneExists&&(n===t||Error.isPrototypeOf(n.constructor))){const t=structuredClone(e);if(Object.getPrototypeOf(t)!==n){Object.setPrototypeOf(t,n)}return t}if(i.needsProtoHack.has(t)){const e=new n.constructor;if(n!==t){Object.setPrototypeOf(e,n)}return e}return Object.create(n)}},749:function(e,t,r){const n=r(163);const o=r(96);const s=r(819);const i=r(960);const f={};e.exports=function(e,t,r={}){if(typeof t!=="object"){t=[t]}n(!Array.isArray(t)||t.length,"Values array cannot be empty");if(typeof e==="string"){return f.string(e,t,r)}if(Array.isArray(e)){return f.array(e,t,r)}n(typeof e==="object","Reference must be string or an object");return f.object(e,t,r)};f.array=function(e,t,r){if(!Array.isArray(t)){t=[t]}if(!e.length){return false}if(r.only&&r.once&&e.length!==t.length){return false}let n;const o=new Map;for(const e of t){if(!r.deep||!e||typeof e!=="object"){const t=o.get(e);if(t){++t.allowed}else{o.set(e,{allowed:1,hits:0})}}else{n=n??f.compare(r);let t=false;for(const[r,s]of o.entries()){if(n(r,e)){++s.allowed;t=true;break}}if(!t){o.set(e,{allowed:1,hits:0})}}}let s=0;for(const t of e){let e;if(!r.deep||!t||typeof t!=="object"){e=o.get(t)}else{n=n??f.compare(r);for(const[r,s]of o.entries()){if(n(r,t)){e=s;break}}}if(e){++e.hits;++s;if(r.once&&e.hits>e.allowed){return false}}}if(r.only&&s!==e.length){return false}for(const e of o.values()){if(e.hits===e.allowed){continue}if(e.hits<e.allowed&&!r.part){return false}}return!!s};f.object=function(e,t,r){n(r.once===undefined,"Cannot use option once with object");const o=i.keys(e,r);if(!o.length){return false}if(Array.isArray(t)){return f.array(o,t,r)}const s=Object.getOwnPropertySymbols(t).filter((e=>t.propertyIsEnumerable(e)));const c=[...Object.keys(t),...s];const a=f.compare(r);const u=new Set(c);for(const n of o){if(!u.has(n)){if(r.only){return false}continue}if(!a(t[n],e[n])){return false}u.delete(n)}if(u.size){return r.part?u.size<c.length:false}return true};f.string=function(e,t,r){if(e===""){return t.length===1&&t[0]===""||!r.once&&!t.some((e=>e!==""))}const o=new Map;const i=[];for(const e of t){n(typeof e==="string","Cannot compare string reference to non-string value");if(e){const t=o.get(e);if(t){++t.allowed}else{o.set(e,{allowed:1,hits:0});i.push(s(e))}}else if(r.once||r.only){return false}}if(!i.length){return true}const f=new RegExp(`(${i.join("|")})`,"g");const c=e.replace(f,((e,t)=>{++o.get(t).hits;return""}));if(r.only&&c){return false}let a=false;for(const e of o.values()){if(e.hits){a=true}if(e.hits===e.allowed){continue}if(e.hits<e.allowed&&!r.part){return false}if(r.once){return false}}return!!a};f.compare=function(e){if(!e.deep){return f.shallow}const t=e.only!==undefined;const r=e.part!==undefined;const n={prototype:t?e.only:r?!e.part:false,part:t?!e.only:r?e.part:false};return(e,t)=>o(e,t,n)};f.shallow=function(e,t){return e===t}},96:function(e,t,r){const n=r(876);const o={mismatched:null};e.exports=function(e,t,r){r=Object.assign({prototype:true},r);return!!o.isDeepEqual(e,t,r,[])};o.isDeepEqual=function(e,t,r,s){if(e===t){return e!==0||1/e===1/t}const i=typeof e;if(i!==typeof t){return false}if(e===null||t===null){return false}if(i==="function"){if(!r.deepFunction||e.toString()!==t.toString()){return false}}else if(i!=="object"){return e!==e&&t!==t}const f=o.getSharedType(e,t,!!r.prototype);switch(f){case n.buffer:return Buffer&&Buffer.prototype.equals.call(e,t);case n.promise:return e===t;case n.regex:case n.url:return e.toString()===t.toString();case o.mismatched:return false}for(let r=s.length-1;r>=0;--r){if(s[r].isSame(e,t)){return true}}s.push(new o.SeenEntry(e,t));try{return!!o.isDeepEqualObj(f,e,t,r,s)}finally{s.pop()}};o.getSharedType=function(e,t,r){if(r){if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)){return o.mismatched}return n.getInternalProto(e)}const s=n.getInternalProto(e);if(s!==n.getInternalProto(t)){return o.mismatched}return s};o.valueOf=function(e){const t=e.valueOf;if(t===undefined){return e}try{return t.call(e)}catch(e){return e}};o.hasOwnEnumerableProperty=function(e,t){return Object.prototype.propertyIsEnumerable.call(e,t)};o.isSetSimpleEqual=function(e,t){for(const r of Set.prototype.values.call(e)){if(!Set.prototype.has.call(t,r)){return false}}return true};o.isDeepEqualObj=function(e,t,r,s,i){const{isDeepEqual:f,valueOf:c,hasOwnEnumerableProperty:a}=o;const{keys:u,getOwnPropertySymbols:l}=Object;if(e===n.array){if(s.part){for(const e of t){for(const t of r){if(f(e,t,s,i)){return true}}}}else{if(t.length!==r.length){return false}for(let e=0;e<t.length;++e){if(!f(t[e],r[e],s,i)){return false}}return true}}else if(e===n.set){if(t.size!==r.size){return false}if(!o.isSetSimpleEqual(t,r)){const e=new Set(Set.prototype.values.call(r));for(const r of Set.prototype.values.call(t)){if(e.delete(r)){continue}let t=false;for(const n of e){if(f(r,n,s,i)){e.delete(n);t=true;break}}if(!t){return false}}}}else if(e===n.map){if(t.size!==r.size){return false}for(const[e,n]of Map.prototype.entries.call(t)){if(n===undefined&&!Map.prototype.has.call(r,e)){return false}if(!f(n,Map.prototype.get.call(r,e),s,i)){return false}}}else if(e===n.error){if(t.name!==r.name||t.message!==r.message){return false}}const p=c(t);const y=c(r);if((t!==p||r!==y)&&!f(p,y,s,i)){return false}const h=u(t);if(!s.part&&h.length!==u(r).length&&!s.skip){return false}let d=0;for(const e of h){if(s.skip&&s.skip.includes(e)){if(r[e]===undefined){++d}continue}if(!a(r,e)){return false}if(!f(t[e],r[e],s,i)){return false}}if(!s.part&&h.length-d!==u(r).length){return false}if(s.symbols!==false){const e=l(t);const n=new Set(l(r));for(const o of e){if(!s.skip?.includes(o)){if(a(t,o)){if(!a(r,o)){return false}if(!f(t[o],r[o],s,i)){return false}}else if(a(r,o)){return false}}n.delete(o)}for(const e of n){if(a(r,e)){return false}}}return true};o.SeenEntry=class{constructor(e,t){this.obj=e;this.ref=t}isSame(e,t){return this.obj===e&&this.ref===t}}},235:function(e,t,r){const n=r(163);const o={};e.exports=function(e){n(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~\"\\]*$/.test(e),"Bad attribute value ("+e+")");return e.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')}},803:function(e){const t={};e.exports=function(e){if(!e){return""}let r="";for(let n=0;n<e.length;++n){const o=e.charCodeAt(n);if(t.isSafe(o)){r+=e[n]}else{r+=t.escapeHtmlChar(o)}}return r};t.escapeHtmlChar=function(e){const r=t.namedHtml.get(e);if(r){return r}if(e>=256){return"&#"+e+";"}const n=e.toString(16).padStart(2,"0");return`&#x${n};`};t.isSafe=function(e){return t.safeCharCodes.has(e)};t.namedHtml=new Map([[38,"&"],[60,"<"],[62,">"],[34,"""],[160," "],[162,"¢"],[163,"£"],[164,"¤"],[169,"©"],[174,"®"]]);t.safeCharCodes=function(){const e=new Set;for(let t=32;t<123;++t){if(t>=97||t>=65&&t<=90||t>=48&&t<=57||t===32||t===46||t===44||t===45||t===58||t===95){e.add(t)}}return e}()},724:function(e){const t={};e.exports=function(e){if(!e){return""}return e.replace(/[<>&\u2028\u2029]/g,t.escape)};t.escape=function(e){return t.replacements.get(e)};t.replacements=new Map([["<","\\u003c"],[">","\\u003e"],["&","\\u0026"],["\u2028","\\u2028"],["\u2029","\\u2029"]])},819:function(e){const t={};e.exports=function(e){return e.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},847:function(e){const t={};e.exports=t.flatten=function(e,r){const n=r||[];for(const r of e){if(Array.isArray(r)){t.flatten(r,n)}else{n.push(r)}}return n}},495:function(e){const t={};e.exports=function(){}},525:function(e,t,r){t.applyToDefaults=r(974);t.assert=r(163);t.AssertError=r(277);t.Bench=r(715);t.block=r(712);t.clone=r(864);t.contain=r(749);t.deepEqual=r(96);t.escapeHeaderAttribute=r(235);t.escapeHtml=r(803);t.escapeJson=r(724);t.escapeRegex=r(819);t.flatten=r(847);t.ignore=r(495);t.intersect=r(500);t.isPromise=r(416);t.merge=r(137);t.once=r(264);t.reach=r(614);t.reachTemplate=r(576);t.stringify=r(52);t.wait=r(64)},500:function(e){const t={};e.exports=function(e,r,n={}){if(!e||!r){return n.first?null:[]}const o=[];const s=Array.isArray(e)?new Set(e):e;const i=new Set;for(const e of r){if(t.has(s,e)&&!i.has(e)){if(n.first){return e}o.push(e);i.add(e)}}return n.first?null:o};t.has=function(e,t){if(typeof e.has==="function"){return e.has(t)}return e[t]!==undefined}},416:function(e){const t={};e.exports=function(e){return typeof e?.then==="function"}},137:function(e,t,r){const n=r(163);const o=r(864);const s=r(960);const i={};e.exports=i.merge=function(e,t,r){n(e&&typeof e==="object","Invalid target value: must be an object");n(t===null||t===undefined||typeof t==="object","Invalid source value: must be null, undefined, or an object");if(!t){return e}r=Object.assign({nullOverride:true,mergeArrays:true},r);if(Array.isArray(t)){n(Array.isArray(e),"Cannot merge array onto an object");if(!r.mergeArrays){e.length=0}for(let n=0;n<t.length;++n){e.push(o(t[n],{symbols:r.symbols}))}return e}const f=s.keys(t,r);for(let n=0;n<f.length;++n){const s=f[n];if(s==="__proto__"||!Object.prototype.propertyIsEnumerable.call(t,s)){continue}const c=t[s];if(c&&typeof c==="object"){if(e[s]===c){continue}if(!e[s]||typeof e[s]!=="object"||Array.isArray(e[s])!==Array.isArray(c)||c instanceof Date||Buffer&&Buffer.isBuffer(c)||c instanceof RegExp){e[s]=o(c,{symbols:r.symbols})}else{i.merge(e[s],c,r)}}else{if(c!==null&&c!==undefined){e[s]=c}else if(r.nullOverride){e[s]=c}}}return e}},264:function(e){const t={wrapped:Symbol("wrapped")};e.exports=function(e){if(e[t.wrapped]){return e}let r=false;const wrappedFn=function(...t){if(!r){r=true;e(...t)}};wrappedFn[t.wrapped]=true;return wrappedFn}},614:function(e,t,r){const n=r(163);const o={};e.exports=function(e,t,r){if(t===false||t===null||t===undefined){return e}r=r||{};if(typeof r==="string"){r={separator:r}}const s=Array.isArray(t);n(!s||!r.separator,"Separator option is not valid for array-based chain");const i=s?t:t.split(r.separator||".");let f=e;for(let e=0;e<i.length;++e){let s=i[e];const c=r.iterables&&o.iterables(f);if(Array.isArray(f)||c==="set"){const e=Number(s);if(Number.isInteger(e)){s=e<0?f.length+e:e}}if(!f||typeof f==="function"&&r.functions===false||!c&&f[s]===undefined){n(!r.strict||e+1===i.length,"Missing segment",s,"in reach path ",t);n(typeof f==="object"||r.functions===true||typeof f!=="function","Invalid segment",s,"in reach path ",t);f=r.default;break}if(!c){f=f[s]}else if(c==="set"){f=[...f][s]}else{f=f.get(s)}}return f};o.iterables=function(e){if(e instanceof Set){return"set"}if(e instanceof Map){return"map"}}},576:function(e,t,r){const n=r(614);const o={};e.exports=function(e,t,r){return t.replace(/{([^{}]+)}/g,((t,o)=>{const s=n(e,o,r);return s??""}))}},52:function(e){const t={};e.exports=function(...e){try{return JSON.stringify(...e)}catch(e){return"[Cannot display object: "+e.message+"]"}}},876:function(e,t){const r={};t=e.exports={array:Array.prototype,buffer:Buffer&&Buffer.prototype,date:Date.prototype,error:Error.prototype,generic:Object.prototype,map:Map.prototype,promise:Promise.prototype,regex:RegExp.prototype,set:Set.prototype,url:URL.prototype,weakMap:WeakMap.prototype,weakSet:WeakSet.prototype};r.typeMap=new Map([["[object Error]",t.error],["[object Map]",t.map],["[object Promise]",t.promise],["[object Set]",t.set],["[object URL]",t.url],["[object WeakMap]",t.weakMap],["[object WeakSet]",t.weakSet]]);t.getInternalProto=function(e){if(Array.isArray(e)){return t.array}if(Buffer&&e instanceof Buffer){return t.buffer}if(e instanceof Date){return t.date}if(e instanceof RegExp){return t.regex}if(e instanceof Error){return t.error}const n=Object.prototype.toString.call(e);return r.typeMap.get(n)||t.generic}},960:function(e,t){const r={};t.keys=function(e,t={}){return t.symbols!==false?Reflect.ownKeys(e):Object.getOwnPropertyNames(e)}},64:function(e){const t={maxTimer:2**31-1};e.exports=function(e,r,n){if(typeof e==="bigint"){e=Number(e)}if(e>=Number.MAX_SAFE_INTEGER){e=Infinity}if(typeof e!=="number"&&e!==undefined){throw new TypeError("Timeout must be a number or bigint")}return new Promise((o=>{const s=n?n.setTimeout:setTimeout;const activate=()=>{const n=Math.min(e,t.maxTimer);e-=n;s((()=>e>0?activate():o(r)),n)};if(e!==Infinity){activate()}}))}}};var t={};function __nccwpck_require__(r){var n=t[r];if(n!==undefined){return n.exports}var o=t[r]={exports:{}};var s=true;try{e[r](o,o.exports,__nccwpck_require__);s=false}finally{if(s)delete t[r]}return o.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r={};!function(){var e=r;const{assert:t}=__nccwpck_require__(525);const n={};e.Sorter=class{constructor(){this._items=[];this.nodes=[]}add(e,r){r=r??{};const n=[].concat(r.before??[]);const o=[].concat(r.after??[]);const s=r.group??"?";const i=r.sort??0;t(!n.includes(s),`Item cannot come before itself: ${s}`);t(!n.includes("?"),"Item cannot come before unassociated items");t(!o.includes(s),`Item cannot come after itself: ${s}`);t(!o.includes("?"),"Item cannot come after unassociated items");if(!Array.isArray(e)){e=[e]}for(const t of e){const e={seq:this._items.length,sort:i,before:n,after:o,group:s,node:t};this._items.push(e)}if(!r.manual){const e=this._sort();t(e,"item",s!=="?"?`added into group ${s}`:"","created a dependencies error")}return this.nodes}merge(e){if(!Array.isArray(e)){e=[e]}for(const t of e){if(t){for(const e of t._items){this._items.push(Object.assign({},e))}}}this._items.sort(n.mergeSort);for(let e=0;e<this._items.length;++e){this._items[e].seq=e}const r=this._sort();t(r,"merge created a dependencies error");return this.nodes}sort(){const e=this._sort();t(e,"sort created a dependencies error");return this.nodes}_sort(){const e={};const t=Object.create(null);const r=Object.create(null);for(const n of this._items){const o=n.seq;const s=n.group;r[s]=r[s]??[];r[s].push(o);e[o]=n.before;for(const e of n.after){t[e]=t[e]??[];t[e].push(o)}}for(const t in e){const n=[];for(const o in e[t]){const s=e[t][o];r[s]=r[s]??[];n.push(...r[s])}e[t]=n}for(const n in t){if(r[n]){for(const o of r[n]){e[o].push(...t[n])}}}const n={};for(const t in e){const r=e[t];for(const e of r){n[e]=n[e]??[];n[e].push(t)}}const o={};const s=[];for(let e=0;e<this._items.length;++e){let t=e;if(n[e]){t=null;for(let e=0;e<this._items.length;++e){if(o[e]===true){continue}if(!n[e]){n[e]=[]}const r=n[e].length;let s=0;for(let t=0;t<r;++t){if(o[n[e][t]]){++s}}if(s===r){t=e;break}}}if(t!==null){o[t]=true;s.push(t)}}if(s.length!==this._items.length){return false}const i={};for(const e of this._items){i[e.seq]=e}this._items=[];this.nodes=[];for(const e of s){const t=i[e];this.nodes.push(t.node);this._items.push(t)}return true}};n.mergeSort=(e,t)=>e.sort===t.sort?0:e.sort<t.sort?-1:1}();module.exports=r})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@hapi/topo","description":"Topological sorting with grouping support","version":"6.0.2","repository":"git://github.com/hapijs/topo","main":"lib/index.js","types":"lib/index.d.ts","files":["lib"],"keywords":["topological","sort","toposort","topsort"],"eslintConfig":{"extends":["plugin:@hapi/module"]},"dependencies":{"@hapi/hoek":"^11.0.2"},"devDependencies":{"@hapi/code":"^9.0.3","@hapi/eslint-plugin":"*","@hapi/lab":"^25.1.2","@types/node":"^17.0.31","typescript":"~4.6.4"},"scripts":{"test":"lab -a @hapi/code -t 100 -L -Y","test-cov-html":"lab -a @hapi/code -t 100 -L -r html -o coverage.html"},"license":"BSD-3-Clause","_lastModified":"2025-
|
|
1
|
+
{"name":"@hapi/topo","description":"Topological sorting with grouping support","version":"6.0.2","repository":"git://github.com/hapijs/topo","main":"lib/index.js","types":"lib/index.d.ts","files":["lib"],"keywords":["topological","sort","toposort","topsort"],"eslintConfig":{"extends":["plugin:@hapi/module"]},"dependencies":{"@hapi/hoek":"^11.0.2"},"devDependencies":{"@hapi/code":"^9.0.3","@hapi/eslint-plugin":"*","@hapi/lab":"^25.1.2","@types/node":"^17.0.31","typescript":"~4.6.4"},"scripts":{"test":"lab -a @hapi/code -t 100 -L -Y","test-cov-html":"lab -a @hapi/code -t 100 -L -r html -o coverage.html"},"license":"BSD-3-Clause","_lastModified":"2025-12-05T07:11:37.286Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"archiver","version":"7.0.1","description":"a streaming interface for archive generation","homepage":"https://github.com/archiverjs/node-archiver","author":{"name":"Chris Talkington","url":"http://christalkington.com/"},"repository":{"type":"git","url":"https://github.com/archiverjs/node-archiver.git"},"bugs":{"url":"https://github.com/archiverjs/node-archiver/issues"},"license":"MIT","main":"index.js","files":["index.js","lib"],"engines":{"node":">= 14"},"scripts":{"test":"mocha --reporter dot","bench":"node benchmark/simple/pack-zip.js"},"dependencies":{"archiver-utils":"^5.0.2","async":"^3.2.4","buffer-crc32":"^1.0.0","readable-stream":"^4.0.0","readdir-glob":"^1.1.2","tar-stream":"^3.0.0","zip-stream":"^6.0.1"},"devDependencies":{"archiver-jsdoc-theme":"1.1.3","chai":"4.4.1","jsdoc":"4.0.2","mkdirp":"3.0.1","mocha":"10.3.0","rimraf":"5.0.5","stream-bench":"0.1.2","tar":"6.2.0","yauzl":"3.1.2"},"keywords":["archive","archiver","stream","zip","tar"],"publishConfig":{"registry":"https://registry.npmjs.org/"},"_lastModified":"2025-
|
|
1
|
+
{"name":"archiver","version":"7.0.1","description":"a streaming interface for archive generation","homepage":"https://github.com/archiverjs/node-archiver","author":{"name":"Chris Talkington","url":"http://christalkington.com/"},"repository":{"type":"git","url":"https://github.com/archiverjs/node-archiver.git"},"bugs":{"url":"https://github.com/archiverjs/node-archiver/issues"},"license":"MIT","main":"index.js","files":["index.js","lib"],"engines":{"node":">= 14"},"scripts":{"test":"mocha --reporter dot","bench":"node benchmark/simple/pack-zip.js"},"dependencies":{"archiver-utils":"^5.0.2","async":"^3.2.4","buffer-crc32":"^1.0.0","readable-stream":"^4.0.0","readdir-glob":"^1.1.2","tar-stream":"^3.0.0","zip-stream":"^6.0.1"},"devDependencies":{"archiver-jsdoc-theme":"1.1.3","chai":"4.4.1","jsdoc":"4.0.2","mkdirp":"3.0.1","mocha":"10.3.0","rimraf":"5.0.5","stream-bench":"0.1.2","tar":"6.2.0","yauzl":"3.1.2"},"keywords":["archive","archiver","stream","zip","tar"],"publishConfig":{"registry":"https://registry.npmjs.org/"},"_lastModified":"2025-12-05T07:11:37.188Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"cron-parser","version":"4.9.0","description":"Node.js library for parsing crontab instructions","main":"lib/parser.js","types":"types/index.d.ts","typesVersions":{"<4.1":{"*":["types/ts3/*"]}},"directories":{"test":"test"},"scripts":{"test:tsd":"tsd","test:unit":"TZ=UTC tap ./test/*.js","test:cover":"TZ=UTC tap --coverage-report=html ./test/*.js","lint":"eslint .","lint:fix":"eslint --fix .","test":"npm run lint && npm run test:unit && npm run test:tsd"},"repository":{"type":"git","url":"https://github.com/harrisiirak/cron-parser.git"},"keywords":["cron","crontab","parser"],"author":"Harri Siirak","contributors":["Nicholas Clawson","Daniel Prentis <daniel@salsitasoft.com>","Renault John Lecoultre","Richard Astbury <richard.astbury@gmail.com>","Meaglin Wasabi <Meaglin.wasabi@gmail.com>","Mike Kusold <hello@mikekusold.com>","Alex Kit <alex.kit@atmajs.com>","Santiago Gimeno <santiago.gimeno@gmail.com>","Daniel <darc.tec@gmail.com>","Christian Steininger <christian.steininger.cs@gmail.com>","Mykola Piskovyi <m.piskovyi@gmail.com>","Brian Vaughn <brian.david.vaughn@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Yasuhiroki <yasuhiroki.duck@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Brendan Warkentin <faazshift@gmail.com>","Charlie Fish <fishcharlie.code@gmail.com>","Ian Graves <ian+diskimage@iangrav.es>","Andy Thompson <me@andytson.com>","Regev Brody <regevbr@gmail.com>"],"license":"MIT","dependencies":{"luxon":"^3.2.1"},"devDependencies":{"eslint":"^8.27.0","sinon":"^15.0.1","tap":"^16.3.3","tsd":"^0.26.0"},"engines":{"node":">=12.0.0"},"browser":{"fs":false},"tap":{"check-coverage":false},"tsd":{"directory":"test","compilerOptions":{"lib":["es2017","dom"]}},"files":["lib","types","LICENSE","README.md"],"_lastModified":"2025-
|
|
1
|
+
{"name":"cron-parser","version":"4.9.0","description":"Node.js library for parsing crontab instructions","main":"lib/parser.js","types":"types/index.d.ts","typesVersions":{"<4.1":{"*":["types/ts3/*"]}},"directories":{"test":"test"},"scripts":{"test:tsd":"tsd","test:unit":"TZ=UTC tap ./test/*.js","test:cover":"TZ=UTC tap --coverage-report=html ./test/*.js","lint":"eslint .","lint:fix":"eslint --fix .","test":"npm run lint && npm run test:unit && npm run test:tsd"},"repository":{"type":"git","url":"https://github.com/harrisiirak/cron-parser.git"},"keywords":["cron","crontab","parser"],"author":"Harri Siirak","contributors":["Nicholas Clawson","Daniel Prentis <daniel@salsitasoft.com>","Renault John Lecoultre","Richard Astbury <richard.astbury@gmail.com>","Meaglin Wasabi <Meaglin.wasabi@gmail.com>","Mike Kusold <hello@mikekusold.com>","Alex Kit <alex.kit@atmajs.com>","Santiago Gimeno <santiago.gimeno@gmail.com>","Daniel <darc.tec@gmail.com>","Christian Steininger <christian.steininger.cs@gmail.com>","Mykola Piskovyi <m.piskovyi@gmail.com>","Brian Vaughn <brian.david.vaughn@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Yasuhiroki <yasuhiroki.duck@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Brendan Warkentin <faazshift@gmail.com>","Charlie Fish <fishcharlie.code@gmail.com>","Ian Graves <ian+diskimage@iangrav.es>","Andy Thompson <me@andytson.com>","Regev Brody <regevbr@gmail.com>"],"license":"MIT","dependencies":{"luxon":"^3.2.1"},"devDependencies":{"eslint":"^8.27.0","sinon":"^15.0.1","tap":"^16.3.3","tsd":"^0.26.0"},"engines":{"node":">=12.0.0"},"browser":{"fs":false},"tap":{"check-coverage":false},"tsd":{"directory":"test","compilerOptions":{"lib":["es2017","dom"]}},"files":["lib","types","LICENSE","README.md"],"_lastModified":"2025-12-05T07:11:38.156Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"semver","version":"7.7.2","description":"The semantic version parser used by npm.","main":"index.js","scripts":{"test":"tap","snap":"tap","lint":"npm run eslint","postlint":"template-oss-check","lintfix":"npm run eslint -- --fix","posttest":"npm run lint","template-oss-apply":"template-oss-apply --force","eslint":"eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""},"devDependencies":{"@npmcli/eslint-config":"^5.0.0","@npmcli/template-oss":"4.24.3","benchmark":"^2.1.4","tap":"^16.0.0"},"license":"ISC","repository":{"type":"git","url":"git+https://github.com/npm/node-semver.git"},"bin":{"semver":"bin/semver.js"},"files":["bin/","lib/","classes/","functions/","internal/","ranges/","index.js","preload.js","range.bnf"],"tap":{"timeout":30,"coverage-map":"map.js","nyc-arg":["--exclude","tap-snapshots/**"]},"engines":{"node":">=10"},"author":"GitHub Inc.","templateOSS":{"//@npmcli/template-oss":"This file is partially managed by @npmcli/template-oss. Edits may be overwritten.","version":"4.24.3","engines":">=10","distPaths":["classes/","functions/","internal/","ranges/","index.js","preload.js","range.bnf"],"allowPaths":["/classes/","/functions/","/internal/","/ranges/","/index.js","/preload.js","/range.bnf","/benchmarks"],"publish":"true"},"_lastModified":"2025-
|
|
1
|
+
{"name":"semver","version":"7.7.2","description":"The semantic version parser used by npm.","main":"index.js","scripts":{"test":"tap","snap":"tap","lint":"npm run eslint","postlint":"template-oss-check","lintfix":"npm run eslint -- --fix","posttest":"npm run lint","template-oss-apply":"template-oss-apply --force","eslint":"eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""},"devDependencies":{"@npmcli/eslint-config":"^5.0.0","@npmcli/template-oss":"4.24.3","benchmark":"^2.1.4","tap":"^16.0.0"},"license":"ISC","repository":{"type":"git","url":"git+https://github.com/npm/node-semver.git"},"bin":{"semver":"bin/semver.js"},"files":["bin/","lib/","classes/","functions/","internal/","ranges/","index.js","preload.js","range.bnf"],"tap":{"timeout":30,"coverage-map":"map.js","nyc-arg":["--exclude","tap-snapshots/**"]},"engines":{"node":">=10"},"author":"GitHub Inc.","templateOSS":{"//@npmcli/template-oss":"This file is partially managed by @npmcli/template-oss. Edits may be overwritten.","version":"4.24.3","engines":">=10","distPaths":["classes/","functions/","internal/","ranges/","index.js","preload.js","range.bnf"],"allowPaths":["/classes/","/functions/","/internal/","/ranges/","/index.js","/preload.js","/range.bnf","/benchmarks"],"publish":"true"},"_lastModified":"2025-12-05T07:11:37.542Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"yauzl","version":"3.2.0","description":"yet another unzip library for node","engines":{"node":">=12"},"main":"index.js","scripts":{"test":"node test/test.js"},"repository":{"type":"git","url":"git+https://github.com/thejoshwolfe/yauzl.git"},"keywords":["unzip","zip","stream","archive","file"],"author":"Josh Wolfe <thejoshwolfe@gmail.com>","license":"MIT","bugs":{"url":"https://github.com/thejoshwolfe/yauzl/issues"},"homepage":"https://github.com/thejoshwolfe/yauzl","dependencies":{"buffer-crc32":"~0.2.3","pend":"~1.2.0"},"devDependencies":{"bl":"^6.0.11"},"files":["fd-slicer.js","index.js"],"_lastModified":"2025-
|
|
1
|
+
{"name":"yauzl","version":"3.2.0","description":"yet another unzip library for node","engines":{"node":">=12"},"main":"index.js","scripts":{"test":"node test/test.js"},"repository":{"type":"git","url":"git+https://github.com/thejoshwolfe/yauzl.git"},"keywords":["unzip","zip","stream","archive","file"],"author":"Josh Wolfe <thejoshwolfe@gmail.com>","license":"MIT","bugs":{"url":"https://github.com/thejoshwolfe/yauzl/issues"},"homepage":"https://github.com/thejoshwolfe/yauzl","dependencies":{"buffer-crc32":"~0.2.3","pend":"~1.2.0"},"devDependencies":{"bl":"^6.0.11"},"files":["fd-slicer.js","index.js"],"_lastModified":"2025-12-05T07:11:37.710Z"}
|
package/dist/server/dumper.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { DumpRulesGroupType } from '@tego/server';
|
|
2
2
|
import { AppMigrator } from './app-migrator';
|
|
3
|
+
import { ProgressTracker } from './progress-tracker';
|
|
3
4
|
type DumpOptions = {
|
|
4
5
|
groups: Set<DumpRulesGroupType>;
|
|
5
6
|
fileName?: string;
|
|
6
7
|
appName?: string;
|
|
8
|
+
userId?: number;
|
|
7
9
|
};
|
|
8
10
|
type BackUpStatusOk = {
|
|
9
11
|
name: string;
|
|
@@ -15,6 +17,8 @@ type BackUpStatusDoing = {
|
|
|
15
17
|
name: string;
|
|
16
18
|
inProgress: true;
|
|
17
19
|
status: 'in_progress';
|
|
20
|
+
progress?: number;
|
|
21
|
+
currentStep?: string;
|
|
18
22
|
};
|
|
19
23
|
type BackUpStatusError = {
|
|
20
24
|
name: string;
|
|
@@ -24,6 +28,8 @@ type BackUpStatusError = {
|
|
|
24
28
|
export declare class Dumper extends AppMigrator {
|
|
25
29
|
static dumpTasks: Map<string, Promise<any>>;
|
|
26
30
|
direction: "dump";
|
|
31
|
+
private get progressManager();
|
|
32
|
+
private _progressManager?;
|
|
27
33
|
sqlContent: {
|
|
28
34
|
[key: string]: {
|
|
29
35
|
sql: string | string[];
|
|
@@ -31,7 +37,7 @@ export declare class Dumper extends AppMigrator {
|
|
|
31
37
|
};
|
|
32
38
|
};
|
|
33
39
|
static getTaskPromise(taskId: string): Promise<any> | undefined;
|
|
34
|
-
static getFileStatus(filePath: string): Promise<BackUpStatusOk | BackUpStatusDoing | BackUpStatusError>;
|
|
40
|
+
static getFileStatus(filePath: string, appName?: string): Promise<BackUpStatusOk | BackUpStatusDoing | BackUpStatusError>;
|
|
35
41
|
static generateFileName(): string;
|
|
36
42
|
writeSQLContent(key: string, data: {
|
|
37
43
|
sql: string | string[];
|
|
@@ -65,13 +71,13 @@ export declare class Dumper extends AppMigrator {
|
|
|
65
71
|
filePath: string;
|
|
66
72
|
dirname: string;
|
|
67
73
|
}>;
|
|
68
|
-
dumpDb(options: DumpOptions): Promise<void>;
|
|
74
|
+
dumpDb(options: DumpOptions, progressTracker?: ProgressTracker): Promise<void>;
|
|
69
75
|
hasSqlContent(): boolean;
|
|
70
76
|
dumpMeta(additionalMeta?: object): Promise<void>;
|
|
71
77
|
dumpCollection(options: {
|
|
72
78
|
name: string;
|
|
73
79
|
}): Promise<void>;
|
|
74
|
-
packDumpedDir(fileName: string, appName?: string): Promise<{
|
|
80
|
+
packDumpedDir(fileName: string, appName?: string, progressTracker?: ProgressTracker): Promise<{
|
|
75
81
|
filePath: string;
|
|
76
82
|
dirname: string;
|
|
77
83
|
}>;
|
package/dist/server/dumper.js
CHANGED
|
@@ -42,6 +42,7 @@ var import_dayjs = __toESM(require("dayjs"));
|
|
|
42
42
|
var import_lodash = __toESM(require("lodash"));
|
|
43
43
|
var import_app_migrator = require("./app-migrator");
|
|
44
44
|
var import_field_value_writer = require("./field-value-writer");
|
|
45
|
+
var import_progress_tracker = require("./progress-tracker");
|
|
45
46
|
var import_utils = require("./utils");
|
|
46
47
|
const finished = import_node_util.default.promisify(import_node_stream.default.finished);
|
|
47
48
|
const _Dumper = class _Dumper extends import_app_migrator.AppMigrator {
|
|
@@ -50,13 +51,24 @@ const _Dumper = class _Dumper extends import_app_migrator.AppMigrator {
|
|
|
50
51
|
this.direction = "dump";
|
|
51
52
|
this.sqlContent = {};
|
|
52
53
|
}
|
|
54
|
+
get progressManager() {
|
|
55
|
+
if (!this._progressManager) {
|
|
56
|
+
this._progressManager = new import_progress_tracker.ProgressManager(
|
|
57
|
+
(appName) => this.backUpStorageDir(appName),
|
|
58
|
+
this.workDir,
|
|
59
|
+
this.app
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
return this._progressManager;
|
|
63
|
+
}
|
|
53
64
|
static getTaskPromise(taskId) {
|
|
54
65
|
return this.dumpTasks.get(taskId);
|
|
55
66
|
}
|
|
56
|
-
static async getFileStatus(filePath) {
|
|
67
|
+
static async getFileStatus(filePath, appName) {
|
|
57
68
|
const lockFile = filePath + ".lock";
|
|
69
|
+
const progressFile = filePath + ".progress";
|
|
58
70
|
const fileName = import_node_path.default.basename(filePath);
|
|
59
|
-
return import_node_fs.default.promises.stat(lockFile).then((lockFileStat) => {
|
|
71
|
+
return import_node_fs.default.promises.stat(lockFile).then(async (lockFileStat) => {
|
|
60
72
|
if (lockFileStat.isFile()) {
|
|
61
73
|
if (lockFileStat.ctime.getTime() < Date.now() - 2 * 60 * 60 * 1e3) {
|
|
62
74
|
return {
|
|
@@ -65,10 +77,18 @@ const _Dumper = class _Dumper extends import_app_migrator.AppMigrator {
|
|
|
65
77
|
status: "error"
|
|
66
78
|
};
|
|
67
79
|
} else {
|
|
80
|
+
let progress = null;
|
|
81
|
+
try {
|
|
82
|
+
const progressContent = await import_promises.default.readFile(progressFile, "utf8");
|
|
83
|
+
progress = JSON.parse(progressContent);
|
|
84
|
+
} catch (error) {
|
|
85
|
+
}
|
|
68
86
|
return {
|
|
69
87
|
name: fileName,
|
|
70
88
|
inProgress: true,
|
|
71
|
-
status: "in_progress"
|
|
89
|
+
status: "in_progress",
|
|
90
|
+
progress: progress == null ? void 0 : progress.percent,
|
|
91
|
+
currentStep: progress == null ? void 0 : progress.currentStep
|
|
72
92
|
};
|
|
73
93
|
}
|
|
74
94
|
} else {
|
|
@@ -193,6 +213,7 @@ const _Dumper = class _Dumper extends import_app_migrator.AppMigrator {
|
|
|
193
213
|
async cleanLockFile(fileName, appName) {
|
|
194
214
|
const filePath = this.lockFilePath(fileName, appName);
|
|
195
215
|
await import_promises.default.unlink(filePath);
|
|
216
|
+
await this.progressManager.cleanProgressFile(fileName, appName);
|
|
196
217
|
}
|
|
197
218
|
async getLockFile(appName) {
|
|
198
219
|
const backupFileName = _Dumper.generateFileName();
|
|
@@ -203,7 +224,8 @@ const _Dumper = class _Dumper extends import_app_migrator.AppMigrator {
|
|
|
203
224
|
await this.dump({
|
|
204
225
|
groups: options.groups,
|
|
205
226
|
fileName: options.fileName,
|
|
206
|
-
appName: options.appName
|
|
227
|
+
appName: options.appName,
|
|
228
|
+
userId: options.userId
|
|
207
229
|
});
|
|
208
230
|
}
|
|
209
231
|
async dumpableCollectionsGroupByGroup() {
|
|
@@ -212,9 +234,14 @@ const _Dumper = class _Dumper extends import_app_migrator.AppMigrator {
|
|
|
212
234
|
async dump(options) {
|
|
213
235
|
const dumpingGroups = options.groups;
|
|
214
236
|
dumpingGroups.add("required");
|
|
237
|
+
const backupFileName = options.fileName || _Dumper.generateFileName();
|
|
238
|
+
const progressTracker = this.progressManager.createProgressTracker(backupFileName, options.appName, options.userId);
|
|
239
|
+
await progressTracker.update(0, "Preparing...");
|
|
215
240
|
const delayCollections = /* @__PURE__ */ new Set();
|
|
216
241
|
const dumpedCollections = await this.getCollectionsByDataTypes(dumpingGroups);
|
|
217
|
-
|
|
242
|
+
const totalCollections = dumpedCollections.length;
|
|
243
|
+
for (let i = 0; i < dumpedCollections.length; i++) {
|
|
244
|
+
const collectionName = dumpedCollections[i];
|
|
218
245
|
const collection = this.app.db.getCollection(collectionName);
|
|
219
246
|
if (import_lodash.default.get(collection.options, "dumpRules.delayRestore")) {
|
|
220
247
|
delayCollections.add(collectionName);
|
|
@@ -222,26 +249,44 @@ const _Dumper = class _Dumper extends import_app_migrator.AppMigrator {
|
|
|
222
249
|
await this.dumpCollection({
|
|
223
250
|
name: collectionName
|
|
224
251
|
});
|
|
252
|
+
const progress = progressTracker.getCollectionProgress(i, totalCollections);
|
|
253
|
+
await progressTracker.update(progress, `Dumping collection: ${collectionName} (${i + 1}/${totalCollections})`);
|
|
225
254
|
}
|
|
255
|
+
await progressTracker.update(70, "Dumping metadata...");
|
|
226
256
|
await this.dumpMeta({
|
|
227
257
|
dumpableCollectionsGroupByGroup: import_lodash.default.pick(await this.dumpableCollectionsGroupByGroup(), [...dumpingGroups]),
|
|
228
258
|
dumpedGroups: [...dumpingGroups],
|
|
229
259
|
delayCollections: [...delayCollections]
|
|
230
260
|
});
|
|
231
|
-
await
|
|
232
|
-
|
|
233
|
-
|
|
261
|
+
await progressTracker.update(75, "Dumping metadata...");
|
|
262
|
+
await progressTracker.update(80, "Dumping database content...");
|
|
263
|
+
await this.dumpDb(options, progressTracker);
|
|
264
|
+
await progressTracker.update(90, "Packing backup file...");
|
|
265
|
+
const filePath = await this.packDumpedDir(backupFileName, options.appName, progressTracker);
|
|
234
266
|
await this.clearWorkDir();
|
|
267
|
+
await progressTracker.update(100, "Completed");
|
|
268
|
+
await this.progressManager.cleanProgressFile(backupFileName, options.appName);
|
|
235
269
|
return filePath;
|
|
236
270
|
}
|
|
237
|
-
async dumpDb(options) {
|
|
271
|
+
async dumpDb(options, progressTracker) {
|
|
238
272
|
var _a;
|
|
239
|
-
|
|
273
|
+
const collections = Array.from(this.app.db.collections.values());
|
|
274
|
+
const totalCollections = collections.length;
|
|
275
|
+
let processedCollections = 0;
|
|
276
|
+
for (const collection of collections) {
|
|
240
277
|
const collectionOnDumpOption = (_a = this.app.db.collectionFactory.collectionTypes.get(
|
|
241
278
|
collection.constructor
|
|
242
279
|
)) == null ? void 0 : _a.onDump;
|
|
243
280
|
if (collectionOnDumpOption) {
|
|
244
281
|
await collectionOnDumpOption(this, collection);
|
|
282
|
+
processedCollections++;
|
|
283
|
+
if (progressTracker && totalCollections > 0) {
|
|
284
|
+
const progress = progressTracker.getDbContentProgress(processedCollections, totalCollections);
|
|
285
|
+
await progressTracker.update(
|
|
286
|
+
progress,
|
|
287
|
+
`Dumping database content... (${processedCollections}/${totalCollections})`
|
|
288
|
+
);
|
|
289
|
+
}
|
|
245
290
|
}
|
|
246
291
|
}
|
|
247
292
|
if (this.hasSqlContent()) {
|
|
@@ -257,6 +302,9 @@ const _Dumper = class _Dumper extends import_app_migrator.AppMigrator {
|
|
|
257
302
|
"utf8"
|
|
258
303
|
);
|
|
259
304
|
}
|
|
305
|
+
if (progressTracker) {
|
|
306
|
+
await progressTracker.update(88, "Dumping database content...");
|
|
307
|
+
}
|
|
260
308
|
}
|
|
261
309
|
hasSqlContent() {
|
|
262
310
|
return Object.keys(this.sqlContent).length > 0;
|
|
@@ -375,7 +423,7 @@ const _Dumper = class _Dumper extends import_app_migrator.AppMigrator {
|
|
|
375
423
|
}
|
|
376
424
|
await import_promises.default.writeFile(import_node_path.default.resolve(collectionDataDir, "meta"), JSON.stringify(meta), "utf8");
|
|
377
425
|
}
|
|
378
|
-
async packDumpedDir(fileName, appName) {
|
|
426
|
+
async packDumpedDir(fileName, appName, progressTracker) {
|
|
379
427
|
const dirname = this.backUpStorageDir(appName);
|
|
380
428
|
await import_promises.default.mkdir(dirname, { recursive: true });
|
|
381
429
|
const filePath = import_node_path.default.resolve(dirname, fileName);
|
|
@@ -383,13 +431,22 @@ const _Dumper = class _Dumper extends import_app_migrator.AppMigrator {
|
|
|
383
431
|
const archive = (0, import_archiver.default)("zip", {
|
|
384
432
|
zlib: { level: 9 }
|
|
385
433
|
});
|
|
434
|
+
let cleanupProgress = null;
|
|
435
|
+
if (progressTracker) {
|
|
436
|
+
cleanupProgress = this.progressManager.setupPackingProgress(archive, progressTracker);
|
|
437
|
+
}
|
|
438
|
+
const app = this.app;
|
|
386
439
|
const onClose = new Promise((resolve, reject) => {
|
|
387
|
-
output.on("close",
|
|
388
|
-
|
|
440
|
+
output.on("close", () => {
|
|
441
|
+
if (app == null ? void 0 : app.logger) {
|
|
442
|
+
app.logger.info(`Backup file created: ${(0, import_utils.humanFileSize)(archive.pointer(), true)}`);
|
|
443
|
+
}
|
|
444
|
+
if (cleanupProgress) {
|
|
445
|
+
cleanupProgress();
|
|
446
|
+
}
|
|
389
447
|
resolve(true);
|
|
390
448
|
});
|
|
391
|
-
output.on("end",
|
|
392
|
-
console.log("Data has been drained");
|
|
449
|
+
output.on("end", () => {
|
|
393
450
|
});
|
|
394
451
|
archive.on("warning", function(err) {
|
|
395
452
|
if (err.code === "ENOENT") {
|
|
@@ -398,6 +455,9 @@ const _Dumper = class _Dumper extends import_app_migrator.AppMigrator {
|
|
|
398
455
|
}
|
|
399
456
|
});
|
|
400
457
|
archive.on("error", function(err) {
|
|
458
|
+
if (cleanupProgress) {
|
|
459
|
+
cleanupProgress();
|
|
460
|
+
}
|
|
401
461
|
reject(err);
|
|
402
462
|
});
|
|
403
463
|
});
|
|
@@ -405,6 +465,9 @@ const _Dumper = class _Dumper extends import_app_migrator.AppMigrator {
|
|
|
405
465
|
archive.directory(this.workDir, false);
|
|
406
466
|
await archive.finalize();
|
|
407
467
|
await onClose;
|
|
468
|
+
if (progressTracker) {
|
|
469
|
+
await progressTracker.update(99, "Packing backup file...");
|
|
470
|
+
}
|
|
408
471
|
return {
|
|
409
472
|
filePath,
|
|
410
473
|
dirname
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Application } from '@tego/server';
|
|
2
|
+
import archiver from 'archiver';
|
|
3
|
+
/**
|
|
4
|
+
* 进度信息类型
|
|
5
|
+
*/
|
|
6
|
+
export type ProgressInfo = {
|
|
7
|
+
percent: number;
|
|
8
|
+
currentStep: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* 进度跟踪器接口
|
|
12
|
+
*/
|
|
13
|
+
export interface ProgressTracker {
|
|
14
|
+
/**
|
|
15
|
+
* 更新进度
|
|
16
|
+
*/
|
|
17
|
+
update(percent: number, currentStep: string): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* 计算集合备份阶段的进度 (5-70%)
|
|
20
|
+
*/
|
|
21
|
+
getCollectionProgress(currentIndex: number, totalCollections: number): number;
|
|
22
|
+
/**
|
|
23
|
+
* 计算数据库内容备份阶段的进度 (80-88%)
|
|
24
|
+
*/
|
|
25
|
+
getDbContentProgress(processedCollections: number, totalCollections: number): number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* 进度管理器类,负责管理备份过程中的进度文件
|
|
29
|
+
*/
|
|
30
|
+
export declare class ProgressManager {
|
|
31
|
+
private backupStorageDir;
|
|
32
|
+
private workDir;
|
|
33
|
+
private app?;
|
|
34
|
+
private static wsUnavailableWarned;
|
|
35
|
+
constructor(backupStorageDir: (appName?: string) => string, workDir: string, app?: Application);
|
|
36
|
+
/**
|
|
37
|
+
* 获取进度文件路径(静态方法,用于不需要实例的场景)
|
|
38
|
+
*/
|
|
39
|
+
static getProgressFilePath(filePath: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* 获取进度文件路径
|
|
42
|
+
*/
|
|
43
|
+
private progressFilePath;
|
|
44
|
+
/**
|
|
45
|
+
* 通过 WebSocket 推送进度更新
|
|
46
|
+
* @param fileName 备份文件名
|
|
47
|
+
* @param progress 进度信息
|
|
48
|
+
* @param userId 用户ID(可选,如果未提供则不会推送,适用于自动备份场景)
|
|
49
|
+
* @param appName 应用名称
|
|
50
|
+
*/
|
|
51
|
+
private pushProgressViaWebSocket;
|
|
52
|
+
/**
|
|
53
|
+
* 写入进度信息
|
|
54
|
+
*/
|
|
55
|
+
writeProgress(fileName: string, progress: ProgressInfo, appName?: string, userId?: number): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* 读取进度信息
|
|
58
|
+
*/
|
|
59
|
+
readProgress(fileName: string, appName?: string): Promise<ProgressInfo | null>;
|
|
60
|
+
/**
|
|
61
|
+
* 清理进度文件
|
|
62
|
+
*/
|
|
63
|
+
cleanProgressFile(fileName: string, appName: string): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* 创建进度跟踪器
|
|
66
|
+
*/
|
|
67
|
+
createProgressTracker(backupFileName: string, appName?: string, userId?: number): ProgressTracker;
|
|
68
|
+
/**
|
|
69
|
+
* 统计目录中的文件总数
|
|
70
|
+
*/
|
|
71
|
+
private countFiles;
|
|
72
|
+
/**
|
|
73
|
+
* 设置打包阶段的进度更新
|
|
74
|
+
*/
|
|
75
|
+
setupPackingProgress(archive: archiver.Archiver, progressTracker: ProgressTracker): () => void;
|
|
76
|
+
}
|