@wirecat/mail-cli 0.37.0 → 0.39.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 +47 -0
- package/README.md +9 -7
- package/contracts/wirecat.json +64 -2
- package/dist/bin/mail.js +11 -11
- package/dist/bundle/{chunk-BNURKCQG.js → chunk-BXH2YUBR.js} +33 -5
- package/dist/bundle/mail.js +4 -166
- package/dist/bundle/program-ZSF2VJI6.js +17329 -0
- package/dist/commands/account-remove.js +1 -2
- package/dist/commands/account.js +1 -1
- package/dist/commands/attachments.js +1 -2
- package/dist/commands/context.js +1 -1
- package/dist/commands/doctor.js +1 -1
- package/dist/commands/drafts-send.js +1 -2
- package/dist/commands/drafts.js +1 -2
- package/dist/commands/export.js +1 -2
- package/dist/commands/folders.js +1 -2
- package/dist/commands/import.js +1 -1
- package/dist/commands/messages.js +1 -1
- package/dist/commands/organising.js +1 -2
- package/dist/commands/read.js +2 -4
- package/dist/commands/restore.js +1 -1
- package/dist/commands/rules.js +1 -2
- package/dist/commands/send.js +1 -2
- package/dist/commands/session-start.js +1 -1
- package/dist/commands/session.js +1 -1
- package/dist/commands/stats.js +1 -1
- package/dist/commands/status.js +3 -5
- package/dist/commands/sync.js +29 -5
- package/dist/commands/tags.js +1 -2
- package/dist/config.js +1 -1
- package/dist/identity.js +27 -0
- package/dist/mail/changes.js +3 -2
- package/dist/mail/cleanup.js +3 -2
- package/dist/mail/domain-age.js +1 -1
- package/dist/mail/memo-trash.js +47 -0
- package/dist/mail/organise.js +1 -1
- package/dist/mail/save.js +1 -1
- package/dist/mail/send-as.js +66 -0
- package/dist/mail/send.js +4 -2
- package/dist/oauth.js +1 -3
- package/dist/profile.js +1 -1
- package/dist/program.js +1 -2
- package/dist/providers.js +4 -4
- package/dist/store.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -5
- package/dist/bin/mail.d.ts +0 -3
- package/dist/bin/mail.d.ts.map +0 -1
- package/dist/bin/mail.js.map +0 -1
- package/dist/bundle/agent-OU4K7TKQ.js +0 -40
- package/dist/bundle/all-profiles-ICGWDPUU.js +0 -320
- package/dist/bundle/anthropic-TL4WFWGU.js +0 -90
- package/dist/bundle/app-server-YAR5EFOO.js +0 -256
- package/dist/bundle/bun-OPDGMZZQ.js +0 -169
- package/dist/bundle/bun-sqlite-WI3ZPANS.js +0 -75
- package/dist/bundle/chunk-2JHVQMVC.js +0 -16
- package/dist/bundle/chunk-2XBDILVW.js +0 -53
- package/dist/bundle/chunk-2YO3PLOE.js +0 -2843
- package/dist/bundle/chunk-3DHJF57U.js +0 -690
- package/dist/bundle/chunk-3HC5F3P7.js +0 -24
- package/dist/bundle/chunk-3SKTQ2HC.js +0 -288
- package/dist/bundle/chunk-3YM4B2GT.js +0 -63
- package/dist/bundle/chunk-3ZOOTTFW.js +0 -1007
- package/dist/bundle/chunk-4FTIHADB.js +0 -259
- package/dist/bundle/chunk-4IZ6R5FS.js +0 -730
- package/dist/bundle/chunk-4N7PP76S.js +0 -6848
- package/dist/bundle/chunk-7HRKUKKY.js +0 -1068
- package/dist/bundle/chunk-7PDGZFXD.js +0 -133
- package/dist/bundle/chunk-7YKWFERX.js +0 -330
- package/dist/bundle/chunk-BNVISIHP.js +0 -95
- package/dist/bundle/chunk-BQMJYSA4.js +0 -360
- package/dist/bundle/chunk-BYITYTRL.js +0 -86
- package/dist/bundle/chunk-CICUPYHT.js +0 -106
- package/dist/bundle/chunk-CQHLWMKK.js +0 -1333
- package/dist/bundle/chunk-CUW7Y2HJ.js +0 -334
- package/dist/bundle/chunk-D72URWJE.js +0 -532
- package/dist/bundle/chunk-DFDN6AUB.js +0 -21
- package/dist/bundle/chunk-DJZIFZOT.js +0 -52
- package/dist/bundle/chunk-DNCLQPOM.js +0 -7
- package/dist/bundle/chunk-DPV53EZC.js +0 -206
- package/dist/bundle/chunk-DTR7JO2M.js +0 -794
- package/dist/bundle/chunk-ES2FF42M.js +0 -2470
- package/dist/bundle/chunk-EV72K4IU.js +0 -274
- package/dist/bundle/chunk-EZQ5BYNL.js +0 -338
- package/dist/bundle/chunk-F2D3J5DR.js +0 -188
- package/dist/bundle/chunk-FTT7UDYV.js +0 -80
- package/dist/bundle/chunk-FXNCKPQ7.js +0 -64
- package/dist/bundle/chunk-G4VJN75G.js +0 -806
- package/dist/bundle/chunk-GGMAIIVE.js +0 -38
- package/dist/bundle/chunk-GPUC3FTU.js +0 -195
- package/dist/bundle/chunk-GQIMVR7C.js +0 -3752
- package/dist/bundle/chunk-HCRUGAIN.js +0 -1024
- package/dist/bundle/chunk-HES6YMYN.js +0 -161
- package/dist/bundle/chunk-HFY7536N.js +0 -9510
- package/dist/bundle/chunk-HTQTIKWP.js +0 -928
- package/dist/bundle/chunk-IA7LLLEI.js +0 -100
- package/dist/bundle/chunk-IUJDWEGJ.js +0 -615
- package/dist/bundle/chunk-IWFWWO37.js +0 -364
- package/dist/bundle/chunk-JG6LCSEX.js +0 -407
- package/dist/bundle/chunk-JLXXUEAM.js +0 -72
- package/dist/bundle/chunk-JNP3XGJI.js +0 -559
- package/dist/bundle/chunk-JZUYZ2XJ.js +0 -2076
- package/dist/bundle/chunk-K4DEQAEW.js +0 -1291
- package/dist/bundle/chunk-KCM3WSER.js +0 -388
- package/dist/bundle/chunk-KP5JDYY6.js +0 -2669
- package/dist/bundle/chunk-KUX54EGR.js +0 -40792
- package/dist/bundle/chunk-KXJ3JEDH.js +0 -2
- package/dist/bundle/chunk-KZD3H5QA.js +0 -108
- package/dist/bundle/chunk-LKH3UKLO.js +0 -230
- package/dist/bundle/chunk-NAOLBEFX.js +0 -12142
- package/dist/bundle/chunk-NB52JKLR.js +0 -323
- package/dist/bundle/chunk-NB7EOAUZ.js +0 -123
- package/dist/bundle/chunk-NISH4UXM.js +0 -58
- package/dist/bundle/chunk-NQSKI7XK.js +0 -52
- package/dist/bundle/chunk-OWPRJLHV.js +0 -353
- package/dist/bundle/chunk-OZKZT3ZI.js +0 -79
- package/dist/bundle/chunk-PL5P7UKW.js +0 -25216
- package/dist/bundle/chunk-Q7ICVP25.js +0 -18
- package/dist/bundle/chunk-QLJGYDWG.js +0 -1197
- package/dist/bundle/chunk-R44KVISE.js +0 -218
- package/dist/bundle/chunk-R73VWPNL.js +0 -192
- package/dist/bundle/chunk-RRTMPSQR.js +0 -29
- package/dist/bundle/chunk-S6JG4YUH.js +0 -72
- package/dist/bundle/chunk-TMJLGR4A.js +0 -4070
- package/dist/bundle/chunk-TXDR6YSF.js +0 -23
- package/dist/bundle/chunk-TY7NDMFY.js +0 -46
- package/dist/bundle/chunk-UDSL3MUU.js +0 -2333
- package/dist/bundle/chunk-UTS5NMR3.js +0 -54
- package/dist/bundle/chunk-VB7FZOYX.js +0 -633
- package/dist/bundle/chunk-VK24UQSD.js +0 -142
- package/dist/bundle/chunk-VYCB5EVI.js +0 -721
- package/dist/bundle/chunk-VZ5PPYDG.js +0 -77
- package/dist/bundle/chunk-WOPVBRPV.js +0 -29
- package/dist/bundle/chunk-XEQQJBBO.js +0 -92
- package/dist/bundle/chunk-XQUUANA2.js +0 -24600
- package/dist/bundle/chunk-XWBTD2WP.js +0 -76
- package/dist/bundle/chunk-XXPJF2VD.js +0 -2
- package/dist/bundle/chunk-Y5E2WNWB.js +0 -35
- package/dist/bundle/chunk-YODGIMMM.js +0 -185
- package/dist/bundle/chunk-YWDFYQOU.js +0 -82
- package/dist/bundle/chunk-Z4BLNAWI.js +0 -67228
- package/dist/bundle/chunk-ZSAPOC7B.js +0 -1247
- package/dist/bundle/chunk-ZTWTEXB2.js +0 -170
- package/dist/bundle/chunk-ZVVMGPBJ.js +0 -50
- package/dist/bundle/command-contract-UC6IGCCM.js +0 -39
- package/dist/bundle/command-server-entry-RA3ZX2KV.js +0 -168
- package/dist/bundle/decode-QVKRSRVF.js +0 -296
- package/dist/bundle/dispatch-USKS7J74.js +0 -411
- package/dist/bundle/dist-HFUVURJG.js +0 -7577
- package/dist/bundle/dist-ITIXJAXK.js +0 -317
- package/dist/bundle/dist-PAKDDIBT.js +0 -191
- package/dist/bundle/echarts-O3TNDAXJ.js +0 -42501
- package/dist/bundle/embed-2HOODFQT.js +0 -37
- package/dist/bundle/embedder-22AJGCZX.js +0 -110
- package/dist/bundle/failure-D4FGOIWF.js +0 -24
- package/dist/bundle/first-run-FU4MFXOA.js +0 -28
- package/dist/bundle/first-screen-A7SEI2ON.js +0 -40
- package/dist/bundle/instructions-AMH5RWVJ.js +0 -11
- package/dist/bundle/mcp-5HFPWC3W.js +0 -167
- package/dist/bundle/meeting-combined-KC6YGWA7.js +0 -24
- package/dist/bundle/meeting-model-QWGAOQHL.js +0 -24
- package/dist/bundle/meeting-semantic-7PVO6RNB.js +0 -21
- package/dist/bundle/node-EGMCBAO7.js +0 -176
- package/dist/bundle/node-KM3CUABH.js +0 -2340
- package/dist/bundle/node-TLZSIHIJ.js +0 -21
- package/dist/bundle/node-sqlite-JXUELLMP.js +0 -73
- package/dist/bundle/oauth-OYAYWH4K.js +0 -19
- package/dist/bundle/open-GLEUJGNA.js +0 -22
- package/dist/bundle/openai-PYTVNB6L.js +0 -237
- package/dist/bundle/process-SGHEN6MQ.js +0 -91
- package/dist/bundle/program-7CFNZ2DF.js +0 -51701
- package/dist/bundle/prompt-CYTILD7N.js +0 -16
- package/dist/bundle/public-XWMXEGEF.js +0 -196
- package/dist/bundle/recognize-26UNETSQ.js +0 -25
- package/dist/bundle/remote-PKXBQA5N.js +0 -30
- package/dist/bundle/rerank-LLKP7M6Q.js +0 -51
- package/dist/bundle/serve-ZRJEAPJI.js +0 -198
- package/dist/bundle/server-4OQ4G5JY.js +0 -218
- package/dist/bundle/server-VVRQ4A34.js +0 -86
- package/dist/bundle/sqlite-runtime-667VV4VY.js +0 -19
- package/dist/bundle/state-V3CAAJBE.js +0 -35
- package/dist/bundle/store-BJCIMIAH.js +0 -302
- package/dist/bundle/store-GLBBY4OZ.js +0 -184
- package/dist/bundle/store-maintenance-command-N7L5OVUE.js +0 -73
- package/dist/bundle/surface-26EUQNDT.js +0 -72
- package/dist/commands/account-remove.d.ts +0 -3
- package/dist/commands/account-remove.d.ts.map +0 -1
- package/dist/commands/account-remove.js.map +0 -1
- package/dist/commands/account.d.ts +0 -3
- package/dist/commands/account.d.ts.map +0 -1
- package/dist/commands/account.js.map +0 -1
- package/dist/commands/attachments.d.ts +0 -3
- package/dist/commands/attachments.d.ts.map +0 -1
- package/dist/commands/attachments.js.map +0 -1
- package/dist/commands/context.d.ts +0 -79
- package/dist/commands/context.d.ts.map +0 -1
- package/dist/commands/context.js.map +0 -1
- package/dist/commands/doctor.d.ts +0 -68
- package/dist/commands/doctor.d.ts.map +0 -1
- package/dist/commands/doctor.js.map +0 -1
- package/dist/commands/drafts-send.d.ts +0 -7
- package/dist/commands/drafts-send.d.ts.map +0 -1
- package/dist/commands/drafts-send.js.map +0 -1
- package/dist/commands/drafts.d.ts +0 -3
- package/dist/commands/drafts.d.ts.map +0 -1
- package/dist/commands/drafts.js.map +0 -1
- package/dist/commands/export.d.ts +0 -3
- package/dist/commands/export.d.ts.map +0 -1
- package/dist/commands/export.js.map +0 -1
- package/dist/commands/folders.d.ts +0 -3
- package/dist/commands/folders.d.ts.map +0 -1
- package/dist/commands/folders.js.map +0 -1
- package/dist/commands/import.d.ts +0 -3
- package/dist/commands/import.d.ts.map +0 -1
- package/dist/commands/import.js.map +0 -1
- package/dist/commands/login.d.ts +0 -5
- package/dist/commands/login.d.ts.map +0 -1
- package/dist/commands/login.js.map +0 -1
- package/dist/commands/mailbox.d.ts +0 -17
- package/dist/commands/mailbox.d.ts.map +0 -1
- package/dist/commands/mailbox.js.map +0 -1
- package/dist/commands/messages.d.ts +0 -4
- package/dist/commands/messages.d.ts.map +0 -1
- package/dist/commands/messages.js.map +0 -1
- package/dist/commands/organising.d.ts +0 -98
- package/dist/commands/organising.d.ts.map +0 -1
- package/dist/commands/organising.js.map +0 -1
- package/dist/commands/read.d.ts +0 -6
- package/dist/commands/read.d.ts.map +0 -1
- package/dist/commands/read.js.map +0 -1
- package/dist/commands/restore.d.ts +0 -3
- package/dist/commands/restore.d.ts.map +0 -1
- package/dist/commands/restore.js.map +0 -1
- package/dist/commands/rules.d.ts +0 -3
- package/dist/commands/rules.d.ts.map +0 -1
- package/dist/commands/rules.js.map +0 -1
- package/dist/commands/send.d.ts +0 -51
- package/dist/commands/send.d.ts.map +0 -1
- package/dist/commands/send.js.map +0 -1
- package/dist/commands/server-search.d.ts +0 -8
- package/dist/commands/server-search.d.ts.map +0 -1
- package/dist/commands/server-search.js.map +0 -1
- package/dist/commands/session-start.d.ts +0 -3
- package/dist/commands/session-start.d.ts.map +0 -1
- package/dist/commands/session-start.js.map +0 -1
- package/dist/commands/session.d.ts +0 -3
- package/dist/commands/session.d.ts.map +0 -1
- package/dist/commands/session.js.map +0 -1
- package/dist/commands/stats.d.ts +0 -3
- package/dist/commands/stats.d.ts.map +0 -1
- package/dist/commands/stats.js.map +0 -1
- package/dist/commands/status.d.ts +0 -3
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/status.js.map +0 -1
- package/dist/commands/sync.d.ts +0 -11
- package/dist/commands/sync.d.ts.map +0 -1
- package/dist/commands/sync.js.map +0 -1
- package/dist/commands/tags.d.ts +0 -3
- package/dist/commands/tags.d.ts.map +0 -1
- package/dist/commands/tags.js.map +0 -1
- package/dist/commands/words.d.ts +0 -8
- package/dist/commands/words.d.ts.map +0 -1
- package/dist/commands/words.js.map +0 -1
- package/dist/config.d.ts +0 -239
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/discovery.d.ts +0 -31
- package/dist/discovery.d.ts.map +0 -1
- package/dist/discovery.js.map +0 -1
- package/dist/export/format.d.ts +0 -19
- package/dist/export/format.d.ts.map +0 -1
- package/dist/export/format.js.map +0 -1
- package/dist/export/journal.d.ts +0 -34
- package/dist/export/journal.d.ts.map +0 -1
- package/dist/export/journal.js.map +0 -1
- package/dist/export/write.d.ts +0 -14
- package/dist/export/write.d.ts.map +0 -1
- package/dist/export/write.js.map +0 -1
- package/dist/identity.d.ts +0 -7
- package/dist/identity.d.ts.map +0 -1
- package/dist/identity.js.map +0 -1
- package/dist/mail/backend.d.ts +0 -138
- package/dist/mail/backend.d.ts.map +0 -1
- package/dist/mail/backend.js.map +0 -1
- package/dist/mail/changes.d.ts +0 -99
- package/dist/mail/changes.d.ts.map +0 -1
- package/dist/mail/changes.js.map +0 -1
- package/dist/mail/cleanup.d.ts +0 -41
- package/dist/mail/cleanup.d.ts.map +0 -1
- package/dist/mail/cleanup.js.map +0 -1
- package/dist/mail/compose.d.ts +0 -75
- package/dist/mail/compose.d.ts.map +0 -1
- package/dist/mail/compose.js.map +0 -1
- package/dist/mail/domain-age.d.ts +0 -29
- package/dist/mail/domain-age.d.ts.map +0 -1
- package/dist/mail/domain-age.js.map +0 -1
- package/dist/mail/drafts.d.ts +0 -54
- package/dist/mail/drafts.d.ts.map +0 -1
- package/dist/mail/drafts.js.map +0 -1
- package/dist/mail/imap/account.d.ts +0 -5
- package/dist/mail/imap/account.d.ts.map +0 -1
- package/dist/mail/imap/account.js.map +0 -1
- package/dist/mail/imap/connection.d.ts +0 -72
- package/dist/mail/imap/connection.d.ts.map +0 -1
- package/dist/mail/imap/connection.js.map +0 -1
- package/dist/mail/imap/errors.d.ts +0 -11
- package/dist/mail/imap/errors.d.ts.map +0 -1
- package/dist/mail/imap/errors.js.map +0 -1
- package/dist/mail/imap/index.d.ts +0 -7
- package/dist/mail/imap/index.d.ts.map +0 -1
- package/dist/mail/imap/index.js.map +0 -1
- package/dist/mail/imap/messages.d.ts +0 -17
- package/dist/mail/imap/messages.d.ts.map +0 -1
- package/dist/mail/imap/messages.js.map +0 -1
- package/dist/mail/imap/read.d.ts +0 -7
- package/dist/mail/imap/read.d.ts.map +0 -1
- package/dist/mail/imap/read.js.map +0 -1
- package/dist/mail/imap/search.d.ts +0 -19
- package/dist/mail/imap/search.d.ts.map +0 -1
- package/dist/mail/imap/search.js.map +0 -1
- package/dist/mail/imap/write.d.ts +0 -5
- package/dist/mail/imap/write.d.ts.map +0 -1
- package/dist/mail/imap/write.js.map +0 -1
- package/dist/mail/locate.d.ts +0 -32
- package/dist/mail/locate.d.ts.map +0 -1
- package/dist/mail/locate.js.map +0 -1
- package/dist/mail/mbox.d.ts +0 -9
- package/dist/mail/mbox.d.ts.map +0 -1
- package/dist/mail/mbox.js.map +0 -1
- package/dist/mail/organise.d.ts +0 -101
- package/dist/mail/organise.d.ts.map +0 -1
- package/dist/mail/organise.js.map +0 -1
- package/dist/mail/restore.d.ts +0 -22
- package/dist/mail/restore.d.ts.map +0 -1
- package/dist/mail/restore.js.map +0 -1
- package/dist/mail/rethread.d.ts +0 -14
- package/dist/mail/rethread.d.ts.map +0 -1
- package/dist/mail/rethread.js.map +0 -1
- package/dist/mail/rules/apply.d.ts +0 -48
- package/dist/mail/rules/apply.d.ts.map +0 -1
- package/dist/mail/rules/apply.js.map +0 -1
- package/dist/mail/rules/file.d.ts +0 -9
- package/dist/mail/rules/file.d.ts.map +0 -1
- package/dist/mail/rules/file.js.map +0 -1
- package/dist/mail/rules/filters.d.ts +0 -11
- package/dist/mail/rules/filters.d.ts.map +0 -1
- package/dist/mail/rules/filters.js.map +0 -1
- package/dist/mail/rules/folders.d.ts +0 -11
- package/dist/mail/rules/folders.d.ts.map +0 -1
- package/dist/mail/rules/folders.js.map +0 -1
- package/dist/mail/rules/query.d.ts +0 -16
- package/dist/mail/rules/query.d.ts.map +0 -1
- package/dist/mail/rules/query.js.map +0 -1
- package/dist/mail/rules/store.d.ts +0 -9
- package/dist/mail/rules/store.d.ts.map +0 -1
- package/dist/mail/rules/store.js.map +0 -1
- package/dist/mail/save.d.ts +0 -9
- package/dist/mail/save.d.ts.map +0 -1
- package/dist/mail/save.js.map +0 -1
- package/dist/mail/send.d.ts +0 -76
- package/dist/mail/send.d.ts.map +0 -1
- package/dist/mail/send.js.map +0 -1
- package/dist/mail/smtp.d.ts +0 -4
- package/dist/mail/smtp.d.ts.map +0 -1
- package/dist/mail/smtp.js.map +0 -1
- package/dist/oauth.d.ts +0 -75
- package/dist/oauth.d.ts.map +0 -1
- package/dist/oauth.js.map +0 -1
- package/dist/profile.d.ts +0 -20
- package/dist/profile.d.ts.map +0 -1
- package/dist/profile.js.map +0 -1
- package/dist/program.d.ts +0 -6
- package/dist/program.d.ts.map +0 -1
- package/dist/program.js.map +0 -1
- package/dist/providers.d.ts +0 -255
- package/dist/providers.d.ts.map +0 -1
- package/dist/providers.js.map +0 -1
- package/dist/reasons.d.ts +0 -9
- package/dist/reasons.d.ts.map +0 -1
- package/dist/reasons.js.map +0 -1
- package/dist/secret.d.ts +0 -31
- package/dist/secret.d.ts.map +0 -1
- package/dist/secret.js.map +0 -1
- package/dist/store.d.ts +0 -12
- package/dist/store.d.ts.map +0 -1
- package/dist/store.js.map +0 -1
- package/dist/version.d.ts +0 -2
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js.map +0 -1
- package/dist/wcat.d.ts +0 -3
- package/dist/wcat.d.ts.map +0 -1
- package/dist/wcat.js.map +0 -1
|
@@ -1,721 +0,0 @@
|
|
|
1
|
-
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
-
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
MESSAGE_PARSING,
|
|
5
|
-
MOST_WORDS_APART,
|
|
6
|
-
QUERY_LIMITS,
|
|
7
|
-
SEARCH_QUERY,
|
|
8
|
-
searchError
|
|
9
|
-
} from "./chunk-OZKZT3ZI.js";
|
|
10
|
-
import {
|
|
11
|
-
tagOf
|
|
12
|
-
} from "./chunk-RRTMPSQR.js";
|
|
13
|
-
import {
|
|
14
|
-
parseLucene,
|
|
15
|
-
queryAstSchema,
|
|
16
|
-
validateQuery,
|
|
17
|
-
walkQuery
|
|
18
|
-
} from "./chunk-TMJLGR4A.js";
|
|
19
|
-
import {
|
|
20
|
-
safeParse
|
|
21
|
-
} from "./chunk-KP5JDYY6.js";
|
|
22
|
-
import {
|
|
23
|
-
CliError,
|
|
24
|
-
isCliError
|
|
25
|
-
} from "./chunk-S6JG4YUH.js";
|
|
26
|
-
import {
|
|
27
|
-
__name
|
|
28
|
-
} from "./chunk-ZVVMGPBJ.js";
|
|
29
|
-
|
|
30
|
-
// node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/search/fusion.js
|
|
31
|
-
var RRF_K = 60;
|
|
32
|
-
var fuseRanked = /* @__PURE__ */ __name((lists, facts) => {
|
|
33
|
-
const rows = lists.flatMap((list) => list.map((item, rank) => ({ item, vote: 1 / (RRF_K + rank + 1), ...facts(item) })));
|
|
34
|
-
const ranking = rows.some(({ ranked }) => ranked);
|
|
35
|
-
return rows.sort((a, b) => Number(b.exact === true) - Number(a.exact === true) || (ranking ? Number(b.ranked) - Number(a.ranked) || b.vote - a.vote : 0) || b.at - a.at).map(({ item }) => item);
|
|
36
|
-
}, "fuseRanked");
|
|
37
|
-
|
|
38
|
-
// node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
|
|
39
|
-
var FIELD_VERSION = 2;
|
|
40
|
-
var UNITS = {
|
|
41
|
-
"": 1,
|
|
42
|
-
b: 1,
|
|
43
|
-
k: 1024,
|
|
44
|
-
kb: 1024,
|
|
45
|
-
m: 1024 ** 2,
|
|
46
|
-
mb: 1024 ** 2,
|
|
47
|
-
g: 1024 ** 3,
|
|
48
|
-
gb: 1024 ** 3
|
|
49
|
-
};
|
|
50
|
-
var parseBytes = /* @__PURE__ */ __name((value, span) => {
|
|
51
|
-
const [, amount, unit] = /^(\d+(?:\.\d+)?)\s*([a-z]*)$/iu.exec(value.trim()) ?? [];
|
|
52
|
-
const scale = UNITS[unit?.toLowerCase() ?? ""];
|
|
53
|
-
if (amount === void 0 || scale === void 0)
|
|
54
|
-
searchError("query.invalid-size", span, "use bytes or KB/MB/GB, e.g. 10MB");
|
|
55
|
-
return Math.round(Number(amount) * scale);
|
|
56
|
-
}, "parseBytes");
|
|
57
|
-
var filled = /* @__PURE__ */ __name((node) => {
|
|
58
|
-
if (node.value === "")
|
|
59
|
-
searchError("query.missing-value", node.span);
|
|
60
|
-
}, "filled");
|
|
61
|
-
var validateSize = /* @__PURE__ */ __name((node) => {
|
|
62
|
-
for (const bound of node.operator === "range" ? [node.value, node.upper] : [node.value])
|
|
63
|
-
if (bound !== void 0 && bound !== "*")
|
|
64
|
-
parseBytes(bound, node.span);
|
|
65
|
-
}, "validateSize");
|
|
66
|
-
var validateTag = /* @__PURE__ */ __name((node) => {
|
|
67
|
-
if (node.operator === "wildcard" ? !/^[a-z0-9*?-]{1,32}$/iu.test(node.value) : tagOf(node.value) === void 0)
|
|
68
|
-
searchError("query.invalid-tag", node.span, "a tag is 1-32 letters a-z, digits and hyphens");
|
|
69
|
-
}, "validateTag");
|
|
70
|
-
var validateMentioned = /* @__PURE__ */ __name((node) => {
|
|
71
|
-
if (!/^(?:person|organization|document):[1-9]\d*$/u.test(node.value))
|
|
72
|
-
searchError("query.invalid-reference", node.span, "use person:<uid>, organization:<id> or document:<id>, quoted");
|
|
73
|
-
}, "validateMentioned");
|
|
74
|
-
var validateTopic = /* @__PURE__ */ __name((node) => {
|
|
75
|
-
if (!/^\d+$/u.test(node.value))
|
|
76
|
-
searchError("query.invalid-topic", node.span, "use a thread id in one chat");
|
|
77
|
-
}, "validateTopic");
|
|
78
|
-
var terms = ["term", "phrase"];
|
|
79
|
-
var names = [...terms, "wildcard"];
|
|
80
|
-
var NAMES = "account-scoped: an id or contact: reference as is; with * or ? a pattern over alias, name, @username (up to 50); else a name";
|
|
81
|
-
var QUERY_FIELDS = [
|
|
82
|
-
{
|
|
83
|
-
name: "text",
|
|
84
|
-
example: "invoice",
|
|
85
|
-
index: "message_stems \u222A message_words; wildcard and regex: message_words",
|
|
86
|
-
aliases: [],
|
|
87
|
-
type: "txt",
|
|
88
|
-
operators: ["term", "phrase", "wildcard", "regex"],
|
|
89
|
-
normalization: "Snowball 3.1.1 by script (Cyrillic, Latin; the store's search_stemmers), then v1",
|
|
90
|
-
support: "A1"
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
name: "exact",
|
|
94
|
-
example: "exact:invoice",
|
|
95
|
-
index: "message_words",
|
|
96
|
-
aliases: [],
|
|
97
|
-
type: "txt",
|
|
98
|
-
operators: ["term", "phrase", "wildcard", "regex"],
|
|
99
|
-
normalization: "NFKD/marks/NFC/lowercase v1",
|
|
100
|
-
support: "A1"
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
name: "body",
|
|
104
|
-
example: "body:/.*invoice.*/",
|
|
105
|
-
index: "messages.text / bounded postfilter",
|
|
106
|
-
aliases: [],
|
|
107
|
-
type: "txt",
|
|
108
|
-
operators: ["term", "phrase", "wildcard", "regex"],
|
|
109
|
-
normalization: "raw, case-sensitive",
|
|
110
|
-
support: "A1"
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
name: "from",
|
|
114
|
-
example: "from:Alice*",
|
|
115
|
-
index: "identities / sender index",
|
|
116
|
-
aliases: ["sender"],
|
|
117
|
-
type: "kw",
|
|
118
|
-
operators: names,
|
|
119
|
-
normalization: NAMES,
|
|
120
|
-
support: "A1"
|
|
121
|
-
},
|
|
122
|
-
...["to", "cc", "bcc"].map((name) => ({
|
|
123
|
-
name,
|
|
124
|
-
example: `${name}:"Alice Synthetic"`,
|
|
125
|
-
index: "email_recipients",
|
|
126
|
-
aliases: [],
|
|
127
|
-
type: "kw",
|
|
128
|
-
operators: names,
|
|
129
|
-
normalization: `${NAMES}; mail only`,
|
|
130
|
-
support: "A1"
|
|
131
|
-
})),
|
|
132
|
-
{
|
|
133
|
-
name: "subject",
|
|
134
|
-
example: 'subject:"quarterly planning"',
|
|
135
|
-
index: "email_words, then the subject",
|
|
136
|
-
aliases: [],
|
|
137
|
-
type: "txt",
|
|
138
|
-
operators: [...terms, "wildcard"],
|
|
139
|
-
normalization: "every word, folded as text is; mail only",
|
|
140
|
-
support: "A1",
|
|
141
|
-
validate: filled
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
name: "mailbox",
|
|
145
|
-
example: 'mailbox:INBOX OR mailbox:"[Gmail]/Sent Mail"',
|
|
146
|
-
index: "email_mailboxes",
|
|
147
|
-
aliases: [],
|
|
148
|
-
type: "kw",
|
|
149
|
-
operators: [...terms, "wildcard"],
|
|
150
|
-
normalization: "a folder or label by its id (ASCII case folded) or name (case folded in any script); mail only",
|
|
151
|
-
support: "A1"
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
name: "label",
|
|
155
|
-
example: "label:Projects",
|
|
156
|
-
index: "email_mailboxes",
|
|
157
|
-
aliases: [],
|
|
158
|
-
type: "kw",
|
|
159
|
-
operators: [...terms, "wildcard"],
|
|
160
|
-
normalization: "the same as mailbox:; mail only",
|
|
161
|
-
support: "A1"
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
name: "list",
|
|
165
|
-
example: "list:github.com",
|
|
166
|
-
index: "emails.headers list-id",
|
|
167
|
-
aliases: [],
|
|
168
|
-
type: "kw",
|
|
169
|
-
operators: terms,
|
|
170
|
-
normalization: "the List-Id of a mailing list, lower case; a domain matches every list under it; mail only",
|
|
171
|
-
support: "A1",
|
|
172
|
-
validate: filled
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
name: "is",
|
|
176
|
-
example: "is:unread",
|
|
177
|
-
index: "emails.read / emails.flagged / messages.starred",
|
|
178
|
-
aliases: [],
|
|
179
|
-
type: "enum",
|
|
180
|
-
operators: terms,
|
|
181
|
-
normalization: "lowercase; read and unread are mail only; starred is a flagged email or a message the owner starred; an unknown state matches neither read nor unread",
|
|
182
|
-
support: "A1",
|
|
183
|
-
values: ["unread", "read", "starred"]
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
name: "chat",
|
|
187
|
-
example: "chat:*fixture*",
|
|
188
|
-
index: "chats / message time index",
|
|
189
|
-
aliases: [],
|
|
190
|
-
type: "kw",
|
|
191
|
-
operators: names,
|
|
192
|
-
normalization: "account-scoped: an id or chat: reference as is; with * or ? a pattern over title, @username (up to 50); else a title",
|
|
193
|
-
support: "A1"
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
name: "date",
|
|
197
|
-
example: "date:[2026-01-01 TO 2026-02-01}",
|
|
198
|
-
index: "messages.sent_at",
|
|
199
|
-
aliases: [],
|
|
200
|
-
type: "time",
|
|
201
|
-
operators: [...terms, "range"],
|
|
202
|
-
normalization: "ISO/calendar timezone; today, yesterday, 30m/2h/7d ago",
|
|
203
|
-
support: "A1"
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
name: "source",
|
|
207
|
-
example: "source:internal",
|
|
208
|
-
index: "notes (internal) / documents (file)",
|
|
209
|
-
aliases: [],
|
|
210
|
-
type: "enum",
|
|
211
|
-
operators: terms,
|
|
212
|
-
normalization: "lowercase; notes only: internal is written in memo, file is from a notes folder",
|
|
213
|
-
support: "A1",
|
|
214
|
-
values: ["internal", "file"]
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
name: "kind",
|
|
218
|
-
example: "kind:private",
|
|
219
|
-
index: "chats.kind / peerKind metadata",
|
|
220
|
-
aliases: [],
|
|
221
|
-
type: "enum",
|
|
222
|
-
operators: terms,
|
|
223
|
-
normalization: "lowercase",
|
|
224
|
-
support: "A1",
|
|
225
|
-
values: ["private", "saved", "bot", "service", "group", "channel", "unknown"]
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
name: "muted",
|
|
229
|
-
example: "muted:false",
|
|
230
|
-
index: "chats.muted / chats.muted_until",
|
|
231
|
-
aliases: [],
|
|
232
|
-
type: "enum",
|
|
233
|
-
operators: terms,
|
|
234
|
-
normalization: "lowercase; true is a chat the owner muted, until the mute runs out; false is every other chat",
|
|
235
|
-
support: "A1",
|
|
236
|
-
values: ["true", "false"]
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
name: "participants_count",
|
|
240
|
-
example: "participants_count<10",
|
|
241
|
-
index: "chats.participants_count",
|
|
242
|
-
aliases: [],
|
|
243
|
-
type: "num",
|
|
244
|
-
operators: [...terms, "range"],
|
|
245
|
-
normalization: "a whole number; a chat whose size the messenger never told matches no value",
|
|
246
|
-
support: "A1"
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
name: "has",
|
|
250
|
-
example: "has:file",
|
|
251
|
-
index: "attachments / messages_fts links / message_transcripts",
|
|
252
|
-
aliases: [],
|
|
253
|
-
type: "enum",
|
|
254
|
-
operators: terms,
|
|
255
|
-
normalization: "lowercase",
|
|
256
|
-
support: "A1",
|
|
257
|
-
values: [
|
|
258
|
-
"text",
|
|
259
|
-
"attachment",
|
|
260
|
-
"link",
|
|
261
|
-
"file",
|
|
262
|
-
"photo",
|
|
263
|
-
"image",
|
|
264
|
-
"video",
|
|
265
|
-
"audio",
|
|
266
|
-
"voice",
|
|
267
|
-
"sticker",
|
|
268
|
-
"contact",
|
|
269
|
-
"location",
|
|
270
|
-
"poll",
|
|
271
|
-
"transcript"
|
|
272
|
-
]
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
name: "topic",
|
|
276
|
-
example: "chat:7 AND topic:42",
|
|
277
|
-
index: "messages.thread_native_id",
|
|
278
|
-
aliases: [],
|
|
279
|
-
type: "kw",
|
|
280
|
-
operators: terms,
|
|
281
|
-
normalization: "string id, one chat required",
|
|
282
|
-
support: "A1",
|
|
283
|
-
validate: validateTopic
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
name: "in",
|
|
287
|
-
example: "in:bots",
|
|
288
|
-
index: "accounts.provider",
|
|
289
|
-
aliases: [],
|
|
290
|
-
type: "kw",
|
|
291
|
-
operators: terms,
|
|
292
|
-
normalization: "lowercase provider/account class",
|
|
293
|
-
support: "A1"
|
|
294
|
-
},
|
|
295
|
-
{
|
|
296
|
-
name: "preset",
|
|
297
|
-
example: "preset:secret",
|
|
298
|
-
index: "bounded local candidate detector",
|
|
299
|
-
aliases: [],
|
|
300
|
-
type: "enum",
|
|
301
|
-
operators: terms,
|
|
302
|
-
normalization: "versioned candidate detector",
|
|
303
|
-
support: "A1",
|
|
304
|
-
values: [
|
|
305
|
-
"password",
|
|
306
|
-
"code",
|
|
307
|
-
"api-key",
|
|
308
|
-
"secret",
|
|
309
|
-
"card",
|
|
310
|
-
"bank",
|
|
311
|
-
"passport",
|
|
312
|
-
"phone",
|
|
313
|
-
"email",
|
|
314
|
-
"telegram-link",
|
|
315
|
-
"url",
|
|
316
|
-
"contact",
|
|
317
|
-
"location"
|
|
318
|
-
]
|
|
319
|
-
},
|
|
320
|
-
{
|
|
321
|
-
name: "filename",
|
|
322
|
-
example: "filename:*.pdf",
|
|
323
|
-
index: "attachments.name / bounded postfilter",
|
|
324
|
-
aliases: [],
|
|
325
|
-
type: "kw",
|
|
326
|
-
operators: [...terms, "wildcard", "regex"],
|
|
327
|
-
normalization: "NFKD/marks/NFC/lowercase v1, whole name",
|
|
328
|
-
support: "A2"
|
|
329
|
-
},
|
|
330
|
-
{
|
|
331
|
-
name: "mime",
|
|
332
|
-
example: 'mime:"application/pdf" OR mime:image',
|
|
333
|
-
index: "attachments.mime / bounded postfilter",
|
|
334
|
-
aliases: [],
|
|
335
|
-
type: "kw",
|
|
336
|
-
operators: [...terms, "wildcard"],
|
|
337
|
-
normalization: "lowercase; a value without / matches the first part; only where the messenger reports a type",
|
|
338
|
-
support: "A2"
|
|
339
|
-
},
|
|
340
|
-
{
|
|
341
|
-
name: "size",
|
|
342
|
-
example: "size>10MB",
|
|
343
|
-
index: "attachments.size",
|
|
344
|
-
aliases: [],
|
|
345
|
-
type: "kw",
|
|
346
|
-
operators: [...terms, "range"],
|
|
347
|
-
normalization: "bytes; KB/MB/GB are 1024-based",
|
|
348
|
-
support: "A2",
|
|
349
|
-
validate: validateSize
|
|
350
|
-
},
|
|
351
|
-
{
|
|
352
|
-
name: "content",
|
|
353
|
-
example: "content:invoice",
|
|
354
|
-
index: "attachment_words",
|
|
355
|
-
aliases: [],
|
|
356
|
-
type: "txt",
|
|
357
|
-
operators: [...terms, "wildcard"],
|
|
358
|
-
normalization: "NFKD/marks/NFC/lowercase v1; the text of files attachments extract read or an agent wrote",
|
|
359
|
-
support: "A2",
|
|
360
|
-
validate: filled
|
|
361
|
-
},
|
|
362
|
-
{
|
|
363
|
-
name: "transcript",
|
|
364
|
-
example: "transcript:invoice",
|
|
365
|
-
index: "attachment_words \u222A transcript_stems; garbled spellings from transcript_words_vocab",
|
|
366
|
-
aliases: [],
|
|
367
|
-
type: "txt",
|
|
368
|
-
operators: [...terms, "wildcard"],
|
|
369
|
-
normalization: "any form of the word (Snowball), widened to spellings speech recognition garbles; what a voice message said",
|
|
370
|
-
support: "A2",
|
|
371
|
-
validate: filled
|
|
372
|
-
},
|
|
373
|
-
...[
|
|
374
|
-
[
|
|
375
|
-
"title",
|
|
376
|
-
'title:"quarterly report"',
|
|
377
|
-
"documents.metadata, then the title column; chats.title_folded; email_words, then the subject",
|
|
378
|
-
"every word, folded as text is: of a note's or a file's title, inside a chat's title, of a mail's subject (as subject:)",
|
|
379
|
-
"txt"
|
|
380
|
-
],
|
|
381
|
-
[
|
|
382
|
-
"site",
|
|
383
|
-
"site:wikipedia",
|
|
384
|
-
"documents.metadata (og:site_name)",
|
|
385
|
-
"contained, folded as text is; notes and files only",
|
|
386
|
-
"kw"
|
|
387
|
-
],
|
|
388
|
-
[
|
|
389
|
-
"lang",
|
|
390
|
-
"lang:ru",
|
|
391
|
-
"documents.metadata (html lang)",
|
|
392
|
-
"language tag or its prefix, lowercase; notes and files only",
|
|
393
|
-
"kw"
|
|
394
|
-
],
|
|
395
|
-
[
|
|
396
|
-
"author",
|
|
397
|
-
"author:ivanov",
|
|
398
|
-
"documents.metadata (meta author, JSON-LD)",
|
|
399
|
-
"contained, folded as text is; notes and files only",
|
|
400
|
-
"kw"
|
|
401
|
-
],
|
|
402
|
-
[
|
|
403
|
-
"keyword",
|
|
404
|
-
"keyword:invoices",
|
|
405
|
-
"documents.metadata (meta keywords)",
|
|
406
|
-
"whole keyword, folded as text is; notes and files only",
|
|
407
|
-
"kw"
|
|
408
|
-
]
|
|
409
|
-
].map(([name, example, index, normalization, type]) => ({
|
|
410
|
-
name,
|
|
411
|
-
example,
|
|
412
|
-
index,
|
|
413
|
-
aliases: [],
|
|
414
|
-
type,
|
|
415
|
-
operators: terms,
|
|
416
|
-
normalization,
|
|
417
|
-
support: "A2",
|
|
418
|
-
validate: filled
|
|
419
|
-
})),
|
|
420
|
-
...[
|
|
421
|
-
[
|
|
422
|
-
"phone",
|
|
423
|
-
'phone:"8 900 000-00-01"',
|
|
424
|
-
"a phone found in the text, written any way; a number without + is read in phone_countries"
|
|
425
|
-
],
|
|
426
|
-
["email", "email:ana@example.com", "an address found in the text, lower-cased"],
|
|
427
|
-
["url", 'url:"https://example.com/a"', "a link found in the text, without utm_*, fbclid and the fragment"],
|
|
428
|
-
["domain", "domain:google.com", "the site of a link or an address in the text; docs.google.com means google.com"],
|
|
429
|
-
[
|
|
430
|
-
"link",
|
|
431
|
-
'link:"click?id=1"',
|
|
432
|
-
"a part of a link, quoted; Latin letters in any case; in mail also the body of a letter with a tracking link"
|
|
433
|
-
]
|
|
434
|
-
].map(([name, example, normalization]) => ({
|
|
435
|
-
name,
|
|
436
|
-
example,
|
|
437
|
-
index: "mentions (kind, value) / (domain); in mail a tracking link is kept as its site",
|
|
438
|
-
aliases: [],
|
|
439
|
-
type: "kw",
|
|
440
|
-
operators: terms,
|
|
441
|
-
normalization,
|
|
442
|
-
support: "A2",
|
|
443
|
-
validate: filled
|
|
444
|
-
})),
|
|
445
|
-
{
|
|
446
|
-
name: "mentions",
|
|
447
|
-
example: 'mentions:"person:12"',
|
|
448
|
-
index: "mentions (target_type, target_id)",
|
|
449
|
-
aliases: [],
|
|
450
|
-
type: "kw",
|
|
451
|
-
operators: terms,
|
|
452
|
-
normalization: "a person (by name, phone or address), an organization or a document, linked; quoted",
|
|
453
|
-
support: "A2",
|
|
454
|
-
validate: validateMentioned
|
|
455
|
-
},
|
|
456
|
-
{
|
|
457
|
-
name: "tag",
|
|
458
|
-
example: "tag:work",
|
|
459
|
-
index: "tags: the message, its chat or its sender",
|
|
460
|
-
aliases: [],
|
|
461
|
-
type: "kw",
|
|
462
|
-
operators: [...terms, "wildcard"],
|
|
463
|
-
normalization: "lowercase a-z, 0-9 and -, 1-32 characters",
|
|
464
|
-
support: "A2",
|
|
465
|
-
validate: validateTag
|
|
466
|
-
}
|
|
467
|
-
];
|
|
468
|
-
var MESSAGES = { entity: "message", backend: "sql", fields: QUERY_FIELDS };
|
|
469
|
-
var NEAR_FIELDS = /* @__PURE__ */ new Set(["text", "exact", "transcript", "content"]);
|
|
470
|
-
var CANONICAL = new Map(QUERY_FIELDS.flatMap(({ name, aliases }) => aliases.map((alias) => [alias, name])));
|
|
471
|
-
var isPresence = /* @__PURE__ */ __name((node) => node.operator === "wildcard" && node.value === "*", "isPresence");
|
|
472
|
-
var PRESENCE = /* @__PURE__ */ new Set(["from", "to", "cc", "bcc", "subject", "title", "topic", "participants_count"]);
|
|
473
|
-
var ALWAYS = /* @__PURE__ */ new Set(["chat", "date"]);
|
|
474
|
-
var EVERY_DATE = { operator: "range", value: "*", upper: "*", lower_inclusive: true, upper_inclusive: true };
|
|
475
|
-
var PRESENCE_INSTEAD = {
|
|
476
|
-
text: "has:text",
|
|
477
|
-
exact: "has:text",
|
|
478
|
-
body: "has:text",
|
|
479
|
-
content: "has:file",
|
|
480
|
-
transcript: "has:transcript",
|
|
481
|
-
size: "has:attachment",
|
|
482
|
-
url: "has:link",
|
|
483
|
-
link: "has:link",
|
|
484
|
-
domain: "has:link"
|
|
485
|
-
};
|
|
486
|
-
var CONTAINED = /* @__PURE__ */ new Set(["title", "site", "author"]);
|
|
487
|
-
var notPresent = /* @__PURE__ */ __name((node) => searchError("query.unsupported-operator", node.span, `${node.field}:* asks whether ${node.field} has a value, which search answers for ${[...PRESENCE, ...ALWAYS].join(", ")}${PRESENCE_INSTEAD[node.field] ? `; write ${PRESENCE_INSTEAD[node.field]}` : ""}`), "notPresent");
|
|
488
|
-
var canonical = /* @__PURE__ */ __name((node) => {
|
|
489
|
-
if (node.kind === "boolean") {
|
|
490
|
-
const clauses = node.clauses.map((clause) => {
|
|
491
|
-
const inner = canonical(clause.node);
|
|
492
|
-
return inner === clause.node ? clause : { ...clause, node: inner };
|
|
493
|
-
});
|
|
494
|
-
return clauses.every((clause, at) => clause === node.clauses[at]) ? node : { ...node, clauses };
|
|
495
|
-
}
|
|
496
|
-
const field = CANONICAL.get(node.field);
|
|
497
|
-
if (node.field !== "_exists_")
|
|
498
|
-
return field ? { ...node, field } : node;
|
|
499
|
-
const { implicit: _, ...rest } = node;
|
|
500
|
-
return { ...rest, field: CANONICAL.get(node.value) ?? node.value, operator: "wildcard", value: "*" };
|
|
501
|
-
}, "canonical");
|
|
502
|
-
var everyDate = /* @__PURE__ */ __name((node) => node.kind === "boolean" ? { ...node, clauses: node.clauses.map((clause) => ({ ...clause, node: everyDate(clause.node) })) } : isPresence(node) && ALWAYS.has(node.field) ? { kind: "predicate", field: "date", ...EVERY_DATE, span: node.span } : node, "everyDate");
|
|
503
|
-
var validateFields = /* @__PURE__ */ __name((written, { presence = false } = {}) => {
|
|
504
|
-
const root = canonical(written.root);
|
|
505
|
-
const ast = root === written.root ? written : { ...written, root };
|
|
506
|
-
for (const node of walkQuery(ast.root)) {
|
|
507
|
-
if (presence && isPresence(node)) {
|
|
508
|
-
if (PRESENCE.has(node.field) || ALWAYS.has(node.field))
|
|
509
|
-
continue;
|
|
510
|
-
const known = QUERY_FIELDS.find(({ name }) => name === node.field);
|
|
511
|
-
if (known && (!known.operators.includes("wildcard") || PRESENCE_INSTEAD[node.field]))
|
|
512
|
-
notPresent(node);
|
|
513
|
-
}
|
|
514
|
-
const field = QUERY_FIELDS.find(({ name }) => name === node.field);
|
|
515
|
-
if (!field && ["after", "before"].includes(node.field)) {
|
|
516
|
-
const plain = ["term", "phrase"].includes(node.operator) && /^[\w:.+-]+$/u.test(node.value);
|
|
517
|
-
searchError("query.legacy-date-field", node.span, plain ? `use date${node.field === "after" ? ">=" : "<"}${node.value}` : "use date>=YYYY-MM-DD or date:[a TO b]");
|
|
518
|
-
}
|
|
519
|
-
if (node.slop !== void 0 && !NEAR_FIELDS.has(node.field))
|
|
520
|
-
searchError("query.unsupported-operator", node.span, `"a b"~N takes words: ${[...NEAR_FIELDS].join(", ")}`);
|
|
521
|
-
if (node.slop !== void 0 && node.slop > MOST_WORDS_APART)
|
|
522
|
-
searchError("query.invalid-number", node.span, `words at most ${MOST_WORDS_APART} apart: "a b"~${MOST_WORDS_APART}`);
|
|
523
|
-
if (field && node.operator === "wildcard" && !field.operators.includes("wildcard")) {
|
|
524
|
-
const part = node.value.replace(/[*?]/gu, "");
|
|
525
|
-
searchError("query.unsupported-operator", node.span, `${field.name} takes ${field.operators.join(", ")}` + (CONTAINED.has(field.name) && part ? `; ${field.name}:${part} already finds it inside a word` : ""));
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
const valid = validateQuery(ast, MESSAGES, SEARCH_QUERY);
|
|
529
|
-
return presence ? { ...valid, root: everyDate(valid.root) } : valid;
|
|
530
|
-
}, "validateFields");
|
|
531
|
-
var record = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && !Array.isArray(value), "record");
|
|
532
|
-
var validSpan = /* @__PURE__ */ __name((value) => record(value) && Number.isInteger(value.start) && Number.isInteger(value.end) && Number(value.start) >= 0 && Number(value.end) >= Number(value.start) && Number(value.end) <= QUERY_LIMITS.bytes, "validSpan");
|
|
533
|
-
var validateAst = /* @__PURE__ */ __name((input, options = {}) => {
|
|
534
|
-
const failure = { start: 0, end: 0 };
|
|
535
|
-
if (!record(input) || input.version !== 1 || input.language !== "lucene-v1")
|
|
536
|
-
searchError("query.unsupported-version", failure);
|
|
537
|
-
let count = 0;
|
|
538
|
-
let bytes = 0;
|
|
539
|
-
const measure = /* @__PURE__ */ __name((value, depth) => {
|
|
540
|
-
if (++count > QUERY_LIMITS.nodes || depth > QUERY_LIMITS.depth)
|
|
541
|
-
searchError("query.too-large", failure);
|
|
542
|
-
if (!record(value) || !validSpan(value.span))
|
|
543
|
-
searchError("query.invalid-ast", failure);
|
|
544
|
-
if (Array.isArray(value.clauses)) {
|
|
545
|
-
if (value.clauses.length === 0)
|
|
546
|
-
searchError("query.invalid-ast", value.span);
|
|
547
|
-
for (const clause of value.clauses)
|
|
548
|
-
measure(record(clause) ? clause.node : void 0, depth + 1);
|
|
549
|
-
return;
|
|
550
|
-
}
|
|
551
|
-
for (const text of [value.field, value.value, value.upper])
|
|
552
|
-
if (typeof text === "string")
|
|
553
|
-
bytes += new TextEncoder().encode(text).length;
|
|
554
|
-
if (bytes > QUERY_LIMITS.bytes)
|
|
555
|
-
searchError("query.too-large", value.span);
|
|
556
|
-
}, "measure");
|
|
557
|
-
measure(input.root, 1);
|
|
558
|
-
const parsed = safeParse(queryAstSchema, input);
|
|
559
|
-
if (!parsed.success)
|
|
560
|
-
searchError("query.invalid-ast", failure);
|
|
561
|
-
const open = walkQuery(parsed.output.root).find((node) => node.operator === "range" && (node.upper === void 0 || node.lower_inclusive === void 0 || node.upper_inclusive === void 0));
|
|
562
|
-
if (open)
|
|
563
|
-
searchError("query.invalid-ast", open.span);
|
|
564
|
-
return validateFields(parsed.output, options);
|
|
565
|
-
}, "validateAst");
|
|
566
|
-
|
|
567
|
-
// node_modules/.pnpm/@wirecat+cli-core@1.0.0_@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescr_dd5172c52281f8f1e2dd1d4e9555d5c3/node_modules/@wirecat/cli-core/dist/search/lucene/plain.js
|
|
568
|
-
var REPAIRED = /* @__PURE__ */ new Set([
|
|
569
|
-
"query.invalid-syntax",
|
|
570
|
-
"query.unclosed-literal",
|
|
571
|
-
"query.unsupported-operator",
|
|
572
|
-
"query.invalid-escape"
|
|
573
|
-
]);
|
|
574
|
-
var SEARCH_FIELDS = /* @__PURE__ */ new Set([
|
|
575
|
-
...QUERY_FIELDS.flatMap(({ name, aliases }) => [name, ...aliases]),
|
|
576
|
-
"after",
|
|
577
|
-
"before",
|
|
578
|
-
"_exists_"
|
|
579
|
-
]);
|
|
580
|
-
var FIELD_PREFIX = /^[+-]?([\p{L}\p{N}_.]+)(?:[:=]|[<>]=?)/u;
|
|
581
|
-
var FIELD_NAME = /^[a-z][a-z_]{2,}$/u;
|
|
582
|
-
var LISTED_BY = "this search has no such field; a list filters by it:";
|
|
583
|
-
var ELSEWHERE = {
|
|
584
|
-
status: `${LISTED_BY} tasks list status:open, deals list status:won`,
|
|
585
|
-
stage: `${LISTED_BY} deals list stage:<value>`,
|
|
586
|
-
pipeline: `${LISTED_BY} deals list pipeline:<value>`,
|
|
587
|
-
priority: `${LISTED_BY} tasks list priority:<value>`,
|
|
588
|
-
assignee: `${LISTED_BY} tasks list assignee:<value>`,
|
|
589
|
-
project: `${LISTED_BY} tasks list project:<value>`,
|
|
590
|
-
due: `${LISTED_BY} tasks list due:<value>`,
|
|
591
|
-
name: "a person's name is from: (who wrote) or mentions: here"
|
|
592
|
-
};
|
|
593
|
-
var unknownField = /* @__PURE__ */ __name((field, written, span, fields) => searchError("query.unknown-field", span, `${ELSEWHERE[field] ?? `fields here: ${[...fields].filter((one) => FIELD_NAME.test(one)).join(", ")}`}; to find the words as written, quote them: "${written}"`), "unknownField");
|
|
594
|
-
var space = /* @__PURE__ */ __name((c) => c !== void 0 && /[ \t\n\r\u3000]/u.test(c), "space");
|
|
595
|
-
var quoted = /* @__PURE__ */ __name((text) => {
|
|
596
|
-
let out = "";
|
|
597
|
-
for (let at = 0; at < text.length; at++) {
|
|
598
|
-
const c = text[at];
|
|
599
|
-
if (c === "\\" && at + 1 < text.length && (text[at + 1] !== "u" || /^u[0-9a-fA-F]{4}/u.test(text.slice(at + 1)))) {
|
|
600
|
-
out += c + text[at + 1];
|
|
601
|
-
at++;
|
|
602
|
-
} else
|
|
603
|
-
out += c === '"' || c === "\\" ? `\\${c}` : c;
|
|
604
|
-
}
|
|
605
|
-
return `"${out}"`;
|
|
606
|
-
}, "quoted");
|
|
607
|
-
var literal = /* @__PURE__ */ __name((word, keepParens, fields) => {
|
|
608
|
-
const prefix = FIELD_PREFIX.exec(word);
|
|
609
|
-
const field = prefix && fields.has(prefix[1] ?? "") ? prefix[0] : "";
|
|
610
|
-
const rest = word.slice(field.length);
|
|
611
|
-
const opening = keepParens ? (field ? /^\(*/u : /^[(+-]*/u).exec(rest)?.[0] ?? "" : "";
|
|
612
|
-
const closing = keepParens ? /\)*$/u.exec(rest.slice(opening.length))?.[0] ?? "" : "";
|
|
613
|
-
const body = rest.slice(opening.length, rest.length - closing.length);
|
|
614
|
-
if (!body)
|
|
615
|
-
return keepParens ? literal(word, false, fields) : `${field}${quoted(rest)}`;
|
|
616
|
-
return `${field}${opening}${quoted(body)}${closing}`;
|
|
617
|
-
}, "literal");
|
|
618
|
-
var wordAround = /* @__PURE__ */ __name((text, at) => {
|
|
619
|
-
let start = at;
|
|
620
|
-
while (start > 0 && !space(text[start - 1]))
|
|
621
|
-
start--;
|
|
622
|
-
let end = at;
|
|
623
|
-
while (end < text.length && !space(text[end]))
|
|
624
|
-
end++;
|
|
625
|
-
return { start, end };
|
|
626
|
-
}, "wordAround");
|
|
627
|
-
var everyWordLiteral = /* @__PURE__ */ __name((text, fields) => text.replace(/[^ \t\n\r\u3000]+/gu, (word) => literal(word, false, fields)), "everyWordLiteral");
|
|
628
|
-
var refusal = /* @__PURE__ */ __name((refuse) => {
|
|
629
|
-
try {
|
|
630
|
-
return refuse();
|
|
631
|
-
} catch (error) {
|
|
632
|
-
return { refused: error };
|
|
633
|
-
}
|
|
634
|
-
}, "refusal");
|
|
635
|
-
var read = /* @__PURE__ */ __name((text, fields) => {
|
|
636
|
-
try {
|
|
637
|
-
const leaves = walkQuery(parseLucene(text, MESSAGE_PARSING).root);
|
|
638
|
-
const unknown = leaves.find(({ field }) => !fields.has(field));
|
|
639
|
-
if (unknown && FIELD_NAME.test(unknown.field) && unknown.value && !unknown.value.startsWith("/"))
|
|
640
|
-
return refusal(() => unknownField(unknown.field, text.slice(unknown.span.start, unknown.span.end), unknown.span, fields));
|
|
641
|
-
if (unknown)
|
|
642
|
-
return { at: text.lastIndexOf(unknown.field, unknown.span.start) };
|
|
643
|
-
const questions = leaves.flatMap(({ implicit, operator, value, span }) => {
|
|
644
|
-
const mark = /^[^*?]*[^*?\\]\?+$/u.test(value) && implicit && operator === "wildcard" ? /\?+$/u.exec(value) : null;
|
|
645
|
-
return mark ? [span.end - mark[0].length] : [];
|
|
646
|
-
});
|
|
647
|
-
if (questions.length)
|
|
648
|
-
return { questions };
|
|
649
|
-
const wordless = leaves.filter(({ implicit, operator, value }) => implicit && (operator === "term" || operator === "phrase") && !/[\p{L}\p{N}]/u.test(value));
|
|
650
|
-
const words = wordless.length < leaves.length;
|
|
651
|
-
return { wordless: words ? wordless : [], words };
|
|
652
|
-
} catch (error) {
|
|
653
|
-
const details = isCliError(error) ? error.details : void 0;
|
|
654
|
-
if (!details?.span || !REPAIRED.has(details.reason ?? ""))
|
|
655
|
-
throw error;
|
|
656
|
-
if (/^~\d/u.test(text.slice(details.span.start)))
|
|
657
|
-
throw error;
|
|
658
|
-
const at = details.span.start;
|
|
659
|
-
const boost = /^\^\d+(?:\.\d+)?/u.exec(text.slice(at))?.[0];
|
|
660
|
-
if (boost && at > 0 && !space(text[at - 1])) {
|
|
661
|
-
const { start } = wordAround(text, at);
|
|
662
|
-
const written = text.slice(start, at + boost.length);
|
|
663
|
-
return refusal(() => searchError("query.unsupported-operator", { start, end: at + boost.length }, `boost ${boost} is not supported \u2014 drop it: ${text.slice(start, at)}, or quote the text to find it as written: ${quoted(written)}`));
|
|
664
|
-
}
|
|
665
|
-
return { at };
|
|
666
|
-
}
|
|
667
|
-
}, "read");
|
|
668
|
-
var without = /* @__PURE__ */ __name((text, leaves) => [...leaves].sort((a, b) => b.span.start - a.span.start).reduce((left, { span }) => left.slice(0, span.start) + left.slice(span.end), text).trim(), "without");
|
|
669
|
-
var plainQuery = /* @__PURE__ */ __name((text, fields = SEARCH_FIELDS) => {
|
|
670
|
-
if (text.trim() && !/[\p{L}\p{N}*]/u.test(text))
|
|
671
|
-
throw new CliError("validation_error", `search needs a letter or a digit to look for; ${JSON.stringify(text)} has none`);
|
|
672
|
-
let current = text;
|
|
673
|
-
let whole = false;
|
|
674
|
-
for (let tries = 0; tries <= 64; tries++) {
|
|
675
|
-
let reading;
|
|
676
|
-
try {
|
|
677
|
-
reading = read(current, fields);
|
|
678
|
-
} catch {
|
|
679
|
-
return text;
|
|
680
|
-
}
|
|
681
|
-
if ("refused" in reading)
|
|
682
|
-
throw reading.refused;
|
|
683
|
-
if ("questions" in reading) {
|
|
684
|
-
current = reading.questions.sort((a, b) => b - a).reduce((left, at) => left.slice(0, at) + left.slice(at).replace(/^\?+/u, (marks) => "\\?".repeat(marks.length)), current);
|
|
685
|
-
continue;
|
|
686
|
-
}
|
|
687
|
-
if ("wordless" in reading) {
|
|
688
|
-
if (!reading.words && current !== text)
|
|
689
|
-
return text;
|
|
690
|
-
if (!reading.wordless.length)
|
|
691
|
-
return current;
|
|
692
|
-
current = without(current, reading.wordless);
|
|
693
|
-
continue;
|
|
694
|
-
}
|
|
695
|
-
const word = reading.at < 0 || reading.at >= current.length ? void 0 : wordAround(current, reading.at);
|
|
696
|
-
const paren = "()".includes(current[reading.at] ?? "");
|
|
697
|
-
const repaired = word ? current.slice(0, word.start) + literal(current.slice(word.start, word.end), !paren, fields) + current.slice(word.end) : current;
|
|
698
|
-
if (repaired !== current) {
|
|
699
|
-
current = repaired;
|
|
700
|
-
continue;
|
|
701
|
-
}
|
|
702
|
-
if (whole)
|
|
703
|
-
return text;
|
|
704
|
-
whole = true;
|
|
705
|
-
current = everyWordLiteral(text, fields);
|
|
706
|
-
}
|
|
707
|
-
return text;
|
|
708
|
-
}, "plainQuery");
|
|
709
|
-
|
|
710
|
-
export {
|
|
711
|
-
FIELD_VERSION,
|
|
712
|
-
parseBytes,
|
|
713
|
-
QUERY_FIELDS,
|
|
714
|
-
isPresence,
|
|
715
|
-
PRESENCE,
|
|
716
|
-
validateFields,
|
|
717
|
-
validateAst,
|
|
718
|
-
plainQuery,
|
|
719
|
-
RRF_K,
|
|
720
|
-
fuseRanked
|
|
721
|
-
};
|