@wirecat/cli-memo 0.131.18 → 0.131.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/memo.js +2 -2
- package/dist/bundle/{all-profiles-23QZDAFJ.js → all-profiles-MVF2XGZK.js} +5 -4
- package/dist/bundle/{anthropic-KRFZSA2B.js → anthropic-OPFHMF2S.js} +3 -3
- package/dist/bundle/{app-server-ESZGTLU2.js → app-server-VHVC55S3.js} +35 -34
- package/dist/bundle/auto-GDLRYDYK.js +82 -0
- package/dist/bundle/{bun-53GOPGVX.js → bun-P6TMDZGU.js} +2 -2
- package/dist/bundle/{bun-sqlite-4KFNOFXO.js → bun-sqlite-3G3NLK4O.js} +2 -2
- package/dist/bundle/{chunk-OCL47NBH.js → chunk-2KOVYXWK.js} +960 -346
- package/dist/bundle/{chunk-Q5DWAV74.js → chunk-2MNEM2CH.js} +4 -4
- package/dist/bundle/{chunk-XHTVSSX6.js → chunk-2R25UBIH.js} +20 -20
- package/dist/bundle/{chunk-XNX6I4Y6.js → chunk-36ULPM2W.js} +2 -2
- package/dist/bundle/{chunk-IJ2ZAFZ6.js → chunk-3BMUVKC7.js} +4 -4
- package/dist/bundle/{chunk-65GCFOVP.js → chunk-3ORDQ62F.js} +6 -6
- package/dist/bundle/{chunk-SCCPYBHR.js → chunk-4G46QFK5.js} +3 -3
- package/dist/bundle/{chunk-NFKJNCVK.js → chunk-4MIPN37I.js} +144 -144
- package/dist/bundle/{chunk-BHBJGVFE.js → chunk-57Q6NXQT.js} +3 -3
- package/dist/bundle/{chunk-DV3YRUZA.js → chunk-5KUPVC5M.js} +1 -1
- package/dist/bundle/{chunk-MOWIIEN4.js → chunk-5XDYV2YT.js} +1 -1
- package/dist/bundle/{chunk-VPJQJS3H.js → chunk-63XICXGM.js} +1 -1
- package/dist/bundle/{chunk-SPPM44M6.js → chunk-66YZUX2C.js} +4 -4
- package/dist/bundle/{chunk-6XRH4A37.js → chunk-6DG7VK3H.js} +2 -2
- package/dist/bundle/{chunk-DQONI6JU.js → chunk-7J5HTZCM.js} +1 -1
- package/dist/bundle/{chunk-WOYXJJOZ.js → chunk-BINR6MJ5.js} +1 -1
- package/dist/bundle/{chunk-P6CJJR55.js → chunk-BMHSGZNE.js} +4 -4
- package/dist/bundle/{chunk-TIF4AZ5I.js → chunk-BPYQYZXA.js} +10 -10
- package/dist/bundle/{chunk-I4VU7HTS.js → chunk-D6G23NFJ.js} +1 -1
- package/dist/bundle/{chunk-Q7EZ4RG7.js → chunk-EFKEG2BA.js} +2 -2
- package/dist/bundle/{chunk-2UATT3OK.js → chunk-EL4ZKQUN.js} +2 -2
- package/dist/bundle/{chunk-OTPEBFD4.js → chunk-EMKFG5BP.js} +2 -2
- package/dist/bundle/{chunk-OWI3LD55.js → chunk-F5CQ2NVA.js} +10 -87
- package/dist/bundle/{chunk-W32TSBMM.js → chunk-FMSA2X3E.js} +1 -1
- package/dist/bundle/{chunk-3V7N7LX3.js → chunk-FRB4UXJG.js} +5 -5
- package/dist/bundle/{chunk-UR2XQFDT.js → chunk-G7TF4E7B.js} +1 -1
- package/dist/bundle/{chunk-I5FQ6YVU.js → chunk-GJKM32WA.js} +20 -20
- package/dist/bundle/{chunk-CAIAS3VT.js → chunk-IW3U6XXI.js} +3 -3
- package/dist/bundle/chunk-JDJDNMCP.js +93 -0
- package/dist/bundle/{chunk-OVNALS6T.js → chunk-JHKTN6NL.js} +9 -9
- package/dist/bundle/{chunk-46UHRZHI.js → chunk-KIEBEYKH.js} +5 -5
- package/dist/bundle/{chunk-HJDLAJGM.js → chunk-KO455254.js} +12 -12
- package/dist/bundle/{chunk-QVDHD7UF.js → chunk-KVVDRD7M.js} +1 -1
- package/dist/bundle/{chunk-PUZ3VNLX.js → chunk-LDVU22MF.js} +5 -5
- package/dist/bundle/{chunk-A7KQAW7W.js → chunk-LEUNYKL6.js} +2 -2
- package/dist/bundle/{chunk-ZEY2XV7V.js → chunk-LKYHSVQL.js} +7 -7
- package/dist/bundle/{chunk-3RXPDCSZ.js → chunk-LQJ4KHXK.js} +8 -8
- package/dist/bundle/{chunk-55M2ZGXO.js → chunk-NKTAEBCU.js} +3 -3
- package/dist/bundle/{chunk-CL5QVFJA.js → chunk-OTHEM74Z.js} +5 -5
- package/dist/bundle/{chunk-OMTNOGFW.js → chunk-OVFMY6ZP.js} +1 -1
- package/dist/bundle/{chunk-76I4DYXH.js → chunk-P22V2OLJ.js} +18 -9
- package/dist/bundle/{chunk-P7AB4FU3.js → chunk-RFB5LOYR.js} +4 -4
- package/dist/bundle/{chunk-BXF52WH2.js → chunk-SHDZVM3B.js} +1 -1
- package/dist/bundle/{chunk-RFVAYHGN.js → chunk-SJLVBJ2L.js} +1 -1
- package/dist/bundle/{chunk-PV6UEVGF.js → chunk-SO6VNTF6.js} +1 -1
- package/dist/bundle/{chunk-XQN3RYNB.js → chunk-T557KUST.js} +2 -2
- package/dist/bundle/{chunk-QEX6BCTL.js → chunk-TQNQS6TR.js} +43 -43
- package/dist/bundle/{chunk-OC5LYRFA.js → chunk-UC4IL2P7.js} +1 -1
- package/dist/bundle/{chunk-MFRJZAVS.js → chunk-V7DZG62U.js} +7 -7
- package/dist/bundle/{chunk-IENYANCU.js → chunk-VQGVPDMH.js} +11 -11
- package/dist/bundle/{chunk-6CWWZJM6.js → chunk-VUWUSGSN.js} +4 -4
- package/dist/bundle/{chunk-ZMRINA7O.js → chunk-WOIRWVDJ.js} +243 -243
- package/dist/bundle/{chunk-HI2DICLB.js → chunk-WRPRPVZF.js} +27 -27
- package/dist/bundle/{chunk-GJM5FMWW.js → chunk-XWS4PTES.js} +320 -241
- package/dist/bundle/{chunk-VADQ64BX.js → chunk-XZWUBDBG.js} +1 -1
- package/dist/bundle/{chunk-DDRCYAOJ.js → chunk-YVECM7XA.js} +3 -3
- package/dist/bundle/{chunk-H6F7WZRW.js → chunk-Z54GPSVH.js} +51 -51
- package/dist/bundle/{chunk-MQ2TLCNP.js → chunk-ZYM4M62Q.js} +1 -1
- package/dist/bundle/{command-contract-RO6MFDXO.js → command-contract-NMJKYTS4.js} +11 -10
- package/dist/bundle/{decode-4ZC23D7U.js → decode-BUTF6VGO.js} +2 -2
- package/dist/bundle/{echarts-PWJPVWHJ.js → echarts-KH3YOWMK.js} +2 -2
- package/dist/bundle/{embed-HASNG6ER.js → embed-WBVM7KQ2.js} +3 -3
- package/dist/bundle/{embedder-NU6EJLTB.js → embedder-27HQIFHM.js} +6 -6
- package/dist/bundle/{entry-SFSRFMWO.js → entry-K2WWMF2B.js} +4 -4
- package/dist/bundle/failure-OJI6C5JA.js +62 -0
- package/dist/bundle/{first-run-OSNIHVHZ.js → first-run-7P5N72VR.js} +5 -5
- package/dist/bundle/{first-screen-26B3BEL6.js → first-screen-3GM5HC4Y.js} +12 -11
- package/dist/bundle/{instructions-V54XGULG.js → instructions-POJKHKRZ.js} +1 -1
- package/dist/bundle/mcp-YGWNSJUH.js +86 -0
- package/dist/bundle/memo.js +6 -6
- package/dist/bundle/{node-J7TQQBYI.js → node-W245R2OP.js} +2 -2
- package/dist/bundle/{node-sqlite-ESX7VQKP.js → node-sqlite-FUYOXFW5.js} +3 -3
- package/dist/bundle/{oauth-TXZKIG4H.js → oauth-ATB3NWQA.js} +4 -4
- package/dist/bundle/{open-QRACRP6K.js → open-HEBEWCYB.js} +2 -2
- package/dist/bundle/{openai-QSUFOP44.js → openai-DN7NA2IU.js} +7 -7
- package/dist/bundle/{process-PECJIROU.js → process-QTIDOJMF.js} +1 -1
- package/dist/bundle/{program-VLYHKDRG.js → program-62ISSWCE.js} +238 -91
- package/dist/bundle/{prompt-E3RWYIKM.js → prompt-RQXVPJ4A.js} +2 -2
- package/dist/bundle/{recognize-X45GM6LD.js → recognize-G7NIZ3IT.js} +1 -1
- package/dist/bundle/{remote-YBR4S7UN.js → remote-H452UBSK.js} +4 -4
- package/dist/bundle/{rerank-35IH2PCJ.js → rerank-77UYD2UD.js} +4 -4
- package/dist/bundle/{serve-IRUY567I.js → serve-L6R4ODZV.js} +6 -6
- package/dist/bundle/{server-D5SWP77Y.js → server-NB3U4PPW.js} +57 -51
- package/dist/bundle/server-SWUSQSRW.js +44 -0
- package/dist/bundle/server-W4IKTTUY.js +57 -0
- package/dist/bundle/{setup-K53LBBVC.js → setup-ZGH5OZ7A.js} +39 -38
- package/dist/bundle/{state-2GC644IL.js → state-KHMYDV4I.js} +3 -3
- package/dist/bundle/{store-73MT2RVQ.js → store-M7KGTLUG.js} +9 -8
- package/dist/bundle/store-maintenance-command-ZPN2ZUL4.js +44 -0
- package/dist/bundle/update-2IYA7RJU.js +65 -0
- package/dist/discovery/command.d.ts.map +1 -1
- package/dist/discovery/command.js +1 -0
- package/dist/discovery/command.js.map +1 -1
- package/dist/examples.d.ts.map +1 -1
- package/dist/examples.js +10 -0
- package/dist/examples.js.map +1 -1
- package/dist/mcp/catalogue.d.ts +3 -0
- package/dist/mcp/catalogue.d.ts.map +1 -1
- package/dist/mcp/catalogue.js +9 -2
- package/dist/mcp/catalogue.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +31 -0
- package/dist/program.js.map +1 -1
- package/dist/records/import.d.ts +8 -0
- package/dist/records/import.d.ts.map +1 -0
- package/dist/records/import.js +79 -0
- package/dist/records/import.js.map +1 -0
- package/dist/records/mapping.d.ts +9 -0
- package/dist/records/mapping.d.ts.map +1 -0
- package/dist/records/mapping.js +67 -0
- package/dist/records/mapping.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/skills/cli-memo/SKILL.md +5 -0
- package/dist/bundle/auto-BA5VRQIC.js +0 -81
- package/dist/bundle/failure-2E4CILMB.js +0 -61
- package/dist/bundle/mcp-M62VFVJS.js +0 -85
- package/dist/bundle/server-KMM6CFGV.js +0 -56
- package/dist/bundle/server-YUAIDS2B.js +0 -43
- package/dist/bundle/store-maintenance-command-TWJ4VLK5.js +0 -43
- package/dist/bundle/update-BI2FTFUU.js +0 -64
- /package/dist/bundle/{chunk-GUJ6OEF7.js → chunk-7YF2MSEC.js} +0 -0
|
@@ -63,7 +63,11 @@ import {
|
|
|
63
63
|
validateQuery,
|
|
64
64
|
walkQuery,
|
|
65
65
|
zonedMoment
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-Z54GPSVH.js";
|
|
67
|
+
import {
|
|
68
|
+
holdsCredential,
|
|
69
|
+
secretNamed
|
|
70
|
+
} from "./chunk-JDJDNMCP.js";
|
|
67
71
|
import {
|
|
68
72
|
DEFAULT_STEMMERS,
|
|
69
73
|
DEFAULT_STEMMERS_VERSION,
|
|
@@ -76,25 +80,25 @@ import {
|
|
|
76
80
|
fold,
|
|
77
81
|
normalize,
|
|
78
82
|
parseStemmers
|
|
79
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-LKYHSVQL.js";
|
|
80
84
|
import {
|
|
81
85
|
DEFAULT_TASK_CATEGORIES,
|
|
82
86
|
sharedConfigPath,
|
|
83
87
|
storedTaskCategories,
|
|
84
88
|
taskCategoriesReader
|
|
85
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-RFB5LOYR.js";
|
|
86
90
|
import {
|
|
87
91
|
storePath
|
|
88
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-7J5HTZCM.js";
|
|
89
93
|
import {
|
|
90
94
|
quietSqliteWarning,
|
|
91
95
|
storeCapable
|
|
92
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-OTHEM74Z.js";
|
|
93
97
|
import {
|
|
94
98
|
PRAGMAS,
|
|
95
99
|
TIME_LIMIT_FUNCTION,
|
|
96
100
|
TimeLimitReached
|
|
97
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-XZWUBDBG.js";
|
|
98
102
|
import {
|
|
99
103
|
SQLiteTable,
|
|
100
104
|
TableAliasProxyHandler,
|
|
@@ -119,7 +123,7 @@ import {
|
|
|
119
123
|
sql,
|
|
120
124
|
sqliteTable,
|
|
121
125
|
text
|
|
122
|
-
} from "./chunk-
|
|
126
|
+
} from "./chunk-FMSA2X3E.js";
|
|
123
127
|
import {
|
|
124
128
|
CliError,
|
|
125
129
|
array,
|
|
@@ -147,7 +151,7 @@ import {
|
|
|
147
151
|
__name
|
|
148
152
|
} from "./chunk-ZVVMGPBJ.js";
|
|
149
153
|
|
|
150
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
154
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/account-store.js
|
|
151
155
|
var bindArea = /* @__PURE__ */ __name(({ keyed, whole }, account) => {
|
|
152
156
|
const methods = whole;
|
|
153
157
|
return Object.fromEntries(Object.keys(keyed).map((name) => [
|
|
@@ -275,7 +279,7 @@ var bindAccount = /* @__PURE__ */ __name((store, account, areas, owners) => {
|
|
|
275
279
|
};
|
|
276
280
|
}, "bindAccount");
|
|
277
281
|
|
|
278
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
282
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/domain/locator.js
|
|
279
283
|
var SCHEME = "msg:";
|
|
280
284
|
var formatLocator = /* @__PURE__ */ __name(({ provider, account, chat: chat2, message: message2 }) => SCHEME + [provider, account, chat2, message2].map(encodeURIComponent).join("/"), "formatLocator");
|
|
281
285
|
var isLocator = /* @__PURE__ */ __name((reference2) => reference2.trim().startsWith(SCHEME), "isLocator");
|
|
@@ -289,7 +293,7 @@ var parseLocator = /* @__PURE__ */ __name((reference2) => {
|
|
|
289
293
|
return { provider, account, chat: chat2, message: message2 };
|
|
290
294
|
}, "parseLocator");
|
|
291
295
|
|
|
292
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
296
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/domain/references.js
|
|
293
297
|
var SIMPLE_REFERENCES = [
|
|
294
298
|
"note",
|
|
295
299
|
"document",
|
|
@@ -436,7 +440,7 @@ var looksLikeReference = /* @__PURE__ */ __name((text6) => {
|
|
|
436
440
|
return match !== null && byPrefix.has(match[1]);
|
|
437
441
|
}, "looksLikeReference");
|
|
438
442
|
|
|
439
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
443
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/domain/providers.js
|
|
440
444
|
var KINDS = ["messages", "mail", "notes", "documents", "meetings", "events"];
|
|
441
445
|
var MESSENGER_OPENS = { chat: "messages list", message: "messages show", contact: "contacts show" };
|
|
442
446
|
var PROVIDERS = [
|
|
@@ -552,7 +556,7 @@ var providerNamed = /* @__PURE__ */ __name((word) => {
|
|
|
552
556
|
var kindIn = /* @__PURE__ */ __name((provider) => isFolderProvider(provider) ? "notes" : registry.find(({ name }) => name === provider)?.kind, "kindIn");
|
|
553
557
|
var kindOf = /* @__PURE__ */ __name((provider) => kindIn(provider) ?? "messages", "kindOf");
|
|
554
558
|
|
|
555
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
559
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/search/query.js
|
|
556
560
|
var isBotProvider = /* @__PURE__ */ __name((provider) => provider.endsWith("-bot"), "isBotProvider");
|
|
557
561
|
var inSource = /* @__PURE__ */ __name((source2, provider) => source2 === "all" || source2 === "bots" && isBotProvider(provider) || source2 === "personal" && !isBotProvider(provider) || source2 === provider || providerNamed(source2)?.name === provider || isKind(source2) && kindOf(provider) === source2, "inSource");
|
|
558
562
|
var fail = /* @__PURE__ */ __name((message2) => {
|
|
@@ -575,7 +579,7 @@ var sourceOf = /* @__PURE__ */ __name((name, value, providers2) => {
|
|
|
575
579
|
return fail(`${name} takes ${[...sources, "messages", "mail"].join(", ")} \u2014 not "${value}"`);
|
|
576
580
|
}, "sourceOf");
|
|
577
581
|
|
|
578
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
582
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/search/account-list.js
|
|
579
583
|
var ACCOUNT_GROUPS = "accountGroups";
|
|
580
584
|
var ACCOUNT_GROUPS_SETTING = "account_groups";
|
|
581
585
|
var GROUP_NAME = /^[a-z0-9][a-z0-9_-]*$/i;
|
|
@@ -762,7 +766,7 @@ var fitting = /* @__PURE__ */ __name((entries, kinds2, what, reasonOf2 = (kind4)
|
|
|
762
766
|
return { accounts: [...chosen.values()], skipped };
|
|
763
767
|
}, "fitting");
|
|
764
768
|
|
|
765
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
769
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/drizzle/core.js
|
|
766
770
|
var IndexBuilderOn = class {
|
|
767
771
|
static {
|
|
768
772
|
__name(this, "IndexBuilderOn");
|
|
@@ -957,7 +961,7 @@ function alias(table, alias2) {
|
|
|
957
961
|
}
|
|
958
962
|
__name(alias, "alias");
|
|
959
963
|
|
|
960
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
964
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/entity-types.js
|
|
961
965
|
var ENTITY_TABLES = {
|
|
962
966
|
account: "accounts",
|
|
963
967
|
attachment: "attachments",
|
|
@@ -999,7 +1003,7 @@ var orphanPointers = /* @__PURE__ */ __name((database) => pointerPairs(database)
|
|
|
999
1003
|
return { table, pointer, type, count, known: known2 };
|
|
1000
1004
|
}).filter(({ count }) => count > 0)), "orphanPointers");
|
|
1001
1005
|
|
|
1002
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1006
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/canonical-tags.js
|
|
1003
1007
|
var canonicalTags = sqliteTable("canonical_tags", {
|
|
1004
1008
|
id: integer("id").primaryKey(),
|
|
1005
1009
|
name: text("name").notNull().unique(),
|
|
@@ -1008,7 +1012,7 @@ var canonicalTags = sqliteTable("canonical_tags", {
|
|
|
1008
1012
|
updatedAt: integer("updated_at").notNull()
|
|
1009
1013
|
});
|
|
1010
1014
|
|
|
1011
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1015
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-transfers.js
|
|
1012
1016
|
var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
|
|
1013
1017
|
sourceKey: text("source_key").notNull(),
|
|
1014
1018
|
collection: text("collection").notNull(),
|
|
@@ -1018,13 +1022,13 @@ var documentAnnotationTransfers = sqliteTable("document_annotation_transfers", {
|
|
|
1018
1022
|
createdAt: integer("created_at").notNull()
|
|
1019
1023
|
}, (table) => [primaryKey({ columns: [table.sourceKey, table.collection] })]);
|
|
1020
1024
|
|
|
1021
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1025
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/document-index-pending.js
|
|
1022
1026
|
var documentIndexPending = sqliteTable("document_index_pending", {
|
|
1023
1027
|
id: integer("id").notNull(),
|
|
1024
1028
|
indexableType: text("indexable_type").notNull()
|
|
1025
1029
|
}, (table) => [primaryKey({ columns: [table.indexableType, table.id] })]);
|
|
1026
1030
|
|
|
1027
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1031
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/schema/tag-consolidations.js
|
|
1028
1032
|
var tagRedirects = sqliteTable("tag_redirects", {
|
|
1029
1033
|
sourceId: integer("source_id").primaryKey().references(() => canonicalTags.id),
|
|
1030
1034
|
survivorId: integer("survivor_id").notNull().references(() => canonicalTags.id),
|
|
@@ -1050,7 +1054,7 @@ var tagConsolidations = sqliteTable("tag_consolidations", {
|
|
|
1050
1054
|
index("tag_consolidations_by_actor_type_actor_id").on(table.actorType, table.actorId)
|
|
1051
1055
|
]);
|
|
1052
1056
|
|
|
1053
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1057
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/schema.js
|
|
1054
1058
|
var accounts = sqliteTable("accounts", {
|
|
1055
1059
|
id: integer("id").primaryKey(),
|
|
1056
1060
|
provider: text("provider").notNull(),
|
|
@@ -2333,6 +2337,38 @@ var paymentAllocations = sqliteTable("payment_allocations", {
|
|
|
2333
2337
|
index("payment_allocations_by_invoice_id").on(table.invoiceId),
|
|
2334
2338
|
index("payment_allocations_by_author_type_author_id").on(table.authorType, table.authorId)
|
|
2335
2339
|
]);
|
|
2340
|
+
var records = sqliteTable("records", {
|
|
2341
|
+
id: integer("id").primaryKey(),
|
|
2342
|
+
accountId: integer("account_id").notNull().references(() => accounts.id),
|
|
2343
|
+
type: text("type").notNull(),
|
|
2344
|
+
externalId: text("external_id").notNull(),
|
|
2345
|
+
fields: text("fields").notNull(),
|
|
2346
|
+
revision: integer("revision"),
|
|
2347
|
+
fingerprint: text("fingerprint").notNull(),
|
|
2348
|
+
entityType: text("entity_type"),
|
|
2349
|
+
entityId: integer("entity_id"),
|
|
2350
|
+
projectedFingerprint: text("projected_fingerprint"),
|
|
2351
|
+
batchId: text("batch_id").notNull(),
|
|
2352
|
+
createdAt: integer("created_at").notNull(),
|
|
2353
|
+
updatedAt: integer("updated_at").notNull(),
|
|
2354
|
+
deletedAt: integer("deleted_at")
|
|
2355
|
+
}, (table) => [
|
|
2356
|
+
unique().on(table.accountId, table.type, table.externalId),
|
|
2357
|
+
index("records_by_entity_type_entity_id").on(table.entityType, table.entityId)
|
|
2358
|
+
]);
|
|
2359
|
+
var recordRelations = sqliteTable("record_relations", {
|
|
2360
|
+
id: integer("id").primaryKey(),
|
|
2361
|
+
recordId: integer("record_id").notNull().references(() => records.id),
|
|
2362
|
+
role: text("role").notNull(),
|
|
2363
|
+
targetType: text("target_type").notNull(),
|
|
2364
|
+
targetExternalId: text("target_external_id").notNull(),
|
|
2365
|
+
targetId: integer("target_id").references(() => records.id),
|
|
2366
|
+
createdAt: integer("created_at").notNull()
|
|
2367
|
+
}, (table) => [
|
|
2368
|
+
unique().on(table.recordId, table.role, table.targetType, table.targetExternalId),
|
|
2369
|
+
index("record_relations_by_target_type_target_external_id").on(table.targetType, table.targetExternalId),
|
|
2370
|
+
index("record_relations_by_target_id").on(table.targetId)
|
|
2371
|
+
]);
|
|
2336
2372
|
var proposedActions = sqliteTable("proposed_actions", {
|
|
2337
2373
|
id: integer("id").primaryKey(),
|
|
2338
2374
|
kind: text("kind").notNull(),
|
|
@@ -2641,7 +2677,7 @@ var storeSettings = sqliteTable("store_settings", {
|
|
|
2641
2677
|
at: integer("at").notNull()
|
|
2642
2678
|
});
|
|
2643
2679
|
|
|
2644
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
2680
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/involvement-queue.js
|
|
2645
2681
|
var ARMS = [
|
|
2646
2682
|
[
|
|
2647
2683
|
"message",
|
|
@@ -2768,7 +2804,7 @@ var drainInvolvementQueue = /* @__PURE__ */ __name((database, cap = QUEUE_CAP) =
|
|
|
2768
2804
|
return recomputed;
|
|
2769
2805
|
}, "drainInvolvementQueue");
|
|
2770
2806
|
|
|
2771
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
2807
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/domain/mentions.js
|
|
2772
2808
|
import { domainToUnicode } from "node:url";
|
|
2773
2809
|
|
|
2774
2810
|
// node_modules/.pnpm/psl@1.15.0/node_modules/psl/dist/psl.mjs
|
|
@@ -12790,7 +12826,7 @@ var oa = /* @__PURE__ */ __name((e) => {
|
|
|
12790
12826
|
}, "oa");
|
|
12791
12827
|
var na = { parse: O, get: aa, isValid: oa };
|
|
12792
12828
|
|
|
12793
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
12829
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/domain/google-documents.js
|
|
12794
12830
|
var LINK = /https?:\/\/(?:(?:docs|drive|sheets|slides)\.google\.com|forms\.gle)(?:[/?#][^\s<>"'`]*)?/gi;
|
|
12795
12831
|
var ID = /^[\w-]{10,}$/;
|
|
12796
12832
|
var trimUrl = /* @__PURE__ */ __name((url) => {
|
|
@@ -12831,7 +12867,7 @@ var googleDocumentLinks = /* @__PURE__ */ __name((text6) => [...text6.matchAll(L
|
|
|
12831
12867
|
return { url, documentId: googleDocumentId(url) };
|
|
12832
12868
|
}), "googleDocumentLinks");
|
|
12833
12869
|
|
|
12834
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
12870
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
|
|
12835
12871
|
var PHONE_PLANS = [
|
|
12836
12872
|
{
|
|
12837
12873
|
country: "us",
|
|
@@ -13211,7 +13247,7 @@ var PHONE_PLANS = [
|
|
|
13211
13247
|
}
|
|
13212
13248
|
];
|
|
13213
13249
|
|
|
13214
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13250
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/domain/phones.js
|
|
13215
13251
|
var PHONE_COUNTRIES = PHONE_PLANS.map((plan) => plan.country);
|
|
13216
13252
|
var DEFAULT_PHONE_COUNTRIES = ["ru"];
|
|
13217
13253
|
var parsePhoneCountries = /* @__PURE__ */ __name((value) => {
|
|
@@ -13252,7 +13288,7 @@ var nationalPhone = /* @__PURE__ */ __name((digits, countries, { anyType }) => {
|
|
|
13252
13288
|
return void 0;
|
|
13253
13289
|
}, "nationalPhone");
|
|
13254
13290
|
|
|
13255
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13291
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/domain/places.js
|
|
13256
13292
|
var BEFORE = [
|
|
13257
13293
|
[/^(?:ул\.?|улиц[аеыу]|улицей)$/iu, "\u0443\u043B\u0438\u0446\u0430"],
|
|
13258
13294
|
[/^(?:пр-т|просп\.?|проспект[аеу]?)$/iu, "\u043F\u0440\u043E\u0441\u043F\u0435\u043A\u0442"],
|
|
@@ -13512,7 +13548,7 @@ var findPlaces = /* @__PURE__ */ __name((text6) => {
|
|
|
13512
13548
|
return found2.sort((a, b) => a.start - b.start);
|
|
13513
13549
|
}, "findPlaces");
|
|
13514
13550
|
|
|
13515
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13551
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/domain/mentions.js
|
|
13516
13552
|
var MENTION_KINDS = ["phone", "email", "url", "document", "person-name", "place"];
|
|
13517
13553
|
var MENTION_VERSIONS = {
|
|
13518
13554
|
phone: 1,
|
|
@@ -13562,10 +13598,10 @@ var SCHEME_URL = /\bhttps?:\/\/[^\s<>"'`«»]+/giu;
|
|
|
13562
13598
|
var BARE_URL = new RegExp("(?<![\\p{L}\\p{N}@._/-])(?:www\\.)?(?:[\\p{L}\\p{N}-]+\\.)+\\p{L}{2,}(?:\\/[^\\s<>\"'`\xAB\xBB]*)?", "gu");
|
|
13563
13599
|
var FILE_SUFFIXES = /* @__PURE__ */ new Set(["md", "py", "sh", "pl", "rs", "cc", "cs", "ps", "rb", "mov", "zip", "im"]);
|
|
13564
13600
|
var TRACKING = /^(?:utm_.+|fbclid|gclid|yclid|mc_cid|mc_eid|_openstat)$/i;
|
|
13565
|
-
var normalizedUrl = /* @__PURE__ */ __name((
|
|
13601
|
+
var normalizedUrl = /* @__PURE__ */ __name((written2) => {
|
|
13566
13602
|
let parsed3;
|
|
13567
13603
|
try {
|
|
13568
|
-
parsed3 = new URL(/^https?:\/\//i.test(
|
|
13604
|
+
parsed3 = new URL(/^https?:\/\//i.test(written2) ? written2 : `https://${written2}`);
|
|
13569
13605
|
} catch {
|
|
13570
13606
|
return null;
|
|
13571
13607
|
}
|
|
@@ -13581,11 +13617,11 @@ var normalizedUrl = /* @__PURE__ */ __name((written) => {
|
|
|
13581
13617
|
}, "normalizedUrl");
|
|
13582
13618
|
var urls = /* @__PURE__ */ __name((text6) => {
|
|
13583
13619
|
const found2 = [];
|
|
13584
|
-
const add = /* @__PURE__ */ __name((start,
|
|
13585
|
-
const url = normalizedUrl(
|
|
13620
|
+
const add = /* @__PURE__ */ __name((start, written2, confidence) => {
|
|
13621
|
+
const url = normalizedUrl(written2);
|
|
13586
13622
|
if (!url)
|
|
13587
13623
|
return;
|
|
13588
|
-
const end = start +
|
|
13624
|
+
const end = start + written2.length;
|
|
13589
13625
|
found2.push({ kind: "url", start, end, value: url.value, domain: siteOf(url.host), confidence });
|
|
13590
13626
|
const documentId = googleDocumentId(url.value);
|
|
13591
13627
|
if (documentId)
|
|
@@ -13597,15 +13633,15 @@ var urls = /* @__PURE__ */ __name((text6) => {
|
|
|
13597
13633
|
for (const match of text6.matchAll(BARE_URL)) {
|
|
13598
13634
|
if (taken(match.index))
|
|
13599
13635
|
continue;
|
|
13600
|
-
const
|
|
13601
|
-
const writtenHost =
|
|
13636
|
+
const written2 = trimUrl(match[0]);
|
|
13637
|
+
const writtenHost = written2.split("/")[0] ?? "";
|
|
13602
13638
|
const host = writtenHost.toLowerCase();
|
|
13603
13639
|
const suffix = host.split(".").at(-1) ?? "";
|
|
13604
|
-
const code = new RegExp("\\p{Lu}", "u").test(writtenHost.split(".").at(-1) ?? "") || /^[([]/.test(text6[match.index +
|
|
13640
|
+
const code = new RegExp("\\p{Lu}", "u").test(writtenHost.split(".").at(-1) ?? "") || /^[([]/.test(text6[match.index + written2.length] ?? "");
|
|
13605
13641
|
const parsed3 = na.parse(host);
|
|
13606
13642
|
if (code || FILE_SUFFIXES.has(suffix) || "error" in parsed3 || !parsed3.listed)
|
|
13607
13643
|
continue;
|
|
13608
|
-
add(match.index,
|
|
13644
|
+
add(match.index, written2, host.startsWith("www.") ? 0.9 : 0.6);
|
|
13609
13645
|
}
|
|
13610
13646
|
return found2;
|
|
13611
13647
|
}, "urls");
|
|
@@ -13622,22 +13658,22 @@ var SPANISH_GROUPS = /^[6-9]\d{2}[ \u00a0\-–]\d{3}[ \u00a0\-–]\d{3}$/;
|
|
|
13622
13658
|
var phones = /* @__PURE__ */ __name((text6, urlSpans, countries) => {
|
|
13623
13659
|
const found2 = [];
|
|
13624
13660
|
for (const match of text6.matchAll(PHONE_CANDIDATE)) {
|
|
13625
|
-
const
|
|
13661
|
+
const written2 = match[0];
|
|
13626
13662
|
const start = match.index;
|
|
13627
|
-
const end = start +
|
|
13663
|
+
const end = start + written2.length;
|
|
13628
13664
|
if (urlSpans.some((url) => start < url.end && end > url.start))
|
|
13629
13665
|
continue;
|
|
13630
|
-
const international =
|
|
13631
|
-
const digits = (international ?
|
|
13632
|
-
if (digits.length < 7 || digits.length > 15 || DATE.test(
|
|
13666
|
+
const international = written2.startsWith("+") || /^00[1-9]/.test(written2);
|
|
13667
|
+
const digits = (international ? written2.replace(/\(0\)/, "") : written2).replace(SEPARATORS, "").replace(/^\+|^00/, "");
|
|
13668
|
+
if (digits.length < 7 || digits.length > 15 || DATE.test(written2) || IP.test(written2))
|
|
13633
13669
|
continue;
|
|
13634
13670
|
const before2 = text6.slice(Math.max(0, start - 25), start);
|
|
13635
13671
|
const after2 = text6.slice(end, end + 6);
|
|
13636
13672
|
if (NOT_PHONE_WORD.test(before2) || CURRENCY_BEFORE.test(before2) || CURRENCY_AFTER.test(after2))
|
|
13637
13673
|
continue;
|
|
13638
13674
|
const named2 = PHONE_WORD.test(before2);
|
|
13639
|
-
const grouped =
|
|
13640
|
-
const shaped = international && digits.length >= 10 || /\(\d{3,5}\)/.test(
|
|
13675
|
+
const grouped = written2 !== written2.replace(SEPARATORS, "");
|
|
13676
|
+
const shaped = international && digits.length >= 10 || /\(\d{3,5}\)/.test(written2) || RUSSIAN_GROUPS.test(written2) || SPANISH_GROUPS.test(written2);
|
|
13641
13677
|
if (international) {
|
|
13642
13678
|
if (!shaped && !named2)
|
|
13643
13679
|
continue;
|
|
@@ -13702,7 +13738,7 @@ var typedPhone = /* @__PURE__ */ __name((typed, { phoneCountries = DEFAULT_PHONE
|
|
|
13702
13738
|
};
|
|
13703
13739
|
}, "typedPhone");
|
|
13704
13740
|
|
|
13705
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13741
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/domain/first-names.js
|
|
13706
13742
|
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";
|
|
13707
13743
|
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";
|
|
13708
13744
|
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";
|
|
@@ -13710,7 +13746,7 @@ var NOT_NAMES = ["\u0436\u0435\u043D\u0430", "\u0436\u0435\u043D\u044B", "\u0436
|
|
|
13710
13746
|
var FIRST_NAMES = [...new Set(`${RUSSIAN} ${EUROPEAN}`.split(" "))];
|
|
13711
13747
|
var NAME_WORDS = WORDS.split(" ");
|
|
13712
13748
|
|
|
13713
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13749
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/domain/person-names.js
|
|
13714
13750
|
var LATIN_TO_CYRILLIC = {
|
|
13715
13751
|
shch: "\u0449",
|
|
13716
13752
|
sch: "\u0449",
|
|
@@ -13790,9 +13826,9 @@ var bearersOf = /* @__PURE__ */ __name(({ people: people2, stem }, word) => {
|
|
|
13790
13826
|
const byStem = people2.get(keyOf2(stem, word));
|
|
13791
13827
|
const lower = word.toLowerCase();
|
|
13792
13828
|
for (let cut2 = 0; cut2 <= MAX_ENDING && lower.length - cut2 >= MIN_WORD - 1; cut2++) {
|
|
13793
|
-
const
|
|
13794
|
-
if (
|
|
13795
|
-
return byStem ? /* @__PURE__ */ new Set([...byStem, ...
|
|
13829
|
+
const written2 = people2.get(`w:${lower.slice(0, lower.length - cut2)}`);
|
|
13830
|
+
if (written2)
|
|
13831
|
+
return byStem ? /* @__PURE__ */ new Set([...byStem, ...written2]) : written2;
|
|
13796
13832
|
}
|
|
13797
13833
|
return byStem;
|
|
13798
13834
|
}, "bearersOf");
|
|
@@ -13918,7 +13954,7 @@ var findUnknownNames = /* @__PURE__ */ __name((text6, stem, taken) => {
|
|
|
13918
13954
|
return found2;
|
|
13919
13955
|
}, "findUnknownNames");
|
|
13920
13956
|
|
|
13921
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13957
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/domain/attachments.js
|
|
13922
13958
|
var NOT_FILES = /* @__PURE__ */ new Set([
|
|
13923
13959
|
"webpage",
|
|
13924
13960
|
"share",
|
|
@@ -13958,7 +13994,7 @@ var matchDownloads = /* @__PURE__ */ __name((stored3, files2) => {
|
|
|
13958
13994
|
});
|
|
13959
13995
|
}, "matchDownloads");
|
|
13960
13996
|
|
|
13961
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
13997
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/search/lucene/types.js
|
|
13962
13998
|
var QUERY_VERSION = 1;
|
|
13963
13999
|
var QUERY_LIMITS2 = {
|
|
13964
14000
|
...QUERY_LIMITS,
|
|
@@ -13994,7 +14030,7 @@ function exhausted(budget) {
|
|
|
13994
14030
|
}
|
|
13995
14031
|
__name(exhausted, "exhausted");
|
|
13996
14032
|
|
|
13997
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14033
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/search/lucene/automaton.js
|
|
13998
14034
|
var any = { kind: "char", ranges: [[0, 1114111]], negate: false };
|
|
13999
14035
|
var literal2 = /* @__PURE__ */ __name((c) => ({
|
|
14000
14036
|
kind: "char",
|
|
@@ -14394,7 +14430,7 @@ var foldRegex = /* @__PURE__ */ __name((pattern, span) => {
|
|
|
14394
14430
|
return out;
|
|
14395
14431
|
}, "foldRegex");
|
|
14396
14432
|
|
|
14397
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14433
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/search/lucene/presets.js
|
|
14398
14434
|
var PRESET_VERSION = 1;
|
|
14399
14435
|
var PRESETS = {
|
|
14400
14436
|
password: {
|
|
@@ -14448,7 +14484,7 @@ var PRESETS = {
|
|
|
14448
14484
|
}
|
|
14449
14485
|
};
|
|
14450
14486
|
|
|
14451
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14487
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
|
|
14452
14488
|
var FIELD_VERSION = 2;
|
|
14453
14489
|
var UNITS = {
|
|
14454
14490
|
"": 1,
|
|
@@ -14908,12 +14944,12 @@ var validateAst = /* @__PURE__ */ __name((input) => {
|
|
|
14908
14944
|
return validateFields(parsed3.output);
|
|
14909
14945
|
}, "validateAst");
|
|
14910
14946
|
|
|
14911
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14947
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/search/lucene/resolved.js
|
|
14912
14948
|
var hasText = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? node.field === "text" || node.field === "exact" : node.clauses.some(({ node: node2 }) => hasText(node2)), "hasText");
|
|
14913
14949
|
var isStemmed = /* @__PURE__ */ __name((node) => node.field === "text" && (node.operator === "term" || node.operator === "phrase") && node.value !== "", "isStemmed");
|
|
14914
14950
|
var hasStems = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? isStemmed(node) : node.clauses.some(({ node: node2 }) => hasStems(node2)), "hasStems");
|
|
14915
14951
|
|
|
14916
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14952
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-links.js
|
|
14917
14953
|
var LIVE = "mn.kind = 'url' AND mn.status <> 'dismissed'";
|
|
14918
14954
|
var MAIL_ROWS = `SELECT mn.source_id FROM mentions mn WHERE mn.source_type = 'email' AND ${LIVE}`;
|
|
14919
14955
|
var linkMatch = /* @__PURE__ */ __name((field4, typed, mail, mentioned2) => {
|
|
@@ -14937,7 +14973,7 @@ var linkMatch = /* @__PURE__ */ __name((field4, typed, mail, mentioned2) => {
|
|
|
14937
14973
|
};
|
|
14938
14974
|
}, "linkMatch");
|
|
14939
14975
|
|
|
14940
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
14976
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/phone-countries.js
|
|
14941
14977
|
var SETTING = "phoneCountries";
|
|
14942
14978
|
var savedPhoneCountries = /* @__PURE__ */ __name((database) => {
|
|
14943
14979
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING);
|
|
@@ -14968,7 +15004,7 @@ var valueMatch = /* @__PURE__ */ __name((database, typed) => {
|
|
|
14968
15004
|
return { sql: "mn.value = ?", params: [phone?.value ?? normalizedValue(typed, { phoneCountries })] };
|
|
14969
15005
|
}, "valueMatch");
|
|
14970
15006
|
|
|
14971
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15007
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/domain/vocabulary.js
|
|
14972
15008
|
var normalizeVocabularyName = /* @__PURE__ */ __name((input) => {
|
|
14973
15009
|
if (typeof input !== "string" || input.length > 200 || /[\p{Cc}\p{Cf}]/u.test(input))
|
|
14974
15010
|
throw new CliError("validation_error", "a vocabulary name takes 1\u2013200 characters without control characters");
|
|
@@ -14996,7 +15032,7 @@ var vocabularySimilarity = /* @__PURE__ */ __name((left, right) => {
|
|
|
14996
15032
|
return 2 * intersection2 / (aa2.size + bb.size);
|
|
14997
15033
|
}, "vocabularySimilarity");
|
|
14998
15034
|
|
|
14999
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15035
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-creation.js
|
|
15000
15036
|
import { createHash } from "node:crypto";
|
|
15001
15037
|
var folded2 = /* @__PURE__ */ __name((name) => {
|
|
15002
15038
|
try {
|
|
@@ -15062,7 +15098,7 @@ var guardTagCreation = /* @__PURE__ */ __name((context, name, kind4, by, options
|
|
|
15062
15098
|
});
|
|
15063
15099
|
}, "guardTagCreation");
|
|
15064
15100
|
|
|
15065
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15101
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/domain/tag-redirects.js
|
|
15066
15102
|
var invalid2 = /* @__PURE__ */ __name((message2) => {
|
|
15067
15103
|
throw new CliError("validation_error", message2);
|
|
15068
15104
|
}, "invalid");
|
|
@@ -15139,7 +15175,7 @@ var createTagRedirectIndex = /* @__PURE__ */ __name((snapshot2) => {
|
|
|
15139
15175
|
};
|
|
15140
15176
|
}, "createTagRedirectIndex");
|
|
15141
15177
|
|
|
15142
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15178
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-resolution.js
|
|
15143
15179
|
var tagCanonicalId = /* @__PURE__ */ __name((database, id2) => {
|
|
15144
15180
|
const row2 = database.prepare("SELECT canonical_id FROM resolved_tags WHERE id=?").get(id2);
|
|
15145
15181
|
if (!row2)
|
|
@@ -15147,8 +15183,8 @@ var tagCanonicalId = /* @__PURE__ */ __name((database, id2) => {
|
|
|
15147
15183
|
return Number(row2.canonical_id);
|
|
15148
15184
|
}, "tagCanonicalId");
|
|
15149
15185
|
var tagMemberIds = /* @__PURE__ */ __name((database, id2) => {
|
|
15150
|
-
const
|
|
15151
|
-
return database.prepare("SELECT ? AS id UNION ALL SELECT source_id AS id FROM tag_redirects WHERE survivor_id=? ORDER BY id").all(
|
|
15186
|
+
const canonical3 = tagCanonicalId(database, id2);
|
|
15187
|
+
return database.prepare("SELECT ? AS id UNION ALL SELECT source_id AS id FROM tag_redirects WHERE survivor_id=? ORDER BY id").all(canonical3, canonical3).map((row2) => Number(row2.id));
|
|
15152
15188
|
}, "tagMemberIds");
|
|
15153
15189
|
var tagRedirectSnapshot = /* @__PURE__ */ __name((database) => {
|
|
15154
15190
|
const tags = database.prepare("SELECT id FROM canonical_tags WHERE kind='tag' ORDER BY id LIMIT 4097").all();
|
|
@@ -15167,7 +15203,7 @@ var tagRedirectSnapshot = /* @__PURE__ */ __name((database) => {
|
|
|
15167
15203
|
return snapshot2;
|
|
15168
15204
|
}, "tagRedirectSnapshot");
|
|
15169
15205
|
|
|
15170
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15206
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/task-keys.js
|
|
15171
15207
|
import { createHash as createHash2 } from "node:crypto";
|
|
15172
15208
|
var TASK_KEY_PREFIXES = {
|
|
15173
15209
|
question: "Q",
|
|
@@ -15195,7 +15231,7 @@ var taskAccountOf = /* @__PURE__ */ __name((database, rowId) => {
|
|
|
15195
15231
|
return row2 && String(row2.key) === inboxKey(String(row2.name)) ? String(row2.name) : void 0;
|
|
15196
15232
|
}, "taskAccountOf");
|
|
15197
15233
|
|
|
15198
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15234
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/things.js
|
|
15199
15235
|
var storedThing = /* @__PURE__ */ __name((type, id2) => ({ type: String(type), id: Number(id2) }), "storedThing");
|
|
15200
15236
|
var REFERABLE = {
|
|
15201
15237
|
note: { tombstone: true },
|
|
@@ -15359,11 +15395,11 @@ var taskIdOf = /* @__PURE__ */ __name((database, rowId) => {
|
|
|
15359
15395
|
return row2 ? String(row2.id ?? row2.key) : void 0;
|
|
15360
15396
|
}, "taskIdOf");
|
|
15361
15397
|
|
|
15362
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15363
|
-
var toMs = /* @__PURE__ */ __name((
|
|
15364
|
-
if (
|
|
15398
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/values.js
|
|
15399
|
+
var toMs = /* @__PURE__ */ __name((iso13) => {
|
|
15400
|
+
if (iso13 === null || iso13 === void 0)
|
|
15365
15401
|
return null;
|
|
15366
|
-
const ms = Date.parse(
|
|
15402
|
+
const ms = Date.parse(iso13);
|
|
15367
15403
|
return Number.isNaN(ms) ? null : ms;
|
|
15368
15404
|
}, "toMs");
|
|
15369
15405
|
var toIso = /* @__PURE__ */ __name((ms) => typeof ms === "number" ? new Date(ms).toISOString() : null, "toIso");
|
|
@@ -15373,7 +15409,7 @@ var present = /* @__PURE__ */ __name((entries) => Object.fromEntries(Object.entr
|
|
|
15373
15409
|
var DELIVERY = { delivered: 1, read: 2 };
|
|
15374
15410
|
var deliveryOf = /* @__PURE__ */ __name((stored3) => stored3 === DELIVERY.read ? "read" : stored3 === DELIVERY.delivered ? "delivered" : void 0, "deliveryOf");
|
|
15375
15411
|
|
|
15376
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15412
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/tags.js
|
|
15377
15413
|
var TAG_KINDS = ["tag", "topic"];
|
|
15378
15414
|
var TAGGABLE = { chat: "chat", contact: "identity", message: "message", task: "task" };
|
|
15379
15415
|
var TAG_TYPE = {
|
|
@@ -15576,7 +15612,7 @@ var tagsOf = /* @__PURE__ */ __name(({ database }, key2, filter) => {
|
|
|
15576
15612
|
return result;
|
|
15577
15613
|
}, "tagsOf");
|
|
15578
15614
|
|
|
15579
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15615
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene-fields.js
|
|
15580
15616
|
var speech = /* @__PURE__ */ __name((alias2) => `(coalesce(${alias2}.extractor,'') LIKE 'speech:%' OR ${alias2}.kind IN ('voice','video_note') OR coalesce(${alias2}.mime,'')='audio/ogg')`, "speech");
|
|
15581
15617
|
var SPEECH = speech("att");
|
|
15582
15618
|
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");
|
|
@@ -15937,7 +15973,7 @@ var FIELD_COMPILERS = {
|
|
|
15937
15973
|
subject
|
|
15938
15974
|
};
|
|
15939
15975
|
|
|
15940
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15976
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/place-key.js
|
|
15941
15977
|
var placeOf = /* @__PURE__ */ __name((database) => {
|
|
15942
15978
|
const exact = database.prepare("SELECT id FROM places WHERE folded = ?");
|
|
15943
15979
|
const onStreet = database.prepare("SELECT id FROM places WHERE substr(folded, 1, ?) = ? LIMIT 2");
|
|
@@ -15953,7 +15989,7 @@ var placeOf = /* @__PURE__ */ __name((database) => {
|
|
|
15953
15989
|
};
|
|
15954
15990
|
}, "placeOf");
|
|
15955
15991
|
|
|
15956
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
15992
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-drain.js
|
|
15957
15993
|
var DRAIN_ON_WRITE = 500;
|
|
15958
15994
|
var METHOD = "rules";
|
|
15959
15995
|
var telegramLink = /* @__PURE__ */ __name((database) => {
|
|
@@ -16082,7 +16118,7 @@ var writer = /* @__PURE__ */ __name((database, now2, kinds2) => {
|
|
|
16082
16118
|
remove.run(type, pk, ...scope3);
|
|
16083
16119
|
if (source2 === null)
|
|
16084
16120
|
return 0;
|
|
16085
|
-
let
|
|
16121
|
+
let written2 = 0;
|
|
16086
16122
|
const all2 = found2(source2);
|
|
16087
16123
|
for (const one of type === "email" ? oneTrackedLinkPerSite(all2) : all2) {
|
|
16088
16124
|
if (kinds2 && !kinds2.includes(one.kind))
|
|
@@ -16094,9 +16130,9 @@ var writer = /* @__PURE__ */ __name((database, now2, kinds2) => {
|
|
|
16094
16130
|
if (moved?.target_type === "place")
|
|
16095
16131
|
rekeyPlace.run(one.value, Number(moved.target_id), String(moved.value), one.value);
|
|
16096
16132
|
const decision = kept.get(`${one.kind}\0${one.value}`) ?? moved ?? one.decision ?? original(one.kind, one.value);
|
|
16097
|
-
|
|
16133
|
+
written2 += Number(insert.run(one.kind, type, pk, source2.field, one.start, one.end, one.value, one.domain, METHOD, MENTION_VERSIONS[one.kind], one.confidence, decision ? String(decision.status) : "found", decision?.target_type == null ? null : String(decision.target_type), decision?.target_id == null ? null : Number(decision.target_id), decision?.author == null ? null : String(decision.author), firstFound.get(here) ?? now2, now2).changes);
|
|
16098
16134
|
}
|
|
16099
|
-
return
|
|
16135
|
+
return written2;
|
|
16100
16136
|
};
|
|
16101
16137
|
}, "writer");
|
|
16102
16138
|
var sourceOf2 = /* @__PURE__ */ __name((row2) => row2 ? { text: String(row2.text), field: String(row2.field), chat: Number(row2.chat_id) } : null, "sourceOf");
|
|
@@ -16116,7 +16152,7 @@ var drainMentions = /* @__PURE__ */ __name((database, now2, limit = DRAIN_ON_WRI
|
|
|
16116
16152
|
return queued.length;
|
|
16117
16153
|
}, "drainMentions");
|
|
16118
16154
|
|
|
16119
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16155
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/index-state.js
|
|
16120
16156
|
var indexRow = /* @__PURE__ */ __name((database, name) => {
|
|
16121
16157
|
const exists2 = database.prepare("SELECT 1 FROM sqlite_master WHERE name = 'search_index_state'").get();
|
|
16122
16158
|
if (!exists2)
|
|
@@ -16124,7 +16160,7 @@ var indexRow = /* @__PURE__ */ __name((database, name) => {
|
|
|
16124
16160
|
return database.prepare("SELECT * FROM search_index_state WHERE name = ?").get(name);
|
|
16125
16161
|
}, "indexRow");
|
|
16126
16162
|
|
|
16127
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16163
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/stems.js
|
|
16128
16164
|
var INDEX = "message_stems";
|
|
16129
16165
|
var SETTING2 = "searchStemmers";
|
|
16130
16166
|
var DRAIN_ON_WRITE2 = 500;
|
|
@@ -16246,7 +16282,7 @@ var stemmerCache = /* @__PURE__ */ __name(() => {
|
|
|
16246
16282
|
};
|
|
16247
16283
|
}, "stemmerCache");
|
|
16248
16284
|
|
|
16249
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16285
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/transaction.js
|
|
16250
16286
|
var SQLITE_BUSY = 5;
|
|
16251
16287
|
var pause = new Int32Array(new SharedArrayBuffer(4));
|
|
16252
16288
|
var isBusy = /* @__PURE__ */ __name((error) => {
|
|
@@ -16341,7 +16377,7 @@ var read = /* @__PURE__ */ __name((database, body2) => {
|
|
|
16341
16377
|
}
|
|
16342
16378
|
}, "read");
|
|
16343
16379
|
|
|
16344
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16380
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/vector-index.js
|
|
16345
16381
|
var source = /* @__PURE__ */ __name((model, dims) => `SELECT k.id, k.chunkable_type,
|
|
16346
16382
|
coalesce(CASE k.chunkable_type
|
|
16347
16383
|
WHEN 'image' THEN (SELECT ch.account_id FROM attachments a JOIN messages m ON m.id = a.attachable_id
|
|
@@ -16483,7 +16519,7 @@ var dropUnusedVectors = /* @__PURE__ */ __name((database, hashes) => {
|
|
|
16483
16519
|
}, "dropUnusedVectors");
|
|
16484
16520
|
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");
|
|
16485
16521
|
|
|
16486
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16522
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/accounts.js
|
|
16487
16523
|
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({
|
|
16488
16524
|
target: [accounts.provider, accounts.externalId],
|
|
16489
16525
|
set: {
|
|
@@ -16555,6 +16591,9 @@ var purgeAccount = /* @__PURE__ */ __name(({ orm, database }, accountKey) => {
|
|
|
16555
16591
|
orm.delete(accountIdentities).where(eq(accountIdentities.accountId, accountKey)).run();
|
|
16556
16592
|
orm.update(projects).set({ accountId: null }).where(eq(projects.accountId, accountKey)).run();
|
|
16557
16593
|
orm.run(sql`DELETE FROM files WHERE account_id = ${accountKey}`);
|
|
16594
|
+
const recordsOf = sql`(SELECT id FROM records WHERE account_id = ${accountKey})`;
|
|
16595
|
+
orm.run(sql`DELETE FROM record_relations WHERE record_id IN ${recordsOf} OR target_id IN ${recordsOf}`);
|
|
16596
|
+
orm.run(sql`DELETE FROM records WHERE account_id = ${accountKey}`);
|
|
16558
16597
|
orm.delete(accounts).where(eq(accounts.id, accountKey)).run();
|
|
16559
16598
|
dropOrphanPeople(database, unseenBefore);
|
|
16560
16599
|
dropUnusedVectors(database, hashes);
|
|
@@ -16589,7 +16628,7 @@ var dropOrphanPeople = /* @__PURE__ */ __name((database, unseenBefore) => {
|
|
|
16589
16628
|
AND id NOT IN (SELECT id FROM (${referencesTo(database, "persons", /* @__PURE__ */ new Set(["identity_links"]))}) WHERE id IS NOT NULL)`).run(JSON.stringify(persons2));
|
|
16590
16629
|
}, "dropOrphanPeople");
|
|
16591
16630
|
|
|
16592
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16631
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/folded.js
|
|
16593
16632
|
var FOLDED = [
|
|
16594
16633
|
{ table: "tasks", column: "title" },
|
|
16595
16634
|
{ table: "tasks", column: "close_reason" },
|
|
@@ -16626,7 +16665,7 @@ var fillFolded = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
|
|
|
16626
16665
|
return filled2;
|
|
16627
16666
|
}, "fillFolded");
|
|
16628
16667
|
|
|
16629
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16668
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/history-skips.js
|
|
16630
16669
|
var HISTORY_KEY = "$history";
|
|
16631
16670
|
var objectOf = /* @__PURE__ */ __name((text6) => {
|
|
16632
16671
|
if (typeof text6 !== "string")
|
|
@@ -16702,7 +16741,7 @@ var withoutHistory = /* @__PURE__ */ __name((metadata3) => {
|
|
|
16702
16741
|
return rest;
|
|
16703
16742
|
}, "withoutHistory");
|
|
16704
16743
|
|
|
16705
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16744
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/conversations/chunks.js
|
|
16706
16745
|
import { createHash as createHash3 } from "node:crypto";
|
|
16707
16746
|
var CHUNK_CHARS = 1200;
|
|
16708
16747
|
var CHUNK_OVERLAP = 150;
|
|
@@ -16807,7 +16846,7 @@ var cutChunks = /* @__PURE__ */ __name((members2, limit = CHUNK_CHARS, check3, c
|
|
|
16807
16846
|
return chunks2;
|
|
16808
16847
|
}, "cutChunks");
|
|
16809
16848
|
|
|
16810
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16849
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/search/task-signature.js
|
|
16811
16850
|
var DAY = 864e5;
|
|
16812
16851
|
var CURRENCY = [
|
|
16813
16852
|
[/^(₽|руб.*|р\.?|rub)$/u, "RUB"],
|
|
@@ -16933,7 +16972,7 @@ var dueDayOf = /* @__PURE__ */ __name((text6, createdMs) => {
|
|
|
16933
16972
|
return best?.day ?? null;
|
|
16934
16973
|
}, "dueDayOf");
|
|
16935
16974
|
|
|
16936
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
16975
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/search/task-similarity.js
|
|
16937
16976
|
var DAY2 = 864e5;
|
|
16938
16977
|
var STOP_WORDS = new Set([
|
|
16939
16978
|
// Russian and English as the test set ran them, already folded (пожалуйста → пожалуиста).
|
|
@@ -17088,7 +17127,7 @@ var rankCandidates = /* @__PURE__ */ __name((views, candidates) => candidates.ma
|
|
|
17088
17127
|
...compareViews(subjectViews ?? views, candidate, replyChain === void 0 ? {} : { replyChain })
|
|
17089
17128
|
})).sort((a, b) => b.score - a.score), "rankCandidates");
|
|
17090
17129
|
|
|
17091
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17130
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/vectors.js
|
|
17092
17131
|
var currentChunks = /* @__PURE__ */ __name((chatKey) => sql`SELECT k.content_hash, k.chunkable_id AS conversation_id, r.first_message_id,
|
|
17093
17132
|
r.last_message_id, r.text_start, r.text_end FROM chunks k JOIN chunk_messages r ON r.chunk_id = k.id
|
|
17094
17133
|
JOIN conversations c ON k.chunkable_type = 'conversation' AND c.id = k.chunkable_id
|
|
@@ -17359,7 +17398,7 @@ var readiness = /* @__PURE__ */ __name(({ orm }, chatKey, model) => {
|
|
|
17359
17398
|
};
|
|
17360
17399
|
}, "readiness");
|
|
17361
17400
|
|
|
17362
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17401
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/document-pictures.js
|
|
17363
17402
|
var DOCUMENT_PICTURE = "document_picture";
|
|
17364
17403
|
var SCAN_PAGE2 = 5e3;
|
|
17365
17404
|
var idOf = /* @__PURE__ */ __name((ref3) => {
|
|
@@ -17422,7 +17461,7 @@ var documentPicturesOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
|
|
|
17422
17461
|
}, "nearestPictures")
|
|
17423
17462
|
}), "documentPicturesOver");
|
|
17424
17463
|
|
|
17425
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17464
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/query-filter.js
|
|
17426
17465
|
var glob = /* @__PURE__ */ __name((value) => [...fold(value).matchAll(/\\(.)|([*?])|(.)/gsu)].map(([, escaped2, wildcard, plain2]) => {
|
|
17427
17466
|
const literal4 = escaped2 ?? plain2 ?? "";
|
|
17428
17467
|
return wildcard ?? (/[*?[]/u.test(literal4) ? `[${literal4}]` : literal4);
|
|
@@ -17487,7 +17526,7 @@ var compile = /* @__PURE__ */ __name((node, columns, options) => {
|
|
|
17487
17526
|
var queryFilter = /* @__PURE__ */ __name((ast, columns, options = {}) => compile(ast.root, columns, options), "queryFilter");
|
|
17488
17527
|
var bound2 = /* @__PURE__ */ __name(({ sql: text6, params }) => sql.join(text6.split("?").map((part, at) => at < params.length ? sql`${sql.raw(part)}${params[at]}` : sql.raw(part)), sql``), "bound");
|
|
17489
17528
|
|
|
17490
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17529
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/events.js
|
|
17491
17530
|
var toJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.stringify(value), "toJson");
|
|
17492
17531
|
var fromJson = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : JSON.parse(String(value)), "fromJson");
|
|
17493
17532
|
var int = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "int");
|
|
@@ -17577,7 +17616,7 @@ var linkMeeting = /* @__PURE__ */ __name((database, id2, eventId, now2, mode = "
|
|
|
17577
17616
|
});
|
|
17578
17617
|
}, "linkMeeting");
|
|
17579
17618
|
|
|
17580
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17619
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/note-index.js
|
|
17581
17620
|
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), ''))";
|
|
17582
17621
|
var UNSEARCHED_EVENT_TYPES = [
|
|
17583
17622
|
"working-location",
|
|
@@ -17807,7 +17846,7 @@ var resetNoteIndex = /* @__PURE__ */ __name((database) => {
|
|
|
17807
17846
|
return true;
|
|
17808
17847
|
}, "resetNoteIndex");
|
|
17809
17848
|
|
|
17810
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17849
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/person-resolution.js
|
|
17811
17850
|
var keyOf3 = /* @__PURE__ */ __name((name) => fold(name).trim().replace(/^@/, ""), "keyOf");
|
|
17812
17851
|
var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
|
|
17813
17852
|
for (const key2 of new Set(names.filter((name) => !!name?.trim()).map(keyOf3))) {
|
|
@@ -17826,7 +17865,7 @@ var resolvePersonLinks = /* @__PURE__ */ __name((database, names) => {
|
|
|
17826
17865
|
}
|
|
17827
17866
|
}, "resolvePersonLinks");
|
|
17828
17867
|
|
|
17829
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
17868
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/identities.js
|
|
17830
17869
|
var flag2 = /* @__PURE__ */ __name((value) => value === void 0 || value === null ? null : Number(value), "flag");
|
|
17831
17870
|
var prepare = /* @__PURE__ */ __name((orm) => ({
|
|
17832
17871
|
find: orm.select({
|
|
@@ -18051,7 +18090,7 @@ var meetingIdentityPk = /* @__PURE__ */ __name((context, accountId, identity) =>
|
|
|
18051
18090
|
}, "meetingIdentityPk");
|
|
18052
18091
|
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");
|
|
18053
18092
|
|
|
18054
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18093
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/chats.js
|
|
18055
18094
|
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");
|
|
18056
18095
|
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");
|
|
18057
18096
|
var chatPkFor = /* @__PURE__ */ __name((context, accountKey, chatId) => findChatPk(context, accountKey, chatId) ?? Number(context.orm.insert(chats).values({
|
|
@@ -18331,7 +18370,7 @@ var replaceAutoTags = /* @__PURE__ */ __name((context, key2, chatId, algorithm,
|
|
|
18331
18370
|
}
|
|
18332
18371
|
}, "replaceAutoTags");
|
|
18333
18372
|
|
|
18334
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18373
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/domain/counters.js
|
|
18335
18374
|
var COUNTER_FIELDS = ["views", "reactions", "comments"];
|
|
18336
18375
|
var validCounter = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isFinite(value) && value >= 0, "validCounter");
|
|
18337
18376
|
var counterObservationTime = /* @__PURE__ */ __name((observation, now2) => {
|
|
@@ -18350,7 +18389,7 @@ var counterFreshness = /* @__PURE__ */ __name((states) => {
|
|
|
18350
18389
|
return states.some((one) => one.freshness === "stale") ? "stale" : "fresh";
|
|
18351
18390
|
}, "counterFreshness");
|
|
18352
18391
|
|
|
18353
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18392
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/email-activity.js
|
|
18354
18393
|
var MAIL_AGENDA_COLUMNS = { chat_kind: { type: "enum", sql: "'dialog'" } };
|
|
18355
18394
|
var ACTIVITY = `
|
|
18356
18395
|
SELECT t.external_id AS thread, t.subject, t.last_email_at, t.emails_count,
|
|
@@ -18443,7 +18482,7 @@ var mailActivity = /* @__PURE__ */ __name((database) => ({
|
|
|
18443
18482
|
threadActivity: /* @__PURE__ */ __name(async (accountId, since, where) => threadActivity(database, accountId, since, where), "threadActivity")
|
|
18444
18483
|
}), "mailActivity");
|
|
18445
18484
|
|
|
18446
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18485
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/conversations/mail-text.js
|
|
18447
18486
|
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");
|
|
18448
18487
|
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;
|
|
18449
18488
|
var ATTRIBUTION = /(wrote|написал[аи]?|escribió|a écrit|schrieb)\s*:\s*$/iu;
|
|
@@ -18524,7 +18563,7 @@ var mailCore = /* @__PURE__ */ __name((body2, earlier) => {
|
|
|
18524
18563
|
return withoutSignOff(withoutGreeting(kept)).join("\n").trim();
|
|
18525
18564
|
}, "mailCore");
|
|
18526
18565
|
|
|
18527
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18566
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/email-index.js
|
|
18528
18567
|
var titleOf = /* @__PURE__ */ __name((subject2) => subject2?.replace(/^\s*((re|fwd?|aw|wg)\s*:\s*)+/i, "").trim() || null, "titleOf");
|
|
18529
18568
|
var MAIL_PIECES = `(SELECT k.id, k.content_hash, k.chunkable_type AS type, k.chunkable_id AS owner, k.position,
|
|
18530
18569
|
k.start_offset, k.end_offset, k.account_id, k.occurred_at, a.attachable_id AS email_id,
|
|
@@ -18634,7 +18673,7 @@ var drainEmailIndex = /* @__PURE__ */ __name((database, stemmerFor2) => {
|
|
|
18634
18673
|
return emails3 + threads;
|
|
18635
18674
|
}, "drainEmailIndex");
|
|
18636
18675
|
|
|
18637
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18676
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/email-locations.js
|
|
18638
18677
|
var locate = /* @__PURE__ */ __name((database, accountId, emailId, where) => database.prepare(`INSERT OR REPLACE INTO email_locations (mailbox_id, uidvalidity, uid, email_id)
|
|
18639
18678
|
SELECT id, ?, ?, ? FROM mailboxes WHERE account_id = ? AND external_id = ?`).run(where.uidvalidity, where.uid, emailId, accountId, where.folder), "locate");
|
|
18640
18679
|
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,
|
|
@@ -18720,7 +18759,7 @@ var forgetLocations = /* @__PURE__ */ __name((database, accountId, folder, uidva
|
|
|
18720
18759
|
var backfillSentAt = /* @__PURE__ */ __name((database, accountId, limit) => Number(database.prepare(`UPDATE emails SET sent_at = received_at WHERE id IN (
|
|
18721
18760
|
SELECT id FROM emails WHERE account_id = ? AND sent_at IS NULL AND received_at IS NOT NULL LIMIT ?)`).run(accountId, limit).changes), "backfillSentAt");
|
|
18722
18761
|
|
|
18723
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18762
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/email-state.js
|
|
18724
18763
|
var recountEmailThread = /* @__PURE__ */ __name((database, threadId, now2) => database.prepare(`UPDATE email_threads SET
|
|
18725
18764
|
emails_count = (SELECT count(*) FROM emails WHERE email_thread_id = ? AND deleted_at IS NULL),
|
|
18726
18765
|
last_email_at = (SELECT max(coalesce(sent_at, received_at)) FROM emails
|
|
@@ -18770,7 +18809,7 @@ var markEmailsRestored = /* @__PURE__ */ __name((database, accountId, externalId
|
|
|
18770
18809
|
return threads.length;
|
|
18771
18810
|
}, "markEmailsRestored");
|
|
18772
18811
|
|
|
18773
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18812
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/mail-rules.js
|
|
18774
18813
|
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");
|
|
18775
18814
|
var conditionsKey = /* @__PURE__ */ __name((conditions) => JSON.stringify(sorted(conditions)), "conditionsKey");
|
|
18776
18815
|
var ruleOf = /* @__PURE__ */ __name((row2) => ({
|
|
@@ -18837,7 +18876,7 @@ var mailRulesOver = /* @__PURE__ */ __name((database) => ({
|
|
|
18837
18876
|
}
|
|
18838
18877
|
}), "mailRulesOver");
|
|
18839
18878
|
|
|
18840
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18879
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/link-reviews.js
|
|
18841
18880
|
var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates, reason, now2) => {
|
|
18842
18881
|
database.prepare(`INSERT INTO link_reviews (linkable_type, linkable_id, entity_type, candidates, reason, status, created_at, updated_at)
|
|
18843
18882
|
VALUES (?, ?, ?, ?, ?, 'open', ?, ?)
|
|
@@ -18845,7 +18884,7 @@ var reviewLink = /* @__PURE__ */ __name((database, linkable, entity, candidates,
|
|
|
18845
18884
|
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);
|
|
18846
18885
|
}, "reviewLink");
|
|
18847
18886
|
|
|
18848
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18887
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-operation.js
|
|
18849
18888
|
function checkMeetingCancelled(signal) {
|
|
18850
18889
|
if (!signal?.aborted)
|
|
18851
18890
|
return;
|
|
@@ -18856,7 +18895,7 @@ function checkMeetingCancelled(signal) {
|
|
|
18856
18895
|
}
|
|
18857
18896
|
__name(checkMeetingCancelled, "checkMeetingCancelled");
|
|
18858
18897
|
|
|
18859
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18898
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-values.js
|
|
18860
18899
|
var meetingOf = /* @__PURE__ */ __name((row2) => ({
|
|
18861
18900
|
id: Number(row2.id),
|
|
18862
18901
|
accountId: Number(row2.account_id),
|
|
@@ -18906,7 +18945,7 @@ var transcriptRowOf = /* @__PURE__ */ __name((row2) => ({
|
|
|
18906
18945
|
createdAt: Number(row2.created_at)
|
|
18907
18946
|
}), "transcriptRowOf");
|
|
18908
18947
|
|
|
18909
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
18948
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-reads.js
|
|
18910
18949
|
var MEETING_TEXT = ["external_id", "title", "description", "location", "join_url", "timezone", "metadata"];
|
|
18911
18950
|
var TRANSCRIPT_TEXT = ["source", "format", "language", "content_hash", "metadata"];
|
|
18912
18951
|
var ROW_TEXT = ["speaker_name", "text", "normalized_text", "metadata"];
|
|
@@ -19073,7 +19112,7 @@ var meetingReadsOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
19073
19112
|
}
|
|
19074
19113
|
}), "meetingReadsOver");
|
|
19075
19114
|
|
|
19076
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19115
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-selection.js
|
|
19077
19116
|
var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
|
|
19078
19117
|
const clauses = ["m.account_id=?", "m.deleted_at IS NULL"];
|
|
19079
19118
|
const params = [input.accountId];
|
|
@@ -19116,7 +19155,7 @@ var meetingSelectionSql = /* @__PURE__ */ __name((input) => {
|
|
|
19116
19155
|
return { clauses, params };
|
|
19117
19156
|
}, "meetingSelectionSql");
|
|
19118
19157
|
|
|
19119
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19158
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-chat-lines.js
|
|
19120
19159
|
var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
19121
19160
|
async meetingChatLines(input) {
|
|
19122
19161
|
checkMeetingCancelled(input.signal);
|
|
@@ -19144,7 +19183,7 @@ var meetingChatLinesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
19144
19183
|
}
|
|
19145
19184
|
}), "meetingChatLinesOver");
|
|
19146
19185
|
|
|
19147
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19186
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/reads.js
|
|
19148
19187
|
var MESSAGE_FIELDS = {
|
|
19149
19188
|
pk: messages.id,
|
|
19150
19189
|
nativeId: messages.externalId,
|
|
@@ -19315,7 +19354,7 @@ var chatActivity = /* @__PURE__ */ __name(({ database }, accountKey, since, wher
|
|
|
19315
19354
|
storedAt: toIso(Number(database.prepare("SELECT max(created_at) AS at FROM messages WHERE account_id = ?").get(accountKey)?.at) || null)
|
|
19316
19355
|
}), "chatActivity");
|
|
19317
19356
|
|
|
19318
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19357
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/search.js
|
|
19319
19358
|
var HIT_FIELDS = {
|
|
19320
19359
|
...MESSAGE_FIELDS,
|
|
19321
19360
|
chatTitle: sql`${chats.title}`.as("chat_title"),
|
|
@@ -19346,9 +19385,9 @@ var matching = /* @__PURE__ */ __name((context, { provider, account, accounts: w
|
|
|
19346
19385
|
return and(isNull(messages.deletedAt), trimmed ? sql`${messages.id} IN (SELECT rowid FROM messages_fts WHERE messages_fts MATCH ${wordsOf2(trimmed)})` : void 0, scopeProvider === void 0 ? void 0 : eq(accounts.provider, scopeProvider), account ? eq(accounts.externalId, account.account) : void 0, within ? inArray(accounts.externalId, within) : void 0, chatId === void 0 ? eq(chats.searchable, 1) : eq(chats.externalId, chatId), ids ? and(eq(identities.provider, accounts.provider), inArray(identities.externalId, ids)) : void 0, ids && together ? inArray(messages.chatId, everyoneWrote(context, ids, scopeProvider)) : void 0);
|
|
19347
19386
|
}, "matching");
|
|
19348
19387
|
var everyoneWrote = /* @__PURE__ */ __name(({ orm }, ids, scopeProvider) => {
|
|
19349
|
-
const
|
|
19388
|
+
const written2 = alias(messages, "m2");
|
|
19350
19389
|
const writer3 = alias(identities, "i2");
|
|
19351
|
-
return orm.select({ chatPk:
|
|
19390
|
+
return orm.select({ chatPk: written2.chatId }).from(written2).innerJoin(writer3, eq(writer3.id, written2.senderIdentityId)).where(and(isNull(written2.deletedAt), eq(writer3.provider, scopeProvider ?? identities.provider), inArray(writer3.externalId, ids))).groupBy(written2.chatId).having(sql`count(DISTINCT ${writer3.externalId}) = ${ids.length}`);
|
|
19352
19391
|
}, "everyoneWrote");
|
|
19353
19392
|
var chatRank = sql`row_number() OVER (PARTITION BY ${messages.chatId} ORDER BY ${messages.sentAt} DESC, ${messages.id} DESC)`;
|
|
19354
19393
|
var selectHits = /* @__PURE__ */ __name(({ orm }) => orm.select(HIT_FIELDS).from(messages).innerJoin(chats, eq(chats.id, messages.chatId)).leftJoin(identities, eq(identities.id, messages.senderIdentityId)).innerJoin(accounts, eq(accounts.id, messages.accountId)), "selectHits");
|
|
@@ -19414,7 +19453,7 @@ var directReplies = /* @__PURE__ */ __name((context, parents, limit) => {
|
|
|
19414
19453
|
};
|
|
19415
19454
|
}, "directReplies");
|
|
19416
19455
|
|
|
19417
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19456
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/person-links.js
|
|
19418
19457
|
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");
|
|
19419
19458
|
var required = /* @__PURE__ */ __name((context, ref3) => {
|
|
19420
19459
|
const found2 = identityRow(context, ref3);
|
|
@@ -19545,7 +19584,7 @@ var mentioning = /* @__PURE__ */ __name((context, accountKey, { id: id2, usernam
|
|
|
19545
19584
|
}, "mentioning");
|
|
19546
19585
|
var escaped = /* @__PURE__ */ __name((text6) => text6.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escaped");
|
|
19547
19586
|
|
|
19548
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19587
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-context-links.js
|
|
19549
19588
|
var missing2 = /* @__PURE__ */ __name(() => {
|
|
19550
19589
|
throw new CliError("not_found", "Meeting, participant or selected target not found");
|
|
19551
19590
|
}, "missing");
|
|
@@ -19667,7 +19706,7 @@ function meetingContextLinksOver(context) {
|
|
|
19667
19706
|
}
|
|
19668
19707
|
__name(meetingContextLinksOver, "meetingContextLinksOver");
|
|
19669
19708
|
|
|
19670
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19709
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-index-values.js
|
|
19671
19710
|
var INDEX_CODES = { meeting_transcript_row: 1, meeting_chat_message: 2, meeting_summary: 3 };
|
|
19672
19711
|
var meetingRowid = /* @__PURE__ */ __name((type, id2) => id2 * 4 + INDEX_CODES[type], "meetingRowid");
|
|
19673
19712
|
var summaryOf = /* @__PURE__ */ __name((row2) => ({
|
|
@@ -19696,7 +19735,7 @@ var indexedText = /* @__PURE__ */ __name((database, type, id2) => {
|
|
|
19696
19735
|
return row2 ? summaryText(summaryOf(row2)) : null;
|
|
19697
19736
|
}, "indexedText");
|
|
19698
19737
|
|
|
19699
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19738
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stem-state.js
|
|
19700
19739
|
var summaryBytes = ["title", "overview", "sections", "next_steps", "content"].map((key2) => `coalesce(length(CAST(s.${key2} AS BLOB)),0)`).join("+");
|
|
19701
19740
|
var meetingCurrentIndexRows = `
|
|
19702
19741
|
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
|
|
@@ -19727,7 +19766,7 @@ var invalidateMeetingStems = /* @__PURE__ */ __name((database, type, id2) => {
|
|
|
19727
19766
|
}, "invalidateMeetingStems");
|
|
19728
19767
|
var meetingStemmableText = /* @__PURE__ */ __name((text6) => text6.replace(/[\p{L}\p{N}\p{M}\p{Co}]+/gu, (token) => token.length <= 1024 ? token : ""), "meetingStemmableText");
|
|
19729
19768
|
|
|
19730
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19769
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-index.js
|
|
19731
19770
|
function meetingHitIndexOver({ database, now: now2 }) {
|
|
19732
19771
|
return {
|
|
19733
19772
|
async indexSearch(original) {
|
|
@@ -19795,10 +19834,10 @@ function meetingHitIndexOver({ database, now: now2 }) {
|
|
|
19795
19834
|
}
|
|
19796
19835
|
__name(meetingHitIndexOver, "meetingHitIndexOver");
|
|
19797
19836
|
|
|
19798
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19837
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
|
|
19799
19838
|
import { createHash as createHash4 } from "node:crypto";
|
|
19800
19839
|
|
|
19801
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19840
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/search/trigrams.js
|
|
19802
19841
|
var trigrams = /* @__PURE__ */ __name((term) => {
|
|
19803
19842
|
const padded = ` ${term} `;
|
|
19804
19843
|
const pieces = /* @__PURE__ */ new Set();
|
|
@@ -19807,7 +19846,7 @@ var trigrams = /* @__PURE__ */ __name((term) => {
|
|
|
19807
19846
|
return [...pieces];
|
|
19808
19847
|
}, "trigrams");
|
|
19809
19848
|
|
|
19810
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19849
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/search/correct.js
|
|
19811
19850
|
var SHORTEST_CORRECTION = 3;
|
|
19812
19851
|
var maxEdits = /* @__PURE__ */ __name((word) => word.length <= 4 ? 1 : 2, "maxEdits");
|
|
19813
19852
|
var editDistance = /* @__PURE__ */ __name((a, b, max) => {
|
|
@@ -19854,7 +19893,7 @@ var correctWords = /* @__PURE__ */ __name(async (vocabulary, words3) => {
|
|
|
19854
19893
|
return corrections;
|
|
19855
19894
|
}, "correctWords");
|
|
19856
19895
|
|
|
19857
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19896
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/search/garbled.js
|
|
19858
19897
|
var SHORTEST_GARBLED = 4;
|
|
19859
19898
|
var MOST_WIDENED = 64;
|
|
19860
19899
|
var plain = /* @__PURE__ */ __name((word) => word.replaceAll("\u044D", "\u0435"), "plain");
|
|
@@ -19946,7 +19985,7 @@ var widenWords = /* @__PURE__ */ __name((probes, vocabulary, stem, known2) => {
|
|
|
19946
19985
|
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((word) => word.term));
|
|
19947
19986
|
}, "widenWords");
|
|
19948
19987
|
|
|
19949
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
19988
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/search/russian-dictionary.js
|
|
19950
19989
|
import { readFileSync } from "node:fs";
|
|
19951
19990
|
var loaded;
|
|
19952
19991
|
var dictionary = /* @__PURE__ */ __name(() => {
|
|
@@ -20005,7 +20044,7 @@ var knownRussianWord = /* @__PURE__ */ __name((word) => {
|
|
|
20005
20044
|
return false;
|
|
20006
20045
|
}, "knownRussianWord");
|
|
20007
20046
|
|
|
20008
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20047
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-query.js
|
|
20009
20048
|
var WORD3 = /[\p{L}\p{N}\p{M}]+/gu;
|
|
20010
20049
|
var MOST_WORDS = 128;
|
|
20011
20050
|
var quote = /* @__PURE__ */ __name((word) => `"${word.replaceAll('"', '""')}"`, "quote");
|
|
@@ -20232,7 +20271,7 @@ var matchMeetingText = /* @__PURE__ */ __name((tree, text6, stemmer) => {
|
|
|
20232
20271
|
return check3(tree);
|
|
20233
20272
|
}, "matchMeetingText");
|
|
20234
20273
|
|
|
20235
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20274
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-hit-search.js
|
|
20236
20275
|
var fail3 = /* @__PURE__ */ __name((message2) => {
|
|
20237
20276
|
throw new CliError("validation_error", message2);
|
|
20238
20277
|
}, "fail");
|
|
@@ -20414,7 +20453,7 @@ function meetingHitSearchOver({ database }) {
|
|
|
20414
20453
|
}
|
|
20415
20454
|
__name(meetingHitSearchOver, "meetingHitSearchOver");
|
|
20416
20455
|
|
|
20417
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20456
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-languages.js
|
|
20418
20457
|
var meetingLanguagesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
20419
20458
|
async fillTranscriptLanguages({ accountId, apply, now: now2 }) {
|
|
20420
20459
|
positiveReadInteger(accountId, "accountId");
|
|
@@ -20446,7 +20485,7 @@ var meetingLanguagesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20446
20485
|
}
|
|
20447
20486
|
}), "meetingLanguagesOver");
|
|
20448
20487
|
|
|
20449
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20488
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-participant-search.js
|
|
20450
20489
|
import { createHash as createHash5 } from "node:crypto";
|
|
20451
20490
|
var cursorOf2 = /* @__PURE__ */ __name((value, key2) => {
|
|
20452
20491
|
if (value === void 0)
|
|
@@ -20536,7 +20575,7 @@ var meetingParticipantSearchOver = /* @__PURE__ */ __name((context) => ({
|
|
|
20536
20575
|
}
|
|
20537
20576
|
}), "meetingParticipantSearchOver");
|
|
20538
20577
|
|
|
20539
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20578
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-context-queries.js
|
|
20540
20579
|
var preparationQueries = {
|
|
20541
20580
|
participants: {
|
|
20542
20581
|
fields: "p.id, p.identity_id, p.display_name, l.person_id",
|
|
@@ -20586,7 +20625,7 @@ var preparationQueries = {
|
|
|
20586
20625
|
}
|
|
20587
20626
|
};
|
|
20588
20627
|
|
|
20589
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20628
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-context.js
|
|
20590
20629
|
var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
20591
20630
|
async preparationContext(original) {
|
|
20592
20631
|
const input = validateMeetingPreparationContext(original);
|
|
@@ -20627,7 +20666,7 @@ var meetingPreparationContextOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20627
20666
|
}
|
|
20628
20667
|
}), "meetingPreparationContextOver");
|
|
20629
20668
|
|
|
20630
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20669
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/preparation-subjects.js
|
|
20631
20670
|
var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
|
|
20632
20671
|
SELECT m.id FROM meetings m JOIN meeting_series s ON s.id=m.meeting_series_id
|
|
20633
20672
|
WHERE m.id IN (${Array.from({ length: anchors }, () => "?").join(",")}) AND m.account_id=? AND s.account_id=?
|
|
@@ -20641,7 +20680,7 @@ var preparationSubjects = /* @__PURE__ */ __name((anchors) => `WITH anchors AS (
|
|
|
20641
20680
|
JOIN main.projects p ON p.id=l.to_id WHERE p.account_id IS NULL AND p.deleted_at IS NULL
|
|
20642
20681
|
)`, "preparationSubjects");
|
|
20643
20682
|
|
|
20644
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20683
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-knowledge.js
|
|
20645
20684
|
var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
20646
20685
|
async preparationKnowledge(original) {
|
|
20647
20686
|
const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
|
|
@@ -20686,7 +20725,7 @@ var meetingPreparationKnowledgeOver = /* @__PURE__ */ __name(({ database }) => (
|
|
|
20686
20725
|
}
|
|
20687
20726
|
}), "meetingPreparationKnowledgeOver");
|
|
20688
20727
|
|
|
20689
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20728
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-preparation-notes.js
|
|
20690
20729
|
var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
20691
20730
|
async preparationNotes(original) {
|
|
20692
20731
|
const { accountId, seriesId, anchorIds, after: after2, before: before2, limit, maxReadBytes, signal } = validateMeetingRelatedHistory(original);
|
|
@@ -20739,7 +20778,7 @@ var meetingPreparationNotesOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20739
20778
|
}
|
|
20740
20779
|
}), "meetingPreparationNotesOver");
|
|
20741
20780
|
|
|
20742
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20781
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-related-history.js
|
|
20743
20782
|
var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
20744
20783
|
async relatedHistory(original) {
|
|
20745
20784
|
const input = validateMeetingRelatedHistory(original);
|
|
@@ -20810,7 +20849,7 @@ var meetingRelatedHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20810
20849
|
}
|
|
20811
20850
|
}), "meetingRelatedHistoryOver");
|
|
20812
20851
|
|
|
20813
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20852
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-review.js
|
|
20814
20853
|
var number2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : Number(value), "number");
|
|
20815
20854
|
var text2 = /* @__PURE__ */ __name((value) => value === null || value === void 0 ? null : String(value), "text");
|
|
20816
20855
|
var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
@@ -20891,7 +20930,7 @@ var meetingReviewOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20891
20930
|
}
|
|
20892
20931
|
}), "meetingReviewOver");
|
|
20893
20932
|
|
|
20894
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20933
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-series-history.js
|
|
20895
20934
|
var bytes2 = "length(CAST(external_id AS BLOB)) + coalesce(length(CAST(title AS BLOB)), 0)";
|
|
20896
20935
|
var ensureBytes2 = /* @__PURE__ */ __name((size2, budget) => {
|
|
20897
20936
|
if (!Number.isSafeInteger(size2) || size2 < 0 || size2 > budget)
|
|
@@ -20945,7 +20984,7 @@ var meetingSeriesHistoryOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20945
20984
|
}
|
|
20946
20985
|
}), "meetingSeriesHistoryOver");
|
|
20947
20986
|
|
|
20948
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
20987
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-stats.js
|
|
20949
20988
|
var MOST_ROWS = 5e5;
|
|
20950
20989
|
var meetingStatsOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
20951
20990
|
async meetingStats(input) {
|
|
@@ -20992,7 +21031,7 @@ var meetingStatsOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
20992
21031
|
}
|
|
20993
21032
|
}), "meetingStatsOver");
|
|
20994
21033
|
|
|
20995
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21034
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/meetings.js
|
|
20996
21035
|
var CURSOR_KEY = "meetings";
|
|
20997
21036
|
var seriesOf2 = /* @__PURE__ */ __name((row2) => ({
|
|
20998
21037
|
id: Number(row2.id),
|
|
@@ -21281,21 +21320,21 @@ var saveTranscripts = /* @__PURE__ */ __name((database, meetingId, transcripts,
|
|
|
21281
21320
|
return counts;
|
|
21282
21321
|
}, "saveTranscripts");
|
|
21283
21322
|
var append = /* @__PURE__ */ __name((context, input) => {
|
|
21284
|
-
const
|
|
21323
|
+
const invalid11 = /* @__PURE__ */ __name((message2) => {
|
|
21285
21324
|
throw new MeetingError("validation_error", message2);
|
|
21286
21325
|
}, "invalid");
|
|
21287
21326
|
if (!Number.isSafeInteger(input.accountId) || input.accountId <= 0 || !input.externalId?.trim() || !Number.isSafeInteger(input.now) || !Array.isArray(input.transcripts) || input.transcripts.length === 0)
|
|
21288
|
-
|
|
21327
|
+
invalid11("Invalid transcript append");
|
|
21289
21328
|
if (input.create && (!Number.isSafeInteger(input.create.startedAt) || Math.abs(input.create.startedAt) > 864e13))
|
|
21290
|
-
|
|
21329
|
+
invalid11("Invalid meeting start");
|
|
21291
21330
|
const sources = /* @__PURE__ */ new Set();
|
|
21292
21331
|
for (const transcript2 of input.transcripts) {
|
|
21293
21332
|
if (!transcript2.source?.trim() || !transcript2.contentHash?.trim() || sources.has(transcript2.source))
|
|
21294
|
-
|
|
21333
|
+
invalid11("Expected distinct transcript sources and nonempty hashes");
|
|
21295
21334
|
sources.add(transcript2.source);
|
|
21296
21335
|
for (const row2 of transcript2.rows)
|
|
21297
21336
|
if ("speakerParticipantPosition" in row2 || "speakerParticipantId" in row2)
|
|
21298
|
-
|
|
21337
|
+
invalid11("Appended transcript rows must be unlinked");
|
|
21299
21338
|
}
|
|
21300
21339
|
const { database } = context;
|
|
21301
21340
|
return write(database, () => {
|
|
@@ -21561,7 +21600,7 @@ var meetingStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
21561
21600
|
};
|
|
21562
21601
|
}, "meetingStoreOver");
|
|
21563
21602
|
|
|
21564
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21603
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/sync.js
|
|
21565
21604
|
var syncStateOf = /* @__PURE__ */ __name(({ orm }, accountKey, name) => {
|
|
21566
21605
|
const row2 = orm.select({ value: syncCursors.value, at: syncCursors.updatedAt }).from(syncCursors).where(and(eq(syncCursors.accountId, accountKey), eq(syncCursors.key, name))).get();
|
|
21567
21606
|
return row2 ? { value: row2.value, at: toIso(row2.at) } : void 0;
|
|
@@ -21587,7 +21626,7 @@ var release = /* @__PURE__ */ __name(({ orm }, chatKey, anchor, holder) => {
|
|
|
21587
21626
|
orm.delete(fetchLeases).where(and(eq(fetchLeases.chatId, chatKey), eq(fetchLeases.anchor, anchor), eq(fetchLeases.holder, holder))).run();
|
|
21588
21627
|
}, "release");
|
|
21589
21628
|
|
|
21590
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21629
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/thread-columns.js
|
|
21591
21630
|
var THREAD_COLUMNS = {
|
|
21592
21631
|
subject: {
|
|
21593
21632
|
where: /* @__PURE__ */ __name(({ value }) => ({
|
|
@@ -21604,7 +21643,7 @@ var threadRows = /* @__PURE__ */ __name((database, filter) => {
|
|
|
21604
21643
|
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);
|
|
21605
21644
|
}, "threadRows");
|
|
21606
21645
|
|
|
21607
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
21646
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/emails.js
|
|
21608
21647
|
var threadConversation = /* @__PURE__ */ __name((place, builtAt) => ({
|
|
21609
21648
|
id: `email:${place.emailId}`,
|
|
21610
21649
|
chatId: place.threadExternalId,
|
|
@@ -22160,7 +22199,7 @@ var mailStoreOver = /* @__PURE__ */ __name(({ database, orm, now: now2 }, stemme
|
|
|
22160
22199
|
}
|
|
22161
22200
|
}), "mailStoreOver");
|
|
22162
22201
|
|
|
22163
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22202
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/search/dictionary.js
|
|
22164
22203
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
22165
22204
|
var DICTIONARIES = Object.fromEntries(LANGUAGES.map(({ name, dictionary: dictionary3 }) => [name, dictionary3]));
|
|
22166
22205
|
var folded4 = /* @__PURE__ */ __name((word) => /^[а-яё'-]*$/.test(word) ? word.replaceAll("\u0451", "\u0435").replaceAll("\u0439", "\u0438") : fold(word), "folded");
|
|
@@ -22250,7 +22289,7 @@ var knownWord = /* @__PURE__ */ __name((languages) => {
|
|
|
22250
22289
|
}, "knownWord");
|
|
22251
22290
|
var dictionaryLanguages = /* @__PURE__ */ __name((stemmers) => [stemmers.cyrillic, ...stemmers.latin.split(",")].filter((name) => Object.hasOwn(DICTIONARIES, name)), "dictionaryLanguages");
|
|
22252
22291
|
|
|
22253
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22292
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/transcript-query.js
|
|
22254
22293
|
var predicates = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? [node] : node.clauses.flatMap(({ node: node2 }) => predicates(node2)), "predicates");
|
|
22255
22294
|
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");
|
|
22256
22295
|
var LATIN_NUMBERS = new Set(`zero one two three four five six seven eight nine ten eleven twelve twenty thirty forty fifty sixty seventy
|
|
@@ -22336,7 +22375,7 @@ var spokenTranscripts = /* @__PURE__ */ __name((database, item, speaking, keys)
|
|
|
22336
22375
|
return found2;
|
|
22337
22376
|
}, "spokenTranscripts");
|
|
22338
22377
|
|
|
22339
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22378
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/hit-places.js
|
|
22340
22379
|
var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, found2, pks) => {
|
|
22341
22380
|
const placeLeaves = leaves.filter(({ node }) => (node.operator === "term" || node.operator === "phrase") && (node.implicit || node.field === "content" || node.field === "transcript"));
|
|
22342
22381
|
if (!placeLeaves.length || !pks.length || found2.length !== pks.length)
|
|
@@ -22383,7 +22422,7 @@ var placeHits = /* @__PURE__ */ __name((database, corpus, leaves, transcripts, f
|
|
|
22383
22422
|
});
|
|
22384
22423
|
}, "placeHits");
|
|
22385
22424
|
|
|
22386
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22425
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/lucene.js
|
|
22387
22426
|
var MESSAGES2 = {
|
|
22388
22427
|
rows: "messages",
|
|
22389
22428
|
threads: "chats",
|
|
@@ -22878,7 +22917,7 @@ var runCompiled = /* @__PURE__ */ __name(async (context, execution, by) => {
|
|
|
22878
22917
|
};
|
|
22879
22918
|
}, "runCompiled");
|
|
22880
22919
|
|
|
22881
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
22920
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/counters.js
|
|
22882
22921
|
function invalidMetadata() {
|
|
22883
22922
|
throw new CliError("validation_error", "stored counter metadata is malformed \u2014 check the store before refreshing");
|
|
22884
22923
|
}
|
|
@@ -22896,11 +22935,11 @@ var counterStates = /* @__PURE__ */ __name(({ database }, messagePk, now2, maxAg
|
|
|
22896
22935
|
}
|
|
22897
22936
|
}, "parse");
|
|
22898
22937
|
const metadata3 = parse(row2.metadata), reactions = parse(row2.reactions);
|
|
22899
|
-
const
|
|
22938
|
+
const records2 = database.prepare("SELECT counter,value,created_at,source FROM message_counter_observations WHERE message_id=?").all(messagePk);
|
|
22900
22939
|
return COUNTER_FIELDS.map((counter) => {
|
|
22901
22940
|
const raw = counter === "reactions" ? reactions.total : metadata3[counter];
|
|
22902
22941
|
const value = validCounter(raw) ? raw : null;
|
|
22903
|
-
const record4 =
|
|
22942
|
+
const record4 = records2.find((one) => one.counter === counter);
|
|
22904
22943
|
const at = record4 && Number(record4.value) === value ? Number(record4.created_at) : Number.NaN;
|
|
22905
22944
|
const known2 = Number.isSafeInteger(at) && at >= 0 && at <= now2 && ["remote_fetch", "remote_update"].includes(String(record4?.source));
|
|
22906
22945
|
const age = known2 ? now2 - at : null;
|
|
@@ -22980,7 +23019,7 @@ var counterTargets = /* @__PURE__ */ __name((context, execution, options) => wit
|
|
|
22980
23019
|
};
|
|
22981
23020
|
}), "counterTargets");
|
|
22982
23021
|
|
|
22983
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23022
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/attachment-texts.js
|
|
22984
23023
|
var NOT_FILE_LIST = [...NOT_FILES].map((kind4) => `'${kind4}'`).join(",");
|
|
22985
23024
|
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,
|
|
22986
23025
|
att.size, att.local_path, att.extraction AS origin, att.size AS read_bytes, att.extraction_error AS error, att.content_sha256, att.extractor
|
|
@@ -23099,7 +23138,7 @@ var attachmentViews = /* @__PURE__ */ __name(({ database }, accountKey, { chatKe
|
|
|
23099
23138
|
}));
|
|
23100
23139
|
}, "attachmentViews");
|
|
23101
23140
|
|
|
23102
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23141
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/transcripts.js
|
|
23103
23142
|
var transcript = /* @__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");
|
|
23104
23143
|
var keepTranscript = /* @__PURE__ */ __name((context, chatKey, messageId, text6, source2) => {
|
|
23105
23144
|
const { orm, database, now: now2 } = context;
|
|
@@ -23137,7 +23176,7 @@ var intoVoiceAttachment = /* @__PURE__ */ __name((context, messagePk) => {
|
|
|
23137
23176
|
keepText(context, Number(row2.id), { text: String(row2.text), origin: "extracted", extractor: `speech:${row2.source}` });
|
|
23138
23177
|
}, "intoVoiceAttachment");
|
|
23139
23178
|
|
|
23140
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23179
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/messages.js
|
|
23141
23180
|
var FIELDS = [
|
|
23142
23181
|
"threadExternalId",
|
|
23143
23182
|
"senderIdentityId",
|
|
@@ -23454,7 +23493,7 @@ var writeDerivedReactions = /* @__PURE__ */ __name((context, chatKey, messageId)
|
|
|
23454
23493
|
reactionStatementsOf(context.database).total.run(JSON.stringify(derived), chatKey, messageId);
|
|
23455
23494
|
}, "writeDerivedReactions");
|
|
23456
23495
|
|
|
23457
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23496
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/keys.js
|
|
23458
23497
|
var keysOver = /* @__PURE__ */ __name((context) => {
|
|
23459
23498
|
const findAccountPk2 = /* @__PURE__ */ __name((key2) => findAccountPk(context, key2), "findAccountPk");
|
|
23460
23499
|
const findChatPk2 = /* @__PURE__ */ __name((accountKey, chatId) => findChatPk(context, accountKey, chatId), "findChatPk");
|
|
@@ -23475,7 +23514,7 @@ var keysOver = /* @__PURE__ */ __name((context) => {
|
|
|
23475
23514
|
};
|
|
23476
23515
|
}, "keysOver");
|
|
23477
23516
|
|
|
23478
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23517
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/account-groups.js
|
|
23479
23518
|
var accountGroupsOf = /* @__PURE__ */ __name((database) => {
|
|
23480
23519
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(ACCOUNT_GROUPS);
|
|
23481
23520
|
if (!row2)
|
|
@@ -23510,7 +23549,7 @@ var saveProfile = /* @__PURE__ */ __name((database, app, profile, key2, now2) =>
|
|
|
23510
23549
|
database.prepare("INSERT OR REPLACE INTO store_settings (key, value, at) VALUES (?, ?, ?)").run(PROFILES, JSON.stringify(profiles), now2);
|
|
23511
23550
|
}, "saveProfile");
|
|
23512
23551
|
|
|
23513
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23552
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/actors.js
|
|
23514
23553
|
var BOT_KINDS = ["agent", "rule", "script", "integration"];
|
|
23515
23554
|
var ownerPerson = /* @__PURE__ */ __name((database) => {
|
|
23516
23555
|
const found2 = database.prepare("SELECT id FROM persons WHERE owner = 1 ORDER BY id LIMIT 1").get();
|
|
@@ -23567,7 +23606,7 @@ var proposedBySql = /* @__PURE__ */ __name((type, id2, by) => {
|
|
|
23567
23606
|
return { sql: bot("pb.name = ?"), params: [by.bot] };
|
|
23568
23607
|
}, "proposedBySql");
|
|
23569
23608
|
|
|
23570
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23609
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/own-identities.js
|
|
23571
23610
|
var linkOwnIdentities = /* @__PURE__ */ __name((context) => {
|
|
23572
23611
|
const owner = ownerPerson(context.database).id;
|
|
23573
23612
|
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);
|
|
@@ -23588,7 +23627,7 @@ var linkToOwner = /* @__PURE__ */ __name((context, ref3) => {
|
|
|
23588
23627
|
return personOf(context, ref3);
|
|
23589
23628
|
}, "linkToOwner");
|
|
23590
23629
|
|
|
23591
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23630
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/providers.js
|
|
23592
23631
|
var PROVIDERS_SETTING = "providers";
|
|
23593
23632
|
var storedProvidersOf = /* @__PURE__ */ __name((database) => {
|
|
23594
23633
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(PROVIDERS_SETTING);
|
|
@@ -23623,7 +23662,7 @@ var registerProvider = /* @__PURE__ */ __name((database, value, now2) => {
|
|
|
23623
23662
|
});
|
|
23624
23663
|
}, "registerProvider");
|
|
23625
23664
|
|
|
23626
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23665
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/task-candidates.js
|
|
23627
23666
|
var DAY3 = 864e5;
|
|
23628
23667
|
var RECENTLY_CLOSED_MS = 14 * DAY3;
|
|
23629
23668
|
var TEXT_LIMIT = 20;
|
|
@@ -23822,7 +23861,7 @@ var taskSimilarityOver = /* @__PURE__ */ __name((context) => {
|
|
|
23822
23861
|
};
|
|
23823
23862
|
}, "taskSimilarityOver");
|
|
23824
23863
|
|
|
23825
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23864
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/task-category-settings.js
|
|
23826
23865
|
var SETTING3 = "taskCategories";
|
|
23827
23866
|
var savedTaskCategories = /* @__PURE__ */ __name((database) => {
|
|
23828
23867
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(SETTING3);
|
|
@@ -23841,7 +23880,7 @@ var saveTaskCategories = /* @__PURE__ */ __name((database, categories, now2) =>
|
|
|
23841
23880
|
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);
|
|
23842
23881
|
}, "saveTaskCategories");
|
|
23843
23882
|
|
|
23844
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23883
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close.js
|
|
23845
23884
|
var DEFAULT_AGENT_CLOSE = { allowed: true, min: 0.8 };
|
|
23846
23885
|
var ALLOWED = "taskAgentClose";
|
|
23847
23886
|
var MIN = "taskAgentCloseMin";
|
|
@@ -23897,7 +23936,7 @@ var SUGGESTION_COLUMNS = [
|
|
|
23897
23936
|
];
|
|
23898
23937
|
var CLEAR_SUGGESTION = SUGGESTION_COLUMNS.map((column2) => `${column2} = NULL`).join(", ");
|
|
23899
23938
|
|
|
23900
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23939
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/decisions.js
|
|
23901
23940
|
var DEFAULT_DECISION_POLICY = { agentDecisions: true, ruleProposalsOwnerOnly: true };
|
|
23902
23941
|
var mayDecide = /* @__PURE__ */ __name((row2, by, policy = DEFAULT_DECISION_POLICY) => {
|
|
23903
23942
|
if (by === "owner")
|
|
@@ -23937,13 +23976,13 @@ var assertMayWithdraw = /* @__PURE__ */ __name((row2, by) => {
|
|
|
23937
23976
|
});
|
|
23938
23977
|
}, "assertMayWithdraw");
|
|
23939
23978
|
var assertMayDecide = /* @__PURE__ */ __name((row2, by, policy = DEFAULT_DECISION_POLICY) => {
|
|
23940
|
-
const
|
|
23941
|
-
if (
|
|
23942
|
-
throw new CliError(
|
|
23979
|
+
const refusal2 = mayDecide(row2, by, policy);
|
|
23980
|
+
if (refusal2)
|
|
23981
|
+
throw new CliError(refusal2.code, refusal2.message, { reason: refusal2.reason });
|
|
23943
23982
|
}, "assertMayDecide");
|
|
23944
23983
|
var deciderAuthor = /* @__PURE__ */ __name((by) => by === "owner" ? "owner" : { bot: by.bot, ...by.model === void 0 ? {} : { model: by.model } }, "deciderAuthor");
|
|
23945
23984
|
|
|
23946
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
23985
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/domain/money.js
|
|
23947
23986
|
var CURRENCY_SCALES = {
|
|
23948
23987
|
AED: 2,
|
|
23949
23988
|
AMD: 2,
|
|
@@ -24028,7 +24067,7 @@ var quantityOf = /* @__PURE__ */ __name((text6) => {
|
|
|
24028
24067
|
}, "quantityOf");
|
|
24029
24068
|
var lineUnits = /* @__PURE__ */ __name((thousandths, unitPrice) => Number((thousandths * BigInt(unitPrice) + 500n) / 1000n), "lineUnits");
|
|
24030
24069
|
|
|
24031
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24070
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/domain/finance.js
|
|
24032
24071
|
var INVOICE_DIRECTIONS = ["receivable", "payable"];
|
|
24033
24072
|
var INVOICE_STATUSES = ["draft", "issued", "partly_paid", "paid", "void"];
|
|
24034
24073
|
var MONEY_DIRECTIONS = ["in", "out"];
|
|
@@ -24057,7 +24096,7 @@ var paymentLine = /* @__PURE__ */ __name((payment) => {
|
|
|
24057
24096
|
var invoiceTitle = /* @__PURE__ */ __name((invoice) => `Invoice ${invoiceLine(invoice)}`, "invoiceTitle");
|
|
24058
24097
|
var paymentEntryTitle = /* @__PURE__ */ __name((payment) => `Payment \xB7 ${paymentLine(payment)}`, "paymentEntryTitle");
|
|
24059
24098
|
|
|
24060
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24099
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/domain/ref-summaries.js
|
|
24061
24100
|
var PROFILE_PLACEHOLDER = "<profile>";
|
|
24062
24101
|
var oneLine = /* @__PURE__ */ __name((text6) => singleLine(text6.replace(/\s+/g, " ").trim()), "oneLine");
|
|
24063
24102
|
var openKind = /* @__PURE__ */ __name((kind4) => kind4 === "email" ? "message" : kind4 === "email_thread" ? "chat" : kind4 === "unknown" ? void 0 : kind4, "openKind");
|
|
@@ -24109,7 +24148,7 @@ var refLabel = /* @__PURE__ */ __name((summary) => {
|
|
|
24109
24148
|
return `${WORDS2[summary.kind]} ${named2}${notes3 === "" ? "" : ` (${notes3})`}`;
|
|
24110
24149
|
}, "refLabel");
|
|
24111
24150
|
|
|
24112
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24151
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/ref-summaries.js
|
|
24113
24152
|
var EXCERPT_CHARS = 280;
|
|
24114
24153
|
var TITLE_CHARS = 120;
|
|
24115
24154
|
var MEMORY_TITLE_CHARS = 80;
|
|
@@ -24462,7 +24501,7 @@ var refReadsOf = /* @__PURE__ */ __name((database, texts2, { excerpt = false } =
|
|
|
24462
24501
|
var summaryOf2 = /* @__PURE__ */ __name(({ sender, excerpt, ...summary }, withExcerpt) => withExcerpt ? { ...summary, excerpt } : summary, "summaryOf");
|
|
24463
24502
|
var refSummariesOf = /* @__PURE__ */ __name((database, texts2, options = {}) => new Map([...refReadsOf(database, texts2, options)].map(([text6, read2]) => [text6, summaryOf2(read2, options.excerpt === true)])), "refSummariesOf");
|
|
24464
24503
|
|
|
24465
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24504
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-sources.js
|
|
24466
24505
|
var sourceOf3 = /* @__PURE__ */ __name((read2, ref3) => ({
|
|
24467
24506
|
ref: ref3,
|
|
24468
24507
|
kind: read2.kind,
|
|
@@ -24498,7 +24537,7 @@ var evidenceSourcesOf = /* @__PURE__ */ __name((database, from2) => {
|
|
|
24498
24537
|
});
|
|
24499
24538
|
}, "evidenceSourcesOf");
|
|
24500
24539
|
|
|
24501
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24540
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/attachments/limits.js
|
|
24502
24541
|
var MAX_FILE_BYTES = 50 * 1024 * 1024;
|
|
24503
24542
|
var MAX_TEXT_CHARS = 2e6;
|
|
24504
24543
|
var ATTACHMENT_LIMIT_ENV = [
|
|
@@ -24524,7 +24563,7 @@ var pdfPreviewLimits = /* @__PURE__ */ __name((env = process.env) => {
|
|
|
24524
24563
|
return { pixels, bytes: positive(env, "MESSAGING_PDF_PREVIEW_MAX_MIB", 8 * 1024 * 1024, 1024 * 1024) };
|
|
24525
24564
|
}, "pdfPreviewLimits");
|
|
24526
24565
|
|
|
24527
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24566
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/ulid.js
|
|
24528
24567
|
import { randomBytes } from "node:crypto";
|
|
24529
24568
|
var CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
24530
24569
|
var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
|
|
@@ -24537,7 +24576,7 @@ var ulid = /* @__PURE__ */ __name((now2 = Date.now()) => {
|
|
|
24537
24576
|
return time3 + random;
|
|
24538
24577
|
}, "ulid");
|
|
24539
24578
|
|
|
24540
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24579
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/document-metadata.js
|
|
24541
24580
|
var FOLDED_FIELDS = ["title", "site", "language", "author"];
|
|
24542
24581
|
var encodeDocumentMetadata = /* @__PURE__ */ __name((meta, sections) => {
|
|
24543
24582
|
if (!meta && !sections?.length)
|
|
@@ -24558,7 +24597,7 @@ var languageOf = /* @__PURE__ */ __name((meta) => {
|
|
|
24558
24597
|
return typeof language === "string" && language !== "" ? language : null;
|
|
24559
24598
|
}, "languageOf");
|
|
24560
24599
|
|
|
24561
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24600
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/files.js
|
|
24562
24601
|
var isObject = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object" && !Array.isArray(value), "isObject");
|
|
24563
24602
|
var objectOf2 = /* @__PURE__ */ __name((value) => {
|
|
24564
24603
|
if (isObject(value))
|
|
@@ -24801,7 +24840,7 @@ var filesStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
|
|
|
24801
24840
|
};
|
|
24802
24841
|
}, "filesStoreOver");
|
|
24803
24842
|
|
|
24804
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24843
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/imported-documents.js
|
|
24805
24844
|
var IMPORTED_DOCUMENT_QUERY = defineQuery({
|
|
24806
24845
|
entity: "document",
|
|
24807
24846
|
backend: "sql",
|
|
@@ -24847,7 +24886,7 @@ var importedDocumentWhere = /* @__PURE__ */ __name((database, query) => {
|
|
|
24847
24886
|
return queryFilter(validateQuery(query, IMPORTED_DOCUMENT_QUERY), columns);
|
|
24848
24887
|
}, "importedDocumentWhere");
|
|
24849
24888
|
|
|
24850
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
24889
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/notes.js
|
|
24851
24890
|
var NOTE_FORMATS = ["obsidian", "markdown"];
|
|
24852
24891
|
var iso2 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
|
|
24853
24892
|
var optionalIso = /* @__PURE__ */ __name((value) => value == null ? null : iso2(value), "optionalIso");
|
|
@@ -25265,8 +25304,8 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
25265
25304
|
// In a folder, a document is wherever one of its live files is, under that file's path.
|
|
25266
25305
|
(folder === null ? "SELECT d.* FROM documents d WHERE d.deleted_at IS NULL AND ? IS NULL AND ? IS NULL " : "SELECT d.*, f.account_id AS account_id, CASE WHEN a.provider IN ('local', 'obsidian') THEN f.external_id ELSE d.external_id END AS external_id FROM files f JOIN documents d ON d.id = f.document_id JOIN accounts a ON a.id = f.account_id WHERE f.deleted_at IS NULL AND d.deleted_at IS NULL AND f.account_id = ? AND ? IS NOT NULL ") + `AND coalesce(json_extract(d.metadata, '$.catalog.active'), 1)=1 AND (? IS NULL OR EXISTS (SELECT 1 FROM links l WHERE l.from_type = 'document' AND l.from_id = d.id AND l.kind = ${linkKind("about")} AND l.to_type = ? AND l.to_id = ?)) ${documentText ? `AND ${documentText.sql} ` : ""}ORDER BY d.created_at DESC, d.id DESC LIMIT ?`
|
|
25267
25306
|
).all(folder, folder, aboutType, aboutType, aboutId, ...documentText?.params ?? [], limit + offset + 1).map(documentOf);
|
|
25268
|
-
const
|
|
25269
|
-
const all2 = [...files2, ...
|
|
25307
|
+
const written2 = options.source === "file" || folder !== null ? [] : database.prepare(`SELECT n.* FROM notes n WHERE n.deleted_at IS NULL AND (? IS NULL OR (n.notable_type = ? AND n.notable_id = ?) OR EXISTS (SELECT 1 FROM links l WHERE l.from_type = 'note' AND l.from_id = n.id AND l.kind = ${linkKind("about")} AND l.to_type = ? AND l.to_id = ?)) ${noteText2 ? `AND ${noteText2.sql} ` : ""}ORDER BY n.created_at DESC, n.id DESC LIMIT ?`).all(aboutType, aboutType, aboutId, aboutType, aboutId, ...noteText2?.params ?? [], limit + offset + 1).map(noteOf);
|
|
25308
|
+
const all2 = [...files2, ...written2].sort((a, b) => b.createdAt.localeCompare(a.createdAt) || b.ref.localeCompare(a.ref));
|
|
25270
25309
|
return { items: all2.slice(offset, offset + limit), hasMore: all2.length > offset + limit };
|
|
25271
25310
|
}, "notes"),
|
|
25272
25311
|
importedDocuments: /* @__PURE__ */ __name(async (folderId, query, { limit, offset }) => {
|
|
@@ -25373,7 +25412,7 @@ var notesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
25373
25412
|
};
|
|
25374
25413
|
}, "notesStoreOver");
|
|
25375
25414
|
|
|
25376
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25415
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/memories.js
|
|
25377
25416
|
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";
|
|
25378
25417
|
var iso3 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
|
|
25379
25418
|
var oneOf2 = /* @__PURE__ */ __name((value, allowed, what) => {
|
|
@@ -25591,7 +25630,7 @@ var memoriesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
25591
25630
|
};
|
|
25592
25631
|
}, "memoriesStoreOver");
|
|
25593
25632
|
|
|
25594
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25633
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/task-first-pass.js
|
|
25595
25634
|
var DEFAULT_FIRST_PASS_PER_CHAT = 0;
|
|
25596
25635
|
var KEY = "taskFirstPassPerChat";
|
|
25597
25636
|
var firstPassPerChatOf = /* @__PURE__ */ __name((value, setting = "task_first_pass_per_chat") => {
|
|
@@ -25611,7 +25650,7 @@ var saveFirstPassPerChat = /* @__PURE__ */ __name((database, value, now2) => {
|
|
|
25611
25650
|
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);
|
|
25612
25651
|
}, "saveFirstPassPerChat");
|
|
25613
25652
|
|
|
25614
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25653
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/task-board.js
|
|
25615
25654
|
var TASK_SORTS = ["priority", "due", "created", "updated", "key", "state"];
|
|
25616
25655
|
var field = /* @__PURE__ */ __name((name, type, example, more = {}) => ({
|
|
25617
25656
|
name,
|
|
@@ -25832,7 +25871,7 @@ var withoutField = /* @__PURE__ */ __name((query, name) => {
|
|
|
25832
25871
|
return root === void 0 ? void 0 : { ...query, root };
|
|
25833
25872
|
}, "withoutField");
|
|
25834
25873
|
|
|
25835
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25874
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/task-comments.js
|
|
25836
25875
|
var authorNamed = /* @__PURE__ */ __name((database, row2) => {
|
|
25837
25876
|
if (row2.author_type == null)
|
|
25838
25877
|
return null;
|
|
@@ -25860,7 +25899,7 @@ var addComment = /* @__PURE__ */ __name((context, task, body2, by) => {
|
|
|
25860
25899
|
return commentsOf(database, task).find((one) => one.ref === `note:${made}`);
|
|
25861
25900
|
}, "addComment");
|
|
25862
25901
|
|
|
25863
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
25902
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/task-relations.js
|
|
25864
25903
|
var TASK_RELATION_KINDS = [
|
|
25865
25904
|
"blocked-by",
|
|
25866
25905
|
"follow-up-of",
|
|
@@ -25990,7 +26029,7 @@ var taskRelationsStoreOver = /* @__PURE__ */ __name((context, record4) => {
|
|
|
25990
26029
|
};
|
|
25991
26030
|
}, "taskRelationsStoreOver");
|
|
25992
26031
|
|
|
25993
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26032
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/work-tasks.js
|
|
25994
26033
|
var TASK_ROLES = ["assignee", "reviewer", "watcher"];
|
|
25995
26034
|
var iso4 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
|
|
25996
26035
|
var recordTaskEvent = /* @__PURE__ */ __name((database, task, actor, kind4, changes, at) => {
|
|
@@ -26494,7 +26533,7 @@ var workTasksOver = /* @__PURE__ */ __name((context) => {
|
|
|
26494
26533
|
};
|
|
26495
26534
|
}, "workTasksOver");
|
|
26496
26535
|
|
|
26497
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26536
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/task-close-store.js
|
|
26498
26537
|
var taskCloseOver = /* @__PURE__ */ __name((context) => {
|
|
26499
26538
|
const { database, now: now2 } = context;
|
|
26500
26539
|
const liveRow = /* @__PURE__ */ __name((id2) => {
|
|
@@ -26543,7 +26582,7 @@ var taskCloseOver = /* @__PURE__ */ __name((context) => {
|
|
|
26543
26582
|
};
|
|
26544
26583
|
}, "taskCloseOver");
|
|
26545
26584
|
|
|
26546
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26585
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/task-pairs.js
|
|
26547
26586
|
var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
|
|
26548
26587
|
const { database, now: now2 } = context;
|
|
26549
26588
|
const required3 = /* @__PURE__ */ __name((id2) => {
|
|
@@ -26761,7 +26800,7 @@ var taskPairsOver = /* @__PURE__ */ __name((context, similarity) => {
|
|
|
26761
26800
|
};
|
|
26762
26801
|
}, "taskPairsOver");
|
|
26763
26802
|
|
|
26764
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
26803
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/tasks.js
|
|
26765
26804
|
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";
|
|
26766
26805
|
var taskStoreOver = /* @__PURE__ */ __name((context) => {
|
|
26767
26806
|
const { database, now: now2 } = context;
|
|
@@ -26966,7 +27005,7 @@ var oneOf3 = /* @__PURE__ */ __name((values, value, column2) => {
|
|
|
26966
27005
|
throw new CliError("configuration_error", `the store holds a task with an unknown ${column2} "${String(value)}"`);
|
|
26967
27006
|
}, "oneOf");
|
|
26968
27007
|
|
|
26969
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27008
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/accounts.js
|
|
26970
27009
|
var accountAccountsOver = /* @__PURE__ */ __name((context) => {
|
|
26971
27010
|
const { database } = context;
|
|
26972
27011
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2 } = keysOver(context);
|
|
@@ -27011,7 +27050,7 @@ var accountsStoreOver = /* @__PURE__ */ __name((context, keyed) => {
|
|
|
27011
27050
|
};
|
|
27012
27051
|
}, "accountsStoreOver");
|
|
27013
27052
|
|
|
27014
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27053
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/attachments.js
|
|
27015
27054
|
var refColumn = /* @__PURE__ */ __name((ref3) => ref3 && Object.keys(ref3).length > 0 ? { providerRef: JSON.stringify(ref3) } : {}, "refColumn");
|
|
27016
27055
|
var updatePlaced = /* @__PURE__ */ __name(({ orm }, chatKey, messageId, files2, change) => {
|
|
27017
27056
|
const message2 = orm.select({ pk: messages.id }).from(messages).where(and(eq(messages.chatId, chatKey), eq(messages.externalId, messageId))).get();
|
|
@@ -27035,7 +27074,7 @@ var keepDownloads = /* @__PURE__ */ __name((context, chatKey, messageId, files2)
|
|
|
27035
27074
|
})), "keepDownloads");
|
|
27036
27075
|
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");
|
|
27037
27076
|
|
|
27038
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27077
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/attachments.js
|
|
27039
27078
|
var accountAttachmentsOver = /* @__PURE__ */ __name((context) => {
|
|
27040
27079
|
const { database } = context;
|
|
27041
27080
|
const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
|
|
@@ -27092,7 +27131,7 @@ var attachmentsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
27092
27131
|
}, "keepAttachmentText")
|
|
27093
27132
|
}), "attachmentsStoreOver");
|
|
27094
27133
|
|
|
27095
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27134
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-rekey.js
|
|
27096
27135
|
var chatRow = /* @__PURE__ */ __name((context, accountKey, chatId) => context.database.prepare("SELECT * FROM chats WHERE account_id = ? AND external_id = ?").get(accountKey, chatId), "chatRow");
|
|
27097
27136
|
var pointerMover = /* @__PURE__ */ __name((context, type) => {
|
|
27098
27137
|
const statements = pointerPairs(context.database).filter(({ table }) => table !== "involvements").map(({ table, pointer }) => {
|
|
@@ -27272,7 +27311,7 @@ var rekeyChats = /* @__PURE__ */ __name((context, key2, accountKey, pairs, lockM
|
|
|
27272
27311
|
return done;
|
|
27273
27312
|
}, "rekeyChats");
|
|
27274
27313
|
|
|
27275
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27314
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/completeness.js
|
|
27276
27315
|
var historyStartKey = /* @__PURE__ */ __name((chatId) => `history_start:${chatId}`, "historyStartKey");
|
|
27277
27316
|
var fetchedKey = /* @__PURE__ */ __name((chatId) => `fetched:${chatId}`, "fetchedKey");
|
|
27278
27317
|
var CHAT_LIST_KEY = "chat_list_complete";
|
|
@@ -27304,7 +27343,7 @@ var chatCompleteness = /* @__PURE__ */ __name(({ database }, accountKey, chatIds
|
|
|
27304
27343
|
});
|
|
27305
27344
|
}, "chatCompleteness");
|
|
27306
27345
|
|
|
27307
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27346
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/chats.js
|
|
27308
27347
|
var chatsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
27309
27348
|
const { database } = context;
|
|
27310
27349
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, writeState: writeState2 } = keysOver(context);
|
|
@@ -27435,7 +27474,7 @@ var chatsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
27435
27474
|
};
|
|
27436
27475
|
}, "chatsStoreOver");
|
|
27437
27476
|
|
|
27438
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27477
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/batches.js
|
|
27439
27478
|
import { createHash as createHash6 } from "node:crypto";
|
|
27440
27479
|
var BATCH_CONTEXT = 50;
|
|
27441
27480
|
var replied = /* @__PURE__ */ __name((m) => sql`EXISTS (SELECT 1 FROM messages p WHERE p.chat_id = ${m}.chat_id
|
|
@@ -27573,7 +27612,7 @@ var saveAnswers = /* @__PURE__ */ __name((context, id2, answer) => {
|
|
|
27573
27612
|
var clearAnswers = /* @__PURE__ */ __name(({ orm }, chatKey, model) => Number(orm.all(sql`DELETE FROM message_links WHERE chat_id = ${chatKey} AND source = 'agent'
|
|
27574
27613
|
${model === void 0 ? sql`` : sql`AND method = ${model}`} RETURNING 1 AS n`).length), "clearAnswers");
|
|
27575
27614
|
|
|
27576
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27615
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/conversations.js
|
|
27577
27616
|
import { setTimeout } from "node:timers/promises";
|
|
27578
27617
|
var position = /* @__PURE__ */ __name((sentAt, pk) => `${sentAt}:${pk}`, "position");
|
|
27579
27618
|
var linkInputs = /* @__PURE__ */ __name(({ orm }, chatKey, { after: after2, limit }) => {
|
|
@@ -27885,7 +27924,7 @@ var agentAnswers = /* @__PURE__ */ __name(({ orm }, chatKey) => new Map(orm.all(
|
|
|
27885
27924
|
AND NOT EXISTS (SELECT 1 FROM messages d
|
|
27886
27925
|
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");
|
|
27887
27926
|
|
|
27888
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27927
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/conversations.js
|
|
27889
27928
|
var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
27890
27929
|
const { database } = context;
|
|
27891
27930
|
const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
|
|
@@ -27992,7 +28031,7 @@ var conversationsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
27992
28031
|
};
|
|
27993
28032
|
}, "conversationsStoreOver");
|
|
27994
28033
|
|
|
27995
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28034
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/counters.js
|
|
27996
28035
|
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";
|
|
27997
28036
|
var accountCountersOver = /* @__PURE__ */ __name((context) => {
|
|
27998
28037
|
const { database } = context;
|
|
@@ -28017,7 +28056,7 @@ var countersStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
28017
28056
|
counterTargets: /* @__PURE__ */ __name(async (execution, options) => counterTargets(context, execution, options), "counterTargets")
|
|
28018
28057
|
}), "countersStoreOver");
|
|
28019
28058
|
|
|
28020
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28059
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/mentions.js
|
|
28021
28060
|
var MENTION_STATUSES = ["found", "linked", "dismissed"];
|
|
28022
28061
|
var MENTION_QUERY = defineQuery({
|
|
28023
28062
|
entity: "mention",
|
|
@@ -28145,13 +28184,13 @@ var showMention = /* @__PURE__ */ __name((database, accountPk2, id2, around2 = 8
|
|
|
28145
28184
|
candidates: candidatesOf2(database, mention, Number(row2.chat_pk))
|
|
28146
28185
|
};
|
|
28147
28186
|
}, "showMention");
|
|
28148
|
-
var candidatesOf2 = /* @__PURE__ */ __name((database, { kind: kind4, value, written }, chat2) => {
|
|
28187
|
+
var candidatesOf2 = /* @__PURE__ */ __name((database, { kind: kind4, value, written: written2 }, chat2) => {
|
|
28149
28188
|
if (kind4 === "phone" || kind4 === "email")
|
|
28150
28189
|
return database.prepare("SELECT l.person_id AS person FROM mentions mn JOIN emails e ON e.id = mn.source_id AND e.deleted_at IS NULL AND coalesce(e.outgoing, 0) = 0 JOIN identity_links l ON l.identity_id = e.from_identity_id JOIN persons p ON p.id = l.person_id AND p.owner = 0 WHERE mn.source_type = 'email' AND mn.kind = ? AND mn.value = ? GROUP BY l.person_id ORDER BY count(DISTINCT e.id) DESC, l.person_id LIMIT 5").all(kind4, value).map((row2) => `person:${Number(row2.person)}`);
|
|
28151
28190
|
if (kind4 !== "person-name")
|
|
28152
28191
|
return [];
|
|
28153
28192
|
const here = chat2 === null ? /* @__PURE__ */ new Set() : participants(database)(chat2);
|
|
28154
|
-
return (findNames(
|
|
28193
|
+
return (findNames(written2, nameIndex(knownPeople(database), createStemmer()))[0]?.people ?? []).map((person2) => ({ person: person2, here: here.has(person2) })).sort((a, b) => Number(b.here) - Number(a.here) || a.person - b.person).map(({ person: person2 }) => `person:${person2}`);
|
|
28155
28194
|
}, "candidatesOf");
|
|
28156
28195
|
var mentionOfAccount = /* @__PURE__ */ __name((database, accountPk2, id2) => {
|
|
28157
28196
|
const row2 = database.prepare(`${SELECT}WHERE mn.id = ? AND m.account_id = ?`).get(id2, accountPk2);
|
|
@@ -28233,7 +28272,7 @@ var listPlaces = /* @__PURE__ */ __name((database, { limit, offset }) => {
|
|
|
28233
28272
|
return { items: hasMore ? rows.slice(0, limit) : rows, hasMore };
|
|
28234
28273
|
}, "listPlaces");
|
|
28235
28274
|
|
|
28236
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28275
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/mentions.js
|
|
28237
28276
|
var accountMentionsOver = /* @__PURE__ */ __name((context) => {
|
|
28238
28277
|
const { database } = context;
|
|
28239
28278
|
const { findAccountPk: findAccountPk2 } = keysOver(context);
|
|
@@ -28268,7 +28307,7 @@ var mentionsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
28268
28307
|
places: /* @__PURE__ */ __name(async (window) => listPlaces(context.database, window), "places")
|
|
28269
28308
|
}), "mentionsStoreOver");
|
|
28270
28309
|
|
|
28271
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28310
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/document-links.js
|
|
28272
28311
|
var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messageId) => {
|
|
28273
28312
|
const read2 = 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");
|
|
28274
28313
|
const rows = messageId === void 0 ? read2.all(chatKey) : read2.all(chatKey, messageId);
|
|
@@ -28283,7 +28322,7 @@ var documentLinkMessages = /* @__PURE__ */ __name(({ database }, chatKey, messag
|
|
|
28283
28322
|
}));
|
|
28284
28323
|
}, "documentLinkMessages");
|
|
28285
28324
|
|
|
28286
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28325
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/follow-ups.js
|
|
28287
28326
|
var stemmerFor = stemmerCache();
|
|
28288
28327
|
var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit }) => {
|
|
28289
28328
|
if (wanted.length > 50 || !Number.isInteger(limit) || limit < 1 || limit > 100)
|
|
@@ -28327,7 +28366,7 @@ var laterSharingRare = /* @__PURE__ */ __name((context, wanted, { rareAt, limit
|
|
|
28327
28366
|
});
|
|
28328
28367
|
}, "laterSharingRare");
|
|
28329
28368
|
|
|
28330
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28369
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/messages.js
|
|
28331
28370
|
var accountMessagesOver = /* @__PURE__ */ __name((context) => {
|
|
28332
28371
|
const { database } = context;
|
|
28333
28372
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf, chatPkFor: chatPkFor2, answeredChatPk: answeredChatPk2, upsertMessage: upsertMessage2 } = keysOver(context);
|
|
@@ -28462,7 +28501,7 @@ var messagesStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
28462
28501
|
laterSharingRare: /* @__PURE__ */ __name(async (wanted, options) => laterSharingRare(context, wanted, options), "laterSharingRare")
|
|
28463
28502
|
}), "messagesStoreOver");
|
|
28464
28503
|
|
|
28465
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28504
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/person-preparation.js
|
|
28466
28505
|
var GLOBAL_PROJECT = "SELECT id FROM main.projects WHERE account_id IS NULL AND deleted_at IS NULL";
|
|
28467
28506
|
var iso5 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
|
|
28468
28507
|
var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: accounts2, limit }) => {
|
|
@@ -28519,7 +28558,7 @@ var personPreparation = /* @__PURE__ */ __name(({ database }, uid, { accounts: a
|
|
|
28519
28558
|
});
|
|
28520
28559
|
}, "personPreparation");
|
|
28521
28560
|
|
|
28522
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28561
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/person-scope.js
|
|
28523
28562
|
var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds) => {
|
|
28524
28563
|
const id2 = Number(uid);
|
|
28525
28564
|
if (!/^[1-9]\d*$/.test(uid) || !Number.isSafeInteger(id2) || !accountIds.length || accountIds.length > 1e3 || accountIds.some((account) => !Number.isSafeInteger(account) || account <= 0))
|
|
@@ -28527,7 +28566,7 @@ var personSeenInAccounts = /* @__PURE__ */ __name(({ database }, uid, accountIds
|
|
|
28527
28566
|
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)));
|
|
28528
28567
|
}, "personSeenInAccounts");
|
|
28529
28568
|
|
|
28530
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28569
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/private-people.js
|
|
28531
28570
|
var required2 = /* @__PURE__ */ __name(({ database }, key2, personId) => {
|
|
28532
28571
|
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);
|
|
28533
28572
|
if (!row2)
|
|
@@ -28593,7 +28632,7 @@ var removeNote = /* @__PURE__ */ __name((context, key2, personId, id2) => {
|
|
|
28593
28632
|
return { id: id2, personId, removed: true };
|
|
28594
28633
|
}, "removeNote");
|
|
28595
28634
|
|
|
28596
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28635
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/people.js
|
|
28597
28636
|
var accountPeopleOver = /* @__PURE__ */ __name((context) => {
|
|
28598
28637
|
const { database } = context;
|
|
28599
28638
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, identityPk: identityPk2 } = keysOver(context);
|
|
@@ -28678,13 +28717,13 @@ var peopleStoreOver = /* @__PURE__ */ __name((context, keyed) => {
|
|
|
28678
28717
|
};
|
|
28679
28718
|
}, "peopleStoreOver");
|
|
28680
28719
|
|
|
28681
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28720
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
|
|
28682
28721
|
import { createHash as createHash8 } from "node:crypto";
|
|
28683
28722
|
|
|
28684
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28723
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
|
|
28685
28724
|
import { createHash as createHash7 } from "node:crypto";
|
|
28686
28725
|
|
|
28687
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28726
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/domain/rankings-options.js
|
|
28688
28727
|
var MESSAGE_MEASURES = ["views", "reactions", "forwards", "comments", "replies", "thread-size"];
|
|
28689
28728
|
var AUTHOR_MEASURES = [
|
|
28690
28729
|
"messages",
|
|
@@ -28824,7 +28863,7 @@ var withoutUrls = /* @__PURE__ */ __name((text6) => text6.replace(/\S+/gu, (toke
|
|
|
28824
28863
|
var rankingWords = /* @__PURE__ */ __name((text6) => withoutUrls(text6).match(/[\p{L}\p{N}]+/gu)?.length ?? 0, "rankingWords");
|
|
28825
28864
|
var rankingQuestion = /* @__PURE__ */ __name((text6) => withoutUrls(text6).includes("?"), "rankingQuestion");
|
|
28826
28865
|
|
|
28827
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
28866
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/domain/rankings-graph.js
|
|
28828
28867
|
var RANKING_GRAPH_LIMITS = { nodes: 5e4, depth: 256, work: 1e7, bytes: 8388608 };
|
|
28829
28868
|
var exhausted2 = /* @__PURE__ */ __name((budget) => {
|
|
28830
28869
|
throw new CliError("validation_error", `ranking exceeded ${budget} \u2014 narrow its chat or date scope`, {
|
|
@@ -29046,7 +29085,7 @@ var rankReplyGraph = /* @__PURE__ */ __name((nodes, check3 = () => {
|
|
|
29046
29085
|
};
|
|
29047
29086
|
}, "rankReplyGraph");
|
|
29048
29087
|
|
|
29049
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29088
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/domain/admin-statistics.js
|
|
29050
29089
|
var adminEntityKey = /* @__PURE__ */ __name((row2) => JSON.stringify([row2.account.provider, row2.account.account, row2.id]), "adminEntityKey");
|
|
29051
29090
|
var personKey = /* @__PURE__ */ __name((node) => JSON.stringify([node.account.provider, node.account.account, node.sender]), "personKey");
|
|
29052
29091
|
var locator = /* @__PURE__ */ __name((node) => formatLocator({ ...node.account, chat: node.chatId, message: node.id }), "locator");
|
|
@@ -29220,7 +29259,7 @@ var calculateAdminStatistics = /* @__PURE__ */ __name((nodes, stays, options, in
|
|
|
29220
29259
|
return { items, evidence, summary, graph: graph.quality };
|
|
29221
29260
|
}, "calculateAdminStatistics");
|
|
29222
29261
|
|
|
29223
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29262
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/domain/rankings-range.js
|
|
29224
29263
|
var rankingContextRange = /* @__PURE__ */ __name((root) => {
|
|
29225
29264
|
const dates = [];
|
|
29226
29265
|
const visit = /* @__PURE__ */ __name((node, required3) => {
|
|
@@ -29242,7 +29281,7 @@ var rankingContextRange = /* @__PURE__ */ __name((root) => {
|
|
|
29242
29281
|
return dates[0].node.resolution.date;
|
|
29243
29282
|
}, "rankingContextRange");
|
|
29244
29283
|
|
|
29245
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29284
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/rankings.js
|
|
29246
29285
|
var reactionCounts = /* @__PURE__ */ __name((stored3) => {
|
|
29247
29286
|
let counts;
|
|
29248
29287
|
try {
|
|
@@ -29537,7 +29576,7 @@ var rankQuery = /* @__PURE__ */ __name((context, execution, request, inspect) =>
|
|
|
29537
29576
|
});
|
|
29538
29577
|
}, "rankQuery");
|
|
29539
29578
|
|
|
29540
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29579
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/admin-statistics.js
|
|
29541
29580
|
function fail4(message2, reason = "query.too-large") {
|
|
29542
29581
|
throw new CliError("validation_error", message2, { reason, complete: false });
|
|
29543
29582
|
}
|
|
@@ -29594,10 +29633,10 @@ var adminStatisticsQuery = /* @__PURE__ */ __name((context, execution, request)
|
|
|
29594
29633
|
let stays = [];
|
|
29595
29634
|
if (options.report === "newcomers" && execution.chat) {
|
|
29596
29635
|
const chat2 = execution.chat;
|
|
29597
|
-
const
|
|
29598
|
-
if (
|
|
29636
|
+
const records2 = database.prepare("SELECT i.external_id AS id,s.joined_at,s.first_seen_at,s.left_at FROM member_stays s JOIN identities i ON i.id=s.identity_id JOIN chats c ON c.id=s.chat_id JOIN accounts ac ON ac.id=c.account_id WHERE ac.provider=? AND ac.external_id=? AND c.external_id=? AND ((s.joined_at BETWEEN ? AND ?) OR (s.joined_at IS NULL AND s.first_seen_at BETWEEN ? AND ?)) ORDER BY s.id LIMIT ?").all(chat2.account.provider, chat2.account.account, chat2.chatId, options.joinSince, options.joinUntil, options.joinSince, options.joinUntil, RANKING_GRAPH_LIMITS.nodes + 1);
|
|
29637
|
+
if (records2.length > RANKING_GRAPH_LIMITS.nodes)
|
|
29599
29638
|
fail4("newcomer cohort exceeds node budget \u2014 narrow join dates");
|
|
29600
|
-
stays =
|
|
29639
|
+
stays = records2.map((row2) => ({
|
|
29601
29640
|
id: String(row2.id),
|
|
29602
29641
|
account: chat2.account,
|
|
29603
29642
|
chatId: chat2.chatId,
|
|
@@ -29714,7 +29753,7 @@ var adminStatisticsQuery = /* @__PURE__ */ __name((context, execution, request)
|
|
|
29714
29753
|
return result;
|
|
29715
29754
|
}), "adminStatisticsQuery");
|
|
29716
29755
|
|
|
29717
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29756
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/conversation-eligibility.js
|
|
29718
29757
|
var conversationEligibility = /* @__PURE__ */ __name(async (context, execution) => {
|
|
29719
29758
|
if (!execution.accounts.length)
|
|
29720
29759
|
return { conversations: [], chats: [] };
|
|
@@ -29732,7 +29771,7 @@ var conversationEligibility = /* @__PURE__ */ __name(async (context, execution)
|
|
|
29732
29771
|
return { conversations: conversations2, chats: chats2 };
|
|
29733
29772
|
}, "conversationEligibility");
|
|
29734
29773
|
|
|
29735
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29774
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/ranking-evidence.js
|
|
29736
29775
|
import { createHash as createHash9 } from "node:crypto";
|
|
29737
29776
|
var EVIDENCE_BYTES = 64 * 1024;
|
|
29738
29777
|
var FINGERPRINT_BYTES = 8 * 1024 * 1024;
|
|
@@ -29882,7 +29921,7 @@ var rankingEvidence = /* @__PURE__ */ __name((context, execution, request) => {
|
|
|
29882
29921
|
return result;
|
|
29883
29922
|
}, "rankingEvidence");
|
|
29884
29923
|
|
|
29885
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29924
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/queries.js
|
|
29886
29925
|
var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
|
|
29887
29926
|
const mailIndexed = /* @__PURE__ */ __name((execution) => {
|
|
29888
29927
|
if (execution.corpus === "mail")
|
|
@@ -29901,7 +29940,7 @@ var queriesStoreOver = /* @__PURE__ */ __name((context, stemmerFor2) => {
|
|
|
29901
29940
|
};
|
|
29902
29941
|
}, "queriesStoreOver");
|
|
29903
29942
|
|
|
29904
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29943
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/chat-events.js
|
|
29905
29944
|
var saveChatEvents = /* @__PURE__ */ __name((context, accountKey, provider, chatKey, events3) => {
|
|
29906
29945
|
const { database, now: now2 } = context;
|
|
29907
29946
|
const insert = database.prepare(`INSERT INTO chat_events (chat_id, source_id, action, actor_identity_id, title, happened_at, created_at, updated_at)
|
|
@@ -29940,10 +29979,10 @@ var chatEventsOf = /* @__PURE__ */ __name(({ database }, chatKey, { since = 0, l
|
|
|
29940
29979
|
}));
|
|
29941
29980
|
}, "chatEventsOf");
|
|
29942
29981
|
|
|
29943
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29982
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
|
|
29944
29983
|
import { createHash as createHash10 } from "node:crypto";
|
|
29945
29984
|
|
|
29946
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
29985
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/domain/calendar.js
|
|
29947
29986
|
var calendarKey = /* @__PURE__ */ __name((zone, by) => {
|
|
29948
29987
|
const format = new Intl.DateTimeFormat("en-CA", {
|
|
29949
29988
|
timeZone: zone,
|
|
@@ -29958,7 +29997,7 @@ var calendarKey = /* @__PURE__ */ __name((zone, by) => {
|
|
|
29958
29997
|
};
|
|
29959
29998
|
}, "calendarKey");
|
|
29960
29999
|
|
|
29961
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30000
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/domain/retention.js
|
|
29962
30001
|
var RETENTION_TOLERANCE = 864e5;
|
|
29963
30002
|
var validateRetentionOptions = /* @__PURE__ */ __name((options) => {
|
|
29964
30003
|
const { since, until, cutoff, checkpoints, within, limit, by } = options;
|
|
@@ -30012,7 +30051,7 @@ var retentionCohorts = /* @__PURE__ */ __name((stays, options) => {
|
|
|
30012
30051
|
return [...groups.values()].sort((a, b) => a.cohort.localeCompare(b.cohort));
|
|
30013
30052
|
}, "retentionCohorts");
|
|
30014
30053
|
|
|
30015
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30054
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/retention.js
|
|
30016
30055
|
var iso6 = /* @__PURE__ */ __name((at) => new Date(at).toISOString(), "iso");
|
|
30017
30056
|
var week = /* @__PURE__ */ __name((day) => {
|
|
30018
30057
|
const date3 = /* @__PURE__ */ new Date(`${day}T00:00:00Z`);
|
|
@@ -30148,7 +30187,7 @@ var retentionQuery = /* @__PURE__ */ __name((context, accountPk2, chatPk, chatId
|
|
|
30148
30187
|
};
|
|
30149
30188
|
}, "retentionQuery");
|
|
30150
30189
|
|
|
30151
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30190
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/roster.js
|
|
30152
30191
|
var iso7 = /* @__PURE__ */ __name((ms) => ms === null ? null : new Date(ms).toISOString(), "iso");
|
|
30153
30192
|
var marksOf = /* @__PURE__ */ __name(({ isBot, flagged, deleted, hasPhoto }) => ({
|
|
30154
30193
|
...isBot === void 0 ? {} : { bot: isBot },
|
|
@@ -30279,7 +30318,7 @@ var trackedChats = /* @__PURE__ */ __name((context, accountKey, where) => contex
|
|
|
30279
30318
|
lastCount: memberCountsOf(context, pk).at(-1) ?? null
|
|
30280
30319
|
})), "trackedChats");
|
|
30281
30320
|
|
|
30282
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30321
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/roster.js
|
|
30283
30322
|
var rosterStoreOver = /* @__PURE__ */ __name((context) => {
|
|
30284
30323
|
const { database } = context;
|
|
30285
30324
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, writeMembers: writeMembers2 } = keysOver(context);
|
|
@@ -30335,7 +30374,7 @@ var rosterStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
30335
30374
|
};
|
|
30336
30375
|
}, "rosterStoreOver");
|
|
30337
30376
|
|
|
30338
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30377
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/backfill.js
|
|
30339
30378
|
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");
|
|
30340
30379
|
var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatch, until = /* @__PURE__ */ __name(() => false, "until") } = {}) => {
|
|
30341
30380
|
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 ?`);
|
|
@@ -30359,7 +30398,7 @@ var backfillNormalized = /* @__PURE__ */ __name((database, { batch = 5e3, onBatc
|
|
|
30359
30398
|
}
|
|
30360
30399
|
}, "backfillNormalized");
|
|
30361
30400
|
|
|
30362
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30401
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/search-index.js
|
|
30363
30402
|
var INDEX2 = "message_words";
|
|
30364
30403
|
var searchIndexState2 = /* @__PURE__ */ __name((database) => {
|
|
30365
30404
|
const row2 = indexRow(database, INDEX2);
|
|
@@ -30456,10 +30495,10 @@ var buildTerms = /* @__PURE__ */ __name((database, { batch, until, onBatch }) =>
|
|
|
30456
30495
|
const next = database.prepare(`SELECT term FROM message_words_vocab WHERE col = 'normalized_text' AND term > ? ORDER BY term LIMIT ?`);
|
|
30457
30496
|
const addTerm = termWriters(database);
|
|
30458
30497
|
let after2 = String(database.prepare("SELECT coalesce(max(term), '') AS term FROM search_terms").get()?.term);
|
|
30459
|
-
let
|
|
30498
|
+
let written2 = 0;
|
|
30460
30499
|
for (; ; ) {
|
|
30461
30500
|
if (until())
|
|
30462
|
-
return
|
|
30501
|
+
return written2;
|
|
30463
30502
|
const terms2 = next.all(after2, batch).map((row2) => String(row2.term));
|
|
30464
30503
|
if (terms2.length === 0)
|
|
30465
30504
|
break;
|
|
@@ -30467,12 +30506,12 @@ var buildTerms = /* @__PURE__ */ __name((database, { batch, until, onBatch }) =>
|
|
|
30467
30506
|
for (const word of terms2)
|
|
30468
30507
|
addTerm(word);
|
|
30469
30508
|
});
|
|
30470
|
-
|
|
30509
|
+
written2 += terms2.length;
|
|
30471
30510
|
after2 = terms2.at(-1) ?? after2;
|
|
30472
|
-
onBatch?.("terms",
|
|
30511
|
+
onBatch?.("terms", written2);
|
|
30473
30512
|
}
|
|
30474
30513
|
database.prepare("UPDATE search_index_state SET terms_through = ? WHERE name = ?").run(Math.max(through, 1), INDEX2);
|
|
30475
|
-
return
|
|
30514
|
+
return written2;
|
|
30476
30515
|
}, "buildTerms");
|
|
30477
30516
|
var resetSearchIndex = /* @__PURE__ */ __name((database) => {
|
|
30478
30517
|
if (!searchIndexState2(database))
|
|
@@ -30486,7 +30525,7 @@ var resetSearchIndex = /* @__PURE__ */ __name((database) => {
|
|
|
30486
30525
|
});
|
|
30487
30526
|
}, "resetSearchIndex");
|
|
30488
30527
|
|
|
30489
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30528
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/stems-fill.js
|
|
30490
30529
|
var fillStems = /* @__PURE__ */ __name((database, { batch = 5e3, until = /* @__PURE__ */ __name(() => false, "until"), onBatch, now: now2 = Date.now } = {}) => {
|
|
30491
30530
|
const filled2 = { stemmed: 0, drained: 0 };
|
|
30492
30531
|
const before2 = stemsState(database);
|
|
@@ -30581,7 +30620,7 @@ var followDefaultStemmers = /* @__PURE__ */ __name((database, now2 = Date.now) =
|
|
|
30581
30620
|
return resetStems(database, { now: now2 });
|
|
30582
30621
|
}, "followDefaultStemmers");
|
|
30583
30622
|
|
|
30584
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30623
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/words.js
|
|
30585
30624
|
var VOCABULARY = "SELECT term, doc FROM message_words_vocab WHERE col = 'normalized_text'";
|
|
30586
30625
|
var knownTerms = /* @__PURE__ */ __name(({ database }, terms2) => {
|
|
30587
30626
|
const lookup = database.prepare(`${VOCABULARY} AND term >= ? AND term <= ? LIMIT 1`);
|
|
@@ -30603,7 +30642,7 @@ var termCandidates = /* @__PURE__ */ __name(({ database }, pieces, { shortest, l
|
|
|
30603
30642
|
});
|
|
30604
30643
|
}, "termCandidates");
|
|
30605
30644
|
|
|
30606
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30645
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/search-index.js
|
|
30607
30646
|
var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
|
|
30608
30647
|
const { database } = context;
|
|
30609
30648
|
const stemmerFor2 = stemmerCache();
|
|
@@ -30625,7 +30664,7 @@ var searchIndexStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
30625
30664
|
};
|
|
30626
30665
|
}, "searchIndexStoreOver");
|
|
30627
30666
|
|
|
30628
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30667
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/searches.js
|
|
30629
30668
|
var HISTORY_KEPT = 1e3;
|
|
30630
30669
|
var commandFilter = /* @__PURE__ */ __name((commands) => commands ? { sql: ` AND command IN (${commands.map(() => "?").join(", ")})`, values: [...commands] } : { sql: "", values: [] }, "commandFilter");
|
|
30631
30670
|
var COLUMNS5 = "id, name, command, params, language, version, fields_version, created_at, updated_at, last_run_at, runs";
|
|
@@ -30694,7 +30733,7 @@ var clearHistory = /* @__PURE__ */ __name(({ database }, commands) => {
|
|
|
30694
30733
|
return database.prepare(`DELETE FROM searches WHERE name IS NULL${only.sql}`).run(...only.values).changes;
|
|
30695
30734
|
}, "clearHistory");
|
|
30696
30735
|
|
|
30697
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30736
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/searches.js
|
|
30698
30737
|
var searchesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
30699
30738
|
const { database } = context;
|
|
30700
30739
|
return {
|
|
@@ -30718,7 +30757,7 @@ var searchesStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
30718
30757
|
};
|
|
30719
30758
|
}, "searchesStoreOver");
|
|
30720
30759
|
|
|
30721
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30760
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/agent-actions.js
|
|
30722
30761
|
var ACTION_TIERS = ["read", "draft", "write-private", "write-public", "destructive", "admin"];
|
|
30723
30762
|
var ACTION_OUTCOMES = ["ok", "refused", "failed"];
|
|
30724
30763
|
var CODE = /^[a-z][a-z0-9_]{0,63}$/;
|
|
@@ -30761,7 +30800,7 @@ var agentActionsStoreOver = /* @__PURE__ */ __name((context, afterRecord = () =>
|
|
|
30761
30800
|
};
|
|
30762
30801
|
}, "agentActionsStoreOver");
|
|
30763
30802
|
|
|
30764
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30803
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/bot-updates.js
|
|
30765
30804
|
var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
|
|
30766
30805
|
}) => {
|
|
30767
30806
|
const { database, now: now2 } = context;
|
|
@@ -30820,7 +30859,7 @@ var botUpdateStoreOver = /* @__PURE__ */ __name((context, afterSave = () => {
|
|
|
30820
30859
|
};
|
|
30821
30860
|
}, "botUpdateStoreOver");
|
|
30822
30861
|
|
|
30823
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30862
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-events.js
|
|
30824
30863
|
var DAY4 = 864e5;
|
|
30825
30864
|
var accountsOf = /* @__PURE__ */ __name((filter) => {
|
|
30826
30865
|
if (filter.accountIds !== void 0 && filter.accountId !== void 0)
|
|
@@ -30929,7 +30968,7 @@ var listEvents = /* @__PURE__ */ __name((database, filter) => {
|
|
|
30929
30968
|
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);
|
|
30930
30969
|
}, "listEvents");
|
|
30931
30970
|
|
|
30932
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
30971
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar-forget.js
|
|
30933
30972
|
var distinctIds = /* @__PURE__ */ __name((rows) => [...new Set(rows.map((row2) => Number(row2.id)))], "distinctIds");
|
|
30934
30973
|
var forgetCalendarRows = /* @__PURE__ */ __name((database, { calendarId, accountId, cursorKey: cursorKey2, now: now2 }, refresh) => {
|
|
30935
30974
|
const unseenBefore = unreferenced(database, "identities");
|
|
@@ -30984,7 +31023,7 @@ var forgetCalendarRows = /* @__PURE__ */ __name((database, { calendarId, account
|
|
|
30984
31023
|
return { entries: entryIds.length, events: goneEvents.length };
|
|
30985
31024
|
}, "forgetCalendarRows");
|
|
30986
31025
|
|
|
30987
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31026
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/calendar.js
|
|
30988
31027
|
var calendarOf = /* @__PURE__ */ __name((row2) => ({
|
|
30989
31028
|
id: Number(row2.id),
|
|
30990
31029
|
accountId: Number(row2.account_id),
|
|
@@ -31571,7 +31610,7 @@ var eventStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
31571
31610
|
};
|
|
31572
31611
|
}, "eventStoreOver");
|
|
31573
31612
|
|
|
31574
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31613
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/catalog.js
|
|
31575
31614
|
var CATALOG_QUERY = defineQuery({
|
|
31576
31615
|
entity: "document",
|
|
31577
31616
|
backend: "sql",
|
|
@@ -31718,9 +31757,9 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
|
|
|
31718
31757
|
else
|
|
31719
31758
|
database.prepare("INSERT INTO documents(account_id,external_id,kind,title,url,mime,size,external_created_at,external_updated_at,metadata,front_matter,created_at,updated_at) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)").run(id2, input.externalId, input.kind, input.name, input.url ?? null, input.mime ?? null, input.size ?? null, created, modified2, JSON.stringify(metadata3), JSON.stringify(frontMatter), at, at);
|
|
31720
31759
|
}
|
|
31721
|
-
const
|
|
31760
|
+
const written2 = database.prepare("SELECT id FROM documents WHERE account_id = ? AND external_id = ?");
|
|
31722
31761
|
for (const { input } of checked)
|
|
31723
|
-
syncFile(database, at, Number(
|
|
31762
|
+
syncFile(database, at, Number(written2.get(id2, input.externalId)?.id));
|
|
31724
31763
|
});
|
|
31725
31764
|
}, "upsert"),
|
|
31726
31765
|
reconcile: /* @__PURE__ */ __name(async (accountId, externalIds) => {
|
|
@@ -31813,7 +31852,7 @@ var catalogStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => {
|
|
|
31813
31852
|
};
|
|
31814
31853
|
}, "catalogStoreOver");
|
|
31815
31854
|
|
|
31816
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31855
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/context/evidence.js
|
|
31817
31856
|
import { createHash as createHash11 } from "node:crypto";
|
|
31818
31857
|
var CONTEXT_MAX_READ_BYTES = 262144;
|
|
31819
31858
|
var CONTEXT_SOURCE_KINDS = ["message", "mail", "document", "meeting"];
|
|
@@ -31911,7 +31950,7 @@ var contextEvidenceRequest = /* @__PURE__ */ __name((input) => {
|
|
|
31911
31950
|
return { source: source2, query, chat: chat2, senders, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal: input.signal };
|
|
31912
31951
|
}, "contextEvidenceRequest");
|
|
31913
31952
|
|
|
31914
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31953
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/context-document-source.js
|
|
31915
31954
|
var drive = "CASE WHEN json_valid(n.front_matter) THEN json_extract(n.front_matter,'$.source')='google-drive' ELSE 0 END";
|
|
31916
31955
|
var field3 = /* @__PURE__ */ __name((name) => `CASE WHEN (${drive}) THEN
|
|
31917
31956
|
CASE WHEN json_type(n.front_matter,'$.${name}')='text' THEN json_extract(n.front_matter,'$.${name}') END END`, "field");
|
|
@@ -31924,7 +31963,7 @@ var contextDocumentTimeKind = `CASE WHEN (${remoteTime}) IS NOT NULL
|
|
|
31924
31963
|
THEN 'source-modified' ELSE 'stored-update' END`;
|
|
31925
31964
|
var contextDocumentUrl = `coalesce(${preferred("url")},n.url,${field3("sourceUrl")})`;
|
|
31926
31965
|
|
|
31927
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
31966
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/context-meeting-source.js
|
|
31928
31967
|
var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
|
|
31929
31968
|
const { source: source2, words: words3, after: after2, before: before2, limit, maxReadBytes, cursor, signal } = request;
|
|
31930
31969
|
signal?.throwIfAborted();
|
|
@@ -32023,7 +32062,7 @@ var readMeetingContextEvidence = /* @__PURE__ */ __name((database, request) => {
|
|
|
32023
32062
|
});
|
|
32024
32063
|
}, "readMeetingContextEvidence");
|
|
32025
32064
|
|
|
32026
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32065
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/context-evidence.js
|
|
32027
32066
|
var corpora = {
|
|
32028
32067
|
message: {
|
|
32029
32068
|
table: "messages",
|
|
@@ -32262,7 +32301,7 @@ var contextRecordsOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
32262
32301
|
}
|
|
32263
32302
|
}), "contextRecordsOver");
|
|
32264
32303
|
|
|
32265
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32304
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/note-search.js
|
|
32266
32305
|
var NOTE_FIELDS = [
|
|
32267
32306
|
"text",
|
|
32268
32307
|
"exact",
|
|
@@ -32692,7 +32731,7 @@ var noteSearchOver = /* @__PURE__ */ __name((context) => {
|
|
|
32692
32731
|
};
|
|
32693
32732
|
}, "noteSearchOver");
|
|
32694
32733
|
|
|
32695
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32734
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/event-search.js
|
|
32696
32735
|
var EVENT_FIELDS = ["text", "exact", "body", "title", "date", "in"];
|
|
32697
32736
|
var inEventAccounts = /* @__PURE__ */ __name((event) => searchableCopy(event, "c.account_id IN (SELECT CAST(value AS INTEGER) FROM json_each(?))"), "inEventAccounts");
|
|
32698
32737
|
var EVENT_CORPUS = {
|
|
@@ -32824,7 +32863,7 @@ var eventSearchOver = /* @__PURE__ */ __name((context) => {
|
|
|
32824
32863
|
};
|
|
32825
32864
|
}, "eventSearchOver");
|
|
32826
32865
|
|
|
32827
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32866
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/finance.js
|
|
32828
32867
|
var refuse2 = /* @__PURE__ */ __name((message2, reason, code = "validation_error") => {
|
|
32829
32868
|
throw new CliError(code, message2, { reason });
|
|
32830
32869
|
}, "refuse");
|
|
@@ -32898,7 +32937,7 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
32898
32937
|
createdAt: iso8(row2.created_at),
|
|
32899
32938
|
updatedAt: iso8(row2.updated_at)
|
|
32900
32939
|
}), "reviewedOf");
|
|
32901
|
-
const
|
|
32940
|
+
const invoiceOf2 = /* @__PURE__ */ __name((row2) => {
|
|
32902
32941
|
const currency = String(row2.currency);
|
|
32903
32942
|
const scale = scaleOf(currency);
|
|
32904
32943
|
const [total, paid] = [Number(row2.total), Number(row2.paid)];
|
|
@@ -32932,7 +32971,7 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
32932
32971
|
...reviewedOf(row2, "invoice")
|
|
32933
32972
|
};
|
|
32934
32973
|
}, "invoiceOf");
|
|
32935
|
-
const
|
|
32974
|
+
const paymentOf3 = /* @__PURE__ */ __name((row2) => {
|
|
32936
32975
|
const currency = String(row2.currency);
|
|
32937
32976
|
const scale = scaleOf(currency);
|
|
32938
32977
|
const [amount, allocated] = [Number(row2.amount), Number(row2.allocated)];
|
|
@@ -32986,11 +33025,11 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
32986
33025
|
unitPrice: line.unit_price == null ? null : formatDecimal(Number(line.unit_price), scale),
|
|
32987
33026
|
amount: formatDecimal(Number(line.amount), scale)
|
|
32988
33027
|
}));
|
|
32989
|
-
return { ...
|
|
33028
|
+
return { ...invoiceOf2(row2), lines, allocations: allocationsWhere("invoice_id", Number(row2.id)) };
|
|
32990
33029
|
}, "invoiceDetail");
|
|
32991
33030
|
const paymentDetail = /* @__PURE__ */ __name((reference2) => {
|
|
32992
33031
|
const row2 = rowOf2(reference2, "payment");
|
|
32993
|
-
return { ...
|
|
33032
|
+
return { ...paymentOf3(row2), allocations: allocationsWhere("payment_id", Number(row2.id)) };
|
|
32994
33033
|
}, "paymentDetail");
|
|
32995
33034
|
const settle = /* @__PURE__ */ __name((invoiceId) => {
|
|
32996
33035
|
const row2 = database.prepare(`SELECT i.status, i.total, ${PAID} AS paid FROM invoices i WHERE i.id = ?`).get(invoiceId);
|
|
@@ -33019,7 +33058,7 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
33019
33058
|
database.prepare("INSERT INTO payment_allocations (payment_id, invoice_id, amount, author_type, author_id, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?) ON CONFLICT (payment_id, invoice_id) DO UPDATE SET amount = amount + excluded.amount, updated_at = excluded.updated_at").run(Number(payment.id), Number(invoice.id), units, actor.type, actor.id, at, at);
|
|
33020
33059
|
return Number(invoice.id);
|
|
33021
33060
|
}, "allocateRow");
|
|
33022
|
-
const
|
|
33061
|
+
const written2 = /* @__PURE__ */ __name((input) => {
|
|
33023
33062
|
const owner = input.by === "owner";
|
|
33024
33063
|
const { actor, model } = authorActor(context, input.by);
|
|
33025
33064
|
const source2 = owner ? "owner" : text3(input.source, "a source", 80) ?? "agent";
|
|
@@ -33129,7 +33168,7 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
33129
33168
|
const id2 = write(database, () => {
|
|
33130
33169
|
const issuer = partyThing(input.issuer, "the issuer");
|
|
33131
33170
|
const counterparty = partyThing(input.counterparty, "the counterparty") ?? refuse2("an invoice names its counterparty, a person: or organization:", "finance.party");
|
|
33132
|
-
const by =
|
|
33171
|
+
const by = written2(input);
|
|
33133
33172
|
const at = now2();
|
|
33134
33173
|
const made = Number(database.prepare("INSERT INTO invoices (direction, number, issuer_type, issuer_id, counterparty_type, counterparty_id, project_id, currency, total, issue_date, due_date, status, review, author_type, author_id, model, confirmed_by_type, confirmed_by_id, source, metadata, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id").get(direction, number3, issuer?.type ?? null, issuer?.id ?? null, counterparty.type, counterparty.id, by.project, currency, total, issueDate, dueDate, input.draft ? "draft" : "issued", by.review, by.actor.type, by.actor.id, by.model, by.confirmedType, by.confirmedId, by.source, by.metadata, at, at)?.id);
|
|
33135
33174
|
const insert = database.prepare("INSERT INTO invoice_lines (invoice_id, position, description, quantity, unit_price, amount, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
|
|
@@ -33147,7 +33186,7 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
33147
33186
|
const by = proposedBySql("i.author_type", "i.author_id", filter.proposedBy);
|
|
33148
33187
|
const status = filter.status === void 0 ? null : oneOf4(filter.status, INVOICE_STATUSES, "a status");
|
|
33149
33188
|
const review = filter.review === void 0 ? null : oneOf4(filter.review, FINANCE_REVIEWS, "a review");
|
|
33150
|
-
return database.prepare(`${INVOICES} WHERE i.deleted_at IS NULL AND (? IS NULL OR i.direction = ?) AND (? IS NULL OR i.status = ?) AND (? IS NULL OR i.review = ?) AND (? IS NULL OR i.project_id = ?) AND (? IS NULL OR (i.counterparty_type = ? AND i.counterparty_id = ?)) ${filter.open ? "AND i.status IN ('issued', 'partly_paid') " : ""}AND ${by.sql} ORDER BY i.created_at DESC, i.id DESC LIMIT ?`).all(filter.direction ?? null, filter.direction ?? null, status, status, review, review, project, project, counterparty?.type ?? null, counterparty?.type ?? null, counterparty?.id ?? null, ...by.params, limitOf2(filter.limit)).map(
|
|
33189
|
+
return database.prepare(`${INVOICES} WHERE i.deleted_at IS NULL AND (? IS NULL OR i.direction = ?) AND (? IS NULL OR i.status = ?) AND (? IS NULL OR i.review = ?) AND (? IS NULL OR i.project_id = ?) AND (? IS NULL OR (i.counterparty_type = ? AND i.counterparty_id = ?)) ${filter.open ? "AND i.status IN ('issued', 'partly_paid') " : ""}AND ${by.sql} ORDER BY i.created_at DESC, i.id DESC LIMIT ?`).all(filter.direction ?? null, filter.direction ?? null, status, status, review, review, project, project, counterparty?.type ?? null, counterparty?.type ?? null, counterparty?.id ?? null, ...by.params, limitOf2(filter.limit)).map(invoiceOf2);
|
|
33151
33190
|
}, "invoices"),
|
|
33152
33191
|
issueInvoice: /* @__PURE__ */ __name((reference2, by) => {
|
|
33153
33192
|
ownerOnly(by, "issues an invoice");
|
|
@@ -33189,7 +33228,7 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
33189
33228
|
const id2 = write(database, () => {
|
|
33190
33229
|
const payer = partyThing(input.payer, "the payer");
|
|
33191
33230
|
const payee = partyThing(input.payee, "the payee");
|
|
33192
|
-
const by =
|
|
33231
|
+
const by = written2(input);
|
|
33193
33232
|
const at = now2();
|
|
33194
33233
|
const made = database.prepare("INSERT INTO payments (direction, payer_type, payer_id, payee_type, payee_id, amount, currency, payment_date, reference, project_id, review, author_type, author_id, model, confirmed_by_type, confirmed_by_id, source, metadata, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *").get(direction, payer?.type ?? null, payer?.id ?? null, payee?.type ?? null, payee?.id ?? null, amount, currency, date3, reference2, by.project, by.review, by.actor.type, by.actor.id, by.model, by.confirmedType, by.confirmedId, by.source, by.metadata, at, at);
|
|
33195
33234
|
keepEvidence("payment", Number(made.id), by);
|
|
@@ -33206,7 +33245,7 @@ var financeOperationsOver = /* @__PURE__ */ __name((context) => {
|
|
|
33206
33245
|
const party2 = partyThing(filter.party, "the party");
|
|
33207
33246
|
const by = proposedBySql("p.author_type", "p.author_id", filter.proposedBy);
|
|
33208
33247
|
const review = filter.review === void 0 ? null : oneOf4(filter.review, FINANCE_REVIEWS, "a review");
|
|
33209
|
-
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, project, project, party2?.type ?? null, party2?.type ?? null, party2?.id ?? null, party2?.type ?? null, party2?.id ?? null, ...by.params, limitOf2(filter.limit)).map(
|
|
33248
|
+
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, project, project, party2?.type ?? null, party2?.type ?? null, party2?.id ?? null, party2?.type ?? null, party2?.id ?? null, ...by.params, limitOf2(filter.limit)).map(paymentOf3);
|
|
33210
33249
|
}, "payments"),
|
|
33211
33250
|
allocate: /* @__PURE__ */ __name(({ payment, invoice, amount, by }) => {
|
|
33212
33251
|
const row2 = rowOf2(payment, "payment");
|
|
@@ -33259,7 +33298,7 @@ var financeStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
33259
33298
|
};
|
|
33260
33299
|
}, "financeStoreOver");
|
|
33261
33300
|
|
|
33262
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33301
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-entries.js
|
|
33263
33302
|
var refuse3 = /* @__PURE__ */ __name((message2, reason) => {
|
|
33264
33303
|
throw new CliError("validation_error", message2, { reason });
|
|
33265
33304
|
}, "refuse");
|
|
@@ -33293,7 +33332,7 @@ var paymentEntriesOver = /* @__PURE__ */ __name((context) => {
|
|
|
33293
33332
|
const { payment } = entry2;
|
|
33294
33333
|
const amount = entryAmount(payment);
|
|
33295
33334
|
const project = entry2.project ?? (payment.counterparty?.startsWith("project:") ? payment.counterparty : void 0);
|
|
33296
|
-
const
|
|
33335
|
+
const written2 = {
|
|
33297
33336
|
by,
|
|
33298
33337
|
...project === void 0 ? {} : { project },
|
|
33299
33338
|
...by === "owner" ? {} : { source: "agent", reason: entry2.statement ?? paymentTitle(entry2) },
|
|
@@ -33313,7 +33352,7 @@ var paymentEntriesOver = /* @__PURE__ */ __name((context) => {
|
|
|
33313
33352
|
if (counterparty === null)
|
|
33314
33353
|
return refuse3("an expected payment is an invoice, which names a person: or organization:", "finance.party");
|
|
33315
33354
|
const invoice = finance.addInvoice({
|
|
33316
|
-
...
|
|
33355
|
+
...written2,
|
|
33317
33356
|
direction: payment.direction === "to_us" ? "receivable" : "payable",
|
|
33318
33357
|
counterparty,
|
|
33319
33358
|
currency: payment.currency,
|
|
@@ -33324,7 +33363,7 @@ var paymentEntriesOver = /* @__PURE__ */ __name((context) => {
|
|
|
33324
33363
|
}
|
|
33325
33364
|
const settles = entry2.supersedes === void 0 ? [] : settled(entry2.supersedes, amount, payment.currency);
|
|
33326
33365
|
const made = finance.addPayment({
|
|
33327
|
-
...
|
|
33366
|
+
...written2,
|
|
33328
33367
|
direction: payment.direction === "to_us" ? "in" : "out",
|
|
33329
33368
|
...counterparty === null ? {} : payment.direction === "to_us" ? { payer: counterparty } : { payee: counterparty },
|
|
33330
33369
|
amount,
|
|
@@ -33337,7 +33376,7 @@ var paymentEntriesOver = /* @__PURE__ */ __name((context) => {
|
|
|
33337
33376
|
};
|
|
33338
33377
|
}, "paymentEntriesOver");
|
|
33339
33378
|
|
|
33340
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33379
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/evidence-findings.js
|
|
33341
33380
|
var EVIDENCE_FINDINGS_KIND = "evidence_findings";
|
|
33342
33381
|
var reference = /* @__PURE__ */ __name((raw) => {
|
|
33343
33382
|
if (/^(document|note):[1-9]\d*$/.test(raw))
|
|
@@ -33363,7 +33402,7 @@ var validateEvidenceFindings = /* @__PURE__ */ __name((input) => {
|
|
|
33363
33402
|
return valid;
|
|
33364
33403
|
}, "validateEvidenceFindings");
|
|
33365
33404
|
|
|
33366
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33405
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/domain/moment.js
|
|
33367
33406
|
var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false } = {}) => {
|
|
33368
33407
|
try {
|
|
33369
33408
|
return zonedMoment(wanted, timezoneOf(zone), { start: 0, end: wanted.length }, { end });
|
|
@@ -33375,7 +33414,7 @@ var calendarMoment = /* @__PURE__ */ __name((wanted, flag6, { zone, end = false
|
|
|
33375
33414
|
}
|
|
33376
33415
|
}, "calendarMoment");
|
|
33377
33416
|
|
|
33378
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33417
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/facts.js
|
|
33379
33418
|
var NAMED3 = "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";
|
|
33380
33419
|
var iso9 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
|
|
33381
33420
|
var oneOf5 = /* @__PURE__ */ __name((value, allowed, what) => {
|
|
@@ -33557,7 +33596,7 @@ var factsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
33557
33596
|
};
|
|
33558
33597
|
}, "factsStoreOver");
|
|
33559
33598
|
|
|
33560
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33599
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/findings-core.js
|
|
33561
33600
|
var invalid4 = /* @__PURE__ */ __name((message2) => {
|
|
33562
33601
|
throw new CliError("validation_error", message2);
|
|
33563
33602
|
}, "invalid");
|
|
@@ -33659,7 +33698,7 @@ var findingsCoreOver = /* @__PURE__ */ __name((context, kind4) => {
|
|
|
33659
33698
|
return { snapshot: snapshot2, snapshotParts, previous, outcomes };
|
|
33660
33699
|
}, "findingsCoreOver");
|
|
33661
33700
|
|
|
33662
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33701
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/proposed-actions.js
|
|
33663
33702
|
var PROPOSAL_STATUSES = ["proposed", "approved", "rejected", "executed", "failed"];
|
|
33664
33703
|
var PROPOSAL_VERDICTS = ["useful", "not_useful"];
|
|
33665
33704
|
var iso10 = /* @__PURE__ */ __name((value) => value == null ? null : new Date(Number(value)).toISOString(), "iso");
|
|
@@ -33819,7 +33858,7 @@ var proposedActionsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
33819
33858
|
};
|
|
33820
33859
|
}, "proposedActionsStoreOver");
|
|
33821
33860
|
|
|
33822
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
33861
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/evidence-findings.js
|
|
33823
33862
|
var stale = /* @__PURE__ */ __name(() => {
|
|
33824
33863
|
throw new CliError("validation_error", "evidence findings changed since they were read; stage a new batch", {
|
|
33825
33864
|
reason: "evidence-findings.stale"
|
|
@@ -34000,7 +34039,7 @@ var evidenceFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
34000
34039
|
};
|
|
34001
34040
|
}, "evidenceFindingsStoreOver");
|
|
34002
34041
|
|
|
34003
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34042
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/involvements.js
|
|
34004
34043
|
var pendingInvolvements = /* @__PURE__ */ __name((database) => Number(database.prepare("SELECT count(*) AS n FROM involvement_pending").get()?.n ?? 0), "pendingInvolvements");
|
|
34005
34044
|
var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => ({
|
|
34006
34045
|
rebuild: /* @__PURE__ */ __name((personId) => write(database, () => {
|
|
@@ -34053,7 +34092,7 @@ var involvementStoreOver = /* @__PURE__ */ __name(({ database, now: now2 }) => (
|
|
|
34053
34092
|
}, "forPerson")
|
|
34054
34093
|
}), "involvementStoreOver");
|
|
34055
34094
|
|
|
34056
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34095
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-projects.js
|
|
34057
34096
|
import { createHash as createHash12 } from "node:crypto";
|
|
34058
34097
|
var fields3 = "id,from_id,to_id,source,confirmed,updated_at,length(evidence) AS evidenceLength,substr(evidence,1,2000) AS evidence";
|
|
34059
34098
|
var id = /* @__PURE__ */ __name((value) => {
|
|
@@ -34139,7 +34178,7 @@ var meetingProjectsStoreOver = /* @__PURE__ */ __name(({ database, now: now2 })
|
|
|
34139
34178
|
};
|
|
34140
34179
|
}, "meetingProjectsStoreOver");
|
|
34141
34180
|
|
|
34142
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34181
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/relation-proposals.js
|
|
34143
34182
|
var relationOf = /* @__PURE__ */ __name((link3) => ({
|
|
34144
34183
|
id: link3.id,
|
|
34145
34184
|
from: link3.from,
|
|
@@ -34365,16 +34404,16 @@ var decidedOrigin = /* @__PURE__ */ __name((by) => by === "owner" ? { origin: "o
|
|
|
34365
34404
|
provenance: `agent:${by.bot} for the owner: ${by.reason.trim()}`
|
|
34366
34405
|
}, "decidedOrigin");
|
|
34367
34406
|
|
|
34368
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34407
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
|
|
34369
34408
|
import { createHash as createHash15 } from "node:crypto";
|
|
34370
34409
|
|
|
34371
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34410
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
|
|
34372
34411
|
import { createHash as createHash14 } from "node:crypto";
|
|
34373
34412
|
|
|
34374
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34413
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
|
|
34375
34414
|
import { createHash as createHash13 } from "node:crypto";
|
|
34376
34415
|
|
|
34377
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34416
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-input.js
|
|
34378
34417
|
var consolidationId = /* @__PURE__ */ __name((value, field4) => {
|
|
34379
34418
|
if (typeof value !== "string" || !/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(Number(value)))
|
|
34380
34419
|
throw new CliError("validation_error", `${field4} must be a positive canonical tag id`);
|
|
@@ -34425,7 +34464,7 @@ var consolidationApplyInput = /* @__PURE__ */ __name((options) => {
|
|
|
34425
34464
|
return input;
|
|
34426
34465
|
}, "consolidationApplyInput");
|
|
34427
34466
|
|
|
34428
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34467
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation-apply.js
|
|
34429
34468
|
var receiptOf = /* @__PURE__ */ __name((row2) => ({
|
|
34430
34469
|
id: String(row2.id),
|
|
34431
34470
|
sourceId: String(row2.source_id),
|
|
@@ -34500,7 +34539,7 @@ var applyTagConsolidation = /* @__PURE__ */ __name((context, preview, options) =
|
|
|
34500
34539
|
}, { beforeCommit: check3 });
|
|
34501
34540
|
}, "applyTagConsolidation");
|
|
34502
34541
|
|
|
34503
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34542
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/tag-consolidation.js
|
|
34504
34543
|
var selections = [
|
|
34505
34544
|
["taggings", "tag_id IN (SELECT value FROM json_each(?))"],
|
|
34506
34545
|
["aliases", "aliasable_type='tag' AND aliasable_id IN (SELECT value FROM json_each(?))"],
|
|
@@ -34644,7 +34683,7 @@ var previewRows = /* @__PURE__ */ __name((context, options, source2, survivor, m
|
|
|
34644
34683
|
};
|
|
34645
34684
|
}, "previewRows");
|
|
34646
34685
|
|
|
34647
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34686
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/vocabulary.js
|
|
34648
34687
|
var kinds = ["project", "tag", "topic"];
|
|
34649
34688
|
var cancelled2 = /* @__PURE__ */ __name((signal) => {
|
|
34650
34689
|
if (signal?.aborted)
|
|
@@ -34908,7 +34947,7 @@ var vocabularyStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
34908
34947
|
};
|
|
34909
34948
|
}, "vocabularyStoreOver");
|
|
34910
34949
|
|
|
34911
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
34950
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/knowledge.js
|
|
34912
34951
|
var TYPED_KEY_PREFIXES = new Set(Object.values(TASK_KEY_PREFIXES));
|
|
34913
34952
|
var ORGANIZATION_KINDS = ["company", "team", "family", "community"];
|
|
34914
34953
|
var PROJECT_TYPES = ["work", "client", "personal", "oss", "other"];
|
|
@@ -35465,7 +35504,7 @@ var projectKey = /* @__PURE__ */ __name((name) => {
|
|
|
35465
35504
|
return key2.padEnd(3, "X");
|
|
35466
35505
|
}, "projectKey");
|
|
35467
35506
|
|
|
35468
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35507
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/log-pruning.js
|
|
35469
35508
|
var DAY5 = 864e5;
|
|
35470
35509
|
var SETTING4 = "logs_pruned_at";
|
|
35471
35510
|
var LOG_RETENTION = { agentActionsMs: 90 * DAY5, botUpdatePayloadsMs: 30 * DAY5 };
|
|
@@ -35492,7 +35531,7 @@ var logPruner = /* @__PURE__ */ __name((database, now2) => {
|
|
|
35492
35531
|
};
|
|
35493
35532
|
}, "logPruner");
|
|
35494
35533
|
|
|
35495
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35534
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-findings.js
|
|
35496
35535
|
var stale2 = /* @__PURE__ */ __name(() => {
|
|
35497
35536
|
throw new CliError("validation_error", "meeting findings changed since they were read; stage a new batch", {
|
|
35498
35537
|
reason: "meeting-findings.stale"
|
|
@@ -35660,7 +35699,7 @@ var meetingFindingsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
35660
35699
|
};
|
|
35661
35700
|
}, "meetingFindingsStoreOver");
|
|
35662
35701
|
|
|
35663
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35702
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/meeting-vectors.js
|
|
35664
35703
|
var RANK_BATCH = 512;
|
|
35665
35704
|
var LIVE3 = "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";
|
|
35666
35705
|
var limitOf = /* @__PURE__ */ __name((value, name, max = 1e3) => {
|
|
@@ -35931,7 +35970,7 @@ var meetingVectorsOver = /* @__PURE__ */ __name((context) => ({
|
|
|
35931
35970
|
}
|
|
35932
35971
|
}), "meetingVectorsOver");
|
|
35933
35972
|
|
|
35934
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
35973
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/mention-sources.js
|
|
35935
35974
|
var OTHER_SOURCES = ["document", "note", "email"];
|
|
35936
35975
|
var TEXTS = {
|
|
35937
35976
|
document: "JOIN documents s ON mn.source_type = 'document' AND s.id = mn.source_id AND s.deleted_at IS NULL WHERE 1 ",
|
|
@@ -35984,8 +36023,8 @@ var sourceMentionStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
35984
36023
|
if (!found2)
|
|
35985
36024
|
throw new CliError("not_found", `no mention ${id2} in a document, a note or this mail`);
|
|
35986
36025
|
const { row: row2 } = found2;
|
|
35987
|
-
const
|
|
35988
|
-
return { id: id2, kind: String(row2.kind), value: String(row2.value), chat: null, written };
|
|
36026
|
+
const written2 = String(row2.text).slice(Number(row2.start_offset), Number(row2.end_offset));
|
|
36027
|
+
return { id: id2, kind: String(row2.kind), value: String(row2.value), chat: null, written: written2 };
|
|
35989
36028
|
}, "located");
|
|
35990
36029
|
return {
|
|
35991
36030
|
list: /* @__PURE__ */ __name(async (source2, query, { limit, offset }, mail) => {
|
|
@@ -36032,11 +36071,11 @@ var sourceMentionStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
36032
36071
|
};
|
|
36033
36072
|
}, "sourceMentionStoreOver");
|
|
36034
36073
|
|
|
36035
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36074
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
|
|
36036
36075
|
import { mkdirSync, statSync, writeFileSync } from "node:fs";
|
|
36037
36076
|
import { dirname } from "node:path";
|
|
36038
36077
|
|
|
36039
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36078
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/clients.js
|
|
36040
36079
|
import { readFileSync as readFileSync3 } from "node:fs";
|
|
36041
36080
|
var CLIENTS_SETTING = "clients";
|
|
36042
36081
|
var coreVersion = (() => {
|
|
@@ -36094,7 +36133,7 @@ var refusalAdvice = /* @__PURE__ */ __name((clients, command, schema) => {
|
|
|
36094
36133
|
return mover ? `${own} (${mover.command} ${mover.version} moved the store to schema ${schema})` : own;
|
|
36095
36134
|
}, "refusalAdvice");
|
|
36096
36135
|
|
|
36097
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
36136
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/migrations.generated.js
|
|
36098
36137
|
var GENERATED = [
|
|
36099
36138
|
{
|
|
36100
36139
|
"name": "20261010184427_initial",
|
|
@@ -37042,10 +37081,20 @@ WHERE json_type(params, '$.selection') = 'object';`
|
|
|
37042
37081
|
"CREATE TRIGGER facts_no_payment_bu BEFORE UPDATE OF type ON facts WHEN new.type = 'payment' BEGIN\n SELECT RAISE(ABORT, 'facts: a payment is a payments row in store.finance, not a fact; upgrade the CLI');\nEND;",
|
|
37043
37082
|
"INSERT OR REPLACE INTO store_settings (key, value, at) VALUES ('payment_facts_to_move', '1', unixepoch() * 1000);"
|
|
37044
37083
|
]
|
|
37084
|
+
},
|
|
37085
|
+
{
|
|
37086
|
+
"name": "20261102192959_version-47-records",
|
|
37087
|
+
"statements": [
|
|
37088
|
+
"CREATE TABLE `record_relations` (\n `id` integer PRIMARY KEY,\n `record_id` integer NOT NULL,\n `role` text NOT NULL,\n `target_type` text NOT NULL,\n `target_external_id` text NOT NULL,\n `target_id` integer,\n `created_at` integer NOT NULL,\n CONSTRAINT `fk_record_relations_record_id_records_id_fk` FOREIGN KEY (`record_id`) REFERENCES `records`(`id`),\n CONSTRAINT `fk_record_relations_target_id_records_id_fk` FOREIGN KEY (`target_id`) REFERENCES `records`(`id`),\n CONSTRAINT `record_relations_record_id_role_target_type_target_external_id_unique` UNIQUE(`record_id`,`role`,`target_type`,`target_external_id`)\n);",
|
|
37089
|
+
"CREATE TABLE `records` (\n `id` integer PRIMARY KEY,\n `account_id` integer NOT NULL,\n `type` text NOT NULL,\n `external_id` text NOT NULL,\n `fields` text NOT NULL,\n `revision` integer,\n `fingerprint` text NOT NULL,\n `entity_type` text,\n `entity_id` integer,\n `projected_fingerprint` text,\n `batch_id` text NOT NULL,\n `created_at` integer NOT NULL,\n `updated_at` integer NOT NULL,\n `deleted_at` integer,\n CONSTRAINT `fk_records_account_id_accounts_id_fk` FOREIGN KEY (`account_id`) REFERENCES `accounts`(`id`),\n CONSTRAINT `records_account_id_type_external_id_unique` UNIQUE(`account_id`,`type`,`external_id`)\n);",
|
|
37090
|
+
"CREATE INDEX `record_relations_by_target_type_target_external_id` ON `record_relations` (`target_type`,`target_external_id`);",
|
|
37091
|
+
"CREATE INDEX `record_relations_by_target_id` ON `record_relations` (`target_id`);",
|
|
37092
|
+
"CREATE INDEX `records_by_entity_type_entity_id` ON `records` (`entity_type`,`entity_id`);"
|
|
37093
|
+
]
|
|
37045
37094
|
}
|
|
37046
37095
|
];
|
|
37047
37096
|
|
|
37048
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37097
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/manifest.js
|
|
37049
37098
|
var MANIFEST = [
|
|
37050
37099
|
{ name: "20261010184427_initial", version: 1, minCompatible: 1 },
|
|
37051
37100
|
{ name: "20261011035353_version-2-facts", version: 2, minCompatible: 1 },
|
|
@@ -37107,7 +37156,8 @@ var MANIFEST = [
|
|
|
37107
37156
|
{ name: "20261102050534_version-44-suggested-links-move", version: 44, minCompatible: 34 },
|
|
37108
37157
|
{ name: "20261102173102_version-45-finance", version: 45, minCompatible: 34 },
|
|
37109
37158
|
{ name: "20261102173113_version-45-finance-rules", version: 45, minCompatible: 34 },
|
|
37110
|
-
{ name: "20261102185954_version-46-payment-facts", version: 46, minCompatible: 34 }
|
|
37159
|
+
{ name: "20261102185954_version-46-payment-facts", version: 46, minCompatible: 34 },
|
|
37160
|
+
{ name: "20261102192959_version-47-records", version: 47, minCompatible: 34 }
|
|
37111
37161
|
];
|
|
37112
37162
|
var generatedMigrations = /* @__PURE__ */ __name((manifest = MANIFEST, generated = GENERATED) => {
|
|
37113
37163
|
const migrations = [];
|
|
@@ -37131,7 +37181,7 @@ var generatedMigrations = /* @__PURE__ */ __name((manifest = MANIFEST, generated
|
|
|
37131
37181
|
return migrations;
|
|
37132
37182
|
}, "generatedMigrations");
|
|
37133
37183
|
|
|
37134
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37184
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/migrations.js
|
|
37135
37185
|
var MIGRATIONS = generatedMigrations();
|
|
37136
37186
|
var HISTORY = `CREATE TABLE IF NOT EXISTS schema_migrations (
|
|
37137
37187
|
version INTEGER PRIMARY KEY,
|
|
@@ -37184,7 +37234,7 @@ var migrate = /* @__PURE__ */ __name((database, { migrations = MIGRATIONS, now:
|
|
|
37184
37234
|
}
|
|
37185
37235
|
}, "migrate");
|
|
37186
37236
|
|
|
37187
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37237
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/join-keys.js
|
|
37188
37238
|
var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
|
|
37189
37239
|
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 ?");
|
|
37190
37240
|
if (pending.get(0, 1) === void 0)
|
|
@@ -37206,7 +37256,7 @@ var fillJoinKeys = /* @__PURE__ */ __name((database, { batch = 2e3 } = {}) => {
|
|
|
37206
37256
|
}
|
|
37207
37257
|
}, "fillJoinKeys");
|
|
37208
37258
|
|
|
37209
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37259
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/open.js
|
|
37210
37260
|
var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {}) => {
|
|
37211
37261
|
const opened = "Bun" in globalThis ? await openUnderBun(path, readOnly) : await openUnderNode(path, readOnly);
|
|
37212
37262
|
try {
|
|
@@ -37219,8 +37269,8 @@ var openSqlite = /* @__PURE__ */ __name(async (path, { readOnly = false } = {})
|
|
|
37219
37269
|
}, "openSqlite");
|
|
37220
37270
|
var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
|
|
37221
37271
|
quietSqliteWarning();
|
|
37222
|
-
const { drizzle } = await import("./node-
|
|
37223
|
-
const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-
|
|
37272
|
+
const { drizzle } = await import("./node-W245R2OP.js");
|
|
37273
|
+
const { cacheOverNodeSqlite, nodeClient } = await import("./node-sqlite-FUYOXFW5.js");
|
|
37224
37274
|
const client = await nodeClient(path, { readOnly });
|
|
37225
37275
|
try {
|
|
37226
37276
|
return { database: cacheOverNodeSqlite(client), orm: drizzle({ client }) };
|
|
@@ -37230,8 +37280,8 @@ var openUnderNode = /* @__PURE__ */ __name(async (path, readOnly) => {
|
|
|
37230
37280
|
}
|
|
37231
37281
|
}, "openUnderNode");
|
|
37232
37282
|
var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
|
|
37233
|
-
const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-
|
|
37234
|
-
const { drizzle } = await import("./bun-
|
|
37283
|
+
const { bunClient, cacheOverBunSqlite } = await import("./bun-sqlite-3G3NLK4O.js");
|
|
37284
|
+
const { drizzle } = await import("./bun-P6TMDZGU.js");
|
|
37235
37285
|
const client = await bunClient(path, readOnly ? { readonly: true, create: false } : void 0);
|
|
37236
37286
|
try {
|
|
37237
37287
|
return { database: cacheOverBunSqlite(client), orm: drizzle({ client }) };
|
|
@@ -37241,7 +37291,7 @@ var openUnderBun = /* @__PURE__ */ __name(async (path, readOnly) => {
|
|
|
37241
37291
|
}
|
|
37242
37292
|
}, "openUnderBun");
|
|
37243
37293
|
|
|
37244
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37294
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/payment-facts.js
|
|
37245
37295
|
var PAYMENT_FACTS_TO_MOVE = "payment_facts_to_move";
|
|
37246
37296
|
var paymentOf = /* @__PURE__ */ __name((metadata3) => {
|
|
37247
37297
|
try {
|
|
@@ -37309,7 +37359,7 @@ var movePaymentFacts = /* @__PURE__ */ __name((context) => {
|
|
|
37309
37359
|
});
|
|
37310
37360
|
}, "movePaymentFacts");
|
|
37311
37361
|
|
|
37312
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37362
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/read-compatibility.js
|
|
37313
37363
|
var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
|
|
37314
37364
|
const ours = MIGRATIONS.at(-1)?.version ?? 0;
|
|
37315
37365
|
if (!database.prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name='schema_migrations'").get())
|
|
@@ -37324,7 +37374,7 @@ var assertReadCompatible = /* @__PURE__ */ __name((database, command) => {
|
|
|
37324
37374
|
throw new CliError("configuration_error", `The store requires schema ${minCompatible}, but this tool supports ${ours}; ${refusalAdvice(storeClients(database), command, version)}`);
|
|
37325
37375
|
}, "assertReadCompatible");
|
|
37326
37376
|
|
|
37327
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37377
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/suggested-links.js
|
|
37328
37378
|
var SUGGESTED_LINKS_TO_MOVE = "suggested_links_to_move";
|
|
37329
37379
|
var proposerOf2 = /* @__PURE__ */ __name((provenance2) => {
|
|
37330
37380
|
if (provenance2?.startsWith("rule:"))
|
|
@@ -37370,7 +37420,7 @@ var moveSuggestedLinks = /* @__PURE__ */ __name((database, now2) => {
|
|
|
37370
37420
|
});
|
|
37371
37421
|
}, "moveSuggestedLinks");
|
|
37372
37422
|
|
|
37373
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37423
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/open-store.js
|
|
37374
37424
|
var BACKFILL_ON_OPEN = 5e3;
|
|
37375
37425
|
var NOT_WRITABLE = /* @__PURE__ */ new Set(["EACCES", "EPERM", "EROFS"]);
|
|
37376
37426
|
var createWritable = /* @__PURE__ */ __name((file) => {
|
|
@@ -37433,10 +37483,10 @@ var openStoreContext = /* @__PURE__ */ __name(async ({ path, env, now: now2 = Da
|
|
|
37433
37483
|
}
|
|
37434
37484
|
}, "openStoreContext");
|
|
37435
37485
|
|
|
37436
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37486
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
|
|
37437
37487
|
import { createHash as createHash16 } from "node:crypto";
|
|
37438
37488
|
|
|
37439
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37489
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/project-transfer/schema.js
|
|
37440
37490
|
var text4 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
|
|
37441
37491
|
var ref = text4(2048);
|
|
37442
37492
|
var timestamp2 = pipe(number(), safeInteger(), minValue(0));
|
|
@@ -37502,7 +37552,7 @@ var projectAnnotationsSchema = strictObject({
|
|
|
37502
37552
|
}))
|
|
37503
37553
|
});
|
|
37504
37554
|
|
|
37505
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37555
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/project-transfer/manifest.js
|
|
37506
37556
|
var PROJECT_ANNOTATIONS_MAX_BYTES = 4 * 1024 * 1024;
|
|
37507
37557
|
var invalid7 = /* @__PURE__ */ __name((field4) => {
|
|
37508
37558
|
throw new CliError("validation_error", `invalid project annotations.${field4}`);
|
|
@@ -37606,7 +37656,7 @@ var validateProjectAnnotationsGraph = /* @__PURE__ */ __name((manifest, addition
|
|
|
37606
37656
|
invalid7("external.unused");
|
|
37607
37657
|
}, "validateProjectAnnotationsGraph");
|
|
37608
37658
|
|
|
37609
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37659
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/project-transfer/plan.js
|
|
37610
37660
|
var hash = pipe(string(), regex(/^[a-f0-9]{64}$/));
|
|
37611
37661
|
var ref2 = pipe(string(), minLength(1), maxLength(2048));
|
|
37612
37662
|
var targetSchema = strictObject({
|
|
@@ -37712,7 +37762,7 @@ var planBoundProjectAnnotations = /* @__PURE__ */ __name((manifest, manifest_fin
|
|
|
37712
37762
|
};
|
|
37713
37763
|
}, "planBoundProjectAnnotations");
|
|
37714
37764
|
|
|
37715
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37765
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-model.js
|
|
37716
37766
|
import { createHash as createHash17 } from "node:crypto";
|
|
37717
37767
|
var text5 = /* @__PURE__ */ __name((max) => pipe(string(), minLength(1), maxLength(max)), "text");
|
|
37718
37768
|
var timestamp3 = pipe(number(), safeInteger(), minValue(0));
|
|
@@ -37759,38 +37809,38 @@ var snapshotGraph = /* @__PURE__ */ __name((value) => ({
|
|
|
37759
37809
|
external: value.external
|
|
37760
37810
|
}), "snapshotGraph");
|
|
37761
37811
|
var decodeProjectAnnotationSnapshot = /* @__PURE__ */ __name((json3) => {
|
|
37762
|
-
const
|
|
37812
|
+
const invalid11 = /* @__PURE__ */ __name((field4) => {
|
|
37763
37813
|
throw new CliError("validation_error", `invalid project annotation snapshot.${field4}`);
|
|
37764
37814
|
}, "invalid");
|
|
37765
37815
|
if (typeof json3 !== "string" || Buffer.byteLength(json3) > PROJECT_ANNOTATIONS_MAX_BYTES)
|
|
37766
|
-
return
|
|
37816
|
+
return invalid11("bytes");
|
|
37767
37817
|
let value;
|
|
37768
37818
|
try {
|
|
37769
37819
|
value = JSON.parse(json3);
|
|
37770
37820
|
} catch {
|
|
37771
|
-
return
|
|
37821
|
+
return invalid11("json");
|
|
37772
37822
|
}
|
|
37773
37823
|
const checked = safeParse(projectAnnotationSnapshotSchema, value);
|
|
37774
37824
|
if (!checked.success)
|
|
37775
|
-
return
|
|
37825
|
+
return invalid11(checked.issues[0]?.path?.map((p) => String(p.key)).join(".") ?? "manifest");
|
|
37776
37826
|
const snapshot2 = checked.output;
|
|
37777
37827
|
if (snapshot2.aliases.length + snapshot2.facts.length + snapshot2.links.length + snapshot2.external.length > 1e3)
|
|
37778
|
-
return
|
|
37828
|
+
return invalid11("record budget");
|
|
37779
37829
|
for (const field4 of ["description", "status", "owner"])
|
|
37780
37830
|
if (snapshot2.project[field4] !== null && !snapshot2.project[field4].trim())
|
|
37781
|
-
return
|
|
37831
|
+
return invalid11(`project.${field4}`);
|
|
37782
37832
|
for (const alias2 of snapshot2.aliases)
|
|
37783
37833
|
for (const field4 of ["name", "source"])
|
|
37784
37834
|
if (!alias2[field4].trim())
|
|
37785
|
-
return
|
|
37835
|
+
return invalid11(`aliases.${field4}`);
|
|
37786
37836
|
if (snapshot2.project.updated_at < snapshot2.project.created_at)
|
|
37787
|
-
return
|
|
37837
|
+
return invalid11("project.updated_at");
|
|
37788
37838
|
for (const alias2 of snapshot2.aliases)
|
|
37789
37839
|
if (alias2.updated_at < alias2.created_at)
|
|
37790
|
-
return
|
|
37840
|
+
return invalid11("aliases.updated_at");
|
|
37791
37841
|
for (const fact of snapshot2.facts)
|
|
37792
37842
|
if (!fact.statement.trim())
|
|
37793
|
-
return
|
|
37843
|
+
return invalid11("facts.statement");
|
|
37794
37844
|
validateProjectAnnotationsGraph(snapshotGraph(snapshot2), snapshot2.project.owner === null ? [] : [snapshot2.project.owner]);
|
|
37795
37845
|
return snapshot2;
|
|
37796
37846
|
}, "decodeProjectAnnotationSnapshot");
|
|
@@ -37806,7 +37856,7 @@ var projectAnnotationSnapshotFingerprint = /* @__PURE__ */ __name((json3) => {
|
|
|
37806
37856
|
})).digest("hex");
|
|
37807
37857
|
}, "projectAnnotationSnapshotFingerprint");
|
|
37808
37858
|
|
|
37809
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37859
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/project-transfer/request.js
|
|
37810
37860
|
var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false) => {
|
|
37811
37861
|
if (!request || typeof request !== "object" || Array.isArray(request))
|
|
37812
37862
|
throw new CliError("validation_error", "project annotation request is required");
|
|
@@ -37823,7 +37873,7 @@ var projectAnnotationRequest = /* @__PURE__ */ __name((request, restore = false)
|
|
|
37823
37873
|
return { snapshot: snapshot2, projectId: Number(request.project.slice(8)) };
|
|
37824
37874
|
}, "projectAnnotationRequest");
|
|
37825
37875
|
|
|
37826
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37876
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/budget.js
|
|
37827
37877
|
var SnapshotBudget = class {
|
|
37828
37878
|
static {
|
|
37829
37879
|
__name(this, "SnapshotBudget");
|
|
@@ -37836,10 +37886,10 @@ var SnapshotBudget = class {
|
|
|
37836
37886
|
if (!Number.isSafeInteger(maxBytes) || maxBytes < 1 || maxBytes > 4 * 1024 * 1024)
|
|
37837
37887
|
throw new CliError("validation_error", "snapshot maxReadBytes takes 1\u20134194304 bytes");
|
|
37838
37888
|
}
|
|
37839
|
-
reserve(
|
|
37840
|
-
if (!Number.isSafeInteger(
|
|
37889
|
+
reserve(records2, bytes3) {
|
|
37890
|
+
if (!Number.isSafeInteger(records2) || records2 < 0 || !Number.isSafeInteger(bytes3) || bytes3 < 0 || this.records + records2 > 1e3 || this.bytes + bytes3 > this.maxBytes)
|
|
37841
37891
|
throw new CliError("validation_error", "project annotation snapshot exceeds its record or input byte budget");
|
|
37842
|
-
this.records +=
|
|
37892
|
+
this.records += records2;
|
|
37843
37893
|
this.bytes += bytes3;
|
|
37844
37894
|
}
|
|
37845
37895
|
rows(database, from2, fields4, parameters) {
|
|
@@ -37849,13 +37899,13 @@ var SnapshotBudget = class {
|
|
|
37849
37899
|
}
|
|
37850
37900
|
};
|
|
37851
37901
|
|
|
37852
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37902
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
|
|
37853
37903
|
import { createHash as createHash19 } from "node:crypto";
|
|
37854
37904
|
|
|
37855
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37905
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/project-transfer/snapshot-plan.js
|
|
37856
37906
|
var planProjectAnnotationSnapshot = /* @__PURE__ */ __name((json3, target, bindings) => planBoundProjectAnnotations(decodeProjectAnnotationSnapshot(json3), projectAnnotationSnapshotFingerprint(json3), target, bindings), "planProjectAnnotationSnapshot");
|
|
37857
37907
|
|
|
37858
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
37908
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/sources.js
|
|
37859
37909
|
import { createHash as createHash18 } from "node:crypto";
|
|
37860
37910
|
var invalid9 = /* @__PURE__ */ __name(() => {
|
|
37861
37911
|
throw new CliError("configuration_error", "project snapshot has an unavailable or unsupported dependency");
|
|
@@ -37998,7 +38048,7 @@ var ProjectSnapshotSources = class {
|
|
|
37998
38048
|
}
|
|
37999
38049
|
};
|
|
38000
38050
|
|
|
38001
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
38051
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/snapshot.js
|
|
38002
38052
|
var unsupported = /* @__PURE__ */ __name(() => {
|
|
38003
38053
|
throw new CliError("configuration_error", "project snapshot has unsupported metadata, deletion or account scope");
|
|
38004
38054
|
}, "unsupported");
|
|
@@ -38169,7 +38219,7 @@ var projectAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, bu
|
|
|
38169
38219
|
return { snapshot: snapshot2, read_bytes: budget.bytes, records: budget.records };
|
|
38170
38220
|
}), "projectAnnotationSnapshot");
|
|
38171
38221
|
|
|
38172
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
38222
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/preview.js
|
|
38173
38223
|
var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, manifest, bindings, budget) => read(database, () => {
|
|
38174
38224
|
const current = projectAnnotationSnapshot(database, projectId2, budget).snapshot;
|
|
38175
38225
|
const sources = new ProjectSnapshotSources(database, budget);
|
|
@@ -38231,7 +38281,7 @@ var previewAnnotationSnapshot = /* @__PURE__ */ __name((database, projectId2, ma
|
|
|
38231
38281
|
};
|
|
38232
38282
|
}), "previewAnnotationSnapshot");
|
|
38233
38283
|
|
|
38234
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
38284
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/records.js
|
|
38235
38285
|
var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId2, snapshot2, bindings) => {
|
|
38236
38286
|
const mappings = { ...bindings };
|
|
38237
38287
|
const resolve = /* @__PURE__ */ __name((ref3) => {
|
|
@@ -38273,7 +38323,7 @@ var restoreAnnotationRecords = /* @__PURE__ */ __name((database, projectId2, sna
|
|
|
38273
38323
|
return mappings;
|
|
38274
38324
|
}, "restoreAnnotationRecords");
|
|
38275
38325
|
|
|
38276
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
38326
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/project-transfer/store.js
|
|
38277
38327
|
var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
38278
38328
|
async preview(request) {
|
|
38279
38329
|
const { snapshot: snapshot2, projectId: projectId2 } = projectAnnotationRequest(request);
|
|
@@ -38303,7 +38353,563 @@ var projectAnnotationStoreOver = /* @__PURE__ */ __name(({ database }) => ({
|
|
|
38303
38353
|
}
|
|
38304
38354
|
}), "projectAnnotationStoreOver");
|
|
38305
38355
|
|
|
38306
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
38356
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/domain/records.js
|
|
38357
|
+
import { createHash as createHash20 } from "node:crypto";
|
|
38358
|
+
var RECORDS_SCHEMA_VERSION = 1;
|
|
38359
|
+
var RECORD_OPERATIONS = ["upsert", "delete"];
|
|
38360
|
+
var RECORD_ENTITY_TYPES = ["invoice", "payment", "person", "organization", "project"];
|
|
38361
|
+
var WORD4 = "^[a-z0-9][a-z0-9_-]{0,62}$";
|
|
38362
|
+
var TYPE = "^(invoice|payment|person|organization|project|custom:[a-z0-9][a-z0-9_-]{0,62})$";
|
|
38363
|
+
var MAX_ID = 512;
|
|
38364
|
+
var MAX_FIELDS_BYTES = 65536;
|
|
38365
|
+
var MAX_RELATIONS = 100;
|
|
38366
|
+
var RECORDS_ENVELOPE_SCHEMA = {
|
|
38367
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
38368
|
+
title: "WireCat records envelope, version 1",
|
|
38369
|
+
description: "Records one source sends to the store. JSONL is the same model: the first line holds schema_version and source, each further line one record.",
|
|
38370
|
+
type: "object",
|
|
38371
|
+
required: ["schema_version", "source", "records"],
|
|
38372
|
+
additionalProperties: false,
|
|
38373
|
+
properties: {
|
|
38374
|
+
schema_version: { const: RECORDS_SCHEMA_VERSION },
|
|
38375
|
+
source: { $ref: "#/$defs/source" },
|
|
38376
|
+
records: { type: "array", items: { $ref: "#/$defs/record" } }
|
|
38377
|
+
},
|
|
38378
|
+
$defs: {
|
|
38379
|
+
source: {
|
|
38380
|
+
type: "object",
|
|
38381
|
+
required: ["provider", "account", "batch_id"],
|
|
38382
|
+
additionalProperties: false,
|
|
38383
|
+
properties: {
|
|
38384
|
+
provider: { type: "string", pattern: WORD4, description: "The system the records come from" },
|
|
38385
|
+
account: { type: "string", minLength: 1, maxLength: MAX_ID, description: "The account in that system" },
|
|
38386
|
+
batch_id: { type: "string", minLength: 1, maxLength: MAX_ID, description: "This import, for the receipt" }
|
|
38387
|
+
}
|
|
38388
|
+
},
|
|
38389
|
+
record: {
|
|
38390
|
+
type: "object",
|
|
38391
|
+
required: ["key", "type", "external_id", "operation"],
|
|
38392
|
+
additionalProperties: false,
|
|
38393
|
+
properties: {
|
|
38394
|
+
key: { type: "string", minLength: 1, maxLength: MAX_ID },
|
|
38395
|
+
type: { type: "string", pattern: TYPE },
|
|
38396
|
+
external_id: { type: "string", minLength: 1, maxLength: MAX_ID },
|
|
38397
|
+
operation: { enum: [...RECORD_OPERATIONS] },
|
|
38398
|
+
fields: {
|
|
38399
|
+
type: "object",
|
|
38400
|
+
description: "What the source says, as data: never secrets, never instructions"
|
|
38401
|
+
},
|
|
38402
|
+
revision: { type: "integer", minimum: 0, maximum: Number.MAX_SAFE_INTEGER },
|
|
38403
|
+
relations: { type: "array", maxItems: MAX_RELATIONS, items: { $ref: "#/$defs/relation" } }
|
|
38404
|
+
}
|
|
38405
|
+
},
|
|
38406
|
+
relation: {
|
|
38407
|
+
type: "object",
|
|
38408
|
+
required: ["role", "type", "external_id"],
|
|
38409
|
+
additionalProperties: false,
|
|
38410
|
+
properties: {
|
|
38411
|
+
role: { type: "string", pattern: WORD4 },
|
|
38412
|
+
type: { type: "string", pattern: TYPE },
|
|
38413
|
+
external_id: { type: "string", minLength: 1, maxLength: MAX_ID }
|
|
38414
|
+
}
|
|
38415
|
+
}
|
|
38416
|
+
}
|
|
38417
|
+
};
|
|
38418
|
+
var wordPattern = new RegExp(WORD4);
|
|
38419
|
+
var typePattern = new RegExp(TYPE);
|
|
38420
|
+
var isObject2 = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isObject");
|
|
38421
|
+
var escapePointer = /* @__PURE__ */ __name((segment) => String(segment).replaceAll("~", "~0").replaceAll("/", "~1"), "escapePointer");
|
|
38422
|
+
var pointerOf = /* @__PURE__ */ __name((...segments) => segments.map((s) => `/${escapePointer(s)}`).join(""), "pointerOf");
|
|
38423
|
+
var idText = /* @__PURE__ */ __name((value) => typeof value === "string" && value.trim() !== "" && value.length <= MAX_ID && !value.includes("\0"), "idText");
|
|
38424
|
+
var extraKeys = /* @__PURE__ */ __name((value, allowed) => Object.keys(value).filter((key2) => !allowed.includes(key2)), "extraKeys");
|
|
38425
|
+
var secretIn = /* @__PURE__ */ __name((value, at) => {
|
|
38426
|
+
if (typeof value === "string")
|
|
38427
|
+
return holdsCredential(value) ? at : void 0;
|
|
38428
|
+
if (Array.isArray(value)) {
|
|
38429
|
+
for (const [index2, item] of value.entries()) {
|
|
38430
|
+
const found2 = secretIn(item, [...at, index2]);
|
|
38431
|
+
if (found2)
|
|
38432
|
+
return found2;
|
|
38433
|
+
}
|
|
38434
|
+
return void 0;
|
|
38435
|
+
}
|
|
38436
|
+
if (!isObject2(value))
|
|
38437
|
+
return void 0;
|
|
38438
|
+
for (const [key2, item] of Object.entries(value)) {
|
|
38439
|
+
if (secretNamed(key2))
|
|
38440
|
+
return [...at, key2];
|
|
38441
|
+
const found2 = secretIn(item, [...at, key2]);
|
|
38442
|
+
if (found2)
|
|
38443
|
+
return found2;
|
|
38444
|
+
}
|
|
38445
|
+
return void 0;
|
|
38446
|
+
}, "secretIn");
|
|
38447
|
+
var relationErrors = /* @__PURE__ */ __name((relations, at) => {
|
|
38448
|
+
if (relations === void 0)
|
|
38449
|
+
return [];
|
|
38450
|
+
if (!Array.isArray(relations) || relations.length > MAX_RELATIONS)
|
|
38451
|
+
return [invalid10(at, `relations is a list of at most ${MAX_RELATIONS}`)];
|
|
38452
|
+
return relations.flatMap((relation, index2) => {
|
|
38453
|
+
const here = [...at, index2];
|
|
38454
|
+
if (!isObject2(relation))
|
|
38455
|
+
return [invalid10(here, "a relation is an object")];
|
|
38456
|
+
const extra = extraKeys(relation, ["role", "type", "external_id"]);
|
|
38457
|
+
if (extra.length > 0)
|
|
38458
|
+
return [invalid10([...here, extra[0]], "a relation holds role, type and external_id")];
|
|
38459
|
+
if (typeof relation.role !== "string" || !wordPattern.test(relation.role))
|
|
38460
|
+
return [invalid10([...here, "role"], "a role is lowercase letters, digits, - and _")];
|
|
38461
|
+
if (typeof relation.type !== "string" || !typePattern.test(relation.type))
|
|
38462
|
+
return [invalid10([...here, "type"], `a type is one of ${RECORD_ENTITY_TYPES.join(", ")} or custom:<name>`)];
|
|
38463
|
+
if (!idText(relation.external_id))
|
|
38464
|
+
return [invalid10([...here, "external_id"], `an external id takes 1\u2013${MAX_ID} characters`)];
|
|
38465
|
+
return [];
|
|
38466
|
+
});
|
|
38467
|
+
}, "relationErrors");
|
|
38468
|
+
var invalid10 = /* @__PURE__ */ __name((at, message2, code = "record.invalid") => ({
|
|
38469
|
+
pointer: pointerOf(...at),
|
|
38470
|
+
code,
|
|
38471
|
+
message: message2
|
|
38472
|
+
}), "invalid");
|
|
38473
|
+
var recordErrors = /* @__PURE__ */ __name((record4, index2) => {
|
|
38474
|
+
const at = ["records", index2];
|
|
38475
|
+
if (!isObject2(record4))
|
|
38476
|
+
return [invalid10(at, "a record is an object")];
|
|
38477
|
+
const key2 = typeof record4.key === "string" ? record4.key : void 0;
|
|
38478
|
+
const withKey = /* @__PURE__ */ __name((errors) => errors.map((error) => key2 === void 0 ? error : { ...error, key: key2 }), "withKey");
|
|
38479
|
+
const extra = extraKeys(record4, ["key", "type", "external_id", "operation", "fields", "revision", "relations"]);
|
|
38480
|
+
if (extra.length > 0)
|
|
38481
|
+
return withKey([invalid10([...at, extra[0]], `a record has no ${extra[0]}`)]);
|
|
38482
|
+
if (!idText(record4.key))
|
|
38483
|
+
return [invalid10([...at, "key"], `a key takes 1\u2013${MAX_ID} characters`)];
|
|
38484
|
+
if (typeof record4.type !== "string" || !typePattern.test(record4.type))
|
|
38485
|
+
return withKey([
|
|
38486
|
+
invalid10([...at, "type"], `a type is one of ${RECORD_ENTITY_TYPES.join(", ")} or custom:<name>`, "record.type")
|
|
38487
|
+
]);
|
|
38488
|
+
if (!idText(record4.external_id))
|
|
38489
|
+
return withKey([invalid10([...at, "external_id"], `an external id takes 1\u2013${MAX_ID} characters`)]);
|
|
38490
|
+
if (!RECORD_OPERATIONS.includes(record4.operation))
|
|
38491
|
+
return withKey([invalid10([...at, "operation"], "an operation is upsert or delete")]);
|
|
38492
|
+
if (record4.revision !== void 0 && (typeof record4.revision !== "number" || !Number.isSafeInteger(record4.revision) || record4.revision < 0))
|
|
38493
|
+
return withKey([invalid10([...at, "revision"], "a revision is a whole number, 0 or more")]);
|
|
38494
|
+
if (record4.operation === "upsert" && !isObject2(record4.fields))
|
|
38495
|
+
return withKey([invalid10([...at, "fields"], "an upsert carries its fields as an object")]);
|
|
38496
|
+
if (record4.fields !== void 0 && !isObject2(record4.fields))
|
|
38497
|
+
return withKey([invalid10([...at, "fields"], "fields is an object")]);
|
|
38498
|
+
if (record4.fields !== void 0 && Buffer.byteLength(JSON.stringify(record4.fields)) > MAX_FIELDS_BYTES)
|
|
38499
|
+
return withKey([invalid10([...at, "fields"], `fields take at most ${MAX_FIELDS_BYTES} bytes`, "record.too-large")]);
|
|
38500
|
+
const secret = record4.fields === void 0 ? void 0 : secretIn(record4.fields, [...at, "fields"]);
|
|
38501
|
+
if (secret)
|
|
38502
|
+
return withKey([
|
|
38503
|
+
invalid10(secret, "a secret never goes into the store: drop this field at the source", "record.secret-field")
|
|
38504
|
+
]);
|
|
38505
|
+
return withKey(relationErrors(record4.relations, [...at, "relations"]));
|
|
38506
|
+
}, "recordErrors");
|
|
38507
|
+
var envelopeErrors = /* @__PURE__ */ __name((envelope, account) => {
|
|
38508
|
+
if (!isObject2(envelope))
|
|
38509
|
+
return [invalid10([], "an envelope is an object", "envelope.invalid")];
|
|
38510
|
+
const extra = extraKeys(envelope, ["schema_version", "source", "records"]);
|
|
38511
|
+
if (extra.length > 0)
|
|
38512
|
+
return [invalid10([extra[0]], `an envelope has no ${extra[0]}`, "envelope.invalid")];
|
|
38513
|
+
if (envelope.schema_version !== RECORDS_SCHEMA_VERSION)
|
|
38514
|
+
return [
|
|
38515
|
+
invalid10(["schema_version"], `this build reads schema_version ${RECORDS_SCHEMA_VERSION}, not ${JSON.stringify(envelope.schema_version)}`, "envelope.schema-version")
|
|
38516
|
+
];
|
|
38517
|
+
const { source: source2 } = envelope;
|
|
38518
|
+
if (!isObject2(source2))
|
|
38519
|
+
return [invalid10(["source"], "source is an object", "envelope.invalid")];
|
|
38520
|
+
const sourceExtra = extraKeys(source2, ["provider", "account", "batch_id"]);
|
|
38521
|
+
if (sourceExtra.length > 0)
|
|
38522
|
+
return [
|
|
38523
|
+
invalid10(["source", sourceExtra[0]], "source holds provider, account and batch_id", "envelope.invalid")
|
|
38524
|
+
];
|
|
38525
|
+
if (typeof source2.provider !== "string" || !wordPattern.test(source2.provider))
|
|
38526
|
+
return [invalid10(["source", "provider"], "a provider is lowercase letters, digits, - and _", "envelope.invalid")];
|
|
38527
|
+
if (!idText(source2.account))
|
|
38528
|
+
return [invalid10(["source", "account"], `an account takes 1\u2013${MAX_ID} characters`, "envelope.invalid")];
|
|
38529
|
+
if (!idText(source2.batch_id))
|
|
38530
|
+
return [invalid10(["source", "batch_id"], `a batch id takes 1\u2013${MAX_ID} characters`, "envelope.invalid")];
|
|
38531
|
+
if (source2.account !== account)
|
|
38532
|
+
return [
|
|
38533
|
+
invalid10(["source", "account"], `the envelope is for account ${JSON.stringify(source2.account)}, the import for ${JSON.stringify(account)}`, "envelope.account-mismatch")
|
|
38534
|
+
];
|
|
38535
|
+
if (!Array.isArray(envelope.records))
|
|
38536
|
+
return [invalid10(["records"], "records is a list", "envelope.invalid")];
|
|
38537
|
+
return [];
|
|
38538
|
+
}, "envelopeErrors");
|
|
38539
|
+
var canonical2 = /* @__PURE__ */ __name((value) => {
|
|
38540
|
+
if (Array.isArray(value))
|
|
38541
|
+
return value.map(canonical2);
|
|
38542
|
+
if (!isObject2(value))
|
|
38543
|
+
return value;
|
|
38544
|
+
return Object.fromEntries(Object.keys(value).sort().map((key2) => [key2, canonical2(value[key2])]));
|
|
38545
|
+
}, "canonical");
|
|
38546
|
+
var recordFingerprint = /* @__PURE__ */ __name((fields4, relations) => createHash20("sha256").update(JSON.stringify(canonical2({
|
|
38547
|
+
fields: fields4,
|
|
38548
|
+
relations: relations.map((relation) => [relation.role, relation.type, relation.external_id]).sort((a, b) => a.join("\0").localeCompare(b.join("\0")))
|
|
38549
|
+
}))).digest("hex"), "recordFingerprint");
|
|
38550
|
+
var envelopeOfJsonl = /* @__PURE__ */ __name((text6) => {
|
|
38551
|
+
const lines = text6.split(/\r?\n/);
|
|
38552
|
+
const first = lines.findIndex((line) => line.trim() !== "");
|
|
38553
|
+
if (first < 0)
|
|
38554
|
+
return {};
|
|
38555
|
+
const parse = /* @__PURE__ */ __name((line) => {
|
|
38556
|
+
try {
|
|
38557
|
+
return JSON.parse(line);
|
|
38558
|
+
} catch {
|
|
38559
|
+
return line;
|
|
38560
|
+
}
|
|
38561
|
+
}, "parse");
|
|
38562
|
+
const header = parse(lines[first]);
|
|
38563
|
+
const records2 = [];
|
|
38564
|
+
for (let at = first + 1; at < lines.length; at++) {
|
|
38565
|
+
const line = lines[at];
|
|
38566
|
+
if (line.trim() !== "")
|
|
38567
|
+
records2.push(parse(line));
|
|
38568
|
+
}
|
|
38569
|
+
return isObject2(header) ? { ...header, records: records2 } : header;
|
|
38570
|
+
}, "envelopeOfJsonl");
|
|
38571
|
+
|
|
38572
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/records.js
|
|
38573
|
+
var PROJECTED = {
|
|
38574
|
+
invoice: { roles: ["issuer", "counterparty", "project"], many: [] },
|
|
38575
|
+
payment: { roles: ["payer", "payee", "project", "settles"], many: ["settles"] }
|
|
38576
|
+
};
|
|
38577
|
+
var isProjected = /* @__PURE__ */ __name((type) => type === "invoice" || type === "payment", "isProjected");
|
|
38578
|
+
var IMPORTER = { bot: "import" };
|
|
38579
|
+
var REFERENCE_FIELDS = ["issuer", "counterparty", "project", "payer", "payee"];
|
|
38580
|
+
var refusal = /* @__PURE__ */ __name((message2, code, at) => {
|
|
38581
|
+
throw new CliError("validation_error", message2, { reason: code, ...at === void 0 ? {} : { at } });
|
|
38582
|
+
}, "refusal");
|
|
38583
|
+
var codeOf = /* @__PURE__ */ __name((error) => {
|
|
38584
|
+
const reason = error.details?.reason;
|
|
38585
|
+
if (typeof reason === "string")
|
|
38586
|
+
return reason;
|
|
38587
|
+
return error.code === "not_found" ? "record.reference-not-found" : "record.entity";
|
|
38588
|
+
}, "codeOf");
|
|
38589
|
+
var iso12 = /* @__PURE__ */ __name((value) => new Date(Number(value)).toISOString(), "iso");
|
|
38590
|
+
var stringField = /* @__PURE__ */ __name((fields4, name) => {
|
|
38591
|
+
const value = fields4[name];
|
|
38592
|
+
if (value === void 0 || value === null)
|
|
38593
|
+
return void 0;
|
|
38594
|
+
if (typeof value !== "string")
|
|
38595
|
+
return refusal(`fields.${name} is text`, "record.invalid");
|
|
38596
|
+
return value;
|
|
38597
|
+
}, "stringField");
|
|
38598
|
+
var invoiceOf = /* @__PURE__ */ __name((fields4, related, source2) => {
|
|
38599
|
+
if (!Array.isArray(fields4.lines) || fields4.lines.some((line) => typeof line !== "object" || line === null))
|
|
38600
|
+
return refusal("an invoice's fields.lines is a list of lines", "record.invalid");
|
|
38601
|
+
const one = /* @__PURE__ */ __name((role) => related.get(role)?.[0] ?? stringField(fields4, role), "one");
|
|
38602
|
+
return {
|
|
38603
|
+
...written(source2),
|
|
38604
|
+
direction: fields4.direction,
|
|
38605
|
+
number: stringField(fields4, "number"),
|
|
38606
|
+
issuer: one("issuer"),
|
|
38607
|
+
counterparty: one("counterparty"),
|
|
38608
|
+
project: one("project"),
|
|
38609
|
+
currency: fields4.currency,
|
|
38610
|
+
issueDate: stringField(fields4, "issue_date"),
|
|
38611
|
+
dueDate: stringField(fields4, "due_date"),
|
|
38612
|
+
total: fields4.total,
|
|
38613
|
+
lines: fields4.lines.map((line) => ({
|
|
38614
|
+
description: line.description,
|
|
38615
|
+
quantity: line.quantity,
|
|
38616
|
+
unitPrice: line.unit_price,
|
|
38617
|
+
amount: line.amount
|
|
38618
|
+
}))
|
|
38619
|
+
};
|
|
38620
|
+
}, "invoiceOf");
|
|
38621
|
+
var paymentOf2 = /* @__PURE__ */ __name((fields4, related, source2) => {
|
|
38622
|
+
const one = /* @__PURE__ */ __name((role) => related.get(role)?.[0] ?? stringField(fields4, role), "one");
|
|
38623
|
+
return {
|
|
38624
|
+
...written(source2),
|
|
38625
|
+
direction: fields4.direction,
|
|
38626
|
+
payer: one("payer"),
|
|
38627
|
+
payee: one("payee"),
|
|
38628
|
+
project: one("project"),
|
|
38629
|
+
amount: fields4.amount,
|
|
38630
|
+
currency: fields4.currency,
|
|
38631
|
+
date: fields4.date,
|
|
38632
|
+
reference: stringField(fields4, "reference")
|
|
38633
|
+
};
|
|
38634
|
+
}, "paymentOf");
|
|
38635
|
+
var written = /* @__PURE__ */ __name((source2) => ({
|
|
38636
|
+
by: IMPORTER,
|
|
38637
|
+
source: `import:${source2.provider}`,
|
|
38638
|
+
reason: `imported from ${source2.provider} account ${source2.account}, batch ${source2.batch_id}`
|
|
38639
|
+
}), "written");
|
|
38640
|
+
var recordStoreOver = /* @__PURE__ */ __name((context) => {
|
|
38641
|
+
const { database, now: now2 } = context;
|
|
38642
|
+
const finance = financeOperationsOver(context);
|
|
38643
|
+
const statements = /* @__PURE__ */ new Map();
|
|
38644
|
+
const sql2 = /* @__PURE__ */ __name((text6) => {
|
|
38645
|
+
let statement = statements.get(text6);
|
|
38646
|
+
if (!statement) {
|
|
38647
|
+
statement = database.prepare(text6);
|
|
38648
|
+
statements.set(text6, statement);
|
|
38649
|
+
}
|
|
38650
|
+
return statement;
|
|
38651
|
+
}, "sql");
|
|
38652
|
+
const entityRef = /* @__PURE__ */ __name((type, id2) => type == null ? null : referenceOfThing(database, storedThing(type, id2)) ?? `${String(type)}:${String(id2)}`, "entityRef");
|
|
38653
|
+
const relatedOf = /* @__PURE__ */ __name((recordId, type) => {
|
|
38654
|
+
const { roles, many } = PROJECTED[type];
|
|
38655
|
+
const rows = sql2("SELECT rr.role, t.entity_type, t.entity_id FROM record_relations rr LEFT JOIN records t ON t.id = rr.target_id AND t.deleted_at IS NULL WHERE rr.record_id = ?").all(recordId);
|
|
38656
|
+
const related = /* @__PURE__ */ new Map();
|
|
38657
|
+
const missing4 = /* @__PURE__ */ new Set();
|
|
38658
|
+
for (const row2 of rows) {
|
|
38659
|
+
const role = String(row2.role);
|
|
38660
|
+
if (!roles.includes(role))
|
|
38661
|
+
continue;
|
|
38662
|
+
const ref3 = entityRef(row2.entity_type, row2.entity_id);
|
|
38663
|
+
if (ref3 === null)
|
|
38664
|
+
missing4.add(role);
|
|
38665
|
+
else
|
|
38666
|
+
related.set(role, [...related.get(role) ?? [], ref3]);
|
|
38667
|
+
}
|
|
38668
|
+
for (const [role, refs] of related)
|
|
38669
|
+
if (refs.length > 1 && !many.includes(role))
|
|
38670
|
+
refusal(`a record has one ${role}`, "record.relation-ambiguous");
|
|
38671
|
+
return { related, missing: [...missing4] };
|
|
38672
|
+
}, "relatedOf");
|
|
38673
|
+
const project = /* @__PURE__ */ __name((row2, source2) => {
|
|
38674
|
+
const type = row2.type;
|
|
38675
|
+
const { related, missing: missing4 } = relatedOf(Number(row2.id), type);
|
|
38676
|
+
if (missing4.length > 0)
|
|
38677
|
+
return { missing: missing4 };
|
|
38678
|
+
const fields4 = JSON.parse(String(row2.fields));
|
|
38679
|
+
for (const name of REFERENCE_FIELDS)
|
|
38680
|
+
stringField(fields4, name);
|
|
38681
|
+
const ref3 = type === "invoice" ? finance.addInvoice(invoiceOf(fields4, related, source2)).ref : settle(fields4, related, source2);
|
|
38682
|
+
const entity = requiredThing(database, ref3);
|
|
38683
|
+
sql2("UPDATE records SET entity_type = ?, entity_id = ?, projected_fingerprint = fingerprint WHERE id = ?").run(entity.type, entity.id, Number(row2.id));
|
|
38684
|
+
return { proposed: ref3, missing: [] };
|
|
38685
|
+
}, "project");
|
|
38686
|
+
const settle = /* @__PURE__ */ __name((fields4, related, source2) => {
|
|
38687
|
+
const made = finance.addPayment(paymentOf2(fields4, related, source2));
|
|
38688
|
+
const units = /* @__PURE__ */ __name((amount) => minorUnits(amount, made.currency), "units");
|
|
38689
|
+
let left = units(made.unallocated);
|
|
38690
|
+
for (const invoice of related.get("settles") ?? []) {
|
|
38691
|
+
const share = Math.min(left, units(finance.invoice(invoice).open));
|
|
38692
|
+
if (share <= 0)
|
|
38693
|
+
continue;
|
|
38694
|
+
const amount = formatDecimal(share, scaleOf(made.currency));
|
|
38695
|
+
finance.allocate({ payment: made.ref, invoice, amount, by: IMPORTER });
|
|
38696
|
+
left -= share;
|
|
38697
|
+
}
|
|
38698
|
+
return made.ref;
|
|
38699
|
+
}, "settle");
|
|
38700
|
+
const completeDependents = /* @__PURE__ */ __name((target, source2, proposed, laterErrors) => {
|
|
38701
|
+
const queue = [target];
|
|
38702
|
+
while (queue.length > 0) {
|
|
38703
|
+
const rows = sql2("SELECT DISTINCT r.* FROM record_relations rr JOIN records r ON r.id = rr.record_id WHERE rr.target_id = ? AND r.entity_id IS NULL AND r.deleted_at IS NULL AND r.type IN ('invoice', 'payment')").all(queue.shift());
|
|
38704
|
+
for (const row2 of rows) {
|
|
38705
|
+
try {
|
|
38706
|
+
const done = write(database, () => project(row2, source2));
|
|
38707
|
+
if (done.proposed) {
|
|
38708
|
+
proposed.push(done.proposed);
|
|
38709
|
+
queue.push(Number(row2.id));
|
|
38710
|
+
}
|
|
38711
|
+
} catch (error) {
|
|
38712
|
+
if (!(error instanceof CliError))
|
|
38713
|
+
throw error;
|
|
38714
|
+
laterErrors.push({
|
|
38715
|
+
pointer: "",
|
|
38716
|
+
code: codeOf(error),
|
|
38717
|
+
message: `${String(row2.type)} ${String(row2.external_id)} waits: ${error.message}`
|
|
38718
|
+
});
|
|
38719
|
+
}
|
|
38720
|
+
}
|
|
38721
|
+
}
|
|
38722
|
+
}, "completeDependents");
|
|
38723
|
+
const relate = /* @__PURE__ */ __name((recordId, accountId, relations, at) => {
|
|
38724
|
+
sql2("DELETE FROM record_relations WHERE record_id = ?").run(recordId);
|
|
38725
|
+
for (const relation of relations)
|
|
38726
|
+
sql2("INSERT OR IGNORE INTO record_relations (record_id, role, target_type, target_external_id, target_id, created_at) VALUES (?, ?, ?, ?, (SELECT id FROM records WHERE account_id = ? AND type = ? AND external_id = ?), ?)").run(recordId, relation.role, relation.type, relation.external_id, accountId, relation.type, relation.external_id, at);
|
|
38727
|
+
}, "relate");
|
|
38728
|
+
const writeOne = /* @__PURE__ */ __name((accountId, source2, { record: record4 }, proposed) => {
|
|
38729
|
+
const stored3 = sql2("SELECT * FROM records WHERE account_id = ? AND type = ? AND external_id = ?").get(accountId, record4.type, record4.external_id);
|
|
38730
|
+
const relations = record4.relations ?? [];
|
|
38731
|
+
const fingerprint2 = record4.operation === "upsert" ? recordFingerprint(record4.fields ?? {}, relations) : null;
|
|
38732
|
+
const stale3 = /* @__PURE__ */ __name((why) => refusal(why, "record.stale-revision", "revision"), "stale");
|
|
38733
|
+
if (stored3 && stored3.revision != null) {
|
|
38734
|
+
const held = Number(stored3.revision);
|
|
38735
|
+
if (record4.revision === void 0)
|
|
38736
|
+
stale3(`the store holds revision ${held}: send the record's revision`);
|
|
38737
|
+
else if (record4.revision < held)
|
|
38738
|
+
stale3(`revision ${record4.revision} is older than the stored ${held}`);
|
|
38739
|
+
else if (record4.revision === held && fingerprint2 !== null && fingerprint2 !== stored3.fingerprint)
|
|
38740
|
+
stale3(`revision ${held} is stored with other content: a change needs a higher revision`);
|
|
38741
|
+
}
|
|
38742
|
+
const time3 = now2();
|
|
38743
|
+
const revision2 = record4.revision ?? (stored3?.revision == null ? null : Number(stored3.revision));
|
|
38744
|
+
if (record4.operation === "delete") {
|
|
38745
|
+
if (!stored3)
|
|
38746
|
+
return refusal(`no ${record4.type} ${record4.external_id} to delete`, "record.not-found", "external_id");
|
|
38747
|
+
if (stored3.deleted_at != null)
|
|
38748
|
+
return { status: "unchanged", id: Number(stored3.id) };
|
|
38749
|
+
sql2("UPDATE records SET deleted_at = ?, updated_at = ?, revision = ?, batch_id = ? WHERE id = ?").run(time3, time3, revision2, source2.batch_id, Number(stored3.id));
|
|
38750
|
+
return { status: "deleted", id: Number(stored3.id), flagged: stored3.entity_id != null };
|
|
38751
|
+
}
|
|
38752
|
+
const fields4 = JSON.stringify(record4.fields);
|
|
38753
|
+
if (stored3 && stored3.fingerprint === fingerprint2 && stored3.deleted_at == null)
|
|
38754
|
+
return { status: "unchanged", id: Number(stored3.id) };
|
|
38755
|
+
const id2 = stored3 ? Number(stored3.id) : Number(sql2("INSERT INTO records (account_id, type, external_id, fields, revision, fingerprint, batch_id, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id").get(accountId, record4.type, record4.external_id, fields4, revision2, fingerprint2, source2.batch_id, time3, time3)?.id);
|
|
38756
|
+
if (stored3)
|
|
38757
|
+
sql2("UPDATE records SET fields = ?, revision = ?, fingerprint = ?, batch_id = ?, updated_at = ?, deleted_at = NULL WHERE id = ?").run(fields4, revision2, fingerprint2, source2.batch_id, time3, id2);
|
|
38758
|
+
else
|
|
38759
|
+
sql2("UPDATE record_relations SET target_id = ? WHERE target_id IS NULL AND target_type = ? AND target_external_id = ? AND record_id IN (SELECT id FROM records WHERE account_id = ?)").run(id2, record4.type, record4.external_id, accountId);
|
|
38760
|
+
relate(id2, accountId, relations, time3);
|
|
38761
|
+
let projected = false;
|
|
38762
|
+
if (isProjected(record4.type) && stored3?.entity_id == null) {
|
|
38763
|
+
const done = project({ id: id2, type: record4.type, fields: fields4, account_id: accountId }, source2);
|
|
38764
|
+
if (done.proposed)
|
|
38765
|
+
proposed.push(done.proposed);
|
|
38766
|
+
projected = done.proposed !== void 0;
|
|
38767
|
+
}
|
|
38768
|
+
return {
|
|
38769
|
+
status: stored3 ? "updated" : "created",
|
|
38770
|
+
id: id2,
|
|
38771
|
+
flagged: stored3?.entity_id != null && stored3.projected_fingerprint !== fingerprint2,
|
|
38772
|
+
// Records waiting on this one move only when it has an entity: made now, or back from a delete.
|
|
38773
|
+
complete: projected || stored3?.deleted_at != null && stored3.entity_id != null
|
|
38774
|
+
};
|
|
38775
|
+
}, "writeOne");
|
|
38776
|
+
const missingOf = /* @__PURE__ */ __name((id2) => {
|
|
38777
|
+
const row2 = sql2("SELECT type, entity_id, deleted_at FROM records WHERE id = ?").get(id2);
|
|
38778
|
+
if (!row2 || row2.entity_id != null || row2.deleted_at != null || !isProjected(row2.type))
|
|
38779
|
+
return null;
|
|
38780
|
+
const { missing: missing4 } = relatedOf(id2, row2.type);
|
|
38781
|
+
return missing4.length > 0 ? missing4 : null;
|
|
38782
|
+
}, "missingOf");
|
|
38783
|
+
const ingest = /* @__PURE__ */ __name((source2, records2, chunk) => {
|
|
38784
|
+
const outcomes = [];
|
|
38785
|
+
const proposed = [];
|
|
38786
|
+
const flagged = [];
|
|
38787
|
+
const laterErrors = [];
|
|
38788
|
+
const kept = [];
|
|
38789
|
+
for (let start = 0; start < records2.length; start += chunk) {
|
|
38790
|
+
write(database, () => {
|
|
38791
|
+
const accountId = accountPk(context, { provider: source2.provider, account: source2.account });
|
|
38792
|
+
const complete = [];
|
|
38793
|
+
for (const item of records2.slice(start, start + chunk)) {
|
|
38794
|
+
try {
|
|
38795
|
+
const done = isProjected(item.record.type) ? write(database, () => writeOne(accountId, source2, item, proposed)) : writeOne(accountId, source2, item, proposed);
|
|
38796
|
+
outcomes.push({ index: item.index, key: item.record.key, status: done.status });
|
|
38797
|
+
if (done.id === void 0)
|
|
38798
|
+
continue;
|
|
38799
|
+
kept.push({ index: item.index, key: item.record.key, id: done.id });
|
|
38800
|
+
if (done.flagged) {
|
|
38801
|
+
const row2 = sql2("SELECT entity_type, entity_id FROM records WHERE id = ?").get(done.id);
|
|
38802
|
+
flagged.push({
|
|
38803
|
+
index: item.index,
|
|
38804
|
+
key: item.record.key,
|
|
38805
|
+
entity: entityRef(row2?.entity_type, row2?.entity_id)
|
|
38806
|
+
});
|
|
38807
|
+
}
|
|
38808
|
+
if (done.complete)
|
|
38809
|
+
complete.push(done.id);
|
|
38810
|
+
} catch (error) {
|
|
38811
|
+
if (!(error instanceof CliError))
|
|
38812
|
+
throw error;
|
|
38813
|
+
const at = error.details?.at ?? "fields";
|
|
38814
|
+
const pointer = pointerOf("records", item.index, at);
|
|
38815
|
+
outcomes.push({
|
|
38816
|
+
index: item.index,
|
|
38817
|
+
key: item.record.key,
|
|
38818
|
+
status: "refused",
|
|
38819
|
+
error: { pointer, code: codeOf(error), message: error.message, key: item.record.key }
|
|
38820
|
+
});
|
|
38821
|
+
}
|
|
38822
|
+
}
|
|
38823
|
+
for (const id2 of complete)
|
|
38824
|
+
completeDependents(id2, source2, proposed, laterErrors);
|
|
38825
|
+
});
|
|
38826
|
+
}
|
|
38827
|
+
const waiting = read(database, () => kept.flatMap(({ index: index2, key: key2, id: id2 }) => {
|
|
38828
|
+
const missing4 = missingOf(id2);
|
|
38829
|
+
return missing4 === null ? [] : [{ index: index2, key: key2, missing: missing4 }];
|
|
38830
|
+
}));
|
|
38831
|
+
return { outcomes, proposed: [...new Set(proposed)], waiting, flagged, laterErrors };
|
|
38832
|
+
}, "ingest");
|
|
38833
|
+
const sourceRecordOf = /* @__PURE__ */ __name((row2) => ({
|
|
38834
|
+
provider: String(row2.provider),
|
|
38835
|
+
account: String(row2.account),
|
|
38836
|
+
type: String(row2.type),
|
|
38837
|
+
externalId: String(row2.external_id),
|
|
38838
|
+
fields: JSON.parse(String(row2.fields)),
|
|
38839
|
+
revision: row2.revision == null ? null : Number(row2.revision),
|
|
38840
|
+
fingerprint: String(row2.fingerprint),
|
|
38841
|
+
relations: sql2("SELECT role, target_type, target_external_id, target_id FROM record_relations WHERE record_id = ? ORDER BY id").all(Number(row2.id)).map((relation) => ({
|
|
38842
|
+
role: String(relation.role),
|
|
38843
|
+
type: String(relation.target_type),
|
|
38844
|
+
externalId: String(relation.target_external_id),
|
|
38845
|
+
resolved: relation.target_id != null
|
|
38846
|
+
})),
|
|
38847
|
+
entity: entityRef(row2.entity_type, row2.entity_id),
|
|
38848
|
+
flagged: row2.entity_id != null && (row2.deleted_at != null || row2.projected_fingerprint !== row2.fingerprint),
|
|
38849
|
+
batchId: String(row2.batch_id),
|
|
38850
|
+
createdAt: iso12(row2.created_at),
|
|
38851
|
+
updatedAt: iso12(row2.updated_at),
|
|
38852
|
+
deletedAt: row2.deleted_at == null ? null : iso12(row2.deleted_at)
|
|
38853
|
+
}), "sourceRecordOf");
|
|
38854
|
+
const SELECT2 = "SELECT r.*, a.provider, a.external_id AS account FROM records r JOIN accounts a ON a.id = r.account_id ";
|
|
38855
|
+
const rowOf2 = /* @__PURE__ */ __name((key2) => sql2(`${SELECT2}WHERE a.provider = ? AND a.external_id = ? AND r.type = ? AND r.external_id = ?`).get(key2.provider, key2.account, key2.type, key2.externalId), "rowOf");
|
|
38856
|
+
return {
|
|
38857
|
+
write: /* @__PURE__ */ __name(async (source2, records2, { dryRun = false, chunk = 1e3 } = {}) => {
|
|
38858
|
+
if (!dryRun)
|
|
38859
|
+
return ingest(source2, records2, chunk);
|
|
38860
|
+
let result;
|
|
38861
|
+
const rollback = new Error("dry run");
|
|
38862
|
+
try {
|
|
38863
|
+
write(database, () => {
|
|
38864
|
+
result = ingest(source2, records2, chunk);
|
|
38865
|
+
throw rollback;
|
|
38866
|
+
});
|
|
38867
|
+
} catch (error) {
|
|
38868
|
+
if (error !== rollback)
|
|
38869
|
+
throw error;
|
|
38870
|
+
}
|
|
38871
|
+
return result;
|
|
38872
|
+
}, "write"),
|
|
38873
|
+
get: /* @__PURE__ */ __name(async (key2) => read(database, () => {
|
|
38874
|
+
const row2 = rowOf2(key2);
|
|
38875
|
+
return row2 ? sourceRecordOf(row2) : void 0;
|
|
38876
|
+
}), "get"),
|
|
38877
|
+
list: /* @__PURE__ */ __name(async ({ provider, account, type, waiting, flagged, limit = 100 }) => {
|
|
38878
|
+
if (!Number.isSafeInteger(limit) || limit < 1 || limit > 500)
|
|
38879
|
+
throw new CliError("validation_error", "a record list takes 1\u2013500 items");
|
|
38880
|
+
return read(database, () => {
|
|
38881
|
+
if (findAccountPk(context, { provider, account }) === void 0)
|
|
38882
|
+
return [];
|
|
38883
|
+
const rows = database.prepare(`${SELECT2}WHERE a.provider = ? AND a.external_id = ? AND (? IS NULL OR r.type = ?) AND (? IS NULL OR (r.entity_id IS NULL AND r.deleted_at IS NULL AND r.type IN ('invoice', 'payment'))) AND (? IS NULL OR (r.entity_id IS NOT NULL AND (r.deleted_at IS NOT NULL OR r.projected_fingerprint IS NOT r.fingerprint))) ORDER BY r.updated_at DESC, r.id DESC LIMIT ?`).all(provider, account, type ?? null, type ?? null, waiting ? 1 : null, flagged ? 1 : null, limit);
|
|
38884
|
+
return rows.map(sourceRecordOf);
|
|
38885
|
+
});
|
|
38886
|
+
}, "list"),
|
|
38887
|
+
map: /* @__PURE__ */ __name(async (key2, entity, by) => {
|
|
38888
|
+
if (by !== "owner")
|
|
38889
|
+
throw new CliError("permission_error", "only the owner says which entity a record is", {
|
|
38890
|
+
reason: "record.map-owner-only"
|
|
38891
|
+
});
|
|
38892
|
+
const proposed = [];
|
|
38893
|
+
const laterErrors = [];
|
|
38894
|
+
write(database, () => {
|
|
38895
|
+
const row2 = rowOf2(key2);
|
|
38896
|
+
if (!row2 || row2.deleted_at != null)
|
|
38897
|
+
throw new CliError("not_found", `no ${key2.type} ${key2.externalId} from ${key2.provider} ${key2.account}`);
|
|
38898
|
+
const thing = requiredThing(database, entity, "the entity");
|
|
38899
|
+
if (thing.type !== key2.type)
|
|
38900
|
+
refusal(`a ${key2.type} record maps to a ${key2.type}:, not ${entity}`, "record.map-type");
|
|
38901
|
+
if (row2.entity_id != null && !(row2.entity_type === thing.type && Number(row2.entity_id) === thing.id))
|
|
38902
|
+
refusal(`${key2.type} ${key2.externalId} is already ${entityRef(row2.entity_type, row2.entity_id)}`, "record.mapped");
|
|
38903
|
+
sql2("UPDATE records SET entity_type = ?, entity_id = ?, projected_fingerprint = fingerprint WHERE id = ?").run(thing.type, thing.id, Number(row2.id));
|
|
38904
|
+
const source2 = { provider: key2.provider, account: key2.account, batch_id: String(row2.batch_id) };
|
|
38905
|
+
completeDependents(Number(row2.id), source2, proposed, laterErrors);
|
|
38906
|
+
});
|
|
38907
|
+
return read(database, () => sourceRecordOf(rowOf2(key2)));
|
|
38908
|
+
}, "map")
|
|
38909
|
+
};
|
|
38910
|
+
}, "recordStoreOver");
|
|
38911
|
+
|
|
38912
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/ranges.js
|
|
38307
38913
|
var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to) => {
|
|
38308
38914
|
const touching = and(eq(syncRanges.chatId, chatKey), lte(syncRanges.fromKey, to + 1), gte(syncRanges.toKey, from2 - 1));
|
|
38309
38915
|
let merged = { from: from2, to };
|
|
@@ -38316,7 +38922,7 @@ var markRange = /* @__PURE__ */ __name(({ orm, now: now2 }, chatKey, from2, to)
|
|
|
38316
38922
|
}, "markRange");
|
|
38317
38923
|
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");
|
|
38318
38924
|
|
|
38319
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
38925
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/task-analysis-marks.js
|
|
38320
38926
|
var prefixOf2 = /* @__PURE__ */ __name(({ provider, account }) => `task_analysis:${provider}:${account}:`, "prefixOf");
|
|
38321
38927
|
var markOf = /* @__PURE__ */ __name((prefix, row2) => ({
|
|
38322
38928
|
chatId: String(row2.key).slice(prefix.length),
|
|
@@ -38337,7 +38943,7 @@ var setTaskAnalysisMark = /* @__PURE__ */ __name((database, account, { chatId, c
|
|
|
38337
38943
|
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);
|
|
38338
38944
|
}, "setTaskAnalysisMark");
|
|
38339
38945
|
|
|
38340
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
38946
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/task-rule-stops.js
|
|
38341
38947
|
var keyOf4 = /* @__PURE__ */ __name(({ provider, account }) => `task_rules_until:${provider}:${account}`, "keyOf");
|
|
38342
38948
|
var taskRulesStop = /* @__PURE__ */ __name((database, account) => {
|
|
38343
38949
|
const row2 = database.prepare("SELECT value FROM store_settings WHERE key = ?").get(keyOf4(account));
|
|
@@ -38347,7 +38953,7 @@ var setTaskRulesStop = /* @__PURE__ */ __name((database, account, until, now2) =
|
|
|
38347
38953
|
database.prepare("INSERT INTO store_settings (key, value, at) VALUES (?, ?, ?) ON CONFLICT (key) DO UPDATE SET value = excluded.value, at = excluded.at").run(keyOf4(account), JSON.stringify(until), now2);
|
|
38348
38954
|
}, "setTaskRulesStop");
|
|
38349
38955
|
|
|
38350
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
38956
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sync.js
|
|
38351
38957
|
var syncStoreOver = /* @__PURE__ */ __name((context) => {
|
|
38352
38958
|
const { database } = context;
|
|
38353
38959
|
const { accountPk: accountPk2, findAccountPk: findAccountPk2, chatKeyOf, chatPkFor: chatPkFor2, identityPk: identityPk2, writeMembers: writeMembers2, writeState: writeState2 } = keysOver(context);
|
|
@@ -38406,7 +39012,7 @@ var syncStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
38406
39012
|
};
|
|
38407
39013
|
}, "syncStoreOver");
|
|
38408
39014
|
|
|
38409
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
39015
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/tags.js
|
|
38410
39016
|
var tagsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
38411
39017
|
const { database } = context;
|
|
38412
39018
|
return {
|
|
@@ -38428,7 +39034,7 @@ var tagsStoreOver = /* @__PURE__ */ __name((context) => {
|
|
|
38428
39034
|
};
|
|
38429
39035
|
}, "tagsStoreOver");
|
|
38430
39036
|
|
|
38431
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
39037
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/image-chunks.js
|
|
38432
39038
|
var IS_IMAGE = sql`(a.kind = 'photo' OR a.mime LIKE 'image/%')`;
|
|
38433
39039
|
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
|
|
38434
39040
|
WHERE chat_id = ${chatKey} AND deleted_at IS NULL AND trim(text) <> '' AND id <> ${messagePk}
|
|
@@ -38555,7 +39161,7 @@ var savePictureChunks = /* @__PURE__ */ __name(({ orm, now: now2, database }, ac
|
|
|
38555
39161
|
dropUnusedVectors(database, released.map(({ hash: hash2 }) => hash2));
|
|
38556
39162
|
}, "savePictureChunks");
|
|
38557
39163
|
|
|
38558
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
39164
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/message-chunks.js
|
|
38559
39165
|
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,
|
|
38560
39166
|
EXISTS (SELECT 1 FROM embeddings v WHERE v.model = ${model} AND v.content_hash = k.content_hash) AS embedded
|
|
38561
39167
|
FROM messages m
|
|
@@ -38644,7 +39250,7 @@ var nearestMessages = /* @__PURE__ */ __name((context, accountPk2, { limit, quer
|
|
|
38644
39250
|
return plain2(best(found2));
|
|
38645
39251
|
}, "nearestMessages");
|
|
38646
39252
|
|
|
38647
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
39253
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/vectors.js
|
|
38648
39254
|
var accountVectorsOver = /* @__PURE__ */ __name((context, mail) => {
|
|
38649
39255
|
const { database } = context;
|
|
38650
39256
|
const { findAccountPk: findAccountPk2, findChatPk: findChatPk2, chatKeyOf } = keysOver(context);
|
|
@@ -38902,7 +39508,7 @@ var vectorsStoreOver = /* @__PURE__ */ __name((context, keyed) => ({
|
|
|
38902
39508
|
embeddedHashes: /* @__PURE__ */ __name(async (model, hashes) => embeddedHashes(context, model, hashes), "embeddedHashes")
|
|
38903
39509
|
}), "vectorsStoreOver");
|
|
38904
39510
|
|
|
38905
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
39511
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/store-tables.js
|
|
38906
39512
|
import { existsSync, readFileSync as readFileSync4 } from "node:fs";
|
|
38907
39513
|
import { dirname as dirname2, join as join2 } from "node:path";
|
|
38908
39514
|
var BOOKKEEPING = ["schema_migrations", "store_settings"];
|
|
@@ -38990,10 +39596,10 @@ var lastBackup = /* @__PURE__ */ __name((path) => {
|
|
|
38990
39596
|
}
|
|
38991
39597
|
}, "lastBackup");
|
|
38992
39598
|
|
|
38993
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
39599
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/providers.js
|
|
38994
39600
|
var registerProvider2 = /* @__PURE__ */ __name((store, entry2) => store.accounts.registerProvider(entry2), "registerProvider");
|
|
38995
39601
|
|
|
38996
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
39602
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/sqlite/store-contents.js
|
|
38997
39603
|
var COUNTED_TABLES = [
|
|
38998
39604
|
"accounts",
|
|
38999
39605
|
"chats",
|
|
@@ -39078,7 +39684,7 @@ var storeContents = /* @__PURE__ */ __name((database) => {
|
|
|
39078
39684
|
};
|
|
39079
39685
|
}, "storeContents");
|
|
39080
39686
|
|
|
39081
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
39687
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.559.0_@wirecat+cli-base@0.75.0_commander@15.0.0_esbuild@0.28.2_type_907a8c00de2c01e4b50d7050f36772c6/node_modules/@wirecat/cli-core/dist/store/store.js
|
|
39082
39688
|
var openStore = /* @__PURE__ */ __name(async (options = {}) => {
|
|
39083
39689
|
const context = await openStoreContext(options);
|
|
39084
39690
|
try {
|
|
@@ -39142,6 +39748,7 @@ var storeOver = /* @__PURE__ */ __name((context) => {
|
|
|
39142
39748
|
};
|
|
39143
39749
|
const facts2 = once3(() => factsStoreOver(context));
|
|
39144
39750
|
const finance = once3(() => financeStoreOver(context));
|
|
39751
|
+
const records2 = once3(() => recordStoreOver(context));
|
|
39145
39752
|
const memories2 = once3(() => memoriesStoreOver(context));
|
|
39146
39753
|
const proposedActions2 = once3(() => proposedActionsStoreOver(context));
|
|
39147
39754
|
const agentActions2 = once3(() => agentActionsStoreOver(context, pruneLogsWhenDue));
|
|
@@ -39245,6 +39852,9 @@ var storeOver = /* @__PURE__ */ __name((context) => {
|
|
|
39245
39852
|
get finance() {
|
|
39246
39853
|
return finance();
|
|
39247
39854
|
},
|
|
39855
|
+
get records() {
|
|
39856
|
+
return records2();
|
|
39857
|
+
},
|
|
39248
39858
|
get memories() {
|
|
39249
39859
|
return memories2();
|
|
39250
39860
|
},
|
|
@@ -39426,6 +40036,10 @@ export {
|
|
|
39426
40036
|
SnapshotBudget,
|
|
39427
40037
|
projectAnnotationSnapshot,
|
|
39428
40038
|
previewAnnotationSnapshot,
|
|
40039
|
+
pointerOf,
|
|
40040
|
+
recordErrors,
|
|
40041
|
+
envelopeErrors,
|
|
40042
|
+
envelopeOfJsonl,
|
|
39429
40043
|
readStoreTables,
|
|
39430
40044
|
fileFacts,
|
|
39431
40045
|
registerProvider2 as registerProvider,
|