@camstack/server 1.2.932 → 1.2.934
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 +18 -0
- package/dist/api/trpc/generated-cap-routers.js +20 -0
- package/package.json +8 -7
- package/system/dist/addon-utils.mjs +1 -1
- package/system/dist/{base-device-IuM1AwXZ.mjs → base-device-Bwiblqmn.mjs} +1 -1
- package/system/dist/{base-device-2sL1DMm1.js → base-device-C1z4zYGR.js} +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +3 -3
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +4 -4
- package/system/dist/builtins/alerts/alerts.addon.js +2 -2
- package/system/dist/builtins/alerts/alerts.addon.mjs +4 -4
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +4 -4
- package/system/dist/builtins/camera-grid/index.js +2 -2
- package/system/dist/builtins/camera-grid/index.mjs +2 -2
- package/system/dist/builtins/composer/composer.addon.js +5 -5
- package/system/dist/builtins/composer/composer.addon.mjs +5 -5
- package/system/dist/builtins/core-blocks/cap-links.d.ts +34 -0
- package/system/dist/builtins/core-blocks/core-blocks.addon.d.ts +4 -0
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +282 -8
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +282 -8
- package/system/dist/builtins/device-manager/device-manager.addon.js +18 -4
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +18 -4
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +3 -3
- package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +9 -9
- package/system/dist/builtins/platform-probe/index.mjs +9 -9
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +19 -19
- package/system/dist/builtins/system-config/system-config.addon.mjs +113 -113
- package/system/dist/{composition-sources-BEUWn2s_.mjs → composition-sources-B0QW4g86.mjs} +2 -2
- package/system/dist/{composition-sources-acfR4hDq.js → composition-sources-BtUx1MfU.js} +2 -2
- package/system/dist/{coral-accelerators-zTMTEd-8.mjs → coral-accelerators-BKcXP59c.mjs} +6 -6
- package/system/dist/{core-blocks.cap-BRPsLAij.mjs → core-blocks.cap-CnwBuf7E.mjs} +1524 -1267
- package/system/dist/{core-blocks.cap-BMeMCBrx.js → core-blocks.cap-DlEuHq-S.js} +1555 -1268
- package/system/dist/{custom-action-registry-N7flBDwT.mjs → custom-action-registry-B9zFBNVa.mjs} +37 -37
- package/system/dist/{error.cap-CSM_SRfR.mjs → error.cap-5zNPAgU2.mjs} +19 -2
- package/system/dist/{error.cap-DBhgPeWK.js → error.cap-BCqzFlo2.js} +24 -1
- package/system/dist/{hub-identity-_IOgPJ00.mjs → hub-identity-DjMN9Ac2.mjs} +9 -9
- package/system/dist/{hub-mdns-ciao-Dk7ts_Uk.mjs → hub-mdns-ciao-DBrtHOcc.mjs} +1 -1
- package/system/dist/index.js +2 -2
- package/system/dist/index.mjs +214 -214
- package/system/dist/{prefix-walk-ifwg_ukx.mjs → prefix-walk-CRnbYJcC.mjs} +2 -2
- package/system/dist/{prefix-walk-BkMxoXpL.js → prefix-walk-DD1BM923.js} +2 -2
- package/system/dist/{rename-composition-block-BJsL58Ih.js → rename-composition-block-BRgyBO25.js} +20 -2
- package/system/dist/{rename-composition-block-OAtErZgq.mjs → rename-composition-block-BYRBlx-V.mjs} +20 -2
- package/system/dist/{restore-archive-kSFNjkWY.mjs → restore-archive-CjAyKpgX.mjs} +93 -93
- package/system/package.json +1 -1
|
@@ -4,8 +4,8 @@ import { r as DATABASE_SNAPSHOT_SUFFIX } from "./database-snapshot.cap-dhrc9xnY.
|
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { createCipheriv, createDecipheriv, createHash, createPrivateKey, createPublicKey, diffieHellman, generateKeyPairSync, hkdfSync, randomBytes } from "node:crypto";
|
|
6
6
|
import { Buffer as Buffer$1 } from "buffer";
|
|
7
|
-
import * as fs$
|
|
8
|
-
import
|
|
7
|
+
import * as fs$2 from "node:fs";
|
|
8
|
+
import fs from "node:fs";
|
|
9
9
|
import * as path$1 from "node:path";
|
|
10
10
|
import path, { basename, join, posix, win32 } from "node:path";
|
|
11
11
|
import * as fsp from "node:fs/promises";
|
|
@@ -461,7 +461,7 @@ async function readBackupEncryptionHeader(file) {
|
|
|
461
461
|
async function decryptBackupFile(input, output, secretKey) {
|
|
462
462
|
const decrypt = createBackupDecryptStream(secretKey);
|
|
463
463
|
try {
|
|
464
|
-
await pipeline(fs$
|
|
464
|
+
await pipeline(fs$2.createReadStream(input), decrypt, fs$2.createWriteStream(output, { mode: 384 }));
|
|
465
465
|
} catch (err) {
|
|
466
466
|
await fsp.rm(output, { force: true }).catch(() => void 0);
|
|
467
467
|
throw err;
|
|
@@ -1856,15 +1856,15 @@ var An = (s) => {
|
|
|
1856
1856
|
}, In = (s) => {
|
|
1857
1857
|
let t = new st(s), e = s.file, i;
|
|
1858
1858
|
try {
|
|
1859
|
-
i =
|
|
1860
|
-
let r =
|
|
1859
|
+
i = fs.openSync(e, "r");
|
|
1860
|
+
let r = fs.fstatSync(i), n = s.maxReadSize || 16 * 1024 * 1024;
|
|
1861
1861
|
if (r.size < n) {
|
|
1862
|
-
let o = Buffer.allocUnsafe(r.size), a =
|
|
1862
|
+
let o = Buffer.allocUnsafe(r.size), a = fs.readSync(i, o, 0, r.size, 0);
|
|
1863
1863
|
t.end(a === o.byteLength ? o : o.subarray(0, a));
|
|
1864
1864
|
} else {
|
|
1865
1865
|
let o = 0, a = Buffer.allocUnsafe(n);
|
|
1866
1866
|
for (; o < r.size;) {
|
|
1867
|
-
let h =
|
|
1867
|
+
let h = fs.readSync(i, a, 0, n, o);
|
|
1868
1868
|
if (h === 0) break;
|
|
1869
1869
|
o += h, t.write(a.subarray(0, h));
|
|
1870
1870
|
}
|
|
@@ -1872,13 +1872,13 @@ var An = (s) => {
|
|
|
1872
1872
|
}
|
|
1873
1873
|
} finally {
|
|
1874
1874
|
if (typeof i == "number") try {
|
|
1875
|
-
|
|
1875
|
+
fs.closeSync(i);
|
|
1876
1876
|
} catch {}
|
|
1877
1877
|
}
|
|
1878
1878
|
}, Fn = (s, t) => {
|
|
1879
1879
|
let e = new st(s), i = s.maxReadSize || 16 * 1024 * 1024, r = s.file;
|
|
1880
1880
|
return new Promise((o, a) => {
|
|
1881
|
-
e.on("error", a), e.on("end", o),
|
|
1881
|
+
e.on("error", a), e.on("end", o), fs.stat(r, (h, l) => {
|
|
1882
1882
|
if (h) a(h);
|
|
1883
1883
|
else {
|
|
1884
1884
|
let c = new _t(r, {
|
|
@@ -2399,7 +2399,7 @@ var mi = class {
|
|
|
2399
2399
|
constructor(t, e) {
|
|
2400
2400
|
this.path = t || "./", this.absolute = e;
|
|
2401
2401
|
}
|
|
2402
|
-
}, 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 = 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 {
|
|
2402
|
+
}, 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 {
|
|
2403
2403
|
sync = !1;
|
|
2404
2404
|
opt;
|
|
2405
2405
|
cwd;
|
|
@@ -2477,7 +2477,7 @@ var mi = class {
|
|
|
2477
2477
|
}
|
|
2478
2478
|
this[Ct]();
|
|
2479
2479
|
}
|
|
2480
|
-
[fs](t) {
|
|
2480
|
+
[fs$1](t) {
|
|
2481
2481
|
t.pending = !0, this[G] += 1, I.readdir(t.absolute, (e, i) => {
|
|
2482
2482
|
if (t.pending = !1, this[G] -= 1, e) return this.emit("error", e);
|
|
2483
2483
|
this[ci](t, i);
|
|
@@ -2524,7 +2524,7 @@ var mi = class {
|
|
|
2524
2524
|
if (t.stat && !t.ignore) {
|
|
2525
2525
|
if (!this.noDirRecurse && t.stat.isDirectory() && !t.readdir) {
|
|
2526
2526
|
let e = this.readdirCache.get(t.absolute);
|
|
2527
|
-
if (e ? this[ci](t, e) : this[fs](t), !t.readdir) return;
|
|
2527
|
+
if (e ? this[ci](t, e) : this[fs$1](t), !t.readdir) return;
|
|
2528
2528
|
}
|
|
2529
2529
|
if (t.entry = this[rr](t), !t.entry) {
|
|
2530
2530
|
t.ignore = !0;
|
|
@@ -2593,7 +2593,7 @@ var mi = class {
|
|
|
2593
2593
|
let e = this.follow ? "statSync" : "lstatSync";
|
|
2594
2594
|
this[ai](t, I[e](t.absolute));
|
|
2595
2595
|
}
|
|
2596
|
-
[fs](t) {
|
|
2596
|
+
[fs$1](t) {
|
|
2597
2597
|
this[ci](t, I.readdirSync(t.absolute));
|
|
2598
2598
|
}
|
|
2599
2599
|
[fi](t) {
|
|
@@ -2649,12 +2649,12 @@ var Wn = (s, t) => {
|
|
|
2649
2649
|
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";
|
|
2650
2650
|
var us = (s, t, e) => {
|
|
2651
2651
|
try {
|
|
2652
|
-
return
|
|
2652
|
+
return fs.lchownSync(s, t, e);
|
|
2653
2653
|
} catch (i) {
|
|
2654
2654
|
if (i?.code !== "ENOENT") throw i;
|
|
2655
2655
|
}
|
|
2656
2656
|
}, pi = (s, t, e, i) => {
|
|
2657
|
-
|
|
2657
|
+
fs.lchown(s, t, e, (r) => {
|
|
2658
2658
|
i(r && r?.code !== "ENOENT" ? r : null);
|
|
2659
2659
|
});
|
|
2660
2660
|
}, Qn = (s, t, e, i, r) => {
|
|
@@ -2664,7 +2664,7 @@ var us = (s, t, e) => {
|
|
|
2664
2664
|
});
|
|
2665
2665
|
else pi(path.resolve(s, t.name), e, i, r);
|
|
2666
2666
|
}, ms = (s, t, e, i) => {
|
|
2667
|
-
|
|
2667
|
+
fs.readdir(s, { withFileTypes: !0 }, (r, n) => {
|
|
2668
2668
|
if (r) {
|
|
2669
2669
|
if (r.code === "ENOENT") return i();
|
|
2670
2670
|
if (r.code !== "ENOTDIR" && r.code !== "ENOTSUP") return i(r);
|
|
@@ -2683,7 +2683,7 @@ var us = (s, t, e) => {
|
|
|
2683
2683
|
}, ps = (s, t, e) => {
|
|
2684
2684
|
let i;
|
|
2685
2685
|
try {
|
|
2686
|
-
i =
|
|
2686
|
+
i = fs.readdirSync(s, { withFileTypes: !0 });
|
|
2687
2687
|
} catch (r) {
|
|
2688
2688
|
let n = r;
|
|
2689
2689
|
if (n?.code === "ENOENT") return;
|
|
@@ -2717,13 +2717,13 @@ var St = class extends Error {
|
|
|
2717
2717
|
}
|
|
2718
2718
|
};
|
|
2719
2719
|
var to = (s, t) => {
|
|
2720
|
-
|
|
2720
|
+
fs.stat(s, (e, i) => {
|
|
2721
2721
|
(e || !i.isDirectory()) && (e = new we(s, e?.code || "ENOTDIR")), t(e);
|
|
2722
2722
|
});
|
|
2723
2723
|
}, Sr = (s, t, e) => {
|
|
2724
2724
|
s = f(s);
|
|
2725
2725
|
let i = t.umask ?? 18, r = t.mode | 448, n = (r & i) !== 0, o = t.uid, a = t.gid, h = typeof o == "number" && typeof a == "number" && (o !== t.processUid || a !== t.processGid), l = t.preserve, c = t.unlink, d = f(t.cwd), S = (E, x) => {
|
|
2726
|
-
E ? e(E) : x && h ? ms(x, o, a, (xe) => S(xe)) : n ?
|
|
2726
|
+
E ? e(E) : x && h ? ms(x, o, a, (xe) => S(xe)) : n ? fs.chmod(s, r, e) : e();
|
|
2727
2727
|
};
|
|
2728
2728
|
if (s === d) return to(s, S);
|
|
2729
2729
|
if (l) return jn.mkdir(s, {
|
|
@@ -2734,14 +2734,14 @@ var to = (s, t) => {
|
|
|
2734
2734
|
}, Es = (s, t, e, i, r, n, o) => {
|
|
2735
2735
|
if (t.length === 0) return o(null, n);
|
|
2736
2736
|
let a = t.shift(), h = f(path.resolve(s + "/" + a));
|
|
2737
|
-
|
|
2737
|
+
fs.mkdir(h, e, yr(h, t, e, i, r, n, o));
|
|
2738
2738
|
}, yr = (s, t, e, i, r, n, o) => (a) => {
|
|
2739
|
-
a ?
|
|
2739
|
+
a ? fs.lstat(s, (h, l) => {
|
|
2740
2740
|
if (h) h.path = h.path && f(h.path), o(h);
|
|
2741
2741
|
else if (l.isDirectory()) Es(s, t, e, i, r, n, o);
|
|
2742
|
-
else if (i)
|
|
2742
|
+
else if (i) fs.unlink(s, (c) => {
|
|
2743
2743
|
if (c) return o(c);
|
|
2744
|
-
|
|
2744
|
+
fs.mkdir(s, e, yr(s, t, e, i, r, n, o));
|
|
2745
2745
|
});
|
|
2746
2746
|
else {
|
|
2747
2747
|
if (l.isSymbolicLink()) return o(new St(s, s + "/" + t.join("/")));
|
|
@@ -2751,7 +2751,7 @@ var to = (s, t) => {
|
|
|
2751
2751
|
}, eo = (s) => {
|
|
2752
2752
|
let t = !1, e;
|
|
2753
2753
|
try {
|
|
2754
|
-
t =
|
|
2754
|
+
t = fs.statSync(s).isDirectory();
|
|
2755
2755
|
} catch (i) {
|
|
2756
2756
|
e = i?.code;
|
|
2757
2757
|
} finally {
|
|
@@ -2760,10 +2760,10 @@ var to = (s, t) => {
|
|
|
2760
2760
|
}, Rr = (s, t) => {
|
|
2761
2761
|
s = f(s);
|
|
2762
2762
|
let e = t.umask ?? 18, i = t.mode | 448, r = (i & e) !== 0, n = t.uid, o = t.gid, a = typeof n == "number" && typeof o == "number" && (n !== t.processUid || o !== t.processGid), h = t.preserve, l = t.unlink, c = f(t.cwd), d = (E) => {
|
|
2763
|
-
E && a && ps(E, n, o), r &&
|
|
2763
|
+
E && a && ps(E, n, o), r && fs.chmodSync(s, i);
|
|
2764
2764
|
};
|
|
2765
2765
|
if (s === c) return eo(c), d();
|
|
2766
|
-
if (h) return d(
|
|
2766
|
+
if (h) return d(fs.mkdirSync(s, {
|
|
2767
2767
|
mode: i,
|
|
2768
2768
|
recursive: !0
|
|
2769
2769
|
}) ?? void 0);
|
|
@@ -2771,12 +2771,12 @@ var to = (s, t) => {
|
|
|
2771
2771
|
for (let E = T.shift(), x = c; E && (x += "/" + E); E = T.shift()) {
|
|
2772
2772
|
x = f(path.resolve(x));
|
|
2773
2773
|
try {
|
|
2774
|
-
|
|
2774
|
+
fs.mkdirSync(x, i), N = N || x;
|
|
2775
2775
|
} catch {
|
|
2776
|
-
let xe =
|
|
2776
|
+
let xe = fs.lstatSync(x);
|
|
2777
2777
|
if (xe.isDirectory()) continue;
|
|
2778
2778
|
if (l) {
|
|
2779
|
-
|
|
2779
|
+
fs.unlinkSync(x), fs.mkdirSync(x, i), N = N || x;
|
|
2780
2780
|
continue;
|
|
2781
2781
|
} else if (xe.isSymbolicLink()) return new St(x, x + "/" + T.join("/"));
|
|
2782
2782
|
}
|
|
@@ -2866,16 +2866,16 @@ var so = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) === "win32"
|
|
|
2866
2866
|
};
|
|
2867
2867
|
var Or = () => process.umask();
|
|
2868
2868
|
var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs = Symbol("isReusable"), P = Symbol("makeFs"), _s = Symbol("file"), Os = Symbol("directory"), Ri = Symbol("link"), Lr = Symbol("symlink"), Nr = Symbol("hardlink"), ye = Symbol("ensureNoSymlink"), Dr = Symbol("unsupported"), Ar = Symbol("checkPath"), Ss = Symbol("stripAbsolutePath"), yt = Symbol("mkdir"), O = Symbol("onError"), yi = Symbol("pending"), Ir = Symbol("pend"), $t = Symbol("unpend"), ys = Symbol("ended"), Rs = Symbol("maybeClose"), Ts = Symbol("skip"), Re = Symbol("doChown"), ge = Symbol("uid"), be = Symbol("gid"), _e = Symbol("checkedCwd"), Oe = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) === "win32", ho = 1024, ao = (s, t) => {
|
|
2869
|
-
if (!Oe) return
|
|
2869
|
+
if (!Oe) return fs.unlink(s, t);
|
|
2870
2870
|
let e = s + ".DELETE." + randomBytes(16).toString("hex");
|
|
2871
|
-
|
|
2871
|
+
fs.rename(s, e, (i) => {
|
|
2872
2872
|
if (i) return t(i);
|
|
2873
|
-
|
|
2873
|
+
fs.unlink(e, t);
|
|
2874
2874
|
});
|
|
2875
2875
|
}, lo = (s) => {
|
|
2876
|
-
if (!Oe) return
|
|
2876
|
+
if (!Oe) return fs.unlinkSync(s);
|
|
2877
2877
|
let t = s + ".DELETE." + randomBytes(16).toString("hex");
|
|
2878
|
-
|
|
2878
|
+
fs.renameSync(s, t), fs.unlinkSync(t);
|
|
2879
2879
|
}, Fr = (s, t, e) => s !== void 0 && s === s >>> 0 ? s : t !== void 0 && t === t >>> 0 ? t : e, Xt = class extends st {
|
|
2880
2880
|
[ys] = !1;
|
|
2881
2881
|
[_e] = !1;
|
|
@@ -3019,14 +3019,14 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3019
3019
|
autoClose: !1
|
|
3020
3020
|
});
|
|
3021
3021
|
r.on("error", (h) => {
|
|
3022
|
-
r.fd &&
|
|
3022
|
+
r.fd && fs.close(r.fd, () => {}), r.write = () => !0, this[O](h, t), e();
|
|
3023
3023
|
});
|
|
3024
3024
|
let n = 1, o = (h) => {
|
|
3025
3025
|
if (h) {
|
|
3026
|
-
r.fd &&
|
|
3026
|
+
r.fd && fs.close(r.fd, () => {}), this[O](h, t), e();
|
|
3027
3027
|
return;
|
|
3028
3028
|
}
|
|
3029
|
-
--n === 0 && r.fd !== void 0 &&
|
|
3029
|
+
--n === 0 && r.fd !== void 0 && fs.close(r.fd, (l) => {
|
|
3030
3030
|
l ? this[O](l, t) : this[$t](), e();
|
|
3031
3031
|
});
|
|
3032
3032
|
};
|
|
@@ -3035,12 +3035,12 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3035
3035
|
if (typeof l == "number" && t.mtime && !this.noMtime) {
|
|
3036
3036
|
n++;
|
|
3037
3037
|
let c = t.atime || /* @__PURE__ */ new Date(), d = t.mtime;
|
|
3038
|
-
|
|
3038
|
+
fs.futimes(l, c, d, (S) => S ? fs.utimes(h, c, d, (T) => o(T && S)) : o());
|
|
3039
3039
|
}
|
|
3040
3040
|
if (typeof l == "number" && this[Re](t)) {
|
|
3041
3041
|
n++;
|
|
3042
3042
|
let c = this[ge](t), d = this[be](t);
|
|
3043
|
-
typeof c == "number" && typeof d == "number" &&
|
|
3043
|
+
typeof c == "number" && typeof d == "number" && fs.fchown(l, c, d, (S) => S ? fs.chown(h, c, d, (T) => o(T && S)) : o());
|
|
3044
3044
|
}
|
|
3045
3045
|
o();
|
|
3046
3046
|
});
|
|
@@ -3059,7 +3059,7 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3059
3059
|
let n = 1, o = () => {
|
|
3060
3060
|
--n === 0 && (e(), this[$t](), t.resume());
|
|
3061
3061
|
};
|
|
3062
|
-
t.mtime && !this.noMtime && (n++,
|
|
3062
|
+
t.mtime && !this.noMtime && (n++, fs.utimes(String(t.absolute), t.atime || /* @__PURE__ */ new Date(), t.mtime, o)), this[Re](t) && (n++, fs.chown(String(t.absolute), Number(this[ge](t)), Number(this[be](t)), o)), o();
|
|
3063
3063
|
});
|
|
3064
3064
|
}
|
|
3065
3065
|
[Dr](t) {
|
|
@@ -3081,7 +3081,7 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3081
3081
|
let o = i.shift();
|
|
3082
3082
|
if (this.preservePaths || o === void 0) return r();
|
|
3083
3083
|
let a = path.resolve(e, o);
|
|
3084
|
-
|
|
3084
|
+
fs.lstat(a, (h, l) => {
|
|
3085
3085
|
if (h) return r();
|
|
3086
3086
|
if (l?.isSymbolicLink()) return n(new St(a, path.resolve(a, i.join("/"))));
|
|
3087
3087
|
this[ye](t, a, i, r, n);
|
|
@@ -3128,7 +3128,7 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3128
3128
|
}
|
|
3129
3129
|
o();
|
|
3130
3130
|
}, o = () => {
|
|
3131
|
-
|
|
3131
|
+
fs.lstat(String(t.absolute), (a, h) => {
|
|
3132
3132
|
if (h && (this.keep || this.newer && h.mtime > (t.mtime ?? h.mtime))) {
|
|
3133
3133
|
this[Ts](t), i();
|
|
3134
3134
|
return;
|
|
@@ -3137,9 +3137,9 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3137
3137
|
if (h.isDirectory()) {
|
|
3138
3138
|
if (t.type === "Directory") {
|
|
3139
3139
|
let l = this.chmod && t.mode && (h.mode & 4095) !== t.mode, c = (d) => this[P](d ?? null, t, i);
|
|
3140
|
-
return l ?
|
|
3140
|
+
return l ? fs.chmod(String(t.absolute), Number(t.mode), c) : c();
|
|
3141
3141
|
}
|
|
3142
|
-
if (t.absolute !== this.cwd) return
|
|
3142
|
+
if (t.absolute !== this.cwd) return fs.rmdir(String(t.absolute), (l) => this[P](l ?? null, t, i));
|
|
3143
3143
|
}
|
|
3144
3144
|
if (t.absolute === this.cwd) return this[P](null, t, i);
|
|
3145
3145
|
ao(String(t.absolute), (l) => this[P](l ?? null, t, i));
|
|
@@ -3163,7 +3163,7 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3163
3163
|
}
|
|
3164
3164
|
}
|
|
3165
3165
|
[Ri](t, e, i, r) {
|
|
3166
|
-
|
|
3166
|
+
fs[i](e, String(t.absolute), (n) => {
|
|
3167
3167
|
n ? this[O](n, t) : (this[$t](), t.resume()), r();
|
|
3168
3168
|
});
|
|
3169
3169
|
}
|
|
@@ -3191,17 +3191,17 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3191
3191
|
if (o) return this[O](o, t);
|
|
3192
3192
|
}
|
|
3193
3193
|
}
|
|
3194
|
-
let [e, i] = Se(() =>
|
|
3194
|
+
let [e, i] = Se(() => fs.lstatSync(String(t.absolute)));
|
|
3195
3195
|
if (i && (this.keep || this.newer && i.mtime > (t.mtime ?? i.mtime))) return this[Ts](t);
|
|
3196
3196
|
if (e || this[bs](t, i)) return this[P](null, t);
|
|
3197
3197
|
if (i.isDirectory()) {
|
|
3198
3198
|
if (t.type === "Directory") {
|
|
3199
3199
|
let [a] = this.chmod && t.mode && (i.mode & 4095) !== t.mode ? Se(() => {
|
|
3200
|
-
|
|
3200
|
+
fs.chmodSync(String(t.absolute), Number(t.mode));
|
|
3201
3201
|
}) : [];
|
|
3202
3202
|
return this[P](a, t);
|
|
3203
3203
|
}
|
|
3204
|
-
let [n] = Se(() =>
|
|
3204
|
+
let [n] = Se(() => fs.rmdirSync(String(t.absolute)));
|
|
3205
3205
|
this[P](n, t);
|
|
3206
3206
|
}
|
|
3207
3207
|
let [r] = t.absolute === this.cwd ? [] : Se(() => lo(String(t.absolute)));
|
|
@@ -3211,21 +3211,21 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3211
3211
|
let i = typeof t.mode == "number" ? t.mode & 4095 : this.fmode, r = (a) => {
|
|
3212
3212
|
let h;
|
|
3213
3213
|
try {
|
|
3214
|
-
|
|
3214
|
+
fs.closeSync(n);
|
|
3215
3215
|
} catch (l) {
|
|
3216
3216
|
h = l;
|
|
3217
3217
|
}
|
|
3218
3218
|
(a || h) && this[O](a || h, t), e();
|
|
3219
3219
|
}, n;
|
|
3220
3220
|
try {
|
|
3221
|
-
n =
|
|
3221
|
+
n = fs.openSync(String(t.absolute), ds(t.size), i);
|
|
3222
3222
|
} catch (a) {
|
|
3223
3223
|
return r(a);
|
|
3224
3224
|
}
|
|
3225
3225
|
let o = this.transform && this.transform(t) || t;
|
|
3226
3226
|
o !== t && (o.on("error", (a) => this[O](a, t)), t.pipe(o)), o.on("data", (a) => {
|
|
3227
3227
|
try {
|
|
3228
|
-
|
|
3228
|
+
fs.writeSync(n, a, 0, a.length);
|
|
3229
3229
|
} catch (h) {
|
|
3230
3230
|
r(h);
|
|
3231
3231
|
}
|
|
@@ -3234,10 +3234,10 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3234
3234
|
if (t.mtime && !this.noMtime) {
|
|
3235
3235
|
let h = t.atime || /* @__PURE__ */ new Date(), l = t.mtime;
|
|
3236
3236
|
try {
|
|
3237
|
-
|
|
3237
|
+
fs.futimesSync(n, h, l);
|
|
3238
3238
|
} catch (c) {
|
|
3239
3239
|
try {
|
|
3240
|
-
|
|
3240
|
+
fs.utimesSync(String(t.absolute), h, l);
|
|
3241
3241
|
} catch {
|
|
3242
3242
|
a = c;
|
|
3243
3243
|
}
|
|
@@ -3246,10 +3246,10 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3246
3246
|
if (this[Re](t)) {
|
|
3247
3247
|
let h = this[ge](t), l = this[be](t);
|
|
3248
3248
|
try {
|
|
3249
|
-
|
|
3249
|
+
fs.fchownSync(n, Number(h), Number(l));
|
|
3250
3250
|
} catch (c) {
|
|
3251
3251
|
try {
|
|
3252
|
-
|
|
3252
|
+
fs.chownSync(String(t.absolute), Number(h), Number(l));
|
|
3253
3253
|
} catch {
|
|
3254
3254
|
a = a || c;
|
|
3255
3255
|
}
|
|
@@ -3265,10 +3265,10 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3265
3265
|
return;
|
|
3266
3266
|
}
|
|
3267
3267
|
if (t.mtime && !this.noMtime) try {
|
|
3268
|
-
|
|
3268
|
+
fs.utimesSync(String(t.absolute), t.atime || /* @__PURE__ */ new Date(), t.mtime);
|
|
3269
3269
|
} catch {}
|
|
3270
3270
|
if (this[Re](t)) try {
|
|
3271
|
-
|
|
3271
|
+
fs.chownSync(String(t.absolute), Number(this[ge](t)), Number(this[be](t)));
|
|
3272
3272
|
} catch {}
|
|
3273
3273
|
e(), t.resume();
|
|
3274
3274
|
}
|
|
@@ -3294,7 +3294,7 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3294
3294
|
let o = e;
|
|
3295
3295
|
for (let a of i) {
|
|
3296
3296
|
o = path.resolve(o, a);
|
|
3297
|
-
let [h, l] = Se(() =>
|
|
3297
|
+
let [h, l] = Se(() => fs.lstatSync(o));
|
|
3298
3298
|
if (h) return r();
|
|
3299
3299
|
if (l.isSymbolicLink()) return n(new St(o, path.resolve(e, i.join("/"))));
|
|
3300
3300
|
}
|
|
@@ -3303,13 +3303,13 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3303
3303
|
[Ri](t, e, i, r) {
|
|
3304
3304
|
let n = `${i}Sync`;
|
|
3305
3305
|
try {
|
|
3306
|
-
|
|
3306
|
+
fs[n](e, String(t.absolute)), r(), t.resume();
|
|
3307
3307
|
} catch (o) {
|
|
3308
3308
|
return this[O](o, t);
|
|
3309
3309
|
}
|
|
3310
3310
|
}
|
|
3311
3311
|
}, co = (s) => {
|
|
3312
|
-
let t = new Te(s), e = s.file, i =
|
|
3312
|
+
let t = new Te(s), e = s.file, i = fs.statSync(e);
|
|
3313
3313
|
new Me(e, {
|
|
3314
3314
|
readSize: s.maxReadSize || 16 * 1024 * 1024,
|
|
3315
3315
|
size: i.size
|
|
@@ -3317,7 +3317,7 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3317
3317
|
}, fo = (s, t) => {
|
|
3318
3318
|
let e = new Xt(s), i = s.maxReadSize || 16 * 1024 * 1024, r = s.file;
|
|
3319
3319
|
return new Promise((o, a) => {
|
|
3320
|
-
e.on("error", a), e.on("close", o),
|
|
3320
|
+
e.on("error", a), e.on("close", o), fs.stat(r, (h, l) => {
|
|
3321
3321
|
if (h) a(h);
|
|
3322
3322
|
else {
|
|
3323
3323
|
let c = new _t(r, {
|
|
@@ -3336,15 +3336,15 @@ var mo = (s, t) => {
|
|
|
3336
3336
|
let e = new kt(s), i = !0, r, n;
|
|
3337
3337
|
try {
|
|
3338
3338
|
try {
|
|
3339
|
-
r =
|
|
3339
|
+
r = fs.openSync(s.file, "r+");
|
|
3340
3340
|
} catch (h) {
|
|
3341
|
-
if (h?.code === "ENOENT") r =
|
|
3341
|
+
if (h?.code === "ENOENT") r = fs.openSync(s.file, "w+");
|
|
3342
3342
|
else throw h;
|
|
3343
3343
|
}
|
|
3344
|
-
let o =
|
|
3344
|
+
let o = fs.fstatSync(r), a = Buffer.alloc(512);
|
|
3345
3345
|
t: for (n = 0; n < o.size; n += 512) {
|
|
3346
3346
|
for (let c = 0, d = 0; c < 512; c += d) {
|
|
3347
|
-
if (d =
|
|
3347
|
+
if (d = fs.readSync(r, a, c, a.length - c, n + c), n === 0 && a[0] === 31 && a[1] === 139) throw new Error("cannot append to compressed archives");
|
|
3348
3348
|
if (!d) break t;
|
|
3349
3349
|
}
|
|
3350
3350
|
let h = new C(a);
|
|
@@ -3356,7 +3356,7 @@ var mo = (s, t) => {
|
|
|
3356
3356
|
i = !1, po(s, e, n, r, t);
|
|
3357
3357
|
} finally {
|
|
3358
3358
|
if (i) try {
|
|
3359
|
-
|
|
3359
|
+
fs.closeSync(r);
|
|
3360
3360
|
} catch {}
|
|
3361
3361
|
}
|
|
3362
3362
|
}, po = (s, t, e, i, r) => {
|
|
@@ -3369,29 +3369,29 @@ var mo = (s, t) => {
|
|
|
3369
3369
|
t = Array.from(t);
|
|
3370
3370
|
let e = new wt(s), i = (n, o, a) => {
|
|
3371
3371
|
let h = (T, N) => {
|
|
3372
|
-
T ?
|
|
3372
|
+
T ? fs.close(n, (E) => a(T)) : a(null, N);
|
|
3373
3373
|
}, l = 0;
|
|
3374
3374
|
if (o === 0) return h(null, 0);
|
|
3375
3375
|
let c = 0, d = Buffer.alloc(512), S = (T, N) => {
|
|
3376
3376
|
if (T || N === void 0) return h(T);
|
|
3377
|
-
if (c += N, c < 512 && N) return
|
|
3377
|
+
if (c += N, c < 512 && N) return fs.read(n, d, c, d.length - c, l + c, S);
|
|
3378
3378
|
if (l === 0 && d[0] === 31 && d[1] === 139) return h(/* @__PURE__ */ new Error("cannot append to compressed archives"));
|
|
3379
3379
|
if (c < 512) return h(null, l);
|
|
3380
3380
|
let E = new C(d);
|
|
3381
3381
|
if (!E.cksumValid) return h(null, l);
|
|
3382
3382
|
let x = 512 * Math.ceil((E.size ?? 0) / 512);
|
|
3383
3383
|
if (l + x + 512 > o || (l += x + 512, l >= o)) return h(null, l);
|
|
3384
|
-
s.mtimeCache && E.mtime && s.mtimeCache.set(String(E.path), E.mtime), c = 0,
|
|
3384
|
+
s.mtimeCache && E.mtime && s.mtimeCache.set(String(E.path), E.mtime), c = 0, fs.read(n, d, 0, 512, l, S);
|
|
3385
3385
|
};
|
|
3386
|
-
|
|
3386
|
+
fs.read(n, d, 0, 512, l, S);
|
|
3387
3387
|
};
|
|
3388
3388
|
return new Promise((n, o) => {
|
|
3389
3389
|
e.on("error", o);
|
|
3390
3390
|
let a = "r+", h = (l, c) => {
|
|
3391
|
-
if (l && l.code === "ENOENT" && a === "r+") return a = "w+",
|
|
3391
|
+
if (l && l.code === "ENOENT" && a === "r+") return a = "w+", fs.open(s.file, a, h);
|
|
3392
3392
|
if (l || !c) return o(l);
|
|
3393
|
-
|
|
3394
|
-
if (d) return
|
|
3393
|
+
fs.fstat(c, (d, S) => {
|
|
3394
|
+
if (d) return fs.close(c, () => o(d));
|
|
3395
3395
|
i(c, S.size, (T, N) => {
|
|
3396
3396
|
if (T) return o(T);
|
|
3397
3397
|
let E = new tt(s.file, {
|
|
@@ -3402,7 +3402,7 @@ var mo = (s, t) => {
|
|
|
3402
3402
|
});
|
|
3403
3403
|
});
|
|
3404
3404
|
};
|
|
3405
|
-
|
|
3405
|
+
fs.open(s.file, a, h);
|
|
3406
3406
|
});
|
|
3407
3407
|
}, wo = (s, t) => {
|
|
3408
3408
|
t.forEach((e) => {
|
|
@@ -3632,7 +3632,7 @@ var SystemBackupService = class {
|
|
|
3632
3632
|
}
|
|
3633
3633
|
async statLocation(loc) {
|
|
3634
3634
|
const abs = path$1.isAbsolute(loc) ? loc : path$1.join(this.dataDir, loc);
|
|
3635
|
-
if (!fs$
|
|
3635
|
+
if (!fs$2.existsSync(abs)) return {
|
|
3636
3636
|
name: loc,
|
|
3637
3637
|
sizeBytes: 0,
|
|
3638
3638
|
fileCount: 0,
|
|
@@ -3679,11 +3679,11 @@ var SystemBackupService = class {
|
|
|
3679
3679
|
const present = [];
|
|
3680
3680
|
for (const loc of requested) {
|
|
3681
3681
|
const abs = path$1.isAbsolute(loc) ? loc : path$1.join(this.dataDir, loc);
|
|
3682
|
-
if (fs$
|
|
3682
|
+
if (fs$2.existsSync(abs)) present.push(loc);
|
|
3683
3683
|
else this.logger.debug("createArchive: skipping missing location", { meta: { location: loc } });
|
|
3684
3684
|
}
|
|
3685
3685
|
if (present.length === 0) throw new Error(`createArchive: no locations from {${requested.join(", ")}} exist under ${this.dataDir}`);
|
|
3686
|
-
fs$
|
|
3686
|
+
fs$2.mkdirSync(path$1.dirname(opts.archivePath), { recursive: true });
|
|
3687
3687
|
const walked = [];
|
|
3688
3688
|
for (const loc of present) {
|
|
3689
3689
|
throwIfCancelled(opts.signal);
|
|
@@ -3767,7 +3767,7 @@ var SystemBackupService = class {
|
|
|
3767
3767
|
*/
|
|
3768
3768
|
async createSnapshotsOnlyArchive(opts, selection, recipient) {
|
|
3769
3769
|
if (opts.owner === void 0) throw new BackupSnapshotRefusedError("a snapshots-only archive needs the database owner, and none was given");
|
|
3770
|
-
fs$
|
|
3770
|
+
fs$2.mkdirSync(path$1.dirname(opts.archivePath), { recursive: true });
|
|
3771
3771
|
const ownedById = await this.ownedDatabasesInScope(opts.owner, null);
|
|
3772
3772
|
const selected = /* @__PURE__ */ new Map();
|
|
3773
3773
|
for (const [rel, databaseId] of ownedById) if (selection.has(databaseId)) selected.set(rel, databaseId);
|
|
@@ -3821,7 +3821,7 @@ var SystemBackupService = class {
|
|
|
3821
3821
|
async writeArchive(opts) {
|
|
3822
3822
|
const { present, manifest } = opts;
|
|
3823
3823
|
const manifestStagePath = `${opts.archivePath}.${process.pid}.manifest.json`;
|
|
3824
|
-
fs$
|
|
3824
|
+
fs$2.writeFileSync(manifestStagePath, JSON.stringify(manifest, null, 2), "utf-8");
|
|
3825
3825
|
this.logger.info("createArchive: tarring", { meta: {
|
|
3826
3826
|
archivePath: opts.archivePath,
|
|
3827
3827
|
locations: [...present],
|
|
@@ -3830,7 +3830,7 @@ var SystemBackupService = class {
|
|
|
3830
3830
|
} });
|
|
3831
3831
|
try {
|
|
3832
3832
|
const stagedInDataDir = path$1.join(this.dataDir, ARCHIVE_MANIFEST_NAME);
|
|
3833
|
-
fs$
|
|
3833
|
+
fs$2.copyFileSync(manifestStagePath, stagedInDataDir);
|
|
3834
3834
|
const stagingRel = path$1.relative(this.dataDir, path$1.dirname(opts.archivePath));
|
|
3835
3835
|
const excludePrefix = stagingRel && !stagingRel.startsWith("..") && !path$1.isAbsolute(stagingRel) ? stagingRel : null;
|
|
3836
3836
|
try {
|
|
@@ -3846,29 +3846,29 @@ var SystemBackupService = class {
|
|
|
3846
3846
|
return norm !== excludePrefix && !norm.startsWith(`${excludePrefix}/`);
|
|
3847
3847
|
}
|
|
3848
3848
|
}, [ARCHIVE_MANIFEST_NAME, ...opts.tarRoots ?? present]);
|
|
3849
|
-
const sink = fs$
|
|
3849
|
+
const sink = fs$2.createWriteStream(opts.archivePath, { mode: 384 });
|
|
3850
3850
|
try {
|
|
3851
3851
|
const streamOpts = opts.signal ? { signal: opts.signal } : {};
|
|
3852
3852
|
if (opts.encryptTo !== void 0) await pipeline(pack, createBackupEncryptStream(opts.encryptTo), byteCountingPassthrough(opts.onArchiveBytes), sink, streamOpts);
|
|
3853
3853
|
else await pipeline(pack, byteCountingPassthrough(opts.onArchiveBytes), sink, streamOpts);
|
|
3854
3854
|
} catch (err) {
|
|
3855
3855
|
try {
|
|
3856
|
-
fs$
|
|
3856
|
+
fs$2.rmSync(opts.archivePath, { force: true });
|
|
3857
3857
|
} catch {}
|
|
3858
3858
|
if (opts.signal?.aborted) throw new BackupCancelledError();
|
|
3859
3859
|
throw err;
|
|
3860
3860
|
}
|
|
3861
3861
|
} finally {
|
|
3862
3862
|
try {
|
|
3863
|
-
fs$
|
|
3863
|
+
fs$2.rmSync(stagedInDataDir, { force: true });
|
|
3864
3864
|
} catch {}
|
|
3865
3865
|
}
|
|
3866
3866
|
} finally {
|
|
3867
3867
|
try {
|
|
3868
|
-
fs$
|
|
3868
|
+
fs$2.rmSync(manifestStagePath, { force: true });
|
|
3869
3869
|
} catch {}
|
|
3870
3870
|
}
|
|
3871
|
-
const sizeBytes = fs$
|
|
3871
|
+
const sizeBytes = fs$2.statSync(opts.archivePath).size;
|
|
3872
3872
|
return {
|
|
3873
3873
|
archivePath: opts.archivePath,
|
|
3874
3874
|
includedLocations: [...present],
|
|
@@ -3881,7 +3881,7 @@ var SystemBackupService = class {
|
|
|
3881
3881
|
* one entry we care about, then aborts.
|
|
3882
3882
|
*/
|
|
3883
3883
|
async readArchiveManifest(archivePath) {
|
|
3884
|
-
if (!fs$
|
|
3884
|
+
if (!fs$2.existsSync(archivePath)) throw new Error(`readArchiveManifest: ${archivePath} does not exist`);
|
|
3885
3885
|
return new Promise((resolve, reject) => {
|
|
3886
3886
|
const chunks = [];
|
|
3887
3887
|
let found = false;
|
|
@@ -3913,7 +3913,7 @@ var SystemBackupService = class {
|
|
|
3913
3913
|
reject(err);
|
|
3914
3914
|
}
|
|
3915
3915
|
});
|
|
3916
|
-
const reader = fs$
|
|
3916
|
+
const reader = fs$2.createReadStream(archivePath);
|
|
3917
3917
|
reader.on("error", (err) => {
|
|
3918
3918
|
if (!resolved) {
|
|
3919
3919
|
resolved = true;
|
|
@@ -3931,7 +3931,7 @@ var SystemBackupService = class {
|
|
|
3931
3931
|
* restart.
|
|
3932
3932
|
*/
|
|
3933
3933
|
scheduleRestoreMarker(opts) {
|
|
3934
|
-
if (!fs$
|
|
3934
|
+
if (!fs$2.existsSync(opts.archivePath)) throw new Error(`scheduleRestoreMarker: ${opts.archivePath} missing`);
|
|
3935
3935
|
const markerPath = this.getRestoreMarkerPath();
|
|
3936
3936
|
const marker = {
|
|
3937
3937
|
archivePath: opts.archivePath,
|
|
@@ -3939,16 +3939,16 @@ var SystemBackupService = class {
|
|
|
3939
3939
|
source: opts.source,
|
|
3940
3940
|
...opts.locations ? { locations: [...opts.locations] } : {}
|
|
3941
3941
|
};
|
|
3942
|
-
fs$
|
|
3943
|
-
fs$
|
|
3942
|
+
fs$2.mkdirSync(path$1.dirname(markerPath), { recursive: true });
|
|
3943
|
+
fs$2.writeFileSync(markerPath, JSON.stringify(marker, null, 2), { mode: 384 });
|
|
3944
3944
|
return markerPath;
|
|
3945
3945
|
}
|
|
3946
3946
|
/** Read the pending-restore marker if one is present. */
|
|
3947
3947
|
readPendingMarker() {
|
|
3948
3948
|
const markerPath = this.getRestoreMarkerPath();
|
|
3949
|
-
if (!fs$
|
|
3949
|
+
if (!fs$2.existsSync(markerPath)) return null;
|
|
3950
3950
|
try {
|
|
3951
|
-
const raw = fs$
|
|
3951
|
+
const raw = fs$2.readFileSync(markerPath, "utf-8");
|
|
3952
3952
|
const parsed = JSON.parse(raw);
|
|
3953
3953
|
if (typeof parsed === "object" && parsed != null && typeof parsed.archivePath === "string") return parsed;
|
|
3954
3954
|
} catch (err) {
|
|
@@ -3959,7 +3959,7 @@ var SystemBackupService = class {
|
|
|
3959
3959
|
/** Drop the marker after a successful boot-time restore. */
|
|
3960
3960
|
clearPendingMarker() {
|
|
3961
3961
|
const markerPath = this.getRestoreMarkerPath();
|
|
3962
|
-
if (fs$
|
|
3962
|
+
if (fs$2.existsSync(markerPath)) fs$2.rmSync(markerPath, { force: true });
|
|
3963
3963
|
}
|
|
3964
3964
|
/**
|
|
3965
3965
|
* The databases the owner declares, archive-relative, that this walk found,
|