@camstack/system 1.2.468 → 1.2.469
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/addon-utils.mjs +1 -1
- package/dist/{agent-https-DJ8OzQOr.js → agent-https-5OgOR-eF.js} +1 -1
- package/dist/{agent-https-DR1wmhYY.mjs → agent-https-b-zX78oB.mjs} +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +4 -4
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +5 -5
- package/dist/builtins/alerts/alerts.addon.js +1 -1
- package/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/dist/builtins/autotrack/index.js +1 -1
- package/dist/builtins/autotrack/index.mjs +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +5 -5
- package/dist/builtins/calendars/calendars.addon.js +1 -1
- package/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/dist/builtins/camera-grid/index.js +1 -1
- package/dist/builtins/camera-grid/index.mjs +1 -1
- package/dist/builtins/composer/composer.addon.js +2 -2
- package/dist/builtins/composer/composer.addon.mjs +2 -2
- package/dist/builtins/console-logging/index.js +1 -1
- package/dist/builtins/console-logging/index.mjs +1 -1
- package/dist/builtins/core-blocks/core-blocks.addon.js +2 -2
- package/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
- package/dist/builtins/device-history/capture/capture-engine.d.ts +24 -4
- package/dist/builtins/device-history/device-history.addon.js +319 -44
- package/dist/builtins/device-history/device-history.addon.mjs +319 -44
- package/dist/builtins/device-history/query/history-query.d.ts +19 -2
- package/dist/builtins/device-history/retention/orphans.d.ts +50 -0
- package/dist/builtins/device-history/retention/retention.d.ts +9 -2
- package/dist/builtins/device-history/runtime/history-runtime.d.ts +10 -2
- package/dist/builtins/device-history/store/history-store.d.ts +5 -0
- package/dist/builtins/device-manager/device-manager.addon.js +2 -2
- package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
- package/dist/builtins/device-manager/device-meta-types.d.ts +2 -2
- package/dist/builtins/hub-forwarder/index.js +1 -1
- package/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/dist/builtins/keychain/index.js +3 -3
- package/dist/builtins/keychain/index.mjs +3 -3
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/dist/builtins/local-auth/local-auth.addon.js +2 -2
- package/dist/builtins/local-auth/local-auth.addon.mjs +5 -5
- package/dist/builtins/local-network/local-network.addon.js +2 -2
- package/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/dist/builtins/loki-logging/index.js +1 -1
- package/dist/builtins/loki-logging/index.mjs +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +10 -10
- package/dist/builtins/platform-probe/index.js +1 -1
- package/dist/builtins/platform-probe/index.mjs +8 -8
- package/dist/builtins/record-entries/index.js +1 -1
- package/dist/builtins/record-entries/index.mjs +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/dist/builtins/snapshot/index.js +1 -1
- package/dist/builtins/snapshot/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +20 -20
- package/dist/builtins/sqlite-storage/index.js +1 -1
- package/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +2 -2
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +2 -2
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/dist/builtins/system-config/system-config.addon.js +3 -3
- package/dist/builtins/system-config/system-config.addon.mjs +115 -115
- package/dist/builtins/winston-logging/index.js +1 -1
- package/dist/builtins/winston-logging/index.mjs +1 -1
- package/dist/{composition-sources-5rpWQhA1.js → composition-sources-BGXTiUZm.js} +1 -1
- package/dist/{composition-sources-Qto-S6MA.mjs → composition-sources-DTdzzyf0.mjs} +1 -1
- package/dist/{constants-CuO3rcw4.js → constants-2mPqJjkR.js} +1 -1
- package/dist/{constants-BWli8Cju.mjs → constants-md_POijo.mjs} +1 -1
- package/dist/{coral-accelerators-D_S1Fo5h.mjs → coral-accelerators-Qhn5TOYZ.mjs} +5 -5
- package/dist/{custom-action-registry-BGYDjTqY.mjs → custom-action-registry-DZSCLBuT.mjs} +37 -37
- package/dist/{device-ca-CGcaSheI.js → device-ca-CC58lmNV.js} +1 -1
- package/dist/{device-ca-C5cLlah1.mjs → device-ca-CFdyrqeJ.mjs} +1 -1
- package/dist/{dist-BpUtAgqR.mjs → dist-CtVVtyTX.mjs} +247 -119
- package/dist/{dist-l6zKmHEb.js → dist-DuBtzSCh.js} +258 -118
- package/dist/file-host-worker.js +1 -1
- package/dist/file-host-worker.mjs +1 -1
- package/dist/{hub-mdns-ciao-CIno_SNn.js → hub-mdns-ciao-BLsX_2cL.js} +2 -2
- package/dist/{hub-mdns-ciao-0KWDyIMD.mjs → hub-mdns-ciao-CmuWLPci.mjs} +2 -2
- package/dist/index.js +7 -7
- package/dist/index.mjs +225 -225
- package/dist/{restore-archive-B71JI-sP.js → restore-archive-CxPAuaNs.js} +1 -1
- package/dist/{restore-archive-DKxAZ9pI.mjs → restore-archive-D2w3z_ob.mjs} +94 -94
- package/dist/{wal-maintenance-BXYwFecW.mjs → wal-maintenance-DeluFl_1.mjs} +0 -0
- package/dist/{wal-maintenance-B6LSQ_OZ.js → wal-maintenance-EK28XXnc.js} +0 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ki as defineRecordKinds, M as DataStoreDatabaseSchema, x as DATABASE_SNAPSHOT_SUFFIX } from "./dist-CtVVtyTX.mjs";
|
|
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";
|
|
@@ -6,8 +6,8 @@ import * as fsp from "node:fs/promises";
|
|
|
6
6
|
import jn from "node:fs/promises";
|
|
7
7
|
import * as path$1 from "node:path";
|
|
8
8
|
import path, { basename, join, posix, win32 } from "node:path";
|
|
9
|
-
import * as fs$
|
|
10
|
-
import
|
|
9
|
+
import * as fs$2 from "node:fs";
|
|
10
|
+
import fs from "node:fs";
|
|
11
11
|
import { EventEmitter } from "node:events";
|
|
12
12
|
import As, { Transform } from "node:stream";
|
|
13
13
|
import { StringDecoder } from "node:string_decoder";
|
|
@@ -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;
|
|
@@ -1854,15 +1854,15 @@ var An = (s) => {
|
|
|
1854
1854
|
}, In = (s) => {
|
|
1855
1855
|
let t = new st(s), e = s.file, i;
|
|
1856
1856
|
try {
|
|
1857
|
-
i =
|
|
1858
|
-
let r =
|
|
1857
|
+
i = fs.openSync(e, "r");
|
|
1858
|
+
let r = fs.fstatSync(i), n = s.maxReadSize || 16 * 1024 * 1024;
|
|
1859
1859
|
if (r.size < n) {
|
|
1860
|
-
let o = Buffer.allocUnsafe(r.size), a =
|
|
1860
|
+
let o = Buffer.allocUnsafe(r.size), a = fs.readSync(i, o, 0, r.size, 0);
|
|
1861
1861
|
t.end(a === o.byteLength ? o : o.subarray(0, a));
|
|
1862
1862
|
} else {
|
|
1863
1863
|
let o = 0, a = Buffer.allocUnsafe(n);
|
|
1864
1864
|
for (; o < r.size;) {
|
|
1865
|
-
let h =
|
|
1865
|
+
let h = fs.readSync(i, a, 0, n, o);
|
|
1866
1866
|
if (h === 0) break;
|
|
1867
1867
|
o += h, t.write(a.subarray(0, h));
|
|
1868
1868
|
}
|
|
@@ -1870,13 +1870,13 @@ var An = (s) => {
|
|
|
1870
1870
|
}
|
|
1871
1871
|
} finally {
|
|
1872
1872
|
if (typeof i == "number") try {
|
|
1873
|
-
|
|
1873
|
+
fs.closeSync(i);
|
|
1874
1874
|
} catch {}
|
|
1875
1875
|
}
|
|
1876
1876
|
}, Fn = (s, t) => {
|
|
1877
1877
|
let e = new st(s), i = s.maxReadSize || 16 * 1024 * 1024, r = s.file;
|
|
1878
1878
|
return new Promise((o, a) => {
|
|
1879
|
-
e.on("error", a), e.on("end", o),
|
|
1879
|
+
e.on("error", a), e.on("end", o), fs.stat(r, (h, l) => {
|
|
1880
1880
|
if (h) a(h);
|
|
1881
1881
|
else {
|
|
1882
1882
|
let c = new _t(r, {
|
|
@@ -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 = 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 {
|
|
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;
|
|
@@ -2475,7 +2475,7 @@ var mi = class {
|
|
|
2475
2475
|
}
|
|
2476
2476
|
this[Ct]();
|
|
2477
2477
|
}
|
|
2478
|
-
[fs](t) {
|
|
2478
|
+
[fs$1](t) {
|
|
2479
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);
|
|
@@ -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](t), !t.readdir) return;
|
|
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;
|
|
@@ -2591,7 +2591,7 @@ var mi = class {
|
|
|
2591
2591
|
let e = this.follow ? "statSync" : "lstatSync";
|
|
2592
2592
|
this[ai](t, I[e](t.absolute));
|
|
2593
2593
|
}
|
|
2594
|
-
[fs](t) {
|
|
2594
|
+
[fs$1](t) {
|
|
2595
2595
|
this[ci](t, I.readdirSync(t.absolute));
|
|
2596
2596
|
}
|
|
2597
2597
|
[fi](t) {
|
|
@@ -2647,12 +2647,12 @@ var Wn = (s, t) => {
|
|
|
2647
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
|
-
return
|
|
2650
|
+
return fs.lchownSync(s, t, e);
|
|
2651
2651
|
} catch (i) {
|
|
2652
2652
|
if (i?.code !== "ENOENT") throw i;
|
|
2653
2653
|
}
|
|
2654
2654
|
}, pi = (s, t, e, i) => {
|
|
2655
|
-
|
|
2655
|
+
fs.lchown(s, t, e, (r) => {
|
|
2656
2656
|
i(r && r?.code !== "ENOENT" ? r : null);
|
|
2657
2657
|
});
|
|
2658
2658
|
}, Qn = (s, t, e, i, r) => {
|
|
@@ -2662,7 +2662,7 @@ var us = (s, t, e) => {
|
|
|
2662
2662
|
});
|
|
2663
2663
|
else pi(path.resolve(s, t.name), e, i, r);
|
|
2664
2664
|
}, ms = (s, t, e, i) => {
|
|
2665
|
-
|
|
2665
|
+
fs.readdir(s, { withFileTypes: !0 }, (r, n) => {
|
|
2666
2666
|
if (r) {
|
|
2667
2667
|
if (r.code === "ENOENT") return i();
|
|
2668
2668
|
if (r.code !== "ENOTDIR" && r.code !== "ENOTSUP") return i(r);
|
|
@@ -2681,7 +2681,7 @@ var us = (s, t, e) => {
|
|
|
2681
2681
|
}, ps = (s, t, e) => {
|
|
2682
2682
|
let i;
|
|
2683
2683
|
try {
|
|
2684
|
-
i =
|
|
2684
|
+
i = fs.readdirSync(s, { withFileTypes: !0 });
|
|
2685
2685
|
} catch (r) {
|
|
2686
2686
|
let n = r;
|
|
2687
2687
|
if (n?.code === "ENOENT") return;
|
|
@@ -2715,13 +2715,13 @@ var St = class extends Error {
|
|
|
2715
2715
|
}
|
|
2716
2716
|
};
|
|
2717
2717
|
var to = (s, t) => {
|
|
2718
|
-
|
|
2718
|
+
fs.stat(s, (e, i) => {
|
|
2719
2719
|
(e || !i.isDirectory()) && (e = new we(s, e?.code || "ENOTDIR")), t(e);
|
|
2720
2720
|
});
|
|
2721
2721
|
}, Sr = (s, t, e) => {
|
|
2722
2722
|
s = f(s);
|
|
2723
2723
|
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) => {
|
|
2724
|
-
E ? e(E) : x && h ? ms(x, o, a, (xe) => S(xe)) : n ?
|
|
2724
|
+
E ? e(E) : x && h ? ms(x, o, a, (xe) => S(xe)) : n ? fs.chmod(s, r, e) : e();
|
|
2725
2725
|
};
|
|
2726
2726
|
if (s === d) return to(s, S);
|
|
2727
2727
|
if (l) return jn.mkdir(s, {
|
|
@@ -2732,14 +2732,14 @@ var to = (s, t) => {
|
|
|
2732
2732
|
}, Es = (s, t, e, i, r, n, o) => {
|
|
2733
2733
|
if (t.length === 0) return o(null, n);
|
|
2734
2734
|
let a = t.shift(), h = f(path.resolve(s + "/" + a));
|
|
2735
|
-
|
|
2735
|
+
fs.mkdir(h, e, yr(h, t, e, i, r, n, o));
|
|
2736
2736
|
}, yr = (s, t, e, i, r, n, o) => (a) => {
|
|
2737
|
-
a ?
|
|
2737
|
+
a ? fs.lstat(s, (h, l) => {
|
|
2738
2738
|
if (h) h.path = h.path && f(h.path), o(h);
|
|
2739
2739
|
else if (l.isDirectory()) Es(s, t, e, i, r, n, o);
|
|
2740
|
-
else if (i)
|
|
2740
|
+
else if (i) fs.unlink(s, (c) => {
|
|
2741
2741
|
if (c) return o(c);
|
|
2742
|
-
|
|
2742
|
+
fs.mkdir(s, e, yr(s, t, e, i, r, n, o));
|
|
2743
2743
|
});
|
|
2744
2744
|
else {
|
|
2745
2745
|
if (l.isSymbolicLink()) return o(new St(s, s + "/" + t.join("/")));
|
|
@@ -2749,7 +2749,7 @@ var to = (s, t) => {
|
|
|
2749
2749
|
}, eo = (s) => {
|
|
2750
2750
|
let t = !1, e;
|
|
2751
2751
|
try {
|
|
2752
|
-
t =
|
|
2752
|
+
t = fs.statSync(s).isDirectory();
|
|
2753
2753
|
} catch (i) {
|
|
2754
2754
|
e = i?.code;
|
|
2755
2755
|
} finally {
|
|
@@ -2758,10 +2758,10 @@ var to = (s, t) => {
|
|
|
2758
2758
|
}, Rr = (s, t) => {
|
|
2759
2759
|
s = f(s);
|
|
2760
2760
|
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) => {
|
|
2761
|
-
E && a && ps(E, n, o), r &&
|
|
2761
|
+
E && a && ps(E, n, o), r && fs.chmodSync(s, i);
|
|
2762
2762
|
};
|
|
2763
2763
|
if (s === c) return eo(c), d();
|
|
2764
|
-
if (h) return d(
|
|
2764
|
+
if (h) return d(fs.mkdirSync(s, {
|
|
2765
2765
|
mode: i,
|
|
2766
2766
|
recursive: !0
|
|
2767
2767
|
}) ?? void 0);
|
|
@@ -2769,12 +2769,12 @@ var to = (s, t) => {
|
|
|
2769
2769
|
for (let E = T.shift(), x = c; E && (x += "/" + E); E = T.shift()) {
|
|
2770
2770
|
x = f(path.resolve(x));
|
|
2771
2771
|
try {
|
|
2772
|
-
|
|
2772
|
+
fs.mkdirSync(x, i), N = N || x;
|
|
2773
2773
|
} catch {
|
|
2774
|
-
let xe =
|
|
2774
|
+
let xe = fs.lstatSync(x);
|
|
2775
2775
|
if (xe.isDirectory()) continue;
|
|
2776
2776
|
if (l) {
|
|
2777
|
-
|
|
2777
|
+
fs.unlinkSync(x), fs.mkdirSync(x, i), N = N || x;
|
|
2778
2778
|
continue;
|
|
2779
2779
|
} else if (xe.isSymbolicLink()) return new St(x, x + "/" + T.join("/"));
|
|
2780
2780
|
}
|
|
@@ -2864,16 +2864,16 @@ var so = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) === "win32"
|
|
|
2864
2864
|
};
|
|
2865
2865
|
var Or = () => process.umask();
|
|
2866
2866
|
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) => {
|
|
2867
|
-
if (!Oe) return
|
|
2867
|
+
if (!Oe) return fs.unlink(s, t);
|
|
2868
2868
|
let e = s + ".DELETE." + randomBytes(16).toString("hex");
|
|
2869
|
-
|
|
2869
|
+
fs.rename(s, e, (i) => {
|
|
2870
2870
|
if (i) return t(i);
|
|
2871
|
-
|
|
2871
|
+
fs.unlink(e, t);
|
|
2872
2872
|
});
|
|
2873
2873
|
}, lo = (s) => {
|
|
2874
|
-
if (!Oe) return
|
|
2874
|
+
if (!Oe) return fs.unlinkSync(s);
|
|
2875
2875
|
let t = s + ".DELETE." + randomBytes(16).toString("hex");
|
|
2876
|
-
|
|
2876
|
+
fs.renameSync(s, t), fs.unlinkSync(t);
|
|
2877
2877
|
}, Fr = (s, t, e) => s !== void 0 && s === s >>> 0 ? s : t !== void 0 && t === t >>> 0 ? t : e, Xt = class extends st {
|
|
2878
2878
|
[ys] = !1;
|
|
2879
2879
|
[_e] = !1;
|
|
@@ -3017,14 +3017,14 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3017
3017
|
autoClose: !1
|
|
3018
3018
|
});
|
|
3019
3019
|
r.on("error", (h) => {
|
|
3020
|
-
r.fd &&
|
|
3020
|
+
r.fd && fs.close(r.fd, () => {}), r.write = () => !0, this[O](h, t), e();
|
|
3021
3021
|
});
|
|
3022
3022
|
let n = 1, o = (h) => {
|
|
3023
3023
|
if (h) {
|
|
3024
|
-
r.fd &&
|
|
3024
|
+
r.fd && fs.close(r.fd, () => {}), this[O](h, t), e();
|
|
3025
3025
|
return;
|
|
3026
3026
|
}
|
|
3027
|
-
--n === 0 && r.fd !== void 0 &&
|
|
3027
|
+
--n === 0 && r.fd !== void 0 && fs.close(r.fd, (l) => {
|
|
3028
3028
|
l ? this[O](l, t) : this[$t](), e();
|
|
3029
3029
|
});
|
|
3030
3030
|
};
|
|
@@ -3033,12 +3033,12 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3033
3033
|
if (typeof l == "number" && t.mtime && !this.noMtime) {
|
|
3034
3034
|
n++;
|
|
3035
3035
|
let c = t.atime || /* @__PURE__ */ new Date(), d = t.mtime;
|
|
3036
|
-
|
|
3036
|
+
fs.futimes(l, c, d, (S) => S ? fs.utimes(h, c, d, (T) => o(T && S)) : o());
|
|
3037
3037
|
}
|
|
3038
3038
|
if (typeof l == "number" && this[Re](t)) {
|
|
3039
3039
|
n++;
|
|
3040
3040
|
let c = this[ge](t), d = this[be](t);
|
|
3041
|
-
typeof c == "number" && typeof d == "number" &&
|
|
3041
|
+
typeof c == "number" && typeof d == "number" && fs.fchown(l, c, d, (S) => S ? fs.chown(h, c, d, (T) => o(T && S)) : o());
|
|
3042
3042
|
}
|
|
3043
3043
|
o();
|
|
3044
3044
|
});
|
|
@@ -3057,7 +3057,7 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3057
3057
|
let n = 1, o = () => {
|
|
3058
3058
|
--n === 0 && (e(), this[$t](), t.resume());
|
|
3059
3059
|
};
|
|
3060
|
-
t.mtime && !this.noMtime && (n++,
|
|
3060
|
+
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();
|
|
3061
3061
|
});
|
|
3062
3062
|
}
|
|
3063
3063
|
[Dr](t) {
|
|
@@ -3079,7 +3079,7 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3079
3079
|
let o = i.shift();
|
|
3080
3080
|
if (this.preservePaths || o === void 0) return r();
|
|
3081
3081
|
let a = path.resolve(e, o);
|
|
3082
|
-
|
|
3082
|
+
fs.lstat(a, (h, l) => {
|
|
3083
3083
|
if (h) return r();
|
|
3084
3084
|
if (l?.isSymbolicLink()) return n(new St(a, path.resolve(a, i.join("/"))));
|
|
3085
3085
|
this[ye](t, a, i, r, n);
|
|
@@ -3126,7 +3126,7 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3126
3126
|
}
|
|
3127
3127
|
o();
|
|
3128
3128
|
}, o = () => {
|
|
3129
|
-
|
|
3129
|
+
fs.lstat(String(t.absolute), (a, h) => {
|
|
3130
3130
|
if (h && (this.keep || this.newer && h.mtime > (t.mtime ?? h.mtime))) {
|
|
3131
3131
|
this[Ts](t), i();
|
|
3132
3132
|
return;
|
|
@@ -3135,9 +3135,9 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3135
3135
|
if (h.isDirectory()) {
|
|
3136
3136
|
if (t.type === "Directory") {
|
|
3137
3137
|
let l = this.chmod && t.mode && (h.mode & 4095) !== t.mode, c = (d) => this[P](d ?? null, t, i);
|
|
3138
|
-
return l ?
|
|
3138
|
+
return l ? fs.chmod(String(t.absolute), Number(t.mode), c) : c();
|
|
3139
3139
|
}
|
|
3140
|
-
if (t.absolute !== this.cwd) return
|
|
3140
|
+
if (t.absolute !== this.cwd) return fs.rmdir(String(t.absolute), (l) => this[P](l ?? null, t, i));
|
|
3141
3141
|
}
|
|
3142
3142
|
if (t.absolute === this.cwd) return this[P](null, t, i);
|
|
3143
3143
|
ao(String(t.absolute), (l) => this[P](l ?? null, t, i));
|
|
@@ -3161,7 +3161,7 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3161
3161
|
}
|
|
3162
3162
|
}
|
|
3163
3163
|
[Ri](t, e, i, r) {
|
|
3164
|
-
|
|
3164
|
+
fs[i](e, String(t.absolute), (n) => {
|
|
3165
3165
|
n ? this[O](n, t) : (this[$t](), t.resume()), r();
|
|
3166
3166
|
});
|
|
3167
3167
|
}
|
|
@@ -3189,17 +3189,17 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3189
3189
|
if (o) return this[O](o, t);
|
|
3190
3190
|
}
|
|
3191
3191
|
}
|
|
3192
|
-
let [e, i] = Se(() =>
|
|
3192
|
+
let [e, i] = Se(() => fs.lstatSync(String(t.absolute)));
|
|
3193
3193
|
if (i && (this.keep || this.newer && i.mtime > (t.mtime ?? i.mtime))) return this[Ts](t);
|
|
3194
3194
|
if (e || this[bs](t, i)) return this[P](null, t);
|
|
3195
3195
|
if (i.isDirectory()) {
|
|
3196
3196
|
if (t.type === "Directory") {
|
|
3197
3197
|
let [a] = this.chmod && t.mode && (i.mode & 4095) !== t.mode ? Se(() => {
|
|
3198
|
-
|
|
3198
|
+
fs.chmodSync(String(t.absolute), Number(t.mode));
|
|
3199
3199
|
}) : [];
|
|
3200
3200
|
return this[P](a, t);
|
|
3201
3201
|
}
|
|
3202
|
-
let [n] = Se(() =>
|
|
3202
|
+
let [n] = Se(() => fs.rmdirSync(String(t.absolute)));
|
|
3203
3203
|
this[P](n, t);
|
|
3204
3204
|
}
|
|
3205
3205
|
let [r] = t.absolute === this.cwd ? [] : Se(() => lo(String(t.absolute)));
|
|
@@ -3209,21 +3209,21 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3209
3209
|
let i = typeof t.mode == "number" ? t.mode & 4095 : this.fmode, r = (a) => {
|
|
3210
3210
|
let h;
|
|
3211
3211
|
try {
|
|
3212
|
-
|
|
3212
|
+
fs.closeSync(n);
|
|
3213
3213
|
} catch (l) {
|
|
3214
3214
|
h = l;
|
|
3215
3215
|
}
|
|
3216
3216
|
(a || h) && this[O](a || h, t), e();
|
|
3217
3217
|
}, n;
|
|
3218
3218
|
try {
|
|
3219
|
-
n =
|
|
3219
|
+
n = fs.openSync(String(t.absolute), ds(t.size), i);
|
|
3220
3220
|
} catch (a) {
|
|
3221
3221
|
return r(a);
|
|
3222
3222
|
}
|
|
3223
3223
|
let o = this.transform && this.transform(t) || t;
|
|
3224
3224
|
o !== t && (o.on("error", (a) => this[O](a, t)), t.pipe(o)), o.on("data", (a) => {
|
|
3225
3225
|
try {
|
|
3226
|
-
|
|
3226
|
+
fs.writeSync(n, a, 0, a.length);
|
|
3227
3227
|
} catch (h) {
|
|
3228
3228
|
r(h);
|
|
3229
3229
|
}
|
|
@@ -3232,10 +3232,10 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3232
3232
|
if (t.mtime && !this.noMtime) {
|
|
3233
3233
|
let h = t.atime || /* @__PURE__ */ new Date(), l = t.mtime;
|
|
3234
3234
|
try {
|
|
3235
|
-
|
|
3235
|
+
fs.futimesSync(n, h, l);
|
|
3236
3236
|
} catch (c) {
|
|
3237
3237
|
try {
|
|
3238
|
-
|
|
3238
|
+
fs.utimesSync(String(t.absolute), h, l);
|
|
3239
3239
|
} catch {
|
|
3240
3240
|
a = c;
|
|
3241
3241
|
}
|
|
@@ -3244,10 +3244,10 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3244
3244
|
if (this[Re](t)) {
|
|
3245
3245
|
let h = this[ge](t), l = this[be](t);
|
|
3246
3246
|
try {
|
|
3247
|
-
|
|
3247
|
+
fs.fchownSync(n, Number(h), Number(l));
|
|
3248
3248
|
} catch (c) {
|
|
3249
3249
|
try {
|
|
3250
|
-
|
|
3250
|
+
fs.chownSync(String(t.absolute), Number(h), Number(l));
|
|
3251
3251
|
} catch {
|
|
3252
3252
|
a = a || c;
|
|
3253
3253
|
}
|
|
@@ -3263,10 +3263,10 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3263
3263
|
return;
|
|
3264
3264
|
}
|
|
3265
3265
|
if (t.mtime && !this.noMtime) try {
|
|
3266
|
-
|
|
3266
|
+
fs.utimesSync(String(t.absolute), t.atime || /* @__PURE__ */ new Date(), t.mtime);
|
|
3267
3267
|
} catch {}
|
|
3268
3268
|
if (this[Re](t)) try {
|
|
3269
|
-
|
|
3269
|
+
fs.chownSync(String(t.absolute), Number(this[ge](t)), Number(this[be](t)));
|
|
3270
3270
|
} catch {}
|
|
3271
3271
|
e(), t.resume();
|
|
3272
3272
|
}
|
|
@@ -3292,7 +3292,7 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3292
3292
|
let o = e;
|
|
3293
3293
|
for (let a of i) {
|
|
3294
3294
|
o = path.resolve(o, a);
|
|
3295
|
-
let [h, l] = Se(() =>
|
|
3295
|
+
let [h, l] = Se(() => fs.lstatSync(o));
|
|
3296
3296
|
if (h) return r();
|
|
3297
3297
|
if (l.isSymbolicLink()) return n(new St(o, path.resolve(e, i.join("/"))));
|
|
3298
3298
|
}
|
|
@@ -3301,13 +3301,13 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3301
3301
|
[Ri](t, e, i, r) {
|
|
3302
3302
|
let n = `${i}Sync`;
|
|
3303
3303
|
try {
|
|
3304
|
-
|
|
3304
|
+
fs[n](e, String(t.absolute)), r(), t.resume();
|
|
3305
3305
|
} catch (o) {
|
|
3306
3306
|
return this[O](o, t);
|
|
3307
3307
|
}
|
|
3308
3308
|
}
|
|
3309
3309
|
}, co = (s) => {
|
|
3310
|
-
let t = new Te(s), e = s.file, i =
|
|
3310
|
+
let t = new Te(s), e = s.file, i = fs.statSync(e);
|
|
3311
3311
|
new Me(e, {
|
|
3312
3312
|
readSize: s.maxReadSize || 16 * 1024 * 1024,
|
|
3313
3313
|
size: i.size
|
|
@@ -3315,7 +3315,7 @@ var Tr = Symbol("onEntry"), gs = Symbol("checkFs"), xr = Symbol("checkFs2"), bs
|
|
|
3315
3315
|
}, fo = (s, t) => {
|
|
3316
3316
|
let e = new Xt(s), i = s.maxReadSize || 16 * 1024 * 1024, r = s.file;
|
|
3317
3317
|
return new Promise((o, a) => {
|
|
3318
|
-
e.on("error", a), e.on("close", o),
|
|
3318
|
+
e.on("error", a), e.on("close", o), fs.stat(r, (h, l) => {
|
|
3319
3319
|
if (h) a(h);
|
|
3320
3320
|
else {
|
|
3321
3321
|
let c = new _t(r, {
|
|
@@ -3334,15 +3334,15 @@ var mo = (s, t) => {
|
|
|
3334
3334
|
let e = new kt(s), i = !0, r, n;
|
|
3335
3335
|
try {
|
|
3336
3336
|
try {
|
|
3337
|
-
r =
|
|
3337
|
+
r = fs.openSync(s.file, "r+");
|
|
3338
3338
|
} catch (h) {
|
|
3339
|
-
if (h?.code === "ENOENT") r =
|
|
3339
|
+
if (h?.code === "ENOENT") r = fs.openSync(s.file, "w+");
|
|
3340
3340
|
else throw h;
|
|
3341
3341
|
}
|
|
3342
|
-
let o =
|
|
3342
|
+
let o = fs.fstatSync(r), a = Buffer.alloc(512);
|
|
3343
3343
|
t: for (n = 0; n < o.size; n += 512) {
|
|
3344
3344
|
for (let c = 0, d = 0; c < 512; c += d) {
|
|
3345
|
-
if (d =
|
|
3345
|
+
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");
|
|
3346
3346
|
if (!d) break t;
|
|
3347
3347
|
}
|
|
3348
3348
|
let h = new C(a);
|
|
@@ -3354,7 +3354,7 @@ var mo = (s, t) => {
|
|
|
3354
3354
|
i = !1, po(s, e, n, r, t);
|
|
3355
3355
|
} finally {
|
|
3356
3356
|
if (i) try {
|
|
3357
|
-
|
|
3357
|
+
fs.closeSync(r);
|
|
3358
3358
|
} catch {}
|
|
3359
3359
|
}
|
|
3360
3360
|
}, po = (s, t, e, i, r) => {
|
|
@@ -3367,29 +3367,29 @@ var mo = (s, t) => {
|
|
|
3367
3367
|
t = Array.from(t);
|
|
3368
3368
|
let e = new wt(s), i = (n, o, a) => {
|
|
3369
3369
|
let h = (T, N) => {
|
|
3370
|
-
T ?
|
|
3370
|
+
T ? fs.close(n, (E) => a(T)) : a(null, N);
|
|
3371
3371
|
}, l = 0;
|
|
3372
3372
|
if (o === 0) return h(null, 0);
|
|
3373
3373
|
let c = 0, d = Buffer.alloc(512), S = (T, N) => {
|
|
3374
3374
|
if (T || N === void 0) return h(T);
|
|
3375
|
-
if (c += N, c < 512 && N) return
|
|
3375
|
+
if (c += N, c < 512 && N) return fs.read(n, d, c, d.length - c, l + c, S);
|
|
3376
3376
|
if (l === 0 && d[0] === 31 && d[1] === 139) return h(/* @__PURE__ */ new Error("cannot append to compressed archives"));
|
|
3377
3377
|
if (c < 512) return h(null, l);
|
|
3378
3378
|
let E = new C(d);
|
|
3379
3379
|
if (!E.cksumValid) return h(null, l);
|
|
3380
3380
|
let x = 512 * Math.ceil((E.size ?? 0) / 512);
|
|
3381
3381
|
if (l + x + 512 > o || (l += x + 512, l >= o)) return h(null, l);
|
|
3382
|
-
s.mtimeCache && E.mtime && s.mtimeCache.set(String(E.path), E.mtime), c = 0,
|
|
3382
|
+
s.mtimeCache && E.mtime && s.mtimeCache.set(String(E.path), E.mtime), c = 0, fs.read(n, d, 0, 512, l, S);
|
|
3383
3383
|
};
|
|
3384
|
-
|
|
3384
|
+
fs.read(n, d, 0, 512, l, S);
|
|
3385
3385
|
};
|
|
3386
3386
|
return new Promise((n, o) => {
|
|
3387
3387
|
e.on("error", o);
|
|
3388
3388
|
let a = "r+", h = (l, c) => {
|
|
3389
|
-
if (l && l.code === "ENOENT" && a === "r+") return a = "w+",
|
|
3389
|
+
if (l && l.code === "ENOENT" && a === "r+") return a = "w+", fs.open(s.file, a, h);
|
|
3390
3390
|
if (l || !c) return o(l);
|
|
3391
|
-
|
|
3392
|
-
if (d) return
|
|
3391
|
+
fs.fstat(c, (d, S) => {
|
|
3392
|
+
if (d) return fs.close(c, () => o(d));
|
|
3393
3393
|
i(c, S.size, (T, N) => {
|
|
3394
3394
|
if (T) return o(T);
|
|
3395
3395
|
let E = new tt(s.file, {
|
|
@@ -3400,7 +3400,7 @@ var mo = (s, t) => {
|
|
|
3400
3400
|
});
|
|
3401
3401
|
});
|
|
3402
3402
|
};
|
|
3403
|
-
|
|
3403
|
+
fs.open(s.file, a, h);
|
|
3404
3404
|
});
|
|
3405
3405
|
}, wo = (s, t) => {
|
|
3406
3406
|
t.forEach((e) => {
|
|
@@ -3631,7 +3631,7 @@ var SystemBackupService = class {
|
|
|
3631
3631
|
}
|
|
3632
3632
|
async statLocation(loc) {
|
|
3633
3633
|
const abs = path$1.isAbsolute(loc) ? loc : path$1.join(this.dataDir, loc);
|
|
3634
|
-
if (!fs$
|
|
3634
|
+
if (!fs$2.existsSync(abs)) return {
|
|
3635
3635
|
name: loc,
|
|
3636
3636
|
sizeBytes: 0,
|
|
3637
3637
|
fileCount: 0,
|
|
@@ -3678,11 +3678,11 @@ var SystemBackupService = class {
|
|
|
3678
3678
|
const present = [];
|
|
3679
3679
|
for (const loc of requested) {
|
|
3680
3680
|
const abs = path$1.isAbsolute(loc) ? loc : path$1.join(this.dataDir, loc);
|
|
3681
|
-
if (fs$
|
|
3681
|
+
if (fs$2.existsSync(abs)) present.push(loc);
|
|
3682
3682
|
else this.logger.debug("createArchive: skipping missing location", { meta: { location: loc } });
|
|
3683
3683
|
}
|
|
3684
3684
|
if (present.length === 0) throw new Error(`createArchive: no locations from {${requested.join(", ")}} exist under ${this.dataDir}`);
|
|
3685
|
-
fs$
|
|
3685
|
+
fs$2.mkdirSync(path$1.dirname(opts.archivePath), { recursive: true });
|
|
3686
3686
|
const walked = [];
|
|
3687
3687
|
for (const loc of present) {
|
|
3688
3688
|
throwIfCancelled(opts.signal);
|
|
@@ -3766,7 +3766,7 @@ var SystemBackupService = class {
|
|
|
3766
3766
|
*/
|
|
3767
3767
|
async createSnapshotsOnlyArchive(opts, selection, recipient) {
|
|
3768
3768
|
if (opts.owner === void 0) throw new BackupSnapshotRefusedError("a snapshots-only archive needs the database owner, and none was given");
|
|
3769
|
-
fs$
|
|
3769
|
+
fs$2.mkdirSync(path$1.dirname(opts.archivePath), { recursive: true });
|
|
3770
3770
|
const ownedById = await this.ownedDatabasesInScope(opts.owner, null);
|
|
3771
3771
|
const selected = /* @__PURE__ */ new Map();
|
|
3772
3772
|
for (const [rel, databaseId] of ownedById) if (selection.has(databaseId)) selected.set(rel, databaseId);
|
|
@@ -3820,7 +3820,7 @@ var SystemBackupService = class {
|
|
|
3820
3820
|
async writeArchive(opts) {
|
|
3821
3821
|
const { present, manifest } = opts;
|
|
3822
3822
|
const manifestStagePath = `${opts.archivePath}.${process.pid}.manifest.json`;
|
|
3823
|
-
fs$
|
|
3823
|
+
fs$2.writeFileSync(manifestStagePath, JSON.stringify(manifest, null, 2), "utf-8");
|
|
3824
3824
|
this.logger.info("createArchive: tarring", { meta: {
|
|
3825
3825
|
archivePath: opts.archivePath,
|
|
3826
3826
|
locations: [...present],
|
|
@@ -3829,7 +3829,7 @@ var SystemBackupService = class {
|
|
|
3829
3829
|
} });
|
|
3830
3830
|
try {
|
|
3831
3831
|
const stagedInDataDir = path$1.join(this.dataDir, ARCHIVE_MANIFEST_NAME);
|
|
3832
|
-
fs$
|
|
3832
|
+
fs$2.copyFileSync(manifestStagePath, stagedInDataDir);
|
|
3833
3833
|
const stagingRel = path$1.relative(this.dataDir, path$1.dirname(opts.archivePath));
|
|
3834
3834
|
const excludePrefix = stagingRel && !stagingRel.startsWith("..") && !path$1.isAbsolute(stagingRel) ? stagingRel : null;
|
|
3835
3835
|
try {
|
|
@@ -3845,29 +3845,29 @@ var SystemBackupService = class {
|
|
|
3845
3845
|
return norm !== excludePrefix && !norm.startsWith(`${excludePrefix}/`);
|
|
3846
3846
|
}
|
|
3847
3847
|
}, [ARCHIVE_MANIFEST_NAME, ...opts.tarRoots ?? present]);
|
|
3848
|
-
const sink = fs$
|
|
3848
|
+
const sink = fs$2.createWriteStream(opts.archivePath, { mode: 384 });
|
|
3849
3849
|
try {
|
|
3850
3850
|
const streamOpts = opts.signal ? { signal: opts.signal } : {};
|
|
3851
3851
|
if (opts.encryptTo !== void 0) await pipeline(pack, createBackupEncryptStream(opts.encryptTo), byteCountingPassthrough(opts.onArchiveBytes), sink, streamOpts);
|
|
3852
3852
|
else await pipeline(pack, byteCountingPassthrough(opts.onArchiveBytes), sink, streamOpts);
|
|
3853
3853
|
} catch (err) {
|
|
3854
3854
|
try {
|
|
3855
|
-
fs$
|
|
3855
|
+
fs$2.rmSync(opts.archivePath, { force: true });
|
|
3856
3856
|
} catch {}
|
|
3857
3857
|
if (opts.signal?.aborted) throw new BackupCancelledError();
|
|
3858
3858
|
throw err;
|
|
3859
3859
|
}
|
|
3860
3860
|
} finally {
|
|
3861
3861
|
try {
|
|
3862
|
-
fs$
|
|
3862
|
+
fs$2.rmSync(stagedInDataDir, { force: true });
|
|
3863
3863
|
} catch {}
|
|
3864
3864
|
}
|
|
3865
3865
|
} finally {
|
|
3866
3866
|
try {
|
|
3867
|
-
fs$
|
|
3867
|
+
fs$2.rmSync(manifestStagePath, { force: true });
|
|
3868
3868
|
} catch {}
|
|
3869
3869
|
}
|
|
3870
|
-
const sizeBytes = fs$
|
|
3870
|
+
const sizeBytes = fs$2.statSync(opts.archivePath).size;
|
|
3871
3871
|
return {
|
|
3872
3872
|
archivePath: opts.archivePath,
|
|
3873
3873
|
includedLocations: [...present],
|
|
@@ -3880,7 +3880,7 @@ var SystemBackupService = class {
|
|
|
3880
3880
|
* one entry we care about, then aborts.
|
|
3881
3881
|
*/
|
|
3882
3882
|
async readArchiveManifest(archivePath) {
|
|
3883
|
-
if (!fs$
|
|
3883
|
+
if (!fs$2.existsSync(archivePath)) throw new Error(`readArchiveManifest: ${archivePath} does not exist`);
|
|
3884
3884
|
return new Promise((resolve, reject) => {
|
|
3885
3885
|
const chunks = [];
|
|
3886
3886
|
let found = false;
|
|
@@ -3912,7 +3912,7 @@ var SystemBackupService = class {
|
|
|
3912
3912
|
reject(err);
|
|
3913
3913
|
}
|
|
3914
3914
|
});
|
|
3915
|
-
const reader = fs$
|
|
3915
|
+
const reader = fs$2.createReadStream(archivePath);
|
|
3916
3916
|
reader.on("error", (err) => {
|
|
3917
3917
|
if (!resolved) {
|
|
3918
3918
|
resolved = true;
|
|
@@ -3930,7 +3930,7 @@ var SystemBackupService = class {
|
|
|
3930
3930
|
* restart.
|
|
3931
3931
|
*/
|
|
3932
3932
|
scheduleRestoreMarker(opts) {
|
|
3933
|
-
if (!fs$
|
|
3933
|
+
if (!fs$2.existsSync(opts.archivePath)) throw new Error(`scheduleRestoreMarker: ${opts.archivePath} missing`);
|
|
3934
3934
|
const markerPath = this.getRestoreMarkerPath();
|
|
3935
3935
|
const marker = {
|
|
3936
3936
|
archivePath: opts.archivePath,
|
|
@@ -3938,16 +3938,16 @@ var SystemBackupService = class {
|
|
|
3938
3938
|
source: opts.source,
|
|
3939
3939
|
...opts.locations ? { locations: [...opts.locations] } : {}
|
|
3940
3940
|
};
|
|
3941
|
-
fs$
|
|
3942
|
-
fs$
|
|
3941
|
+
fs$2.mkdirSync(path$1.dirname(markerPath), { recursive: true });
|
|
3942
|
+
fs$2.writeFileSync(markerPath, JSON.stringify(marker, null, 2), { mode: 384 });
|
|
3943
3943
|
return markerPath;
|
|
3944
3944
|
}
|
|
3945
3945
|
/** Read the pending-restore marker if one is present. */
|
|
3946
3946
|
readPendingMarker() {
|
|
3947
3947
|
const markerPath = this.getRestoreMarkerPath();
|
|
3948
|
-
if (!fs$
|
|
3948
|
+
if (!fs$2.existsSync(markerPath)) return null;
|
|
3949
3949
|
try {
|
|
3950
|
-
const raw = fs$
|
|
3950
|
+
const raw = fs$2.readFileSync(markerPath, "utf-8");
|
|
3951
3951
|
const parsed = JSON.parse(raw);
|
|
3952
3952
|
if (typeof parsed === "object" && parsed != null && typeof parsed.archivePath === "string") return parsed;
|
|
3953
3953
|
} catch (err) {
|
|
@@ -3958,7 +3958,7 @@ var SystemBackupService = class {
|
|
|
3958
3958
|
/** Drop the marker after a successful boot-time restore. */
|
|
3959
3959
|
clearPendingMarker() {
|
|
3960
3960
|
const markerPath = this.getRestoreMarkerPath();
|
|
3961
|
-
if (fs$
|
|
3961
|
+
if (fs$2.existsSync(markerPath)) fs$2.rmSync(markerPath, { force: true });
|
|
3962
3962
|
}
|
|
3963
3963
|
/**
|
|
3964
3964
|
* The databases the owner declares, archive-relative, that this walk found,
|
|
Binary file
|
|
Binary file
|