@wirecat/mail-cli 0.19.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/bin/mail.js +2 -2
- package/dist/bundle/{all-profiles-MRNWJSXX.js → all-profiles-DTUWUCQQ.js} +7 -6
- package/dist/bundle/{anthropic-OUV5B4ZR.js → anthropic-YJAEQSNT.js} +3 -3
- package/dist/bundle/{app-server-TLZPGT53.js → app-server-3ZXSTBA3.js} +41 -40
- package/dist/bundle/{bun-IDEPIM6S.js → bun-34VBM7C5.js} +2 -2
- package/dist/bundle/{bun-sqlite-DW4XMJOP.js → bun-sqlite-GCT7ROCK.js} +2 -2
- package/dist/bundle/{chunk-ETZFPIDO.js → chunk-2PPEDB67.js} +31 -29
- package/dist/bundle/{chunk-HUOAAQU7.js → chunk-3DSYLE5N.js} +2 -2
- package/dist/bundle/{chunk-RYRR5NFB.js → chunk-3HDQVTND.js} +4 -4
- package/dist/bundle/{chunk-H3KB77WL.js → chunk-4FWJNIPH.js} +1 -1
- package/dist/bundle/{chunk-NA63ZIYN.js → chunk-4WIEVQ2Q.js} +8 -14
- package/dist/bundle/{chunk-EWXCMKLM.js → chunk-566MEXK5.js} +2 -2
- package/dist/bundle/{chunk-GZAETQ6X.js → chunk-72N26BQM.js} +24 -22
- package/dist/bundle/{chunk-DC6BXHWF.js → chunk-7XLOWYGD.js} +93 -6
- package/dist/bundle/{chunk-RYE5SRUM.js → chunk-AF62BPIW.js} +5 -5
- package/dist/bundle/{chunk-GAPH7GET.js → chunk-B74SOC4R.js} +9 -20
- package/dist/bundle/{chunk-BQM4ROFB.js → chunk-FTI73RLC.js} +2 -2
- package/dist/bundle/{chunk-OUMXW53I.js → chunk-GAPQENMY.js} +2 -2
- package/dist/bundle/{chunk-4EMXLDQ6.js → chunk-HJ2CXDKJ.js} +130 -11
- package/dist/bundle/{chunk-2ZDKZGES.js → chunk-HN43G27G.js} +30 -22
- package/dist/bundle/{chunk-VVHEB3M3.js → chunk-HRRSTIGP.js} +4 -4
- package/dist/bundle/{chunk-QC6QDORL.js → chunk-HSBGNVEL.js} +202 -171
- package/dist/bundle/{chunk-CQVRBZGP.js → chunk-I2SDXWLR.js} +173 -48
- package/dist/bundle/{chunk-3CJVUCDZ.js → chunk-J2U6LUT5.js} +3 -3
- package/dist/bundle/{chunk-WJQWEKZL.js → chunk-J4UZXBEV.js} +1 -1
- package/dist/bundle/{chunk-57KFWOMH.js → chunk-KMQAHDBM.js} +7170 -13496
- package/dist/bundle/{chunk-7H45FPAT.js → chunk-LF5XM4HE.js} +1 -1
- package/dist/bundle/chunk-LTXYJAJK.js +12211 -0
- package/dist/bundle/{chunk-YJMQWOPH.js → chunk-MD64ITYO.js} +1 -1
- package/dist/bundle/{chunk-WELIANTW.js → chunk-MDDB7M7Z.js} +1 -1
- package/dist/bundle/{chunk-ZXQDJMWD.js → chunk-NOVBK4SY.js} +12 -12
- package/dist/bundle/{chunk-YL5WH6XH.js → chunk-O3M2S62X.js} +3 -3
- package/dist/bundle/{chunk-H4MWBB4X.js → chunk-ODFHIXMA.js} +1 -1
- package/dist/bundle/{chunk-HCRMPNSO.js → chunk-OKO2Q6H6.js} +2 -2
- package/dist/bundle/{chunk-FBSDRNW5.js → chunk-P2QJA7S5.js} +1 -1
- package/dist/bundle/{chunk-VIXEQPVE.js → chunk-P6FT6YYT.js} +17 -14
- package/dist/bundle/{chunk-QU3JH3GB.js → chunk-QE72KTS7.js} +1 -1
- package/dist/bundle/{chunk-W3PU5XGE.js → chunk-QPRXTLMD.js} +1 -1
- package/dist/bundle/{chunk-EQWYG3QN.js → chunk-QTMVGOSF.js} +298 -266
- package/dist/bundle/{chunk-HTNWOOA2.js → chunk-R3WPMQYZ.js} +105 -61
- package/dist/bundle/{chunk-SOZXI7I3.js → chunk-RFB27ACZ.js} +2 -2
- package/dist/bundle/{chunk-P2RSKCY4.js → chunk-RPCKBXKN.js} +1 -1
- package/dist/bundle/{chunk-QXZTVB5I.js → chunk-RT6SLZBI.js} +1 -1
- package/dist/bundle/{chunk-TX2TTMK4.js → chunk-RY7PBP4F.js} +45 -29
- package/dist/bundle/{chunk-7ERCJWNL.js → chunk-SCIC2CJS.js} +4 -4
- package/dist/bundle/{chunk-33BOFLDQ.js → chunk-SFC46MP2.js} +249 -8
- package/dist/bundle/chunk-SYEICLTR.js +66 -0
- package/dist/bundle/{chunk-HOGJNJ3T.js → chunk-T3DTYJTG.js} +1 -1
- package/dist/bundle/{chunk-NBHMSEN4.js → chunk-T4FVIPUJ.js} +1 -1
- package/dist/bundle/{chunk-MQISDBH2.js → chunk-TCCN5TON.js} +1 -1
- package/dist/bundle/{chunk-KO2DA7CN.js → chunk-V6OIIVH3.js} +10 -10
- package/dist/bundle/{chunk-A5A6MPIX.js → chunk-VDUGE6TH.js} +2 -2
- package/dist/bundle/{chunk-LCP2DMBD.js → chunk-VINSQR4X.js} +7 -7
- package/dist/bundle/{chunk-42QY6DIG.js → chunk-VQZCIDSO.js} +2 -2
- package/dist/bundle/{chunk-OYYEY3UE.js → chunk-WBAA2X3E.js} +9 -9
- package/dist/bundle/{chunk-2WORM2E3.js → chunk-Z75WYAX6.js} +6 -6
- package/dist/bundle/{chunk-POWHDZIC.js → chunk-Z7N4MGOQ.js} +5 -5
- package/dist/bundle/{chunk-R2ETE3SX.js → chunk-ZKLXSVIO.js} +1 -1
- package/dist/bundle/{chunk-OBSV2GUJ.js → chunk-ZZSHGCRC.js} +3 -3
- package/dist/bundle/{command-contract-36ASI4YI.js → command-contract-Y4ZQAJEC.js} +14 -13
- package/dist/bundle/{decode-Z37HTJ53.js → decode-BIOOL5E4.js} +2 -2
- package/dist/bundle/{dist-E3UUAOWA.js → dist-TJVIRLE5.js} +77 -17
- package/dist/bundle/{echarts-TSRD7GVA.js → echarts-ECPGMKXO.js} +2 -2
- package/dist/bundle/{embed-Z5GZUUCK.js → embed-F7JFSLHN.js} +3 -3
- package/dist/bundle/{embedder-SYWZ6JW2.js → embedder-U4G74HV3.js} +6 -6
- package/dist/bundle/{first-run-I5GMVVX5.js → first-run-JTYPUYQP.js} +5 -5
- package/dist/bundle/first-screen-W6RWTAU7.js +33 -0
- package/dist/bundle/{instructions-IMW3LWMS.js → instructions-WNCGZ7OJ.js} +1 -1
- package/dist/bundle/mail.js +2 -2
- package/dist/bundle/{node-V6SRRJ2F.js → node-UIRGGMGT.js} +2 -2
- package/dist/bundle/{node-sqlite-HN2P6PY2.js → node-sqlite-4ZM7OPRF.js} +3 -3
- package/dist/bundle/{oauth-7FIIKNXY.js → oauth-5RAJZPBW.js} +4 -4
- package/dist/bundle/{open-6XPAHITO.js → open-7ORCHOAI.js} +2 -2
- package/dist/bundle/{openai-B5MSVUDL.js → openai-XSJNXJA7.js} +10 -10
- package/dist/bundle/{process-LNEAZMJV.js → process-ZLO72UVZ.js} +1 -1
- package/dist/bundle/{program-BDB3D2HE.js → program-LBLGFZWU.js} +1733 -1654
- package/dist/bundle/{prompt-ZXS7F7OS.js → prompt-IDUPCUGM.js} +2 -2
- package/dist/bundle/{recognize-ONHYBE77.js → recognize-OS3EZKIM.js} +1 -1
- package/dist/bundle/{remote-IBZTKGBQ.js → remote-PF4LZR65.js} +4 -4
- package/dist/bundle/{rerank-TWODAEGK.js → rerank-CQNZF3JI.js} +4 -4
- package/dist/bundle/{serve-PPJIP254.js → serve-Y2DDLGBT.js} +6 -6
- package/dist/bundle/server-I3IALQMC.js +65 -0
- package/dist/bundle/{server-VG7EAG5C.js → server-TVRT7YEY.js} +33 -32
- package/dist/bundle/{sqlite-runtime-JZFSB33U.js → sqlite-runtime-5343C3OE.js} +3 -3
- package/dist/bundle/{state-2FUXS6RU.js → state-4GBTMPIV.js} +3 -3
- package/dist/bundle/{store-VURW3NE7.js → store-OLBLTQPT.js} +44 -13
- package/dist/bundle/{store-PYAP6NYK.js → store-QA6QJ5BB.js} +20 -11
- package/dist/bundle/store-maintenance-command-LB6CMGP4.js +55 -0
- package/dist/commands/send.d.ts +1 -0
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +10 -2
- package/dist/commands/send.js.map +1 -1
- package/dist/mail/compose.d.ts +2 -0
- package/dist/mail/compose.d.ts.map +1 -1
- package/dist/mail/compose.js +1 -0
- package/dist/mail/compose.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/skills/mail-cli/SKILL.md +2 -1
- package/dist/bundle/chunk-IRY3ZFPW.js +0 -656
- package/dist/bundle/first-screen-R3LHPHU3.js +0 -32
- package/dist/bundle/server-JBV7NTAA.js +0 -64
- package/dist/bundle/store-maintenance-command-EHWGMBEA.js +0 -54
|
@@ -23,16 +23,20 @@ import {
|
|
|
23
23
|
tagMemberIds,
|
|
24
24
|
thingOf,
|
|
25
25
|
write
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-KMQAHDBM.js";
|
|
27
27
|
import {
|
|
28
|
+
ADDED_PROVIDER,
|
|
28
29
|
filesAccountSql,
|
|
29
30
|
folderProviderOf,
|
|
30
31
|
folderProviderSql,
|
|
31
32
|
isDocumentAccountProvider
|
|
32
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-LTXYJAJK.js";
|
|
34
|
+
import {
|
|
35
|
+
damagedFile
|
|
36
|
+
} from "./chunk-SYEICLTR.js";
|
|
33
37
|
import {
|
|
34
38
|
fold
|
|
35
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-VINSQR4X.js";
|
|
36
40
|
import {
|
|
37
41
|
CliError
|
|
38
42
|
} from "./chunk-DALBYUPC.js";
|
|
@@ -40,13 +44,14 @@ import {
|
|
|
40
44
|
__name
|
|
41
45
|
} from "./chunk-ZVVMGPBJ.js";
|
|
42
46
|
|
|
43
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
47
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/damage.js
|
|
44
48
|
var DERIVED = /* @__PURE__ */ new Set(["mentions", "involvements", "embeddings"]);
|
|
45
49
|
var named = /* @__PURE__ */ __name((tables) => tables.length <= 5 ? tables.join(", ") : `${tables.slice(0, 5).join(", ")} and ${tables.length - 5} more`, "named");
|
|
46
50
|
var isDerivedTable = /* @__PURE__ */ __name((table, searchIndexes) => DERIVED.has(table) || table.startsWith("vector_index_") || searchIndexes.some((index) => table === index || table.startsWith(`${index}_`)), "isDerivedTable");
|
|
47
51
|
var WIRECAT_UNITS = ["memo-*", "mail-*", "tg-*", "max-*", "wirecat-*"];
|
|
48
|
-
var
|
|
49
|
-
|
|
52
|
+
var seen = /* @__PURE__ */ __name((mark) => `\`${mark.command}\` found the store damaged at ${mark.at} (${mark.error})`, "seen");
|
|
53
|
+
var explainDamage = /* @__PURE__ */ __name((health, command, mark = null) => {
|
|
54
|
+
if (health.ok && !mark)
|
|
50
55
|
return null;
|
|
51
56
|
const indexNames = (health.searchIndexes ?? []).map((index) => index.name);
|
|
52
57
|
const badIndexes = (health.searchIndexes ?? []).filter((index) => !index.ok).map((index) => index.name);
|
|
@@ -55,12 +60,13 @@ var explainDamage = /* @__PURE__ */ __name((health, command) => {
|
|
|
55
60
|
const derived = [.../* @__PURE__ */ new Set([...tables.filter((table) => isDerivedTable(table, indexNames)), ...badIndexes])];
|
|
56
61
|
const unopened = health.error !== void 0;
|
|
57
62
|
const json = (health.invalidJson ?? []).map(({ table, column }) => `${table}.${column}`);
|
|
58
|
-
const
|
|
63
|
+
const checked = health.ok ? `${seen(mark)}; the quick check reads too little to see it, and a deep check that passes clears it` : unopened ? `the store file cannot be opened: ${health.error}` : health.checked === "quick" ? "the store file's header or schema is damaged" : `the store file is damaged: ${health.problems ?? 0} problems` + (sources.length ? ` in the data of ${named(sources)}` : "") + (derived.length ? `${sources.length ? ", and" : " in"} the search data of ${named(derived)}` : "") + (json.length ? `; values that are not valid JSON in ${named(json)}` : "");
|
|
64
|
+
const what = mark && !health.ok ? `${checked}; ${seen(mark)}` : checked;
|
|
59
65
|
const impact = [
|
|
60
66
|
...sources.length ? [`some rows of ${named(sources)} cannot be read; a recovery keeps every row it can read and names the rest`] : [],
|
|
61
67
|
...derived.length ? [`searches may miss results or fail; ${named(derived)} hold nothing that is not elsewhere, and are rebuilt`] : [],
|
|
62
68
|
...json.length ? [`a read of a row with a broken JSON value fails ("malformed JSON"); a recovery clears those values`] : [],
|
|
63
|
-
"reads that do not touch a damaged page work; a write that touches one fails until the store is recovered"
|
|
69
|
+
mark ? "reads that do not touch a damaged page work; every command that writes the store refuses until it is recovered" : "reads that do not touch a damaged page work; a write that touches one fails until the store is recovered"
|
|
64
70
|
];
|
|
65
71
|
return {
|
|
66
72
|
what,
|
|
@@ -73,7 +79,7 @@ var explainDamage = /* @__PURE__ */ __name((health, command) => {
|
|
|
73
79
|
`journalctl --user ${WIRECAT_UNITS.map((unit) => `-u '${unit}'`).join(" ")} --since -14d | grep -i -e malformed -e corrupt -e 'disk full'`,
|
|
74
80
|
"journalctl -k --since -14d | grep -i -e 'I/O error' -e nvme -e ata",
|
|
75
81
|
`df -h ${health.path.replace(/\/[^/]*$/, "")}`,
|
|
76
|
-
...health.checked === "quick" ? [`${command} store recover`] : []
|
|
82
|
+
...health.checked === "quick" || health.ok ? [`${command} store recover`] : []
|
|
77
83
|
],
|
|
78
84
|
impact,
|
|
79
85
|
externalUnaffected: "only this computer's copy is damaged: Telegram, MAX, the mail servers and Google Drive keep their own data, so whatever is lost here can be fetched again by a sync",
|
|
@@ -85,11 +91,11 @@ var explainDamage = /* @__PURE__ */ __name((health, command) => {
|
|
|
85
91
|
};
|
|
86
92
|
}, "explainDamage");
|
|
87
93
|
|
|
88
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
94
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/document-transfer/index.js
|
|
89
95
|
import { realpathSync, statSync } from "node:fs";
|
|
90
96
|
import { resolve } from "node:path";
|
|
91
97
|
|
|
92
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
98
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/people.js
|
|
93
99
|
var planPeople = /* @__PURE__ */ __name((database, snapshot, mappings, bindings, conflicts) => {
|
|
94
100
|
const creatable = /* @__PURE__ */ new Set();
|
|
95
101
|
let people = 0, identities = 0;
|
|
@@ -152,11 +158,11 @@ var copyPeople = /* @__PURE__ */ __name((database, snapshot, mappings, now) => {
|
|
|
152
158
|
}
|
|
153
159
|
}, "copyPeople");
|
|
154
160
|
|
|
155
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
161
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/document-transfer/digest.js
|
|
156
162
|
import { createHash } from "node:crypto";
|
|
157
163
|
var digest = /* @__PURE__ */ __name((value) => createHash("sha256").update(JSON.stringify(value)).digest("hex"), "digest");
|
|
158
164
|
|
|
159
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
165
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/collection.js
|
|
160
166
|
var documentsKeyOf = /* @__PURE__ */ __name((collection) => {
|
|
161
167
|
const colon = collection.indexOf(":");
|
|
162
168
|
const provider = collection.slice(0, colon);
|
|
@@ -200,7 +206,7 @@ var currentCollection = /* @__PURE__ */ __name((row) => {
|
|
|
200
206
|
};
|
|
201
207
|
}, "currentCollection");
|
|
202
208
|
|
|
203
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
209
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/plan.js
|
|
204
210
|
var planTransfer = /* @__PURE__ */ __name((database, snapshot, sourceKey, bindings) => {
|
|
205
211
|
const mappings = /* @__PURE__ */ new Map();
|
|
206
212
|
const missing = /* @__PURE__ */ new Set(), conflicts = /* @__PURE__ */ new Set();
|
|
@@ -367,7 +373,7 @@ var planTransfer = /* @__PURE__ */ __name((database, snapshot, sourceKey, bindin
|
|
|
367
373
|
};
|
|
368
374
|
}, "planTransfer");
|
|
369
375
|
|
|
370
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
376
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/snapshot.js
|
|
371
377
|
var TRANSFER_TABLES = { document: "documents", note: "notes", memory: "memories", fact: "facts" };
|
|
372
378
|
var MAX_ENTITIES = 1e3;
|
|
373
379
|
var MAX_AUXILIARY = 1e4;
|
|
@@ -509,7 +515,7 @@ var transferSnapshot = /* @__PURE__ */ __name((database, collection) => read(dat
|
|
|
509
515
|
item.bot = { name: String(bot.name), kind: String(bot.kind) };
|
|
510
516
|
}
|
|
511
517
|
if (thing.type === "document") {
|
|
512
|
-
const doc = database.prepare(`SELECT a.provider,a.external_id AS account,a.name,d.external_id,d.body,d.content_hash,d.deleted_at FROM documents d JOIN accounts a ON a.id=d.account_id WHERE d.id=? AND ${filesAccountSql("a.provider")}`).get(thing.id);
|
|
518
|
+
const doc = database.prepare(`SELECT a.provider,a.external_id AS account,a.name,d.external_id,d.body,d.content_hash,d.deleted_at FROM documents d JOIN accounts a ON a.id=d.account_id WHERE d.id=? AND ${filesAccountSql("a.provider")} AND a.provider<>'${ADDED_PROVIDER}'`).get(thing.id);
|
|
513
519
|
if (doc) {
|
|
514
520
|
item.collection = collectionNameOf({ provider: doc.provider, external_id: doc.account, name: doc.name });
|
|
515
521
|
item.external_id = String(doc.external_id);
|
|
@@ -529,7 +535,7 @@ var transferSnapshot = /* @__PURE__ */ __name((database, collection) => read(dat
|
|
|
529
535
|
};
|
|
530
536
|
}), "transferSnapshot");
|
|
531
537
|
|
|
532
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
538
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/apply.js
|
|
533
539
|
var providerHere = /* @__PURE__ */ __name(({ provider, name, settings }) => {
|
|
534
540
|
if (provider !== "folder" || String(name ?? "").startsWith("google-drive:"))
|
|
535
541
|
return provider ?? null;
|
|
@@ -701,7 +707,7 @@ var remapEntity = /* @__PURE__ */ __name((database, entity, id, mappings) => {
|
|
|
701
707
|
database.prepare(`UPDATE ${TRANSFER_TABLES[entity.kind]} SET ${columns.join(",")} WHERE id=?`).run(...values, id);
|
|
702
708
|
}, "remapEntity");
|
|
703
709
|
|
|
704
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
710
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/document-transfer/index.js
|
|
705
711
|
var locations = /* @__PURE__ */ __name((options) => {
|
|
706
712
|
for (const value of [options.source, options.destination, options.collection])
|
|
707
713
|
if (typeof value !== "string" || !value.trim())
|
|
@@ -754,6 +760,9 @@ var openPreviewTarget = /* @__PURE__ */ __name(async (path) => {
|
|
|
754
760
|
}, "openPreviewTarget");
|
|
755
761
|
var previewDocumentTransfer = /* @__PURE__ */ __name(async (options) => {
|
|
756
762
|
const location = locations(options);
|
|
763
|
+
return damagedFile([location.source, location.destination], () => previewWith(location, options));
|
|
764
|
+
}, "previewDocumentTransfer");
|
|
765
|
+
var previewWith = /* @__PURE__ */ __name(async (location, options) => {
|
|
757
766
|
const source = await openSource(location.source);
|
|
758
767
|
try {
|
|
759
768
|
const target = await openPreviewTarget(location.destination);
|
|
@@ -765,11 +774,14 @@ var previewDocumentTransfer = /* @__PURE__ */ __name(async (options) => {
|
|
|
765
774
|
} finally {
|
|
766
775
|
source.database.close();
|
|
767
776
|
}
|
|
768
|
-
}, "
|
|
777
|
+
}, "previewWith");
|
|
769
778
|
var applyDocumentTransfer = /* @__PURE__ */ __name(async (options) => {
|
|
770
779
|
if (!/^[a-f0-9]{64}$/.test(options.expected_fingerprint))
|
|
771
780
|
throw new CliError("validation_error", "apply requires the fingerprint returned by a transfer preview");
|
|
772
781
|
const location = locations(options);
|
|
782
|
+
return damagedFile([location.source, location.destination], () => applyWith(location, options));
|
|
783
|
+
}, "applyDocumentTransfer");
|
|
784
|
+
var applyWith = /* @__PURE__ */ __name(async (location, options) => {
|
|
773
785
|
const source = await openSource(location.source);
|
|
774
786
|
try {
|
|
775
787
|
const snapshot = transferSnapshot(source.database, options.collection);
|
|
@@ -795,9 +807,9 @@ var applyDocumentTransfer = /* @__PURE__ */ __name(async (options) => {
|
|
|
795
807
|
} finally {
|
|
796
808
|
source.database.close();
|
|
797
809
|
}
|
|
798
|
-
}, "
|
|
810
|
+
}, "applyWith");
|
|
799
811
|
|
|
800
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
812
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/health.js
|
|
801
813
|
import { existsSync, statSync as statSync2 } from "node:fs";
|
|
802
814
|
var JSON_COLUMNS = {
|
|
803
815
|
accounts: ["settings"],
|
|
@@ -939,7 +951,7 @@ var storeHealth = /* @__PURE__ */ __name(async (path, { deep = false } = {}) =>
|
|
|
939
951
|
}
|
|
940
952
|
}, "storeHealth");
|
|
941
953
|
|
|
942
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
954
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/project-transfer/preview.js
|
|
943
955
|
var previewProjectAnnotationSnapshot = /* @__PURE__ */ __name(async (options) => {
|
|
944
956
|
if (!options || typeof options !== "object" || Array.isArray(options))
|
|
945
957
|
throw new CliError("validation_error", "project preview options are required");
|
|
@@ -953,15 +965,19 @@ var previewProjectAnnotationSnapshot = /* @__PURE__ */ __name(async (options) =>
|
|
|
953
965
|
if (typeof options.project !== "string" || !/^project:[1-9]\d*$/.test(options.project) || !Number.isSafeInteger(Number(options.project.slice(8))))
|
|
954
966
|
throw new CliError("validation_error", "project preview project is a project:<safe integer id> reference");
|
|
955
967
|
const budget = new SnapshotBudget(options.maxReadBytes ?? 4 * 1024 * 1024);
|
|
956
|
-
const
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
968
|
+
const target = options.target;
|
|
969
|
+
const project2 = options.project;
|
|
970
|
+
return damagedFile([target], async () => {
|
|
971
|
+
const context = await openStoreContext({ path: target, env: options.env, readOnly: true });
|
|
972
|
+
try {
|
|
973
|
+
return previewAnnotationSnapshot(context.database, Number(project2.slice(8)), snapshot, options.bindings, budget);
|
|
974
|
+
} finally {
|
|
975
|
+
context.database.close();
|
|
976
|
+
}
|
|
977
|
+
});
|
|
962
978
|
}, "previewProjectAnnotationSnapshot");
|
|
963
979
|
|
|
964
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
980
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot.js
|
|
965
981
|
var snapshotProjectAnnotations = /* @__PURE__ */ __name(async (options) => {
|
|
966
982
|
if (!options || typeof options !== "object" || Array.isArray(options))
|
|
967
983
|
throw new CliError("validation_error", "snapshot options are required");
|
|
@@ -5,15 +5,15 @@ import {
|
|
|
5
5
|
readLock,
|
|
6
6
|
releaseLock,
|
|
7
7
|
takeLock
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-VQZCIDSO.js";
|
|
9
9
|
import {
|
|
10
10
|
__name
|
|
11
11
|
} from "./chunk-ZVVMGPBJ.js";
|
|
12
12
|
|
|
13
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/mcp/http/state.js
|
|
14
14
|
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
|
|
15
15
|
|
|
16
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/mcp/http/activity.js
|
|
17
17
|
import { randomBytes } from "node:crypto";
|
|
18
18
|
import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
19
19
|
import { dirname } from "node:path";
|
|
@@ -86,7 +86,7 @@ var activityRecorder = /* @__PURE__ */ __name((path, now = Date.now) => {
|
|
|
86
86
|
};
|
|
87
87
|
}, "activityRecorder");
|
|
88
88
|
|
|
89
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
89
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/mcp/http/state.js
|
|
90
90
|
var ACCESS_SECONDS = 60 * 60;
|
|
91
91
|
var REFRESH_SECONDS = 30 * 24 * 60 * 60;
|
|
92
92
|
var readStored = /* @__PURE__ */ __name((path) => existsSync2(path) ? JSON.parse(readFileSync2(path, "utf8")) : { clients: [], tokens: [] }, "readStored");
|
|
@@ -2,13 +2,15 @@ import { createRequire as __bundleRequire } from "node:module";
|
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
LEVELS
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-HRRSTIGP.js";
|
|
6
6
|
import {
|
|
7
|
+
WORD_BODY,
|
|
7
8
|
looksLikeReference,
|
|
8
9
|
parseReference,
|
|
9
10
|
providerLabel,
|
|
10
|
-
providerNamed
|
|
11
|
-
|
|
11
|
+
providerNamed,
|
|
12
|
+
typedPhone
|
|
13
|
+
} from "./chunk-LTXYJAJK.js";
|
|
12
14
|
import {
|
|
13
15
|
resolvePaths,
|
|
14
16
|
writeSecurely
|
|
@@ -41,7 +43,7 @@ import {
|
|
|
41
43
|
__name
|
|
42
44
|
} from "./chunk-ZVVMGPBJ.js";
|
|
43
45
|
|
|
44
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
46
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/domain/ref-arguments.js
|
|
45
47
|
var TAKES = {
|
|
46
48
|
chat: "a chat: chat:<provider>/<account>/<chat>, its id or its title",
|
|
47
49
|
message: "a message: msg:<provider>/<account>/<chat>/<message>, or a chat and the message's id"
|
|
@@ -101,7 +103,7 @@ var ensureAccount = /* @__PURE__ */ __name(async (reference, scope, profilesOn)
|
|
|
101
103
|
throw wrongAccount(reference, scope, profiles);
|
|
102
104
|
}, "ensureAccount");
|
|
103
105
|
|
|
104
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
106
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/resolve.js
|
|
105
107
|
var isId = /* @__PURE__ */ __name((reference) => /^-?\d+$/.test(reference.trim()), "isId");
|
|
106
108
|
var foldName = /* @__PURE__ */ __name((name) => name.normalize("NFC").replace(/[\uFE0E\uFE0F\u200D]/g, "").toLowerCase().replaceAll("\u0451", "\u0435"), "foldName");
|
|
107
109
|
var pickChat = /* @__PURE__ */ __name((reference, chats) => {
|
|
@@ -146,7 +148,244 @@ ${lines}`, { candidates });
|
|
|
146
148
|
}, "ambiguous");
|
|
147
149
|
var isPresent = /* @__PURE__ */ __name((value) => value !== null && value !== void 0, "isPresent");
|
|
148
150
|
|
|
149
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
151
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/domain/vcard.js
|
|
152
|
+
import { createHash } from "node:crypto";
|
|
153
|
+
var MAX_ID = 512;
|
|
154
|
+
var AS_WORD = new RegExp(`^${WORD_BODY}$`);
|
|
155
|
+
var isVcard = /* @__PURE__ */ __name((text) => /^?\s*BEGIN:VCARD\b/i.test(text), "isVcard");
|
|
156
|
+
var isQuotedPrintable = /* @__PURE__ */ __name((line) => {
|
|
157
|
+
const colon = line.indexOf(":");
|
|
158
|
+
return /;(ENCODING=)?QUOTED-PRINTABLE\b/i.test(colon < 0 ? line : line.slice(0, colon));
|
|
159
|
+
}, "isQuotedPrintable");
|
|
160
|
+
var PROPERTY_START = /^([A-Za-z0-9-]+\.)?[A-Za-z][A-Za-z0-9-]*(;[^:]*)?:/;
|
|
161
|
+
var isSoft = /* @__PURE__ */ __name((line) => line !== void 0 && isQuotedPrintable(line) && line.endsWith("="), "isSoft");
|
|
162
|
+
var unfolded = /* @__PURE__ */ __name((text) => {
|
|
163
|
+
const lines = [];
|
|
164
|
+
for (const raw of text.replace(/^\uFEFF/, "").split(/\r\n|\r|\n/)) {
|
|
165
|
+
const last2 = lines.length - 1;
|
|
166
|
+
const previous = lines[last2];
|
|
167
|
+
const bounds = /^(BEGIN|END):/i.test(raw);
|
|
168
|
+
if (isSoft(previous) && !bounds && !PROPERTY_START.test(raw))
|
|
169
|
+
lines[last2] = previous.slice(0, -1) + raw.replace(/^[ \t]/, "");
|
|
170
|
+
else if (previous !== void 0 && /^[ \t]/.test(raw) && !bounds)
|
|
171
|
+
lines[last2] = previous + raw.slice(1);
|
|
172
|
+
else {
|
|
173
|
+
if (isSoft(previous))
|
|
174
|
+
lines[last2] = previous.slice(0, -1);
|
|
175
|
+
lines.push(raw);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
const last = lines.length - 1;
|
|
179
|
+
if (isSoft(lines[last]))
|
|
180
|
+
lines[last] = lines[last].slice(0, -1);
|
|
181
|
+
return lines.filter((line) => line.trim() !== "");
|
|
182
|
+
}, "unfolded");
|
|
183
|
+
var propertyOf = /* @__PURE__ */ __name((line) => {
|
|
184
|
+
let quoted = false;
|
|
185
|
+
let colon = -1;
|
|
186
|
+
for (let index = 0; index < line.length; index += 1) {
|
|
187
|
+
if (line[index] === '"')
|
|
188
|
+
quoted = !quoted;
|
|
189
|
+
else if (line[index] === ":" && !quoted) {
|
|
190
|
+
colon = index;
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (colon < 0)
|
|
195
|
+
return void 0;
|
|
196
|
+
const [head = "", ...rest] = line.slice(0, colon).split(";");
|
|
197
|
+
const params = /* @__PURE__ */ new Map();
|
|
198
|
+
for (const part of rest) {
|
|
199
|
+
const equals = part.indexOf("=");
|
|
200
|
+
const key = equals < 0 ? /^(QUOTED-PRINTABLE|BASE64|8BIT|7BIT|B)$/i.test(part) ? "ENCODING" : "TYPE" : part.slice(0, equals);
|
|
201
|
+
const values = (equals < 0 ? part : part.slice(equals + 1)).replaceAll('"', "").split(",");
|
|
202
|
+
params.set(key.toUpperCase(), [...params.get(key.toUpperCase()) ?? [], ...values.map((one) => one.toUpperCase())]);
|
|
203
|
+
}
|
|
204
|
+
const name = head.replace(/^[^.]*\./, "").toUpperCase();
|
|
205
|
+
return { name, params, value: line.slice(colon + 1) };
|
|
206
|
+
}, "propertyOf");
|
|
207
|
+
var encoder = new TextEncoder();
|
|
208
|
+
var decoded = /* @__PURE__ */ __name((property, report) => {
|
|
209
|
+
const encoding = property.params.get("ENCODING")?.[0];
|
|
210
|
+
if (encoding !== "QUOTED-PRINTABLE")
|
|
211
|
+
return property.value;
|
|
212
|
+
const bytes = [];
|
|
213
|
+
const { value } = property;
|
|
214
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
215
|
+
const hex = value.slice(index + 1, index + 3);
|
|
216
|
+
if (value[index] === "=" && /^[0-9A-F]{2}$/i.test(hex)) {
|
|
217
|
+
bytes.push(Number.parseInt(hex, 16));
|
|
218
|
+
index += 2;
|
|
219
|
+
} else
|
|
220
|
+
for (const byte of encoder.encode(value[index]))
|
|
221
|
+
bytes.push(byte);
|
|
222
|
+
}
|
|
223
|
+
const charset = property.params.get("CHARSET")?.[0]?.toLowerCase() ?? "utf-8";
|
|
224
|
+
try {
|
|
225
|
+
return new TextDecoder(charset).decode(new Uint8Array(bytes));
|
|
226
|
+
} catch {
|
|
227
|
+
report(`${property.name} names the unknown charset ${charset}: read as UTF-8`);
|
|
228
|
+
return new TextDecoder("utf-8").decode(new Uint8Array(bytes));
|
|
229
|
+
}
|
|
230
|
+
}, "decoded");
|
|
231
|
+
var components = /* @__PURE__ */ __name((value) => {
|
|
232
|
+
const parts = [""];
|
|
233
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
234
|
+
const char = value[index];
|
|
235
|
+
if (char === "\\" && index + 1 < value.length) {
|
|
236
|
+
const next = value[index + 1];
|
|
237
|
+
parts[parts.length - 1] += next === "n" || next === "N" ? "\n" : next;
|
|
238
|
+
index += 1;
|
|
239
|
+
} else if (char === ";")
|
|
240
|
+
parts.push("");
|
|
241
|
+
else
|
|
242
|
+
parts[parts.length - 1] += char;
|
|
243
|
+
}
|
|
244
|
+
return parts.map((part) => part.trim());
|
|
245
|
+
}, "components");
|
|
246
|
+
var textOf = /* @__PURE__ */ __name((property, report) => components(decoded(property, report)).join(";").trim(), "textOf");
|
|
247
|
+
var e164 = /* @__PURE__ */ __name((typed, region) => {
|
|
248
|
+
const text = typed.replace(/^tel:/i, "").replace(/;.*$/, "").trim();
|
|
249
|
+
const international = /^(\+|00)/.test(text);
|
|
250
|
+
if (!international && region === void 0)
|
|
251
|
+
return void 0;
|
|
252
|
+
const value = typedPhone(text, region === void 0 ? {} : { phoneCountries: [region] })?.value;
|
|
253
|
+
return value?.startsWith("+") ? value : void 0;
|
|
254
|
+
}, "e164");
|
|
255
|
+
var foldedName = /* @__PURE__ */ __name((name) => name.normalize("NFKC").toLowerCase().replace(/\s+/g, " ").trim(), "foldedName");
|
|
256
|
+
var hashed = /* @__PURE__ */ __name((prefix, parts) => `${prefix}${createHash("sha256").update(parts.join("\n")).digest("hex").slice(0, 32)}`, "hashed");
|
|
257
|
+
var organizationId = /* @__PURE__ */ __name((name) => {
|
|
258
|
+
const id = `org:${foldedName(name)}`;
|
|
259
|
+
return id.length <= MAX_ID ? id : hashed("org:", [foldedName(name)]);
|
|
260
|
+
}, "organizationId");
|
|
261
|
+
var titleWord = /* @__PURE__ */ __name((title) => {
|
|
262
|
+
const word = title.toLowerCase().trim().replace(/\s+/g, "-");
|
|
263
|
+
return AS_WORD.test(word) ? word : void 0;
|
|
264
|
+
}, "titleWord");
|
|
265
|
+
var nameOf = /* @__PURE__ */ __name((properties, report) => {
|
|
266
|
+
const full = properties.find(({ name }) => name === "FN");
|
|
267
|
+
const text = full ? textOf(full, report) : "";
|
|
268
|
+
if (text)
|
|
269
|
+
return text;
|
|
270
|
+
const structured = properties.find(({ name }) => name === "N");
|
|
271
|
+
if (!structured)
|
|
272
|
+
return void 0;
|
|
273
|
+
const [family = "", given = "", additional = ""] = components(decoded(structured, report));
|
|
274
|
+
return [given, additional, family].filter(Boolean).join(" ") || void 0;
|
|
275
|
+
}, "nameOf");
|
|
276
|
+
var SKIPPED = /* @__PURE__ */ new Set(["PHOTO", "LOGO", "SOUND", "KEY"]);
|
|
277
|
+
var cardsOf = /* @__PURE__ */ __name((text) => {
|
|
278
|
+
const cards = [];
|
|
279
|
+
const issues = [];
|
|
280
|
+
let card;
|
|
281
|
+
const isBound = /* @__PURE__ */ __name((property, name) => property.name === name && property.value.trim().toUpperCase() === "VCARD", "isBound");
|
|
282
|
+
for (const line of unfolded(text)) {
|
|
283
|
+
const property = propertyOf(line);
|
|
284
|
+
if (!property)
|
|
285
|
+
continue;
|
|
286
|
+
if (isBound(property, "BEGIN")) {
|
|
287
|
+
if (card) {
|
|
288
|
+
issues.push({ card: cards.length, message: "BEGIN:VCARD inside a card: the card ends there, unfinished" });
|
|
289
|
+
cards.push(card);
|
|
290
|
+
}
|
|
291
|
+
card = [];
|
|
292
|
+
} else if (isBound(property, "END")) {
|
|
293
|
+
if (card)
|
|
294
|
+
cards.push(card);
|
|
295
|
+
card = void 0;
|
|
296
|
+
} else if (card && !SKIPPED.has(property.name))
|
|
297
|
+
card.push(property);
|
|
298
|
+
}
|
|
299
|
+
if (card) {
|
|
300
|
+
issues.push({ card: cards.length, message: "the file ends inside a card, with no END:VCARD" });
|
|
301
|
+
cards.push(card);
|
|
302
|
+
}
|
|
303
|
+
return { cards, issues };
|
|
304
|
+
}, "cardsOf");
|
|
305
|
+
var envelopeOfVcard = /* @__PURE__ */ __name((text, { provider, account, batchId, region }) => {
|
|
306
|
+
const { cards, issues } = cardsOf(text);
|
|
307
|
+
const people = [];
|
|
308
|
+
const organizations = /* @__PURE__ */ new Map();
|
|
309
|
+
const seen = /* @__PURE__ */ new Set();
|
|
310
|
+
for (const [index, properties] of cards.entries()) {
|
|
311
|
+
const report = /* @__PURE__ */ __name((message) => {
|
|
312
|
+
if (!issues.some((one) => one.card === index && one.message === message))
|
|
313
|
+
issues.push({ card: index, message });
|
|
314
|
+
}, "report");
|
|
315
|
+
const values = /* @__PURE__ */ __name((wanted) => properties.filter(({ name: name2 }) => name2 === wanted).map((one) => textOf(one, report)).filter(Boolean), "values");
|
|
316
|
+
const name = nameOf(properties, report);
|
|
317
|
+
const phones = [];
|
|
318
|
+
const unread = [];
|
|
319
|
+
for (const typed of values("TEL")) {
|
|
320
|
+
const value = e164(typed, region);
|
|
321
|
+
if (value !== void 0) {
|
|
322
|
+
if (!phones.includes(value))
|
|
323
|
+
phones.push(value);
|
|
324
|
+
} else {
|
|
325
|
+
unread.push(typed);
|
|
326
|
+
issues.push({
|
|
327
|
+
card: index,
|
|
328
|
+
message: `${typed} has no country code${region === void 0 ? " and no region was given" : ` in ${region}`}: kept, not matched`
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
const emails = [...new Set(values("EMAIL").map((one) => one.replace(/^mailto:/i, "").toLowerCase()))];
|
|
333
|
+
if (name === void 0 && phones.length === 0 && unread.length === 0 && emails.length === 0) {
|
|
334
|
+
report("the card holds no name, number or address: left out");
|
|
335
|
+
continue;
|
|
336
|
+
}
|
|
337
|
+
const uid = values("UID")[0];
|
|
338
|
+
const externalId = uid === void 0 ? hashed("vcard:", [name ?? "", ...[...phones].sort(), ...emails.sort()]) : uid.length <= MAX_ID ? uid : hashed("vcard:", [uid]);
|
|
339
|
+
if (seen.has(externalId)) {
|
|
340
|
+
issues.push({ card: index, message: `another card of the file is ${externalId}: left out` });
|
|
341
|
+
continue;
|
|
342
|
+
}
|
|
343
|
+
seen.add(externalId);
|
|
344
|
+
const organization = properties.find(({ name: name2 }) => name2 === "ORG");
|
|
345
|
+
const organizationName = organization ? components(decoded(organization, report))[0] : void 0;
|
|
346
|
+
const title = values("TITLE")[0];
|
|
347
|
+
const relations = [];
|
|
348
|
+
if (organizationName) {
|
|
349
|
+
const id = organizationId(organizationName);
|
|
350
|
+
if (!organizations.has(id))
|
|
351
|
+
organizations.set(id, {
|
|
352
|
+
key: id,
|
|
353
|
+
type: "organization",
|
|
354
|
+
external_id: id,
|
|
355
|
+
operation: "upsert",
|
|
356
|
+
fields: { name: organizationName }
|
|
357
|
+
});
|
|
358
|
+
const as = title === void 0 ? void 0 : titleWord(title);
|
|
359
|
+
relations.push({ role: "member-of", type: "organization", external_id: id, ...as ? { as } : {} });
|
|
360
|
+
}
|
|
361
|
+
people.push({
|
|
362
|
+
key: `person:${externalId}`,
|
|
363
|
+
type: "person",
|
|
364
|
+
external_id: externalId,
|
|
365
|
+
operation: "upsert",
|
|
366
|
+
fields: {
|
|
367
|
+
...name === void 0 ? {} : { name },
|
|
368
|
+
...phones.length ? { phone: phones } : {},
|
|
369
|
+
...emails.length ? { email: emails } : {},
|
|
370
|
+
...unread.length ? { phone_unread: unread } : {},
|
|
371
|
+
...organizationName ? { organization: organizationName } : {},
|
|
372
|
+
...title === void 0 ? {} : { title }
|
|
373
|
+
},
|
|
374
|
+
...relations.length ? { relations } : {}
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
return {
|
|
378
|
+
envelope: {
|
|
379
|
+
schema_version: 1,
|
|
380
|
+
source: { provider, account, batch_id: batchId },
|
|
381
|
+
...region === void 0 ? {} : { options: { phone_region: region } },
|
|
382
|
+
records: [...organizations.values(), ...people]
|
|
383
|
+
},
|
|
384
|
+
issues
|
|
385
|
+
};
|
|
386
|
+
}, "envelopeOfVcard");
|
|
387
|
+
|
|
388
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/domain/formatting.js
|
|
150
389
|
var invalid = /* @__PURE__ */ __name(() => new CliError("validation_error", "the messenger formatter returned invalid text spans"), "invalid");
|
|
151
390
|
var validateFormattedText = /* @__PURE__ */ __name((formatted) => {
|
|
152
391
|
const { text, spans } = formatted;
|
|
@@ -206,7 +445,7 @@ var visibleFormattedText = /* @__PURE__ */ __name((formatted) => {
|
|
|
206
445
|
};
|
|
207
446
|
}, "visibleFormattedText");
|
|
208
447
|
|
|
209
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
448
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/moderation/check.js
|
|
210
449
|
var INVITE = /max\.ru\/join\/|(t|telegram)\.me\/(\+|joinchat\/)|tg:\/\/join/i;
|
|
211
450
|
var LINK = /https?:\/\/\S+/i;
|
|
212
451
|
var STRENGTH = { report: 0, delete: 1, remove: 2 };
|
|
@@ -394,7 +633,7 @@ var nextPoint = /* @__PURE__ */ __name((rows, found) => {
|
|
|
394
633
|
}, "nextPoint");
|
|
395
634
|
var someUndone = /* @__PURE__ */ __name((rows) => rows.some(undone), "someUndone");
|
|
396
635
|
|
|
397
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
636
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/moderation/rules.js
|
|
398
637
|
import { existsSync, readFileSync } from "node:fs";
|
|
399
638
|
import { join } from "node:path";
|
|
400
639
|
var RULE_ACTIONS = ["report", "delete", "remove"];
|
|
@@ -545,6 +784,8 @@ export {
|
|
|
545
784
|
foldName,
|
|
546
785
|
pickChat,
|
|
547
786
|
pickPerson,
|
|
787
|
+
isVcard,
|
|
788
|
+
envelopeOfVcard,
|
|
548
789
|
validateFormattedText,
|
|
549
790
|
visibleFormattedText,
|
|
550
791
|
judge,
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
CliError,
|
|
5
|
+
errorCodes
|
|
6
|
+
} from "./chunk-DALBYUPC.js";
|
|
7
|
+
import {
|
|
8
|
+
__name
|
|
9
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
10
|
+
|
|
11
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/errors/failures.js
|
|
12
|
+
var isCliFailure = /* @__PURE__ */ __name((value) => value instanceof Error && value.name === "CliError" && errorCodes.includes(value.code), "isCliFailure");
|
|
13
|
+
var isCommanderFailure = /* @__PURE__ */ __name((value) => {
|
|
14
|
+
const { code, exitCode } = value ?? {};
|
|
15
|
+
return value instanceof Error && typeof code === "string" && code.startsWith("commander.") && typeof exitCode === "number";
|
|
16
|
+
}, "isCommanderFailure");
|
|
17
|
+
var failureKey = /* @__PURE__ */ __name((error) => isCliFailure(error) ? error.code : error instanceof Error ? error.name : "error", "failureKey");
|
|
18
|
+
var SQLITE_CORRUPT = 11;
|
|
19
|
+
var SQLITE_NOTADB = 26;
|
|
20
|
+
var DAMAGED_TEXT = /database disk image is malformed|file is not a database|fts5: corruption/i;
|
|
21
|
+
var sqliteCode = /* @__PURE__ */ __name((error) => {
|
|
22
|
+
const { errcode, errno, name } = error ?? {};
|
|
23
|
+
const code = typeof errcode === "number" ? errcode : name === "SQLiteError" && typeof errno === "number" ? errno : null;
|
|
24
|
+
return code === null ? void 0 : code & 255;
|
|
25
|
+
}, "sqliteCode");
|
|
26
|
+
var damageIn = /* @__PURE__ */ __name((error) => {
|
|
27
|
+
if (isCliFailure(error) || isCommanderFailure(error))
|
|
28
|
+
return void 0;
|
|
29
|
+
let at = error;
|
|
30
|
+
for (let depth = 0; depth < 5 && at instanceof Error; depth += 1) {
|
|
31
|
+
const code = sqliteCode(at);
|
|
32
|
+
if (code !== void 0 && [SQLITE_CORRUPT, SQLITE_NOTADB].includes(code) || DAMAGED_TEXT.test(at.message))
|
|
33
|
+
return at;
|
|
34
|
+
at = at.cause;
|
|
35
|
+
}
|
|
36
|
+
return void 0;
|
|
37
|
+
}, "damageIn");
|
|
38
|
+
var wrapping = /* @__PURE__ */ __name((error, original) => {
|
|
39
|
+
Object.defineProperty(error, "cause", { value: original, configurable: true, writable: true });
|
|
40
|
+
if (original instanceof Error && original.stack)
|
|
41
|
+
error.stack = original.stack;
|
|
42
|
+
return error;
|
|
43
|
+
}, "wrapping");
|
|
44
|
+
var storeDamaged = /* @__PURE__ */ __name((error, next) => damageIn(error) ? wrapping(new CliError("configuration_error", `the store file is damaged${next ? `; \`${next}\` says what is damaged and what to do` : ""}`, { reason: "store.damaged" }), error) : error, "storeDamaged");
|
|
45
|
+
var damagedFile = /* @__PURE__ */ __name(async (files, work) => {
|
|
46
|
+
try {
|
|
47
|
+
return await work();
|
|
48
|
+
} catch (error) {
|
|
49
|
+
if (!damageIn(error))
|
|
50
|
+
throw error;
|
|
51
|
+
throw wrapping(new CliError("validation_error", `${files.join(" or ")} is damaged or not a database`, {
|
|
52
|
+
reason: "store.file-damaged"
|
|
53
|
+
}), error);
|
|
54
|
+
}
|
|
55
|
+
}, "damagedFile");
|
|
56
|
+
var isStoreDamage = /* @__PURE__ */ __name((error) => damageIn(error) !== void 0, "isStoreDamage");
|
|
57
|
+
|
|
58
|
+
export {
|
|
59
|
+
isCliFailure,
|
|
60
|
+
isCommanderFailure,
|
|
61
|
+
failureKey,
|
|
62
|
+
sqliteCode,
|
|
63
|
+
storeDamaged,
|
|
64
|
+
damagedFile,
|
|
65
|
+
isStoreDamage
|
|
66
|
+
};
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
__name
|
|
5
5
|
} from "./chunk-ZVVMGPBJ.js";
|
|
6
6
|
|
|
7
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
7
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.608.0_@wirecat+cli-base@0.80.7_commander@15.0.0_esbuild@0.28.2_type_2045f8d992dff370989171c93240f8d7/node_modules/@wirecat/cli-core/dist/background/processes.js
|
|
8
8
|
import { execFileSync } from "node:child_process";
|
|
9
9
|
import { readdirSync, readFileSync, readlinkSync } from "node:fs";
|
|
10
10
|
var alive = /* @__PURE__ */ __name((pid) => {
|
|
@@ -52,7 +52,7 @@ var ENTRIES = [
|
|
|
52
52
|
var REASONS = defineReasons(ENTRIES.map(([reason, code, message]) => ({ reason, code, message, details: [] })));
|
|
53
53
|
|
|
54
54
|
// dist/version.js
|
|
55
|
-
var VERSION = "0.
|
|
55
|
+
var VERSION = "0.21.0";
|
|
56
56
|
|
|
57
57
|
// dist/identity.js
|
|
58
58
|
var PACKAGE = "@wirecat/mail-cli";
|