@camstack/server 1.2.798 → 1.2.799
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/CHANGELOG.md +6 -0
- package/dist/boot/boot-config.js +5 -6
- package/dist/main.js +6 -11
- package/dist/manual-boot.js +2 -4
- package/dist/pending-restore.js +8 -0
- package/package.json +6 -7
- package/system/dist/addon-runner.js +3 -3
- package/system/dist/addon-runner.mjs +3 -3
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/system-backup/system-backup.service.d.ts +1 -1
- package/system/dist/builtins/system-config/system-config.addon.js +6 -6
- package/system/dist/builtins/system-config/system-config.addon.mjs +287 -287
- package/system/dist/index.js +191 -68
- package/system/dist/index.mjs +191 -68
- package/system/dist/kernel/bootstrap-config.d.ts +11 -6
- package/system/dist/kernel/config-manager.d.ts +5 -5
- package/system/dist/kernel/config-schema.d.ts +3 -4
- package/system/dist/kernel/legacy-config-yaml.d.ts +37 -0
- package/system/dist/kernel/sections-store.d.ts +1 -1
- package/system/dist/kernel/system-settings-policy.d.ts +1 -1
- package/system/dist/{restore-archive-DfFB1J2w.mjs → restore-archive-CXw4EaBA.mjs} +81 -82
- package/system/dist/{restore-archive-HS5O901O.js → restore-archive-DfuKCYXp.js} +0 -1
- package/system/package.json +1 -1
|
@@ -2,17 +2,17 @@ import { Is as defineRecordKinds, P as DATABASE_SNAPSHOT_SUFFIX, q as DataStoreD
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { createCipheriv, createDecipheriv, createHash, createPrivateKey, createPublicKey, diffieHellman, generateKeyPairSync, hkdfSync, randomBytes } from "node:crypto";
|
|
4
4
|
import { Buffer as Buffer$1 } from "buffer";
|
|
5
|
-
import * as fs$
|
|
5
|
+
import * as fs$2 from "node:fs";
|
|
6
6
|
import fs from "node:fs";
|
|
7
|
-
import * as path$
|
|
7
|
+
import * as path$1 from "node:path";
|
|
8
8
|
import path, { basename, join, posix, win32 } from "node:path";
|
|
9
9
|
import * as fsp from "node:fs/promises";
|
|
10
10
|
import jn from "node:fs/promises";
|
|
11
11
|
import { EventEmitter } from "node:events";
|
|
12
|
-
import
|
|
12
|
+
import As, { Transform } from "node:stream";
|
|
13
13
|
import { StringDecoder } from "node:string_decoder";
|
|
14
|
-
import
|
|
15
|
-
import
|
|
14
|
+
import I from "fs";
|
|
15
|
+
import qs, { dirname as dirname$1, parse } from "path";
|
|
16
16
|
import * as Ms from "zlib";
|
|
17
17
|
import Jr from "zlib";
|
|
18
18
|
import Pi from "assert";
|
|
@@ -459,7 +459,7 @@ async function readBackupEncryptionHeader(file) {
|
|
|
459
459
|
async function decryptBackupFile(input, output, secretKey) {
|
|
460
460
|
const decrypt = createBackupDecryptStream(secretKey);
|
|
461
461
|
try {
|
|
462
|
-
await pipeline(fs$
|
|
462
|
+
await pipeline(fs$2.createReadStream(input), decrypt, fs$2.createWriteStream(output, { mode: 384 }));
|
|
463
463
|
} catch (err) {
|
|
464
464
|
await fsp.rm(output, { force: true }).catch(() => void 0);
|
|
465
465
|
throw err;
|
|
@@ -477,7 +477,7 @@ var Br = (s, t) => {
|
|
|
477
477
|
var xs = typeof process == "object" && process ? process : {
|
|
478
478
|
stdout: null,
|
|
479
479
|
stderr: null
|
|
480
|
-
}, zr = (s) => !!s && typeof s == "object" && (s instanceof A || s instanceof
|
|
480
|
+
}, zr = (s) => !!s && typeof s == "object" && (s instanceof A || s instanceof As || Ur(s) || Hr(s)), Ur = (s) => !!s && typeof s == "object" && s instanceof EventEmitter && typeof s.pipe == "function" && s.pipe !== As.Writable.prototype.pipe, Hr = (s) => !!s && typeof s == "object" && s instanceof EventEmitter && typeof s.write == "function" && typeof s.end == "function", q = Symbol("EOF"), Q = Symbol("maybeEmitEnd"), rt = Symbol("emittedEnd"), Le = Symbol("emittingEnd"), qt = Symbol("emittedError"), Ne = Symbol("closed"), Ls = Symbol("read"), De = Symbol("flush"), Ns = Symbol("flushChunk"), z$1 = Symbol("encoding"), Mt = Symbol("decoder"), g = Symbol("flowing"), Qt = Symbol("paused"), Bt = Symbol("resume"), b = Symbol("buffer"), D = Symbol("pipes"), _ = Symbol("bufferLength"), gi = Symbol("bufferPush"), Ae = Symbol("bufferShift"), L = Symbol("objectMode"), w = Symbol("destroyed"), bi = Symbol("error"), _i = Symbol("emitData"), Ds = Symbol("emitEnd"), Oi = Symbol("emitEnd2"), Z = Symbol("async"), Ti = Symbol("abort"), Ie = Symbol("aborted"), Jt = Symbol("signal"), Rt = Symbol("dataListeners"), F = Symbol("discarded"), jt = (s) => Promise.resolve().then(s), Wr = (s) => s(), Gr = (s) => s === "end" || s === "finish" || s === "prefinish", Zr = (s) => s instanceof ArrayBuffer || !!s && typeof s == "object" && s.constructor && s.constructor.name === "ArrayBuffer" && s.byteLength >= 0, Yr = (s) => !Buffer.isBuffer(s) && ArrayBuffer.isView(s), Fe = class {
|
|
481
481
|
src;
|
|
482
482
|
dest;
|
|
483
483
|
opts;
|
|
@@ -797,7 +797,7 @@ while (this[Ns](this[Ae]()) && this[b].length);
|
|
|
797
797
|
return zr;
|
|
798
798
|
}
|
|
799
799
|
};
|
|
800
|
-
var Xr =
|
|
800
|
+
var Xr = I.writev, ot = Symbol("_autoClose"), H = Symbol("_close"), te = Symbol("_ended"), m = Symbol("_fd"), Ni = Symbol("_finished"), j = Symbol("_flags"), Di = Symbol("_flush"), Ci = Symbol("_handleChunk"), ki = Symbol("_makeBuf"), ie = Symbol("_mode"), Ce = Symbol("_needDrain"), Ut = Symbol("_onerror"), Ht = Symbol("_onopen"), Ai = Symbol("_onread"), Pt = Symbol("_onwrite"), ht = Symbol("_open"), U = Symbol("_path"), nt = Symbol("_pos"), Y = Symbol("_queue"), zt = Symbol("_read"), Ii = Symbol("_readSize"), J = Symbol("_reading"), ee = Symbol("_remain"), Fi = Symbol("_size"), ke = Symbol("_write"), gt = Symbol("_writing"), ve = Symbol("_defaultFlag"), bt = Symbol("_errored"), _t = class extends A {
|
|
801
801
|
[bt] = !1;
|
|
802
802
|
[m];
|
|
803
803
|
[U];
|
|
@@ -823,7 +823,7 @@ var Xr = fs$1.writev, ot = Symbol("_autoClose"), H = Symbol("_close"), te = Symb
|
|
|
823
823
|
throw new TypeError("this is a readable stream");
|
|
824
824
|
}
|
|
825
825
|
[ht]() {
|
|
826
|
-
|
|
826
|
+
I.open(this[U], "r", (t, e) => this[Ht](t, e));
|
|
827
827
|
}
|
|
828
828
|
[Ht](t, e) {
|
|
829
829
|
t ? this[Ut](t) : (this[m] = e, this.emit("open", e), this[zt]());
|
|
@@ -836,7 +836,7 @@ var Xr = fs$1.writev, ot = Symbol("_autoClose"), H = Symbol("_close"), te = Symb
|
|
|
836
836
|
this[J] = !0;
|
|
837
837
|
let t = this[ki]();
|
|
838
838
|
if (t.length === 0) return process.nextTick(() => this[Ai](null, 0, t));
|
|
839
|
-
|
|
839
|
+
I.read(this[m], t, 0, t.length, null, (e, i, r) => this[Ai](e, i, r));
|
|
840
840
|
}
|
|
841
841
|
}
|
|
842
842
|
[Ai](t, e, i) {
|
|
@@ -845,7 +845,7 @@ var Xr = fs$1.writev, ot = Symbol("_autoClose"), H = Symbol("_close"), te = Symb
|
|
|
845
845
|
[H]() {
|
|
846
846
|
if (this[ot] && typeof this[m] == "number") {
|
|
847
847
|
let t = this[m];
|
|
848
|
-
this[m] = void 0,
|
|
848
|
+
this[m] = void 0, I.close(t, (e) => e ? this.emit("error", e) : this.emit("close"));
|
|
849
849
|
}
|
|
850
850
|
}
|
|
851
851
|
[Ut](t) {
|
|
@@ -868,7 +868,7 @@ var Xr = fs$1.writev, ot = Symbol("_autoClose"), H = Symbol("_close"), te = Symb
|
|
|
868
868
|
[ht]() {
|
|
869
869
|
let t = !0;
|
|
870
870
|
try {
|
|
871
|
-
this[Ht](null,
|
|
871
|
+
this[Ht](null, I.openSync(this[U], "r")), t = !1;
|
|
872
872
|
} finally {
|
|
873
873
|
t && this[H]();
|
|
874
874
|
}
|
|
@@ -879,7 +879,7 @@ var Xr = fs$1.writev, ot = Symbol("_autoClose"), H = Symbol("_close"), te = Symb
|
|
|
879
879
|
if (!this[J]) {
|
|
880
880
|
this[J] = !0;
|
|
881
881
|
do {
|
|
882
|
-
let e = this[ki](), i = e.length === 0 ? 0 :
|
|
882
|
+
let e = this[ki](), i = e.length === 0 ? 0 : I.readSync(this[m], e, 0, e.length, null);
|
|
883
883
|
if (!this[Ci](i, e)) break;
|
|
884
884
|
} while (!0);
|
|
885
885
|
this[J] = !1;
|
|
@@ -892,7 +892,7 @@ var Xr = fs$1.writev, ot = Symbol("_autoClose"), H = Symbol("_close"), te = Symb
|
|
|
892
892
|
[H]() {
|
|
893
893
|
if (this[ot] && typeof this[m] == "number") {
|
|
894
894
|
let t = this[m];
|
|
895
|
-
this[m] = void 0,
|
|
895
|
+
this[m] = void 0, I.closeSync(t), this.emit("close");
|
|
896
896
|
}
|
|
897
897
|
}
|
|
898
898
|
}, tt = class extends $r {
|
|
@@ -933,7 +933,7 @@ var Xr = fs$1.writev, ot = Symbol("_autoClose"), H = Symbol("_close"), te = Symb
|
|
|
933
933
|
this[H](), this[gt] = !0, this.emit("error", t);
|
|
934
934
|
}
|
|
935
935
|
[ht]() {
|
|
936
|
-
|
|
936
|
+
I.open(this[U], this[j], this[ie], (t, e) => this[Ht](t, e));
|
|
937
937
|
}
|
|
938
938
|
[Ht](t, e) {
|
|
939
939
|
this[ve] && this[j] === "r+" && t && t.code === "ENOENT" ? (this[j] = "w", this[ht]()) : t ? this[Ut](t) : (this[m] = e, this.emit("open", e), this[gt] || this[Di]());
|
|
@@ -945,7 +945,7 @@ var Xr = fs$1.writev, ot = Symbol("_autoClose"), H = Symbol("_close"), te = Symb
|
|
|
945
945
|
return typeof t == "string" && (t = Buffer.from(t, e)), this[te] ? (this.emit("error", /* @__PURE__ */ new Error("write() after end()")), !1) : this[m] === void 0 || this[gt] || this[Y].length ? (this[Y].push(t), this[Ce] = !0, !1) : (this[gt] = !0, this[ke](t), !0);
|
|
946
946
|
}
|
|
947
947
|
[ke](t) {
|
|
948
|
-
|
|
948
|
+
I.write(this[m], t, 0, t.length, this[nt], (e, i) => this[Pt](e, i));
|
|
949
949
|
}
|
|
950
950
|
[Pt](t, e) {
|
|
951
951
|
t ? this[Ut](t) : (this[nt] !== void 0 && typeof e == "number" && (this[nt] += e), this[Y].length ? this[Di]() : (this[gt] = !1, this[te] && !this[Ni] ? (this[Ni] = !0, this[H](), this.emit("finish")) : this[Ce] && (this[Ce] = !1, this.emit("drain"))));
|
|
@@ -961,31 +961,31 @@ var Xr = fs$1.writev, ot = Symbol("_autoClose"), H = Symbol("_close"), te = Symb
|
|
|
961
961
|
[H]() {
|
|
962
962
|
if (this[ot] && typeof this[m] == "number") {
|
|
963
963
|
let t = this[m];
|
|
964
|
-
this[m] = void 0,
|
|
964
|
+
this[m] = void 0, I.close(t, (e) => e ? this.emit("error", e) : this.emit("close"));
|
|
965
965
|
}
|
|
966
966
|
}
|
|
967
967
|
}, Wt = class extends tt {
|
|
968
968
|
[ht]() {
|
|
969
969
|
let t;
|
|
970
970
|
if (this[ve] && this[j] === "r+") try {
|
|
971
|
-
t =
|
|
971
|
+
t = I.openSync(this[U], this[j], this[ie]);
|
|
972
972
|
} catch (e) {
|
|
973
973
|
if (e?.code === "ENOENT") return this[j] = "w", this[ht]();
|
|
974
974
|
throw e;
|
|
975
975
|
}
|
|
976
|
-
else t =
|
|
976
|
+
else t = I.openSync(this[U], this[j], this[ie]);
|
|
977
977
|
this[Ht](null, t);
|
|
978
978
|
}
|
|
979
979
|
[H]() {
|
|
980
980
|
if (this[ot] && typeof this[m] == "number") {
|
|
981
981
|
let t = this[m];
|
|
982
|
-
this[m] = void 0,
|
|
982
|
+
this[m] = void 0, I.closeSync(t), this.emit("close");
|
|
983
983
|
}
|
|
984
984
|
}
|
|
985
985
|
[ke](t) {
|
|
986
986
|
let e = !0;
|
|
987
987
|
try {
|
|
988
|
-
this[Pt](null,
|
|
988
|
+
this[Pt](null, I.writeSync(this[m], t, 0, t.length, this[nt])), e = !1;
|
|
989
989
|
} finally {
|
|
990
990
|
if (e) try {
|
|
991
991
|
this[H]();
|
|
@@ -1268,7 +1268,7 @@ var tn = Buffer$1.concat, Bs = Object.getOwnPropertyDescriptor(Buffer$1, "concat
|
|
|
1268
1268
|
}
|
|
1269
1269
|
}
|
|
1270
1270
|
};
|
|
1271
|
-
var Pe
|
|
1271
|
+
var Pe = class extends Be {
|
|
1272
1272
|
#t;
|
|
1273
1273
|
constructor(t) {
|
|
1274
1274
|
super(t, "Gzip"), this.#t = t && !!t.portable;
|
|
@@ -1945,7 +1945,7 @@ var er = (s, t) => t ? (s = f(s).replace(/^\.(\/|$)/, ""), mt(t) + "/" + s) : f(
|
|
|
1945
1945
|
let [o, a] = le(this.path);
|
|
1946
1946
|
o && typeof a == "string" && (this.path = a, r = o);
|
|
1947
1947
|
}
|
|
1948
|
-
this.win32 = !!i.win32 || process.platform === "win32", this.win32 && (this.path = $s(this.path.replaceAll(/\\/g, "/")), t = t.replaceAll(/\\/g, "/")), this.absolute = f(i.absolute ||
|
|
1948
|
+
this.win32 = !!i.win32 || process.platform === "win32", this.win32 && (this.path = $s(this.path.replaceAll(/\\/g, "/")), t = t.replaceAll(/\\/g, "/")), this.absolute = f(i.absolute || qs.resolve(this.cwd, t)), this.path === "" && (this.path = "./"), r && this.warn("TAR_ENTRY_INFO", `stripping ${r} from absolute path`, {
|
|
1949
1949
|
entry: this,
|
|
1950
1950
|
path: r + this.path
|
|
1951
1951
|
});
|
|
@@ -1959,7 +1959,7 @@ var er = (s, t) => t ? (s = f(s).replace(/^\.(\/|$)/, ""), mt(t) + "/" + s) : f(
|
|
|
1959
1959
|
return t === "error" && (this.#t = !0), super.emit(t, ...e);
|
|
1960
1960
|
}
|
|
1961
1961
|
[es]() {
|
|
1962
|
-
|
|
1962
|
+
I.lstat(this.absolute, (t, e) => {
|
|
1963
1963
|
if (t) return this.emit("error", t);
|
|
1964
1964
|
this[ii](e);
|
|
1965
1965
|
});
|
|
@@ -2018,7 +2018,7 @@ var er = (s, t) => t ? (s = f(s).replace(/^\.(\/|$)/, ""), mt(t) + "/" + s) : f(
|
|
|
2018
2018
|
this.path.slice(-1) !== "/" && (this.path += "/"), this.stat.size = 0, this[ce](), this.end();
|
|
2019
2019
|
}
|
|
2020
2020
|
[ts]() {
|
|
2021
|
-
|
|
2021
|
+
I.readlink(this.absolute, (t, e) => {
|
|
2022
2022
|
if (t) return this.emit("error", t);
|
|
2023
2023
|
this[ss](e);
|
|
2024
2024
|
});
|
|
@@ -2028,7 +2028,7 @@ var er = (s, t) => t ? (s = f(s).replace(/^\.(\/|$)/, ""), mt(t) + "/" + s) : f(
|
|
|
2028
2028
|
}
|
|
2029
2029
|
[tr](t) {
|
|
2030
2030
|
if (!this.stat) throw new Error("cannot create link entry without stat");
|
|
2031
|
-
this.type = "Link", this.linkpath = f(
|
|
2031
|
+
this.type = "Link", this.linkpath = f(qs.relative(this.cwd, t)), this.stat.size = 0, this[ce](), this.end();
|
|
2032
2032
|
}
|
|
2033
2033
|
[Js]() {
|
|
2034
2034
|
if (!this.stat) throw new Error("cannot create file entry without stat");
|
|
@@ -2041,7 +2041,7 @@ var er = (s, t) => t ? (s = f(s).replace(/^\.(\/|$)/, ""), mt(t) + "/" + s) : f(
|
|
|
2041
2041
|
this[rs]();
|
|
2042
2042
|
}
|
|
2043
2043
|
[rs]() {
|
|
2044
|
-
|
|
2044
|
+
I.open(this.absolute, "r", (t, e) => {
|
|
2045
2045
|
if (t) return this.emit("error", t);
|
|
2046
2046
|
this[ns](e);
|
|
2047
2047
|
});
|
|
@@ -2056,13 +2056,13 @@ var er = (s, t) => t ? (s = f(s).replace(/^\.(\/|$)/, ""), mt(t) + "/" + s) : f(
|
|
|
2056
2056
|
[ei]() {
|
|
2057
2057
|
let { fd: t, buf: e, offset: i, length: r, pos: n } = this;
|
|
2058
2058
|
if (t === void 0 || e === void 0) throw new Error("cannot read file without first opening");
|
|
2059
|
-
|
|
2059
|
+
I.read(t, e, i, r, n, (o, a) => {
|
|
2060
2060
|
if (o) return this[pt](() => this.emit("error", o));
|
|
2061
2061
|
this[is](a);
|
|
2062
2062
|
});
|
|
2063
2063
|
}
|
|
2064
2064
|
[pt](t = () => {}) {
|
|
2065
|
-
this.fd !== void 0 &&
|
|
2065
|
+
this.fd !== void 0 && I.close(this.fd, t);
|
|
2066
2066
|
}
|
|
2067
2067
|
[is](t) {
|
|
2068
2068
|
if (t <= 0 && this.remain > 0) {
|
|
@@ -2104,20 +2104,20 @@ var er = (s, t) => t ? (s = f(s).replace(/^\.(\/|$)/, ""), mt(t) + "/" + s) : f(
|
|
|
2104
2104
|
}, ri = class extends fe {
|
|
2105
2105
|
sync = !0;
|
|
2106
2106
|
[es]() {
|
|
2107
|
-
this[ii](
|
|
2107
|
+
this[ii](I.lstatSync(this.absolute));
|
|
2108
2108
|
}
|
|
2109
2109
|
[ts]() {
|
|
2110
|
-
this[ss](
|
|
2110
|
+
this[ss](I.readlinkSync(this.absolute));
|
|
2111
2111
|
}
|
|
2112
2112
|
[rs]() {
|
|
2113
|
-
this[ns](
|
|
2113
|
+
this[ns](I.openSync(this.absolute, "r"));
|
|
2114
2114
|
}
|
|
2115
2115
|
[ei]() {
|
|
2116
2116
|
let t = !0;
|
|
2117
2117
|
try {
|
|
2118
2118
|
let { fd: e, buf: i, offset: r, length: n, pos: o } = this;
|
|
2119
2119
|
if (e === void 0 || i === void 0) throw new Error("fd and buf must be set in READ method");
|
|
2120
|
-
let a =
|
|
2120
|
+
let a = I.readSync(e, i, r, n, o);
|
|
2121
2121
|
this[is](a), t = !1;
|
|
2122
2122
|
} finally {
|
|
2123
2123
|
if (t) try {
|
|
@@ -2129,7 +2129,7 @@ var er = (s, t) => t ? (s = f(s).replace(/^\.(\/|$)/, ""), mt(t) + "/" + s) : f(
|
|
|
2129
2129
|
t();
|
|
2130
2130
|
}
|
|
2131
2131
|
[pt](t = () => {}) {
|
|
2132
|
-
this.fd !== void 0 &&
|
|
2132
|
+
this.fd !== void 0 && I.closeSync(this.fd), t();
|
|
2133
2133
|
}
|
|
2134
2134
|
}, ni = class extends A {
|
|
2135
2135
|
blockLen = 0;
|
|
@@ -2397,7 +2397,7 @@ var mi = class {
|
|
|
2397
2397
|
constructor(t, e) {
|
|
2398
2398
|
this.path = t || "./", this.absolute = e;
|
|
2399
2399
|
}
|
|
2400
|
-
}, ir = Buffer.alloc(1024), ai = Symbol("onStat"), ue = Symbol("ended"), W = Symbol("queue"), me = Symbol("pendingLinks"), Et = Symbol("current"), Ct = Symbol("process"), pe = Symbol("processing"), hi = Symbol("processJob"), G = Symbol("jobs"), hs = Symbol("jobDone"), li = Symbol("addFSEntry"), sr = Symbol("addTarEntry"), cs = Symbol("stat"), fs$
|
|
2400
|
+
}, ir = Buffer.alloc(1024), ai = Symbol("onStat"), ue = Symbol("ended"), W = Symbol("queue"), me = Symbol("pendingLinks"), Et = Symbol("current"), Ct = Symbol("process"), pe = Symbol("processing"), hi = Symbol("processJob"), G = Symbol("jobs"), hs = Symbol("jobDone"), li = Symbol("addFSEntry"), sr = Symbol("addTarEntry"), cs = Symbol("stat"), fs$1 = Symbol("readdir"), ci = Symbol("onreaddir"), fi = Symbol("pipe"), rr = Symbol("entry"), as = Symbol("entryOpt"), di = Symbol("writeEntryClass"), or = Symbol("write"), ls = Symbol("ondrain"), wt = class extends A {
|
|
2401
2401
|
sync = !1;
|
|
2402
2402
|
opt;
|
|
2403
2403
|
cwd;
|
|
@@ -2428,7 +2428,7 @@ var mi = class {
|
|
|
2428
2428
|
constructor(t = {}) {
|
|
2429
2429
|
if (super(), this.opt = t, this.file = t.file || "", this.cwd = t.cwd || process.cwd(), this.maxReadSize = t.maxReadSize, this.preservePaths = !!t.preservePaths, this.strict = !!t.strict, this.noPax = !!t.noPax, this.prefix = f(t.prefix || ""), this.linkCache = t.linkCache || /* @__PURE__ */ new Map(), this.statCache = t.statCache || /* @__PURE__ */ new Map(), this.readdirCache = t.readdirCache || /* @__PURE__ */ new Map(), this.onWriteEntry = t.onWriteEntry, this[di] = fe, typeof t.onwarn == "function" && this.on("warn", t.onwarn), this.portable = !!t.portable, t.gzip || t.brotli || t.zstd) {
|
|
2430
2430
|
if ((t.gzip ? 1 : 0) + (t.brotli ? 1 : 0) + (t.zstd ? 1 : 0) > 1) throw new TypeError("gzip, brotli, zstd are mutually exclusive");
|
|
2431
|
-
if (t.gzip && (typeof t.gzip != "object" && (t.gzip = {}), this.portable && (t.gzip.portable = !0), this.zip = new Pe
|
|
2431
|
+
if (t.gzip && (typeof t.gzip != "object" && (t.gzip = {}), this.portable && (t.gzip.portable = !0), this.zip = new Pe(t.gzip)), t.brotli && (typeof t.brotli != "object" && (t.brotli = {}), this.zip = new He(t.brotli)), t.zstd && (typeof t.zstd != "object" && (t.zstd = {}), this.zip = new Ze(t.zstd)), !this.zip) throw new Error("impossible");
|
|
2432
2432
|
let e = this.zip;
|
|
2433
2433
|
e.on("data", (i) => super.write(i)), e.on("end", () => super.end()), e.on("drain", () => this[ls]()), this.on("resume", () => e.resume());
|
|
2434
2434
|
} else this.on("drain", this[ls]);
|
|
@@ -2448,7 +2448,7 @@ var mi = class {
|
|
|
2448
2448
|
return typeof t == "string" ? this[li](t) : this[sr](t), this.flowing;
|
|
2449
2449
|
}
|
|
2450
2450
|
[sr](t) {
|
|
2451
|
-
let e = f(
|
|
2451
|
+
let e = f(qs.resolve(this.cwd, t.path));
|
|
2452
2452
|
if (!this.filter(t.path, t)) t.resume();
|
|
2453
2453
|
else {
|
|
2454
2454
|
let i = new mi(t.path, e);
|
|
@@ -2457,12 +2457,12 @@ var mi = class {
|
|
|
2457
2457
|
this[Ct]();
|
|
2458
2458
|
}
|
|
2459
2459
|
[li](t) {
|
|
2460
|
-
let e = f(
|
|
2460
|
+
let e = f(qs.resolve(this.cwd, t));
|
|
2461
2461
|
this[W].push(new mi(t, e)), this[Ct]();
|
|
2462
2462
|
}
|
|
2463
2463
|
[cs](t) {
|
|
2464
2464
|
t.pending = !0, this[G] += 1;
|
|
2465
|
-
|
|
2465
|
+
I[this.follow ? "stat" : "lstat"](t.absolute, (i, r) => {
|
|
2466
2466
|
t.pending = !1, this[G] -= 1, i ? this.emit("error", i) : this[ai](t, r);
|
|
2467
2467
|
});
|
|
2468
2468
|
}
|
|
@@ -2475,8 +2475,8 @@ var mi = class {
|
|
|
2475
2475
|
}
|
|
2476
2476
|
this[Ct]();
|
|
2477
2477
|
}
|
|
2478
|
-
[fs$
|
|
2479
|
-
t.pending = !0, this[G] += 1,
|
|
2478
|
+
[fs$1](t) {
|
|
2479
|
+
t.pending = !0, this[G] += 1, I.readdir(t.absolute, (e, i) => {
|
|
2480
2480
|
if (t.pending = !1, this[G] -= 1, e) return this.emit("error", e);
|
|
2481
2481
|
this[ci](t, i);
|
|
2482
2482
|
});
|
|
@@ -2522,7 +2522,7 @@ var mi = class {
|
|
|
2522
2522
|
if (t.stat && !t.ignore) {
|
|
2523
2523
|
if (!this.noDirRecurse && t.stat.isDirectory() && !t.readdir) {
|
|
2524
2524
|
let e = this.readdirCache.get(t.absolute);
|
|
2525
|
-
if (e ? this[ci](t, e) : this[fs$
|
|
2525
|
+
if (e ? this[ci](t, e) : this[fs$1](t), !t.readdir) return;
|
|
2526
2526
|
}
|
|
2527
2527
|
if (t.entry = this[rr](t), !t.entry) {
|
|
2528
2528
|
t.ignore = !0;
|
|
@@ -2589,10 +2589,10 @@ var mi = class {
|
|
|
2589
2589
|
resume() {}
|
|
2590
2590
|
[cs](t) {
|
|
2591
2591
|
let e = this.follow ? "statSync" : "lstatSync";
|
|
2592
|
-
this[ai](t,
|
|
2592
|
+
this[ai](t, I[e](t.absolute));
|
|
2593
2593
|
}
|
|
2594
|
-
[fs$
|
|
2595
|
-
this[ci](t,
|
|
2594
|
+
[fs$1](t) {
|
|
2595
|
+
this[ci](t, I.readdirSync(t.absolute));
|
|
2596
2596
|
}
|
|
2597
2597
|
[fi](t) {
|
|
2598
2598
|
let e = t.entry, i = this.zip;
|
|
@@ -2644,7 +2644,7 @@ var Wn = (s, t) => {
|
|
|
2644
2644
|
}, Kn = K(Wn, Gn, Zn, Yn, (s, t) => {
|
|
2645
2645
|
if (!t?.length) throw new TypeError("no paths specified to add to archive");
|
|
2646
2646
|
});
|
|
2647
|
-
var ur = (process.env.__FAKE_PLATFORM__ || process.platform) === "win32", { O_CREAT: mr, O_NOFOLLOW: cr, O_TRUNC: pr, O_WRONLY: Er } =
|
|
2647
|
+
var ur = (process.env.__FAKE_PLATFORM__ || process.platform) === "win32", { O_CREAT: mr, O_NOFOLLOW: cr, O_TRUNC: pr, O_WRONLY: Er } = I.constants, wr = Number(process.env.__FAKE_FS_O_FILENAME__) || I.constants.UV_FS_O_FILEMAP || 0, $n = ur && !!wr, Xn = 512 * 1024, qn = wr | pr | mr | Er, fr = !ur && typeof cr == "number" ? cr | pr | mr | Er : null, ds = fr !== null ? () => fr : $n ? (s) => s < Xn ? qn : "w" : () => "w";
|
|
2648
2648
|
var us = (s, t, e) => {
|
|
2649
2649
|
try {
|
|
2650
2650
|
return fs.lchownSync(s, t, e);
|
|
@@ -3503,7 +3503,6 @@ function throwIfCancelled(signal) {
|
|
|
3503
3503
|
* below, enforced in the walk and the tar filter alike.
|
|
3504
3504
|
*/
|
|
3505
3505
|
var DEFAULT_BACKUP_LOCATIONS = [
|
|
3506
|
-
"config.yaml",
|
|
3507
3506
|
"addons",
|
|
3508
3507
|
"addons-data",
|
|
3509
3508
|
"tls",
|
|
@@ -3630,8 +3629,8 @@ var SystemBackupService = class {
|
|
|
3630
3629
|
return value;
|
|
3631
3630
|
}
|
|
3632
3631
|
async statLocation(loc) {
|
|
3633
|
-
const abs = path$
|
|
3634
|
-
if (!fs$
|
|
3632
|
+
const abs = path$1.isAbsolute(loc) ? loc : path$1.join(this.dataDir, loc);
|
|
3633
|
+
if (!fs$2.existsSync(abs)) return {
|
|
3635
3634
|
name: loc,
|
|
3636
3635
|
sizeBytes: 0,
|
|
3637
3636
|
fileCount: 0,
|
|
@@ -3677,19 +3676,19 @@ var SystemBackupService = class {
|
|
|
3677
3676
|
if (!selection.has("settings")) return this.createSnapshotsOnlyArchive(opts, selection, recipient);
|
|
3678
3677
|
const present = [];
|
|
3679
3678
|
for (const loc of requested) {
|
|
3680
|
-
const abs = path$
|
|
3681
|
-
if (fs$
|
|
3679
|
+
const abs = path$1.isAbsolute(loc) ? loc : path$1.join(this.dataDir, loc);
|
|
3680
|
+
if (fs$2.existsSync(abs)) present.push(loc);
|
|
3682
3681
|
else this.logger.debug("createArchive: skipping missing location", { meta: { location: loc } });
|
|
3683
3682
|
}
|
|
3684
3683
|
if (present.length === 0) throw new Error(`createArchive: no locations from {${requested.join(", ")}} exist under ${this.dataDir}`);
|
|
3685
|
-
fs$
|
|
3684
|
+
fs$2.mkdirSync(path$1.dirname(opts.archivePath), { recursive: true });
|
|
3686
3685
|
const walked = [];
|
|
3687
3686
|
for (const loc of present) {
|
|
3688
3687
|
throwIfCancelled(opts.signal);
|
|
3689
|
-
const abs = path$
|
|
3688
|
+
const abs = path$1.join(this.dataDir, loc);
|
|
3690
3689
|
const stat = await fsp.stat(abs);
|
|
3691
3690
|
if (stat.isDirectory()) for (const e of await walkAbs(abs, this.dataDir, this.exclusionPredicate(), opts.signal)) walked.push(e);
|
|
3692
|
-
else if (!isExcludedFromBackup(path$
|
|
3691
|
+
else if (!isExcludedFromBackup(path$1.relative(this.dataDir, abs))) walked.push(toArchiveEntry(abs, this.dataDir, stat));
|
|
3693
3692
|
}
|
|
3694
3693
|
const walkedPaths = new Set(walked.map((e) => e.path));
|
|
3695
3694
|
const ownedById = walked.some((e) => isSqlitePath(e.path)) ? await this.ownedDatabasesInScope(opts.owner, walkedPaths) : /* @__PURE__ */ new Map();
|
|
@@ -3766,7 +3765,7 @@ var SystemBackupService = class {
|
|
|
3766
3765
|
*/
|
|
3767
3766
|
async createSnapshotsOnlyArchive(opts, selection, recipient) {
|
|
3768
3767
|
if (opts.owner === void 0) throw new BackupSnapshotRefusedError("a snapshots-only archive needs the database owner, and none was given");
|
|
3769
|
-
fs$
|
|
3768
|
+
fs$2.mkdirSync(path$1.dirname(opts.archivePath), { recursive: true });
|
|
3770
3769
|
const ownedById = await this.ownedDatabasesInScope(opts.owner, null);
|
|
3771
3770
|
const selected = /* @__PURE__ */ new Map();
|
|
3772
3771
|
for (const [rel, databaseId] of ownedById) if (selection.has(databaseId)) selected.set(rel, databaseId);
|
|
@@ -3820,7 +3819,7 @@ var SystemBackupService = class {
|
|
|
3820
3819
|
async writeArchive(opts) {
|
|
3821
3820
|
const { present, manifest } = opts;
|
|
3822
3821
|
const manifestStagePath = `${opts.archivePath}.${process.pid}.manifest.json`;
|
|
3823
|
-
fs$
|
|
3822
|
+
fs$2.writeFileSync(manifestStagePath, JSON.stringify(manifest, null, 2), "utf-8");
|
|
3824
3823
|
this.logger.info("createArchive: tarring", { meta: {
|
|
3825
3824
|
archivePath: opts.archivePath,
|
|
3826
3825
|
locations: [...present],
|
|
@@ -3828,10 +3827,10 @@ var SystemBackupService = class {
|
|
|
3828
3827
|
totalBytes: manifest.totalBytes
|
|
3829
3828
|
} });
|
|
3830
3829
|
try {
|
|
3831
|
-
const stagedInDataDir = path$
|
|
3832
|
-
fs$
|
|
3833
|
-
const stagingRel = path$
|
|
3834
|
-
const excludePrefix = stagingRel && !stagingRel.startsWith("..") && !path$
|
|
3830
|
+
const stagedInDataDir = path$1.join(this.dataDir, ARCHIVE_MANIFEST_NAME);
|
|
3831
|
+
fs$2.copyFileSync(manifestStagePath, stagedInDataDir);
|
|
3832
|
+
const stagingRel = path$1.relative(this.dataDir, path$1.dirname(opts.archivePath));
|
|
3833
|
+
const excludePrefix = stagingRel && !stagingRel.startsWith("..") && !path$1.isAbsolute(stagingRel) ? stagingRel : null;
|
|
3835
3834
|
try {
|
|
3836
3835
|
const pack = Kn({
|
|
3837
3836
|
gzip: true,
|
|
@@ -3845,29 +3844,29 @@ var SystemBackupService = class {
|
|
|
3845
3844
|
return norm !== excludePrefix && !norm.startsWith(`${excludePrefix}/`);
|
|
3846
3845
|
}
|
|
3847
3846
|
}, [ARCHIVE_MANIFEST_NAME, ...opts.tarRoots ?? present]);
|
|
3848
|
-
const sink = fs$
|
|
3847
|
+
const sink = fs$2.createWriteStream(opts.archivePath, { mode: 384 });
|
|
3849
3848
|
try {
|
|
3850
3849
|
const streamOpts = opts.signal ? { signal: opts.signal } : {};
|
|
3851
3850
|
if (opts.encryptTo !== void 0) await pipeline(pack, createBackupEncryptStream(opts.encryptTo), byteCountingPassthrough(opts.onArchiveBytes), sink, streamOpts);
|
|
3852
3851
|
else await pipeline(pack, byteCountingPassthrough(opts.onArchiveBytes), sink, streamOpts);
|
|
3853
3852
|
} catch (err) {
|
|
3854
3853
|
try {
|
|
3855
|
-
fs$
|
|
3854
|
+
fs$2.rmSync(opts.archivePath, { force: true });
|
|
3856
3855
|
} catch {}
|
|
3857
3856
|
if (opts.signal?.aborted) throw new BackupCancelledError();
|
|
3858
3857
|
throw err;
|
|
3859
3858
|
}
|
|
3860
3859
|
} finally {
|
|
3861
3860
|
try {
|
|
3862
|
-
fs$
|
|
3861
|
+
fs$2.rmSync(stagedInDataDir, { force: true });
|
|
3863
3862
|
} catch {}
|
|
3864
3863
|
}
|
|
3865
3864
|
} finally {
|
|
3866
3865
|
try {
|
|
3867
|
-
fs$
|
|
3866
|
+
fs$2.rmSync(manifestStagePath, { force: true });
|
|
3868
3867
|
} catch {}
|
|
3869
3868
|
}
|
|
3870
|
-
const sizeBytes = fs$
|
|
3869
|
+
const sizeBytes = fs$2.statSync(opts.archivePath).size;
|
|
3871
3870
|
return {
|
|
3872
3871
|
archivePath: opts.archivePath,
|
|
3873
3872
|
includedLocations: [...present],
|
|
@@ -3880,7 +3879,7 @@ var SystemBackupService = class {
|
|
|
3880
3879
|
* one entry we care about, then aborts.
|
|
3881
3880
|
*/
|
|
3882
3881
|
async readArchiveManifest(archivePath) {
|
|
3883
|
-
if (!fs$
|
|
3882
|
+
if (!fs$2.existsSync(archivePath)) throw new Error(`readArchiveManifest: ${archivePath} does not exist`);
|
|
3884
3883
|
return new Promise((resolve, reject) => {
|
|
3885
3884
|
const chunks = [];
|
|
3886
3885
|
let found = false;
|
|
@@ -3912,7 +3911,7 @@ var SystemBackupService = class {
|
|
|
3912
3911
|
reject(err);
|
|
3913
3912
|
}
|
|
3914
3913
|
});
|
|
3915
|
-
const reader = fs$
|
|
3914
|
+
const reader = fs$2.createReadStream(archivePath);
|
|
3916
3915
|
reader.on("error", (err) => {
|
|
3917
3916
|
if (!resolved) {
|
|
3918
3917
|
resolved = true;
|
|
@@ -3930,7 +3929,7 @@ var SystemBackupService = class {
|
|
|
3930
3929
|
* restart.
|
|
3931
3930
|
*/
|
|
3932
3931
|
scheduleRestoreMarker(opts) {
|
|
3933
|
-
if (!fs$
|
|
3932
|
+
if (!fs$2.existsSync(opts.archivePath)) throw new Error(`scheduleRestoreMarker: ${opts.archivePath} missing`);
|
|
3934
3933
|
const markerPath = this.getRestoreMarkerPath();
|
|
3935
3934
|
const marker = {
|
|
3936
3935
|
archivePath: opts.archivePath,
|
|
@@ -3938,16 +3937,16 @@ var SystemBackupService = class {
|
|
|
3938
3937
|
source: opts.source,
|
|
3939
3938
|
...opts.locations ? { locations: [...opts.locations] } : {}
|
|
3940
3939
|
};
|
|
3941
|
-
fs$
|
|
3942
|
-
fs$
|
|
3940
|
+
fs$2.mkdirSync(path$1.dirname(markerPath), { recursive: true });
|
|
3941
|
+
fs$2.writeFileSync(markerPath, JSON.stringify(marker, null, 2), { mode: 384 });
|
|
3943
3942
|
return markerPath;
|
|
3944
3943
|
}
|
|
3945
3944
|
/** Read the pending-restore marker if one is present. */
|
|
3946
3945
|
readPendingMarker() {
|
|
3947
3946
|
const markerPath = this.getRestoreMarkerPath();
|
|
3948
|
-
if (!fs$
|
|
3947
|
+
if (!fs$2.existsSync(markerPath)) return null;
|
|
3949
3948
|
try {
|
|
3950
|
-
const raw = fs$
|
|
3949
|
+
const raw = fs$2.readFileSync(markerPath, "utf-8");
|
|
3951
3950
|
const parsed = JSON.parse(raw);
|
|
3952
3951
|
if (typeof parsed === "object" && parsed != null && typeof parsed.archivePath === "string") return parsed;
|
|
3953
3952
|
} catch (err) {
|
|
@@ -3958,7 +3957,7 @@ var SystemBackupService = class {
|
|
|
3958
3957
|
/** Drop the marker after a successful boot-time restore. */
|
|
3959
3958
|
clearPendingMarker() {
|
|
3960
3959
|
const markerPath = this.getRestoreMarkerPath();
|
|
3961
|
-
if (fs$
|
|
3960
|
+
if (fs$2.existsSync(markerPath)) fs$2.rmSync(markerPath, { force: true });
|
|
3962
3961
|
}
|
|
3963
3962
|
/**
|
|
3964
3963
|
* The databases the owner declares, archive-relative, that this walk found,
|
|
@@ -4002,7 +4001,7 @@ var SystemBackupService = class {
|
|
|
4002
4001
|
*/
|
|
4003
4002
|
async takeOwnerSnapshots(owner, selected, signal) {
|
|
4004
4003
|
const removeOwnedSnapshots = async () => {
|
|
4005
|
-
for (const db of selected.keys()) await this.removeSnapshot(path$
|
|
4004
|
+
for (const db of selected.keys()) await this.removeSnapshot(path$1.join(this.dataDir, db + DATABASE_SNAPSHOT_SUFFIX));
|
|
4006
4005
|
};
|
|
4007
4006
|
const taken = [];
|
|
4008
4007
|
try {
|
|
@@ -4047,7 +4046,7 @@ var SystemBackupService = class {
|
|
|
4047
4046
|
}
|
|
4048
4047
|
if (snapshotPath !== livePath + ".backup-snapshot") throw new BackupSnapshotRefusedError(`snapshot ${snapshotPath} does not sit beside the database ${livePath} it copies`);
|
|
4049
4048
|
if (livePath !== expectedLive || result.databaseId !== databaseId) throw new BackupSnapshotRefusedError(`snapshot copies ${livePath} (${result.databaseId}), but ${databaseId} (${expectedLive}) was asked for`);
|
|
4050
|
-
const absPath = path$
|
|
4049
|
+
const absPath = path$1.join(this.dataDir, snapshotPath);
|
|
4051
4050
|
const stat = await fsp.stat(absPath);
|
|
4052
4051
|
this.logger.info("createArchive: carrying the owner snapshot in place of the live database", { meta: {
|
|
4053
4052
|
database: livePath,
|
|
@@ -4080,12 +4079,12 @@ var SystemBackupService = class {
|
|
|
4080
4079
|
}
|
|
4081
4080
|
/** `abs` relative to the data root, or null when it lies outside it. */
|
|
4082
4081
|
archiveRelative(abs) {
|
|
4083
|
-
const rel = path$
|
|
4084
|
-
if (rel.length === 0 || rel.startsWith("..") || path$
|
|
4082
|
+
const rel = path$1.relative(path$1.resolve(this.dataDir), path$1.resolve(abs));
|
|
4083
|
+
if (rel.length === 0 || rel.startsWith("..") || path$1.isAbsolute(rel)) return null;
|
|
4085
4084
|
return normalizeArchivePath(rel);
|
|
4086
4085
|
}
|
|
4087
4086
|
getRestoreMarkerPath() {
|
|
4088
|
-
return path$
|
|
4087
|
+
return path$1.join(this.dataDir, ".pending-restore.json");
|
|
4089
4088
|
}
|
|
4090
4089
|
/**
|
|
4091
4090
|
* Absolute-path form of {@link isExcludedFromBackup}, anchored on
|
|
@@ -4093,7 +4092,7 @@ var SystemBackupService = class {
|
|
|
4093
4092
|
* stats so both agree with the tar filter about what a backup contains.
|
|
4094
4093
|
*/
|
|
4095
4094
|
exclusionPredicate() {
|
|
4096
|
-
return (abs) => isExcludedFromBackup(path$
|
|
4095
|
+
return (abs) => isExcludedFromBackup(path$1.relative(this.dataDir, abs));
|
|
4097
4096
|
}
|
|
4098
4097
|
};
|
|
4099
4098
|
/**
|
|
@@ -4124,7 +4123,7 @@ async function walkRec(abs, dataDir, out, shouldSkip, signal) {
|
|
|
4124
4123
|
} catch {
|
|
4125
4124
|
return;
|
|
4126
4125
|
}
|
|
4127
|
-
for (const child of children) await walkRec(path$
|
|
4126
|
+
for (const child of children) await walkRec(path$1.join(abs, child), dataDir, out, shouldSkip, signal);
|
|
4128
4127
|
}
|
|
4129
4128
|
}
|
|
4130
4129
|
/**
|
|
@@ -4141,10 +4140,10 @@ function byteCountingPassthrough(onBytes) {
|
|
|
4141
4140
|
} });
|
|
4142
4141
|
}
|
|
4143
4142
|
function toArchiveEntry(abs, dataDir, stat) {
|
|
4144
|
-
const rel = path$
|
|
4143
|
+
const rel = path$1.relative(dataDir, abs).replace(/\\/g, "/");
|
|
4145
4144
|
const kind = stat.isDirectory() ? "dir" : stat.isSymbolicLink() ? "symlink" : "file";
|
|
4146
4145
|
return {
|
|
4147
|
-
path: rel || path$
|
|
4146
|
+
path: rel || path$1.basename(abs),
|
|
4148
4147
|
kind,
|
|
4149
4148
|
sizeBytes: kind === "file" ? stat.size : 0,
|
|
4150
4149
|
mtime: stat.mtimeMs
|