@wirecat/mail-cli 0.23.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/bin/mail.js +2 -2
  3. package/dist/bundle/{all-profiles-CI32WFEV.js → all-profiles-VS7P6DJY.js} +11 -11
  4. package/dist/bundle/{anthropic-ICSOMJIN.js → anthropic-C5JXKGBS.js} +16 -7
  5. package/dist/bundle/{app-server-3F4ZB7DH.js → app-server-HU3LVU42.js} +51 -50
  6. package/dist/bundle/{bun-7AHNFZMZ.js → bun-QLFX47WZ.js} +2 -2
  7. package/dist/bundle/{bun-sqlite-UIWRS4HI.js → bun-sqlite-W4PGAKVY.js} +5 -5
  8. package/dist/bundle/{chunk-ETIUB2DF.js → chunk-3FD3IATT.js} +6 -6
  9. package/dist/bundle/{chunk-6FSLEARF.js → chunk-3KSK5BBB.js} +2 -2
  10. package/dist/bundle/{chunk-I3YNNSGB.js → chunk-4QNHAM3J.js} +2 -2
  11. package/dist/bundle/{chunk-7SWWVDEZ.js → chunk-4W4EVVL4.js} +61 -21
  12. package/dist/bundle/{chunk-JDKC7EXM.js → chunk-5NLHDK7P.js} +50 -46
  13. package/dist/bundle/{chunk-AHRHP2H2.js → chunk-5X3GU5LI.js} +6 -6
  14. package/dist/bundle/{chunk-KNRONMVG.js → chunk-64ZG5ERD.js} +2 -2
  15. package/dist/bundle/{chunk-RIAZTS6C.js → chunk-6PWCQKMD.js} +12 -12
  16. package/dist/bundle/{chunk-4PNIZUEC.js → chunk-6VV7J2TN.js} +36 -57
  17. package/dist/bundle/{chunk-5AS5N7V5.js → chunk-A6J4MPTI.js} +3 -1
  18. package/dist/bundle/{chunk-ZYHBMDNU.js → chunk-AUTX2MLF.js} +11 -9
  19. package/dist/bundle/{chunk-5Y2WRUYP.js → chunk-B72343TK.js} +2 -2
  20. package/dist/bundle/{chunk-7SIWMF77.js → chunk-BFQQV22T.js} +1 -1
  21. package/dist/bundle/chunk-C3NYJW6B.js +1542 -0
  22. package/dist/bundle/{chunk-7ZDH2XEY.js → chunk-C5BMCLCQ.js} +4 -4
  23. package/dist/bundle/{chunk-JO4BJYVE.js → chunk-DW3F6DUW.js} +1 -1
  24. package/dist/bundle/chunk-EKGRNFYQ.js +18 -0
  25. package/dist/bundle/{chunk-4YTX5YAU.js → chunk-FKWUUCX2.js} +1361 -1539
  26. package/dist/bundle/{chunk-LLYVBO3R.js → chunk-FNLUKODV.js} +19 -19
  27. package/dist/bundle/{chunk-HGV7DSSA.js → chunk-H5FJTHVA.js} +2 -2
  28. package/dist/bundle/{chunk-3QVGB2CI.js → chunk-HBZAJINU.js} +4 -4
  29. package/dist/bundle/{chunk-BT7UUI6E.js → chunk-IRUN4XOV.js} +2 -2
  30. package/dist/bundle/{chunk-4TKQIXND.js → chunk-JMLIKXFO.js} +2 -2
  31. package/dist/bundle/{chunk-XV3M3NAN.js → chunk-JOQGJUFT.js} +1 -1
  32. package/dist/bundle/{chunk-NEDYKKJJ.js → chunk-JWMLMAHP.js} +4 -4
  33. package/dist/bundle/{chunk-5QQOUYNA.js → chunk-KGOVFEWZ.js} +3 -3
  34. package/dist/bundle/{chunk-NKDYHAHP.js → chunk-KV4VTKF3.js} +3 -3
  35. package/dist/bundle/chunk-LVGX7VTD.js +138 -0
  36. package/dist/bundle/{chunk-3DQYO7FB.js → chunk-MCPOZNWG.js} +1 -1
  37. package/dist/bundle/{chunk-SCH3NC5X.js → chunk-MTO6YVMN.js} +3 -3
  38. package/dist/bundle/{chunk-R4RAWEMV.js → chunk-NCRSE647.js} +286 -48
  39. package/dist/bundle/{chunk-UTLJQG6Q.js → chunk-NSIN5IM4.js} +8 -8
  40. package/dist/bundle/{chunk-IMIY7HQB.js → chunk-NWKKPDZV.js} +2 -2
  41. package/dist/bundle/chunk-O373QEAJ.js +1243 -0
  42. package/dist/bundle/{chunk-OMW37FXK.js → chunk-OQW6GHUA.js} +1 -1
  43. package/dist/bundle/{chunk-D6WTKSRA.js → chunk-PRQ2U7HF.js} +2 -2
  44. package/dist/bundle/{chunk-HRIYU2HJ.js → chunk-PT6MF2VU.js} +469 -120
  45. package/dist/bundle/{chunk-B6GITVDX.js → chunk-Q4OKEN3B.js} +7 -7
  46. package/dist/bundle/{chunk-ELGEHZK2.js → chunk-Q6K2XUGU.js} +1 -1
  47. package/dist/bundle/{chunk-CNYQ3TTZ.js → chunk-QI3PXUOJ.js} +43 -595
  48. package/dist/bundle/{chunk-SGMENSI6.js → chunk-QVMOEB3I.js} +391 -16
  49. package/dist/bundle/{chunk-S2U5BXWS.js → chunk-RLQZFZLK.js} +80 -5
  50. package/dist/bundle/{chunk-SETCGPFG.js → chunk-RN7OI5KL.js} +9 -8
  51. package/dist/bundle/{chunk-5J4WNTTM.js → chunk-RNZKQMFY.js} +14 -14
  52. package/dist/bundle/{chunk-WQRX4RQS.js → chunk-RUASZW3M.js} +5 -5
  53. package/dist/bundle/{chunk-UHC5I3JV.js → chunk-RX5CJ55S.js} +1 -1
  54. package/dist/bundle/{chunk-FHCOGR7S.js → chunk-SWKQ6IAR.js} +3 -3
  55. package/dist/bundle/{chunk-KJQZXCNK.js → chunk-TI7ZIPA2.js} +4 -4
  56. package/dist/bundle/{chunk-7DFWXIY5.js → chunk-TLEBSMC7.js} +1997 -768
  57. package/dist/bundle/{chunk-5Z7LZAVP.js → chunk-U6MMQNNK.js} +6 -6
  58. package/dist/bundle/{chunk-HN6PB7F5.js → chunk-VNKWSCN7.js} +99 -42
  59. package/dist/bundle/{chunk-DALBYUPC.js → chunk-VUBZFMGP.js} +2 -2
  60. package/dist/bundle/{chunk-XP5FBDIG.js → chunk-VVL4MKYH.js} +1 -1
  61. package/dist/bundle/{chunk-TEL2OMS5.js → chunk-WOX7FZJP.js} +686 -220
  62. package/dist/bundle/{chunk-2BAO4T4Z.js → chunk-X47BL4M5.js} +13 -13
  63. package/dist/bundle/{chunk-GOMJNH56.js → chunk-X7J3TTDO.js} +8 -8
  64. package/dist/bundle/{chunk-FVKZ55I2.js → chunk-XBEO472U.js} +29976 -16640
  65. package/dist/bundle/{chunk-UA4BOLIY.js → chunk-YA45XV6G.js} +4 -4
  66. package/dist/bundle/{chunk-FIZWQTUC.js → chunk-YBQ5AYLZ.js} +3 -3
  67. package/dist/bundle/{chunk-AFPETMXZ.js → chunk-YI544LHI.js} +13 -136
  68. package/dist/bundle/chunk-ZO4MQWIK.js +188 -0
  69. package/dist/bundle/{chunk-7OVVX4F4.js → chunk-ZR2BDNGG.js} +1 -1
  70. package/dist/bundle/command-contract-ERYYPAD2.js +35 -0
  71. package/dist/bundle/command-server-entry-5E3PPDE5.js +164 -0
  72. package/dist/bundle/{decode-BJXABRAN.js → decode-AVWV7SVZ.js} +5 -5
  73. package/dist/bundle/{dispatch-G4CYFWQ2.js → dispatch-BXPHSNK5.js} +10 -10
  74. package/dist/bundle/{dist-LLEA6R4V.js → dist-PIOOKBWT.js} +78 -44
  75. package/dist/bundle/{echarts-YPTKBOZV.js → echarts-7K6YQV52.js} +2 -2
  76. package/dist/bundle/{embed-DMROTI5M.js → embed-4NT76GJK.js} +6 -6
  77. package/dist/bundle/{embedder-DWMHXCHJ.js → embedder-ITQFF7EN.js} +9 -9
  78. package/dist/bundle/{failure-FFPK2WYB.js → failure-3Q65JOPD.js} +2 -2
  79. package/dist/bundle/{first-run-FQOEF2IO.js → first-run-PM74YU4X.js} +11 -11
  80. package/dist/bundle/first-screen-WBVGVSMY.js +33 -0
  81. package/dist/bundle/{instructions-OGKMROLD.js → instructions-JDSITYHV.js} +1 -1
  82. package/dist/bundle/mail.js +37 -13
  83. package/dist/bundle/{mcp-CFVG2OUS.js → mcp-7KQUJNFN.js} +2 -2
  84. package/dist/bundle/{node-HIKYE546.js → node-D6YIJOJI.js} +2 -2
  85. package/dist/bundle/{node-sqlite-3GJAG7VO.js → node-sqlite-PJOHHB4X.js} +6 -6
  86. package/dist/bundle/{oauth-H3DB6IHI.js → oauth-BOWJ3IBT.js} +7 -7
  87. package/dist/bundle/{open-DJ2PRG74.js → open-FIAKKZMW.js} +5 -5
  88. package/dist/bundle/{openai-MDBRYB55.js → openai-QL54VVLC.js} +16 -37
  89. package/dist/bundle/{process-4LBD72JH.js → process-AYHK7WRC.js} +1 -1
  90. package/dist/bundle/{program-F6WK6RX4.js → program-6FKWOTBK.js} +3206 -1603
  91. package/dist/bundle/{prompt-UNPUG6SO.js → prompt-XJZCBELC.js} +5 -5
  92. package/dist/bundle/{recognize-DMIO4PDB.js → recognize-OQKWAHBY.js} +4 -4
  93. package/dist/bundle/{remote-24HJA72D.js → remote-NLVUZ5WK.js} +7 -7
  94. package/dist/bundle/{rerank-PTNCHHIU.js → rerank-NRPZDTJ7.js} +7 -7
  95. package/dist/bundle/{serve-T6JHM2YD.js → serve-O4YUI7F6.js} +9 -9
  96. package/dist/bundle/server-6OT5ZEWL.js +66 -0
  97. package/dist/bundle/{server-BWEYRUR3.js → server-WAL3M4OO.js} +40 -40
  98. package/dist/bundle/{sqlite-runtime-ZJ4EH5ZM.js → sqlite-runtime-5YHGI4D4.js} +6 -6
  99. package/dist/bundle/{state-KSN4OFYW.js → state-WYYOJ7KK.js} +6 -6
  100. package/dist/bundle/{store-OIEZJEA7.js → store-6BJO3F2J.js} +22 -16
  101. package/dist/bundle/{store-GVBW2ZFK.js → store-X72GOJHD.js} +50 -22
  102. package/dist/bundle/store-maintenance-command-ASS7RBYC.js +54 -0
  103. package/dist/commands/rules.d.ts.map +1 -1
  104. package/dist/commands/rules.js +29 -7
  105. package/dist/commands/rules.js.map +1 -1
  106. package/dist/commands/sync.d.ts +0 -1
  107. package/dist/commands/sync.d.ts.map +1 -1
  108. package/dist/commands/sync.js +8 -2
  109. package/dist/commands/sync.js.map +1 -1
  110. package/dist/config.d.ts +4 -0
  111. package/dist/config.d.ts.map +1 -1
  112. package/dist/version.d.ts +1 -1
  113. package/dist/version.js +1 -1
  114. package/package.json +4 -4
  115. package/dist/bundle/chunk-5AQ4S4TZ.js +0 -12172
  116. package/dist/bundle/chunk-B4MWHI2V.js +0 -380
  117. package/dist/bundle/command-contract-UIRWJVEY.js +0 -35
  118. package/dist/bundle/first-screen-B6LF5464.js +0 -33
  119. package/dist/bundle/server-VUQNR5ZD.js +0 -65
  120. package/dist/bundle/store-maintenance-command-KJ54HLUQ.js +0 -54
  121. /package/dist/bundle/{chunk-QZLK2ISN.js → chunk-YVNHQFLC.js} +0 -0
