@wirecat/zoom-cli 0.67.0 → 0.69.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/dist/answer-entities.d.ts +18 -0
- package/dist/answer-entities.d.ts.map +1 -1
- package/dist/answer-entities.js +12 -0
- package/dist/answer-entities.js.map +1 -1
- package/dist/answer-policy.d.ts.map +1 -1
- package/dist/answer-policy.js +2 -1
- package/dist/answer-policy.js.map +1 -1
- package/dist/bin/zm.js +2 -2
- package/dist/bundle/{all-profiles-SEW2VL76.js → all-profiles-ZQWPCJEK.js} +12 -12
- package/dist/bundle/answer-policy-VBDYLUXI.js +104 -0
- package/dist/bundle/{anthropic-FSNASJML.js → anthropic-7FUQ2HYJ.js} +7 -7
- package/dist/bundle/{app-server-EVSRYJ3H.js → app-server-DNPE2EQB.js} +61 -58
- package/dist/bundle/{bun-DACL5SVO.js → bun-ZVQFCFCC.js} +2 -2
- package/dist/bundle/{bun-sqlite-HQ2KOXSI.js → bun-sqlite-EB2UMUPJ.js} +6 -6
- package/dist/bundle/{chunk-4ZR5DJ26.js → chunk-2SYWVIQJ.js} +3 -3
- package/dist/bundle/chunk-37B7A4RP.js +66 -0
- package/dist/bundle/{chunk-WHQ4ZCJI.js → chunk-3TPRYZUW.js} +214 -86
- package/dist/bundle/{chunk-L6CAUVMU.js → chunk-4APZQYCH.js} +5 -5
- package/dist/bundle/{chunk-ASCHAVNW.js → chunk-52DCABMU.js} +27 -27
- package/dist/bundle/{chunk-LM26DJOK.js → chunk-5GOE6PQK.js} +6 -6
- package/dist/bundle/{chunk-QX2MAT6I.js → chunk-5H6VTEEC.js} +3 -3
- package/dist/bundle/{chunk-V33VGWT3.js → chunk-5ZF6QVMC.js} +16 -6
- package/dist/bundle/{chunk-GP4NSYDU.js → chunk-5ZJXKASF.js} +254 -13
- package/dist/bundle/chunk-6AMMTXEA.js +12473 -0
- package/dist/bundle/{chunk-Q65SDEFN.js → chunk-6KMTQX3D.js} +2 -2
- package/dist/bundle/{chunk-TBRG2DPE.js → chunk-6N2D6JGX.js} +2 -2
- package/dist/bundle/{chunk-X67YD3QI.js → chunk-6TICX3MN.js} +2 -2
- package/dist/bundle/{chunk-4GCKDO2H.js → chunk-7AUP2WT3.js} +3 -3
- package/dist/bundle/{chunk-JVCHGI7W.js → chunk-B5D7NZI7.js} +1 -1
- package/dist/bundle/{chunk-AAZFLJSH.js → chunk-B6JMVB6R.js} +10 -10
- package/dist/bundle/{chunk-CRLBTNC4.js → chunk-BL36NSV5.js} +3 -3
- package/dist/bundle/{chunk-4UVT2QCO.js → chunk-BOAMDYLY.js} +4 -4
- package/dist/bundle/{chunk-VQTAU4DV.js → chunk-C6TEYKXV.js} +8 -8
- package/dist/bundle/{chunk-6AJDVJVZ.js → chunk-CKK6JOC4.js} +2 -2
- package/dist/bundle/{chunk-4U2555EQ.js → chunk-CUZHKYC2.js} +30 -28
- package/dist/bundle/{chunk-7LLUUXJB.js → chunk-DHD25JII.js} +1 -1
- package/dist/bundle/{chunk-RYKG6AEH.js → chunk-EPPSMCEV.js} +4 -2
- package/dist/bundle/chunk-F5DYBWH7.js +299 -0
- package/dist/bundle/{chunk-KIJLM5UL.js → chunk-FBLUKCIR.js} +1 -1
- package/dist/bundle/{chunk-WZ5XK74U.js → chunk-FEM2JQN2.js} +1 -1
- package/dist/bundle/{chunk-SSXCOUP3.js → chunk-G6IX2MD2.js} +500 -227
- package/dist/bundle/{chunk-OTMGAKUM.js → chunk-GR3QDHBU.js} +7 -7
- package/dist/bundle/{chunk-QEI55M2F.js → chunk-GXDOTUUO.js} +10 -10
- package/dist/bundle/chunk-H3MFBYTQ.js +261 -0
- package/dist/bundle/{chunk-DFUPETW7.js → chunk-HC56J5LB.js} +135 -76
- package/dist/bundle/{chunk-D6OXI2NV.js → chunk-HSI7YOYK.js} +229 -67
- package/dist/bundle/{chunk-FGTPREAZ.js → chunk-HW5QTRFF.js} +35 -35
- package/dist/bundle/{chunk-VNIBTNV4.js → chunk-IEC4E65G.js} +2 -2
- package/dist/bundle/{chunk-EUPZSR2G.js → chunk-IPBZKUC3.js} +4 -4
- package/dist/bundle/{chunk-EQ7XRRKV.js → chunk-JHFP3Z5S.js} +11 -11
- package/dist/bundle/{chunk-3GO3KME7.js → chunk-JX5JJZC3.js} +3 -3
- package/dist/bundle/{chunk-7HAIM7GV.js → chunk-JZ4YOAHA.js} +963 -622
- package/dist/bundle/{chunk-B3KWAULD.js → chunk-KAPJQGHE.js} +2 -2
- package/dist/bundle/{chunk-T6CZWSHF.js → chunk-KNE6VFHZ.js} +21 -21
- package/dist/bundle/{chunk-I7SOXH64.js → chunk-KX5MZVPX.js} +66 -39
- package/dist/bundle/chunk-L62EJDNZ.js +64 -0
- package/dist/bundle/{chunk-EPDRF66S.js → chunk-LDRQ5NAP.js} +22 -14
- package/dist/bundle/{chunk-7VU5UGRR.js → chunk-LEA4BGK7.js} +16 -16
- package/dist/bundle/{chunk-ZMPTO2WB.js → chunk-LQX74VKG.js} +1 -1
- package/dist/bundle/{chunk-LKJXTACE.js → chunk-MJMVIFSC.js} +7 -7
- package/dist/bundle/{chunk-KWRSC6O6.js → chunk-MNOVYS43.js} +18 -4
- package/dist/bundle/{chunk-M43MBWJX.js → chunk-MOTKS7XG.js} +20741 -14882
- package/dist/bundle/{chunk-MWEOVTIF.js → chunk-MSDCZ6GT.js} +4 -4
- package/dist/bundle/{chunk-SOZVC3SV.js → chunk-MVDPZRFE.js} +1 -1
- package/dist/bundle/{chunk-NTZDM5SJ.js → chunk-NRRI37NJ.js} +9 -9
- package/dist/bundle/{chunk-BKY4XVB4.js → chunk-O7L44JK2.js} +2632 -1870
- package/dist/bundle/{chunk-6IBM4Z3V.js → chunk-OE7EIP5L.js} +1 -1
- package/dist/bundle/{chunk-RAMPYIO2.js → chunk-OSBHEM2A.js} +11 -11
- package/dist/bundle/{chunk-KV4267S4.js → chunk-P3ASN72F.js} +1 -1
- package/dist/bundle/{chunk-DG4DWAU7.js → chunk-QLGG7S6F.js} +3 -3
- package/dist/bundle/{chunk-6UFWFKFH.js → chunk-QW5VPZEH.js} +2 -2
- package/dist/bundle/{chunk-C6UKW7JO.js → chunk-QXM7S3Y3.js} +6 -6
- package/dist/bundle/{chunk-ESFMHBHH.js → chunk-R2ULMWB4.js} +62 -53
- package/dist/bundle/{chunk-L6WUAGPN.js → chunk-R3JYPY3J.js} +3 -3
- package/dist/bundle/{chunk-2UW533HQ.js → chunk-RGJ7OWHU.js} +4 -4
- package/dist/bundle/{chunk-7K5TDTZY.js → chunk-RPQ3JOD3.js} +7 -7
- package/dist/bundle/{chunk-L643D4RJ.js → chunk-S2EAGDS7.js} +12 -12
- package/dist/bundle/{chunk-4KDZ22RA.js → chunk-SQT47CFW.js} +1 -1
- package/dist/bundle/{chunk-CLEZE65P.js → chunk-SZ3Z4ZNO.js} +1 -1
- package/dist/bundle/chunk-T5X4LGXE.js +380 -0
- package/dist/bundle/{chunk-SMVO5R3T.js → chunk-TFFEFEG2.js} +39 -26
- package/dist/bundle/{chunk-LFQ73UFK.js → chunk-TKXLWFM2.js} +3 -3
- package/dist/bundle/{chunk-SCFFCIIP.js → chunk-TN77LX6W.js} +2 -2
- package/dist/bundle/{chunk-VFIEYRYD.js → chunk-TWIC6JJG.js} +8 -8
- package/dist/bundle/{chunk-FXQPK742.js → chunk-UEZ6URJR.js} +29 -15
- package/dist/bundle/{chunk-OZEYFJX2.js → chunk-V4MM6GST.js} +1 -1
- package/dist/bundle/chunk-V74QFMSL.js +31 -0
- package/dist/bundle/{chunk-YPF6OS37.js → chunk-VW6BF6M7.js} +1 -1
- package/dist/bundle/{chunk-6TZF2JP7.js → chunk-WY4NYPPS.js} +13 -13
- package/dist/bundle/{chunk-B5Z4XPVS.js → chunk-XITUFTON.js} +2 -2
- package/dist/bundle/{chunk-FWU3ZYHE.js → chunk-XJBYGMZ4.js} +776 -134
- package/dist/bundle/{chunk-KANH7GBB.js → chunk-XRZDYWF6.js} +2 -2
- package/dist/bundle/{chunk-ZRMZBMOF.js → chunk-Z6TTGTMU.js} +156 -9
- package/dist/bundle/{chunk-IFDO3YPJ.js → chunk-ZRHMB3LQ.js} +1 -1
- package/dist/bundle/{cli-YUATSOLA.js → cli-P3BZUE6S.js} +106 -64
- package/dist/bundle/command-contract-TOLB32NJ.js +41 -0
- package/dist/bundle/config-4KLLIADY.js +90 -0
- package/dist/bundle/{decode-IL44LNC3.js → decode-QWOQXM7M.js} +6 -6
- package/dist/bundle/{dispatch-3BGIXSJR.js → dispatch-5MGDLOK4.js} +9 -9
- package/dist/bundle/{dist-3W27UQ2S.js → dist-OUE4MF37.js} +108 -28
- package/dist/bundle/{echarts-CO4D26JF.js → echarts-65IMPY43.js} +2 -2
- package/dist/bundle/{embed-XH2X4DFM.js → embed-4IULBCKL.js} +7 -7
- package/dist/bundle/{embedder-WTFWDXBJ.js → embedder-JW4W6IZI.js} +10 -10
- package/dist/bundle/{failure-HTIS3NLS.js → failure-CR64C4XA.js} +3 -3
- package/dist/bundle/{first-run-5RBH7FDO.js → first-run-CH6C674R.js} +12 -12
- package/dist/bundle/first-screen-OCAW5ZN6.js +39 -0
- package/dist/bundle/{folders-F4DNQPIY.js → folders-VU4IN35Y.js} +5 -5
- package/dist/bundle/{instructions-EPPBL6TT.js → instructions-G5QIH2TM.js} +1 -1
- package/dist/bundle/{main-LVQTCDZS.js → main-O4ZJIEWP.js} +21 -23
- package/dist/bundle/{mcp-PPVOM4SE.js → mcp-M4QN2E7R.js} +2 -2
- package/dist/bundle/{meetings-BMELXRTR.js → meetings-77CCAVYD.js} +13 -7
- package/dist/bundle/{node-CQVMWVIG.js → node-E6VQHU4Y.js} +2 -2
- package/dist/bundle/{node-sqlite-QQEX7LZT.js → node-sqlite-RJZ4PGLD.js} +7 -7
- package/dist/bundle/{oauth-AYGX7CQS.js → oauth-F4JKNRW4.js} +8 -8
- package/dist/bundle/{open-MIL2TOT6.js → open-NYOGMIAA.js} +6 -6
- package/dist/bundle/openai-5U6EQTFQ.js +25 -0
- package/dist/bundle/{output-file-4XADZPYH.js → output-file-6COFGPUL.js} +6 -6
- package/dist/bundle/{process-NJVQK6GB.js → process-OBWUKBMX.js} +1 -1
- package/dist/bundle/{program-WUYRS6H7.js → program-MU7DEJTO.js} +115 -187
- package/dist/bundle/{prompt-J4QPFLEA.js → prompt-2QWQTHWT.js} +6 -6
- package/dist/bundle/{recognize-OLJZVNWW.js → recognize-SNUNTUC3.js} +5 -5
- package/dist/bundle/{remote-JPUXNYLV.js → remote-2CTCIQGF.js} +8 -8
- package/dist/bundle/{rerank-XVV3X5TT.js → rerank-XDA7NJNH.js} +8 -8
- package/dist/bundle/{run-log-DJXBEVS5.js → run-log-NSG3DJVX.js} +59 -59
- package/dist/bundle/{serve-NYYUO3MR.js → serve-TWQFHOV2.js} +10 -10
- package/dist/bundle/{server-4Z5E4YTT.js → server-RIQ6HMH2.js} +47 -47
- package/dist/bundle/server-XO6XQQTJ.js +72 -0
- package/dist/bundle/{services-EKWM76HP.js → services-NKZQJQIV.js} +49 -33
- package/dist/bundle/{speech-WFJ44ACJ.js → speech-ZOB76SXA.js} +14 -14
- package/dist/bundle/{state-VIRCT4VW.js → state-7YYEIXQ5.js} +7 -7
- package/dist/bundle/{store-ZTDZ6UY5.js → store-E6RTSSNR.js} +29 -18
- package/dist/bundle/{store-2Q4GEZJS.js → store-OX4HRBLO.js} +80 -29
- package/dist/bundle/store-connection-55QPNUDS.js +83 -0
- package/dist/bundle/store-maintenance-command-Q5MSU6OK.js +62 -0
- package/dist/bundle/{streaming-7BPKIGAS.js → streaming-O53PIORL.js} +7 -7
- package/dist/bundle/{tokens-CQHMMKNX.js → tokens-QKNEP2GJ.js} +7 -7
- package/dist/bundle/zm.js +9 -10
- package/dist/bundle/zoom-app-TSI2MGVK.js +41 -0
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +1 -0
- package/dist/commands.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -3
- package/dist/config.js.map +1 -1
- package/dist/identity.d.ts +1 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +11 -0
- package/dist/identity.js.map +1 -1
- package/dist/program-bindings.d.ts.map +1 -1
- package/dist/program-bindings.js +7 -2
- package/dist/program-bindings.js.map +1 -1
- package/dist/setup-commands.d.ts +6 -0
- package/dist/setup-commands.d.ts.map +1 -1
- package/dist/setup-commands.js +24 -9
- package/dist/setup-commands.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/zoom-app.d.ts +32 -0
- package/dist/zoom-app.d.ts.map +1 -1
- package/dist/zoom-app.js +61 -0
- package/dist/zoom-app.js.map +1 -1
- package/package.json +3 -3
- package/dist/bundle/answer-policy-5OYUL6UF.js +0 -103
- package/dist/bundle/chunk-3ZIHUSMM.js +0 -22
- package/dist/bundle/chunk-54RTMQL6.js +0 -132
- package/dist/bundle/chunk-6VFORXL3.js +0 -101
- package/dist/bundle/chunk-D4KBD63W.js +0 -19
- package/dist/bundle/chunk-J3ZBEWQY.js +0 -880
- package/dist/bundle/chunk-SXFODCYK.js +0 -9
- package/dist/bundle/chunk-YRNZT4GQ.js +0 -176
- package/dist/bundle/chunk-Z3WXI4DK.js +0 -31
- package/dist/bundle/command-contract-UWHY55UE.js +0 -41
- package/dist/bundle/config-TGF6E6ZD.js +0 -89
- package/dist/bundle/first-screen-PGFIXJAX.js +0 -39
- package/dist/bundle/openai-7QZZXQW5.js +0 -25
- package/dist/bundle/server-VW5UVCH7.js +0 -72
- package/dist/bundle/store-connection-FKVVQLEF.js +0 -83
- package/dist/bundle/store-maintenance-command-AU73UVUQ.js +0 -62
- package/dist/bundle/zoom-app-OEKFMJS6.js +0 -25
- /package/dist/bundle/{chunk-LU3WKZBA.js → chunk-VOXIGICJ.js} +0 -0
|
@@ -1,880 +0,0 @@
|
|
|
1
|
-
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
-
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
holdsCredential,
|
|
5
|
-
secretNamed
|
|
6
|
-
} from "./chunk-OZEYFJX2.js";
|
|
7
|
-
import {
|
|
8
|
-
formatMeetingReference,
|
|
9
|
-
parseMeetingReference
|
|
10
|
-
} from "./chunk-DFUPETW7.js";
|
|
11
|
-
import {
|
|
12
|
-
CliError
|
|
13
|
-
} from "./chunk-WZ5XK74U.js";
|
|
14
|
-
import {
|
|
15
|
-
singleLine
|
|
16
|
-
} from "./chunk-6IBM4Z3V.js";
|
|
17
|
-
import {
|
|
18
|
-
__name
|
|
19
|
-
} from "./chunk-ZVVMGPBJ.js";
|
|
20
|
-
|
|
21
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.570.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_093219d088c44dcb3d8868e1fe992f3e/node_modules/@wirecat/cli-core/dist/domain/locator.js
|
|
22
|
-
var SCHEME = "msg:";
|
|
23
|
-
var formatLocator = /* @__PURE__ */ __name(({ provider, account, chat, message }) => SCHEME + [provider, account, chat, message].map(encodeURIComponent).join("/"), "formatLocator");
|
|
24
|
-
var isLocator = /* @__PURE__ */ __name((reference) => reference.trim().startsWith(SCHEME), "isLocator");
|
|
25
|
-
var parseLocator = /* @__PURE__ */ __name((reference) => {
|
|
26
|
-
const trimmed = reference.trim();
|
|
27
|
-
const parts2 = trimmed.startsWith(SCHEME) ? trimmed.slice(SCHEME.length).split("/") : [];
|
|
28
|
-
if (parts2.length !== 4 || parts2.some((part) => part === "")) {
|
|
29
|
-
throw new CliError("validation_error", `"${singleLine(reference)}" is not a message locator \u2014 expected msg:<provider>/<account>/<chat>/<message>`);
|
|
30
|
-
}
|
|
31
|
-
const [provider, account, chat, message] = parts2.map(decodeURIComponent);
|
|
32
|
-
return { provider, account, chat, message };
|
|
33
|
-
}, "parseLocator");
|
|
34
|
-
|
|
35
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.570.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_093219d088c44dcb3d8868e1fe992f3e/node_modules/@wirecat/cli-core/dist/domain/references.js
|
|
36
|
-
var SIMPLE_REFERENCES = [
|
|
37
|
-
"note",
|
|
38
|
-
"document",
|
|
39
|
-
"person",
|
|
40
|
-
"organization",
|
|
41
|
-
"project",
|
|
42
|
-
"task",
|
|
43
|
-
"memory",
|
|
44
|
-
"fact",
|
|
45
|
-
"bot",
|
|
46
|
-
"event",
|
|
47
|
-
"invoice",
|
|
48
|
-
"payment",
|
|
49
|
-
"entity"
|
|
50
|
-
];
|
|
51
|
-
var malformed = /* @__PURE__ */ __name((text, shape) => new CliError("validation_error", `"${singleLine(text)}" is not a reference \u2014 expected ${shape}`, {
|
|
52
|
-
reason: "ref.malformed"
|
|
53
|
-
}), "malformed");
|
|
54
|
-
var parts = /* @__PURE__ */ __name((rest, count, text, shape) => {
|
|
55
|
-
const split = rest.split("/");
|
|
56
|
-
if (split.length !== count || split.some((part) => part === ""))
|
|
57
|
-
throw malformed(text, shape);
|
|
58
|
-
return split.map(decodeURIComponent);
|
|
59
|
-
}, "parts");
|
|
60
|
-
var encoded = /* @__PURE__ */ __name((...values) => values.map(encodeURIComponent).join("/"), "encoded");
|
|
61
|
-
var folderPath = /* @__PURE__ */ __name((path) => {
|
|
62
|
-
const clean = path.split("/").filter((part) => part !== "" && part !== ".").join("/");
|
|
63
|
-
return clean === "" ? path.trim() === "" ? "" : null : clean;
|
|
64
|
-
}, "folderPath");
|
|
65
|
-
var MEETING_SHAPE = "meeting:<account>/<meeting>[/<transcript>[/<cue>]] with safe integer ids";
|
|
66
|
-
var kind = /* @__PURE__ */ __name((spec) => spec, "kind");
|
|
67
|
-
var simple = /* @__PURE__ */ __name((prefix) => kind({
|
|
68
|
-
prefix,
|
|
69
|
-
type: prefix,
|
|
70
|
-
shape: `${prefix}:<id>`,
|
|
71
|
-
parse: /* @__PURE__ */ __name((rest, text) => {
|
|
72
|
-
if (!rest.trim())
|
|
73
|
-
throw new CliError("validation_error", `"${singleLine(text)}" names no ${prefix}`, {
|
|
74
|
-
reason: "ref.malformed"
|
|
75
|
-
});
|
|
76
|
-
return { type: prefix, id: rest };
|
|
77
|
-
}, "parse"),
|
|
78
|
-
format: /* @__PURE__ */ __name((reference) => `${reference.type}:${reference.id}`, "format")
|
|
79
|
-
}), "simple");
|
|
80
|
-
var REF_KINDS = [
|
|
81
|
-
kind({
|
|
82
|
-
prefix: "msg",
|
|
83
|
-
type: "message",
|
|
84
|
-
shape: "msg:<provider>/<account>/<chat>/<message>",
|
|
85
|
-
parse: /* @__PURE__ */ __name((_, text) => {
|
|
86
|
-
try {
|
|
87
|
-
return { type: "message", ...parseLocator(text) };
|
|
88
|
-
} catch {
|
|
89
|
-
throw malformed(text, "msg:<provider>/<account>/<chat>/<message>");
|
|
90
|
-
}
|
|
91
|
-
}, "parse"),
|
|
92
|
-
format: formatLocator
|
|
93
|
-
}),
|
|
94
|
-
kind({
|
|
95
|
-
prefix: "chat",
|
|
96
|
-
type: "chat",
|
|
97
|
-
shape: "chat:<provider>/<account>/<chat>",
|
|
98
|
-
parse: /* @__PURE__ */ __name((rest, text) => {
|
|
99
|
-
const [provider, account, chat] = parts(rest, 3, text, "chat:<provider>/<account>/<chat>");
|
|
100
|
-
return { type: "chat", provider, account, chat };
|
|
101
|
-
}, "parse"),
|
|
102
|
-
format: /* @__PURE__ */ __name(({ provider, account, chat }) => `chat:${encoded(provider, account, chat)}`, "format")
|
|
103
|
-
}),
|
|
104
|
-
kind({
|
|
105
|
-
prefix: "contact",
|
|
106
|
-
type: "contact",
|
|
107
|
-
shape: "contact:<provider>/<id>",
|
|
108
|
-
parse: /* @__PURE__ */ __name((rest, text) => {
|
|
109
|
-
const [provider, id] = parts(rest, 2, text, "contact:<provider>/<id>");
|
|
110
|
-
return { type: "contact", provider, id };
|
|
111
|
-
}, "parse"),
|
|
112
|
-
format: /* @__PURE__ */ __name(({ provider, id }) => `contact:${encoded(provider, id)}`, "format")
|
|
113
|
-
}),
|
|
114
|
-
kind({
|
|
115
|
-
prefix: "folder",
|
|
116
|
-
type: "folder",
|
|
117
|
-
shape: "folder:<id>[/<path>]",
|
|
118
|
-
parse: /* @__PURE__ */ __name((rest, text) => {
|
|
119
|
-
const slash = rest.indexOf("/");
|
|
120
|
-
const id = decodeURIComponent(slash < 0 ? rest : rest.slice(0, slash));
|
|
121
|
-
const path = slash < 0 ? null : folderPath(decodeURIComponent(rest.slice(slash + 1)));
|
|
122
|
-
if (!id.trim() || path === "")
|
|
123
|
-
throw malformed(text, "folder:<id>[/<path>]");
|
|
124
|
-
return { type: "folder", id, path };
|
|
125
|
-
}, "parse"),
|
|
126
|
-
format: /* @__PURE__ */ __name(({ id, path }) => path === null ? `folder:${encodeURIComponent(id)}` : `folder:${encoded(id, path)}`, "format")
|
|
127
|
-
}),
|
|
128
|
-
kind({
|
|
129
|
-
prefix: "meeting",
|
|
130
|
-
type: "meeting",
|
|
131
|
-
shape: MEETING_SHAPE,
|
|
132
|
-
parse: /* @__PURE__ */ __name((_, text) => {
|
|
133
|
-
try {
|
|
134
|
-
return parseMeetingReference(text);
|
|
135
|
-
} catch {
|
|
136
|
-
throw malformed(text, MEETING_SHAPE);
|
|
137
|
-
}
|
|
138
|
-
}, "parse"),
|
|
139
|
-
format: formatMeetingReference
|
|
140
|
-
}),
|
|
141
|
-
...SIMPLE_REFERENCES.map(simple)
|
|
142
|
-
];
|
|
143
|
-
var byPrefix = new Map(REF_KINDS.map((spec) => [spec.prefix, spec]));
|
|
144
|
-
var byType = new Map(REF_KINDS.map((spec) => [spec.type, spec]));
|
|
145
|
-
var offered = REF_KINDS.map(({ prefix }) => prefix).filter((prefix) => prefix !== "entity");
|
|
146
|
-
var distance = /* @__PURE__ */ __name((a, b) => {
|
|
147
|
-
let row = Array.from({ length: b.length + 1 }, (_, at) => at);
|
|
148
|
-
for (const [i, x] of [...a].entries()) {
|
|
149
|
-
const next = [i + 1];
|
|
150
|
-
for (const [j, y] of [...b].entries())
|
|
151
|
-
next.push(Math.min(row[j + 1] + 1, next[j] + 1, row[j] + (x === y ? 0 : 1)));
|
|
152
|
-
row = next;
|
|
153
|
-
}
|
|
154
|
-
return row[b.length];
|
|
155
|
-
}, "distance");
|
|
156
|
-
var nearest = /* @__PURE__ */ __name((typed) => offered.find((prefix) => typed.length >= 2 && prefix.startsWith(typed)) ?? offered.map((prefix) => ({ prefix, far: distance(typed, prefix) })).filter(({ far }) => far <= 2).sort((a, b) => a.far - b.far)[0]?.prefix, "nearest");
|
|
157
|
-
var unknownKind = /* @__PURE__ */ __name((text, prefix, rest) => {
|
|
158
|
-
const near = prefix === "" ? void 0 : nearest(prefix);
|
|
159
|
-
const kinds = offered.map((one) => `${one}:`).join(", ");
|
|
160
|
-
const hint = near === void 0 ? `; kinds: ${kinds}` : `; did you mean ${near}:${singleLine(rest)}? Kinds: ${kinds}`;
|
|
161
|
-
return new CliError("validation_error", `"${singleLine(text)}" is no kind of reference${hint}`, {
|
|
162
|
-
reason: "ref.unknown-kind"
|
|
163
|
-
});
|
|
164
|
-
}, "unknownKind");
|
|
165
|
-
var formatReference = /* @__PURE__ */ __name((reference) => byType.get(reference.type).format(reference), "formatReference");
|
|
166
|
-
var parseReference = /* @__PURE__ */ __name((text) => {
|
|
167
|
-
const reference = text.trim();
|
|
168
|
-
const colon = reference.indexOf(":");
|
|
169
|
-
const prefix = colon < 0 ? "" : reference.slice(0, colon);
|
|
170
|
-
const rest = reference.slice(colon + 1);
|
|
171
|
-
const spec = byPrefix.get(prefix);
|
|
172
|
-
if (!spec)
|
|
173
|
-
throw unknownKind(reference, prefix, rest);
|
|
174
|
-
return spec.parse(rest, reference);
|
|
175
|
-
}, "parseReference");
|
|
176
|
-
var canonicalReference = /* @__PURE__ */ __name((text) => formatReference(parseReference(text)), "canonicalReference");
|
|
177
|
-
var looksLikeReference = /* @__PURE__ */ __name((text) => {
|
|
178
|
-
const match = /^([a-z]+):\S+$/.exec(text.trim());
|
|
179
|
-
return match !== null && byPrefix.has(match[1]);
|
|
180
|
-
}, "looksLikeReference");
|
|
181
|
-
|
|
182
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.570.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_093219d088c44dcb3d8868e1fe992f3e/node_modules/@wirecat/cli-core/dist/domain/providers.js
|
|
183
|
-
var KINDS = ["messages", "mail", "notes", "documents", "meetings", "events"];
|
|
184
|
-
var MESSENGER_OPENS = { chat: "messages list", message: "messages show", contact: "contacts show" };
|
|
185
|
-
var PROVIDERS = [
|
|
186
|
-
{ name: "telegram", kind: "messages", aliases: ["tg"], command: "tg", opens: MESSENGER_OPENS },
|
|
187
|
-
{ name: "telegram-bot", kind: "messages", aliases: ["tg-bot"] },
|
|
188
|
-
{ name: "max", kind: "messages", aliases: [], command: "max", opens: MESSENGER_OPENS },
|
|
189
|
-
{ name: "max-bot", kind: "messages", aliases: [] },
|
|
190
|
-
{ name: "whatsapp", kind: "messages", aliases: ["wa"], command: "wa", opens: MESSENGER_OPENS },
|
|
191
|
-
{ name: "whatsapp-bot", kind: "messages", aliases: ["wa-bot"] },
|
|
192
|
-
{ name: "email", kind: "mail", aliases: [] },
|
|
193
|
-
{ name: "notes", kind: "notes", aliases: [] },
|
|
194
|
-
{ name: "local", kind: "notes", aliases: [] },
|
|
195
|
-
{ name: "obsidian", kind: "notes", aliases: [] },
|
|
196
|
-
{ name: "zoom", kind: "meetings", aliases: [] }
|
|
197
|
-
];
|
|
198
|
-
var LABELS = {
|
|
199
|
-
telegram: "Telegram",
|
|
200
|
-
"telegram-bot": "Telegram bot",
|
|
201
|
-
max: "MAX",
|
|
202
|
-
"max-bot": "MAX bot",
|
|
203
|
-
whatsapp: "WhatsApp",
|
|
204
|
-
"whatsapp-bot": "WhatsApp bot",
|
|
205
|
-
"google-drive": "Google Drive",
|
|
206
|
-
email: "mail"
|
|
207
|
-
};
|
|
208
|
-
var providerLabel = /* @__PURE__ */ __name((provider) => LABELS[provider] ?? provider, "providerLabel");
|
|
209
|
-
var FOLDER_PROVIDERS = ["local", "obsidian", "folder"];
|
|
210
|
-
var isFolderProvider = /* @__PURE__ */ __name((provider) => FOLDER_PROVIDERS.includes(provider), "isFolderProvider");
|
|
211
|
-
var folderProviderSql = /* @__PURE__ */ __name((column = "provider") => `${column} IN (${FOLDER_PROVIDERS.map((name) => `'${name}'`).join(", ")})`, "folderProviderSql");
|
|
212
|
-
var folderProviderOf = /* @__PURE__ */ __name((format) => format === "markdown" ? "local" : "obsidian", "folderProviderOf");
|
|
213
|
-
var DOCUMENT_ACCOUNT_PROVIDERS = ["google-drive"];
|
|
214
|
-
var isDocumentAccountProvider = /* @__PURE__ */ __name((provider) => DOCUMENT_ACCOUNT_PROVIDERS.includes(provider), "isDocumentAccountProvider");
|
|
215
|
-
var filesAccountSql = /* @__PURE__ */ __name((column = "provider") => `${column} IN (${[...FOLDER_PROVIDERS, ...DOCUMENT_ACCOUNT_PROVIDERS].map((name) => `'${name}'`).join(", ")})`, "filesAccountSql");
|
|
216
|
-
var INTERNAL_NOTES = "internal";
|
|
217
|
-
var UNKNOWN_PROVIDER = "unknown provider \u2014 run its CLI once";
|
|
218
|
-
var WORD = /^[a-z0-9][a-z0-9_-]*$/;
|
|
219
|
-
var invalid = /* @__PURE__ */ __name((message) => {
|
|
220
|
-
throw new CliError("validation_error", message);
|
|
221
|
-
}, "invalid");
|
|
222
|
-
var wordOf = /* @__PURE__ */ __name((value, what) => typeof value === "string" && WORD.test(value) ? value : invalid(`${what} is lowercase letters, digits, - and _ \u2014 not ${JSON.stringify(value)}`), "wordOf");
|
|
223
|
-
var OPEN_KINDS = new Set(REF_KINDS.map(({ type }) => type).filter((type) => type !== "entity"));
|
|
224
|
-
var COMMAND_WORDS = /^[a-z0-9][a-z0-9_-]*( [a-z0-9][a-z0-9_-]*)*$/;
|
|
225
|
-
var opensOf = /* @__PURE__ */ __name((value, named) => {
|
|
226
|
-
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
227
|
-
return invalid(`provider ${named}'s opens maps a kind of reference to a command`);
|
|
228
|
-
const known = Object.entries(value).filter(([kind2]) => OPEN_KINDS.has(kind2));
|
|
229
|
-
for (const [kind2, command] of known)
|
|
230
|
-
if (typeof command !== "string" || !COMMAND_WORDS.test(command))
|
|
231
|
-
invalid(`provider ${named} opens a ${kind2} with command words, not ${JSON.stringify(command)}`);
|
|
232
|
-
return Object.fromEntries(known);
|
|
233
|
-
}, "opensOf");
|
|
234
|
-
var providerEntryOf = /* @__PURE__ */ __name((value) => {
|
|
235
|
-
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
236
|
-
return invalid("a provider entry is an object");
|
|
237
|
-
const { name, kind: kind2, aliases = [], command, opens } = value;
|
|
238
|
-
const named = wordOf(name, "a provider's name");
|
|
239
|
-
if (typeof kind2 !== "string" || !KINDS.includes(kind2))
|
|
240
|
-
invalid(`provider ${named}'s kind is one of ${KINDS.join(", ")} \u2014 not ${JSON.stringify(kind2)}`);
|
|
241
|
-
if (!Array.isArray(aliases))
|
|
242
|
-
invalid(`provider ${named}'s aliases are a list`);
|
|
243
|
-
return {
|
|
244
|
-
name: named,
|
|
245
|
-
kind: kind2,
|
|
246
|
-
aliases: [...new Set(aliases.map((alias) => wordOf(alias, `an alias of ${named}`)))],
|
|
247
|
-
...command === void 0 ? {} : { command: wordOf(command, `the command of ${named}`) },
|
|
248
|
-
...opens === void 0 ? {} : { opens: opensOf(opens, named) }
|
|
249
|
-
};
|
|
250
|
-
}, "providerEntryOf");
|
|
251
|
-
var describe = /* @__PURE__ */ __name(({ name, kind: kind2, command }) => `${name} (${kind2}${command ? `, from ${command}` : ""})`, "describe");
|
|
252
|
-
var wordsOf = /* @__PURE__ */ __name(({ name, aliases }) => [name, ...aliases], "wordsOf");
|
|
253
|
-
var joined = /* @__PURE__ */ __name((known, entry) => {
|
|
254
|
-
const same = known.find(({ name }) => name === entry.name);
|
|
255
|
-
if (same && same.kind !== entry.kind)
|
|
256
|
-
invalid(`two provider entries disagree on the kind: ${describe(same)} and ${describe(entry)}`);
|
|
257
|
-
const merged = same ? {
|
|
258
|
-
...same,
|
|
259
|
-
aliases: [.../* @__PURE__ */ new Set([...same.aliases, ...entry.aliases])],
|
|
260
|
-
...entry.command ? { command: entry.command } : {},
|
|
261
|
-
...entry.opens ? { opens: { ...same.opens, ...entry.opens } } : {}
|
|
262
|
-
} : entry;
|
|
263
|
-
const others = known.filter((one) => one !== same);
|
|
264
|
-
for (const word of wordsOf(merged)) {
|
|
265
|
-
const owner = others.find((one) => wordsOf(one).includes(word));
|
|
266
|
-
if (owner)
|
|
267
|
-
invalid(`"${word}" names two providers: ${describe(owner)} and ${describe(merged)}`);
|
|
268
|
-
}
|
|
269
|
-
return same ? known.map((one) => one === same ? merged : one) : [...known, merged];
|
|
270
|
-
}, "joined");
|
|
271
|
-
var registry = PROVIDERS;
|
|
272
|
-
var providers = /* @__PURE__ */ __name(() => registry, "providers");
|
|
273
|
-
var useProviders = /* @__PURE__ */ __name((entries) => {
|
|
274
|
-
registry = entries.map(providerEntryOf).reduce(joined, PROVIDERS);
|
|
275
|
-
}, "useProviders");
|
|
276
|
-
var useStoredProviders = /* @__PURE__ */ __name((entries) => {
|
|
277
|
-
const left = [];
|
|
278
|
-
registry = entries.reduce((known, entry) => {
|
|
279
|
-
try {
|
|
280
|
-
return joined(known, providerEntryOf(entry));
|
|
281
|
-
} catch (error) {
|
|
282
|
-
if (!(error instanceof CliError))
|
|
283
|
-
throw error;
|
|
284
|
-
left.push(entry);
|
|
285
|
-
return known;
|
|
286
|
-
}
|
|
287
|
-
}, PROVIDERS);
|
|
288
|
-
return left;
|
|
289
|
-
}, "useStoredProviders");
|
|
290
|
-
var addProvider = /* @__PURE__ */ __name((entry) => {
|
|
291
|
-
registry = joined(registry, providerEntryOf(entry));
|
|
292
|
-
}, "addProvider");
|
|
293
|
-
var isKind = /* @__PURE__ */ __name((word) => KINDS.includes(word.toLowerCase()), "isKind");
|
|
294
|
-
var providerNamed = /* @__PURE__ */ __name((word) => {
|
|
295
|
-
const wanted = word.toLowerCase();
|
|
296
|
-
return registry.find((entry) => wordsOf(entry).includes(wanted));
|
|
297
|
-
}, "providerNamed");
|
|
298
|
-
var kindIn = /* @__PURE__ */ __name((provider) => isFolderProvider(provider) ? "notes" : registry.find(({ name }) => name === provider)?.kind, "kindIn");
|
|
299
|
-
var kindOf = /* @__PURE__ */ __name((provider) => kindIn(provider) ?? "messages", "kindOf");
|
|
300
|
-
|
|
301
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.570.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_093219d088c44dcb3d8868e1fe992f3e/node_modules/@wirecat/cli-core/dist/domain/counters.js
|
|
302
|
-
var COUNTER_FIELDS = ["views", "reactions", "comments"];
|
|
303
|
-
var validCounter = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isFinite(value) && value >= 0, "validCounter");
|
|
304
|
-
var counterValue = /* @__PURE__ */ __name((message, field) => {
|
|
305
|
-
const value = field === "reactions" ? message.reactions?.total : message.providerMetadata?.[field];
|
|
306
|
-
return validCounter(value) ? value : null;
|
|
307
|
-
}, "counterValue");
|
|
308
|
-
var counterObservationTime = /* @__PURE__ */ __name((observation, now) => {
|
|
309
|
-
const at = Date.parse(observation.observedAt);
|
|
310
|
-
if (!validCounter(observation.value) || !Number.isSafeInteger(at) || at < 0 || at > now || !["remote_fetch", "remote_update"].includes(observation.source))
|
|
311
|
-
throw new CliError("validation_error", "counter observation needs a valid value, source and nonfuture observation time");
|
|
312
|
-
if (observation.reactions && (!validCounter(observation.reactions.total) || observation.reactions.total !== observation.value))
|
|
313
|
-
throw new CliError("validation_error", "reaction observation payload and total disagree");
|
|
314
|
-
return at;
|
|
315
|
-
}, "counterObservationTime");
|
|
316
|
-
var observedCounters = /* @__PURE__ */ __name((message, observedAt, fields, source = "remote_fetch") => {
|
|
317
|
-
const observations = {};
|
|
318
|
-
for (const field of fields) {
|
|
319
|
-
const value = counterValue(message, field);
|
|
320
|
-
if (value !== null)
|
|
321
|
-
observations[field] = {
|
|
322
|
-
value,
|
|
323
|
-
observedAt,
|
|
324
|
-
source,
|
|
325
|
-
...field === "reactions" && message.reactions ? { reactions: message.reactions } : {}
|
|
326
|
-
};
|
|
327
|
-
}
|
|
328
|
-
return { ...message, counterObservations: observations };
|
|
329
|
-
}, "observedCounters");
|
|
330
|
-
var counterFreshness = /* @__PURE__ */ __name((states) => {
|
|
331
|
-
if (!states.length || states.every((one) => one.freshness === "unknown"))
|
|
332
|
-
return "unknown";
|
|
333
|
-
if (states.some((one) => one.freshness === "unknown"))
|
|
334
|
-
return "partial";
|
|
335
|
-
return states.some((one) => one.freshness === "stale") ? "stale" : "fresh";
|
|
336
|
-
}, "counterFreshness");
|
|
337
|
-
|
|
338
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.570.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_093219d088c44dcb3d8868e1fe992f3e/node_modules/@wirecat/cli-core/dist/domain/money.js
|
|
339
|
-
var CURRENCY_SCALES = {
|
|
340
|
-
AED: 2,
|
|
341
|
-
AMD: 2,
|
|
342
|
-
AUD: 2,
|
|
343
|
-
BHD: 3,
|
|
344
|
-
BYN: 2,
|
|
345
|
-
CAD: 2,
|
|
346
|
-
CHF: 2,
|
|
347
|
-
CLP: 0,
|
|
348
|
-
CNY: 2,
|
|
349
|
-
CZK: 2,
|
|
350
|
-
DKK: 2,
|
|
351
|
-
EUR: 2,
|
|
352
|
-
GBP: 2,
|
|
353
|
-
GEL: 2,
|
|
354
|
-
HUF: 2,
|
|
355
|
-
ILS: 2,
|
|
356
|
-
INR: 2,
|
|
357
|
-
ISK: 0,
|
|
358
|
-
JPY: 0,
|
|
359
|
-
KGS: 2,
|
|
360
|
-
KRW: 0,
|
|
361
|
-
KWD: 3,
|
|
362
|
-
KZT: 2,
|
|
363
|
-
NOK: 2,
|
|
364
|
-
PLN: 2,
|
|
365
|
-
RSD: 2,
|
|
366
|
-
RUB: 2,
|
|
367
|
-
SEK: 2,
|
|
368
|
-
THB: 2,
|
|
369
|
-
TRY: 2,
|
|
370
|
-
UAH: 2,
|
|
371
|
-
USD: 2,
|
|
372
|
-
UZS: 2,
|
|
373
|
-
VND: 0
|
|
374
|
-
};
|
|
375
|
-
var refuse = /* @__PURE__ */ __name((message, reason) => {
|
|
376
|
-
throw new CliError("validation_error", message, { reason });
|
|
377
|
-
}, "refuse");
|
|
378
|
-
var DECIMAL = /^(\d{1,15})(?:\.(\d+))?$/;
|
|
379
|
-
var parseDecimal = /* @__PURE__ */ __name((text, scale) => {
|
|
380
|
-
const match = DECIMAL.exec(text.trim());
|
|
381
|
-
if (!match || (match[2] ?? "").length > scale)
|
|
382
|
-
return void 0;
|
|
383
|
-
return BigInt(`${match[1]}${(match[2] ?? "").padEnd(scale, "0")}`);
|
|
384
|
-
}, "parseDecimal");
|
|
385
|
-
var formatDecimal = /* @__PURE__ */ __name((units, scale) => {
|
|
386
|
-
const digits = BigInt(units).toString().padStart(scale + 1, "0");
|
|
387
|
-
return scale === 0 ? digits : `${digits.slice(0, -scale)}.${digits.slice(-scale)}`;
|
|
388
|
-
}, "formatDecimal");
|
|
389
|
-
var groupDigits = /* @__PURE__ */ __name((decimal) => {
|
|
390
|
-
const [whole = "0", fraction] = decimal.split(".");
|
|
391
|
-
const grouped = whole.replace(/\B(?=(\d{3})+(?!\d))/g, " ");
|
|
392
|
-
return fraction === void 0 ? grouped : `${grouped}.${fraction}`;
|
|
393
|
-
}, "groupDigits");
|
|
394
|
-
var currencyOf = /* @__PURE__ */ __name((text) => {
|
|
395
|
-
const code = typeof text === "string" ? text.trim().toUpperCase() : "";
|
|
396
|
-
if (CURRENCY_SCALES[code] === void 0)
|
|
397
|
-
return refuse(`${typeof text === "string" && text.trim() ? text.trim() : "an empty currency"} is not a currency the store keeps; use one of ${Object.keys(CURRENCY_SCALES).join(", ")}`, "money.currency");
|
|
398
|
-
return code;
|
|
399
|
-
}, "currencyOf");
|
|
400
|
-
var scaleOf = /* @__PURE__ */ __name((currency) => CURRENCY_SCALES[currencyOf(currency)], "scaleOf");
|
|
401
|
-
var minorUnits = /* @__PURE__ */ __name((amount, currency, what = "an amount") => {
|
|
402
|
-
const scale = scaleOf(currency);
|
|
403
|
-
const units = typeof amount === "string" ? parseDecimal(amount, scale) : void 0;
|
|
404
|
-
if (units === void 0 || units > BigInt(Number.MAX_SAFE_INTEGER))
|
|
405
|
-
return refuse(`${what} is a decimal string with at most ${scale} decimal${scale === 1 ? "" : "s"} for ${currency}, such as "${formatDecimal(5e3 * 10 ** scale, scale)}"`, "money.amount");
|
|
406
|
-
return Number(units);
|
|
407
|
-
}, "minorUnits");
|
|
408
|
-
var moneyOf = /* @__PURE__ */ __name((units, currency) => ({
|
|
409
|
-
amount: formatDecimal(units, scaleOf(currency)),
|
|
410
|
-
currency
|
|
411
|
-
}), "moneyOf");
|
|
412
|
-
var moneyLabel = /* @__PURE__ */ __name((units, currency) => `${groupDigits(formatDecimal(units, scaleOf(currency)))} ${currency}`, "moneyLabel");
|
|
413
|
-
var QUANTITY_SCALE = 3;
|
|
414
|
-
var quantityOf = /* @__PURE__ */ __name((text) => {
|
|
415
|
-
const thousandths = typeof text === "string" ? parseDecimal(text, QUANTITY_SCALE) : void 0;
|
|
416
|
-
if (thousandths === void 0 || thousandths === 0n)
|
|
417
|
-
return refuse('a quantity is a decimal string above 0 with at most 3 decimals, such as "1.5"', "money.quantity");
|
|
418
|
-
const plain = formatDecimal(thousandths, QUANTITY_SCALE).replace(/\.?0+$/, "");
|
|
419
|
-
return { text: plain, thousandths };
|
|
420
|
-
}, "quantityOf");
|
|
421
|
-
var lineUnits = /* @__PURE__ */ __name((thousandths, unitPrice) => Number((thousandths * BigInt(unitPrice) + 500n) / 1000n), "lineUnits");
|
|
422
|
-
|
|
423
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.570.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_093219d088c44dcb3d8868e1fe992f3e/node_modules/@wirecat/cli-core/dist/domain/finance.js
|
|
424
|
-
var INVOICE_DIRECTIONS = ["receivable", "payable"];
|
|
425
|
-
var INVOICE_STATUSES = ["draft", "issued", "partly_paid", "paid", "void"];
|
|
426
|
-
var MONEY_DIRECTIONS = ["in", "out"];
|
|
427
|
-
var FINANCE_REVIEWS = ["proposed", "confirmed", "rejected"];
|
|
428
|
-
var settledStatus = /* @__PURE__ */ __name((current, total, paid) => {
|
|
429
|
-
if (current === "draft" || current === "void")
|
|
430
|
-
return current;
|
|
431
|
-
if (paid <= 0)
|
|
432
|
-
return "issued";
|
|
433
|
-
return paid < total ? "partly_paid" : "paid";
|
|
434
|
-
}, "settledStatus");
|
|
435
|
-
var dayMonth = /* @__PURE__ */ __name((date) => date === null ? null : `${date.slice(8, 10)}.${date.slice(5, 7)}`, "dayMonth");
|
|
436
|
-
var notes = /* @__PURE__ */ __name((...words) => {
|
|
437
|
-
const kept = words.filter((word) => word !== null);
|
|
438
|
-
return kept.length === 0 ? "" : ` (${kept.join(", ")})`;
|
|
439
|
-
}, "notes");
|
|
440
|
-
var invoiceLine = /* @__PURE__ */ __name((invoice) => {
|
|
441
|
-
const party = invoice.counterpartyName === null ? "" : `${invoice.direction === "receivable" ? " to" : " from"} ${invoice.counterpartyName}`;
|
|
442
|
-
const due = invoice.dueDate === null ? "" : `, due ${dayMonth(invoice.dueDate)}`;
|
|
443
|
-
return `${invoice.number ?? `#${invoice.id}`} \xB7 ${moneyLabel(invoice.total, invoice.currency)}${party}${due}` + notes(invoice.status.replace("_", " "), invoice.review === "confirmed" ? null : invoice.review);
|
|
444
|
-
}, "invoiceLine");
|
|
445
|
-
var paymentLine = /* @__PURE__ */ __name((payment) => {
|
|
446
|
-
const party = payment.partyName === null ? "" : `${payment.direction === "in" ? " from" : " to"} ${payment.partyName}`;
|
|
447
|
-
return `${moneyLabel(payment.amount, payment.currency)}${party}, ${dayMonth(payment.date)}` + notes(payment.review === "confirmed" ? null : payment.review);
|
|
448
|
-
}, "paymentLine");
|
|
449
|
-
var invoiceTitle = /* @__PURE__ */ __name((invoice) => `Invoice ${invoiceLine(invoice)}`, "invoiceTitle");
|
|
450
|
-
var paymentEntryTitle = /* @__PURE__ */ __name((payment) => `Payment \xB7 ${paymentLine(payment)}`, "paymentEntryTitle");
|
|
451
|
-
|
|
452
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.570.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_093219d088c44dcb3d8868e1fe992f3e/node_modules/@wirecat/cli-core/dist/domain/rankings-options.js
|
|
453
|
-
var MESSAGE_MEASURES = ["views", "reactions", "forwards", "comments", "replies", "thread-size"];
|
|
454
|
-
var AUTHOR_MEASURES = [
|
|
455
|
-
"messages",
|
|
456
|
-
"words",
|
|
457
|
-
"reactions",
|
|
458
|
-
"replies",
|
|
459
|
-
"answers",
|
|
460
|
-
"answer-time",
|
|
461
|
-
"threads",
|
|
462
|
-
"active-days"
|
|
463
|
-
];
|
|
464
|
-
var CONTEXT = /* @__PURE__ */ new Set([
|
|
465
|
-
"replies",
|
|
466
|
-
"replies-from-others",
|
|
467
|
-
"replies-from-others-per-message",
|
|
468
|
-
"thread-size",
|
|
469
|
-
"threads",
|
|
470
|
-
"answers",
|
|
471
|
-
"answer-time"
|
|
472
|
-
]);
|
|
473
|
-
var needsRankingContext = /* @__PURE__ */ __name((options) => options.components.some((name) => CONTEXT.has(name)), "needsRankingContext");
|
|
474
|
-
var presets = {
|
|
475
|
-
helpful: { answers: 0.5, "replies-from-others": 0.25, reactions: 0.25 },
|
|
476
|
-
active: { "active-days": 0.6, messages: 0.4 },
|
|
477
|
-
engaging: { "reactions-per-message": 0.5, "replies-from-others-per-message": 0.5 }
|
|
478
|
-
};
|
|
479
|
-
function invalid2(message) {
|
|
480
|
-
throw new CliError("validation_error", message, { reason: "ranking.invalid" });
|
|
481
|
-
}
|
|
482
|
-
__name(invalid2, "invalid");
|
|
483
|
-
var rankingOptions = /* @__PURE__ */ __name((target, input) => {
|
|
484
|
-
const measures = target === "messages" ? MESSAGE_MEASURES : AUTHOR_MEASURES;
|
|
485
|
-
const { measure, score, weights: given, minMessages } = input;
|
|
486
|
-
const messageKind = input.messageKind ?? "all";
|
|
487
|
-
if (!["all", "posts", "comments"].includes(messageKind))
|
|
488
|
-
invalid2("message_kind takes all, posts or comments");
|
|
489
|
-
if (target === "messages" && minMessages !== void 0)
|
|
490
|
-
invalid2("min_messages applies to stats contacts top");
|
|
491
|
-
if (minMessages !== void 0 && (!Number.isSafeInteger(minMessages) || minMessages < 1))
|
|
492
|
-
invalid2("min_messages takes a positive integer");
|
|
493
|
-
if (measure !== void 0 && !measures.includes(measure))
|
|
494
|
-
invalid2(`--measure takes ${measures.join(", ")}`);
|
|
495
|
-
if (measure !== void 0 && (score !== void 0 || given !== void 0))
|
|
496
|
-
invalid2("--measure cannot be combined with --score or --weights");
|
|
497
|
-
if (score !== void 0 && !["helpful", "active", "engaging"].includes(score))
|
|
498
|
-
invalid2("--score takes helpful, active or engaging");
|
|
499
|
-
if (target === "messages" && score !== void 0 && score !== "engaging")
|
|
500
|
-
invalid2("helpful and active scores apply to authors only");
|
|
501
|
-
const scoring = score !== void 0 || given !== void 0;
|
|
502
|
-
const preset = score;
|
|
503
|
-
let weights = null;
|
|
504
|
-
if (scoring) {
|
|
505
|
-
let raw = given !== void 0 ? given : target === "messages" ? { reactions: 0.5, "replies-from-others": 0.5 } : presets[preset];
|
|
506
|
-
if (typeof raw === "string") {
|
|
507
|
-
try {
|
|
508
|
-
raw = JSON.parse(raw);
|
|
509
|
-
} catch {
|
|
510
|
-
invalid2("--weights takes a JSON object of component weights");
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
if (!raw || typeof raw !== "object" || Array.isArray(raw))
|
|
514
|
-
invalid2("--weights takes a JSON object of component weights");
|
|
515
|
-
const allowed = target === "messages" ? [...MESSAGE_MEASURES, "replies-from-others"] : [
|
|
516
|
-
...AUTHOR_MEASURES.filter((name) => name !== "answer-time"),
|
|
517
|
-
"replies-from-others",
|
|
518
|
-
"reactions-per-message",
|
|
519
|
-
"replies-from-others-per-message"
|
|
520
|
-
];
|
|
521
|
-
const entries = Object.entries(raw);
|
|
522
|
-
for (const [name, weight] of entries) {
|
|
523
|
-
if (!allowed.includes(name))
|
|
524
|
-
invalid2(`unknown ${target} score component: ${name}`);
|
|
525
|
-
if (typeof weight !== "number" || !Number.isFinite(weight) || weight < 0)
|
|
526
|
-
invalid2(`weight for ${name} must be a finite nonnegative number`);
|
|
527
|
-
}
|
|
528
|
-
if (!entries.some(([, weight]) => weight > 0))
|
|
529
|
-
invalid2("--weights needs at least one positive weight");
|
|
530
|
-
weights = Object.fromEntries(entries);
|
|
531
|
-
}
|
|
532
|
-
const selected = measure ?? (target === "messages" ? "reactions" : "messages");
|
|
533
|
-
return {
|
|
534
|
-
target,
|
|
535
|
-
messageKind,
|
|
536
|
-
minMessages: minMessages ?? (target === "contacts" && score === "engaging" ? 5 : 1),
|
|
537
|
-
measure: scoring ? "score" : selected,
|
|
538
|
-
order: !scoring && selected === "answer-time" ? "ascending" : "descending",
|
|
539
|
-
weights,
|
|
540
|
-
preset: scoring ? preset ?? "custom" : null,
|
|
541
|
-
components: weights === null ? [selected] : Object.entries(weights).filter(([, weight]) => weight > 0).map(([name]) => name)
|
|
542
|
-
};
|
|
543
|
-
}, "rankingOptions");
|
|
544
|
-
var rankingScore = /* @__PURE__ */ __name((raw, maxima, weights) => {
|
|
545
|
-
const entries = Object.entries(weights).filter(([, weight]) => weight > 0);
|
|
546
|
-
const scale = Math.max(...entries.map(([, weight]) => weight));
|
|
547
|
-
const denominator = entries.reduce((sum2, [, weight]) => sum2 + weight / scale, 0);
|
|
548
|
-
if (!Number.isFinite(scale) || scale <= 0 || !Number.isFinite(denominator) || denominator <= 0)
|
|
549
|
-
return null;
|
|
550
|
-
const normalized = {};
|
|
551
|
-
const contributions = {};
|
|
552
|
-
let sum = 0;
|
|
553
|
-
for (const [name, weight] of entries) {
|
|
554
|
-
const value = raw[name];
|
|
555
|
-
const maximum = maxima[name];
|
|
556
|
-
if (value == null || !Number.isFinite(value) || value < 0 || maximum === void 0 || !Number.isFinite(maximum) || maximum < value)
|
|
557
|
-
return null;
|
|
558
|
-
const part = maximum === 0 ? 0 : value / maximum;
|
|
559
|
-
normalized[name] = part;
|
|
560
|
-
contributions[name] = 100 * part * (weight / scale) / denominator;
|
|
561
|
-
sum += contributions[name];
|
|
562
|
-
}
|
|
563
|
-
return { score: Math.min(100, sum), normalized, contributions };
|
|
564
|
-
}, "rankingScore");
|
|
565
|
-
var RANKING_TOKENIZER_VERSION = 1;
|
|
566
|
-
var withoutUrls = /* @__PURE__ */ __name((text) => text.replace(/\S+/gu, (token) => {
|
|
567
|
-
for (let offset = 0; ; ) {
|
|
568
|
-
const marker = token.indexOf("://", offset);
|
|
569
|
-
if (marker < 0)
|
|
570
|
-
break;
|
|
571
|
-
let start = marker;
|
|
572
|
-
while (start > 0 && /[a-z0-9+.-]/iu.test(token[start - 1]))
|
|
573
|
-
start--;
|
|
574
|
-
if (/^[a-z][a-z0-9+.-]*$/iu.test(token.slice(start, marker)) && (start === 0 || !/\w/u.test(token[start - 1])))
|
|
575
|
-
return token.slice(0, start);
|
|
576
|
-
offset = marker + 3;
|
|
577
|
-
}
|
|
578
|
-
const folded = token.toLowerCase();
|
|
579
|
-
for (let offset = 0; ; ) {
|
|
580
|
-
const start = folded.indexOf("www.", offset);
|
|
581
|
-
if (start < 0)
|
|
582
|
-
break;
|
|
583
|
-
if (start === 0 || !/\w/u.test(token[start - 1]))
|
|
584
|
-
return token.slice(0, start);
|
|
585
|
-
offset = start + 4;
|
|
586
|
-
}
|
|
587
|
-
return token;
|
|
588
|
-
}), "withoutUrls");
|
|
589
|
-
var rankingWords = /* @__PURE__ */ __name((text) => withoutUrls(text).match(/[\p{L}\p{N}]+/gu)?.length ?? 0, "rankingWords");
|
|
590
|
-
var rankingQuestion = /* @__PURE__ */ __name((text) => withoutUrls(text).includes("?"), "rankingQuestion");
|
|
591
|
-
|
|
592
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.570.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_093219d088c44dcb3d8868e1fe992f3e/node_modules/@wirecat/cli-core/dist/domain/records.js
|
|
593
|
-
import { createHash } from "node:crypto";
|
|
594
|
-
var RECORDS_SCHEMA_VERSION = 1;
|
|
595
|
-
var RECORD_OPERATIONS = ["upsert", "delete"];
|
|
596
|
-
var RECORD_ENTITY_TYPES = ["invoice", "payment", "person", "organization", "project"];
|
|
597
|
-
var WORD2 = "^[a-z0-9][a-z0-9_-]{0,62}$";
|
|
598
|
-
var TYPE = "^(invoice|payment|person|organization|project|custom:[a-z0-9][a-z0-9_-]{0,62})$";
|
|
599
|
-
var MAX_ID = 512;
|
|
600
|
-
var MAX_FIELDS_BYTES = 65536;
|
|
601
|
-
var MAX_RELATIONS = 100;
|
|
602
|
-
var RECORDS_ENVELOPE_SCHEMA = {
|
|
603
|
-
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
604
|
-
title: "WireCat records envelope, version 1",
|
|
605
|
-
description: "Records one source sends to the store. JSONL is the same model: the first line holds schema_version and source, each further line one record.",
|
|
606
|
-
type: "object",
|
|
607
|
-
required: ["schema_version", "source", "records"],
|
|
608
|
-
additionalProperties: false,
|
|
609
|
-
properties: {
|
|
610
|
-
schema_version: { const: RECORDS_SCHEMA_VERSION },
|
|
611
|
-
source: { $ref: "#/$defs/source" },
|
|
612
|
-
records: { type: "array", items: { $ref: "#/$defs/record" } }
|
|
613
|
-
},
|
|
614
|
-
$defs: {
|
|
615
|
-
source: {
|
|
616
|
-
type: "object",
|
|
617
|
-
required: ["provider", "account", "batch_id"],
|
|
618
|
-
additionalProperties: false,
|
|
619
|
-
properties: {
|
|
620
|
-
provider: { type: "string", pattern: WORD2, description: "The system the records come from" },
|
|
621
|
-
account: { type: "string", minLength: 1, maxLength: MAX_ID, description: "The account in that system" },
|
|
622
|
-
batch_id: { type: "string", minLength: 1, maxLength: MAX_ID, description: "This import, for the receipt" }
|
|
623
|
-
}
|
|
624
|
-
},
|
|
625
|
-
record: {
|
|
626
|
-
type: "object",
|
|
627
|
-
required: ["key", "type", "external_id", "operation"],
|
|
628
|
-
additionalProperties: false,
|
|
629
|
-
properties: {
|
|
630
|
-
key: { type: "string", minLength: 1, maxLength: MAX_ID },
|
|
631
|
-
type: { type: "string", pattern: TYPE },
|
|
632
|
-
external_id: { type: "string", minLength: 1, maxLength: MAX_ID },
|
|
633
|
-
operation: { enum: [...RECORD_OPERATIONS] },
|
|
634
|
-
fields: {
|
|
635
|
-
type: "object",
|
|
636
|
-
description: "What the source says, as data: never secrets, never instructions"
|
|
637
|
-
},
|
|
638
|
-
revision: { type: "integer", minimum: 0, maximum: Number.MAX_SAFE_INTEGER },
|
|
639
|
-
relations: { type: "array", maxItems: MAX_RELATIONS, items: { $ref: "#/$defs/relation" } }
|
|
640
|
-
}
|
|
641
|
-
},
|
|
642
|
-
relation: {
|
|
643
|
-
type: "object",
|
|
644
|
-
required: ["role", "type", "external_id"],
|
|
645
|
-
additionalProperties: false,
|
|
646
|
-
properties: {
|
|
647
|
-
role: { type: "string", pattern: WORD2 },
|
|
648
|
-
type: { type: "string", pattern: TYPE },
|
|
649
|
-
external_id: { type: "string", minLength: 1, maxLength: MAX_ID }
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
};
|
|
654
|
-
var wordPattern = new RegExp(WORD2);
|
|
655
|
-
var typePattern = new RegExp(TYPE);
|
|
656
|
-
var isObject = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isObject");
|
|
657
|
-
var escapePointer = /* @__PURE__ */ __name((segment) => String(segment).replaceAll("~", "~0").replaceAll("/", "~1"), "escapePointer");
|
|
658
|
-
var pointerOf = /* @__PURE__ */ __name((...segments) => segments.map((s) => `/${escapePointer(s)}`).join(""), "pointerOf");
|
|
659
|
-
var idText = /* @__PURE__ */ __name((value) => typeof value === "string" && value.trim() !== "" && value.length <= MAX_ID && !value.includes("\0"), "idText");
|
|
660
|
-
var extraKeys = /* @__PURE__ */ __name((value, allowed) => Object.keys(value).filter((key) => !allowed.includes(key)), "extraKeys");
|
|
661
|
-
var secretIn = /* @__PURE__ */ __name((value, at) => {
|
|
662
|
-
if (typeof value === "string")
|
|
663
|
-
return holdsCredential(value) ? at : void 0;
|
|
664
|
-
if (Array.isArray(value)) {
|
|
665
|
-
for (const [index, item] of value.entries()) {
|
|
666
|
-
const found = secretIn(item, [...at, index]);
|
|
667
|
-
if (found)
|
|
668
|
-
return found;
|
|
669
|
-
}
|
|
670
|
-
return void 0;
|
|
671
|
-
}
|
|
672
|
-
if (!isObject(value))
|
|
673
|
-
return void 0;
|
|
674
|
-
for (const [key, item] of Object.entries(value)) {
|
|
675
|
-
if (secretNamed(key))
|
|
676
|
-
return [...at, key];
|
|
677
|
-
const found = secretIn(item, [...at, key]);
|
|
678
|
-
if (found)
|
|
679
|
-
return found;
|
|
680
|
-
}
|
|
681
|
-
return void 0;
|
|
682
|
-
}, "secretIn");
|
|
683
|
-
var relationErrors = /* @__PURE__ */ __name((relations, at) => {
|
|
684
|
-
if (relations === void 0)
|
|
685
|
-
return [];
|
|
686
|
-
if (!Array.isArray(relations) || relations.length > MAX_RELATIONS)
|
|
687
|
-
return [invalid3(at, `relations is a list of at most ${MAX_RELATIONS}`)];
|
|
688
|
-
return relations.flatMap((relation, index) => {
|
|
689
|
-
const here = [...at, index];
|
|
690
|
-
if (!isObject(relation))
|
|
691
|
-
return [invalid3(here, "a relation is an object")];
|
|
692
|
-
const extra = extraKeys(relation, ["role", "type", "external_id"]);
|
|
693
|
-
if (extra.length > 0)
|
|
694
|
-
return [invalid3([...here, extra[0]], "a relation holds role, type and external_id")];
|
|
695
|
-
if (typeof relation.role !== "string" || !wordPattern.test(relation.role))
|
|
696
|
-
return [invalid3([...here, "role"], "a role is lowercase letters, digits, - and _")];
|
|
697
|
-
if (typeof relation.type !== "string" || !typePattern.test(relation.type))
|
|
698
|
-
return [invalid3([...here, "type"], `a type is one of ${RECORD_ENTITY_TYPES.join(", ")} or custom:<name>`)];
|
|
699
|
-
if (!idText(relation.external_id))
|
|
700
|
-
return [invalid3([...here, "external_id"], `an external id takes 1\u2013${MAX_ID} characters`)];
|
|
701
|
-
return [];
|
|
702
|
-
});
|
|
703
|
-
}, "relationErrors");
|
|
704
|
-
var invalid3 = /* @__PURE__ */ __name((at, message, code = "record.invalid") => ({
|
|
705
|
-
pointer: pointerOf(...at),
|
|
706
|
-
code,
|
|
707
|
-
message
|
|
708
|
-
}), "invalid");
|
|
709
|
-
var recordErrors = /* @__PURE__ */ __name((record, index) => {
|
|
710
|
-
const at = ["records", index];
|
|
711
|
-
if (!isObject(record))
|
|
712
|
-
return [invalid3(at, "a record is an object")];
|
|
713
|
-
const key = typeof record.key === "string" ? record.key : void 0;
|
|
714
|
-
const withKey = /* @__PURE__ */ __name((errors) => errors.map((error) => key === void 0 ? error : { ...error, key }), "withKey");
|
|
715
|
-
const extra = extraKeys(record, ["key", "type", "external_id", "operation", "fields", "revision", "relations"]);
|
|
716
|
-
if (extra.length > 0)
|
|
717
|
-
return withKey([invalid3([...at, extra[0]], `a record has no ${extra[0]}`)]);
|
|
718
|
-
if (!idText(record.key))
|
|
719
|
-
return [invalid3([...at, "key"], `a key takes 1\u2013${MAX_ID} characters`)];
|
|
720
|
-
if (typeof record.type !== "string" || !typePattern.test(record.type))
|
|
721
|
-
return withKey([
|
|
722
|
-
invalid3([...at, "type"], `a type is one of ${RECORD_ENTITY_TYPES.join(", ")} or custom:<name>`, "record.type")
|
|
723
|
-
]);
|
|
724
|
-
if (!idText(record.external_id))
|
|
725
|
-
return withKey([invalid3([...at, "external_id"], `an external id takes 1\u2013${MAX_ID} characters`)]);
|
|
726
|
-
if (!RECORD_OPERATIONS.includes(record.operation))
|
|
727
|
-
return withKey([invalid3([...at, "operation"], "an operation is upsert or delete")]);
|
|
728
|
-
if (record.revision !== void 0 && (typeof record.revision !== "number" || !Number.isSafeInteger(record.revision) || record.revision < 0))
|
|
729
|
-
return withKey([invalid3([...at, "revision"], "a revision is a whole number, 0 or more")]);
|
|
730
|
-
if (record.operation === "upsert" && !isObject(record.fields))
|
|
731
|
-
return withKey([invalid3([...at, "fields"], "an upsert carries its fields as an object")]);
|
|
732
|
-
if (record.fields !== void 0 && !isObject(record.fields))
|
|
733
|
-
return withKey([invalid3([...at, "fields"], "fields is an object")]);
|
|
734
|
-
if (record.fields !== void 0 && Buffer.byteLength(JSON.stringify(record.fields)) > MAX_FIELDS_BYTES)
|
|
735
|
-
return withKey([invalid3([...at, "fields"], `fields take at most ${MAX_FIELDS_BYTES} bytes`, "record.too-large")]);
|
|
736
|
-
const secret = record.fields === void 0 ? void 0 : secretIn(record.fields, [...at, "fields"]);
|
|
737
|
-
if (secret)
|
|
738
|
-
return withKey([
|
|
739
|
-
invalid3(secret, "a secret never goes into the store: drop this field at the source", "record.secret-field")
|
|
740
|
-
]);
|
|
741
|
-
return withKey(relationErrors(record.relations, [...at, "relations"]));
|
|
742
|
-
}, "recordErrors");
|
|
743
|
-
var envelopeErrors = /* @__PURE__ */ __name((envelope, account) => {
|
|
744
|
-
if (!isObject(envelope))
|
|
745
|
-
return [invalid3([], "an envelope is an object", "envelope.invalid")];
|
|
746
|
-
const extra = extraKeys(envelope, ["schema_version", "source", "records"]);
|
|
747
|
-
if (extra.length > 0)
|
|
748
|
-
return [invalid3([extra[0]], `an envelope has no ${extra[0]}`, "envelope.invalid")];
|
|
749
|
-
if (envelope.schema_version !== RECORDS_SCHEMA_VERSION)
|
|
750
|
-
return [
|
|
751
|
-
invalid3(["schema_version"], `this build reads schema_version ${RECORDS_SCHEMA_VERSION}, not ${JSON.stringify(envelope.schema_version)}`, "envelope.schema-version")
|
|
752
|
-
];
|
|
753
|
-
const { source } = envelope;
|
|
754
|
-
if (!isObject(source))
|
|
755
|
-
return [invalid3(["source"], "source is an object", "envelope.invalid")];
|
|
756
|
-
const sourceExtra = extraKeys(source, ["provider", "account", "batch_id"]);
|
|
757
|
-
if (sourceExtra.length > 0)
|
|
758
|
-
return [
|
|
759
|
-
invalid3(["source", sourceExtra[0]], "source holds provider, account and batch_id", "envelope.invalid")
|
|
760
|
-
];
|
|
761
|
-
if (typeof source.provider !== "string" || !wordPattern.test(source.provider))
|
|
762
|
-
return [invalid3(["source", "provider"], "a provider is lowercase letters, digits, - and _", "envelope.invalid")];
|
|
763
|
-
if (!idText(source.account))
|
|
764
|
-
return [invalid3(["source", "account"], `an account takes 1\u2013${MAX_ID} characters`, "envelope.invalid")];
|
|
765
|
-
if (!idText(source.batch_id))
|
|
766
|
-
return [invalid3(["source", "batch_id"], `a batch id takes 1\u2013${MAX_ID} characters`, "envelope.invalid")];
|
|
767
|
-
if (source.account !== account)
|
|
768
|
-
return [
|
|
769
|
-
invalid3(["source", "account"], `the envelope is for account ${JSON.stringify(source.account)}, the import for ${JSON.stringify(account)}`, "envelope.account-mismatch")
|
|
770
|
-
];
|
|
771
|
-
if (!Array.isArray(envelope.records))
|
|
772
|
-
return [invalid3(["records"], "records is a list", "envelope.invalid")];
|
|
773
|
-
return [];
|
|
774
|
-
}, "envelopeErrors");
|
|
775
|
-
var canonical = /* @__PURE__ */ __name((value) => {
|
|
776
|
-
if (Array.isArray(value))
|
|
777
|
-
return value.map(canonical);
|
|
778
|
-
if (!isObject(value))
|
|
779
|
-
return value;
|
|
780
|
-
return Object.fromEntries(Object.keys(value).sort().map((key) => [key, canonical(value[key])]));
|
|
781
|
-
}, "canonical");
|
|
782
|
-
var recordFingerprint = /* @__PURE__ */ __name((fields, relations) => createHash("sha256").update(JSON.stringify(canonical({
|
|
783
|
-
fields,
|
|
784
|
-
relations: relations.map((relation) => [relation.role, relation.type, relation.external_id]).sort((a, b) => a.join("\0").localeCompare(b.join("\0")))
|
|
785
|
-
}))).digest("hex"), "recordFingerprint");
|
|
786
|
-
var envelopeOfJsonl = /* @__PURE__ */ __name((text) => {
|
|
787
|
-
const lines = text.split(/\r?\n/);
|
|
788
|
-
const first = lines.findIndex((line) => line.trim() !== "");
|
|
789
|
-
if (first < 0)
|
|
790
|
-
return {};
|
|
791
|
-
const parse = /* @__PURE__ */ __name((line) => {
|
|
792
|
-
try {
|
|
793
|
-
return JSON.parse(line);
|
|
794
|
-
} catch {
|
|
795
|
-
return line;
|
|
796
|
-
}
|
|
797
|
-
}, "parse");
|
|
798
|
-
const header = parse(lines[first]);
|
|
799
|
-
const records = [];
|
|
800
|
-
for (let at = first + 1; at < lines.length; at++) {
|
|
801
|
-
const line = lines[at];
|
|
802
|
-
if (line.trim() !== "")
|
|
803
|
-
records.push(parse(line));
|
|
804
|
-
}
|
|
805
|
-
return isObject(header) ? { ...header, records } : header;
|
|
806
|
-
}, "envelopeOfJsonl");
|
|
807
|
-
|
|
808
|
-
export {
|
|
809
|
-
formatLocator,
|
|
810
|
-
isLocator,
|
|
811
|
-
parseLocator,
|
|
812
|
-
REF_KINDS,
|
|
813
|
-
formatReference,
|
|
814
|
-
parseReference,
|
|
815
|
-
canonicalReference,
|
|
816
|
-
looksLikeReference,
|
|
817
|
-
KINDS,
|
|
818
|
-
PROVIDERS,
|
|
819
|
-
providerLabel,
|
|
820
|
-
FOLDER_PROVIDERS,
|
|
821
|
-
isFolderProvider,
|
|
822
|
-
folderProviderSql,
|
|
823
|
-
folderProviderOf,
|
|
824
|
-
DOCUMENT_ACCOUNT_PROVIDERS,
|
|
825
|
-
isDocumentAccountProvider,
|
|
826
|
-
filesAccountSql,
|
|
827
|
-
INTERNAL_NOTES,
|
|
828
|
-
UNKNOWN_PROVIDER,
|
|
829
|
-
providerEntryOf,
|
|
830
|
-
providers,
|
|
831
|
-
useProviders,
|
|
832
|
-
useStoredProviders,
|
|
833
|
-
addProvider,
|
|
834
|
-
isKind,
|
|
835
|
-
providerNamed,
|
|
836
|
-
kindIn,
|
|
837
|
-
kindOf,
|
|
838
|
-
COUNTER_FIELDS,
|
|
839
|
-
validCounter,
|
|
840
|
-
counterValue,
|
|
841
|
-
counterObservationTime,
|
|
842
|
-
observedCounters,
|
|
843
|
-
counterFreshness,
|
|
844
|
-
CURRENCY_SCALES,
|
|
845
|
-
parseDecimal,
|
|
846
|
-
formatDecimal,
|
|
847
|
-
currencyOf,
|
|
848
|
-
scaleOf,
|
|
849
|
-
minorUnits,
|
|
850
|
-
moneyOf,
|
|
851
|
-
moneyLabel,
|
|
852
|
-
quantityOf,
|
|
853
|
-
lineUnits,
|
|
854
|
-
INVOICE_DIRECTIONS,
|
|
855
|
-
INVOICE_STATUSES,
|
|
856
|
-
MONEY_DIRECTIONS,
|
|
857
|
-
FINANCE_REVIEWS,
|
|
858
|
-
settledStatus,
|
|
859
|
-
invoiceLine,
|
|
860
|
-
paymentLine,
|
|
861
|
-
invoiceTitle,
|
|
862
|
-
paymentEntryTitle,
|
|
863
|
-
MESSAGE_MEASURES,
|
|
864
|
-
AUTHOR_MEASURES,
|
|
865
|
-
needsRankingContext,
|
|
866
|
-
rankingOptions,
|
|
867
|
-
rankingScore,
|
|
868
|
-
RANKING_TOKENIZER_VERSION,
|
|
869
|
-
rankingWords,
|
|
870
|
-
rankingQuestion,
|
|
871
|
-
RECORDS_SCHEMA_VERSION,
|
|
872
|
-
RECORD_OPERATIONS,
|
|
873
|
-
RECORD_ENTITY_TYPES,
|
|
874
|
-
RECORDS_ENVELOPE_SCHEMA,
|
|
875
|
-
pointerOf,
|
|
876
|
-
recordErrors,
|
|
877
|
-
envelopeErrors,
|
|
878
|
-
recordFingerprint,
|
|
879
|
-
envelopeOfJsonl
|
|
880
|
-
};
|