@wirecat/mail-cli 0.24.0 → 0.25.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 +13 -0
- package/dist/bin/mail.js +2 -2
- package/dist/bundle/{all-profiles-VS7P6DJY.js → all-profiles-QEV2PSOR.js} +9 -9
- package/dist/bundle/{anthropic-C5JXKGBS.js → anthropic-5NKQXIHM.js} +16 -9
- package/dist/bundle/{app-server-HU3LVU42.js → app-server-G2CJNT4R.js} +56 -45
- package/dist/bundle/{bun-QLFX47WZ.js → bun-6HBYWQIX.js} +2 -2
- package/dist/bundle/{bun-sqlite-W4PGAKVY.js → bun-sqlite-DXIQ7BVR.js} +8 -4
- package/dist/bundle/{chunk-U6MMQNNK.js → chunk-37F6QYTO.js} +5 -5
- package/dist/bundle/{chunk-5NLHDK7P.js → chunk-3XVR2ROR.js} +30 -30
- package/dist/bundle/{chunk-TI7ZIPA2.js → chunk-434YOD6A.js} +3 -3
- package/dist/bundle/{chunk-NCRSE647.js → chunk-5QYK3LWS.js} +57 -25
- package/dist/bundle/{chunk-WOX7FZJP.js → chunk-5ZYFV6FD.js} +82 -61
- package/dist/bundle/chunk-7GLJSJ7M.js +16 -0
- package/dist/bundle/{chunk-XBEO472U.js → chunk-A6BPOX5O.js} +11804 -10024
- package/dist/bundle/{chunk-VVL4MKYH.js → chunk-ADKMBXY4.js} +1 -1
- package/dist/bundle/{chunk-PRQ2U7HF.js → chunk-B7SWTH5O.js} +2 -2
- package/dist/bundle/{chunk-64ZG5ERD.js → chunk-BC7PFQL7.js} +2 -2
- package/dist/bundle/{chunk-Q6K2XUGU.js → chunk-CBYBZCQP.js} +1 -1
- package/dist/bundle/{chunk-ZO4MQWIK.js → chunk-CIWWNBVW.js} +7 -7
- package/dist/bundle/{chunk-Q4OKEN3B.js → chunk-DIA56CS7.js} +7 -6
- package/dist/bundle/{chunk-QI3PXUOJ.js → chunk-EXVY76VO.js} +36 -30
- package/dist/bundle/{chunk-RNZKQMFY.js → chunk-FZZD4AFY.js} +11 -11
- package/dist/bundle/{chunk-5X3GU5LI.js → chunk-G5LHHAW2.js} +5 -5
- package/dist/bundle/{chunk-YI544LHI.js → chunk-GJRYZXBN.js} +8 -8
- package/dist/bundle/{chunk-NSIN5IM4.js → chunk-GY4XCLCO.js} +9 -14
- package/dist/bundle/{chunk-IRUN4XOV.js → chunk-HEIDAHRC.js} +2 -2
- package/dist/bundle/{chunk-4QNHAM3J.js → chunk-HEYVMAAQ.js} +1 -1
- package/dist/bundle/{chunk-RLQZFZLK.js → chunk-HJSJBNCJ.js} +61 -6
- package/dist/bundle/{chunk-H5FJTHVA.js → chunk-HLXVUMZJ.js} +2 -2
- package/dist/bundle/{chunk-DW3F6DUW.js → chunk-IACWKZWS.js} +1 -1
- package/dist/bundle/{chunk-JOQGJUFT.js → chunk-IXO4SCKE.js} +1 -1
- package/dist/bundle/{chunk-X7J3TTDO.js → chunk-IZOYW4Z4.js} +24 -0
- package/dist/bundle/{chunk-6PWCQKMD.js → chunk-J4OYK4WL.js} +13 -13
- package/dist/bundle/{chunk-ZR2BDNGG.js → chunk-JG4MNYG2.js} +1 -1
- package/dist/bundle/{chunk-JMLIKXFO.js → chunk-K2OGF7KC.js} +1 -1
- package/dist/bundle/chunk-K6HR6HCO.js +32 -0
- package/dist/bundle/{chunk-FKWUUCX2.js → chunk-KFB2X6KE.js} +385 -178
- package/dist/bundle/{chunk-3FD3IATT.js → chunk-KK4HD3SI.js} +5 -5
- package/dist/bundle/{chunk-HBZAJINU.js → chunk-L4QVOEOB.js} +2 -2
- package/dist/bundle/chunk-LGZPKKBN.js +53 -0
- package/dist/bundle/{chunk-O373QEAJ.js → chunk-MBFPFWCO.js} +25 -25
- package/dist/bundle/{chunk-SWKQ6IAR.js → chunk-MWGH3M46.js} +2 -2
- package/dist/bundle/{chunk-C5BMCLCQ.js → chunk-ND5H5ADM.js} +3 -3
- package/dist/bundle/{chunk-EKGRNFYQ.js → chunk-NMZQTYKJ.js} +1 -1
- package/dist/bundle/{chunk-RUASZW3M.js → chunk-OLKCJBZY.js} +4 -4
- package/dist/bundle/{chunk-MTO6YVMN.js → chunk-OLLIWNFG.js} +3 -3
- package/dist/bundle/{chunk-X47BL4M5.js → chunk-P6GXNT7Z.js} +12 -12
- package/dist/bundle/{chunk-YBQ5AYLZ.js → chunk-PGC5TRH6.js} +3 -3
- package/dist/bundle/{chunk-RN7OI5KL.js → chunk-PHHH2NQP.js} +14 -8
- package/dist/bundle/{chunk-KGOVFEWZ.js → chunk-PP3YOAWG.js} +2 -2
- package/dist/bundle/{chunk-YA45XV6G.js → chunk-PQMJ5BXH.js} +4 -4
- package/dist/bundle/{chunk-NWKKPDZV.js → chunk-QB3DP2TN.js} +1 -1
- package/dist/bundle/{chunk-BFQQV22T.js → chunk-QQUY4MZY.js} +1 -1
- package/dist/bundle/{chunk-VNKWSCN7.js → chunk-S2QRAKQI.js} +16 -16
- package/dist/bundle/{chunk-6VV7J2TN.js → chunk-SMTBV62X.js} +31 -26
- package/dist/bundle/{chunk-A6J4MPTI.js → chunk-T27IMG6X.js} +1 -1
- package/dist/bundle/{chunk-FNLUKODV.js → chunk-TY644DKQ.js} +1 -1
- package/dist/bundle/{chunk-3KSK5BBB.js → chunk-U6IQ6YQ2.js} +1 -1
- package/dist/bundle/{chunk-PT6MF2VU.js → chunk-VFU7PVPQ.js} +336 -106
- package/dist/bundle/{chunk-QVMOEB3I.js → chunk-VL6H2BND.js} +13 -13
- package/dist/bundle/{chunk-OQW6GHUA.js → chunk-WOAYHCM2.js} +1 -1
- package/dist/bundle/{chunk-TLEBSMC7.js → chunk-WX6OYVCH.js} +3968 -3527
- package/dist/bundle/{chunk-C3NYJW6B.js → chunk-XMDEM6BZ.js} +631 -79
- package/dist/bundle/{chunk-AUTX2MLF.js → chunk-XQYKIZMG.js} +11 -9
- package/dist/bundle/{chunk-KV4VTKF3.js → chunk-YNS2YVUR.js} +68 -5
- package/dist/bundle/{chunk-JWMLMAHP.js → chunk-Z5T6OW3V.js} +13 -4
- package/dist/bundle/command-contract-XSW2Q33S.js +36 -0
- package/dist/bundle/{command-server-entry-5E3PPDE5.js → command-server-entry-XMSSY5ID.js} +23 -22
- package/dist/bundle/{decode-AVWV7SVZ.js → decode-RYGB4PGT.js} +4 -4
- package/dist/bundle/{dispatch-BXPHSNK5.js → dispatch-PLQOIZG5.js} +1 -1
- package/dist/bundle/{dist-PIOOKBWT.js → dist-GY2AQETI.js} +23 -16
- package/dist/bundle/{echarts-7K6YQV52.js → echarts-7CM2MCMW.js} +2 -2
- package/dist/bundle/{embed-4NT76GJK.js → embed-FTBDPOPT.js} +5 -5
- package/dist/bundle/{embedder-ITQFF7EN.js → embedder-B43WGNBD.js} +8 -8
- package/dist/bundle/{failure-3Q65JOPD.js → failure-XP5QYV2T.js} +1 -1
- package/dist/bundle/{first-run-PM74YU4X.js → first-run-XIIUARNM.js} +9 -8
- package/dist/bundle/first-screen-Z7HC6PQU.js +34 -0
- package/dist/bundle/{instructions-JDSITYHV.js → instructions-R7OHVAWH.js} +1 -1
- package/dist/bundle/mail.js +5 -5
- package/dist/bundle/{node-D6YIJOJI.js → node-3N2JGZ7V.js} +2 -2
- package/dist/bundle/{node-sqlite-PJOHHB4X.js → node-sqlite-WFJXW3CZ.js} +9 -5
- package/dist/bundle/{oauth-BOWJ3IBT.js → oauth-SVJLQTWV.js} +6 -6
- package/dist/bundle/{open-FIAKKZMW.js → open-ZDONVKSX.js} +4 -4
- package/dist/bundle/{openai-QL54VVLC.js → openai-XVEW6XOU.js} +17 -13
- package/dist/bundle/{process-AYHK7WRC.js → process-YAHHUFR5.js} +1 -1
- package/dist/bundle/{program-6FKWOTBK.js → program-HU2UVMJE.js} +5742 -5008
- package/dist/bundle/{prompt-XJZCBELC.js → prompt-JAJ2CUJI.js} +4 -4
- package/dist/bundle/{recognize-OQKWAHBY.js → recognize-UFBWUNFR.js} +3 -3
- package/dist/bundle/{remote-NLVUZ5WK.js → remote-2GFOVLCR.js} +8 -6
- package/dist/bundle/{rerank-NRPZDTJ7.js → rerank-BGPSMXTL.js} +6 -6
- package/dist/bundle/{serve-O4YUI7F6.js → serve-CB3XJTH3.js} +8 -8
- package/dist/bundle/server-34GEF22R.js +68 -0
- package/dist/bundle/{server-WAL3M4OO.js → server-M7FQY7TX.js} +38 -36
- package/dist/bundle/{sqlite-runtime-5YHGI4D4.js → sqlite-runtime-AEV6PGDR.js} +5 -5
- package/dist/bundle/{state-WYYOJ7KK.js → state-YLBEQLBI.js} +5 -5
- package/dist/bundle/{store-6BJO3F2J.js → store-CDUL3HKK.js} +17 -14
- package/dist/bundle/{store-X72GOJHD.js → store-EKWKY6GG.js} +22 -17
- package/dist/bundle/store-maintenance-command-XH2JUM5F.js +58 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/dist/bundle/chunk-B72343TK.js +0 -35
- package/dist/bundle/command-contract-ERYYPAD2.js +0 -35
- package/dist/bundle/first-screen-WBVGVSMY.js +0 -33
- package/dist/bundle/server-6OT5ZEWL.js +0 -66
- package/dist/bundle/store-maintenance-command-ASS7RBYC.js +0 -54
|
@@ -11,23 +11,29 @@ import {
|
|
|
11
11
|
ORDER_DIRECTIONS,
|
|
12
12
|
ORDER_PURPOSES,
|
|
13
13
|
ORDER_STATUSES,
|
|
14
|
+
QUERY_LIMITS,
|
|
14
15
|
SUBSCRIPTION_STATUSES,
|
|
15
16
|
TRANSACTION_STATUSES,
|
|
16
17
|
WALLET_KINDS,
|
|
17
18
|
looksLikeReference,
|
|
18
19
|
parseReference,
|
|
19
20
|
providerLabel,
|
|
20
|
-
providerNamed
|
|
21
|
-
|
|
21
|
+
providerNamed,
|
|
22
|
+
queryError
|
|
23
|
+
} from "./chunk-5ZYFV6FD.js";
|
|
24
|
+
import {
|
|
25
|
+
fold
|
|
26
|
+
} from "./chunk-7GLJSJ7M.js";
|
|
22
27
|
import {
|
|
23
28
|
CliError,
|
|
29
|
+
isCliError,
|
|
24
30
|
singleLine
|
|
25
31
|
} from "./chunk-VUBZFMGP.js";
|
|
26
32
|
import {
|
|
27
33
|
__name
|
|
28
34
|
} from "./chunk-ZVVMGPBJ.js";
|
|
29
35
|
|
|
30
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/domain/ref-arguments.js
|
|
31
37
|
var TAKES = {
|
|
32
38
|
chat: "a chat: chat:<provider>/<account>/<chat>, its id or its title",
|
|
33
39
|
message: "a message: msg:<provider>/<account>/<chat>/<message>, or a chat and the message's id"
|
|
@@ -41,8 +47,8 @@ var wrongProvider = /* @__PURE__ */ __name((text2, provider, kind) => {
|
|
|
41
47
|
const command = entry?.command;
|
|
42
48
|
const opens = kind === "entity" ? void 0 : entry?.opens?.[kind];
|
|
43
49
|
const how = command && opens ? `open it with ${command} <profile> ${opens} ${text2}` : "open it with its own CLI";
|
|
44
|
-
const
|
|
45
|
-
return new CliError("validation_error", `${text2} is ${article(
|
|
50
|
+
const label2 = providerLabel(provider);
|
|
51
|
+
return new CliError("validation_error", `${text2} is ${article(label2.toLowerCase())} ${label2} ${kind}; ${how}`, {
|
|
46
52
|
reason: "ref.wrong-provider"
|
|
47
53
|
});
|
|
48
54
|
}, "wrongProvider");
|
|
@@ -87,7 +93,461 @@ var ensureAccount = /* @__PURE__ */ __name(async (reference, scope, profilesOn)
|
|
|
87
93
|
throw wrongAccount(reference, scope, profiles);
|
|
88
94
|
}, "ensureAccount");
|
|
89
95
|
|
|
90
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
96
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
|
|
97
|
+
var QUERY_VERSION = 1;
|
|
98
|
+
var QUERY_LIMITS2 = {
|
|
99
|
+
...QUERY_LIMITS,
|
|
100
|
+
pattern: 1024,
|
|
101
|
+
states: 1e4,
|
|
102
|
+
expansions: 1e4,
|
|
103
|
+
candidates: 5e4,
|
|
104
|
+
bodyBytes: 8388608,
|
|
105
|
+
milliseconds: 2e3,
|
|
106
|
+
work: 1e7
|
|
107
|
+
};
|
|
108
|
+
var SEARCH_QUERY = {
|
|
109
|
+
command: "search",
|
|
110
|
+
guide: "https://github.com/WireCatLabs/cli-core/blob/main/docs/search/query-language.md"
|
|
111
|
+
};
|
|
112
|
+
var MESSAGE_PARSING = { ...SEARCH_QUERY, proximity: true };
|
|
113
|
+
var MOST_WORDS_APART = 50;
|
|
114
|
+
function searchError(reason, span, alternative) {
|
|
115
|
+
queryError(reason, span, alternative, SEARCH_QUERY);
|
|
116
|
+
}
|
|
117
|
+
__name(searchError, "searchError");
|
|
118
|
+
var ANSWER_MS = 1e3;
|
|
119
|
+
var searchTimeLimit = /* @__PURE__ */ __name((deadline, now = Date.now()) => deadline?.explicit ? Math.max(QUERY_LIMITS2.milliseconds, deadline.endsAt - now - ANSWER_MS) : void 0, "searchTimeLimit");
|
|
120
|
+
function outOfTime(limitMs = QUERY_LIMITS2.milliseconds) {
|
|
121
|
+
throw new CliError("timeout", `search stopped at its time limit of ${limitMs / 1e3}s \u2014 the query is valid; add chat: or date: to search less of the store`, { reason: "query.time-limit", budget: "time", limit_ms: limitMs, complete: false });
|
|
122
|
+
}
|
|
123
|
+
__name(outOfTime, "outOfTime");
|
|
124
|
+
var isQueryLimit = /* @__PURE__ */ __name((error) => isCliError(error) && (error.details.reason === "query.too-large" || error.details.reason === "query.time-limit"), "isQueryLimit");
|
|
125
|
+
function exhausted(budget) {
|
|
126
|
+
throw new CliError("validation_error", `search exceeded its ${budget} budget \u2014 narrow the chat or date range`, {
|
|
127
|
+
reason: "query.too-large",
|
|
128
|
+
budget,
|
|
129
|
+
complete: false
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
__name(exhausted, "exhausted");
|
|
133
|
+
function tooWideTerm([term], budget) {
|
|
134
|
+
if (term === void 0)
|
|
135
|
+
exhausted(budget);
|
|
136
|
+
const part = term.replace(/[*?]+/gu, " ").trim().split(/\s+/u).sort((a, b) => b.length - a.length)[0] ?? term;
|
|
137
|
+
throw new CliError("validation_error", `search exceeded its ${budget} budget: ${term} is checked word by word, and too many messages hold it \u2014 write *${part}* (any word holding it, read from the index), more of the word, or add chat: or date:`, { reason: "query.too-large", budget, term, complete: false });
|
|
138
|
+
}
|
|
139
|
+
__name(tooWideTerm, "tooWideTerm");
|
|
140
|
+
|
|
141
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
|
|
142
|
+
var any = { kind: "char", ranges: [[0, 1114111]], negate: false };
|
|
143
|
+
var literal = /* @__PURE__ */ __name((c) => ({
|
|
144
|
+
kind: "char",
|
|
145
|
+
ranges: [[c.codePointAt(0) ?? 0, c.codePointAt(0) ?? 0]],
|
|
146
|
+
negate: false
|
|
147
|
+
}), "literal");
|
|
148
|
+
var compileAutomaton = /* @__PURE__ */ __name((pattern, span = { start: 0, end: pattern.length }) => {
|
|
149
|
+
if (pattern.length > QUERY_LIMITS2.pattern * 2)
|
|
150
|
+
exhausted("pattern");
|
|
151
|
+
const chars = [...pattern];
|
|
152
|
+
if (chars.length > QUERY_LIMITS2.pattern)
|
|
153
|
+
exhausted("pattern");
|
|
154
|
+
let at = 0, depth = 0;
|
|
155
|
+
const failure = /* @__PURE__ */ __name(() => searchError("query.invalid-regex", span, "use the supported Lucene regex subset"), "failure");
|
|
156
|
+
const character = /* @__PURE__ */ __name(() => {
|
|
157
|
+
if (at >= chars.length)
|
|
158
|
+
return failure();
|
|
159
|
+
return chars[at++];
|
|
160
|
+
}, "character");
|
|
161
|
+
const predefined = /* @__PURE__ */ __name(() => {
|
|
162
|
+
if (chars[at] !== "\\")
|
|
163
|
+
return void 0;
|
|
164
|
+
const name = chars[at + 1] ?? "";
|
|
165
|
+
let ranges;
|
|
166
|
+
if (name.toLowerCase() === "d")
|
|
167
|
+
ranges = [[48, 57]];
|
|
168
|
+
if (name.toLowerCase() === "w")
|
|
169
|
+
ranges = [
|
|
170
|
+
[48, 57],
|
|
171
|
+
[65, 90],
|
|
172
|
+
[95, 95],
|
|
173
|
+
[97, 122]
|
|
174
|
+
];
|
|
175
|
+
if (name.toLowerCase() === "s")
|
|
176
|
+
ranges = [
|
|
177
|
+
[9, 10],
|
|
178
|
+
[13, 13],
|
|
179
|
+
[32, 32]
|
|
180
|
+
];
|
|
181
|
+
if (ranges) {
|
|
182
|
+
at += 2;
|
|
183
|
+
return { kind: "char", ranges, negate: name === name.toUpperCase() };
|
|
184
|
+
}
|
|
185
|
+
if (/^[a-zA-Z]$/u.test(name))
|
|
186
|
+
return failure();
|
|
187
|
+
return void 0;
|
|
188
|
+
}, "predefined");
|
|
189
|
+
const escaped = /* @__PURE__ */ __name(() => {
|
|
190
|
+
if (chars[at] === "\\")
|
|
191
|
+
at++;
|
|
192
|
+
return character();
|
|
193
|
+
}, "escaped");
|
|
194
|
+
const union = /* @__PURE__ */ __name(() => {
|
|
195
|
+
if (++depth > QUERY_LIMITS2.depth)
|
|
196
|
+
exhausted("pattern depth");
|
|
197
|
+
const children = [concat()];
|
|
198
|
+
while (chars[at] === "|") {
|
|
199
|
+
at++;
|
|
200
|
+
children.push(concat());
|
|
201
|
+
}
|
|
202
|
+
depth--;
|
|
203
|
+
return children.length === 1 ? children[0] : { kind: "union", children };
|
|
204
|
+
}, "union");
|
|
205
|
+
const concat = /* @__PURE__ */ __name(() => {
|
|
206
|
+
const children = [];
|
|
207
|
+
do {
|
|
208
|
+
children.push(repeat());
|
|
209
|
+
} while (at < chars.length && ![")", "|", "&"].includes(chars[at] ?? ""));
|
|
210
|
+
if (chars[at] === "&")
|
|
211
|
+
searchError("query.unsupported-regex", span, "automaton intersection is not supported");
|
|
212
|
+
return children.length === 1 ? children[0] : { kind: "concat", children };
|
|
213
|
+
}, "concat");
|
|
214
|
+
const repeat = /* @__PURE__ */ __name(() => {
|
|
215
|
+
let child = simple();
|
|
216
|
+
while (["?", "*", "+", "{"].includes(chars[at] ?? "")) {
|
|
217
|
+
const op = character();
|
|
218
|
+
let min = op === "+" ? 1 : 0, max = op === "?" ? 1 : null;
|
|
219
|
+
if (op === "{") {
|
|
220
|
+
const number = /* @__PURE__ */ __name(() => {
|
|
221
|
+
const start2 = at;
|
|
222
|
+
while (/^[0-9]$/u.test(chars[at] ?? ""))
|
|
223
|
+
at++;
|
|
224
|
+
if (at === start2)
|
|
225
|
+
return failure();
|
|
226
|
+
return Number(chars.slice(start2, at).join(""));
|
|
227
|
+
}, "number");
|
|
228
|
+
min = number();
|
|
229
|
+
max = min;
|
|
230
|
+
if (chars[at] === ",") {
|
|
231
|
+
at++;
|
|
232
|
+
max = chars[at] === "}" ? null : number();
|
|
233
|
+
}
|
|
234
|
+
if (character() !== "}" || max !== null && max < min)
|
|
235
|
+
return failure();
|
|
236
|
+
}
|
|
237
|
+
if (min > QUERY_LIMITS2.states || max !== null && max > QUERY_LIMITS2.states)
|
|
238
|
+
exhausted("automaton states");
|
|
239
|
+
child = { kind: "repeat", child, min, max };
|
|
240
|
+
}
|
|
241
|
+
return child;
|
|
242
|
+
}, "repeat");
|
|
243
|
+
const simple = /* @__PURE__ */ __name(() => {
|
|
244
|
+
const predefinedAtom = predefined();
|
|
245
|
+
if (predefinedAtom)
|
|
246
|
+
return predefinedAtom;
|
|
247
|
+
const c = character();
|
|
248
|
+
if (c === "~" || c === "<")
|
|
249
|
+
searchError("query.unsupported-regex", span, "complement, named automata and numeric intervals are not supported");
|
|
250
|
+
if (c === ".")
|
|
251
|
+
return any;
|
|
252
|
+
if (c === "#")
|
|
253
|
+
return { kind: "empty" };
|
|
254
|
+
if (c === "@")
|
|
255
|
+
return { kind: "repeat", child: any, min: 0, max: null };
|
|
256
|
+
if (c === '"') {
|
|
257
|
+
const children = [];
|
|
258
|
+
while (chars[at] !== '"')
|
|
259
|
+
children.push(literal(character()));
|
|
260
|
+
at++;
|
|
261
|
+
return { kind: "concat", children };
|
|
262
|
+
}
|
|
263
|
+
if (c === "(") {
|
|
264
|
+
if (chars[at] === ")") {
|
|
265
|
+
at++;
|
|
266
|
+
return { kind: "epsilon" };
|
|
267
|
+
}
|
|
268
|
+
if (chars[at] === "?")
|
|
269
|
+
searchError("query.unsupported-regex", span, "JavaScript groups and lookaround are not Lucene operators");
|
|
270
|
+
const child = union();
|
|
271
|
+
if (character() !== ")")
|
|
272
|
+
return failure();
|
|
273
|
+
return child;
|
|
274
|
+
}
|
|
275
|
+
if (c === "[") {
|
|
276
|
+
const negate = chars[at] === "^";
|
|
277
|
+
if (negate)
|
|
278
|
+
at++;
|
|
279
|
+
const choices = [];
|
|
280
|
+
do {
|
|
281
|
+
const pre = predefined();
|
|
282
|
+
if (pre) {
|
|
283
|
+
choices.push(pre);
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
const lo = escaped().codePointAt(0) ?? 0;
|
|
287
|
+
let hi = lo;
|
|
288
|
+
if (chars[at] === "-") {
|
|
289
|
+
at++;
|
|
290
|
+
hi = escaped().codePointAt(0) ?? 0;
|
|
291
|
+
}
|
|
292
|
+
if (hi < lo)
|
|
293
|
+
return failure();
|
|
294
|
+
choices.push({ kind: "char", ranges: [[lo, hi]], negate: false });
|
|
295
|
+
} while (at < chars.length && chars[at] !== "]");
|
|
296
|
+
if (character() !== "]")
|
|
297
|
+
return failure();
|
|
298
|
+
if (!negate)
|
|
299
|
+
return { kind: "union", children: choices };
|
|
300
|
+
const ranges = [];
|
|
301
|
+
for (const choice of choices) {
|
|
302
|
+
if (choice.kind !== "char" || choice.negate)
|
|
303
|
+
searchError("query.unsupported-regex", span, "negative predefined classes inside a negated class are not supported");
|
|
304
|
+
ranges.push(...choice.ranges);
|
|
305
|
+
}
|
|
306
|
+
return { kind: "char", ranges, negate: true };
|
|
307
|
+
}
|
|
308
|
+
if (c === "\\")
|
|
309
|
+
return literal(character());
|
|
310
|
+
return literal(c);
|
|
311
|
+
}, "simple");
|
|
312
|
+
const expression = chars.length === 0 ? { kind: "epsilon" } : union();
|
|
313
|
+
if (at !== chars.length)
|
|
314
|
+
return failure();
|
|
315
|
+
const states = [];
|
|
316
|
+
const state = /* @__PURE__ */ __name(() => {
|
|
317
|
+
if (states.length >= QUERY_LIMITS2.states)
|
|
318
|
+
exhausted("automaton states");
|
|
319
|
+
states.push({ epsilon: [], edges: [] });
|
|
320
|
+
return states.length - 1;
|
|
321
|
+
}, "state");
|
|
322
|
+
const epsilon = /* @__PURE__ */ __name((from, to) => {
|
|
323
|
+
;
|
|
324
|
+
states[from].epsilon.push(to);
|
|
325
|
+
}, "epsilon");
|
|
326
|
+
const build = /* @__PURE__ */ __name((node, from, to) => {
|
|
327
|
+
if (node.kind === "char") {
|
|
328
|
+
;
|
|
329
|
+
states[from].edges.push({ to, atom: node });
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
if (node.kind === "empty")
|
|
333
|
+
return;
|
|
334
|
+
if (node.kind === "epsilon") {
|
|
335
|
+
epsilon(from, to);
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
if (node.kind === "union") {
|
|
339
|
+
for (const child of node.children)
|
|
340
|
+
build(child, from, to);
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
if (node.kind === "concat") {
|
|
344
|
+
let current2 = from;
|
|
345
|
+
node.children.forEach((child, index) => {
|
|
346
|
+
const next = index === node.children.length - 1 ? to : state();
|
|
347
|
+
build(child, current2, next);
|
|
348
|
+
current2 = next;
|
|
349
|
+
});
|
|
350
|
+
if (node.children.length === 0)
|
|
351
|
+
epsilon(from, to);
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
let current = from;
|
|
355
|
+
for (let i = 0; i < node.min; i++) {
|
|
356
|
+
const next = state();
|
|
357
|
+
build(node.child, current, next);
|
|
358
|
+
current = next;
|
|
359
|
+
}
|
|
360
|
+
if (node.max === null) {
|
|
361
|
+
epsilon(current, to);
|
|
362
|
+
const end2 = state();
|
|
363
|
+
build(node.child, current, end2);
|
|
364
|
+
epsilon(end2, current);
|
|
365
|
+
} else {
|
|
366
|
+
for (let i = node.min; i < node.max; i++) {
|
|
367
|
+
epsilon(current, to);
|
|
368
|
+
const next = state();
|
|
369
|
+
build(node.child, current, next);
|
|
370
|
+
current = next;
|
|
371
|
+
}
|
|
372
|
+
epsilon(current, to);
|
|
373
|
+
}
|
|
374
|
+
}, "build");
|
|
375
|
+
const start = state(), end = state();
|
|
376
|
+
build(expression, start, end);
|
|
377
|
+
return {
|
|
378
|
+
states: states.length,
|
|
379
|
+
test: /* @__PURE__ */ __name((text2, budget = { work: 0 }) => {
|
|
380
|
+
const spend = /* @__PURE__ */ __name(() => {
|
|
381
|
+
if (++budget.work > (budget.maxWork ?? QUERY_LIMITS2.work))
|
|
382
|
+
exhausted("automaton work");
|
|
383
|
+
}, "spend");
|
|
384
|
+
const closure = /* @__PURE__ */ __name((initial) => {
|
|
385
|
+
const stack = [...initial];
|
|
386
|
+
while (stack.length) {
|
|
387
|
+
const id = stack.pop();
|
|
388
|
+
for (const next of states[id].epsilon) {
|
|
389
|
+
spend();
|
|
390
|
+
if (!initial.has(next)) {
|
|
391
|
+
initial.add(next);
|
|
392
|
+
stack.push(next);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
return initial;
|
|
397
|
+
}, "closure");
|
|
398
|
+
let current = closure(/* @__PURE__ */ new Set([start]));
|
|
399
|
+
for (const c of text2) {
|
|
400
|
+
const point = c.codePointAt(0) ?? 0;
|
|
401
|
+
const next = /* @__PURE__ */ new Set();
|
|
402
|
+
for (const id of current)
|
|
403
|
+
for (const edge of states[id].edges) {
|
|
404
|
+
spend();
|
|
405
|
+
const inside = edge.atom.ranges.some(([lo, hi]) => point >= lo && point <= hi);
|
|
406
|
+
if (inside !== edge.atom.negate)
|
|
407
|
+
next.add(edge.to);
|
|
408
|
+
}
|
|
409
|
+
current = closure(next);
|
|
410
|
+
if (current.size === 0)
|
|
411
|
+
return false;
|
|
412
|
+
}
|
|
413
|
+
return current.has(end);
|
|
414
|
+
}, "test")
|
|
415
|
+
};
|
|
416
|
+
}, "compileAutomaton");
|
|
417
|
+
var wildcardPattern = /* @__PURE__ */ __name((value) => {
|
|
418
|
+
const chars = [...value];
|
|
419
|
+
let pattern = "";
|
|
420
|
+
for (let at = 0; at < chars.length; at++) {
|
|
421
|
+
const c = chars[at];
|
|
422
|
+
if (c === "\\") {
|
|
423
|
+
const escaped = chars[++at];
|
|
424
|
+
if (escaped === void 0)
|
|
425
|
+
searchError("query.invalid-escape", { start: 0, end: value.length });
|
|
426
|
+
pattern += /[|&?*+(){}[\].#@<>"~\\]/u.test(escaped) ? `\\${escaped}` : escaped;
|
|
427
|
+
} else
|
|
428
|
+
pattern += c === "*" ? ".*" : c === "?" ? "." : /[|&?*+(){}[\].#@<>"~\\]/u.test(c) ? `\\${c}` : c;
|
|
429
|
+
}
|
|
430
|
+
return pattern;
|
|
431
|
+
}, "wildcardPattern");
|
|
432
|
+
var FOLD_RANGE = 4096;
|
|
433
|
+
var unfoldable = /* @__PURE__ */ __name((span, what) => searchError("query.unsupported-regex", span, `${what} has no single lowercase form without accents, which is what text: words are \u2014 write it that way, or use body:/\u2026/ to match the original text`), "unfoldable");
|
|
434
|
+
var classChar = /* @__PURE__ */ __name((point) => {
|
|
435
|
+
const c = String.fromCodePoint(point);
|
|
436
|
+
return /[\p{L}\p{N}]/u.test(c) ? c : `\\${c}`;
|
|
437
|
+
}, "classChar");
|
|
438
|
+
var foldRegex = /* @__PURE__ */ __name((pattern, span) => {
|
|
439
|
+
const chars = [...pattern.normalize("NFC")];
|
|
440
|
+
let out = "";
|
|
441
|
+
let at = 0;
|
|
442
|
+
const literal2 = /* @__PURE__ */ __name((c) => {
|
|
443
|
+
if (!/[\p{L}\p{N}\p{M}]/u.test(c))
|
|
444
|
+
return c;
|
|
445
|
+
const folded = fold(c);
|
|
446
|
+
if (folded === "")
|
|
447
|
+
return unfoldable(span, `"${c}"`);
|
|
448
|
+
if ([...folded].length === 1 && /[\p{L}\p{N}]/u.test(folded))
|
|
449
|
+
return folded;
|
|
450
|
+
if (folded.includes('"'))
|
|
451
|
+
return unfoldable(span, `"${c}"`);
|
|
452
|
+
return `"${folded}"`;
|
|
453
|
+
}, "literal");
|
|
454
|
+
const characterClass = /* @__PURE__ */ __name(() => {
|
|
455
|
+
const begin = at - 1;
|
|
456
|
+
let negate = "";
|
|
457
|
+
if (chars[at] === "^") {
|
|
458
|
+
negate = "^";
|
|
459
|
+
at++;
|
|
460
|
+
}
|
|
461
|
+
const kept2 = [];
|
|
462
|
+
const points = /* @__PURE__ */ new Set();
|
|
463
|
+
do {
|
|
464
|
+
const start = at;
|
|
465
|
+
if (chars[at] === "\\" && /^[a-zA-Z]$/u.test(chars[at + 1] ?? "")) {
|
|
466
|
+
kept2.push(`\\${chars[at + 1]}`);
|
|
467
|
+
at += 2;
|
|
468
|
+
continue;
|
|
469
|
+
}
|
|
470
|
+
const escaped = /* @__PURE__ */ __name(() => {
|
|
471
|
+
if (chars[at] === "\\")
|
|
472
|
+
at++;
|
|
473
|
+
return (chars[at++] ?? "").codePointAt(0) ?? 0;
|
|
474
|
+
}, "escaped");
|
|
475
|
+
const lo = escaped();
|
|
476
|
+
let hi = lo;
|
|
477
|
+
if (chars[at] === "-") {
|
|
478
|
+
at++;
|
|
479
|
+
hi = escaped();
|
|
480
|
+
}
|
|
481
|
+
if (at > chars.length) {
|
|
482
|
+
out += chars.slice(begin).join("");
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
const single = /* @__PURE__ */ __name((point) => [...fold(String.fromCodePoint(point))], "single");
|
|
486
|
+
if (hi < lo)
|
|
487
|
+
kept2.push(chars.slice(start, at).join(""));
|
|
488
|
+
else if (hi - lo >= FOLD_RANGE) {
|
|
489
|
+
if (single(lo).join("") !== String.fromCodePoint(lo) || single(hi).join("") !== String.fromCodePoint(hi))
|
|
490
|
+
unfoldable(span, `the range ${chars.slice(start, at).join("")}`);
|
|
491
|
+
kept2.push(chars.slice(start, at).join(""));
|
|
492
|
+
} else
|
|
493
|
+
for (let point = lo; point <= hi; point++) {
|
|
494
|
+
const folded = single(point);
|
|
495
|
+
if (folded.length === 1)
|
|
496
|
+
points.add(folded[0]?.codePointAt(0) ?? 0);
|
|
497
|
+
else if (lo === hi)
|
|
498
|
+
unfoldable(span, `"${String.fromCodePoint(point)}"`);
|
|
499
|
+
}
|
|
500
|
+
} while (at < chars.length && chars[at] !== "]");
|
|
501
|
+
const sorted = [...points].sort((a, b) => a - b);
|
|
502
|
+
const ranges = [];
|
|
503
|
+
for (let i = 0; i < sorted.length; i++) {
|
|
504
|
+
const first = sorted[i];
|
|
505
|
+
while (sorted[i + 1] === sorted[i] + 1)
|
|
506
|
+
i++;
|
|
507
|
+
const last = sorted[i];
|
|
508
|
+
ranges.push(last === first ? classChar(first) : `${classChar(first)}-${classChar(last)}`);
|
|
509
|
+
}
|
|
510
|
+
if (!kept2.length && !ranges.length)
|
|
511
|
+
unfoldable(span, "the class");
|
|
512
|
+
out += `[${negate}${kept2.join("")}${ranges.join("")}`;
|
|
513
|
+
}, "characterClass");
|
|
514
|
+
while (at < chars.length) {
|
|
515
|
+
const c = chars[at++];
|
|
516
|
+
if (c === "\\") {
|
|
517
|
+
const next = chars[at++];
|
|
518
|
+
if (next === void 0)
|
|
519
|
+
out += c;
|
|
520
|
+
else
|
|
521
|
+
out += (next.codePointAt(0) ?? 0) < 128 ? `${c}${next}` : literal2(next);
|
|
522
|
+
} else if (c === '"') {
|
|
523
|
+
const end = chars.indexOf('"', at);
|
|
524
|
+
if (end < 0) {
|
|
525
|
+
out += chars.slice(at - 1).join("");
|
|
526
|
+
break;
|
|
527
|
+
}
|
|
528
|
+
const folded = fold(chars.slice(at, end).join(""));
|
|
529
|
+
if (folded.includes('"'))
|
|
530
|
+
unfoldable(span, `"${chars.slice(at, end).join("")}"`);
|
|
531
|
+
out += `"${folded}"`;
|
|
532
|
+
at = end + 1;
|
|
533
|
+
} else if (c === "[")
|
|
534
|
+
characterClass();
|
|
535
|
+
else
|
|
536
|
+
out += literal2(c);
|
|
537
|
+
}
|
|
538
|
+
return out;
|
|
539
|
+
}, "foldRegex");
|
|
540
|
+
|
|
541
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/search/trigrams.js
|
|
542
|
+
var trigrams = /* @__PURE__ */ __name((term) => {
|
|
543
|
+
const padded = ` ${term} `;
|
|
544
|
+
const pieces = /* @__PURE__ */ new Set();
|
|
545
|
+
for (let at = 0; at + 3 <= padded.length; at++)
|
|
546
|
+
pieces.add(padded.slice(at, at + 3));
|
|
547
|
+
return [...pieces];
|
|
548
|
+
}, "trigrams");
|
|
549
|
+
|
|
550
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/resolve.js
|
|
91
551
|
var isId = /* @__PURE__ */ __name((reference) => /^-?\d+$/.test(reference.trim()), "isId");
|
|
92
552
|
var foldName = /* @__PURE__ */ __name((name) => name.normalize("NFC").replace(/[\uFE0E\uFE0F\u200D]/g, "").toLowerCase().replaceAll("\u0451", "\u0435"), "foldName");
|
|
93
553
|
var pickChat = /* @__PURE__ */ __name((reference, chats) => {
|
|
@@ -115,24 +575,50 @@ var pickPerson = /* @__PURE__ */ __name((reference, people) => {
|
|
|
115
575
|
throw new CliError("not_found", `no person ${trimmed} in what this account has seen`);
|
|
116
576
|
const wanted = foldName(trimmed.replace(/^@/, ""));
|
|
117
577
|
const everyone = people.all().toSorted((a, b) => (a.name ?? "").localeCompare(b.name ?? ""));
|
|
118
|
-
const
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
578
|
+
const exact = everyone.filter((person) => namesOf(person).includes(wanted));
|
|
579
|
+
const containing = everyone.filter((person) => namesOf(person).some((one) => one.includes(wanted)));
|
|
580
|
+
if (exact.length === 1 && exact[0])
|
|
581
|
+
return exact[0];
|
|
582
|
+
if (containing.length === 1 && containing[0])
|
|
583
|
+
return containing[0];
|
|
584
|
+
if (containing.length === 0)
|
|
124
585
|
throw new CliError("not_found", `nobody matches "${reference}"`);
|
|
586
|
+
const matches = exact.length > 0 ? [...exact, ...containing.filter((person) => !exact.includes(person))] : containing;
|
|
125
587
|
throw ambiguous(reference, "people", matches.map(({ id, name, username }) => ({ id, name, username })), ({ name, username }) => singleLine([name, username && `@${username}`].filter(isPresent).join(" ")));
|
|
126
588
|
}, "pickPerson");
|
|
127
|
-
var
|
|
589
|
+
var namesOf = /* @__PURE__ */ __name((person, byAddress = false) => [person.alias, person.name, person.username, byAddress ? person.id : void 0].filter(isPresent).map(foldName), "namesOf");
|
|
590
|
+
var chatNamesOf = /* @__PURE__ */ __name((chat) => [chat.title, chat.providerMetadata?.username].filter((one) => typeof one === "string" && one !== "").map(foldName), "chatNamesOf");
|
|
591
|
+
var namePattern = /* @__PURE__ */ __name((pattern) => {
|
|
592
|
+
const automaton = compileAutomaton(wildcardPattern(foldName(pattern.trim().replace(/^@/, ""))));
|
|
593
|
+
return (names) => names.some((one) => automaton.test(one));
|
|
594
|
+
}, "namePattern");
|
|
595
|
+
var peopleMatching = /* @__PURE__ */ __name((pattern, people, { byAddress = false } = {}) => {
|
|
596
|
+
const fits = namePattern(pattern);
|
|
597
|
+
return people.filter((person) => fits(namesOf(person, byAddress)));
|
|
598
|
+
}, "peopleMatching");
|
|
599
|
+
var chatsMatching = /* @__PURE__ */ __name((pattern, chats) => {
|
|
600
|
+
const fits = namePattern(pattern);
|
|
601
|
+
return chats.filter((chat) => fits(chatNamesOf(chat)));
|
|
602
|
+
}, "chatsMatching");
|
|
603
|
+
var nearest = /* @__PURE__ */ __name((pattern, items, names, most = 5) => {
|
|
604
|
+
const pieces = /* @__PURE__ */ __name((text2) => foldName(text2).split(/\s+/u).flatMap(trigrams), "pieces");
|
|
605
|
+
const wanted = new Set(pieces(pattern.replace(/\\(.)/gu, "$1").replace(/[*?@]/gu, " ").trim()));
|
|
606
|
+
if (wanted.size === 0)
|
|
607
|
+
return [];
|
|
608
|
+
return items.map((item) => ({
|
|
609
|
+
item,
|
|
610
|
+
score: names(item).flatMap(pieces).filter((piece) => wanted.has(piece)).length
|
|
611
|
+
})).filter(({ score }) => score > 1).toSorted((a, b) => b.score - a.score).slice(0, most).map(({ item }) => item);
|
|
612
|
+
}, "nearest");
|
|
613
|
+
var ambiguous = /* @__PURE__ */ __name((reference, what, candidates, label2) => {
|
|
128
614
|
const width = Math.max(...candidates.map(({ id }) => id.length));
|
|
129
|
-
const lines = candidates.map((candidate) => ` ${candidate.id.padEnd(width)} ${
|
|
615
|
+
const lines = candidates.map((candidate) => ` ${candidate.id.padEnd(width)} ${label2(candidate)}`).join("\n");
|
|
130
616
|
return new CliError("validation_error", `"${singleLine(reference)}" matches ${candidates.length} ${what} \u2014 name one by its id:
|
|
131
617
|
${lines}`, { candidates });
|
|
132
618
|
}, "ambiguous");
|
|
133
619
|
var isPresent = /* @__PURE__ */ __name((value) => value !== null && value !== void 0, "isPresent");
|
|
134
620
|
|
|
135
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
621
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/domain/record-fields.js
|
|
136
622
|
var DECIMAL_PATTERN = "^[0-9]{1,16}(\\.[0-9]{1,6})?$";
|
|
137
623
|
var SIGNED_DECIMAL = "^-?[0-9]{1,16}(\\.[0-9]{1,6})?$";
|
|
138
624
|
var DAY = "^[0-9]{4}-[0-9]{2}-[0-9]{2}$";
|
|
@@ -182,7 +668,7 @@ var arrayOf = /* @__PURE__ */ __name((item, maxItems, description) => ({
|
|
|
182
668
|
}), "arrayOf");
|
|
183
669
|
var isObject = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isObject");
|
|
184
670
|
|
|
185
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
671
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/domain/record-types.js
|
|
186
672
|
var kept = /* @__PURE__ */ __name((description) => ({ description }), "kept");
|
|
187
673
|
var PARTY = ["person", "organization"];
|
|
188
674
|
var ORGANIZATION = ["organization"];
|
|
@@ -556,44 +1042,7 @@ var hasV1Roles = /* @__PURE__ */ __name((type) => rolesOf(type).some(([, role])
|
|
|
556
1042
|
var IDENTITY_TYPES = RECORD_ENTITY_TYPES.filter((type) => RECORD_TYPES[type].review === "identity");
|
|
557
1043
|
var article2 = /* @__PURE__ */ __name((word) => /^[aeiou]/.test(word) ? "an" : "a", "article");
|
|
558
1044
|
|
|
559
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
560
|
-
var COUNTER_FIELDS = ["views", "reactions", "comments"];
|
|
561
|
-
var validCounter = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isFinite(value) && value >= 0, "validCounter");
|
|
562
|
-
var counterValue = /* @__PURE__ */ __name((message, field) => {
|
|
563
|
-
const value = field === "reactions" ? message.reactions?.total : message.providerMetadata?.[field];
|
|
564
|
-
return validCounter(value) ? value : null;
|
|
565
|
-
}, "counterValue");
|
|
566
|
-
var counterObservationTime = /* @__PURE__ */ __name((observation, now) => {
|
|
567
|
-
const at = Date.parse(observation.observedAt);
|
|
568
|
-
if (!validCounter(observation.value) || !Number.isSafeInteger(at) || at < 0 || at > now || !["remote_fetch", "remote_update"].includes(observation.source))
|
|
569
|
-
throw new CliError("validation_error", "counter observation needs a valid value, source and nonfuture observation time");
|
|
570
|
-
if (observation.reactions && (!validCounter(observation.reactions.total) || observation.reactions.total !== observation.value))
|
|
571
|
-
throw new CliError("validation_error", "reaction observation payload and total disagree");
|
|
572
|
-
return at;
|
|
573
|
-
}, "counterObservationTime");
|
|
574
|
-
var observedCounters = /* @__PURE__ */ __name((message, observedAt, fields, source = "remote_fetch") => {
|
|
575
|
-
const observations = {};
|
|
576
|
-
for (const field of fields) {
|
|
577
|
-
const value = counterValue(message, field);
|
|
578
|
-
if (value !== null)
|
|
579
|
-
observations[field] = {
|
|
580
|
-
value,
|
|
581
|
-
observedAt,
|
|
582
|
-
source,
|
|
583
|
-
...field === "reactions" && message.reactions ? { reactions: message.reactions } : {}
|
|
584
|
-
};
|
|
585
|
-
}
|
|
586
|
-
return { ...message, counterObservations: observations };
|
|
587
|
-
}, "observedCounters");
|
|
588
|
-
var counterFreshness = /* @__PURE__ */ __name((states) => {
|
|
589
|
-
if (!states.length || states.every((one) => one.freshness === "unknown"))
|
|
590
|
-
return "unknown";
|
|
591
|
-
if (states.some((one) => one.freshness === "unknown"))
|
|
592
|
-
return "partial";
|
|
593
|
-
return states.some((one) => one.freshness === "stale") ? "stale" : "fresh";
|
|
594
|
-
}, "counterFreshness");
|
|
595
|
-
|
|
596
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/domain/addresses.js
|
|
1045
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/domain/addresses.js
|
|
597
1046
|
var EMAIL_ADDRESS = /^[^\s@]+@[^\s@]+\.[^\s@]+$/u;
|
|
598
1047
|
var isEmailAddress = /* @__PURE__ */ __name((value) => EMAIL_ADDRESS.test(value), "isEmailAddress");
|
|
599
1048
|
var ROLE_ADDRESS_WORDS = {
|
|
@@ -651,9 +1100,11 @@ var localWord = /* @__PURE__ */ __name((address) => {
|
|
|
651
1100
|
return bare(local.split("+")[0] ?? "");
|
|
652
1101
|
}, "localWord");
|
|
653
1102
|
var isRoleAddress = /* @__PURE__ */ __name((address) => ROLE.has(localWord(address)), "isRoleAddress");
|
|
1103
|
+
var PERSON_LIKE = /* @__PURE__ */ new Set(["hr"]);
|
|
1104
|
+
var isPersonLikeRoleAddress = /* @__PURE__ */ __name((address) => PERSON_LIKE.has(localWord(address)), "isPersonLikeRoleAddress");
|
|
654
1105
|
var isNoReplyAddress = /* @__PURE__ */ __name((address) => NO_REPLY.has(localWord(address)), "isNoReplyAddress");
|
|
655
1106
|
|
|
656
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1107
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/domain/display-names.js
|
|
657
1108
|
var QUOTES = [
|
|
658
1109
|
['"', '"'],
|
|
659
1110
|
["'", "'"],
|
|
@@ -683,9 +1134,23 @@ var displayName = /* @__PURE__ */ __name((name, fallbacks = {}) => {
|
|
|
683
1134
|
const cleaned = PLACEHOLDERS.has(unwrapped.toLowerCase()) ? "" : unwrapped;
|
|
684
1135
|
if (READABLE.test(cleaned))
|
|
685
1136
|
return cleaned;
|
|
1137
|
+
const borrowed = fallbacks.name === void 0 || fallbacks.name === null ? null : displayName(fallbacks.name);
|
|
1138
|
+
if (borrowed !== null && READABLE.test(borrowed) && !borrowed.startsWith("@"))
|
|
1139
|
+
return borrowed;
|
|
686
1140
|
const username = given(fallbacks.username);
|
|
687
1141
|
return (username === void 0 ? void 0 : username.startsWith("@") ? username : `@${username}`) ?? given(fallbacks.phone) ?? given(fallbacks.email) ?? (cleaned === "" ? null : cleaned);
|
|
688
1142
|
}, "displayName");
|
|
1143
|
+
var present = /* @__PURE__ */ __name((value) => typeof value === "string" && value !== "" ? value : null, "present");
|
|
1144
|
+
var takeFallbacks = /* @__PURE__ */ __name((into, identity) => {
|
|
1145
|
+
const named = displayName(identity.name);
|
|
1146
|
+
if (into.name === null && isReadable(named) && !named?.startsWith("@"))
|
|
1147
|
+
into.name = named;
|
|
1148
|
+
into.username ??= present(identity.username);
|
|
1149
|
+
into.phone ??= present(identity.phone) ?? (identity.provider === "phone" ? identity.id : null);
|
|
1150
|
+
into.email ??= present(identity.email) ?? (identity.provider === "email" ? identity.id : null);
|
|
1151
|
+
return into;
|
|
1152
|
+
}, "takeFallbacks");
|
|
1153
|
+
var noFallbacks = /* @__PURE__ */ __name(() => ({ name: null, username: null, phone: null, email: null }), "noFallbacks");
|
|
689
1154
|
var nameKey = /* @__PURE__ */ __name((name) => {
|
|
690
1155
|
if (typeof name !== "string")
|
|
691
1156
|
return null;
|
|
@@ -697,7 +1162,44 @@ var nameKey = /* @__PURE__ */ __name((name) => {
|
|
|
697
1162
|
}, "nameKey");
|
|
698
1163
|
var isReadable = /* @__PURE__ */ __name((shown) => shown !== null && READABLE.test(shown), "isReadable");
|
|
699
1164
|
|
|
700
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1165
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/domain/counters.js
|
|
1166
|
+
var COUNTER_FIELDS = ["views", "reactions", "comments"];
|
|
1167
|
+
var validCounter = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isFinite(value) && value >= 0, "validCounter");
|
|
1168
|
+
var counterValue = /* @__PURE__ */ __name((message, field) => {
|
|
1169
|
+
const value = field === "reactions" ? message.reactions?.total : message.providerMetadata?.[field];
|
|
1170
|
+
return validCounter(value) ? value : null;
|
|
1171
|
+
}, "counterValue");
|
|
1172
|
+
var counterObservationTime = /* @__PURE__ */ __name((observation, now) => {
|
|
1173
|
+
const at = Date.parse(observation.observedAt);
|
|
1174
|
+
if (!validCounter(observation.value) || !Number.isSafeInteger(at) || at < 0 || at > now || !["remote_fetch", "remote_update"].includes(observation.source))
|
|
1175
|
+
throw new CliError("validation_error", "counter observation needs a valid value, source and nonfuture observation time");
|
|
1176
|
+
if (observation.reactions && (!validCounter(observation.reactions.total) || observation.reactions.total !== observation.value))
|
|
1177
|
+
throw new CliError("validation_error", "reaction observation payload and total disagree");
|
|
1178
|
+
return at;
|
|
1179
|
+
}, "counterObservationTime");
|
|
1180
|
+
var observedCounters = /* @__PURE__ */ __name((message, observedAt, fields, source = "remote_fetch") => {
|
|
1181
|
+
const observations = {};
|
|
1182
|
+
for (const field of fields) {
|
|
1183
|
+
const value = counterValue(message, field);
|
|
1184
|
+
if (value !== null)
|
|
1185
|
+
observations[field] = {
|
|
1186
|
+
value,
|
|
1187
|
+
observedAt,
|
|
1188
|
+
source,
|
|
1189
|
+
...field === "reactions" && message.reactions ? { reactions: message.reactions } : {}
|
|
1190
|
+
};
|
|
1191
|
+
}
|
|
1192
|
+
return { ...message, counterObservations: observations };
|
|
1193
|
+
}, "observedCounters");
|
|
1194
|
+
var counterFreshness = /* @__PURE__ */ __name((states) => {
|
|
1195
|
+
if (!states.length || states.every((one) => one.freshness === "unknown"))
|
|
1196
|
+
return "unknown";
|
|
1197
|
+
if (states.some((one) => one.freshness === "unknown"))
|
|
1198
|
+
return "partial";
|
|
1199
|
+
return states.some((one) => one.freshness === "stale") ? "stale" : "fresh";
|
|
1200
|
+
}, "counterFreshness");
|
|
1201
|
+
|
|
1202
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/domain/rankings-options.js
|
|
701
1203
|
var MESSAGE_MEASURES = ["views", "reactions", "forwards", "comments", "replies", "thread-size"];
|
|
702
1204
|
var AUTHOR_MEASURES = [
|
|
703
1205
|
"messages",
|
|
@@ -837,10 +1339,10 @@ var withoutUrls = /* @__PURE__ */ __name((text2) => text2.replace(/\S+/gu, (toke
|
|
|
837
1339
|
var rankingWords = /* @__PURE__ */ __name((text2) => withoutUrls(text2).match(/[\p{L}\p{N}]+/gu)?.length ?? 0, "rankingWords");
|
|
838
1340
|
var rankingQuestion = /* @__PURE__ */ __name((text2) => withoutUrls(text2).includes("?"), "rankingQuestion");
|
|
839
1341
|
|
|
840
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1342
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/domain/records.js
|
|
841
1343
|
import { createHash } from "node:crypto";
|
|
842
1344
|
|
|
843
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1345
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
|
|
844
1346
|
var PHONE_PLANS = [
|
|
845
1347
|
{
|
|
846
1348
|
country: "us",
|
|
@@ -1220,7 +1722,7 @@ var PHONE_PLANS = [
|
|
|
1220
1722
|
}
|
|
1221
1723
|
];
|
|
1222
1724
|
|
|
1223
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1725
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/domain/phones.js
|
|
1224
1726
|
var PHONE_COUNTRIES = PHONE_PLANS.map((plan) => plan.country);
|
|
1225
1727
|
var DEFAULT_PHONE_COUNTRIES = ["ru"];
|
|
1226
1728
|
var parsePhoneCountries = /* @__PURE__ */ __name((value) => {
|
|
@@ -1294,7 +1796,7 @@ var storedPhone = /* @__PURE__ */ __name((raw, provider) => {
|
|
|
1294
1796
|
return found ? `+${found[1]}` : void 0;
|
|
1295
1797
|
}, "storedPhone");
|
|
1296
1798
|
|
|
1297
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1799
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/domain/records.js
|
|
1298
1800
|
var RECORDS_SCHEMA_VERSION = 1;
|
|
1299
1801
|
var RECORD_OPERATIONS = ["upsert", "delete"];
|
|
1300
1802
|
var LINE_OPTIONS = ["text", "products"];
|
|
@@ -1465,23 +1967,73 @@ var fieldReferences = /* @__PURE__ */ __name((record, options = {}) => {
|
|
|
1465
1967
|
return found;
|
|
1466
1968
|
}, "fieldReferences");
|
|
1467
1969
|
|
|
1468
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1469
|
-
var
|
|
1470
|
-
var
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1970
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.647.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_a46df5420a4458268e3f15f3e8c41b99/node_modules/@wirecat/cli-core/dist/domain/relation-role-labels.js
|
|
1971
|
+
var label = /* @__PURE__ */ __name((en, ru, es) => ({ en, ru, es }), "label");
|
|
1972
|
+
var ROLE_LABELS = {
|
|
1973
|
+
organization: {
|
|
1974
|
+
employee: label("Employee", "\u0421\u043E\u0442\u0440\u0443\u0434\u043D\u0438\u043A", "Empleado"),
|
|
1975
|
+
contractor: label("Contractor", "\u041F\u043E\u0434\u0440\u044F\u0434\u0447\u0438\u043A", "Contratista"),
|
|
1976
|
+
founder: label("Founder", "\u041E\u0441\u043D\u043E\u0432\u0430\u0442\u0435\u043B\u044C", "Fundador"),
|
|
1977
|
+
owner: label("Owner", "\u0412\u043B\u0430\u0434\u0435\u043B\u0435\u0446", "Propietario"),
|
|
1978
|
+
manager: label("Manager", "\u0420\u0443\u043A\u043E\u0432\u043E\u0434\u0438\u0442\u0435\u043B\u044C", "Directivo"),
|
|
1979
|
+
adviser: label("Adviser", "\u0421\u043E\u0432\u0435\u0442\u043D\u0438\u043A", "Asesor"),
|
|
1980
|
+
contact: label("Contact", "\u041A\u043E\u043D\u0442\u0430\u043A\u0442", "Contacto")
|
|
1981
|
+
},
|
|
1982
|
+
project: {
|
|
1983
|
+
owner: label("Owner", "\u0412\u043B\u0430\u0434\u0435\u043B\u0435\u0446", "Propietario"),
|
|
1984
|
+
manager: label("Manager", "\u0420\u0443\u043A\u043E\u0432\u043E\u0434\u0438\u0442\u0435\u043B\u044C", "Directivo"),
|
|
1985
|
+
contributor: label("Contributor", "\u0423\u0447\u0430\u0441\u0442\u043D\u0438\u043A", "Colaborador"),
|
|
1986
|
+
"client-contact": label("Client contact", "\u041A\u043E\u043D\u0442\u0430\u043A\u0442 \u043A\u043B\u0438\u0435\u043D\u0442\u0430", "Contacto del cliente"),
|
|
1987
|
+
approver: label("Approver", "\u0421\u043E\u0433\u043B\u0430\u0441\u0443\u044E\u0449\u0438\u0439", "Aprobador")
|
|
1988
|
+
},
|
|
1989
|
+
deal: {
|
|
1990
|
+
owner: label("Responsible", "\u041E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043D\u043D\u044B\u0439", "Responsable"),
|
|
1991
|
+
contact: label("Contact", "\u041A\u043E\u043D\u0442\u0430\u043A\u0442", "Contacto"),
|
|
1992
|
+
"decision-maker": label("Decision-maker", "\u041F\u0440\u0438\u043D\u0438\u043C\u0430\u0435\u0442 \u0440\u0435\u0448\u0435\u043D\u0438\u0435", "Responsable de decidir"),
|
|
1993
|
+
influencer: label("Influencer", "\u0412\u043B\u0438\u044F\u0435\u0442 \u043D\u0430 \u0440\u0435\u0448\u0435\u043D\u0438\u0435", "Influye en la decisi\xF3n")
|
|
1994
|
+
},
|
|
1995
|
+
contract: {
|
|
1996
|
+
customer: label("Customer", "\u0417\u0430\u043A\u0430\u0437\u0447\u0438\u043A", "Cliente"),
|
|
1997
|
+
supplier: label("Supplier", "\u041F\u043E\u0441\u0442\u0430\u0432\u0449\u0438\u043A", "Proveedor"),
|
|
1998
|
+
signatory: label("Signatory", "\u041F\u043E\u0434\u043F\u0438\u0441\u0430\u043D\u0442", "Firmante"),
|
|
1999
|
+
guarantor: label("Guarantor", "\u041F\u043E\u0440\u0443\u0447\u0438\u0442\u0435\u043B\u044C", "Garante")
|
|
2000
|
+
},
|
|
2001
|
+
related: {
|
|
2002
|
+
colleague: label("Colleague", "\u041A\u043E\u043B\u043B\u0435\u0433\u0430", "Colega"),
|
|
2003
|
+
adviser: label("Adviser", "\u0421\u043E\u0432\u0435\u0442\u043D\u0438\u043A", "Asesor"),
|
|
2004
|
+
investor: label("Investor", "\u0418\u043D\u0432\u0435\u0441\u0442\u043E\u0440", "Inversor"),
|
|
2005
|
+
mentor: label("Mentor", "\u041D\u0430\u0441\u0442\u0430\u0432\u043D\u0438\u043A", "Mentor"),
|
|
2006
|
+
family: label("Family", "\u0421\u0435\u043C\u044C\u044F", "Familia"),
|
|
2007
|
+
friend: label("Friend", "\u0414\u0440\u0443\u0433", "Amigo")
|
|
2008
|
+
}
|
|
2009
|
+
};
|
|
1476
2010
|
|
|
1477
2011
|
export {
|
|
1478
2012
|
chatReferenceOf,
|
|
1479
2013
|
wrongAccount,
|
|
1480
2014
|
ensureAccount,
|
|
2015
|
+
QUERY_VERSION,
|
|
2016
|
+
QUERY_LIMITS2 as QUERY_LIMITS,
|
|
2017
|
+
SEARCH_QUERY,
|
|
2018
|
+
MESSAGE_PARSING,
|
|
2019
|
+
MOST_WORDS_APART,
|
|
2020
|
+
searchError,
|
|
2021
|
+
searchTimeLimit,
|
|
2022
|
+
outOfTime,
|
|
2023
|
+
isQueryLimit,
|
|
2024
|
+
exhausted,
|
|
2025
|
+
tooWideTerm,
|
|
2026
|
+
compileAutomaton,
|
|
2027
|
+
wildcardPattern,
|
|
2028
|
+
foldRegex,
|
|
2029
|
+
trigrams,
|
|
1481
2030
|
isId,
|
|
1482
2031
|
foldName,
|
|
1483
2032
|
pickChat,
|
|
1484
2033
|
pickPerson,
|
|
2034
|
+
peopleMatching,
|
|
2035
|
+
chatsMatching,
|
|
2036
|
+
nearest,
|
|
1485
2037
|
isObject,
|
|
1486
2038
|
RECORD_TYPES,
|
|
1487
2039
|
isRecordType,
|
|
@@ -1499,6 +2051,11 @@ export {
|
|
|
1499
2051
|
hasV1Roles,
|
|
1500
2052
|
IDENTITY_TYPES,
|
|
1501
2053
|
article2 as article,
|
|
2054
|
+
isEmailAddress,
|
|
2055
|
+
ROLE_ADDRESS_WORDS,
|
|
2056
|
+
isRoleAddress,
|
|
2057
|
+
isPersonLikeRoleAddress,
|
|
2058
|
+
isNoReplyAddress,
|
|
1502
2059
|
DEFAULT_PHONE_COUNTRIES,
|
|
1503
2060
|
parsePhoneCountries,
|
|
1504
2061
|
nationalPhone,
|
|
@@ -1506,19 +2063,17 @@ export {
|
|
|
1506
2063
|
e164Of,
|
|
1507
2064
|
BARE_INTERNATIONAL_PROVIDERS,
|
|
1508
2065
|
storedPhone,
|
|
2066
|
+
displayName,
|
|
2067
|
+
takeFallbacks,
|
|
2068
|
+
noFallbacks,
|
|
2069
|
+
nameKey,
|
|
2070
|
+
isReadable,
|
|
1509
2071
|
COUNTER_FIELDS,
|
|
1510
2072
|
validCounter,
|
|
1511
2073
|
counterValue,
|
|
1512
2074
|
counterObservationTime,
|
|
1513
2075
|
observedCounters,
|
|
1514
2076
|
counterFreshness,
|
|
1515
|
-
isEmailAddress,
|
|
1516
|
-
ROLE_ADDRESS_WORDS,
|
|
1517
|
-
isRoleAddress,
|
|
1518
|
-
isNoReplyAddress,
|
|
1519
|
-
displayName,
|
|
1520
|
-
nameKey,
|
|
1521
|
-
isReadable,
|
|
1522
2077
|
MESSAGE_MEASURES,
|
|
1523
2078
|
AUTHOR_MEASURES,
|
|
1524
2079
|
needsRankingContext,
|
|
@@ -1535,8 +2090,5 @@ export {
|
|
|
1535
2090
|
envelopeOfJsonl,
|
|
1536
2091
|
envelopeOfText,
|
|
1537
2092
|
fieldReferences,
|
|
1538
|
-
|
|
1539
|
-
isCrmUserId,
|
|
1540
|
-
normalCrmUserId,
|
|
1541
|
-
isItemKind
|
|
2093
|
+
ROLE_LABELS
|
|
1542
2094
|
};
|