@wirecat/zoom-cli 0.80.0 → 0.82.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/contracts/wirecat.json +71 -3
- package/dist/answers.d.ts +100 -0
- package/dist/answers.d.ts.map +1 -1
- package/dist/bin/zm.js +2 -2
- package/dist/bundle/agent-F4TRJWWS.js +46 -0
- package/dist/bundle/{all-profiles-5GOKWOT4.js → all-profiles-RULEKTDQ.js} +64 -22
- package/dist/bundle/answer-policy-6XC57AEZ.js +131 -0
- package/dist/bundle/{anthropic-NHXMOFYS.js → anthropic-4NAQBZFL.js} +6 -6
- package/dist/bundle/{app-server-HFW5Z5PI.js → app-server-VLR42U5L.js} +92 -80
- package/dist/bundle/{bun-M5IGY2TG.js → bun-OPDGMZZQ.js} +2 -2
- package/dist/bundle/{bun-sqlite-MTP5JJQ2.js → bun-sqlite-HC6X4AOX.js} +7 -7
- package/dist/bundle/{chunk-TNL3YQ33.js → chunk-274SLQNW.js} +2 -2
- package/dist/bundle/{chunk-5CJ6AAUI.js → chunk-2CI2OEZQ.js} +4 -4
- package/dist/bundle/{chunk-GVKZZT7E.js → chunk-2DBF2IIC.js} +7 -78
- package/dist/bundle/{chunk-NRVMK5H3.js → chunk-2GP573Q4.js} +15748 -11939
- package/dist/bundle/{chunk-4OAR7BGU.js → chunk-2JHVQMVC.js} +1 -1
- package/dist/bundle/{chunk-XKLU5KV2.js → chunk-2SWKQ7C4.js} +1 -1
- package/dist/bundle/{chunk-W3GZ7JUO.js → chunk-2XBDILVW.js} +1 -1
- package/dist/bundle/{chunk-3UONR5HW.js → chunk-3HC5F3P7.js} +1 -1
- package/dist/bundle/{chunk-VN7TKMOW.js → chunk-3YM4B2GT.js} +1 -1
- package/dist/bundle/{chunk-PCPOO5FS.js → chunk-434YFJAE.js} +2 -2
- package/dist/bundle/{chunk-CW6CPQHI.js → chunk-4HLQ2JGK.js} +4 -4
- package/dist/bundle/{chunk-RT7C3SSJ.js → chunk-4N7PP76S.js} +1 -1
- package/dist/bundle/{chunk-JJX4HKDV.js → chunk-52Y4ETKU.js} +4 -4
- package/dist/bundle/{chunk-BIKHHFD2.js → chunk-5HAUK3I4.js} +2166 -2760
- package/dist/bundle/{chunk-W2QDYMAM.js → chunk-5KYQ53EF.js} +13 -9
- package/dist/bundle/{chunk-BW5JEOBE.js → chunk-5TU7Y5UW.js} +12 -12
- package/dist/bundle/{chunk-P2JTVRGU.js → chunk-66ALX4ZI.js} +168 -168
- package/dist/bundle/{chunk-EPIA2UUM.js → chunk-676C2LE6.js} +12 -12
- package/dist/bundle/{chunk-BNEJKGG7.js → chunk-6CWL5BKG.js} +78 -76
- package/dist/bundle/{chunk-TDBVM2SS.js → chunk-6QYZP4E2.js} +3 -3
- package/dist/bundle/{chunk-JXSEH64A.js → chunk-6VK332XS.js} +3 -3
- package/dist/bundle/{chunk-W7M4JYEE.js → chunk-73MOMNLL.js} +1 -1
- package/dist/bundle/{chunk-K672XJ2P.js → chunk-7QPIUMUG.js} +12 -12
- package/dist/bundle/{chunk-CWCDCNXA.js → chunk-7UVDPRFK.js} +6 -6
- package/dist/bundle/{chunk-RMX2WPWS.js → chunk-A6EZK5RG.js} +4 -4
- package/dist/bundle/{chunk-ONJPUFLX.js → chunk-AC6VJNMJ.js} +1 -1
- package/dist/bundle/{chunk-QIK2IBJ4.js → chunk-ACI4YIEH.js} +23 -7
- package/dist/bundle/{chunk-UX4JZMA4.js → chunk-AIKFOBDO.js} +278 -59
- package/dist/bundle/{chunk-GCPO7T2X.js → chunk-ASBDFXLS.js} +3 -3
- package/dist/bundle/{chunk-O4ZBFATF.js → chunk-B32KZRQM.js} +12 -12
- package/dist/bundle/{chunk-5RVXXDN7.js → chunk-BBGJQMRI.js} +1 -1
- package/dist/bundle/chunk-BDKVOU3I.js +52 -0
- package/dist/bundle/{chunk-GCUOZ2OA.js → chunk-BP4FYANF.js} +6 -6
- package/dist/bundle/{chunk-XTCAWNBP.js → chunk-DCYFT3FR.js} +4 -4
- package/dist/bundle/{chunk-FPUGMDJV.js → chunk-DNCLQPOM.js} +1 -1
- package/dist/bundle/{chunk-PKW3TPNP.js → chunk-DSZYABYL.js} +38 -19
- package/dist/bundle/{chunk-6MDL2LZA.js → chunk-E745WZKY.js} +8 -8
- package/dist/bundle/chunk-EGTCQKHV.js +340 -0
- package/dist/bundle/chunk-EQG3PIH2.js +108 -0
- package/dist/bundle/{chunk-ZPZT46O6.js → chunk-ESN3W2MZ.js} +48 -12
- package/dist/bundle/{chunk-7U5X37TE.js → chunk-G46WJ7YO.js} +6 -6
- package/dist/bundle/{chunk-L6FM5RQY.js → chunk-G6PETRMV.js} +3 -3
- package/dist/bundle/chunk-GBHMT2IU.js +755 -0
- package/dist/bundle/{chunk-6QCBTBDA.js → chunk-GGMAIIVE.js} +1 -1
- package/dist/bundle/{chunk-6I4C4ZFT.js → chunk-GTKPMYK7.js} +2 -2
- package/dist/bundle/{chunk-N5YUHN6S.js → chunk-GWGHH56B.js} +12 -12
- package/dist/bundle/{chunk-5XO2AY6D.js → chunk-HC6VN5CO.js} +10 -10
- package/dist/bundle/{chunk-ARL2TTPZ.js → chunk-HP7A2ZOP.js} +9 -9
- package/dist/bundle/chunk-HZENBDW2.js +209 -0
- package/dist/bundle/{chunk-ST3ZB7LS.js → chunk-IANKXHSE.js} +1 -1
- package/dist/bundle/{chunk-GGKEQQME.js → chunk-ICPJT672.js} +13 -9
- package/dist/bundle/chunk-JQ54DYAQ.js +80 -0
- package/dist/bundle/chunk-K5JGJIV2.js +640 -0
- package/dist/bundle/{chunk-DYRISFHZ.js → chunk-KJ6USQDZ.js} +19 -9
- package/dist/bundle/{chunk-TMYZKDQ7.js → chunk-KKFY23AK.js} +65 -65
- package/dist/bundle/chunk-KQPUVXKX.js +84 -0
- package/dist/bundle/{chunk-BPSURRAD.js → chunk-KVJ3I7UL.js} +43 -64
- package/dist/bundle/{chunk-NXFKZFTC.js → chunk-KWU46LNK.js} +3 -3
- package/dist/bundle/chunk-KXJ3JEDH.js +2 -0
- package/dist/bundle/{chunk-YAA2D6RP.js → chunk-L75SMSJR.js} +5 -5
- package/dist/bundle/{chunk-OXPHJEJ2.js → chunk-LAYYO4WD.js} +3 -3
- package/dist/bundle/{chunk-6PIXP5IH.js → chunk-LEKKTJKK.js} +40 -26
- package/dist/bundle/{chunk-3AOESMW6.js → chunk-M7H4MCAX.js} +18 -259
- package/dist/bundle/{chunk-DZ6H3YJH.js → chunk-MAJJ4PG3.js} +19 -16
- package/dist/bundle/{chunk-G5VH4WUF.js → chunk-MQLPZBMQ.js} +2 -2
- package/dist/bundle/{chunk-3Z7CFQTI.js → chunk-N3JLO63O.js} +1 -1
- package/dist/bundle/{chunk-NMETTKCV.js → chunk-N46F72AF.js} +14 -14
- package/dist/bundle/{chunk-A3TUG2DP.js → chunk-NB7EOAUZ.js} +36 -1
- package/dist/bundle/{chunk-BRMV33MO.js → chunk-NEMX3UNN.js} +4 -4
- package/dist/bundle/{chunk-6CDMGT6Q.js → chunk-OBXQLFT5.js} +2 -2
- package/dist/bundle/{chunk-HH7GR6TN.js → chunk-OGNO35A2.js} +6 -6
- package/dist/bundle/{chunk-Q6MISDKJ.js → chunk-OIPYBF43.js} +3 -3
- package/dist/bundle/{chunk-6LY4LBSD.js → chunk-OO4TRVPB.js} +7 -7
- package/dist/bundle/{chunk-CHEHK6IW.js → chunk-OQFQ77AY.js} +214 -118
- package/dist/bundle/{chunk-5D4AEUVA.js → chunk-PL5P7UKW.js} +434 -1
- package/dist/bundle/{chunk-Q5LUGY2V.js → chunk-PMUPN6JW.js} +9 -9
- package/dist/bundle/chunk-PSKTMMCO.js +561 -0
- package/dist/bundle/{chunk-U5N2PKKM.js → chunk-PWVJUIDQ.js} +2 -2
- package/dist/bundle/{chunk-475P3LWG.js → chunk-Q7ICVP25.js} +1 -1
- package/dist/bundle/{chunk-JGSVWLL2.js → chunk-QG6PILDO.js} +2 -2
- package/dist/bundle/{chunk-5K54M6RD.js → chunk-QPHBK63S.js} +1 -1
- package/dist/bundle/{chunk-RFXJLG5V.js → chunk-QVSL5WJ7.js} +5173 -3077
- package/dist/bundle/{chunk-IQWBGMCR.js → chunk-QVYAV7F2.js} +4 -4
- package/dist/bundle/{chunk-XIHENZW6.js → chunk-R2B6PUVI.js} +4 -4
- package/dist/bundle/{chunk-MH4L5LL6.js → chunk-RQOZBTNI.js} +16 -3
- package/dist/bundle/{chunk-FSLR2YGR.js → chunk-T7IAWEBU.js} +7 -7
- package/dist/bundle/{chunk-D4HKTC2T.js → chunk-TKNM22OH.js} +2 -2
- package/dist/bundle/{chunk-EI37UXDR.js → chunk-TKVBFJ5C.js} +1 -1
- package/dist/bundle/{chunk-O3DYRCIT.js → chunk-TXDR6YSF.js} +1 -1
- package/dist/bundle/{chunk-CWXOXIWS.js → chunk-TY7NDMFY.js} +1 -1
- package/dist/bundle/{chunk-Z3CPZ4I4.js → chunk-UAWSINMC.js} +306 -306
- package/dist/bundle/{chunk-4F7Q5CET.js → chunk-UKAAAOPC.js} +31 -180
- package/dist/bundle/{chunk-XL4ND7CZ.js → chunk-UL2PXLKT.js} +26 -26
- package/dist/bundle/{chunk-GRYXOSN6.js → chunk-UQCTXZEP.js} +10 -10
- package/dist/bundle/{chunk-E3JVLVVB.js → chunk-UR5DBODY.js} +37 -30
- package/dist/bundle/{chunk-SUG6YGAF.js → chunk-V5EJSF2B.js} +237 -167
- package/dist/bundle/{chunk-HGSBLY6M.js → chunk-VB72LTSZ.js} +12 -12
- package/dist/bundle/{chunk-2XZ2YKW4.js → chunk-VB7FZOYX.js} +2 -100
- package/dist/bundle/{chunk-PMO2Z6DQ.js → chunk-VS6WURLX.js} +3 -3
- package/dist/bundle/{chunk-5QXQIZJY.js → chunk-VZ5PPYDG.js} +3 -4
- package/dist/bundle/{chunk-YR5TRWT2.js → chunk-W5QHB53X.js} +287 -580
- package/dist/bundle/{chunk-2P6MQH4V.js → chunk-WMANRJR5.js} +6 -6
- package/dist/bundle/chunk-WOPVBRPV.js +29 -0
- package/dist/bundle/{chunk-W32HK7KG.js → chunk-XQ2WL3HB.js} +2 -2
- package/dist/bundle/{chunk-FIJREKLA.js → chunk-XQQVMECZ.js} +3 -3
- package/dist/bundle/{chunk-75JW7X2W.js → chunk-Y6PVS55U.js} +71 -61
- package/dist/bundle/{chunk-EMYRUJCV.js → chunk-YJXJJ2XP.js} +8 -8
- package/dist/bundle/{chunk-L2TURFT6.js → chunk-YY7XKHDY.js} +10 -3
- package/dist/bundle/chunk-ZED2CJW5.js +353 -0
- package/dist/bundle/chunk-ZOYOXWJB.js +746 -0
- package/dist/bundle/{cli-QNBYDOKV.js → cli-U4O5XB7J.js} +171 -124
- package/dist/bundle/command-contract-FBTK6GQX.js +45 -0
- package/dist/bundle/{command-server-entry-WMA4SWJ5.js → command-server-entry-KKH6ZWJV.js} +35 -35
- package/dist/bundle/config-FRJSIZNN.js +118 -0
- package/dist/bundle/{decode-7PXUXNIP.js → decode-TPCNXEK4.js} +6 -6
- package/dist/bundle/{dispatch-AWDROXWN.js → dispatch-FKMIPCPQ.js} +9 -9
- package/dist/bundle/{dist-TSBH4FOU.js → dist-7CLBCYZN.js} +23 -21
- package/dist/bundle/dist-PAKDDIBT.js +191 -0
- package/dist/bundle/{echarts-WIDIUEO6.js → echarts-O3TNDAXJ.js} +2 -2
- package/dist/bundle/{embed-EIRVQF5E.js → embed-WCJSFVSK.js} +7 -7
- package/dist/bundle/{embedder-MXPM6OXK.js → embedder-TBBUPXBX.js} +10 -10
- package/dist/bundle/{failure-JZW73RP7.js → failure-XTWBYI2A.js} +3 -3
- package/dist/bundle/first-run-ELEMFW42.js +29 -0
- package/dist/bundle/first-screen-DIOBWMKP.js +46 -0
- package/dist/bundle/{folders-TGFOE7DY.js → folders-LXOL4N4S.js} +5 -5
- package/dist/bundle/{instructions-D5LNE6NJ.js → instructions-AMH5RWVJ.js} +1 -1
- package/dist/bundle/{main-OHW5Z56X.js → main-YAA7WQ23.js} +24 -24
- package/dist/bundle/{mcp-RGNRW77S.js → mcp-5HFPWC3W.js} +2 -2
- package/dist/bundle/meeting-combined-UXCF4SJ3.js +26 -0
- package/dist/bundle/meeting-model-3BZJ3EQP.js +26 -0
- package/dist/bundle/{meeting-semantic-FYOVY4S2.js → meeting-semantic-3HU7I2SJ.js} +8 -8
- package/dist/bundle/{meetings-WI4SXPBJ.js → meetings-XWMB6FOH.js} +7 -7
- package/dist/bundle/{node-UEWUFR7N.js → node-EGMCBAO7.js} +2 -2
- package/dist/bundle/{node-sqlite-FJWKJHYU.js → node-sqlite-IJBWENFX.js} +8 -8
- package/dist/bundle/oauth-SZDDAP7A.js +20 -0
- package/dist/bundle/{open-EFYTWUGC.js → open-NS3TMKZX.js} +6 -6
- package/dist/bundle/openai-4DN6WI3B.js +28 -0
- package/dist/bundle/{output-file-J4SU6X4I.js → output-file-2UB5JP3R.js} +6 -6
- package/dist/bundle/{process-U5PLNIDC.js → process-SGHEN6MQ.js} +1 -1
- package/dist/bundle/{program-3JICCSA6.js → program-GVCGZP27.js} +170 -160
- package/dist/bundle/{prompt-YPDMSOKC.js → prompt-HJFMPFVC.js} +6 -6
- package/dist/bundle/public-C2ZB2AGQ.js +198 -0
- package/dist/bundle/{recognize-Z2SSWUKH.js → recognize-2SEI5PPM.js} +5 -5
- package/dist/bundle/{remote-R5HMDHOG.js → remote-2DMS74XE.js} +11 -11
- package/dist/bundle/{rerank-6NGBEMQ2.js → rerank-H6GCYVIA.js} +8 -8
- package/dist/bundle/run-log-QU26SUZP.js +145 -0
- package/dist/bundle/{serve-CU3RMWU7.js → serve-ODVRPFJO.js} +11 -11
- package/dist/bundle/server-NBPF6IDZ.js +95 -0
- package/dist/bundle/{server-SOQSVX2Q.js → server-PCLIO24L.js} +82 -69
- package/dist/bundle/{services-LROZ3RDT.js → services-4QAPXBLO.js} +60 -54
- package/dist/bundle/{speech-AS77HFIF.js → speech-MA6ZT3WE.js} +28 -28
- package/dist/bundle/{sqlite-runtime-U25NS6BK.js → sqlite-runtime-PVMAUXRN.js} +7 -7
- package/dist/bundle/{state-CPEVKK66.js → state-QFMTYUME.js} +7 -7
- package/dist/bundle/{store-6CHRMJM7.js → store-25OTAQC3.js} +31 -24
- package/dist/bundle/{store-QKHCZOYR.js → store-F724QIKJ.js} +34 -26
- package/dist/bundle/store-connection-OGPXANGB.js +111 -0
- package/dist/bundle/store-maintenance-command-2CM7LLNQ.js +83 -0
- package/dist/bundle/{streaming-VDJOYGMO.js → streaming-S22C4DG5.js} +7 -7
- package/dist/bundle/surface-7PXHWCF6.js +81 -0
- package/dist/bundle/{tokens-JBN2OHQB.js → tokens-NLUHA2DW.js} +11 -10
- package/dist/bundle/zm.js +9 -9
- package/dist/bundle/{zoom-app-Q4IKYNG3.js → zoom-app-YWFB367P.js} +8 -8
- package/dist/commands.d.ts +1 -0
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +8 -2
- package/dist/commands.js.map +1 -1
- package/dist/setup-commands.d.ts +1 -1
- package/dist/setup-commands.d.ts.map +1 -1
- package/dist/setup-commands.js +31 -5
- package/dist/setup-commands.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/zoom-api/types.d.ts +5 -0
- package/dist/zoom-api/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/bundle/answer-policy-7PYXHK2I.js +0 -122
- package/dist/bundle/chunk-3BTRJYIT.js +0 -729
- package/dist/bundle/chunk-M4LAF627.js +0 -719
- package/dist/bundle/command-contract-CT6MV6YG.js +0 -45
- package/dist/bundle/config-ZFQFDEVL.js +0 -109
- package/dist/bundle/first-run-K6EHRAIM.js +0 -29
- package/dist/bundle/first-screen-C6AF4KT4.js +0 -45
- package/dist/bundle/meeting-combined-3OKFXZNA.js +0 -26
- package/dist/bundle/meeting-model-4XNF725D.js +0 -26
- package/dist/bundle/oauth-KOONTGLW.js +0 -20
- package/dist/bundle/openai-6Y2JRDNY.js +0 -28
- package/dist/bundle/run-log-LG3TI3WI.js +0 -136
- package/dist/bundle/server-X7JYRMKX.js +0 -85
- package/dist/bundle/store-connection-FCDVOPWB.js +0 -102
- package/dist/bundle/store-maintenance-command-6HVOAHOZ.js +0 -77
|
@@ -19,16 +19,302 @@ import {
|
|
|
19
19
|
reference,
|
|
20
20
|
string,
|
|
21
21
|
variant
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-ESN3W2MZ.js";
|
|
23
23
|
import {
|
|
24
24
|
CliError,
|
|
25
25
|
isCliError
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-IANKXHSE.js";
|
|
27
27
|
import {
|
|
28
28
|
__name
|
|
29
29
|
} from "./chunk-ZVVMGPBJ.js";
|
|
30
30
|
|
|
31
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
31
|
+
// node_modules/.pnpm/@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/help.js
|
|
32
|
+
var shownOf = /* @__PURE__ */ __name((registry) => registry.backend === "native" ? registry.fields.filter((field) => field.native) : registry.fields, "shownOf");
|
|
33
|
+
var leftOut = /* @__PURE__ */ __name((fields) => fields.filter((field) => field.negatable).map((field) => field.name), "leftOut");
|
|
34
|
+
var has = /* @__PURE__ */ __name((fields, operator) => fields.some((field) => field.operators.includes(operator)), "has");
|
|
35
|
+
var syntaxOf = /* @__PURE__ */ __name((shown, backend) => [
|
|
36
|
+
"field:value",
|
|
37
|
+
...has(shown, "phrase") ? ['"a phrase"'] : [],
|
|
38
|
+
...has(shown, "wildcard") ? ["word*"] : [],
|
|
39
|
+
...backend === "native" ? ["terms joined by AND"] : ["AND OR NOT", "( )"],
|
|
40
|
+
...has(shown, "range") ? ["[a TO b] \xB7 > >= < <="] : []
|
|
41
|
+
].join(" \xB7 "), "syntaxOf");
|
|
42
|
+
var kindOf = /* @__PURE__ */ __name((field) => field.values ? `${field.type}: ${field.values.join("|")}` : `${field.type}: ${field.operators.join(", ")}`, "kindOf");
|
|
43
|
+
var fieldsHelp = /* @__PURE__ */ __name((registry, guide) => {
|
|
44
|
+
const shown = shownOf(registry);
|
|
45
|
+
const negatable = leftOut(shown);
|
|
46
|
+
const rows = shown.map((field) => [field.name, kindOf(field), field.example]);
|
|
47
|
+
const widths = [0, 1].map((at) => Math.max(...rows.map((row) => (row[at] ?? "").length)));
|
|
48
|
+
return [
|
|
49
|
+
"Fields:",
|
|
50
|
+
...rows.map(([name = "", kind = "", example = ""]) => ` ${name.padEnd(widths[0] ?? 0)} ${kind.padEnd(widths[1] ?? 0)} ${example}`.trimEnd()),
|
|
51
|
+
...registry.defaults && registry.defaults.length > 0 ? [`Defaults: ${registry.defaults.join(" ")} \u2014 name the field to change it`] : [],
|
|
52
|
+
...negatable.length > 0 ? [`Leave out: -${negatable[0]}:value or NOT ${negatable[0]}:value, for ${negatable.join(", ")}`] : [],
|
|
53
|
+
`Syntax: ${syntaxOf(shown, registry.backend)}`,
|
|
54
|
+
...guide ? [`Guide: ${guide}`] : []
|
|
55
|
+
].join("\n");
|
|
56
|
+
}, "fieldsHelp");
|
|
57
|
+
var queryDescription = /* @__PURE__ */ __name((registry) => {
|
|
58
|
+
const shown = shownOf(registry);
|
|
59
|
+
if (shown.length === 0)
|
|
60
|
+
return "field:value terms; this list filters by none yet, so any term is refused";
|
|
61
|
+
const negatable = leftOut(shown);
|
|
62
|
+
const terms = registry.backend === "native" ? `field:value terms joined by AND that narrow the list${negatable.length > 0 ? `; -field:value or NOT field:value leaves out what matches, for ${negatable.join(", ")} only` : ""}` : `field:value terms that narrow the list (Lucene: AND OR NOT, -field:value${has(shown, "range") ? ", [a TO b], > <" : ""})`;
|
|
63
|
+
const fields = shown.map((field) => field.values ? `${field.name} (${field.values.join("|")})` : field.name);
|
|
64
|
+
const defaults = registry.defaults?.length ? `; unless named: ${registry.defaults.join(" ")}` : "";
|
|
65
|
+
return `${terms}; fields: ${fields.join(", ")}; e.g. ${shown[0]?.example ?? ""}${defaults}`;
|
|
66
|
+
}, "queryDescription");
|
|
67
|
+
|
|
68
|
+
// node_modules/.pnpm/@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/types.js
|
|
69
|
+
var QUERY_LIMITS = {
|
|
70
|
+
bytes: 8192,
|
|
71
|
+
depth: 32,
|
|
72
|
+
nodes: 256
|
|
73
|
+
};
|
|
74
|
+
var spanSchema = object({ start: number(), end: number() });
|
|
75
|
+
var predicateSchema = object({
|
|
76
|
+
kind: literal("predicate"),
|
|
77
|
+
field: string(),
|
|
78
|
+
operator: picklist(["term", "phrase", "wildcard", "regex", "range"]),
|
|
79
|
+
value: string(),
|
|
80
|
+
upper: optional(string()),
|
|
81
|
+
lower_inclusive: optional(boolean()),
|
|
82
|
+
upper_inclusive: optional(boolean()),
|
|
83
|
+
span: spanSchema,
|
|
84
|
+
implicit: optional(literal(true)),
|
|
85
|
+
slop: optional(pipe(number(), integer(), minValue(0)))
|
|
86
|
+
});
|
|
87
|
+
var queryNodeSchema = variant("kind", [
|
|
88
|
+
predicateSchema,
|
|
89
|
+
object({
|
|
90
|
+
kind: literal("boolean"),
|
|
91
|
+
clauses: array(object({ occur: picklist(["must", "should", "must_not"]), node: lazy(() => queryNodeSchema) })),
|
|
92
|
+
span: spanSchema
|
|
93
|
+
})
|
|
94
|
+
]);
|
|
95
|
+
var queryAstSchema = object({
|
|
96
|
+
version: literal(1),
|
|
97
|
+
language: literal("lucene-v1"),
|
|
98
|
+
root: queryNodeSchema
|
|
99
|
+
});
|
|
100
|
+
function queryError(reason, span, alternative, context = {}, details = {}) {
|
|
101
|
+
throw new CliError("validation_error", `${context.command ?? "query"}: ${reason} at position ${span.start + 1}${alternative ? ` \u2014 ${alternative}` : ""}`, {
|
|
102
|
+
reason,
|
|
103
|
+
span,
|
|
104
|
+
...alternative ? { alternative } : {},
|
|
105
|
+
...context.guide ? { guide: context.guide } : {},
|
|
106
|
+
...details
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
__name(queryError, "queryError");
|
|
110
|
+
var walkQuery = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? [node] : node.clauses.flatMap(({ node: node2 }) => walkQuery(node2)), "walkQuery");
|
|
111
|
+
|
|
112
|
+
// node_modules/.pnpm/@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/dates.js
|
|
113
|
+
var timezoneOf = /* @__PURE__ */ __name((given) => {
|
|
114
|
+
const zone = given ?? Intl.DateTimeFormat().resolvedOptions().timeZone ?? "UTC";
|
|
115
|
+
try {
|
|
116
|
+
new Intl.DateTimeFormat("en", { timeZone: zone }).format(0);
|
|
117
|
+
} catch {
|
|
118
|
+
queryError("query.invalid-timezone", { start: 0, end: 0 }, "use an IANA timezone such as Europe/Madrid");
|
|
119
|
+
}
|
|
120
|
+
return zone;
|
|
121
|
+
}, "timezoneOf");
|
|
122
|
+
var calendar = /* @__PURE__ */ __name((value, span) => {
|
|
123
|
+
if (!/^\d{4}-\d{2}-\d{2}$/u.test(value))
|
|
124
|
+
queryError("query.invalid-date", span, "use an ISO date such as 2026-10-01");
|
|
125
|
+
const year = Number(value.slice(0, 4)), month = Number(value.slice(5, 7)), day = Number(value.slice(8, 10));
|
|
126
|
+
const date = /* @__PURE__ */ new Date(0);
|
|
127
|
+
date.setUTCFullYear(year, month - 1, day);
|
|
128
|
+
date.setUTCHours(0, 0, 0, 0);
|
|
129
|
+
if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month - 1 || date.getUTCDate() !== day)
|
|
130
|
+
queryError("query.invalid-date", span);
|
|
131
|
+
return date;
|
|
132
|
+
}, "calendar");
|
|
133
|
+
var dayBoundary = /* @__PURE__ */ __name((value, zone, next, span) => {
|
|
134
|
+
const date = calendar(value, span);
|
|
135
|
+
if (next)
|
|
136
|
+
date.setUTCDate(date.getUTCDate() + 1);
|
|
137
|
+
const wanted = date.getUTCFullYear() * 1e4 + (date.getUTCMonth() + 1) * 100 + date.getUTCDate();
|
|
138
|
+
const formatter = new Intl.DateTimeFormat("en-CA", {
|
|
139
|
+
timeZone: zone,
|
|
140
|
+
year: "numeric",
|
|
141
|
+
month: "2-digit",
|
|
142
|
+
day: "2-digit",
|
|
143
|
+
era: "short"
|
|
144
|
+
});
|
|
145
|
+
const dayAt = /* @__PURE__ */ __name((time) => {
|
|
146
|
+
const parts = formatter.formatToParts(time);
|
|
147
|
+
const value2 = /* @__PURE__ */ __name((name) => Number(parts.find((p) => p.type === name)?.value), "value");
|
|
148
|
+
const year = parts.find((p) => p.type === "era")?.value === "BC" ? 1 - value2("year") : value2("year");
|
|
149
|
+
return year * 1e4 + value2("month") * 100 + value2("day");
|
|
150
|
+
}, "dayAt");
|
|
151
|
+
let lo = date.getTime() - 2 * 864e5, hi = date.getTime() + 2 * 864e5;
|
|
152
|
+
while (lo < hi) {
|
|
153
|
+
const mid = Math.floor((lo + hi) / 2);
|
|
154
|
+
if (dayAt(mid) < wanted)
|
|
155
|
+
lo = mid + 1;
|
|
156
|
+
else
|
|
157
|
+
hi = mid;
|
|
158
|
+
}
|
|
159
|
+
if (dayAt(lo) !== wanted)
|
|
160
|
+
queryError("query.invalid-date", span, "this calendar day does not exist in the selected timezone");
|
|
161
|
+
return lo;
|
|
162
|
+
}, "dayBoundary");
|
|
163
|
+
var WALL = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?$/u;
|
|
164
|
+
var wallTime = /* @__PURE__ */ __name((value, zone, span) => {
|
|
165
|
+
const [, year, month, day, hour, minute, second = "0", fraction = "0"] = WALL.exec(value) ?? [];
|
|
166
|
+
if (year === void 0)
|
|
167
|
+
queryError("query.invalid-date", span, "use YYYY-MM-DDTHH:mm, with optional seconds");
|
|
168
|
+
const wanted = Date.UTC(Number(year), Number(month) - 1, Number(day), Number(hour), Number(minute), Number(second), Number(fraction.padEnd(3, "0")));
|
|
169
|
+
const check = new Date(wanted);
|
|
170
|
+
if (check.getUTCDate() !== Number(day) || check.getUTCHours() !== Number(hour) || check.getUTCMinutes() !== Number(minute) || check.getUTCSeconds() !== Number(second))
|
|
171
|
+
queryError("query.invalid-date", span);
|
|
172
|
+
const formatter = new Intl.DateTimeFormat("en-CA", {
|
|
173
|
+
timeZone: zone,
|
|
174
|
+
year: "numeric",
|
|
175
|
+
month: "2-digit",
|
|
176
|
+
day: "2-digit",
|
|
177
|
+
hour: "2-digit",
|
|
178
|
+
minute: "2-digit",
|
|
179
|
+
second: "2-digit",
|
|
180
|
+
hourCycle: "h23"
|
|
181
|
+
});
|
|
182
|
+
const shown = /* @__PURE__ */ __name((instant) => {
|
|
183
|
+
const parts = Object.fromEntries(formatter.formatToParts(instant).map((part) => [part.type, Number(part.value)]));
|
|
184
|
+
return Date.UTC(parts.year ?? 0, (parts.month ?? 1) - 1, parts.day, parts.hour, parts.minute, parts.second) + (instant % 1e3 + 1e3) % 1e3;
|
|
185
|
+
}, "shown");
|
|
186
|
+
const found = /* @__PURE__ */ new Set();
|
|
187
|
+
for (const probe of [wanted - 864e5, wanted, wanted + 864e5]) {
|
|
188
|
+
const candidate = wanted - (shown(probe) - probe);
|
|
189
|
+
if (shown(candidate) === wanted)
|
|
190
|
+
found.add(candidate);
|
|
191
|
+
}
|
|
192
|
+
if (found.size !== 1)
|
|
193
|
+
queryError("query.invalid-date", span, "this local time is skipped or repeated by daylight saving; add an offset");
|
|
194
|
+
return [...found][0];
|
|
195
|
+
}, "wallTime");
|
|
196
|
+
var ZONED = /(?:Z|[+-]\d{2}:?\d{2})$/iu;
|
|
197
|
+
var zonedMoment = /* @__PURE__ */ __name((value, zone, span, { end = false } = {}) => {
|
|
198
|
+
if (/^\d{4}-\d{2}-\d{2}$/u.test(value))
|
|
199
|
+
return dayBoundary(value, zone, end, span) - (end ? 1 : 0);
|
|
200
|
+
if (!ZONED.test(value))
|
|
201
|
+
return wallTime(value, zone, span);
|
|
202
|
+
const time = Date.parse(value);
|
|
203
|
+
if (!/^\d{4}-\d{2}-\d{2}T/u.test(value) || !Number.isFinite(time))
|
|
204
|
+
queryError("query.invalid-date", span);
|
|
205
|
+
calendar(value.slice(0, 10), span);
|
|
206
|
+
return time;
|
|
207
|
+
}, "zonedMoment");
|
|
208
|
+
var AGO = /^(\d+)(m|h|d)$/u;
|
|
209
|
+
var MOMENT = /^(\d{4}-\d{2}-\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.\d{1,3})?)?(Z|[+-]\d{2}:\d{2})?$/u;
|
|
210
|
+
var AGO_MS = { m: 6e4, h: 36e5, d: 864e5 };
|
|
211
|
+
var dayOf = /* @__PURE__ */ __name((word, zone, now, span) => {
|
|
212
|
+
const today = new Intl.DateTimeFormat("en-CA", {
|
|
213
|
+
timeZone: zone,
|
|
214
|
+
year: "numeric",
|
|
215
|
+
month: "2-digit",
|
|
216
|
+
day: "2-digit"
|
|
217
|
+
}).format(now);
|
|
218
|
+
if (word === "today")
|
|
219
|
+
return today;
|
|
220
|
+
const date = calendar(today, span);
|
|
221
|
+
date.setUTCDate(date.getUTCDate() - 1);
|
|
222
|
+
return date.toISOString().slice(0, 10);
|
|
223
|
+
}, "dayOf");
|
|
224
|
+
var dateEndpoint = /* @__PURE__ */ __name((value, zone, side, inclusive, span, now = Date.now()) => {
|
|
225
|
+
if (value === "*")
|
|
226
|
+
return { inclusive };
|
|
227
|
+
const word = value.toLowerCase();
|
|
228
|
+
if (word === "today" || word === "yesterday")
|
|
229
|
+
return dateEndpoint(dayOf(word, zone, now, span), zone, side, inclusive, span);
|
|
230
|
+
const [, amount, unit] = AGO.exec(word) ?? [];
|
|
231
|
+
if (amount && unit)
|
|
232
|
+
return { time: now - Number(amount) * (AGO_MS[unit] ?? 0), inclusive };
|
|
233
|
+
if (/^\d{4}-\d{2}-\d{2}$/u.test(value))
|
|
234
|
+
return {
|
|
235
|
+
time: dayBoundary(value, zone, side === "lower" ? !inclusive : inclusive, span),
|
|
236
|
+
inclusive: side === "lower"
|
|
237
|
+
};
|
|
238
|
+
const [, day, hour, minute, second = "0", offset] = MOMENT.exec(value) ?? [];
|
|
239
|
+
if (day === void 0)
|
|
240
|
+
queryError("query.invalid-date", span, "use an ISO date, a date and time such as 2026-10-01T09:00 (optional seconds and offset), today, yesterday or 30m/2h/7d ago");
|
|
241
|
+
const moment = value.replace(" ", "T");
|
|
242
|
+
if (offset === void 0)
|
|
243
|
+
return { time: wallTime(moment, zone, span), inclusive };
|
|
244
|
+
calendar(day, span);
|
|
245
|
+
const time = Date.parse(moment);
|
|
246
|
+
if (!Number.isFinite(time) || Number(hour) > 23 || Number(minute) > 59 || Number(second) > 59)
|
|
247
|
+
queryError("query.invalid-date", span);
|
|
248
|
+
return { time, inclusive };
|
|
249
|
+
}, "dateEndpoint");
|
|
250
|
+
var dateRange = /* @__PURE__ */ __name((lower, upper, lowerInclusive, upperInclusive, zone, span, now = Date.now()) => {
|
|
251
|
+
const since = lower === upper && AGO.test(lower.toLowerCase());
|
|
252
|
+
const lo = dateEndpoint(lower, zone, "lower", lowerInclusive, span, now);
|
|
253
|
+
const hi = dateEndpoint(since ? "*" : upper, zone, "upper", upperInclusive, span, now);
|
|
254
|
+
return {
|
|
255
|
+
...lo.time === void 0 ? {} : { lower: lo.time },
|
|
256
|
+
...hi.time === void 0 ? {} : { upper: hi.time },
|
|
257
|
+
lower_inclusive: lo.inclusive,
|
|
258
|
+
upper_inclusive: hi.inclusive
|
|
259
|
+
};
|
|
260
|
+
}, "dateRange");
|
|
261
|
+
|
|
262
|
+
// node_modules/.pnpm/@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/evaluate.js
|
|
263
|
+
var wordsOf = /* @__PURE__ */ __name((text) => text.toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? [], "wordsOf");
|
|
264
|
+
var pattern = /* @__PURE__ */ __name((value) => new RegExp(`^${[...value].map((char) => char === "*" ? ".*" : char === "?" ? "." : char.replace(/[.+^${}()|[\]\\]/, "\\$&")).join("")}$`, "iu"), "pattern");
|
|
265
|
+
var present = /* @__PURE__ */ __name((value) => value !== void 0 && value !== null && value !== "", "present");
|
|
266
|
+
var matchOne = /* @__PURE__ */ __name((field, node, value, options) => {
|
|
267
|
+
if (!present(value))
|
|
268
|
+
return false;
|
|
269
|
+
if (node.operator === "wildcard" && node.value === "*")
|
|
270
|
+
return true;
|
|
271
|
+
const text = String(value);
|
|
272
|
+
switch (field.type) {
|
|
273
|
+
case "txt": {
|
|
274
|
+
const words = wordsOf(text);
|
|
275
|
+
if (node.operator === "wildcard")
|
|
276
|
+
return words.some((word) => pattern(node.value).test(word));
|
|
277
|
+
const wanted = wordsOf(node.value);
|
|
278
|
+
return words.some((_, at) => wanted.every((word, offset) => words[at + offset] === word));
|
|
279
|
+
}
|
|
280
|
+
case "num": {
|
|
281
|
+
const number2 = Number(value);
|
|
282
|
+
if (node.operator !== "range")
|
|
283
|
+
return number2 === Number(node.value);
|
|
284
|
+
const { value: lower, upper = "*", lower_inclusive: lowerInclusive, upper_inclusive: upperInclusive } = node;
|
|
285
|
+
return (lower === "*" || (lowerInclusive ? number2 >= Number(lower) : number2 > Number(lower))) && (upper === "*" || (upperInclusive ? number2 <= Number(upper) : number2 < Number(upper)));
|
|
286
|
+
}
|
|
287
|
+
case "time": {
|
|
288
|
+
const time = Date.parse(text);
|
|
289
|
+
const [lower, upper, lowerInclusive, upperInclusive] = node.operator === "range" ? [node.value, node.upper ?? "*", node.lower_inclusive ?? true, node.upper_inclusive ?? true] : [node.value, node.value, true, true];
|
|
290
|
+
const range = dateRange(lower, upper, lowerInclusive, upperInclusive, options.zone ?? "UTC", node.span, options.now);
|
|
291
|
+
return (range.lower === void 0 || (range.lower_inclusive ? time >= range.lower : time > range.lower)) && (range.upper === void 0 || (range.upper_inclusive ? time <= range.upper : time < range.upper));
|
|
292
|
+
}
|
|
293
|
+
default:
|
|
294
|
+
return node.operator === "wildcard" ? pattern(node.value).test(text) : text.toLowerCase() === node.value.toLowerCase();
|
|
295
|
+
}
|
|
296
|
+
}, "matchOne");
|
|
297
|
+
var matches = /* @__PURE__ */ __name((node, item, byName, options) => {
|
|
298
|
+
if (node.kind === "boolean") {
|
|
299
|
+
const by = /* @__PURE__ */ __name((occur) => node.clauses.filter((clause) => clause.occur === occur), "by");
|
|
300
|
+
const [must, should, mustNot] = [by("must"), by("should"), by("must_not")];
|
|
301
|
+
const holds = /* @__PURE__ */ __name((clause) => matches(clause.node, item, byName, options), "holds");
|
|
302
|
+
return must.every(holds) && !mustNot.some(holds) && (should.length === 0 || must.length > 0 || should.some(holds));
|
|
303
|
+
}
|
|
304
|
+
const field = byName.get(node.field);
|
|
305
|
+
if (!field)
|
|
306
|
+
throw new Error(`evaluate: no field "${node.field}"; validate the query first`);
|
|
307
|
+
if (field.relation !== void 0) {
|
|
308
|
+
if (!options.relation)
|
|
309
|
+
throw new Error(`evaluate: "${node.field}" is a relation; pass options.relation`);
|
|
310
|
+
return options.relation(node, item);
|
|
311
|
+
}
|
|
312
|
+
const value = item[node.field];
|
|
313
|
+
return Array.isArray(value) ? value.some((one) => matchOne(field, node, one, options)) : matchOne(field, node, value, options);
|
|
314
|
+
}, "matches");
|
|
315
|
+
var evaluate = /* @__PURE__ */ __name((ast, fields, item, options = {}) => matches(ast.root, item, new Map(fields.map((field) => [field.name, field])), options), "evaluate");
|
|
316
|
+
|
|
317
|
+
// node_modules/.pnpm/@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/fields.js
|
|
32
318
|
var FIELD_TYPES = ["kw", "txt", "enum", "num", "time", "bool", "ref"];
|
|
33
319
|
var OPERATORS_BY_TYPE = {
|
|
34
320
|
kw: ["term", "phrase", "wildcard"],
|
|
@@ -91,67 +377,23 @@ var queryFieldsOf = /* @__PURE__ */ __name((schema, annotations = {}) => {
|
|
|
91
377
|
if (excluded.has(name))
|
|
92
378
|
return [];
|
|
93
379
|
const found = typeOf(entry);
|
|
94
|
-
if (!found)
|
|
95
|
-
return [];
|
|
96
|
-
return [finish({ name, ...found, ...words.has(name) && found.type === "kw" ? { type: "txt" } : {} })];
|
|
97
|
-
});
|
|
98
|
-
const relations = Object.entries(annotations.relations ?? {}).map(([name, relation]) => finish({ name, ...relation }));
|
|
99
|
-
const states = annotations.states ? [
|
|
100
|
-
finish({
|
|
101
|
-
name: "is",
|
|
102
|
-
type: "enum",
|
|
103
|
-
values: Object.keys(annotations.states),
|
|
104
|
-
relation: Object.entries(annotations.states).map(([state, meaning]) => `${state}: ${meaning}`).join("; ")
|
|
105
|
-
})
|
|
106
|
-
] : [];
|
|
107
|
-
return [...own, ...relations, ...states];
|
|
108
|
-
}, "queryFieldsOf");
|
|
109
|
-
|
|
110
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/types.js
|
|
111
|
-
var QUERY_LIMITS = {
|
|
112
|
-
bytes: 8192,
|
|
113
|
-
depth: 32,
|
|
114
|
-
nodes: 256
|
|
115
|
-
};
|
|
116
|
-
var spanSchema = object({ start: number(), end: number() });
|
|
117
|
-
var predicateSchema = object({
|
|
118
|
-
kind: literal("predicate"),
|
|
119
|
-
field: string(),
|
|
120
|
-
operator: picklist(["term", "phrase", "wildcard", "regex", "range"]),
|
|
121
|
-
value: string(),
|
|
122
|
-
upper: optional(string()),
|
|
123
|
-
lower_inclusive: optional(boolean()),
|
|
124
|
-
upper_inclusive: optional(boolean()),
|
|
125
|
-
span: spanSchema,
|
|
126
|
-
implicit: optional(literal(true)),
|
|
127
|
-
slop: optional(pipe(number(), integer(), minValue(0)))
|
|
128
|
-
});
|
|
129
|
-
var queryNodeSchema = variant("kind", [
|
|
130
|
-
predicateSchema,
|
|
131
|
-
object({
|
|
132
|
-
kind: literal("boolean"),
|
|
133
|
-
clauses: array(object({ occur: picklist(["must", "should", "must_not"]), node: lazy(() => queryNodeSchema) })),
|
|
134
|
-
span: spanSchema
|
|
135
|
-
})
|
|
136
|
-
]);
|
|
137
|
-
var queryAstSchema = object({
|
|
138
|
-
version: literal(1),
|
|
139
|
-
language: literal("lucene-v1"),
|
|
140
|
-
root: queryNodeSchema
|
|
141
|
-
});
|
|
142
|
-
function queryError(reason, span, alternative, context = {}, details = {}) {
|
|
143
|
-
throw new CliError("validation_error", `${context.command ?? "query"}: ${reason} at position ${span.start + 1}${alternative ? ` \u2014 ${alternative}` : ""}`, {
|
|
144
|
-
reason,
|
|
145
|
-
span,
|
|
146
|
-
...alternative ? { alternative } : {},
|
|
147
|
-
...context.guide ? { guide: context.guide } : {},
|
|
148
|
-
...details
|
|
380
|
+
if (!found)
|
|
381
|
+
return [];
|
|
382
|
+
return [finish({ name, ...found, ...words.has(name) && found.type === "kw" ? { type: "txt" } : {} })];
|
|
149
383
|
});
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
384
|
+
const relations = Object.entries(annotations.relations ?? {}).map(([name, relation]) => finish({ name, ...relation }));
|
|
385
|
+
const states = annotations.states ? [
|
|
386
|
+
finish({
|
|
387
|
+
name: "is",
|
|
388
|
+
type: "enum",
|
|
389
|
+
values: Object.keys(annotations.states),
|
|
390
|
+
relation: Object.entries(annotations.states).map(([state, meaning]) => `${state}: ${meaning}`).join("; ")
|
|
391
|
+
})
|
|
392
|
+
] : [];
|
|
393
|
+
return [...own, ...relations, ...states];
|
|
394
|
+
}, "queryFieldsOf");
|
|
153
395
|
|
|
154
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
396
|
+
// node_modules/.pnpm/@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/parser.js
|
|
155
397
|
var whitespace = /* @__PURE__ */ __name((c) => /[ \t\n\r\u3000]/u.test(c), "whitespace");
|
|
156
398
|
var reserved = /* @__PURE__ */ new Set([
|
|
157
399
|
"+",
|
|
@@ -460,157 +702,7 @@ var implicitTextTerms = /* @__PURE__ */ __name((text) => {
|
|
|
460
702
|
return new Set(tokens.flatMap((token, index) => (token.kind === "term" || token.kind === "number") && ![":", "=", "<", ">", "<=", ">="].includes(tokens[index - 1]?.kind ?? "") && ![":", "=", "<", ">", "<=", ">="].includes(tokens[index + 1]?.kind ?? "") ? [token.span.start] : []));
|
|
461
703
|
}, "implicitTextTerms");
|
|
462
704
|
|
|
463
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
464
|
-
var timezoneOf = /* @__PURE__ */ __name((given) => {
|
|
465
|
-
const zone = given ?? Intl.DateTimeFormat().resolvedOptions().timeZone ?? "UTC";
|
|
466
|
-
try {
|
|
467
|
-
new Intl.DateTimeFormat("en", { timeZone: zone }).format(0);
|
|
468
|
-
} catch {
|
|
469
|
-
queryError("query.invalid-timezone", { start: 0, end: 0 }, "use an IANA timezone such as Europe/Madrid");
|
|
470
|
-
}
|
|
471
|
-
return zone;
|
|
472
|
-
}, "timezoneOf");
|
|
473
|
-
var calendar = /* @__PURE__ */ __name((value, span) => {
|
|
474
|
-
if (!/^\d{4}-\d{2}-\d{2}$/u.test(value))
|
|
475
|
-
queryError("query.invalid-date", span, "use an ISO date such as 2026-10-01");
|
|
476
|
-
const year = Number(value.slice(0, 4)), month = Number(value.slice(5, 7)), day = Number(value.slice(8, 10));
|
|
477
|
-
const date = /* @__PURE__ */ new Date(0);
|
|
478
|
-
date.setUTCFullYear(year, month - 1, day);
|
|
479
|
-
date.setUTCHours(0, 0, 0, 0);
|
|
480
|
-
if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month - 1 || date.getUTCDate() !== day)
|
|
481
|
-
queryError("query.invalid-date", span);
|
|
482
|
-
return date;
|
|
483
|
-
}, "calendar");
|
|
484
|
-
var dayBoundary = /* @__PURE__ */ __name((value, zone, next, span) => {
|
|
485
|
-
const date = calendar(value, span);
|
|
486
|
-
if (next)
|
|
487
|
-
date.setUTCDate(date.getUTCDate() + 1);
|
|
488
|
-
const wanted = date.getUTCFullYear() * 1e4 + (date.getUTCMonth() + 1) * 100 + date.getUTCDate();
|
|
489
|
-
const formatter = new Intl.DateTimeFormat("en-CA", {
|
|
490
|
-
timeZone: zone,
|
|
491
|
-
year: "numeric",
|
|
492
|
-
month: "2-digit",
|
|
493
|
-
day: "2-digit",
|
|
494
|
-
era: "short"
|
|
495
|
-
});
|
|
496
|
-
const dayAt = /* @__PURE__ */ __name((time) => {
|
|
497
|
-
const parts = formatter.formatToParts(time);
|
|
498
|
-
const value2 = /* @__PURE__ */ __name((name) => Number(parts.find((p) => p.type === name)?.value), "value");
|
|
499
|
-
const year = parts.find((p) => p.type === "era")?.value === "BC" ? 1 - value2("year") : value2("year");
|
|
500
|
-
return year * 1e4 + value2("month") * 100 + value2("day");
|
|
501
|
-
}, "dayAt");
|
|
502
|
-
let lo = date.getTime() - 2 * 864e5, hi = date.getTime() + 2 * 864e5;
|
|
503
|
-
while (lo < hi) {
|
|
504
|
-
const mid = Math.floor((lo + hi) / 2);
|
|
505
|
-
if (dayAt(mid) < wanted)
|
|
506
|
-
lo = mid + 1;
|
|
507
|
-
else
|
|
508
|
-
hi = mid;
|
|
509
|
-
}
|
|
510
|
-
if (dayAt(lo) !== wanted)
|
|
511
|
-
queryError("query.invalid-date", span, "this calendar day does not exist in the selected timezone");
|
|
512
|
-
return lo;
|
|
513
|
-
}, "dayBoundary");
|
|
514
|
-
var WALL = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?$/u;
|
|
515
|
-
var wallTime = /* @__PURE__ */ __name((value, zone, span) => {
|
|
516
|
-
const [, year, month, day, hour, minute, second = "0", fraction = "0"] = WALL.exec(value) ?? [];
|
|
517
|
-
if (year === void 0)
|
|
518
|
-
queryError("query.invalid-date", span, "use YYYY-MM-DDTHH:mm, with optional seconds");
|
|
519
|
-
const wanted = Date.UTC(Number(year), Number(month) - 1, Number(day), Number(hour), Number(minute), Number(second), Number(fraction.padEnd(3, "0")));
|
|
520
|
-
const check = new Date(wanted);
|
|
521
|
-
if (check.getUTCDate() !== Number(day) || check.getUTCHours() !== Number(hour) || check.getUTCMinutes() !== Number(minute) || check.getUTCSeconds() !== Number(second))
|
|
522
|
-
queryError("query.invalid-date", span);
|
|
523
|
-
const formatter = new Intl.DateTimeFormat("en-CA", {
|
|
524
|
-
timeZone: zone,
|
|
525
|
-
year: "numeric",
|
|
526
|
-
month: "2-digit",
|
|
527
|
-
day: "2-digit",
|
|
528
|
-
hour: "2-digit",
|
|
529
|
-
minute: "2-digit",
|
|
530
|
-
second: "2-digit",
|
|
531
|
-
hourCycle: "h23"
|
|
532
|
-
});
|
|
533
|
-
const shown = /* @__PURE__ */ __name((instant) => {
|
|
534
|
-
const parts = Object.fromEntries(formatter.formatToParts(instant).map((part) => [part.type, Number(part.value)]));
|
|
535
|
-
return Date.UTC(parts.year ?? 0, (parts.month ?? 1) - 1, parts.day, parts.hour, parts.minute, parts.second) + (instant % 1e3 + 1e3) % 1e3;
|
|
536
|
-
}, "shown");
|
|
537
|
-
const found = /* @__PURE__ */ new Set();
|
|
538
|
-
for (const probe of [wanted - 864e5, wanted, wanted + 864e5]) {
|
|
539
|
-
const candidate = wanted - (shown(probe) - probe);
|
|
540
|
-
if (shown(candidate) === wanted)
|
|
541
|
-
found.add(candidate);
|
|
542
|
-
}
|
|
543
|
-
if (found.size !== 1)
|
|
544
|
-
queryError("query.invalid-date", span, "this local time is skipped or repeated by daylight saving; add an offset");
|
|
545
|
-
return [...found][0];
|
|
546
|
-
}, "wallTime");
|
|
547
|
-
var ZONED = /(?:Z|[+-]\d{2}:?\d{2})$/iu;
|
|
548
|
-
var zonedMoment = /* @__PURE__ */ __name((value, zone, span, { end = false } = {}) => {
|
|
549
|
-
if (/^\d{4}-\d{2}-\d{2}$/u.test(value))
|
|
550
|
-
return dayBoundary(value, zone, end, span) - (end ? 1 : 0);
|
|
551
|
-
if (!ZONED.test(value))
|
|
552
|
-
return wallTime(value, zone, span);
|
|
553
|
-
const time = Date.parse(value);
|
|
554
|
-
if (!/^\d{4}-\d{2}-\d{2}T/u.test(value) || !Number.isFinite(time))
|
|
555
|
-
queryError("query.invalid-date", span);
|
|
556
|
-
calendar(value.slice(0, 10), span);
|
|
557
|
-
return time;
|
|
558
|
-
}, "zonedMoment");
|
|
559
|
-
var AGO = /^(\d+)(m|h|d)$/u;
|
|
560
|
-
var MOMENT = /^(\d{4}-\d{2}-\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.\d{1,3})?)?(Z|[+-]\d{2}:\d{2})?$/u;
|
|
561
|
-
var AGO_MS = { m: 6e4, h: 36e5, d: 864e5 };
|
|
562
|
-
var dayOf = /* @__PURE__ */ __name((word, zone, now, span) => {
|
|
563
|
-
const today = new Intl.DateTimeFormat("en-CA", {
|
|
564
|
-
timeZone: zone,
|
|
565
|
-
year: "numeric",
|
|
566
|
-
month: "2-digit",
|
|
567
|
-
day: "2-digit"
|
|
568
|
-
}).format(now);
|
|
569
|
-
if (word === "today")
|
|
570
|
-
return today;
|
|
571
|
-
const date = calendar(today, span);
|
|
572
|
-
date.setUTCDate(date.getUTCDate() - 1);
|
|
573
|
-
return date.toISOString().slice(0, 10);
|
|
574
|
-
}, "dayOf");
|
|
575
|
-
var dateEndpoint = /* @__PURE__ */ __name((value, zone, side, inclusive, span, now = Date.now()) => {
|
|
576
|
-
if (value === "*")
|
|
577
|
-
return { inclusive };
|
|
578
|
-
const word = value.toLowerCase();
|
|
579
|
-
if (word === "today" || word === "yesterday")
|
|
580
|
-
return dateEndpoint(dayOf(word, zone, now, span), zone, side, inclusive, span);
|
|
581
|
-
const [, amount, unit] = AGO.exec(word) ?? [];
|
|
582
|
-
if (amount && unit)
|
|
583
|
-
return { time: now - Number(amount) * (AGO_MS[unit] ?? 0), inclusive };
|
|
584
|
-
if (/^\d{4}-\d{2}-\d{2}$/u.test(value))
|
|
585
|
-
return {
|
|
586
|
-
time: dayBoundary(value, zone, side === "lower" ? !inclusive : inclusive, span),
|
|
587
|
-
inclusive: side === "lower"
|
|
588
|
-
};
|
|
589
|
-
const [, day, hour, minute, second = "0", offset] = MOMENT.exec(value) ?? [];
|
|
590
|
-
if (day === void 0)
|
|
591
|
-
queryError("query.invalid-date", span, "use an ISO date, a date and time such as 2026-10-01T09:00 (optional seconds and offset), today, yesterday or 30m/2h/7d ago");
|
|
592
|
-
const moment = value.replace(" ", "T");
|
|
593
|
-
if (offset === void 0)
|
|
594
|
-
return { time: wallTime(moment, zone, span), inclusive };
|
|
595
|
-
calendar(day, span);
|
|
596
|
-
const time = Date.parse(moment);
|
|
597
|
-
if (!Number.isFinite(time) || Number(hour) > 23 || Number(minute) > 59 || Number(second) > 59)
|
|
598
|
-
queryError("query.invalid-date", span);
|
|
599
|
-
return { time, inclusive };
|
|
600
|
-
}, "dateEndpoint");
|
|
601
|
-
var dateRange = /* @__PURE__ */ __name((lower, upper, lowerInclusive, upperInclusive, zone, span, now = Date.now()) => {
|
|
602
|
-
const since = lower === upper && AGO.test(lower.toLowerCase());
|
|
603
|
-
const lo = dateEndpoint(lower, zone, "lower", lowerInclusive, span, now);
|
|
604
|
-
const hi = dateEndpoint(since ? "*" : upper, zone, "upper", upperInclusive, span, now);
|
|
605
|
-
return {
|
|
606
|
-
...lo.time === void 0 ? {} : { lower: lo.time },
|
|
607
|
-
...hi.time === void 0 ? {} : { upper: hi.time },
|
|
608
|
-
lower_inclusive: lo.inclusive,
|
|
609
|
-
upper_inclusive: hi.inclusive
|
|
610
|
-
};
|
|
611
|
-
}, "dateRange");
|
|
612
|
-
|
|
613
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/validate.js
|
|
705
|
+
// node_modules/.pnpm/@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/validate.js
|
|
614
706
|
var inContext = /* @__PURE__ */ __name((context, run) => {
|
|
615
707
|
try {
|
|
616
708
|
run();
|
|
@@ -685,7 +777,7 @@ var validateQuery = /* @__PURE__ */ __name((ast, registry, options = {}) => {
|
|
|
685
777
|
}, "validateQuery");
|
|
686
778
|
var fieldsNamed = /* @__PURE__ */ __name((ast) => new Set(walkQuery(ast.root).map((node) => node.field)), "fieldsNamed");
|
|
687
779
|
|
|
688
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.
|
|
780
|
+
// node_modules/.pnpm/@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/registry.js
|
|
689
781
|
var describeQuery = /* @__PURE__ */ __name((registry) => ({
|
|
690
782
|
entity: registry.entity,
|
|
691
783
|
backend: registry.backend,
|
|
@@ -756,98 +848,6 @@ var QUERY_REASONS = defineReasons([
|
|
|
756
848
|
details: [...SPAN, ...details]
|
|
757
849
|
})));
|
|
758
850
|
|
|
759
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/help.js
|
|
760
|
-
var shownOf = /* @__PURE__ */ __name((registry) => registry.backend === "native" ? registry.fields.filter((field) => field.native) : registry.fields, "shownOf");
|
|
761
|
-
var leftOut = /* @__PURE__ */ __name((fields) => fields.filter((field) => field.negatable).map((field) => field.name), "leftOut");
|
|
762
|
-
var has = /* @__PURE__ */ __name((fields, operator) => fields.some((field) => field.operators.includes(operator)), "has");
|
|
763
|
-
var syntaxOf = /* @__PURE__ */ __name((shown, backend) => [
|
|
764
|
-
"field:value",
|
|
765
|
-
...has(shown, "phrase") ? ['"a phrase"'] : [],
|
|
766
|
-
...has(shown, "wildcard") ? ["word*"] : [],
|
|
767
|
-
...backend === "native" ? ["terms joined by AND"] : ["AND OR NOT", "( )"],
|
|
768
|
-
...has(shown, "range") ? ["[a TO b] \xB7 > >= < <="] : []
|
|
769
|
-
].join(" \xB7 "), "syntaxOf");
|
|
770
|
-
var kindOf = /* @__PURE__ */ __name((field) => field.values ? `${field.type}: ${field.values.join("|")}` : `${field.type}: ${field.operators.join(", ")}`, "kindOf");
|
|
771
|
-
var fieldsHelp = /* @__PURE__ */ __name((registry, guide) => {
|
|
772
|
-
const shown = shownOf(registry);
|
|
773
|
-
const negatable = leftOut(shown);
|
|
774
|
-
const rows = shown.map((field) => [field.name, kindOf(field), field.example]);
|
|
775
|
-
const widths = [0, 1].map((at) => Math.max(...rows.map((row) => (row[at] ?? "").length)));
|
|
776
|
-
return [
|
|
777
|
-
"Fields:",
|
|
778
|
-
...rows.map(([name = "", kind = "", example = ""]) => ` ${name.padEnd(widths[0] ?? 0)} ${kind.padEnd(widths[1] ?? 0)} ${example}`.trimEnd()),
|
|
779
|
-
...registry.defaults && registry.defaults.length > 0 ? [`Defaults: ${registry.defaults.join(" ")} \u2014 name the field to change it`] : [],
|
|
780
|
-
...negatable.length > 0 ? [`Leave out: -${negatable[0]}:value or NOT ${negatable[0]}:value, for ${negatable.join(", ")}`] : [],
|
|
781
|
-
`Syntax: ${syntaxOf(shown, registry.backend)}`,
|
|
782
|
-
...guide ? [`Guide: ${guide}`] : []
|
|
783
|
-
].join("\n");
|
|
784
|
-
}, "fieldsHelp");
|
|
785
|
-
var queryDescription = /* @__PURE__ */ __name((registry) => {
|
|
786
|
-
const shown = shownOf(registry);
|
|
787
|
-
if (shown.length === 0)
|
|
788
|
-
return "field:value terms; this list filters by none yet, so any term is refused";
|
|
789
|
-
const negatable = leftOut(shown);
|
|
790
|
-
const terms = registry.backend === "native" ? `field:value terms joined by AND that narrow the list${negatable.length > 0 ? `; -field:value or NOT field:value leaves out what matches, for ${negatable.join(", ")} only` : ""}` : `field:value terms that narrow the list (Lucene: AND OR NOT, -field:value${has(shown, "range") ? ", [a TO b], > <" : ""})`;
|
|
791
|
-
const fields = shown.map((field) => field.values ? `${field.name} (${field.values.join("|")})` : field.name);
|
|
792
|
-
const defaults = registry.defaults?.length ? `; unless named: ${registry.defaults.join(" ")}` : "";
|
|
793
|
-
return `${terms}; fields: ${fields.join(", ")}; e.g. ${shown[0]?.example ?? ""}${defaults}`;
|
|
794
|
-
}, "queryDescription");
|
|
795
|
-
|
|
796
|
-
// node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/evaluate.js
|
|
797
|
-
var wordsOf = /* @__PURE__ */ __name((text) => text.toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? [], "wordsOf");
|
|
798
|
-
var pattern = /* @__PURE__ */ __name((value) => new RegExp(`^${[...value].map((char) => char === "*" ? ".*" : char === "?" ? "." : char.replace(/[.+^${}()|[\]\\]/, "\\$&")).join("")}$`, "iu"), "pattern");
|
|
799
|
-
var present = /* @__PURE__ */ __name((value) => value !== void 0 && value !== null && value !== "", "present");
|
|
800
|
-
var matchOne = /* @__PURE__ */ __name((field, node, value, options) => {
|
|
801
|
-
if (!present(value))
|
|
802
|
-
return false;
|
|
803
|
-
if (node.operator === "wildcard" && node.value === "*")
|
|
804
|
-
return true;
|
|
805
|
-
const text = String(value);
|
|
806
|
-
switch (field.type) {
|
|
807
|
-
case "txt": {
|
|
808
|
-
const words = wordsOf(text);
|
|
809
|
-
if (node.operator === "wildcard")
|
|
810
|
-
return words.some((word) => pattern(node.value).test(word));
|
|
811
|
-
const wanted = wordsOf(node.value);
|
|
812
|
-
return words.some((_, at) => wanted.every((word, offset) => words[at + offset] === word));
|
|
813
|
-
}
|
|
814
|
-
case "num": {
|
|
815
|
-
const number2 = Number(value);
|
|
816
|
-
if (node.operator !== "range")
|
|
817
|
-
return number2 === Number(node.value);
|
|
818
|
-
const { value: lower, upper = "*", lower_inclusive: lowerInclusive, upper_inclusive: upperInclusive } = node;
|
|
819
|
-
return (lower === "*" || (lowerInclusive ? number2 >= Number(lower) : number2 > Number(lower))) && (upper === "*" || (upperInclusive ? number2 <= Number(upper) : number2 < Number(upper)));
|
|
820
|
-
}
|
|
821
|
-
case "time": {
|
|
822
|
-
const time = Date.parse(text);
|
|
823
|
-
const [lower, upper, lowerInclusive, upperInclusive] = node.operator === "range" ? [node.value, node.upper ?? "*", node.lower_inclusive ?? true, node.upper_inclusive ?? true] : [node.value, node.value, true, true];
|
|
824
|
-
const range = dateRange(lower, upper, lowerInclusive, upperInclusive, options.zone ?? "UTC", node.span, options.now);
|
|
825
|
-
return (range.lower === void 0 || (range.lower_inclusive ? time >= range.lower : time > range.lower)) && (range.upper === void 0 || (range.upper_inclusive ? time <= range.upper : time < range.upper));
|
|
826
|
-
}
|
|
827
|
-
default:
|
|
828
|
-
return node.operator === "wildcard" ? pattern(node.value).test(text) : text.toLowerCase() === node.value.toLowerCase();
|
|
829
|
-
}
|
|
830
|
-
}, "matchOne");
|
|
831
|
-
var matches = /* @__PURE__ */ __name((node, item, byName, options) => {
|
|
832
|
-
if (node.kind === "boolean") {
|
|
833
|
-
const by = /* @__PURE__ */ __name((occur) => node.clauses.filter((clause) => clause.occur === occur), "by");
|
|
834
|
-
const [must, should, mustNot] = [by("must"), by("should"), by("must_not")];
|
|
835
|
-
const holds = /* @__PURE__ */ __name((clause) => matches(clause.node, item, byName, options), "holds");
|
|
836
|
-
return must.every(holds) && !mustNot.some(holds) && (should.length === 0 || must.length > 0 || should.some(holds));
|
|
837
|
-
}
|
|
838
|
-
const field = byName.get(node.field);
|
|
839
|
-
if (!field)
|
|
840
|
-
throw new Error(`evaluate: no field "${node.field}"; validate the query first`);
|
|
841
|
-
if (field.relation !== void 0) {
|
|
842
|
-
if (!options.relation)
|
|
843
|
-
throw new Error(`evaluate: "${node.field}" is a relation; pass options.relation`);
|
|
844
|
-
return options.relation(node, item);
|
|
845
|
-
}
|
|
846
|
-
const value = item[node.field];
|
|
847
|
-
return Array.isArray(value) ? value.some((one) => matchOne(field, node, one, options)) : matchOne(field, node, value, options);
|
|
848
|
-
}, "matches");
|
|
849
|
-
var evaluate = /* @__PURE__ */ __name((ast, fields, item, options = {}) => matches(ast.root, item, new Map(fields.map((field) => [field.name, field])), options), "evaluate");
|
|
850
|
-
|
|
851
851
|
export {
|
|
852
852
|
FIELD_TYPES,
|
|
853
853
|
OPERATORS_BY_TYPE,
|