@covro/covro 0.2.1-dev.6 → 0.2.1-dev.7
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/README.md +7 -0
- package/README.zh-CN.md +7 -0
- package/dist/backups/factory.js +22 -0
- package/dist/backups/factory.js.map +7 -0
- package/dist/backups/lock.js +22 -0
- package/dist/backups/lock.js.map +7 -0
- package/dist/backups/manager.js +170 -0
- package/dist/backups/manager.js.map +7 -0
- package/dist/backups/restore.js +188 -0
- package/dist/backups/restore.js.map +7 -0
- package/dist/backups/store.js +274 -0
- package/dist/backups/store.js.map +7 -0
- package/dist/cli/backup.js +84 -0
- package/dist/cli/backup.js.map +7 -0
- package/dist/cli/daemon.js +7 -0
- package/dist/cli/daemon.js.map +2 -2
- package/dist/cli/main.js +35 -5
- package/dist/cli/main.js.map +2 -2
- package/dist/cli/paths.js.map +2 -2
- package/dist/server/db/history.js +60 -0
- package/dist/server/db/history.js.map +7 -0
- package/dist/server/db/index.js +11 -1
- package/dist/server/db/index.js.map +2 -2
- package/dist/server/db/migrate.js +8 -18
- package/dist/server/db/migrate.js.map +2 -2
- package/dist/server/http.js +21 -3
- package/dist/server/http.js.map +2 -2
- package/dist/server/main.js +14 -3
- package/dist/server/main.js.map +2 -2
- package/dist/server/service.js +9 -5
- package/dist/server/service.js.map +2 -2
- package/dist/shared/backups.js +55 -0
- package/dist/shared/backups.js.map +7 -0
- package/dist/shared/database.js +15 -0
- package/dist/shared/database.js.map +7 -0
- package/dist/update-worker.cjs +934 -388
- package/dist/updates/files.js +2 -1
- package/dist/updates/files.js.map +2 -2
- package/dist/updates/transaction.js +3 -24
- package/dist/updates/transaction.js.map +2 -2
- package/dist/updates/worker.js +69 -19
- package/dist/updates/worker.js.map +2 -2
- package/dist/web/assets/{abnfDiagram-WEYOIA3C-BkC1EVBk.js → abnfDiagram-WEYOIA3C-Baw8Q2RL.js} +1 -1
- package/dist/web/assets/{arc-CYGT9huc.js → arc-BvZHXzPr.js} +1 -1
- package/dist/web/assets/{architecture-WOLXFQ4H-DCsF3gVg.js → architecture-WOLXFQ4H-DrQ2OxuY.js} +1 -1
- package/dist/web/assets/{architectureDiagram-ZHVYKT53-Cn6kovuz.js → architectureDiagram-ZHVYKT53-D96hX75H.js} +1 -1
- package/dist/web/assets/{blockDiagram-RJAE7QA3-CNk2zXm9.js → blockDiagram-RJAE7QA3-Csce-aWb.js} +1 -1
- package/dist/web/assets/{c4Diagram-XDPPPE54-CTuI_1XJ.js → c4Diagram-XDPPPE54-Dfu8ZQ6Y.js} +1 -1
- package/dist/web/assets/channel-DQhtAfM4.js +1 -0
- package/dist/web/assets/{chunk-2E7WHVMD-TrYs0qV3.js → chunk-2E7WHVMD-Vb63e-lu.js} +1 -1
- package/dist/web/assets/{chunk-4EMNKR2T-QL4-PZ4r.js → chunk-4EMNKR2T-DrY1P7q3.js} +1 -1
- package/dist/web/assets/{chunk-55XCU76K-yynn-EEr.js → chunk-55XCU76K-D70bjQ9E.js} +1 -1
- package/dist/web/assets/{chunk-7S6XSTFO-dzrEn-_W.js → chunk-7S6XSTFO-CfW90MUC.js} +1 -1
- package/dist/web/assets/{chunk-AQDTSKZB-DaNZMEGO.js → chunk-AQDTSKZB-u4KDDGBt.js} +1 -1
- package/dist/web/assets/{chunk-DSNLSHJZ-BnMtx8Ho.js → chunk-DSNLSHJZ-Cax3giJD.js} +1 -1
- package/dist/web/assets/{chunk-HAGFOTED-fg-JyiA5.js → chunk-HAGFOTED-BG9UMwzK.js} +1 -1
- package/dist/web/assets/{chunk-HNE4Q36P-CCsfPbcn.js → chunk-HNE4Q36P-BNxIfOgZ.js} +1 -1
- package/dist/web/assets/{chunk-NQOKRVIF-DLlOpcWZ.js → chunk-NQOKRVIF-DJ60e0Al.js} +1 -1
- package/dist/web/assets/{chunk-UHW7PFBP-B-sPKpeS.js → chunk-UHW7PFBP-C9gHYcjJ.js} +1 -1
- package/dist/web/assets/{chunk-VQ5W62QI-BVqGMzey.js → chunk-VQ5W62QI-TyHPGVfQ.js} +1 -1
- package/dist/web/assets/{chunk-WQQL4CDK-DcwJXNuh.js → chunk-WQQL4CDK-DeAauheh.js} +1 -1
- package/dist/web/assets/{chunk-XXDRQBXY-DRwLkqyU.js → chunk-XXDRQBXY-V-L20Tbi.js} +1 -1
- package/dist/web/assets/{chunk-YZO67HFG-BrrgBnrQ.js → chunk-YZO67HFG-LV5QVBiU.js} +1 -1
- package/dist/web/assets/{chunk-ZAUX2LTX-C7qvwkRr.js → chunk-ZAUX2LTX-CBsBBk7L.js} +1 -1
- package/dist/web/assets/{chunk-ZCHMQSOR-DdBd3Cvs.js → chunk-ZCHMQSOR-a2_9JHHn.js} +1 -1
- package/dist/web/assets/{classDiagram-v2-4MYWR3UA-Dn2RZb3v.js → classDiagram-v2-4MYWR3UA-77eiBCO3.js} +1 -1
- package/dist/web/assets/{cose-bilkent-JH36ORCC-BlXvtfgE.js → cose-bilkent-JH36ORCC-DDP73pnY.js} +1 -1
- package/dist/web/assets/{cynefin-EF2NZ3EQ-odDgTxc-.js → cynefin-EF2NZ3EQ-onpnpyxc.js} +1 -1
- package/dist/web/assets/{cynefinDiagram-WF24UDRP-BySEoCW8.js → cynefinDiagram-WF24UDRP-BmLplbnH.js} +1 -1
- package/dist/web/assets/{dagre-NK4GIZVX-ihxmhB4X.js → dagre-NK4GIZVX-BhaMf_Gx.js} +1 -1
- package/dist/web/assets/{diagram-CBK3MWTC-Ckr5P3IM.js → diagram-CBK3MWTC-BaalTqFt.js} +1 -1
- package/dist/web/assets/{diagram-I5XIIV2D-D5BZIval.js → diagram-I5XIIV2D-4Tdshcyt.js} +1 -1
- package/dist/web/assets/{diagram-ODIL2UCW-BC5jjqqY.js → diagram-ODIL2UCW-SlEcZgod.js} +1 -1
- package/dist/web/assets/{diagram-PFBEJUXE-D_IdYKqC.js → diagram-PFBEJUXE-CosCAXbh.js} +1 -1
- package/dist/web/assets/{diagram-RJA3I4VV-DlPNsPqP.js → diagram-RJA3I4VV-HQElVL4B.js} +1 -1
- package/dist/web/assets/{diagram-TYUNFSNR-Ca2ANhGM.js → diagram-TYUNFSNR-BT2WDc21.js} +1 -1
- package/dist/web/assets/{dist-BSWkYZRr.js → dist-CrpGQKqw.js} +1 -1
- package/dist/web/assets/{ebnfDiagram-V4P3TTPT-BrqvmeiB.js → ebnfDiagram-V4P3TTPT-BhK6AM0_.js} +1 -1
- package/dist/web/assets/{elk-QONTBCTQ-BfXeOE2E.js → elk-QONTBCTQ-CS7DfCnD.js} +1 -1
- package/dist/web/assets/{erDiagram-KYQIGQAA-CMuYoCVJ.js → erDiagram-KYQIGQAA-DxVnuqFK.js} +1 -1
- package/dist/web/assets/{eventmodeling-K75KTNOO-9s4vQqv1.js → eventmodeling-K75KTNOO-oC_YeomD.js} +1 -1
- package/dist/web/assets/flowDiagram-IUGLLWBU-Bspg0rQz.js +1 -0
- package/dist/web/assets/{ganttDiagram-R7GPNTJY-B-Xmfmm2.js → ganttDiagram-R7GPNTJY-CquUpiE1.js} +1 -1
- package/dist/web/assets/{gitGraph-VSP46ZUC-ZSbSQ7jf.js → gitGraph-VSP46ZUC-BTtGQYsh.js} +1 -1
- package/dist/web/assets/{gitGraphDiagram-PDYL7XHY-BhxijLaZ.js → gitGraphDiagram-PDYL7XHY-BsokGXYo.js} +1 -1
- package/dist/web/assets/index-B8tsymVC.js +147 -0
- package/dist/web/assets/{index-mkDvqMQ3.css → index-COSho7m2.css} +1 -1
- package/dist/web/assets/{info-OHQRW6UA-CTSCkjt3.js → info-OHQRW6UA-CvGN4gWh.js} +1 -1
- package/dist/web/assets/{infoDiagram-MVDRKAX5-D46MTesD.js → infoDiagram-MVDRKAX5-BF9Rp3BT.js} +1 -1
- package/dist/web/assets/{ishikawaDiagram-HPEHV2GE-Bafu9NOk.js → ishikawaDiagram-HPEHV2GE-DtD20ngU.js} +1 -1
- package/dist/web/assets/{journeyDiagram-BOSHW7O7-CRsIi1Ry.js → journeyDiagram-BOSHW7O7-gB16trHV.js} +1 -1
- package/dist/web/assets/{kanban-definition-FNSA4HC5-DjIT_uLs.js → kanban-definition-FNSA4HC5-D0aKOsE2.js} +1 -1
- package/dist/web/assets/{line-B5MDdgVs.js → line-BR5dqPmF.js} +1 -1
- package/dist/web/assets/{linear-wm7JWxlT.js → linear-OsiQaPpK.js} +1 -1
- package/dist/web/assets/{mermaid-parser.core-C7jTW4sZ.js → mermaid-parser.core-MEuwYVot.js} +3 -3
- package/dist/web/assets/{mermaid.core-DcWRGjP5.js → mermaid.core-CVKnnz65.js} +4 -4
- package/dist/web/assets/{mindmap-definition-6OY57UG3-qY6vV0UI.js → mindmap-definition-6OY57UG3-5aHA-kPJ.js} +1 -1
- package/dist/web/assets/{packet-JDAUHWVQ-9B7vLYK0.js → packet-JDAUHWVQ-uj48AF5r.js} +1 -1
- package/dist/web/assets/{pegDiagram-ECIUJNBX-B7gLZ_Fs.js → pegDiagram-ECIUJNBX-BkVIHLBX.js} +1 -1
- package/dist/web/assets/{pie-XZMESJXO-MfazZSiE.js → pie-XZMESJXO-D3hy3nD7.js} +1 -1
- package/dist/web/assets/{pieDiagram-GNMPY74T-1ahagzzC.js → pieDiagram-GNMPY74T-CBAqGMEo.js} +1 -1
- package/dist/web/assets/{quadrantDiagram-D57K4MC3-C-GkwjOp.js → quadrantDiagram-D57K4MC3-C35kvNRB.js} +1 -1
- package/dist/web/assets/{radar-ABXABTNO-CgutvWTi.js → radar-ABXABTNO-3LWE6J2Y.js} +1 -1
- package/dist/web/assets/{railroad-I3PHUGI6-Bl9LJINm.js → railroad-I3PHUGI6-B6Mc9Djl.js} +1 -1
- package/dist/web/assets/{railroad-abnf-LNEFI6M7-CGRpAnuU.js → railroad-abnf-LNEFI6M7-DJnbwbpn.js} +1 -1
- package/dist/web/assets/{railroad-ebnf-DWYD2UWJ-D6A47xZS.js → railroad-ebnf-DWYD2UWJ-BFXAvY4k.js} +1 -1
- package/dist/web/assets/{railroad-peg-JR7BVNR7-DxGphrFO.js → railroad-peg-JR7BVNR7-JYGb2Oq5.js} +1 -1
- package/dist/web/assets/{railroadDiagram-Y72NRBL7-D8P17OV4.js → railroadDiagram-Y72NRBL7-uBIggR0w.js} +1 -1
- package/dist/web/assets/{requirementDiagram-EQYSW5RA-c93_xAaQ.js → requirementDiagram-EQYSW5RA-CDWglrxJ.js} +1 -1
- package/dist/web/assets/{sankeyDiagram-SY24JHO5-FankqwcZ.js → sankeyDiagram-SY24JHO5-BT16hnTl.js} +1 -1
- package/dist/web/assets/{sequenceDiagram-BLEHNHQU-CWH5SeL1.js → sequenceDiagram-BLEHNHQU-eFJ27rVk.js} +1 -1
- package/dist/web/assets/{src-BXQOmVZv.js → src-BlOCBHYS.js} +1 -1
- package/dist/web/assets/{stateDiagram-v2-A6IESKWZ-DLfcw0e7.js → stateDiagram-v2-A6IESKWZ-CK_s-2Qv.js} +1 -1
- package/dist/web/assets/{swimlanes-B3ENRKFQ-DZ-yBiap.js → swimlanes-B3ENRKFQ-WLMrk9Lm.js} +1 -1
- package/dist/web/assets/swimlanesDiagram-AYQRV4AK-DmjebfnI.js +8 -0
- package/dist/web/assets/{timeline-definition-JXYKGLGB-B7XvxDHY.js → timeline-definition-JXYKGLGB-D0-xZS_V.js} +1 -1
- package/dist/web/assets/{treeView-D4JQ5SDB-DrB6wXJ0.js → treeView-D4JQ5SDB-TTivyB8T.js} +1 -1
- package/dist/web/assets/{treemap-SAJKECNS-BynFjsvx.js → treemap-SAJKECNS-DtU16wOO.js} +1 -1
- package/dist/web/assets/{usecaseDiagram-WPOLBNNX-BISzHOHN.js → usecaseDiagram-WPOLBNNX-DLFybW0F.js} +1 -1
- package/dist/web/assets/{vennDiagram-Q3Y3IDCW-BZwjTIST.js → vennDiagram-Q3Y3IDCW-DRDuYw70.js} +1 -1
- package/dist/web/assets/{wardley-7MLQ67FV-2bM0pMhO.js → wardley-7MLQ67FV-tZ-5qrqv.js} +1 -1
- package/dist/web/assets/{wardleyDiagram-IVAIDKWA-CflkU8us.js → wardleyDiagram-IVAIDKWA-wRKeGCMl.js} +1 -1
- package/dist/web/assets/{xychartDiagram-4URNHDU4-DRspOlD3.js → xychartDiagram-4URNHDU4-B5-k-DHF.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +8 -3
- package/dist/web/assets/channel-BDxsxdm-.js +0 -1
- package/dist/web/assets/flowDiagram-IUGLLWBU-BHwP7Ha7.js +0 -1
- package/dist/web/assets/index-BrvtlTwN.js +0 -147
- package/dist/web/assets/swimlanesDiagram-AYQRV4AK-BlmdUBbW.js +0 -8
package/dist/update-worker.cjs
CHANGED
|
@@ -522,7 +522,7 @@ var require_graceful_fs = __commonJS({
|
|
|
522
522
|
function patch(fs2) {
|
|
523
523
|
polyfills(fs2);
|
|
524
524
|
fs2.gracefulify = patch;
|
|
525
|
-
fs2.createReadStream =
|
|
525
|
+
fs2.createReadStream = createReadStream2;
|
|
526
526
|
fs2.createWriteStream = createWriteStream;
|
|
527
527
|
var fs$readFile = fs2.readFile;
|
|
528
528
|
fs2.readFile = readFile3;
|
|
@@ -597,9 +597,9 @@ var require_graceful_fs = __commonJS({
|
|
|
597
597
|
}
|
|
598
598
|
}
|
|
599
599
|
var fs$readdir = fs2.readdir;
|
|
600
|
-
fs2.readdir =
|
|
600
|
+
fs2.readdir = readdir3;
|
|
601
601
|
var noReaddirOptionVersions = /^v[0-5]\./;
|
|
602
|
-
function
|
|
602
|
+
function readdir3(path, options, cb) {
|
|
603
603
|
if (typeof options === "function")
|
|
604
604
|
cb = options, options = null;
|
|
605
605
|
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path2, options2, cb2, startTime) {
|
|
@@ -702,7 +702,7 @@ var require_graceful_fs = __commonJS({
|
|
|
702
702
|
}
|
|
703
703
|
function ReadStream$open() {
|
|
704
704
|
var that = this;
|
|
705
|
-
|
|
705
|
+
open5(that.path, that.flags, that.mode, function(err, fd) {
|
|
706
706
|
if (err) {
|
|
707
707
|
if (that.autoClose)
|
|
708
708
|
that.destroy();
|
|
@@ -722,7 +722,7 @@ var require_graceful_fs = __commonJS({
|
|
|
722
722
|
}
|
|
723
723
|
function WriteStream$open() {
|
|
724
724
|
var that = this;
|
|
725
|
-
|
|
725
|
+
open5(that.path, that.flags, that.mode, function(err, fd) {
|
|
726
726
|
if (err) {
|
|
727
727
|
that.destroy();
|
|
728
728
|
that.emit("error", err);
|
|
@@ -732,15 +732,15 @@ var require_graceful_fs = __commonJS({
|
|
|
732
732
|
}
|
|
733
733
|
});
|
|
734
734
|
}
|
|
735
|
-
function
|
|
735
|
+
function createReadStream2(path, options) {
|
|
736
736
|
return new fs2.ReadStream(path, options);
|
|
737
737
|
}
|
|
738
738
|
function createWriteStream(path, options) {
|
|
739
739
|
return new fs2.WriteStream(path, options);
|
|
740
740
|
}
|
|
741
741
|
var fs$open = fs2.open;
|
|
742
|
-
fs2.open =
|
|
743
|
-
function
|
|
742
|
+
fs2.open = open5;
|
|
743
|
+
function open5(path, flags, mode, cb) {
|
|
744
744
|
if (typeof mode === "function")
|
|
745
745
|
cb = mode, mode = null;
|
|
746
746
|
return go$open(path, flags, mode, cb);
|
|
@@ -1238,11 +1238,11 @@ var require_mtime_precision = __commonJS({
|
|
|
1238
1238
|
function probe(file2, fs, callback) {
|
|
1239
1239
|
const cachedPrecision = fs[cacheSymbol];
|
|
1240
1240
|
if (cachedPrecision) {
|
|
1241
|
-
return fs.stat(file2, (err,
|
|
1241
|
+
return fs.stat(file2, (err, stat) => {
|
|
1242
1242
|
if (err) {
|
|
1243
1243
|
return callback(err);
|
|
1244
1244
|
}
|
|
1245
|
-
callback(null,
|
|
1245
|
+
callback(null, stat.mtime, cachedPrecision);
|
|
1246
1246
|
});
|
|
1247
1247
|
}
|
|
1248
1248
|
const mtime = new Date(Math.ceil(Date.now() / 1e3) * 1e3 + 5);
|
|
@@ -1250,13 +1250,13 @@ var require_mtime_precision = __commonJS({
|
|
|
1250
1250
|
if (err) {
|
|
1251
1251
|
return callback(err);
|
|
1252
1252
|
}
|
|
1253
|
-
fs.stat(file2, (err2,
|
|
1253
|
+
fs.stat(file2, (err2, stat) => {
|
|
1254
1254
|
if (err2) {
|
|
1255
1255
|
return callback(err2);
|
|
1256
1256
|
}
|
|
1257
|
-
const precision =
|
|
1257
|
+
const precision = stat.mtime.getTime() % 1e3 === 0 ? "s" : "ms";
|
|
1258
1258
|
Object.defineProperty(fs, cacheSymbol, { value: precision });
|
|
1259
|
-
callback(null,
|
|
1259
|
+
callback(null, stat.mtime, precision);
|
|
1260
1260
|
});
|
|
1261
1261
|
});
|
|
1262
1262
|
}
|
|
@@ -1310,14 +1310,14 @@ var require_lockfile = __commonJS({
|
|
|
1310
1310
|
if (options.stale <= 0) {
|
|
1311
1311
|
return callback(Object.assign(new Error("Lock file is already being held"), { code: "ELOCKED", file: file2 }));
|
|
1312
1312
|
}
|
|
1313
|
-
options.fs.stat(lockfilePath, (err2,
|
|
1313
|
+
options.fs.stat(lockfilePath, (err2, stat) => {
|
|
1314
1314
|
if (err2) {
|
|
1315
1315
|
if (err2.code === "ENOENT") {
|
|
1316
1316
|
return acquireLock(file2, { ...options, stale: 0 }, callback);
|
|
1317
1317
|
}
|
|
1318
1318
|
return callback(err2);
|
|
1319
1319
|
}
|
|
1320
|
-
if (!isLockStale(
|
|
1320
|
+
if (!isLockStale(stat, options)) {
|
|
1321
1321
|
return callback(Object.assign(new Error("Lock file is already being held"), { code: "ELOCKED", file: file2 }));
|
|
1322
1322
|
}
|
|
1323
1323
|
removeLock(file2, options, (err3) => {
|
|
@@ -1329,8 +1329,8 @@ var require_lockfile = __commonJS({
|
|
|
1329
1329
|
});
|
|
1330
1330
|
});
|
|
1331
1331
|
}
|
|
1332
|
-
function isLockStale(
|
|
1333
|
-
return
|
|
1332
|
+
function isLockStale(stat, options) {
|
|
1333
|
+
return stat.mtime.getTime() < Date.now() - options.stale;
|
|
1334
1334
|
}
|
|
1335
1335
|
function removeLock(file2, options, callback) {
|
|
1336
1336
|
options.fs.rmdir(getLockFile(file2, options), (err) => {
|
|
@@ -1348,7 +1348,7 @@ var require_lockfile = __commonJS({
|
|
|
1348
1348
|
lock2.updateDelay = lock2.updateDelay || options.update;
|
|
1349
1349
|
lock2.updateTimeout = setTimeout(() => {
|
|
1350
1350
|
lock2.updateTimeout = null;
|
|
1351
|
-
options.fs.stat(lock2.lockfilePath, (err,
|
|
1351
|
+
options.fs.stat(lock2.lockfilePath, (err, stat) => {
|
|
1352
1352
|
const isOverThreshold = lock2.lastUpdate + options.stale < Date.now();
|
|
1353
1353
|
if (err) {
|
|
1354
1354
|
if (err.code === "ENOENT" || isOverThreshold) {
|
|
@@ -1357,7 +1357,7 @@ var require_lockfile = __commonJS({
|
|
|
1357
1357
|
lock2.updateDelay = 1e3;
|
|
1358
1358
|
return updateLock(file2, options);
|
|
1359
1359
|
}
|
|
1360
|
-
const isMtimeOurs = lock2.mtime.getTime() ===
|
|
1360
|
+
const isMtimeOurs = lock2.mtime.getTime() === stat.mtime.getTime();
|
|
1361
1361
|
if (!isMtimeOurs) {
|
|
1362
1362
|
return setLockAsCompromised(
|
|
1363
1363
|
file2,
|
|
@@ -1482,11 +1482,11 @@ var require_lockfile = __commonJS({
|
|
|
1482
1482
|
if (err) {
|
|
1483
1483
|
return callback(err);
|
|
1484
1484
|
}
|
|
1485
|
-
options.fs.stat(getLockFile(file3, options), (err2,
|
|
1485
|
+
options.fs.stat(getLockFile(file3, options), (err2, stat) => {
|
|
1486
1486
|
if (err2) {
|
|
1487
1487
|
return err2.code === "ENOENT" ? callback(null, false) : callback(err2);
|
|
1488
1488
|
}
|
|
1489
|
-
return callback(null, !isLockStale(
|
|
1489
|
+
return callback(null, !isLockStale(stat, options));
|
|
1490
1490
|
});
|
|
1491
1491
|
});
|
|
1492
1492
|
}
|
|
@@ -1532,12 +1532,12 @@ var require_adapter = __commonJS({
|
|
|
1532
1532
|
return newFs;
|
|
1533
1533
|
}
|
|
1534
1534
|
function toPromise(method) {
|
|
1535
|
-
return (...args) => new Promise((
|
|
1535
|
+
return (...args) => new Promise((resolve3, reject) => {
|
|
1536
1536
|
args.push((err, result) => {
|
|
1537
1537
|
if (err) {
|
|
1538
1538
|
reject(err);
|
|
1539
1539
|
} else {
|
|
1540
|
-
|
|
1540
|
+
resolve3(result);
|
|
1541
1541
|
}
|
|
1542
1542
|
});
|
|
1543
1543
|
method(...args);
|
|
@@ -1578,27 +1578,27 @@ var require_adapter = __commonJS({
|
|
|
1578
1578
|
var require_proper_lockfile = __commonJS({
|
|
1579
1579
|
"node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/index.js"(exports2, module2) {
|
|
1580
1580
|
"use strict";
|
|
1581
|
-
var
|
|
1581
|
+
var lockfile8 = require_lockfile();
|
|
1582
1582
|
var { toPromise, toSync, toSyncOptions } = require_adapter();
|
|
1583
1583
|
async function lock(file2, options) {
|
|
1584
|
-
const release = await toPromise(
|
|
1584
|
+
const release = await toPromise(lockfile8.lock)(file2, options);
|
|
1585
1585
|
return toPromise(release);
|
|
1586
1586
|
}
|
|
1587
1587
|
function lockSync(file2, options) {
|
|
1588
|
-
const release = toSync(
|
|
1588
|
+
const release = toSync(lockfile8.lock)(file2, toSyncOptions(options));
|
|
1589
1589
|
return toSync(release);
|
|
1590
1590
|
}
|
|
1591
1591
|
function unlock(file2, options) {
|
|
1592
|
-
return toPromise(
|
|
1592
|
+
return toPromise(lockfile8.unlock)(file2, options);
|
|
1593
1593
|
}
|
|
1594
1594
|
function unlockSync(file2, options) {
|
|
1595
|
-
return toSync(
|
|
1595
|
+
return toSync(lockfile8.unlock)(file2, toSyncOptions(options));
|
|
1596
1596
|
}
|
|
1597
1597
|
function check2(file2, options) {
|
|
1598
|
-
return toPromise(
|
|
1598
|
+
return toPromise(lockfile8.check)(file2, options);
|
|
1599
1599
|
}
|
|
1600
1600
|
function checkSync(file2, options) {
|
|
1601
|
-
return toSync(
|
|
1601
|
+
return toSync(lockfile8.check)(file2, toSyncOptions(options));
|
|
1602
1602
|
}
|
|
1603
1603
|
module2.exports = lock;
|
|
1604
1604
|
module2.exports.lock = lock;
|
|
@@ -1610,9 +1610,6 @@ var require_proper_lockfile = __commonJS({
|
|
|
1610
1610
|
}
|
|
1611
1611
|
});
|
|
1612
1612
|
|
|
1613
|
-
// src/shared/package.ts
|
|
1614
|
-
var npmPackageName = "@covro/covro";
|
|
1615
|
-
|
|
1616
1613
|
// node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/classic/external.js
|
|
1617
1614
|
var external_exports = {};
|
|
1618
1615
|
__export(external_exports, {
|
|
@@ -3717,13 +3714,13 @@ var numericOriginMap = {
|
|
|
3717
3714
|
};
|
|
3718
3715
|
var $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst, def) => {
|
|
3719
3716
|
$ZodCheck.init(inst, def);
|
|
3720
|
-
const
|
|
3717
|
+
const origin2 = numericOriginMap[typeof def.value];
|
|
3721
3718
|
inst._zod.check = (payload) => {
|
|
3722
3719
|
if (def.inclusive ? payload.value <= def.value : payload.value < def.value) {
|
|
3723
3720
|
return;
|
|
3724
3721
|
}
|
|
3725
3722
|
payload.issues.push({
|
|
3726
|
-
origin: numericOriginMap[typeof payload.value] ??
|
|
3723
|
+
origin: numericOriginMap[typeof payload.value] ?? origin2,
|
|
3727
3724
|
code: "too_big",
|
|
3728
3725
|
maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
3729
3726
|
input: payload.value,
|
|
@@ -3735,13 +3732,13 @@ var $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst,
|
|
|
3735
3732
|
});
|
|
3736
3733
|
var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan", (inst, def) => {
|
|
3737
3734
|
$ZodCheck.init(inst, def);
|
|
3738
|
-
const
|
|
3735
|
+
const origin2 = numericOriginMap[typeof def.value];
|
|
3739
3736
|
inst._zod.check = (payload) => {
|
|
3740
3737
|
if (def.inclusive ? payload.value >= def.value : payload.value > def.value) {
|
|
3741
3738
|
return;
|
|
3742
3739
|
}
|
|
3743
3740
|
payload.issues.push({
|
|
3744
|
-
origin: numericOriginMap[typeof payload.value] ??
|
|
3741
|
+
origin: numericOriginMap[typeof payload.value] ?? origin2,
|
|
3745
3742
|
code: "too_small",
|
|
3746
3743
|
minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
3747
3744
|
input: payload.value,
|
|
@@ -3776,14 +3773,14 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
3776
3773
|
$ZodCheck.init(inst, def);
|
|
3777
3774
|
def.format = def.format || "float64";
|
|
3778
3775
|
const isInt = def.format?.includes("int");
|
|
3779
|
-
const
|
|
3776
|
+
const origin2 = isInt ? "int" : "number";
|
|
3780
3777
|
const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
|
|
3781
3778
|
inst._zod.check = (payload) => {
|
|
3782
3779
|
const input2 = payload.value;
|
|
3783
3780
|
if (isInt) {
|
|
3784
3781
|
if (!Number.isInteger(input2)) {
|
|
3785
3782
|
payload.issues.push({
|
|
3786
|
-
expected:
|
|
3783
|
+
expected: origin2,
|
|
3787
3784
|
format: def.format,
|
|
3788
3785
|
code: "invalid_type",
|
|
3789
3786
|
continue: false,
|
|
@@ -3800,7 +3797,7 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
3800
3797
|
maximum: Number.MAX_SAFE_INTEGER,
|
|
3801
3798
|
note: "Integers must be within the safe integer range.",
|
|
3802
3799
|
inst,
|
|
3803
|
-
origin,
|
|
3800
|
+
origin: origin2,
|
|
3804
3801
|
inclusive: true,
|
|
3805
3802
|
continue: !def.abort
|
|
3806
3803
|
});
|
|
@@ -3811,7 +3808,7 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
3811
3808
|
minimum: Number.MIN_SAFE_INTEGER,
|
|
3812
3809
|
note: "Integers must be within the safe integer range.",
|
|
3813
3810
|
inst,
|
|
3814
|
-
origin,
|
|
3811
|
+
origin: origin2,
|
|
3815
3812
|
inclusive: true,
|
|
3816
3813
|
continue: !def.abort
|
|
3817
3814
|
});
|
|
@@ -3943,9 +3940,9 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
|
|
|
3943
3940
|
const length = typeof input2 === "string" && units > def.maximum ? codePointLength(input2) : units;
|
|
3944
3941
|
if (length <= def.maximum)
|
|
3945
3942
|
return;
|
|
3946
|
-
const
|
|
3943
|
+
const origin2 = getLengthableOrigin(input2);
|
|
3947
3944
|
payload.issues.push({
|
|
3948
|
-
origin,
|
|
3945
|
+
origin: origin2,
|
|
3949
3946
|
code: "too_big",
|
|
3950
3947
|
maximum: def.maximum,
|
|
3951
3948
|
inclusive: true,
|
|
@@ -3965,9 +3962,9 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
|
|
|
3965
3962
|
const length = typeof input2 === "string" && units >= def.minimum && units < def.minimum * 2 ? codePointLength(input2) : units;
|
|
3966
3963
|
if (length >= def.minimum)
|
|
3967
3964
|
return;
|
|
3968
|
-
const
|
|
3965
|
+
const origin2 = getLengthableOrigin(input2);
|
|
3969
3966
|
payload.issues.push({
|
|
3970
|
-
origin,
|
|
3967
|
+
origin: origin2,
|
|
3971
3968
|
code: "too_small",
|
|
3972
3969
|
minimum: def.minimum,
|
|
3973
3970
|
inclusive: true,
|
|
@@ -3987,10 +3984,10 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
|
|
|
3987
3984
|
const length = typeof input2 === "string" && units >= def.length && units <= def.length * 2 ? codePointLength(input2) : units;
|
|
3988
3985
|
if (length === def.length)
|
|
3989
3986
|
return;
|
|
3990
|
-
const
|
|
3987
|
+
const origin2 = getLengthableOrigin(input2);
|
|
3991
3988
|
const tooBig = length > def.length;
|
|
3992
3989
|
payload.issues.push({
|
|
3993
|
-
origin,
|
|
3990
|
+
origin: origin2,
|
|
3994
3991
|
...tooBig ? { code: "too_big", maximum: def.length } : { code: "too_small", minimum: def.length },
|
|
3995
3992
|
inclusive: true,
|
|
3996
3993
|
exact: true,
|
|
@@ -6480,9 +6477,9 @@ function partPattern(schema) {
|
|
|
6480
6477
|
return own2;
|
|
6481
6478
|
}
|
|
6482
6479
|
if (def.options) {
|
|
6483
|
-
const
|
|
6484
|
-
if (
|
|
6485
|
-
return `^(${
|
|
6480
|
+
const sources2 = def.options.map(partPattern);
|
|
6481
|
+
if (sources2.every(Boolean))
|
|
6482
|
+
return `^(${sources2.map((s) => cleanRegex(s)).join("|")})$`;
|
|
6486
6483
|
}
|
|
6487
6484
|
return leafPattern(schema);
|
|
6488
6485
|
}
|
|
@@ -6680,7 +6677,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
|
|
|
6680
6677
|
var NONE = 0;
|
|
6681
6678
|
var ASSUMED = 1;
|
|
6682
6679
|
var PROVEN = 2;
|
|
6683
|
-
function isRecursive(inst, stack,
|
|
6680
|
+
function isRecursive(inst, stack, resolve3) {
|
|
6684
6681
|
const cached2 = recursive.get(inst);
|
|
6685
6682
|
if (cached2 !== void 0)
|
|
6686
6683
|
return cached2 ? PROVEN : NONE;
|
|
@@ -6690,7 +6687,7 @@ function isRecursive(inst, stack, resolve) {
|
|
|
6690
6687
|
let result = NONE;
|
|
6691
6688
|
const check2 = (child) => {
|
|
6692
6689
|
if (result !== PROVEN && child?._zod) {
|
|
6693
|
-
const answer = isRecursive(child, stack,
|
|
6690
|
+
const answer = isRecursive(child, stack, resolve3);
|
|
6694
6691
|
if (answer > result)
|
|
6695
6692
|
result = answer;
|
|
6696
6693
|
}
|
|
@@ -6701,7 +6698,7 @@ function isRecursive(inst, stack, resolve) {
|
|
|
6701
6698
|
const desc = Object.getOwnPropertyDescriptor(sh, key);
|
|
6702
6699
|
if (spread && !desc.enumerable)
|
|
6703
6700
|
continue;
|
|
6704
|
-
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack,
|
|
6701
|
+
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve3) : NONE;
|
|
6705
6702
|
if (child > answer)
|
|
6706
6703
|
answer = child;
|
|
6707
6704
|
}
|
|
@@ -6765,7 +6762,7 @@ function isRecursive(inst, stack, resolve) {
|
|
|
6765
6762
|
break;
|
|
6766
6763
|
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
|
|
6767
6764
|
case "lazy": {
|
|
6768
|
-
const inner = def._cachedInner ?? (
|
|
6765
|
+
const inner = def._cachedInner ?? (resolve3 ? inst._zod.innerType : void 0);
|
|
6769
6766
|
merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
6770
6767
|
break;
|
|
6771
6768
|
}
|
|
@@ -7015,8 +7012,8 @@ var error = () => {
|
|
|
7015
7012
|
set: { unit: "\u0639\u0646\u0635\u0631", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" },
|
|
7016
7013
|
map: { unit: "\u0639\u0646\u0635\u0631", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" }
|
|
7017
7014
|
};
|
|
7018
|
-
function getSizing(
|
|
7019
|
-
return Sizable[
|
|
7015
|
+
function getSizing(origin2) {
|
|
7016
|
+
return Sizable[origin2] ?? null;
|
|
7020
7017
|
}
|
|
7021
7018
|
const FormatDictionary = {
|
|
7022
7019
|
regex: "\u0645\u062F\u062E\u0644",
|
|
@@ -7127,8 +7124,8 @@ var error2 = () => {
|
|
|
7127
7124
|
set: { unit: "element", verb: "olmal\u0131d\u0131r" },
|
|
7128
7125
|
map: { unit: "element", verb: "olmal\u0131d\u0131r" }
|
|
7129
7126
|
};
|
|
7130
|
-
function getSizing(
|
|
7131
|
-
return Sizable[
|
|
7127
|
+
function getSizing(origin2) {
|
|
7128
|
+
return Sizable[origin2] ?? null;
|
|
7132
7129
|
}
|
|
7133
7130
|
const FormatDictionary = {
|
|
7134
7131
|
regex: "input",
|
|
@@ -7288,8 +7285,8 @@ var error3 = () => {
|
|
|
7288
7285
|
verb: "\u043C\u0435\u0446\u044C"
|
|
7289
7286
|
}
|
|
7290
7287
|
};
|
|
7291
|
-
function getSizing(
|
|
7292
|
-
return Sizable[
|
|
7288
|
+
function getSizing(origin2) {
|
|
7289
|
+
return Sizable[origin2] ?? null;
|
|
7293
7290
|
}
|
|
7294
7291
|
const FormatDictionary = {
|
|
7295
7292
|
regex: "\u0443\u0432\u043E\u0434",
|
|
@@ -7407,8 +7404,8 @@ var error4 = () => {
|
|
|
7407
7404
|
set: { unit: "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430", verb: "\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430" },
|
|
7408
7405
|
map: { unit: "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430", verb: "\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430" }
|
|
7409
7406
|
};
|
|
7410
|
-
function getSizing(
|
|
7411
|
-
return Sizable[
|
|
7407
|
+
function getSizing(origin2) {
|
|
7408
|
+
return Sizable[origin2] ?? null;
|
|
7412
7409
|
}
|
|
7413
7410
|
const FormatDictionary = {
|
|
7414
7411
|
regex: "\u0432\u0445\u043E\u0434",
|
|
@@ -7533,8 +7530,8 @@ var error5 = () => {
|
|
|
7533
7530
|
set: { unit: "\u0986\u0987\u099F\u09C7\u09AE", verb: "\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7" },
|
|
7534
7531
|
map: { unit: "\u098F\u09A8\u09CD\u099F\u09CD\u09B0\u09BF", verb: "\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7" }
|
|
7535
7532
|
};
|
|
7536
|
-
function getSizing(
|
|
7537
|
-
return Sizable[
|
|
7533
|
+
function getSizing(origin2) {
|
|
7534
|
+
return Sizable[origin2] ?? null;
|
|
7538
7535
|
}
|
|
7539
7536
|
const FormatDictionary = {
|
|
7540
7537
|
regex: "\u0987\u09A8\u09AA\u09C1\u099F",
|
|
@@ -7647,8 +7644,8 @@ var error6 = () => {
|
|
|
7647
7644
|
set: { unit: "elements", verb: "contenir" },
|
|
7648
7645
|
map: { unit: "elements", verb: "contenir" }
|
|
7649
7646
|
};
|
|
7650
|
-
function getSizing(
|
|
7651
|
-
return Sizable[
|
|
7647
|
+
function getSizing(origin2) {
|
|
7648
|
+
return Sizable[origin2] ?? null;
|
|
7652
7649
|
}
|
|
7653
7650
|
const FormatDictionary = {
|
|
7654
7651
|
regex: "entrada",
|
|
@@ -7761,8 +7758,8 @@ var error7 = () => {
|
|
|
7761
7758
|
set: { unit: "\u062F\u0627\u0646\u06D5", verb: "\u0628\u06CE\u062A" },
|
|
7762
7759
|
map: { unit: "\u062F\u0627\u0646\u06D5", verb: "\u0628\u06CE\u062A" }
|
|
7763
7760
|
};
|
|
7764
|
-
function getSizing(
|
|
7765
|
-
return Sizable[
|
|
7761
|
+
function getSizing(origin2) {
|
|
7762
|
+
return Sizable[origin2] ?? null;
|
|
7766
7763
|
}
|
|
7767
7764
|
const FormatDictionary = {
|
|
7768
7765
|
regex: "regex",
|
|
@@ -7894,8 +7891,8 @@ var error8 = () => {
|
|
|
7894
7891
|
set: { unit: "prvk\u016F", verb: "m\xEDt" },
|
|
7895
7892
|
map: { unit: "prvk\u016F", verb: "m\xEDt" }
|
|
7896
7893
|
};
|
|
7897
|
-
function getSizing(
|
|
7898
|
-
return Sizable[
|
|
7894
|
+
function getSizing(origin2) {
|
|
7895
|
+
return Sizable[origin2] ?? null;
|
|
7899
7896
|
}
|
|
7900
7897
|
const FormatDictionary = {
|
|
7901
7898
|
regex: "regul\xE1rn\xED v\xFDraz",
|
|
@@ -8011,8 +8008,8 @@ var error9 = () => {
|
|
|
8011
8008
|
set: { unit: "elementer", verb: "indeholdt" },
|
|
8012
8009
|
map: { unit: "elementer", verb: "indeholdt" }
|
|
8013
8010
|
};
|
|
8014
|
-
function getSizing(
|
|
8015
|
-
return Sizable[
|
|
8011
|
+
function getSizing(origin2) {
|
|
8012
|
+
return Sizable[origin2] ?? null;
|
|
8016
8013
|
}
|
|
8017
8014
|
const FormatDictionary = {
|
|
8018
8015
|
regex: "input",
|
|
@@ -8076,19 +8073,19 @@ var error9 = () => {
|
|
|
8076
8073
|
case "too_big": {
|
|
8077
8074
|
const adj = issue2.inclusive ? "<=" : "<";
|
|
8078
8075
|
const sizing = getSizing(issue2.origin);
|
|
8079
|
-
const
|
|
8076
|
+
const origin2 = TypeDictionary[issue2.origin] ?? issue2.origin;
|
|
8080
8077
|
if (sizing)
|
|
8081
|
-
return `For stor: forventede ${
|
|
8082
|
-
return `For stor: forventede ${
|
|
8078
|
+
return `For stor: forventede ${origin2 ?? "value"} ${sizing.verb} ${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "elementer"}`;
|
|
8079
|
+
return `For stor: forventede ${origin2 ?? "value"} havde ${adj} ${issue2.maximum.toString()}`;
|
|
8083
8080
|
}
|
|
8084
8081
|
case "too_small": {
|
|
8085
8082
|
const adj = issue2.inclusive ? ">=" : ">";
|
|
8086
8083
|
const sizing = getSizing(issue2.origin);
|
|
8087
|
-
const
|
|
8084
|
+
const origin2 = TypeDictionary[issue2.origin] ?? issue2.origin;
|
|
8088
8085
|
if (sizing) {
|
|
8089
|
-
return `For lille: forventede ${
|
|
8086
|
+
return `For lille: forventede ${origin2} ${sizing.verb} ${adj} ${issue2.minimum.toString()} ${sizing.unit}`;
|
|
8090
8087
|
}
|
|
8091
|
-
return `For lille: forventede ${
|
|
8088
|
+
return `For lille: forventede ${origin2} havde ${adj} ${issue2.minimum.toString()}`;
|
|
8092
8089
|
}
|
|
8093
8090
|
case "invalid_format": {
|
|
8094
8091
|
const _issue = issue2;
|
|
@@ -8132,8 +8129,8 @@ var error10 = () => {
|
|
|
8132
8129
|
set: { unit: "Elemente", verb: "zu haben" },
|
|
8133
8130
|
map: { unit: "Elemente", verb: "zu haben" }
|
|
8134
8131
|
};
|
|
8135
|
-
function getSizing(
|
|
8136
|
-
return Sizable[
|
|
8132
|
+
function getSizing(origin2) {
|
|
8133
|
+
return Sizable[origin2] ?? null;
|
|
8137
8134
|
}
|
|
8138
8135
|
const FormatDictionary = {
|
|
8139
8136
|
regex: "Eingabe",
|
|
@@ -8246,8 +8243,8 @@ var error11 = () => {
|
|
|
8246
8243
|
set: { unit: "\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1", verb: "\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9" },
|
|
8247
8244
|
map: { unit: "\u03BA\u03B1\u03C4\u03B1\u03C7\u03C9\u03C1\u03AE\u03C3\u03B5\u03B9\u03C2", verb: "\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9" }
|
|
8248
8245
|
};
|
|
8249
|
-
function getSizing(
|
|
8250
|
-
return Sizable[
|
|
8246
|
+
function getSizing(origin2) {
|
|
8247
|
+
return Sizable[origin2] ?? null;
|
|
8251
8248
|
}
|
|
8252
8249
|
const FormatDictionary = {
|
|
8253
8250
|
regex: "\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2",
|
|
@@ -8359,8 +8356,8 @@ var error12 = () => {
|
|
|
8359
8356
|
set: { unit: "items", verb: "to have" },
|
|
8360
8357
|
map: { unit: "entries", verb: "to have" }
|
|
8361
8358
|
};
|
|
8362
|
-
function getSizing(
|
|
8363
|
-
return Sizable[
|
|
8359
|
+
function getSizing(origin2) {
|
|
8360
|
+
return Sizable[origin2] ?? null;
|
|
8364
8361
|
}
|
|
8365
8362
|
const FormatDictionary = {
|
|
8366
8363
|
regex: "input",
|
|
@@ -8484,8 +8481,8 @@ var error13 = () => {
|
|
|
8484
8481
|
set: { unit: "elementojn", verb: "havi" },
|
|
8485
8482
|
map: { unit: "elementojn", verb: "havi" }
|
|
8486
8483
|
};
|
|
8487
|
-
function getSizing(
|
|
8488
|
-
return Sizable[
|
|
8484
|
+
function getSizing(origin2) {
|
|
8485
|
+
return Sizable[origin2] ?? null;
|
|
8489
8486
|
}
|
|
8490
8487
|
const FormatDictionary = {
|
|
8491
8488
|
regex: "enigo",
|
|
@@ -8598,8 +8595,8 @@ var error14 = () => {
|
|
|
8598
8595
|
array: { unit: "elementos", verb: "tener" },
|
|
8599
8596
|
set: { unit: "elementos", verb: "tener" }
|
|
8600
8597
|
};
|
|
8601
|
-
function getSizing(
|
|
8602
|
-
return Sizable[
|
|
8598
|
+
function getSizing(origin2) {
|
|
8599
|
+
return Sizable[origin2] ?? null;
|
|
8603
8600
|
}
|
|
8604
8601
|
const FormatDictionary = {
|
|
8605
8602
|
regex: "entrada",
|
|
@@ -8680,19 +8677,19 @@ var error14 = () => {
|
|
|
8680
8677
|
case "too_big": {
|
|
8681
8678
|
const adj = issue2.inclusive ? "<=" : "<";
|
|
8682
8679
|
const sizing = getSizing(issue2.origin);
|
|
8683
|
-
const
|
|
8680
|
+
const origin2 = TypeDictionary[issue2.origin] ?? issue2.origin;
|
|
8684
8681
|
if (sizing)
|
|
8685
|
-
return `Demasiado grande: se esperaba que ${
|
|
8686
|
-
return `Demasiado grande: se esperaba que ${
|
|
8682
|
+
return `Demasiado grande: se esperaba que ${origin2 ?? "valor"} tuviera ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementos"}`;
|
|
8683
|
+
return `Demasiado grande: se esperaba que ${origin2 ?? "valor"} fuera ${adj}${issue2.maximum.toString()}`;
|
|
8687
8684
|
}
|
|
8688
8685
|
case "too_small": {
|
|
8689
8686
|
const adj = issue2.inclusive ? ">=" : ">";
|
|
8690
8687
|
const sizing = getSizing(issue2.origin);
|
|
8691
|
-
const
|
|
8688
|
+
const origin2 = TypeDictionary[issue2.origin] ?? issue2.origin;
|
|
8692
8689
|
if (sizing) {
|
|
8693
|
-
return `Demasiado peque\xF1o: se esperaba que ${
|
|
8690
|
+
return `Demasiado peque\xF1o: se esperaba que ${origin2} tuviera ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
|
|
8694
8691
|
}
|
|
8695
|
-
return `Demasiado peque\xF1o: se esperaba que ${
|
|
8692
|
+
return `Demasiado peque\xF1o: se esperaba que ${origin2} fuera ${adj}${issue2.minimum.toString()}`;
|
|
8696
8693
|
}
|
|
8697
8694
|
case "invalid_format": {
|
|
8698
8695
|
const _issue = issue2;
|
|
@@ -8736,8 +8733,8 @@ var error15 = () => {
|
|
|
8736
8733
|
set: { unit: "\u0622\u06CC\u062A\u0645", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" },
|
|
8737
8734
|
map: { unit: "\u0622\u06CC\u062A\u0645", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" }
|
|
8738
8735
|
};
|
|
8739
|
-
function getSizing(
|
|
8740
|
-
return Sizable[
|
|
8736
|
+
function getSizing(origin2) {
|
|
8737
|
+
return Sizable[origin2] ?? null;
|
|
8741
8738
|
}
|
|
8742
8739
|
const FormatDictionary = {
|
|
8743
8740
|
regex: "\u0648\u0631\u0648\u062F\u06CC",
|
|
@@ -8860,8 +8857,8 @@ var error16 = () => {
|
|
|
8860
8857
|
int: { unit: "", subject: "kokonaisluvun" },
|
|
8861
8858
|
date: { unit: "", subject: "p\xE4iv\xE4m\xE4\xE4r\xE4n" }
|
|
8862
8859
|
};
|
|
8863
|
-
function getSizing(
|
|
8864
|
-
return Sizable[
|
|
8860
|
+
function getSizing(origin2) {
|
|
8861
|
+
return Sizable[origin2] ?? null;
|
|
8865
8862
|
}
|
|
8866
8863
|
const FormatDictionary = {
|
|
8867
8864
|
regex: "s\xE4\xE4nn\xF6llinen lauseke",
|
|
@@ -8973,8 +8970,8 @@ var error17 = () => {
|
|
|
8973
8970
|
array: { unit: "\xE9l\xE9ments", verb: "avoir" },
|
|
8974
8971
|
set: { unit: "\xE9l\xE9ments", verb: "avoir" }
|
|
8975
8972
|
};
|
|
8976
|
-
function getSizing(
|
|
8977
|
-
return Sizable[
|
|
8973
|
+
function getSizing(origin2) {
|
|
8974
|
+
return Sizable[origin2] ?? null;
|
|
8978
8975
|
}
|
|
8979
8976
|
const FormatDictionary = {
|
|
8980
8977
|
regex: "expression r\xE9guli\xE8re",
|
|
@@ -9104,8 +9101,8 @@ var error18 = () => {
|
|
|
9104
9101
|
set: { unit: "\xE9l\xE9ments", verb: "avoir" },
|
|
9105
9102
|
map: { unit: "\xE9l\xE9ments", verb: "avoir" }
|
|
9106
9103
|
};
|
|
9107
|
-
function getSizing(
|
|
9108
|
-
return Sizable[
|
|
9104
|
+
function getSizing(origin2) {
|
|
9105
|
+
return Sizable[origin2] ?? null;
|
|
9109
9106
|
}
|
|
9110
9107
|
const FormatDictionary = {
|
|
9111
9108
|
regex: "entr\xE9e",
|
|
@@ -9217,8 +9214,8 @@ var error19 = () => {
|
|
|
9217
9214
|
set: { unit: "\u0A86\u0A87\u0A9F\u0AAE", verb: "\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F" },
|
|
9218
9215
|
map: { unit: "\u0A8F\u0AA8\u0ACD\u0A9F\u0ACD\u0AB0\u0AC0", verb: "\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F" }
|
|
9219
9216
|
};
|
|
9220
|
-
function getSizing(
|
|
9221
|
-
return Sizable[
|
|
9217
|
+
function getSizing(origin2) {
|
|
9218
|
+
return Sizable[origin2] ?? null;
|
|
9222
9219
|
}
|
|
9223
9220
|
const FormatDictionary = {
|
|
9224
9221
|
regex: "\u0A87\u0AA8\u0AAA\u0AC1\u0A9F",
|
|
@@ -9365,10 +9362,10 @@ var error20 = () => {
|
|
|
9365
9362
|
const gender = e?.gender ?? "m";
|
|
9366
9363
|
return gender === "f" ? "\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA" : "\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA";
|
|
9367
9364
|
};
|
|
9368
|
-
const getSizing = (
|
|
9369
|
-
if (!
|
|
9365
|
+
const getSizing = (origin2) => {
|
|
9366
|
+
if (!origin2)
|
|
9370
9367
|
return null;
|
|
9371
|
-
return Sizable[
|
|
9368
|
+
return Sizable[origin2] ?? null;
|
|
9372
9369
|
};
|
|
9373
9370
|
const FormatDictionary = {
|
|
9374
9371
|
regex: { label: "\u05E7\u05DC\u05D8", gender: "m" },
|
|
@@ -9533,8 +9530,8 @@ var error21 = () => {
|
|
|
9533
9530
|
set: { unit: "\u0924\u0924\u094D\u0935", verb: "\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F" },
|
|
9534
9531
|
map: { unit: "\u092A\u094D\u0930\u0935\u093F\u0937\u094D\u091F\u093F\u092F\u093E\u0901", verb: "\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F" }
|
|
9535
9532
|
};
|
|
9536
|
-
function getSizing(
|
|
9537
|
-
return Sizable[
|
|
9533
|
+
function getSizing(origin2) {
|
|
9534
|
+
return Sizable[origin2] ?? null;
|
|
9538
9535
|
}
|
|
9539
9536
|
const FormatDictionary = {
|
|
9540
9537
|
regex: "\u0907\u0928\u092A\u0941\u091F",
|
|
@@ -9644,8 +9641,8 @@ var error22 = () => {
|
|
|
9644
9641
|
array: { unit: "stavki", verb: "imati" },
|
|
9645
9642
|
set: { unit: "stavki", verb: "imati" }
|
|
9646
9643
|
};
|
|
9647
|
-
function getSizing(
|
|
9648
|
-
return Sizable[
|
|
9644
|
+
function getSizing(origin2) {
|
|
9645
|
+
return Sizable[origin2] ?? null;
|
|
9649
9646
|
}
|
|
9650
9647
|
const FormatDictionary = {
|
|
9651
9648
|
regex: "unos",
|
|
@@ -9716,19 +9713,19 @@ var error22 = () => {
|
|
|
9716
9713
|
case "too_big": {
|
|
9717
9714
|
const adj = issue2.inclusive ? "<=" : "<";
|
|
9718
9715
|
const sizing = getSizing(issue2.origin);
|
|
9719
|
-
const
|
|
9716
|
+
const origin2 = TypeDictionary[issue2.origin] ?? issue2.origin;
|
|
9720
9717
|
if (sizing)
|
|
9721
|
-
return `Preveliko: o\u010Dekivano da ${
|
|
9722
|
-
return `Preveliko: o\u010Dekivano da ${
|
|
9718
|
+
return `Preveliko: o\u010Dekivano da ${origin2 ?? "vrijednost"} ima ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elemenata"}`;
|
|
9719
|
+
return `Preveliko: o\u010Dekivano da ${origin2 ?? "vrijednost"} bude ${adj}${issue2.maximum.toString()}`;
|
|
9723
9720
|
}
|
|
9724
9721
|
case "too_small": {
|
|
9725
9722
|
const adj = issue2.inclusive ? ">=" : ">";
|
|
9726
9723
|
const sizing = getSizing(issue2.origin);
|
|
9727
|
-
const
|
|
9724
|
+
const origin2 = TypeDictionary[issue2.origin] ?? issue2.origin;
|
|
9728
9725
|
if (sizing) {
|
|
9729
|
-
return `Premalo: o\u010Dekivano da ${
|
|
9726
|
+
return `Premalo: o\u010Dekivano da ${origin2} ima ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
|
|
9730
9727
|
}
|
|
9731
|
-
return `Premalo: o\u010Dekivano da ${
|
|
9728
|
+
return `Premalo: o\u010Dekivano da ${origin2} bude ${adj}${issue2.minimum.toString()}`;
|
|
9732
9729
|
}
|
|
9733
9730
|
case "invalid_format": {
|
|
9734
9731
|
const _issue = issue2;
|
|
@@ -9772,8 +9769,8 @@ var error23 = () => {
|
|
|
9772
9769
|
set: { unit: "elem", verb: "legyen" },
|
|
9773
9770
|
map: { unit: "elem", verb: "legyen" }
|
|
9774
9771
|
};
|
|
9775
|
-
function getSizing(
|
|
9776
|
-
return Sizable[
|
|
9772
|
+
function getSizing(origin2) {
|
|
9773
|
+
return Sizable[origin2] ?? null;
|
|
9777
9774
|
}
|
|
9778
9775
|
const FormatDictionary = {
|
|
9779
9776
|
regex: "bemenet",
|
|
@@ -9926,8 +9923,8 @@ var error24 = () => {
|
|
|
9926
9923
|
verb: "\u0578\u0582\u0576\u0565\u0576\u0561\u056C"
|
|
9927
9924
|
}
|
|
9928
9925
|
};
|
|
9929
|
-
function getSizing(
|
|
9930
|
-
return Sizable[
|
|
9926
|
+
function getSizing(origin2) {
|
|
9927
|
+
return Sizable[origin2] ?? null;
|
|
9931
9928
|
}
|
|
9932
9929
|
const FormatDictionary = {
|
|
9933
9930
|
regex: "\u0574\u0578\u0582\u057F\u0584",
|
|
@@ -10045,8 +10042,8 @@ var error25 = () => {
|
|
|
10045
10042
|
set: { unit: "item", verb: "memiliki" },
|
|
10046
10043
|
map: { unit: "item", verb: "memiliki" }
|
|
10047
10044
|
};
|
|
10048
|
-
function getSizing(
|
|
10049
|
-
return Sizable[
|
|
10045
|
+
function getSizing(origin2) {
|
|
10046
|
+
return Sizable[origin2] ?? null;
|
|
10050
10047
|
}
|
|
10051
10048
|
const FormatDictionary = {
|
|
10052
10049
|
regex: "input",
|
|
@@ -10157,8 +10154,8 @@ var error26 = () => {
|
|
|
10157
10154
|
set: { unit: "hluti", verb: "a\xF0 hafa" },
|
|
10158
10155
|
map: { unit: "hluti", verb: "a\xF0 hafa" }
|
|
10159
10156
|
};
|
|
10160
|
-
function getSizing(
|
|
10161
|
-
return Sizable[
|
|
10157
|
+
function getSizing(origin2) {
|
|
10158
|
+
return Sizable[origin2] ?? null;
|
|
10162
10159
|
}
|
|
10163
10160
|
const FormatDictionary = {
|
|
10164
10161
|
regex: "gildi",
|
|
@@ -10272,8 +10269,8 @@ var error27 = () => {
|
|
|
10272
10269
|
set: { unit: "elementi", verb: "avere" },
|
|
10273
10270
|
map: { unit: "elementi", verb: "avere" }
|
|
10274
10271
|
};
|
|
10275
|
-
function getSizing(
|
|
10276
|
-
return Sizable[
|
|
10272
|
+
function getSizing(origin2) {
|
|
10273
|
+
return Sizable[origin2] ?? null;
|
|
10277
10274
|
}
|
|
10278
10275
|
const FormatDictionary = {
|
|
10279
10276
|
regex: "input",
|
|
@@ -10386,8 +10383,8 @@ var error28 = () => {
|
|
|
10386
10383
|
set: { unit: "\u8981\u7D20", verb: "\u3067\u3042\u308B" },
|
|
10387
10384
|
map: { unit: "\u8981\u7D20", verb: "\u3067\u3042\u308B" }
|
|
10388
10385
|
};
|
|
10389
|
-
function getSizing(
|
|
10390
|
-
return Sizable[
|
|
10386
|
+
function getSizing(origin2) {
|
|
10387
|
+
return Sizable[origin2] ?? null;
|
|
10391
10388
|
}
|
|
10392
10389
|
const FormatDictionary = {
|
|
10393
10390
|
regex: "\u5165\u529B\u5024",
|
|
@@ -10499,8 +10496,8 @@ var error29 = () => {
|
|
|
10499
10496
|
set: { unit: "\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" },
|
|
10500
10497
|
map: { unit: "\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" }
|
|
10501
10498
|
};
|
|
10502
|
-
function getSizing(
|
|
10503
|
-
return Sizable[
|
|
10499
|
+
function getSizing(origin2) {
|
|
10500
|
+
return Sizable[origin2] ?? null;
|
|
10504
10501
|
}
|
|
10505
10502
|
const FormatDictionary = {
|
|
10506
10503
|
regex: "\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0",
|
|
@@ -10617,8 +10614,8 @@ var error30 = () => {
|
|
|
10617
10614
|
set: { unit: "\u1792\u17B6\u178F\u17BB", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" },
|
|
10618
10615
|
map: { unit: "\u1792\u17B6\u178F\u17BB", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" }
|
|
10619
10616
|
};
|
|
10620
|
-
function getSizing(
|
|
10621
|
-
return Sizable[
|
|
10617
|
+
function getSizing(origin2) {
|
|
10618
|
+
return Sizable[origin2] ?? null;
|
|
10622
10619
|
}
|
|
10623
10620
|
const FormatDictionary = {
|
|
10624
10621
|
regex: "\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",
|
|
@@ -10738,8 +10735,8 @@ var error31 = () => {
|
|
|
10738
10735
|
set: { unit: "\u0CB5\u0CB8\u0CCD\u0CA4\u0CC1\u0C97\u0CB3\u0CC1", verb: "\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1" },
|
|
10739
10736
|
map: { unit: "entries", verb: "\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1" }
|
|
10740
10737
|
};
|
|
10741
|
-
function getSizing(
|
|
10742
|
-
return Sizable[
|
|
10738
|
+
function getSizing(origin2) {
|
|
10739
|
+
return Sizable[origin2] ?? null;
|
|
10743
10740
|
}
|
|
10744
10741
|
const FormatDictionary = {
|
|
10745
10742
|
regex: "\u0C87\u0CA8\u0CCD\u0CAA\u0CC1\u0C9F\u0CCD",
|
|
@@ -10854,8 +10851,8 @@ var error32 = () => {
|
|
|
10854
10851
|
set: { unit: "\uAC1C", verb: "to have" },
|
|
10855
10852
|
map: { unit: "\uAC1C", verb: "to have" }
|
|
10856
10853
|
};
|
|
10857
|
-
function getSizing(
|
|
10858
|
-
return Sizable[
|
|
10854
|
+
function getSizing(origin2) {
|
|
10855
|
+
return Sizable[origin2] ?? null;
|
|
10859
10856
|
}
|
|
10860
10857
|
const FormatDictionary = {
|
|
10861
10858
|
regex: "\uC785\uB825",
|
|
@@ -11047,8 +11044,8 @@ var error33 = () => {
|
|
|
11047
11044
|
}
|
|
11048
11045
|
}
|
|
11049
11046
|
};
|
|
11050
|
-
function getSizing(
|
|
11051
|
-
const result = Sizable[
|
|
11047
|
+
function getSizing(origin2, unitType, inclusive, targetShouldBe) {
|
|
11048
|
+
const result = Sizable[origin2] ?? null;
|
|
11052
11049
|
if (result === null)
|
|
11053
11050
|
return result;
|
|
11054
11051
|
return {
|
|
@@ -11119,20 +11116,20 @@ var error33 = () => {
|
|
|
11119
11116
|
return `Privalo b\u016Bti ${stringifyPrimitive(issue2.values[0])}`;
|
|
11120
11117
|
return `Privalo b\u016Bti vienas i\u0161 ${joinValues(issue2.values, "|")} pasirinkim\u0173`;
|
|
11121
11118
|
case "too_big": {
|
|
11122
|
-
const
|
|
11119
|
+
const origin2 = TypeDictionary[issue2.origin] ?? issue2.origin;
|
|
11123
11120
|
const sizing = getSizing(issue2.origin, getUnitTypeFromNumber(Number(issue2.maximum)), issue2.inclusive ?? false, "smaller");
|
|
11124
11121
|
if (sizing?.verb)
|
|
11125
|
-
return `${capitalizeFirstCharacter(
|
|
11122
|
+
return `${capitalizeFirstCharacter(origin2 ?? issue2.origin ?? "reik\u0161m\u0117")} ${sizing.verb} ${issue2.maximum.toString()} ${sizing.unit ?? "element\u0173"}`;
|
|
11126
11123
|
const adj = issue2.inclusive ? "ne didesnis kaip" : "ma\u017Eesnis kaip";
|
|
11127
|
-
return `${capitalizeFirstCharacter(
|
|
11124
|
+
return `${capitalizeFirstCharacter(origin2 ?? issue2.origin ?? "reik\u0161m\u0117")} turi b\u016Bti ${adj} ${issue2.maximum.toString()} ${sizing?.unit}`;
|
|
11128
11125
|
}
|
|
11129
11126
|
case "too_small": {
|
|
11130
|
-
const
|
|
11127
|
+
const origin2 = TypeDictionary[issue2.origin] ?? issue2.origin;
|
|
11131
11128
|
const sizing = getSizing(issue2.origin, getUnitTypeFromNumber(Number(issue2.minimum)), issue2.inclusive ?? false, "bigger");
|
|
11132
11129
|
if (sizing?.verb)
|
|
11133
|
-
return `${capitalizeFirstCharacter(
|
|
11130
|
+
return `${capitalizeFirstCharacter(origin2 ?? issue2.origin ?? "reik\u0161m\u0117")} ${sizing.verb} ${issue2.minimum.toString()} ${sizing.unit ?? "element\u0173"}`;
|
|
11134
11131
|
const adj = issue2.inclusive ? "ne ma\u017Eesnis kaip" : "didesnis kaip";
|
|
11135
|
-
return `${capitalizeFirstCharacter(
|
|
11132
|
+
return `${capitalizeFirstCharacter(origin2 ?? issue2.origin ?? "reik\u0161m\u0117")} turi b\u016Bti ${adj} ${issue2.minimum.toString()} ${sizing?.unit}`;
|
|
11136
11133
|
}
|
|
11137
11134
|
case "invalid_format": {
|
|
11138
11135
|
const _issue = issue2;
|
|
@@ -11156,8 +11153,8 @@ var error33 = () => {
|
|
|
11156
11153
|
case "invalid_union":
|
|
11157
11154
|
return "Klaidinga \u012Fvestis";
|
|
11158
11155
|
case "invalid_element": {
|
|
11159
|
-
const
|
|
11160
|
-
return `${capitalizeFirstCharacter(
|
|
11156
|
+
const origin2 = TypeDictionary[issue2.origin] ?? issue2.origin;
|
|
11157
|
+
return `${capitalizeFirstCharacter(origin2 ?? issue2.origin ?? "reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`;
|
|
11161
11158
|
}
|
|
11162
11159
|
default:
|
|
11163
11160
|
return "Klaidinga \u012Fvestis";
|
|
@@ -11179,8 +11176,8 @@ var error34 = () => {
|
|
|
11179
11176
|
set: { unit: "\u0441\u0442\u0430\u0432\u043A\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" },
|
|
11180
11177
|
map: { unit: "\u0441\u0442\u0430\u0432\u043A\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" }
|
|
11181
11178
|
};
|
|
11182
|
-
function getSizing(
|
|
11183
|
-
return Sizable[
|
|
11179
|
+
function getSizing(origin2) {
|
|
11180
|
+
return Sizable[origin2] ?? null;
|
|
11184
11181
|
}
|
|
11185
11182
|
const FormatDictionary = {
|
|
11186
11183
|
regex: "\u0432\u043D\u0435\u0441",
|
|
@@ -11294,8 +11291,8 @@ var error35 = () => {
|
|
|
11294
11291
|
set: { unit: "elemen", verb: "mempunyai" },
|
|
11295
11292
|
map: { unit: "elemen", verb: "mempunyai" }
|
|
11296
11293
|
};
|
|
11297
|
-
function getSizing(
|
|
11298
|
-
return Sizable[
|
|
11294
|
+
function getSizing(origin2) {
|
|
11295
|
+
return Sizable[origin2] ?? null;
|
|
11299
11296
|
}
|
|
11300
11297
|
const FormatDictionary = {
|
|
11301
11298
|
regex: "input",
|
|
@@ -11407,8 +11404,8 @@ var error36 = () => {
|
|
|
11407
11404
|
set: { unit: "\u0924\u0924\u094D\u0935", verb: "\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B" },
|
|
11408
11405
|
map: { unit: "\u092A\u094D\u0930\u0935\u093F\u0937\u094D\u091F\u093F", verb: "\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B" }
|
|
11409
11406
|
};
|
|
11410
|
-
function getSizing(
|
|
11411
|
-
return Sizable[
|
|
11407
|
+
function getSizing(origin2) {
|
|
11408
|
+
return Sizable[origin2] ?? null;
|
|
11412
11409
|
}
|
|
11413
11410
|
const FormatDictionary = {
|
|
11414
11411
|
regex: "\u0907\u0928\u092A\u0941\u091F",
|
|
@@ -11519,8 +11516,8 @@ var error37 = () => {
|
|
|
11519
11516
|
set: { unit: "elementen", verb: "heeft" },
|
|
11520
11517
|
map: { unit: "elementen", verb: "heeft" }
|
|
11521
11518
|
};
|
|
11522
|
-
function getSizing(
|
|
11523
|
-
return Sizable[
|
|
11519
|
+
function getSizing(origin2) {
|
|
11520
|
+
return Sizable[origin2] ?? null;
|
|
11524
11521
|
}
|
|
11525
11522
|
const FormatDictionary = {
|
|
11526
11523
|
regex: "invoer",
|
|
@@ -11635,8 +11632,8 @@ var error38 = () => {
|
|
|
11635
11632
|
set: { unit: "element", verb: "\xE5 innehalde" },
|
|
11636
11633
|
map: { unit: "element", verb: "\xE5 innehalde" }
|
|
11637
11634
|
};
|
|
11638
|
-
function getSizing(
|
|
11639
|
-
return Sizable[
|
|
11635
|
+
function getSizing(origin2) {
|
|
11636
|
+
return Sizable[origin2] ?? null;
|
|
11640
11637
|
}
|
|
11641
11638
|
const FormatDictionary = {
|
|
11642
11639
|
regex: "input",
|
|
@@ -11749,8 +11746,8 @@ var error39 = () => {
|
|
|
11749
11746
|
set: { unit: "elementer", verb: "\xE5 inneholde" },
|
|
11750
11747
|
map: { unit: "elementer", verb: "\xE5 inneholde" }
|
|
11751
11748
|
};
|
|
11752
|
-
function getSizing(
|
|
11753
|
-
return Sizable[
|
|
11749
|
+
function getSizing(origin2) {
|
|
11750
|
+
return Sizable[origin2] ?? null;
|
|
11754
11751
|
}
|
|
11755
11752
|
const FormatDictionary = {
|
|
11756
11753
|
regex: "input",
|
|
@@ -11863,8 +11860,8 @@ var error40 = () => {
|
|
|
11863
11860
|
set: { unit: "unsur", verb: "olmal\u0131d\u0131r" },
|
|
11864
11861
|
map: { unit: "unsur", verb: "olmal\u0131d\u0131r" }
|
|
11865
11862
|
};
|
|
11866
|
-
function getSizing(
|
|
11867
|
-
return Sizable[
|
|
11863
|
+
function getSizing(origin2) {
|
|
11864
|
+
return Sizable[origin2] ?? null;
|
|
11868
11865
|
}
|
|
11869
11866
|
const FormatDictionary = {
|
|
11870
11867
|
regex: "giren",
|
|
@@ -11978,8 +11975,8 @@ var error41 = () => {
|
|
|
11978
11975
|
set: { unit: "\u062A\u0648\u06A9\u064A", verb: "\u0648\u0644\u0631\u064A" },
|
|
11979
11976
|
map: { unit: "\u062A\u0648\u06A9\u064A", verb: "\u0648\u0644\u0631\u064A" }
|
|
11980
11977
|
};
|
|
11981
|
-
function getSizing(
|
|
11982
|
-
return Sizable[
|
|
11978
|
+
function getSizing(origin2) {
|
|
11979
|
+
return Sizable[origin2] ?? null;
|
|
11983
11980
|
}
|
|
11984
11981
|
const FormatDictionary = {
|
|
11985
11982
|
regex: "\u0648\u0631\u0648\u062F\u064A",
|
|
@@ -12098,8 +12095,8 @@ var error42 = () => {
|
|
|
12098
12095
|
set: { unit: "element\xF3w", verb: "mie\u0107" },
|
|
12099
12096
|
map: { unit: "element\xF3w", verb: "mie\u0107" }
|
|
12100
12097
|
};
|
|
12101
|
-
function getSizing(
|
|
12102
|
-
return Sizable[
|
|
12098
|
+
function getSizing(origin2) {
|
|
12099
|
+
return Sizable[origin2] ?? null;
|
|
12103
12100
|
}
|
|
12104
12101
|
const FormatDictionary = {
|
|
12105
12102
|
regex: "wyra\u017Cenie",
|
|
@@ -12213,8 +12210,8 @@ var error43 = () => {
|
|
|
12213
12210
|
set: { unit: "elementos" },
|
|
12214
12211
|
map: { unit: "entradas" }
|
|
12215
12212
|
};
|
|
12216
|
-
function getSizing(
|
|
12217
|
-
return Sizable[
|
|
12213
|
+
function getSizing(origin2) {
|
|
12214
|
+
return Sizable[origin2] ?? null;
|
|
12218
12215
|
}
|
|
12219
12216
|
const FormatDictionary = {
|
|
12220
12217
|
regex: "a entrada",
|
|
@@ -12357,8 +12354,8 @@ var error44 = () => {
|
|
|
12357
12354
|
set: { unit: "elementos" },
|
|
12358
12355
|
map: { unit: "entradas" }
|
|
12359
12356
|
};
|
|
12360
|
-
function getSizing(
|
|
12361
|
-
return Sizable[
|
|
12357
|
+
function getSizing(origin2) {
|
|
12358
|
+
return Sizable[origin2] ?? null;
|
|
12362
12359
|
}
|
|
12363
12360
|
const FormatDictionary = {
|
|
12364
12361
|
regex: "a entrada",
|
|
@@ -12502,8 +12499,8 @@ var error45 = () => {
|
|
|
12502
12499
|
set: { unit: "elemente", verb: "s\u0103 aib\u0103" },
|
|
12503
12500
|
map: { unit: "intr\u0103ri", verb: "s\u0103 aib\u0103" }
|
|
12504
12501
|
};
|
|
12505
|
-
function getSizing(
|
|
12506
|
-
return Sizable[
|
|
12502
|
+
function getSizing(origin2) {
|
|
12503
|
+
return Sizable[origin2] ?? null;
|
|
12507
12504
|
}
|
|
12508
12505
|
const FormatDictionary = {
|
|
12509
12506
|
regex: "intrare",
|
|
@@ -12675,8 +12672,8 @@ var error46 = () => {
|
|
|
12675
12672
|
verb: "\u0438\u043C\u0435\u0442\u044C"
|
|
12676
12673
|
}
|
|
12677
12674
|
};
|
|
12678
|
-
function getSizing(
|
|
12679
|
-
return Sizable[
|
|
12675
|
+
function getSizing(origin2) {
|
|
12676
|
+
return Sizable[origin2] ?? null;
|
|
12680
12677
|
}
|
|
12681
12678
|
const FormatDictionary = {
|
|
12682
12679
|
regex: "\u0432\u0432\u043E\u0434",
|
|
@@ -12794,8 +12791,8 @@ var error47 = () => {
|
|
|
12794
12791
|
set: { unit: "prvkov", verb: "ma\u0165" },
|
|
12795
12792
|
map: { unit: "polo\u017Eiek", verb: "ma\u0165" }
|
|
12796
12793
|
};
|
|
12797
|
-
function getSizing(
|
|
12798
|
-
return Sizable[
|
|
12794
|
+
function getSizing(origin2) {
|
|
12795
|
+
return Sizable[origin2] ?? null;
|
|
12799
12796
|
}
|
|
12800
12797
|
const FormatDictionary = {
|
|
12801
12798
|
regex: "regul\xE1rny v\xFDraz",
|
|
@@ -12911,8 +12908,8 @@ var error48 = () => {
|
|
|
12911
12908
|
set: { unit: "elementov", verb: "imeti" },
|
|
12912
12909
|
map: { unit: "elementov", verb: "imeti" }
|
|
12913
12910
|
};
|
|
12914
|
-
function getSizing(
|
|
12915
|
-
return Sizable[
|
|
12911
|
+
function getSizing(origin2) {
|
|
12912
|
+
return Sizable[origin2] ?? null;
|
|
12916
12913
|
}
|
|
12917
12914
|
const FormatDictionary = {
|
|
12918
12915
|
regex: "vnos",
|
|
@@ -13026,8 +13023,8 @@ var error49 = () => {
|
|
|
13026
13023
|
set: { unit: "objekt", verb: "att inneh\xE5lla" },
|
|
13027
13024
|
map: { unit: "objekt", verb: "att inneh\xE5lla" }
|
|
13028
13025
|
};
|
|
13029
|
-
function getSizing(
|
|
13030
|
-
return Sizable[
|
|
13026
|
+
function getSizing(origin2) {
|
|
13027
|
+
return Sizable[origin2] ?? null;
|
|
13031
13028
|
}
|
|
13032
13029
|
const FormatDictionary = {
|
|
13033
13030
|
regex: "regulj\xE4rt uttryck",
|
|
@@ -13142,8 +13139,8 @@ var error50 = () => {
|
|
|
13142
13139
|
set: { unit: "\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" },
|
|
13143
13140
|
map: { unit: "\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" }
|
|
13144
13141
|
};
|
|
13145
|
-
function getSizing(
|
|
13146
|
-
return Sizable[
|
|
13142
|
+
function getSizing(origin2) {
|
|
13143
|
+
return Sizable[origin2] ?? null;
|
|
13147
13144
|
}
|
|
13148
13145
|
const FormatDictionary = {
|
|
13149
13146
|
regex: "\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",
|
|
@@ -13258,8 +13255,8 @@ var error51 = () => {
|
|
|
13258
13255
|
set: { unit: "\u0443\u043D\u0441\u0443\u0440", verb: "\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434" },
|
|
13259
13256
|
map: { unit: "\u0441\u0430\u0431\u0442", verb: "\u0434\u043E\u0448\u0442\u0430 \u0431\u043E\u0448\u0430\u0434" }
|
|
13260
13257
|
};
|
|
13261
|
-
function getSizing(
|
|
13262
|
-
return Sizable[
|
|
13258
|
+
function getSizing(origin2) {
|
|
13259
|
+
return Sizable[origin2] ?? null;
|
|
13263
13260
|
}
|
|
13264
13261
|
const FormatDictionary = {
|
|
13265
13262
|
regex: "\u0432\u0443\u0440\u0443\u0434",
|
|
@@ -13375,8 +13372,8 @@ var error52 = () => {
|
|
|
13375
13372
|
set: { unit: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
|
|
13376
13373
|
map: { unit: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" }
|
|
13377
13374
|
};
|
|
13378
|
-
function getSizing(
|
|
13379
|
-
return Sizable[
|
|
13375
|
+
function getSizing(origin2) {
|
|
13376
|
+
return Sizable[origin2] ?? null;
|
|
13380
13377
|
}
|
|
13381
13378
|
const FormatDictionary = {
|
|
13382
13379
|
regex: "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",
|
|
@@ -13491,8 +13488,8 @@ var error53 = () => {
|
|
|
13491
13488
|
set: { unit: "elementler", verb: "bolmaly" },
|
|
13492
13489
|
map: { unit: "elementler", verb: "bolmaly" }
|
|
13493
13490
|
};
|
|
13494
|
-
function getSizing(
|
|
13495
|
-
return Sizable[
|
|
13491
|
+
function getSizing(origin2) {
|
|
13492
|
+
return Sizable[origin2] ?? null;
|
|
13496
13493
|
}
|
|
13497
13494
|
const FormatDictionary = {
|
|
13498
13495
|
regex: "giri\u015F",
|
|
@@ -13599,8 +13596,8 @@ var error54 = () => {
|
|
|
13599
13596
|
set: { unit: "\xF6\u011Fe", verb: "olmal\u0131" },
|
|
13600
13597
|
map: { unit: "\xF6\u011Fe", verb: "olmal\u0131" }
|
|
13601
13598
|
};
|
|
13602
|
-
function getSizing(
|
|
13603
|
-
return Sizable[
|
|
13599
|
+
function getSizing(origin2) {
|
|
13600
|
+
return Sizable[origin2] ?? null;
|
|
13604
13601
|
}
|
|
13605
13602
|
const FormatDictionary = {
|
|
13606
13603
|
regex: "girdi",
|
|
@@ -13710,8 +13707,8 @@ var error55 = () => {
|
|
|
13710
13707
|
set: { unit: "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" },
|
|
13711
13708
|
map: { unit: "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" }
|
|
13712
13709
|
};
|
|
13713
|
-
function getSizing(
|
|
13714
|
-
return Sizable[
|
|
13710
|
+
function getSizing(origin2) {
|
|
13711
|
+
return Sizable[origin2] ?? null;
|
|
13715
13712
|
}
|
|
13716
13713
|
const FormatDictionary = {
|
|
13717
13714
|
regex: "\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",
|
|
@@ -13829,8 +13826,8 @@ var error56 = () => {
|
|
|
13829
13826
|
set: { unit: "\u0622\u0626\u0679\u0645\u0632", verb: "\u06C1\u0648\u0646\u0627" },
|
|
13830
13827
|
map: { unit: "\u0622\u0626\u0679\u0645\u0632", verb: "\u06C1\u0648\u0646\u0627" }
|
|
13831
13828
|
};
|
|
13832
|
-
function getSizing(
|
|
13833
|
-
return Sizable[
|
|
13829
|
+
function getSizing(origin2) {
|
|
13830
|
+
return Sizable[origin2] ?? null;
|
|
13834
13831
|
}
|
|
13835
13832
|
const FormatDictionary = {
|
|
13836
13833
|
regex: "\u0627\u0646 \u067E\u0679",
|
|
@@ -13945,8 +13942,8 @@ var error57 = () => {
|
|
|
13945
13942
|
set: { unit: "element", verb: "bo\u2018lishi kerak" },
|
|
13946
13943
|
map: { unit: "yozuv", verb: "bo\u2018lishi kerak" }
|
|
13947
13944
|
};
|
|
13948
|
-
function getSizing(
|
|
13949
|
-
return Sizable[
|
|
13945
|
+
function getSizing(origin2) {
|
|
13946
|
+
return Sizable[origin2] ?? null;
|
|
13950
13947
|
}
|
|
13951
13948
|
const FormatDictionary = {
|
|
13952
13949
|
regex: "kirish",
|
|
@@ -14059,8 +14056,8 @@ var error58 = () => {
|
|
|
14059
14056
|
set: { unit: "ph\u1EA7n t\u1EED", verb: "c\xF3" },
|
|
14060
14057
|
map: { unit: "ph\u1EA7n t\u1EED", verb: "c\xF3" }
|
|
14061
14058
|
};
|
|
14062
|
-
function getSizing(
|
|
14063
|
-
return Sizable[
|
|
14059
|
+
function getSizing(origin2) {
|
|
14060
|
+
return Sizable[origin2] ?? null;
|
|
14064
14061
|
}
|
|
14065
14062
|
const FormatDictionary = {
|
|
14066
14063
|
regex: "\u0111\u1EA7u v\xE0o",
|
|
@@ -14173,8 +14170,8 @@ var error59 = () => {
|
|
|
14173
14170
|
set: { unit: "\u9879", verb: "\u5305\u542B" },
|
|
14174
14171
|
map: { unit: "\u9879", verb: "\u5305\u542B" }
|
|
14175
14172
|
};
|
|
14176
|
-
function getSizing(
|
|
14177
|
-
return Sizable[
|
|
14173
|
+
function getSizing(origin2) {
|
|
14174
|
+
return Sizable[origin2] ?? null;
|
|
14178
14175
|
}
|
|
14179
14176
|
const FormatDictionary = {
|
|
14180
14177
|
regex: "\u8F93\u5165",
|
|
@@ -14288,8 +14285,8 @@ var error60 = () => {
|
|
|
14288
14285
|
set: { unit: "\u9805\u76EE", verb: "\u64C1\u6709" },
|
|
14289
14286
|
map: { unit: "\u9805\u76EE", verb: "\u64C1\u6709" }
|
|
14290
14287
|
};
|
|
14291
|
-
function getSizing(
|
|
14292
|
-
return Sizable[
|
|
14288
|
+
function getSizing(origin2) {
|
|
14289
|
+
return Sizable[origin2] ?? null;
|
|
14293
14290
|
}
|
|
14294
14291
|
const FormatDictionary = {
|
|
14295
14292
|
regex: "\u8F38\u5165",
|
|
@@ -14401,8 +14398,8 @@ var error61 = () => {
|
|
|
14401
14398
|
set: { unit: "nkan", verb: "n\xED" },
|
|
14402
14399
|
map: { unit: "nkan", verb: "n\xED" }
|
|
14403
14400
|
};
|
|
14404
|
-
function getSizing(
|
|
14405
|
-
return Sizable[
|
|
14401
|
+
function getSizing(origin2) {
|
|
14402
|
+
return Sizable[origin2] ?? null;
|
|
14406
14403
|
}
|
|
14407
14404
|
const FormatDictionary = {
|
|
14408
14405
|
regex: "\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9",
|
|
@@ -17225,8 +17222,8 @@ function _stringFormat(Class2, format, fnOrRegex, _params = {}) {
|
|
|
17225
17222
|
}
|
|
17226
17223
|
|
|
17227
17224
|
// node_modules/.pnpm/zod@4.6.6/node_modules/zod/v4/core/to-json-schema.js
|
|
17228
|
-
function assignProps(target, ...
|
|
17229
|
-
for (const source of
|
|
17225
|
+
function assignProps(target, ...sources2) {
|
|
17226
|
+
for (const source of sources2) {
|
|
17230
17227
|
for (const key of Reflect.ownKeys(source)) {
|
|
17231
17228
|
if (Object.prototype.propertyIsEnumerable.call(source, key)) {
|
|
17232
17229
|
assignProp(target, key, source[key]);
|
|
@@ -21330,6 +21327,580 @@ function date4(params) {
|
|
|
21330
21327
|
return _coercedDate(ZodDate, params);
|
|
21331
21328
|
}
|
|
21332
21329
|
|
|
21330
|
+
// src/backups/store.ts
|
|
21331
|
+
var import_node_crypto3 = require("node:crypto");
|
|
21332
|
+
var import_node_fs2 = require("node:fs");
|
|
21333
|
+
var import_promises2 = require("node:fs/promises");
|
|
21334
|
+
var import_node_path4 = require("node:path");
|
|
21335
|
+
var import_proper_lockfile2 = __toESM(require_proper_lockfile(), 1);
|
|
21336
|
+
|
|
21337
|
+
// src/shared/backups.ts
|
|
21338
|
+
var backupIdSchema = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,100}$/);
|
|
21339
|
+
var backupTriggers = ["manual", "preUpgrade", "preRestore"];
|
|
21340
|
+
var backupPhases = [
|
|
21341
|
+
"waiting",
|
|
21342
|
+
"copying",
|
|
21343
|
+
"verifying",
|
|
21344
|
+
"succeeded",
|
|
21345
|
+
"failed",
|
|
21346
|
+
"cancelled",
|
|
21347
|
+
"interrupted",
|
|
21348
|
+
"corrupt"
|
|
21349
|
+
];
|
|
21350
|
+
var backupManifestSchema = external_exports.object({
|
|
21351
|
+
formatVersion: external_exports.literal(1),
|
|
21352
|
+
complete: external_exports.literal(true),
|
|
21353
|
+
id: backupIdSchema,
|
|
21354
|
+
createdAt: external_exports.number().int().positive(),
|
|
21355
|
+
appVersion: external_exports.string().min(1),
|
|
21356
|
+
commit: external_exports.string().optional(),
|
|
21357
|
+
trigger: external_exports.enum(backupTriggers),
|
|
21358
|
+
configPath: external_exports.string(),
|
|
21359
|
+
dataDir: external_exports.string(),
|
|
21360
|
+
schemaVersion: external_exports.number().int().positive(),
|
|
21361
|
+
migrationHashes: external_exports.array(external_exports.string().regex(/^[a-f0-9]{64}$/)).min(1),
|
|
21362
|
+
files: external_exports.array(
|
|
21363
|
+
external_exports.object({
|
|
21364
|
+
name: external_exports.enum(["app.sqlite", "config.json"]),
|
|
21365
|
+
size: external_exports.number().int().nonnegative(),
|
|
21366
|
+
sha256: external_exports.string().regex(/^[a-f0-9]{64}$/)
|
|
21367
|
+
}).strict()
|
|
21368
|
+
).length(2),
|
|
21369
|
+
protectedBy: external_exports.string().optional()
|
|
21370
|
+
}).strict().refine(
|
|
21371
|
+
(value) => new Set(value.files.map((file2) => file2.name)).size === 2 && value.migrationHashes.length === value.schemaVersion
|
|
21372
|
+
);
|
|
21373
|
+
var backupRecordSchema = external_exports.object({
|
|
21374
|
+
id: backupIdSchema,
|
|
21375
|
+
phase: external_exports.enum(backupPhases),
|
|
21376
|
+
trigger: external_exports.enum(backupTriggers),
|
|
21377
|
+
createdAt: external_exports.number().int().nonnegative().max(864e13),
|
|
21378
|
+
updatedAt: external_exports.number().int().nonnegative(),
|
|
21379
|
+
path: external_exports.string(),
|
|
21380
|
+
message: external_exports.string(),
|
|
21381
|
+
progress: external_exports.number().min(0).max(100).optional(),
|
|
21382
|
+
manifest: backupManifestSchema.optional()
|
|
21383
|
+
}).strict();
|
|
21384
|
+
|
|
21385
|
+
// src/shared/errors.ts
|
|
21386
|
+
var AppError = class extends Error {
|
|
21387
|
+
constructor(code, message2, status = 400, details) {
|
|
21388
|
+
super(message2);
|
|
21389
|
+
this.code = code;
|
|
21390
|
+
this.status = status;
|
|
21391
|
+
this.details = details;
|
|
21392
|
+
this.name = "AppError";
|
|
21393
|
+
}
|
|
21394
|
+
code;
|
|
21395
|
+
status;
|
|
21396
|
+
details;
|
|
21397
|
+
toJSON(clientOperationId) {
|
|
21398
|
+
return {
|
|
21399
|
+
code: this.code,
|
|
21400
|
+
message: this.message,
|
|
21401
|
+
...clientOperationId ? { clientOperationId } : {},
|
|
21402
|
+
...this.details === void 0 ? {} : { details: this.details }
|
|
21403
|
+
};
|
|
21404
|
+
}
|
|
21405
|
+
};
|
|
21406
|
+
|
|
21407
|
+
// src/server/db/history.ts
|
|
21408
|
+
var import_node_crypto = require("node:crypto");
|
|
21409
|
+
var import_node_fs = require("node:fs");
|
|
21410
|
+
var import_node_path = require("node:path");
|
|
21411
|
+
function readMigrations(folder) {
|
|
21412
|
+
const journal = JSON.parse((0, import_node_fs.readFileSync)((0, import_node_path.join)(folder, "meta/_journal.json"), "utf8"));
|
|
21413
|
+
let last = 0;
|
|
21414
|
+
return journal.entries.map((entry, index) => {
|
|
21415
|
+
if (!/^[a-zA-Z0-9_-]+$/.test(entry.tag) || entry.idx !== index || entry.when <= last)
|
|
21416
|
+
throw new Error("Invalid database migration journal");
|
|
21417
|
+
last = entry.when;
|
|
21418
|
+
const source = (0, import_node_fs.readFileSync)((0, import_node_path.join)(folder, `${entry.tag}.sql`), "utf8");
|
|
21419
|
+
return {
|
|
21420
|
+
hash: (0, import_node_crypto.createHash)("sha256").update(source).digest("hex"),
|
|
21421
|
+
createdAt: entry.when,
|
|
21422
|
+
sql: source.split("--> statement-breakpoint")
|
|
21423
|
+
};
|
|
21424
|
+
});
|
|
21425
|
+
}
|
|
21426
|
+
function inspectDatabase(sqlite, migrations) {
|
|
21427
|
+
const recorded = sqlite.pragma("user_version", { simple: true });
|
|
21428
|
+
const tables = sqlite.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name NOT LIKE 'sqlite_%'").all();
|
|
21429
|
+
const applied = tables.some((table) => table.name === "__drizzle_migrations") ? sqlite.prepare("SELECT hash, created_at FROM __drizzle_migrations ORDER BY created_at").all() : [];
|
|
21430
|
+
if (!applied.length && tables.some((table) => table.name !== "__drizzle_migrations") || applied.some(
|
|
21431
|
+
(entry, index) => entry.hash !== migrations[index]?.hash || entry.created_at !== migrations[index]?.createdAt
|
|
21432
|
+
) || recorded !== 0 && recorded !== applied.length)
|
|
21433
|
+
throw new Error(
|
|
21434
|
+
"\u6570\u636E\u5E93 Schema \u6216\u8FC1\u79FB\u5386\u53F2\u4E0D\u517C\u5BB9\uFF1B\u8BF7\u4F7F\u7528\u517C\u5BB9\u7248\u672C\u6216\u6062\u590D\u5347\u7EA7\u524D\u5907\u4EFD\uFF0C\u4E0D\u4F1A\u6539\u5199\u6216\u91CD\u5EFA\u6570\u636E\u5E93\u3002"
|
|
21435
|
+
);
|
|
21436
|
+
return {
|
|
21437
|
+
schemaVersion: applied.length,
|
|
21438
|
+
legacy: recorded === 0,
|
|
21439
|
+
migrationHashes: applied.map((entry) => entry.hash)
|
|
21440
|
+
};
|
|
21441
|
+
}
|
|
21442
|
+
function requireRestorable(version3, contract) {
|
|
21443
|
+
if (version3 < contract.minRestorableSchemaVersion || version3 > contract.schemaVersion)
|
|
21444
|
+
throw new Error(
|
|
21445
|
+
`\u5907\u4EFD Schema ${version3} \u4E0D\u517C\u5BB9\u76EE\u6807\u7248\u672C\uFF08\u652F\u6301 ${contract.minRestorableSchemaVersion}\u2013${contract.schemaVersion}\uFF09\u3002`
|
|
21446
|
+
);
|
|
21447
|
+
}
|
|
21448
|
+
|
|
21449
|
+
// src/server/config-store.ts
|
|
21450
|
+
var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
21451
|
+
|
|
21452
|
+
// src/server/config.ts
|
|
21453
|
+
var import_node_path2 = require("node:path");
|
|
21454
|
+
|
|
21455
|
+
// src/codex/transport.ts
|
|
21456
|
+
var DEFAULT_MAX_LINE_BYTES = 64 * 1024 * 1024;
|
|
21457
|
+
|
|
21458
|
+
// src/server/config.ts
|
|
21459
|
+
var origin = external_exports.string().regex(/^https?:\/\/[^/?#\\\s]+\/?$/i, "Expected an exact HTTP(S) origin").pipe(external_exports.string().url()).transform((value, context) => {
|
|
21460
|
+
const url2 = new URL(value);
|
|
21461
|
+
if (!["http:", "https:"].includes(url2.protocol) || url2.hostname.includes("*") || value.includes("@") || url2.username || url2.password || url2.pathname !== "/" || url2.search || url2.hash) {
|
|
21462
|
+
context.addIssue({
|
|
21463
|
+
code: "custom",
|
|
21464
|
+
message: "Expected an exact HTTP(S) origin without wildcard, path, credentials, query or hash"
|
|
21465
|
+
});
|
|
21466
|
+
return external_exports.NEVER;
|
|
21467
|
+
}
|
|
21468
|
+
return url2.origin;
|
|
21469
|
+
});
|
|
21470
|
+
var project = external_exports.object({
|
|
21471
|
+
id: external_exports.string().regex(/^[a-zA-Z0-9_-]+$/),
|
|
21472
|
+
name: external_exports.string().min(1),
|
|
21473
|
+
path: external_exports.string().refine(import_node_path2.isAbsolute, "Project path must be absolute")
|
|
21474
|
+
}).strict();
|
|
21475
|
+
var configSchema = external_exports.object({
|
|
21476
|
+
host: external_exports.string().default("127.0.0.1"),
|
|
21477
|
+
port: external_exports.number().int().min(1).max(65535).default(8787),
|
|
21478
|
+
publicOrigin: external_exports.array(origin).min(1).default(["http://127.0.0.1:8787"]).transform((values) => [...new Set(values)]),
|
|
21479
|
+
developmentOrigins: external_exports.array(origin).default([]),
|
|
21480
|
+
dataDir: external_exports.string().min(1).default("./.local/codex-web"),
|
|
21481
|
+
codex: external_exports.object({
|
|
21482
|
+
binary: external_exports.string().min(1).default("codex"),
|
|
21483
|
+
home: external_exports.string().refine(import_node_path2.isAbsolute).optional(),
|
|
21484
|
+
requestTimeoutMs: external_exports.number().int().min(100).max(3e5).default(3e4),
|
|
21485
|
+
maxLineBytes: external_exports.number().int().min(1024).max(256 * 1024 * 1024).default(DEFAULT_MAX_LINE_BYTES)
|
|
21486
|
+
}).strict().default({ binary: "codex", requestTimeoutMs: 3e4, maxLineBytes: DEFAULT_MAX_LINE_BYTES }),
|
|
21487
|
+
auth: external_exports.discriminatedUnion("mode", [
|
|
21488
|
+
external_exports.object({ mode: external_exports.literal("local") }).strict(),
|
|
21489
|
+
external_exports.object({
|
|
21490
|
+
mode: external_exports.literal("cloudflare-access"),
|
|
21491
|
+
issuer: external_exports.string().url(),
|
|
21492
|
+
audience: external_exports.string().min(1)
|
|
21493
|
+
}).strict()
|
|
21494
|
+
]).default({ mode: "local" }),
|
|
21495
|
+
projects: external_exports.array(project).default([]),
|
|
21496
|
+
limits: external_exports.object({
|
|
21497
|
+
eventBytes: external_exports.number().int().min(1024).max(64 * 1024 * 1024).default(16 * 1024 * 1024),
|
|
21498
|
+
wsBytes: external_exports.number().int().min(1024).max(16 * 1024 * 1024).default(4 * 1024 * 1024),
|
|
21499
|
+
itemBytes: external_exports.number().int().min(1024).max(8 * 1024 * 1024).default(2 * 1024 * 1024)
|
|
21500
|
+
}).strict().default({
|
|
21501
|
+
eventBytes: 16 * 1024 * 1024,
|
|
21502
|
+
wsBytes: 4 * 1024 * 1024,
|
|
21503
|
+
itemBytes: 2 * 1024 * 1024
|
|
21504
|
+
})
|
|
21505
|
+
}).strict();
|
|
21506
|
+
var sources = /* @__PURE__ */ new WeakMap();
|
|
21507
|
+
function isLoopback(hostname3) {
|
|
21508
|
+
return ["127.0.0.1", "localhost", "::1", "[::1]"].includes(hostname3);
|
|
21509
|
+
}
|
|
21510
|
+
function parseFileConfig(value) {
|
|
21511
|
+
const parsed = configSchema.safeParse(value);
|
|
21512
|
+
if (!parsed.success)
|
|
21513
|
+
throw new AppError(
|
|
21514
|
+
"INVALID_CONFIG",
|
|
21515
|
+
parsed.error.issues.map((issue2) => `${issue2.path.join(".") || "\u914D\u7F6E"}: ${issue2.message}`).join("\n")
|
|
21516
|
+
);
|
|
21517
|
+
const config2 = parsed.data;
|
|
21518
|
+
if (new Set(config2.projects.map((p) => p.id)).size !== config2.projects.length)
|
|
21519
|
+
throw new AppError("INVALID_CONFIG", "Project IDs must be unique");
|
|
21520
|
+
if (config2.auth.mode === "local" && !isLoopback(config2.host))
|
|
21521
|
+
throw new AppError("INVALID_CONFIG", "Local mode requires a loopback host");
|
|
21522
|
+
if (config2.developmentOrigins.some((o) => !isLoopback(new URL(o).hostname)))
|
|
21523
|
+
throw new AppError("INVALID_CONFIG", "Development origins must be loopback");
|
|
21524
|
+
if (config2.auth.mode === "cloudflare-access") {
|
|
21525
|
+
const issuer = new URL(config2.auth.issuer);
|
|
21526
|
+
if (issuer.protocol !== "https:" || !issuer.hostname.endsWith(".cloudflareaccess.com") || issuer.pathname !== "/" || issuer.search || issuer.hash || issuer.username || issuer.password)
|
|
21527
|
+
throw new AppError(
|
|
21528
|
+
"INVALID_CONFIG",
|
|
21529
|
+
"Access issuer must be https://<team>.cloudflareaccess.com"
|
|
21530
|
+
);
|
|
21531
|
+
if (config2.publicOrigin.some((value2) => new URL(value2).protocol !== "https:"))
|
|
21532
|
+
throw new AppError("INVALID_CONFIG", "All Access public origins must use HTTPS");
|
|
21533
|
+
config2.auth.issuer = issuer.origin;
|
|
21534
|
+
}
|
|
21535
|
+
return config2;
|
|
21536
|
+
}
|
|
21537
|
+
function parseConfig(value, filename, development = false) {
|
|
21538
|
+
const config2 = parseFileConfig(value);
|
|
21539
|
+
const result = {
|
|
21540
|
+
...config2,
|
|
21541
|
+
developmentOrigins: development ? config2.developmentOrigins : [],
|
|
21542
|
+
dataDir: (0, import_node_path2.resolve)((0, import_node_path2.dirname)(filename), config2.dataDir),
|
|
21543
|
+
demo: false
|
|
21544
|
+
};
|
|
21545
|
+
sources.set(result, { path: (0, import_node_path2.resolve)(filename), development });
|
|
21546
|
+
return result;
|
|
21547
|
+
}
|
|
21548
|
+
|
|
21549
|
+
// src/server/config-store.ts
|
|
21550
|
+
var saveSchema = external_exports.object({ revision: external_exports.string().regex(/^[a-f0-9]{64}$/), config: external_exports.unknown() }).strict();
|
|
21551
|
+
var importSchema = external_exports.object({ config: external_exports.unknown() }).strict();
|
|
21552
|
+
var MAX_CONFIG_BYTES = 256 * 1024;
|
|
21553
|
+
|
|
21554
|
+
// src/updates/files.ts
|
|
21555
|
+
var import_node_crypto2 = require("node:crypto");
|
|
21556
|
+
var import_node_path3 = require("node:path");
|
|
21557
|
+
var import_promises = require("node:fs/promises");
|
|
21558
|
+
async function readJson(filename) {
|
|
21559
|
+
try {
|
|
21560
|
+
return JSON.parse(await (0, import_promises.readFile)(filename, "utf8"));
|
|
21561
|
+
} catch (error62) {
|
|
21562
|
+
if (error62.code === "ENOENT") return void 0;
|
|
21563
|
+
throw error62;
|
|
21564
|
+
}
|
|
21565
|
+
}
|
|
21566
|
+
async function saveJson(filename, value) {
|
|
21567
|
+
await (0, import_promises.mkdir)((0, import_node_path3.dirname)(filename), { recursive: true, mode: 448 });
|
|
21568
|
+
const temporary = `${filename}.${(0, import_node_crypto2.randomUUID)()}.tmp`;
|
|
21569
|
+
try {
|
|
21570
|
+
const file2 = await (0, import_promises.open)(temporary, "wx", 384);
|
|
21571
|
+
try {
|
|
21572
|
+
await file2.writeFile(`${JSON.stringify(value, null, 2)}
|
|
21573
|
+
`);
|
|
21574
|
+
await file2.sync();
|
|
21575
|
+
} finally {
|
|
21576
|
+
await file2.close();
|
|
21577
|
+
}
|
|
21578
|
+
await (0, import_promises.rename)(temporary, filename);
|
|
21579
|
+
await syncDirectory((0, import_node_path3.dirname)(filename));
|
|
21580
|
+
} finally {
|
|
21581
|
+
await (0, import_promises.rm)(temporary, { force: true });
|
|
21582
|
+
}
|
|
21583
|
+
}
|
|
21584
|
+
async function syncDirectory(directory) {
|
|
21585
|
+
if (process.platform === "win32") return;
|
|
21586
|
+
const handle = await (0, import_promises.open)(directory, "r");
|
|
21587
|
+
try {
|
|
21588
|
+
await handle.sync();
|
|
21589
|
+
} finally {
|
|
21590
|
+
await handle.close();
|
|
21591
|
+
}
|
|
21592
|
+
}
|
|
21593
|
+
async function copyDurable(source, target) {
|
|
21594
|
+
await (0, import_promises.cp)(source, target);
|
|
21595
|
+
const file2 = await (0, import_promises.open)(target, "r");
|
|
21596
|
+
try {
|
|
21597
|
+
await file2.sync();
|
|
21598
|
+
} finally {
|
|
21599
|
+
await file2.close();
|
|
21600
|
+
}
|
|
21601
|
+
await syncDirectory((0, import_node_path3.dirname)(target));
|
|
21602
|
+
}
|
|
21603
|
+
|
|
21604
|
+
// src/backups/store.ts
|
|
21605
|
+
var backupDirectory = (home, dataDir) => (0, import_node_path4.join)(home, "backups", (0, import_node_crypto3.createHash)("sha256").update((0, import_node_path4.resolve)(dataDir)).digest("hex").slice(0, 16));
|
|
21606
|
+
async function fingerprint(path) {
|
|
21607
|
+
const info = await (0, import_promises2.lstat)(path);
|
|
21608
|
+
if (!info.isFile() || info.isSymbolicLink())
|
|
21609
|
+
throw new Error("Backup contains a non-regular file");
|
|
21610
|
+
const hash2 = (0, import_node_crypto3.createHash)("sha256");
|
|
21611
|
+
for await (const chunk of (0, import_node_fs2.createReadStream)(path)) hash2.update(chunk);
|
|
21612
|
+
return { size: info.size, sha256: hash2.digest("hex") };
|
|
21613
|
+
}
|
|
21614
|
+
function backupFailure(error62) {
|
|
21615
|
+
if (error62 instanceof SyntaxError || error62 instanceof ZodError)
|
|
21616
|
+
return "\u670D\u52A1\u914D\u7F6E\u65E0\u6548\uFF0C\u5907\u4EFD\u672A\u5B8C\u6210\uFF1B\u8BF7\u68C0\u67E5\u914D\u7F6E\u540E\u91CD\u8BD5\u3002";
|
|
21617
|
+
const code = error62?.code;
|
|
21618
|
+
if (code === "ENOSPC" || code === "SQLITE_FULL") return "\u78C1\u76D8\u7A7A\u95F4\u4E0D\u8DB3\uFF0C\u5907\u4EFD\u672A\u5B8C\u6210\u3002";
|
|
21619
|
+
if (code === "EACCES" || code === "EPERM" || code === "EROFS")
|
|
21620
|
+
return "\u65E0\u6CD5\u5199\u5165\u5907\u4EFD\u76EE\u5F55\uFF0C\u8BF7\u68C0\u67E5\u6587\u4EF6\u6743\u9650\u3002";
|
|
21621
|
+
if (code === "ELOCKED") return "\u914D\u7F6E\u6216\u5907\u4EFD\u76EE\u5F55\u6B63\u5728\u88AB\u5176\u4ED6\u64CD\u4F5C\u4F7F\u7528\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002";
|
|
21622
|
+
return "\u5907\u4EFD\u9A8C\u8BC1\u6216\u6587\u4EF6\u64CD\u4F5C\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u78C1\u76D8\u3001\u6743\u9650\u53CA\u6587\u4EF6\u5B8C\u6574\u6027\u540E\u91CD\u8BD5\u3002";
|
|
21623
|
+
}
|
|
21624
|
+
var BackupStore = class {
|
|
21625
|
+
constructor(options) {
|
|
21626
|
+
this.options = options;
|
|
21627
|
+
}
|
|
21628
|
+
options;
|
|
21629
|
+
path(id) {
|
|
21630
|
+
return (0, import_node_path4.join)(this.options.directory, backupIdSchema.parse(id));
|
|
21631
|
+
}
|
|
21632
|
+
async record(record2) {
|
|
21633
|
+
await saveJson((0, import_node_path4.join)(this.path(record2.id), "record.json"), record2);
|
|
21634
|
+
}
|
|
21635
|
+
async list() {
|
|
21636
|
+
let names;
|
|
21637
|
+
try {
|
|
21638
|
+
names = await (0, import_promises2.readdir)(this.options.directory);
|
|
21639
|
+
} catch (error62) {
|
|
21640
|
+
if (error62.code === "ENOENT") return [];
|
|
21641
|
+
throw error62;
|
|
21642
|
+
}
|
|
21643
|
+
const records = [];
|
|
21644
|
+
for (const id of names.filter((name) => backupIdSchema.safeParse(name).success)) {
|
|
21645
|
+
try {
|
|
21646
|
+
const value = await readJson((0, import_node_path4.join)(this.path(id), "record.json"));
|
|
21647
|
+
if (value === void 0) continue;
|
|
21648
|
+
const record2 = backupRecordSchema.parse(value);
|
|
21649
|
+
if (record2.id !== id) throw new Error("Backup record identity mismatch");
|
|
21650
|
+
const parsed = backupManifestSchema.safeParse(
|
|
21651
|
+
await readJson((0, import_node_path4.join)(this.path(id), "snapshot.json"))
|
|
21652
|
+
);
|
|
21653
|
+
if (parsed.success && parsed.data.id === id)
|
|
21654
|
+
records.push({
|
|
21655
|
+
...record2,
|
|
21656
|
+
path: this.path(id),
|
|
21657
|
+
phase: ["waiting", "copying", "verifying"].includes(record2.phase) ? "succeeded" : record2.phase,
|
|
21658
|
+
manifest: parsed.data
|
|
21659
|
+
});
|
|
21660
|
+
else
|
|
21661
|
+
records.push({
|
|
21662
|
+
...record2,
|
|
21663
|
+
path: this.path(id),
|
|
21664
|
+
phase: record2.phase === "succeeded" ? "corrupt" : record2.phase,
|
|
21665
|
+
manifest: void 0
|
|
21666
|
+
});
|
|
21667
|
+
} catch {
|
|
21668
|
+
records.push({
|
|
21669
|
+
id,
|
|
21670
|
+
path: this.path(id),
|
|
21671
|
+
phase: "corrupt",
|
|
21672
|
+
trigger: "manual",
|
|
21673
|
+
createdAt: 0,
|
|
21674
|
+
updatedAt: 0,
|
|
21675
|
+
message: "\u5907\u4EFD\u8BB0\u5F55\u635F\u574F\uFF0C\u4E0D\u80FD\u6062\u590D\u3002"
|
|
21676
|
+
});
|
|
21677
|
+
}
|
|
21678
|
+
}
|
|
21679
|
+
return records.sort((a, b) => b.createdAt - a.createdAt);
|
|
21680
|
+
}
|
|
21681
|
+
async create(input2) {
|
|
21682
|
+
const { Sqlite, migrations, config: config2, dataDir, appVersion, commit } = this.options;
|
|
21683
|
+
const id = backupIdSchema.parse(input2.id ?? (0, import_node_crypto3.randomUUID)());
|
|
21684
|
+
const directory = this.path(id);
|
|
21685
|
+
await (0, import_promises2.mkdir)(this.options.directory, { recursive: true, mode: 448 });
|
|
21686
|
+
if (!(await (0, import_promises2.lstat)(this.options.directory)).isDirectory() || (await (0, import_promises2.lstat)(this.options.directory)).isSymbolicLink())
|
|
21687
|
+
throw new Error("Invalid backup directory");
|
|
21688
|
+
await (0, import_promises2.chmod)(this.options.directory, 448);
|
|
21689
|
+
if (input2.reserved) {
|
|
21690
|
+
const reserved = await readJson((0, import_node_path4.join)(directory, "record.json"));
|
|
21691
|
+
if (reserved?.id !== id || reserved.phase !== "waiting" || await readJson((0, import_node_path4.join)(directory, "snapshot.json")))
|
|
21692
|
+
throw new Error("Invalid backup reservation");
|
|
21693
|
+
} else await (0, import_promises2.mkdir)(directory, { mode: 448 });
|
|
21694
|
+
const record2 = {
|
|
21695
|
+
id,
|
|
21696
|
+
phase: "copying",
|
|
21697
|
+
trigger: input2.trigger,
|
|
21698
|
+
createdAt: Date.now(),
|
|
21699
|
+
updatedAt: Date.now(),
|
|
21700
|
+
path: directory,
|
|
21701
|
+
message: "\u6B63\u5728\u751F\u6210\u6570\u636E\u5E93\u4E0E\u914D\u7F6E\u5FEB\u7167"
|
|
21702
|
+
};
|
|
21703
|
+
let release;
|
|
21704
|
+
let sqlite;
|
|
21705
|
+
try {
|
|
21706
|
+
await this.record(record2);
|
|
21707
|
+
input2.progress?.({ ...record2 });
|
|
21708
|
+
input2.signal?.throwIfAborted();
|
|
21709
|
+
release = await import_proper_lockfile2.default.lock(config2, { realpath: false, retries: 0 });
|
|
21710
|
+
const configStat = await (0, import_promises2.lstat)(config2);
|
|
21711
|
+
if (!configStat.isFile() || configStat.size > MAX_CONFIG_BYTES)
|
|
21712
|
+
throw new Error("Invalid config file");
|
|
21713
|
+
const contents = await (0, import_promises2.readFile)(config2, "utf8");
|
|
21714
|
+
if (parseConfig(JSON.parse(contents), config2).dataDir !== (0, import_node_path4.resolve)(dataDir))
|
|
21715
|
+
throw new Error("Saved configuration no longer identifies the running data directory");
|
|
21716
|
+
const configFile = await (0, import_promises2.open)((0, import_node_path4.join)(directory, "config.json"), "wx", 384);
|
|
21717
|
+
try {
|
|
21718
|
+
await configFile.writeFile(contents);
|
|
21719
|
+
await configFile.sync();
|
|
21720
|
+
} finally {
|
|
21721
|
+
await configFile.close();
|
|
21722
|
+
}
|
|
21723
|
+
sqlite = new Sqlite((0, import_node_path4.join)(dataDir, "app.sqlite"), { readonly: true, fileMustExist: true });
|
|
21724
|
+
const history = inspectDatabase(sqlite, migrations);
|
|
21725
|
+
requireRestorable(history.schemaVersion, this.options.contract);
|
|
21726
|
+
await sqlite.backup((0, import_node_path4.join)(directory, "app.sqlite"), {
|
|
21727
|
+
progress: ({ totalPages, remainingPages }) => {
|
|
21728
|
+
input2.signal?.throwIfAborted();
|
|
21729
|
+
input2.progress?.({
|
|
21730
|
+
...record2,
|
|
21731
|
+
progress: Math.round((totalPages - remainingPages) / totalPages * 100)
|
|
21732
|
+
});
|
|
21733
|
+
return 100;
|
|
21734
|
+
}
|
|
21735
|
+
});
|
|
21736
|
+
sqlite.close();
|
|
21737
|
+
sqlite = void 0;
|
|
21738
|
+
await (0, import_promises2.chmod)((0, import_node_path4.join)(directory, "app.sqlite"), 384);
|
|
21739
|
+
if (await (0, import_promises2.readFile)(config2, "utf8") !== contents)
|
|
21740
|
+
throw new Error("Configuration changed externally during backup");
|
|
21741
|
+
input2.signal?.throwIfAborted();
|
|
21742
|
+
record2.phase = "verifying";
|
|
21743
|
+
record2.message = "\u6B63\u5728\u9A8C\u8BC1\u5907\u4EFD\u5B8C\u6574\u6027";
|
|
21744
|
+
record2.updatedAt = Date.now();
|
|
21745
|
+
await this.record(record2);
|
|
21746
|
+
input2.progress?.({ ...record2 });
|
|
21747
|
+
const files = await Promise.all(
|
|
21748
|
+
["app.sqlite", "config.json"].map(async (name) => ({
|
|
21749
|
+
name,
|
|
21750
|
+
...await fingerprint((0, import_node_path4.join)(directory, name))
|
|
21751
|
+
}))
|
|
21752
|
+
);
|
|
21753
|
+
const manifest = backupManifestSchema.parse({
|
|
21754
|
+
formatVersion: 1,
|
|
21755
|
+
complete: true,
|
|
21756
|
+
id,
|
|
21757
|
+
createdAt: record2.createdAt,
|
|
21758
|
+
appVersion,
|
|
21759
|
+
commit,
|
|
21760
|
+
trigger: input2.trigger,
|
|
21761
|
+
configPath: config2,
|
|
21762
|
+
dataDir,
|
|
21763
|
+
schemaVersion: history.schemaVersion,
|
|
21764
|
+
migrationHashes: history.migrationHashes,
|
|
21765
|
+
files,
|
|
21766
|
+
protectedBy: input2.protectedBy
|
|
21767
|
+
});
|
|
21768
|
+
this.checkDatabase(directory, manifest);
|
|
21769
|
+
const file2 = await (0, import_promises2.open)((0, import_node_path4.join)(directory, "app.sqlite"), "r");
|
|
21770
|
+
try {
|
|
21771
|
+
await file2.sync();
|
|
21772
|
+
} finally {
|
|
21773
|
+
await file2.close();
|
|
21774
|
+
}
|
|
21775
|
+
input2.signal?.throwIfAborted();
|
|
21776
|
+
await saveJson((0, import_node_path4.join)(directory, "snapshot.json"), manifest);
|
|
21777
|
+
record2.phase = "succeeded";
|
|
21778
|
+
record2.message = "\u5907\u4EFD\u6210\u529F\uFF0C\u5B8C\u6574\u6027\u9A8C\u8BC1\u901A\u8FC7";
|
|
21779
|
+
record2.updatedAt = Date.now();
|
|
21780
|
+
record2.manifest = manifest;
|
|
21781
|
+
await this.record(record2).catch(() => {
|
|
21782
|
+
});
|
|
21783
|
+
input2.progress?.({ ...record2 });
|
|
21784
|
+
return manifest;
|
|
21785
|
+
} catch (error62) {
|
|
21786
|
+
record2.phase = input2.signal?.aborted ? "cancelled" : "failed";
|
|
21787
|
+
record2.message = input2.signal?.aborted ? "\u5907\u4EFD\u5DF2\u53D6\u6D88\uFF0C\u672A\u751F\u6210\u53EF\u6062\u590D\u5FEB\u7167\u3002" : backupFailure(error62);
|
|
21788
|
+
record2.updatedAt = Date.now();
|
|
21789
|
+
await this.record(record2).catch(() => {
|
|
21790
|
+
});
|
|
21791
|
+
input2.progress?.({ ...record2 });
|
|
21792
|
+
throw new AppError("BACKUP_FAILED", record2.message, 500);
|
|
21793
|
+
} finally {
|
|
21794
|
+
sqlite?.close();
|
|
21795
|
+
await release?.();
|
|
21796
|
+
}
|
|
21797
|
+
}
|
|
21798
|
+
checkDatabase(directory, manifest) {
|
|
21799
|
+
const sqlite = new this.options.Sqlite((0, import_node_path4.join)(directory, "app.sqlite"), {
|
|
21800
|
+
readonly: true,
|
|
21801
|
+
fileMustExist: true
|
|
21802
|
+
});
|
|
21803
|
+
try {
|
|
21804
|
+
if (sqlite.pragma("integrity_check", { simple: true }) !== "ok" || sqlite.pragma("foreign_key_check").length)
|
|
21805
|
+
throw new Error("Invalid backup database");
|
|
21806
|
+
const history = inspectDatabase(sqlite, this.options.migrations);
|
|
21807
|
+
requireRestorable(history.schemaVersion, this.options.contract);
|
|
21808
|
+
if (history.schemaVersion !== manifest.schemaVersion || JSON.stringify(history.migrationHashes) !== JSON.stringify(manifest.migrationHashes))
|
|
21809
|
+
throw new Error("Backup database differs from manifest");
|
|
21810
|
+
} finally {
|
|
21811
|
+
sqlite.close();
|
|
21812
|
+
}
|
|
21813
|
+
}
|
|
21814
|
+
async verify(id) {
|
|
21815
|
+
const directory = this.path(id);
|
|
21816
|
+
if (!(await (0, import_promises2.lstat)(directory)).isDirectory() || (await (0, import_promises2.lstat)(directory)).isSymbolicLink())
|
|
21817
|
+
throw new Error("Invalid backup directory");
|
|
21818
|
+
const manifest = backupManifestSchema.parse(await readJson((0, import_node_path4.join)(directory, "snapshot.json")));
|
|
21819
|
+
if (manifest.id !== id) throw new Error("Backup identity mismatch");
|
|
21820
|
+
for (const file2 of manifest.files) {
|
|
21821
|
+
const actual = await fingerprint((0, import_node_path4.join)(directory, file2.name));
|
|
21822
|
+
if (actual.size !== file2.size || actual.sha256 !== file2.sha256)
|
|
21823
|
+
throw new Error("Backup checksum mismatch");
|
|
21824
|
+
}
|
|
21825
|
+
parseFileConfig(JSON.parse(await (0, import_promises2.readFile)((0, import_node_path4.join)(directory, "config.json"), "utf8")));
|
|
21826
|
+
this.checkDatabase(directory, manifest);
|
|
21827
|
+
return manifest;
|
|
21828
|
+
}
|
|
21829
|
+
/** Caller must own the instance lock, and must not have resumed business writes. */
|
|
21830
|
+
async restoreFiles(id) {
|
|
21831
|
+
await this.verify(id);
|
|
21832
|
+
for (const name of ["app.sqlite-wal", "app.sqlite-shm"])
|
|
21833
|
+
await (0, import_promises2.rm)((0, import_node_path4.join)(this.options.dataDir, name), { force: true });
|
|
21834
|
+
await copyDurable((0, import_node_path4.join)(this.path(id), "app.sqlite"), (0, import_node_path4.join)(this.options.dataDir, "app.sqlite"));
|
|
21835
|
+
await (0, import_promises2.chmod)((0, import_node_path4.join)(this.options.dataDir, "app.sqlite"), 384);
|
|
21836
|
+
await copyDurable((0, import_node_path4.join)(this.path(id), "config.json"), this.options.config);
|
|
21837
|
+
await (0, import_promises2.chmod)(this.options.config, 384);
|
|
21838
|
+
}
|
|
21839
|
+
};
|
|
21840
|
+
async function verifyLegacySnapshot(directory, Sqlite, migrationsFolder) {
|
|
21841
|
+
external_exports.object({ complete: external_exports.literal(true) }).strict().parse(await readJson((0, import_node_path4.join)(directory, "snapshot.json")));
|
|
21842
|
+
parseFileConfig(JSON.parse(await (0, import_promises2.readFile)((0, import_node_path4.join)(directory, "config.json"), "utf8")));
|
|
21843
|
+
const db = new Sqlite((0, import_node_path4.join)(directory, "app.sqlite"), { readonly: true, fileMustExist: true });
|
|
21844
|
+
try {
|
|
21845
|
+
if (db.pragma("integrity_check", { simple: true }) !== "ok" || db.pragma("foreign_key_check").length)
|
|
21846
|
+
throw new Error("\u65E7\u5907\u4EFD\u6570\u636E\u5E93\u635F\u574F");
|
|
21847
|
+
inspectDatabase(db, readMigrations(migrationsFolder));
|
|
21848
|
+
} finally {
|
|
21849
|
+
db.close();
|
|
21850
|
+
}
|
|
21851
|
+
}
|
|
21852
|
+
|
|
21853
|
+
// src/backups/lock.ts
|
|
21854
|
+
var import_promises3 = require("node:fs/promises");
|
|
21855
|
+
var import_node_path5 = require("node:path");
|
|
21856
|
+
var import_proper_lockfile3 = __toESM(require_proper_lockfile(), 1);
|
|
21857
|
+
async function acquireMaintenanceLock(dataDir) {
|
|
21858
|
+
try {
|
|
21859
|
+
const directory = (0, import_node_path5.join)(dataDir, ".covro-maintenance");
|
|
21860
|
+
await (0, import_promises3.mkdir)(directory, { recursive: true, mode: 448 });
|
|
21861
|
+
return await import_proper_lockfile3.default.lock(directory, {
|
|
21862
|
+
realpath: true,
|
|
21863
|
+
stale: 1e4,
|
|
21864
|
+
update: 2e3,
|
|
21865
|
+
retries: 0
|
|
21866
|
+
});
|
|
21867
|
+
} catch {
|
|
21868
|
+
throw new AppError("MAINTENANCE_BUSY", "\u5DF2\u6709\u5907\u4EFD\u3001\u5347\u7EA7\u6216\u6062\u590D\u6B63\u5728\u5904\u7406\uFF0C\u8BF7\u5B8C\u6210\u540E\u91CD\u8BD5\u3002", 409);
|
|
21869
|
+
}
|
|
21870
|
+
}
|
|
21871
|
+
|
|
21872
|
+
// src/server/instance-lock.ts
|
|
21873
|
+
var import_promises4 = require("node:fs/promises");
|
|
21874
|
+
var import_proper_lockfile4 = __toESM(require_proper_lockfile(), 1);
|
|
21875
|
+
async function acquireInstanceLock(dataDir) {
|
|
21876
|
+
await (0, import_promises4.mkdir)(dataDir, { recursive: true, mode: 448 });
|
|
21877
|
+
await (0, import_promises4.chmod)(dataDir, 448);
|
|
21878
|
+
try {
|
|
21879
|
+
return await import_proper_lockfile4.default.lock(dataDir, {
|
|
21880
|
+
realpath: true,
|
|
21881
|
+
stale: 1e4,
|
|
21882
|
+
update: 2e3,
|
|
21883
|
+
retries: 0
|
|
21884
|
+
});
|
|
21885
|
+
} catch {
|
|
21886
|
+
throw new AppError(
|
|
21887
|
+
"INSTANCE_LOCKED",
|
|
21888
|
+
"Another gateway or migration owns this dataDir; retry after a stale lock expires",
|
|
21889
|
+
409
|
|
21890
|
+
);
|
|
21891
|
+
}
|
|
21892
|
+
}
|
|
21893
|
+
|
|
21894
|
+
// src/shared/database.ts
|
|
21895
|
+
var databaseCompatibilitySchema = external_exports.object({
|
|
21896
|
+
schemaVersion: external_exports.number().int().positive(),
|
|
21897
|
+
minRestorableSchemaVersion: external_exports.number().int().positive(),
|
|
21898
|
+
backupFormatVersion: external_exports.literal(1)
|
|
21899
|
+
}).strict().refine((value) => value.minRestorableSchemaVersion <= value.schemaVersion);
|
|
21900
|
+
|
|
21901
|
+
// src/shared/package.ts
|
|
21902
|
+
var npmPackageName = "@covro/covro";
|
|
21903
|
+
|
|
21333
21904
|
// src/shared/versions.ts
|
|
21334
21905
|
var versionPattern = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
|
|
21335
21906
|
function validVersion(version3) {
|
|
@@ -21393,19 +21964,18 @@ function requireCodexCompatibility(metadata, running, confirmed = false) {
|
|
|
21393
21964
|
var import_node_child_process4 = require("node:child_process");
|
|
21394
21965
|
var import_node_util4 = require("node:util");
|
|
21395
21966
|
var import_node_module = require("node:module");
|
|
21396
|
-
var
|
|
21397
|
-
var
|
|
21398
|
-
var
|
|
21399
|
-
var
|
|
21400
|
-
var
|
|
21401
|
-
var import_proper_lockfile3 = __toESM(require_proper_lockfile(), 1);
|
|
21967
|
+
var import_promises12 = require("node:fs/promises");
|
|
21968
|
+
var import_node_fs4 = require("node:fs");
|
|
21969
|
+
var import_node_path11 = require("node:path");
|
|
21970
|
+
var import_promises13 = require("node:timers/promises");
|
|
21971
|
+
var import_proper_lockfile7 = __toESM(require_proper_lockfile(), 1);
|
|
21402
21972
|
|
|
21403
21973
|
// src/cli/control.ts
|
|
21404
21974
|
var import_node_http = require("node:http");
|
|
21405
|
-
var
|
|
21406
|
-
var
|
|
21975
|
+
var import_proper_lockfile5 = __toESM(require_proper_lockfile(), 1);
|
|
21976
|
+
var import_promises5 = require("node:timers/promises");
|
|
21407
21977
|
function control(location, action, input2 = {}) {
|
|
21408
|
-
return new Promise((
|
|
21978
|
+
return new Promise((resolve3, reject) => {
|
|
21409
21979
|
const requestBody = JSON.stringify(input2);
|
|
21410
21980
|
const outgoing = (0, import_node_http.request)(
|
|
21411
21981
|
{
|
|
@@ -21429,7 +21999,7 @@ function control(location, action, input2 = {}) {
|
|
|
21429
21999
|
const result = JSON.parse(body);
|
|
21430
22000
|
if (incoming.statusCode !== 200)
|
|
21431
22001
|
reject(new Error(result.error ?? "Control request failed"));
|
|
21432
|
-
else
|
|
22002
|
+
else resolve3(result);
|
|
21433
22003
|
} catch (error62) {
|
|
21434
22004
|
reject(error62);
|
|
21435
22005
|
}
|
|
@@ -21452,43 +22022,43 @@ async function stopAndWait(location) {
|
|
|
21452
22022
|
}
|
|
21453
22023
|
for (let attempt = 0; attempt < 120; attempt++) {
|
|
21454
22024
|
try {
|
|
21455
|
-
if (!await
|
|
22025
|
+
if (!await import_proper_lockfile5.default.check(location.state, { stale: 1e4 })) return;
|
|
21456
22026
|
} catch (error62) {
|
|
21457
22027
|
if (error62.code === "ENOENT") return;
|
|
21458
22028
|
throw error62;
|
|
21459
22029
|
}
|
|
21460
|
-
await (0,
|
|
22030
|
+
await (0, import_promises5.setTimeout)(100);
|
|
21461
22031
|
}
|
|
21462
22032
|
throw new Error("Covro \u5C1A\u672A\u5B8C\u6210\u5173\u95ED\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");
|
|
21463
22033
|
}
|
|
21464
22034
|
|
|
21465
22035
|
// src/cli/background.ts
|
|
21466
22036
|
var import_node_child_process2 = require("node:child_process");
|
|
21467
|
-
var
|
|
21468
|
-
var
|
|
22037
|
+
var import_promises8 = require("node:fs/promises");
|
|
22038
|
+
var import_node_path8 = require("node:path");
|
|
21469
22039
|
var import_node_util2 = require("node:util");
|
|
21470
|
-
var
|
|
21471
|
-
var
|
|
22040
|
+
var import_promises9 = require("node:timers/promises");
|
|
22041
|
+
var import_proper_lockfile6 = __toESM(require_proper_lockfile(), 1);
|
|
21472
22042
|
|
|
21473
22043
|
// src/cli/launchd.ts
|
|
21474
22044
|
var import_node_child_process = require("node:child_process");
|
|
21475
22045
|
var import_node_util = require("node:util");
|
|
21476
|
-
var
|
|
22046
|
+
var import_node_crypto5 = require("node:crypto");
|
|
21477
22047
|
var import_node_os = require("node:os");
|
|
21478
|
-
var
|
|
21479
|
-
var
|
|
22048
|
+
var import_node_path7 = require("node:path");
|
|
22049
|
+
var import_promises7 = require("node:fs/promises");
|
|
21480
22050
|
|
|
21481
22051
|
// src/cli/launch-environment.ts
|
|
21482
22052
|
var import_node_net = require("node:net");
|
|
21483
|
-
var
|
|
21484
|
-
var
|
|
21485
|
-
var
|
|
22053
|
+
var import_promises6 = require("node:fs/promises");
|
|
22054
|
+
var import_node_crypto4 = require("node:crypto");
|
|
22055
|
+
var import_node_path6 = require("node:path");
|
|
21486
22056
|
async function environmentBridge(home) {
|
|
21487
|
-
const path = (0,
|
|
22057
|
+
const path = (0, import_node_path6.join)(home, `e-${(0, import_node_crypto4.randomBytes)(6).toString("hex")}.sock`);
|
|
21488
22058
|
const clients = /* @__PURE__ */ new Set();
|
|
21489
22059
|
let accept;
|
|
21490
|
-
const consumed = new Promise((
|
|
21491
|
-
accept =
|
|
22060
|
+
const consumed = new Promise((resolve3) => {
|
|
22061
|
+
accept = resolve3;
|
|
21492
22062
|
});
|
|
21493
22063
|
const payload = JSON.stringify({ env: { ...process.env, COVRO_HOME: home }, cwd: process.cwd() });
|
|
21494
22064
|
const server = (0, import_node_net.createServer)((socket) => {
|
|
@@ -21500,11 +22070,11 @@ async function environmentBridge(home) {
|
|
|
21500
22070
|
socket.end(payload, () => accept?.());
|
|
21501
22071
|
});
|
|
21502
22072
|
try {
|
|
21503
|
-
await new Promise((
|
|
22073
|
+
await new Promise((resolve3, reject) => {
|
|
21504
22074
|
server.once("error", reject);
|
|
21505
|
-
server.listen(path,
|
|
22075
|
+
server.listen(path, resolve3);
|
|
21506
22076
|
});
|
|
21507
|
-
await (0,
|
|
22077
|
+
await (0, import_promises6.chmod)(path, 384);
|
|
21508
22078
|
return {
|
|
21509
22079
|
path,
|
|
21510
22080
|
async wait() {
|
|
@@ -21526,14 +22096,14 @@ async function environmentBridge(home) {
|
|
|
21526
22096
|
async close() {
|
|
21527
22097
|
for (const socket of clients) socket.destroy();
|
|
21528
22098
|
await new Promise(
|
|
21529
|
-
(
|
|
22099
|
+
(resolve3, reject) => server.close((error62) => error62 ? reject(error62) : resolve3())
|
|
21530
22100
|
);
|
|
21531
|
-
await (0,
|
|
22101
|
+
await (0, import_promises6.rm)(path, { force: true });
|
|
21532
22102
|
}
|
|
21533
22103
|
};
|
|
21534
22104
|
} catch (error62) {
|
|
21535
22105
|
server.close();
|
|
21536
|
-
await (0,
|
|
22106
|
+
await (0, import_promises6.rm)(path, { force: true });
|
|
21537
22107
|
throw error62;
|
|
21538
22108
|
}
|
|
21539
22109
|
}
|
|
@@ -21560,56 +22130,6 @@ try {
|
|
|
21560
22130
|
}
|
|
21561
22131
|
`;
|
|
21562
22132
|
|
|
21563
|
-
// src/updates/files.ts
|
|
21564
|
-
var import_node_crypto2 = require("node:crypto");
|
|
21565
|
-
var import_node_path2 = require("node:path");
|
|
21566
|
-
var import_promises3 = require("node:fs/promises");
|
|
21567
|
-
async function readJson(filename) {
|
|
21568
|
-
try {
|
|
21569
|
-
return JSON.parse(await (0, import_promises3.readFile)(filename, "utf8"));
|
|
21570
|
-
} catch (error62) {
|
|
21571
|
-
if (error62.code === "ENOENT") return void 0;
|
|
21572
|
-
throw error62;
|
|
21573
|
-
}
|
|
21574
|
-
}
|
|
21575
|
-
async function saveJson(filename, value) {
|
|
21576
|
-
await (0, import_promises3.mkdir)((0, import_node_path2.dirname)(filename), { recursive: true, mode: 448 });
|
|
21577
|
-
const temporary = `${filename}.${(0, import_node_crypto2.randomUUID)()}.tmp`;
|
|
21578
|
-
try {
|
|
21579
|
-
const file2 = await (0, import_promises3.open)(temporary, "wx", 384);
|
|
21580
|
-
try {
|
|
21581
|
-
await file2.writeFile(`${JSON.stringify(value, null, 2)}
|
|
21582
|
-
`);
|
|
21583
|
-
await file2.sync();
|
|
21584
|
-
} finally {
|
|
21585
|
-
await file2.close();
|
|
21586
|
-
}
|
|
21587
|
-
await (0, import_promises3.rename)(temporary, filename);
|
|
21588
|
-
await syncDirectory((0, import_node_path2.dirname)(filename));
|
|
21589
|
-
} finally {
|
|
21590
|
-
await (0, import_promises3.rm)(temporary, { force: true });
|
|
21591
|
-
}
|
|
21592
|
-
}
|
|
21593
|
-
async function syncDirectory(directory) {
|
|
21594
|
-
if (process.platform === "win32") return;
|
|
21595
|
-
const handle = await (0, import_promises3.open)(directory, "r");
|
|
21596
|
-
try {
|
|
21597
|
-
await handle.sync();
|
|
21598
|
-
} finally {
|
|
21599
|
-
await handle.close();
|
|
21600
|
-
}
|
|
21601
|
-
}
|
|
21602
|
-
async function copyDurable(source, target) {
|
|
21603
|
-
await (0, import_promises3.cp)(source, target);
|
|
21604
|
-
const file2 = await (0, import_promises3.open)(target, "r");
|
|
21605
|
-
try {
|
|
21606
|
-
await file2.sync();
|
|
21607
|
-
} finally {
|
|
21608
|
-
await file2.close();
|
|
21609
|
-
}
|
|
21610
|
-
await syncDirectory((0, import_node_path2.dirname)(target));
|
|
21611
|
-
}
|
|
21612
|
-
|
|
21613
22133
|
// src/cli/launchd.ts
|
|
21614
22134
|
var exec = (0, import_node_util.promisify)(import_node_child_process.execFile);
|
|
21615
22135
|
var launchctl = (args) => exec("/bin/launchctl", args, { timeout: 5e3, maxBuffer: 2 * 1024 * 1024 });
|
|
@@ -21622,14 +22142,14 @@ function failureDetail(error62) {
|
|
|
21622
22142
|
1024
|
|
21623
22143
|
);
|
|
21624
22144
|
}
|
|
21625
|
-
function launchdPaths(location, label = `dev.covro.${location.key}.${(0,
|
|
22145
|
+
function launchdPaths(location, label = `dev.covro.${location.key}.${(0, import_node_crypto5.createHash)("sha256").update(location.home).digest("hex").slice(0, 12)}`) {
|
|
21626
22146
|
const domain2 = `gui/${process.getuid()}`;
|
|
21627
22147
|
return {
|
|
21628
22148
|
label,
|
|
21629
22149
|
domain: domain2,
|
|
21630
22150
|
target: `${domain2}/${label}`,
|
|
21631
|
-
temporary: (0,
|
|
21632
|
-
login: (0,
|
|
22151
|
+
temporary: (0, import_node_path7.join)(location.state, "launchd.plist"),
|
|
22152
|
+
login: (0, import_node_path7.join)((0, import_node_os.homedir)(), "Library/LaunchAgents", `${label}.plist`)
|
|
21633
22153
|
};
|
|
21634
22154
|
}
|
|
21635
22155
|
async function loaded(target) {
|
|
@@ -21650,7 +22170,7 @@ async function guiSessionAvailable(location) {
|
|
|
21650
22170
|
}
|
|
21651
22171
|
async function loginRegistration(location) {
|
|
21652
22172
|
const installed = await readJson(
|
|
21653
|
-
(0,
|
|
22173
|
+
(0, import_node_path7.join)(location.state, "service.json")
|
|
21654
22174
|
);
|
|
21655
22175
|
if (installed?.platform !== "darwin") return void 0;
|
|
21656
22176
|
if (installed.label !== launchdPaths(location).label && installed.label !== `dev.covro.${location.key}`)
|
|
@@ -21694,7 +22214,7 @@ async function unloadLaunchd(location) {
|
|
|
21694
22214
|
}
|
|
21695
22215
|
}
|
|
21696
22216
|
}
|
|
21697
|
-
await (0,
|
|
22217
|
+
await (0, import_promises7.rm)(temporary, { force: true });
|
|
21698
22218
|
}
|
|
21699
22219
|
async function startLaunchd(location, entry) {
|
|
21700
22220
|
const installed = await loginRegistration(location);
|
|
@@ -21711,9 +22231,9 @@ async function startLaunchd(location, entry) {
|
|
|
21711
22231
|
}
|
|
21712
22232
|
const bridge = await environmentBridge(location.home);
|
|
21713
22233
|
try {
|
|
21714
|
-
const runner = (0,
|
|
21715
|
-
await (0,
|
|
21716
|
-
await (0,
|
|
22234
|
+
const runner = (0, import_node_path7.join)(location.state, "launch-runner.mjs");
|
|
22235
|
+
await (0, import_promises7.writeFile)(runner, launchRunner, { mode: 384 });
|
|
22236
|
+
await (0, import_promises7.writeFile)(
|
|
21717
22237
|
temporary,
|
|
21718
22238
|
launchdPlist(
|
|
21719
22239
|
location,
|
|
@@ -21745,9 +22265,9 @@ async function startLaunchd(location, entry) {
|
|
|
21745
22265
|
// src/cli/background.ts
|
|
21746
22266
|
var exec2 = (0, import_node_util2.promisify)(import_node_child_process2.execFile);
|
|
21747
22267
|
async function lifecycle(location, action) {
|
|
21748
|
-
await (0,
|
|
21749
|
-
const release = await
|
|
21750
|
-
lockfilePath: (0,
|
|
22268
|
+
await (0, import_promises8.mkdir)(location.state, { recursive: true, mode: 448 });
|
|
22269
|
+
const release = await import_proper_lockfile6.default.lock(location.state, {
|
|
22270
|
+
lockfilePath: (0, import_node_path8.join)(location.state, "lifecycle.lock"),
|
|
21751
22271
|
stale: 1e4,
|
|
21752
22272
|
update: 2e3,
|
|
21753
22273
|
retries: { retries: 280, minTimeout: 250, maxTimeout: 250 }
|
|
@@ -21766,7 +22286,7 @@ async function start(location, entry) {
|
|
|
21766
22286
|
}
|
|
21767
22287
|
let child;
|
|
21768
22288
|
const installed = await readJson(
|
|
21769
|
-
(0,
|
|
22289
|
+
(0, import_node_path8.join)(location.state, "service.json")
|
|
21770
22290
|
);
|
|
21771
22291
|
if (process.platform === "darwin" && await startLaunchd(location, entry)) {
|
|
21772
22292
|
} else if (installed?.platform === "linux") {
|
|
@@ -21776,7 +22296,7 @@ async function start(location, entry) {
|
|
|
21776
22296
|
console.warn(
|
|
21777
22297
|
"\u5F53\u524D\u6CA1\u6709 macOS \u684C\u9762\u767B\u5F55\u4F1A\u8BDD\uFF0C\u4F7F\u7528 headless \u540E\u53F0\u542F\u52A8\uFF1B\u7CFB\u7EDF\u94A5\u5319\u4E32\u51ED\u8BC1\u53EF\u80FD\u4E0D\u53EF\u7528\u3002"
|
|
21778
22298
|
);
|
|
21779
|
-
const log = await (0,
|
|
22299
|
+
const log = await (0, import_promises8.open)(location.log, "a", 384);
|
|
21780
22300
|
try {
|
|
21781
22301
|
child = (0, import_node_child_process2.spawn)(process.execPath, [entry, "run", "--config", location.config], {
|
|
21782
22302
|
detached: true,
|
|
@@ -21784,8 +22304,8 @@ async function start(location, entry) {
|
|
|
21784
22304
|
windowsHide: true,
|
|
21785
22305
|
env: { ...process.env, COVRO_HOME: location.home }
|
|
21786
22306
|
});
|
|
21787
|
-
await new Promise((
|
|
21788
|
-
child.once("spawn",
|
|
22307
|
+
await new Promise((resolve3, reject) => {
|
|
22308
|
+
child.once("spawn", resolve3);
|
|
21789
22309
|
child.once("error", reject);
|
|
21790
22310
|
});
|
|
21791
22311
|
child.unref();
|
|
@@ -21800,7 +22320,7 @@ async function start(location, entry) {
|
|
|
21800
22320
|
if (!isNotRunning(error62)) throw error62;
|
|
21801
22321
|
}
|
|
21802
22322
|
if (child && child.exitCode !== null) throw new Error(`Covro \u542F\u52A8\u5931\u8D25\uFF0C\u8BF7\u67E5\u770B ${location.log}`);
|
|
21803
|
-
await (0,
|
|
22323
|
+
await (0, import_promises9.setTimeout)(250);
|
|
21804
22324
|
}
|
|
21805
22325
|
throw new Error(`Covro \u5C1A\u672A\u786E\u8BA4\u542F\u52A8\uFF0C\u8BF7\u8FD0\u884C covro status \u5E76\u67E5\u770B ${location.log}`);
|
|
21806
22326
|
}
|
|
@@ -21809,7 +22329,7 @@ async function stop(location) {
|
|
|
21809
22329
|
if (process.platform === "darwin") await unloadLaunchd(location);
|
|
21810
22330
|
else {
|
|
21811
22331
|
const installed = await readJson(
|
|
21812
|
-
(0,
|
|
22332
|
+
(0, import_node_path8.join)(location.state, "service.json")
|
|
21813
22333
|
);
|
|
21814
22334
|
if (installed?.platform === "linux")
|
|
21815
22335
|
await exec2("systemctl", ["--user", "stop", `${installed.label}.service`]);
|
|
@@ -21819,15 +22339,8 @@ var startBackground = (location, entry) => lifecycle(location, () => start(locat
|
|
|
21819
22339
|
var stopBackground = (location) => lifecycle(location, () => stop(location));
|
|
21820
22340
|
|
|
21821
22341
|
// src/updates/transaction.ts
|
|
21822
|
-
var
|
|
21823
|
-
var
|
|
21824
|
-
var exists = async (path) => (0, import_promises7.stat)(path).then(
|
|
21825
|
-
() => true,
|
|
21826
|
-
(error62) => {
|
|
21827
|
-
if (error62.code === "ENOENT") return false;
|
|
21828
|
-
throw error62;
|
|
21829
|
-
}
|
|
21830
|
-
);
|
|
22342
|
+
var import_promises10 = require("node:fs/promises");
|
|
22343
|
+
var import_node_path9 = require("node:path");
|
|
21831
22344
|
async function activateUpdate(paths, effects) {
|
|
21832
22345
|
let stopped = false;
|
|
21833
22346
|
let moved = false;
|
|
@@ -21839,17 +22352,11 @@ async function activateUpdate(paths, effects) {
|
|
|
21839
22352
|
await effects.phase("stopping", "\u5DF2\u5173\u95ED\u65B0\u4EFB\u52A1\u5165\u53E3\uFF0C\u6B63\u5728\u505C\u6B62\u65E7\u670D\u52A1\u5E76\u5907\u4EFD\u6570\u636E");
|
|
21840
22353
|
stopped = true;
|
|
21841
22354
|
await effects.stop();
|
|
21842
|
-
await
|
|
21843
|
-
for (const name of ["app.sqlite", "app.sqlite-wal", "app.sqlite-shm"]) {
|
|
21844
|
-
if (await exists((0, import_node_path5.join)(paths.dataDir, name)))
|
|
21845
|
-
await copyDurable((0, import_node_path5.join)(paths.dataDir, name), (0, import_node_path5.join)(paths.backup, name));
|
|
21846
|
-
}
|
|
21847
|
-
await copyDurable(paths.config, (0, import_node_path5.join)(paths.backup, "config.json"));
|
|
21848
|
-
await saveJson((0, import_node_path5.join)(paths.backup, "snapshot.json"), { complete: true });
|
|
22355
|
+
await effects.backup();
|
|
21849
22356
|
backedUp = true;
|
|
21850
|
-
await (0,
|
|
22357
|
+
await (0, import_promises10.rename)(paths.root, paths.previous);
|
|
21851
22358
|
moved = true;
|
|
21852
|
-
await (0,
|
|
22359
|
+
await (0, import_promises10.rename)(paths.candidate, paths.root);
|
|
21853
22360
|
await effects.phase("verifying", "\u6B63\u5728\u542F\u52A8\u65B0\u7248\u3001\u8FC1\u79FB\u6570\u636E\u5E93\u5E76\u9A8C\u8BC1\uFF1B\u4E1A\u52A1\u5199\u5165\u4FDD\u6301\u6682\u505C");
|
|
21854
22361
|
await effects.start(true);
|
|
21855
22362
|
await effects.verify();
|
|
@@ -21866,17 +22373,10 @@ async function activateUpdate(paths, effects) {
|
|
|
21866
22373
|
try {
|
|
21867
22374
|
await effects.stop();
|
|
21868
22375
|
if (moved) {
|
|
21869
|
-
await (0,
|
|
21870
|
-
await (0,
|
|
21871
|
-
}
|
|
21872
|
-
if (backedUp) {
|
|
21873
|
-
for (const name of ["app.sqlite", "app.sqlite-wal", "app.sqlite-shm"]) {
|
|
21874
|
-
await (0, import_promises7.rm)((0, import_node_path5.join)(paths.dataDir, name), { force: true });
|
|
21875
|
-
if (await exists((0, import_node_path5.join)(paths.backup, name)))
|
|
21876
|
-
await copyDurable((0, import_node_path5.join)(paths.backup, name), (0, import_node_path5.join)(paths.dataDir, name));
|
|
21877
|
-
}
|
|
21878
|
-
await copyDurable((0, import_node_path5.join)(paths.backup, "config.json"), paths.config);
|
|
22376
|
+
await (0, import_promises10.rm)(paths.root, { recursive: true, force: true });
|
|
22377
|
+
await (0, import_promises10.rename)(paths.previous, paths.root);
|
|
21879
22378
|
}
|
|
22379
|
+
if (backedUp) await effects.restore();
|
|
21880
22380
|
await effects.phase(
|
|
21881
22381
|
"rolledBack",
|
|
21882
22382
|
`\u65B0\u7248\u542F\u52A8\u5931\u8D25\uFF0C\u5DF2\u6062\u590D\u65E7\u7248\uFF1A${error62 instanceof Error ? error62.message : String(error62)}`
|
|
@@ -21893,16 +22393,16 @@ async function activateUpdate(paths, effects) {
|
|
|
21893
22393
|
}
|
|
21894
22394
|
}
|
|
21895
22395
|
function transactionPaths(root, id, dataDir, config2, backup) {
|
|
21896
|
-
const prefix = (0,
|
|
22396
|
+
const prefix = (0, import_node_path9.join)((0, import_node_path9.dirname)(root), `.covro-stage-${id}`);
|
|
21897
22397
|
return {
|
|
21898
22398
|
root,
|
|
21899
22399
|
prefix,
|
|
21900
|
-
candidate: (0,
|
|
22400
|
+
candidate: (0, import_node_path9.join)(
|
|
21901
22401
|
prefix,
|
|
21902
22402
|
process.platform === "win32" ? "node_modules" : "lib/node_modules",
|
|
21903
22403
|
npmPackageName
|
|
21904
22404
|
),
|
|
21905
|
-
previous: (0,
|
|
22405
|
+
previous: (0, import_node_path9.join)((0, import_node_path9.dirname)(root), `.covro-previous-${id}`),
|
|
21906
22406
|
backup,
|
|
21907
22407
|
dataDir,
|
|
21908
22408
|
config: config2
|
|
@@ -21912,9 +22412,9 @@ function transactionPaths(root, id, dataDir, config2, backup) {
|
|
|
21912
22412
|
// src/updates/registry.ts
|
|
21913
22413
|
var import_node_child_process3 = require("node:child_process");
|
|
21914
22414
|
var import_node_util3 = require("node:util");
|
|
21915
|
-
var
|
|
21916
|
-
var
|
|
21917
|
-
var
|
|
22415
|
+
var import_promises11 = require("node:fs/promises");
|
|
22416
|
+
var import_node_fs3 = require("node:fs");
|
|
22417
|
+
var import_node_path10 = require("node:path");
|
|
21918
22418
|
var run = (0, import_node_util3.promisify)(import_node_child_process3.execFile);
|
|
21919
22419
|
var registry2 = "https://registry.npmjs.org";
|
|
21920
22420
|
var releaseSchema = external_exports.object({
|
|
@@ -21932,16 +22432,16 @@ async function inspectInstallation(root) {
|
|
|
21932
22432
|
}
|
|
21933
22433
|
}
|
|
21934
22434
|
async function inspectPackageDirectory(root, globalRoot) {
|
|
21935
|
-
const expected = (0,
|
|
21936
|
-
if ((await (0,
|
|
22435
|
+
const expected = (0, import_node_path10.join)(await (0, import_promises11.realpath)(globalRoot), npmPackageName);
|
|
22436
|
+
if ((await (0, import_promises11.lstat)(expected)).isSymbolicLink() || await (0, import_promises11.realpath)(root) !== expected)
|
|
21937
22437
|
return "\u5F53\u524D\u4E3A\u6E90\u7801\u3001\u94FE\u63A5\u6216\u975E npm \u5168\u5C40\u5B89\u88C5\uFF1B\u8BF7\u4F7F\u7528\u539F\u90E8\u7F72\u65B9\u5F0F\u66F4\u65B0\u3002";
|
|
21938
22438
|
try {
|
|
21939
|
-
await (0,
|
|
22439
|
+
await (0, import_promises11.lstat)((0, import_node_path10.join)(expected, ".git"));
|
|
21940
22440
|
return "\u5F53\u524D\u5B89\u88C5\u5305\u542B Git \u5DE5\u4F5C\u533A\uFF1B\u8BF7\u4F7F\u7528\u539F\u90E8\u7F72\u65B9\u5F0F\u66F4\u65B0\u3002";
|
|
21941
22441
|
} catch (error62) {
|
|
21942
22442
|
if (error62.code !== "ENOENT") throw error62;
|
|
21943
22443
|
}
|
|
21944
|
-
await (0,
|
|
22444
|
+
await (0, import_promises11.access)(root, import_node_fs3.constants.W_OK);
|
|
21945
22445
|
return void 0;
|
|
21946
22446
|
}
|
|
21947
22447
|
|
|
@@ -21949,7 +22449,7 @@ async function inspectPackageDirectory(root, globalRoot) {
|
|
|
21949
22449
|
var exec3 = (0, import_node_util4.promisify)(import_node_child_process4.execFile);
|
|
21950
22450
|
var message = (error62) => error62 instanceof Error ? error62.message : String(error62);
|
|
21951
22451
|
async function startService(context) {
|
|
21952
|
-
await startBackground(context.location, (0,
|
|
22452
|
+
await startBackground(context.location, (0, import_node_path11.join)(context.root, "bin/covro.mjs"));
|
|
21953
22453
|
}
|
|
21954
22454
|
async function stopService(context) {
|
|
21955
22455
|
await stopBackground(context.location);
|
|
@@ -21964,65 +22464,89 @@ async function verifyRestoredService(context, version3) {
|
|
|
21964
22464
|
} catch (error62) {
|
|
21965
22465
|
if (attempt === 239) throw error62;
|
|
21966
22466
|
}
|
|
21967
|
-
await (0,
|
|
22467
|
+
await (0, import_promises13.setTimeout)(250);
|
|
21968
22468
|
}
|
|
21969
22469
|
}
|
|
21970
22470
|
async function verifyMigrations(context, candidate) {
|
|
21971
|
-
const require2 = (0, import_node_module.createRequire)((0,
|
|
22471
|
+
const require2 = (0, import_node_module.createRequire)((0, import_node_path11.join)(context.root, "package.json"));
|
|
21972
22472
|
const Sqlite = require2("better-sqlite3");
|
|
21973
|
-
const filename = (0,
|
|
22473
|
+
const filename = (0, import_node_path11.join)(context.dataDir, "app.sqlite");
|
|
21974
22474
|
try {
|
|
21975
|
-
await (0,
|
|
22475
|
+
await (0, import_promises12.access)(filename);
|
|
21976
22476
|
} catch (error62) {
|
|
21977
22477
|
if (error62.code === "ENOENT") return;
|
|
21978
22478
|
throw error62;
|
|
21979
22479
|
}
|
|
21980
22480
|
const db = new Sqlite(filename, { readonly: true, fileMustExist: true });
|
|
21981
22481
|
try {
|
|
21982
|
-
const
|
|
21983
|
-
|
|
21984
|
-
|
|
21985
|
-
|
|
21986
|
-
|
|
21987
|
-
|
|
21988
|
-
|
|
21989
|
-
|
|
21990
|
-
if (!/^[a-zA-Z0-9_-]+$/.test(entry.tag)) throw new Error("\u5019\u9009\u5305\u5305\u542B\u65E0\u6548\u8FC1\u79FB\u8DEF\u5F84");
|
|
21991
|
-
return (0, import_node_crypto4.createHash)("sha256").update(await (0, import_promises9.readFile)((0, import_node_path7.join)(candidate, "dist/drizzle", `${entry.tag}.sql`))).digest("hex");
|
|
21992
|
-
})
|
|
21993
|
-
);
|
|
21994
|
-
if (applied.some((entry, i) => entry.hash !== hashes[i]))
|
|
21995
|
-
throw new Error("\u76EE\u6807\u7248\u672C\u4E0D\u517C\u5BB9\u5F53\u524D\u6570\u636E\u5E93\u8FC1\u79FB\u5386\u53F2\u3002\u8BF7\u7B49\u5F85\u517C\u5BB9\u7248\u672C\uFF0C\u6216\u4F7F\u7528\u72EC\u7ACB\u6D4B\u8BD5\u6570\u636E\u76EE\u5F55\u3002");
|
|
22482
|
+
const migrations = readMigrations((0, import_node_path11.join)(candidate, "dist/drizzle"));
|
|
22483
|
+
const metadata = await readJson((0, import_node_path11.join)(candidate, "package.json"));
|
|
22484
|
+
if (metadata?.covroDatabase) {
|
|
22485
|
+
const contract = databaseCompatibilitySchema.parse(metadata.covroDatabase);
|
|
22486
|
+
if (contract.schemaVersion !== migrations.length)
|
|
22487
|
+
throw new Error("\u76EE\u6807\u7248\u672C\u7684 Schema \u58F0\u660E\u4E0E\u8FC1\u79FB\u4E0D\u4E00\u81F4");
|
|
22488
|
+
}
|
|
22489
|
+
inspectDatabase(db, migrations);
|
|
21996
22490
|
} finally {
|
|
21997
22491
|
db.close();
|
|
21998
22492
|
}
|
|
21999
22493
|
}
|
|
22000
22494
|
async function worker(directory) {
|
|
22001
|
-
await (0,
|
|
22002
|
-
const release = await
|
|
22495
|
+
await (0, import_promises12.mkdir)(directory, { recursive: true, mode: 448 });
|
|
22496
|
+
const release = await import_proper_lockfile7.default.lock(directory, {
|
|
22003
22497
|
stale: 1e4,
|
|
22004
22498
|
update: 2e3,
|
|
22005
22499
|
retries: { retries: 30, minTimeout: 100, maxTimeout: 500 }
|
|
22006
22500
|
});
|
|
22007
|
-
let record2 = await readJson((0,
|
|
22008
|
-
const context = await readJson((0,
|
|
22501
|
+
let record2 = await readJson((0, import_node_path11.join)(directory, "run.json"));
|
|
22502
|
+
const context = await readJson((0, import_node_path11.join)(directory, "context.json"));
|
|
22009
22503
|
if (!record2 || !context) {
|
|
22010
22504
|
await release();
|
|
22011
22505
|
throw new Error("\u7F3A\u5C11\u5347\u7EA7\u8BB0\u5F55");
|
|
22012
22506
|
}
|
|
22013
22507
|
const update = async (phase, detail) => {
|
|
22014
22508
|
record2 = { ...record2, phase, message: detail, updatedAt: Date.now() };
|
|
22015
|
-
await saveJson((0,
|
|
22509
|
+
await saveJson((0, import_node_path11.join)(directory, "run.json"), record2);
|
|
22016
22510
|
};
|
|
22017
22511
|
const paths = transactionPaths(
|
|
22018
22512
|
context.root,
|
|
22019
22513
|
record2.id,
|
|
22020
22514
|
context.dataDir,
|
|
22021
22515
|
context.location.config,
|
|
22022
|
-
(0,
|
|
22516
|
+
(0, import_node_path11.join)(backupDirectory(context.location.home, context.dataDir), record2.id)
|
|
22517
|
+
);
|
|
22518
|
+
let releaseMaintenance;
|
|
22519
|
+
let releaseData;
|
|
22520
|
+
const previousMetadata = await readJson(
|
|
22521
|
+
(0, import_node_path11.join)(paths.previous, "package.json")
|
|
22023
22522
|
);
|
|
22523
|
+
const originalRoot = previousMetadata?.version === record2.from ? paths.previous : context.root;
|
|
22524
|
+
const originalMetadata = await readJson((0, import_node_path11.join)(originalRoot, "package.json"));
|
|
22525
|
+
const Sqlite = (0, import_node_module.createRequire)((0, import_node_path11.join)(originalRoot, "package.json"))(
|
|
22526
|
+
"better-sqlite3"
|
|
22527
|
+
);
|
|
22528
|
+
const migrations = readMigrations((0, import_node_path11.join)(originalRoot, "dist/drizzle"));
|
|
22529
|
+
const backups = new BackupStore({
|
|
22530
|
+
directory: backupDirectory(context.location.home, context.dataDir),
|
|
22531
|
+
config: paths.config,
|
|
22532
|
+
dataDir: paths.dataDir,
|
|
22533
|
+
appVersion: record2.from,
|
|
22534
|
+
commit: originalMetadata?.covroCommit,
|
|
22535
|
+
contract: databaseCompatibilitySchema.parse(
|
|
22536
|
+
originalMetadata?.covroDatabase ?? {
|
|
22537
|
+
schemaVersion: migrations.length,
|
|
22538
|
+
minRestorableSchemaVersion: 1,
|
|
22539
|
+
backupFormatVersion: 1
|
|
22540
|
+
}
|
|
22541
|
+
),
|
|
22542
|
+
Sqlite,
|
|
22543
|
+
migrations
|
|
22544
|
+
});
|
|
22024
22545
|
try {
|
|
22025
22546
|
if (process.argv[3] === "--repair") {
|
|
22547
|
+
releaseMaintenance = await acquireMaintenanceLock(context.dataDir);
|
|
22548
|
+
if (!await readJson((0, import_node_path11.join)(paths.backup, "snapshot.json")))
|
|
22549
|
+
paths.backup = (0, import_node_path11.join)(directory, `backup-${record2.id}`);
|
|
22026
22550
|
const active = await control(context.location, "status").catch(
|
|
22027
22551
|
(error62) => {
|
|
22028
22552
|
if (isNotRunning(error62)) return void 0;
|
|
@@ -22033,18 +22557,24 @@ async function worker(directory) {
|
|
|
22033
22557
|
if (active && !active.maintenance && active.version !== record2.from)
|
|
22034
22558
|
throw new Error("\u5F53\u524D\u670D\u52A1\u53EF\u80FD\u5DF2\u63A5\u53D7\u65B0\u7248\u4E1A\u52A1\u6570\u636E\uFF1B\u62D2\u7EDD\u6062\u590D\u65E7\u5FEB\u7167\uFF0C\u8BF7\u4F7F\u7528\u517C\u5BB9\u7248\u672C\u68C0\u67E5\u3002");
|
|
22035
22559
|
const previous = await readJson(
|
|
22036
|
-
(0,
|
|
22560
|
+
(0, import_node_path11.join)(paths.previous, "package.json")
|
|
22037
22561
|
);
|
|
22038
22562
|
if (previous) {
|
|
22039
22563
|
if (active && !active.maintenance)
|
|
22040
22564
|
throw new Error("\u65E7\u670D\u52A1\u5DF2\u6062\u590D\u4E1A\u52A1\u5199\u5165\uFF1B\u62D2\u7EDD\u7528\u5347\u7EA7\u524D\u5FEB\u7167\u8986\u76D6\u73B0\u6709\u6570\u636E\uFF0C\u8BF7\u4FDD\u7559\u73B0\u573A\u68C0\u67E5\u3002");
|
|
22041
22565
|
if (previous.name !== npmPackageName || previous.version !== record2.from)
|
|
22042
22566
|
throw new Error("\u65E7\u7248\u5907\u4EFD\u8EAB\u4EFD\u4E0D\u5339\u914D");
|
|
22043
|
-
const snapshot = await readJson(
|
|
22044
|
-
|
|
22567
|
+
const snapshot = await readJson(
|
|
22568
|
+
(0, import_node_path11.join)(paths.backup, "snapshot.json")
|
|
22569
|
+
);
|
|
22570
|
+
if (snapshot?.formatVersion === 1) {
|
|
22571
|
+
const verified = await backups.verify(record2.id);
|
|
22572
|
+
if (verified.appVersion !== record2.from || verified.protectedBy !== record2.id || verified.configPath !== paths.config || verified.dataDir !== paths.dataDir)
|
|
22573
|
+
throw new Error("\u5907\u4EFD\u8EAB\u4EFD\u4E0D\u5339\u914D");
|
|
22574
|
+
} else await verifyLegacySnapshot(paths.backup, Sqlite, (0, import_node_path11.join)(originalRoot, "dist/drizzle"));
|
|
22045
22575
|
} else {
|
|
22046
22576
|
const original = await readJson(
|
|
22047
|
-
(0,
|
|
22577
|
+
(0, import_node_path11.join)(paths.root, "package.json")
|
|
22048
22578
|
);
|
|
22049
22579
|
if (original?.name !== npmPackageName || original.version !== record2.from)
|
|
22050
22580
|
throw new Error("\u672A\u627E\u5230\u5B8C\u6574\u7684\u4E0A\u4E00\u7248\u672C\u5B89\u88C5");
|
|
@@ -22054,26 +22584,29 @@ async function worker(directory) {
|
|
|
22054
22584
|
if (!admission.ready) throw new Error("\u4ECD\u6709\u4EFB\u52A1\u3001\u5BA1\u6279\u6216\u5F85\u6838\u5BF9\u64CD\u4F5C\uFF0C\u4E0D\u80FD\u6062\u590D\u65E7\u5B89\u88C5");
|
|
22055
22585
|
}
|
|
22056
22586
|
await stopService(context);
|
|
22587
|
+
releaseData = await acquireInstanceLock(context.dataDir);
|
|
22057
22588
|
if (previous) {
|
|
22058
|
-
await (0,
|
|
22059
|
-
await (0,
|
|
22589
|
+
await (0, import_promises12.rm)(paths.root, { recursive: true, force: true });
|
|
22590
|
+
await (0, import_promises12.rename)(paths.previous, paths.root);
|
|
22060
22591
|
for (const name of ["app.sqlite", "app.sqlite-wal", "app.sqlite-shm"]) {
|
|
22061
|
-
await (0,
|
|
22592
|
+
await (0, import_promises12.rm)((0, import_node_path11.join)(paths.dataDir, name), { force: true });
|
|
22062
22593
|
try {
|
|
22063
|
-
await copyDurable((0,
|
|
22594
|
+
await copyDurable((0, import_node_path11.join)(paths.backup, name), (0, import_node_path11.join)(paths.dataDir, name));
|
|
22064
22595
|
} catch (error62) {
|
|
22065
22596
|
if (error62.code !== "ENOENT") throw error62;
|
|
22066
22597
|
}
|
|
22067
22598
|
}
|
|
22068
|
-
await copyDurable((0,
|
|
22599
|
+
await copyDurable((0, import_node_path11.join)(paths.backup, "config.json"), paths.config);
|
|
22069
22600
|
}
|
|
22070
22601
|
const restored = await readJson(
|
|
22071
|
-
(0,
|
|
22602
|
+
(0, import_node_path11.join)(paths.root, "package.json")
|
|
22072
22603
|
);
|
|
22073
22604
|
if (restored?.name !== npmPackageName || restored.version !== record2.from)
|
|
22074
22605
|
throw new Error("\u672A\u627E\u5230\u5B8C\u6574\u7684\u4E0A\u4E00\u7248\u672C\u5B89\u88C5");
|
|
22075
22606
|
await update("rolledBack", "\u5DF2\u6062\u590D\u4E0A\u6B21\u672A\u5B8C\u6210\u7684\u5347\u7EA7\uFF0C\u6B63\u5728\u542F\u52A8\u4E0A\u4E00\u7248\u672C");
|
|
22076
22607
|
try {
|
|
22608
|
+
await releaseData?.();
|
|
22609
|
+
releaseData = void 0;
|
|
22077
22610
|
await startService(context);
|
|
22078
22611
|
await verifyRestoredService(context, record2.from);
|
|
22079
22612
|
await update("rolledBack", "\u5DF2\u6062\u590D\u4E0A\u6B21\u672A\u5B8C\u6210\u7684\u5347\u7EA7\uFF0C\u4E0A\u4E00\u7248\u672C\u5DF2\u5C31\u7EEA");
|
|
@@ -22085,10 +22618,10 @@ async function worker(directory) {
|
|
|
22085
22618
|
}
|
|
22086
22619
|
const reason = await inspectInstallation(context.root);
|
|
22087
22620
|
if (reason) throw new Error(reason);
|
|
22088
|
-
for (const key of await (0,
|
|
22621
|
+
for (const key of await (0, import_promises12.readdir)((0, import_node_path11.join)(context.location.home, "instances"))) {
|
|
22089
22622
|
if (key === context.location.key) continue;
|
|
22090
22623
|
const instance = await readJson(
|
|
22091
|
-
(0,
|
|
22624
|
+
(0, import_node_path11.join)(context.location.home, "instances", key, "instance.json")
|
|
22092
22625
|
);
|
|
22093
22626
|
if (instance?.root !== context.root) continue;
|
|
22094
22627
|
try {
|
|
@@ -22098,7 +22631,7 @@ async function worker(directory) {
|
|
|
22098
22631
|
if (!isNotRunning(error62)) throw error62;
|
|
22099
22632
|
}
|
|
22100
22633
|
}
|
|
22101
|
-
await (0,
|
|
22634
|
+
await (0, import_promises12.access)((0, import_node_path11.dirname)(context.root), import_node_fs4.constants.W_OK);
|
|
22102
22635
|
await exec3(
|
|
22103
22636
|
"npm",
|
|
22104
22637
|
[
|
|
@@ -22116,7 +22649,7 @@ async function worker(directory) {
|
|
|
22116
22649
|
{ timeout: 10 * 6e4, maxBuffer: 2 * 1024 * 1024 }
|
|
22117
22650
|
);
|
|
22118
22651
|
const candidate = await readJson(
|
|
22119
|
-
(0,
|
|
22652
|
+
(0, import_node_path11.join)(paths.candidate, "package.json")
|
|
22120
22653
|
);
|
|
22121
22654
|
if (candidate?.name !== npmPackageName || candidate.version !== record2.target)
|
|
22122
22655
|
throw new Error("\u5019\u9009\u5305\u8EAB\u4EFD\u6216\u7248\u672C\u4E0D\u5339\u914D");
|
|
@@ -22135,17 +22668,26 @@ async function worker(directory) {
|
|
|
22135
22668
|
);
|
|
22136
22669
|
};
|
|
22137
22670
|
await checkCodex();
|
|
22138
|
-
await exec3(process.execPath, [(0,
|
|
22671
|
+
await exec3(process.execPath, [(0, import_node_path11.join)(paths.candidate, "bin/covro.mjs"), "--version"], {
|
|
22139
22672
|
timeout: 3e4
|
|
22140
22673
|
});
|
|
22141
22674
|
const nativeProbe = 'const {createRequire}=await import("node:module"); const r=createRequire(process.argv[1]); const DB=r("better-sqlite3"); const db=new DB(":memory:"); db.close();';
|
|
22142
22675
|
await exec3(
|
|
22143
22676
|
process.execPath,
|
|
22144
|
-
["--input-type=module", "-e", nativeProbe, (0,
|
|
22677
|
+
["--input-type=module", "-e", nativeProbe, (0, import_node_path11.join)(paths.candidate, "package.json")],
|
|
22145
22678
|
{ timeout: 3e4 }
|
|
22146
22679
|
);
|
|
22147
22680
|
await verifyMigrations(context, paths.candidate);
|
|
22681
|
+
releaseMaintenance = await acquireMaintenanceLock(context.dataDir);
|
|
22148
22682
|
await activateUpdate(paths, {
|
|
22683
|
+
backup: async () => {
|
|
22684
|
+
releaseData = await acquireInstanceLock(context.dataDir);
|
|
22685
|
+
await backups.create({ id: record2.id, trigger: "preUpgrade", protectedBy: record2.id });
|
|
22686
|
+
},
|
|
22687
|
+
restore: async () => {
|
|
22688
|
+
releaseData ??= await acquireInstanceLock(context.dataDir);
|
|
22689
|
+
await backups.restoreFiles(record2.id);
|
|
22690
|
+
},
|
|
22149
22691
|
phase: update,
|
|
22150
22692
|
waitForIdle: async () => {
|
|
22151
22693
|
for (; ; ) {
|
|
@@ -22159,11 +22701,13 @@ async function worker(directory) {
|
|
|
22159
22701
|
return;
|
|
22160
22702
|
}
|
|
22161
22703
|
await update("waiting", result.reason ?? "\u7B49\u5F85\u6240\u6709\u4EFB\u52A1\u7ED3\u675F");
|
|
22162
|
-
await (0,
|
|
22704
|
+
await (0, import_promises13.setTimeout)(2e3);
|
|
22163
22705
|
}
|
|
22164
22706
|
},
|
|
22165
22707
|
stop: () => stopService(context),
|
|
22166
22708
|
start: async (candidate2) => {
|
|
22709
|
+
await releaseData?.();
|
|
22710
|
+
releaseData = void 0;
|
|
22167
22711
|
await startService(context);
|
|
22168
22712
|
if (!candidate2) await verifyRestoredService(context, record2.from);
|
|
22169
22713
|
},
|
|
@@ -22178,7 +22722,7 @@ async function worker(directory) {
|
|
|
22178
22722
|
await checkCodex(current);
|
|
22179
22723
|
if (current.codexReady) return;
|
|
22180
22724
|
}
|
|
22181
|
-
await (0,
|
|
22725
|
+
await (0, import_promises13.setTimeout)(250);
|
|
22182
22726
|
}
|
|
22183
22727
|
throw new Error("\u65B0\u7248\u670D\u52A1\u6216 Codex \u8FDE\u63A5\u672A\u5C31\u7EEA\uFF0C\u62D2\u7EDD\u6FC0\u6D3B");
|
|
22184
22728
|
},
|
|
@@ -22187,18 +22731,18 @@ async function worker(directory) {
|
|
|
22187
22731
|
id: record2.id,
|
|
22188
22732
|
channel: record2.channel
|
|
22189
22733
|
});
|
|
22190
|
-
const final = await readJson((0,
|
|
22734
|
+
const final = await readJson((0, import_node_path11.join)(directory, "run.json"));
|
|
22191
22735
|
if (!final?.committed) throw new Error("\u65B0\u7248\u5C1A\u672A\u786E\u8BA4\u5347\u7EA7\u63D0\u4EA4");
|
|
22192
22736
|
record2 = final;
|
|
22193
22737
|
},
|
|
22194
|
-
hasCommitted: async () => Boolean((await readJson((0,
|
|
22738
|
+
hasCommitted: async () => Boolean((await readJson((0, import_node_path11.join)(directory, "run.json")))?.committed),
|
|
22195
22739
|
resume: async () => {
|
|
22196
22740
|
await control(context.location, "cancel-update").catch(() => {
|
|
22197
22741
|
});
|
|
22198
22742
|
}
|
|
22199
22743
|
});
|
|
22200
22744
|
} catch (error62) {
|
|
22201
|
-
const latest = await readJson((0,
|
|
22745
|
+
const latest = await readJson((0, import_node_path11.join)(directory, "run.json"));
|
|
22202
22746
|
if (latest?.committed) {
|
|
22203
22747
|
record2 = latest;
|
|
22204
22748
|
} else if (!["rolledBack", "failed"].includes(record2.phase))
|
|
@@ -22206,9 +22750,11 @@ async function worker(directory) {
|
|
|
22206
22750
|
console.error(message(error62));
|
|
22207
22751
|
process.exitCode = record2.committed || record2.phase === "rolledBack" ? 0 : 1;
|
|
22208
22752
|
} finally {
|
|
22753
|
+
await releaseData?.();
|
|
22754
|
+
await releaseMaintenance?.();
|
|
22209
22755
|
await release();
|
|
22210
22756
|
if (record2.phase === "succeeded" || record2.phase === "rolledBack") {
|
|
22211
|
-
await (0,
|
|
22757
|
+
await (0, import_promises12.rm)(paths.prefix, { recursive: true, force: true });
|
|
22212
22758
|
}
|
|
22213
22759
|
}
|
|
22214
22760
|
}
|