@wirecat/zoom-cli 0.67.0 → 0.68.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/dist/answer-entities.d.ts +18 -0
- package/dist/answer-entities.d.ts.map +1 -1
- package/dist/answer-entities.js +12 -0
- package/dist/answer-entities.js.map +1 -1
- package/dist/answer-policy.d.ts.map +1 -1
- package/dist/answer-policy.js +2 -1
- package/dist/answer-policy.js.map +1 -1
- package/dist/bin/zm.js +2 -2
- package/dist/bundle/{all-profiles-SEW2VL76.js → all-profiles-R66UM3HM.js} +12 -12
- package/dist/bundle/answer-policy-UCGUO53A.js +104 -0
- package/dist/bundle/{anthropic-FSNASJML.js → anthropic-4ZI2BPLG.js} +7 -7
- package/dist/bundle/{app-server-EVSRYJ3H.js → app-server-64O5IQI5.js} +61 -58
- package/dist/bundle/{bun-DACL5SVO.js → bun-HUHQD76Z.js} +2 -2
- package/dist/bundle/{bun-sqlite-HQ2KOXSI.js → bun-sqlite-VOVHPTIF.js} +6 -6
- package/dist/bundle/{chunk-SMVO5R3T.js → chunk-2OSBCYJT.js} +39 -26
- package/dist/bundle/{chunk-TBRG2DPE.js → chunk-2T6XHWDX.js} +2 -2
- package/dist/bundle/{chunk-6AJDVJVZ.js → chunk-32FPA7P2.js} +2 -2
- package/dist/bundle/{chunk-7LLUUXJB.js → chunk-355PHJYX.js} +1 -1
- package/dist/bundle/{chunk-3GO3KME7.js → chunk-3BRV2YU2.js} +3 -3
- package/dist/bundle/{chunk-I7SOXH64.js → chunk-474WF55M.js} +53 -39
- package/dist/bundle/{chunk-L643D4RJ.js → chunk-4TLPOY22.js} +12 -12
- package/dist/bundle/{chunk-D6OXI2NV.js → chunk-4YFJYSSK.js} +205 -59
- package/dist/bundle/chunk-5JAYUG3X.js +261 -0
- package/dist/bundle/{chunk-VNIBTNV4.js → chunk-65T3PU75.js} +2 -2
- package/dist/bundle/{chunk-6TZF2JP7.js → chunk-6CJ7NHIP.js} +13 -13
- package/dist/bundle/{chunk-MWEOVTIF.js → chunk-6T3P226D.js} +4 -4
- package/dist/bundle/{chunk-EPDRF66S.js → chunk-6TJ62LZQ.js} +22 -14
- package/dist/bundle/{chunk-ZRMZBMOF.js → chunk-6XO7RTJY.js} +66 -6
- package/dist/bundle/{chunk-VFIEYRYD.js → chunk-77I67HWF.js} +8 -8
- package/dist/bundle/{chunk-QX2MAT6I.js → chunk-77KFLU5F.js} +3 -3
- package/dist/bundle/{chunk-4GCKDO2H.js → chunk-7AUP2WT3.js} +3 -3
- package/dist/bundle/{chunk-7VU5UGRR.js → chunk-7DUYFITC.js} +16 -16
- package/dist/bundle/{chunk-ASCHAVNW.js → chunk-7QNJICKZ.js} +27 -27
- package/dist/bundle/{chunk-KWRSC6O6.js → chunk-A63ZFOQJ.js} +18 -4
- package/dist/bundle/{chunk-SSXCOUP3.js → chunk-AJ7CMUGD.js} +464 -220
- package/dist/bundle/{chunk-SCFFCIIP.js → chunk-AVEIQMHZ.js} +2 -2
- package/dist/bundle/chunk-AYEVBAGO.js +178 -0
- package/dist/bundle/{chunk-AAZFLJSH.js → chunk-B6JMVB6R.js} +10 -10
- package/dist/bundle/{chunk-CRLBTNC4.js → chunk-BL36NSV5.js} +3 -3
- package/dist/bundle/{chunk-4UVT2QCO.js → chunk-BOAMDYLY.js} +4 -4
- package/dist/bundle/chunk-BSM43OMN.js +31 -0
- package/dist/bundle/{chunk-QEI55M2F.js → chunk-DGNPJGD3.js} +16 -10
- package/dist/bundle/{chunk-SOZVC3SV.js → chunk-DVA6MQWK.js} +1 -1
- package/dist/bundle/{chunk-YRNZT4GQ.js → chunk-DWSUSWAX.js} +98 -13
- package/dist/bundle/{chunk-LFQ73UFK.js → chunk-EH5QGQFR.js} +3 -3
- package/dist/bundle/{chunk-OZEYFJX2.js → chunk-EJDV5IIF.js} +1 -1
- package/dist/bundle/{chunk-VQTAU4DV.js → chunk-EWIBLDQQ.js} +8 -8
- package/dist/bundle/{chunk-4ZR5DJ26.js → chunk-EZRPSZJS.js} +3 -3
- package/dist/bundle/{chunk-KIJLM5UL.js → chunk-FBLUKCIR.js} +1 -1
- package/dist/bundle/{chunk-WZ5XK74U.js → chunk-FEM2JQN2.js} +1 -1
- package/dist/bundle/{chunk-GP4NSYDU.js → chunk-FMQS7HCC.js} +12 -12
- package/dist/bundle/{chunk-B5Z4XPVS.js → chunk-FNQASORM.js} +2 -2
- package/dist/bundle/{chunk-FWU3ZYHE.js → chunk-GOXDBCDM.js} +728 -130
- package/dist/bundle/{chunk-CLEZE65P.js → chunk-HXOAPH47.js} +1 -1
- package/dist/bundle/{chunk-7K5TDTZY.js → chunk-JO4YADNV.js} +7 -7
- package/dist/bundle/{chunk-4U2555EQ.js → chunk-JRCYFCPL.js} +30 -28
- package/dist/bundle/{chunk-L6CAUVMU.js → chunk-K67V24AT.js} +5 -5
- package/dist/bundle/{chunk-B3KWAULD.js → chunk-KAPJQGHE.js} +2 -2
- package/dist/bundle/{chunk-T6CZWSHF.js → chunk-KNE6VFHZ.js} +21 -21
- package/dist/bundle/{chunk-LM26DJOK.js → chunk-KUB2U5NT.js} +6 -6
- package/dist/bundle/{chunk-EUPZSR2G.js → chunk-L4WVLRXM.js} +4 -4
- package/dist/bundle/{chunk-BKY4XVB4.js → chunk-LBOSTBAY.js} +1248 -617
- package/dist/bundle/{chunk-C6UKW7JO.js → chunk-LV7QRR5S.js} +6 -6
- package/dist/bundle/{chunk-FGTPREAZ.js → chunk-LYWUG43B.js} +33 -33
- package/dist/bundle/{chunk-NTZDM5SJ.js → chunk-NRRI37NJ.js} +9 -9
- package/dist/bundle/{chunk-J3ZBEWQY.js → chunk-NUJMJQXV.js} +54 -147
- package/dist/bundle/{chunk-6IBM4Z3V.js → chunk-OE7EIP5L.js} +1 -1
- package/dist/bundle/{chunk-ZMPTO2WB.js → chunk-P2TISY3R.js} +1 -1
- package/dist/bundle/{chunk-KV4267S4.js → chunk-P3ASN72F.js} +1 -1
- package/dist/bundle/{chunk-V33VGWT3.js → chunk-PIHBD3YS.js} +16 -6
- package/dist/bundle/{chunk-RYKG6AEH.js → chunk-PUTGTW6W.js} +4 -2
- package/dist/bundle/{chunk-L6WUAGPN.js → chunk-QXTREL2M.js} +3 -3
- package/dist/bundle/{chunk-X67YD3QI.js → chunk-R7LFGEDE.js} +2 -2
- package/dist/bundle/{chunk-2UW533HQ.js → chunk-RGJ7OWHU.js} +4 -4
- package/dist/bundle/{chunk-LKJXTACE.js → chunk-RP3U3J53.js} +7 -7
- package/dist/bundle/{chunk-DG4DWAU7.js → chunk-RRYUD2EF.js} +3 -3
- package/dist/bundle/{chunk-Q65SDEFN.js → chunk-SRP6SFFD.js} +2 -2
- package/dist/bundle/{chunk-4KDZ22RA.js → chunk-SSPSNSC5.js} +1 -1
- package/dist/bundle/{chunk-DFUPETW7.js → chunk-TDGZMC6K.js} +130 -75
- package/dist/bundle/{chunk-EQ7XRRKV.js → chunk-TN3FH2GQ.js} +11 -11
- package/dist/bundle/chunk-TUNQ6NE2.js +64 -0
- package/dist/bundle/{chunk-FXQPK742.js → chunk-TZUKDM72.js} +29 -15
- package/dist/bundle/{chunk-IFDO3YPJ.js → chunk-UDJTRFRV.js} +1 -1
- package/dist/bundle/{chunk-ESFMHBHH.js → chunk-US5C3WAY.js} +60 -51
- package/dist/bundle/{chunk-KANH7GBB.js → chunk-UU5PLDRA.js} +2 -2
- package/dist/bundle/{chunk-OTMGAKUM.js → chunk-VLD7Y4SY.js} +7 -7
- package/dist/bundle/{chunk-YPF6OS37.js → chunk-VW6BF6M7.js} +1 -1
- package/dist/bundle/{chunk-JVCHGI7W.js → chunk-W42BJ65M.js} +1 -1
- package/dist/bundle/{chunk-RAMPYIO2.js → chunk-Y5LP5SHV.js} +11 -11
- package/dist/bundle/{chunk-WHQ4ZCJI.js → chunk-YJY3W2ZT.js} +210 -85
- package/dist/bundle/{chunk-3ZIHUSMM.js → chunk-YOAEZSDG.js} +2 -2
- package/dist/bundle/{chunk-M43MBWJX.js → chunk-YQRNFG2E.js} +13471 -1289
- package/dist/bundle/{chunk-7HAIM7GV.js → chunk-YTF2WPV4.js} +601 -443
- package/dist/bundle/{chunk-6UFWFKFH.js → chunk-ZRD3NDOX.js} +2 -2
- package/dist/bundle/{cli-YUATSOLA.js → cli-VQJ7ZRYR.js} +89 -61
- package/dist/bundle/command-contract-JPUWWYIV.js +41 -0
- package/dist/bundle/config-YGLLR77A.js +90 -0
- package/dist/bundle/{decode-IL44LNC3.js → decode-L3ENO2XH.js} +6 -6
- package/dist/bundle/{dispatch-3BGIXSJR.js → dispatch-5MGDLOK4.js} +9 -9
- package/dist/bundle/{dist-3W27UQ2S.js → dist-WQLS7U23.js} +47 -27
- package/dist/bundle/{echarts-CO4D26JF.js → echarts-5LLJ6JXC.js} +2 -2
- package/dist/bundle/{embed-XH2X4DFM.js → embed-37MYTCU7.js} +7 -7
- package/dist/bundle/{embedder-WTFWDXBJ.js → embedder-GNGHVJAO.js} +10 -10
- package/dist/bundle/{failure-HTIS3NLS.js → failure-CR64C4XA.js} +3 -3
- package/dist/bundle/{first-run-5RBH7FDO.js → first-run-NR5JKYP3.js} +12 -12
- package/dist/bundle/first-screen-RCR7ATO2.js +39 -0
- package/dist/bundle/{folders-F4DNQPIY.js → folders-VU4IN35Y.js} +5 -5
- package/dist/bundle/{instructions-EPPBL6TT.js → instructions-P72XX4AK.js} +1 -1
- package/dist/bundle/{main-LVQTCDZS.js → main-QYFCYSTW.js} +21 -23
- package/dist/bundle/{mcp-PPVOM4SE.js → mcp-M4QN2E7R.js} +2 -2
- package/dist/bundle/{meetings-BMELXRTR.js → meetings-66UQINKI.js} +13 -7
- package/dist/bundle/{node-CQVMWVIG.js → node-ZB4RNICS.js} +2 -2
- package/dist/bundle/{node-sqlite-QQEX7LZT.js → node-sqlite-XPRKBDF3.js} +7 -7
- package/dist/bundle/{oauth-AYGX7CQS.js → oauth-WJRDUU5J.js} +8 -8
- package/dist/bundle/{open-MIL2TOT6.js → open-S2YSIEOW.js} +6 -6
- package/dist/bundle/openai-CRNZFNZD.js +25 -0
- package/dist/bundle/{output-file-4XADZPYH.js → output-file-6COFGPUL.js} +6 -6
- package/dist/bundle/{process-NJVQK6GB.js → process-XNN4WG6N.js} +1 -1
- package/dist/bundle/{program-WUYRS6H7.js → program-BRPJKRCX.js} +115 -187
- package/dist/bundle/{prompt-J4QPFLEA.js → prompt-7RQOL25I.js} +6 -6
- package/dist/bundle/{recognize-OLJZVNWW.js → recognize-N5WADGQB.js} +5 -5
- package/dist/bundle/{remote-JPUXNYLV.js → remote-WHYV35IF.js} +8 -8
- package/dist/bundle/{rerank-XVV3X5TT.js → rerank-FBMZVWSH.js} +8 -8
- package/dist/bundle/{run-log-DJXBEVS5.js → run-log-TOCHREH2.js} +59 -59
- package/dist/bundle/{serve-NYYUO3MR.js → serve-4BABX4WS.js} +10 -10
- package/dist/bundle/{server-4Z5E4YTT.js → server-CDVI6LOB.js} +47 -47
- package/dist/bundle/server-XOFQKFVO.js +72 -0
- package/dist/bundle/{services-EKWM76HP.js → services-PIY33I7R.js} +43 -33
- package/dist/bundle/{speech-WFJ44ACJ.js → speech-LS5Q4FL2.js} +14 -14
- package/dist/bundle/{state-VIRCT4VW.js → state-YUX5R2R7.js} +7 -7
- package/dist/bundle/{store-ZTDZ6UY5.js → store-BD7HAXAA.js} +20 -18
- package/dist/bundle/{store-2Q4GEZJS.js → store-ERMGBF2B.js} +49 -29
- package/dist/bundle/store-connection-JBR6CMTJ.js +83 -0
- package/dist/bundle/store-maintenance-command-I5DUSO2C.js +62 -0
- package/dist/bundle/{streaming-7BPKIGAS.js → streaming-O53PIORL.js} +7 -7
- package/dist/bundle/{tokens-CQHMMKNX.js → tokens-QKNEP2GJ.js} +7 -7
- package/dist/bundle/zm.js +9 -10
- package/dist/bundle/zoom-app-XJXZ4ZBX.js +41 -0
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +1 -0
- package/dist/commands.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -3
- package/dist/config.js.map +1 -1
- package/dist/identity.d.ts +1 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +11 -0
- package/dist/identity.js.map +1 -1
- package/dist/program-bindings.d.ts.map +1 -1
- package/dist/program-bindings.js +7 -2
- package/dist/program-bindings.js.map +1 -1
- package/dist/setup-commands.d.ts +6 -0
- package/dist/setup-commands.d.ts.map +1 -1
- package/dist/setup-commands.js +24 -9
- package/dist/setup-commands.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/zoom-app.d.ts +32 -0
- package/dist/zoom-app.d.ts.map +1 -1
- package/dist/zoom-app.js +61 -0
- package/dist/zoom-app.js.map +1 -1
- package/package.json +3 -3
- package/dist/bundle/answer-policy-5OYUL6UF.js +0 -103
- package/dist/bundle/chunk-54RTMQL6.js +0 -132
- package/dist/bundle/chunk-6VFORXL3.js +0 -101
- package/dist/bundle/chunk-D4KBD63W.js +0 -19
- package/dist/bundle/chunk-SXFODCYK.js +0 -9
- package/dist/bundle/chunk-Z3WXI4DK.js +0 -31
- package/dist/bundle/command-contract-UWHY55UE.js +0 -41
- package/dist/bundle/config-TGF6E6ZD.js +0 -89
- package/dist/bundle/first-screen-PGFIXJAX.js +0 -39
- package/dist/bundle/openai-7QZZXQW5.js +0 -25
- package/dist/bundle/server-VW5UVCH7.js +0 -72
- package/dist/bundle/store-connection-FKVVQLEF.js +0 -83
- package/dist/bundle/store-maintenance-command-AU73UVUQ.js +0 -62
- package/dist/bundle/zoom-app-OEKFMJS6.js +0 -25
- /package/dist/bundle/{chunk-LU3WKZBA.js → chunk-VOXIGICJ.js} +0 -0
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { createRequire as __bundleRequire } from "node:module";
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
organization,
|
|
5
|
-
project,
|
|
6
|
-
reminder
|
|
7
|
-
} from "./chunk-54RTMQL6.js";
|
|
8
3
|
import {
|
|
9
4
|
MIGRATIONS,
|
|
10
5
|
SnapshotBudget,
|
|
@@ -28,31 +23,73 @@ import {
|
|
|
28
23
|
tagMemberIds,
|
|
29
24
|
thingOf,
|
|
30
25
|
write
|
|
31
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-YQRNFG2E.js";
|
|
32
27
|
import {
|
|
33
28
|
fold
|
|
34
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-77I67HWF.js";
|
|
35
30
|
import {
|
|
36
31
|
filesAccountSql,
|
|
37
32
|
folderProviderOf,
|
|
38
33
|
folderProviderSql,
|
|
39
34
|
isDocumentAccountProvider
|
|
40
|
-
} from "./chunk-
|
|
41
|
-
import {
|
|
42
|
-
queryFieldsOf
|
|
43
|
-
} from "./chunk-AAZFLJSH.js";
|
|
35
|
+
} from "./chunk-NUJMJQXV.js";
|
|
44
36
|
import {
|
|
45
37
|
CliError
|
|
46
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-FEM2JQN2.js";
|
|
47
39
|
import {
|
|
48
40
|
__name
|
|
49
41
|
} from "./chunk-ZVVMGPBJ.js";
|
|
50
42
|
|
|
51
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
43
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/store/damage.js
|
|
44
|
+
var DERIVED = /* @__PURE__ */ new Set(["mentions", "involvements", "embeddings"]);
|
|
45
|
+
var named = /* @__PURE__ */ __name((tables) => tables.length <= 5 ? tables.join(", ") : `${tables.slice(0, 5).join(", ")} and ${tables.length - 5} more`, "named");
|
|
46
|
+
var isDerivedTable = /* @__PURE__ */ __name((table, searchIndexes) => DERIVED.has(table) || table.startsWith("vector_index_") || searchIndexes.some((index) => table === index || table.startsWith(`${index}_`)), "isDerivedTable");
|
|
47
|
+
var WIRECAT_UNITS = ["memo-*", "mail-*", "tg-*", "max-*", "wirecat-*"];
|
|
48
|
+
var explainDamage = /* @__PURE__ */ __name((health, command) => {
|
|
49
|
+
if (health.ok)
|
|
50
|
+
return null;
|
|
51
|
+
const indexNames = (health.searchIndexes ?? []).map((index) => index.name);
|
|
52
|
+
const badIndexes = (health.searchIndexes ?? []).filter((index) => !index.ok).map((index) => index.name);
|
|
53
|
+
const tables = (health.damagedTables ?? []).map((one) => one.table).filter((table) => table !== null);
|
|
54
|
+
const sources = tables.filter((table) => !isDerivedTable(table, indexNames));
|
|
55
|
+
const derived = [.../* @__PURE__ */ new Set([...tables.filter((table) => isDerivedTable(table, indexNames)), ...badIndexes])];
|
|
56
|
+
const unopened = health.error !== void 0;
|
|
57
|
+
const json = (health.invalidJson ?? []).map(({ table, column }) => `${table}.${column}`);
|
|
58
|
+
const what = 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)}` : "");
|
|
59
|
+
const impact = [
|
|
60
|
+
...sources.length ? [`some rows of ${named(sources)} cannot be read; a recovery keeps every row it can read and names the rest`] : [],
|
|
61
|
+
...derived.length ? [`searches may miss results or fail; ${named(derived)} hold nothing that is not elsewhere, and are rebuilt`] : [],
|
|
62
|
+
...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"
|
|
64
|
+
];
|
|
65
|
+
return {
|
|
66
|
+
what,
|
|
67
|
+
causes: [
|
|
68
|
+
"the computer lost power or crashed, or the disk filled up, while a tool was writing",
|
|
69
|
+
"the file was copied, restored or synced while a tool had it open, or it sits in a synced or network folder",
|
|
70
|
+
"a fault of the disk itself"
|
|
71
|
+
],
|
|
72
|
+
investigate: [
|
|
73
|
+
`journalctl --user ${WIRECAT_UNITS.map((unit) => `-u '${unit}'`).join(" ")} --since -14d | grep -i -e malformed -e corrupt -e 'disk full'`,
|
|
74
|
+
"journalctl -k --since -14d | grep -i -e 'I/O error' -e nvme -e ata",
|
|
75
|
+
`df -h ${health.path.replace(/\/[^/]*$/, "")}`,
|
|
76
|
+
...health.checked === "quick" ? [`${command} store recover`] : []
|
|
77
|
+
],
|
|
78
|
+
impact,
|
|
79
|
+
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",
|
|
80
|
+
steps: [
|
|
81
|
+
"stop every timer and server of the WireCat tools; `store recover run` lists the ones still running",
|
|
82
|
+
`${command} store recover run`,
|
|
83
|
+
"run the fetch commands it prints, then start the timers again"
|
|
84
|
+
]
|
|
85
|
+
};
|
|
86
|
+
}, "explainDamage");
|
|
87
|
+
|
|
88
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/store/document-transfer/index.js
|
|
52
89
|
import { realpathSync, statSync } from "node:fs";
|
|
53
90
|
import { resolve } from "node:path";
|
|
54
91
|
|
|
55
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
92
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/people.js
|
|
56
93
|
var planPeople = /* @__PURE__ */ __name((database, snapshot, mappings, bindings, conflicts) => {
|
|
57
94
|
const creatable = /* @__PURE__ */ new Set();
|
|
58
95
|
let people = 0, identities = 0;
|
|
@@ -115,11 +152,11 @@ var copyPeople = /* @__PURE__ */ __name((database, snapshot, mappings, now) => {
|
|
|
115
152
|
}
|
|
116
153
|
}, "copyPeople");
|
|
117
154
|
|
|
118
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
155
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/store/document-transfer/digest.js
|
|
119
156
|
import { createHash } from "node:crypto";
|
|
120
157
|
var digest = /* @__PURE__ */ __name((value) => createHash("sha256").update(JSON.stringify(value)).digest("hex"), "digest");
|
|
121
158
|
|
|
122
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
159
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/collection.js
|
|
123
160
|
var documentsKeyOf = /* @__PURE__ */ __name((collection) => {
|
|
124
161
|
const colon = collection.indexOf(":");
|
|
125
162
|
const provider = collection.slice(0, colon);
|
|
@@ -163,7 +200,7 @@ var currentCollection = /* @__PURE__ */ __name((row) => {
|
|
|
163
200
|
};
|
|
164
201
|
}, "currentCollection");
|
|
165
202
|
|
|
166
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
203
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/plan.js
|
|
167
204
|
var planTransfer = /* @__PURE__ */ __name((database, snapshot, sourceKey, bindings) => {
|
|
168
205
|
const mappings = /* @__PURE__ */ new Map();
|
|
169
206
|
const missing = /* @__PURE__ */ new Set(), conflicts = /* @__PURE__ */ new Set();
|
|
@@ -272,9 +309,9 @@ var planTransfer = /* @__PURE__ */ __name((database, snapshot, sourceKey, bindin
|
|
|
272
309
|
}
|
|
273
310
|
for (const alias of snapshot.aliases) {
|
|
274
311
|
const sourceTag = snapshot.taggings.find((tagging) => tagging.tag_id === alias.aliasable_id);
|
|
275
|
-
const
|
|
312
|
+
const named2 = canonicalTagNamed(database, String(alias.name));
|
|
276
313
|
const targetTag = sourceTag && canonicalTagNamed(database, String(sourceTag.tag_name));
|
|
277
|
-
if (
|
|
314
|
+
if (named2 && named2.id !== targetTag?.id)
|
|
278
315
|
conflicts.add(`destination alias conflicts with source tag ${String(alias.aliasable_id)}`);
|
|
279
316
|
if (targetTag && alias.display === 1) {
|
|
280
317
|
const displayed = database.prepare("SELECT name_folded FROM aliases WHERE aliasable_type='tag' AND aliasable_id=? AND account_id IS NULL AND display=1").get(targetTag.id);
|
|
@@ -330,7 +367,7 @@ var planTransfer = /* @__PURE__ */ __name((database, snapshot, sourceKey, bindin
|
|
|
330
367
|
};
|
|
331
368
|
}, "planTransfer");
|
|
332
369
|
|
|
333
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
370
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/snapshot.js
|
|
334
371
|
var TRANSFER_TABLES = { document: "documents", note: "notes", memory: "memories", fact: "facts" };
|
|
335
372
|
var MAX_ENTITIES = 1e3;
|
|
336
373
|
var MAX_AUXILIARY = 1e4;
|
|
@@ -492,7 +529,7 @@ var transferSnapshot = /* @__PURE__ */ __name((database, collection) => read(dat
|
|
|
492
529
|
};
|
|
493
530
|
}), "transferSnapshot");
|
|
494
531
|
|
|
495
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
532
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/store/sqlite/document-transfer/apply.js
|
|
496
533
|
var providerHere = /* @__PURE__ */ __name(({ provider, name, settings }) => {
|
|
497
534
|
if (provider !== "folder" || String(name ?? "").startsWith("google-drive:"))
|
|
498
535
|
return provider ?? null;
|
|
@@ -664,7 +701,7 @@ var remapEntity = /* @__PURE__ */ __name((database, entity, id, mappings) => {
|
|
|
664
701
|
database.prepare(`UPDATE ${TRANSFER_TABLES[entity.kind]} SET ${columns.join(",")} WHERE id=?`).run(...values, id);
|
|
665
702
|
}, "remapEntity");
|
|
666
703
|
|
|
667
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
704
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/store/document-transfer/index.js
|
|
668
705
|
var locations = /* @__PURE__ */ __name((options) => {
|
|
669
706
|
for (const value of [options.source, options.destination, options.collection])
|
|
670
707
|
if (typeof value !== "string" || !value.trim())
|
|
@@ -760,42 +797,149 @@ var applyDocumentTransfer = /* @__PURE__ */ __name(async (options) => {
|
|
|
760
797
|
}
|
|
761
798
|
}, "applyDocumentTransfer");
|
|
762
799
|
|
|
763
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
800
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/store/health.js
|
|
801
|
+
import { existsSync, statSync as statSync2 } from "node:fs";
|
|
802
|
+
var JSON_COLUMNS = {
|
|
803
|
+
accounts: ["settings"],
|
|
804
|
+
account_identities: ["mail_signals"],
|
|
805
|
+
bot_updates: ["payload"],
|
|
806
|
+
documents: ["front_matter"],
|
|
807
|
+
emails: ["headers"],
|
|
808
|
+
meeting_participants: ["sessions"],
|
|
809
|
+
messages: ["mentions", "reply_to"],
|
|
810
|
+
proposed_actions: ["payload", "result"],
|
|
811
|
+
searches: ["params"],
|
|
812
|
+
tag_consolidations: ["source_member_ids", "survivor_member_ids"],
|
|
813
|
+
task_events: ["changes"]
|
|
771
814
|
};
|
|
772
|
-
var
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
815
|
+
var jsonColumns = /* @__PURE__ */ __name((database) => database.prepare(`SELECT m.name AS "table", c.name AS "column", c."notnull" AS required FROM sqlite_master m, pragma_table_info(m.name) c
|
|
816
|
+
WHERE m.type = 'table' AND m.sql NOT LIKE 'CREATE VIRTUAL%' ORDER BY 1, 2`).all().map((row) => ({ table: String(row.table), column: String(row.column), required: Number(row.required) === 1 })).filter(({ table, column }) => column === "metadata" || JSON_COLUMNS[table]?.includes(column)), "jsonColumns");
|
|
817
|
+
var invalidJson = /* @__PURE__ */ __name((database) => jsonColumns(database).map((one) => ({
|
|
818
|
+
...one,
|
|
819
|
+
rows: Number(database.prepare(`SELECT count(*) AS n FROM "${one.table}" WHERE "${one.column}" IS NOT NULL AND NOT json_valid("${one.column}")`).get()?.n)
|
|
820
|
+
})).filter(({ rows }) => rows > 0), "invalidJson");
|
|
821
|
+
var QUICK_CHECK_LIMIT = 1e4;
|
|
822
|
+
var QUICK_HEALTH_CHECKS = "the file header, its size against its page count, and the schema's own pages";
|
|
823
|
+
var FTS5 = /^\s*CREATE\s+VIRTUAL\s+TABLE\s+\S+\s+USING\s+fts5\s*\(/i;
|
|
824
|
+
var fts5Tables = /* @__PURE__ */ __name((database) => database.prepare("SELECT name, sql FROM sqlite_master WHERE type = 'table' AND sql LIKE 'CREATE VIRTUAL TABLE%' ORDER BY name").all().filter((row) => FTS5.test(String(row.sql))).map((row) => {
|
|
825
|
+
const sql = String(row.sql);
|
|
826
|
+
return { name: String(row.name), sql, external: /content\s*=\s*'[^']+'/i.test(sql) };
|
|
827
|
+
}), "fts5Tables");
|
|
828
|
+
var messageOf = /* @__PURE__ */ __name((error) => error instanceof Error ? error.message : String(error), "messageOf");
|
|
829
|
+
var bytesOf = /* @__PURE__ */ __name((path) => statSync2(path, { throwIfNoEntry: false })?.size ?? 0, "bytesOf");
|
|
830
|
+
var damagedTables = /* @__PURE__ */ __name((database, lines) => {
|
|
831
|
+
const roots = new Map(database.prepare("SELECT rootpage, tbl_name FROM sqlite_master WHERE rootpage > 0").all().map((row) => [Number(row.rootpage), String(row.tbl_name)]));
|
|
832
|
+
const owners = new Map(database.prepare("SELECT name, tbl_name FROM sqlite_master WHERE type = 'index'").all().map((row) => [String(row.name), String(row.tbl_name)]));
|
|
833
|
+
const virtual = database.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND sql LIKE 'CREATE VIRTUAL TABLE%'").all().map((row) => String(row.name));
|
|
834
|
+
const ownerOf = /* @__PURE__ */ __name((table) => table === null ? null : virtual.find((name) => table.startsWith(`${name}_`)) ?? table, "ownerOf");
|
|
835
|
+
const tables = /* @__PURE__ */ new Map();
|
|
836
|
+
for (const raw of lines) {
|
|
837
|
+
const line = raw.replace(/^\*\*\* in database \w+ \*\*\*\s*/, "");
|
|
838
|
+
const tree = /^Tree (\d+) /.exec(line);
|
|
839
|
+
const column = /value in (\w+)\.\w+/.exec(line) ?? /^table (\w+): /.exec(line);
|
|
840
|
+
const index = /index (\w+)/.exec(line)?.[1];
|
|
841
|
+
const table = ownerOf(tree ? roots.get(Number(tree[1])) ?? null : column ? column[1] ?? null : index ? owners.get(index) ?? null : null);
|
|
842
|
+
const known = tables.get(table);
|
|
843
|
+
if (known)
|
|
844
|
+
known.problems += 1;
|
|
845
|
+
else
|
|
846
|
+
tables.set(table, { table, problems: 1, sample: line.slice(0, 200) });
|
|
847
|
+
}
|
|
848
|
+
return [...tables.values()].sort((a, b) => b.problems - a.problems);
|
|
849
|
+
}, "damagedTables");
|
|
850
|
+
var searchIndexHealth = /* @__PURE__ */ __name((database) => fts5Tables(database).map(({ name }) => {
|
|
851
|
+
try {
|
|
852
|
+
database.exec("BEGIN");
|
|
853
|
+
try {
|
|
854
|
+
database.exec(`INSERT INTO "${name}" ("${name}", rank) VALUES ('integrity-check', 0)`);
|
|
855
|
+
} finally {
|
|
856
|
+
database.exec("ROLLBACK");
|
|
786
857
|
}
|
|
787
|
-
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
}
|
|
858
|
+
return { name, ok: true };
|
|
859
|
+
} catch (error) {
|
|
860
|
+
return { name, ok: false, error: messageOf(error) };
|
|
861
|
+
}
|
|
862
|
+
}), "searchIndexHealth");
|
|
863
|
+
var pragmaLines = /* @__PURE__ */ __name((database, sql) => database.prepare(sql).all().flatMap((row) => String(Object.values(row)[0]).split("\n")), "pragmaLines");
|
|
864
|
+
var checkLines = /* @__PURE__ */ __name((database) => {
|
|
865
|
+
try {
|
|
866
|
+
return pragmaLines(database, `PRAGMA quick_check(${QUICK_CHECK_LIMIT})`);
|
|
867
|
+
} catch {
|
|
868
|
+
const tables = database.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND rootpage > 0 ORDER BY name").all().map((row) => String(row.name));
|
|
869
|
+
return tables.flatMap((table) => {
|
|
870
|
+
try {
|
|
871
|
+
return pragmaLines(database, `PRAGMA quick_check("${table}")`).filter((line) => line !== "ok");
|
|
872
|
+
} catch (error) {
|
|
873
|
+
return [`table ${table}: ${messageOf(error)}`];
|
|
874
|
+
}
|
|
875
|
+
});
|
|
876
|
+
}
|
|
877
|
+
}, "checkLines");
|
|
878
|
+
var quickHealth = /* @__PURE__ */ __name((database, path) => {
|
|
879
|
+
const pragma = /* @__PURE__ */ __name((name) => Number(Object.values(database.prepare(`PRAGMA ${name}`).get() ?? {})[0] ?? 0), "pragma");
|
|
880
|
+
const file = {
|
|
881
|
+
bytes: bytesOf(path),
|
|
882
|
+
pages: pragma("page_count"),
|
|
883
|
+
pageSize: pragma("page_size"),
|
|
884
|
+
freePages: pragma("freelist_count")
|
|
885
|
+
};
|
|
886
|
+
const schema = database.prepare("PRAGMA quick_check('sqlite_schema')").all().map((row) => String(Object.values(row)[0]));
|
|
887
|
+
const walFrames = existsSync(`${path}-wal`) && bytesOf(`${path}-wal`) > 0;
|
|
888
|
+
const sized = walFrames || file.bytes === file.pages * file.pageSize;
|
|
889
|
+
const problems = [
|
|
890
|
+
...schema.length === 1 && schema[0] === "ok" ? [] : schema,
|
|
891
|
+
...sized ? [] : [`the file holds ${file.bytes} bytes, its header says ${file.pages * file.pageSize}`]
|
|
892
|
+
];
|
|
893
|
+
return { file, problems };
|
|
894
|
+
}, "quickHealth");
|
|
895
|
+
var storeHealth = /* @__PURE__ */ __name(async (path, { deep = false } = {}) => {
|
|
896
|
+
const started = Date.now();
|
|
897
|
+
const checked = deep ? "deep" : "quick";
|
|
898
|
+
const done = /* @__PURE__ */ __name((health) => ({
|
|
899
|
+
path,
|
|
900
|
+
checked,
|
|
901
|
+
...health,
|
|
902
|
+
ms: Date.now() - started
|
|
903
|
+
}), "done");
|
|
904
|
+
let database;
|
|
905
|
+
try {
|
|
906
|
+
database = (await openSqlite(path, { readOnly: !deep })).database;
|
|
907
|
+
} catch (error) {
|
|
908
|
+
return done({ ok: false, error: messageOf(error) });
|
|
909
|
+
}
|
|
910
|
+
try {
|
|
911
|
+
const { file, problems } = quickHealth(database, path);
|
|
912
|
+
if (!deep) {
|
|
913
|
+
return done({
|
|
914
|
+
ok: problems.length === 0,
|
|
915
|
+
file,
|
|
916
|
+
...problems.length ? {
|
|
917
|
+
problems: problems.length,
|
|
918
|
+
damagedTables: [{ table: null, problems: problems.length, sample: problems[0] }]
|
|
919
|
+
} : {}
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
database.exec("PRAGMA busy_timeout = 30000");
|
|
923
|
+
const lines = checkLines(database);
|
|
924
|
+
const pagesOk = lines.length === 1 && lines[0] === "ok";
|
|
925
|
+
const indexes = searchIndexHealth(database);
|
|
926
|
+
const json = pagesOk ? invalidJson(database) : [];
|
|
927
|
+
return done({
|
|
928
|
+
ok: pagesOk && problems.length === 0 && indexes.every((index) => index.ok) && json.length === 0,
|
|
929
|
+
file,
|
|
930
|
+
problems: pagesOk ? 0 : lines.length,
|
|
931
|
+
damagedTables: pagesOk ? [] : damagedTables(database, lines),
|
|
932
|
+
searchIndexes: indexes,
|
|
933
|
+
invalidJson: json
|
|
934
|
+
});
|
|
935
|
+
} catch (error) {
|
|
936
|
+
return done({ ok: false, error: messageOf(error) });
|
|
937
|
+
} finally {
|
|
938
|
+
database.close();
|
|
939
|
+
}
|
|
940
|
+
}, "storeHealth");
|
|
797
941
|
|
|
798
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
942
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/store/project-transfer/preview.js
|
|
799
943
|
var previewProjectAnnotationSnapshot = /* @__PURE__ */ __name(async (options) => {
|
|
800
944
|
if (!options || typeof options !== "object" || Array.isArray(options))
|
|
801
945
|
throw new CliError("validation_error", "project preview options are required");
|
|
@@ -817,7 +961,7 @@ var previewProjectAnnotationSnapshot = /* @__PURE__ */ __name(async (options) =>
|
|
|
817
961
|
}
|
|
818
962
|
}, "previewProjectAnnotationSnapshot");
|
|
819
963
|
|
|
820
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
964
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot.js
|
|
821
965
|
var snapshotProjectAnnotations = /* @__PURE__ */ __name(async (options) => {
|
|
822
966
|
if (!options || typeof options !== "object" || Array.isArray(options))
|
|
823
967
|
throw new CliError("validation_error", "snapshot options are required");
|
|
@@ -839,11 +983,13 @@ var snapshotProjectAnnotations = /* @__PURE__ */ __name(async (options) => {
|
|
|
839
983
|
}, "snapshotProjectAnnotations");
|
|
840
984
|
|
|
841
985
|
export {
|
|
986
|
+
explainDamage,
|
|
987
|
+
invalidJson,
|
|
988
|
+
QUICK_HEALTH_CHECKS,
|
|
989
|
+
fts5Tables,
|
|
990
|
+
storeHealth,
|
|
842
991
|
previewDocumentTransfer,
|
|
843
992
|
applyDocumentTransfer,
|
|
844
|
-
ORGANIZATIONS_QUERY,
|
|
845
|
-
PROJECTS_QUERY,
|
|
846
|
-
REMINDERS_QUERY,
|
|
847
993
|
previewProjectAnnotationSnapshot,
|
|
848
994
|
snapshotProjectAnnotations
|
|
849
995
|
};
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
checkCancelled
|
|
5
|
+
} from "./chunk-KAPJQGHE.js";
|
|
6
|
+
import {
|
|
7
|
+
BASE_CONSTANTS,
|
|
8
|
+
baseConstantsSchema,
|
|
9
|
+
loadConstants
|
|
10
|
+
} from "./chunk-KNE6VFHZ.js";
|
|
11
|
+
import {
|
|
12
|
+
nonEmpty,
|
|
13
|
+
object,
|
|
14
|
+
optional,
|
|
15
|
+
pipe,
|
|
16
|
+
string,
|
|
17
|
+
transform
|
|
18
|
+
} from "./chunk-NRRI37NJ.js";
|
|
19
|
+
import {
|
|
20
|
+
CliError
|
|
21
|
+
} from "./chunk-FEM2JQN2.js";
|
|
22
|
+
import {
|
|
23
|
+
__name
|
|
24
|
+
} from "./chunk-ZVVMGPBJ.js";
|
|
25
|
+
|
|
26
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/constants/obscure.js
|
|
27
|
+
import { createDecipheriv } from "node:crypto";
|
|
28
|
+
var KEY = Buffer.from("d43012779aa2dded3e98092a3dbcf5d8980c564172f5ce0a5fd0574e5f740339", "hex");
|
|
29
|
+
var reveal = /* @__PURE__ */ __name((obscured) => {
|
|
30
|
+
const bytes = Buffer.from(obscured, "base64url");
|
|
31
|
+
const decipher = createDecipheriv("aes-256-ctr", KEY, bytes.subarray(0, 16));
|
|
32
|
+
return Buffer.concat([decipher.update(bytes.subarray(16)), decipher.final()]).toString("utf8");
|
|
33
|
+
}, "reveal");
|
|
34
|
+
|
|
35
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/constants/index.js
|
|
36
|
+
var CORE_CONSTANTS = new URL("../../constants.json", new URL("constants/index.js", import.meta.resolve("@wirecat/cli-core")).href);
|
|
37
|
+
var constantsSchema = object({
|
|
38
|
+
...baseConstantsSchema.entries,
|
|
39
|
+
google: object({
|
|
40
|
+
app: object({
|
|
41
|
+
client_id: pipe(string(), nonEmpty(), transform(reveal)),
|
|
42
|
+
client_secret: optional(pipe(string(), transform(reveal)))
|
|
43
|
+
})
|
|
44
|
+
}),
|
|
45
|
+
microsoft: object({ app: object({ client_id: pipe(string(), nonEmpty()) }) })
|
|
46
|
+
});
|
|
47
|
+
var loaded = /* @__PURE__ */ new Map();
|
|
48
|
+
var constants = /* @__PURE__ */ __name((toolLayer, schema2) => {
|
|
49
|
+
const key = toolLayer?.href ?? "";
|
|
50
|
+
if (!loaded.has(key)) {
|
|
51
|
+
const layers = toolLayer ? [BASE_CONSTANTS, CORE_CONSTANTS, toolLayer] : [BASE_CONSTANTS, CORE_CONSTANTS];
|
|
52
|
+
loaded.set(key, loadConstants(layers, schema2 ?? constantsSchema));
|
|
53
|
+
}
|
|
54
|
+
return loaded.get(key);
|
|
55
|
+
}, "constants");
|
|
56
|
+
var oauthApp = /* @__PURE__ */ __name((options) => {
|
|
57
|
+
const { env, prefix, provider } = options;
|
|
58
|
+
const name = `${prefix}_${provider.toUpperCase()}_CLIENT`;
|
|
59
|
+
const clientSecret = env[`${name}_SECRET`];
|
|
60
|
+
const own = [
|
|
61
|
+
[options.clientId, "flag"],
|
|
62
|
+
[env[`${name}_ID`], "env"],
|
|
63
|
+
[options.configClientId, "config"]
|
|
64
|
+
];
|
|
65
|
+
const [clientId, source] = own.find(([id]) => id) ?? [];
|
|
66
|
+
if (clientId && source)
|
|
67
|
+
return app({ clientId, ...clientSecret ? { clientSecret } : {} }, source);
|
|
68
|
+
if (clientSecret)
|
|
69
|
+
throw new CliError("configuration_error", `${name}_SECRET is set without a client id; set ${name}_ID too, or unset it to use WireCat's app`, { reason: "sign-in.secret-without-id" });
|
|
70
|
+
const wirecat = options.wirecat;
|
|
71
|
+
if (!wirecat?.client_id)
|
|
72
|
+
return void 0;
|
|
73
|
+
return app({ clientId: wirecat.client_id, ...wirecat.client_secret ? { clientSecret: wirecat.client_secret } : {} }, "constants");
|
|
74
|
+
}, "oauthApp");
|
|
75
|
+
var app = /* @__PURE__ */ __name((client, source) => ({ client: { ...client, source }, source }), "app");
|
|
76
|
+
var oauthClientReport = /* @__PURE__ */ __name((app2, reason) => app2?.source ? { client: app2.source === "constants" ? "wirecat" : "own", source: app2.source } : { client: null, source: null, ...reason ? { reason } : {} }, "oauthClientReport");
|
|
77
|
+
|
|
78
|
+
// dist/login.js
|
|
79
|
+
import { createHash, randomBytes } from "node:crypto";
|
|
80
|
+
import { createServer } from "node:http";
|
|
81
|
+
var REDIRECT = "https://wirecat.dev/zoom-callback";
|
|
82
|
+
var login = /* @__PURE__ */ __name(async (options) => {
|
|
83
|
+
checkCancelled(options.signal);
|
|
84
|
+
const verifier = randomBytes(48).toString("base64url");
|
|
85
|
+
const challenge = createHash("sha256").update(verifier).digest("base64url");
|
|
86
|
+
const controller = new AbortController();
|
|
87
|
+
let state = "";
|
|
88
|
+
let accept = /* @__PURE__ */ __name(() => {
|
|
89
|
+
}, "accept");
|
|
90
|
+
let fail = /* @__PURE__ */ __name(() => {
|
|
91
|
+
}, "fail");
|
|
92
|
+
const codePromise = new Promise((resolve, reject) => {
|
|
93
|
+
accept = resolve;
|
|
94
|
+
fail = reject;
|
|
95
|
+
});
|
|
96
|
+
const onAbort = /* @__PURE__ */ __name(() => {
|
|
97
|
+
try {
|
|
98
|
+
checkCancelled(options.signal);
|
|
99
|
+
} catch (error) {
|
|
100
|
+
fail(error instanceof Error ? error : new CliError("cancelled", "command cancelled"));
|
|
101
|
+
}
|
|
102
|
+
}, "onAbort");
|
|
103
|
+
options.signal?.addEventListener("abort", onAbort, { once: true });
|
|
104
|
+
void codePromise.catch(() => {
|
|
105
|
+
});
|
|
106
|
+
const server = createServer((request, response) => {
|
|
107
|
+
const query = new URL(request.url ?? "/", "http://127.0.0.1");
|
|
108
|
+
if (query.pathname !== "/callback") {
|
|
109
|
+
response.writeHead(404).end();
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (query.searchParams.get("state") !== state) {
|
|
113
|
+
response.writeHead(400).end("state does not match");
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const code = query.searchParams.get("code");
|
|
117
|
+
response.end("zm: received, you can close this tab");
|
|
118
|
+
if (code)
|
|
119
|
+
accept(code);
|
|
120
|
+
else
|
|
121
|
+
fail(new CliError("authentication_error", "Zoom login was not approved"));
|
|
122
|
+
});
|
|
123
|
+
const timer = setTimeout(() => fail(new CliError("authentication_error", "Zoom login timed out")), options.timeoutMs ?? 3e5);
|
|
124
|
+
try {
|
|
125
|
+
await new Promise((resolve, reject) => {
|
|
126
|
+
server.once("error", reject);
|
|
127
|
+
server.listen(0, "127.0.0.1", resolve);
|
|
128
|
+
});
|
|
129
|
+
const address = server.address();
|
|
130
|
+
if (!address || typeof address === "string")
|
|
131
|
+
throw new CliError("configuration_error", "could not start the local login listener");
|
|
132
|
+
state = `${address.port}.${randomBytes(24).toString("base64url")}`;
|
|
133
|
+
const authorize = new URL("https://zoom.us/oauth/authorize");
|
|
134
|
+
authorize.search = new URLSearchParams({
|
|
135
|
+
response_type: "code",
|
|
136
|
+
client_id: options.tokens.options.clientId,
|
|
137
|
+
redirect_uri: REDIRECT,
|
|
138
|
+
code_challenge: challenge,
|
|
139
|
+
code_challenge_method: "S256",
|
|
140
|
+
state
|
|
141
|
+
}).toString();
|
|
142
|
+
checkCancelled(options.signal);
|
|
143
|
+
options.showUrl?.(authorize.toString());
|
|
144
|
+
const pastePromise = options.readPaste?.(controller.signal).then((text) => {
|
|
145
|
+
const query = new URLSearchParams(text.includes("?") ? text.slice(text.indexOf("?") + 1) : text);
|
|
146
|
+
if (query.get("state") !== state || !query.get("code"))
|
|
147
|
+
throw new CliError("authentication_error", "pasted login must contain the matching code and state");
|
|
148
|
+
return query.get("code") ?? "";
|
|
149
|
+
});
|
|
150
|
+
void Promise.resolve().then(() => options.openBrowser(authorize.toString())).catch(() => {
|
|
151
|
+
if (!options.readPaste)
|
|
152
|
+
fail(new CliError("configuration_error", "could not open the browser; retry with --browser <program>"));
|
|
153
|
+
});
|
|
154
|
+
const code = await (pastePromise ? Promise.race([codePromise, pastePromise]) : codePromise);
|
|
155
|
+
controller.abort();
|
|
156
|
+
const tokens = await options.tokens.exchange({
|
|
157
|
+
grant_type: "authorization_code",
|
|
158
|
+
code,
|
|
159
|
+
redirect_uri: REDIRECT,
|
|
160
|
+
code_verifier: verifier
|
|
161
|
+
});
|
|
162
|
+
return { loggedIn: true, scopes: tokens.scopes, credentialStorage: options.tokens.storageOf() };
|
|
163
|
+
} finally {
|
|
164
|
+
options.signal?.removeEventListener("abort", onAbort);
|
|
165
|
+
clearTimeout(timer);
|
|
166
|
+
controller.abort();
|
|
167
|
+
server.close();
|
|
168
|
+
server.closeAllConnections();
|
|
169
|
+
}
|
|
170
|
+
}, "login");
|
|
171
|
+
|
|
172
|
+
// dist/zoom-app.js
|
|
173
|
+
var schema = object({
|
|
174
|
+
...constantsSchema.entries,
|
|
175
|
+
zoom: object({ app: object({ client_id: string() }) })
|
|
176
|
+
});
|
|
177
|
+
var ZOOM_CONSTANTS = new URL("../constants.json", new URL("../zoom-app.js", import.meta.url).href);
|
|
178
|
+
var NO_ZOOM_APP = "WireCat has no Zoom app yet; make your own (docs/zoom-app.md) and set zoom.client_id or ZM_ZOOM_CLIENT_ID";
|
|
179
|
+
var SET_ZOOM_APP = "run zm config set zoom.client_id <Public Client ID> first, or set ZM_ZOOM_CLIENT_ID";
|
|
180
|
+
var zoomApp = /* @__PURE__ */ __name((options) => oauthApp({
|
|
181
|
+
provider: "zoom",
|
|
182
|
+
prefix: "ZM",
|
|
183
|
+
env: options.env,
|
|
184
|
+
clientId: options.clientId,
|
|
185
|
+
configClientId: options.configClientId ?? void 0,
|
|
186
|
+
wirecat: constants(ZOOM_CONSTANTS, schema).zoom.app
|
|
187
|
+
}), "zoomApp");
|
|
188
|
+
var zoomClientId = /* @__PURE__ */ __name((config, env) => zoomApp({ env, configClientId: config?.clientId })?.client.clientId, "zoomClientId");
|
|
189
|
+
var zoomClientReport = /* @__PURE__ */ __name((config, env) => oauthClientReport(zoomApp({ env, configClientId: config?.clientId }), NO_ZOOM_APP), "zoomClientReport");
|
|
190
|
+
var checkedClientId = /* @__PURE__ */ __name((value) => {
|
|
191
|
+
if (!value.trim() || /\s/.test(value))
|
|
192
|
+
throw new CliError("validation_error", "client id must not contain whitespace");
|
|
193
|
+
return value;
|
|
194
|
+
}, "checkedClientId");
|
|
195
|
+
var ZOOM_APP_BUILD_URL = "https://marketplace.zoom.us/develop/create";
|
|
196
|
+
var ZOOM_APP_GUIDE_URL = "https://github.com/WireCatLabs/zoom-cli/blob/main/docs/zoom-app.md";
|
|
197
|
+
var ZOOM_APP_SCOPES = [
|
|
198
|
+
{ scope: "meeting:read:list_meetings", required: true, use: "find your meetings and scheduled series" },
|
|
199
|
+
{ scope: "meeting:read:list_past_instances", required: true, use: "find each meeting that ran" },
|
|
200
|
+
{ scope: "cloud_recording:read:meeting_transcript", required: true, use: "read meeting transcripts" },
|
|
201
|
+
{ scope: "meeting:read:list_past_participants", required: true, use: "read who joined and when" },
|
|
202
|
+
{ scope: "meeting:read:summary", required: true, use: "read Zoom AI summaries" },
|
|
203
|
+
{ scope: "cloud_recording:read:list_user_recordings", required: false, use: "find your cloud recordings" },
|
|
204
|
+
{ scope: "cloud_recording:read:list_recording_files", required: false, use: "download recordings and meeting chat" },
|
|
205
|
+
{ scope: "user:read:user", required: false, use: "session status --check" },
|
|
206
|
+
{ scope: "meeting:read:meeting", required: false, use: "show one meeting, prepare a series" },
|
|
207
|
+
{ scope: "meeting:read:invitation", required: false, use: "show a meeting's invitation" },
|
|
208
|
+
{ scope: "meeting:write:meeting", required: false, use: "create a meeting" },
|
|
209
|
+
{ scope: "meeting:update:meeting", required: false, use: "change a meeting" },
|
|
210
|
+
{ scope: "meeting:delete:meeting", required: false, use: "cancel a meeting" },
|
|
211
|
+
{ scope: "team_chat:read:list_contacts", required: false, use: "contacts list" },
|
|
212
|
+
{ scope: "team_chat:read:contact", required: false, use: "contacts show" },
|
|
213
|
+
{ scope: "agentic_search:read:search", required: false, use: "zoom search" }
|
|
214
|
+
];
|
|
215
|
+
var zoomAppSetup = /* @__PURE__ */ __name(() => ({
|
|
216
|
+
marketplace_url: ZOOM_APP_BUILD_URL,
|
|
217
|
+
guide_url: ZOOM_APP_GUIDE_URL,
|
|
218
|
+
app_type: "General app",
|
|
219
|
+
management: "User-managed",
|
|
220
|
+
oauth: "Public Client OAuth",
|
|
221
|
+
redirect_url: REDIRECT,
|
|
222
|
+
allow_list: [REDIRECT],
|
|
223
|
+
scopes: ZOOM_APP_SCOPES,
|
|
224
|
+
config_key: "zoom.client_id"
|
|
225
|
+
}), "zoomAppSetup");
|
|
226
|
+
var zoomAppChecklist = /* @__PURE__ */ __name(() => {
|
|
227
|
+
const scopes = /* @__PURE__ */ __name((required) => ZOOM_APP_SCOPES.filter((one) => one.required === required).map((one) => one.scope).join(", "), "scopes");
|
|
228
|
+
return [
|
|
229
|
+
`1. Open ${ZOOM_APP_BUILD_URL} and build a General app.`,
|
|
230
|
+
"2. Choose User-managed. Under App Credentials, turn on Use Public Client OAuth and copy the Public Client ID.",
|
|
231
|
+
`3. OAuth Redirect URL: ${REDIRECT}`,
|
|
232
|
+
`4. OAuth Allow List: ${REDIRECT}`,
|
|
233
|
+
`5. Add the scopes meetings sync needs: ${scopes(true)}`,
|
|
234
|
+
` Only for the features you use: ${scopes(false)}`,
|
|
235
|
+
"6. Run zm config set zoom.client_id <Public Client ID>, then zm <profile> session start.",
|
|
236
|
+
`The whole guide: ${ZOOM_APP_GUIDE_URL}`
|
|
237
|
+
].join("\n");
|
|
238
|
+
}, "zoomAppChecklist");
|
|
239
|
+
var CLIENT_ID_NEED = {
|
|
240
|
+
field: "client_id",
|
|
241
|
+
secret: false,
|
|
242
|
+
prompt: "Public Client ID of your Zoom app",
|
|
243
|
+
hint: `Build a General app (User-managed, Public Client OAuth) at ${ZOOM_APP_BUILD_URL}; zm app lists what to enter.`
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
export {
|
|
247
|
+
login,
|
|
248
|
+
ZOOM_CONSTANTS,
|
|
249
|
+
NO_ZOOM_APP,
|
|
250
|
+
SET_ZOOM_APP,
|
|
251
|
+
zoomApp,
|
|
252
|
+
zoomClientId,
|
|
253
|
+
zoomClientReport,
|
|
254
|
+
checkedClientId,
|
|
255
|
+
ZOOM_APP_BUILD_URL,
|
|
256
|
+
ZOOM_APP_GUIDE_URL,
|
|
257
|
+
ZOOM_APP_SCOPES,
|
|
258
|
+
zoomAppSetup,
|
|
259
|
+
zoomAppChecklist,
|
|
260
|
+
CLIENT_ID_NEED
|
|
261
|
+
};
|
|
@@ -2,12 +2,12 @@ import { createRequire as __bundleRequire } from "node:module";
|
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
CliError
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-FEM2JQN2.js";
|
|
6
6
|
import {
|
|
7
7
|
__name
|
|
8
8
|
} from "./chunk-ZVVMGPBJ.js";
|
|
9
9
|
|
|
10
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.604.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_90db47d7f41d7a563eea7bc9cc13c345/node_modules/@wirecat/cli-core/dist/sends/permissions.js
|
|
11
11
|
var LEVELS = ["deny", "readonly", "ask", "allow"];
|
|
12
12
|
var DANGEROUS = /* @__PURE__ */ new Set(["messages.delete", "bot.messages.delete", "topics.delete", "chats.delete", "chats.clear"]);
|
|
13
13
|
var skipFlagFor = /* @__PURE__ */ __name((key) => DANGEROUS.has(key) ? "--allow-dangerous" : "--yes", "skipFlagFor");
|