@wirecat/cli-memo 0.131.63 → 0.131.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/memo.js +2 -2
- package/dist/bundle/{app-server-QBJG7OGQ.js → app-server-7KM4MSDA.js} +9 -9
- package/dist/bundle/{auto-LGA3VXKQ.js → auto-V3FUD6RW.js} +16 -16
- package/dist/bundle/{chunk-LK6D26RK.js → chunk-3SCHFNUH.js} +5 -5
- package/dist/bundle/{chunk-HGNWJJDT.js → chunk-3YNJBKGV.js} +13 -1
- package/dist/bundle/{chunk-Q3VEUHC7.js → chunk-6OS7PTOC.js} +3 -3
- package/dist/bundle/{chunk-2UCLF4AO.js → chunk-DXTNBVLV.js} +394 -115
- package/dist/bundle/{chunk-5Q534L4I.js → chunk-EDBZEHAU.js} +5 -4
- package/dist/bundle/{chunk-GNHDE7FH.js → chunk-FHZKHKBJ.js} +9 -9
- package/dist/bundle/{chunk-TBSWOVM3.js → chunk-FKUA3BTM.js} +14 -14
- package/dist/bundle/{chunk-TSKGEK2S.js → chunk-LVLFLWGY.js} +3 -3
- package/dist/bundle/{chunk-O2NQCWRM.js → chunk-ML46T7UC.js} +8 -8
- package/dist/bundle/{chunk-RSG7BRXI.js → chunk-MYXB2T77.js} +25 -1
- package/dist/bundle/{chunk-WDZOEBTE.js → chunk-NH3A5QTW.js} +2 -2
- package/dist/bundle/{chunk-6OZ2WI7Y.js → chunk-NIJZXGJN.js} +1 -1
- package/dist/bundle/{chunk-EGI6JHIA.js → chunk-NRHF7TQ4.js} +2 -2
- package/dist/bundle/{chunk-WDWKG7FJ.js → chunk-PVGK67AJ.js} +17 -0
- package/dist/bundle/{chunk-E5JQFEIQ.js → chunk-QHNAPLVB.js} +4 -4
- package/dist/bundle/{chunk-SJ55SMBE.js → chunk-QTF4ZXOL.js} +2 -1
- package/dist/bundle/{chunk-YVJAD5E7.js → chunk-T3LVSUNZ.js} +38 -5
- package/dist/bundle/{chunk-OXBETHGN.js → chunk-UXAP7MNL.js} +4 -4
- package/dist/bundle/{chunk-3ZXWLFUG.js → chunk-VLUDHCCX.js} +3 -3
- package/dist/bundle/{chunk-K4WCDPDL.js → chunk-WINH45XG.js} +4 -4
- package/dist/bundle/{chunk-4BKSE3CG.js → chunk-XPT5PX7H.js} +4 -4
- package/dist/bundle/{chunk-BOMHJR2E.js → chunk-ZX6SWNSR.js} +3 -3
- package/dist/bundle/{command-contract-SIXWLKAS.js → command-contract-PLB2JGFJ.js} +2 -2
- package/dist/bundle/{entry-SFLEGFSN.js → entry-MUE6HWX3.js} +1 -1
- package/dist/bundle/{failure-OGSLUNT6.js → failure-6SP64Q66.js} +14 -14
- package/dist/bundle/{first-run-ZKDGFY6P.js → first-run-3JYWLJCH.js} +1 -1
- package/dist/bundle/{first-screen-IQEU7XF2.js → first-screen-QH34AIFV.js} +3 -3
- package/dist/bundle/{mcp-Y4XMDC5Q.js → mcp-QX2D6EXA.js} +6 -6
- package/dist/bundle/memo.js +6 -6
- package/dist/bundle/{program-ZHLCEVWB.js → program-LXQLWUAG.js} +1755 -413
- package/dist/bundle/{server-IQILK5YP.js → server-L622PMVC.js} +9 -9
- package/dist/bundle/{server-I5BPRS5C.js → server-MVJU7QG4.js} +19 -19
- package/dist/bundle/{server-NKI7SVK5.js → server-SJVP2XXD.js} +6 -6
- package/dist/bundle/{store-6H4FPFTX.js → store-M5QSIRWJ.js} +1 -1
- package/dist/bundle/{store-maintenance-command-IFVWSQMJ.js → store-maintenance-command-PQCO5ICC.js} +5 -5
- package/dist/bundle/{update-YMILPFRY.js → update-MQUCCIBB.js} +15 -15
- package/dist/discovery/command.d.ts.map +1 -1
- package/dist/discovery/command.js +6 -0
- package/dist/discovery/command.js.map +1 -1
- package/dist/events/command.d.ts +4 -0
- package/dist/events/command.d.ts.map +1 -0
- package/dist/events/command.js +35 -0
- package/dist/events/command.js.map +1 -0
- package/dist/events/events.d.ts +52 -0
- package/dist/events/events.d.ts.map +1 -0
- package/dist/events/events.js +199 -0
- package/dist/events/events.js.map +1 -0
- package/dist/examples.d.ts.map +1 -1
- package/dist/examples.js +90 -3
- package/dist/examples.js.map +1 -1
- package/dist/finance/command.d.ts +1 -1
- package/dist/finance/command.d.ts.map +1 -1
- package/dist/finance/command.js +13 -30
- package/dist/finance/command.js.map +1 -1
- package/dist/finance/contracts-command.d.ts +12 -0
- package/dist/finance/contracts-command.d.ts.map +1 -0
- package/dist/finance/contracts-command.js +110 -0
- package/dist/finance/contracts-command.js.map +1 -0
- package/dist/finance/deals-command.d.ts.map +1 -1
- package/dist/finance/deals-command.js +5 -4
- package/dist/finance/deals-command.js.map +1 -1
- package/dist/finance/lines-command.d.ts +37 -0
- package/dist/finance/lines-command.d.ts.map +1 -0
- package/dist/finance/lines-command.js +70 -0
- package/dist/finance/lines-command.js.map +1 -0
- package/dist/finance/orders-command.d.ts.map +1 -1
- package/dist/finance/orders-command.js +5 -2
- package/dist/finance/orders-command.js.map +1 -1
- package/dist/finance/products-command.d.ts +12 -0
- package/dist/finance/products-command.d.ts.map +1 -0
- package/dist/finance/products-command.js +99 -0
- package/dist/finance/products-command.js.map +1 -0
- package/dist/finance/subscriptions-command.d.ts +12 -0
- package/dist/finance/subscriptions-command.d.ts.map +1 -0
- package/dist/finance/subscriptions-command.js +153 -0
- package/dist/finance/subscriptions-command.js.map +1 -0
- package/dist/finance/transactions-command.d.ts +12 -0
- package/dist/finance/transactions-command.d.ts.map +1 -0
- package/dist/finance/transactions-command.js +137 -0
- package/dist/finance/transactions-command.js.map +1 -0
- package/dist/finance/wallets-command.d.ts +12 -0
- package/dist/finance/wallets-command.d.ts.map +1 -0
- package/dist/finance/wallets-command.js +106 -0
- package/dist/finance/wallets-command.js.map +1 -0
- package/dist/finance/written.d.ts +37 -0
- package/dist/finance/written.d.ts.map +1 -0
- package/dist/finance/written.js +36 -0
- package/dist/finance/written.js.map +1 -0
- package/dist/knowledge/command.d.ts.map +1 -1
- package/dist/knowledge/command.js +3 -2
- package/dist/knowledge/command.js.map +1 -1
- package/dist/mcp/permissions.d.ts +1 -1
- package/dist/mcp/permissions.d.ts.map +1 -1
- package/dist/mcp/permissions.js +1 -0
- package/dist/mcp/permissions.js.map +1 -1
- package/dist/options.d.ts +2 -0
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js +2 -0
- package/dist/options.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +174 -0
- package/dist/program.js.map +1 -1
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +24 -0
- package/dist/reasons.js.map +1 -1
- package/dist/records/import.d.ts +2 -4
- package/dist/records/import.d.ts.map +1 -1
- package/dist/records/import.js +41 -41
- package/dist/records/import.js.map +1 -1
- package/dist/records/input.d.ts +20 -0
- package/dist/records/input.d.ts.map +1 -0
- package/dist/records/input.js +115 -0
- package/dist/records/input.js.map +1 -0
- package/dist/records/mapping.d.ts +16 -1
- package/dist/records/mapping.d.ts.map +1 -1
- package/dist/records/mapping.js +24 -11
- package/dist/records/mapping.js.map +1 -1
- package/dist/records/record-commands.d.ts +8 -0
- package/dist/records/record-commands.d.ts.map +1 -0
- package/dist/records/record-commands.js +89 -0
- package/dist/records/record-commands.js.map +1 -0
- package/dist/records/sources.d.ts +48 -0
- package/dist/records/sources.d.ts.map +1 -0
- package/dist/records/sources.js +72 -0
- package/dist/records/sources.js.map +1 -0
- package/dist/review/kinds.d.ts +1 -1
- package/dist/review/kinds.d.ts.map +1 -1
- package/dist/review/kinds.js +4 -0
- package/dist/review/kinds.js.map +1 -1
- package/dist/review/review.d.ts.map +1 -1
- package/dist/review/review.js +4 -0
- package/dist/review/review.js.map +1 -1
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +34 -0
- package/dist/rows.js.map +1 -1
- package/dist/search/lane-gates.js +1 -1
- package/dist/search/lane-gates.js.map +1 -1
- package/dist/show/command.d.ts +3 -0
- package/dist/show/command.d.ts.map +1 -1
- package/dist/show/command.js +21 -1
- package/dist/show/command.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/skills/cli-memo/SKILL.md +8 -5
- package/skills/cli-memo/topics/money.md +20 -1
- package/skills/cli-memo/topics/proposals.md +8 -5
- package/skills/cli-memo/topics/search.md +7 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { open } from "node:fs/promises";
|
|
2
|
+
import { CliError } from "@wirecat/cli-base";
|
|
3
|
+
import { envelopeOfText, isVcard } from "@wirecat/cli-core";
|
|
4
|
+
import { ingest, ingestLines, ingestVcard, jsonlLines } from "@wirecat/cli-core/services";
|
|
5
|
+
/** A vCard address book is a phone's contacts: they go under the seeded `phone` provider, one account per device. */
|
|
6
|
+
const PHONE = "phone";
|
|
7
|
+
const BOM = /^\uFEFF/;
|
|
8
|
+
const errnoOf = (error) => typeof error === "object" && error !== null && "code" in error ? String(error.code) : undefined;
|
|
9
|
+
/** A file opened now, so a missing one fails before anything is read; its errors come as answers, not as errno. */
|
|
10
|
+
const linesOf = async (file, stdin) => {
|
|
11
|
+
if (file === "-")
|
|
12
|
+
return jsonlLines(stdin);
|
|
13
|
+
try {
|
|
14
|
+
const handle = await open(file);
|
|
15
|
+
if (!(await handle.stat()).isFile()) {
|
|
16
|
+
await handle.close();
|
|
17
|
+
throw Object.assign(new Error(`${file} is a folder`), { code: "EISDIR" });
|
|
18
|
+
}
|
|
19
|
+
return jsonlLines(handle.createReadStream({ encoding: "utf8" }));
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
if (errnoOf(error) === "ENOENT")
|
|
23
|
+
throw new CliError("not_found", `no records file ${file}: give a file that exists, or - for stdin`, {
|
|
24
|
+
reason: "records.file-missing",
|
|
25
|
+
path: file,
|
|
26
|
+
});
|
|
27
|
+
const why = errnoOf(error) === "EISDIR" ? "it is a folder" : errnoOf(error) === "EACCES" ? "no permission" : "unreadable";
|
|
28
|
+
throw new CliError("validation_error", `the records file ${file} cannot be read: ${why}`, {
|
|
29
|
+
reason: "records.file-unreadable",
|
|
30
|
+
path: file,
|
|
31
|
+
why,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
/** A JSONL file's first line: an object holding no `records`. */
|
|
36
|
+
const headerOf = (line) => {
|
|
37
|
+
try {
|
|
38
|
+
const value = JSON.parse(line);
|
|
39
|
+
return value && typeof value === "object" && !Array.isArray(value) && !("records" in value)
|
|
40
|
+
? value
|
|
41
|
+
: undefined;
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
/** `sheet:rentals` names the envelope's provider and account, as records list and link take it. */
|
|
48
|
+
const accountIn = (envelope, given) => {
|
|
49
|
+
const provider = envelope?.source?.provider;
|
|
50
|
+
return typeof provider === "string" && given.startsWith(`${provider}:`) ? given.slice(provider.length + 1) : given;
|
|
51
|
+
};
|
|
52
|
+
const deviceOf = (given) => {
|
|
53
|
+
const at = given.indexOf(":");
|
|
54
|
+
if (at < 0)
|
|
55
|
+
return given;
|
|
56
|
+
if (given.slice(0, at) !== PHONE)
|
|
57
|
+
throw new CliError("validation_error", "a vCard file holds a phone's contacts: --account phone:<device>", {
|
|
58
|
+
param: "--account",
|
|
59
|
+
});
|
|
60
|
+
return given.slice(at + 1);
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Imports a records file or stdin. JSONL streams, a record at a time, so a file of any length fits in memory; a JSON
|
|
64
|
+
* envelope and a vCard address book are read whole, as one envelope each. `onIssue` hears every refusal as it
|
|
65
|
+
* happens, also those past the receipt's capped lists.
|
|
66
|
+
*/
|
|
67
|
+
export const importRecords = async (store, { file, stdin, account, dryRun, onIssue, }) => {
|
|
68
|
+
const iterator = (await linesOf(file, stdin))[Symbol.asyncIterator]();
|
|
69
|
+
const before = [];
|
|
70
|
+
let next = await iterator.next();
|
|
71
|
+
while (!next.done && next.value.replace(BOM, "").trim() === "") {
|
|
72
|
+
before.push(next.value);
|
|
73
|
+
next = await iterator.next();
|
|
74
|
+
}
|
|
75
|
+
async function* rest() {
|
|
76
|
+
for (let line = await iterator.next(); !line.done; line = await iterator.next())
|
|
77
|
+
yield line.value;
|
|
78
|
+
}
|
|
79
|
+
const whole = async (first) => {
|
|
80
|
+
const lines = [...before, ...first];
|
|
81
|
+
for await (const line of rest())
|
|
82
|
+
lines.push(line);
|
|
83
|
+
return lines.join("\n");
|
|
84
|
+
};
|
|
85
|
+
if (next.done)
|
|
86
|
+
return ingest(store, envelopeOfText(before.join("\n")), { account, dryRun, onIssue });
|
|
87
|
+
const first = next.value.replace(BOM, "");
|
|
88
|
+
if (isVcard(first)) {
|
|
89
|
+
const { vcard, ...receipt } = await ingestVcard(store, await whole([first]), {
|
|
90
|
+
account: deviceOf(account),
|
|
91
|
+
provider: PHONE,
|
|
92
|
+
batchId: `vcard-${new Date().toISOString()}`,
|
|
93
|
+
dryRun,
|
|
94
|
+
onIssue,
|
|
95
|
+
});
|
|
96
|
+
return { ...receipt, vcard: vcard.map((one) => ({ ...one, card: one.card + 1 })) };
|
|
97
|
+
}
|
|
98
|
+
const header = headerOf(first);
|
|
99
|
+
if (header !== undefined) {
|
|
100
|
+
async function* all() {
|
|
101
|
+
// A refused header stops the stream at its first line; the file is closed here, not when it is collected.
|
|
102
|
+
try {
|
|
103
|
+
yield first;
|
|
104
|
+
yield* rest();
|
|
105
|
+
}
|
|
106
|
+
finally {
|
|
107
|
+
await iterator.return?.();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return ingestLines(store, all(), { account: accountIn(header, account), dryRun, onIssue });
|
|
111
|
+
}
|
|
112
|
+
const envelope = envelopeOfText(await whole([first]));
|
|
113
|
+
return ingest(store, envelope, { account: accountIn(envelope, account), dryRun, onIssue });
|
|
114
|
+
};
|
|
115
|
+
//# sourceMappingURL=input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../src/records/input.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,GAAG,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,CAAA;IACpF,CAAC;IACD,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC9B,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,KAAK,SAAS,CAAC,CAAC,GAAG;YACjB,0GAA0G;YAC1G,IAAI,CAAC;gBACH,MAAM,KAAK,CAAA;gBACX,KAAK,CAAC,CAAC,IAAI,EAAE,CAAA;YACf,CAAC;oBAAS,CAAC;gBACT,MAAM,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAA;YAC3B,CAAC;QACH,CAAC;QACD,OAAO,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAA;IAC5F,CAAC;IACD,MAAM,QAAQ,GAAG,cAAc,CAAC,MAAM,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IACrD,OAAO,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAA;AAC5F,CAAC,CAAA"}
|
|
@@ -3,7 +3,22 @@ import type { Command } from "commander";
|
|
|
3
3
|
export declare const RECORD_QUERY: {
|
|
4
4
|
readonly entity: "source_record";
|
|
5
5
|
readonly backend: "native";
|
|
6
|
-
readonly fields: readonly [import("@wirecat/cli-base/query").FieldSpec, import("@wirecat/cli-base/query").FieldSpec, import("@wirecat/cli-base/query").FieldSpec];
|
|
6
|
+
readonly fields: readonly [import("@wirecat/cli-base/query").FieldSpec, import("@wirecat/cli-base/query").FieldSpec, import("@wirecat/cli-base/query").FieldSpec, import("@wirecat/cli-base/query").FieldSpec, import("@wirecat/cli-base/query").FieldSpec, import("@wirecat/cli-base/query").FieldSpec, import("@wirecat/cli-base/query").FieldSpec];
|
|
7
7
|
};
|
|
8
|
+
/** `sheet:rentals`: records are kept per source, so a read or a mapping names its provider and account. */
|
|
9
|
+
export declare const sourceOf: (account: string | undefined) => {
|
|
10
|
+
provider: string;
|
|
11
|
+
account: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* `organization:client` or `custom:quote:Q-7`: the record's type and its id at the source, as the envelope gave them.
|
|
15
|
+
* Only a `custom:` type holds a colon; any other id may hold one.
|
|
16
|
+
*/
|
|
17
|
+
export declare const recordOf: (record: string) => {
|
|
18
|
+
type: string;
|
|
19
|
+
externalId: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const RECORD_HELP = "<type>:<external_id> as the source names it, such as organization:client or custom:quote:Q-7";
|
|
22
|
+
export declare const ACCOUNT_HELP = "the source, <provider>:<account> as the envelope's source names it, such as sheet:rentals";
|
|
8
23
|
export declare const recordMappingCommands: (records: Command, program: Command, streams: Streams, env: NodeJS.ProcessEnv) => void;
|
|
9
24
|
//# sourceMappingURL=mapping.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapping.d.ts","sourceRoot":"","sources":["../../src/records/mapping.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAI1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAMxC,eAAO,MAAM,YAAY;qBACf,eAAe;sBACd,QAAQ;;
|
|
1
|
+
{"version":3,"file":"mapping.d.ts","sourceRoot":"","sources":["../../src/records/mapping.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAI1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAMxC,eAAO,MAAM,YAAY;qBACf,eAAe;sBACd,QAAQ;;CAUe,CAAA;AAElC,2GAA2G;AAC3G,eAAO,MAAM,QAAQ,YAAa,MAAM,GAAG,SAAS;;;CAQnD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,QAAQ,WAAY,MAAM;IAS5B,IAAI;IAAuB,UAAU;CAC/C,CAAA;AAED,eAAO,MAAM,WAAW,iGACwE,CAAA;AAEhG,eAAO,MAAM,YAAY,8FAA8F,CAAA;AAEvH,eAAO,MAAM,qBAAqB,YACvB,OAAO,WACP,OAAO,WACP,OAAO,OACX,MAAM,CAAC,UAAU,KACrB,IAyDF,CAAA"}
|
package/dist/records/mapping.js
CHANGED
|
@@ -12,10 +12,14 @@ export const RECORD_QUERY = {
|
|
|
12
12
|
termField("type", "kw", "type:organization"),
|
|
13
13
|
termField("waiting", "bool", "waiting:true"),
|
|
14
14
|
termField("flagged", "bool", "flagged:true"),
|
|
15
|
+
termField("unmatched", "bool", "unmatched:true"),
|
|
16
|
+
termField("entity", "ref", 'entity:"organization:3"'),
|
|
17
|
+
termField("batch", "kw", "batch:2026-11-07"),
|
|
18
|
+
termField("deleted", "bool", "deleted:true"),
|
|
15
19
|
],
|
|
16
20
|
};
|
|
17
21
|
/** `sheet:rentals`: records are kept per source, so a read or a mapping names its provider and account. */
|
|
18
|
-
const sourceOf = (account) => {
|
|
22
|
+
export const sourceOf = (account) => {
|
|
19
23
|
const [provider = "", ...rest] = (account ?? "").trim().split(":");
|
|
20
24
|
const name = rest.join(":");
|
|
21
25
|
if (!provider || !name)
|
|
@@ -24,19 +28,24 @@ const sourceOf = (account) => {
|
|
|
24
28
|
});
|
|
25
29
|
return { provider, account: name };
|
|
26
30
|
};
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
/**
|
|
32
|
+
* `organization:client` or `custom:quote:Q-7`: the record's type and its id at the source, as the envelope gave them.
|
|
33
|
+
* Only a `custom:` type holds a colon; any other id may hold one.
|
|
34
|
+
*/
|
|
35
|
+
export const recordOf = (record) => {
|
|
36
|
+
const from = record.startsWith("custom:") ? "custom:".length : 0;
|
|
37
|
+
const at = record.indexOf(":", from);
|
|
38
|
+
if (at <= from || at === record.length - 1)
|
|
39
|
+
throw new CliError("validation_error", `${record} is not <type>:<external_id>, such as organization:client or custom:quote:Q-7`, { param: "record" });
|
|
34
40
|
return { type: record.slice(0, at), externalId: record.slice(at + 1) };
|
|
35
41
|
};
|
|
36
|
-
const
|
|
42
|
+
export const RECORD_HELP = "<type>:<external_id> as the source names it, such as organization:client or custom:quote:Q-7";
|
|
43
|
+
export const ACCOUNT_HELP = "the source, <provider>:<account> as the envelope's source names it, such as sheet:rentals";
|
|
37
44
|
export const recordMappingCommands = (records, program, streams, env) => {
|
|
38
45
|
const { run } = answers(program, streams, env);
|
|
39
|
-
withQuery(annotate(records.command("list"), { effects: LOCAL_READ }).description("a source's records, newest first; waiting:true lists those
|
|
46
|
+
withQuery(annotate(records.command("list"), { effects: LOCAL_READ }).description("a source's records, newest first; waiting:true lists those that wait for a record they name, unmatched:true " +
|
|
47
|
+
"the people, organizations and projects whose identifiers fit more than one of yours, entity: those mapped " +
|
|
48
|
+
"to one of your entries"), RECORD_QUERY)
|
|
40
49
|
.summary("a source's records; waiting:true lists what needs records link")
|
|
41
50
|
.option("--account <account>", ACCOUNT_HELP)
|
|
42
51
|
.option("--limit <n>", "most records, up to 500", positive, 100)
|
|
@@ -49,6 +58,10 @@ export const recordMappingCommands = (records, program, streams, env) => {
|
|
|
49
58
|
...(terms.has("type") ? { type: terms.get("type") } : {}),
|
|
50
59
|
...(terms.get("waiting") === "true" ? { waiting: true } : {}),
|
|
51
60
|
...(terms.get("flagged") === "true" ? { flagged: true } : {}),
|
|
61
|
+
...(terms.get("unmatched") === "true" ? { unmatched: true } : {}),
|
|
62
|
+
...(terms.has("entity") ? { entity: terms.get("entity") } : {}),
|
|
63
|
+
...(terms.has("batch") ? { batch: terms.get("batch") } : {}),
|
|
64
|
+
...(terms.has("deleted") ? { deleted: terms.get("deleted") === "true" } : {}),
|
|
52
65
|
};
|
|
53
66
|
return pageOf("records list", given.limit, (most) => store.records.list({ ...filter, limit: most }));
|
|
54
67
|
}));
|
|
@@ -56,7 +69,7 @@ export const recordMappingCommands = (records, program, streams, env) => {
|
|
|
56
69
|
.description("say which of your entries a source's record is (organization:client is organization:3); never done by " +
|
|
57
70
|
"name. Records that waited for it become proposals in memo review. Only you link; an agent is refused")
|
|
58
71
|
.summary("say which of your entries a source's record is")
|
|
59
|
-
.argument("<record>",
|
|
72
|
+
.argument("<record>", RECORD_HELP)
|
|
60
73
|
.argument("<ref>", "your entry of the same type: person:<id>, organization:<id> or project:<id>")
|
|
61
74
|
.option("--account <account>", ACCOUNT_HELP)
|
|
62
75
|
.option("--json", "print JSON; --json=type,external_id,entity keeps only those fields")).action(async (record, ref, given, command) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapping.js","sourceRoot":"","sources":["../../src/records/mapping.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAgB,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAErD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjG,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEnC,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,MAAM,EAAE,eAAe;IACvB,OAAO,EAAE,QAAQ;IACjB,MAAM,EAAE;QACN,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,mBAAmB,CAAC;QAC5C,SAAS,CAAC,SAAS,E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,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC;SACjC,QAAQ,CAAC,OAAO,EAAE,6EAA6E,CAAC;SAChG,MAAM,CAAC,qBAAqB,EAAE,YAAY,CAAC;SAC3C,MAAM,CAAC,QAAQ,EAAE,oEAAoE,CAAC,CAC1F,CAAC,MAAM,CACN,KAAK,EACH,MAAc,EACd,GAAW,EACX,KAA8D,EAC9D,OAAgB,EAChB,EAAE;QACF,MAAM,EAAE,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC,CAAA;QAChH,MAAM,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CACpC,UAAU,CAAC,MAAM,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,CAClG,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MessageStore } from "@wirecat/cli-core/store";
|
|
2
|
+
import type { Command } from "commander";
|
|
3
|
+
import { type answers } from "../answer.js";
|
|
4
|
+
/** The CLI code cli-core registers for an import's refusal, such as `record.stale-revision`. */
|
|
5
|
+
export declare const codeOf: (reason: string) => "authentication_error" | "cancelled" | "configuration_error" | "confirmation_required" | "conflict" | "invalid_response" | "network_error" | "not_found" | "outcome_unknown" | "permission_error" | "provider_error" | "provider_unavailable" | "rate_limited" | "timeout" | "validation_error";
|
|
6
|
+
/** `records show`, `records delete` and `records match`: one record, and the account's waiting identities. */
|
|
7
|
+
export declare const recordCommands: (records: Command, { run, print }: ReturnType<typeof answers>, withStore: <T>(work: (store: MessageStore) => Promise<T>) => Promise<T>) => void;
|
|
8
|
+
//# sourceMappingURL=record-commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-commands.d.ts","sourceRoot":"","sources":["../../src/records/record-commands.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAY,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,cAAc,CAAA;AAMvD,gGAAgG;AAChG,eAAO,MAAM,MAAM,WAAY,MAAM,oSAGpC,CAAA;AA8BD,8GAA8G;AAC9G,eAAO,MAAM,cAAc,YAChB,OAAO,kBACA,UAAU,CAAC,OAAO,OAAO,CAAC,aAC/B,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,KACtE,IAuFF,CAAA"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { CliError } from "@wirecat/cli-base";
|
|
2
|
+
import { annotate } from "@wirecat/cli-base/commands";
|
|
3
|
+
import { CORE_REASONS, RECORDS_SCHEMA_VERSION } from "@wirecat/cli-core";
|
|
4
|
+
import { LOCAL_READ, LOCAL_WRITE } from "@wirecat/cli-core/cli";
|
|
5
|
+
import { ingest } from "@wirecat/cli-core/services";
|
|
6
|
+
import { itemAnswer } from "../answer.js";
|
|
7
|
+
import { jsonOption } from "../options.js";
|
|
8
|
+
import { ACCOUNT_HELP, RECORD_HELP, recordOf, sourceOf } from "./mapping.js";
|
|
9
|
+
const INCOMING = 100;
|
|
10
|
+
/** The CLI code cli-core registers for an import's refusal, such as `record.stale-revision`. */
|
|
11
|
+
export const codeOf = (reason) => {
|
|
12
|
+
const code = CORE_REASONS.find((one) => one.reason === reason)?.code;
|
|
13
|
+
return code === undefined || code === "internal_error" ? "validation_error" : code;
|
|
14
|
+
};
|
|
15
|
+
const storedRecord = async (store, account, record) => {
|
|
16
|
+
const key = { ...sourceOf(account), ...recordOf(record) };
|
|
17
|
+
const found = await store.records.get(key);
|
|
18
|
+
if (found === undefined)
|
|
19
|
+
throw new CliError("not_found", `no record ${record} from ${key.provider}:${key.account}; records list shows them`, {
|
|
20
|
+
reason: "records.not-stored",
|
|
21
|
+
record,
|
|
22
|
+
});
|
|
23
|
+
return found;
|
|
24
|
+
};
|
|
25
|
+
const matchText = (run) => [
|
|
26
|
+
`matched ${run.linked}, created ${run.created}`,
|
|
27
|
+
...(run.proposed.length ? [`proposed for your review: ${run.proposed.join(" ")}`] : []),
|
|
28
|
+
...run.unmatched.map((one) => `unmatched ${one.key.type}:${one.key.externalId}: ` +
|
|
29
|
+
`${one.candidates.length ? `could be ${one.candidates.join(" or ")}` : one.reason}`),
|
|
30
|
+
...run.errors.map((one) => `refused ${one.pointer} · ${one.message} (${one.code})`),
|
|
31
|
+
...(run.truncated ? ["the lists stop at 1000 entries each; the counts are exact"] : []),
|
|
32
|
+
].join("\n");
|
|
33
|
+
/** `records show`, `records delete` and `records match`: one record, and the account's waiting identities. */
|
|
34
|
+
export const recordCommands = (records, { run, print }, withStore) => {
|
|
35
|
+
jsonOption(annotate(records.command("show"), { effects: LOCAL_READ, output: { entity: "source_record" } })
|
|
36
|
+
.argument("<record>", RECORD_HELP)
|
|
37
|
+
.option("--account <account>", ACCOUNT_HELP), "fields,relations,incoming,entity")
|
|
38
|
+
.description("one record as its source said it: its fields, the records it names, the records that name it (incoming, " +
|
|
39
|
+
`the first ${INCOMING}) and the entry made from it`)
|
|
40
|
+
.summary("one record as its source said it")
|
|
41
|
+
.action((record, given) => run(given.json, async (store) => {
|
|
42
|
+
const found = await storedRecord(store, given.account, record);
|
|
43
|
+
const incoming = await store.records.incoming(found, { limit: INCOMING + 1 });
|
|
44
|
+
return itemAnswer({
|
|
45
|
+
...found,
|
|
46
|
+
incoming: { items: incoming.slice(0, INCOMING), hasMore: incoming.length > INCOMING },
|
|
47
|
+
});
|
|
48
|
+
}));
|
|
49
|
+
jsonOption(annotate(records.command("delete"), { effects: LOCAL_WRITE, output: { entity: "records_receipt" } })
|
|
50
|
+
.argument("<record>", RECORD_HELP)
|
|
51
|
+
.option("--account <account>", ACCOUNT_HELP), "deleted,flagged,errors")
|
|
52
|
+
.description("say a source no longer has a record, as an import's delete does: the record is kept as deleted, and the " +
|
|
53
|
+
"entry made from it stays, flagged for you to reject or keep")
|
|
54
|
+
.summary("mark a source's record deleted")
|
|
55
|
+
.action(async (record, given) => {
|
|
56
|
+
const receipt = await withStore(async (store) => {
|
|
57
|
+
const found = await storedRecord(store, given.account, record);
|
|
58
|
+
return ingest(store, {
|
|
59
|
+
schema_version: RECORDS_SCHEMA_VERSION,
|
|
60
|
+
source: {
|
|
61
|
+
provider: found.provider,
|
|
62
|
+
account: found.account,
|
|
63
|
+
batch_id: `delete-${new Date().toISOString()}`,
|
|
64
|
+
},
|
|
65
|
+
records: [
|
|
66
|
+
{
|
|
67
|
+
key: "delete",
|
|
68
|
+
type: found.type,
|
|
69
|
+
external_id: found.externalId,
|
|
70
|
+
operation: "delete",
|
|
71
|
+
...(found.revision === null ? {} : { revision: found.revision }),
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
}, { account: found.account });
|
|
75
|
+
});
|
|
76
|
+
const [refused] = receipt.errors;
|
|
77
|
+
if (refused)
|
|
78
|
+
throw new CliError(codeOf(refused.code), refused.message, { reason: refused.code });
|
|
79
|
+
print(given.json, itemAnswer(receipt), receipt.deleted === 0
|
|
80
|
+
? `${record} was already deleted`
|
|
81
|
+
: `deleted ${record}${receipt.flagged.length ? `; ${receipt.flagged.map((one) => one.entity).join(" ")} kept, flagged for you` : ""}`);
|
|
82
|
+
});
|
|
83
|
+
jsonOption(annotate(records.command("match"), { effects: LOCAL_WRITE, output: { entity: "records_match" } }).option("--account <account>", ACCOUNT_HELP), "linked,created,unmatched")
|
|
84
|
+
.description("link every waiting person, organization and project of a source to the one entry its e-mail, phone or other " +
|
|
85
|
+
"identifier names, or make one, as an import does; never by name. Two or more fits wait for records link")
|
|
86
|
+
.summary("match a source's waiting people and organizations")
|
|
87
|
+
.action((given) => withStore(async (store) => store.records.match(sourceOf(given.account))).then((found) => print(given.json, itemAnswer(found), matchText(found))));
|
|
88
|
+
};
|
|
89
|
+
//# sourceMappingURL=record-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-commands.js","sourceRoot":"","sources":["../../src/records/record-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AACxE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAGnD,OAAO,EAAgB,UAAU,EAAE,MAAM,cAAc,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAE5E,MAAM,QAAQ,GAAG,GAAG,CAAA;AAEpB,gGAAgG;AAChG,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,MAAc,EAAE,EAAE;IACvC,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,KAAK,MAAM,CAAC,EAAE,IAAI,CAAA;IACpE,OAAO,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,gBAAgB,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAA;AACpF,CAAC,CAAA;AAED,MAAM,YAAY,GAAG,KAAK,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AK,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CACvD,CACF,CAAA;AACL,CAAC,CAAA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { AccountKey, MessageStore } from "@wirecat/cli-core/store";
|
|
2
|
+
import type { Command } from "commander";
|
|
3
|
+
/** An entity as its `show` reads it: an import's row says `import:<provider>`, a CRM copy names its account. */
|
|
4
|
+
export interface Sourced {
|
|
5
|
+
ref: string;
|
|
6
|
+
source?: string;
|
|
7
|
+
account?: AccountKey | null;
|
|
8
|
+
}
|
|
9
|
+
export declare const SOURCED: ReadonlySet<string>;
|
|
10
|
+
export declare const readSourced: (store: MessageStore, kind: string, ref: string) => Promise<Sourced> | undefined;
|
|
11
|
+
/** Whether an import or a CRM made it, so its title is the source's words, not the owner's. */
|
|
12
|
+
export declare const imported: ({ source, account }: Sourced) => boolean;
|
|
13
|
+
/** The accounts whose records can be mapped to the entity: its CRM account, or every account of its import provider. */
|
|
14
|
+
export declare const sourceAccounts: (store: MessageStore, { source, account }: Sourced) => Promise<AccountKey[]>;
|
|
15
|
+
export interface SourceRecordRef {
|
|
16
|
+
/** `type:external_id`, as `records show` takes it with `--account`. */
|
|
17
|
+
record: string;
|
|
18
|
+
account: string;
|
|
19
|
+
flagged?: true;
|
|
20
|
+
deleted?: true;
|
|
21
|
+
}
|
|
22
|
+
export interface NamingRecord {
|
|
23
|
+
record: string;
|
|
24
|
+
account: string;
|
|
25
|
+
role: string;
|
|
26
|
+
as: string | null;
|
|
27
|
+
}
|
|
28
|
+
export interface SourcesOf {
|
|
29
|
+
records: {
|
|
30
|
+
items: SourceRecordRef[];
|
|
31
|
+
hasMore: boolean;
|
|
32
|
+
};
|
|
33
|
+
incoming: {
|
|
34
|
+
items: NamingRecord[];
|
|
35
|
+
hasMore: boolean;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Where an entity came from: the records of its source's accounts mapped to it, and the live records of any account
|
|
40
|
+
* whose relations name it, such as a quote `quoted-for` a deal.
|
|
41
|
+
*/
|
|
42
|
+
export declare const sourcesOf: (store: MessageStore, entity: Sourced) => Promise<SourcesOf>;
|
|
43
|
+
export declare const sourcesText: (ref: string, { records, incoming }: SourcesOf, indent?: string) => string[];
|
|
44
|
+
/** `sources` names source records, which `records show` reads: an MCP client denied that gets none. */
|
|
45
|
+
export declare const recordsHidden: (command: Command) => boolean;
|
|
46
|
+
/** An entity's `show` answer with where it came from beside it. */
|
|
47
|
+
export declare const withSources: <T extends Sourced>(command: Command, store: MessageStore, item: T) => Promise<T>;
|
|
48
|
+
//# sourceMappingURL=sources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sources.d.ts","sourceRoot":"","sources":["../../src/records/sources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAa,MAAM,yBAAyB,CAAA;AAClF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAKxC,gHAAgH;AAChH,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI,CAAA;CAC5B;AAiBD,eAAO,MAAM,OAAO,EAAE,WAAW,CAAC,MAAM,CAA+B,CAAA;AAEvE,eAAO,MAAM,WAAW,UAAW,YAAY,QAAQ,MAAM,OAAO,MAAM,iCAA8B,CAAA;AAIxG,+FAA+F;AAC/F,eAAO,MAAM,QAAQ,wBAAyB,OAAO,YAA+D,CAAA;AAEpH,wHAAwH;AACxH,eAAO,MAAM,cAAc,UAAiB,YAAY,uBAAuB,OAAO,KAAG,OAAO,CAAC,UAAU,EAAE,CAK5G,CAAA;AAED,MAAM,WAAW,eAAe;IAC9B,uEAAuE;IACvE,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,IAAI,CAAA;IACd,OAAO,CAAC,EAAE,IAAI,CAAA;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;CAClB;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE;QAAE,KAAK,EAAE,eAAe,EAAE,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAA;IACvD,QAAQ,EAAE;QAAE,KAAK,EAAE,YAAY,EAAE,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAA;CACtD;AAOD;;;GAGG;AACH,eAAO,MAAM,SAAS,UAAiB,YAAY,UAAU,OAAO,KAAG,OAAO,CAAC,SAAS,CAoBvF,CAAA;AAED,eAAO,MAAM,WAAW,QAAS,MAAM,yBAAyB,SAAS,sBAAkB,MAAM,EAWhG,CAAA;AAED,uGAAuG;AACvG,eAAO,MAAM,aAAa,YAAa,OAAO,YAAqD,CAAA;AAEnG,mEAAmE;AACnE,eAAO,MAAM,WAAW,GAAU,CAAC,SAAS,OAAO,WAAW,OAAO,SAAS,YAAY,QAAQ,CAAC,eACf,CAAA"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { grantedLevel } from "../mcp/granted.js";
|
|
2
|
+
const MOST = 100;
|
|
3
|
+
/** Each kind an import makes, and the read that tells where one came from. */
|
|
4
|
+
const READS = {
|
|
5
|
+
product: (store, ref) => store.products.get(ref),
|
|
6
|
+
contract: (store, ref) => store.contracts.get(ref),
|
|
7
|
+
subscription: (store, ref) => store.subscriptions.get(ref),
|
|
8
|
+
wallet: (store, ref) => store.wallets.get(ref),
|
|
9
|
+
transaction: (store, ref) => store.transactions.get(ref),
|
|
10
|
+
invoice: (store, ref) => store.finance.invoice(ref),
|
|
11
|
+
payment: (store, ref) => store.finance.payment(ref),
|
|
12
|
+
order: (store, ref) => store.orders.get(ref),
|
|
13
|
+
deal: (store, ref) => store.deals.get(ref),
|
|
14
|
+
lead: (store, ref) => store.deals.get(ref),
|
|
15
|
+
pipeline: (store, ref) => store.deals.pipeline(ref),
|
|
16
|
+
};
|
|
17
|
+
export const SOURCED = new Set(Object.keys(READS));
|
|
18
|
+
export const readSourced = (store, kind, ref) => READS[kind]?.(store, ref);
|
|
19
|
+
const IMPORT = "import:";
|
|
20
|
+
/** Whether an import or a CRM made it, so its title is the source's words, not the owner's. */
|
|
21
|
+
export const imported = ({ source, account }) => (account ?? null) !== null || !!source?.startsWith(IMPORT);
|
|
22
|
+
/** The accounts whose records can be mapped to the entity: its CRM account, or every account of its import provider. */
|
|
23
|
+
export const sourceAccounts = async (store, { source, account }) => {
|
|
24
|
+
if (account)
|
|
25
|
+
return [account];
|
|
26
|
+
if (!source?.startsWith(IMPORT))
|
|
27
|
+
return [];
|
|
28
|
+
const provider = source.slice(IMPORT.length);
|
|
29
|
+
return (await store.accounts.accounts()).filter((key) => key.provider === provider);
|
|
30
|
+
};
|
|
31
|
+
const named = (key) => ({
|
|
32
|
+
record: `${key.type}:${key.externalId}`,
|
|
33
|
+
account: `${key.provider}:${key.account}`,
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* Where an entity came from: the records of its source's accounts mapped to it, and the live records of any account
|
|
37
|
+
* whose relations name it, such as a quote `quoted-for` a deal.
|
|
38
|
+
*/
|
|
39
|
+
export const sourcesOf = async (store, entity) => {
|
|
40
|
+
const { ref } = entity;
|
|
41
|
+
const records = [];
|
|
42
|
+
for (const { provider, account } of await sourceAccounts(store, entity)) {
|
|
43
|
+
if (records.length > MOST)
|
|
44
|
+
break;
|
|
45
|
+
for (const one of await store.records.list({ provider, account, entity: ref, limit: MOST + 1 }))
|
|
46
|
+
records.push({
|
|
47
|
+
...named(one),
|
|
48
|
+
...(one.flagged ? { flagged: true } : {}),
|
|
49
|
+
...(one.deletedAt === null ? {} : { deleted: true }),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
const incoming = await store.records.incoming({ entity: ref }, { limit: MOST + 1 });
|
|
53
|
+
return {
|
|
54
|
+
records: { items: records.slice(0, MOST), hasMore: records.length > MOST },
|
|
55
|
+
incoming: {
|
|
56
|
+
items: incoming.slice(0, MOST).map(({ record, role, as }) => ({ ...named(record), role, as })),
|
|
57
|
+
hasMore: incoming.length > MOST,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
export const sourcesText = (ref, { records, incoming }, indent = " ") => [
|
|
62
|
+
...records.items.map((one) => `${indent}from ${one.account} ${one.record}${one.flagged ? " (flagged)" : ""}${one.deleted ? " (deleted)" : ""}`),
|
|
63
|
+
...incoming.items.map((one) => `${indent}named by ${one.account} ${one.record} as ${one.role}${one.as === null ? "" : ` (${one.as})`}`),
|
|
64
|
+
...(records.hasMore || incoming.hasMore
|
|
65
|
+
? [`${indent}more: memo records list entity:${ref} --account <account>`]
|
|
66
|
+
: []),
|
|
67
|
+
];
|
|
68
|
+
/** `sources` names source records, which `records show` reads: an MCP client denied that gets none. */
|
|
69
|
+
export const recordsHidden = (command) => grantedLevel(command, "records.show") === "deny";
|
|
70
|
+
/** An entity's `show` answer with where it came from beside it. */
|
|
71
|
+
export const withSources = async (command, store, item) => recordsHidden(command) ? item : { ...item, sources: await sourcesOf(store, item) };
|
|
72
|
+
//# sourceMappingURL=sources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sources.js","sourceRoot":"","sources":["../../src/records/sources.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,MAAM,IAAI,GAAG,GAAG,CAAA;AAShB,8EAA8E;AAC9E,MAAM,KAAK,GAAqF;IAC9F,OAAO,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC;IAChD,QAAQ,EAAE,CAA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AO,EAAE,EAAE,CACrG,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAA"}
|
package/dist/review/kinds.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export type ReviewRow = ProposalRow & {
|
|
|
5
5
|
source?: string | null;
|
|
6
6
|
};
|
|
7
7
|
/** Every kind `memo review` shows, as `kind:` takes them. */
|
|
8
|
-
export declare const REVIEW_KINDS: readonly ["relationship", "relationship_update", "key_document", "fact", "memory", "findings", "meeting_findings", "mail_findings", "task_close", "action", "invoice", "payment", "order"];
|
|
8
|
+
export declare const REVIEW_KINDS: readonly ["relationship", "relationship_update", "key_document", "fact", "memory", "findings", "meeting_findings", "mail_findings", "task_close", "action", "invoice", "payment", "order", "contract", "subscription", "subscription_price", "transaction"];
|
|
9
9
|
/** cli-core's registry, with each mail and meeting batch grouped under the account it came from. */
|
|
10
10
|
export declare const reviewRegistry: (store: MessageStore) => ProposalRegistry;
|
|
11
11
|
//# sourceMappingURL=kinds.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kinds.d.ts","sourceRoot":"","sources":["../../src/review/kinds.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAoB,MAAM,4BAA4B,CAAA;AACtG,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAE/E,yFAAyF;AACzF,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAA;AAEhE,6DAA6D;AAC7D,eAAO,MAAM,YAAY,YACvB,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,MAAM,EACN,QAAQ,EACR,UAAU,EACV,kBAAkB,mBAElB,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,SAAS,EACT,OAAO,
|
|
1
|
+
{"version":3,"file":"kinds.d.ts","sourceRoot":"","sources":["../../src/review/kinds.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAoB,MAAM,4BAA4B,CAAA;AACtG,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAE/E,yFAAyF;AACzF,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAA;AAEhE,6DAA6D;AAC7D,eAAO,MAAM,YAAY,YACvB,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,MAAM,EACN,QAAQ,EACR,UAAU,EACV,kBAAkB,mBAElB,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,SAAS,EACT,OAAO,EACP,UAAU,EACV,cAAc,EACd,oBAAoB,EACpB,aAAa,CACL,CAAA;AAIV,oGAAoG;AACpG,eAAO,MAAM,cAAc,UAAW,YAAY,KAAG,gBAepD,CAAA"}
|
package/dist/review/kinds.js
CHANGED
|
@@ -16,6 +16,10 @@ export const REVIEW_KINDS = [
|
|
|
16
16
|
"invoice",
|
|
17
17
|
"payment",
|
|
18
18
|
"order",
|
|
19
|
+
"contract",
|
|
20
|
+
"subscription",
|
|
21
|
+
"subscription_price",
|
|
22
|
+
"transaction",
|
|
19
23
|
];
|
|
20
24
|
const BY_ACCOUNT = [MEETING_FINDINGS_KIND, MAIL_FINDINGS_KIND];
|
|
21
25
|
/** cli-core's registry, with each mail and meeting batch grouped under the account it came from. */
|
package/dist/review/kinds.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kinds.js","sourceRoot":"","sources":["../../src/review/kinds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,EAA2C,gBAAgB,EAAE,MAAM,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O,MAAM,OAAO,WAAW,MAAM,KAAG,QAG3E,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,SAAS,UAAiB,YAAY,MAAM,MAAM,YAAY,QAAQ,KAAG,OAAO,CAAC,OAAO,CAKpG,CAAA"}
|
package/dist/review/review.js
CHANGED
|
@@ -80,6 +80,10 @@ const titleOf = (row, label) => {
|
|
|
80
80
|
case "invoice":
|
|
81
81
|
case "payment":
|
|
82
82
|
case "order":
|
|
83
|
+
case "contract":
|
|
84
|
+
case "subscription":
|
|
85
|
+
case "subscription_price":
|
|
86
|
+
case "transaction":
|
|
83
87
|
return row.summary ?? subject;
|
|
84
88
|
default:
|
|
85
89
|
return object === null ? subject : `${subject} → ${object}`;
|