@@ -0,0 +1,1542 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ CATALOG_KINDS,
5
+ CONTRACT_KINDS,
6
+ CONTRACT_STATUSES,
7
+ DEAL_KINDS,
8
+ DEAL_STATUSES,
9
+ INVOICE_DIRECTIONS,
10
+ MONEY_DIRECTIONS,
11
+ ORDER_DIRECTIONS,
12
+ ORDER_PURPOSES,
13
+ ORDER_STATUSES,
14
+ SUBSCRIPTION_STATUSES,
15
+ TRANSACTION_STATUSES,
16
+ WALLET_KINDS,
17
+ looksLikeReference,
18
+ parseReference,
19
+ providerLabel,
20
+ providerNamed
21
+ } from "./chunk-WOX7FZJP.js";
22
+ import {
23
+ CliError,
24
+ singleLine
25
+ } from "./chunk-VUBZFMGP.js";
26
+ import {
27
+ __name
28
+ } from "./chunk-ZVVMGPBJ.js";
29
+
30
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/domain/ref-arguments.js
31
+ var TAKES = {
32
+ chat: "a chat: chat:<provider>/<account>/<chat>, its id or its title",
33
+ message: "a message: msg:<provider>/<account>/<chat>/<message>, or a chat and the message's id"
34
+ };
35
+ var article = /* @__PURE__ */ __name((word) => /^[aeiou]/.test(word) ? "an" : "a", "article");
36
+ var wrongKind = /* @__PURE__ */ __name((text2, kind, takes) => new CliError("validation_error", `${text2} names ${article(kind)} ${kind}; this takes ${TAKES[takes]}`, {
37
+ reason: "ref.wrong-kind"
38
+ }), "wrongKind");
39
+ var wrongProvider = /* @__PURE__ */ __name((text2, provider, kind) => {
40
+ const entry = providerNamed(provider);
41
+ const command = entry?.command;
42
+ const opens = kind === "entity" ? void 0 : entry?.opens?.[kind];
43
+ const how = command && opens ? `open it with ${command} <profile> ${opens} ${text2}` : "open it with its own CLI";
44
+ const label = providerLabel(provider);
45
+ return new CliError("validation_error", `${text2} is ${article(label.toLowerCase())} ${label} ${kind}; ${how}`, {
46
+ reason: "ref.wrong-provider"
47
+ });
48
+ }, "wrongProvider");
49
+ var chatReferenceOf = /* @__PURE__ */ __name((text2, provider, takes = "chat") => {
50
+ const trimmed = text2.trim();
51
+ if (!looksLikeReference(trimmed))
52
+ return void 0;
53
+ const reference = parseReference(trimmed);
54
+ if (reference.type !== "chat" && reference.type !== "message")
55
+ throw wrongKind(trimmed, reference.type, takes);
56
+ if (reference.provider !== provider)
57
+ throw wrongProvider(trimmed, reference.provider, reference.type);
58
+ const found = {
59
+ text: trimmed,
60
+ provider: reference.provider,
61
+ account: reference.account,
62
+ chat: reference.chat,
63
+ ...reference.type === "message" ? { message: reference.message } : {}
64
+ };
65
+ return found;
66
+ }, "chatReferenceOf");
67
+ var contactReferenceOf = /* @__PURE__ */ __name((text2, provider) => {
68
+ const trimmed = text2.trim();
69
+ if (!trimmed.startsWith("contact:"))
70
+ return void 0;
71
+ const reference = parseReference(trimmed);
72
+ if (reference.type !== "contact")
73
+ return void 0;
74
+ if (provider !== void 0 && reference.provider !== provider)
75
+ throw wrongProvider(trimmed, reference.provider, reference.type);
76
+ return reference.id;
77
+ }, "contactReferenceOf");
78
+ var wrongAccount = /* @__PURE__ */ __name((reference, scope, profiles) => {
79
+ const here = scope.account === void 0 ? "the account of this profile is not known yet" : `${scope.profile === void 0 ? "this profile" : `profile ${scope.profile}`} is account ${scope.account}`;
80
+ const others = profiles === void 0 ? "" : `. Profiles signed in to ${reference.account}: ${profiles.length > 0 ? profiles.join(", ") : "none here"}`;
81
+ return new CliError("validation_error", `${reference.text} belongs to account ${reference.account}; ${here}${others}`, { reason: "ref.wrong-account" });
82
+ }, "wrongAccount");
83
+ var ensureAccount = /* @__PURE__ */ __name(async (reference, scope, profilesOn) => {
84
+ if (scope.account !== void 0 && scope.account === reference.account)
85
+ return;
86
+ const profiles = await profilesOn?.(reference.account).catch(() => void 0);
87
+ throw wrongAccount(reference, scope, profiles);
88
+ }, "ensureAccount");
89
+
90
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/resolve.js
91
+ var isId = /* @__PURE__ */ __name((reference) => /^-?\d+$/.test(reference.trim()), "isId");
92
+ var foldName = /* @__PURE__ */ __name((name) => name.normalize("NFC").replace(/[\uFE0E\uFE0F\u200D]/g, "").toLowerCase().replaceAll("\u0451", "\u0435"), "foldName");
93
+ var pickChat = /* @__PURE__ */ __name((reference, chats) => {
94
+ const wanted = foldName(reference.trim());
95
+ const matches = chats.filter((chat) => chat.title !== null && foldName(chat.title).includes(wanted));
96
+ if (matches.length === 1 && matches[0])
97
+ return matches[0];
98
+ if (matches.length === 0)
99
+ throw new CliError("not_found", `no chat matches "${reference}"`);
100
+ throw ambiguous(reference, "chats", matches.map((chat) => ({ id: chat.id, title: chat.title })), ({ title }) => singleLine(String(title)));
101
+ }, "pickChat");
102
+ var pickPerson = /* @__PURE__ */ __name((reference, people) => {
103
+ const trimmed = reference.trim();
104
+ const contact = contactReferenceOf(trimmed, people.provider);
105
+ if (contact !== void 0) {
106
+ const named = people.get(contact);
107
+ if (named)
108
+ return named;
109
+ throw new CliError("not_found", `no person ${contact} in what this account has seen`);
110
+ }
111
+ const known = people.get(trimmed);
112
+ if (known)
113
+ return known;
114
+ if (isId(trimmed))
115
+ throw new CliError("not_found", `no person ${trimmed} in what this account has seen`);
116
+ const wanted = foldName(trimmed.replace(/^@/, ""));
117
+ const everyone = people.all().toSorted((a, b) => (a.name ?? "").localeCompare(b.name ?? ""));
118
+ const fields = /* @__PURE__ */ __name((person) => [person.alias, person.name, person.username].filter(isPresent).map(foldName), "fields");
119
+ const exact = everyone.filter((person) => fields(person).includes(wanted));
120
+ const matches = exact.length > 0 ? exact : everyone.filter((person) => fields(person).some((one) => one.includes(wanted)));
121
+ if (matches.length === 1 && matches[0])
122
+ return matches[0];
123
+ if (matches.length === 0)
124
+ throw new CliError("not_found", `nobody matches "${reference}"`);
125
+ throw ambiguous(reference, "people", matches.map(({ id, name, username }) => ({ id, name, username })), ({ name, username }) => singleLine([name, username && `@${username}`].filter(isPresent).join(" ")));
126
+ }, "pickPerson");
127
+ var ambiguous = /* @__PURE__ */ __name((reference, what, candidates, label) => {
128
+ const width = Math.max(...candidates.map(({ id }) => id.length));
129
+ const lines = candidates.map((candidate) => ` ${candidate.id.padEnd(width)} ${label(candidate)}`).join("\n");
130
+ return new CliError("validation_error", `"${singleLine(reference)}" matches ${candidates.length} ${what} \u2014 name one by its id:
131
+ ${lines}`, { candidates });
132
+ }, "ambiguous");
133
+ var isPresent = /* @__PURE__ */ __name((value) => value !== null && value !== void 0, "isPresent");
134
+
135
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/domain/record-fields.js
136
+ var DECIMAL_PATTERN = "^[0-9]{1,16}(\\.[0-9]{1,6})?$";
137
+ var SIGNED_DECIMAL = "^-?[0-9]{1,16}(\\.[0-9]{1,6})?$";
138
+ var DAY = "^[0-9]{4}-[0-9]{2}-[0-9]{2}$";
139
+ var INSTANT = "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}(:[0-9]{2}(\\.[0-9]{1,9})?)?(Z|[+-][0-9]{2}:[0-9]{2})$";
140
+ var text = /* @__PURE__ */ __name((description, maxLength = 2e3) => ({
141
+ type: "string",
142
+ minLength: 1,
143
+ maxLength,
144
+ ...description ? { description } : {}
145
+ }), "text");
146
+ var decimal = /* @__PURE__ */ __name((description) => ({ type: "string", pattern: DECIMAL_PATTERN, description }), "decimal");
147
+ var signedDecimal = /* @__PURE__ */ __name((description) => ({
148
+ type: "string",
149
+ pattern: SIGNED_DECIMAL,
150
+ description
151
+ }), "signedDecimal");
152
+ var day = /* @__PURE__ */ __name((description) => ({ type: "string", pattern: DAY, description }), "day");
153
+ var instant = /* @__PURE__ */ __name((description) => ({ type: "string", pattern: INSTANT, description }), "instant");
154
+ var enumOf = /* @__PURE__ */ __name((values, description) => ({
155
+ type: "string",
156
+ enum: values,
157
+ ...description ? { description } : {}
158
+ }), "enumOf");
159
+ var currency = { type: "string", pattern: "^[A-Za-z]{3}$", description: "ISO 4217 code" };
160
+ var nullable = /* @__PURE__ */ __name((schema) => {
161
+ if (schema.type === void 0)
162
+ return schema;
163
+ const types = typeof schema.type === "string" ? [schema.type] : [...schema.type];
164
+ return {
165
+ ...schema,
166
+ type: types.includes("null") ? types : [...types, "null"],
167
+ ...schema.enum ? { enum: [...schema.enum, null] } : {}
168
+ };
169
+ }, "nullable");
170
+ var objectOf = /* @__PURE__ */ __name((properties, { required, description } = {}) => ({
171
+ type: "object",
172
+ ...description ? { description } : {},
173
+ properties: Object.fromEntries(Object.entries(properties).map(([key, schema]) => [key, required?.includes(key) ? schema : nullable(schema)])),
174
+ ...required?.length ? { required } : {},
175
+ additionalProperties: true
176
+ }), "objectOf");
177
+ var arrayOf = /* @__PURE__ */ __name((item, maxItems, description) => ({
178
+ type: "array",
179
+ items: item,
180
+ maxItems,
181
+ description
182
+ }), "arrayOf");
183
+ var isObject = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isObject");
184
+
185
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/domain/record-types.js
186
+ var kept = /* @__PURE__ */ __name((description) => ({ description }), "kept");
187
+ var PARTY = ["person", "organization"];
188
+ var ORGANIZATION = ["organization"];
189
+ var lineItem = objectOf({
190
+ description: text("What the line is for; the product's name when left out", 2e3),
191
+ quantity: decimal("A decimal, 1 when left out"),
192
+ unit_price: decimal("A decimal in the parent's currency"),
193
+ amount: decimal("A decimal in the parent's currency: quantity \xD7 unit price"),
194
+ // Untyped: with options.lines text an invoice line's product is data, whatever v1 sent in it.
195
+ product: { description: "The product record's external id in this account, read with options.lines products" },
196
+ product_ref: { type: "string", pattern: "^product:[1-9][0-9]*$", description: "A product: ref of the store" }
197
+ });
198
+ var SMS_DIRECTIONS = ["in", "out"];
199
+ var CALL_DIRECTIONS = ["in", "out", "missed"];
200
+ var phoneFields = {
201
+ phone: text("The other side's number as the phone shows it: read to E.164 with the store's phone_countries", 64),
202
+ name: text("The other side's name as the phone shows it", 200)
203
+ };
204
+ var COUNTERPART = { counterpart: { targets: ["person"], linked: true } };
205
+ var linesIn = /* @__PURE__ */ __name((table, parent) => ({ table, parent, references: { product: "product" }, refs: { product_ref: "product" } }), "linesIn");
206
+ var dealFields = /* @__PURE__ */ __name((kind) => objectOf({
207
+ title: text(`The ${kind}'s title`, 200),
208
+ pipeline: text("The pipeline record's external id in this account", 512),
209
+ stage: text("The stage's external id in that pipeline", 512),
210
+ status: enumOf(DEAL_STATUSES, "Left out, the stage's outcome says it"),
211
+ amount: decimal("A decimal in currency"),
212
+ currency,
213
+ close_date: day("When it is expected to close"),
214
+ closed_date: day("When it was won or lost"),
215
+ closed_reason: text("Why it was won or lost", 2e3),
216
+ url: text("The source's page for it", 2e3)
217
+ }, { required: ["title", "pipeline", "stage"] }), "dealFields");
218
+ var RECORD_TYPES = {
219
+ invoice: {
220
+ table: "invoices",
221
+ review: "proposal",
222
+ update: "flag",
223
+ tombstone: true,
224
+ fields: objectOf({
225
+ direction: enumOf(INVOICE_DIRECTIONS),
226
+ number: text("The invoice's number", 80),
227
+ currency,
228
+ issue_date: day("The day it was issued"),
229
+ due_date: day("The day it is due"),
230
+ total: decimal("The printed total: refused when it is not the sum of the lines"),
231
+ lines: arrayOf(lineItem, 500, "The invoice's lines")
232
+ }),
233
+ roles: {
234
+ issuer: { targets: PARTY, v1: true, column: "issuer", pair: true },
235
+ counterparty: { targets: PARTY, v1: true, column: "counterparty", pair: true },
236
+ project: { targets: ["project"], v1: true, column: "project_id" },
237
+ contract: { targets: ["contract"], column: "contract_id" },
238
+ subscription: { targets: ["subscription"], column: "subscription_id" }
239
+ },
240
+ nested: { lines: linesIn("invoice_lines", "invoice_id") }
241
+ },
242
+ payment: {
243
+ table: "payments",
244
+ review: "proposal",
245
+ update: "re-settle",
246
+ tombstone: true,
247
+ fields: objectOf({
248
+ direction: enumOf(MONEY_DIRECTIONS),
249
+ amount: decimal("A decimal in currency"),
250
+ currency,
251
+ date: day("The day it was paid"),
252
+ reference: text("The payment's reference", 2e3)
253
+ }),
254
+ roles: {
255
+ payer: { targets: PARTY, v1: true, column: "payer", pair: true },
256
+ payee: { targets: PARTY, v1: true, column: "payee", pair: true },
257
+ project: { targets: ["project"], v1: true, column: "project_id" },
258
+ settles: { targets: ["invoice"], many: true, amount: true, v1: true },
259
+ refund_of: { targets: ["payment"], column: "refund_of" },
260
+ subscription: { targets: ["subscription"], column: "subscription_id" }
261
+ }
262
+ },
263
+ person: {
264
+ table: "persons",
265
+ review: "identity",
266
+ update: "in-place",
267
+ tombstone: false,
268
+ fields: objectOf({
269
+ name: kept("The person's name"),
270
+ email: kept("E-mail addresses, one or a list: an exact one links the record to the one person who has it"),
271
+ phone: kept("Phone numbers, one or a list: an exact one, read to E.164, links like an e-mail"),
272
+ position: kept("The job title, kept beside each member-of as its position: never the role")
273
+ }),
274
+ roles: { "member-of": { targets: ORGANIZATION, relationship: "member-of", kept: true } }
275
+ },
276
+ organization: {
277
+ table: "organizations",
278
+ review: "identity",
279
+ update: "in-place",
280
+ tombstone: true,
281
+ fields: objectOf({
282
+ name: kept("The organization's name"),
283
+ identifiers: kept("Strong identifiers, a list of {scheme, value}: scheme email, domain, tax-id:<cc> or registration:<cc>. One that another organization has links the record to it; any other item is kept as data")
284
+ }),
285
+ roles: {
286
+ "customer-of": { targets: ORGANIZATION, relationship: "customer-of", kept: true },
287
+ "partner-of": { targets: ORGANIZATION, relationship: "partner-of", kept: true }
288
+ }
289
+ },
290
+ project: {
291
+ table: "projects",
292
+ review: "identity",
293
+ update: "in-place",
294
+ tombstone: true,
295
+ fields: objectOf({
296
+ name: kept("The project's name"),
297
+ key: kept("The project's key: an existing project with it is this one"),
298
+ description: kept("What the project is")
299
+ }),
300
+ roles: { organization: { targets: ORGANIZATION, column: "organization_id" } }
301
+ },
302
+ order: {
303
+ table: "orders",
304
+ review: "proposal",
305
+ update: "re-propose",
306
+ tombstone: true,
307
+ fields: objectOf({
308
+ number: text("The order's number at the supplier", 80),
309
+ direction: enumOf(ORDER_DIRECTIONS, "purchase when left out; in a sale the owner is the supplier"),
310
+ purpose: enumOf(ORDER_PURPOSES, "business when left out"),
311
+ status: enumOf(ORDER_STATUSES, "placed when left out"),
312
+ supplier_name: text("The shop or supplier as the source names it", 200),
313
+ order_date: day("The day it was ordered"),
314
+ fulfilled_date: day("The day it was delivered"),
315
+ currency,
316
+ total: decimal("With lines, their sum"),
317
+ source_url: text("The order's page at the shop", 2e3),
318
+ lines: arrayOf(lineItem, 500, "The order's lines")
319
+ }),
320
+ roles: {
321
+ customer: { targets: PARTY, column: "customer", pair: true },
322
+ supplier: { targets: PARTY, column: "supplier", pair: true },
323
+ project: { targets: ["project"], column: "project_id" },
324
+ contract: { targets: ["contract"], column: "contract_id" },
325
+ deal: { targets: ["deal"], column: "deal_id" },
326
+ invoice: { targets: ["invoice"], column: "invoice_id" },
327
+ payment: { targets: ["payment"], column: "payment_id" }
328
+ },
329
+ nested: { lines: linesIn("order_lines", "order_id") }
330
+ },
331
+ product: {
332
+ table: "catalog_items",
333
+ review: "direct",
334
+ update: "in-place",
335
+ tombstone: true,
336
+ fields: objectOf({
337
+ kind: enumOf(CATALOG_KINDS, "product when left out"),
338
+ name: text("The product's name", 200),
339
+ sku: text("The supplier's code for it", 80),
340
+ unit: text("hour, pcs, month: free text", 40),
341
+ unit_price: decimal("A decimal in currency"),
342
+ currency,
343
+ description: text("What it is", 2e3),
344
+ archived_date: day("No longer sold from this day")
345
+ }, { required: ["name"] }),
346
+ roles: { supplier: { targets: PARTY, column: "supplier", pair: true } }
347
+ },
348
+ contract: {
349
+ table: "contracts",
350
+ review: "valued-proposal",
351
+ update: "re-propose",
352
+ tombstone: true,
353
+ fields: objectOf({
354
+ name: text("The contract's name", 200),
355
+ number: text("The contract's number", 80),
356
+ kind: enumOf(CONTRACT_KINDS),
357
+ status: enumOf(CONTRACT_STATUSES, "active when left out"),
358
+ signed_date: day("The day it was signed"),
359
+ effective_date: day("The day it starts"),
360
+ expiration_date: day("The day it ends; open-ended when left out"),
361
+ auto_renew: { type: "boolean", description: "Whether it renews itself" },
362
+ renewal: { type: "string", pattern: "^[1-9][0-9]{0,2}-(day|week|month|year)$", description: "1-year" },
363
+ notice_days: { type: "integer", minimum: 0, maximum: 3650, description: "Days of notice before it ends" },
364
+ terms: text("Renewal, cancellation and other terms, as text", 2e4),
365
+ value: decimal("A decimal in currency: the contract is then a proposal"),
366
+ currency
367
+ }, { required: ["name", "kind"] }),
368
+ roles: {
369
+ project: { targets: ["project"], column: "project_id" },
370
+ deal: { targets: ["deal"], column: "deal_id" },
371
+ party: { targets: PARTY, many: true, relationship: "related-to", kept: true },
372
+ document: { targets: ["document"], many: true, kept: true }
373
+ }
374
+ },
375
+ subscription: {
376
+ table: "subscriptions",
377
+ review: "proposal",
378
+ update: "re-propose",
379
+ tombstone: true,
380
+ fields: objectOf({
381
+ name: text("Its name; the product's when left out", 200),
382
+ direction: enumOf(INVOICE_DIRECTIONS, "receivable: the owner bills it; payable: the owner pays it"),
383
+ status: enumOf(SUBSCRIPTION_STATUSES),
384
+ interval: { type: "string", pattern: "^[1-9][0-9]{0,2}-(day|week|month|year)$", description: "1-month" },
385
+ start_date: day("The first day"),
386
+ trial_end_date: day("The trial's last day"),
387
+ next_renewal_date: day("The next renewal"),
388
+ cancelled_date: day("The day it was cancelled"),
389
+ end_date: day("The last day"),
390
+ prices: arrayOf(objectOf({
391
+ amount: decimal("A decimal in currency"),
392
+ currency,
393
+ effective_from: day("The day the price starts; the subscription's start when left out")
394
+ }, { required: ["amount", "currency"] }), 100, "Its prices, each from a day; a price is never overwritten")
395
+ }, { required: ["direction", "interval", "start_date"] }),
396
+ roles: {
397
+ supplier: { targets: PARTY, column: "supplier", pair: true },
398
+ customer: { targets: PARTY, column: "customer", pair: true },
399
+ product: { targets: ["product"], column: "catalog_item_id" },
400
+ contract: { targets: ["contract"], column: "contract_id" },
401
+ project: { targets: ["project"], column: "project_id" }
402
+ },
403
+ nested: { prices: { table: "subscription_prices", parent: "subscription_id" } }
404
+ },
405
+ wallet: {
406
+ table: "financial_accounts",
407
+ review: "direct",
408
+ update: "in-place",
409
+ tombstone: true,
410
+ fields: objectOf({
411
+ name: text("The account's name", 200),
412
+ kind: enumOf(WALLET_KINDS, "bank when left out"),
413
+ currency,
414
+ institution: text("The bank, as text", 200),
415
+ number_hint: text("The last 4 characters of its number; a whole IBAN or card number is refused", 4),
416
+ opening_balance: signedDecimal("Kept in the record only: the owner sets the wallet's opening balance"),
417
+ opening_date: day("The day of that balance")
418
+ }, { required: ["name", "currency"] }),
419
+ roles: { holder: { targets: PARTY, column: "holder", pair: true } }
420
+ },
421
+ transaction: {
422
+ table: "financial_transactions",
423
+ review: "proposal",
424
+ update: "re-propose",
425
+ tombstone: true,
426
+ fields: objectOf({
427
+ direction: enumOf(MONEY_DIRECTIONS),
428
+ amount: decimal("A decimal above 0 in the wallet's currency"),
429
+ currency,
430
+ status: enumOf(TRANSACTION_STATUSES, "booked when left out"),
431
+ date: day("The day the statement shows"),
432
+ booked_date: day("The day it was booked; the statement day when left out"),
433
+ description: text("As the statement says it", 2e3),
434
+ counterparty_name: text("As the statement names the other side", 200),
435
+ reference: text("The statement's reference", 200),
436
+ splits: arrayOf(objectOf({
437
+ amount: decimal("A decimal above 0"),
438
+ category: text("Free text, such as rent", 200),
439
+ note: text("A note", 2e3)
440
+ }, { required: ["amount", "category"] }), 100, "Categories of its amount; what they leave is uncategorized")
441
+ }, { required: ["direction", "amount", "date"] }),
442
+ roles: {
443
+ wallet: { targets: ["wallet"], required: true, column: "financial_account_id" },
444
+ counterparty: { targets: PARTY, column: "counterparty", pair: true },
445
+ payment: { targets: ["payment"], column: "payment_id" },
446
+ project: { targets: ["project"], column: "project_id" }
447
+ },
448
+ nested: { splits: { table: "transaction_splits", parent: "transaction_id" } }
449
+ },
450
+ deal: {
451
+ table: "deals",
452
+ review: "direct",
453
+ update: "in-place",
454
+ tombstone: true,
455
+ fields: dealFields("deal"),
456
+ references: { pipeline: "pipeline" },
457
+ roles: {
458
+ organization: { targets: ORGANIZATION, column: "organization_id" },
459
+ person: { targets: ["person"], many: true, relationship: "related-to", kept: true },
460
+ project: { targets: ["project"], column: "project_id" }
461
+ }
462
+ },
463
+ lead: {
464
+ table: "leads",
465
+ review: "direct",
466
+ update: "in-place",
467
+ tombstone: true,
468
+ fields: dealFields("lead"),
469
+ references: { pipeline: "pipeline" },
470
+ roles: {
471
+ organization: { targets: ORGANIZATION, column: "organization_id" },
472
+ person: { targets: ["person"], many: true, relationship: "related-to", kept: true },
473
+ project: { targets: ["project"], column: "project_id" },
474
+ deal: { targets: ["deal"], column: "deal_id" }
475
+ }
476
+ },
477
+ message: {
478
+ table: "messages",
479
+ review: "direct",
480
+ update: "in-place",
481
+ tombstone: true,
482
+ importOnly: true,
483
+ fields: objectOf({
484
+ kind: enumOf(["sms"], "sms: a text message of the phone"),
485
+ direction: enumOf(SMS_DIRECTIONS, "in: the other side wrote it; out: the owner did"),
486
+ ...phoneFields,
487
+ thread: text("The phone's thread id; the number when left out", 512),
488
+ body: { type: "string", maxLength: 2e4, description: "The text" },
489
+ sent_at: instant("When it was sent"),
490
+ read: { type: "boolean", description: "An incoming message the owner opened" }
491
+ }, { required: ["kind", "direction", "phone", "body", "sent_at"] }),
492
+ roles: COUNTERPART
493
+ },
494
+ event: {
495
+ table: "events",
496
+ review: "direct",
497
+ update: "in-place",
498
+ tombstone: true,
499
+ importOnly: true,
500
+ fields: objectOf({
501
+ kind: enumOf(["call"], "call: a phone call"),
502
+ direction: enumOf(CALL_DIRECTIONS, "in, out, or missed: a call the owner did not take"),
503
+ ...phoneFields,
504
+ started_at: instant("When it rang"),
505
+ duration: { type: "integer", minimum: 0, maximum: 604800, description: "Seconds talked; 0 when missed" }
506
+ }, { required: ["kind", "direction", "phone", "started_at"] }),
507
+ roles: COUNTERPART
508
+ },
509
+ pipeline: {
510
+ table: "pipelines",
511
+ review: "direct",
512
+ update: "in-place",
513
+ tombstone: false,
514
+ fields: objectOf({
515
+ kind: enumOf(DEAL_KINDS, "deal when left out"),
516
+ name: text("The pipeline's name", 80),
517
+ stages: arrayOf(objectOf({
518
+ external_id: text("The stage's id at the source", 512),
519
+ name: text("The stage's name", 80),
520
+ position: { type: "integer", minimum: 0, maximum: 1e3 },
521
+ outcome: enumOf(DEAL_STATUSES, "open when left out")
522
+ }, { required: ["external_id", "name"] }), 30, "The stages in order")
523
+ }, { required: ["name", "stages"] }),
524
+ roles: {},
525
+ nested: { stages: { table: "pipeline_stages", parent: "pipeline_id" } }
526
+ }
527
+ };
528
+ var isRecordType = /* @__PURE__ */ __name((type) => Object.hasOwn(RECORD_TYPES, type), "isRecordType");
529
+ var isBusinessType = /* @__PURE__ */ __name((type) => isRecordType(type) && RECORD_TYPES[type].review !== "identity", "isBusinessType");
530
+ var isIdentityType = /* @__PURE__ */ __name((type) => typeof type === "string" && isRecordType(type) && RECORD_TYPES[type].review === "identity", "isIdentityType");
531
+ var RECORD_ENTITY_TYPES = Object.keys(RECORD_TYPES);
532
+ var RECORD_TABLES = Object.fromEntries(Object.entries(RECORD_TYPES).map(([type, spec]) => [type, spec.table]));
533
+ var decidedOf = /* @__PURE__ */ __name((types) => Object.fromEntries(Object.entries(types).flatMap(([type, spec]) => spec.review === "proposal" || spec.review === "valued-proposal" ? [[type, spec.table]] : [])), "decidedOf");
534
+ var DECIDED_TABLES = {
535
+ ...decidedOf(RECORD_TYPES),
536
+ subscription_price: "subscription_prices"
537
+ };
538
+ var WORD_BODY = "[a-z0-9][a-z0-9_-]{0,62}";
539
+ var TYPE_PATTERN = `^(${RECORD_ENTITY_TYPES.join("|")}|custom:${WORD_BODY})$`;
540
+ var TYPE_RULE = `a type is one of ${RECORD_ENTITY_TYPES.join(", ")} or custom:<name>`;
541
+ var rolesOf = /* @__PURE__ */ __name((type) => Object.entries(RECORD_TYPES[type].roles), "rolesOf");
542
+ var roleOf = /* @__PURE__ */ __name((type, role) => {
543
+ if (!isRecordType(type))
544
+ return void 0;
545
+ const roles = RECORD_TYPES[type].roles;
546
+ return Object.hasOwn(roles, role) ? roles[role] : void 0;
547
+ }, "roleOf");
548
+ var nestedOf = /* @__PURE__ */ __name((type) => Object.entries(RECORD_TYPES[type].nested ?? {}), "nestedOf");
549
+ var referencesOf = /* @__PURE__ */ __name((type) => Object.entries(RECORD_TYPES[type].references ?? {}), "referencesOf");
550
+ var roleNames = /* @__PURE__ */ __name((types, keep) => [
551
+ ...new Set(types.flatMap((type) => rolesOf(type).flatMap(([name, role]) => keep(role) ? [name] : [])))
552
+ ], "roleNames");
553
+ var AMOUNT_ROLES = roleNames(RECORD_ENTITY_TYPES, (role) => role.amount);
554
+ var FIELD_REFERENCE_ROLES = roleNames(RECORD_ENTITY_TYPES, (role) => role.v1 && !role.many);
555
+ var hasV1Roles = /* @__PURE__ */ __name((type) => rolesOf(type).some(([, role]) => role.v1), "hasV1Roles");
556
+ var IDENTITY_TYPES = RECORD_ENTITY_TYPES.filter((type) => RECORD_TYPES[type].review === "identity");
557
+ var article2 = /* @__PURE__ */ __name((word) => /^[aeiou]/.test(word) ? "an" : "a", "article");
558
+
559
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/domain/counters.js
560
+ var COUNTER_FIELDS = ["views", "reactions", "comments"];
561
+ var validCounter = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isFinite(value) && value >= 0, "validCounter");
562
+ var counterValue = /* @__PURE__ */ __name((message, field) => {
563
+ const value = field === "reactions" ? message.reactions?.total : message.providerMetadata?.[field];
564
+ return validCounter(value) ? value : null;
565
+ }, "counterValue");
566
+ var counterObservationTime = /* @__PURE__ */ __name((observation, now) => {
567
+ const at = Date.parse(observation.observedAt);
568
+ if (!validCounter(observation.value) || !Number.isSafeInteger(at) || at < 0 || at > now || !["remote_fetch", "remote_update"].includes(observation.source))
569
+ throw new CliError("validation_error", "counter observation needs a valid value, source and nonfuture observation time");
570
+ if (observation.reactions && (!validCounter(observation.reactions.total) || observation.reactions.total !== observation.value))
571
+ throw new CliError("validation_error", "reaction observation payload and total disagree");
572
+ return at;
573
+ }, "counterObservationTime");
574
+ var observedCounters = /* @__PURE__ */ __name((message, observedAt, fields, source = "remote_fetch") => {
575
+ const observations = {};
576
+ for (const field of fields) {
577
+ const value = counterValue(message, field);
578
+ if (value !== null)
579
+ observations[field] = {
580
+ value,
581
+ observedAt,
582
+ source,
583
+ ...field === "reactions" && message.reactions ? { reactions: message.reactions } : {}
584
+ };
585
+ }
586
+ return { ...message, counterObservations: observations };
587
+ }, "observedCounters");
588
+ var counterFreshness = /* @__PURE__ */ __name((states) => {
589
+ if (!states.length || states.every((one) => one.freshness === "unknown"))
590
+ return "unknown";
591
+ if (states.some((one) => one.freshness === "unknown"))
592
+ return "partial";
593
+ return states.some((one) => one.freshness === "stale") ? "stale" : "fresh";
594
+ }, "counterFreshness");
595
+
596
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/domain/addresses.js
597
+ var EMAIL_ADDRESS = /^[^\s@]+@[^\s@]+\.[^\s@]+$/u;
598
+ var isEmailAddress = /* @__PURE__ */ __name((value) => EMAIL_ADDRESS.test(value), "isEmailAddress");
599
+ var ROLE_ADDRESS_WORDS = {
600
+ noReply: ["noreply", "no-reply", "donotreply", "do-not-reply", "mailer-daemon", "bounce", "bounces"],
601
+ shared: [
602
+ "info",
603
+ "hello",
604
+ "hi",
605
+ "contact",
606
+ "contacts",
607
+ "support",
608
+ "help",
609
+ "helpdesk",
610
+ "service",
611
+ "sales",
612
+ "office",
613
+ "admin",
614
+ "team",
615
+ "billing",
616
+ "accounts",
617
+ "accounting",
618
+ "invoices",
619
+ "finance",
620
+ "hr",
621
+ "jobs",
622
+ "careers",
623
+ "press",
624
+ "media",
625
+ "marketing",
626
+ "partners",
627
+ "legal",
628
+ "privacy",
629
+ "security",
630
+ "abuse",
631
+ "postmaster",
632
+ "webmaster",
633
+ "mail",
634
+ "inbox",
635
+ "enquiries",
636
+ "inquiries",
637
+ "booking",
638
+ "reservations",
639
+ "orders",
640
+ "feedback",
641
+ "newsletter",
642
+ "notifications",
643
+ "alerts"
644
+ ]
645
+ };
646
+ var bare = /* @__PURE__ */ __name((word) => word.replace(/[.\-_]/gu, ""), "bare");
647
+ var NO_REPLY = new Set(ROLE_ADDRESS_WORDS.noReply.map(bare));
648
+ var ROLE = new Set([...ROLE_ADDRESS_WORDS.shared, ...ROLE_ADDRESS_WORDS.noReply].map(bare));
649
+ var localWord = /* @__PURE__ */ __name((address) => {
650
+ const local = address.trim().toLowerCase().split("@")[0] ?? "";
651
+ return bare(local.split("+")[0] ?? "");
652
+ }, "localWord");
653
+ var isRoleAddress = /* @__PURE__ */ __name((address) => ROLE.has(localWord(address)), "isRoleAddress");
654
+ var isNoReplyAddress = /* @__PURE__ */ __name((address) => NO_REPLY.has(localWord(address)), "isNoReplyAddress");
655
+
656
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/domain/display-names.js
657
+ var QUOTES = [
658
+ ['"', '"'],
659
+ ["'", "'"],
660
+ ["\xAB", "\xBB"],
661
+ ["\u201C", "\u201D"],
662
+ ["\u201E", "\u201C"],
663
+ ["\u2018", "\u2019"],
664
+ ["`", "`"]
665
+ ];
666
+ var READABLE = /[\p{L}\p{N}]/u;
667
+ var PLACEHOLDERS = /* @__PURE__ */ new Set(["null", "undefined", "none", "\u0431\u0435\u0437 \u0438\u043C\u0435\u043D\u0438", "deleted account", "\u0443\u0434\u0430\u043B\u0451\u043D\u043D\u044B\u0439 \u0430\u043A\u043A\u0430\u0443\u043D\u0442"]);
668
+ var unquoted = /* @__PURE__ */ __name((text2) => {
669
+ let at = text2.replace(/\s+/gu, " ").trim();
670
+ for (; ; ) {
671
+ const pair = QUOTES.find(([open, close]) => at.length >= 2 && at.startsWith(open) && at.endsWith(close));
672
+ if (pair === void 0)
673
+ return at;
674
+ at = at.slice(pair[0].length, at.length - pair[1].length).trim();
675
+ }
676
+ }, "unquoted");
677
+ var given = /* @__PURE__ */ __name((value) => {
678
+ const text2 = typeof value === "string" ? value.trim() : "";
679
+ return text2 === "" ? void 0 : text2;
680
+ }, "given");
681
+ var displayName = /* @__PURE__ */ __name((name, fallbacks = {}) => {
682
+ const unwrapped = typeof name === "string" ? unquoted(name) : "";
683
+ const cleaned = PLACEHOLDERS.has(unwrapped.toLowerCase()) ? "" : unwrapped;
684
+ if (READABLE.test(cleaned))
685
+ return cleaned;
686
+ const username = given(fallbacks.username);
687
+ return (username === void 0 ? void 0 : username.startsWith("@") ? username : `@${username}`) ?? given(fallbacks.phone) ?? given(fallbacks.email) ?? (cleaned === "" ? null : cleaned);
688
+ }, "displayName");
689
+ var nameKey = /* @__PURE__ */ __name((name) => {
690
+ if (typeof name !== "string")
691
+ return null;
692
+ const unwrapped = unquoted(name);
693
+ if (PLACEHOLDERS.has(unwrapped.toLowerCase()))
694
+ return null;
695
+ const words = foldName(unwrapped).split(/[^\p{L}\p{N}]+/u).filter((word) => word !== "");
696
+ return words.length === 0 ? null : words.sort().join(" ");
697
+ }, "nameKey");
698
+ var isReadable = /* @__PURE__ */ __name((shown) => shown !== null && READABLE.test(shown), "isReadable");
699
+
700
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/domain/rankings-options.js
701
+ var MESSAGE_MEASURES = ["views", "reactions", "forwards", "comments", "replies", "thread-size"];
702
+ var AUTHOR_MEASURES = [
703
+ "messages",
704
+ "words",
705
+ "reactions",
706
+ "replies",
707
+ "answers",
708
+ "answer-time",
709
+ "threads",
710
+ "active-days"
711
+ ];
712
+ var CONTEXT = /* @__PURE__ */ new Set([
713
+ "replies",
714
+ "replies-from-others",
715
+ "replies-from-others-per-message",
716
+ "thread-size",
717
+ "threads",
718
+ "answers",
719
+ "answer-time"
720
+ ]);
721
+ var needsRankingContext = /* @__PURE__ */ __name((options) => options.components.some((name) => CONTEXT.has(name)), "needsRankingContext");
722
+ var presets = {
723
+ helpful: { answers: 0.5, "replies-from-others": 0.25, reactions: 0.25 },
724
+ active: { "active-days": 0.6, messages: 0.4 },
725
+ engaging: { "reactions-per-message": 0.5, "replies-from-others-per-message": 0.5 }
726
+ };
727
+ function invalid(message) {
728
+ throw new CliError("validation_error", message, { reason: "ranking.invalid" });
729
+ }
730
+ __name(invalid, "invalid");
731
+ var rankingOptions = /* @__PURE__ */ __name((target, input) => {
732
+ const measures = target === "messages" ? MESSAGE_MEASURES : AUTHOR_MEASURES;
733
+ const { measure, score, weights: given2, minMessages } = input;
734
+ const messageKind = input.messageKind ?? "all";
735
+ if (!["all", "posts", "comments"].includes(messageKind))
736
+ invalid("message_kind takes all, posts or comments");
737
+ if (target === "messages" && minMessages !== void 0)
738
+ invalid("min_messages applies to stats contacts top");
739
+ if (minMessages !== void 0 && (!Number.isSafeInteger(minMessages) || minMessages < 1))
740
+ invalid("min_messages takes a positive integer");
741
+ if (measure !== void 0 && !measures.includes(measure))
742
+ invalid(`--measure takes ${measures.join(", ")}`);
743
+ if (measure !== void 0 && (score !== void 0 || given2 !== void 0))
744
+ invalid("--measure cannot be combined with --score or --weights");
745
+ if (score !== void 0 && !["helpful", "active", "engaging"].includes(score))
746
+ invalid("--score takes helpful, active or engaging");
747
+ if (target === "messages" && score !== void 0 && score !== "engaging")
748
+ invalid("helpful and active scores apply to authors only");
749
+ const scoring = score !== void 0 || given2 !== void 0;
750
+ const preset = score;
751
+ let weights = null;
752
+ if (scoring) {
753
+ let raw = given2 !== void 0 ? given2 : target === "messages" ? { reactions: 0.5, "replies-from-others": 0.5 } : presets[preset];
754
+ if (typeof raw === "string") {
755
+ try {
756
+ raw = JSON.parse(raw);
757
+ } catch {
758
+ invalid("--weights takes a JSON object of component weights");
759
+ }
760
+ }
761
+ if (!raw || typeof raw !== "object" || Array.isArray(raw))
762
+ invalid("--weights takes a JSON object of component weights");
763
+ const allowed = target === "messages" ? [...MESSAGE_MEASURES, "replies-from-others"] : [
764
+ ...AUTHOR_MEASURES.filter((name) => name !== "answer-time"),
765
+ "replies-from-others",
766
+ "reactions-per-message",
767
+ "replies-from-others-per-message"
768
+ ];
769
+ const entries = Object.entries(raw);
770
+ for (const [name, weight] of entries) {
771
+ if (!allowed.includes(name))
772
+ invalid(`unknown ${target} score component: ${name}`);
773
+ if (typeof weight !== "number" || !Number.isFinite(weight) || weight < 0)
774
+ invalid(`weight for ${name} must be a finite nonnegative number`);
775
+ }
776
+ if (!entries.some(([, weight]) => weight > 0))
777
+ invalid("--weights needs at least one positive weight");
778
+ weights = Object.fromEntries(entries);
779
+ }
780
+ const selected = measure ?? (target === "messages" ? "reactions" : "messages");
781
+ return {
782
+ target,
783
+ messageKind,
784
+ minMessages: minMessages ?? (target === "contacts" && score === "engaging" ? 5 : 1),
785
+ measure: scoring ? "score" : selected,
786
+ order: !scoring && selected === "answer-time" ? "ascending" : "descending",
787
+ weights,
788
+ preset: scoring ? preset ?? "custom" : null,
789
+ components: weights === null ? [selected] : Object.entries(weights).filter(([, weight]) => weight > 0).map(([name]) => name)
790
+ };
791
+ }, "rankingOptions");
792
+ var rankingScore = /* @__PURE__ */ __name((raw, maxima, weights) => {
793
+ const entries = Object.entries(weights).filter(([, weight]) => weight > 0);
794
+ const scale = Math.max(...entries.map(([, weight]) => weight));
795
+ const denominator = entries.reduce((sum2, [, weight]) => sum2 + weight / scale, 0);
796
+ if (!Number.isFinite(scale) || scale <= 0 || !Number.isFinite(denominator) || denominator <= 0)
797
+ return null;
798
+ const normalized = {};
799
+ const contributions = {};
800
+ let sum = 0;
801
+ for (const [name, weight] of entries) {
802
+ const value = raw[name];
803
+ const maximum = maxima[name];
804
+ if (value == null || !Number.isFinite(value) || value < 0 || maximum === void 0 || !Number.isFinite(maximum) || maximum < value)
805
+ return null;
806
+ const part = maximum === 0 ? 0 : value / maximum;
807
+ normalized[name] = part;
808
+ contributions[name] = 100 * part * (weight / scale) / denominator;
809
+ sum += contributions[name];
810
+ }
811
+ return { score: Math.min(100, sum), normalized, contributions };
812
+ }, "rankingScore");
813
+ var RANKING_TOKENIZER_VERSION = 1;
814
+ var withoutUrls = /* @__PURE__ */ __name((text2) => text2.replace(/\S+/gu, (token) => {
815
+ for (let offset = 0; ; ) {
816
+ const marker = token.indexOf("://", offset);
817
+ if (marker < 0)
818
+ break;
819
+ let start = marker;
820
+ while (start > 0 && /[a-z0-9+.-]/iu.test(token[start - 1]))
821
+ start--;
822
+ if (/^[a-z][a-z0-9+.-]*$/iu.test(token.slice(start, marker)) && (start === 0 || !/\w/u.test(token[start - 1])))
823
+ return token.slice(0, start);
824
+ offset = marker + 3;
825
+ }
826
+ const folded = token.toLowerCase();
827
+ for (let offset = 0; ; ) {
828
+ const start = folded.indexOf("www.", offset);
829
+ if (start < 0)
830
+ break;
831
+ if (start === 0 || !/\w/u.test(token[start - 1]))
832
+ return token.slice(0, start);
833
+ offset = start + 4;
834
+ }
835
+ return token;
836
+ }), "withoutUrls");
837
+ var rankingWords = /* @__PURE__ */ __name((text2) => withoutUrls(text2).match(/[\p{L}\p{N}]+/gu)?.length ?? 0, "rankingWords");
838
+ var rankingQuestion = /* @__PURE__ */ __name((text2) => withoutUrls(text2).includes("?"), "rankingQuestion");
839
+
840
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/domain/records.js
841
+ import { createHash } from "node:crypto";
842
+
843
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/domain/phone-plans.generated.js
844
+ var PHONE_PLANS = [
845
+ {
846
+ country: "us",
847
+ code: "1",
848
+ trunk: "1",
849
+ lengths: [10],
850
+ valid: "[2-9]\\d{9}|3\\d{6}",
851
+ mobile: null
852
+ },
853
+ {
854
+ country: "ca",
855
+ code: "1",
856
+ trunk: "1",
857
+ lengths: [7, 10],
858
+ valid: "[2-9]\\d{9}|3\\d{6}",
859
+ mobile: null
860
+ },
861
+ {
862
+ country: "gb",
863
+ code: "44",
864
+ trunk: "0|180020",
865
+ lengths: [7, 9, 10],
866
+ valid: "[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}",
867
+ mobile: "7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}"
868
+ },
869
+ {
870
+ country: "ie",
871
+ code: "353",
872
+ trunk: "0",
873
+ lengths: [7, 8, 9, 10],
874
+ valid: "(?:1\\d|[2569])\\d{6,8}|4\\d{6,9}|7\\d{8}|8\\d{8,9}",
875
+ mobile: "8(?:22|[35-9]\\d)\\d{6}"
876
+ },
877
+ {
878
+ country: "es",
879
+ code: "34",
880
+ trunk: "",
881
+ lengths: [9],
882
+ valid: "(?:400|[5-9]\\d\\d)\\d{6}",
883
+ mobile: "96906(?:09|10)\\d\\d|(?:590(?:10[0-2]|600)|97390\\d)\\d{3}|(?:6\\d|7[1-48])\\d{7}"
884
+ },
885
+ {
886
+ country: "pt",
887
+ code: "351",
888
+ trunk: "",
889
+ lengths: [9],
890
+ valid: "1693\\d{5}|(?:[26-9]\\d|30)\\d{7}",
891
+ mobile: "6(?:[06]92(?:30|9\\d)|[35]92(?:[049]\\d|3[034]))\\d{3}|(?:(?:16|6[0356])93|9(?:[1-36]\\d\\d|480))\\d{5}"
892
+ },
893
+ {
894
+ country: "fr",
895
+ code: "33",
896
+ trunk: "0",
897
+ lengths: [9],
898
+ valid: "[1-9]\\d{8}",
899
+ mobile: "(?:6(?:[0-24-8]\\d|3[0-8]|9[589])|7[3-9]\\d)\\d{6}"
900
+ },
901
+ {
902
+ country: "be",
903
+ code: "32",
904
+ trunk: "0",
905
+ lengths: [8, 9],
906
+ valid: "4\\d{8}|[1-9]\\d{7}",
907
+ mobile: "4[5-9]\\d{7}"
908
+ },
909
+ {
910
+ country: "nl",
911
+ code: "31",
912
+ trunk: "0",
913
+ lengths: [5, 6, 7, 8, 9, 10, 11],
914
+ valid: "(?:[124-7]\\d\\d|3(?:[02-9]\\d|1[0-8]))\\d{6}|8\\d{6,9}|9\\d{6,10}|1\\d{4,5}",
915
+ mobile: "(?:6[1-58]|970\\d)\\d{7}"
916
+ },
917
+ {
918
+ country: "lu",
919
+ code: "352",
920
+ trunk: "",
921
+ lengths: [4, 5, 6, 7, 8, 9, 10, 11],
922
+ valid: "35[013-9]\\d{4,8}|6\\d{8}|35\\d{2,4}|(?:[2457-9]\\d|3[0-46-9])\\d{2,9}",
923
+ mobile: "6(?:[26][18]|5[1568]|7[189]|81|9[128])\\d{6}"
924
+ },
925
+ {
926
+ country: "de",
927
+ code: "49",
928
+ trunk: "0",
929
+ lengths: [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
930
+ valid: "[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:2[024-9]|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[015]\\d|2[13]|31|[46][1-8])\\d{1,9}",
931
+ mobile: "1(?:6[023]|7\\d)\\d{7,8}|15(?:[0-25-9]\\d\\d|3(?:10|33))\\d{6}"
932
+ },
933
+ {
934
+ country: "at",
935
+ code: "43",
936
+ trunk: "0",
937
+ lengths: [4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
938
+ valid: "1\\d{3,12}|2\\d{6,12}|43(?:(?:0\\d|5[02-9])\\d{3,9}|2\\d{4,5}|[3467]\\d{4}|8\\d{4,6}|9\\d{4,7})|5\\d{4,12}|8\\d{7,12}|9\\d{8,12}|(?:[367]\\d|4[0-24-9])\\d{4,11}",
939
+ mobile: "6(?:485|(?:5[0-3579]|6[013-9]|[7-9]\\d)\\d)\\d{3,9}"
940
+ },
941
+ {
942
+ country: "ch",
943
+ code: "41",
944
+ trunk: "0",
945
+ lengths: [9, 12],
946
+ valid: "8\\d{11}|[2-9]\\d{8}",
947
+ mobile: "(?:6[89]|7[235-9])\\d{7}"
948
+ },
949
+ {
950
+ country: "li",
951
+ code: "423",
952
+ trunk: "0",
953
+ lengths: [7, 9],
954
+ valid: "[68]\\d{8}|(?:[2378]\\d|90)\\d{5}",
955
+ mobile: "(?:6(?:(?:4[5-9]|5\\d)\\d|6(?:[024-68]\\d|1[01]|3[7-9]|7[02]))\\d|7(?:[37-9]\\d|42|56))\\d{4}"
956
+ },
957
+ {
958
+ country: "it",
959
+ code: "39",
960
+ trunk: "",
961
+ lengths: [6, 7, 8, 9, 10, 11, 12],
962
+ valid: "0\\d{5,11}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:43|55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?",
963
+ mobile: "3[2-9]\\d{7,8}|(?:31|43)\\d{8}"
964
+ },
965
+ {
966
+ country: "mt",
967
+ code: "356",
968
+ trunk: "",
969
+ lengths: [8],
970
+ valid: "3550\\d{4}|(?:[2579]\\d\\d|800)\\d{5}",
971
+ mobile: "(?:7(?:210|[79]\\d\\d)|9(?:[29]\\d\\d|69[67]|8(?:1[1-3]|89|97)))\\d{4}"
972
+ },
973
+ {
974
+ country: "si",
975
+ code: "386",
976
+ trunk: "0",
977
+ lengths: [5, 6, 7, 8],
978
+ valid: "[1-7]\\d{7}|8\\d{4,7}|90\\d{4,6}",
979
+ mobile: "65(?:[178]\\d|5[56]|6[01])\\d{4}|(?:[37][01]|4[013]|51|6[489])\\d{6}"
980
+ },
981
+ {
982
+ country: "hr",
983
+ code: "385",
984
+ trunk: "0",
985
+ lengths: [7, 8, 9],
986
+ valid: "[2-69]\\d{8}|80\\d{5,7}|[1-79]\\d{7}|6\\d{6}",
987
+ mobile: "9(?:(?:0[1-9]|[12589]\\d)\\d\\d|7(?:[0679]\\d\\d|5(?:[01]\\d|44|55|77|9[5-79])))\\d{4}|98\\d{6}"
988
+ },
989
+ {
990
+ country: "ba",
991
+ code: "387",
992
+ trunk: "0",
993
+ lengths: [8, 9],
994
+ valid: "6\\d{8}|(?:[35689]\\d|49|70)\\d{6}",
995
+ mobile: "6040\\d{5}|6(?:03|[1-356]|44|7\\d)\\d{6}"
996
+ },
997
+ {
998
+ country: "rs",
999
+ code: "381",
1000
+ trunk: "0",
1001
+ lengths: [6, 7, 8, 9, 10, 11, 12],
1002
+ valid: "38[02-9]\\d{6,9}|6\\d{7,9}|90\\d{4,8}|38\\d{5,6}|(?:7\\d\\d|800)\\d{3,9}|(?:[12]\\d|3[0-79])\\d{5,10}",
1003
+ mobile: "6(?:[0-689]|7\\d)\\d{6,7}"
1004
+ },
1005
+ {
1006
+ country: "me",
1007
+ code: "382",
1008
+ trunk: "0",
1009
+ lengths: [8, 9],
1010
+ valid: "(?:20|[3-79]\\d)\\d{6}|80\\d{6,7}",
1011
+ mobile: "6(?:[07-9]\\d|3[024]|6[0-25])\\d{5}"
1012
+ },
1013
+ {
1014
+ country: "mk",
1015
+ code: "389",
1016
+ trunk: "0",
1017
+ lengths: [8],
1018
+ valid: "[2-578]\\d{7}",
1019
+ mobile: "7(?:3555|(?:474|9[019]7)7)\\d{3}|7(?:[0-25-8]\\d\\d|3(?:[1-478]\\d|6[01])|4(?:2\\d|60|7[01578])|9(?:[2-4]\\d|5[01]|7[015]))\\d{4}"
1020
+ },
1021
+ {
1022
+ country: "al",
1023
+ code: "355",
1024
+ trunk: "0",
1025
+ lengths: [6, 7, 8, 9],
1026
+ valid: "(?:700\\d\\d|900)\\d{3}|8\\d{5,7}|(?:[2-5]|6\\d)\\d{7}",
1027
+ mobile: "6(?:[78][2-9]|9\\d)\\d{6}"
1028
+ },
1029
+ {
1030
+ country: "gr",
1031
+ code: "30",
1032
+ trunk: "",
1033
+ lengths: [10, 11, 12],
1034
+ valid: "5005000\\d{3}|8\\d{9,11}|(?:[269]\\d|70)\\d{8}",
1035
+ mobile: "68[57-9]\\d{7}|(?:69|94)\\d{8}"
1036
+ },
1037
+ {
1038
+ country: "cy",
1039
+ code: "357",
1040
+ trunk: "",
1041
+ lengths: [8],
1042
+ valid: "(?:[279]\\d|[58]0)\\d{6}",
1043
+ mobile: "9(?:10|[4-79]\\d)\\d{5}"
1044
+ },
1045
+ {
1046
+ country: "bg",
1047
+ code: "359",
1048
+ trunk: "0",
1049
+ lengths: [6, 7, 8, 9, 12],
1050
+ valid: "00800\\d{7}|[2-7]\\d{6,7}|[89]\\d{6,8}|2\\d{5}",
1051
+ mobile: "(?:43[07-9]|99[69]\\d)\\d{5}|(?:8[7-9]|98)\\d{7}"
1052
+ },
1053
+ {
1054
+ country: "ro",
1055
+ code: "40",
1056
+ trunk: "0",
1057
+ lengths: [6, 9],
1058
+ valid: "(?:[236-8]\\d|90)\\d{7}|[23]\\d{5}",
1059
+ mobile: "(?:630|702)0\\d{5}|(?:6(?:00|2\\d)|7(?:0[013-9]|1[0-3]|[2-7]\\d|8[03-8]|9[0-39]))\\d{6}"
1060
+ },
1061
+ {
1062
+ country: "md",
1063
+ code: "373",
1064
+ trunk: "0",
1065
+ lengths: [8],
1066
+ valid: "(?:[235-7]\\d|[89]0)\\d{6}",
1067
+ mobile: "562\\d{5}|(?:6\\d|7[16-9])\\d{6}"
1068
+ },
1069
+ {
1070
+ country: "hu",
1071
+ code: "36",
1072
+ trunk: "06",
1073
+ lengths: [8, 9],
1074
+ valid: "[235-7]\\d{8}|[1-9]\\d{7}",
1075
+ mobile: "(?:[257]0|3[01])\\d{7}"
1076
+ },
1077
+ {
1078
+ country: "sk",
1079
+ code: "421",
1080
+ trunk: "0",
1081
+ lengths: [6, 7, 9],
1082
+ valid: "[2-689]\\d{8}|[2-59]\\d{6}|[2-5]\\d{5}",
1083
+ mobile: "909[1-9]\\d{5}|9(?:0[1-8]|1[0-24-9]|4[03-57-9]|5\\d)\\d{6}"
1084
+ },
1085
+ {
1086
+ country: "cz",
1087
+ code: "420",
1088
+ trunk: "",
1089
+ lengths: [9, 10, 11, 12],
1090
+ valid: "(?:[2-578]\\d|60)\\d{7}|9\\d{8,11}",
1091
+ mobile: "7060\\d{5}|(?:60[1-8]|7(?:0[2-5]|19|[2379]\\d))\\d{6}"
1092
+ },
1093
+ {
1094
+ country: "pl",
1095
+ code: "48",
1096
+ trunk: "",
1097
+ lengths: [6, 7, 8, 9, 10],
1098
+ valid: "(?:6|8\\d\\d)\\d{7}|[1-9]\\d{6}(?:\\d{2})?|[26]\\d{5}",
1099
+ mobile: "21(?:1[013-5]|2\\d|3[1-9])\\d{5}|(?:45|5[0137]|6[069]|7[2389]|88)\\d{7}"
1100
+ },
1101
+ {
1102
+ country: "lt",
1103
+ code: "370",
1104
+ trunk: "[08]",
1105
+ lengths: [8],
1106
+ valid: "(?:[3469]\\d|52|[78]0)\\d{6}",
1107
+ mobile: "6\\d{7}"
1108
+ },
1109
+ {
1110
+ country: "lv",
1111
+ code: "371",
1112
+ trunk: "",
1113
+ lengths: [8],
1114
+ valid: "(?:[268]\\d|78|90)\\d{6}",
1115
+ mobile: "2333[0-8]\\d{3}|2(?:[0-24-9]\\d\\d|3(?:0[07]|[14-9]\\d|2[02-9]|3[0-24-9]))\\d{4}"
1116
+ },
1117
+ {
1118
+ country: "ee",
1119
+ code: "372",
1120
+ trunk: "",
1121
+ lengths: [7, 8, 10],
1122
+ valid: "8\\d{9}|[4578]\\d{7}|(?:[3-8]\\d|90)\\d{5}",
1123
+ mobile: "(?:5\\d{5}|8(?:1(?:0(?:0(?:00|[178]\\d)|[3-9]\\d\\d)|(?:1(?:0[2-6]|1\\d)|[2-79]\\d\\d)\\d)|2(?:0(?:0(?:00|4\\d)|[1-7]\\d\\d)|(?:(?:[124-69]\\d|3[5-9])\\d|7(?:[0-79]\\d|8[013-9])|8(?:[2-6]\\d|7[01]))\\d)|[349]\\d{4}))\\d\\d|5(?:(?:[02]\\d|5[0-478])\\d|1(?:[0-8]\\d|95)|6(?:4[0-4]|5[1-589]))\\d{3}"
1124
+ },
1125
+ {
1126
+ country: "fi",
1127
+ code: "358",
1128
+ trunk: "0",
1129
+ lengths: [5, 6, 7, 8, 9, 10, 11, 12],
1130
+ valid: "[1-35689]\\d{4}|7\\d{10,11}|(?:[124-7]\\d|3[0-46-9])\\d{8}|[1-9]\\d{5,8}",
1131
+ mobile: "4946\\d{2,6}|(?:4[0-8]|50)\\d{4,8}"
1132
+ },
1133
+ {
1134
+ country: "se",
1135
+ code: "46",
1136
+ trunk: "0",
1137
+ lengths: [6, 7, 8, 9, 10, 12],
1138
+ valid: "(?:[26]\\d\\d|9)\\d{9}|[1-9]\\d{8}|[1-689]\\d{7}|[1-4689]\\d{6}|2\\d{5}",
1139
+ mobile: "7[023689]\\d{7}"
1140
+ },
1141
+ {
1142
+ country: "no",
1143
+ code: "47",
1144
+ trunk: "",
1145
+ lengths: [5, 8],
1146
+ valid: "(?:0|[2-9]\\d{3})\\d{4}",
1147
+ mobile: "45(?:[0-24-9]\\d|3[0-57-9])\\d{4}|(?:4[016-8]|9\\d)\\d{6}"
1148
+ },
1149
+ {
1150
+ country: "dk",
1151
+ code: "45",
1152
+ trunk: "",
1153
+ lengths: [8],
1154
+ valid: "[2-9]\\d{7}",
1155
+ mobile: "(?:2[6-8]|37|6[78]|96)\\d{6}|(?:2[0-59]|3[0-689]|[457]\\d|6[0-69]|8[126-9]|9[1-47-9])[1-9]\\d{5}"
1156
+ },
1157
+ {
1158
+ country: "is",
1159
+ code: "354",
1160
+ trunk: "",
1161
+ lengths: [7, 9],
1162
+ valid: "(?:38\\d|[4-9])\\d{6}",
1163
+ mobile: "(?:38[589]\\d\\d|6(?:1[1-8]|2[0-6]|3[026-9]|4[014679]|5[0159]|6[0-69]|70|8[06-8]|9\\d)|7(?:5[057]|[6-9]\\d)|8(?:2[0-59]|[3-69]\\d|8[238]))\\d{4}"
1164
+ },
1165
+ {
1166
+ country: "ua",
1167
+ code: "380",
1168
+ trunk: "0",
1169
+ lengths: [9, 10],
1170
+ valid: "[89]\\d{9}|[3-9]\\d{8}",
1171
+ mobile: "790\\d{6}|(?:39|50|6[36-8]|7[1-357]|9[1-9])\\d{7}"
1172
+ },
1173
+ {
1174
+ country: "by",
1175
+ code: "375",
1176
+ trunk: "0|80?",
1177
+ lengths: [6, 7, 8, 9, 10, 11],
1178
+ valid: "(?:[12]\\d|33|44|902)\\d{7}|8(?:0[0-79]\\d{5,7}|[1-7]\\d{9})|8(?:1[0-489]|[5-79]\\d)\\d{7}|8[1-79]\\d{6,7}|8[0-79]\\d{5}|8\\d{5}",
1179
+ mobile: "(?:2(?:5[5-79]|9[1-9])|(?:33|44)\\d)\\d{6}"
1180
+ },
1181
+ {
1182
+ country: "ru",
1183
+ code: "7",
1184
+ trunk: "8",
1185
+ lengths: [10, 14],
1186
+ valid: "8\\d{13}|[347-9]\\d{9}",
1187
+ mobile: "9\\d{9}"
1188
+ },
1189
+ {
1190
+ country: "kz",
1191
+ code: "7",
1192
+ trunk: "8",
1193
+ lengths: [10, 14],
1194
+ valid: "8\\d{13}|[78]\\d{9}",
1195
+ mobile: "7(?:0[0-25-8]|47|6[0-4]|7[15-8]|85)\\d{7}"
1196
+ },
1197
+ {
1198
+ country: "ge",
1199
+ code: "995",
1200
+ trunk: "0",
1201
+ lengths: [9],
1202
+ valid: "(?:[3-57]\\d\\d|800)\\d{6}",
1203
+ mobile: "5(?:(?:(?:0555|1(?:[17]77|555))[5-9]|757(?:7[7-9]|8[01]))\\d|22252[0-4])\\d\\d|5(?:0(?:0(?:1[09]|70)|505)|1(?:0[01]0|1(?:07|33|51))|2(?:0[02]0|2[25]2)|3(?:0[03]0|3[35]3)|4(?:0[04]0|411)|5222|9000)[0-4]\\d{3}|(?:5(?:0(?:0(?:0\\d|1[12]|2[02]|3[0-6]|4[04]|5[05]|77|88|9[09])|(?:[14]\\d|77)\\d|22[02])|1(?:1(?:[03][01]|[124]\\d|5[02-6]|7[0-6])|4\\d\\d)|2(?:228|555)|3555|4(?:4(?:[02-9]\\d|14)|555)|5(?:[0157-9]\\d\\d|200|333|4(?:44|55))|6[89]\\d\\d|7(?:(?:[0147-9]\\d|22)\\d|5(?:00|[57]5))|8(?:0(?:[018]\\d|2[0-4])|5(?:55|8[89])|8(?:55|88))|9(?:090|[1-35-9]\\d\\d))|790\\d\\d)\\d{4}"
1204
+ },
1205
+ {
1206
+ country: "am",
1207
+ code: "374",
1208
+ trunk: "0",
1209
+ lengths: [8],
1210
+ valid: "(?:[1-489]\\d|55|60|77)\\d{6}",
1211
+ mobile: "(?:33|4[1349]|55|77|88|9[13-9])\\d{6}"
1212
+ },
1213
+ {
1214
+ country: "tr",
1215
+ code: "90",
1216
+ trunk: "0",
1217
+ lengths: [7, 10, 12, 13],
1218
+ valid: "4\\d{6}|8\\d{11,12}|(?:[2-58]\\d\\d|900)\\d{7}",
1219
+ mobile: "5(?:61(?:011|61\\d)|82[2-5]\\d\\d)\\d{4}|5(?:[03-5]\\d|1[06]|24|6[24]|7[245]|9[46])\\d{7}"
1220
+ }
1221
+ ];
1222
+
1223
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/domain/phones.js
1224
+ var PHONE_COUNTRIES = PHONE_PLANS.map((plan) => plan.country);
1225
+ var DEFAULT_PHONE_COUNTRIES = ["ru"];
1226
+ var parsePhoneCountries = /* @__PURE__ */ __name((value) => {
1227
+ const countries = value.split(/[\s,]+/).map((one) => one.trim().toLowerCase()).filter(Boolean);
1228
+ const unknown = countries.filter((one) => !PHONE_COUNTRIES.includes(one));
1229
+ if (countries.length === 0 || unknown.length > 0)
1230
+ throw new CliError("validation_error", `phone_countries takes country codes, ${unknown.length > 0 ? `not ${unknown.join(", ")}` : "at least one"}: ` + PHONE_COUNTRIES.join(", "));
1231
+ return [...new Set(countries)];
1232
+ }, "parsePhoneCountries");
1233
+ var PLANS = new Map(PHONE_PLANS.map((plan) => [
1234
+ plan.country,
1235
+ {
1236
+ code: plan.code,
1237
+ trunk: plan.trunk ? new RegExp(`^(?:${plan.trunk})`) : null,
1238
+ lengths: new Set(plan.lengths),
1239
+ valid: new RegExp(`^(?:${plan.valid})$`),
1240
+ mobile: plan.mobile === null ? null : new RegExp(`^(?:${plan.mobile})$`)
1241
+ }
1242
+ ]));
1243
+ var nationalPhone = /* @__PURE__ */ __name((digits, countries, { anyType }) => {
1244
+ for (const country of countries) {
1245
+ const plan = PLANS.get(country);
1246
+ if (!plan)
1247
+ continue;
1248
+ const readings = [
1249
+ ...plan.trunk?.test(digits) ? [digits.replace(plan.trunk, "")] : [],
1250
+ digits,
1251
+ ...digits.startsWith(plan.code) ? [digits.slice(plan.code.length)] : []
1252
+ ];
1253
+ for (const national of readings) {
1254
+ if (!plan.lengths.has(national.length) || !plan.valid.test(national))
1255
+ continue;
1256
+ const mobile = plan.mobile?.test(national) ?? false;
1257
+ if (anyType || mobile)
1258
+ return { value: `+${plan.code}${national}`, national, mobile };
1259
+ }
1260
+ }
1261
+ return void 0;
1262
+ }, "nationalPhone");
1263
+ var typedPhone = /* @__PURE__ */ __name((typed, { phoneCountries = DEFAULT_PHONE_COUNTRIES } = {}) => {
1264
+ const text2 = typed.trim();
1265
+ if (!/^\+?[\d\s().\-–]+$/.test(text2))
1266
+ return void 0;
1267
+ const digits = text2.replace(/\(0\)/, "").replace(/\D/g, "").replace(/^00/, "");
1268
+ if (digits.length < 7 || digits.length > 15)
1269
+ return void 0;
1270
+ const national = nationalPhone(digits, phoneCountries, { anyType: true });
1271
+ const tail = national?.national ?? digits.replace(/^0+/, "");
1272
+ return {
1273
+ value: text2.startsWith("+") || /^00/.test(text2) ? `+${digits}` : national?.value ?? digits,
1274
+ national: tail.length >= 8 ? tail : null
1275
+ };
1276
+ }, "typedPhone");
1277
+ var e164Of = /* @__PURE__ */ __name((phone, region) => {
1278
+ if (/^\s*(\+|00)/.test(phone))
1279
+ return typedPhone(phone)?.value;
1280
+ if (typedPhone(phone) === void 0)
1281
+ return void 0;
1282
+ if (region === void 0)
1283
+ return null;
1284
+ const digits = phone.replace(/\(0\)/, "").replace(/\D/g, "");
1285
+ return nationalPhone(digits, [region], { anyType: true })?.value;
1286
+ }, "e164Of");
1287
+ var BARE_INTERNATIONAL_PROVIDERS = ["telegram", "max", "whatsapp"];
1288
+ var storedPhone = /* @__PURE__ */ __name((raw, provider) => {
1289
+ if (/^\s*(\+|00)/.test(raw))
1290
+ return typedPhone(raw)?.value;
1291
+ if (!BARE_INTERNATIONAL_PROVIDERS.includes(provider))
1292
+ return void 0;
1293
+ const found = /^([1-9]\d{6,14})$/.exec(raw.trim());
1294
+ return found ? `+${found[1]}` : void 0;
1295
+ }, "storedPhone");
1296
+
1297
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/domain/records.js
1298
+ var RECORDS_SCHEMA_VERSION = 1;
1299
+ var RECORD_OPERATIONS = ["upsert", "delete"];
1300
+ var LINE_OPTIONS = ["text", "products"];
1301
+ var WORD = `^${WORD_BODY}$`;
1302
+ var MAX_ID = 512;
1303
+ var MAX_RELATIONS = 100;
1304
+ var DECIMAL = DECIMAL_PATTERN;
1305
+ var REF = "^[a-z]+:[^\\s]{1,500}$";
1306
+ var fieldsDef = /* @__PURE__ */ __name((type) => `fields-${type}`, "fieldsDef");
1307
+ var RECORDS_ENVELOPE_SCHEMA = {
1308
+ $schema: "https://json-schema.org/draft/2020-12/schema",
1309
+ title: "WireCat records envelope, version 1",
1310
+ description: "Records one source sends to the store. JSONL is the same model: the first line holds schema_version, source and options, each further line one record.",
1311
+ type: "object",
1312
+ required: ["schema_version", "source", "records"],
1313
+ additionalProperties: false,
1314
+ properties: {
1315
+ schema_version: { const: RECORDS_SCHEMA_VERSION },
1316
+ source: { $ref: "#/$defs/source" },
1317
+ options: { $ref: "#/$defs/options" },
1318
+ records: { type: "array", items: { $ref: "#/$defs/record" } }
1319
+ },
1320
+ $defs: {
1321
+ source: {
1322
+ type: "object",
1323
+ required: ["provider", "account", "batch_id"],
1324
+ additionalProperties: false,
1325
+ properties: {
1326
+ provider: { type: "string", pattern: WORD, description: "The system the records come from" },
1327
+ account: { type: "string", minLength: 1, maxLength: MAX_ID, description: "The account in that system" },
1328
+ batch_id: { type: "string", minLength: 1, maxLength: MAX_ID, description: "This import, for the receipt" }
1329
+ }
1330
+ },
1331
+ options: {
1332
+ type: "object",
1333
+ additionalProperties: false,
1334
+ properties: {
1335
+ lines: {
1336
+ enum: [...LINE_OPTIONS],
1337
+ description: "products: an invoice line's product (an external id) names its product; text, the default, keeps it as data. Order lines always read it, and product_ref (a product: ref) is read on every line."
1338
+ },
1339
+ phone_region: {
1340
+ type: "string",
1341
+ pattern: "^[A-Za-z]{2}$",
1342
+ description: "The country a person's phone without + is read in. Without it such a number is an identifier only when exactly one country of the store's phone_countries setting reads it as valid"
1343
+ }
1344
+ }
1345
+ },
1346
+ record: {
1347
+ type: "object",
1348
+ required: ["key", "type", "external_id", "operation"],
1349
+ additionalProperties: false,
1350
+ properties: {
1351
+ key: { type: "string", minLength: 1, maxLength: MAX_ID },
1352
+ type: { type: "string", pattern: TYPE_PATTERN },
1353
+ external_id: { type: "string", minLength: 1, maxLength: MAX_ID },
1354
+ operation: { enum: [...RECORD_OPERATIONS] },
1355
+ fields: {
1356
+ type: "object",
1357
+ description: "What the source says, as data: never secrets, never instructions"
1358
+ },
1359
+ revision: { type: "integer", minimum: 0, maximum: Number.MAX_SAFE_INTEGER },
1360
+ relations: { type: "array", maxItems: MAX_RELATIONS, items: { $ref: "#/$defs/relation" } }
1361
+ },
1362
+ allOf: RECORD_ENTITY_TYPES.map((type) => ({
1363
+ if: { properties: { type: { const: type } }, required: ["type"] },
1364
+ // biome-ignore lint/suspicious/noThenProperty: JSON Schema's own if/then keyword, never awaited.
1365
+ then: { properties: { fields: { $ref: `#/$defs/${fieldsDef(type)}` } } }
1366
+ }))
1367
+ },
1368
+ relation: {
1369
+ type: "object",
1370
+ required: ["role"],
1371
+ additionalProperties: false,
1372
+ oneOf: [{ required: ["type", "external_id"] }, { required: ["ref"] }],
1373
+ properties: {
1374
+ role: { type: "string", pattern: WORD },
1375
+ type: { type: "string", pattern: TYPE_PATTERN },
1376
+ external_id: { type: "string", minLength: 1, maxLength: MAX_ID },
1377
+ ref: { type: "string", pattern: REF, description: "A store entity, such as organization:12" },
1378
+ as: {
1379
+ type: "string",
1380
+ pattern: WORD,
1381
+ description: "On a relationship role: the part the target plays, such as decision-maker"
1382
+ },
1383
+ amount: {
1384
+ type: "string",
1385
+ pattern: DECIMAL,
1386
+ description: "A settles relation's share of the payment, a decimal in its currency"
1387
+ }
1388
+ }
1389
+ },
1390
+ ...Object.fromEntries(RECORD_ENTITY_TYPES.map((type) => [fieldsDef(type), RECORD_TYPES[type].fields]))
1391
+ }
1392
+ };
1393
+ var wordPattern = new RegExp(WORD);
1394
+ var typePattern = new RegExp(TYPE_PATTERN);
1395
+ var decimalPattern = new RegExp(DECIMAL);
1396
+ var refPattern = new RegExp(REF);
1397
+ var escapePointer = /* @__PURE__ */ __name((segment) => String(segment).replaceAll("~", "~0").replaceAll("/", "~1"), "escapePointer");
1398
+ var pointerOf = /* @__PURE__ */ __name((...segments) => segments.map((s) => `/${escapePointer(s)}`).join(""), "pointerOf");
1399
+ var canonical = /* @__PURE__ */ __name((value) => {
1400
+ if (Array.isArray(value))
1401
+ return value.map(canonical);
1402
+ if (!isObject(value))
1403
+ return value;
1404
+ return Object.fromEntries(Object.keys(value).sort().map((key) => [key, canonical(value[key])]));
1405
+ }, "canonical");
1406
+ var recordFingerprint = /* @__PURE__ */ __name((fields, relations) => createHash("sha256").update(JSON.stringify(canonical({
1407
+ fields,
1408
+ relations: relations.map((relation) => [
1409
+ relation.role,
1410
+ ...relation.ref === void 0 ? [relation.type, relation.external_id] : [`ref=${relation.ref}`],
1411
+ ...relation.amount === void 0 ? [] : [relation.amount],
1412
+ ...relation.as === void 0 ? [] : [`as=${relation.as}`]
1413
+ ]).sort((a, b) => a.join("\0").localeCompare(b.join("\0")))
1414
+ }))).digest("hex"), "recordFingerprint");
1415
+ var BOM = "\uFEFF";
1416
+ var withoutBom = /* @__PURE__ */ __name((text2) => text2.startsWith(BOM) ? text2.slice(1) : text2, "withoutBom");
1417
+ var jsonLine = /* @__PURE__ */ __name((line) => {
1418
+ try {
1419
+ return JSON.parse(withoutBom(line));
1420
+ } catch {
1421
+ return line;
1422
+ }
1423
+ }, "jsonLine");
1424
+ var envelopeOfJsonl = /* @__PURE__ */ __name((text2) => {
1425
+ const lines = withoutBom(text2).split(/\r?\n/);
1426
+ const first = lines.findIndex((line) => line.trim() !== "");
1427
+ if (first < 0)
1428
+ return {};
1429
+ const header = jsonLine(lines[first]);
1430
+ const records = [];
1431
+ for (let at = first + 1; at < lines.length; at++) {
1432
+ const line = lines[at];
1433
+ if (line.trim() !== "")
1434
+ records.push(jsonLine(line));
1435
+ }
1436
+ return isObject(header) ? { ...header, records } : header;
1437
+ }, "envelopeOfJsonl");
1438
+ var envelopeOfText = /* @__PURE__ */ __name((text2) => {
1439
+ const clean = withoutBom(text2);
1440
+ const first = clean.split(/\r?\n/).find((line) => line.trim() !== "");
1441
+ const head = first === void 0 ? void 0 : jsonLine(first);
1442
+ if (isObject(head) && !Object.hasOwn(head, "records"))
1443
+ return envelopeOfJsonl(clean);
1444
+ return jsonLine(clean);
1445
+ }, "envelopeOfText");
1446
+ var fieldReferences = /* @__PURE__ */ __name((record, options = {}) => {
1447
+ if (record.operation !== "upsert" || !isRecordType(record.type))
1448
+ return [];
1449
+ const fields = record.fields ?? {};
1450
+ const found = [];
1451
+ for (const [key, type] of referencesOf(record.type))
1452
+ if (typeof fields[key] === "string")
1453
+ found.push({ role: `fields.${key}`, type, external_id: fields[key] });
1454
+ if (record.type === "invoice" && options.lines !== "products")
1455
+ return found;
1456
+ for (const [list, spec] of nestedOf(record.type)) {
1457
+ const items = fields[list];
1458
+ if (!Array.isArray(items))
1459
+ continue;
1460
+ for (const item of items)
1461
+ for (const [key, type] of Object.entries(spec.references ?? {}))
1462
+ if (isObject(item) && typeof item[key] === "string")
1463
+ found.push({ role: `fields.${list}.${key}`, type, external_id: item[key] });
1464
+ }
1465
+ return found;
1466
+ }, "fieldReferences");
1467
+
1468
+ // node_modules/.pnpm/@wirecat+cli-core@0.630.0_@wirecat+cli-base@0.93.0_commander@15.0.0_esbuild@0.28.2_type_4dc2b7e09a64a37f199c7e635efe1b87/node_modules/@wirecat/cli-core/dist/domain/crm.js
1469
+ var CRM_KINDS = ["organization", "person", "deal", "lead"];
1470
+ var isCrmUserId = /* @__PURE__ */ __name((id) => /^\d{1,20}$/.test(id), "isCrmUserId");
1471
+ var normalCrmUserId = /* @__PURE__ */ __name((id) => {
1472
+ const text2 = id.trim();
1473
+ return /^\d+$/.test(text2) ? text2.replace(/^0+(?=\d)/, "") : text2;
1474
+ }, "normalCrmUserId");
1475
+ var isItemKind = /* @__PURE__ */ __name((kind) => kind === "deal" || kind === "lead", "isItemKind");
1476
+
1477
+ export {
1478
+ chatReferenceOf,
1479
+ wrongAccount,
1480
+ ensureAccount,
1481
+ isId,
1482
+ foldName,
1483
+ pickChat,
1484
+ pickPerson,
1485
+ isObject,
1486
+ RECORD_TYPES,
1487
+ isRecordType,
1488
+ isBusinessType,
1489
+ isIdentityType,
1490
+ RECORD_ENTITY_TYPES,
1491
+ RECORD_TABLES,
1492
+ DECIDED_TABLES,
1493
+ WORD_BODY,
1494
+ rolesOf,
1495
+ roleOf,
1496
+ nestedOf,
1497
+ AMOUNT_ROLES,
1498
+ FIELD_REFERENCE_ROLES,
1499
+ hasV1Roles,
1500
+ IDENTITY_TYPES,
1501
+ article2 as article,
1502
+ DEFAULT_PHONE_COUNTRIES,
1503
+ parsePhoneCountries,
1504
+ nationalPhone,
1505
+ typedPhone,
1506
+ e164Of,
1507
+ BARE_INTERNATIONAL_PROVIDERS,
1508
+ storedPhone,
1509
+ COUNTER_FIELDS,
1510
+ validCounter,
1511
+ counterValue,
1512
+ counterObservationTime,
1513
+ observedCounters,
1514
+ counterFreshness,
1515
+ isEmailAddress,
1516
+ ROLE_ADDRESS_WORDS,
1517
+ isRoleAddress,
1518
+ isNoReplyAddress,
1519
+ displayName,
1520
+ nameKey,
1521
+ isReadable,
1522
+ MESSAGE_MEASURES,
1523
+ AUTHOR_MEASURES,
1524
+ needsRankingContext,
1525
+ rankingOptions,
1526
+ rankingScore,
1527
+ RANKING_TOKENIZER_VERSION,
1528
+ rankingWords,
1529
+ rankingQuestion,
1530
+ RECORDS_SCHEMA_VERSION,
1531
+ RECORD_OPERATIONS,
1532
+ RECORDS_ENVELOPE_SCHEMA,
1533
+ pointerOf,
1534
+ recordFingerprint,
1535
+ envelopeOfJsonl,
1536
+ envelopeOfText,
1537
+ fieldReferences,
1538
+ CRM_KINDS,
1539
+ isCrmUserId,
1540
+ normalCrmUserId,
1541
+ isItemKind
1542
+ };