@wirecat/zoom-cli 0.69.0 → 0.70.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/README.md +1 -1
- package/dist/account-removal.d.ts +6 -0
- package/dist/account-removal.d.ts.map +1 -0
- package/dist/account-removal.js +43 -0
- package/dist/account-removal.js.map +1 -0
- package/dist/bin/zm.js +2 -2
- package/dist/bundle/{all-profiles-ZQWPCJEK.js → all-profiles-GE2TFJJP.js} +9 -9
- package/dist/bundle/answer-policy-GOXSDYDD.js +104 -0
- package/dist/bundle/{anthropic-7FUQ2HYJ.js → anthropic-FA6NHENI.js} +9 -7
- package/dist/bundle/{app-server-DNPE2EQB.js → app-server-IRADMSNX.js} +50 -50
- package/dist/bundle/{bun-ZVQFCFCC.js → bun-ZYZGGCX5.js} +2 -2
- package/dist/bundle/{bun-sqlite-EB2UMUPJ.js → bun-sqlite-Y24TUIGS.js} +4 -4
- package/dist/bundle/{chunk-B5D7NZI7.js → chunk-2JEM2YNV.js} +1 -1
- package/dist/bundle/{chunk-JX5JJZC3.js → chunk-2QFPVUM3.js} +2 -2
- package/dist/bundle/{chunk-KAPJQGHE.js → chunk-2U6SER67.js} +1 -1
- package/dist/bundle/{chunk-TWIC6JJG.js → chunk-3KC7C465.js} +7 -7
- package/dist/bundle/{chunk-MOTKS7XG.js → chunk-4DSIWYGO.js} +863 -423
- package/dist/bundle/{chunk-LEA4BGK7.js → chunk-56OV5ASY.js} +11 -11
- package/dist/bundle/{chunk-TN77LX6W.js → chunk-5XWCBLUR.js} +1 -1
- package/dist/bundle/{chunk-SZ3Z4ZNO.js → chunk-6HJFIMT7.js} +1 -1
- package/dist/bundle/{chunk-SQT47CFW.js → chunk-6IF5ZHDS.js} +1 -1
- package/dist/bundle/{chunk-BOAMDYLY.js → chunk-7QC4M4HS.js} +2 -2
- package/dist/bundle/{chunk-MSDCZ6GT.js → chunk-AISJCF7A.js} +4 -4
- package/dist/bundle/{chunk-F5DYBWH7.js → chunk-AT2XKNFN.js} +51 -8
- package/dist/bundle/{chunk-V74QFMSL.js → chunk-AUNW7N4I.js} +1 -1
- package/dist/bundle/{chunk-6TICX3MN.js → chunk-BSS6HX4O.js} +2 -2
- package/dist/bundle/{chunk-5ZJXKASF.js → chunk-BVWF4B33.js} +10 -10
- package/dist/bundle/{chunk-GXDOTUUO.js → chunk-CEJJBZAE.js} +9 -9
- package/dist/bundle/{chunk-IPBZKUC3.js → chunk-CHGUNZ3L.js} +3 -3
- package/dist/bundle/{chunk-O7L44JK2.js → chunk-CIZ25UPK.js} +2259 -1046
- package/dist/bundle/{chunk-JHFP3Z5S.js → chunk-CSEBB4OP.js} +8 -8
- package/dist/bundle/{chunk-RPQ3JOD3.js → chunk-D3PNCJD5.js} +5 -5
- package/dist/bundle/{chunk-R2ULMWB4.js → chunk-DCUWJITQ.js} +29 -29
- package/dist/bundle/{chunk-R3JYPY3J.js → chunk-DNR4B5YV.js} +2 -2
- package/dist/bundle/{chunk-EPPSMCEV.js → chunk-DXCTW3MV.js} +1 -1
- package/dist/bundle/{chunk-B6JMVB6R.js → chunk-EOSVN2ER.js} +1 -1
- package/dist/bundle/{chunk-QW5VPZEH.js → chunk-GB5X3GBE.js} +23 -1
- package/dist/bundle/{chunk-CKK6JOC4.js → chunk-GVT5363M.js} +2 -2
- package/dist/bundle/{chunk-C6TEYKXV.js → chunk-IINZIP73.js} +7 -7
- package/dist/bundle/{chunk-H3MFBYTQ.js → chunk-IS3ZTT2Z.js} +5 -5
- package/dist/bundle/{chunk-HW5QTRFF.js → chunk-IWPXWGF7.js} +33 -33
- package/dist/bundle/{chunk-CUZHKYC2.js → chunk-J3SKXICS.js} +350 -136
- package/dist/bundle/{chunk-ZRHMB3LQ.js → chunk-JRO2FWO2.js} +1 -1
- package/dist/bundle/chunk-JULBAECW.js +126 -0
- package/dist/bundle/{chunk-XITUFTON.js → chunk-KM736RMJ.js} +1 -1
- package/dist/bundle/{chunk-S2EAGDS7.js → chunk-KWRCP55G.js} +11 -11
- package/dist/bundle/{chunk-6KMTQX3D.js → chunk-L24UOUWG.js} +1 -1
- package/dist/bundle/{chunk-G6IX2MD2.js → chunk-LAG5O2FV.js} +180 -222
- package/dist/bundle/{chunk-XRZDYWF6.js → chunk-LXXCLQCW.js} +2 -2
- package/dist/bundle/{chunk-IEC4E65G.js → chunk-M6JIXMQZ.js} +5 -1
- package/dist/bundle/{chunk-QXM7S3Y3.js → chunk-M7E44TMT.js} +5 -5
- package/dist/bundle/{chunk-Z6TTGTMU.js → chunk-M7VUXXGS.js} +19 -4
- package/dist/bundle/{chunk-MNOVYS43.js → chunk-MVOMLJYQ.js} +3 -3
- package/dist/bundle/{chunk-MVDPZRFE.js → chunk-OA37BWE5.js} +1 -1
- package/dist/bundle/{chunk-5H6VTEEC.js → chunk-OAQLVV6W.js} +2 -2
- package/dist/bundle/{chunk-KNE6VFHZ.js → chunk-OORMSM6O.js} +1 -1
- package/dist/bundle/{chunk-UEZ6URJR.js → chunk-PV6OHXHN.js} +16 -16
- package/dist/bundle/{chunk-TFFEFEG2.js → chunk-QL7EMFIC.js} +18 -18
- package/dist/bundle/{chunk-HSI7YOYK.js → chunk-QO2KPU26.js} +16 -16
- package/dist/bundle/{chunk-XJBYGMZ4.js → chunk-RB33VTUW.js} +243 -387
- package/dist/bundle/{chunk-HC56J5LB.js → chunk-RIPAUCKJ.js} +54 -54
- package/dist/bundle/{chunk-WY4NYPPS.js → chunk-RO3ZR4VP.js} +12 -12
- package/dist/bundle/{chunk-BL36NSV5.js → chunk-RQG5VOGH.js} +12 -2
- package/dist/bundle/{chunk-JZ4YOAHA.js → chunk-RRRJCHUC.js} +1767 -1038
- package/dist/bundle/{chunk-37B7A4RP.js → chunk-RWIILYKW.js} +1 -1
- package/dist/bundle/{chunk-3TPRYZUW.js → chunk-SNIY3JDN.js} +18 -18
- package/dist/bundle/{chunk-TKXLWFM2.js → chunk-SVF3NDAO.js} +3 -3
- package/dist/bundle/{chunk-GR3QDHBU.js → chunk-UVPL7YAY.js} +5 -5
- package/dist/bundle/{chunk-6N2D6JGX.js → chunk-V2E7QFZ3.js} +1 -1
- package/dist/bundle/{chunk-4APZQYCH.js → chunk-V5GRSOCZ.js} +4 -4
- package/dist/bundle/{chunk-T5X4LGXE.js → chunk-VE2VNECR.js} +12 -12
- package/dist/bundle/{chunk-QLGG7S6F.js → chunk-VJ5ZU4UF.js} +22 -4
- package/dist/bundle/{chunk-52DCABMU.js → chunk-VNU5L37V.js} +26 -26
- package/dist/bundle/{chunk-LDRQ5NAP.js → chunk-VSLDWT4E.js} +3 -3
- package/dist/bundle/{chunk-LQX74VKG.js → chunk-W7ZEEC4K.js} +1 -1
- package/dist/bundle/{chunk-NRRI37NJ.js → chunk-WOIHSQAL.js} +44 -0
- package/dist/bundle/{chunk-V4MM6GST.js → chunk-X4ZF4XXI.js} +1 -1
- package/dist/bundle/{chunk-FBLUKCIR.js → chunk-XRFHQGOD.js} +1 -1
- package/dist/bundle/{chunk-5GOE6PQK.js → chunk-XWQNJKTP.js} +5 -5
- package/dist/bundle/{chunk-6AMMTXEA.js → chunk-Y6C3N7YG.js} +26 -65
- package/dist/bundle/{chunk-KX5MZVPX.js → chunk-YJSPBUGB.js} +50 -32
- package/dist/bundle/{chunk-MJMVIFSC.js → chunk-YTN2JN6N.js} +7 -7
- package/dist/bundle/{chunk-OSBHEM2A.js → chunk-YUHM2OJM.js} +10 -10
- package/dist/bundle/{chunk-7AUP2WT3.js → chunk-ZBKWRYRS.js} +2 -2
- package/dist/bundle/{chunk-DHD25JII.js → chunk-ZS55EERO.js} +1 -1
- package/dist/bundle/{chunk-L62EJDNZ.js → chunk-ZSKE7N2U.js} +3 -3
- package/dist/bundle/{chunk-5ZF6QVMC.js → chunk-ZV3INEKM.js} +4 -4
- package/dist/bundle/{cli-P3BZUE6S.js → cli-VRSQ7HAE.js} +60 -58
- package/dist/bundle/command-contract-RPRKHVU6.js +41 -0
- package/dist/bundle/config-QU6A6VIO.js +90 -0
- package/dist/bundle/{decode-QWOQXM7M.js → decode-523PUQMR.js} +4 -4
- package/dist/bundle/{dispatch-5MGDLOK4.js → dispatch-IZCAK47P.js} +1 -1
- package/dist/bundle/{dist-OUE4MF37.js → dist-6WWKPEVW.js} +41 -25
- package/dist/bundle/{echarts-65IMPY43.js → echarts-S5UMX2D3.js} +2 -2
- package/dist/bundle/{embed-4IULBCKL.js → embed-ODPDVHUK.js} +5 -5
- package/dist/bundle/{embedder-JW4W6IZI.js → embedder-PAXRBSZE.js} +8 -8
- package/dist/bundle/{failure-CR64C4XA.js → failure-R2OIHCE5.js} +1 -1
- package/dist/bundle/{first-run-CH6C674R.js → first-run-NVTDR5VO.js} +8 -8
- package/dist/bundle/first-screen-5RWZDWLK.js +39 -0
- package/dist/bundle/{folders-VU4IN35Y.js → folders-ZXTOFY4T.js} +3 -3
- package/dist/bundle/{instructions-G5QIH2TM.js → instructions-DUB7E6C5.js} +1 -1
- package/dist/bundle/{main-O4ZJIEWP.js → main-A7JSYQI6.js} +18 -18
- package/dist/bundle/{meetings-77CCAVYD.js → meetings-BDZQV3HR.js} +4 -4
- package/dist/bundle/{node-E6VQHU4Y.js → node-E25KP53H.js} +2 -2
- package/dist/bundle/{node-sqlite-RJZ4PGLD.js → node-sqlite-PHWDFZCP.js} +5 -5
- package/dist/bundle/{oauth-F4JKNRW4.js → oauth-G2K46IYP.js} +6 -6
- package/dist/bundle/{open-NYOGMIAA.js → open-INWS5HIZ.js} +4 -4
- package/dist/bundle/{openai-5U6EQTFQ.js → openai-T44ORVGQ.js} +10 -10
- package/dist/bundle/{output-file-6COFGPUL.js → output-file-YGQYZCBJ.js} +4 -4
- package/dist/bundle/{process-OBWUKBMX.js → process-UJ2JHMJN.js} +1 -1
- package/dist/bundle/{program-MU7DEJTO.js → program-LYTGFV6L.js} +115 -72
- package/dist/bundle/{prompt-2QWQTHWT.js → prompt-VTUCRCE4.js} +6 -4
- package/dist/bundle/{recognize-SNUNTUC3.js → recognize-3CEPOW2F.js} +3 -3
- package/dist/bundle/{remote-2CTCIQGF.js → remote-DRQEXEZL.js} +6 -6
- package/dist/bundle/{rerank-XDA7NJNH.js → rerank-UL4KNNVN.js} +6 -6
- package/dist/bundle/{run-log-NSG3DJVX.js → run-log-UZAB5CWF.js} +54 -54
- package/dist/bundle/{serve-TWQFHOV2.js → serve-P5UWUOWQ.js} +8 -8
- package/dist/bundle/server-F3NPVMS2.js +72 -0
- package/dist/bundle/{server-RIQ6HMH2.js → server-M6XK2Y3X.js} +42 -42
- package/dist/bundle/{services-NKZQJQIV.js → services-4HRYNY62.js} +60 -30
- package/dist/bundle/{speech-ZOB76SXA.js → speech-BBPBMFAO.js} +12 -12
- package/dist/bundle/{state-7YYEIXQ5.js → state-GDSUNUSY.js} +5 -5
- package/dist/bundle/{store-E6RTSSNR.js → store-LBQ6FZP2.js} +33 -16
- package/dist/bundle/{store-OX4HRBLO.js → store-VWLABMLF.js} +27 -18
- package/dist/bundle/store-connection-XEBFP56U.js +83 -0
- package/dist/bundle/store-maintenance-command-G43JN57J.js +61 -0
- package/dist/bundle/{streaming-O53PIORL.js → streaming-EJ3NM2C2.js} +5 -5
- package/dist/bundle/{tokens-QKNEP2GJ.js → tokens-BE6CJMR5.js} +5 -5
- package/dist/bundle/zm.js +3 -3
- package/dist/bundle/{zoom-app-TSI2MGVK.js → zoom-app-YIEJLWCW.js} +6 -6
- package/dist/first-screen.d.ts.map +1 -1
- package/dist/first-screen.js +1 -0
- package/dist/first-screen.js.map +1 -1
- package/dist/permissions.js +1 -1
- package/dist/permissions.js.map +1 -1
- package/dist/setup-commands.d.ts.map +1 -1
- package/dist/setup-commands.js +11 -0
- package/dist/setup-commands.js.map +1 -1
- package/dist/tokens.d.ts +2 -0
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +11 -0
- package/dist/tokens.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/dist/bundle/answer-policy-VBDYLUXI.js +0 -104
- package/dist/bundle/chunk-2SYWVIQJ.js +0 -33
- package/dist/bundle/command-contract-TOLB32NJ.js +0 -41
- package/dist/bundle/config-4KLLIADY.js +0 -90
- package/dist/bundle/first-screen-OCAW5ZN6.js +0 -39
- package/dist/bundle/server-XO6XQQTJ.js +0 -72
- package/dist/bundle/store-connection-55QPNUDS.js +0 -83
- package/dist/bundle/store-maintenance-command-Q5MSU6OK.js +0 -62
|
@@ -12,14 +12,11 @@ import {
|
|
|
12
12
|
fold,
|
|
13
13
|
normalize,
|
|
14
14
|
parseStemmers
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-3KC7C465.js";
|
|
16
16
|
import {
|
|
17
17
|
ADDED_ACCOUNT,
|
|
18
18
|
ADDED_PROVIDER,
|
|
19
19
|
AMOUNT_ROLES,
|
|
20
|
-
CATALOG_KINDS,
|
|
21
|
-
CONTRACT_KINDS,
|
|
22
|
-
CONTRACT_STATUSES,
|
|
23
20
|
COUNTER_FIELDS,
|
|
24
21
|
DECIDED_TABLES,
|
|
25
22
|
DEFAULT_PHONE_COUNTRIES,
|
|
@@ -29,17 +26,12 @@ import {
|
|
|
29
26
|
INTERNAL_NOTES,
|
|
30
27
|
MENTION_KINDS,
|
|
31
28
|
MENTION_VERSIONS,
|
|
32
|
-
ORDER_DIRECTIONS,
|
|
33
29
|
RECORD_TABLES,
|
|
34
30
|
RECORD_TYPES,
|
|
35
|
-
SUBSCRIPTION_STATUSES,
|
|
36
|
-
TRANSACTION_STATUSES,
|
|
37
31
|
UNKNOWN_PROVIDER,
|
|
38
|
-
WALLET_KINDS,
|
|
39
32
|
addProvider,
|
|
40
33
|
article,
|
|
41
34
|
canonicalReference,
|
|
42
|
-
contractLine,
|
|
43
35
|
counterFreshness,
|
|
44
36
|
counterObservationTime,
|
|
45
37
|
fieldReferences,
|
|
@@ -53,7 +45,6 @@ import {
|
|
|
53
45
|
hasV1Roles,
|
|
54
46
|
holdsKindOf,
|
|
55
47
|
importedOf,
|
|
56
|
-
intervalOf,
|
|
57
48
|
isBusinessType,
|
|
58
49
|
isDocumentAccountProvider,
|
|
59
50
|
isFolderProvider,
|
|
@@ -78,7 +69,6 @@ import {
|
|
|
78
69
|
parsePhoneCountries,
|
|
79
70
|
parseReference,
|
|
80
71
|
pointerOf,
|
|
81
|
-
productLine,
|
|
82
72
|
providerEntryOf,
|
|
83
73
|
providerLabel,
|
|
84
74
|
providerNamed,
|
|
@@ -89,16 +79,13 @@ import {
|
|
|
89
79
|
recordFingerprint,
|
|
90
80
|
roleOf,
|
|
91
81
|
siteOf,
|
|
92
|
-
subscriptionLine,
|
|
93
82
|
telegramTarget,
|
|
94
83
|
trackedOrigin,
|
|
95
|
-
transactionLine,
|
|
96
84
|
typedPhone,
|
|
97
85
|
unitedKinds,
|
|
98
86
|
useStoredProviders,
|
|
99
|
-
validCounter
|
|
100
|
-
|
|
101
|
-
} from "./chunk-6AMMTXEA.js";
|
|
87
|
+
validCounter
|
|
88
|
+
} from "./chunk-Y6C3N7YG.js";
|
|
102
89
|
import {
|
|
103
90
|
COUNTERPART_ROLE,
|
|
104
91
|
FACT_STATUSES,
|
|
@@ -124,17 +111,21 @@ import {
|
|
|
124
111
|
project,
|
|
125
112
|
refuseDamagedStore,
|
|
126
113
|
reminder
|
|
127
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-VE2VNECR.js";
|
|
128
115
|
import {
|
|
129
116
|
sqliteCode
|
|
130
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-RWIILYKW.js";
|
|
131
118
|
import {
|
|
132
119
|
DEFAULT_TASK_CATEGORIES,
|
|
133
120
|
sharedConfigPath,
|
|
134
121
|
storedTaskCategories,
|
|
135
122
|
taskCategoriesReader
|
|
136
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-UVPL7YAY.js";
|
|
137
124
|
import {
|
|
125
|
+
BUSINESS_KINDS,
|
|
126
|
+
CATALOG_KINDS,
|
|
127
|
+
CONTRACT_KINDS,
|
|
128
|
+
CONTRACT_STATUSES,
|
|
138
129
|
DEAL_KINDS,
|
|
139
130
|
DEAL_ROLES,
|
|
140
131
|
DEAL_STATUSES,
|
|
@@ -142,17 +133,23 @@ import {
|
|
|
142
133
|
INVOICE_DIRECTIONS,
|
|
143
134
|
INVOICE_STATUSES,
|
|
144
135
|
MONEY_DIRECTIONS,
|
|
136
|
+
ORDER_DIRECTIONS,
|
|
145
137
|
ORDER_PURPOSES,
|
|
146
138
|
ORDER_STATUSES,
|
|
147
139
|
RELATION_KINDS,
|
|
148
140
|
ROLE_LISTS,
|
|
149
141
|
STAGE_OUTCOMES,
|
|
150
142
|
STANDINGS,
|
|
143
|
+
SUBSCRIPTION_STATUSES,
|
|
144
|
+
TRANSACTION_STATUSES,
|
|
145
|
+
WALLET_KINDS,
|
|
151
146
|
checkEnds,
|
|
152
147
|
checkRole,
|
|
148
|
+
contractLine,
|
|
153
149
|
currencyOf,
|
|
154
150
|
dealLine,
|
|
155
151
|
formatDecimal,
|
|
152
|
+
intervalOf,
|
|
156
153
|
inverseOf,
|
|
157
154
|
invoiceLine,
|
|
158
155
|
invoiceTitle,
|
|
@@ -169,6 +166,7 @@ import {
|
|
|
169
166
|
parseDecimal,
|
|
170
167
|
paymentEntryTitle,
|
|
171
168
|
paymentLine,
|
|
169
|
+
productLine,
|
|
172
170
|
quantityOf,
|
|
173
171
|
roleListOf,
|
|
174
172
|
rolesOf,
|
|
@@ -176,23 +174,26 @@ import {
|
|
|
176
174
|
settledStatus,
|
|
177
175
|
signedMinorUnits,
|
|
178
176
|
standingOf,
|
|
177
|
+
subscriptionLine,
|
|
179
178
|
tagOf,
|
|
180
|
-
|
|
181
|
-
|
|
179
|
+
transactionLine,
|
|
180
|
+
usableLinkSql,
|
|
181
|
+
walletLine
|
|
182
|
+
} from "./chunk-AT2XKNFN.js";
|
|
182
183
|
import {
|
|
183
184
|
refuseOwnerStoreInTests,
|
|
184
185
|
storePath
|
|
185
|
-
} from "./chunk-
|
|
186
|
+
} from "./chunk-GVT5363M.js";
|
|
186
187
|
import {
|
|
187
188
|
quietSqliteWarning,
|
|
188
189
|
storeCapable
|
|
189
|
-
} from "./chunk-
|
|
190
|
+
} from "./chunk-M7E44TMT.js";
|
|
190
191
|
import {
|
|
191
192
|
PRAGMAS,
|
|
192
193
|
TIME_LIMIT_FUNCTION,
|
|
193
194
|
TimeLimitReached,
|
|
194
195
|
isQueryOnly
|
|
195
|
-
} from "./chunk-
|
|
196
|
+
} from "./chunk-DXCTW3MV.js";
|
|
196
197
|
import {
|
|
197
198
|
CHAT_MESSAGES_READ,
|
|
198
199
|
FACT_TYPES,
|
|
@@ -234,7 +235,7 @@ import {
|
|
|
234
235
|
validateMeetingRelatedHistory,
|
|
235
236
|
validateMeetingSeriesHistory,
|
|
236
237
|
validatePayment
|
|
237
|
-
} from "./chunk-
|
|
238
|
+
} from "./chunk-RIPAUCKJ.js";
|
|
238
239
|
import {
|
|
239
240
|
OPERATORS_BY_TYPE,
|
|
240
241
|
QUERY_LIMITS,
|
|
@@ -250,7 +251,7 @@ import {
|
|
|
250
251
|
validateQuery,
|
|
251
252
|
walkQuery,
|
|
252
253
|
zonedMoment
|
|
253
|
-
} from "./chunk-
|
|
254
|
+
} from "./chunk-EOSVN2ER.js";
|
|
254
255
|
import {
|
|
255
256
|
array,
|
|
256
257
|
boolean,
|
|
@@ -268,7 +269,7 @@ import {
|
|
|
268
269
|
safeParse,
|
|
269
270
|
strictObject,
|
|
270
271
|
string
|
|
271
|
-
} from "./chunk-
|
|
272
|
+
} from "./chunk-WOIHSQAL.js";
|
|
272
273
|
import {
|
|
273
274
|
resolveFrom
|
|
274
275
|
} from "./chunk-Y5E2WNWB.js";
|
|
@@ -303,7 +304,7 @@ import {
|
|
|
303
304
|
sql,
|
|
304
305
|
sqliteTable,
|
|
305
306
|
text
|
|
306
|
-
} from "./chunk-
|
|
307
|
+
} from "./chunk-W7ZEEC4K.js";
|
|
307
308
|
import {
|
|
308
309
|
__commonJS,
|
|
309
310
|
__name,
|
|
@@ -10047,7 +10048,7 @@ var require_cjs = __commonJS({
|
|
|
10047
10048
|
}
|
|
10048
10049
|
});
|
|
10049
10050
|
|
|
10050
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10051
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/account-store.js
|
|
10051
10052
|
var bindArea = /* @__PURE__ */ __name(({ keyed, whole }, account) => {
|
|
10052
10053
|
const methods = whole;
|
|
10053
10054
|
return Object.fromEntries(Object.keys(keyed).map((name) => [
|
|
@@ -10175,7 +10176,7 @@ var bindAccount = /* @__PURE__ */ __name((store, account, areas, owners) => {
|
|
|
10175
10176
|
};
|
|
10176
10177
|
}, "bindAccount");
|
|
10177
10178
|
|
|
10178
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10179
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/search/query.js
|
|
10179
10180
|
var isBotProvider = /* @__PURE__ */ __name((provider) => provider.endsWith("-bot"), "isBotProvider");
|
|
10180
10181
|
var inSource = /* @__PURE__ */ __name((source2, provider) => source2 === "all" || source2 === "bots" && isBotProvider(provider) || source2 === "personal" && !isBotProvider(provider) || source2 === provider || providerNamed(source2)?.name === provider || isKind(source2) && holdsKindOf(provider, source2), "inSource");
|
|
10181
10182
|
var fail = /* @__PURE__ */ __name((message3) => {
|
|
@@ -10198,7 +10199,7 @@ var sourceOf = /* @__PURE__ */ __name((name, value, providers2) => {
|
|
|
10198
10199
|
return fail(`${name} takes ${[...sources, "messages", "mail"].join(", ")} \u2014 not "${value}"`);
|
|
10199
10200
|
}, "sourceOf");
|
|
10200
10201
|
|
|
10201
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10202
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/search/account-list.js
|
|
10202
10203
|
var ACCOUNT_GROUPS = "accountGroups";
|
|
10203
10204
|
var ACCOUNT_GROUPS_SETTING = "account_groups";
|
|
10204
10205
|
var GROUP_NAME = /^[a-z0-9][a-z0-9_-]*$/i;
|
|
@@ -10373,16 +10374,16 @@ var READS = {
|
|
|
10373
10374
|
events: "calendar events \u2014 no search reads them yet",
|
|
10374
10375
|
crm: "CRM deals and leads \u2014 search all reads them"
|
|
10375
10376
|
};
|
|
10376
|
-
var fitting = /* @__PURE__ */ __name((entries, kinds2, what, reasonOf2 = (kind3) => READS[kind3]) => {
|
|
10377
|
+
var fitting = /* @__PURE__ */ __name((entries, kinds2, what, reasonOf2 = (kind3) => READS[kind3], alsoFits = () => false) => {
|
|
10377
10378
|
const chosen = /* @__PURE__ */ new Map();
|
|
10378
10379
|
const skipped = [];
|
|
10379
10380
|
for (const { entry: entry2, accounts: accounts2 } of entries) {
|
|
10380
|
-
const fits = accounts2.filter((one2) => kinds2.some((kind3) => listedHolds(one2, kind3)));
|
|
10381
|
+
const fits = accounts2.filter((one2) => kinds2.some((kind3) => listedHolds(one2, kind3)) || alsoFits(one2));
|
|
10381
10382
|
for (const { provider, account } of fits)
|
|
10382
10383
|
if (!chosen.has(keyOf({ provider, account })))
|
|
10383
10384
|
chosen.set(keyOf({ provider, account }), { provider, account });
|
|
10384
10385
|
const known2 = accounts2.filter(({ kind: kind3 }) => kind3 !== void 0);
|
|
10385
|
-
const unknown2 = accounts2.filter((
|
|
10386
|
+
const unknown2 = accounts2.filter((one2) => one2.kind === void 0 && !alsoFits(one2));
|
|
10386
10387
|
if (known2.length)
|
|
10387
10388
|
for (const { provider, account } of unknown2)
|
|
10388
10389
|
skipped.push({ source: `${provider}:${account}`, code: "not_found", reason: UNKNOWN_PROVIDER });
|
|
@@ -10396,7 +10397,7 @@ var fitting = /* @__PURE__ */ __name((entries, kinds2, what, reasonOf2 = (kind3)
|
|
|
10396
10397
|
return { accounts: [...chosen.values()], skipped };
|
|
10397
10398
|
}, "fitting");
|
|
10398
10399
|
|
|
10399
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10400
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/core.js
|
|
10400
10401
|
var IndexBuilderOn = class {
|
|
10401
10402
|
static {
|
|
10402
10403
|
__name(this, "IndexBuilderOn");
|
|
@@ -10591,7 +10592,7 @@ function alias(table, alias2) {
|
|
|
10591
10592
|
}
|
|
10592
10593
|
__name(alias, "alias");
|
|
10593
10594
|
|
|
10594
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10595
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/entity-types.js
|
|
10595
10596
|
var ENTITY_TABLES = {
|
|
10596
10597
|
...RECORD_TABLES,
|
|
10597
10598
|
account: "accounts",
|
|
@@ -10603,6 +10604,7 @@ var ENTITY_TABLES = {
|
|
|
10603
10604
|
document: "documents",
|
|
10604
10605
|
document_picture: "documents",
|
|
10605
10606
|
email: "emails",
|
|
10607
|
+
email_enrichment: "emails",
|
|
10606
10608
|
email_thread: "email_threads",
|
|
10607
10609
|
event: "events",
|
|
10608
10610
|
event_series: "event_series",
|
|
@@ -10629,14 +10631,14 @@ var orphanPointers = /* @__PURE__ */ __name((database) => pointerPairs(database)
|
|
|
10629
10631
|
return { table, pointer, type, count, known: known2 };
|
|
10630
10632
|
}).filter(({ count }) => count > 0)), "orphanPointers");
|
|
10631
10633
|
|
|
10632
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10634
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/source-review.js
|
|
10633
10635
|
var SOURCE_REVIEW_KIND = "memory_source_review";
|
|
10634
10636
|
var SOURCE_REVIEW_CAUSES = ["changed", "outdated", "deleted", "contradicted"];
|
|
10635
10637
|
var ERASED_TEXT = "[source erased]";
|
|
10636
10638
|
var severity = /* @__PURE__ */ __name((cause) => SOURCE_REVIEW_CAUSES.indexOf(cause), "severity");
|
|
10637
10639
|
var graver = /* @__PURE__ */ __name((a, b) => severity(b) > severity(a) ? b : a, "graver");
|
|
10638
10640
|
|
|
10639
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10641
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/actors.js
|
|
10640
10642
|
var BOT_KINDS = ["agent", "rule", "script", "integration"];
|
|
10641
10643
|
var ownerPerson = /* @__PURE__ */ __name((database) => {
|
|
10642
10644
|
const found2 = database.prepare("SELECT id FROM persons WHERE owner = 1 ORDER BY id LIMIT 1").get();
|
|
@@ -10693,7 +10695,7 @@ var proposedBySql = /* @__PURE__ */ __name((type, id2, by) => {
|
|
|
10693
10695
|
return { sql: bot("pb.name = ?"), params: [by.bot] };
|
|
10694
10696
|
}, "proposedBySql");
|
|
10695
10697
|
|
|
10696
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10698
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/source-review-marks.js
|
|
10697
10699
|
var TABLES = { memory: "memories", fact: "facts" };
|
|
10698
10700
|
var HOLDING = { memory: ["proposed", "confirmed"], fact: ["proposed", "accepted"] };
|
|
10699
10701
|
var KEPT = 20;
|
|
@@ -10788,7 +10790,7 @@ var scrubSourceReviews = /* @__PURE__ */ __name((database, erased, { refs }) =>
|
|
|
10788
10790
|
return scrubbed;
|
|
10789
10791
|
}, "scrubSourceReviews");
|
|
10790
10792
|
|
|
10791
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10793
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/things.js
|
|
10792
10794
|
var storedThing = /* @__PURE__ */ __name((type, id2) => ({ type: String(type), id: Number(id2) }), "storedThing");
|
|
10793
10795
|
var REFERABLE = {
|
|
10794
10796
|
...Object.fromEntries(Object.entries(RECORD_TYPES).map(([type, { tombstone: tombstone2 }]) => [type, { tombstone: tombstone2 }])),
|
|
@@ -10948,7 +10950,7 @@ var taskIdOf = /* @__PURE__ */ __name((database, rowId) => {
|
|
|
10948
10950
|
return row2 ? String(row2.id ?? row2.key) : void 0;
|
|
10949
10951
|
}, "taskIdOf");
|
|
10950
10952
|
|
|
10951
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
10953
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-signature.js
|
|
10952
10954
|
var QUOTE_LIMIT = 500;
|
|
10953
10955
|
var GONE = { sig: "gone", rev: null, deleted: true, changedAt: null };
|
|
10954
10956
|
var part = /* @__PURE__ */ __name((value) => value == null ? "" : String(value), "part");
|
|
@@ -11226,7 +11228,7 @@ var deleteDocumentRow = /* @__PURE__ */ __name((database, id2, at) => {
|
|
|
11226
11228
|
database.prepare("DELETE FROM documents WHERE id = ?").run(id2);
|
|
11227
11229
|
}, "deleteDocumentRow");
|
|
11228
11230
|
|
|
11229
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
11231
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/canonical-tags.js
|
|
11230
11232
|
var canonicalTags = sqliteTable("canonical_tags", {
|
|
11231
11233
|
id: integer("id").primaryKey(),
|
|
11232
11234
|
name: text("name").notNull().unique(),
|
|
@@ -11235,7 +11237,7 @@ var canonicalTags = sqliteTable("canonical_tags", {
|
|
|
11235
11237
|
updatedAt: integer("updated_at").notNull()
|
|
11236
11238
|
});
|
|
11237
11239
|
|
|
11238
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
11240
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/link-revisions.js
|
|
11239
11241
|
var linkRevisions = sqliteTable("link_revisions", {
|
|
11240
11242
|
id: integer("id").primaryKey(),
|
|
11241
11243
|
linkId: integer("link_id").notNull(),
|
|
@@ -11247,7 +11249,7 @@ var linkRevisions = sqliteTable("link_revisions", {
|
|
|
11247
11249
|
createdAt: integer("created_at").notNull()
|
|
11248
11250
|
}, (table) => [index("link_revisions_by_link_id_created_at").on(table.linkId, table.createdAt)]);
|
|
11249
11251
|
|
|
11250
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
11252
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-transfers.js
|
|
11251
11253
|
var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
|
|
11252
11254
|
sourceKey: text("source_key").notNull(),
|
|
11253
11255
|
collection: text("collection").notNull(),
|
|
@@ -11257,13 +11259,13 @@ var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
|
|
|
11257
11259
|
createdAt: integer("created_at").notNull()
|
|
11258
11260
|
}, (table) => [primaryKey({ columns: [table.sourceKey, table.collection] })]);
|
|
11259
11261
|
|
|
11260
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
11262
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-index-pending.js
|
|
11261
11263
|
var documentIndexPending = sqliteTable("document_index_pending", {
|
|
11262
11264
|
id: integer("id").notNull(),
|
|
11263
11265
|
indexableType: text("indexable_type").notNull()
|
|
11264
11266
|
}, (table) => [primaryKey({ columns: [table.indexableType, table.id] })]);
|
|
11265
11267
|
|
|
11266
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
11268
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/decision-requests.js
|
|
11267
11269
|
var decisionRequests = sqliteTable("decision_requests", {
|
|
11268
11270
|
id: integer("id").primaryKey(),
|
|
11269
11271
|
tokenDigest: text("token_digest").notNull().unique(),
|
|
@@ -11283,7 +11285,19 @@ var decisionRequests = sqliteTable("decision_requests", {
|
|
|
11283
11285
|
index("decision_requests_by_channel_bot_profile_chat_id_message_id").on(table.channel, table.botProfile, table.chatId, table.messageId)
|
|
11284
11286
|
]);
|
|
11285
11287
|
|
|
11286
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
11288
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/enrichments.js
|
|
11289
|
+
var enrichments = sqliteTable("enrichments", {
|
|
11290
|
+
subjectType: text("subject_type").notNull(),
|
|
11291
|
+
subjectId: integer("subject_id").notNull(),
|
|
11292
|
+
sourceHash: text("source_hash").notNull(),
|
|
11293
|
+
provider: text("provider").notNull(),
|
|
11294
|
+
model: text("model").notNull(),
|
|
11295
|
+
text: text("text").notNull(),
|
|
11296
|
+
tokens: integer("tokens").notNull(),
|
|
11297
|
+
createdAt: integer("created_at").notNull()
|
|
11298
|
+
}, (table) => [primaryKey({ columns: [table.subjectType, table.subjectId] })]);
|
|
11299
|
+
|
|
11300
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/links.js
|
|
11287
11301
|
var links = sqliteTable("links", {
|
|
11288
11302
|
id: integer("id").primaryKey(),
|
|
11289
11303
|
fromType: text("from_type").notNull(),
|
|
@@ -11314,7 +11328,7 @@ var links = sqliteTable("links", {
|
|
|
11314
11328
|
index("links_by_to_type_to_id").on(table.toType, table.toId)
|
|
11315
11329
|
]);
|
|
11316
11330
|
|
|
11317
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
11331
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/tag-consolidations.js
|
|
11318
11332
|
var tagRedirects = sqliteTable("tag_redirects", {
|
|
11319
11333
|
sourceId: integer("source_id").primaryKey().references(() => canonicalTags.id),
|
|
11320
11334
|
survivorId: integer("survivor_id").notNull().references(() => canonicalTags.id),
|
|
@@ -11340,7 +11354,7 @@ var tagConsolidations = sqliteTable("tag_consolidations", {
|
|
|
11340
11354
|
index("tag_consolidations_by_actor_type_actor_id").on(table.actorType, table.actorId)
|
|
11341
11355
|
]);
|
|
11342
11356
|
|
|
11343
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
11357
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/schema.js
|
|
11344
11358
|
var accounts = sqliteTable("accounts", {
|
|
11345
11359
|
id: integer("id").primaryKey(),
|
|
11346
11360
|
provider: text("provider").notNull(),
|
|
@@ -13336,10 +13350,10 @@ var storeSettings = sqliteTable("store_settings", {
|
|
|
13336
13350
|
at: integer("at").notNull()
|
|
13337
13351
|
});
|
|
13338
13352
|
|
|
13339
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13353
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
|
|
13340
13354
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
13341
13355
|
|
|
13342
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13356
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/involvement-queue.js
|
|
13343
13357
|
var ARMS = [
|
|
13344
13358
|
[
|
|
13345
13359
|
"message",
|
|
@@ -13432,16 +13446,15 @@ var linkArm = /* @__PURE__ */ __name((linkFrom, linkTo) => `
|
|
|
13432
13446
|
WHERE l.to_type IN ('person','identity') AND l.to_id IS NOT NULL AND ${usableLinkSql("l")} AND (l.from_type<>'message' OR m.deleted_at IS NULL) AND (l.from_type<>'email' OR e.deleted_at IS NULL) AND (l.from_type<>'meeting' OR mt.deleted_at IS NULL) AND (l.from_type<>'task' OR t.deleted_at IS NULL) AND (l.from_type<>'document' OR d.deleted_at IS NULL)
|
|
13433
13447
|
`, "linkArm");
|
|
13434
13448
|
var COLUMNS = "SELECT NULL AS person_id, NULL AS identity_id, NULL AS subject_type, NULL AS subject_id, NULL AS role, NULL AS occurred_at, NULL AS scope, NULL AS account_id, NULL AS project_id WHERE 0";
|
|
13435
|
-
var sourcesOf = /* @__PURE__ */ __name((
|
|
13436
|
-
if (
|
|
13449
|
+
var sourcesOf = /* @__PURE__ */ __name((type) => {
|
|
13450
|
+
if (type === void 0)
|
|
13437
13451
|
return [COLUMNS, ...ARMS.map(([, , sql2]) => sql2), linkArm("1", "1")].join(" UNION ");
|
|
13438
|
-
if (!/^[a-z_]+$/.test(
|
|
13439
|
-
throw new CliError("configuration_error", `the involvement queue holds ${
|
|
13440
|
-
const { type, id: id2 } = subject2;
|
|
13452
|
+
if (!/^[a-z_]+$/.test(type))
|
|
13453
|
+
throw new CliError("configuration_error", `the involvement queue holds a ${type}`);
|
|
13441
13454
|
return [
|
|
13442
13455
|
COLUMNS,
|
|
13443
|
-
...ARMS.filter(([of]) => of === type).map(([, key2, sql2]) => `${sql2} AND ${key2}
|
|
13444
|
-
linkArm(`from_type='${type}' AND from_id
|
|
13456
|
+
...ARMS.filter(([of]) => of === type).map(([, key2, sql2]) => `${sql2} AND ${key2}=?`),
|
|
13457
|
+
linkArm(`from_type='${type}' AND from_id=?`, `to_type='${type}' AND to_id=?`)
|
|
13445
13458
|
].join(" UNION ");
|
|
13446
13459
|
}, "sourcesOf");
|
|
13447
13460
|
var INSERT = "INSERT INTO involvements (person_id, identity_id, subject_type, subject_id, role, occurred_at, scope, account_id, project_id, created_at)";
|
|
@@ -13458,7 +13471,9 @@ var drainInvolvementQueue = /* @__PURE__ */ __name((database, cap = QUEUE_CAP) =
|
|
|
13458
13471
|
break;
|
|
13459
13472
|
for (const subject2 of subjects) {
|
|
13460
13473
|
drop.run(subject2.type, subject2.id);
|
|
13461
|
-
|
|
13474
|
+
const sql2 = `${INSERT} SELECT s.*, ? FROM (${sourcesOf(subject2.type)}) s JOIN persons p ON p.id=s.person_id`;
|
|
13475
|
+
const ids = Array(sql2.split("?").length - 2).fill(subject2.id);
|
|
13476
|
+
database.prepare(sql2).run(at, ...ids);
|
|
13462
13477
|
done.run(subject2.type, subject2.id);
|
|
13463
13478
|
}
|
|
13464
13479
|
recomputed += subjects.length;
|
|
@@ -13466,7 +13481,7 @@ var drainInvolvementQueue = /* @__PURE__ */ __name((database, cap = QUEUE_CAP) =
|
|
|
13466
13481
|
return recomputed;
|
|
13467
13482
|
}, "drainInvolvementQueue");
|
|
13468
13483
|
|
|
13469
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13484
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/domain/first-names.js
|
|
13470
13485
|
var RUSSIAN = "\u0410\u043B\u0435\u043A\u0441\u0430\u043D\u0434\u0440 \u0410\u043B\u0435\u043A\u0441\u0435\u0439 \u0410\u043D\u0430\u0442\u043E\u043B\u0438\u0439 \u0410\u043D\u0434\u0440\u0435\u0439 \u0410\u043D\u0442\u043E\u043D \u0410\u0440\u043A\u0430\u0434\u0438\u0439 \u0410\u0440\u0441\u0435\u043D\u0438\u0439 \u0410\u0440\u0442\u0451\u043C \u0410\u0440\u0442\u0435\u043C \u0410\u0440\u0442\u0443\u0440 \u0411\u043E\u0440\u0438\u0441 \u0412\u0430\u0434\u0438\u043C \u0412\u0430\u043B\u0435\u043D\u0442\u0438\u043D \u0412\u0430\u043B\u0435\u0440\u0438\u0439 \u0412\u0430\u0441\u0438\u043B\u0438\u0439 \u0412\u0438\u043A\u0442\u043E\u0440 \u0412\u0438\u0442\u0430\u043B\u0438\u0439 \u0412\u043B\u0430\u0434\u0438\u043C\u0438\u0440 \u0412\u043B\u0430\u0434\u0438\u0441\u043B\u0430\u0432 \u0412\u0441\u0435\u0432\u043E\u043B\u043E\u0434 \u0412\u044F\u0447\u0435\u0441\u043B\u0430\u0432 \u0413\u0435\u043D\u043D\u0430\u0434\u0438\u0439 \u0413\u0435\u043E\u0440\u0433\u0438\u0439 \u0413\u043B\u0435\u0431 \u0413\u0440\u0438\u0433\u043E\u0440\u0438\u0439 \u0414\u0430\u043D\u0438\u0438\u043B \u0414\u0430\u043D\u0438\u043B\u0430 \u0414\u0435\u043D\u0438\u0441 \u0414\u043C\u0438\u0442\u0440\u0438\u0439 \u0415\u0432\u0433\u0435\u043D\u0438\u0439 \u0415\u0433\u043E\u0440 \u0418\u0432\u0430\u043D \u0418\u0433\u043E\u0440\u044C \u0418\u043B\u044C\u044F \u041A\u0438\u0440\u0438\u043B\u043B \u041A\u043E\u043D\u0441\u0442\u0430\u043D\u0442\u0438\u043D \u041B\u0435\u043E\u043D\u0438\u0434 \u041C\u0430\u043A\u0441\u0438\u043C \u041C\u0430\u0440\u0430\u0442 \u041C\u0430\u0442\u0432\u0435\u0439 \u041C\u0438\u0445\u0430\u0438\u043B \u041D\u0438\u043A\u0438\u0442\u0430 \u041D\u0438\u043A\u043E\u043B\u0430\u0439 \u041E\u043B\u0435\u0433 \u041F\u0430\u0432\u0435\u043B \u041F\u0451\u0442\u0440 \u041F\u0435\u0442\u0440 \u0420\u043E\u0434\u0438\u043E\u043D \u0420\u043E\u0441\u0442\u0438\u0441\u043B\u0430\u0432 \u0420\u0443\u0441\u043B\u0430\u043D \u0420\u0443\u0441\u0442\u0430\u043C \u0421\u0435\u043C\u0451\u043D \u0421\u0435\u043C\u0435\u043D \u0421\u0435\u0440\u0433\u0435\u0439 \u0421\u0442\u0430\u043D\u0438\u0441\u043B\u0430\u0432 \u0421\u0442\u0435\u043F\u0430\u043D \u0422\u0438\u043C\u043E\u0444\u0435\u0439 \u0422\u0438\u043C\u0443\u0440 \u0424\u0451\u0434\u043E\u0440 \u0424\u0435\u0434\u043E\u0440 \u0424\u0438\u043B\u0438\u043F\u043F \u042D\u0434\u0443\u0430\u0440\u0434 \u042E\u0440\u0438\u0439 \u042F\u0440\u043E\u0441\u043B\u0430\u0432 \u042F\u043A\u043E\u0432 \u042D\u043B\u044C\u0434\u0430\u0440 \u0414\u0430\u0432\u0438\u0434 \u0417\u0430\u0445\u0430\u0440 \u0421\u0430\u0432\u0435\u043B\u0438\u0439 \u041C\u0438\u0440\u043E\u043D \u041F\u043B\u0430\u0442\u043E\u043D \u0414\u0435\u043C\u0438\u0434 \u0410\u0440\u0441\u0435\u043D \u041D\u0443\u0440\u043B\u0430\u043D \u0410\u043D\u0437\u043E\u0440 \u0410\u043B\u0435\u043A\u0441\u0430\u043D\u0434\u0440\u0430 \u0410\u043B\u0438\u043D\u0430 \u0410\u043B\u0438\u0441\u0430 \u0410\u043B\u043B\u0430 \u0410\u043D\u0430\u0441\u0442\u0430\u0441\u0438\u044F \u0410\u043D\u0433\u0435\u043B\u0438\u043D\u0430 \u0410\u043D\u043D\u0430 \u0410\u043D\u0442\u043E\u043D\u0438\u043D\u0430 \u0412\u0430\u043B\u0435\u043D\u0442\u0438\u043D\u0430 \u0412\u0430\u043B\u0435\u0440\u0438\u044F \u0412\u0430\u0440\u0432\u0430\u0440\u0430 \u0412\u0435\u0440\u043E\u043D\u0438\u043A\u0430 \u0412\u0438\u043A\u0442\u043E\u0440\u0438\u044F \u0413\u0430\u043B\u0438\u043D\u0430 \u0414\u0430\u0440\u044C\u044F \u0414\u0438\u0430\u043D\u0430 \u0415\u0432\u0433\u0435\u043D\u0438\u044F \u0415\u043A\u0430\u0442\u0435\u0440\u0438\u043D\u0430 \u0415\u043B\u0435\u043D\u0430 \u0415\u043B\u0438\u0437\u0430\u0432\u0435\u0442\u0430 \u0416\u0430\u043D\u043D\u0430 \u0417\u0438\u043D\u0430\u0438\u0434\u0430 \u041A\u0430\u0440\u0438\u043D\u0430 \u041A\u0438\u0440\u0430 \u041A\u043B\u0430\u0432\u0434\u0438\u044F \u041A\u0440\u0438\u0441\u0442\u0438\u043D\u0430 \u041A\u0441\u0435\u043D\u0438\u044F \u041B\u0430\u0440\u0438\u0441\u0430 \u041B\u0438\u0434\u0438\u044F \u041B\u044E\u0434\u043C\u0438\u043B\u0430 \u041C\u0430\u0440\u0433\u0430\u0440\u0438\u0442\u0430 \u041C\u0430\u0440\u0438\u043D\u0430 \u041C\u0430\u0440\u0438\u044F \u041C\u0438\u043B\u0430\u043D\u0430 \u041D\u0430\u0442\u0430\u043B\u044C\u044F \u041D\u0430\u0442\u0430\u043B\u0438\u044F \u041D\u0438\u043D\u0430 \u041E\u043A\u0441\u0430\u043D\u0430 \u041E\u043B\u0435\u0441\u044F \u041E\u043B\u044C\u0433\u0430 \u041F\u043E\u043B\u0438\u043D\u0430 \u0420\u0430\u0438\u0441\u0430 \u0421\u0432\u0435\u0442\u043B\u0430\u043D\u0430 \u0421\u043E\u0444\u0438\u044F \u0421\u043E\u0444\u044C\u044F \u0422\u0430\u0438\u0441\u0438\u044F \u0422\u0430\u043C\u0430\u0440\u0430 \u0422\u0430\u0442\u044C\u044F\u043D\u0430 \u0423\u043B\u044C\u044F\u043D\u0430 \u042E\u043B\u0438\u044F \u042D\u043B\u044C\u0432\u0438\u0440\u0430 \u0420\u0435\u0433\u0438\u043D\u0430 \u0421\u043D\u0435\u0436\u0430\u043D\u0430 \u0410\u043B\u0451\u043D\u0430 \u0410\u043B\u0435\u043D\u0430 \u0412\u0430\u0441\u0438\u043B\u0438\u0441\u0430 \u0410\u0440\u0438\u043D\u0430 \u0415\u0441\u0435\u043D\u0438\u044F \u042D\u0432\u0435\u043B\u0438\u043D\u0430 \u0421\u0430\u0448\u0430 \u0416\u0435\u043D\u044F \u0412\u0430\u043B\u044F \u0414\u0438\u043C\u0430 \u041C\u0438\u0448\u0430 \u041A\u043E\u043B\u044F \u041F\u0435\u0442\u044F \u0412\u0430\u0441\u044F \u0421\u0435\u0440\u0451\u0436\u0430 \u0421\u0435\u0440\u0435\u0436\u0430 \u041F\u0430\u0448\u0430 \u041B\u0451\u0448\u0430 \u041B\u0435\u0448\u0430 \u0412\u0438\u0442\u044F \u041A\u043E\u0441\u0442\u044F \u0412\u043E\u0432\u0430 \u0412\u043E\u043B\u043E\u0434\u044F \u0412\u0430\u043D\u044F \u0413\u043E\u0448\u0430 \u0413\u0440\u0438\u0448\u0430 \u0422\u043E\u043B\u044F \u0411\u043E\u0440\u044F \u0421\u0442\u0430\u0441 \u0422\u0451\u043C\u0430 \u0422\u0430\u043D\u044F \u041A\u0430\u0442\u044F \u041B\u0435\u043D\u0430 \u041D\u0430\u0442\u0430\u0448\u0430 \u0421\u0432\u0435\u0442\u0430 \u042E\u043B\u044F \u041D\u0430\u0441\u0442\u044F \u0414\u0430\u0448\u0430 \u041C\u0430\u0448\u0430 \u041B\u044E\u0434\u0430 \u0413\u0430\u043B\u044F \u0412\u0438\u043A\u0430 \u041A\u0441\u044E\u0448\u0430 \u041B\u0438\u0437\u0430 \u0421\u043E\u043D\u044F \u041D\u0430\u0434\u044F \u041B\u0435\u0440\u0430 \u0410\u043B\u0451\u0448\u0430 \u0410\u043B\u0435\u0448\u0430 \u041C\u0438\u0442\u044F \u0421\u0435\u043D\u044F \u0424\u0435\u0434\u044F \u0416\u0435\u043D\u0435\u0447\u043A\u0430 \u041E\u043B\u0435\u043D\u044C\u043A\u0430 \u0422\u0430\u043D\u0435\u0447\u043A\u0430";
|
|
13471
13486
|
var EUROPEAN = "James John Robert Michael William David Richard Joseph Thomas Charles Christopher Daniel Matthew Anthony Donald Steven Paul Andrew Joshua Kenneth Kevin Brian George Timothy Ronald Edward Jason Jeffrey Ryan Jacob Gary Nicholas Eric Jonathan Stephen Larry Justin Scott Brandon Benjamin Samuel Gregory Alexander Patrick Raymond Dennis Jerry Tyler Aaron Nathan Henry Peter Zachary Douglas Harold Kyle Noah Ethan Oliver Harry Lucas Liam Mary Patricia Jennifer Linda Elizabeth Barbara Susan Jessica Sarah Karen Lisa Nancy Betty Margaret Sandra Ashley Kimberly Emily Donna Michelle Carol Amanda Dorothy Melissa Deborah Stephanie Rebecca Sharon Laura Cynthia Kathleen Angela Shirley Anna Brenda Pamela Emma Nicole Helen Samantha Katherine Christine Rachel Carolyn Janet Catherine Maria Heather Diane Ruth Julie Olivia Joyce Kelly Lauren Christina Joan Evelyn Judith Megan Andrea Cheryl Hannah Jacqueline Martha Teresa Sara Madison Frances Kathryn Janice Abigail Alice Julia Judy Sophia Denise Doris Marilyn Danielle Beverly Isabella Theresa Diana Natalie Charlotte Marie Kayla Alexis Javier Carlos Antonio Manuel Francisco Juan Pedro Alejandro Miguel Rafael Pablo Sergio Fernando Jorge Luis Alberto \xC1lvaro Diego Adri\xE1n Rub\xE9n Iv\xE1n \xD3scar Andr\xE9s Ra\xFAl Enrique Vicente Joaqu\xEDn Ignacio Gonzalo Marcos V\xEDctor Jaime Alfonso Guillermo Tom\xE1s Emilio Gabriel Nicol\xE1s Mart\xEDn Jordi Josep Xavier Luc\xEDa Carmen Isabel Cristina Marta Elena Raquel Silvia Beatriz Paula Nuria N\xFAria Sonia Alicia Irene Montserrat Inmaculada Noelia Lorena Sof\xEDa Valeria Claudia Natalia Sandra Ver\xF3nica Esther Yolanda Vanesa Laia Klaus J\xFCrgen Wolfgang Stefan Andreas Matthias Markus Tobias Florian Lukas Jonas Maximilian Sebastian Dirk Sabine Ursula Petra Monika Katrin Anja Pierre Michel Philippe Alain Fran\xE7ois Christophe Laurent Olivier Julien Mathieu S\xE9bastien Guillaume Antoine Camille Nathalie Isabelle Sylvie Sophie C\xE9line Aur\xE9lie Chlo\xE9 Manon Giuseppe Giovanni Marco Luca Francesco Alessandro Matteo Lorenzo Stefano Paolo Roberto Davide Simone Federico Giulia Francesca Chiara Valentina Alessia Martina Elisa Jo\xE3o Pedro Tiago Beatriz In\xEAs Mariana Piotr Krzysztof Tomasz Marcin Agnieszka Katarzyna Ma\u0142gorzata Magdalena";
|
|
13472
13487
|
var WORDS = "\u0412\u0435\u0440\u0430 \u041D\u0430\u0434\u0435\u0436\u0434\u0430 \u041B\u044E\u0431\u043E\u0432\u044C \u0421\u043B\u0430\u0432\u0430 \u0420\u043E\u043C\u0430\u043D \u0420\u043E\u0437\u0430 \u041C\u0430\u0439\u044F \u041B\u0438\u043B\u0438\u044F \u0417\u043B\u0430\u0442\u0430 \u041C\u0438\u043B\u0430 \u041D\u0438\u043A\u0430 \u041B\u0435\u0432 \u0413\u043B\u043E\u0440\u0438\u044F Will Mark Rose Grace Hope Faith Bill Frank Jack June April Summer Amber Ruby Lily Daisy Victoria Virginia Georgia Florence Sydney Chelsea Jordan Austin Dallas Mercedes Dolores Rosa Pilar Marina Esperanza Gloria Amparo Consuelo Roc\xEDo Salvador Santiago Jes\xFAs \xC1ngeles Hugo Ram\xF3n Christian Felix F\xE9lix Mario Martin Victor Pierre Paz Merc\xE8 Estrella Aurora Concepci\xF3n Remedios Soledad Milagros Angel \xC1ngel Dawn Joy Holly Ivy Iris Violet Pearl";
|
|
@@ -13474,7 +13489,7 @@ var NOT_NAMES = ["\u0436\u0435\u043D\u0430", "\u0436\u0435\u043D\u044B", "\u0436
|
|
|
13474
13489
|
var FIRST_NAMES = [...new Set(`${RUSSIAN} ${EUROPEAN}`.split(" "))];
|
|
13475
13490
|
var NAME_WORDS = WORDS.split(" ");
|
|
13476
13491
|
|
|
13477
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13492
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/domain/person-names.js
|
|
13478
13493
|
var LATIN_TO_CYRILLIC = {
|
|
13479
13494
|
shch: "\u0449",
|
|
13480
13495
|
sch: "\u0449",
|
|
@@ -13682,7 +13697,7 @@ var findUnknownNames = /* @__PURE__ */ __name((text6, stem, taken) => {
|
|
|
13682
13697
|
return found2;
|
|
13683
13698
|
}, "findUnknownNames");
|
|
13684
13699
|
|
|
13685
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13700
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/domain/attachments.js
|
|
13686
13701
|
var NOT_FILES = /* @__PURE__ */ new Set([
|
|
13687
13702
|
"webpage",
|
|
13688
13703
|
"share",
|
|
@@ -13722,7 +13737,7 @@ var matchDownloads = /* @__PURE__ */ __name((stored4, files2) => {
|
|
|
13722
13737
|
});
|
|
13723
13738
|
}, "matchDownloads");
|
|
13724
13739
|
|
|
13725
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13740
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
|
|
13726
13741
|
var QUERY_VERSION = 1;
|
|
13727
13742
|
var QUERY_LIMITS2 = {
|
|
13728
13743
|
...QUERY_LIMITS,
|
|
@@ -13758,7 +13773,7 @@ function exhausted(budget) {
|
|
|
13758
13773
|
}
|
|
13759
13774
|
__name(exhausted, "exhausted");
|
|
13760
13775
|
|
|
13761
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13776
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
|
|
13762
13777
|
var any = { kind: "char", ranges: [[0, 1114111]], negate: false };
|
|
13763
13778
|
var literal2 = /* @__PURE__ */ __name((c) => ({
|
|
13764
13779
|
kind: "char",
|
|
@@ -14158,7 +14173,7 @@ var foldRegex = /* @__PURE__ */ __name((pattern, span) => {
|
|
|
14158
14173
|
return out;
|
|
14159
14174
|
}, "foldRegex");
|
|
14160
14175
|
|
|
14161
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14176
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/search/lucene/presets.js
|
|
14162
14177
|
var PRESET_VERSION = 1;
|
|
14163
14178
|
var PRESETS = {
|
|
14164
14179
|
password: {
|
|
@@ -14212,7 +14227,7 @@ var PRESETS = {
|
|
|
14212
14227
|
}
|
|
14213
14228
|
};
|
|
14214
14229
|
|
|
14215
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14230
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
|
|
14216
14231
|
var FIELD_VERSION = 2;
|
|
14217
14232
|
var UNITS = {
|
|
14218
14233
|
"": 1,
|
|
@@ -14724,12 +14739,12 @@ var QUERY_OPERATORS = [
|
|
|
14724
14739
|
{ name: "boost / minimum / intervals", example: "invoice^2", semantics: "query.unsupported-operator" }
|
|
14725
14740
|
];
|
|
14726
14741
|
|
|
14727
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14742
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/search/lucene/resolved.js
|
|
14728
14743
|
var hasText = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? node.field === "text" || node.field === "exact" : node.clauses.some(({ node: node2 }) => hasText(node2)), "hasText");
|
|
14729
14744
|
var isStemmed = /* @__PURE__ */ __name((node) => node.field === "text" && (node.operator === "term" || node.operator === "phrase") && node.value !== "", "isStemmed");
|
|
14730
14745
|
var hasStems = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? isStemmed(node) : node.clauses.some(({ node: node2 }) => hasStems(node2)), "hasStems");
|
|
14731
14746
|
|
|
14732
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14747
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-links.js
|
|
14733
14748
|
var LIVE = "mn.kind = 'url' AND mn.status <> 'dismissed'";
|
|
14734
14749
|
var MAIL_ROWS = `SELECT mn.source_id FROM mentions mn WHERE mn.source_type = 'email' AND ${LIVE}`;
|
|
14735
14750
|
var linkMatch = /* @__PURE__ */ __name((field4, typed, mail, mentioned2) => {
|
|
@@ -14753,7 +14768,7 @@ var linkMatch = /* @__PURE__ */ __name((field4, typed, mail, mentioned2) => {
|
|
|
14753
14768
|
};
|
|
14754
14769
|
}, "linkMatch");
|
|
14755
14770
|
|
|
14756
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14771
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/phone-countries.js
|
|
14757
14772
|
var SETTING = "phoneCountries";
|
|
14758
14773
|
var savedPhoneCountries = /* @__PURE__ */ __name((database) => {
|
|
14759
14774
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING);
|
|
@@ -14784,7 +14799,7 @@ var valueMatch = /* @__PURE__ */ __name((database, typed) => {
|
|
|
14784
14799
|
return { sql: "mn.value = ?", params: [phone?.value ?? normalizedValue(typed, { phoneCountries })] };
|
|
14785
14800
|
}, "valueMatch");
|
|
14786
14801
|
|
|
14787
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14802
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/domain/vocabulary.js
|
|
14788
14803
|
var normalizeVocabularyName = /* @__PURE__ */ __name((input) => {
|
|
14789
14804
|
if (typeof input !== "string" || input.length > 200 || /[\p{Cc}\p{Cf}]/u.test(input))
|
|
14790
14805
|
throw new CliError("validation_error", "a vocabulary name takes 1\u2013200 characters without control characters");
|
|
@@ -14812,7 +14827,7 @@ var vocabularySimilarity = /* @__PURE__ */ __name((left, right) => {
|
|
|
14812
14827
|
return 2 * intersection2 / (aa.size + bb.size);
|
|
14813
14828
|
}, "vocabularySimilarity");
|
|
14814
14829
|
|
|
14815
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14830
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-creation.js
|
|
14816
14831
|
import { createHash } from "node:crypto";
|
|
14817
14832
|
var folded2 = /* @__PURE__ */ __name((name) => {
|
|
14818
14833
|
try {
|
|
@@ -14878,7 +14893,7 @@ var guardTagCreation = /* @__PURE__ */ __name((context, name, kind3, by, options
|
|
|
14878
14893
|
});
|
|
14879
14894
|
}, "guardTagCreation");
|
|
14880
14895
|
|
|
14881
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14896
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/domain/tag-redirects.js
|
|
14882
14897
|
var invalid = /* @__PURE__ */ __name((message3) => {
|
|
14883
14898
|
throw new CliError("validation_error", message3);
|
|
14884
14899
|
}, "invalid");
|
|
@@ -14955,7 +14970,7 @@ var createTagRedirectIndex = /* @__PURE__ */ __name((snapshot2) => {
|
|
|
14955
14970
|
};
|
|
14956
14971
|
}, "createTagRedirectIndex");
|
|
14957
14972
|
|
|
14958
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14973
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-resolution.js
|
|
14959
14974
|
var tagCanonicalId = /* @__PURE__ */ __name((database, id2) => {
|
|
14960
14975
|
const row2 = database.prepare("SELECT canonical_id FROM resolved_tags WHERE id=?").get(id2);
|
|
14961
14976
|
if (!row2)
|
|
@@ -14983,7 +14998,7 @@ var tagRedirectSnapshot = /* @__PURE__ */ __name((database) => {
|
|
|
14983
14998
|
return snapshot2;
|
|
14984
14999
|
}, "tagRedirectSnapshot");
|
|
14985
15000
|
|
|
14986
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15001
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/task-keys.js
|
|
14987
15002
|
import { createHash as createHash2 } from "node:crypto";
|
|
14988
15003
|
var TASK_KEY_PREFIXES = {
|
|
14989
15004
|
question: "Q",
|
|
@@ -15011,7 +15026,7 @@ var taskAccountOf = /* @__PURE__ */ __name((database, rowId) => {
|
|
|
15011
15026
|
return row2 && String(row2.key) === inboxKey(String(row2.name)) ? String(row2.name) : void 0;
|
|
15012
15027
|
}, "taskAccountOf");
|
|
15013
15028
|
|
|
15014
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15029
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/values.js
|
|
15015
15030
|
var toMs = /* @__PURE__ */ __name((iso16) => {
|
|
15016
15031
|
if (iso16 === null || iso16 === void 0)
|
|
15017
15032
|
return null;
|
|
@@ -15025,7 +15040,7 @@ var present = /* @__PURE__ */ __name((entries) => Object.fromEntries(Object.entr
|
|
|
15025
15040
|
var DELIVERY = { delivered: 1, read: 2 };
|
|
15026
15041
|
var deliveryOf = /* @__PURE__ */ __name((stored4) => stored4 === DELIVERY.read ? "read" : stored4 === DELIVERY.delivered ? "delivered" : void 0, "deliveryOf");
|
|
15027
15042
|
|
|
15028
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15043
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/tags.js
|
|
15029
15044
|
var TAG_KINDS = ["tag", "topic"];
|
|
15030
15045
|
var TAGGABLE = { chat: "chat", contact: "identity", message: "message", task: "task" };
|
|
15031
15046
|
var TAG_TYPE = {
|
|
@@ -15228,7 +15243,7 @@ var tagsOf = /* @__PURE__ */ __name(({ database }, key2, filter) => {
|
|
|
15228
15243
|
return result;
|
|
15229
15244
|
}, "tagsOf");
|
|
15230
15245
|
|
|
15231
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15246
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-fields.js
|
|
15232
15247
|
var speech = /* @__PURE__ */ __name((alias2) => `(coalesce(${alias2}.extractor,'') LIKE 'speech:%' OR ${alias2}.kind IN ('voice','video_note') OR coalesce(${alias2}.mime,'')='audio/ogg')`, "speech");
|
|
15233
15248
|
var SPEECH = speech("att");
|
|
15234
15249
|
var mentionText = /* @__PURE__ */ __name((alias2) => `CASE WHEN coalesce(json_extract(${alias2}.contact, '$.phone'), '') <> '' THEN 'phone: ' || json_extract(${alias2}.contact, '$.phone') ELSE ${alias2}.text END`, "mentionText");
|
|
@@ -15592,7 +15607,7 @@ var FIELD_COMPILERS = {
|
|
|
15592
15607
|
subject
|
|
15593
15608
|
};
|
|
15594
15609
|
|
|
15595
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15610
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/place-key.js
|
|
15596
15611
|
var placeOf = /* @__PURE__ */ __name((database) => {
|
|
15597
15612
|
const exact = database.prepare("SELECT id FROM places WHERE folded = ?");
|
|
15598
15613
|
const onStreet = database.prepare("SELECT id FROM places WHERE substr(folded, 1, ?) = ? LIMIT 2");
|
|
@@ -15608,7 +15623,7 @@ var placeOf = /* @__PURE__ */ __name((database) => {
|
|
|
15608
15623
|
};
|
|
15609
15624
|
}, "placeOf");
|
|
15610
15625
|
|
|
15611
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15626
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-drain.js
|
|
15612
15627
|
var DRAIN_ON_WRITE = 500;
|
|
15613
15628
|
var METHOD = "rules";
|
|
15614
15629
|
var telegramLink = /* @__PURE__ */ __name((database) => {
|
|
@@ -15771,7 +15786,7 @@ var drainMentions = /* @__PURE__ */ __name((database, now2, limit = DRAIN_ON_WRI
|
|
|
15771
15786
|
return queued.length;
|
|
15772
15787
|
}, "drainMentions");
|
|
15773
15788
|
|
|
15774
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15789
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/index-state.js
|
|
15775
15790
|
var indexRow = /* @__PURE__ */ __name((database, name) => {
|
|
15776
15791
|
const exists2 = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'search_index_state'").get();
|
|
15777
15792
|
if (!exists2)
|
|
@@ -15779,7 +15794,7 @@ var indexRow = /* @__PURE__ */ __name((database, name) => {
|
|
|
15779
15794
|
return database.prepare("SELECT * FROM search_index_state WHERE name = ?").get(name);
|
|
15780
15795
|
}, "indexRow");
|
|
15781
15796
|
|
|
15782
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15797
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/stems.js
|
|
15783
15798
|
var INDEX = "message_stems";
|
|
15784
15799
|
var SETTING2 = "searchStemmers";
|
|
15785
15800
|
var DRAIN_ON_WRITE2 = 500;
|
|
@@ -15901,7 +15916,7 @@ var stemmerCache = /* @__PURE__ */ __name(() => {
|
|
|
15901
15916
|
};
|
|
15902
15917
|
}, "stemmerCache");
|
|
15903
15918
|
|
|
15904
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15919
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
|
|
15905
15920
|
var rehearsal = new AsyncLocalStorage();
|
|
15906
15921
|
var SQLITE_BUSY = 5;
|
|
15907
15922
|
var pause = new Int32Array(new SharedArrayBuffer(4));
|
|
@@ -16035,7 +16050,7 @@ var read = /* @__PURE__ */ __name((database, body2) => {
|
|
|
16035
16050
|
}
|
|
16036
16051
|
}, "read");
|
|
16037
16052
|
|
|
16038
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16053
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/vector-index.js
|
|
16039
16054
|
var source = /* @__PURE__ */ __name((model, dims) => `SELECT k.id, k.chunkable_type,
|
|
16040
16055
|
coalesce(CASE k.chunkable_type
|
|
16041
16056
|
WHEN 'image' THEN (SELECT ch.account_id FROM attachments a JOIN messages m ON m.id = a.attachable_id
|
|
@@ -16177,7 +16192,7 @@ var dropUnusedVectors = /* @__PURE__ */ __name((database, hashes) => {
|
|
|
16177
16192
|
}, "dropUnusedVectors");
|
|
16178
16193
|
var dropAllUnusedVectors = /* @__PURE__ */ __name((database) => database.prepare("DELETE FROM embeddings WHERE NOT EXISTS (SELECT 1 FROM chunks k WHERE k.content_hash = embeddings.content_hash) RETURNING 1").all().length, "dropAllUnusedVectors");
|
|
16179
16194
|
|
|
16180
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16195
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/accounts.js
|
|
16181
16196
|
var accountPk = /* @__PURE__ */ __name(({ orm, now: now2 }, { provider, account, scope: scope3 }, name = null) => Number(orm.insert(accounts).values({ provider, externalId: account, name, scope: scope3 ?? "personal", createdAt: now2(), updatedAt: now2() }).onConflictDoUpdate({
|
|
16182
16197
|
target: [accounts.provider, accounts.externalId],
|
|
16183
16198
|
set: {
|
|
@@ -16308,7 +16323,7 @@ var dropOrphanPeople = /* @__PURE__ */ __name((database, unseenBefore) => {
|
|
|
16308
16323
|
AND id NOT IN (SELECT id FROM (${referencesTo(database, "persons", /* @__PURE__ */ new Set(["identity_links"]))}) WHERE id IS NOT NULL)`).run(JSON.stringify(persons2));
|
|
16309
16324
|
}, "dropOrphanPeople");
|
|
16310
16325
|
|
|
16311
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16326
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/folded.js
|
|
16312
16327
|
var FOLDED = [
|
|
16313
16328
|
{ table: "tasks", column: "title" },
|
|
16314
16329
|
{ table: "tasks", column: "close_reason" },
|
|
@@ -16345,7 +16360,7 @@ var fillFolded = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
|
|
|
16345
16360
|
return filled2;
|
|
16346
16361
|
}, "fillFolded");
|
|
16347
16362
|
|
|
16348
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16363
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/history-skips.js
|
|
16349
16364
|
var HISTORY_KEY = "$history";
|
|
16350
16365
|
var objectOf = /* @__PURE__ */ __name((text6) => {
|
|
16351
16366
|
if (typeof text6 !== "string")
|
|
@@ -16421,7 +16436,7 @@ var withoutHistory = /* @__PURE__ */ __name((metadata3) => {
|
|
|
16421
16436
|
return rest;
|
|
16422
16437
|
}, "withoutHistory");
|
|
16423
16438
|
|
|
16424
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16439
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/conversations/chunks.js
|
|
16425
16440
|
import { createHash as createHash3 } from "node:crypto";
|
|
16426
16441
|
var CHUNK_CHARS = 1200;
|
|
16427
16442
|
var CHUNK_OVERLAP = 150;
|
|
@@ -16526,7 +16541,7 @@ var cutChunks = /* @__PURE__ */ __name((members2, limit = CHUNK_CHARS, check3, c
|
|
|
16526
16541
|
return chunks2;
|
|
16527
16542
|
}, "cutChunks");
|
|
16528
16543
|
|
|
16529
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16544
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/search/task-signature.js
|
|
16530
16545
|
var DAY = 864e5;
|
|
16531
16546
|
var CURRENCY = [
|
|
16532
16547
|
[/^(₽|руб.*|р\.?|rub)$/u, "RUB"],
|
|
@@ -16652,7 +16667,7 @@ var dueDayOf = /* @__PURE__ */ __name((text6, createdMs) => {
|
|
|
16652
16667
|
return best?.day ?? null;
|
|
16653
16668
|
}, "dueDayOf");
|
|
16654
16669
|
|
|
16655
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16670
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/search/task-similarity.js
|
|
16656
16671
|
var DAY2 = 864e5;
|
|
16657
16672
|
var STOP_WORDS = new Set([
|
|
16658
16673
|
// Russian and English as the test set ran them, already folded (пожалуйста → пожалуиста).
|
|
@@ -16807,7 +16822,7 @@ var rankCandidates = /* @__PURE__ */ __name((views, candidates) => candidates.ma
|
|
|
16807
16822
|
...compareViews(subjectViews ?? views, candidate, replyChain === void 0 ? {} : { replyChain })
|
|
16808
16823
|
})).sort((a, b) => b.score - a.score), "rankCandidates");
|
|
16809
16824
|
|
|
16810
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16825
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/vectors.js
|
|
16811
16826
|
var currentChunks = /* @__PURE__ */ __name((chatKey) => sql`SELECT k.content_hash, k.chunkable_id AS conversation_id, r.first_message_id,
|
|
16812
16827
|
r.last_message_id, r.text_start, r.text_end FROM chunks k JOIN chunk_messages r ON r.chunk_id = k.id
|
|
16813
16828
|
JOIN conversations c ON k.chunkable_type = 'conversation' AND c.id = k.chunkable_id
|
|
@@ -17077,8 +17092,12 @@ var readiness = /* @__PURE__ */ __name(({ orm }, chatKey, model) => {
|
|
|
17077
17092
|
vectors: { chunks: chunks2, embedded: Number(vectors?.embedded ?? 0), current, stale: stale4, missing: chunks2 - current - stale4 }
|
|
17078
17093
|
};
|
|
17079
17094
|
}, "readiness");
|
|
17095
|
+
var vectorCounts = /* @__PURE__ */ __name(({ orm }, models) => new Map(models.map((model) => [
|
|
17096
|
+
model,
|
|
17097
|
+
Number(orm.get(sql`SELECT count(*) AS n FROM embeddings WHERE model = ${model}`)?.n ?? 0)
|
|
17098
|
+
])), "vectorCounts");
|
|
17080
17099
|
|
|
17081
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17100
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/document-pictures.js
|
|
17082
17101
|
var DOCUMENT_PICTURE = "document_picture";
|
|
17083
17102
|
var SCAN_PAGE2 = 5e3;
|
|
17084
17103
|
var idOf = /* @__PURE__ */ __name((ref3) => {
|
|
@@ -17141,7 +17160,106 @@ var documentPicturesOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
|
|
|
17141
17160
|
}, "nearestPictures")
|
|
17142
17161
|
}), "documentPicturesOver");
|
|
17143
17162
|
|
|
17144
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17163
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/index-text.js
|
|
17164
|
+
var noteIndexText = /* @__PURE__ */ __name((title, text6) => title ? `${title}
|
|
17165
|
+
|
|
17166
|
+
${text6}` : text6, "noteIndexText");
|
|
17167
|
+
|
|
17168
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/enrichments.js
|
|
17169
|
+
var ENRICHMENT_SUBJECTS = ["document", "note", "email"];
|
|
17170
|
+
var ENRICHMENT_POSITION = 1e6;
|
|
17171
|
+
var EMAIL_ENRICHMENT = "email_enrichment";
|
|
17172
|
+
var LIVE2 = {
|
|
17173
|
+
document: "SELECT d.id, d.title, coalesce(d.body, '') AS body, coalesce(d.external_updated_at, d.updated_at) AS at FROM documents d WHERE d.deleted_at IS NULL AND coalesce(json_extract(d.metadata, '$.catalog.active'), 1) = 1",
|
|
17174
|
+
note: "SELECT n.id, n.title, coalesce(n.body, '') AS body, n.updated_at AS at FROM notes n WHERE n.deleted_at IS NULL",
|
|
17175
|
+
email: "SELECT e.id, e.subject AS title, coalesce(e.body_text, '') AS body, coalesce(e.sent_at, e.received_at) AS at FROM emails e WHERE e.deleted_at IS NULL"
|
|
17176
|
+
};
|
|
17177
|
+
var QUEUES = {
|
|
17178
|
+
document: "INSERT OR IGNORE INTO document_index_pending (indexable_type, id) VALUES ('document', ?)",
|
|
17179
|
+
note: "INSERT OR IGNORE INTO note_index_pending (indexable_type, id) VALUES ('note', ?)",
|
|
17180
|
+
email: "INSERT OR IGNORE INTO email_index_pending (indexable_type, id) VALUES ('email', ?)"
|
|
17181
|
+
};
|
|
17182
|
+
var currentEnrichment = /* @__PURE__ */ __name((database, type, id2, indexed) => {
|
|
17183
|
+
if (!ENRICHMENT_SUBJECTS.includes(type))
|
|
17184
|
+
return void 0;
|
|
17185
|
+
const row2 = database.prepare("SELECT text, source_hash FROM enrichments WHERE subject_type = ? AND subject_id = ?").get(type, id2);
|
|
17186
|
+
return row2 && String(row2.source_hash) === chunkHash(indexed) ? String(row2.text) : void 0;
|
|
17187
|
+
}, "currentEnrichment");
|
|
17188
|
+
var enrichmentText = /* @__PURE__ */ __name((database, type, id2) => {
|
|
17189
|
+
const row2 = database.prepare("SELECT text FROM enrichments WHERE subject_type = ? AND subject_id = ?").get(type === EMAIL_ENRICHMENT ? "email" : type, id2);
|
|
17190
|
+
return row2 === void 0 ? void 0 : String(row2.text);
|
|
17191
|
+
}, "enrichmentText");
|
|
17192
|
+
var scan = /* @__PURE__ */ __name(function* (database, type, only) {
|
|
17193
|
+
const held = new Map(database.prepare("SELECT subject_id AS id, source_hash AS hash FROM enrichments WHERE subject_type = ?").all(type).map((row2) => [Number(row2.id), String(row2.hash)]));
|
|
17194
|
+
for (const row2 of database.prepare(`${LIVE2[type]} ORDER BY 1`).all()) {
|
|
17195
|
+
const id2 = Number(row2.id);
|
|
17196
|
+
if (only && !only.has(id2))
|
|
17197
|
+
continue;
|
|
17198
|
+
const title = row2.title == null ? null : String(row2.title);
|
|
17199
|
+
const text6 = noteIndexText(title, String(row2.body));
|
|
17200
|
+
if (!text6.trim())
|
|
17201
|
+
continue;
|
|
17202
|
+
const hash2 = chunkHash(text6);
|
|
17203
|
+
yield { type, id: id2, text: text6, at: row2.at == null ? null : Number(row2.at), hash: hash2, enriched: held.get(id2) === hash2 };
|
|
17204
|
+
}
|
|
17205
|
+
}, "scan");
|
|
17206
|
+
var enrichmentsOver = /* @__PURE__ */ __name(({ database, now: now2 }) => ({
|
|
17207
|
+
pending: /* @__PURE__ */ __name(async (limit, { types = ENRICHMENT_SUBJECTS, only } = {}) => {
|
|
17208
|
+
const found2 = [];
|
|
17209
|
+
for (const type of types) {
|
|
17210
|
+
const ids = only ? new Set(only.filter((one2) => one2.type === type).map((one2) => one2.id)) : void 0;
|
|
17211
|
+
if (ids?.size === 0)
|
|
17212
|
+
continue;
|
|
17213
|
+
for (const { enriched, ...candidate } of scan(database, type, ids)) {
|
|
17214
|
+
if (found2.length >= limit)
|
|
17215
|
+
return found2;
|
|
17216
|
+
if (!enriched)
|
|
17217
|
+
found2.push(candidate);
|
|
17218
|
+
}
|
|
17219
|
+
}
|
|
17220
|
+
return found2;
|
|
17221
|
+
}, "pending"),
|
|
17222
|
+
counts: /* @__PURE__ */ __name(async () => {
|
|
17223
|
+
const counts = {
|
|
17224
|
+
records: 0,
|
|
17225
|
+
enriched: 0,
|
|
17226
|
+
pendingChars: 0,
|
|
17227
|
+
pendingByType: { document: 0, note: 0, email: 0 }
|
|
17228
|
+
};
|
|
17229
|
+
for (const type of ENRICHMENT_SUBJECTS)
|
|
17230
|
+
for (const one2 of scan(database, type)) {
|
|
17231
|
+
counts.records += 1;
|
|
17232
|
+
if (one2.enriched)
|
|
17233
|
+
counts.enriched += 1;
|
|
17234
|
+
else {
|
|
17235
|
+
counts.pendingChars += one2.text.length;
|
|
17236
|
+
counts.pendingByType[type] += 1;
|
|
17237
|
+
}
|
|
17238
|
+
}
|
|
17239
|
+
return counts;
|
|
17240
|
+
}, "counts"),
|
|
17241
|
+
save: /* @__PURE__ */ __name(async (rows) => write(database, () => {
|
|
17242
|
+
const upsert2 = database.prepare(`INSERT INTO enrichments (subject_type, subject_id, source_hash, provider, model, text, tokens, created_at)
|
|
17243
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
17244
|
+
ON CONFLICT (subject_type, subject_id) DO UPDATE SET source_hash = excluded.source_hash,
|
|
17245
|
+
provider = excluded.provider, model = excluded.model, text = excluded.text, tokens = excluded.tokens,
|
|
17246
|
+
created_at = excluded.created_at`);
|
|
17247
|
+
const at = now2();
|
|
17248
|
+
for (const row2 of rows) {
|
|
17249
|
+
upsert2.run(row2.type, row2.id, row2.hash, row2.provider, row2.model, row2.text, row2.tokens, at);
|
|
17250
|
+
database.prepare(QUEUES[row2.type]).run(row2.id);
|
|
17251
|
+
}
|
|
17252
|
+
}), "save"),
|
|
17253
|
+
clear: /* @__PURE__ */ __name(async () => write(database, () => {
|
|
17254
|
+
const rows = database.prepare("SELECT subject_type AS type, subject_id AS id FROM enrichments").all();
|
|
17255
|
+
for (const row2 of rows)
|
|
17256
|
+
database.prepare(QUEUES[row2.type]).run(Number(row2.id));
|
|
17257
|
+
database.prepare("DELETE FROM enrichments").run();
|
|
17258
|
+
return rows.length;
|
|
17259
|
+
}), "clear")
|
|
17260
|
+
}), "enrichmentsOver");
|
|
17261
|
+
|
|
17262
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/query-filter.js
|
|
17145
17263
|
var glob = /* @__PURE__ */ __name((value) => [...fold(value).matchAll(/\\(.)|([*?])|(.)/gsu)].map(([, escaped2, wildcard, plain2]) => {
|
|
17146
17264
|
const literal5 = escaped2 ?? plain2 ?? "";
|
|
17147
17265
|
return wildcard ?? (/[*?[]/u.test(literal5) ? `[${literal5}]` : literal5);
|
|
@@ -17206,7 +17324,7 @@ var compile = /* @__PURE__ */ __name((node, columns, options) => {
|
|
|
17206
17324
|
var queryFilter = /* @__PURE__ */ __name((ast, columns, options = {}) => compile(ast.root, columns, options), "queryFilter");
|
|
17207
17325
|
var bound2 = /* @__PURE__ */ __name(({ sql: text6, params }) => sql.join(text6.split("?").map((part2, at) => at < params.length ? sql`${sql.raw(part2)}${params[at]}` : sql.raw(part2)), sql``), "bound");
|
|
17208
17326
|
|
|
17209
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17327
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/events.js
|
|
17210
17328
|
var toJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.stringify(value), "toJson");
|
|
17211
17329
|
var fromJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.parse(String(value)), "fromJson");
|
|
17212
17330
|
var int = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "int");
|
|
@@ -17296,7 +17414,7 @@ var linkMeeting = /* @__PURE__ */ __name((database, id2, eventId, now2, mode = "
|
|
|
17296
17414
|
});
|
|
17297
17415
|
}, "linkMeeting");
|
|
17298
17416
|
|
|
17299
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17417
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/note-index.js
|
|
17300
17418
|
var EVENT_TEXT = "trim(coalesce(e.description, '') || ' ' || coalesce(e.location, '') || ' ' || coalesce((SELECT group_concat(p.name, ' ') FROM calendar_entries ce JOIN calendar_entry_participants p ON p.entry_id = ce.id WHERE ce.event_id = e.id AND ce.deleted_at IS NULL AND p.resource = 0 AND p.name IS NOT NULL), ''))";
|
|
17301
17419
|
var UNSEARCHED_EVENT_TYPES = [
|
|
17302
17420
|
"working-location",
|
|
@@ -17359,9 +17477,6 @@ var CORPORA = {
|
|
|
17359
17477
|
read: `SELECT e.title, ${EVENT_TEXT} AS body, ${EVENT_LIVE} AS live, coalesce((SELECT a.scope FROM calendar_entries ce JOIN calendars c ON c.id = ce.calendar_id JOIN accounts a ON a.id = c.account_id WHERE ce.event_id = e.id LIMIT 1), 'personal') AS scope, (SELECT c.account_id FROM calendar_entries ce JOIN calendars c ON c.id = ce.calendar_id WHERE ce.event_id = e.id AND ce.deleted_at IS NULL ORDER BY ce.id LIMIT 1) AS account_id FROM events e WHERE e.id = ?`
|
|
17360
17478
|
}
|
|
17361
17479
|
};
|
|
17362
|
-
var noteIndexText = /* @__PURE__ */ __name((title, text6) => title ? `${title}
|
|
17363
|
-
|
|
17364
|
-
${text6}` : text6, "noteIndexText");
|
|
17365
17480
|
var queuedAs = /* @__PURE__ */ __name((corpus) => corpus.queued ?? corpus.type, "queuedAs");
|
|
17366
17481
|
var hasTrigrams = /* @__PURE__ */ __name((corpus) => corpus.type === "note" || corpus.type === "document", "hasTrigrams");
|
|
17367
17482
|
var holdingText = /* @__PURE__ */ __name((type, column2, search2) => {
|
|
@@ -17444,27 +17559,44 @@ var writer2 = /* @__PURE__ */ __name((database, corpus, stemmer) => {
|
|
|
17444
17559
|
stems: database.prepare(`INSERT INTO ${corpus.type}_stems (rowid, stems, scope) VALUES (?, ?, ?)`),
|
|
17445
17560
|
trigrams: hasTrigrams(corpus) ? database.prepare(`INSERT INTO ${corpus.type}_trigrams (rowid, text) VALUES (?, ?)`) : null,
|
|
17446
17561
|
chunk: database.prepare("INSERT INTO chunks (chunkable_type, chunkable_id, position, start_offset, end_offset, content_hash, scope, account_id, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"),
|
|
17447
|
-
dequeue: database.prepare(`DELETE FROM ${corpus.type}_index_pending WHERE indexable_type = ? AND id = ?`)
|
|
17562
|
+
dequeue: database.prepare(`DELETE FROM ${corpus.type}_index_pending WHERE indexable_type = ? AND id = ?`),
|
|
17563
|
+
emailAt: database.prepare("SELECT coalesce(received_at, sent_at) AS at FROM emails WHERE id = ?")
|
|
17448
17564
|
};
|
|
17565
|
+
const enrichedType = corpus.type === "email" ? EMAIL_ENRICHMENT : corpus.type;
|
|
17449
17566
|
return (id2) => {
|
|
17450
17567
|
const row2 = read3.get(id2);
|
|
17451
|
-
const before2 =
|
|
17568
|
+
const before2 = [
|
|
17569
|
+
...oldHashes.all(corpus.type, id2).map((hash2) => String(hash2.hash)),
|
|
17570
|
+
...corpus.type === "email" ? oldHashes.all(EMAIL_ENRICHMENT, id2).map((hash2) => String(hash2.hash)) : []
|
|
17571
|
+
];
|
|
17452
17572
|
statements.dropWords.run(id2);
|
|
17453
17573
|
statements.dropStems.run(id2);
|
|
17454
17574
|
statements.dropTrigrams?.run(id2);
|
|
17455
17575
|
statements.dropChunks.run(corpus.type, id2);
|
|
17576
|
+
if (corpus.type === "email")
|
|
17577
|
+
statements.dropChunks.run(EMAIL_ENRICHMENT, id2);
|
|
17456
17578
|
const live2 = row2 !== void 0 && Number(row2.live) === 1;
|
|
17457
17579
|
const text6 = live2 ? noteIndexText(row2.title == null ? null : String(row2.title), String(row2.body)) : "";
|
|
17458
17580
|
const scope3 = live2 ? String(row2.scope ?? "personal") : "";
|
|
17581
|
+
const enrichment = text6.trim() ? currentEnrichment(database, corpus.type, id2, text6) : void 0;
|
|
17459
17582
|
const terms2 = corpus.terms && text6 ? corpus.terms(text6, stemmer) : void 0;
|
|
17460
17583
|
const words3 = terms2 ? terms2.words : normalize(text6);
|
|
17461
17584
|
if (words3 !== "") {
|
|
17462
17585
|
statements.words.run(id2, words3, scope3);
|
|
17463
17586
|
statements.trigrams?.run(id2, words3);
|
|
17464
17587
|
}
|
|
17465
|
-
const stems = terms2 ? terms2.stems : text6 ? stemmer.indexText(
|
|
17588
|
+
const stems = terms2 ? terms2.stems : text6 ? stemmer.indexText(enrichment ? `${text6}
|
|
17589
|
+
|
|
17590
|
+
${enrichment}` : text6) : "";
|
|
17466
17591
|
if (stems !== "")
|
|
17467
17592
|
statements.stems.run(id2, stems, scope3);
|
|
17593
|
+
if (enrichment) {
|
|
17594
|
+
const at = Date.now();
|
|
17595
|
+
const occurred = corpus.type === "email" ? int(statements.emailAt.get(id2)?.at) : null;
|
|
17596
|
+
statements.chunk.run(enrichedType, id2, corpus.type === "email" ? 0 : ENRICHMENT_POSITION, 0, 0, chunkHash(enrichment), scope3, int(row2?.account_id), at, at);
|
|
17597
|
+
if (occurred !== null && occurred !== void 0)
|
|
17598
|
+
database.prepare("UPDATE chunks SET occurred_at = ? WHERE chunkable_type = ? AND chunkable_id = ?").run(occurred, EMAIL_ENRICHMENT, id2);
|
|
17599
|
+
}
|
|
17468
17600
|
if (text6.trim() && corpus.pieces !== false) {
|
|
17469
17601
|
const at = Date.now();
|
|
17470
17602
|
const sections = row2?.metadata == null ? [] : storedSections(String(row2.metadata));
|
|
@@ -17528,7 +17660,7 @@ var resetNoteIndex = /* @__PURE__ */ __name((database) => {
|
|
|
17528
17660
|
return true;
|
|
17529
17661
|
}, "resetNoteIndex");
|
|
17530
17662
|
|
|
17531
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17663
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/person-resolution.js
|
|
17532
17664
|
var keyOf3 = /* @__PURE__ */ __name((name) => fold(name).trim().replace(/^@/, ""), "keyOf");
|
|
17533
17665
|
var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
|
|
17534
17666
|
for (const key2 of new Set(names.filter((name) => !!name?.trim()).map(keyOf3))) {
|
|
@@ -17547,7 +17679,7 @@ var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
|
|
|
17547
17679
|
}
|
|
17548
17680
|
}, "resolvePersonLinks");
|
|
17549
17681
|
|
|
17550
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17682
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/identities.js
|
|
17551
17683
|
var flag2 = /* @__PURE__ */ __name((value) => value === void 0 || value === null ? null : Number(value), "flag");
|
|
17552
17684
|
var prepare = /* @__PURE__ */ __name((orm) => ({
|
|
17553
17685
|
find: orm.select({
|
|
@@ -17772,7 +17904,7 @@ var meetingIdentityPk = /* @__PURE__ */ __name((context, accountId, identity) =>
|
|
|
17772
17904
|
}, "meetingIdentityPk");
|
|
17773
17905
|
var phoneOf = /* @__PURE__ */ __name(({ orm }, provider, nativeId) => orm.select({ phone: identities.phone }).from(identities).where(and(eq(identities.provider, provider), eq(identities.externalId, nativeId))).get()?.phone ?? null, "phoneOf");
|
|
17774
17906
|
|
|
17775
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17907
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/chats.js
|
|
17776
17908
|
var chatOf = /* @__PURE__ */ __name(({ orm }, accountKey, chatKey) => orm.select({ id: chats.externalId }).from(chats).where(and(eq(chats.id, chatKey), eq(chats.accountId, accountKey))).get()?.id, "chatOf");
|
|
17777
17909
|
var findChatPk = /* @__PURE__ */ __name(({ orm }, accountKey, chatId) => orm.select({ pk: chats.id }).from(chats).where(and(eq(chats.accountId, accountKey), eq(chats.externalId, chatId))).get()?.pk, "findChatPk");
|
|
17778
17910
|
var chatPkFor = /* @__PURE__ */ __name((context, accountKey, chatId) => findChatPk(context, accountKey, chatId) ?? Number(context.orm.insert(chats).values({
|
|
@@ -18060,7 +18192,7 @@ var replaceAutoTags = /* @__PURE__ */ __name((context, key2, chatId, algorithm,
|
|
|
18060
18192
|
}
|
|
18061
18193
|
}, "replaceAutoTags");
|
|
18062
18194
|
|
|
18063
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18195
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/context/evidence.js
|
|
18064
18196
|
import { createHash as createHash4 } from "node:crypto";
|
|
18065
18197
|
var CONTEXT_MAX_READ_BYTES = 262144;
|
|
18066
18198
|
var CONTEXT_SOURCE_KINDS = ["message", "mail", "document", "meeting"];
|
|
@@ -18158,7 +18290,7 @@ var contextEvidenceRequest = /* @__PURE__ */ __name((input) => {
|
|
|
18158
18290
|
return { source: source2, query, chat: chat2, senders, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal: input.signal };
|
|
18159
18291
|
}, "contextEvidenceRequest");
|
|
18160
18292
|
|
|
18161
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18293
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/email-activity.js
|
|
18162
18294
|
var MAIL_AGENDA_COLUMNS = { chat_kind: { type: "enum", sql: "'dialog'" } };
|
|
18163
18295
|
var ACTIVITY = `
|
|
18164
18296
|
SELECT t.external_id AS thread, t.subject, t.last_email_at, t.emails_count,
|
|
@@ -18288,7 +18420,7 @@ var mailActivity = /* @__PURE__ */ __name((database) => ({
|
|
|
18288
18420
|
threadActivity: /* @__PURE__ */ __name(async (accountId, since, where) => threadActivity(database, accountId, since, where), "threadActivity")
|
|
18289
18421
|
}), "mailActivity");
|
|
18290
18422
|
|
|
18291
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18423
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/conversations/mail-text.js
|
|
18292
18424
|
var GREETING = new RegExp("^(hi|hello|hey|dear|greetings|good (morning|afternoon|evening)|\u043F\u0440\u0438\u0432\u0435\u0442|\u0437\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439(\u0442\u0435)?|\u0434\u043E\u0431\u0440(\u044B\u0439|\u043E\u0435|\u043E\u0433\u043E) (\u0434\u0435\u043D\u044C|\u0432\u0435\u0447\u0435\u0440|\u0443\u0442\u0440\u043E|\u0443\u0442\u0440\u0430|\u0434\u043D\u044F)|hola|buen(os|as) (d\xEDas|dias|tardes|noches)|estimad[oa]s?|querid[oa]s?)(?![\\p{L}\\p{N}])([\\s,]+\\p{L}[\\p{L}.'\u2019-]*){0,3}\\s*[,!.:]?$", "iu");
|
|
18293
18425
|
var SIGN_OFF = /^(best|best regards|best wishes|kind regards|warm regards|regards|thanks|thanks again|thanks a lot|thank you|many thanks|cheers|sincerely|yours|yours truly|yours sincerely|br|с уважением|спасибо|заранее спасибо|всего доброго|всего хорошего|un saludo|saludos|saludos cordiales|atentamente|gracias|muchas gracias)[\s,.!]*$/iu;
|
|
18294
18426
|
var ATTRIBUTION = /(wrote|написал[аи]?|escribió|a écrit|schrieb)\s*:\s*$/iu;
|
|
@@ -18369,15 +18501,17 @@ var mailCore = /* @__PURE__ */ __name((body2, earlier) => {
|
|
|
18369
18501
|
return withoutSignOff(withoutGreeting(kept)).join("\n").trim();
|
|
18370
18502
|
}, "mailCore");
|
|
18371
18503
|
|
|
18372
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18504
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/email-index.js
|
|
18373
18505
|
var titleOf = /* @__PURE__ */ __name((subject2) => subject2?.replace(/^\s*((re|fwd?|aw|wg)\s*:\s*)+/i, "").trim() || null, "titleOf");
|
|
18374
18506
|
var MAIL_PIECES = `(SELECT k.id, k.content_hash, k.chunkable_type AS type, k.chunkable_id AS owner, k.position,
|
|
18375
|
-
k.start_offset, k.end_offset, k.account_id, k.occurred_at,
|
|
18507
|
+
k.start_offset, k.end_offset, k.account_id, k.occurred_at,
|
|
18508
|
+
CASE k.chunkable_type WHEN 'email_enrichment' THEN k.chunkable_id ELSE a.attachable_id END AS email_id,
|
|
18376
18509
|
CASE k.chunkable_type WHEN 'email_thread' THEN k.chunkable_id
|
|
18377
|
-
ELSE (SELECT email_thread_id FROM emails
|
|
18510
|
+
ELSE (SELECT email_thread_id FROM emails
|
|
18511
|
+
WHERE id = CASE k.chunkable_type WHEN 'email_enrichment' THEN k.chunkable_id ELSE a.attachable_id END) END AS thread_id
|
|
18378
18512
|
FROM chunks k LEFT JOIN attachments a ON k.chunkable_type = 'attachment' AND a.id = k.chunkable_id
|
|
18379
18513
|
AND a.attachable_type = 'email'
|
|
18380
|
-
WHERE k.chunkable_type
|
|
18514
|
+
WHERE k.chunkable_type IN ('email_thread', 'email_enrichment') OR a.id IS NOT NULL) p`;
|
|
18381
18515
|
var threadText = /* @__PURE__ */ __name((database, threadId) => {
|
|
18382
18516
|
const rows = database.prepare(`SELECT id, subject, coalesce(body_text, '') AS body, coalesce(from_name, from_address) AS sender,
|
|
18383
18517
|
coalesce(received_at, sent_at) AS at
|
|
@@ -18479,7 +18613,7 @@ var drainEmailIndex = /* @__PURE__ */ __name((database, stemmerFor2) => {
|
|
|
18479
18613
|
return emails2 + threads;
|
|
18480
18614
|
}, "drainEmailIndex");
|
|
18481
18615
|
|
|
18482
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18616
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/email-locations.js
|
|
18483
18617
|
var locate = /* @__PURE__ */ __name((database, accountId, emailId, where) => database.prepare(`INSERT OR REPLACE INTO email_locations (mailbox_id, uidvalidity, uid, email_id)
|
|
18484
18618
|
SELECT id, ?, ?, ? FROM mailboxes WHERE account_id = ? AND external_id = ?`).run(where.uidvalidity, where.uid, emailId, accountId, where.folder), "locate");
|
|
18485
18619
|
var folderEmails = /* @__PURE__ */ __name((database, accountId, folder, uidvalidity) => database.prepare(`SELECT l.uid, e.external_id, coalesce(e.received_at, e.sent_at) AS at, e.read, e.flagged,
|
|
@@ -18577,7 +18711,7 @@ var forgetLocations = /* @__PURE__ */ __name((database, accountId, folder, uidva
|
|
|
18577
18711
|
var backfillSentAt = /* @__PURE__ */ __name((database, accountId, limit) => Number(database.prepare(`UPDATE emails SET sent_at = received_at WHERE id IN (
|
|
18578
18712
|
SELECT id FROM emails WHERE account_id = ? AND sent_at IS NULL AND received_at IS NOT NULL LIMIT ?)`).run(accountId, limit).changes), "backfillSentAt");
|
|
18579
18713
|
|
|
18580
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18714
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/email-state.js
|
|
18581
18715
|
var recountEmailThread = /* @__PURE__ */ __name((database, threadId, now2) => database.prepare(`UPDATE email_threads SET
|
|
18582
18716
|
emails_count = (SELECT count(*) FROM emails WHERE email_thread_id = ? AND deleted_at IS NULL),
|
|
18583
18717
|
last_email_at = (SELECT max(coalesce(sent_at, received_at)) FROM emails
|
|
@@ -18627,7 +18761,7 @@ var markEmailsRestored = /* @__PURE__ */ __name((database, accountId, externalId
|
|
|
18627
18761
|
return threads.length;
|
|
18628
18762
|
}, "markEmailsRestored");
|
|
18629
18763
|
|
|
18630
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18764
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-nearest.js
|
|
18631
18765
|
var MAIL_PIECE_ROWS = `SELECT p.id, p.content_hash AS hash, p.type, p.owner, p.position, p.email_id AS email, v.vector
|
|
18632
18766
|
FROM ${MAIL_PIECES} JOIN embeddings v ON v.model = ? AND v.content_hash = p.content_hash
|
|
18633
18767
|
WHERE p.account_id = ?
|
|
@@ -18663,7 +18797,7 @@ var scannedMailPieces = /* @__PURE__ */ __name((database, model, query, filter)
|
|
|
18663
18797
|
var indexedMailPieces = /* @__PURE__ */ __name((database, model, query, filter, depth) => {
|
|
18664
18798
|
const candidates = database.prepare(`${MAIL_PIECE_ROWS} AND p.id IN (SELECT value FROM json_each(?)) ORDER BY p.id`);
|
|
18665
18799
|
const merged = /* @__PURE__ */ new Map();
|
|
18666
|
-
for (const kind3 of ["email_thread", "attachment"]) {
|
|
18800
|
+
for (const kind3 of ["email_thread", "attachment", "email_enrichment"]) {
|
|
18667
18801
|
const found2 = searchIndex(database, model, { kind: kind3, account: filter.accountId, ...filter.since === void 0 ? {} : { since: filter.since } }, query, depth, (near2) => {
|
|
18668
18802
|
const hashes = new Map(near2.map(({ id: id2, hash: hash2 }) => [id2, hash2]));
|
|
18669
18803
|
const best = /* @__PURE__ */ new Map();
|
|
@@ -18687,7 +18821,7 @@ var indexedMailPieces = /* @__PURE__ */ __name((database, model, query, filter,
|
|
|
18687
18821
|
}, "indexedMailPieces");
|
|
18688
18822
|
var nearestMailPieces = /* @__PURE__ */ __name((database, model, query, filter, depth) => (filter.threadExternalId === void 0 ? indexedMailPieces(database, model, query, filter, depth) : void 0) ?? scannedMailPieces(database, model, query, filter), "nearestMailPieces");
|
|
18689
18823
|
|
|
18690
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18824
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-rules.js
|
|
18691
18825
|
var sorted = /* @__PURE__ */ __name((value) => Array.isArray(value) ? value.map(sorted) : value !== null && typeof value === "object" ? Object.fromEntries(Object.keys(value).sort().map((key2) => [key2, sorted(value[key2])])) : value, "sorted");
|
|
18692
18826
|
var conditionsKey = /* @__PURE__ */ __name((conditions) => JSON.stringify(sorted(conditions)), "conditionsKey");
|
|
18693
18827
|
var ruleOf = /* @__PURE__ */ __name((row2) => ({
|
|
@@ -18754,7 +18888,7 @@ var mailRulesOver = /* @__PURE__ */ __name((database) => ({
|
|
|
18754
18888
|
}
|
|
18755
18889
|
}), "mailRulesOver");
|
|
18756
18890
|
|
|
18757
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18891
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/link-reviews.js
|
|
18758
18892
|
var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates, reason, now2) => {
|
|
18759
18893
|
database.prepare(`INSERT INTO link_reviews (linkable_type, linkable_id, entity_type, candidates, reason, status, created_at, updated_at)
|
|
18760
18894
|
VALUES (?, ?, ?, ?, ?, 'open', ?, ?)
|
|
@@ -18762,7 +18896,7 @@ var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates,
|
|
|
18762
18896
|
reason = excluded.reason, updated_at = excluded.updated_at WHERE link_reviews.status = 'open'`).run(linkable.type, linkable.id, entity, JSON.stringify([...candidates].sort((a, b) => a - b)), reason, now2, now2);
|
|
18763
18897
|
}, "reviewLink");
|
|
18764
18898
|
|
|
18765
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18899
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-operation.js
|
|
18766
18900
|
function checkMeetingCancelled(signal) {
|
|
18767
18901
|
if (!signal?.aborted)
|
|
18768
18902
|
return;
|
|
@@ -18773,7 +18907,7 @@ function checkMeetingCancelled(signal) {
|
|
|
18773
18907
|
}
|
|
18774
18908
|
__name(checkMeetingCancelled, "checkMeetingCancelled");
|
|
18775
18909
|
|
|
18776
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18910
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-values.js
|
|
18777
18911
|
var meetingOf = /* @__PURE__ */ __name((row2) => ({
|
|
18778
18912
|
id: Number(row2.id),
|
|
18779
18913
|
accountId: Number(row2.account_id),
|
|
@@ -18823,7 +18957,7 @@ var transcriptRowOf = /* @__PURE__ */ __name((row2) => ({
|
|
|
18823
18957
|
createdAt: Number(row2.created_at)
|
|
18824
18958
|
}), "transcriptRowOf");
|
|
18825
18959
|
|
|
18826
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18960
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-reads.js
|
|
18827
18961
|
var MEETING_TEXT = ["external_id", "title", "description", "location", "join_url", "timezone", "metadata"];
|
|
18828
18962
|
var TRANSCRIPT_TEXT = ["source", "format", "language", "content_hash", "metadata"];
|
|
18829
18963
|
var ROW_TEXT = ["speaker_name", "text", "normalized_text", "metadata"];
|
|
@@ -18990,7 +19124,7 @@ var meetingReadsOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
18990
19124
|
}
|
|
18991
19125
|
}), "meetingReadsOver");
|
|
18992
19126
|
|
|
18993
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19127
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-selection.js
|
|
18994
19128
|
var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
|
|
18995
19129
|
const clauses = ["m.account_id=?", "m.deleted_at IS NULL"];
|
|
18996
19130
|
const params = [input.accountId];
|
|
@@ -19033,7 +19167,7 @@ var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
|
|
|
19033
19167
|
return { clauses, params };
|
|
19034
19168
|
}, "meetingSelectionSql");
|
|
19035
19169
|
|
|
19036
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19170
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-chat-lines.js
|
|
19037
19171
|
var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
19038
19172
|
async meetingChatLines(input) {
|
|
19039
19173
|
checkMeetingCancelled(input.signal);
|
|
@@ -19061,7 +19195,7 @@ var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
19061
19195
|
}
|
|
19062
19196
|
}), "meetingChatLinesOver");
|
|
19063
19197
|
|
|
19064
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19198
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/person-separation.js
|
|
19065
19199
|
var identitiesOf = /* @__PURE__ */ __name(({ database }, person2) => database.prepare("SELECT identity_id AS pk FROM identity_links WHERE person_id = ?").all(person2).map(({ pk }) => Number(pk)), "identitiesOf");
|
|
19066
19200
|
var MOVED_AWAY = `moved.identity_id IN (SELECT value FROM json_each(?))
|
|
19067
19201
|
AND (moved.from_person_id IN (SELECT value FROM json_each(?))
|
|
@@ -19076,7 +19210,7 @@ var apart = /* @__PURE__ */ __name(({ database }, one2, other) => {
|
|
|
19076
19210
|
var separated = /* @__PURE__ */ __name((context, one2, other) => one2 !== other && apart(context, { identities: identitiesOf(context, one2), person: one2 }, { identities: identitiesOf(context, other), person: other }), "separated");
|
|
19077
19211
|
var identitySeparated = /* @__PURE__ */ __name((context, identity, person2) => apart(context, { identities: [identity] }, { identities: identitiesOf(context, person2).filter((pk) => pk !== identity), person: person2 }), "identitySeparated");
|
|
19078
19212
|
|
|
19079
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19213
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/reads.js
|
|
19080
19214
|
var MESSAGE_FIELDS = {
|
|
19081
19215
|
pk: messages.id,
|
|
19082
19216
|
nativeId: messages.externalId,
|
|
@@ -19247,7 +19381,7 @@ var chatActivity = /* @__PURE__ */ __name(({ database }, accountKey, since, wher
|
|
|
19247
19381
|
storedAt: toIso(Number(database.prepare("SELECT max(created_at) AS at FROM messages WHERE account_id = ?").get(accountKey)?.at) || null)
|
|
19248
19382
|
}), "chatActivity");
|
|
19249
19383
|
|
|
19250
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19384
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/search.js
|
|
19251
19385
|
var HIT_FIELDS = {
|
|
19252
19386
|
...MESSAGE_FIELDS,
|
|
19253
19387
|
chatTitle: sql`${chats.title}`.as("chat_title"),
|
|
@@ -19346,7 +19480,7 @@ var directReplies = /* @__PURE__ */ __name((context, parents, limit) => {
|
|
|
19346
19480
|
};
|
|
19347
19481
|
}, "directReplies");
|
|
19348
19482
|
|
|
19349
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19483
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/person-links.js
|
|
19350
19484
|
var identityRow = /* @__PURE__ */ __name(({ orm }, { provider, id: id2 }) => orm.select({ pk: identities.id, personPk: identityLinks.personId }).from(identities).innerJoin(identityLinks, eq(identityLinks.identityId, identities.id)).where(and(eq(identities.provider, provider), eq(identities.externalId, id2))).get(), "identityRow");
|
|
19351
19485
|
var required = /* @__PURE__ */ __name((context, ref3) => {
|
|
19352
19486
|
const found2 = identityRow(context, ref3);
|
|
@@ -19480,7 +19614,7 @@ var mentioning = /* @__PURE__ */ __name((context, accountKey, { id: id2, usernam
|
|
|
19480
19614
|
}, "mentioning");
|
|
19481
19615
|
var escaped = /* @__PURE__ */ __name((text6) => text6.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escaped");
|
|
19482
19616
|
|
|
19483
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19617
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-context-links.js
|
|
19484
19618
|
var missing2 = /* @__PURE__ */ __name(() => {
|
|
19485
19619
|
throw new CliError("not_found", "Meeting, participant or selected target not found");
|
|
19486
19620
|
}, "missing");
|
|
@@ -19602,7 +19736,7 @@ function meetingContextLinksOver(context) {
|
|
|
19602
19736
|
}
|
|
19603
19737
|
__name(meetingContextLinksOver, "meetingContextLinksOver");
|
|
19604
19738
|
|
|
19605
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19739
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-index-values.js
|
|
19606
19740
|
var INDEX_CODES = { meeting_transcript_row: 1, meeting_chat_message: 2, meeting_summary: 3 };
|
|
19607
19741
|
var meetingRowid = /* @__PURE__ */ __name((type, id2) => id2 * 4 + INDEX_CODES[type], "meetingRowid");
|
|
19608
19742
|
var summaryOf = /* @__PURE__ */ __name((row2) => ({
|
|
@@ -19631,7 +19765,7 @@ var indexedText = /* @__PURE__ */ __name((database, type, id2) => {
|
|
|
19631
19765
|
return row2 ? summaryText(summaryOf(row2)) : null;
|
|
19632
19766
|
}, "indexedText");
|
|
19633
19767
|
|
|
19634
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19768
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stem-state.js
|
|
19635
19769
|
var summaryBytes = ["title", "overview", "sections", "next_steps", "content"].map((key2) => `coalesce(length(CAST(s.${key2} AS BLOB)),0)`).join("+");
|
|
19636
19770
|
var meetingCurrentIndexRows = `
|
|
19637
19771
|
SELECT 'meeting_transcript_row' AS indexable_type,r.id,r.id*4+1 AS rid,1 AS live,coalesce(length(CAST(r.text AS BLOB)),0) AS bytes FROM meeting_transcript_rows r JOIN meeting_transcripts t ON t.id=r.meeting_transcript_id JOIN meetings m ON m.id=t.meeting_id WHERE m.account_id=? AND m.deleted_at IS NULL AND t.deleted_at IS NULL AND t.superseded_at IS NULL
|
|
@@ -19662,7 +19796,7 @@ var invalidateMeetingStems = /* @__PURE__ */ __name((database, type, id2) => {
|
|
|
19662
19796
|
}, "invalidateMeetingStems");
|
|
19663
19797
|
var meetingStemmableText = /* @__PURE__ */ __name((text6) => text6.replace(/[\p{L}\p{N}\p{M}\p{Co}]+/gu, (token) => token.length <= 1024 ? token : ""), "meetingStemmableText");
|
|
19664
19798
|
|
|
19665
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19799
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-index.js
|
|
19666
19800
|
function meetingHitIndexOver({ database, now: now2 }) {
|
|
19667
19801
|
return {
|
|
19668
19802
|
async indexSearch(original) {
|
|
@@ -19730,10 +19864,10 @@ function meetingHitIndexOver({ database, now: now2 }) {
|
|
|
19730
19864
|
}
|
|
19731
19865
|
__name(meetingHitIndexOver, "meetingHitIndexOver");
|
|
19732
19866
|
|
|
19733
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19867
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
|
|
19734
19868
|
import { createHash as createHash5 } from "node:crypto";
|
|
19735
19869
|
|
|
19736
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19870
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/search/lucene/plain.js
|
|
19737
19871
|
var REPAIRED = /* @__PURE__ */ new Set([
|
|
19738
19872
|
"query.invalid-syntax",
|
|
19739
19873
|
"query.unclosed-literal",
|
|
@@ -19802,6 +19936,8 @@ var read2 = /* @__PURE__ */ __name((text6, fields4) => {
|
|
|
19802
19936
|
}, "read");
|
|
19803
19937
|
var without = /* @__PURE__ */ __name((text6, leaves) => [...leaves].sort((a, b) => b.span.start - a.span.start).reduce((left, { span }) => left.slice(0, span.start) + left.slice(span.end), text6).trim(), "without");
|
|
19804
19938
|
var plainQuery = /* @__PURE__ */ __name((text6, fields4 = SEARCH_FIELDS) => {
|
|
19939
|
+
if (text6.trim() && !/[\p{L}\p{N}*]/u.test(text6))
|
|
19940
|
+
throw new CliError("validation_error", `search needs a letter or a digit to look for; ${JSON.stringify(text6)} has none`);
|
|
19805
19941
|
let current = text6;
|
|
19806
19942
|
let whole = false;
|
|
19807
19943
|
for (let tries = 0; tries <= 64; tries++) {
|
|
@@ -19838,7 +19974,7 @@ var plainQuery = /* @__PURE__ */ __name((text6, fields4 = SEARCH_FIELDS) => {
|
|
|
19838
19974
|
return text6;
|
|
19839
19975
|
}, "plainQuery");
|
|
19840
19976
|
|
|
19841
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19977
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/search/trigrams.js
|
|
19842
19978
|
var trigrams = /* @__PURE__ */ __name((term) => {
|
|
19843
19979
|
const padded = ` ${term} `;
|
|
19844
19980
|
const pieces = /* @__PURE__ */ new Set();
|
|
@@ -19847,7 +19983,7 @@ var trigrams = /* @__PURE__ */ __name((term) => {
|
|
|
19847
19983
|
return [...pieces];
|
|
19848
19984
|
}, "trigrams");
|
|
19849
19985
|
|
|
19850
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19986
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/search/correct.js
|
|
19851
19987
|
var SHORTEST_CORRECTION = 3;
|
|
19852
19988
|
var maxEdits = /* @__PURE__ */ __name((word2) => word2.length <= 4 ? 1 : 2, "maxEdits");
|
|
19853
19989
|
var editDistance = /* @__PURE__ */ __name((a, b, max) => {
|
|
@@ -19894,7 +20030,7 @@ var correctWords = /* @__PURE__ */ __name(async (vocabulary, words3) => {
|
|
|
19894
20030
|
return corrections;
|
|
19895
20031
|
}, "correctWords");
|
|
19896
20032
|
|
|
19897
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20033
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/search/garbled.js
|
|
19898
20034
|
var SHORTEST_GARBLED = 4;
|
|
19899
20035
|
var MOST_WIDENED = 64;
|
|
19900
20036
|
var plain = /* @__PURE__ */ __name((word2) => word2.replaceAll("\u044D", "\u0435"), "plain");
|
|
@@ -19986,7 +20122,7 @@ var widenWords = /* @__PURE__ */ __name((probes, vocabulary, stem, known2) => {
|
|
|
19986
20122
|
return found2.map((words3) => words3.sort((a, b) => a.distance - b.distance || b.docs - a.docs || a.term.localeCompare(b.term)).slice(0, MOST_WIDENED).map((word2) => word2.term));
|
|
19987
20123
|
}, "widenWords");
|
|
19988
20124
|
|
|
19989
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20125
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/search/russian-dictionary.js
|
|
19990
20126
|
import { readFileSync } from "node:fs";
|
|
19991
20127
|
var loaded;
|
|
19992
20128
|
var dictionary = /* @__PURE__ */ __name(() => {
|
|
@@ -20045,7 +20181,7 @@ var knownRussianWord = /* @__PURE__ */ __name((word2) => {
|
|
|
20045
20181
|
return false;
|
|
20046
20182
|
}, "knownRussianWord");
|
|
20047
20183
|
|
|
20048
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20184
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-query.js
|
|
20049
20185
|
var WORD2 = /[\p{L}\p{N}\p{M}]+/gu;
|
|
20050
20186
|
var MOST_WORDS = 128;
|
|
20051
20187
|
var quote = /* @__PURE__ */ __name((word2) => `"${word2.replaceAll('"', '""')}"`, "quote");
|
|
@@ -20272,7 +20408,7 @@ var matchMeetingText = /* @__PURE__ */ __name((tree, text6, stemmer) => {
|
|
|
20272
20408
|
return check3(tree);
|
|
20273
20409
|
}, "matchMeetingText");
|
|
20274
20410
|
|
|
20275
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20411
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
|
|
20276
20412
|
var fail3 = /* @__PURE__ */ __name((message3) => {
|
|
20277
20413
|
throw new CliError("validation_error", message3);
|
|
20278
20414
|
}, "fail");
|
|
@@ -20454,7 +20590,7 @@ function meetingHitSearchOver({ database }) {
|
|
|
20454
20590
|
}
|
|
20455
20591
|
__name(meetingHitSearchOver, "meetingHitSearchOver");
|
|
20456
20592
|
|
|
20457
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20593
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-languages.js
|
|
20458
20594
|
var meetingLanguagesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
20459
20595
|
async fillTranscriptLanguages({ accountId, apply, now: now2 }) {
|
|
20460
20596
|
positiveReadInteger(accountId, "accountId");
|
|
@@ -20486,7 +20622,7 @@ var meetingLanguagesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20486
20622
|
}
|
|
20487
20623
|
}), "meetingLanguagesOver");
|
|
20488
20624
|
|
|
20489
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20625
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-participant-search.js
|
|
20490
20626
|
import { createHash as createHash6 } from "node:crypto";
|
|
20491
20627
|
var cursorOf2 = /* @__PURE__ */ __name((value, key2) => {
|
|
20492
20628
|
if (value === void 0)
|
|
@@ -20576,7 +20712,7 @@ var meetingParticipantSearchOver = /* @__PURE__ */ __name((context) => ({
|
|
|
20576
20712
|
}
|
|
20577
20713
|
}), "meetingParticipantSearchOver");
|
|
20578
20714
|
|
|
20579
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20715
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-context-queries.js
|
|
20580
20716
|
var preparationQueries = {
|
|
20581
20717
|
participants: {
|
|
20582
20718
|
fields: "p.id, p.identity_id, p.display_name, l.person_id",
|
|
@@ -20626,7 +20762,7 @@ var preparationQueries = {
|
|
|
20626
20762
|
}
|
|
20627
20763
|
};
|
|
20628
20764
|
|
|
20629
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20765
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-context.js
|
|
20630
20766
|
var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
20631
20767
|
async preparationContext(original) {
|
|
20632
20768
|
const input = validateMeetingPreparationContext(original);
|
|
@@ -20667,7 +20803,7 @@ var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20667
20803
|
}
|
|
20668
20804
|
}), "meetingPreparationContextOver");
|
|
20669
20805
|
|
|
20670
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20806
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-subjects.js
|
|
20671
20807
|
var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
|
|
20672
20808
|
SELECT m.id FROM meetings m JOIN meeting_series s ON s.id=m.meeting_series_id
|
|
20673
20809
|
WHERE m.id IN (${Array.from({ length: anchors }, () => "?").join(",")}) AND m.account_id=? AND s.account_id=?
|
|
@@ -20681,7 +20817,7 @@ var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
|
|
|
20681
20817
|
JOIN main.projects p ON p.id=l.to_id WHERE p.account_id IS NULL AND p.deleted_at IS NULL
|
|
20682
20818
|
)`, "preparationSubjects");
|
|
20683
20819
|
|
|
20684
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20820
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-knowledge.js
|
|
20685
20821
|
var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
20686
20822
|
async preparationKnowledge(original) {
|
|
20687
20823
|
const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
|
|
@@ -20726,7 +20862,7 @@ var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => (
|
|
|
20726
20862
|
}
|
|
20727
20863
|
}), "meetingPreparationKnowledgeOver");
|
|
20728
20864
|
|
|
20729
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20865
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-notes.js
|
|
20730
20866
|
var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
20731
20867
|
async preparationNotes(original) {
|
|
20732
20868
|
const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
|
|
@@ -20779,7 +20915,7 @@ var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20779
20915
|
}
|
|
20780
20916
|
}), "meetingPreparationNotesOver");
|
|
20781
20917
|
|
|
20782
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20918
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-related-history.js
|
|
20783
20919
|
var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
20784
20920
|
async relatedHistory(original) {
|
|
20785
20921
|
const input = validateMeetingRelatedHistory(original);
|
|
@@ -20850,7 +20986,7 @@ var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20850
20986
|
}
|
|
20851
20987
|
}), "meetingRelatedHistoryOver");
|
|
20852
20988
|
|
|
20853
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20989
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-review.js
|
|
20854
20990
|
var number2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "number");
|
|
20855
20991
|
var text2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : String(value), "text");
|
|
20856
20992
|
var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
@@ -20931,7 +21067,7 @@ var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20931
21067
|
}
|
|
20932
21068
|
}), "meetingReviewOver");
|
|
20933
21069
|
|
|
20934
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21070
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-series-history.js
|
|
20935
21071
|
var bytes2 = "length(CAST(external_id AS BLOB)) + coalesce(length(CAST(title AS BLOB)), 0)";
|
|
20936
21072
|
var ensureBytes2 = /* @__PURE__ */ __name((size2, budget) => {
|
|
20937
21073
|
if (!Number.isSafeInteger(size2) || size2 < 0 || size2 > budget)
|
|
@@ -20985,7 +21121,7 @@ var meetingSeriesHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20985
21121
|
}
|
|
20986
21122
|
}), "meetingSeriesHistoryOver");
|
|
20987
21123
|
|
|
20988
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21124
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stats.js
|
|
20989
21125
|
var MOST_ROWS = 5e5;
|
|
20990
21126
|
var meetingCountsSql = /* @__PURE__ */ __name((where) => `SELECT m.started_at, coalesce(m.duration_ms, m.ended_at - m.started_at) AS duration_ms,
|
|
20991
21127
|
EXISTS (SELECT 1 FROM meeting_transcripts t WHERE t.meeting_id = m.id AND t.deleted_at IS NULL
|
|
@@ -21054,7 +21190,7 @@ var meetingStatsOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
21054
21190
|
}
|
|
21055
21191
|
}), "meetingStatsOver");
|
|
21056
21192
|
|
|
21057
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21193
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/meetings.js
|
|
21058
21194
|
var CURSOR_KEY = "meetings";
|
|
21059
21195
|
var seriesOf2 = /* @__PURE__ */ __name((row2) => ({
|
|
21060
21196
|
id: Number(row2.id),
|
|
@@ -21623,7 +21759,7 @@ var meetingStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
21623
21759
|
};
|
|
21624
21760
|
}, "meetingStoreOver");
|
|
21625
21761
|
|
|
21626
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21762
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/sync.js
|
|
21627
21763
|
var syncStateOf = /* @__PURE__ */ __name(({ orm }, accountKey, name) => {
|
|
21628
21764
|
const row2 = orm.select({ value: syncCursors.value, at: syncCursors.updatedAt }).from(syncCursors).where(and(eq(syncCursors.accountId, accountKey), eq(syncCursors.key, name))).get();
|
|
21629
21765
|
return row2 ? { value: row2.value, at: toIso(row2.at) } : void 0;
|
|
@@ -21649,7 +21785,7 @@ var release = /* @__PURE__ */ __name(({ orm }, chatKey, anchor, holder) => {
|
|
|
21649
21785
|
orm.delete(fetchLeases).where(and(eq(fetchLeases.chatId, chatKey), eq(fetchLeases.anchor, anchor), eq(fetchLeases.holder, holder))).run();
|
|
21650
21786
|
}, "release");
|
|
21651
21787
|
|
|
21652
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21788
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/thread-columns.js
|
|
21653
21789
|
var THREAD_COLUMNS = {
|
|
21654
21790
|
subject: {
|
|
21655
21791
|
where: /* @__PURE__ */ __name(({ value }) => ({
|
|
@@ -21666,7 +21802,7 @@ var threadRows = /* @__PURE__ */ __name((database, filter) => {
|
|
|
21666
21802
|
AND (${filter.where?.sql ?? "1"}) ORDER BY coalesce(last_email_at, 0) DESC, id DESC LIMIT ? OFFSET ?`).all(filter.accountId ?? null, filter.accountId ?? null, filter.includeDeleted ? 1 : 0, ...filter.where?.params ?? [], limit, offset);
|
|
21667
21803
|
}, "threadRows");
|
|
21668
21804
|
|
|
21669
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21805
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/emails.js
|
|
21670
21806
|
var threadConversation = /* @__PURE__ */ __name((place, builtAt) => ({
|
|
21671
21807
|
id: `email:${place.emailId}`,
|
|
21672
21808
|
chatId: place.threadExternalId,
|
|
@@ -22148,6 +22284,10 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm, now: now2 }, stemme
|
|
|
22148
22284
|
const piece = threads.get(owner)?.[Number(row2.position)];
|
|
22149
22285
|
return piece && piece.hash === row2.hash ? [{ hash: piece.hash, text: piece.text }] : [];
|
|
22150
22286
|
}
|
|
22287
|
+
if (type === EMAIL_ENRICHMENT) {
|
|
22288
|
+
const text7 = enrichmentText(database, type, owner);
|
|
22289
|
+
return text7 === void 0 ? [] : [{ hash: String(row2.hash), text: text7 }];
|
|
22290
|
+
}
|
|
22151
22291
|
const text6 = str(file.get(owner)?.text);
|
|
22152
22292
|
return text6 == null ? [] : [{ hash: String(row2.hash), text: text6.slice(Number(row2.start), Number(row2.end)) }];
|
|
22153
22293
|
});
|
|
@@ -22204,7 +22344,7 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm, now: now2 }, stemme
|
|
|
22204
22344
|
}
|
|
22205
22345
|
}), "mailStoreOver");
|
|
22206
22346
|
|
|
22207
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22347
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/search/dictionary.js
|
|
22208
22348
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
22209
22349
|
var DICTIONARIES = Object.fromEntries(LANGUAGES.map(({ name, dictionary: dictionary3 }) => [name, dictionary3]));
|
|
22210
22350
|
var folded4 = /* @__PURE__ */ __name((word2) => /^[а-яё'-]*$/.test(word2) ? word2.replaceAll("\u0451", "\u0435").replaceAll("\u0439", "\u0438") : fold(word2), "folded");
|
|
@@ -22294,7 +22434,7 @@ var knownWord = /* @__PURE__ */ __name((languages) => {
|
|
|
22294
22434
|
}, "knownWord");
|
|
22295
22435
|
var dictionaryLanguages = /* @__PURE__ */ __name((stemmers) => [stemmers.cyrillic, ...stemmers.latin.split(",")].filter((name) => Object.hasOwn(DICTIONARIES, name)), "dictionaryLanguages");
|
|
22296
22436
|
|
|
22297
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22437
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/transcript-query.js
|
|
22298
22438
|
var predicates = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? [node] : node.clauses.flatMap(({ node: node2 }) => predicates(node2)), "predicates");
|
|
22299
22439
|
var readsTranscripts = /* @__PURE__ */ __name((node) => (node.operator === "term" || node.operator === "phrase") && /[\p{L}\p{N}]/u.test(normalize(node.value)) && (node.field === "transcript" || node.implicit === true && (node.field === "text" || node.field === "exact")), "readsTranscripts");
|
|
22300
22440
|
var LATIN_NUMBERS = new Set(`zero one two three four five six seven eight nine ten eleven twelve twenty thirty forty fifty sixty seventy
|
|
@@ -22380,7 +22520,7 @@ var spokenTranscripts = /* @__PURE__ */ __name((database, item, speaking, keys)
|
|
|
22380
22520
|
return found2;
|
|
22381
22521
|
}, "spokenTranscripts");
|
|
22382
22522
|
|
|
22383
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22523
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/hit-places.js
|
|
22384
22524
|
var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, found2, pks) => {
|
|
22385
22525
|
const placeLeaves = leaves.filter(({ node }) => (node.operator === "term" || node.operator === "phrase") && (node.implicit || node.field === "content" || node.field === "transcript"));
|
|
22386
22526
|
if (!placeLeaves.length || !pks.length || found2.length !== pks.length)
|
|
@@ -22427,7 +22567,7 @@ var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, f
|
|
|
22427
22567
|
});
|
|
22428
22568
|
}, "placeHits");
|
|
22429
22569
|
|
|
22430
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22570
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-groups.js
|
|
22431
22571
|
var GROUPS = {
|
|
22432
22572
|
chat: {
|
|
22433
22573
|
key: "m.chat_id",
|
|
@@ -22449,7 +22589,7 @@ var GROUPS = {
|
|
|
22449
22589
|
}
|
|
22450
22590
|
};
|
|
22451
22591
|
|
|
22452
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22592
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene.js
|
|
22453
22593
|
var MESSAGES2 = {
|
|
22454
22594
|
rows: "messages",
|
|
22455
22595
|
threads: "chats",
|
|
@@ -22932,7 +23072,7 @@ var runCompiled = /* @__PURE__ */ __name(async (context, execution, by) => {
|
|
|
22932
23072
|
};
|
|
22933
23073
|
}, "runCompiled");
|
|
22934
23074
|
|
|
22935
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23075
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/counters.js
|
|
22936
23076
|
function invalidMetadata() {
|
|
22937
23077
|
throw new CliError("validation_error", "stored counter metadata is malformed \u2014 check the store before refreshing");
|
|
22938
23078
|
}
|
|
@@ -23034,7 +23174,7 @@ var counterTargets = /* @__PURE__ */ __name((context, execution, options) => wit
|
|
|
23034
23174
|
};
|
|
23035
23175
|
}), "counterTargets");
|
|
23036
23176
|
|
|
23037
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23177
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/attachment-texts.js
|
|
23038
23178
|
var NOT_FILE_LIST = [...NOT_FILES].map((kind3) => `'${kind3}'`).join(",");
|
|
23039
23179
|
var fileAttachments = /* @__PURE__ */ __name(({ database }, accountKey, { chatKey, messageId, beforePk, limit }) => database.prepare(`SELECT att.id AS pk, c.external_id AS chat_id, m.external_id AS message_id, att.position, att.kind, att.name, att.mime,
|
|
23040
23180
|
att.size, att.local_path, att.extraction AS origin, att.size AS read_bytes, att.extraction_error AS error, att.content_sha256, att.extractor
|
|
@@ -23153,7 +23293,7 @@ var attachmentViews = /* @__PURE__ */ __name(({ database }, accountKey, { chatKe
|
|
|
23153
23293
|
}));
|
|
23154
23294
|
}, "attachmentViews");
|
|
23155
23295
|
|
|
23156
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23296
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/transcripts.js
|
|
23157
23297
|
var transcript2 = /* @__PURE__ */ __name(({ orm }, chatKey, messageId) => orm.select({ text: messageTranscripts.text, source: messageTranscripts.source }).from(messageTranscripts).where(and(eq(messageTranscripts.chatId, chatKey), eq(messageTranscripts.messageExternalId, messageId))).get(), "transcript");
|
|
23158
23298
|
var keepTranscript = /* @__PURE__ */ __name((context, chatKey, messageId, text6, source2) => {
|
|
23159
23299
|
const { orm, database, now: now2 } = context;
|
|
@@ -23191,7 +23331,7 @@ var intoVoiceAttachment = /* @__PURE__ */ __name((context, messagePk) => {
|
|
|
23191
23331
|
keepText(context, Number(row2.id), { text: String(row2.text), origin: "extracted", extractor: `speech:${row2.source}` });
|
|
23192
23332
|
}, "intoVoiceAttachment");
|
|
23193
23333
|
|
|
23194
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23334
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/messages.js
|
|
23195
23335
|
var FIELDS = [
|
|
23196
23336
|
"threadExternalId",
|
|
23197
23337
|
"senderIdentityId",
|
|
@@ -23509,7 +23649,7 @@ var writeDerivedReactions = /* @__PURE__ */ __name((context, chatKey, messageId)
|
|
|
23509
23649
|
reactionStatementsOf(context.database).total.run(JSON.stringify(derived), chatKey, messageId);
|
|
23510
23650
|
}, "writeDerivedReactions");
|
|
23511
23651
|
|
|
23512
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23652
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/keys.js
|
|
23513
23653
|
var keysOver = /* @__PURE__ */ __name((context) => {
|
|
23514
23654
|
const findAccountPk2 = /* @__PURE__ */ __name((key2) => findAccountPk(context, key2), "findAccountPk");
|
|
23515
23655
|
const findChatPk2 = /* @__PURE__ */ __name((accountKey, chatId) => findChatPk(context, accountKey, chatId), "findChatPk");
|
|
@@ -23530,7 +23670,7 @@ var keysOver = /* @__PURE__ */ __name((context) => {
|
|
|
23530
23670
|
};
|
|
23531
23671
|
}, "keysOver");
|
|
23532
23672
|
|
|
23533
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23673
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/account-groups.js
|
|
23534
23674
|
var accountGroupsOf = /* @__PURE__ */ __name((database) => {
|
|
23535
23675
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(ACCOUNT_GROUPS);
|
|
23536
23676
|
if (!row2)
|
|
@@ -23564,8 +23704,20 @@ var saveProfile = /* @__PURE__ */ __name((database, app, profile, key2, now2) =>
|
|
|
23564
23704
|
profiles[app] = { ...profiles[app], [profile]: { provider: key2.provider, account: key2.account } };
|
|
23565
23705
|
database.prepare("INSERT OR REPLACE INTO store_settings (key, value, at) VALUES (?, ?, ?)").run(PROFILES, JSON.stringify(profiles), now2);
|
|
23566
23706
|
}, "saveProfile");
|
|
23707
|
+
var forgetProfile = /* @__PURE__ */ __name((database, app, profile, now2) => {
|
|
23708
|
+
const profiles = profilesOf2(database);
|
|
23709
|
+
const own = profiles[app];
|
|
23710
|
+
if (own?.[profile] === void 0)
|
|
23711
|
+
return;
|
|
23712
|
+
const { [profile]: _, ...rest } = own;
|
|
23713
|
+
if (Object.keys(rest).length === 0)
|
|
23714
|
+
delete profiles[app];
|
|
23715
|
+
else
|
|
23716
|
+
profiles[app] = rest;
|
|
23717
|
+
database.prepare("INSERT OR REPLACE INTO store_settings (key, value, at) VALUES (?, ?, ?)").run(PROFILES, JSON.stringify(profiles), now2);
|
|
23718
|
+
}, "forgetProfile");
|
|
23567
23719
|
|
|
23568
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23720
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/own-identities.js
|
|
23569
23721
|
var linkOwnIdentities = /* @__PURE__ */ __name((context) => {
|
|
23570
23722
|
const owner = ownerPerson(context.database).id;
|
|
23571
23723
|
const strays = context.database.prepare("SELECT DISTINCT l.person_id AS person FROM identity_links l JOIN identities i ON i.id = l.identity_id JOIN accounts a ON a.provider = i.provider AND a.external_id = i.external_id WHERE l.person_id <> ?").all(owner);
|
|
@@ -23587,7 +23739,7 @@ var linkToOwner = /* @__PURE__ */ __name((context, ref3) => {
|
|
|
23587
23739
|
return personOf(context, ref3);
|
|
23588
23740
|
}, "linkToOwner");
|
|
23589
23741
|
|
|
23590
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23742
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/providers.js
|
|
23591
23743
|
var PROVIDERS_SETTING = "providers";
|
|
23592
23744
|
var storedProvidersOf = /* @__PURE__ */ __name((database) => {
|
|
23593
23745
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(PROVIDERS_SETTING);
|
|
@@ -23635,7 +23787,7 @@ var registerProvider = /* @__PURE__ */ __name((database, value, now2) => {
|
|
|
23635
23787
|
});
|
|
23636
23788
|
}, "registerProvider");
|
|
23637
23789
|
|
|
23638
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23790
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/task-candidates.js
|
|
23639
23791
|
var DAY3 = 864e5;
|
|
23640
23792
|
var RECENTLY_CLOSED_MS = 14 * DAY3;
|
|
23641
23793
|
var TEXT_LIMIT = 20;
|
|
@@ -23834,7 +23986,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
|
|
|
23834
23986
|
};
|
|
23835
23987
|
}, "taskSimilarityOver");
|
|
23836
23988
|
|
|
23837
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23989
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/task-category-settings.js
|
|
23838
23990
|
var SETTING3 = "taskCategories";
|
|
23839
23991
|
var savedTaskCategories = /* @__PURE__ */ __name((database) => {
|
|
23840
23992
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING3);
|
|
@@ -23853,7 +24005,7 @@ var saveTaskCategories = /* @__PURE__ */ __name((database, categories, now2) =>
|
|
|
23853
24005
|
database.prepare("INSERT INTO store_settings (key, value, at) VALUES (?, ?, ?) ON CONFLICT (key) DO UPDATE SET value = excluded.value, at = excluded.at").run(SETTING3, JSON.stringify(categories), now2);
|
|
23854
24006
|
}, "saveTaskCategories");
|
|
23855
24007
|
|
|
23856
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24008
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close.js
|
|
23857
24009
|
var DEFAULT_AGENT_CLOSE = { allowed: true, min: 0.8 };
|
|
23858
24010
|
var ALLOWED = "taskAgentClose";
|
|
23859
24011
|
var MIN = "taskAgentCloseMin";
|
|
@@ -23909,10 +24061,10 @@ var SUGGESTION_COLUMNS = [
|
|
|
23909
24061
|
];
|
|
23910
24062
|
var CLEAR_SUGGESTION = SUGGESTION_COLUMNS.map((column2) => `${column2} = NULL`).join(", ");
|
|
23911
24063
|
|
|
23912
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24064
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/mail-findings.js
|
|
23913
24065
|
var MAIL_FINDINGS_KIND = "mail_findings";
|
|
23914
24066
|
|
|
23915
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24067
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/decisions.js
|
|
23916
24068
|
var TASK_CLOSE_KIND = "task_close";
|
|
23917
24069
|
var DEFAULT_DECISION_POLICY = { agentDecisions: false, ruleProposalsOwnerOnly: true };
|
|
23918
24070
|
var isOwnerOnlyKind = /* @__PURE__ */ __name((kind3) => kind3 === MAIL_FINDINGS_KIND || kind3 === MEETING_FINDINGS_KIND || kind3 === TASK_CLOSE_KIND || kind3 === SOURCE_REVIEW_KIND, "isOwnerOnlyKind");
|
|
@@ -23960,7 +24112,7 @@ var assertMayDecide = /* @__PURE__ */ __name((row2, by, policy = DEFAULT_DECISIO
|
|
|
23960
24112
|
}, "assertMayDecide");
|
|
23961
24113
|
var deciderAuthor = /* @__PURE__ */ __name((by) => by === "owner" ? "owner" : { bot: by.bot, ...by.model === void 0 ? {} : { model: by.model } }, "deciderAuthor");
|
|
23962
24114
|
|
|
23963
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24115
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/domain/ref-summaries.js
|
|
23964
24116
|
var PROFILE_PLACEHOLDER = "<profile>";
|
|
23965
24117
|
var oneLine = /* @__PURE__ */ __name((text6) => singleLine(text6.replace(/\s+/g, " ").trim()), "oneLine");
|
|
23966
24118
|
var openKind = /* @__PURE__ */ __name((kind3) => kind3 === "email" ? "message" : kind3 === "email_thread" ? "chat" : kind3 === "unknown" ? void 0 : kind3, "openKind");
|
|
@@ -24021,7 +24173,7 @@ var refLabel = /* @__PURE__ */ __name((summary) => {
|
|
|
24021
24173
|
return `${WORDS2[summary.kind]} ${named2}${notes2 === "" ? "" : ` (${notes2})`}`;
|
|
24022
24174
|
}, "refLabel");
|
|
24023
24175
|
|
|
24024
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24176
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/ref-summaries.js
|
|
24025
24177
|
var EXCERPT_CHARS = 280;
|
|
24026
24178
|
var TITLE_CHARS = 120;
|
|
24027
24179
|
var MEMORY_TITLE_CHARS = 80;
|
|
@@ -24439,8 +24591,11 @@ var refReadsOf = /* @__PURE__ */ __name((database, texts2, { excerpt = false, no
|
|
|
24439
24591
|
}, "refReadsOf");
|
|
24440
24592
|
var summaryOf2 = /* @__PURE__ */ __name(({ sender, excerpt, ...summary }, withExcerpt) => withExcerpt ? { ...summary, excerpt } : summary, "summaryOf");
|
|
24441
24593
|
var refSummariesOf = /* @__PURE__ */ __name((database, texts2, options = {}) => new Map([...refReadsOf(database, texts2, options)].map(([text6, read3]) => [text6, summaryOf2(read3, options.excerpt === true)])), "refSummariesOf");
|
|
24594
|
+
var refsStoreOver = /* @__PURE__ */ __name((context) => ({
|
|
24595
|
+
summaries: /* @__PURE__ */ __name(async (texts2, options) => refSummariesOf(context.database, texts2, { ...options, now: context.now() }), "summaries")
|
|
24596
|
+
}), "refsStoreOver");
|
|
24442
24597
|
|
|
24443
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24598
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-sources.js
|
|
24444
24599
|
var sourceOf3 = /* @__PURE__ */ __name((read3, ref3) => ({
|
|
24445
24600
|
ref: ref3,
|
|
24446
24601
|
kind: read3.kind,
|
|
@@ -24478,7 +24633,7 @@ var evidenceSourcesOf = /* @__PURE__ */ __name((database, from2) => {
|
|
|
24478
24633
|
});
|
|
24479
24634
|
}, "evidenceSourcesOf");
|
|
24480
24635
|
|
|
24481
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24636
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/attachments/limits.js
|
|
24482
24637
|
var MAX_FILE_BYTES = 50 * 1024 * 1024;
|
|
24483
24638
|
var MAX_TEXT_CHARS = 2e6;
|
|
24484
24639
|
var ATTACHMENT_LIMIT_ENV = [
|
|
@@ -24504,7 +24659,7 @@ var pdfPreviewLimits = /* @__PURE__ */ __name((env = process.env) => {
|
|
|
24504
24659
|
return { pixels, bytes: positive(env, "MESSAGING_PDF_PREVIEW_MAX_MIB", 8 * 1024 * 1024, 1024 * 1024) };
|
|
24505
24660
|
}, "pdfPreviewLimits");
|
|
24506
24661
|
|
|
24507
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24662
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/ulid.js
|
|
24508
24663
|
import { randomBytes } from "node:crypto";
|
|
24509
24664
|
var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
24510
24665
|
var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
|
|
@@ -24517,7 +24672,7 @@ var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
|
|
|
24517
24672
|
return time3 + random;
|
|
24518
24673
|
}, "ulid");
|
|
24519
24674
|
|
|
24520
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24675
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/document-metadata.js
|
|
24521
24676
|
var FOLDED_FIELDS = ["title", "site", "language", "author"];
|
|
24522
24677
|
var encodeDocumentMetadata = /* @__PURE__ */ __name((meta, sections) => {
|
|
24523
24678
|
if (!meta && !sections?.length)
|
|
@@ -24538,7 +24693,7 @@ var languageOf = /* @__PURE__ */ __name((meta) => {
|
|
|
24538
24693
|
return typeof language === "string" && language !== "" ? language : null;
|
|
24539
24694
|
}, "languageOf");
|
|
24540
24695
|
|
|
24541
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24696
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/files.js
|
|
24542
24697
|
var isObject2 = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "isObject");
|
|
24543
24698
|
var objectOf2 = /* @__PURE__ */ __name((value) => {
|
|
24544
24699
|
if (isObject2(value))
|
|
@@ -24781,7 +24936,7 @@ var filesStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
|
|
|
24781
24936
|
};
|
|
24782
24937
|
}, "filesStoreOver");
|
|
24783
24938
|
|
|
24784
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24939
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/imported-documents.js
|
|
24785
24940
|
var IMPORTED_DOCUMENT_QUERY = defineQuery({
|
|
24786
24941
|
entity: "document",
|
|
24787
24942
|
backend: "sql",
|
|
@@ -24827,7 +24982,7 @@ var importedDocumentWhere = /* @__PURE__ */ __name((database, query) => {
|
|
|
24827
24982
|
return queryFilter(validateQuery(query, IMPORTED_DOCUMENT_QUERY), columns);
|
|
24828
24983
|
}, "importedDocumentWhere");
|
|
24829
24984
|
|
|
24830
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24985
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/note-dates.js
|
|
24831
24986
|
var dateFileNotes = /* @__PURE__ */ __name((database, folder, dates) => {
|
|
24832
24987
|
const fileAt = database.prepare("SELECT id, document_id FROM files WHERE account_id = ? AND external_id = ? AND kind <> 'folder' AND deleted_at IS NULL");
|
|
24833
24988
|
const legacy = database.prepare("SELECT id FROM documents WHERE account_id = ? AND external_id = ? AND deleted_at IS NULL");
|
|
@@ -24848,7 +25003,7 @@ var dateFileNotes = /* @__PURE__ */ __name((database, folder, dates) => {
|
|
|
24848
25003
|
return changed;
|
|
24849
25004
|
}, "dateFileNotes");
|
|
24850
25005
|
|
|
24851
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25006
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/text-input.js
|
|
24852
25007
|
var textOf2 = /* @__PURE__ */ __name((text6, what, max = 1e5, allowEmpty = false) => {
|
|
24853
25008
|
const value = text6.trim();
|
|
24854
25009
|
if (!value && !allowEmpty || value.length > max)
|
|
@@ -24861,7 +25016,7 @@ var oneOf = /* @__PURE__ */ __name((value, allowed, what) => {
|
|
|
24861
25016
|
return value;
|
|
24862
25017
|
}, "oneOf");
|
|
24863
25018
|
|
|
24864
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25019
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/notes.js
|
|
24865
25020
|
var NOTE_FORMATS = ["obsidian", "markdown"];
|
|
24866
25021
|
var iso3 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
|
|
24867
25022
|
var optionalIso = /* @__PURE__ */ __name((value) => value == null ? null : iso3(value), "optionalIso");
|
|
@@ -25394,7 +25549,7 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
25394
25549
|
};
|
|
25395
25550
|
}, "notesStoreOver");
|
|
25396
25551
|
|
|
25397
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25552
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/memories.js
|
|
25398
25553
|
var NAMED = "SELECT m.*, b.name AS author_name, b.kind AS author_kind FROM memories m LEFT JOIN bots b ON m.author_type = 'bot' AND b.id = m.author_id";
|
|
25399
25554
|
var iso4 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
|
|
25400
25555
|
var oneOf2 = /* @__PURE__ */ __name((value, allowed, what) => {
|
|
@@ -25653,7 +25808,7 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
25653
25808
|
};
|
|
25654
25809
|
}, "memoriesStoreOver");
|
|
25655
25810
|
|
|
25656
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25811
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/task-first-pass.js
|
|
25657
25812
|
var DEFAULT_FIRST_PASS_PER_CHAT = 0;
|
|
25658
25813
|
var KEY = "taskFirstPassPerChat";
|
|
25659
25814
|
var firstPassPerChatOf = /* @__PURE__ */ __name((value, setting = "task_first_pass_per_chat") => {
|
|
@@ -25673,7 +25828,7 @@ var saveFirstPassPerChat = /* @__PURE__ */ __name((database, value, now2) => {
|
|
|
25673
25828
|
database.prepare("INSERT INTO store_settings (key, value, at) VALUES (?, ?, ?) ON CONFLICT (key) DO UPDATE SET value = excluded.value, at = excluded.at").run(KEY, String(value), now2);
|
|
25674
25829
|
}, "saveFirstPassPerChat");
|
|
25675
25830
|
|
|
25676
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25831
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/domain/external-links.js
|
|
25677
25832
|
var EXTERNAL_SERVICE = /^[a-z][a-z0-9-]{0,31}$/;
|
|
25678
25833
|
var EXTERNAL_ID_CHARS = 200;
|
|
25679
25834
|
var SOURCE_URL_CHARS = 2e3;
|
|
@@ -25700,7 +25855,7 @@ var sourceUrlOf = /* @__PURE__ */ __name((value, reason = "task.source-url") =>
|
|
|
25700
25855
|
return text6;
|
|
25701
25856
|
}, "sourceUrlOf");
|
|
25702
25857
|
|
|
25703
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25858
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/task-board.js
|
|
25704
25859
|
var TASK_SORTS = ["priority", "due", "created", "updated", "key", "state"];
|
|
25705
25860
|
var field = /* @__PURE__ */ __name((name, type, example, more = {}) => ({
|
|
25706
25861
|
name,
|
|
@@ -25923,7 +26078,7 @@ var withoutField = /* @__PURE__ */ __name((query, name) => {
|
|
|
25923
26078
|
return root === void 0 ? void 0 : { ...query, root };
|
|
25924
26079
|
}, "withoutField");
|
|
25925
26080
|
|
|
25926
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26081
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/task-comments.js
|
|
25927
26082
|
var authorNamed = /* @__PURE__ */ __name((database, row2) => {
|
|
25928
26083
|
if (row2.author_type == null)
|
|
25929
26084
|
return null;
|
|
@@ -25951,7 +26106,7 @@ var addComment = /* @__PURE__ */ __name((context, task, body2, by) => {
|
|
|
25951
26106
|
return commentsOf(database, task).find((one2) => one2.ref === `note:${made}`);
|
|
25952
26107
|
}, "addComment");
|
|
25953
26108
|
|
|
25954
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26109
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/task-relations.js
|
|
25955
26110
|
var TASK_RELATION_KINDS = [
|
|
25956
26111
|
"blocked-by",
|
|
25957
26112
|
"follow-up-of",
|
|
@@ -26081,7 +26236,7 @@ var taskRelationsStoreOver = /* @__PURE__ */ __name((context, record4) => {
|
|
|
26081
26236
|
};
|
|
26082
26237
|
}, "taskRelationsStoreOver");
|
|
26083
26238
|
|
|
26084
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26239
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/work-tasks.js
|
|
26085
26240
|
var TASK_ROLES = ["assignee", "reviewer", "watcher"];
|
|
26086
26241
|
var TASK_EVENT_KINDS = [
|
|
26087
26242
|
"created",
|
|
@@ -26635,7 +26790,7 @@ var workTasksOver = /* @__PURE__ */ __name((context) => {
|
|
|
26635
26790
|
};
|
|
26636
26791
|
}, "workTasksOver");
|
|
26637
26792
|
|
|
26638
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26793
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close-store.js
|
|
26639
26794
|
var taskCloseOver = /* @__PURE__ */ __name((context) => {
|
|
26640
26795
|
const { database, now: now2 } = context;
|
|
26641
26796
|
const liveRow = /* @__PURE__ */ __name((id2) => {
|
|
@@ -26684,7 +26839,7 @@ var taskCloseOver = /* @__PURE__ */ __name((context) => {
|
|
|
26684
26839
|
};
|
|
26685
26840
|
}, "taskCloseOver");
|
|
26686
26841
|
|
|
26687
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26842
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/task-pairs.js
|
|
26688
26843
|
var TASK_PAIR_DECISIONS = ["review", "unsure", "merged", "rejected", "unmerged", "attached", "new"];
|
|
26689
26844
|
var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
|
|
26690
26845
|
const { database, now: now2 } = context;
|
|
@@ -26903,7 +27058,7 @@ var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
|
|
|
26903
27058
|
};
|
|
26904
27059
|
}, "taskPairsOver");
|
|
26905
27060
|
|
|
26906
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27061
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/task-stats.js
|
|
26907
27062
|
var ACCOUNT_SCOPE = "t.package_id IS NOT NULL AND t.deleted_at IS NULL AND t.project_id = ?";
|
|
26908
27063
|
var TASK_STATS_SQL = {
|
|
26909
27064
|
rows: /* @__PURE__ */ __name((board, filter) => `SELECT t.source_group, t.source_kind, t.project_id, t.status, t.created_at, t.closed_at FROM tasks t WHERE ${board ? BOARD_SCOPE : ACCOUNT_SCOPE}${filter} ORDER BY t.created_at, t.id`, "rows"),
|
|
@@ -26942,7 +27097,7 @@ var taskStatsOver = /* @__PURE__ */ __name(({ database }, inbox) => ({
|
|
|
26942
27097
|
}, "statNames")
|
|
26943
27098
|
}), "taskStatsOver");
|
|
26944
27099
|
|
|
26945
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27100
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/tasks.js
|
|
26946
27101
|
var COLUMNS3 = "t.id AS row_id, t.package_id, t.source_locator, t.source_kind, t.source_group, t.type, t.status, t.close_reason, t.source, t.created_at, t.due_at, t.closed_at, t.closed_by_type, t.closed_by_id, t.key, t.category, t.claimed_by, t.claimed_until, p.name AS account";
|
|
26947
27102
|
var inboxProject = /* @__PURE__ */ __name(({ database, now: now2 }, account, create) => {
|
|
26948
27103
|
const key2 = inboxKey(account);
|
|
@@ -27149,7 +27304,7 @@ var oneOf3 = /* @__PURE__ */ __name((values, value, column2) => {
|
|
|
27149
27304
|
throw new CliError("configuration_error", `the store holds a task with an unknown ${column2} "${String(value)}"`);
|
|
27150
27305
|
}, "oneOf");
|
|
27151
27306
|
|
|
27152
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27307
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/accounts.js
|
|
27153
27308
|
var accountAccountsOver = /* @__PURE__ */ __name((context) => {
|
|
27154
27309
|
const { database } = context;
|
|
27155
27310
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2 } = keysOver(context);
|
|
@@ -27182,6 +27337,7 @@ var accountsStoreOver = /* @__PURE__ */ __name((context, keyed) => {
|
|
|
27182
27337
|
accountGroups: /* @__PURE__ */ __name(async () => accountGroupsOf(database), "accountGroups"),
|
|
27183
27338
|
profiles: /* @__PURE__ */ __name(async () => profilesOf2(database), "profiles"),
|
|
27184
27339
|
saveProfile: /* @__PURE__ */ __name(async (app, profile, key2) => write(database, () => saveProfile(database, app, profile, key2, context.now())), "saveProfile"),
|
|
27340
|
+
forgetProfile: /* @__PURE__ */ __name(async (app, profile) => write(database, () => forgetProfile(database, app, profile, context.now())), "forgetProfile"),
|
|
27185
27341
|
registerProvider: /* @__PURE__ */ __name(async (entry2) => registerProvider(database, entry2, context.now()), "registerProvider"),
|
|
27186
27342
|
saveAccountGroup: /* @__PURE__ */ __name(async (name, members2) => write(database, () => {
|
|
27187
27343
|
const groups = accountGroupsOf(database);
|
|
@@ -27194,7 +27350,7 @@ var accountsStoreOver = /* @__PURE__ */ __name((context, keyed) => {
|
|
|
27194
27350
|
};
|
|
27195
27351
|
}, "accountsStoreOver");
|
|
27196
27352
|
|
|
27197
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27353
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/attachments.js
|
|
27198
27354
|
var refColumn = /* @__PURE__ */ __name((ref3) => ref3 && Object.keys(ref3).length > 0 ? { providerRef: JSON.stringify(ref3) } : {}, "refColumn");
|
|
27199
27355
|
var updatePlaced = /* @__PURE__ */ __name(({ orm }, chatKey, messageId, files2, change) => {
|
|
27200
27356
|
const message3 = orm.select({ pk: messages.id }).from(messages).where(and(eq(messages.chatId, chatKey), eq(messages.externalId, messageId))).get();
|
|
@@ -27218,7 +27374,7 @@ var keepDownloads = /* @__PURE__ */ __name((context, chatKey, messageId, files2)
|
|
|
27218
27374
|
})), "keepDownloads");
|
|
27219
27375
|
var keepProviderRefs = /* @__PURE__ */ __name((context, chatKey, messageId, files2) => updatePlaced(context, chatKey, messageId, files2.filter((file) => Object.keys(file.providerRef).length > 0), (file) => refColumn(file.providerRef)), "keepProviderRefs");
|
|
27220
27376
|
|
|
27221
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27377
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/attachments.js
|
|
27222
27378
|
var accountAttachmentsOver = /* @__PURE__ */ __name((context) => {
|
|
27223
27379
|
const { database } = context;
|
|
27224
27380
|
const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
|
|
@@ -27275,7 +27431,7 @@ var attachmentsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
27275
27431
|
}, "keepAttachmentText")
|
|
27276
27432
|
}), "attachmentsStoreOver");
|
|
27277
27433
|
|
|
27278
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27434
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-rekey.js
|
|
27279
27435
|
var chatRow = /* @__PURE__ */ __name((context, accountKey, chatId) => context.database.prepare("SELECT * FROM chats WHERE account_id = ? AND external_id = ?").get(accountKey, chatId), "chatRow");
|
|
27280
27436
|
var pointerMover = /* @__PURE__ */ __name((context, type) => {
|
|
27281
27437
|
const statements = pointerPairs(context.database).filter(({ table }) => table !== "involvements").map(({ table, pointer }) => {
|
|
@@ -27460,7 +27616,7 @@ var rekeyChats = /* @__PURE__ */ __name((context, key2, accountKey, pairs, lockM
|
|
|
27460
27616
|
return done;
|
|
27461
27617
|
}, "rekeyChats");
|
|
27462
27618
|
|
|
27463
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27619
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/completeness.js
|
|
27464
27620
|
var historyStartKey = /* @__PURE__ */ __name((chatId) => `history_start:${chatId}`, "historyStartKey");
|
|
27465
27621
|
var fetchedKey = /* @__PURE__ */ __name((chatId) => `fetched:${chatId}`, "fetchedKey");
|
|
27466
27622
|
var CHAT_LIST_KEY = "chat_list_complete";
|
|
@@ -27518,7 +27674,7 @@ var chatCoverage = /* @__PURE__ */ __name(({ database }, accountKey) => {
|
|
|
27518
27674
|
return { ...coverage, oldestMessageAt: toIso(oldest) };
|
|
27519
27675
|
}, "chatCoverage");
|
|
27520
27676
|
|
|
27521
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27677
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/chats.js
|
|
27522
27678
|
var chatsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
27523
27679
|
const { database } = context;
|
|
27524
27680
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, writeState: writeState2 } = keysOver(context);
|
|
@@ -27653,7 +27809,7 @@ var chatsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
27653
27809
|
};
|
|
27654
27810
|
}, "chatsStoreOver");
|
|
27655
27811
|
|
|
27656
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27812
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/batches.js
|
|
27657
27813
|
import { createHash as createHash7 } from "node:crypto";
|
|
27658
27814
|
var BATCH_CONTEXT = 50;
|
|
27659
27815
|
var replied = /* @__PURE__ */ __name((m) => sql`EXISTS (SELECT 1 FROM messages p WHERE p.chat_id = ${m}.chat_id
|
|
@@ -27791,7 +27947,7 @@ var saveAnswers = /* @__PURE__ */ __name((context, id2, answer) => {
|
|
|
27791
27947
|
var clearAnswers = /* @__PURE__ */ __name(({ orm }, chatKey, model) => Number(orm.all(sql`DELETE FROM message_links WHERE chat_id = ${chatKey} AND source = 'agent'
|
|
27792
27948
|
${model === void 0 ? sql`` : sql`AND method = ${model}`} RETURNING 1 AS n`).length), "clearAnswers");
|
|
27793
27949
|
|
|
27794
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27950
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/conversations.js
|
|
27795
27951
|
import { setTimeout } from "node:timers/promises";
|
|
27796
27952
|
var position = /* @__PURE__ */ __name((sentAt, pk) => `${sentAt}:${pk}`, "position");
|
|
27797
27953
|
var linkInputs = /* @__PURE__ */ __name(({ orm }, chatKey, { after: after2, limit }) => {
|
|
@@ -28103,7 +28259,7 @@ var agentAnswers = /* @__PURE__ */ __name(({ orm }, chatKey) => new Map(orm.all(
|
|
|
28103
28259
|
AND NOT EXISTS (SELECT 1 FROM messages d
|
|
28104
28260
|
WHERE d.id IN (l.message_id, l.parent_id) AND d.deleted_at > l.created_at)`).map(({ id: id2, parent: parent2 }) => [id2, parent2])), "agentAnswers");
|
|
28105
28261
|
|
|
28106
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28262
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/conversations.js
|
|
28107
28263
|
var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
28108
28264
|
const { database } = context;
|
|
28109
28265
|
const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
|
|
@@ -28210,7 +28366,7 @@ var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
28210
28366
|
};
|
|
28211
28367
|
}, "conversationsStoreOver");
|
|
28212
28368
|
|
|
28213
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28369
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/counters.js
|
|
28214
28370
|
var LIVE_MESSAGE = "SELECT m.id AS pk FROM messages m JOIN chats c ON c.id=m.chat_id JOIN accounts ac ON ac.id=m.account_id WHERE ac.provider=? AND ac.external_id=? AND c.external_id=? AND m.external_id=? AND m.deleted_at IS NULL";
|
|
28215
28371
|
var accountCountersOver = /* @__PURE__ */ __name((context) => {
|
|
28216
28372
|
const { database } = context;
|
|
@@ -28235,7 +28391,7 @@ var countersStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
28235
28391
|
counterTargets: /* @__PURE__ */ __name(async (execution, options) => counterTargets(context, execution, options), "counterTargets")
|
|
28236
28392
|
}), "countersStoreOver");
|
|
28237
28393
|
|
|
28238
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28394
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/mentions.js
|
|
28239
28395
|
var MENTION_STATUSES = ["found", "linked", "dismissed"];
|
|
28240
28396
|
var MENTION_QUERY = defineQuery({
|
|
28241
28397
|
entity: "mention",
|
|
@@ -28451,7 +28607,7 @@ var listPlaces = /* @__PURE__ */ __name((database, { limit, offset }) => {
|
|
|
28451
28607
|
return { items: hasMore ? rows.slice(0, limit) : rows, hasMore };
|
|
28452
28608
|
}, "listPlaces");
|
|
28453
28609
|
|
|
28454
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28610
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/mentions.js
|
|
28455
28611
|
var accountMentionsOver = /* @__PURE__ */ __name((context) => {
|
|
28456
28612
|
const { database } = context;
|
|
28457
28613
|
const { findAccountPk: findAccountPk2 } = keysOver(context);
|
|
@@ -28486,7 +28642,7 @@ var mentionsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
28486
28642
|
places: /* @__PURE__ */ __name(async (window) => listPlaces(context.database, window), "places")
|
|
28487
28643
|
}), "mentionsStoreOver");
|
|
28488
28644
|
|
|
28489
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28645
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/document-links.js
|
|
28490
28646
|
var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messageId) => {
|
|
28491
28647
|
const read3 = database.prepare("SELECT m.id, m.external_id, m.text, m.sent_at, m.sender_name, coalesce(m.sender_chat_external_id, i.external_id) AS sender_id FROM messages m LEFT JOIN identities i ON i.id = m.sender_identity_id WHERE m.chat_id = ? AND m.deleted_at IS NULL AND (m.text LIKE '%google.com%' OR m.text LIKE '%forms.gle%') " + (messageId === void 0 ? "" : "AND m.external_id = ? ") + "ORDER BY m.sent_at DESC, m.id DESC");
|
|
28492
28648
|
const rows = messageId === void 0 ? read3.all(chatKey) : read3.all(chatKey, messageId);
|
|
@@ -28501,7 +28657,7 @@ var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messag
|
|
|
28501
28657
|
}));
|
|
28502
28658
|
}, "documentLinkMessages");
|
|
28503
28659
|
|
|
28504
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28660
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/follow-ups.js
|
|
28505
28661
|
var stemmerFor = stemmerCache();
|
|
28506
28662
|
var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit }) => {
|
|
28507
28663
|
if (wanted.length > 50 || !Number.isInteger(limit) || limit < 1 || limit > 100)
|
|
@@ -28545,7 +28701,7 @@ var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit
|
|
|
28545
28701
|
});
|
|
28546
28702
|
}, "laterSharingRare");
|
|
28547
28703
|
|
|
28548
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28704
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/messages.js
|
|
28549
28705
|
var accountMessagesOver = /* @__PURE__ */ __name((context) => {
|
|
28550
28706
|
const { database } = context;
|
|
28551
28707
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf, chatPkFor: chatPkFor2, answeredChatPk: answeredChatPk2, upsertMessage: upsertMessage2 } = keysOver(context);
|
|
@@ -28680,7 +28836,7 @@ var messagesStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
28680
28836
|
laterSharingRare: /* @__PURE__ */ __name(async (wanted, options) => laterSharingRare(context, wanted, options), "laterSharingRare")
|
|
28681
28837
|
}), "messagesStoreOver");
|
|
28682
28838
|
|
|
28683
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28839
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/person-preparation.js
|
|
28684
28840
|
var GLOBAL_PROJECT = "SELECT id FROM main.projects WHERE account_id IS NULL AND deleted_at IS NULL";
|
|
28685
28841
|
var iso6 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
|
|
28686
28842
|
var personPreparation = /* @__PURE__ */ __name(({ database, now: now2 }, uid, { accounts: accounts2, limit }) => {
|
|
@@ -28737,7 +28893,7 @@ var personPreparation = /* @__PURE__ */ __name(({ database, now: now2 }, uid, {
|
|
|
28737
28893
|
});
|
|
28738
28894
|
}, "personPreparation");
|
|
28739
28895
|
|
|
28740
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28896
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/person-scope.js
|
|
28741
28897
|
var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds) => {
|
|
28742
28898
|
const id2 = Number(uid);
|
|
28743
28899
|
if (!/^[1-9]\d*$/.test(uid) || !Number.isSafeInteger(id2) || !accountIds.length || accountIds.length > 1e3 || accountIds.some((account) => !Number.isSafeInteger(account) || account <= 0))
|
|
@@ -28745,7 +28901,7 @@ var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds
|
|
|
28745
28901
|
return Boolean(database.prepare("SELECT 1 FROM persons p JOIN identity_links l ON l.person_id=p.id JOIN account_identities a ON a.identity_id=l.identity_id WHERE p.id=? AND a.account_id IN (SELECT value FROM json_each(?)) LIMIT 1").get(id2, JSON.stringify(accountIds)));
|
|
28746
28902
|
}, "personSeenInAccounts");
|
|
28747
28903
|
|
|
28748
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28904
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/private-people.js
|
|
28749
28905
|
var required2 = /* @__PURE__ */ __name(({ database }, key2, personId) => {
|
|
28750
28906
|
const row2 = database.prepare("SELECT a.id AS account_id, i.id AS identity_id FROM accounts a JOIN account_identities ai ON ai.account_id=a.id JOIN identities i ON i.id=ai.identity_id WHERE a.provider=? AND a.external_id=? AND i.provider=? AND i.external_id=?").get(key2.provider, key2.account, key2.provider, personId);
|
|
28751
28907
|
if (!row2)
|
|
@@ -28812,7 +28968,7 @@ var removeNote = /* @__PURE__ */ __name((context, key2, personId, id2) => {
|
|
|
28812
28968
|
return { id: id2, personId, removed: true };
|
|
28813
28969
|
}, "removeNote");
|
|
28814
28970
|
|
|
28815
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28971
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/people.js
|
|
28816
28972
|
var accountPeopleOver = /* @__PURE__ */ __name((context) => {
|
|
28817
28973
|
const { database } = context;
|
|
28818
28974
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, identityPk: identityPk2 } = keysOver(context);
|
|
@@ -28897,13 +29053,13 @@ var peopleStoreOver = /* @__PURE__ */ __name((context, keyed) => {
|
|
|
28897
29053
|
};
|
|
28898
29054
|
}, "peopleStoreOver");
|
|
28899
29055
|
|
|
28900
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29056
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
|
|
28901
29057
|
import { createHash as createHash9 } from "node:crypto";
|
|
28902
29058
|
|
|
28903
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29059
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
|
|
28904
29060
|
import { createHash as createHash8 } from "node:crypto";
|
|
28905
29061
|
|
|
28906
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29062
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/domain/rankings-graph.js
|
|
28907
29063
|
var RANKING_GRAPH_LIMITS = { nodes: 5e4, depth: 256, work: 1e7, bytes: 8388608 };
|
|
28908
29064
|
var exhausted2 = /* @__PURE__ */ __name((budget) => {
|
|
28909
29065
|
throw new CliError("validation_error", `ranking exceeded ${budget} \u2014 narrow its chat or date scope`, {
|
|
@@ -29125,7 +29281,7 @@ var rankReplyGraph = /* @__PURE__ */ __name((nodes, check3 = () => {
|
|
|
29125
29281
|
};
|
|
29126
29282
|
}, "rankReplyGraph");
|
|
29127
29283
|
|
|
29128
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29284
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
|
|
29129
29285
|
var adminEntityKey = /* @__PURE__ */ __name((row2) => JSON.stringify([row2.account.provider, row2.account.account, row2.id]), "adminEntityKey");
|
|
29130
29286
|
var personKey = /* @__PURE__ */ __name((node) => JSON.stringify([node.account.provider, node.account.account, node.sender]), "personKey");
|
|
29131
29287
|
var locator = /* @__PURE__ */ __name((node) => formatLocator({ ...node.account, chat: node.chatId, message: node.id }), "locator");
|
|
@@ -29299,7 +29455,7 @@ var calculateAdminStatistics = /* @__PURE__ */ __name((nodes, stays, options, in
|
|
|
29299
29455
|
return { items, evidence, summary, graph: graph.quality };
|
|
29300
29456
|
}, "calculateAdminStatistics");
|
|
29301
29457
|
|
|
29302
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29458
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/domain/rankings-range.js
|
|
29303
29459
|
var rankingContextRange = /* @__PURE__ */ __name((root) => {
|
|
29304
29460
|
const dates = [];
|
|
29305
29461
|
const visit = /* @__PURE__ */ __name((node, required3) => {
|
|
@@ -29321,7 +29477,7 @@ var rankingContextRange = /* @__PURE__ */ __name((root) => {
|
|
|
29321
29477
|
return dates[0].node.resolution.date;
|
|
29322
29478
|
}, "rankingContextRange");
|
|
29323
29479
|
|
|
29324
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29480
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/rankings.js
|
|
29325
29481
|
var reactionCounts = /* @__PURE__ */ __name((stored4) => {
|
|
29326
29482
|
let counts;
|
|
29327
29483
|
try {
|
|
@@ -29616,7 +29772,7 @@ var rankQuery = /* @__PURE__ */ __name((context, execution, request, inspect) =>
|
|
|
29616
29772
|
});
|
|
29617
29773
|
}, "rankQuery");
|
|
29618
29774
|
|
|
29619
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29775
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
|
|
29620
29776
|
function fail4(message3, reason = "query.too-large") {
|
|
29621
29777
|
throw new CliError("validation_error", message3, { reason, complete: false });
|
|
29622
29778
|
}
|
|
@@ -29793,7 +29949,7 @@ var adminStatisticsQuery = /* @__PURE__ */ __name((context, execution, request)
|
|
|
29793
29949
|
return result;
|
|
29794
29950
|
}), "adminStatisticsQuery");
|
|
29795
29951
|
|
|
29796
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29952
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/conversation-eligibility.js
|
|
29797
29953
|
var conversationEligibility = /* @__PURE__ */ __name(async (context, execution) => {
|
|
29798
29954
|
if (!execution.accounts.length)
|
|
29799
29955
|
return { conversations: [], chats: [] };
|
|
@@ -29811,7 +29967,7 @@ var conversationEligibility = /* @__PURE__ */ __name(async (context, execution)
|
|
|
29811
29967
|
return { conversations: conversations2, chats: chats2 };
|
|
29812
29968
|
}, "conversationEligibility");
|
|
29813
29969
|
|
|
29814
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29970
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/ranking-evidence.js
|
|
29815
29971
|
import { createHash as createHash10 } from "node:crypto";
|
|
29816
29972
|
var EVIDENCE_BYTES = 64 * 1024;
|
|
29817
29973
|
var FINGERPRINT_BYTES = 8 * 1024 * 1024;
|
|
@@ -29961,7 +30117,7 @@ var rankingEvidence = /* @__PURE__ */ __name((context, execution, request) => {
|
|
|
29961
30117
|
return result;
|
|
29962
30118
|
}, "rankingEvidence");
|
|
29963
30119
|
|
|
29964
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30120
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/reply-times.js
|
|
29965
30121
|
var FAR = Number.MAX_SAFE_INTEGER;
|
|
29966
30122
|
var chatsIn = /* @__PURE__ */ __name((scope3, kinds2) => {
|
|
29967
30123
|
const params = [...scope3.accounts.flatMap(({ provider, account }) => [provider, account]), ...kinds2];
|
|
@@ -30055,7 +30211,7 @@ var waitingChats = /* @__PURE__ */ __name((context, scope3, waits, cap) => {
|
|
|
30055
30211
|
});
|
|
30056
30212
|
}, "waitingChats");
|
|
30057
30213
|
|
|
30058
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30214
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/queries.js
|
|
30059
30215
|
var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
|
|
30060
30216
|
const mailIndexed = /* @__PURE__ */ __name((execution) => {
|
|
30061
30217
|
if (execution.corpus === "mail")
|
|
@@ -30076,7 +30232,7 @@ var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
|
|
|
30076
30232
|
};
|
|
30077
30233
|
}, "queriesStoreOver");
|
|
30078
30234
|
|
|
30079
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30235
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-events.js
|
|
30080
30236
|
var saveChatEvents = /* @__PURE__ */ __name((context, accountKey, provider, chatKey, events3) => {
|
|
30081
30237
|
const { database, now: now2 } = context;
|
|
30082
30238
|
const insert = database.prepare(`INSERT INTO chat_events (chat_id, source_id, action, actor_identity_id, title, happened_at, created_at, updated_at)
|
|
@@ -30115,10 +30271,10 @@ var chatEventsOf = /* @__PURE__ */ __name(({ database }, chatKey, { since = 0, l
|
|
|
30115
30271
|
}));
|
|
30116
30272
|
}, "chatEventsOf");
|
|
30117
30273
|
|
|
30118
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30274
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
|
|
30119
30275
|
import { createHash as createHash11 } from "node:crypto";
|
|
30120
30276
|
|
|
30121
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30277
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/domain/calendar.js
|
|
30122
30278
|
var calendarKey = /* @__PURE__ */ __name((zone, by) => {
|
|
30123
30279
|
const format = new Intl.DateTimeFormat("en-CA", {
|
|
30124
30280
|
timeZone: zone,
|
|
@@ -30138,7 +30294,7 @@ var weekKey = /* @__PURE__ */ __name((day2) => {
|
|
|
30138
30294
|
return date3.toISOString().slice(0, 10);
|
|
30139
30295
|
}, "weekKey");
|
|
30140
30296
|
|
|
30141
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30297
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/domain/retention.js
|
|
30142
30298
|
var RETENTION_TOLERANCE = 864e5;
|
|
30143
30299
|
var validateRetentionOptions = /* @__PURE__ */ __name((options) => {
|
|
30144
30300
|
const { since, until, cutoff, checkpoints, within, limit, by } = options;
|
|
@@ -30192,7 +30348,7 @@ var retentionCohorts = /* @__PURE__ */ __name((stays, options) => {
|
|
|
30192
30348
|
return [...groups.values()].sort((a, b) => a.cohort.localeCompare(b.cohort));
|
|
30193
30349
|
}, "retentionCohorts");
|
|
30194
30350
|
|
|
30195
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30351
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
|
|
30196
30352
|
var iso7 = /* @__PURE__ */ __name((at) => new Date(at).toISOString(), "iso");
|
|
30197
30353
|
var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId, options, evidence) => {
|
|
30198
30354
|
validateRetentionOptions(options);
|
|
@@ -30323,7 +30479,7 @@ var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId
|
|
|
30323
30479
|
};
|
|
30324
30480
|
}, "retentionQuery");
|
|
30325
30481
|
|
|
30326
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30482
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/roster.js
|
|
30327
30483
|
var iso8 = /* @__PURE__ */ __name((ms) => ms === null ? null : new Date(ms).toISOString(), "iso");
|
|
30328
30484
|
var marksOf = /* @__PURE__ */ __name(({ isBot, flagged, deleted, hasPhoto }) => ({
|
|
30329
30485
|
...isBot === void 0 ? {} : { bot: isBot },
|
|
@@ -30454,7 +30610,7 @@ var trackedChats = /* @__PURE__ */ __name((context, accountKey, where) => contex
|
|
|
30454
30610
|
lastCount: memberCountsOf(context, pk).at(-1) ?? null
|
|
30455
30611
|
})), "trackedChats");
|
|
30456
30612
|
|
|
30457
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30613
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/roster.js
|
|
30458
30614
|
var rosterStoreOver = /* @__PURE__ */ __name((context) => {
|
|
30459
30615
|
const { database } = context;
|
|
30460
30616
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, writeMembers: writeMembers2 } = keysOver(context);
|
|
@@ -30510,7 +30666,7 @@ var rosterStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
30510
30666
|
};
|
|
30511
30667
|
}, "rosterStoreOver");
|
|
30512
30668
|
|
|
30513
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30669
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/backfill.js
|
|
30514
30670
|
var pendingNormalization = /* @__PURE__ */ __name((database) => Number(database.prepare("SELECT count(*) AS n FROM messages WHERE normalized_text IS NULL AND deleted_at IS NULL").get()?.n), "pendingNormalization");
|
|
30515
30671
|
var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatch, until = /* @__PURE__ */ __name(() => false, "until") } = {}) => {
|
|
30516
30672
|
const next = database.prepare(`SELECT id AS pk, text FROM messages WHERE normalized_text IS NULL AND deleted_at IS NULL AND id > ? ORDER BY id LIMIT ?`);
|
|
@@ -30534,7 +30690,7 @@ var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatc
|
|
|
30534
30690
|
}
|
|
30535
30691
|
}, "backfillNormalized");
|
|
30536
30692
|
|
|
30537
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30693
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/search-index.js
|
|
30538
30694
|
var INDEX2 = "message_words";
|
|
30539
30695
|
var searchIndexState2 = /* @__PURE__ */ __name((database) => {
|
|
30540
30696
|
const row2 = indexRow(database, INDEX2);
|
|
@@ -30661,7 +30817,7 @@ var resetSearchIndex = /* @__PURE__ */ __name((database) => {
|
|
|
30661
30817
|
});
|
|
30662
30818
|
}, "resetSearchIndex");
|
|
30663
30819
|
|
|
30664
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30820
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/stems-fill.js
|
|
30665
30821
|
var fillStems = /* @__PURE__ */ __name((database, { batch = 5e3, until = /* @__PURE__ */ __name(() => false, "until"), onBatch, now: now2 = Date.now } = {}) => {
|
|
30666
30822
|
const filled2 = { stemmed: 0, drained: 0 };
|
|
30667
30823
|
const before2 = stemsState(database);
|
|
@@ -30756,7 +30912,7 @@ var followDefaultStemmers = /* @__PURE__ */ __name((database, now2 = Date.now) =
|
|
|
30756
30912
|
return resetStems(database, { now: now2 });
|
|
30757
30913
|
}, "followDefaultStemmers");
|
|
30758
30914
|
|
|
30759
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30915
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/words.js
|
|
30760
30916
|
var VOCABULARY = "SELECT term, doc FROM message_words_vocab WHERE col = 'normalized_text'";
|
|
30761
30917
|
var knownTerms = /* @__PURE__ */ __name(({ database }, terms2) => {
|
|
30762
30918
|
const lookup = database.prepare(`${VOCABULARY} AND term >= ? AND term <= ? LIMIT 1`);
|
|
@@ -30778,7 +30934,7 @@ var termCandidates = /* @__PURE__ */ __name(({ database }, pieces, { shortest, l
|
|
|
30778
30934
|
});
|
|
30779
30935
|
}, "termCandidates");
|
|
30780
30936
|
|
|
30781
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30937
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/search-index.js
|
|
30782
30938
|
var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
|
|
30783
30939
|
const { database } = context;
|
|
30784
30940
|
const stemmerFor2 = stemmerCache();
|
|
@@ -30802,7 +30958,7 @@ var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
30802
30958
|
};
|
|
30803
30959
|
}, "searchIndexStoreOver");
|
|
30804
30960
|
|
|
30805
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30961
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/searches.js
|
|
30806
30962
|
var HISTORY_KEPT = 1e3;
|
|
30807
30963
|
var commandFilter = /* @__PURE__ */ __name((commands) => commands ? { sql: ` AND command IN (${commands.map(() => "?").join(", ")})`, values: [...commands] } : { sql: "", values: [] }, "commandFilter");
|
|
30808
30964
|
var COLUMNS5 = "id, name, command, params, language, version, fields_version, created_at, updated_at, last_run_at, runs";
|
|
@@ -30871,7 +31027,7 @@ var clearHistory = /* @__PURE__ */ __name(({ database }, commands) => {
|
|
|
30871
31027
|
return database.prepare(`DELETE FROM searches WHERE name IS NULL${only.sql}`).run(...only.values).changes;
|
|
30872
31028
|
}, "clearHistory");
|
|
30873
31029
|
|
|
30874
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31030
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/searches.js
|
|
30875
31031
|
var searchesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
30876
31032
|
const { database } = context;
|
|
30877
31033
|
return {
|
|
@@ -30895,7 +31051,7 @@ var searchesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
30895
31051
|
};
|
|
30896
31052
|
}, "searchesStoreOver");
|
|
30897
31053
|
|
|
30898
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31054
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/added-sources.js
|
|
30899
31055
|
import { createHash as createHash12 } from "node:crypto";
|
|
30900
31056
|
var ADDED_KINDS = ["text", "file", "page"];
|
|
30901
31057
|
var sha256 = /* @__PURE__ */ __name((value) => createHash12("sha256").update(value).digest("hex"), "sha256");
|
|
@@ -31075,7 +31231,7 @@ var addedSourcesOver = /* @__PURE__ */ __name((context) => {
|
|
|
31075
31231
|
};
|
|
31076
31232
|
}, "addedSourcesOver");
|
|
31077
31233
|
|
|
31078
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31234
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/agent-actions.js
|
|
31079
31235
|
var ACTION_TIERS = ["read", "draft", "write-private", "write-public", "destructive", "admin"];
|
|
31080
31236
|
var ACTION_OUTCOMES = ["ok", "refused", "failed"];
|
|
31081
31237
|
var CODE = /^[a-z][a-z0-9_]{0,63}$/;
|
|
@@ -31118,7 +31274,7 @@ var agentActionsStoreOver = /* @__PURE__ */ __name((context, afterRecord = () =>
|
|
|
31118
31274
|
};
|
|
31119
31275
|
}, "agentActionsStoreOver");
|
|
31120
31276
|
|
|
31121
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31277
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/bot-updates.js
|
|
31122
31278
|
var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
|
|
31123
31279
|
}) => {
|
|
31124
31280
|
const { database, now: now2 } = context;
|
|
@@ -31177,7 +31333,7 @@ var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
|
|
|
31177
31333
|
};
|
|
31178
31334
|
}, "botUpdateStoreOver");
|
|
31179
31335
|
|
|
31180
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31336
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/reviewed.js
|
|
31181
31337
|
var prefixesText = /* @__PURE__ */ __name((types) => `${article(types[0] ?? "")} ${types.map((type) => `${type}:`).join(" or ")}`, "prefixesText");
|
|
31182
31338
|
var refuse = /* @__PURE__ */ __name((message3, reason, code = "validation_error") => {
|
|
31183
31339
|
throw new CliError(code, message3, { reason });
|
|
@@ -31325,7 +31481,7 @@ var reviewedRowsOver = /* @__PURE__ */ __name((context) => {
|
|
|
31325
31481
|
return { partyOf, partyThing, reviewedOf, written, keepEvidence, ownerOnly, linkedId, ...decisionsOver(context) };
|
|
31326
31482
|
}, "reviewedRowsOver");
|
|
31327
31483
|
|
|
31328
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31484
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/business-contracts.js
|
|
31329
31485
|
var CONTRACTS = "SELECT k.*, b.name AS author_name, b.kind AS author_kind FROM contracts k LEFT JOIN bots b ON k.author_type = 'bot' AND b.id = k.author_id";
|
|
31330
31486
|
var DAY_MS = 864e5;
|
|
31331
31487
|
var deadlineOf = /* @__PURE__ */ __name((expiration, days) => expiration === null || days === null ? null : new Date(Date.parse(`${expiration}T00:00:00Z`) - days * DAY_MS).toISOString().slice(0, 10), "deadlineOf");
|
|
@@ -31474,7 +31630,111 @@ var contractsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
31474
31630
|
};
|
|
31475
31631
|
}, "contractsStoreOver");
|
|
31476
31632
|
|
|
31477
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31633
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/business-search.js
|
|
31634
|
+
var BUSINESS_FIND_MAX = 2001;
|
|
31635
|
+
var party = /* @__PURE__ */ __name((kind3, id2, as) => `LEFT JOIN persons ${as}p ON ${kind3} = 'person' AND ${as}p.id = ${id2} AND ${as}p.owner = 0 LEFT JOIN organizations ${as}o ON ${kind3} = 'organization' AND ${as}o.id = ${id2} LEFT JOIN projects ${as}j ON ${kind3} = 'project' AND ${as}j.id = ${id2}`, "party");
|
|
31636
|
+
var partyName = /* @__PURE__ */ __name((as) => `coalesce(${as}p.name, ${as}o.name, ${as}j.name)`, "partyName");
|
|
31637
|
+
var LIVE3 = "x.deleted_at IS NULL";
|
|
31638
|
+
var DECIDED = `${LIVE3} AND x.review <> 'rejected'`;
|
|
31639
|
+
var SEARCHED = {
|
|
31640
|
+
invoice: `SELECT x.id, x.review, x.source, x.updated_at, x.number AS f1, ${partyName("c")} AS f2 FROM invoices x ${party("x.counterparty_type", "x.counterparty_id", "c")} WHERE ${DECIDED}`,
|
|
31641
|
+
payment: `SELECT x.id, x.review, x.source, x.updated_at, x.reference AS f1, ${partyName("r")} AS f2, ${partyName("e")} AS f3 FROM payments x ${party("x.payer_type", "x.payer_id", "r")} ${party("x.payee_type", "x.payee_id", "e")} WHERE ${DECIDED}`,
|
|
31642
|
+
order: `SELECT x.id, x.review, x.source, x.updated_at, x.number AS f1, x.supplier_name AS f2, (SELECT group_concat(description, char(10)) FROM order_lines WHERE order_id = x.id) AS f3 FROM orders x WHERE ${DECIDED}`,
|
|
31643
|
+
contract: `SELECT x.id, x.review, x.source, x.updated_at, x.name AS f1, x.number AS f2 FROM contracts x WHERE ${DECIDED}`,
|
|
31644
|
+
subscription: `SELECT x.id, x.review, x.source, x.updated_at, x.name AS f1 FROM subscriptions x WHERE ${DECIDED}`,
|
|
31645
|
+
product: `SELECT x.id, 'confirmed' AS review, x.source, x.updated_at, x.name AS f1, x.sku AS f2 FROM catalog_items x WHERE ${LIVE3}`,
|
|
31646
|
+
wallet: `SELECT x.id, 'confirmed' AS review, x.source, x.updated_at, x.name AS f1, x.institution AS f2 FROM financial_accounts x WHERE ${LIVE3}`
|
|
31647
|
+
};
|
|
31648
|
+
var FIELDS2 = ["f1", "f2", "f3"];
|
|
31649
|
+
var TEXT_CHARS = 240;
|
|
31650
|
+
var KINDS_SQL = BUSINESS_KINDS.map((kind3) => `'${kind3}'`).join(", ");
|
|
31651
|
+
var IMPORT = "import:";
|
|
31652
|
+
var WORD_CHAR = /[\p{L}\p{N}]/u;
|
|
31653
|
+
var keyOf4 = /* @__PURE__ */ __name(({ provider, account }) => `${provider}\0${account}`, "keyOf");
|
|
31654
|
+
var lineOf2 = /* @__PURE__ */ __name((parts) => {
|
|
31655
|
+
const line = parts.join(" \xB7 ").replace(/\s+/gu, " ").trim();
|
|
31656
|
+
return line.length <= TEXT_CHARS ? line : `${line.slice(0, TEXT_CHARS - 1)}\u2026`;
|
|
31657
|
+
}, "lineOf");
|
|
31658
|
+
var startsAWord = /* @__PURE__ */ __name((folded5, word2) => {
|
|
31659
|
+
for (let at = folded5.indexOf(word2); at !== -1; at = folded5.indexOf(word2, at + 1))
|
|
31660
|
+
if (at === 0 || !WORD_CHAR.test(folded5[at - 1]))
|
|
31661
|
+
return true;
|
|
31662
|
+
return false;
|
|
31663
|
+
}, "startsAWord");
|
|
31664
|
+
var businessSearchOver = /* @__PURE__ */ __name(({ database }) => {
|
|
31665
|
+
const matchedOf = /* @__PURE__ */ __name((kind3, wanted, anyWord) => database.prepare(SEARCHED[kind3]).all().flatMap((row2) => {
|
|
31666
|
+
const parts = FIELDS2.flatMap((field4) => row2[field4] == null ? [] : [String(row2[field4])]);
|
|
31667
|
+
const folded5 = fold(parts.join("\n"));
|
|
31668
|
+
const score = wanted.filter((word2) => startsAWord(folded5, word2)).length;
|
|
31669
|
+
if (anyWord ? score === 0 : score < wanted.length)
|
|
31670
|
+
return [];
|
|
31671
|
+
const source2 = String(row2.source);
|
|
31672
|
+
return [
|
|
31673
|
+
{
|
|
31674
|
+
kind: kind3,
|
|
31675
|
+
id: Number(row2.id),
|
|
31676
|
+
review: row2.review === "proposed" ? "proposed" : "confirmed",
|
|
31677
|
+
imported: source2.startsWith(IMPORT) ? source2.slice(IMPORT.length) : void 0,
|
|
31678
|
+
parts,
|
|
31679
|
+
score,
|
|
31680
|
+
updatedAt: Number(row2.updated_at)
|
|
31681
|
+
}
|
|
31682
|
+
];
|
|
31683
|
+
}), "matchedOf");
|
|
31684
|
+
const sourcesOf2 = /* @__PURE__ */ __name((matched) => {
|
|
31685
|
+
const sources = /* @__PURE__ */ new Map();
|
|
31686
|
+
for (const kind3 of BUSINESS_KINDS) {
|
|
31687
|
+
const ids = matched.filter((one2) => one2.kind === kind3 && one2.imported !== void 0).map(({ id: id2 }) => id2);
|
|
31688
|
+
if (!ids.length)
|
|
31689
|
+
continue;
|
|
31690
|
+
const rows = database.prepare("SELECT r.entity_id, r.external_id, a.provider, a.external_id AS account FROM records r JOIN accounts a ON a.id = r.account_id WHERE r.entity_type = ? AND r.entity_id IN (SELECT value FROM json_each(?)) ORDER BY r.entity_id, (r.deleted_at IS NOT NULL), r.id").all(kind3, JSON.stringify(ids));
|
|
31691
|
+
for (const row2 of rows) {
|
|
31692
|
+
const ref3 = `${kind3}:${row2.entity_id}`;
|
|
31693
|
+
if (!sources.has(ref3))
|
|
31694
|
+
sources.set(ref3, {
|
|
31695
|
+
provider: String(row2.provider),
|
|
31696
|
+
account: String(row2.account),
|
|
31697
|
+
externalId: String(row2.external_id)
|
|
31698
|
+
});
|
|
31699
|
+
}
|
|
31700
|
+
}
|
|
31701
|
+
return sources;
|
|
31702
|
+
}, "sourcesOf");
|
|
31703
|
+
const find2 = /* @__PURE__ */ __name(({ words: words3, anyWord = false, accounts: accounts2, limit }) => {
|
|
31704
|
+
const wanted = [...new Set(words3.map((word2) => fold(word2).trim()).filter(Boolean))];
|
|
31705
|
+
if (!wanted.length)
|
|
31706
|
+
return [];
|
|
31707
|
+
const most = Math.min(Math.max(limit ?? 100, 1), BUSINESS_FIND_MAX);
|
|
31708
|
+
const within = accounts2 === void 0 ? void 0 : new Set(accounts2.map(keyOf4));
|
|
31709
|
+
const matched = BUSINESS_KINDS.flatMap((kind3) => matchedOf(kind3, wanted, anyWord)).sort((a, b) => b.score - a.score || b.updatedAt - a.updatedAt || a.kind.localeCompare(b.kind) || b.id - a.id);
|
|
31710
|
+
const candidates = within === void 0 ? matched.slice(0, most) : matched.filter((one2) => one2.imported);
|
|
31711
|
+
const sources = sourcesOf2(candidates);
|
|
31712
|
+
const kept = within === void 0 ? candidates : candidates.filter((one2) => {
|
|
31713
|
+
const source2 = sources.get(`${one2.kind}:${one2.id}`);
|
|
31714
|
+
return source2 !== void 0 && within.has(keyOf4(source2));
|
|
31715
|
+
}).slice(0, most);
|
|
31716
|
+
return kept.map((one2) => {
|
|
31717
|
+
const ref3 = `${one2.kind}:${one2.id}`;
|
|
31718
|
+
const source2 = sources.get(ref3);
|
|
31719
|
+
return {
|
|
31720
|
+
kind: one2.kind,
|
|
31721
|
+
ref: ref3,
|
|
31722
|
+
review: one2.review,
|
|
31723
|
+
...one2.imported === void 0 ? {} : { imported: one2.imported },
|
|
31724
|
+
...source2 === void 0 ? {} : { source: source2 },
|
|
31725
|
+
text: lineOf2(one2.parts),
|
|
31726
|
+
updatedAt: one2.updatedAt
|
|
31727
|
+
};
|
|
31728
|
+
});
|
|
31729
|
+
}, "find");
|
|
31730
|
+
const sourceAccounts = /* @__PURE__ */ __name(() => database.prepare(`SELECT DISTINCT a.provider, a.external_id AS account FROM records r JOIN accounts a ON a.id = r.account_id WHERE r.entity_type IN (${KINDS_SQL}) AND r.entity_id IS NOT NULL AND r.deleted_at IS NULL ORDER BY a.provider, a.external_id`).all().map((row2) => ({ provider: String(row2.provider), account: String(row2.account) })), "sourceAccounts");
|
|
31731
|
+
return {
|
|
31732
|
+
find: /* @__PURE__ */ __name(async (search2) => find2(search2), "find"),
|
|
31733
|
+
accounts: /* @__PURE__ */ __name(async () => sourceAccounts(), "accounts")
|
|
31734
|
+
};
|
|
31735
|
+
}, "businessSearchOver");
|
|
31736
|
+
|
|
31737
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-events.js
|
|
31478
31738
|
var DAY4 = 864e5;
|
|
31479
31739
|
var COUNTERPART_LINK = `EXISTS (SELECT 1 FROM links l WHERE l.from_type = 'event' AND l.from_id = e.id AND l.to_type = 'person' AND l.to_id = ? AND l.kind = ${linkKind("related-to")} AND l.role = '${COUNTERPART_ROLE}')`;
|
|
31480
31740
|
var accountsOf = /* @__PURE__ */ __name((filter) => {
|
|
@@ -31584,7 +31844,7 @@ var listEvents = /* @__PURE__ */ __name((database, filter) => {
|
|
|
31584
31844
|
return database.prepare(`SELECT e.* FROM events e WHERE ${clauses.join(" AND ")} ORDER BY ${filter.newest ? "e.starts_at DESC, e.id DESC" : "e.starts_at, e.id"} LIMIT ? OFFSET ?`).all(...params, limit, offset).map(eventOf);
|
|
31585
31845
|
}, "listEvents");
|
|
31586
31846
|
|
|
31587
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31847
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-forget.js
|
|
31588
31848
|
var distinctIds = /* @__PURE__ */ __name((rows) => [...new Set(rows.map((row2) => Number(row2.id)))], "distinctIds");
|
|
31589
31849
|
var forgetCalendarRows = /* @__PURE__ */ __name((database, { calendarId, accountId, cursorKey: cursorKey2, now: now2 }, refresh) => {
|
|
31590
31850
|
const unseenBefore = unreferenced(database, "identities");
|
|
@@ -31641,7 +31901,7 @@ var forgetCalendarRows = /* @__PURE__ */ __name((database, { calendarId, account
|
|
|
31641
31901
|
return { entries: entryIds.length, events: goneEvents.length };
|
|
31642
31902
|
}, "forgetCalendarRows");
|
|
31643
31903
|
|
|
31644
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31904
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar.js
|
|
31645
31905
|
var calendarOf = /* @__PURE__ */ __name((row2) => ({
|
|
31646
31906
|
id: Number(row2.id),
|
|
31647
31907
|
accountId: Number(row2.account_id),
|
|
@@ -32244,7 +32504,7 @@ var eventStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
32244
32504
|
};
|
|
32245
32505
|
}, "eventStoreOver");
|
|
32246
32506
|
|
|
32247
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32507
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/catalog.js
|
|
32248
32508
|
var CATALOG_QUERY = defineQuery({
|
|
32249
32509
|
entity: "document",
|
|
32250
32510
|
backend: "sql",
|
|
@@ -32486,7 +32746,7 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
|
|
|
32486
32746
|
};
|
|
32487
32747
|
}, "catalogStoreOver");
|
|
32488
32748
|
|
|
32489
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32749
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/context-document-source.js
|
|
32490
32750
|
var drive = "CASE WHEN json_valid(n.front_matter) THEN json_extract(n.front_matter,'$.source')='google-drive' ELSE 0 END";
|
|
32491
32751
|
var field3 = /* @__PURE__ */ __name((name) => `CASE WHEN (${drive}) THEN
|
|
32492
32752
|
CASE WHEN json_type(n.front_matter,'$.${name}')='text' THEN json_extract(n.front_matter,'$.${name}') END END`, "field");
|
|
@@ -32499,7 +32759,7 @@ var contextDocumentTimeKind = `CASE WHEN (${remoteTime}) IS NOT NULL
|
|
|
32499
32759
|
THEN 'source-modified' ELSE 'stored-update' END`;
|
|
32500
32760
|
var contextDocumentUrl = `coalesce(${preferred("url")},n.url,${field3("sourceUrl")})`;
|
|
32501
32761
|
|
|
32502
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32762
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/context-meeting-source.js
|
|
32503
32763
|
var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
|
|
32504
32764
|
const { source: source2, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal } = request;
|
|
32505
32765
|
signal?.throwIfAborted();
|
|
@@ -32598,7 +32858,7 @@ var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
|
|
|
32598
32858
|
});
|
|
32599
32859
|
}, "readMeetingContextEvidence");
|
|
32600
32860
|
|
|
32601
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32861
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/context-evidence.js
|
|
32602
32862
|
var corpora = {
|
|
32603
32863
|
message: {
|
|
32604
32864
|
table: "messages",
|
|
@@ -32837,7 +33097,7 @@ var contextRecordsOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
32837
33097
|
}
|
|
32838
33098
|
}), "contextRecordsOver");
|
|
32839
33099
|
|
|
32840
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33100
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/crm-rows.js
|
|
32841
33101
|
var TABLES2 = { deal: "deals", lead: "leads" };
|
|
32842
33102
|
var SOURCE = "crm";
|
|
32843
33103
|
var crmIdentityId = /* @__PURE__ */ __name((key2, externalId, type = "contact") => `${idPart(key2.account)}/${type}/${idPart(externalId)}`, "crmIdentityId");
|
|
@@ -32966,7 +33226,7 @@ var crmRowsOver = /* @__PURE__ */ __name((context) => {
|
|
|
32966
33226
|
return { savePipeline, saveItemRow };
|
|
32967
33227
|
}, "crmRowsOver");
|
|
32968
33228
|
|
|
32969
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33229
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/crm-settings.js
|
|
32970
33230
|
var CRM_LINK_MODES = ["reported", "review"];
|
|
32971
33231
|
var COMPANY_TYPE_MEANINGS = ["customer-of", "supplier", "partner-of"];
|
|
32972
33232
|
var crmSettingKey = /* @__PURE__ */ __name((key2, name) => `crm.${key2.provider}:${key2.account}.${name}`, "crmSettingKey");
|
|
@@ -33029,10 +33289,25 @@ var crmSettingsOf = /* @__PURE__ */ __name((database) => database.prepare("SELEC
|
|
|
33029
33289
|
];
|
|
33030
33290
|
}), "crmSettingsOf");
|
|
33031
33291
|
|
|
33032
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33292
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/money-lines.js
|
|
33293
|
+
var MAX_LINES = 500;
|
|
33033
33294
|
var PARENTS = {
|
|
33034
|
-
invoice: {
|
|
33035
|
-
|
|
33295
|
+
invoice: {
|
|
33296
|
+
parents: "invoices",
|
|
33297
|
+
table: "invoice_lines",
|
|
33298
|
+
column: "invoice_id",
|
|
33299
|
+
reasons: "finance",
|
|
33300
|
+
full: "finance.lines",
|
|
33301
|
+
instead: "reject or void the invoice instead"
|
|
33302
|
+
},
|
|
33303
|
+
order: {
|
|
33304
|
+
parents: "orders",
|
|
33305
|
+
table: "order_lines",
|
|
33306
|
+
column: "order_id",
|
|
33307
|
+
reasons: "order",
|
|
33308
|
+
full: "order.field",
|
|
33309
|
+
instead: "reject or cancel the order instead"
|
|
33310
|
+
}
|
|
33036
33311
|
};
|
|
33037
33312
|
var moneyLinesOver = /* @__PURE__ */ __name(({ database }) => {
|
|
33038
33313
|
const productOf2 = /* @__PURE__ */ __name((reference2, what, code) => {
|
|
@@ -33087,10 +33362,34 @@ var moneyLinesOver = /* @__PURE__ */ __name(({ database }) => {
|
|
|
33087
33362
|
product: line.catalog_item_id == null ? null : `product:${line.catalog_item_id}`
|
|
33088
33363
|
}));
|
|
33089
33364
|
}, "shownLines");
|
|
33090
|
-
|
|
33365
|
+
const appendLine = /* @__PURE__ */ __name((parent2, id2, line, at) => {
|
|
33366
|
+
const { table, column: column2, full } = PARENTS[parent2];
|
|
33367
|
+
const last = Number(database.prepare(`SELECT coalesce(max(position), 0) AS n FROM ${table} WHERE ${column2} = ?`).get(id2)?.n);
|
|
33368
|
+
if (last >= MAX_LINES)
|
|
33369
|
+
refuse(`an ${parent2} has at most ${MAX_LINES} lines`, full);
|
|
33370
|
+
insertLines(parent2, id2, [line], last + 1, at);
|
|
33371
|
+
}, "appendLine");
|
|
33372
|
+
const deleteLine = /* @__PURE__ */ __name((parent2, id2, position2) => {
|
|
33373
|
+
const { table, column: column2, reasons, instead } = PARENTS[parent2];
|
|
33374
|
+
const lines = Number(database.prepare(`SELECT count(*) AS n FROM ${table} WHERE ${column2} = ?`).get(id2)?.n);
|
|
33375
|
+
const gone = database.prepare(`DELETE FROM ${table} WHERE ${column2} = ? AND position = ?`).run(id2, position2);
|
|
33376
|
+
if (gone.changes === 0)
|
|
33377
|
+
throw new CliError("not_found", `${parent2}:${id2} has no line ${position2}`, { reason: `${reasons}.no-line` });
|
|
33378
|
+
if (lines === 1)
|
|
33379
|
+
refuse(`line ${position2} is the last of ${parent2}:${id2}; ${instead}`, `${reasons}.line`);
|
|
33380
|
+
}, "deleteLine");
|
|
33381
|
+
const sumOf = /* @__PURE__ */ __name((parent2, id2) => {
|
|
33382
|
+
const { table, column: column2 } = PARENTS[parent2];
|
|
33383
|
+
return Number(database.prepare(`SELECT coalesce(sum(amount), 0) AS n FROM ${table} WHERE ${column2} = ?`).get(id2)?.n);
|
|
33384
|
+
}, "sumOf");
|
|
33385
|
+
const retotal = /* @__PURE__ */ __name((parent2, id2, at) => {
|
|
33386
|
+
const { parents, table, column: column2 } = PARENTS[parent2];
|
|
33387
|
+
database.prepare(`UPDATE ${parents} SET total = coalesce((SELECT sum(amount) FROM ${table} WHERE ${column2} = ?), total), updated_at = ? WHERE id = ?`).run(id2, at, id2);
|
|
33388
|
+
}, "retotal");
|
|
33389
|
+
return { linesOf, insertLines, shownLines, appendLine, deleteLine, sumOf, retotal };
|
|
33091
33390
|
}, "moneyLinesOver");
|
|
33092
33391
|
|
|
33093
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33392
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/refunds.js
|
|
33094
33393
|
var COUNTED = {
|
|
33095
33394
|
confirmed: "np.review = 'confirmed' AND np.deleted_at IS NULL",
|
|
33096
33395
|
// A proposed refund promises nothing back yet, so it must not free room an import could then fill.
|
|
@@ -33165,10 +33464,9 @@ var refundRulesOver = /* @__PURE__ */ __name((context) => {
|
|
|
33165
33464
|
return { originalFor, refundShare, confirmable, keepsRefunded, keepsShare, keepsInvoice };
|
|
33166
33465
|
}, "refundRulesOver");
|
|
33167
33466
|
|
|
33168
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33467
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/finance.js
|
|
33169
33468
|
var FINANCE_TYPES = ["invoice", "payment"];
|
|
33170
33469
|
var isFinanceType = /* @__PURE__ */ __name((type) => FINANCE_TYPES.includes(type), "isFinanceType");
|
|
33171
|
-
var MAX_LINES = 500;
|
|
33172
33470
|
var PAID = netPaidSql("i.id");
|
|
33173
33471
|
var INVOICES = `SELECT i.*, ${PAID} AS paid, b.name AS author_name, b.kind AS author_kind FROM invoices i LEFT JOIN bots b ON i.author_type = 'bot' AND b.id = i.author_id`;
|
|
33174
33472
|
var PAYMENTS = "SELECT p.*, (SELECT coalesce(sum(amount), 0) FROM payment_allocations WHERE payment_id = p.id) AS allocated, b.name AS author_name, b.kind AS author_kind FROM payments p LEFT JOIN bots b ON p.author_type = 'bot' AND b.id = p.author_id";
|
|
@@ -33351,6 +33649,28 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
33351
33649
|
for (const refund of [true, false])
|
|
33352
33650
|
database.prepare(`DELETE FROM payment_allocations WHERE invoice_id = ? AND payment_id IN (SELECT id FROM payments WHERE refund_of IS ${refund ? "NOT " : ""}NULL${which})`).run(invoiceId);
|
|
33353
33651
|
}, "dropAllocations");
|
|
33652
|
+
const mayChangeLines = /* @__PURE__ */ __name((row2, by) => {
|
|
33653
|
+
mayChangeParts(row2, by, `only the owner changes the lines of invoice:${row2.id}; a bot changes only an invoice it proposed that is still proposed`);
|
|
33654
|
+
if (row2.deleted_at != null || row2.review === "rejected" || row2.status === "void")
|
|
33655
|
+
refuse(`invoice:${row2.id} is ${row2.deleted_at != null ? "deleted" : row2.review === "rejected" ? "rejected" : "void"}`, "finance.status");
|
|
33656
|
+
}, "mayChangeLines");
|
|
33657
|
+
const relined = /* @__PURE__ */ __name((row2, change) => {
|
|
33658
|
+
const [id2, currency] = [Number(row2.id), String(row2.currency)];
|
|
33659
|
+
write(database, () => {
|
|
33660
|
+
change(id2);
|
|
33661
|
+
const total = lines.sumOf("invoice", id2);
|
|
33662
|
+
if (!Number.isSafeInteger(total))
|
|
33663
|
+
refuse("an invoice's total is too large", "finance.total");
|
|
33664
|
+
if (total <= 0)
|
|
33665
|
+
refuse("an invoice totals more than 0", "finance.total");
|
|
33666
|
+
const paid = Number(database.prepare(`SELECT ${netPaidSql("?")} AS n`).get(id2)?.n);
|
|
33667
|
+
if (total < paid)
|
|
33668
|
+
refuse(`${moneyLabel(paid, currency)} is paid on invoice:${id2}; its lines cannot total ${moneyLabel(total, currency)}`, "finance.below-paid");
|
|
33669
|
+
lines.retotal("invoice", id2, now2());
|
|
33670
|
+
settle(id2);
|
|
33671
|
+
});
|
|
33672
|
+
return invoiceDetail(`invoice:${id2}`);
|
|
33673
|
+
}, "relined");
|
|
33354
33674
|
const mayAllocate = /* @__PURE__ */ __name((row2, by) => mayChangeParts(row2, by, `only the owner allocates payment:${row2.id}; a bot allocates only from a payment it proposed that is still proposed`), "mayAllocate");
|
|
33355
33675
|
return {
|
|
33356
33676
|
addInvoice: /* @__PURE__ */ __name((input) => {
|
|
@@ -33387,6 +33707,17 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
33387
33707
|
return invoiceDetail(`invoice:${id2}`);
|
|
33388
33708
|
}, "addInvoice"),
|
|
33389
33709
|
invoice: /* @__PURE__ */ __name((reference2) => invoiceDetail(reference2), "invoice"),
|
|
33710
|
+
addInvoiceLine: /* @__PURE__ */ __name((reference2, { by, ...line }) => {
|
|
33711
|
+
const row2 = rowOf2(reference2, "invoice");
|
|
33712
|
+
mayChangeLines(row2, by);
|
|
33713
|
+
const [priced] = lines.linesOf("invoice", [line], String(row2.currency));
|
|
33714
|
+
return relined(row2, (id2) => lines.appendLine("invoice", id2, priced, now2()));
|
|
33715
|
+
}, "addInvoiceLine"),
|
|
33716
|
+
removeInvoiceLine: /* @__PURE__ */ __name((reference2, { position: position2, by }) => {
|
|
33717
|
+
const row2 = rowOf2(reference2, "invoice");
|
|
33718
|
+
mayChangeLines(row2, by);
|
|
33719
|
+
return relined(row2, (id2) => lines.deleteLine("invoice", id2, position2));
|
|
33720
|
+
}, "removeInvoiceLine"),
|
|
33390
33721
|
invoices: /* @__PURE__ */ __name((filter = {}) => {
|
|
33391
33722
|
const project2 = filter.project === void 0 ? null : projectId(database, filter.project);
|
|
33392
33723
|
const counterparty = partyThing(filter.counterparty, "the counterparty");
|
|
@@ -33453,10 +33784,10 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
33453
33784
|
payment: /* @__PURE__ */ __name((reference2) => paymentDetail(reference2), "payment"),
|
|
33454
33785
|
payments: /* @__PURE__ */ __name((filter = {}) => {
|
|
33455
33786
|
const project2 = filter.project === void 0 ? null : projectId(database, filter.project);
|
|
33456
|
-
const
|
|
33787
|
+
const party3 = partyThing(filter.party, "the party");
|
|
33457
33788
|
const by = proposedBySql("p.author_type", "p.author_id", filter.proposedBy);
|
|
33458
33789
|
const review = filter.review === void 0 ? null : oneOf4(filter.review, FINANCE_REVIEWS, "a review");
|
|
33459
|
-
return database.prepare(`${PAYMENTS} WHERE p.deleted_at IS NULL AND (? IS NULL OR p.direction = ?) AND (? IS NULL OR p.review = ?) AND (? IS NULL OR p.project_id = ?) AND (? IS NULL OR (p.payer_type = ? AND p.payer_id = ?) OR (p.payee_type = ? AND p.payee_id = ?)) AND ${by.sql} ORDER BY p.created_at DESC, p.id DESC LIMIT ?`).all(filter.direction ?? null, filter.direction ?? null, review, review, project2, project2,
|
|
33790
|
+
return database.prepare(`${PAYMENTS} WHERE p.deleted_at IS NULL AND (? IS NULL OR p.direction = ?) AND (? IS NULL OR p.review = ?) AND (? IS NULL OR p.project_id = ?) AND (? IS NULL OR (p.payer_type = ? AND p.payer_id = ?) OR (p.payee_type = ? AND p.payee_id = ?)) AND ${by.sql} ORDER BY p.created_at DESC, p.id DESC LIMIT ?`).all(filter.direction ?? null, filter.direction ?? null, review, review, project2, project2, party3?.type ?? null, party3?.type ?? null, party3?.id ?? null, party3?.type ?? null, party3?.id ?? null, ...by.params, limitOf(filter.limit)).map(paymentOf3);
|
|
33460
33791
|
}, "payments"),
|
|
33461
33792
|
allocate: /* @__PURE__ */ __name(({ payment, invoice, amount, by }) => {
|
|
33462
33793
|
const row2 = rowOf2(payment, "payment");
|
|
@@ -33515,6 +33846,8 @@ var financeStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
33515
33846
|
return {
|
|
33516
33847
|
addInvoice: /* @__PURE__ */ __name(async (input) => operations.addInvoice(input), "addInvoice"),
|
|
33517
33848
|
invoice: /* @__PURE__ */ __name(async (reference2) => operations.invoice(reference2), "invoice"),
|
|
33849
|
+
addInvoiceLine: /* @__PURE__ */ __name(async (reference2, input) => operations.addInvoiceLine(reference2, input), "addInvoiceLine"),
|
|
33850
|
+
removeInvoiceLine: /* @__PURE__ */ __name(async (reference2, input) => operations.removeInvoiceLine(reference2, input), "removeInvoiceLine"),
|
|
33518
33851
|
invoices: /* @__PURE__ */ __name(async (filter) => operations.invoices(filter), "invoices"),
|
|
33519
33852
|
issueInvoice: /* @__PURE__ */ __name(async (reference2, by) => operations.issueInvoice(reference2, by), "issueInvoice"),
|
|
33520
33853
|
voidInvoice: /* @__PURE__ */ __name(async (reference2, by) => operations.voidInvoice(reference2, by), "voidInvoice"),
|
|
@@ -33529,7 +33862,7 @@ var financeStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
33529
33862
|
};
|
|
33530
33863
|
}, "financeStoreOver");
|
|
33531
33864
|
|
|
33532
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33865
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-entries.js
|
|
33533
33866
|
var refuse2 = /* @__PURE__ */ __name((message3, reason) => {
|
|
33534
33867
|
throw new CliError("validation_error", message3, { reason });
|
|
33535
33868
|
}, "refuse");
|
|
@@ -33545,7 +33878,7 @@ var entryAmount = /* @__PURE__ */ __name((payment) => {
|
|
|
33545
33878
|
return refuse2(`${payment.currency} has ${scale} decimals; ${payment.amount} does not fit`, "money.amount");
|
|
33546
33879
|
return formatDecimal(cents / shift, scale);
|
|
33547
33880
|
}, "entryAmount");
|
|
33548
|
-
var
|
|
33881
|
+
var party2 = /* @__PURE__ */ __name((payment) => /^(person|organization):/.test(payment.counterparty ?? "") ? payment.counterparty : null, "party");
|
|
33549
33882
|
var paymentEntriesOver = /* @__PURE__ */ __name((context) => {
|
|
33550
33883
|
const finance = financeOperationsOver(context);
|
|
33551
33884
|
const today = /* @__PURE__ */ __name(() => new Date(context.now()).toISOString().slice(0, 10), "today");
|
|
@@ -33569,7 +33902,7 @@ var paymentEntriesOver = /* @__PURE__ */ __name((context) => {
|
|
|
33569
33902
|
...by === "owner" ? {} : { source: "agent", reason: entry2.statement ?? paymentTitle(entry2) },
|
|
33570
33903
|
evidence: entry2.evidence
|
|
33571
33904
|
};
|
|
33572
|
-
const counterparty =
|
|
33905
|
+
const counterparty = party2(payment);
|
|
33573
33906
|
if (payment.state === "cancelled") {
|
|
33574
33907
|
if (entry2.supersedes === void 0)
|
|
33575
33908
|
return refuse2("a cancelled payment names the invoice it cancels", "finance.ref");
|
|
@@ -33607,7 +33940,7 @@ var paymentEntriesOver = /* @__PURE__ */ __name((context) => {
|
|
|
33607
33940
|
};
|
|
33608
33941
|
}, "paymentEntriesOver");
|
|
33609
33942
|
|
|
33610
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33943
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/evidence-findings.js
|
|
33611
33944
|
var EVIDENCE_FINDINGS_KIND = "evidence_findings";
|
|
33612
33945
|
var reference = /* @__PURE__ */ __name((raw) => {
|
|
33613
33946
|
if (/^(document|note):[1-9]\d*$/.test(raw))
|
|
@@ -33633,7 +33966,7 @@ var validateEvidenceFindings = /* @__PURE__ */ __name((input) => {
|
|
|
33633
33966
|
return valid;
|
|
33634
33967
|
}, "validateEvidenceFindings");
|
|
33635
33968
|
|
|
33636
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33969
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/proposed-actions.js
|
|
33637
33970
|
var PROPOSAL_STATUSES = ["proposed", "approved", "rejected", "executed", "failed"];
|
|
33638
33971
|
var PROPOSAL_VERDICTS = ["useful", "not_useful"];
|
|
33639
33972
|
var iso10 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
|
|
@@ -33721,11 +34054,11 @@ var proposalOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
33721
34054
|
}, "propose"),
|
|
33722
34055
|
get: /* @__PURE__ */ __name((id2) => actionOf(rowOf2(id2)), "get"),
|
|
33723
34056
|
pending: /* @__PURE__ */ __name(({ limit = 100 } = {}) => database.prepare(`${NAMED3} WHERE p.status = 'proposed' ORDER BY p.created_at, p.id LIMIT ?`).all(Math.min(Math.max(limit, 1), 500)).map(actionOf), "pending"),
|
|
33724
|
-
list: /* @__PURE__ */ __name(({ status: status2, limit = 100, kinds: kinds2, except, proposedBy, project: project2 } = {}) => {
|
|
34057
|
+
list: /* @__PURE__ */ __name(({ status: status2, limit = 100, kinds: kinds2, except, proposedBy, project: project2, evidence } = {}) => {
|
|
33725
34058
|
if (status2 !== void 0 && !PROPOSAL_STATUSES.includes(status2))
|
|
33726
34059
|
throw new CliError("validation_error", `a status is one of ${PROPOSAL_STATUSES.join(", ")}`);
|
|
33727
34060
|
const by = proposedBySql("p.proposed_by_type", "p.proposed_by_id", proposedBy);
|
|
33728
|
-
return database.prepare(`${NAMED3} WHERE (? IS NULL OR ${STATUS} = ?) AND (? IS NULL OR p.kind IN (SELECT value FROM json_each(?))) AND p.kind NOT IN (SELECT value FROM json_each(?)) AND (? IS NULL OR (p.target_type = 'project' AND 'project:' || p.target_id = ?) OR json_extract(p.payload, '$.to') = ? OR json_extract(p.payload, '$.from') = ? OR json_extract(p.payload, '$.project') = ?) AND ${by.sql} ORDER BY p.created_at DESC, p.id DESC LIMIT ?`).all(status2 ?? null, status2 ?? null, kinds2 === void 0 ? null : 1, JSON.stringify(kinds2 ?? []), JSON.stringify(except ?? []), ...Array(5).fill(project2 ?? null), ...by.params, Math.min(Math.max(limit, 1), 500)).map(actionOf);
|
|
34061
|
+
return database.prepare(`${NAMED3} WHERE (? IS NULL OR ${STATUS} = ?) AND (? IS NULL OR p.kind IN (SELECT value FROM json_each(?))) AND p.kind NOT IN (SELECT value FROM json_each(?)) AND (? IS NULL OR (p.target_type = 'project' AND 'project:' || p.target_id = ?) OR json_extract(p.payload, '$.to') = ? OR json_extract(p.payload, '$.from') = ? OR json_extract(p.payload, '$.project') = ?) AND (? IS NULL OR EXISTS (SELECT 1 FROM json_each(p.payload, '$.evidence') WHERE value = ?)) AND ${by.sql} ORDER BY p.created_at DESC, p.id DESC LIMIT ?`).all(status2 ?? null, status2 ?? null, kinds2 === void 0 ? null : 1, JSON.stringify(kinds2 ?? []), JSON.stringify(except ?? []), ...Array(5).fill(project2 ?? null), evidence ?? null, evidence ?? null, ...by.params, Math.min(Math.max(limit, 1), 500)).map(actionOf);
|
|
33729
34062
|
}, "list"),
|
|
33730
34063
|
approve: /* @__PURE__ */ __name((id2, result, by) => decide2(id2, "approved", result, by), "approve"),
|
|
33731
34064
|
reject: /* @__PURE__ */ __name((id2, by, result) => decide2(id2, "rejected", result, by), "reject"),
|
|
@@ -33814,7 +34147,7 @@ var proposedActionsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
33814
34147
|
};
|
|
33815
34148
|
}, "proposedActionsStoreOver");
|
|
33816
34149
|
|
|
33817
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34150
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-roles.js
|
|
33818
34151
|
var settingOf = /* @__PURE__ */ __name((list2) => `relationships.roles.${list2}`, "settingOf");
|
|
33819
34152
|
var isList = /* @__PURE__ */ __name((list2) => Object.hasOwn(ROLE_LISTS, list2), "isList");
|
|
33820
34153
|
var listOf = /* @__PURE__ */ __name((list2) => {
|
|
@@ -33886,7 +34219,7 @@ var relationRolesOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
|
|
|
33886
34219
|
};
|
|
33887
34220
|
}, "relationRolesOver");
|
|
33888
34221
|
|
|
33889
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34222
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-proposals.js
|
|
33890
34223
|
var isoOf = /* @__PURE__ */ __name((ms) => ms === void 0 ? null : new Date(ms).toISOString(), "isoOf");
|
|
33891
34224
|
var relationOf = /* @__PURE__ */ __name((link3, now2) => ({
|
|
33892
34225
|
id: link3.id,
|
|
@@ -34205,7 +34538,8 @@ var decidedOrigin = /* @__PURE__ */ __name((by) => by === "owner" ? { origin: "o
|
|
|
34205
34538
|
provenance: `agent:${by.bot} for the owner: ${by.reason.trim()}`
|
|
34206
34539
|
}, "decidedOrigin");
|
|
34207
34540
|
|
|
34208
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34541
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/reported-relations.js
|
|
34542
|
+
var KEYED = "kind IN ('member-of', 'related-to', 'reports-to', 'customer-of', 'partner-of') AND to_id IS NOT NULL";
|
|
34209
34543
|
var metadataOf = /* @__PURE__ */ __name((relation) => relation.metadata && Object.keys(relation.metadata).length ? JSON.stringify(relation.metadata) : null, "metadataOf");
|
|
34210
34544
|
var syncReportedIn = /* @__PURE__ */ __name((context, key2, relationships, scope3, { source: source2 = "import", by = { bot: key2.provider, kind: "rule" } } = {}) => {
|
|
34211
34545
|
const { database, now: now2 } = context;
|
|
@@ -34224,7 +34558,7 @@ var syncReportedIn = /* @__PURE__ */ __name((context, key2, relationships, scope
|
|
|
34224
34558
|
};
|
|
34225
34559
|
const seen = /* @__PURE__ */ new Set();
|
|
34226
34560
|
const issue = /* @__PURE__ */ __name((relation, reason, message3) => result.issues.push({ reason, message: message3, from: relation.from, to: relation.to, kind: relation.kind }), "issue");
|
|
34227
|
-
const sameKey =
|
|
34561
|
+
const sameKey = `${KEYED} AND kind = ? AND from_type = ? AND from_id = ? AND to_type = ? AND to_id = ? AND anchor IS NULL AND ifnull(role, '') = ?`;
|
|
34228
34562
|
for (const relation of relationships) {
|
|
34229
34563
|
let from2 = thingOf(database, relation.from);
|
|
34230
34564
|
let to = thingOf(database, relation.to);
|
|
@@ -34310,7 +34644,7 @@ var relationsStoreOver = /* @__PURE__ */ __name((context) => ({
|
|
|
34310
34644
|
syncReported: /* @__PURE__ */ __name(async (key2, relationships, scope3, options) => write(context.database, () => syncReportedIn(context, key2, relationships, scope3, options)), "syncReported")
|
|
34311
34645
|
}), "relationsStoreOver");
|
|
34312
34646
|
|
|
34313
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34647
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/crm.js
|
|
34314
34648
|
var PENDING = "crm:pending-relations";
|
|
34315
34649
|
var PENDING_DAYS = 30;
|
|
34316
34650
|
var PENDING_MOST = 5e3;
|
|
@@ -34788,7 +35122,7 @@ var crmCopiesOver = /* @__PURE__ */ __name((context, people2) => {
|
|
|
34788
35122
|
};
|
|
34789
35123
|
}, "crmCopiesOver");
|
|
34790
35124
|
|
|
34791
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35125
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/stage-amounts.js
|
|
34792
35126
|
var TABLES3 = { deal: "deals", lead: "leads" };
|
|
34793
35127
|
var stageAmountsOf = /* @__PURE__ */ __name(({ database }, kind3, stageIds, cutoff) => {
|
|
34794
35128
|
const rows = database.prepare(`SELECT stage_id, currency, count(*) AS items, coalesce(sum(amount), 0) AS units FROM ${TABLES3[kind3]} WHERE stage_id IN (${stageIds.map(() => "?").join(", ") || "NULL"}) AND deleted_at IS NULL AND (? IS NULL OR created_at >= ?) GROUP BY stage_id, currency ORDER BY currency`).all(...stageIds, cutoff, cutoff);
|
|
@@ -34805,7 +35139,7 @@ var stageAmountsOf = /* @__PURE__ */ __name(({ database }, kind3, stageIds, cuto
|
|
|
34805
35139
|
});
|
|
34806
35140
|
}, "stageAmountsOf");
|
|
34807
35141
|
|
|
34808
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35142
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/deals.js
|
|
34809
35143
|
var TABLES4 = { deal: "deals", lead: "leads" };
|
|
34810
35144
|
var itemsSql = /* @__PURE__ */ __name((kind3) => `SELECT d.*, s.name AS stage_name, s.pipeline_id, p.name AS pipeline_name, b.name AS author_name, b.kind AS author_kind, a.provider AS account_provider, a.external_id AS account_external_id FROM ${TABLES4[kind3]} d JOIN pipeline_stages s ON s.id = d.stage_id JOIN pipelines p ON p.id = s.pipeline_id LEFT JOIN bots b ON d.author_type = 'bot' AND b.id = d.author_id LEFT JOIN accounts a ON a.id = d.account_id`, "itemsSql");
|
|
34811
35145
|
var MAX_STAGES = 30;
|
|
@@ -35146,10 +35480,10 @@ var dealsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
35146
35480
|
};
|
|
35147
35481
|
}, "dealsStoreOver");
|
|
35148
35482
|
|
|
35149
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35483
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/decision-requests.js
|
|
35150
35484
|
import { createHash as createHash13, randomBytes as randomBytes2 } from "node:crypto";
|
|
35151
35485
|
|
|
35152
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35486
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/decision-requests.js
|
|
35153
35487
|
var DECISION_ACTIONS = ["confirm", "reject", "ask-confirm", "ask-reject", "back", "later"];
|
|
35154
35488
|
var DECISION_TTL_MS = 72 * 60 * 60 * 1e3;
|
|
35155
35489
|
var CALLBACK_PREFIX = "wcr1:";
|
|
@@ -35163,7 +35497,7 @@ var callbackDataOf = /* @__PURE__ */ __name((token) => {
|
|
|
35163
35497
|
}, "callbackDataOf");
|
|
35164
35498
|
var parseCallbackData = /* @__PURE__ */ __name((data) => typeof data === "string" ? CALLBACK.exec(data)?.[1] : void 0, "parseCallbackData");
|
|
35165
35499
|
|
|
35166
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35500
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/decision-requests.js
|
|
35167
35501
|
var digestOf = /* @__PURE__ */ __name((token) => createHash13("sha256").update(token).digest("hex"), "digestOf");
|
|
35168
35502
|
var newToken = /* @__PURE__ */ __name(() => randomBytes2(16).toString("base64url"), "newToken");
|
|
35169
35503
|
var requestOf = /* @__PURE__ */ __name((row2) => ({
|
|
@@ -35259,7 +35593,7 @@ var decisionRequestStoreOver = /* @__PURE__ */ __name(({ database, now: now2 })
|
|
|
35259
35593
|
};
|
|
35260
35594
|
}, "decisionRequestStoreOver");
|
|
35261
35595
|
|
|
35262
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35596
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/note-search.js
|
|
35263
35597
|
var NOTE_FIELDS = [
|
|
35264
35598
|
"text",
|
|
35265
35599
|
"exact",
|
|
@@ -35537,7 +35871,7 @@ var searchCorpus = /* @__PURE__ */ __name((context, query, corpus) => {
|
|
|
35537
35871
|
});
|
|
35538
35872
|
}, "searchCorpus");
|
|
35539
35873
|
var SCAN_PAGE3 = 5e3;
|
|
35540
|
-
var
|
|
35874
|
+
var LIVE4 = "((k.chunkable_type = 'document' AND EXISTS (SELECT 1 FROM documents d WHERE d.id = k.chunkable_id AND d.deleted_at IS NULL AND coalesce(json_extract(d.metadata, '$.catalog.active'), 1)=1 AND (? IS NULL OR d.account_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))))) OR (k.chunkable_type = 'note' AND ? IS NULL AND EXISTS (SELECT 1 FROM notes n WHERE n.id = k.chunkable_id AND n.deleted_at IS NULL)))";
|
|
35541
35875
|
var noteSearchOver = /* @__PURE__ */ __name((context) => {
|
|
35542
35876
|
const { database } = context;
|
|
35543
35877
|
const stemmerFor2 = stemmerCache();
|
|
@@ -35550,7 +35884,7 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
|
|
|
35550
35884
|
const folders = folderIds?.length ? JSON.stringify(folderIds) : null;
|
|
35551
35885
|
const types = source2 === void 0 ? ["document", "note"] : source2 === "file" ? ["document"] : ["note"];
|
|
35552
35886
|
return {
|
|
35553
|
-
sql: ` AND k.chunkable_type IN (${types.map(() => "?").join(", ")}) AND ${
|
|
35887
|
+
sql: ` AND k.chunkable_type IN (${types.map(() => "?").join(", ")}) AND ${LIVE4}`,
|
|
35554
35888
|
params: [...types, folders, folders, withInternal ? null : folders]
|
|
35555
35889
|
};
|
|
35556
35890
|
}, "live");
|
|
@@ -35577,11 +35911,17 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
|
|
|
35577
35911
|
}
|
|
35578
35912
|
return texts2.get(owner);
|
|
35579
35913
|
}, "textOf");
|
|
35580
|
-
return database.prepare(`SELECT k.content_hash AS hash, min(k.chunkable_type || ':' || k.chunkable_id) AS owner, k.start_offset AS start, k.end_offset AS end
|
|
35914
|
+
return database.prepare(`SELECT k.content_hash AS hash, min(k.chunkable_type || ':' || k.chunkable_id) AS owner, k.start_offset AS start, k.end_offset AS end,
|
|
35915
|
+
k.position
|
|
35581
35916
|
FROM chunks k
|
|
35582
35917
|
WHERE k.content_hash > ?${scope3.sql}
|
|
35583
35918
|
AND NOT EXISTS (SELECT 1 FROM embeddings v WHERE v.model = ? AND v.content_hash = k.content_hash)
|
|
35584
35919
|
GROUP BY k.content_hash ORDER BY k.content_hash LIMIT ?`).all(after2 ?? "", ...scope3.params, model, limit).flatMap((row2) => {
|
|
35920
|
+
if (Number(row2.position) === ENRICHMENT_POSITION) {
|
|
35921
|
+
const [type, id2] = String(row2.owner).split(":");
|
|
35922
|
+
const text7 = enrichmentText(database, String(type), Number(id2));
|
|
35923
|
+
return text7 === void 0 ? [] : [{ hash: String(row2.hash), text: text7 }];
|
|
35924
|
+
}
|
|
35585
35925
|
const text6 = textOf7(String(row2.owner));
|
|
35586
35926
|
return text6 === void 0 ? [] : [{ hash: String(row2.hash), text: text6.slice(Number(row2.start), Number(row2.end)) }];
|
|
35587
35927
|
});
|
|
@@ -35689,7 +36029,7 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
|
|
|
35689
36029
|
};
|
|
35690
36030
|
}, "noteSearchOver");
|
|
35691
36031
|
|
|
35692
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36032
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/event-search.js
|
|
35693
36033
|
var EVENT_FIELDS = ["text", "exact", "body", "title", "date", "in"];
|
|
35694
36034
|
var inEventAccounts = /* @__PURE__ */ __name((event2) => searchableCopy(event2, "c.account_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))"), "inEventAccounts");
|
|
35695
36035
|
var EVENT_CORPUS = {
|
|
@@ -35821,7 +36161,7 @@ var eventSearchOver = /* @__PURE__ */ __name((context) => {
|
|
|
35821
36161
|
};
|
|
35822
36162
|
}, "eventSearchOver");
|
|
35823
36163
|
|
|
35824
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36164
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/domain/moment.js
|
|
35825
36165
|
var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false } = {}) => {
|
|
35826
36166
|
try {
|
|
35827
36167
|
return zonedMoment(wanted, timezoneOf(zone), { start: 0, end: wanted.length }, { end });
|
|
@@ -35833,7 +36173,7 @@ var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false
|
|
|
35833
36173
|
}
|
|
35834
36174
|
}, "calendarMoment");
|
|
35835
36175
|
|
|
35836
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36176
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/facts.js
|
|
35837
36177
|
var NAMED4 = "SELECT f.*, b.name AS author_name, b.kind AS author_kind FROM facts f LEFT JOIN bots b ON f.author_type = 'bot' AND b.id = f.author_id";
|
|
35838
36178
|
var iso12 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
|
|
35839
36179
|
var oneOf5 = /* @__PURE__ */ __name((value, allowed, what) => {
|
|
@@ -36053,7 +36393,7 @@ var factsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
36053
36393
|
};
|
|
36054
36394
|
}, "factsStoreOver");
|
|
36055
36395
|
|
|
36056
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36396
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/findings-core.js
|
|
36057
36397
|
var invalid2 = /* @__PURE__ */ __name((message3) => {
|
|
36058
36398
|
throw new CliError("validation_error", message3);
|
|
36059
36399
|
}, "invalid");
|
|
@@ -36157,7 +36497,7 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind3) => {
|
|
|
36157
36497
|
return { snapshot: snapshot2, snapshotParts, previous, outcomes, create };
|
|
36158
36498
|
}, "findingsCoreOver");
|
|
36159
36499
|
|
|
36160
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36500
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-findings.js
|
|
36161
36501
|
var stale = /* @__PURE__ */ __name(() => {
|
|
36162
36502
|
throw new CliError("validation_error", "evidence findings changed since they were read; stage a new batch", {
|
|
36163
36503
|
reason: "evidence-findings.stale"
|
|
@@ -36338,7 +36678,7 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
36338
36678
|
};
|
|
36339
36679
|
}, "evidenceFindingsStoreOver");
|
|
36340
36680
|
|
|
36341
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36681
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/involvements.js
|
|
36342
36682
|
var pendingInvolvements = /* @__PURE__ */ __name((database) => Number(database.prepare("SELECT count(*) AS n FROM involvement_pending").get()?.n ?? 0), "pendingInvolvements");
|
|
36343
36683
|
var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => ({
|
|
36344
36684
|
rebuild: /* @__PURE__ */ __name((personId) => write(database, () => {
|
|
@@ -36391,7 +36731,7 @@ var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
|
|
|
36391
36731
|
}, "forPerson")
|
|
36392
36732
|
}), "involvementStoreOver");
|
|
36393
36733
|
|
|
36394
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36734
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/labelled.js
|
|
36395
36735
|
var LABELLED = {
|
|
36396
36736
|
note: "note",
|
|
36397
36737
|
document: "document",
|
|
@@ -36403,7 +36743,7 @@ var LABELLED = {
|
|
|
36403
36743
|
account: "folder"
|
|
36404
36744
|
};
|
|
36405
36745
|
|
|
36406
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36746
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-projects.js
|
|
36407
36747
|
import { createHash as createHash14 } from "node:crypto";
|
|
36408
36748
|
var fields3 = "id,from_id,to_id,source,confirmed,updated_at,length(evidence) AS evidenceLength,substr(evidence,1,2000) AS evidence";
|
|
36409
36749
|
var id = /* @__PURE__ */ __name((value) => {
|
|
@@ -36489,7 +36829,7 @@ var meetingProjectsStoreOver = /* @__PURE__ */ __name(({ database, now: now2 })
|
|
|
36489
36829
|
};
|
|
36490
36830
|
}, "meetingProjectsStoreOver");
|
|
36491
36831
|
|
|
36492
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36832
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/knowledge-query.js
|
|
36493
36833
|
var ORGANIZATIONS_QUERY = {
|
|
36494
36834
|
entity: "organization",
|
|
36495
36835
|
backend: "sql",
|
|
@@ -36530,7 +36870,7 @@ var REMINDERS_QUERY = {
|
|
|
36530
36870
|
})
|
|
36531
36871
|
};
|
|
36532
36872
|
|
|
36533
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36873
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/organizations.js
|
|
36534
36874
|
var organizationOf = /* @__PURE__ */ __name((row2) => ({
|
|
36535
36875
|
id: String(row2.id),
|
|
36536
36876
|
ref: `organization:${row2.id}`,
|
|
@@ -36572,7 +36912,7 @@ var organizationsStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) =>
|
|
|
36572
36912
|
}), "setOwnOrganization")
|
|
36573
36913
|
}), "organizationsStoreOver");
|
|
36574
36914
|
|
|
36575
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36915
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-list.js
|
|
36576
36916
|
var KINDS = RELATION_KINDS.map(linkKind).join(", ");
|
|
36577
36917
|
var typeOfRef = /* @__PURE__ */ __name((column2) => `substr(${column2}, 1, instr(${column2}, ':') - 1)`, "typeOfRef");
|
|
36578
36918
|
var idOfRef = /* @__PURE__ */ __name((column2) => `CAST(substr(${column2}, instr(${column2}, ':') + 1) AS INTEGER)`, "idOfRef");
|
|
@@ -36697,13 +37037,13 @@ var relationListOver = /* @__PURE__ */ __name((context) => {
|
|
|
36697
37037
|
__name(proposalItem, "proposalItem");
|
|
36698
37038
|
}, "relationListOver");
|
|
36699
37039
|
|
|
36700
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37040
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-reads.js
|
|
36701
37041
|
var relationReadsOver = /* @__PURE__ */ __name((context) => ({
|
|
36702
37042
|
...relationListOver(context),
|
|
36703
37043
|
...relationRolesOver(context)
|
|
36704
37044
|
}), "relationReadsOver");
|
|
36705
37045
|
|
|
36706
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37046
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/source-review.js
|
|
36707
37047
|
var TABLES5 = { memory: "memories", fact: "facts" };
|
|
36708
37048
|
var RETIRED = /* @__PURE__ */ new Set(["superseded", "reversed", "rejected", "stale"]);
|
|
36709
37049
|
var DEFAULT_LIMIT = 500;
|
|
@@ -36891,16 +37231,16 @@ var sourceReviewStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
36891
37231
|
};
|
|
36892
37232
|
}, "sourceReviewStoreOver");
|
|
36893
37233
|
|
|
36894
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37234
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
|
|
36895
37235
|
import { createHash as createHash17 } from "node:crypto";
|
|
36896
37236
|
|
|
36897
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37237
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
|
|
36898
37238
|
import { createHash as createHash16 } from "node:crypto";
|
|
36899
37239
|
|
|
36900
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37240
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
|
|
36901
37241
|
import { createHash as createHash15 } from "node:crypto";
|
|
36902
37242
|
|
|
36903
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37243
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-input.js
|
|
36904
37244
|
var consolidationId = /* @__PURE__ */ __name((value, field4) => {
|
|
36905
37245
|
if (typeof value !== "string" || !/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
|
|
36906
37246
|
throw new CliError("validation_error", `${field4} must be a positive canonical tag id`);
|
|
@@ -36951,7 +37291,7 @@ var consolidationApplyInput = /* @__PURE__ */ __name((options) => {
|
|
|
36951
37291
|
return input;
|
|
36952
37292
|
}, "consolidationApplyInput");
|
|
36953
37293
|
|
|
36954
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37294
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
|
|
36955
37295
|
var receiptOf = /* @__PURE__ */ __name((row2) => ({
|
|
36956
37296
|
id: String(row2.id),
|
|
36957
37297
|
sourceId: String(row2.source_id),
|
|
@@ -37026,7 +37366,7 @@ var applyTagConsolidation = /* @__PURE__ */ __name((context, preview, options) =
|
|
|
37026
37366
|
}, { beforeCommit: check3 });
|
|
37027
37367
|
}, "applyTagConsolidation");
|
|
37028
37368
|
|
|
37029
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37369
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
|
|
37030
37370
|
var selections = [
|
|
37031
37371
|
["taggings", "tag_id IN (SELECT value FROM json_each(?))"],
|
|
37032
37372
|
["aliases", "aliasable_type='tag' AND aliasable_id IN (SELECT value FROM json_each(?))"],
|
|
@@ -37170,7 +37510,7 @@ var previewRows = /* @__PURE__ */ __name((context, options, source2, survivor, m
|
|
|
37170
37510
|
};
|
|
37171
37511
|
}, "previewRows");
|
|
37172
37512
|
|
|
37173
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37513
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
|
|
37174
37514
|
var kinds = ["project", "tag", "topic"];
|
|
37175
37515
|
var cancelled2 = /* @__PURE__ */ __name((signal) => {
|
|
37176
37516
|
if (signal?.aborted)
|
|
@@ -37434,7 +37774,7 @@ var vocabularyStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
37434
37774
|
};
|
|
37435
37775
|
}, "vocabularyStoreOver");
|
|
37436
37776
|
|
|
37437
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37777
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/knowledge.js
|
|
37438
37778
|
var TYPED_KEY_PREFIXES = new Set(Object.values(TASK_KEY_PREFIXES));
|
|
37439
37779
|
var ORGANIZATION_KINDS = ["company", "team", "family", "community"];
|
|
37440
37780
|
var PROJECT_TYPES = ["work", "client", "personal", "oss", "other"];
|
|
@@ -37980,7 +38320,7 @@ var projectKey = /* @__PURE__ */ __name((name) => {
|
|
|
37980
38320
|
return key2.padEnd(3, "X");
|
|
37981
38321
|
}, "projectKey");
|
|
37982
38322
|
|
|
37983
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
38323
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/log-pruning.js
|
|
37984
38324
|
var DAY5 = 864e5;
|
|
37985
38325
|
var SETTING4 = "logs_pruned_at";
|
|
37986
38326
|
var LOG_RETENTION = { agentActionsMs: 90 * DAY5, botUpdatePayloadsMs: 30 * DAY5 };
|
|
@@ -38007,7 +38347,7 @@ var logPruner = /* @__PURE__ */ __name((database, now2) => {
|
|
|
38007
38347
|
};
|
|
38008
38348
|
}, "logPruner");
|
|
38009
38349
|
|
|
38010
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
38350
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/mail/findings.js
|
|
38011
38351
|
var MAIL_FINDINGS_PER_RUN = 30;
|
|
38012
38352
|
var MAIL_FINDINGS_PER_SENDER = 5;
|
|
38013
38353
|
var invalid4 = /* @__PURE__ */ __name((message3) => {
|
|
@@ -38163,7 +38503,7 @@ var one = /* @__PURE__ */ __name((raw, ids) => {
|
|
|
38163
38503
|
return invalid4(`${what} is not a reference of the kind it takes: ${text6}`);
|
|
38164
38504
|
return text6;
|
|
38165
38505
|
}, "reference");
|
|
38166
|
-
const
|
|
38506
|
+
const party3 = /* @__PURE__ */ __name((field4, what) => {
|
|
38167
38507
|
const [given2, name, email] = [raw[field4], raw[`${field4}Name`], raw[`${field4}Email`]];
|
|
38168
38508
|
if (given2 !== void 0 && name !== void 0)
|
|
38169
38509
|
return invalid4(`${what} is ${field4} or ${field4}_name, not both`);
|
|
@@ -38258,7 +38598,7 @@ var one = /* @__PURE__ */ __name((raw, ids) => {
|
|
|
38258
38598
|
id: id2,
|
|
38259
38599
|
kind: "invoice",
|
|
38260
38600
|
direction: oneOf7(raw.direction, INVOICE_DIRECTIONS, "an invoice's direction"),
|
|
38261
|
-
...raw.counterparty === void 0 && raw.counterpartyName === void 0 ? invalid4("an invoice names its counterparty: counterparty person:N|organization:N, or counterparty_name") :
|
|
38601
|
+
...raw.counterparty === void 0 && raw.counterpartyName === void 0 ? invalid4("an invoice names its counterparty: counterparty person:N|organization:N, or counterparty_name") : party3("counterparty", "an invoice's counterparty"),
|
|
38262
38602
|
currency: word(raw.currency, 3),
|
|
38263
38603
|
lines,
|
|
38264
38604
|
...optional2("total", raw.total, (value) => word(value, 30)),
|
|
@@ -38290,8 +38630,8 @@ var one = /* @__PURE__ */ __name((raw, ids) => {
|
|
|
38290
38630
|
id: id2,
|
|
38291
38631
|
kind: "payment",
|
|
38292
38632
|
direction: oneOf7(raw.direction, MONEY_DIRECTIONS, "a payment's direction"),
|
|
38293
|
-
...
|
|
38294
|
-
...
|
|
38633
|
+
...party3("payer", "a payment's payer"),
|
|
38634
|
+
...party3("payee", "a payment's payee"),
|
|
38295
38635
|
amount: word(raw.amount, 30),
|
|
38296
38636
|
currency: word(raw.currency, 3),
|
|
38297
38637
|
date: word(raw.date, 10),
|
|
@@ -38307,7 +38647,7 @@ var one = /* @__PURE__ */ __name((raw, ids) => {
|
|
|
38307
38647
|
id: id2,
|
|
38308
38648
|
kind: "order",
|
|
38309
38649
|
purpose: oneOf7(raw.purpose, ORDER_PURPOSES, "an order's purpose"),
|
|
38310
|
-
...
|
|
38650
|
+
...party3("customer", "an order's customer"),
|
|
38311
38651
|
...optional2("supplier", raw.supplier, (value) => reference2(value, PARTY, "an order's supplier")),
|
|
38312
38652
|
supplierName: word(raw.supplierName, 200),
|
|
38313
38653
|
...optional2("number", raw.number, (value) => word(value, 80)),
|
|
@@ -38383,7 +38723,7 @@ var checkMailFindings = /* @__PURE__ */ __name((input) => {
|
|
|
38383
38723
|
}, "checkMailFindings");
|
|
38384
38724
|
var mailFindingFingerprint = /* @__PURE__ */ __name(({ id: _id, ...finding }) => findingHash(finding), "mailFindingFingerprint");
|
|
38385
38725
|
|
|
38386
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
38726
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/mail/score.js
|
|
38387
38727
|
var import_disposable_email_domains_js = __toESM(require_dist(), 1);
|
|
38388
38728
|
var import_tldts = __toESM(require_cjs(), 1);
|
|
38389
38729
|
var FREE_MAIL = /* @__PURE__ */ new Set([
|
|
@@ -38413,8 +38753,7 @@ var FREE_MAIL = /* @__PURE__ */ new Set([
|
|
|
38413
38753
|
]);
|
|
38414
38754
|
var DAY_MS2 = 24 * 60 * 60 * 1e3;
|
|
38415
38755
|
|
|
38416
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
38417
|
-
var MAX_LINES2 = 500;
|
|
38756
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/orders.js
|
|
38418
38757
|
var ORDERS = "SELECT o.*, b.name AS author_name, b.kind AS author_kind FROM orders o LEFT JOIN bots b ON o.author_type = 'bot' AND b.id = o.author_id";
|
|
38419
38758
|
var orderOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
38420
38759
|
const { database, now: now2 } = context;
|
|
@@ -38459,9 +38798,6 @@ var orderOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
38459
38798
|
...orderOf2(row2),
|
|
38460
38799
|
lines: row2.currency == null ? [] : moneyLines.shownLines("order", Number(row2.id), String(row2.currency))
|
|
38461
38800
|
}), "detailOf");
|
|
38462
|
-
const retotal = /* @__PURE__ */ __name((orderId) => {
|
|
38463
|
-
database.prepare("UPDATE orders SET total = coalesce((SELECT sum(amount) FROM order_lines WHERE order_id = ?), total), updated_at = ? WHERE id = ?").run(orderId, now2(), orderId);
|
|
38464
|
-
}, "retotal");
|
|
38465
38801
|
const mayChangeLines = /* @__PURE__ */ __name((row2, by) => {
|
|
38466
38802
|
mayChangeParts(row2, by, `only the owner changes the lines of order:${row2.id}; a bot changes only an order it proposed that is still proposed`, "order.owner-only");
|
|
38467
38803
|
if (row2.review === "rejected" || row2.deleted_at != null)
|
|
@@ -38492,8 +38828,8 @@ var orderOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
38492
38828
|
refuse("a sale names its customer, a person: or organization:", "order.field");
|
|
38493
38829
|
const number3 = text3(input.number, "an order's number", 80);
|
|
38494
38830
|
const lines = input.lines ?? [];
|
|
38495
|
-
if (!Array.isArray(lines) || lines.length >
|
|
38496
|
-
refuse(`an order has at most ${
|
|
38831
|
+
if (!Array.isArray(lines) || lines.length > MAX_LINES)
|
|
38832
|
+
refuse(`an order has at most ${MAX_LINES} lines`, "order.field");
|
|
38497
38833
|
if (lines.length && input.currency === void 0)
|
|
38498
38834
|
refuse("an order with lines names its currency", "order.total");
|
|
38499
38835
|
if (!lines.length && input.total === void 0 !== (input.currency === void 0))
|
|
@@ -38513,8 +38849,8 @@ var orderOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
38513
38849
|
const id2 = write(database, () => {
|
|
38514
38850
|
const customer = partyThing(input.customer, "the customer") ?? ownerPerson(database);
|
|
38515
38851
|
const supplier = partyThing(input.supplier, "the supplier") ?? (direction === "sale" ? ownerPerson(database) : void 0);
|
|
38516
|
-
const
|
|
38517
|
-
const supplierName = named2 ??
|
|
38852
|
+
const party3 = partyOf(supplier?.type, supplier?.id);
|
|
38853
|
+
const supplierName = named2 ?? party3?.name ?? (party3?.owner ? "owner" : null);
|
|
38518
38854
|
if (supplierName === null)
|
|
38519
38855
|
return refuse("an order names its shop or supplier", "order.field");
|
|
38520
38856
|
if (number3 !== null && ordersOfShop(database, supplierName, number3).some((one2) => held === void 0 || one2.id !== held.id))
|
|
@@ -38582,11 +38918,8 @@ var orderOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
38582
38918
|
refuse(`order:${row2.id} has no currency; a line needs one`, "order.total");
|
|
38583
38919
|
const [priced] = moneyLines.linesOf("order", [line], String(row2.currency));
|
|
38584
38920
|
write(database, () => {
|
|
38585
|
-
|
|
38586
|
-
|
|
38587
|
-
refuse(`an order has at most ${MAX_LINES2} lines`, "order.field");
|
|
38588
|
-
moneyLines.insertLines("order", Number(row2.id), [priced], last + 1, now2());
|
|
38589
|
-
retotal(Number(row2.id));
|
|
38921
|
+
moneyLines.appendLine("order", Number(row2.id), priced, now2());
|
|
38922
|
+
moneyLines.retotal("order", Number(row2.id), now2());
|
|
38590
38923
|
});
|
|
38591
38924
|
return detailOf(rowOf2(`order:${row2.id}`));
|
|
38592
38925
|
}, "addLine"),
|
|
@@ -38594,13 +38927,8 @@ var orderOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
38594
38927
|
const row2 = rowOf2(reference2);
|
|
38595
38928
|
mayChangeLines(row2, by);
|
|
38596
38929
|
write(database, () => {
|
|
38597
|
-
|
|
38598
|
-
|
|
38599
|
-
if (gone.changes === 0)
|
|
38600
|
-
throw new CliError("not_found", `order:${row2.id} has no line ${position2}`, { reason: "order.no-line" });
|
|
38601
|
-
if (lines === 1)
|
|
38602
|
-
refuse(`line ${position2} is the last of order:${row2.id}; reject or cancel the order instead`, "order.line");
|
|
38603
|
-
retotal(Number(row2.id));
|
|
38930
|
+
moneyLines.deleteLine("order", Number(row2.id), position2);
|
|
38931
|
+
moneyLines.retotal("order", Number(row2.id), now2());
|
|
38604
38932
|
});
|
|
38605
38933
|
return detailOf(rowOf2(`order:${row2.id}`));
|
|
38606
38934
|
}, "removeLine")
|
|
@@ -38633,7 +38961,7 @@ var ordersStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
38633
38961
|
};
|
|
38634
38962
|
}, "ordersStoreOver");
|
|
38635
38963
|
|
|
38636
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
38964
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-findings.js
|
|
38637
38965
|
var stale2 = /* @__PURE__ */ __name(() => {
|
|
38638
38966
|
throw new CliError("validation_error", "mail findings cite mail that changed since it was read; stage a new batch", {
|
|
38639
38967
|
reason: "mail-findings.stale"
|
|
@@ -39090,7 +39418,7 @@ ${evidence.join("\n")}`, agent);
|
|
|
39090
39418
|
};
|
|
39091
39419
|
}, "mailFindingsStoreOver");
|
|
39092
39420
|
|
|
39093
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
39421
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-findings.js
|
|
39094
39422
|
var stale3 = /* @__PURE__ */ __name(() => {
|
|
39095
39423
|
throw new CliError("validation_error", "meeting findings changed since they were read; stage a new batch", {
|
|
39096
39424
|
reason: "meeting-findings.stale"
|
|
@@ -39258,9 +39586,9 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
39258
39586
|
};
|
|
39259
39587
|
}, "meetingFindingsStoreOver");
|
|
39260
39588
|
|
|
39261
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
39589
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-vectors.js
|
|
39262
39590
|
var RANK_BATCH = 512;
|
|
39263
|
-
var
|
|
39591
|
+
var LIVE5 = "FROM chunks k JOIN meeting_transcripts t ON k.chunkable_type = 'meeting_transcript' AND t.id = k.chunkable_id JOIN meetings m ON m.id = t.meeting_id WHERE m.account_id = ? AND m.deleted_at IS NULL AND t.deleted_at IS NULL AND t.superseded_at IS NULL";
|
|
39264
39592
|
var limitOf2 = /* @__PURE__ */ __name((value, name, max = 1e3) => {
|
|
39265
39593
|
positiveReadInteger(value, name);
|
|
39266
39594
|
if (value > max)
|
|
@@ -39346,7 +39674,7 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
|
|
|
39346
39674
|
throw new CliError("validation_error", "Vector save exceeds its batch or 16 MiB payload budget");
|
|
39347
39675
|
return write(context.database, () => {
|
|
39348
39676
|
const unique2 = new Map(rows.map((row2) => [row2.hash, row2]));
|
|
39349
|
-
const current = context.database.prepare(`SELECT DISTINCT k.content_hash ${
|
|
39677
|
+
const current = context.database.prepare(`SELECT DISTINCT k.content_hash ${LIVE5} AND k.content_hash IN (SELECT value FROM json_each(?))`).all(input.accountId, JSON.stringify([...unique2.keys()]));
|
|
39350
39678
|
const available = new Set(current.map((row2) => String(row2.content_hash)));
|
|
39351
39679
|
const selected = [...unique2.values()].filter((row2) => available.has(row2.hash) && !context.database.prepare("SELECT 1 FROM embeddings WHERE model=? AND content_hash=?").get(model, row2.hash));
|
|
39352
39680
|
input.signal?.throwIfAborted();
|
|
@@ -39403,7 +39731,7 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
|
|
|
39403
39731
|
if (input.afterHash !== void 0 && !/^[a-f0-9]{64}$/.test(input.afterHash))
|
|
39404
39732
|
throw new CliError("validation_error", "afterHash must be a content hash");
|
|
39405
39733
|
return read(context.database, () => {
|
|
39406
|
-
const rows = context.database.prepare(`SELECT k.* ${
|
|
39734
|
+
const rows = context.database.prepare(`SELECT k.* ${LIVE5} AND k.content_hash > ? AND NOT EXISTS (SELECT 1 FROM embeddings e WHERE e.model=? AND e.content_hash=k.content_hash) GROUP BY k.content_hash ORDER BY k.content_hash LIMIT ?`).all(input.accountId, input.afterHash ?? "", model, limit + 1);
|
|
39407
39735
|
const load = textLoader(context, input);
|
|
39408
39736
|
const items = rows.slice(0, limit).map((row2) => ({
|
|
39409
39737
|
hash: String(row2.content_hash),
|
|
@@ -39423,13 +39751,13 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
|
|
|
39423
39751
|
if (input.afterChunkId !== void 0)
|
|
39424
39752
|
positiveReadInteger(input.afterChunkId, "afterChunkId");
|
|
39425
39753
|
return read(context.database, () => {
|
|
39426
|
-
const selectedSql = `${
|
|
39754
|
+
const selectedSql = `${LIVE5.replace(" WHERE", " JOIN embeddings e ON e.content_hash=k.content_hash AND e.model=? WHERE")} AND k.id>? ORDER BY k.id LIMIT ?`;
|
|
39427
39755
|
const params = [model, input.accountId, input.afterChunkId ?? 0, maxChunks + 1];
|
|
39428
39756
|
const preflight = context.database.prepare(`SELECT coalesce(sum(n),0) AS bytes, coalesce(sum(bad),0) AS bad FROM (SELECT length(e.vector) AS n, (e.dims != ? OR length(e.vector) != ?) AS bad ${selectedSql})`).get(query.length, query.length * 4, ...params);
|
|
39429
39757
|
if (Number(preflight?.bad ?? 0) || Number(preflight?.bytes ?? 0) > 16 * 1024 * 1024)
|
|
39430
39758
|
throw new CliError("validation_error", "Stored vectors exceed the dimension or 16 MiB scan budget");
|
|
39431
39759
|
input.signal?.throwIfAborted();
|
|
39432
|
-
const rows = context.database.prepare(`SELECT k.*,e.dims,e.vector ${
|
|
39760
|
+
const rows = context.database.prepare(`SELECT k.*,e.dims,e.vector ${LIVE5.replace(" WHERE", " JOIN embeddings e ON e.content_hash=k.content_hash AND e.model=? WHERE")} AND k.id>? ORDER BY k.id LIMIT ?`).all(model, input.accountId, input.afterChunkId ?? 0, maxChunks + 1);
|
|
39433
39761
|
const selected = rows.slice(0, maxChunks);
|
|
39434
39762
|
const load = textLoader(context, input);
|
|
39435
39763
|
const items = selected.map((row2) => {
|
|
@@ -39524,12 +39852,12 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
|
|
|
39524
39852
|
async status(input) {
|
|
39525
39853
|
scope2(input);
|
|
39526
39854
|
modelOf(input.model);
|
|
39527
|
-
const row2 = context.database.prepare(`SELECT count(DISTINCT k.content_hash) AS chunks,count(DISTINCT CASE WHEN EXISTS (SELECT 1 FROM embeddings e WHERE e.model=? AND e.content_hash=k.content_hash) THEN k.content_hash END) AS embedded ${
|
|
39855
|
+
const row2 = context.database.prepare(`SELECT count(DISTINCT k.content_hash) AS chunks,count(DISTINCT CASE WHEN EXISTS (SELECT 1 FROM embeddings e WHERE e.model=? AND e.content_hash=k.content_hash) THEN k.content_hash END) AS embedded ${LIVE5}`).get(input.model, input.accountId);
|
|
39528
39856
|
return { chunks: Number(row2?.chunks ?? 0), embedded: Number(row2?.embedded ?? 0) };
|
|
39529
39857
|
}
|
|
39530
39858
|
}), "meetingVectorsOver");
|
|
39531
39859
|
|
|
39532
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
39860
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-sources.js
|
|
39533
39861
|
var OTHER_SOURCES = ["document", "note", "email"];
|
|
39534
39862
|
var TEXTS = {
|
|
39535
39863
|
document: "JOIN documents s ON mn.source_type = 'document' AND s.id = mn.source_id AND s.deleted_at IS NULL WHERE 1 ",
|
|
@@ -39630,7 +39958,7 @@ var sourceMentionStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
39630
39958
|
};
|
|
39631
39959
|
}, "sourceMentionStoreOver");
|
|
39632
39960
|
|
|
39633
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
39961
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/money-transactions.js
|
|
39634
39962
|
var TRANSACTIONS = "SELECT t.*, w.name AS wallet_name, b.name AS author_name, b.kind AS author_kind, (SELECT coalesce(sum(amount), 0) FROM transaction_splits WHERE transaction_id = t.id) AS split FROM financial_transactions t JOIN financial_accounts w ON w.id = t.financial_account_id LEFT JOIN bots b ON t.author_type = 'bot' AND b.id = t.author_id";
|
|
39635
39963
|
var MAX_SPLITS = 100;
|
|
39636
39964
|
var transactionOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
@@ -39861,11 +40189,11 @@ var transactionsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
39861
40189
|
};
|
|
39862
40190
|
}, "transactionsStoreOver");
|
|
39863
40191
|
|
|
39864
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
40192
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
|
|
39865
40193
|
import { accessSync, constants, existsSync, mkdirSync as mkdirSync2, statSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
39866
40194
|
import { dirname as dirname2 } from "node:path";
|
|
39867
40195
|
|
|
39868
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
40196
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/clients.js
|
|
39869
40197
|
import { readFileSync as readFileSync3 } from "node:fs";
|
|
39870
40198
|
var CLIENTS_SETTING = "clients";
|
|
39871
40199
|
var coreVersion = (() => {
|
|
@@ -39923,7 +40251,7 @@ var refusalAdvice = /* @__PURE__ */ __name((clients, command, schema) => {
|
|
|
39923
40251
|
return mover ? `${own} (${mover.command} ${mover.version} moved the store to schema ${schema})` : own;
|
|
39924
40252
|
}, "refusalAdvice");
|
|
39925
40253
|
|
|
39926
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
40254
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/migrations.generated.js
|
|
39927
40255
|
var GENERATED = [
|
|
39928
40256
|
{
|
|
39929
40257
|
"name": "20261010184427_initial",
|
|
@@ -41133,10 +41461,24 @@ WHERE json_type(params, '$.selection') = 'object';`
|
|
|
41133
41461
|
"CREATE TRIGGER payment_allocations_refund_bd BEFORE DELETE ON payment_allocations\n WHEN (SELECT refund_of IS NOT NULL AND review = 'confirmed' AND deleted_at IS NULL FROM payments WHERE id = old.payment_id)\n AND (SELECT review FROM invoices WHERE id = old.invoice_id) <> 'rejected'\n AND (SELECT coalesce(sum(CASE WHEN np.refund_of IS NULL THEN na.amount ELSE -na.amount END), 0) FROM payment_allocations na JOIN payments np ON np.id = na.payment_id WHERE na.invoice_id = old.invoice_id AND np.review = 'confirmed' AND np.deleted_at IS NULL) + old.amount\n > (SELECT total FROM invoices WHERE id = old.invoice_id) BEGIN\n SELECT RAISE(ABORT, 'payment_allocations: taking a refund''s share back would pay the invoice beyond its total');\nEND;",
|
|
41134
41462
|
"-- A void invoice keeps what was settled on it; a rejected one lets its allocations go, as reject sets review first.\nCREATE TRIGGER payment_allocations_void_bd BEFORE DELETE ON payment_allocations\n WHEN (SELECT status = 'void' AND review <> 'rejected' FROM invoices WHERE id = old.invoice_id) BEGIN\n SELECT RAISE(ABORT, 'payment_allocations: a void invoice keeps its allocations');\nEND;"
|
|
41135
41463
|
]
|
|
41464
|
+
},
|
|
41465
|
+
{
|
|
41466
|
+
"name": "20261108104659_version-58-enrichments",
|
|
41467
|
+
"statements": [
|
|
41468
|
+
"CREATE TABLE `enrichments` (\n `subject_type` text NOT NULL,\n `subject_id` integer NOT NULL,\n `source_hash` text NOT NULL,\n `provider` text NOT NULL,\n `model` text NOT NULL,\n `text` text NOT NULL,\n `tokens` integer NOT NULL,\n `created_at` integer NOT NULL,\n CONSTRAINT `enrichments_pk` PRIMARY KEY(`subject_type`, `subject_id`)\n);"
|
|
41469
|
+
]
|
|
41470
|
+
},
|
|
41471
|
+
{
|
|
41472
|
+
"name": "20261108104701_version-58-enrichments-deletes",
|
|
41473
|
+
"statements": [
|
|
41474
|
+
"CREATE TRIGGER enrichments_document_gone AFTER DELETE ON documents BEGIN\n DELETE FROM enrichments WHERE subject_type = 'document' AND subject_id = OLD.id;\nEND;",
|
|
41475
|
+
"CREATE TRIGGER enrichments_note_gone AFTER DELETE ON notes BEGIN\n DELETE FROM enrichments WHERE subject_type = 'note' AND subject_id = OLD.id;\nEND;",
|
|
41476
|
+
"CREATE TRIGGER enrichments_email_gone AFTER DELETE ON emails BEGIN\n DELETE FROM enrichments WHERE subject_type = 'email' AND subject_id = OLD.id;\n DELETE FROM chunks WHERE chunkable_type = 'email_enrichment' AND chunkable_id = OLD.id;\nEND;"
|
|
41477
|
+
]
|
|
41136
41478
|
}
|
|
41137
41479
|
];
|
|
41138
41480
|
|
|
41139
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
41481
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/rollback-copy.js
|
|
41140
41482
|
import { mkdirSync, rmSync, statfsSync, writeFileSync } from "node:fs";
|
|
41141
41483
|
import { basename, dirname, join as join2, parse } from "node:path";
|
|
41142
41484
|
var DERIVED = /(_fts|_words|_stems|_trigrams|_pending)$|^(embeddings|chunks|chunk_messages|mentions|involvements|search_terms)$|^vector_index/;
|
|
@@ -41369,7 +41711,7 @@ var rollBack = /* @__PURE__ */ __name((database, path) => {
|
|
|
41369
41711
|
return { ...result, foreignKeyViolations };
|
|
41370
41712
|
}, "rollBack");
|
|
41371
41713
|
|
|
41372
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
41714
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/manifest.js
|
|
41373
41715
|
var V31_TABLES = [
|
|
41374
41716
|
"accounts",
|
|
41375
41717
|
"account_identities",
|
|
@@ -41487,7 +41829,9 @@ var MANIFEST = [
|
|
|
41487
41829
|
{ name: "20261107162448_version-56-relationship-links-history", version: 56, minCompatible: 56, tables: V56_TABLES },
|
|
41488
41830
|
{ name: "20261107163245_version-56-relationship-links-key", version: 56, minCompatible: 56, tables: V56_TABLES },
|
|
41489
41831
|
{ name: "20261108010753_version-57-business", version: 57, minCompatible: 56 },
|
|
41490
|
-
{ name: "20261108010754_version-57-business-rules", version: 57, minCompatible: 56 }
|
|
41832
|
+
{ name: "20261108010754_version-57-business-rules", version: 57, minCompatible: 56 },
|
|
41833
|
+
{ name: "20261108104659_version-58-enrichments", version: 58, minCompatible: 56 },
|
|
41834
|
+
{ name: "20261108104701_version-58-enrichments-deletes", version: 58, minCompatible: 56 }
|
|
41491
41835
|
];
|
|
41492
41836
|
var generatedMigrations = /* @__PURE__ */ __name((manifest = MANIFEST, generated = GENERATED) => {
|
|
41493
41837
|
const migrations = [];
|
|
@@ -41523,7 +41867,7 @@ var generatedMigrations = /* @__PURE__ */ __name((manifest = MANIFEST, generated
|
|
|
41523
41867
|
return migrations;
|
|
41524
41868
|
}, "generatedMigrations");
|
|
41525
41869
|
|
|
41526
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
41870
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/migrations.js
|
|
41527
41871
|
var MIGRATIONS = generatedMigrations();
|
|
41528
41872
|
var HISTORY = `CREATE TABLE IF NOT EXISTS schema_migrations (
|
|
41529
41873
|
version INTEGER PRIMARY KEY,
|
|
@@ -41602,7 +41946,7 @@ var migrate = /* @__PURE__ */ __name((database, { migrations = MIGRATIONS, now:
|
|
|
41602
41946
|
}
|
|
41603
41947
|
}, "migrate");
|
|
41604
41948
|
|
|
41605
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
41949
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/join-keys.js
|
|
41606
41950
|
var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
|
|
41607
41951
|
const pending = database.prepare("SELECT id, join_url FROM meetings WHERE join_url IS NOT NULL AND join_key IS NULL AND id > ? ORDER BY id LIMIT ?");
|
|
41608
41952
|
if (pending.get(0, 1) === void 0)
|
|
@@ -41624,7 +41968,7 @@ var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
|
|
|
41624
41968
|
}
|
|
41625
41969
|
}, "fillJoinKeys");
|
|
41626
41970
|
|
|
41627
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
41971
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/open.js
|
|
41628
41972
|
var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {}) => {
|
|
41629
41973
|
refuseOwnerStoreInTests(path);
|
|
41630
41974
|
const opened = "Bun" in globalThis ? await openUnderBun(path, readOnly) : await openUnderNode(path, readOnly);
|
|
@@ -41638,8 +41982,8 @@ var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {})
|
|
|
41638
41982
|
}, "openSqlite");
|
|
41639
41983
|
var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
|
|
41640
41984
|
quietSqliteWarning();
|
|
41641
|
-
const { drizzle } = await import("./node-
|
|
41642
|
-
const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-
|
|
41985
|
+
const { drizzle } = await import("./node-E25KP53H.js");
|
|
41986
|
+
const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-PHWDFZCP.js");
|
|
41643
41987
|
const client = await nodeClient(path, { readOnly });
|
|
41644
41988
|
try {
|
|
41645
41989
|
return { database: cacheOverNodeSqlite(client), orm: drizzle({ client }) };
|
|
@@ -41649,8 +41993,8 @@ var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
|
|
|
41649
41993
|
}
|
|
41650
41994
|
}, "openUnderNode");
|
|
41651
41995
|
var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
|
|
41652
|
-
const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-
|
|
41653
|
-
const { drizzle } = await import("./bun-
|
|
41996
|
+
const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-Y24TUIGS.js");
|
|
41997
|
+
const { drizzle } = await import("./bun-ZYZGGCX5.js");
|
|
41654
41998
|
const client = await bunClient(path, readOnly ? { readonly: true, create: false } : void 0);
|
|
41655
41999
|
try {
|
|
41656
42000
|
return { database: cacheOverBunSqlite(client), orm: drizzle({ client }) };
|
|
@@ -41660,7 +42004,7 @@ var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
|
|
|
41660
42004
|
}
|
|
41661
42005
|
}, "openUnderBun");
|
|
41662
42006
|
|
|
41663
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
42007
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-facts.js
|
|
41664
42008
|
var PAYMENT_FACTS_TO_MOVE = "payment_facts_to_move";
|
|
41665
42009
|
var paymentOf = /* @__PURE__ */ __name((metadata3) => {
|
|
41666
42010
|
try {
|
|
@@ -41728,7 +42072,7 @@ var movePaymentFacts = /* @__PURE__ */ __name((context) => {
|
|
|
41728
42072
|
});
|
|
41729
42073
|
}, "movePaymentFacts");
|
|
41730
42074
|
|
|
41731
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
42075
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/read-compatibility.js
|
|
41732
42076
|
var readCompatibility = /* @__PURE__ */ __name((database, command) => {
|
|
41733
42077
|
const ours = MIGRATIONS.at(-1)?.version ?? 0;
|
|
41734
42078
|
if (!database.prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name='schema_migrations'").get())
|
|
@@ -41746,7 +42090,7 @@ var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
|
|
|
41746
42090
|
throw new CliError("configuration_error", `The store needs schema ${MIGRATIONS.at(-1)?.version ?? 0} maintenance before a read-only open`);
|
|
41747
42091
|
}, "assertReadCompatible");
|
|
41748
42092
|
|
|
41749
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
42093
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/suggested-links.js
|
|
41750
42094
|
var SUGGESTED_LINKS_TO_MOVE = "suggested_links_to_move";
|
|
41751
42095
|
var proposerOf2 = /* @__PURE__ */ __name((provenance2) => {
|
|
41752
42096
|
if (provenance2?.startsWith("rule:"))
|
|
@@ -41792,7 +42136,7 @@ var moveSuggestedLinks = /* @__PURE__ */ __name((database, now2) => {
|
|
|
41792
42136
|
});
|
|
41793
42137
|
}, "moveSuggestedLinks");
|
|
41794
42138
|
|
|
41795
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
42139
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/test-accounts.js
|
|
41796
42140
|
var TEST_ACCOUNTS_TO_PURGE = "test_accounts_to_purge";
|
|
41797
42141
|
var TEST_PROVIDER = "chat";
|
|
41798
42142
|
var purgeTestAccounts = /* @__PURE__ */ __name((context, warn) => {
|
|
@@ -41813,7 +42157,7 @@ var purgeTestAccounts = /* @__PURE__ */ __name((context, warn) => {
|
|
|
41813
42157
|
}
|
|
41814
42158
|
}, "purgeTestAccounts");
|
|
41815
42159
|
|
|
41816
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
42160
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
|
|
41817
42161
|
var BACKFILL_ON_OPEN = 5e3;
|
|
41818
42162
|
var NOT_WRITABLE = /* @__PURE__ */ new Set(["EACCES", "EPERM", "EROFS"]);
|
|
41819
42163
|
var createWritable = /* @__PURE__ */ __name((file) => {
|
|
@@ -41911,7 +42255,7 @@ var openStoreContext = /* @__PURE__ */ __name(async (options = {}) => {
|
|
|
41911
42255
|
}
|
|
41912
42256
|
}, "openStoreContext");
|
|
41913
42257
|
|
|
41914
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
42258
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/products.js
|
|
41915
42259
|
var PRODUCTS = "SELECT c.*, b.name AS author_name, b.kind AS author_kind FROM catalog_items c LEFT JOIN bots b ON c.author_type = 'bot' AND b.id = c.author_id";
|
|
41916
42260
|
var productOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
41917
42261
|
const { database, now: now2 } = context;
|
|
@@ -42017,13 +42361,13 @@ var productsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
42017
42361
|
};
|
|
42018
42362
|
}, "productsStoreOver");
|
|
42019
42363
|
|
|
42020
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
42364
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
|
|
42021
42365
|
import { createHash as createHash19 } from "node:crypto";
|
|
42022
42366
|
|
|
42023
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
42367
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
|
|
42024
42368
|
import { createHash as createHash18 } from "node:crypto";
|
|
42025
42369
|
|
|
42026
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
42370
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/project-transfer/schema.js
|
|
42027
42371
|
var text4 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
|
|
42028
42372
|
var ref = text4(2048);
|
|
42029
42373
|
var timestamp2 = pipe(number(), safeInteger(), minValue(0));
|
|
@@ -42093,7 +42437,7 @@ var projectAnnotationsSchema = strictObject({
|
|
|
42093
42437
|
}))
|
|
42094
42438
|
});
|
|
42095
42439
|
|
|
42096
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
42440
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
|
|
42097
42441
|
var PROJECT_ANNOTATIONS_MAX_BYTES = 4 * 1024 * 1024;
|
|
42098
42442
|
var invalid7 = /* @__PURE__ */ __name((field4) => {
|
|
42099
42443
|
throw new CliError("validation_error", `invalid project annotations.${field4}`);
|
|
@@ -42226,7 +42570,7 @@ var projectAnnotationsFingerprint = /* @__PURE__ */ __name((json3) => {
|
|
|
42226
42570
|
return createHash18("sha256").update(JSON.stringify(normalized)).digest("hex");
|
|
42227
42571
|
}, "projectAnnotationsFingerprint");
|
|
42228
42572
|
|
|
42229
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
42573
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
|
|
42230
42574
|
var hash = pipe(string(), regex(/^[a-f0-9]{64}$/));
|
|
42231
42575
|
var ref2 = pipe(string(), minLength(1), maxLength(2048));
|
|
42232
42576
|
var targetSchema = strictObject({
|
|
@@ -42333,7 +42677,7 @@ var planBoundProjectAnnotations = /* @__PURE__ */ __name((manifest, manifest_fin
|
|
|
42333
42677
|
}, "planBoundProjectAnnotations");
|
|
42334
42678
|
var planProjectAnnotations = /* @__PURE__ */ __name((json3, target, bindings) => planBoundProjectAnnotations(decodeProjectAnnotations(json3), projectAnnotationsFingerprint(json3), target, bindings), "planProjectAnnotations");
|
|
42335
42679
|
|
|
42336
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
42680
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-model.js
|
|
42337
42681
|
import { createHash as createHash20 } from "node:crypto";
|
|
42338
42682
|
var text5 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
|
|
42339
42683
|
var timestamp3 = pipe(number(), safeInteger(), minValue(0));
|
|
@@ -42427,7 +42771,7 @@ var projectAnnotationSnapshotFingerprint = /* @__PURE__ */ __name((json3) => {
|
|
|
42427
42771
|
})).digest("hex");
|
|
42428
42772
|
}, "projectAnnotationSnapshotFingerprint");
|
|
42429
42773
|
|
|
42430
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
42774
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/project-transfer/request.js
|
|
42431
42775
|
var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false) => {
|
|
42432
42776
|
if (!request || typeof request !== "object" || Array.isArray(request))
|
|
42433
42777
|
throw new CliError("validation_error", "project annotation request is required");
|
|
@@ -42444,7 +42788,7 @@ var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false)
|
|
|
42444
42788
|
return { snapshot: snapshot2, projectId: Number(request.project.slice(8)) };
|
|
42445
42789
|
}, "projectAnnotationRequest");
|
|
42446
42790
|
|
|
42447
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
42791
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/budget.js
|
|
42448
42792
|
var SnapshotBudget = class {
|
|
42449
42793
|
static {
|
|
42450
42794
|
__name(this, "SnapshotBudget");
|
|
@@ -42470,13 +42814,13 @@ var SnapshotBudget = class {
|
|
|
42470
42814
|
}
|
|
42471
42815
|
};
|
|
42472
42816
|
|
|
42473
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
42817
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
|
|
42474
42818
|
import { createHash as createHash22 } from "node:crypto";
|
|
42475
42819
|
|
|
42476
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
42820
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-plan.js
|
|
42477
42821
|
var planProjectAnnotationSnapshot = /* @__PURE__ */ __name((json3, target, bindings) => planBoundProjectAnnotations(decodeProjectAnnotationSnapshot(json3), projectAnnotationSnapshotFingerprint(json3), target, bindings), "planProjectAnnotationSnapshot");
|
|
42478
42822
|
|
|
42479
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
42823
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/sources.js
|
|
42480
42824
|
import { createHash as createHash21 } from "node:crypto";
|
|
42481
42825
|
var invalid9 = /* @__PURE__ */ __name(() => {
|
|
42482
42826
|
throw new CliError("configuration_error", "project snapshot has an unavailable or unsupported dependency");
|
|
@@ -42619,7 +42963,7 @@ var ProjectSnapshotSources = class {
|
|
|
42619
42963
|
}
|
|
42620
42964
|
};
|
|
42621
42965
|
|
|
42622
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
42966
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/snapshot.js
|
|
42623
42967
|
var unsupported = /* @__PURE__ */ __name(() => {
|
|
42624
42968
|
throw new CliError("configuration_error", "project snapshot has unsupported metadata, deletion or account scope");
|
|
42625
42969
|
}, "unsupported");
|
|
@@ -42797,7 +43141,7 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, bu
|
|
|
42797
43141
|
return { snapshot: snapshot2, read_bytes: budget.bytes, records: budget.records };
|
|
42798
43142
|
}), "projectAnnotationSnapshot");
|
|
42799
43143
|
|
|
42800
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
43144
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
|
|
42801
43145
|
var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, manifest, bindings, budget) => read(database, () => {
|
|
42802
43146
|
const current = projectAnnotationSnapshot(database, projectId2, budget).snapshot;
|
|
42803
43147
|
const sources = new ProjectSnapshotSources(database, budget);
|
|
@@ -42859,7 +43203,7 @@ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, ma
|
|
|
42859
43203
|
};
|
|
42860
43204
|
}), "previewAnnotationSnapshot");
|
|
42861
43205
|
|
|
42862
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
43206
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/records.js
|
|
42863
43207
|
var metadataOf2 = /* @__PURE__ */ __name((database, link3, to) => {
|
|
42864
43208
|
const provenance2 = link3.provenance === null ? {} : { provenance: link3.provenance };
|
|
42865
43209
|
if (link3.kind === "evidence" && to)
|
|
@@ -42926,7 +43270,7 @@ var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId2, sna
|
|
|
42926
43270
|
return mappings;
|
|
42927
43271
|
}, "restoreAnnotationRecords");
|
|
42928
43272
|
|
|
42929
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
43273
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/store.js
|
|
42930
43274
|
var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
42931
43275
|
async preview(request) {
|
|
42932
43276
|
const { snapshot: snapshot2, projectId: projectId2 } = projectAnnotationRequest(request);
|
|
@@ -42956,7 +43300,7 @@ var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
42956
43300
|
}
|
|
42957
43301
|
}), "projectAnnotationStoreOver");
|
|
42958
43302
|
|
|
42959
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
43303
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projection.js
|
|
42960
43304
|
var IMPORTER = { bot: "import" };
|
|
42961
43305
|
var importersProposal = /* @__PURE__ */ __name((entity) => entity.review === "proposed" && entity.author.type === "bot" && entity.author.name === IMPORTER.bot, "importersProposal");
|
|
42962
43306
|
var codeOf = /* @__PURE__ */ __name((error) => {
|
|
@@ -43001,7 +43345,7 @@ var moneyLinesOf = /* @__PURE__ */ __name((projection, list2) => (Array.isArray(
|
|
|
43001
43345
|
};
|
|
43002
43346
|
}), "moneyLinesOf");
|
|
43003
43347
|
|
|
43004
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
43348
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/record-relations.js
|
|
43005
43349
|
var isDerived = /* @__PURE__ */ __name((role) => role.startsWith("fields."), "isDerived");
|
|
43006
43350
|
var recordRelationsOver = /* @__PURE__ */ __name(({ database }) => {
|
|
43007
43351
|
const sql2 = /* @__PURE__ */ __name((text6) => database.prepare(text6), "sql");
|
|
@@ -43072,7 +43416,7 @@ var recordRelationsOver = /* @__PURE__ */ __name(({ database }) => {
|
|
|
43072
43416
|
return { entityRef, relatedOf, storedRelations, relate, missingOf };
|
|
43073
43417
|
}, "recordRelationsOver");
|
|
43074
43418
|
|
|
43075
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
43419
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/record-remap.js
|
|
43076
43420
|
var recordRemapOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
|
|
43077
43421
|
const pointedAt = /* @__PURE__ */ __name((type, id2) => {
|
|
43078
43422
|
for (const { table, pointer } of pointerPairs(database))
|
|
@@ -43126,7 +43470,7 @@ var recordRemapOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
|
|
|
43126
43470
|
return { pointedAt, remap };
|
|
43127
43471
|
}, "recordRemapOver");
|
|
43128
43472
|
|
|
43129
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
43473
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/record-run.js
|
|
43130
43474
|
var runs = 0;
|
|
43131
43475
|
var PAGE = 500;
|
|
43132
43476
|
var recordRunOver = /* @__PURE__ */ __name((context, writes) => {
|
|
@@ -43286,7 +43630,7 @@ var waitingPointer = /* @__PURE__ */ __name((index2, missing4) => {
|
|
|
43286
43630
|
return pointerOf("records", index2, "fields", key2);
|
|
43287
43631
|
}, "waitingPointer");
|
|
43288
43632
|
|
|
43289
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
43633
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/record-matching.js
|
|
43290
43634
|
var valuesOf = /* @__PURE__ */ __name((value) => (Array.isArray(value) ? value : [value]).filter((one2) => typeof one2 === "string"), "valuesOf");
|
|
43291
43635
|
var SCHEME = /^(email|domain|tax-id:[a-z]{2}|registration:[a-z]{2})$/;
|
|
43292
43636
|
var ORG_EMAIL = "org-email";
|
|
@@ -43398,7 +43742,7 @@ var matchOf = /* @__PURE__ */ __name((context, type, ids) => {
|
|
|
43398
43742
|
return { outcome: "ambiguous", ids: found2, reason: "record.separated" };
|
|
43399
43743
|
return { outcome: "one", id: id2 };
|
|
43400
43744
|
}, "matchOf");
|
|
43401
|
-
var
|
|
43745
|
+
var IMPORT2 = "import";
|
|
43402
43746
|
var importedIdentity = /* @__PURE__ */ __name(({ database, now: now2 }, identity) => {
|
|
43403
43747
|
const held = database.prepare("SELECT id FROM identities WHERE provider = ? AND external_id = ?").get(identity.provider, identity.externalId);
|
|
43404
43748
|
if (held)
|
|
@@ -43413,8 +43757,8 @@ var linkToPerson = /* @__PURE__ */ __name((context, person2, identity, source2)
|
|
|
43413
43757
|
if (identitySeparated(context, identity, person2))
|
|
43414
43758
|
return;
|
|
43415
43759
|
const at = now2();
|
|
43416
|
-
database.prepare("INSERT INTO identity_links (identity_id, person_id, method, confidence, created_at, author, source, updated_at) VALUES (?, ?, ?, 1, ?, ?, ?, ?)").run(identity, person2,
|
|
43417
|
-
database.prepare("INSERT INTO identity_link_events (identity_id, from_person_id, to_person_id, method, created_at, author) VALUES (?, NULL, ?, ?, ?, ?)").run(identity, person2,
|
|
43760
|
+
database.prepare("INSERT INTO identity_links (identity_id, person_id, method, confidence, created_at, author, source, updated_at) VALUES (?, ?, ?, 1, ?, ?, ?, ?)").run(identity, person2, IMPORT2, at, IMPORT2, `import:${source2.provider}`, at);
|
|
43761
|
+
database.prepare("INSERT INTO identity_link_events (identity_id, from_person_id, to_person_id, method, created_at, author) VALUES (?, NULL, ?, ?, ?, ?)").run(identity, person2, IMPORT2, at, IMPORT2);
|
|
43418
43762
|
}, "linkToPerson");
|
|
43419
43763
|
var addIdentifiers = /* @__PURE__ */ __name((context, type, id2, ids, name, source2) => {
|
|
43420
43764
|
const { database, now: now2 } = context;
|
|
@@ -43432,7 +43776,7 @@ var addIdentifiers = /* @__PURE__ */ __name((context, type, id2, ids, name, sour
|
|
|
43432
43776
|
for (const { provider, value } of ids.organization) {
|
|
43433
43777
|
const identity = importedIdentity(context, { provider, externalId: value, name });
|
|
43434
43778
|
const at = now2();
|
|
43435
|
-
database.prepare("INSERT OR IGNORE INTO organization_identities (identity_id, organization_id, method, author, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?)").run(identity, id2,
|
|
43779
|
+
database.prepare("INSERT OR IGNORE INTO organization_identities (identity_id, organization_id, method, author, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?)").run(identity, id2, IMPORT2, IMPORT2, at, at);
|
|
43436
43780
|
}
|
|
43437
43781
|
}, "addIdentifiers");
|
|
43438
43782
|
var createEntity = /* @__PURE__ */ __name((context, type, fields4, ids, related, source2, externalId) => {
|
|
@@ -43474,7 +43818,7 @@ var renameMade = /* @__PURE__ */ __name(({ database, now: now2 }, type, id2, nam
|
|
|
43474
43818
|
]);
|
|
43475
43819
|
}, "renameMade");
|
|
43476
43820
|
|
|
43477
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
43821
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors-direct.js
|
|
43478
43822
|
var productFields = /* @__PURE__ */ __name((fields4) => ({
|
|
43479
43823
|
name: given(fields4, "name"),
|
|
43480
43824
|
unit: given(fields4, "unit"),
|
|
@@ -43597,7 +43941,7 @@ var DIRECT_PROJECTORS = {
|
|
|
43597
43941
|
lead: dealProjector("lead")
|
|
43598
43942
|
};
|
|
43599
43943
|
|
|
43600
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
43944
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors-money.js
|
|
43601
43945
|
var allocatedByOthers = /* @__PURE__ */ __name((context, paymentId) => {
|
|
43602
43946
|
const importer = authorActor(context, IMPORTER).actor;
|
|
43603
43947
|
return context.database.prepare("SELECT 1 FROM payment_allocations WHERE payment_id = ? AND NOT (author_type = ? AND author_id = ?) LIMIT 1").get(paymentId, importer.type, importer.id) !== void 0;
|
|
@@ -43807,7 +44151,7 @@ var MONEY_PROJECTORS = {
|
|
|
43807
44151
|
}
|
|
43808
44152
|
};
|
|
43809
44153
|
|
|
43810
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
44154
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors-phone.js
|
|
43811
44155
|
var CALLS_CALENDAR = "calls";
|
|
43812
44156
|
var importOnly = /* @__PURE__ */ __name((source2, type) => {
|
|
43813
44157
|
if (!isImportedProvider(source2.provider))
|
|
@@ -43982,7 +44326,7 @@ var PHONE_PROJECTORS = {
|
|
|
43982
44326
|
}
|
|
43983
44327
|
};
|
|
43984
44328
|
|
|
43985
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
44329
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/record-projectors.js
|
|
43986
44330
|
var RECORD_PROJECTORS = {
|
|
43987
44331
|
...MONEY_PROJECTORS,
|
|
43988
44332
|
...DIRECT_PROJECTORS,
|
|
@@ -43992,7 +44336,7 @@ var RECORD_PROJECTORS = {
|
|
|
43992
44336
|
project: null
|
|
43993
44337
|
};
|
|
43994
44338
|
|
|
43995
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
44339
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/record-settling.js
|
|
43996
44340
|
var recordSettlingOver = /* @__PURE__ */ __name(({ database }, finance) => {
|
|
43997
44341
|
const sql2 = /* @__PURE__ */ __name((text6) => database.prepare(text6), "sql");
|
|
43998
44342
|
const freeOn = /* @__PURE__ */ __name((invoice, payment) => {
|
|
@@ -44054,7 +44398,7 @@ var recordSettlingOver = /* @__PURE__ */ __name(({ database }, finance) => {
|
|
|
44054
44398
|
return { settle, checkShares };
|
|
44055
44399
|
}, "recordSettlingOver");
|
|
44056
44400
|
|
|
44057
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
44401
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/record-stamps.js
|
|
44058
44402
|
import { createHash as createHash23 } from "node:crypto";
|
|
44059
44403
|
var VOLATILE = /* @__PURE__ */ new Set(["id", "created_at", "updated_at", "metadata"]);
|
|
44060
44404
|
var content = /* @__PURE__ */ __name((row2) => row2 === void 0 ? null : Object.fromEntries(Object.entries(row2).filter(([column2]) => !VOLATILE.has(column2))), "content");
|
|
@@ -44070,7 +44414,7 @@ var importStampsOver = /* @__PURE__ */ __name(({ database }) => {
|
|
|
44070
44414
|
return { stamp, untouched };
|
|
44071
44415
|
}, "importStampsOver");
|
|
44072
44416
|
|
|
44073
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
44417
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/subscriptions.js
|
|
44074
44418
|
var SUBSCRIPTIONS = "SELECT s.*, b.name AS author_name, b.kind AS author_kind FROM subscriptions s LEFT JOIN bots b ON s.author_type = 'bot' AND b.id = s.author_id";
|
|
44075
44419
|
var PRICES = "SELECT p.*, b.name AS author_name, b.kind AS author_kind FROM subscription_prices p LEFT JOIN bots b ON p.author_type = 'bot' AND b.id = p.author_id";
|
|
44076
44420
|
var PRICE_REF = /^subscription_price:([1-9]\d{0,15})$/;
|
|
@@ -44168,9 +44512,9 @@ var subscriptionOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
44168
44512
|
if (settled === "cancelled" && cancelled3 === null)
|
|
44169
44513
|
refuse("a cancelled subscription has the day it was cancelled", "subscription.field");
|
|
44170
44514
|
const owner = ownerPerson(database);
|
|
44171
|
-
const
|
|
44172
|
-
const supplier =
|
|
44173
|
-
const customer =
|
|
44515
|
+
const party3 = /* @__PURE__ */ __name((given2, type, id2, ownerSide, what) => given2 !== void 0 ? partyThing(given2, what) : base[type] != null ? { type: String(base[type]), id: Number(base[id2]) } : ownerSide ? owner : refuse("a subscription names its supplier and its customer, a person: or organization:", "subscription.field"), "party");
|
|
44516
|
+
const supplier = party3(fields4.supplier, "supplier_type", "supplier_id", direction === "receivable", "the supplier");
|
|
44517
|
+
const customer = party3(fields4.customer, "customer_type", "customer_id", direction === "payable", "the customer");
|
|
44174
44518
|
const linked = /* @__PURE__ */ __name((given2, type, column2) => given2 === void 0 ? base[column2] ?? null : given2 === null ? null : linkedId(given2, type, "subscription.ref"), "linked");
|
|
44175
44519
|
const product = linked(fields4.product, "product", "catalog_item_id");
|
|
44176
44520
|
const productName = product === null ? null : String(database.prepare("SELECT name FROM catalog_items WHERE id = ?").get(product)?.name);
|
|
@@ -44301,7 +44645,7 @@ var subscriptionsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
44301
44645
|
};
|
|
44302
44646
|
}, "subscriptionsStoreOver");
|
|
44303
44647
|
|
|
44304
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
44648
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/wallets.js
|
|
44305
44649
|
var WALLETS = "SELECT w.*, b.name AS author_name, b.kind AS author_kind FROM financial_accounts w LEFT JOIN bots b ON w.author_type = 'bot' AND b.id = w.author_id";
|
|
44306
44650
|
var SIGNED = "CASE t.direction WHEN 'in' THEN t.amount ELSE -t.amount END";
|
|
44307
44651
|
var walletOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
@@ -44423,7 +44767,7 @@ var walletsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
44423
44767
|
};
|
|
44424
44768
|
}, "walletsStoreOver");
|
|
44425
44769
|
|
|
44426
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
44770
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/record-writes.js
|
|
44427
44771
|
var specOf = /* @__PURE__ */ __name((type) => RECORD_TYPES[type], "specOf");
|
|
44428
44772
|
var unsettled = /* @__PURE__ */ __name((fields4, relations) => recordFingerprint(fields4, relations.filter((relation) => !AMOUNT_ROLES.includes(relation.role))), "unsettled");
|
|
44429
44773
|
var tableOf2 = /* @__PURE__ */ __name((type) => typeof type === "string" && Object.hasOwn(DECIDED_TABLES, type) ? DECIDED_TABLES[type] : void 0, "tableOf");
|
|
@@ -44680,9 +45024,13 @@ var recordWritesOver = /* @__PURE__ */ __name((context) => {
|
|
|
44680
45024
|
return { writeOne, project: project2, completeDependents, entityRef, missingOf: relations.missingOf };
|
|
44681
45025
|
}, "recordWritesOver");
|
|
44682
45026
|
|
|
44683
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
45027
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/records.js
|
|
44684
45028
|
var LIMIT = 1e3;
|
|
44685
45029
|
var iso15 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
|
|
45030
|
+
var checkLimit = /* @__PURE__ */ __name((limit) => {
|
|
45031
|
+
if (!Number.isSafeInteger(limit) || limit < 1 || limit > 500)
|
|
45032
|
+
throw new CliError("validation_error", "a record list takes 1\u2013500 items");
|
|
45033
|
+
}, "checkLimit");
|
|
44686
45034
|
var IDENTITY_SQL = IDENTITY_TYPES.map((type) => `'${type}'`).join(", ");
|
|
44687
45035
|
var recordStoreOver = /* @__PURE__ */ __name((context) => {
|
|
44688
45036
|
const { database } = context;
|
|
@@ -44738,16 +45086,67 @@ var recordStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
44738
45086
|
const row2 = rowOf2(key2);
|
|
44739
45087
|
return row2 ? sourceRecordOf(row2) : void 0;
|
|
44740
45088
|
}), "get"),
|
|
44741
|
-
list: /* @__PURE__ */ __name(async ({ provider, account, type, waiting, unmatched, flagged, limit = 100 }) => {
|
|
44742
|
-
|
|
44743
|
-
throw new CliError("validation_error", "a record list takes 1\u2013500 items");
|
|
45089
|
+
list: /* @__PURE__ */ __name(async ({ provider, account, type, waiting, unmatched, flagged, entity, batch, deleted, limit = 100 }) => {
|
|
45090
|
+
checkLimit(limit);
|
|
44744
45091
|
return read(database, () => {
|
|
44745
|
-
|
|
45092
|
+
const accountId = findAccountPk(context, { provider, account });
|
|
45093
|
+
if (accountId === void 0)
|
|
44746
45094
|
return [];
|
|
44747
|
-
const
|
|
44748
|
-
|
|
45095
|
+
const where = ["r.account_id = ?"];
|
|
45096
|
+
const params = [accountId];
|
|
45097
|
+
const and2 = /* @__PURE__ */ __name((condition, ...values) => {
|
|
45098
|
+
where.push(condition);
|
|
45099
|
+
for (const value of values)
|
|
45100
|
+
params.push(value);
|
|
45101
|
+
}, "and");
|
|
45102
|
+
if (type !== void 0)
|
|
45103
|
+
and2("r.type = ?", type);
|
|
45104
|
+
if (waiting)
|
|
45105
|
+
and2(`r.entity_id IS NULL AND r.deleted_at IS NULL AND r.type NOT LIKE 'custom:%' AND r.type NOT IN (${IDENTITY_SQL})`);
|
|
45106
|
+
if (unmatched)
|
|
45107
|
+
and2(`r.entity_id IS NULL AND r.deleted_at IS NULL AND r.type IN (${IDENTITY_SQL})`);
|
|
45108
|
+
if (flagged)
|
|
45109
|
+
and2("r.entity_id IS NOT NULL AND (r.deleted_at IS NOT NULL OR r.projected_fingerprint IS NOT r.fingerprint)");
|
|
45110
|
+
if (entity !== void 0) {
|
|
45111
|
+
const thing = requiredThing(database, entity, "the entity");
|
|
45112
|
+
and2("r.entity_type = ? AND r.entity_id = ?", thing.type, thing.id);
|
|
45113
|
+
}
|
|
45114
|
+
if (batch !== void 0)
|
|
45115
|
+
and2("r.batch_id = ?", batch);
|
|
45116
|
+
if (deleted !== void 0)
|
|
45117
|
+
and2(`r.deleted_at IS ${deleted ? "NOT " : ""}NULL`);
|
|
45118
|
+
return database.prepare(`${SELECT2}WHERE ${where.join(" AND ")} ORDER BY r.updated_at DESC, r.id DESC LIMIT ?`).all(...params, limit).map(sourceRecordOf);
|
|
44749
45119
|
});
|
|
44750
45120
|
}, "list"),
|
|
45121
|
+
incoming: /* @__PURE__ */ __name(async (target, { limit = 100 } = {}) => {
|
|
45122
|
+
checkLimit(limit);
|
|
45123
|
+
return read(database, () => {
|
|
45124
|
+
let pointing;
|
|
45125
|
+
if ("externalId" in target) {
|
|
45126
|
+
const row2 = rowOf2(target);
|
|
45127
|
+
if (!row2)
|
|
45128
|
+
return [];
|
|
45129
|
+
pointing = { sql: "SELECT id FROM record_relations WHERE target_id = ?", params: [Number(row2.id)] };
|
|
45130
|
+
} else {
|
|
45131
|
+
const thing = requiredThing(database, target.entity, "the entity");
|
|
45132
|
+
pointing = {
|
|
45133
|
+
sql: "SELECT id FROM record_relations WHERE target_type = ? AND target_external_id = ? UNION SELECT rr.id FROM record_relations rr JOIN records t ON t.id = rr.target_id WHERE t.entity_type = ? AND t.entity_id = ?",
|
|
45134
|
+
params: ["ref", `${thing.type}:${thing.id}`, thing.type, thing.id]
|
|
45135
|
+
};
|
|
45136
|
+
}
|
|
45137
|
+
return database.prepare(`SELECT rr.role, rr.as_role, rr.amount, r.type, r.external_id, a.provider, a.external_id AS account FROM record_relations rr JOIN records r ON r.id = rr.record_id JOIN accounts a ON a.id = r.account_id WHERE rr.id IN (${pointing.sql}) AND r.deleted_at IS NULL AND rr.role NOT LIKE 'fields.%' ORDER BY rr.id LIMIT ?`).all(...pointing.params, limit).map((row2) => ({
|
|
45138
|
+
record: {
|
|
45139
|
+
provider: String(row2.provider),
|
|
45140
|
+
account: String(row2.account),
|
|
45141
|
+
type: String(row2.type),
|
|
45142
|
+
externalId: String(row2.external_id)
|
|
45143
|
+
},
|
|
45144
|
+
role: String(row2.role),
|
|
45145
|
+
as: row2.as_role == null ? null : String(row2.as_role),
|
|
45146
|
+
amount: row2.amount == null ? null : String(row2.amount)
|
|
45147
|
+
}));
|
|
45148
|
+
});
|
|
45149
|
+
}, "incoming"),
|
|
44751
45150
|
map: /* @__PURE__ */ __name(async (key2, entity, by) => {
|
|
44752
45151
|
if (by !== "owner")
|
|
44753
45152
|
throw new CliError("permission_error", "only the owner says which entity a record is", {
|
|
@@ -44830,7 +45229,7 @@ var recordStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
44830
45229
|
};
|
|
44831
45230
|
}, "recordStoreOver");
|
|
44832
45231
|
|
|
44833
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
45232
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/store-errors.js
|
|
44834
45233
|
var refusalOf = /* @__PURE__ */ __name((error) => error instanceof Error && error.name === "DrizzleQueryError" && error.cause instanceof CliError ? error.cause : error, "refusalOf");
|
|
44835
45234
|
var wrapped = /* @__PURE__ */ new WeakMap();
|
|
44836
45235
|
var storeErrors = /* @__PURE__ */ __name((area) => {
|
|
@@ -44865,7 +45264,7 @@ var storeErrors = /* @__PURE__ */ __name((area) => {
|
|
|
44865
45264
|
return proxy;
|
|
44866
45265
|
}, "storeErrors");
|
|
44867
45266
|
|
|
44868
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
45267
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/ranges.js
|
|
44869
45268
|
var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to) => {
|
|
44870
45269
|
const touching = and(eq(syncRanges.chatId, chatKey), lte(syncRanges.fromKey, to + 1), gte(syncRanges.toKey, from2 - 1));
|
|
44871
45270
|
let merged = { from: from2, to };
|
|
@@ -44878,7 +45277,7 @@ var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to)
|
|
|
44878
45277
|
}, "markRange");
|
|
44879
45278
|
var ranges = /* @__PURE__ */ __name(({ orm }, chatKey) => orm.select({ from: syncRanges.fromKey, to: syncRanges.toKey }).from(syncRanges).where(eq(syncRanges.chatId, chatKey)).orderBy(syncRanges.fromKey).all(), "ranges");
|
|
44880
45279
|
|
|
44881
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
45280
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/task-analysis-marks.js
|
|
44882
45281
|
var prefixOf2 = /* @__PURE__ */ __name(({ provider, account }) => `task_analysis:${provider}:${account}:`, "prefixOf");
|
|
44883
45282
|
var markOf = /* @__PURE__ */ __name((prefix, row2) => ({
|
|
44884
45283
|
chatId: String(row2.key).slice(prefix.length),
|
|
@@ -44899,17 +45298,17 @@ var setTaskAnalysisMark = /* @__PURE__ */ __name((database, account, { chatId, c
|
|
|
44899
45298
|
database.prepare("INSERT INTO store_settings (key, value, at) VALUES (?, ?, ?) ON CONFLICT (key) DO UPDATE SET value = excluded.value, at = excluded.at").run(prefixOf2(account) + chatId, JSON.stringify({ ...saved, checkedAt: checkedAt ?? new Date(now2).toISOString() }), now2);
|
|
44900
45299
|
}, "setTaskAnalysisMark");
|
|
44901
45300
|
|
|
44902
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
44903
|
-
var
|
|
45301
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/task-rule-stops.js
|
|
45302
|
+
var keyOf5 = /* @__PURE__ */ __name(({ provider, account }) => `task_rules_until:${provider}:${account}`, "keyOf");
|
|
44904
45303
|
var taskRulesStop = /* @__PURE__ */ __name((database, account) => {
|
|
44905
|
-
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(
|
|
45304
|
+
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(keyOf5(account));
|
|
44906
45305
|
return row2 ? JSON.parse(String(row2.value)) : null;
|
|
44907
45306
|
}, "taskRulesStop");
|
|
44908
45307
|
var setTaskRulesStop = /* @__PURE__ */ __name((database, account, until, now2) => {
|
|
44909
|
-
database.prepare("INSERT INTO store_settings (key, value, at) VALUES (?, ?, ?) ON CONFLICT (key) DO UPDATE SET value = excluded.value, at = excluded.at").run(
|
|
45308
|
+
database.prepare("INSERT INTO store_settings (key, value, at) VALUES (?, ?, ?) ON CONFLICT (key) DO UPDATE SET value = excluded.value, at = excluded.at").run(keyOf5(account), JSON.stringify(until), now2);
|
|
44910
45309
|
}, "setTaskRulesStop");
|
|
44911
45310
|
|
|
44912
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
45311
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sync.js
|
|
44913
45312
|
var syncStoreOver = /* @__PURE__ */ __name((context) => {
|
|
44914
45313
|
const { database } = context;
|
|
44915
45314
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, identityPk: identityPk2, writeMembers: writeMembers2, writeState: writeState2 } = keysOver(context);
|
|
@@ -44968,7 +45367,7 @@ var syncStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
44968
45367
|
};
|
|
44969
45368
|
}, "syncStoreOver");
|
|
44970
45369
|
|
|
44971
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
45370
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/tags.js
|
|
44972
45371
|
var tagsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
44973
45372
|
const { database } = context;
|
|
44974
45373
|
return {
|
|
@@ -44990,7 +45389,7 @@ var tagsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
44990
45389
|
};
|
|
44991
45390
|
}, "tagsStoreOver");
|
|
44992
45391
|
|
|
44993
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
45392
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/image-chunks.js
|
|
44994
45393
|
var IS_IMAGE = sql`(a.kind = 'photo' OR a.mime LIKE 'image/%')`;
|
|
44995
45394
|
var neighbours = /* @__PURE__ */ __name(({ orm }, chatKey, messagePk, sentAt, { messages: messages2, withinMs }, side) => orm.all(sql`SELECT sender_name AS sender, text, sent_at AS sentAt FROM messages
|
|
44996
45395
|
WHERE chat_id = ${chatKey} AND deleted_at IS NULL AND trim(text) <> '' AND id <> ${messagePk}
|
|
@@ -45117,7 +45516,7 @@ var savePictureChunks = /* @__PURE__ */ __name(({ orm, now: now2, database }, ac
|
|
|
45117
45516
|
dropUnusedVectors(database, released.map(({ hash: hash2 }) => hash2));
|
|
45118
45517
|
}, "savePictureChunks");
|
|
45119
45518
|
|
|
45120
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
45519
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/message-chunks.js
|
|
45121
45520
|
var messagesToEmbed = /* @__PURE__ */ __name(({ orm }, accountPk2, { chatKey, model, after: after2, limit }) => orm.all(sql`SELECT m.id AS messagePk, m.text, m.sent_at AS sentAt, k.content_hash AS hash,
|
|
45122
45521
|
EXISTS (SELECT 1 FROM embeddings v WHERE v.model = ${model} AND v.content_hash = k.content_hash) AS embedded
|
|
45123
45522
|
FROM messages m
|
|
@@ -45206,7 +45605,7 @@ var nearestMessages = /* @__PURE__ */ __name((context, accountPk2, { limit, quer
|
|
|
45206
45605
|
return plain2(best(found2));
|
|
45207
45606
|
}, "nearestMessages");
|
|
45208
45607
|
|
|
45209
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
45608
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/vectors.js
|
|
45210
45609
|
var accountVectorsOver = /* @__PURE__ */ __name((context, mail) => {
|
|
45211
45610
|
const { database } = context;
|
|
45212
45611
|
const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
|
|
@@ -45461,10 +45860,11 @@ var vectorsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
45461
45860
|
saveVectors: /* @__PURE__ */ __name(async (model, dims, rows) => {
|
|
45462
45861
|
write(context.database, () => saveVectors(context, model, dims, rows));
|
|
45463
45862
|
}, "saveVectors"),
|
|
45464
|
-
embeddedHashes: /* @__PURE__ */ __name(async (model, hashes) => embeddedHashes(context, model, hashes), "embeddedHashes")
|
|
45863
|
+
embeddedHashes: /* @__PURE__ */ __name(async (model, hashes) => embeddedHashes(context, model, hashes), "embeddedHashes"),
|
|
45864
|
+
vectorCounts: /* @__PURE__ */ __name(async (models) => vectorCounts(context, models), "vectorCounts")
|
|
45465
45865
|
}), "vectorsStoreOver");
|
|
45466
45866
|
|
|
45467
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
45867
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/store-tables.js
|
|
45468
45868
|
import { existsSync as existsSync2, readFileSync as readFileSync4 } from "node:fs";
|
|
45469
45869
|
import { dirname as dirname3, join as join3 } from "node:path";
|
|
45470
45870
|
var BOOKKEEPING2 = ["schema_migrations", "store_settings"];
|
|
@@ -45552,10 +45952,40 @@ var lastBackup = /* @__PURE__ */ __name((path) => {
|
|
|
45552
45952
|
}
|
|
45553
45953
|
}, "lastBackup");
|
|
45554
45954
|
|
|
45555
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
45955
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/providers.js
|
|
45556
45956
|
var registerProvider2 = /* @__PURE__ */ __name((store, entry2) => store.accounts.registerProvider(entry2), "registerProvider");
|
|
45557
45957
|
|
|
45558
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
45958
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/owner-languages.js
|
|
45959
|
+
var KEY4 = "ownerLanguages";
|
|
45960
|
+
var ISO_639_1 = new Set("aa ab ae af ak am an ar as av ay az ba be bg bi bm bn bo br bs ca ce ch co cr cs cu cv cy da de dv dz ee el en eo es et eu fa ff fi fj fo fr fy ga gd gl gn gu gv ha he hi ho hr ht hu hy hz ia id ie ig ii ik io is it iu ja jv ka kg ki kj kk kl km kn ko kr ks ku kv kw ky la lb lg li ln lo lt lu lv mg mh mi mk ml mn mr ms mt my na nb nd ne ng nl nn no nr nv ny oc oj om or os pa pi pl ps pt qu rm rn ro ru rw sa sc sd se sg si sk sl sm sn so sq sr ss st su sv sw ta te tg th ti tk tl tn to tr ts tt tw ty ug uk ur uz ve vi vo wa wo xh yi yo za zh zu".split(" "));
|
|
45961
|
+
var DEFAULT_OWNER_LANGUAGES = ["ru"];
|
|
45962
|
+
var parseOwnerLanguages = /* @__PURE__ */ __name((value) => {
|
|
45963
|
+
const codes = value.split(/[\s,]+/).map((one2) => one2.trim().toLowerCase()).filter(Boolean);
|
|
45964
|
+
const unknown2 = codes.filter((one2) => !ISO_639_1.has(one2));
|
|
45965
|
+
if (codes.length === 0 || unknown2.length > 0)
|
|
45966
|
+
throw new CliError("validation_error", `owner_languages takes ISO 639-1 language codes, the language the owner reads first first (ru,en) \u2014 ${unknown2.length > 0 ? `not ${unknown2.join(", ")}` : "at least one"}`);
|
|
45967
|
+
return [...new Set(codes)];
|
|
45968
|
+
}, "parseOwnerLanguages");
|
|
45969
|
+
var savedOwnerLanguages = /* @__PURE__ */ __name((database) => {
|
|
45970
|
+
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(KEY4);
|
|
45971
|
+
if (!row2)
|
|
45972
|
+
return void 0;
|
|
45973
|
+
try {
|
|
45974
|
+
return parseOwnerLanguages(JSON.parse(String(row2.value)).join(","));
|
|
45975
|
+
} catch {
|
|
45976
|
+
return void 0;
|
|
45977
|
+
}
|
|
45978
|
+
}, "savedOwnerLanguages");
|
|
45979
|
+
var ownerLanguages = /* @__PURE__ */ __name((database) => savedOwnerLanguages(database) ?? DEFAULT_OWNER_LANGUAGES, "ownerLanguages");
|
|
45980
|
+
var saveOwnerLanguages = /* @__PURE__ */ __name((database, languages, now2) => {
|
|
45981
|
+
if (languages === void 0) {
|
|
45982
|
+
database.prepare("DELETE FROM store_settings WHERE key = ?").run(KEY4);
|
|
45983
|
+
return;
|
|
45984
|
+
}
|
|
45985
|
+
database.prepare("INSERT INTO store_settings (key, value, at) VALUES (?, ?, ?) ON CONFLICT (key) DO UPDATE SET value = excluded.value, at = excluded.at").run(KEY4, JSON.stringify(languages), now2);
|
|
45986
|
+
}, "saveOwnerLanguages");
|
|
45987
|
+
|
|
45988
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/sqlite/store-contents.js
|
|
45559
45989
|
var COUNTED_TABLES = [
|
|
45560
45990
|
"accounts",
|
|
45561
45991
|
"chats",
|
|
@@ -45640,7 +46070,7 @@ var storeContents = /* @__PURE__ */ __name((database) => {
|
|
|
45640
46070
|
};
|
|
45641
46071
|
}, "storeContents");
|
|
45642
46072
|
|
|
45643
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
46073
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.614.0_@wirecat+cli-base@0.80.8_commander@15.0.0_esbuild@0.28.2_type_3bb6323e04e526bd9df39f840434b06b/node_modules/@wirecat/cli-core/dist/store/store.js
|
|
45644
46074
|
var openStore = /* @__PURE__ */ __name(async (options = {}) => {
|
|
45645
46075
|
const context = await openStoreContext(options);
|
|
45646
46076
|
try {
|
|
@@ -45697,9 +46127,7 @@ var storeOver = /* @__PURE__ */ __name((context) => {
|
|
|
45697
46127
|
const meetingFindings = once3(() => meetingFindingsStoreOver(context));
|
|
45698
46128
|
const evidenceFindings = once3(() => evidenceFindingsStoreOver(context));
|
|
45699
46129
|
const mailFindings = once3(() => mailFindingsStoreOver(context));
|
|
45700
|
-
const refs =
|
|
45701
|
-
summaries: /* @__PURE__ */ __name(async (texts2, options) => refSummariesOf(context.database, texts2, { ...options, now: context.now() }), "summaries")
|
|
45702
|
-
};
|
|
46130
|
+
const refs = refsStoreOver(context);
|
|
45703
46131
|
const facts2 = once3(() => factsStoreOver(context));
|
|
45704
46132
|
const finance = once3(() => financeStoreOver(context));
|
|
45705
46133
|
const orders2 = once3(() => ordersStoreOver(context));
|
|
@@ -45717,7 +46145,11 @@ var storeOver = /* @__PURE__ */ __name((context) => {
|
|
|
45717
46145
|
const proposedActions2 = once3(() => proposedActionsStoreOver(context));
|
|
45718
46146
|
const agentActions2 = once3(() => agentActionsStoreOver(context, pruneLogsWhenDue));
|
|
45719
46147
|
const meetings2 = once3(() => meetingStoreOver(context));
|
|
46148
|
+
const enrichment = once3(() => enrichmentsOver(context));
|
|
45720
46149
|
const store = {
|
|
46150
|
+
get enrichment() {
|
|
46151
|
+
return enrichment();
|
|
46152
|
+
},
|
|
45721
46153
|
get projectAnnotations() {
|
|
45722
46154
|
return projectAnnotations();
|
|
45723
46155
|
},
|
|
@@ -45807,6 +46239,7 @@ var storeOver = /* @__PURE__ */ __name((context) => {
|
|
|
45807
46239
|
return meetingFindings();
|
|
45808
46240
|
},
|
|
45809
46241
|
refs,
|
|
46242
|
+
business: businessSearchOver(context),
|
|
45810
46243
|
get evidenceFindings() {
|
|
45811
46244
|
return evidenceFindings();
|
|
45812
46245
|
},
|
|
@@ -45940,6 +46373,7 @@ export {
|
|
|
45940
46373
|
amountsOf,
|
|
45941
46374
|
amountOf,
|
|
45942
46375
|
dueDayOf,
|
|
46376
|
+
ENRICHMENT_SUBJECTS,
|
|
45943
46377
|
queryFilter,
|
|
45944
46378
|
CORPORA,
|
|
45945
46379
|
fillTrigrams,
|
|
@@ -46015,6 +46449,7 @@ export {
|
|
|
46015
46449
|
resetStems,
|
|
46016
46450
|
ADDED_KINDS,
|
|
46017
46451
|
addedSourceKeyOf,
|
|
46452
|
+
BUSINESS_FIND_MAX,
|
|
46018
46453
|
CATALOG_QUERY,
|
|
46019
46454
|
crmIdentityId,
|
|
46020
46455
|
CRM_LINK_MODES,
|
|
@@ -46072,6 +46507,11 @@ export {
|
|
|
46072
46507
|
readStoreTables,
|
|
46073
46508
|
fileFacts,
|
|
46074
46509
|
registerProvider2 as registerProvider,
|
|
46510
|
+
DEFAULT_OWNER_LANGUAGES,
|
|
46511
|
+
parseOwnerLanguages,
|
|
46512
|
+
savedOwnerLanguages,
|
|
46513
|
+
ownerLanguages,
|
|
46514
|
+
saveOwnerLanguages,
|
|
46075
46515
|
rowCounts,
|
|
46076
46516
|
storeContents,
|
|
46077
46517
|
openStore
|