@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.
- package/CHANGELOG.md +29 -0
- package/dist/bin/mail.js +2 -2
- package/dist/bundle/{all-profiles-CI32WFEV.js → all-profiles-VS7P6DJY.js} +11 -11
- package/dist/bundle/{anthropic-ICSOMJIN.js → anthropic-C5JXKGBS.js} +16 -7
- package/dist/bundle/{app-server-3F4ZB7DH.js → app-server-HU3LVU42.js} +51 -50
- package/dist/bundle/{bun-7AHNFZMZ.js → bun-QLFX47WZ.js} +2 -2
- package/dist/bundle/{bun-sqlite-UIWRS4HI.js → bun-sqlite-W4PGAKVY.js} +5 -5
- package/dist/bundle/{chunk-ETIUB2DF.js → chunk-3FD3IATT.js} +6 -6
- package/dist/bundle/{chunk-6FSLEARF.js → chunk-3KSK5BBB.js} +2 -2
- package/dist/bundle/{chunk-I3YNNSGB.js → chunk-4QNHAM3J.js} +2 -2
- package/dist/bundle/{chunk-7SWWVDEZ.js → chunk-4W4EVVL4.js} +61 -21
- package/dist/bundle/{chunk-JDKC7EXM.js → chunk-5NLHDK7P.js} +50 -46
- package/dist/bundle/{chunk-AHRHP2H2.js → chunk-5X3GU5LI.js} +6 -6
- package/dist/bundle/{chunk-KNRONMVG.js → chunk-64ZG5ERD.js} +2 -2
- package/dist/bundle/{chunk-RIAZTS6C.js → chunk-6PWCQKMD.js} +12 -12
- package/dist/bundle/{chunk-4PNIZUEC.js → chunk-6VV7J2TN.js} +36 -57
- package/dist/bundle/{chunk-5AS5N7V5.js → chunk-A6J4MPTI.js} +3 -1
- package/dist/bundle/{chunk-ZYHBMDNU.js → chunk-AUTX2MLF.js} +11 -9
- package/dist/bundle/{chunk-5Y2WRUYP.js → chunk-B72343TK.js} +2 -2
- package/dist/bundle/{chunk-7SIWMF77.js → chunk-BFQQV22T.js} +1 -1
- package/dist/bundle/chunk-C3NYJW6B.js +1542 -0
- package/dist/bundle/{chunk-7ZDH2XEY.js → chunk-C5BMCLCQ.js} +4 -4
- package/dist/bundle/{chunk-JO4BJYVE.js → chunk-DW3F6DUW.js} +1 -1
- package/dist/bundle/chunk-EKGRNFYQ.js +18 -0
- package/dist/bundle/{chunk-4YTX5YAU.js → chunk-FKWUUCX2.js} +1361 -1539
- package/dist/bundle/{chunk-LLYVBO3R.js → chunk-FNLUKODV.js} +19 -19
- package/dist/bundle/{chunk-HGV7DSSA.js → chunk-H5FJTHVA.js} +2 -2
- package/dist/bundle/{chunk-3QVGB2CI.js → chunk-HBZAJINU.js} +4 -4
- package/dist/bundle/{chunk-BT7UUI6E.js → chunk-IRUN4XOV.js} +2 -2
- package/dist/bundle/{chunk-4TKQIXND.js → chunk-JMLIKXFO.js} +2 -2
- package/dist/bundle/{chunk-XV3M3NAN.js → chunk-JOQGJUFT.js} +1 -1
- package/dist/bundle/{chunk-NEDYKKJJ.js → chunk-JWMLMAHP.js} +4 -4
- package/dist/bundle/{chunk-5QQOUYNA.js → chunk-KGOVFEWZ.js} +3 -3
- package/dist/bundle/{chunk-NKDYHAHP.js → chunk-KV4VTKF3.js} +3 -3
- package/dist/bundle/chunk-LVGX7VTD.js +138 -0
- package/dist/bundle/{chunk-3DQYO7FB.js → chunk-MCPOZNWG.js} +1 -1
- package/dist/bundle/{chunk-SCH3NC5X.js → chunk-MTO6YVMN.js} +3 -3
- package/dist/bundle/{chunk-R4RAWEMV.js → chunk-NCRSE647.js} +286 -48
- package/dist/bundle/{chunk-UTLJQG6Q.js → chunk-NSIN5IM4.js} +8 -8
- package/dist/bundle/{chunk-IMIY7HQB.js → chunk-NWKKPDZV.js} +2 -2
- package/dist/bundle/chunk-O373QEAJ.js +1243 -0
- package/dist/bundle/{chunk-OMW37FXK.js → chunk-OQW6GHUA.js} +1 -1
- package/dist/bundle/{chunk-D6WTKSRA.js → chunk-PRQ2U7HF.js} +2 -2
- package/dist/bundle/{chunk-HRIYU2HJ.js → chunk-PT6MF2VU.js} +469 -120
- package/dist/bundle/{chunk-B6GITVDX.js → chunk-Q4OKEN3B.js} +7 -7
- package/dist/bundle/{chunk-ELGEHZK2.js → chunk-Q6K2XUGU.js} +1 -1
- package/dist/bundle/{chunk-CNYQ3TTZ.js → chunk-QI3PXUOJ.js} +43 -595
- package/dist/bundle/{chunk-SGMENSI6.js → chunk-QVMOEB3I.js} +391 -16
- package/dist/bundle/{chunk-S2U5BXWS.js → chunk-RLQZFZLK.js} +80 -5
- package/dist/bundle/{chunk-SETCGPFG.js → chunk-RN7OI5KL.js} +9 -8
- package/dist/bundle/{chunk-5J4WNTTM.js → chunk-RNZKQMFY.js} +14 -14
- package/dist/bundle/{chunk-WQRX4RQS.js → chunk-RUASZW3M.js} +5 -5
- package/dist/bundle/{chunk-UHC5I3JV.js → chunk-RX5CJ55S.js} +1 -1
- package/dist/bundle/{chunk-FHCOGR7S.js → chunk-SWKQ6IAR.js} +3 -3
- package/dist/bundle/{chunk-KJQZXCNK.js → chunk-TI7ZIPA2.js} +4 -4
- package/dist/bundle/{chunk-7DFWXIY5.js → chunk-TLEBSMC7.js} +1997 -768
- package/dist/bundle/{chunk-5Z7LZAVP.js → chunk-U6MMQNNK.js} +6 -6
- package/dist/bundle/{chunk-HN6PB7F5.js → chunk-VNKWSCN7.js} +99 -42
- package/dist/bundle/{chunk-DALBYUPC.js → chunk-VUBZFMGP.js} +2 -2
- package/dist/bundle/{chunk-XP5FBDIG.js → chunk-VVL4MKYH.js} +1 -1
- package/dist/bundle/{chunk-TEL2OMS5.js → chunk-WOX7FZJP.js} +686 -220
- package/dist/bundle/{chunk-2BAO4T4Z.js → chunk-X47BL4M5.js} +13 -13
- package/dist/bundle/{chunk-GOMJNH56.js → chunk-X7J3TTDO.js} +8 -8
- package/dist/bundle/{chunk-FVKZ55I2.js → chunk-XBEO472U.js} +29976 -16640
- package/dist/bundle/{chunk-UA4BOLIY.js → chunk-YA45XV6G.js} +4 -4
- package/dist/bundle/{chunk-FIZWQTUC.js → chunk-YBQ5AYLZ.js} +3 -3
- package/dist/bundle/{chunk-AFPETMXZ.js → chunk-YI544LHI.js} +13 -136
- package/dist/bundle/chunk-ZO4MQWIK.js +188 -0
- package/dist/bundle/{chunk-7OVVX4F4.js → chunk-ZR2BDNGG.js} +1 -1
- package/dist/bundle/command-contract-ERYYPAD2.js +35 -0
- package/dist/bundle/command-server-entry-5E3PPDE5.js +164 -0
- package/dist/bundle/{decode-BJXABRAN.js → decode-AVWV7SVZ.js} +5 -5
- package/dist/bundle/{dispatch-G4CYFWQ2.js → dispatch-BXPHSNK5.js} +10 -10
- package/dist/bundle/{dist-LLEA6R4V.js → dist-PIOOKBWT.js} +78 -44
- package/dist/bundle/{echarts-YPTKBOZV.js → echarts-7K6YQV52.js} +2 -2
- package/dist/bundle/{embed-DMROTI5M.js → embed-4NT76GJK.js} +6 -6
- package/dist/bundle/{embedder-DWMHXCHJ.js → embedder-ITQFF7EN.js} +9 -9
- package/dist/bundle/{failure-FFPK2WYB.js → failure-3Q65JOPD.js} +2 -2
- package/dist/bundle/{first-run-FQOEF2IO.js → first-run-PM74YU4X.js} +11 -11
- package/dist/bundle/first-screen-WBVGVSMY.js +33 -0
- package/dist/bundle/{instructions-OGKMROLD.js → instructions-JDSITYHV.js} +1 -1
- package/dist/bundle/mail.js +37 -13
- package/dist/bundle/{mcp-CFVG2OUS.js → mcp-7KQUJNFN.js} +2 -2
- package/dist/bundle/{node-HIKYE546.js → node-D6YIJOJI.js} +2 -2
- package/dist/bundle/{node-sqlite-3GJAG7VO.js → node-sqlite-PJOHHB4X.js} +6 -6
- package/dist/bundle/{oauth-H3DB6IHI.js → oauth-BOWJ3IBT.js} +7 -7
- package/dist/bundle/{open-DJ2PRG74.js → open-FIAKKZMW.js} +5 -5
- package/dist/bundle/{openai-MDBRYB55.js → openai-QL54VVLC.js} +16 -37
- package/dist/bundle/{process-4LBD72JH.js → process-AYHK7WRC.js} +1 -1
- package/dist/bundle/{program-F6WK6RX4.js → program-6FKWOTBK.js} +3206 -1603
- package/dist/bundle/{prompt-UNPUG6SO.js → prompt-XJZCBELC.js} +5 -5
- package/dist/bundle/{recognize-DMIO4PDB.js → recognize-OQKWAHBY.js} +4 -4
- package/dist/bundle/{remote-24HJA72D.js → remote-NLVUZ5WK.js} +7 -7
- package/dist/bundle/{rerank-PTNCHHIU.js → rerank-NRPZDTJ7.js} +7 -7
- package/dist/bundle/{serve-T6JHM2YD.js → serve-O4YUI7F6.js} +9 -9
- package/dist/bundle/server-6OT5ZEWL.js +66 -0
- package/dist/bundle/{server-BWEYRUR3.js → server-WAL3M4OO.js} +40 -40
- package/dist/bundle/{sqlite-runtime-ZJ4EH5ZM.js → sqlite-runtime-5YHGI4D4.js} +6 -6
- package/dist/bundle/{state-KSN4OFYW.js → state-WYYOJ7KK.js} +6 -6
- package/dist/bundle/{store-OIEZJEA7.js → store-6BJO3F2J.js} +22 -16
- package/dist/bundle/{store-GVBW2ZFK.js → store-X72GOJHD.js} +50 -22
- package/dist/bundle/store-maintenance-command-ASS7RBYC.js +54 -0
- package/dist/commands/rules.d.ts.map +1 -1
- package/dist/commands/rules.js +29 -7
- package/dist/commands/rules.js.map +1 -1
- package/dist/commands/sync.d.ts +0 -1
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +8 -2
- package/dist/commands/sync.js.map +1 -1
- package/dist/config.d.ts +4 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
- package/dist/bundle/chunk-5AQ4S4TZ.js +0 -12172
- package/dist/bundle/chunk-B4MWHI2V.js +0 -380
- package/dist/bundle/command-contract-UIRWJVEY.js +0 -35
- package/dist/bundle/first-screen-B6LF5464.js +0 -33
- package/dist/bundle/server-VUQNR5ZD.js +0 -65
- package/dist/bundle/store-maintenance-command-KJ54HLUQ.js +0 -54
- /package/dist/bundle/{chunk-QZLK2ISN.js → chunk-YVNHQFLC.js} +0 -0
|
@@ -2,35 +2,40 @@ import { createRequire as __bundleRequire } from "node:module";
|
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
validateFormattedText
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-YI544LHI.js";
|
|
6
6
|
import {
|
|
7
7
|
inputPolicy
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-NWKKPDZV.js";
|
|
9
|
+
import {
|
|
10
|
+
RECORDS_SCHEMA_VERSION,
|
|
11
|
+
RECORD_TYPES,
|
|
12
|
+
pointerOf
|
|
13
|
+
} from "./chunk-C3NYJW6B.js";
|
|
9
14
|
import {
|
|
10
15
|
parseReference
|
|
11
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-WOX7FZJP.js";
|
|
12
17
|
import {
|
|
13
18
|
indent
|
|
14
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-FNLUKODV.js";
|
|
15
20
|
import {
|
|
16
21
|
CliError
|
|
17
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-VUBZFMGP.js";
|
|
18
23
|
import {
|
|
19
24
|
__name
|
|
20
25
|
} from "./chunk-ZVVMGPBJ.js";
|
|
21
26
|
|
|
22
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
27
|
+
// 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/checks.js
|
|
23
28
|
var spelled = /* @__PURE__ */ __name((check, args) => `${check.replaceAll(".", " ")}${args === void 0 ? "" : ` ${args}`}`, "spelled");
|
|
24
29
|
var bareCheck = /* @__PURE__ */ __name((check, args) => `\`${spelled(check, args)}\``, "bareCheck");
|
|
25
30
|
var checkWords = /* @__PURE__ */ __name((command, profile) => (check, args) => `\`${command} ${profile === void 0 ? "" : `${profile} `}${spelled(check, args)}\``, "checkWords");
|
|
26
31
|
|
|
27
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
32
|
+
// 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/links.js
|
|
28
33
|
var LINK_VERSION = "v1";
|
|
29
34
|
var DEFAULT_LINK_CONFIG = { base: "https://wirecat.dev/o", enabled: true };
|
|
30
35
|
var APP_PREFIX = "wirecat://open";
|
|
31
36
|
var MAX_PATH = 512;
|
|
32
37
|
var MAX_SEGMENTS = 6;
|
|
33
|
-
var TASK_FILTERS = ["overdue", "today", "tomorrow"];
|
|
38
|
+
var TASK_FILTERS = ["overdue", "today", "tomorrow", "undated"];
|
|
34
39
|
var DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
35
40
|
var DATE_TIME = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:\d{2})$/;
|
|
36
41
|
var isMoment = /* @__PURE__ */ __name((text, pattern) => pattern.test(text) && !Number.isNaN(Date.parse(text)), "isMoment");
|
|
@@ -41,7 +46,9 @@ var partsOf = /* @__PURE__ */ __name((target) => {
|
|
|
41
46
|
case "chat":
|
|
42
47
|
return ["chat", target.provider, target.account, target.chat];
|
|
43
48
|
case "task":
|
|
44
|
-
|
|
49
|
+
case "person":
|
|
50
|
+
case "project":
|
|
51
|
+
return [target.type, target.id];
|
|
45
52
|
case "tasks":
|
|
46
53
|
return target.filter === "new" ? ["tasks", "new", target.since] : ["tasks", target.filter];
|
|
47
54
|
case "proposal":
|
|
@@ -62,7 +69,9 @@ var targetOfParts = /* @__PURE__ */ __name((parts) => {
|
|
|
62
69
|
case "chat":
|
|
63
70
|
return rest.length === 3 ? { type: "chat", provider: a, account: b, chat: c } : null;
|
|
64
71
|
case "task":
|
|
65
|
-
|
|
72
|
+
case "person":
|
|
73
|
+
case "project":
|
|
74
|
+
return rest.length === 1 ? { type: kind, id: a } : null;
|
|
66
75
|
case "tasks":
|
|
67
76
|
if (rest.length === 1 && TASK_FILTERS.includes(a))
|
|
68
77
|
return { type: "tasks", filter: a };
|
|
@@ -99,7 +108,12 @@ var parseLink = /* @__PURE__ */ __name((text) => {
|
|
|
99
108
|
return targetOfPath(rest);
|
|
100
109
|
}, "parseLink");
|
|
101
110
|
var LINK_ONLY = /* @__PURE__ */ new Set(["tasks", "proposal", "digest", "sync"]);
|
|
102
|
-
var FROM_REFERENCE = /* @__PURE__ */ new Set(["message", "chat", "task"]);
|
|
111
|
+
var FROM_REFERENCE = /* @__PURE__ */ new Set(["message", "chat", "task", "person", "project"]);
|
|
112
|
+
var ENTITY_KINDS = /* @__PURE__ */ new Set(["person", "project"]);
|
|
113
|
+
var refsForLink = /* @__PURE__ */ __name((refs) => [
|
|
114
|
+
...refs.filter((ref) => !ENTITY_KINDS.has(ref.slice(0, ref.indexOf(":")))),
|
|
115
|
+
...refs.filter((ref) => ENTITY_KINDS.has(ref.slice(0, ref.indexOf(":"))))
|
|
116
|
+
], "refsForLink");
|
|
103
117
|
var linkTargetOf = /* @__PURE__ */ __name((ref) => {
|
|
104
118
|
const text = ref.trim();
|
|
105
119
|
const colon = text.indexOf(":");
|
|
@@ -132,7 +146,7 @@ var linkFor = /* @__PURE__ */ __name((ref, { form, config = DEFAULT_LINK_CONFIG,
|
|
|
132
146
|
return form === "app" ? `${APP_PREFIX}${path}` : `${config.base}#${path}`;
|
|
133
147
|
}, "linkFor");
|
|
134
148
|
|
|
135
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
149
|
+
// 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/markdown.js
|
|
136
150
|
var MARKERS = [
|
|
137
151
|
["**", "bold"],
|
|
138
152
|
["~~", "strike"],
|
|
@@ -178,7 +192,7 @@ var closing = /* @__PURE__ */ __name((input, open, marker) => {
|
|
|
178
192
|
return end;
|
|
179
193
|
}, "closing");
|
|
180
194
|
|
|
181
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
195
|
+
// 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/markdown-spans.js
|
|
182
196
|
var STYLES = [
|
|
183
197
|
["**", "bold"],
|
|
184
198
|
["__", "underline"],
|
|
@@ -338,7 +352,7 @@ var parseMarkdownSpans = /* @__PURE__ */ __name((input) => {
|
|
|
338
352
|
return validateFormattedText(result);
|
|
339
353
|
}, "parseMarkdownSpans");
|
|
340
354
|
|
|
341
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
355
|
+
// 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/polls.js
|
|
342
356
|
var countedPoll = /* @__PURE__ */ __name((poll, votes, self) => {
|
|
343
357
|
const cast = votes.filter((vote) => vote.answers.length > 0);
|
|
344
358
|
const mine = self === null ? void 0 : votes.find((vote) => vote.person.id === self);
|
|
@@ -353,6 +367,361 @@ var countedPoll = /* @__PURE__ */ __name((poll, votes, self) => {
|
|
|
353
367
|
};
|
|
354
368
|
}, "countedPoll");
|
|
355
369
|
|
|
370
|
+
// 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-table.js
|
|
371
|
+
var TABLE_RECORD_TYPES = Object.keys(RECORD_TYPES).filter((type) => !RECORD_TYPES[type].importOnly);
|
|
372
|
+
var TableError = class extends Error {
|
|
373
|
+
static {
|
|
374
|
+
__name(this, "TableError");
|
|
375
|
+
}
|
|
376
|
+
errors;
|
|
377
|
+
constructor(errors) {
|
|
378
|
+
super(errors.map((e) => e.message).join("; "));
|
|
379
|
+
this.errors = errors;
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
var LIST_SEPARATOR = "|";
|
|
383
|
+
var BOM = "\uFEFF";
|
|
384
|
+
var specOf = /* @__PURE__ */ __name((type) => RECORD_TYPES[type], "specOf");
|
|
385
|
+
var typesOf = /* @__PURE__ */ __name((schema) => schema.type === void 0 ? [] : typeof schema.type === "string" ? [schema.type] : [...schema.type], "typesOf");
|
|
386
|
+
var shapeOf = /* @__PURE__ */ __name((schema) => {
|
|
387
|
+
const types = typesOf(schema);
|
|
388
|
+
if (types.includes("integer"))
|
|
389
|
+
return "integer";
|
|
390
|
+
if (types.includes("boolean"))
|
|
391
|
+
return "boolean";
|
|
392
|
+
if (types.includes("array"))
|
|
393
|
+
return "list";
|
|
394
|
+
if (schema.pattern?.includes("T[0-9]{2}"))
|
|
395
|
+
return "instant";
|
|
396
|
+
if (schema.pattern?.startsWith("^[0-9]{4}-"))
|
|
397
|
+
return "day";
|
|
398
|
+
if (schema.pattern?.includes("[A-Za-z]{3}"))
|
|
399
|
+
return "currency";
|
|
400
|
+
if (schema.pattern?.includes("(\\.[0-9]"))
|
|
401
|
+
return "decimal";
|
|
402
|
+
return "text";
|
|
403
|
+
}, "shapeOf");
|
|
404
|
+
var valuesOf = /* @__PURE__ */ __name((schema) => schema.enum?.filter((v) => v !== null), "valuesOf");
|
|
405
|
+
var flat = /* @__PURE__ */ __name((schema) => {
|
|
406
|
+
const types = typesOf(schema);
|
|
407
|
+
return !types.includes("object") && !(types.includes("array") && schema.items?.type === "object");
|
|
408
|
+
}, "flat");
|
|
409
|
+
var fieldColumn = /* @__PURE__ */ __name((name, schema, required, kind) => {
|
|
410
|
+
const values = valuesOf(schema);
|
|
411
|
+
const shape = shapeOf(schema);
|
|
412
|
+
return {
|
|
413
|
+
name,
|
|
414
|
+
kind,
|
|
415
|
+
required,
|
|
416
|
+
shape,
|
|
417
|
+
description: schema.description ?? "",
|
|
418
|
+
...values ? { values } : {},
|
|
419
|
+
...shape === "list" ? { many: true } : {}
|
|
420
|
+
};
|
|
421
|
+
}, "fieldColumn");
|
|
422
|
+
var roleColumn = /* @__PURE__ */ __name((name, role) => ({
|
|
423
|
+
name,
|
|
424
|
+
kind: "role",
|
|
425
|
+
required: role.required === true,
|
|
426
|
+
shape: "text",
|
|
427
|
+
description: role.targets.length === 1 ? `The ${role.targets[0]}'s external id` : `<type>:<external id>, the type one of ${role.targets.join(", ")}`,
|
|
428
|
+
targets: role.targets,
|
|
429
|
+
...role.many ? { many: true } : {}
|
|
430
|
+
}), "roleColumn");
|
|
431
|
+
var recordColumns = /* @__PURE__ */ __name((type) => {
|
|
432
|
+
const spec = specOf(type);
|
|
433
|
+
if (!spec || spec.importOnly)
|
|
434
|
+
return [];
|
|
435
|
+
const fields = spec.fields.properties ?? {};
|
|
436
|
+
const required = spec.fields.required ?? [];
|
|
437
|
+
const lists = Object.entries(fields).filter(([, schema]) => !flat(schema));
|
|
438
|
+
return [
|
|
439
|
+
{ name: "external_id", kind: "id", required: true, shape: "text", description: "Its id in your system" },
|
|
440
|
+
...Object.entries(fields).filter(([, schema]) => flat(schema)).map(([name, schema]) => fieldColumn(name, schema, required.includes(name), "field")),
|
|
441
|
+
...Object.entries(spec.roles).filter(([, role]) => !role.linked).map(([name, role]) => roleColumn(name, role)),
|
|
442
|
+
...lists.flatMap(([list, schema]) => {
|
|
443
|
+
const item = schema.items ?? {};
|
|
444
|
+
const own = item.required ?? [];
|
|
445
|
+
return Object.entries(item.properties ?? {}).map(([key, s]) => fieldColumn(`${list}.${key}`, s, required.includes(list) && own.includes(key), "item"));
|
|
446
|
+
})
|
|
447
|
+
];
|
|
448
|
+
}, "recordColumns");
|
|
449
|
+
var csvCell = /* @__PURE__ */ __name((value, separator) => /["\r\n]/.test(value) || value.includes(separator) ? `"${value.replaceAll('"', '""')}"` : value, "csvCell");
|
|
450
|
+
var example = /* @__PURE__ */ __name((column) => {
|
|
451
|
+
if (column.values?.[0])
|
|
452
|
+
return column.values[0];
|
|
453
|
+
switch (column.shape) {
|
|
454
|
+
case "decimal":
|
|
455
|
+
return "100.00";
|
|
456
|
+
case "day":
|
|
457
|
+
return "2026-01-31";
|
|
458
|
+
case "instant":
|
|
459
|
+
return "2026-01-31T09:00:00Z";
|
|
460
|
+
case "currency":
|
|
461
|
+
return "EUR";
|
|
462
|
+
case "integer":
|
|
463
|
+
return 1;
|
|
464
|
+
case "boolean":
|
|
465
|
+
return true;
|
|
466
|
+
case "list":
|
|
467
|
+
return ["\u2026"];
|
|
468
|
+
default:
|
|
469
|
+
return column.description || "\u2026";
|
|
470
|
+
}
|
|
471
|
+
}, "example");
|
|
472
|
+
var exampleRef = /* @__PURE__ */ __name((column) => ({
|
|
473
|
+
role: column.name,
|
|
474
|
+
type: column.targets?.[0] ?? "",
|
|
475
|
+
external_id: `${column.targets?.[0] ?? "record"}-1`
|
|
476
|
+
}), "exampleRef");
|
|
477
|
+
var recordTemplate = /* @__PURE__ */ __name((type, format, { source, separator = "," } = {}) => {
|
|
478
|
+
const columns = recordColumns(type);
|
|
479
|
+
if (columns.length === 0)
|
|
480
|
+
throw new TableError([unknownType(type)]);
|
|
481
|
+
if (format === "csv")
|
|
482
|
+
return `${BOM}${columns.map((c) => csvCell(c.name, separator)).join(separator)}\r
|
|
483
|
+
`;
|
|
484
|
+
const fields = {};
|
|
485
|
+
for (const c of columns.filter((c2) => c2.kind === "field"))
|
|
486
|
+
fields[c.name] = example(c);
|
|
487
|
+
for (const c of columns.filter((c2) => c2.kind === "item")) {
|
|
488
|
+
const [list = "", key = ""] = c.name.split(".");
|
|
489
|
+
fields[list] ??= [{}];
|
|
490
|
+
const [first] = fields[list];
|
|
491
|
+
if (first)
|
|
492
|
+
first[key] = example(c);
|
|
493
|
+
}
|
|
494
|
+
const envelope = {
|
|
495
|
+
schema_version: RECORDS_SCHEMA_VERSION,
|
|
496
|
+
source: {
|
|
497
|
+
provider: source?.provider ?? "sheet",
|
|
498
|
+
account: source?.account ?? "main",
|
|
499
|
+
batch_id: source?.batch_id ?? "first-import"
|
|
500
|
+
},
|
|
501
|
+
records: [
|
|
502
|
+
{
|
|
503
|
+
key: `${type}-1`,
|
|
504
|
+
type,
|
|
505
|
+
external_id: `${type}-1`,
|
|
506
|
+
operation: "upsert",
|
|
507
|
+
fields,
|
|
508
|
+
relations: columns.filter((c) => c.kind === "role").map(exampleRef)
|
|
509
|
+
}
|
|
510
|
+
]
|
|
511
|
+
};
|
|
512
|
+
return `${JSON.stringify(envelope, null, 2)}
|
|
513
|
+
`;
|
|
514
|
+
}, "recordTemplate");
|
|
515
|
+
var csvRows = /* @__PURE__ */ __name((text, separator) => {
|
|
516
|
+
const rows = [];
|
|
517
|
+
let cells = [];
|
|
518
|
+
let cell = "";
|
|
519
|
+
let quoted = false;
|
|
520
|
+
let line = 1;
|
|
521
|
+
let start = 1;
|
|
522
|
+
const end = /* @__PURE__ */ __name(() => {
|
|
523
|
+
cells.push(cell);
|
|
524
|
+
cell = "";
|
|
525
|
+
}, "end");
|
|
526
|
+
for (let i = 0; i < text.length; i++) {
|
|
527
|
+
const c = text[i];
|
|
528
|
+
if (quoted) {
|
|
529
|
+
if (c === '"' && text[i + 1] === '"') {
|
|
530
|
+
cell += '"';
|
|
531
|
+
i++;
|
|
532
|
+
} else if (c === '"')
|
|
533
|
+
quoted = false;
|
|
534
|
+
else {
|
|
535
|
+
if (c === "\n")
|
|
536
|
+
line++;
|
|
537
|
+
cell += c;
|
|
538
|
+
}
|
|
539
|
+
} else if (c === '"' && cell === "")
|
|
540
|
+
quoted = true;
|
|
541
|
+
else if (c === separator)
|
|
542
|
+
end();
|
|
543
|
+
else if (c === "\n" || c === "\r") {
|
|
544
|
+
if (c === "\r" && text[i + 1] === "\n")
|
|
545
|
+
i++;
|
|
546
|
+
end();
|
|
547
|
+
rows.push({ cells, line: start });
|
|
548
|
+
cells = [];
|
|
549
|
+
line++;
|
|
550
|
+
start = line;
|
|
551
|
+
} else
|
|
552
|
+
cell += c;
|
|
553
|
+
}
|
|
554
|
+
if (cell !== "" || cells.length > 0) {
|
|
555
|
+
end();
|
|
556
|
+
rows.push({ cells, line: start });
|
|
557
|
+
}
|
|
558
|
+
return rows.filter((r) => r.cells.some((c) => c.trim() !== ""));
|
|
559
|
+
}, "csvRows");
|
|
560
|
+
var csvSeparator = /* @__PURE__ */ __name((header) => {
|
|
561
|
+
const count = /* @__PURE__ */ __name((s) => header.split(s).length - 1, "count");
|
|
562
|
+
return [";", " ", ","].reduce((best, s) => count(s) > count(best) ? s : best, ",");
|
|
563
|
+
}, "csvSeparator");
|
|
564
|
+
var DAY_DOTTED = /^(\d{1,2})[./](\d{1,2})[./](\d{4})$/;
|
|
565
|
+
var normalized = /* @__PURE__ */ __name((column, raw) => {
|
|
566
|
+
const value = raw.trim();
|
|
567
|
+
switch (column.shape) {
|
|
568
|
+
case "decimal": {
|
|
569
|
+
const plain = value.replace(/[\s ]/g, "");
|
|
570
|
+
return /^\d+,\d+$/.test(plain) ? plain.replace(",", ".") : plain;
|
|
571
|
+
}
|
|
572
|
+
case "day": {
|
|
573
|
+
const dotted = DAY_DOTTED.exec(value);
|
|
574
|
+
return dotted ? `${dotted[3]}-${dotted[2]?.padStart(2, "0")}-${dotted[1]?.padStart(2, "0")}` : value;
|
|
575
|
+
}
|
|
576
|
+
case "currency":
|
|
577
|
+
return value.toUpperCase();
|
|
578
|
+
case "integer":
|
|
579
|
+
return /^-?\d+$/.test(value) ? Number(value) : value;
|
|
580
|
+
case "boolean":
|
|
581
|
+
return /^(true|yes|1|да|sí|si)$/i.test(value) ? true : /^(false|no|0|нет)$/i.test(value) ? false : value;
|
|
582
|
+
case "list":
|
|
583
|
+
return value.split(LIST_SEPARATOR).map((v) => v.trim()).filter(Boolean);
|
|
584
|
+
default:
|
|
585
|
+
return column.many ? value.split(LIST_SEPARATOR).map((v) => v.trim()).filter(Boolean) : value;
|
|
586
|
+
}
|
|
587
|
+
}, "normalized");
|
|
588
|
+
var unknownType = /* @__PURE__ */ __name((type) => ({
|
|
589
|
+
pointer: "",
|
|
590
|
+
code: "record.type",
|
|
591
|
+
message: `no table for ${type}: use one of ${TABLE_RECORD_TYPES.join(", ")}`
|
|
592
|
+
}), "unknownType");
|
|
593
|
+
var relationsOf = /* @__PURE__ */ __name((column, raw) => {
|
|
594
|
+
const targets = column.targets ?? [];
|
|
595
|
+
const values = column.many ? raw.split(LIST_SEPARATOR) : [raw];
|
|
596
|
+
const out = [];
|
|
597
|
+
for (const value of values.map((v) => v.trim()).filter(Boolean)) {
|
|
598
|
+
const at = value.indexOf(":");
|
|
599
|
+
const named = at > 0 ? value.slice(0, at) : "";
|
|
600
|
+
if (targets.length === 1 && !targets.includes(named)) {
|
|
601
|
+
out.push({ role: column.name, type: targets[0], external_id: value });
|
|
602
|
+
continue;
|
|
603
|
+
}
|
|
604
|
+
if (!targets.includes(named) || at === value.length - 1)
|
|
605
|
+
return {
|
|
606
|
+
pointer: "",
|
|
607
|
+
code: "record.invalid",
|
|
608
|
+
message: `${column.name} takes <type>:<external id>, the type one of ${targets.join(", ")}: not ${value}`
|
|
609
|
+
};
|
|
610
|
+
out.push({ role: column.name, type: named, external_id: value.slice(at + 1) });
|
|
611
|
+
}
|
|
612
|
+
return out;
|
|
613
|
+
}, "relationsOf");
|
|
614
|
+
var envelopeOfCsv = /* @__PURE__ */ __name((text, { type, source, options }) => {
|
|
615
|
+
const columns = recordColumns(type);
|
|
616
|
+
if (columns.length === 0)
|
|
617
|
+
throw new TableError([unknownType(type)]);
|
|
618
|
+
const body = text.startsWith(BOM) ? text.slice(1) : text;
|
|
619
|
+
const separator = csvSeparator(body.slice(0, body.search(/\r?\n|$/)));
|
|
620
|
+
const [head, ...rows] = csvRows(body, separator);
|
|
621
|
+
if (!head)
|
|
622
|
+
throw new TableError([{ pointer: "", code: "envelope.invalid", message: "the file has no header row" }]);
|
|
623
|
+
const byName = new Map(columns.map((c) => [c.name, c]));
|
|
624
|
+
const header = head.cells.map((name) => name.trim());
|
|
625
|
+
const unknown = header.filter((name) => name !== "" && !byName.has(name));
|
|
626
|
+
if (unknown.length > 0)
|
|
627
|
+
throw new TableError([
|
|
628
|
+
{
|
|
629
|
+
pointer: "",
|
|
630
|
+
code: "envelope.invalid",
|
|
631
|
+
message: `columns ${type} has no field for: ${unknown.join(", ")}. Download the ${type} template for the list`,
|
|
632
|
+
place: { line: 1, column: unknown[0] }
|
|
633
|
+
}
|
|
634
|
+
]);
|
|
635
|
+
if (!header.includes("external_id"))
|
|
636
|
+
throw new TableError([
|
|
637
|
+
{ pointer: "", code: "envelope.invalid", message: "the header has no external_id column", place: { line: 1 } }
|
|
638
|
+
]);
|
|
639
|
+
const records = [];
|
|
640
|
+
const indexById = /* @__PURE__ */ new Map();
|
|
641
|
+
const places = /* @__PURE__ */ new Map();
|
|
642
|
+
const errors = [];
|
|
643
|
+
for (const row of rows) {
|
|
644
|
+
const cell = /* @__PURE__ */ __name((name) => row.cells[header.indexOf(name)] ?? "", "cell");
|
|
645
|
+
const id = cell("external_id").trim();
|
|
646
|
+
if (!id) {
|
|
647
|
+
errors.push({
|
|
648
|
+
pointer: "",
|
|
649
|
+
code: "record.invalid",
|
|
650
|
+
message: "a row has no external_id",
|
|
651
|
+
place: { line: row.line, column: "external_id" }
|
|
652
|
+
});
|
|
653
|
+
continue;
|
|
654
|
+
}
|
|
655
|
+
const known = indexById.get(id);
|
|
656
|
+
const index = known ?? records.length;
|
|
657
|
+
const record = records[index] ?? {
|
|
658
|
+
key: `${type}:${id}`,
|
|
659
|
+
type,
|
|
660
|
+
external_id: id,
|
|
661
|
+
operation: "upsert",
|
|
662
|
+
fields: {},
|
|
663
|
+
relations: []
|
|
664
|
+
};
|
|
665
|
+
if (known === void 0) {
|
|
666
|
+
records.push(record);
|
|
667
|
+
indexById.set(id, index);
|
|
668
|
+
places.set(pointerOf("records", index), { line: row.line });
|
|
669
|
+
}
|
|
670
|
+
const fields = record.fields;
|
|
671
|
+
const item = {};
|
|
672
|
+
let list = "";
|
|
673
|
+
header.forEach((name, i) => {
|
|
674
|
+
const column = byName.get(name);
|
|
675
|
+
const raw = row.cells[i] ?? "";
|
|
676
|
+
if (!column || column.kind === "id" || raw.trim() === "")
|
|
677
|
+
return;
|
|
678
|
+
const at = { line: row.line, column: name };
|
|
679
|
+
if (column.kind === "field") {
|
|
680
|
+
fields[name] = normalized(column, raw);
|
|
681
|
+
places.set(pointerOf("records", index, "fields", name), at);
|
|
682
|
+
} else if (column.kind === "role") {
|
|
683
|
+
const relations = relationsOf(column, raw);
|
|
684
|
+
if (!Array.isArray(relations)) {
|
|
685
|
+
errors.push({ ...relations, pointer: pointerOf("records", index, "relations"), key: record.key, place: at });
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
record.relations = [...(record.relations ?? []).filter((r) => r.role !== name), ...relations];
|
|
689
|
+
places.set(pointerOf("records", index, "relations"), at);
|
|
690
|
+
} else {
|
|
691
|
+
const [of = "", key = ""] = name.split(".");
|
|
692
|
+
list = of;
|
|
693
|
+
item[key] = normalized(column, raw);
|
|
694
|
+
}
|
|
695
|
+
});
|
|
696
|
+
if (list) {
|
|
697
|
+
fields[list] ??= [];
|
|
698
|
+
const items = fields[list];
|
|
699
|
+
places.set(pointerOf("records", index, "fields", list, items.length), { line: row.line });
|
|
700
|
+
items.push(item);
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
if (errors.length > 0)
|
|
704
|
+
throw new TableError(errors);
|
|
705
|
+
const envelope = {
|
|
706
|
+
schema_version: RECORDS_SCHEMA_VERSION,
|
|
707
|
+
source,
|
|
708
|
+
...options ? { options } : {},
|
|
709
|
+
records
|
|
710
|
+
};
|
|
711
|
+
return {
|
|
712
|
+
envelope,
|
|
713
|
+
placeOf(pointer) {
|
|
714
|
+
const item = /^\/records\/\d+\/fields\/([^/]+)\/\d+\/([^/]+)/.exec(pointer);
|
|
715
|
+
for (let at = pointer; at !== ""; at = at.slice(0, at.lastIndexOf("/"))) {
|
|
716
|
+
const place = places.get(at);
|
|
717
|
+
if (place)
|
|
718
|
+
return item && !place.column ? { ...place, column: `${item[1]}.${item[2]}` } : place;
|
|
719
|
+
}
|
|
720
|
+
return void 0;
|
|
721
|
+
}
|
|
722
|
+
};
|
|
723
|
+
}, "envelopeOfCsv");
|
|
724
|
+
|
|
356
725
|
// node_modules/.pnpm/qrcode-generator@2.0.4/node_modules/qrcode-generator/dist/qrcode.mjs
|
|
357
726
|
var qrcode = /* @__PURE__ */ __name(function(typeNumber, errorCorrectionLevel) {
|
|
358
727
|
const PAD0 = 236;
|
|
@@ -1987,7 +2356,7 @@ var createDataURL = /* @__PURE__ */ __name(function(width, height, getPixel) {
|
|
|
1987
2356
|
var qrcode_default = qrcode;
|
|
1988
2357
|
var stringToBytes = qrcode.stringToBytes;
|
|
1989
2358
|
|
|
1990
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
2359
|
+
// 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/terminal/qr.js
|
|
1991
2360
|
var QUIET_ZONE = 4;
|
|
1992
2361
|
var BLACK_ON_WHITE = "\x1B[30;107m";
|
|
1993
2362
|
var RESET = "\x1B[0m";
|
|
@@ -2034,7 +2403,7 @@ var plainQr = /* @__PURE__ */ __name((link) => {
|
|
|
2034
2403
|
return lines.join("\n");
|
|
2035
2404
|
}, "plainQr");
|
|
2036
2405
|
|
|
2037
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
2406
|
+
// 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/terminal/login-qr.js
|
|
2038
2407
|
var MARGIN = 2;
|
|
2039
2408
|
var atTerminal = /* @__PURE__ */ __name((input) => input.isTTY === true && !inputPolicy(input).noInput, "atTerminal");
|
|
2040
2409
|
var PASTE_QR = "agents: paste the QR code above into the chat as a code block, exactly as printed; when a new one is printed, paste it and say the old one expired";
|
|
@@ -2074,6 +2443,7 @@ export {
|
|
|
2074
2443
|
DEFAULT_LINK_CONFIG,
|
|
2075
2444
|
formatLink,
|
|
2076
2445
|
parseLink,
|
|
2446
|
+
refsForLink,
|
|
2077
2447
|
linkTargetOf,
|
|
2078
2448
|
linkConfigOf,
|
|
2079
2449
|
linkFor,
|
|
@@ -2082,6 +2452,11 @@ export {
|
|
|
2082
2452
|
parseMarkdown,
|
|
2083
2453
|
parseMarkdownSpans,
|
|
2084
2454
|
countedPoll,
|
|
2455
|
+
TABLE_RECORD_TYPES,
|
|
2456
|
+
TableError,
|
|
2457
|
+
recordColumns,
|
|
2458
|
+
recordTemplate,
|
|
2459
|
+
envelopeOfCsv,
|
|
2085
2460
|
terminalQr,
|
|
2086
2461
|
plainQr,
|
|
2087
2462
|
atTerminal,
|