@wirecat/attio-cli 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/LICENSE +204 -0
- package/README.md +248 -2
- package/contracts/wirecat.json +2321 -0
- package/dist/bin/attio.d.ts +3 -0
- package/dist/bin/attio.d.ts.map +1 -0
- package/dist/bin/attio.js +40 -0
- package/dist/bin/attio.js.map +1 -0
- package/dist/bundle/agent-KLBL3FYD.js +37 -0
- package/dist/bundle/all-profiles-C2NMRQPE.js +320 -0
- package/dist/bundle/anthropic-KOU2ILDK.js +91 -0
- package/dist/bundle/app-server-TINV4NNY.js +249 -0
- package/dist/bundle/attio.js +183 -0
- package/dist/bundle/bun-GVNM6IWY.js +169 -0
- package/dist/bundle/bun-sqlite-IF6B3EQI.js +76 -0
- package/dist/bundle/chunk-2343HKEW.js +362 -0
- package/dist/bundle/chunk-2H2MWGBD.js +988 -0
- package/dist/bundle/chunk-2P7ENEQ7.js +288 -0
- package/dist/bundle/chunk-4EYKJLWI.js +771 -0
- package/dist/bundle/chunk-4HQDT5PF.js +338 -0
- package/dist/bundle/chunk-4QE4L7UL.js +142 -0
- package/dist/bundle/chunk-4XHWGJXT.js +6848 -0
- package/dist/bundle/chunk-5DCRHSBI.js +72 -0
- package/dist/bundle/chunk-5ETXE5KF.js +372 -0
- package/dist/bundle/chunk-5WAGTWCS.js +156 -0
- package/dist/bundle/chunk-6B5PSQQ7.js +319 -0
- package/dist/bundle/chunk-6BVPS2YY.js +230 -0
- package/dist/bundle/chunk-6L5EUGLP.js +188 -0
- package/dist/bundle/chunk-7NFEMS4A.js +1028 -0
- package/dist/bundle/chunk-A7YQTQ5U.js +733 -0
- package/dist/bundle/chunk-AEPOHR4Z.js +82 -0
- package/dist/bundle/chunk-ARRQVUJ2.js +334 -0
- package/dist/bundle/chunk-BHNFRL3H.js +95 -0
- package/dist/bundle/chunk-CBPL3GID.js +23 -0
- package/dist/bundle/chunk-D72URWJE.js +532 -0
- package/dist/bundle/chunk-DFDN6AUB.js +21 -0
- package/dist/bundle/chunk-DVN54VPI.js +16 -0
- package/dist/bundle/chunk-DW3V7GTY.js +388 -0
- package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
- package/dist/bundle/chunk-ETSOG6TZ.js +65288 -0
- package/dist/bundle/chunk-FJV3MO57.js +29 -0
- package/dist/bundle/chunk-HLLRNP2G.js +170 -0
- package/dist/bundle/chunk-HQJ2TABD.js +18 -0
- package/dist/bundle/chunk-ICUXAOEM.js +42063 -0
- package/dist/bundle/chunk-IGALQ74S.js +358 -0
- package/dist/bundle/chunk-IPHUAWFG.js +100 -0
- package/dist/bundle/chunk-IYMWUL6E.js +633 -0
- package/dist/bundle/chunk-JKCXDIGC.js +52 -0
- package/dist/bundle/chunk-JTOKDROB.js +95 -0
- package/dist/bundle/chunk-JZMGOVCZ.js +80 -0
- package/dist/bundle/chunk-KB3YJJPN.js +794 -0
- package/dist/bundle/chunk-KD4EUUER.js +37 -0
- package/dist/bundle/chunk-LB6D4QF2.js +2333 -0
- package/dist/bundle/chunk-LWUJZ2E3.js +108 -0
- package/dist/bundle/chunk-MCQOXTAL.js +53 -0
- package/dist/bundle/chunk-MMGCGPKM.js +3571 -0
- package/dist/bundle/chunk-MXDIXBIV.js +24 -0
- package/dist/bundle/chunk-MYVWV5L5.js +407 -0
- package/dist/bundle/chunk-MZNRIH3T.js +1233 -0
- package/dist/bundle/chunk-NEFILPPV.js +353 -0
- package/dist/bundle/chunk-O6CVJGGL.js +131 -0
- package/dist/bundle/chunk-OPXCRQTV.js +161 -0
- package/dist/bundle/chunk-PKNFA5TU.js +38 -0
- package/dist/bundle/chunk-PL5P7UKW.js +25216 -0
- package/dist/bundle/chunk-PO6PLQYL.js +50 -0
- package/dist/bundle/chunk-PWUQC2GI.js +218 -0
- package/dist/bundle/chunk-QCEEPJNN.js +185 -0
- package/dist/bundle/chunk-QG4WCLGB.js +1332 -0
- package/dist/bundle/chunk-QNQ2OF24.js +9578 -0
- package/dist/bundle/chunk-RCKRXBJF.js +1392 -0
- package/dist/bundle/chunk-RK4GN2II.js +2000 -0
- package/dist/bundle/chunk-RRH7UK7L.js +106 -0
- package/dist/bundle/chunk-S4UUN6LD.js +1410 -0
- package/dist/bundle/chunk-S7WJXELM.js +58 -0
- package/dist/bundle/chunk-SBRFKB77.js +1197 -0
- package/dist/bundle/chunk-SP6DPFZ4.js +4072 -0
- package/dist/bundle/chunk-SWJDLFDM.js +557 -0
- package/dist/bundle/chunk-TWCVCW5T.js +66 -0
- package/dist/bundle/chunk-V2R2BJJU.js +63 -0
- package/dist/bundle/chunk-V5K3M7FE.js +78 -0
- package/dist/bundle/chunk-V6ALLFEE.js +1068 -0
- package/dist/bundle/chunk-V6EVJXLO.js +259 -0
- package/dist/bundle/chunk-VJ4CPL6F.js +54 -0
- package/dist/bundle/chunk-VL25A6V2.js +41 -0
- package/dist/bundle/chunk-WBEZZGZE.js +12645 -0
- package/dist/bundle/chunk-WIYAMDPP.js +73 -0
- package/dist/bundle/chunk-WRJGITBX.js +76 -0
- package/dist/bundle/chunk-XHIVZPQ2.js +7 -0
- package/dist/bundle/chunk-XQUUANA2.js +24600 -0
- package/dist/bundle/chunk-XTQIXZVM.js +2788 -0
- package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
- package/dist/bundle/chunk-YKN4Y35P.js +206 -0
- package/dist/bundle/chunk-ZMJZQGCN.js +46 -0
- package/dist/bundle/chunk-ZPSH27BB.js +274 -0
- package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
- package/dist/bundle/command-contract-3FR7BK72.js +37 -0
- package/dist/bundle/command-server-entry-4XR4GDS7.js +166 -0
- package/dist/bundle/decode-24EITKP4.js +297 -0
- package/dist/bundle/definitions-HU62PG4L.js +43364 -0
- package/dist/bundle/dispatch-VE6CXCJW.js +411 -0
- package/dist/bundle/dist-PAKDDIBT.js +191 -0
- package/dist/bundle/dist-ZSNEZYVF.js +7577 -0
- package/dist/bundle/echarts-LEVLEF7L.js +42501 -0
- package/dist/bundle/embed-G6FGY3VZ.js +38 -0
- package/dist/bundle/embedder-B6LNMXZZ.js +111 -0
- package/dist/bundle/failure-ASVFQXMF.js +25 -0
- package/dist/bundle/first-run-NVXVVALW.js +29 -0
- package/dist/bundle/first-screen-N3IPK5AT.js +37 -0
- package/dist/bundle/instructions-F3KPYMJK.js +11 -0
- package/dist/bundle/mcp-BUCB5ZPE.js +167 -0
- package/dist/bundle/meeting-combined-7FREWXMB.js +24 -0
- package/dist/bundle/meeting-model-GJPAIUQL.js +25 -0
- package/dist/bundle/meeting-semantic-YWY645AH.js +22 -0
- package/dist/bundle/node-KM3CUABH.js +2340 -0
- package/dist/bundle/node-TLZSIHIJ.js +21 -0
- package/dist/bundle/node-WVUZSDLD.js +176 -0
- package/dist/bundle/node-sqlite-V4NNKABG.js +74 -0
- package/dist/bundle/oauth-7CENTQIN.js +20 -0
- package/dist/bundle/open-OLTONZBG.js +23 -0
- package/dist/bundle/openai-M6ES74YN.js +238 -0
- package/dist/bundle/process-VFIFK5KO.js +91 -0
- package/dist/bundle/program-N72VUDXM.js +33418 -0
- package/dist/bundle/prompt-TNWPBEBB.js +17 -0
- package/dist/bundle/recognize-PV2WOUWS.js +26 -0
- package/dist/bundle/remote-3F6JACS5.js +31 -0
- package/dist/bundle/rerank-33C67PIV.js +52 -0
- package/dist/bundle/schemas-RLDEALIJ.js +21410 -0
- package/dist/bundle/serve-3DEMACSQ.js +199 -0
- package/dist/bundle/server-AAK2HWQM.js +79 -0
- package/dist/bundle/server-LIBRGMUZ.js +212 -0
- package/dist/bundle/sqlite-runtime-SMAREHYG.js +20 -0
- package/dist/bundle/state-WPHAVJIU.js +36 -0
- package/dist/bundle/store-A7V4FEXE.js +177 -0
- package/dist/bundle/store-PMAPJNXT.js +291 -0
- package/dist/bundle/store-maintenance-command-QHRHAEYN.js +66 -0
- package/dist/bundle/surface-MN4RTNYW.js +65 -0
- package/dist/commands/api.d.ts +12 -0
- package/dist/commands/api.d.ts.map +1 -0
- package/dist/commands/api.js +27 -0
- package/dist/commands/api.js.map +1 -0
- package/dist/commands/comments.d.ts +3 -0
- package/dist/commands/comments.d.ts.map +1 -0
- package/dist/commands/comments.js +114 -0
- package/dist/commands/comments.js.map +1 -0
- package/dist/commands/crm.d.ts +4 -0
- package/dist/commands/crm.d.ts.map +1 -0
- package/dist/commands/crm.js +66 -0
- package/dist/commands/crm.js.map +1 -0
- package/dist/commands/session.d.ts +7 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +22 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/config.d.ts +14 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +14 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +37 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +31 -0
- package/dist/context.js.map +1 -0
- package/dist/generated/definitions.d.ts +3 -0
- package/dist/generated/definitions.d.ts.map +1 -0
- package/dist/generated/definitions.js +43360 -0
- package/dist/generated/definitions.js.map +1 -0
- package/dist/generated/manifest.d.ts +6 -0
- package/dist/generated/manifest.d.ts.map +1 -0
- package/dist/generated/manifest.js +5158 -0
- package/dist/generated/manifest.js.map +1 -0
- package/dist/generated/schemas.d.ts +383 -0
- package/dist/generated/schemas.d.ts.map +1 -0
- package/dist/generated/schemas.js +21196 -0
- package/dist/generated/schemas.js.map +1 -0
- package/dist/generated/types.d.ts +10156 -0
- package/dist/generated/types.d.ts.map +1 -0
- package/dist/generated/types.js +5 -0
- package/dist/generated/types.js.map +1 -0
- package/dist/generated/wirecat-config.d.ts +15 -0
- package/dist/generated/wirecat-config.d.ts.map +1 -0
- package/dist/generated/wirecat-config.js +328 -0
- package/dist/generated/wirecat-config.js.map +1 -0
- package/dist/hooks.d.ts +3 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +7 -0
- package/dist/hooks.js.map +1 -0
- package/dist/identity.d.ts +33 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +31 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/program.d.ts +6 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +54 -0
- package/dist/program.js.map +1 -0
- package/dist/sample/comments.d.ts +61 -0
- package/dist/sample/comments.d.ts.map +1 -0
- package/dist/sample/comments.js +39 -0
- package/dist/sample/comments.js.map +1 -0
- package/dist/sample/records.d.ts +16 -0
- package/dist/sample/records.d.ts.map +1 -0
- package/dist/sample/records.js +22 -0
- package/dist/sample/records.js.map +1 -0
- package/dist/sample/transport.d.ts +42 -0
- package/dist/sample/transport.d.ts.map +1 -0
- package/dist/sample/transport.js +153 -0
- package/dist/sample/transport.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/dist/wcat.d.ts +3 -0
- package/dist/wcat.d.ts.map +1 -0
- package/dist/wcat.js +4 -0
- package/dist/wcat.js.map +1 -0
- package/package.json +87 -4
- package/skills/attio-cli/SKILL.md +58 -0
- package/skills/attio-cli/references/api/api-activities.md +62 -0
- package/skills/attio-cli/references/api/api-activity-records.md +96 -0
- package/skills/attio-cli/references/api/api-attributes.md +148 -0
- package/skills/attio-cli/references/api/api-call-recordings.md +53 -0
- package/skills/attio-cli/references/api/api-comments.md +36 -0
- package/skills/attio-cli/references/api/api-emails.md +23 -0
- package/skills/attio-cli/references/api/api-entries.md +127 -0
- package/skills/attio-cli/references/api/api-files.md +63 -0
- package/skills/attio-cli/references/api/api-lists.md +44 -0
- package/skills/attio-cli/references/api/api-meetings.md +82 -0
- package/skills/attio-cli/references/api/api-meta.md +8 -0
- package/skills/attio-cli/references/api/api-notes.md +64 -0
- package/skills/attio-cli/references/api/api-objects.md +55 -0
- package/skills/attio-cli/references/api/api-records.md +168 -0
- package/skills/attio-cli/references/api/api-sequences.md +15 -0
- package/skills/attio-cli/references/api/api-sql.md +15 -0
- package/skills/attio-cli/references/api/api-tasks.md +67 -0
- package/skills/attio-cli/references/api/api-threads.md +35 -0
- package/skills/attio-cli/references/api/api-transcripts.md +17 -0
- package/skills/attio-cli/references/api/api-views.md +133 -0
- package/skills/attio-cli/references/api/api-webhooks.md +62 -0
- package/skills/attio-cli/references/api/api-workspace-blocklist.md +39 -0
- package/skills/attio-cli/references/api/api-workspace-members.md +19 -0
- package/skills/attio-cli/references/api.md +35 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { CliError } from "@wirecat/cli-base";
|
|
2
|
+
import { annotate } from "@wirecat/cli-base/commands";
|
|
3
|
+
import { answerEntity, commandPath, itemOf, outputFor, pagedList, pageOf, queryTerms, REMOTE_READ, REMOTE_WRITE, renderAnswer, termField, terminalAsker, withPaging, withQuery, } from "@wirecat/cli-core/cli";
|
|
4
|
+
import { guardedWrite, guardFor, keyedGuard, levelFor, newOperationId } from "@wirecat/cli-core/sends";
|
|
5
|
+
import { Command } from "commander";
|
|
6
|
+
import { permissions } from "../config.js";
|
|
7
|
+
import { contextOf, withService } from "../context.js";
|
|
8
|
+
import { IDENTITY } from "../identity.js";
|
|
9
|
+
import { commentSchema } from "../sample/comments.js";
|
|
10
|
+
import { SERVICE } from "../sample/transport.js";
|
|
11
|
+
// SAMPLE: `comments` is the reference command group. Keep its shape; replace the noun and the calls with your
|
|
12
|
+
// service's. Every command path is its own permission key (`comments.create`), from `commandPermissions()`.
|
|
13
|
+
const CLI = IDENTITY.command;
|
|
14
|
+
/** The list's query: one field the service filters itself (WC-CMD-20). Nothing is filtered in memory. */
|
|
15
|
+
const COMMENTS_QUERY = {
|
|
16
|
+
entity: "comment",
|
|
17
|
+
backend: "native",
|
|
18
|
+
fields: [termField("author", "kw", "author:u2")],
|
|
19
|
+
};
|
|
20
|
+
/** --all walks pages until the service has no more, at most this many, so a huge account cannot hold the run open. */
|
|
21
|
+
const ALL_PAGES = 20;
|
|
22
|
+
const ALL_PAGE_SIZE = 100;
|
|
23
|
+
const listAll = async (service, author) => {
|
|
24
|
+
const items = [];
|
|
25
|
+
for (let page = 0; page < ALL_PAGES; page++) {
|
|
26
|
+
const found = await service.list({ limit: ALL_PAGE_SIZE, offset: page * ALL_PAGE_SIZE, author });
|
|
27
|
+
for (const item of found.items)
|
|
28
|
+
items.push(item);
|
|
29
|
+
if (!found.hasMore)
|
|
30
|
+
return { items, hasMore: false };
|
|
31
|
+
}
|
|
32
|
+
return { items, hasMore: true };
|
|
33
|
+
};
|
|
34
|
+
const listCommand = () => withPaging(withQuery(answerEntity(annotate(new Command("list"), {
|
|
35
|
+
effects: REMOTE_READ,
|
|
36
|
+
offline: false,
|
|
37
|
+
examples: [`${CLI} personal comments list`, `${CLI} personal comments list author:u2 --json=id,text`],
|
|
38
|
+
}), "comment", commentSchema), COMMENTS_QUERY))
|
|
39
|
+
.description(`list the comments in ${SERVICE}, newest first`)
|
|
40
|
+
.action(async function (words) {
|
|
41
|
+
const path = commandPath(this);
|
|
42
|
+
const author = queryTerms(words, COMMENTS_QUERY, path).get("author");
|
|
43
|
+
const { settings } = contextOf(this);
|
|
44
|
+
const found = await withService(this, (service) => settings.all ? listAll(service, author) : service.list({ ...pageOf(settings), author }));
|
|
45
|
+
renderAnswer(this, outputFor(this), pagedList(path, settings, found));
|
|
46
|
+
});
|
|
47
|
+
const showCommand = () => answerEntity(annotate(new Command("show"), {
|
|
48
|
+
effects: REMOTE_READ,
|
|
49
|
+
offline: false,
|
|
50
|
+
examples: [`${CLI} personal comments show c1`, `${CLI} personal comments show c1 --json`],
|
|
51
|
+
}), "comment", commentSchema)
|
|
52
|
+
.description(`show one comment in ${SERVICE}`)
|
|
53
|
+
.argument("<id>", "the comment's id, as list prints it")
|
|
54
|
+
.action(async function (id) {
|
|
55
|
+
renderAnswer(this, outputFor(this), itemOf(await withService(this, (service) => service.show(id))));
|
|
56
|
+
});
|
|
57
|
+
/**
|
|
58
|
+
* Every write's one path (WC-PERM-13). The profile's level for the command's key refuses, or asks once; the send
|
|
59
|
+
* journal records the attempt and its outcome, never its content (WC-PERM-17); the answer carries the `operation_id`
|
|
60
|
+
* (WC-OUT-10). cli-core's `run` has already answered `--dry-run` and refused under `<PREFIX>_READ_ONLY` before this
|
|
61
|
+
* runs. Never retried: a write that got no answer is `outcome_unknown`, with the id to look it up by (WC-LIFE-9).
|
|
62
|
+
*/
|
|
63
|
+
const write = async (command, act) => {
|
|
64
|
+
const { settings, env, renderer } = contextOf(command);
|
|
65
|
+
const key = commandPath(command).replaceAll(" ", ".");
|
|
66
|
+
const operationId = newOperationId();
|
|
67
|
+
const levelOf = (one) => levelFor(settings.permissions, one, permissions.defaults).level;
|
|
68
|
+
const guard = keyedGuard((ask) => guardFor(IDENTITY,
|
|
69
|
+
// SAMPLE: the service limits its own rate, so this guard keeps the levels and the journal, not a send cap.
|
|
70
|
+
{ ...settings, sendsPerHour: Number.MAX_SAFE_INTEGER, permissionDefaults: permissions.defaults }, renderer.warn, env, ask), terminalAsker(command), levelOf, []);
|
|
71
|
+
const request = { chatId: null, kind: "edit", key, operationId };
|
|
72
|
+
guard.refuse(request);
|
|
73
|
+
let comment;
|
|
74
|
+
try {
|
|
75
|
+
comment = await guardedWrite(guard, request, () => withService(command, act));
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
if (error instanceof CliError && error.code === "outcome_unknown")
|
|
79
|
+
throw new CliError("outcome_unknown", error.message, { ...error.details, operation_id: operationId });
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
renderAnswer(command, outputFor(command), itemOf({ operation_id: operationId, comment }));
|
|
83
|
+
};
|
|
84
|
+
const createCommand = () => annotate(new Command("create"), {
|
|
85
|
+
effects: REMOTE_WRITE,
|
|
86
|
+
offline: false,
|
|
87
|
+
examples: [
|
|
88
|
+
`${CLI} personal comments create --text "Looks good to me"`,
|
|
89
|
+
`${CLI} personal comments create --text "Looks good to me" --dry-run`,
|
|
90
|
+
],
|
|
91
|
+
})
|
|
92
|
+
.description(`post a comment in ${SERVICE}`)
|
|
93
|
+
.requiredOption("--text <text>", "the comment's text")
|
|
94
|
+
.action(async function (args) {
|
|
95
|
+
await write(this, (service) => service.create(args.text));
|
|
96
|
+
});
|
|
97
|
+
const updateCommand = () => annotate(new Command("update"), {
|
|
98
|
+
effects: REMOTE_WRITE,
|
|
99
|
+
offline: false,
|
|
100
|
+
examples: [`${CLI} personal comments update c1 --text "Looks good now"`],
|
|
101
|
+
})
|
|
102
|
+
.description(`change the text of your comment in ${SERVICE}`)
|
|
103
|
+
.argument("<id>", "the comment's id, as list prints it")
|
|
104
|
+
.requiredOption("--text <text>", "the new text")
|
|
105
|
+
.action(async function (id, args) {
|
|
106
|
+
await write(this, (service) => service.update(id, args.text));
|
|
107
|
+
});
|
|
108
|
+
export const commentsCommand = () => annotate(new Command("comments"), { effects: REMOTE_READ })
|
|
109
|
+
.description(`read and write comments in ${SERVICE}, the sample service`)
|
|
110
|
+
.addCommand(listCommand())
|
|
111
|
+
.addCommand(showCommand())
|
|
112
|
+
.addCommand(createCommand())
|
|
113
|
+
.addCommand(updateCommand());
|
|
114
|
+
//# sourceMappingURL=comments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comments.js","sourceRoot":"","sources":["../../src/commands/comments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AACrD,OAAO,EACL,YAAY,EACZ,WAAW,EACX,MAAM,EACN,SAAS,EACT,SAAS,EACT,MAAM,EACN,UAAU,EACV,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,aAAa,EACb,UAAU,EACV,SAAS,GACV,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,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,CAAA"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { CliError } from "@wirecat/cli-base";
|
|
2
|
+
import { retrying } from "@wirecat/cli-base/http";
|
|
3
|
+
import { openAppStore, recalledAccount, serviceApiCall } from "@wirecat/cli-core/cli";
|
|
4
|
+
import { crmSourceFromManifest } from "@wirecat/cli-core/crm";
|
|
5
|
+
import { addCrmCommands, openCrmStore } from "@wirecat/cli-core/crm/cli";
|
|
6
|
+
import { Pacer, pacePathFor } from "@wirecat/cli-core/sends";
|
|
7
|
+
import { Command } from "commander";
|
|
8
|
+
import { API } from "../config.js";
|
|
9
|
+
import { contextOf, PACE, tokenOf } from "../context.js";
|
|
10
|
+
import { HOOK_OPTIONS, LIVE, SOURCE } from "../generated/wirecat-config.js";
|
|
11
|
+
import { IDENTITY } from "../identity.js";
|
|
12
|
+
import { serviceFetch } from "./api.js";
|
|
13
|
+
// The account is the one `session start` checked the token against; the store keeps each account's rows apart.
|
|
14
|
+
const accountOf = (command) => {
|
|
15
|
+
const { env, profile } = contextOf(command);
|
|
16
|
+
const account = recalledAccount(IDENTITY, SOURCE.provider, profile, env);
|
|
17
|
+
if (!account)
|
|
18
|
+
throw new CliError("authentication_error", `${profile} is not signed in; run ${IDENTITY.command} ${profile} session start`, {
|
|
19
|
+
reason: "auth.missing",
|
|
20
|
+
});
|
|
21
|
+
return account;
|
|
22
|
+
};
|
|
23
|
+
const open = async (command, { readOnly }) => {
|
|
24
|
+
const { env, profile, environment } = contextOf(command);
|
|
25
|
+
const { store, account } = await openCrmStore({
|
|
26
|
+
app: IDENTITY,
|
|
27
|
+
env,
|
|
28
|
+
profile,
|
|
29
|
+
readOnly,
|
|
30
|
+
provider: SOURCE.provider,
|
|
31
|
+
// The shared store, with this CLI's provider entry written so every other CLI's search knows it (WC-ARCH-21).
|
|
32
|
+
open: (at, options) => openAppStore(at, {
|
|
33
|
+
app: IDENTITY,
|
|
34
|
+
provider: { name: SOURCE.provider, kind: "crm", aliases: [], command: IDENTITY.command },
|
|
35
|
+
...options,
|
|
36
|
+
}),
|
|
37
|
+
account: () => accountOf(command),
|
|
38
|
+
});
|
|
39
|
+
const fetch = retrying(serviceFetch(environment), { pacer: new Pacer(pacePathFor(IDENTITY, profile, env), PACE) });
|
|
40
|
+
const call = serviceApiCall({ manifest: API.manifest, service: API.service, fetch, token: () => tokenOf(command) });
|
|
41
|
+
let source;
|
|
42
|
+
return {
|
|
43
|
+
profile,
|
|
44
|
+
account,
|
|
45
|
+
// A CRM that limits its users is not described by a manifest yet; nobody's rows are hidden.
|
|
46
|
+
user: null,
|
|
47
|
+
store,
|
|
48
|
+
env,
|
|
49
|
+
locked: Boolean(env[`${IDENTITY.envPrefix}_PROFILE_LOCK`]),
|
|
50
|
+
source: () => (source ??= crmSourceFromManifest(SOURCE, { api: API.manifest, call, ...HOOK_OPTIONS })),
|
|
51
|
+
close: () => store.close(),
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
/** cli-core's CRM commands over the source wirecat.config.ts describes: sync, store status, deals, search. */
|
|
55
|
+
export const crmCommands = () => {
|
|
56
|
+
const holder = new Command(IDENTITY.command);
|
|
57
|
+
addCrmCommands(holder, {
|
|
58
|
+
app: IDENTITY,
|
|
59
|
+
open,
|
|
60
|
+
leads: SOURCE.kinds.includes("lead"),
|
|
61
|
+
// People and companies whose entity names a search, and the users when the source names a call for them.
|
|
62
|
+
live: LIVE,
|
|
63
|
+
});
|
|
64
|
+
return [...holder.commands];
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=crm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crm.js","sourceRoot":"","sources":["../../src/commands/crm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,uBAAuB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C,CAAC;QACtG,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE;KAC3B,CAAA;AACH,CAAC,CAAA;AAED,8GAA8G;AAC9G,MAAM,CAAC,MAAM,WAAW,GAAG,GAAc,EAAE;IACzC,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;IAC5C,cAAc,CAAC,MAAM,EAAE;QACrB,GAAG,EAAE,QAAQ;QACb,IAAI;QACJ,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;QACpC,yGAAyG;QACzG,IAAI,EAAE,IAAI;KACX,CAAC,CAAA;IACF,OAAO,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC7B,CAAC,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
/**
|
|
3
|
+
* `session start | status | end | list` (WC-ACCT-12): the token is checked by the call `auth.verify` names in
|
|
4
|
+
* wirecat.config.ts, and the account is the id and name its answer holds.
|
|
5
|
+
*/
|
|
6
|
+
export declare const sessionCommand: () => Command;
|
|
7
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/commands/session.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAOxC;;;GAGG;AACH,eAAO,MAAM,cAAc,QAAO,OAW9B,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { manifestVerify, tokenSessionCommand } from "@wirecat/cli-core/cli";
|
|
2
|
+
import { API, configuration } from "../config.js";
|
|
3
|
+
import { contextOf } from "../context.js";
|
|
4
|
+
import { VERIFY } from "../generated/wirecat-config.js";
|
|
5
|
+
import { IDENTITY } from "../identity.js";
|
|
6
|
+
import { serviceFetch } from "./api.js";
|
|
7
|
+
/**
|
|
8
|
+
* `session start | status | end | list` (WC-ACCT-12): the token is checked by the call `auth.verify` names in
|
|
9
|
+
* wirecat.config.ts, and the account is the id and name its answer holds.
|
|
10
|
+
*/
|
|
11
|
+
export const sessionCommand = () => tokenSessionCommand({
|
|
12
|
+
app: IDENTITY,
|
|
13
|
+
service: API.service,
|
|
14
|
+
resolveSettings: configuration.resolveSettings,
|
|
15
|
+
verify: manifestVerify({
|
|
16
|
+
manifest: API.manifest,
|
|
17
|
+
service: API.service,
|
|
18
|
+
verify: VERIFY,
|
|
19
|
+
fetch: (command) => serviceFetch(contextOf(command).environment),
|
|
20
|
+
}),
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/commands/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAE3E,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEvC;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,GAAY,EAAE,CAC1C,mBAAmB,CAAC;IAClB,GAAG,EAAE,QAAQ;IACb,OAAO,EAAE,GAAG,CAAC,OAAO;IACpB,eAAe,EAAE,aAAa,CAAC,eAAe;IAC9C,MAAM,EAAE,cAAc,CAAC;QACrB,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC;KACjE,CAAC;CACH,CAAC,CAAA"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Configuration } from "@wirecat/cli-core/cli";
|
|
2
|
+
/** Each command is checked against its own path (`notes.list`); add the keys a command checks inside itself. */
|
|
3
|
+
export declare const API: {
|
|
4
|
+
manifest: {
|
|
5
|
+
servers: readonly import("@wirecat/cli-base/codegen").ApiServer[];
|
|
6
|
+
securitySchemes: Readonly<Record<string, import("@wirecat/cli-base/codegen").SecurityScheme>>;
|
|
7
|
+
security: readonly import("@wirecat/cli-base/codegen").SecurityRequirement[];
|
|
8
|
+
operations: readonly import("@wirecat/cli-base/codegen").ManifestOperation[];
|
|
9
|
+
};
|
|
10
|
+
service: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const permissions: import("@wirecat/cli-core/cli").CommandPermissions;
|
|
13
|
+
export declare const configuration: Configuration;
|
|
14
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAKnB,MAAM,uBAAuB,CAAA;AAI9B,gHAAgH;AAIhH,eAAO,MAAM,GAAG;;;;;;;;CAGf,CAAA;AAED,eAAO,MAAM,WAAW,oDAAiD,CAAA;AAEzE,eAAO,MAAM,aAAa,EAAE,aAAsD,CAAA"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { commandPermissions, serviceApiOperations, serviceApiPermissions, settingsFor, } from "@wirecat/cli-core/cli";
|
|
2
|
+
import * as manifest from "./generated/manifest.js";
|
|
3
|
+
import { IDENTITY } from "./identity.js";
|
|
4
|
+
/** Each command is checked against its own path (`notes.list`); add the keys a command checks inside itself. */
|
|
5
|
+
// The keys a delete or a share checks come from `permissions` in
|
|
6
|
+
// scripts/generate.ts. The operations the api group cannot offer are left out: one that answers with a
|
|
7
|
+
// credential (the CLI signs in through `session`) and a body it cannot send, such as a multipart form.
|
|
8
|
+
export const API = {
|
|
9
|
+
manifest: { ...manifest, operations: serviceApiOperations(manifest).offered },
|
|
10
|
+
service: "Attio",
|
|
11
|
+
};
|
|
12
|
+
export const permissions = commandPermissions(serviceApiPermissions(API));
|
|
13
|
+
export const configuration = settingsFor(IDENTITY, { permissions });
|
|
14
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,WAAW,GACZ,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,gHAAgH;AAChH,iEAAiE;AACjE,uGAAuG;AACvG,uGAAuG;AACvG,MAAM,CAAC,MAAM,GAAG,GAAG;IACjB,QAAQ,EAAE,EAAE,GAAG,QAAQ,EAAE,UAAU,EAAE,oBAAoB,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE;IAC7E,OAAO,EAAE,OAAO;CACjB,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,kBAAkB,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,CAAA;AAEzE,MAAM,CAAC,MAAM,aAAa,GAAkB,WAAW,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,CAAC,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type BaseEnvironment, type GlobalFlags, ProfileTokenStore } from "@wirecat/cli-core/cli";
|
|
2
|
+
import type { Command } from "commander";
|
|
3
|
+
/** What a test hands `run()` beside cli-core's own: the fake service in place of the network (WC-ARCH-10). */
|
|
4
|
+
export interface ServiceEnvironment extends BaseEnvironment {
|
|
5
|
+
fetch?: typeof fetch;
|
|
6
|
+
}
|
|
7
|
+
export declare const PACE: {
|
|
8
|
+
perMinute: number;
|
|
9
|
+
burst: number;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Settings, keyring and the run come from cli-core's `baseContext` and nowhere else: a command that resolves settings
|
|
13
|
+
* on its own skips `--timeout`, the run record and the profile's permissions (WC-LIFE-5, WC-LIFE-15).
|
|
14
|
+
*/
|
|
15
|
+
export declare const contextOf: (command: Command) => {
|
|
16
|
+
settings: import("@wirecat/cli-core/cli").Settings;
|
|
17
|
+
renderer: import("@wirecat/cli-base").Renderer;
|
|
18
|
+
format: import("@wirecat/cli-base").RenderFormat;
|
|
19
|
+
color: boolean;
|
|
20
|
+
streams: import("@wirecat/cli-base").Streams;
|
|
21
|
+
compact?: boolean;
|
|
22
|
+
full?: boolean;
|
|
23
|
+
env: NodeJS.ProcessEnv;
|
|
24
|
+
keyring?: import("@wirecat/cli-base").KeyringStore;
|
|
25
|
+
run: <T>(body: (events: import("@wirecat/cli-core/cli").EventSink) => Promise<T>, options?: {
|
|
26
|
+
unbounded?: boolean;
|
|
27
|
+
name?: string;
|
|
28
|
+
}) => Promise<T>;
|
|
29
|
+
track: (closeable: import("@wirecat/cli-core/cli").Closeable) => void;
|
|
30
|
+
environment: ServiceEnvironment;
|
|
31
|
+
flags: GlobalFlags;
|
|
32
|
+
profile: string;
|
|
33
|
+
tokens: ProfileTokenStore;
|
|
34
|
+
};
|
|
35
|
+
/** The profile's saved token, or an authentication error that says how to sign in. Read before any request. */
|
|
36
|
+
export declare const tokenOf: (command: Command) => string;
|
|
37
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EAGpB,KAAK,WAAW,EAChB,iBAAiB,EAElB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAIxC,8GAA8G;AAC9G,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IACzD,KAAK,CAAC,EAAE,OAAO,KAAK,CAAA;CACrB;AAGD,eAAO,MAAM,IAAI;IAAK,SAAS;IAAO,KAAK;CAAM,CAAA;AAEjD;;;GAGG;AACH,eAAO,MAAM,SAAS,YAAa,OAAO;;;;;;;;;;;;;;;;;;;CAczC,CAAA;AAED,+GAA+G;AAC/G,eAAO,MAAM,OAAO,YAAa,OAAO,KAAG,MAI1C,CAAA"}
|
package/dist/context.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { baseContext, environmentOf, ProfileTokenStore, refuseOffline, } from "@wirecat/cli-core/cli";
|
|
2
|
+
import { API, configuration } from "./config.js";
|
|
3
|
+
import { IDENTITY } from "./identity.js";
|
|
4
|
+
// Attio allows 100 reads and 25 writes a second (docs.attio.com/rest-api/guides/rate-limiting); half of the writes.
|
|
5
|
+
export const PACE = { perMinute: 720, burst: 12 };
|
|
6
|
+
/**
|
|
7
|
+
* Settings, keyring and the run come from cli-core's `baseContext` and nowhere else: a command that resolves settings
|
|
8
|
+
* on its own skips `--timeout`, the run record and the profile's permissions (WC-LIFE-5, WC-LIFE-15).
|
|
9
|
+
*/
|
|
10
|
+
export const contextOf = (command) => {
|
|
11
|
+
const base = baseContext(command, configuration.resolveSettings);
|
|
12
|
+
return {
|
|
13
|
+
...base,
|
|
14
|
+
environment: environmentOf(command),
|
|
15
|
+
flags: command.optsWithGlobals(),
|
|
16
|
+
profile: base.settings.profile,
|
|
17
|
+
tokens: new ProfileTokenStore({
|
|
18
|
+
app: IDENTITY,
|
|
19
|
+
env: base.env,
|
|
20
|
+
keyring: base.keyring,
|
|
21
|
+
warn: base.renderer.warn,
|
|
22
|
+
}),
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
/** The profile's saved token, or an authentication error that says how to sign in. Read before any request. */
|
|
26
|
+
export const tokenOf = (command) => {
|
|
27
|
+
const { profile, tokens } = contextOf(command);
|
|
28
|
+
refuseOffline(command, API.service);
|
|
29
|
+
return tokens.need(profile);
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EACX,aAAa,EAEb,iBAAiB,EACjB,aAAa,GACd,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAOxC,oHAAoH;AACpH,MAAM,CAAC,MAAM,IAAI,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,CAAA;AAEjD;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,OAAgB,EAAE,EAAE;IAC5C,MAAM,IAAI,GAAG,WAAW,CAAC,OAAO,EAAE,aAAa,CAAC,eAAe,CAAC,CAAA;IAChE,OAAO;QACL,GAAG,IAAI;QACP,WAAW,EAAE,aAAa,CAAqB,OAAO,CAAC;QACvD,KAAK,EAAE,OAAO,CAAC,eAAe,EAAe;QAC7C,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO;QAC9B,MAAM,EAAE,IAAI,iBAAiB,CAAC;YAC5B,GAAG,EAAE,QAAQ;YACb,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI;SACzB,CAAC;KACH,CAAA;AACH,CAAC,CAAA;AAED,+GAA+G;AAC/G,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,OAAgB,EAAU,EAAE;IAClD,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GA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