@curviate/cli 0.48.0 → 0.50.0-next.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 +72 -0
- package/README.md +47 -6
- package/dist/{account-WKQHMM7P.js → account-KGCGUYKF.js} +668 -116
- package/dist/analytics-HRAD4ABO.js +27 -0
- package/dist/beta-consent-364JI6IL.js +81 -0
- package/dist/billing-3SSVRS2Y.js +124 -0
- package/dist/{chunk-Q63IIPL2.js → chunk-25MO7BYN.js} +4 -4
- package/dist/{chunk-76SWLAZ6.js → chunk-2W4RN5ON.js} +59 -1
- package/dist/chunk-5S3MJVI5.js +22 -0
- package/dist/chunk-67S4JHZZ.js +339 -0
- package/dist/chunk-73DJ3KNE.js +54 -0
- package/dist/chunk-CQGDMARG.js +525 -0
- package/dist/{chunk-Y7K4UBFC.js → chunk-DOHBOYXN.js} +1 -1
- package/dist/{chunk-TSOIZBBU.js → chunk-DSGKYZDK.js} +1 -1
- package/dist/{chunk-YLSJ4HKU.js → chunk-ENBIMEKS.js} +26 -1
- package/dist/{chunk-LCGXJGPB.js → chunk-GHMRPX5H.js} +7 -1
- package/dist/chunk-GOICALYQ.js +28 -0
- package/dist/chunk-L4CIJT6F.js +144 -0
- package/dist/{chunk-PQWDDSV7.js → chunk-L7JH3W56.js} +1 -1
- package/dist/{chunk-YFXLXION.js → chunk-OE6YFYUM.js} +85 -10
- package/dist/chunk-PPGKQJKU.js +38 -0
- package/dist/{chunk-MKGVNDMJ.js → chunk-QM57YDJE.js} +13 -201
- package/dist/{chunk-CVMSQ3OF.js → chunk-RYWWSZUH.js} +17 -3
- package/dist/chunk-T6GBS5SS.js +58 -0
- package/dist/{chunk-AYKKXGTR.js → chunk-TE3WBPW6.js} +392 -14
- package/dist/chunk-UL53T4O6.js +52 -0
- package/dist/chunk-UWQPX4AE.js +20 -0
- package/dist/{chunk-OHXYFICP.js → chunk-YXVF5UST.js} +77 -4
- package/dist/cli.js +35 -17
- package/dist/{comment-7IQ6ZOJF.js → comment-5JKGNYOY.js} +90 -11
- package/dist/{company-RD7RDGSA.js → company-TXST2VXW.js} +65 -15
- package/dist/{config-EYBNYRGK.js → config-TVIQUVNK.js} +53 -4
- package/dist/{connect-HVXT67A6.js → connect-RBL6U4KV.js} +63 -18
- package/dist/contact-YAHC5QFX.js +32 -0
- package/dist/contact-groups-DKOIBC57.js +399 -0
- package/dist/contact-import-ITSJQV7K.js +336 -0
- package/dist/core-PWMJPPRG.js +46 -0
- package/dist/do-not-contact-WDYIBWYA.js +200 -0
- package/dist/{doctor-HUXQERLQ.js → doctor-F7JLPTED.js} +65 -11
- package/dist/{document-AUUCGST2.js → document-BHYAUJ6F.js} +1 -1
- package/dist/{draft-DFO22K6Q.js → draft-TDJJUXLH.js} +60 -14
- package/dist/enrollment-Q6UOKHPY.js +484 -0
- package/dist/{examples-64YT5V5K.js → examples-DQSVIIXZ.js} +2 -2
- package/dist/{exit-codes-AW6KHDDN.js → exit-codes-7DBETBDT.js} +1 -1
- package/dist/export-HIJSCJS6.js +96 -0
- package/dist/{feed-JWP6ANPI.js → feed-W56ZTA4Z.js} +13 -10
- package/dist/{group-SIQFJEZV.js → group-AUALYK5H.js} +18 -10
- package/dist/{inbox-MMIMCA5O.js → inbox-HLZR2ZPV.js} +31 -12
- package/dist/{inboxes-RND3D4C7.js → inboxes-IZTRD6FE.js} +14 -10
- package/dist/incoming-ULB2RNV4.js +218 -0
- package/dist/{job-ACFKBLFK.js → job-55IKS6LP.js} +65 -13
- package/dist/{login-ZOB5KVKQ.js → login-DPZ6CXNO.js} +13 -4
- package/dist/{message-OFK6UVXR.js → message-J44YKRDS.js} +9 -7
- package/dist/motion-SQI5F2EK.js +868 -0
- package/dist/network-K4QD7APQ.js +235 -0
- package/dist/{notification-KKGAZU7M.js → notification-SEDXZHXO.js} +38 -11
- package/dist/notifications-HGIBRUNQ.js +231 -0
- package/dist/{post-A5SBCFB2.js → post-L467SKIG.js} +92 -12
- package/dist/{profile-4SOOQZ4K.js → profile-A2N6RMR2.js} +79 -23
- package/dist/{recruiter-YN73STDP.js → recruiter-AR75RHBO.js} +132 -21
- package/dist/{sales-nav-JXF5RY2K.js → sales-nav-C2AYFXPV.js} +73 -18
- package/dist/{search-JAL242A2.js → search-Z4DZIG4X.js} +55 -23
- package/dist/{setup-WICWH4JG.js → setup-45BEVX6B.js} +69 -17
- package/dist/team-6QWY4IFP.js +450 -0
- package/dist/tier-2HS3BXDF.js +61 -0
- package/dist/unibox-DHUKG65Z.js +402 -0
- package/dist/{webhook-UGKVYWBC.js → webhook-Q53WUAI2.js} +273 -45
- package/package.json +2 -2
- package/dist/chunk-GQKC6E5K.js +0 -36
- package/dist/core-6XYGUNAY.js +0 -46
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
BULK_MAX_IDS,
|
|
4
|
+
FILTER_ARGS,
|
|
5
|
+
contactIds,
|
|
6
|
+
hasFilter,
|
|
7
|
+
mergeChunks,
|
|
8
|
+
online,
|
|
9
|
+
preview,
|
|
10
|
+
readFilter
|
|
11
|
+
} from "./chunk-CQGDMARG.js";
|
|
12
|
+
import "./chunk-25MO7BYN.js";
|
|
13
|
+
import "./chunk-GOICALYQ.js";
|
|
14
|
+
import {
|
|
15
|
+
sendInChunks
|
|
16
|
+
} from "./chunk-UL53T4O6.js";
|
|
17
|
+
import {
|
|
18
|
+
fail,
|
|
19
|
+
listFlag,
|
|
20
|
+
outputOpts,
|
|
21
|
+
usage
|
|
22
|
+
} from "./chunk-T6GBS5SS.js";
|
|
23
|
+
import "./chunk-TCUYH5GO.js";
|
|
24
|
+
import {
|
|
25
|
+
intFlag
|
|
26
|
+
} from "./chunk-NNV2OYEF.js";
|
|
27
|
+
import {
|
|
28
|
+
pageDelayFromFlags,
|
|
29
|
+
readCursorFlag,
|
|
30
|
+
readMaxPagesFlag,
|
|
31
|
+
readableObject,
|
|
32
|
+
readablePage,
|
|
33
|
+
rejectPaginationModifiersWithoutAll,
|
|
34
|
+
streamAll
|
|
35
|
+
} from "./chunk-L4CIJT6F.js";
|
|
36
|
+
import {
|
|
37
|
+
renderSuccess,
|
|
38
|
+
writeNdjsonItem
|
|
39
|
+
} from "./chunk-QM57YDJE.js";
|
|
40
|
+
import "./chunk-YXVF5UST.js";
|
|
41
|
+
import {
|
|
42
|
+
GLOBAL_FLAGS,
|
|
43
|
+
READ_SINGLE_FLAGS,
|
|
44
|
+
WRITE_SINGLE_FLAGS,
|
|
45
|
+
readOnly
|
|
46
|
+
} from "./chunk-RYWWSZUH.js";
|
|
47
|
+
import "./chunk-73DJ3KNE.js";
|
|
48
|
+
import "./chunk-ZYURL5VK.js";
|
|
49
|
+
import "./chunk-2W4RN5ON.js";
|
|
50
|
+
|
|
51
|
+
// src/commands/contact-groups.ts
|
|
52
|
+
import { defineCommand } from "citty";
|
|
53
|
+
var show = (result, f) => renderSuccess(result, outputOpts(f), process);
|
|
54
|
+
var required = (flag, v, what) => {
|
|
55
|
+
if (v === void 0 || v.trim() === "") usage(`--${flag} is required: ${what}.`);
|
|
56
|
+
return v;
|
|
57
|
+
};
|
|
58
|
+
async function page(f, params, fetchPage) {
|
|
59
|
+
rejectPaginationModifiersWithoutAll(f, process);
|
|
60
|
+
if (f.limit !== void 0) params["limit"] = intFlag("limit", f.limit, 1, 100);
|
|
61
|
+
const cursor = readCursorFlag(f, process);
|
|
62
|
+
if (cursor) params["cursor"] = cursor;
|
|
63
|
+
try {
|
|
64
|
+
if (f.all) {
|
|
65
|
+
const next = (p) => fetchPage(p);
|
|
66
|
+
for await (const item of streamAll(next, params, { maxPages: readMaxPagesFlag(f, process), out: process, pageDelayMs: pageDelayFromFlags(f) })) writeNdjsonItem(process, item, f.fields);
|
|
67
|
+
} else {
|
|
68
|
+
show(readablePage(await fetchPage(params)), f);
|
|
69
|
+
}
|
|
70
|
+
} catch (err) {
|
|
71
|
+
await fail(err, f);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
var named = (what, v) => {
|
|
75
|
+
if (v === void 0 || v.trim() === "") usage(`${what} is empty.`);
|
|
76
|
+
return v;
|
|
77
|
+
};
|
|
78
|
+
async function bulkUpdate(c, f, skip, change) {
|
|
79
|
+
const ids = contactIds(f, skip);
|
|
80
|
+
const filtered = hasFilter(f);
|
|
81
|
+
if (filtered && ids.length) usage("name the Contacts either by id or with filter flags, not both.");
|
|
82
|
+
if (!filtered && !ids.length) usage("name the Contacts: one or more Contact ids (con_...), --ids, or filter flags such as --list or --tag.");
|
|
83
|
+
try {
|
|
84
|
+
if (filtered) {
|
|
85
|
+
const body = { filter: await readFilter(c, f, "body"), ...change };
|
|
86
|
+
if (f.preview) return preview("contacts.updateMany", {}, body);
|
|
87
|
+
return show(await c.contacts.updateMany(body), f);
|
|
88
|
+
}
|
|
89
|
+
if (f.preview) return preview("contacts.updateMany", {}, { contact_ids: ids.slice(0, BULK_MAX_IDS), ...change });
|
|
90
|
+
show(mergeChunks(await sendInChunks(ids, BULK_MAX_IDS, (chunk) => c.contacts.updateMany({ contact_ids: chunk, ...change }), f)), f);
|
|
91
|
+
} catch (err) {
|
|
92
|
+
await fail(err, f);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
var ID = { type: "positional", description: "Contact list id (cl_...)." };
|
|
96
|
+
var IDS = {
|
|
97
|
+
id: { type: "positional", required: false, variadic: true, description: "Contact id (con_...); several may follow." },
|
|
98
|
+
ids: { type: "string", description: `Contact ids (con_...); repeatable, or a comma list. Sent in requests of up to ${BULK_MAX_IDS} ids, in order; a failed request stops the run and reports what was sent.` }
|
|
99
|
+
};
|
|
100
|
+
var SEE_LISTS = ["curviate contact lists get", "curviate contact list"];
|
|
101
|
+
var BULK_ERRORS = { INSUFFICIENT_ROLE: "your role cannot change Contacts here.", CONTACT_LIMIT_REACHED: "a Tag or list-membership cap would be exceeded (the Contact is under `refused`)." };
|
|
102
|
+
var BULK_OUTPUT = ["`updated`, `unchanged`, `not_found` (ids that did not exist) and `refused` (a Contact over a cap, with the reason). Counts are summed over every request."];
|
|
103
|
+
var BULK_RADIUS = `By id: up to ${BULK_MAX_IDS} Contacts per request. By filter: every Contact the filter matches; count it first with \`curviate contact list <same filters> --total --limit 1\`.`;
|
|
104
|
+
var listsList = defineCommand({
|
|
105
|
+
meta: {
|
|
106
|
+
name: "list",
|
|
107
|
+
description: "List your Team's Contact lists, with how many Contacts each holds.",
|
|
108
|
+
risk: "read",
|
|
109
|
+
examples: ["curviate contact lists list", "curviate contact lists list --query warm"]
|
|
110
|
+
},
|
|
111
|
+
args: { ...readOnly(GLOBAL_FLAGS), query: { type: "string", description: "Only lists whose name matches this text." } },
|
|
112
|
+
run: online((c, f) => page(f, f.query !== void 0 ? { q: named("--query", f.query) } : {}, (p) => c.contactLists.list(p)))
|
|
113
|
+
});
|
|
114
|
+
var listsGet = defineCommand({
|
|
115
|
+
meta: { name: "get", description: "One Contact list: its name, description and Contact count.", risk: "read", examples: ["curviate contact lists get cl_YOUR_LIST_ID"] },
|
|
116
|
+
args: { ...readOnly(READ_SINGLE_FLAGS), id: ID },
|
|
117
|
+
run: online(async (c, f) => {
|
|
118
|
+
try {
|
|
119
|
+
show(readableObject(await c.contactLists.get(String(f.id ?? ""))), f);
|
|
120
|
+
} catch (err) {
|
|
121
|
+
await fail(err, f);
|
|
122
|
+
}
|
|
123
|
+
})
|
|
124
|
+
});
|
|
125
|
+
var listsCreate = defineCommand({
|
|
126
|
+
meta: {
|
|
127
|
+
name: "create",
|
|
128
|
+
description: "Create an empty Contact list. Fill it with `curviate contact lists add`, `curviate contact import --list`, or build it from other lists with `curviate contact lists combine`. Needs Automate.",
|
|
129
|
+
risk: "write",
|
|
130
|
+
rules: {
|
|
131
|
+
changes: "A new, empty Contact list.",
|
|
132
|
+
visible_to: "Your Team.",
|
|
133
|
+
budget_rows: [],
|
|
134
|
+
retry: "Not safe: a list name is unique, so a repeat answers NAME_TAKEN.",
|
|
135
|
+
undo: "`curviate contact lists delete <id>`."
|
|
136
|
+
},
|
|
137
|
+
errors: { NAME_TAKEN: "a list of that name exists (409)." },
|
|
138
|
+
examples: ['curviate contact lists create "Q4 prospects" --description "From the conference"']
|
|
139
|
+
},
|
|
140
|
+
args: {
|
|
141
|
+
...WRITE_SINGLE_FLAGS,
|
|
142
|
+
name: { type: "positional", description: "The list's name (up to 100 characters)." },
|
|
143
|
+
description: { type: "string", description: "What the list is for (up to 500 characters)." }
|
|
144
|
+
},
|
|
145
|
+
run: online(async (c, f) => {
|
|
146
|
+
const body = { name: named("the list name", f.name) };
|
|
147
|
+
if (f.description !== void 0) body["description"] = f.description;
|
|
148
|
+
if (f.preview) return preview("contactLists.create", {}, body);
|
|
149
|
+
try {
|
|
150
|
+
show(readableObject(await c.contactLists.create(body)), f);
|
|
151
|
+
} catch (err) {
|
|
152
|
+
await fail(err, f);
|
|
153
|
+
}
|
|
154
|
+
})
|
|
155
|
+
});
|
|
156
|
+
var listsCombine = defineCommand({
|
|
157
|
+
meta: {
|
|
158
|
+
name: "combine",
|
|
159
|
+
description: "Create a new Contact list from other lists: the Contacts in any of them (--list a --list b), in all of them (--list-match all), minus those in some others (--not-list). Any other filter flag narrows it too. The new list holds the Contacts that match now; it does not follow later changes to the source lists. Needs Automate.",
|
|
160
|
+
risk: "write",
|
|
161
|
+
rules: {
|
|
162
|
+
changes: "A new Contact list holding every Contact the filter matches at this moment. The source lists are unchanged.",
|
|
163
|
+
visible_to: "Your Team.",
|
|
164
|
+
budget_rows: [],
|
|
165
|
+
retry: "Not safe: a list name is unique, so a repeat answers NAME_TAKEN.",
|
|
166
|
+
undo: "`curviate contact lists delete <id>`; the Contacts stay."
|
|
167
|
+
},
|
|
168
|
+
errors: { NAME_TAKEN: "a list of that name exists (409).", CONTACT_LIMIT_REACHED: "the Team is at a list-membership cap." },
|
|
169
|
+
seeAlso: SEE_LISTS,
|
|
170
|
+
examples: [
|
|
171
|
+
'curviate contact lists combine "Hot or warm" --list cl_HOT --list cl_WARM',
|
|
172
|
+
'curviate contact lists combine "Hot and replied" --list cl_HOT --list cl_REPLIED --list-match all --not-list cl_DNC'
|
|
173
|
+
]
|
|
174
|
+
},
|
|
175
|
+
args: {
|
|
176
|
+
...WRITE_SINGLE_FLAGS,
|
|
177
|
+
name: { type: "positional", description: "The new list's name (up to 100 characters)." },
|
|
178
|
+
...FILTER_ARGS,
|
|
179
|
+
description: { type: "string", description: "What the list is for (up to 500 characters)." }
|
|
180
|
+
},
|
|
181
|
+
run: online(async (c, f) => {
|
|
182
|
+
if (listFlag("list", f.list).length === 0) usage("--list is required: the source list or lists (cl_...), repeatable.");
|
|
183
|
+
const body = { name: named("the list name", f.name), from: await readFilter(c, f, "body") };
|
|
184
|
+
if (f.description !== void 0) body["description"] = f.description;
|
|
185
|
+
if (f.preview) return preview("contactLists.create", {}, body);
|
|
186
|
+
try {
|
|
187
|
+
show(readableObject(await c.contactLists.create(body)), f);
|
|
188
|
+
} catch (err) {
|
|
189
|
+
await fail(err, f);
|
|
190
|
+
}
|
|
191
|
+
})
|
|
192
|
+
});
|
|
193
|
+
var listsUpdate = defineCommand({
|
|
194
|
+
meta: {
|
|
195
|
+
name: "update",
|
|
196
|
+
description: 'Rename a Contact list or change its description (--description "" clears it). Needs Automate.',
|
|
197
|
+
risk: "write",
|
|
198
|
+
rules: {
|
|
199
|
+
changes: "The list's name or description.",
|
|
200
|
+
visible_to: "Your Team.",
|
|
201
|
+
budget_rows: [],
|
|
202
|
+
retry: "Safe: the same call leaves the same list.",
|
|
203
|
+
undo: "Update again with the old values."
|
|
204
|
+
},
|
|
205
|
+
errors: { NAME_TAKEN: "a list of that name exists (409)." },
|
|
206
|
+
examples: ['curviate contact lists update cl_YOUR_LIST_ID --name "Q4 prospects"']
|
|
207
|
+
},
|
|
208
|
+
args: {
|
|
209
|
+
...WRITE_SINGLE_FLAGS,
|
|
210
|
+
id: ID,
|
|
211
|
+
name: { type: "string", description: "The new name (up to 100 characters)." },
|
|
212
|
+
description: { type: "string", description: "The new description (up to 500 characters); empty clears it." }
|
|
213
|
+
},
|
|
214
|
+
run: online(async (c, f) => {
|
|
215
|
+
const { name, description } = f;
|
|
216
|
+
const body = {};
|
|
217
|
+
if (name !== void 0) body["name"] = named("--name", name);
|
|
218
|
+
if (description !== void 0) body["description"] = description === "" ? null : description;
|
|
219
|
+
if (Object.keys(body).length === 0) usage("name what to change: --name or --description.");
|
|
220
|
+
if (f.preview) return preview("contactLists.update", { id: f.id }, body);
|
|
221
|
+
try {
|
|
222
|
+
show(readableObject(await c.contactLists.update(String(f.id ?? ""), body)), f);
|
|
223
|
+
} catch (err) {
|
|
224
|
+
await fail(err, f);
|
|
225
|
+
}
|
|
226
|
+
})
|
|
227
|
+
});
|
|
228
|
+
var listsDelete = defineCommand({
|
|
229
|
+
meta: {
|
|
230
|
+
name: "delete",
|
|
231
|
+
description: "Delete a Contact list. Its Contacts stay; a Motion that enrolls from it needs another list. Owners and Managers only.",
|
|
232
|
+
risk: "high",
|
|
233
|
+
rules: {
|
|
234
|
+
changes: "The list and its memberships are deleted; the Contacts are not.",
|
|
235
|
+
visible_to: "Your Team.",
|
|
236
|
+
budget_rows: [],
|
|
237
|
+
retry: "Safe: a second call answers RESOURCE_NOT_FOUND.",
|
|
238
|
+
undo: "Cannot be undone for the list itself: create it again and add the Contacts.",
|
|
239
|
+
blast_radius: "One list and its membership; no Contact is deleted."
|
|
240
|
+
},
|
|
241
|
+
errors: { RESOURCE_IN_USE: "a Motion still uses the list (409).", INSUFFICIENT_ROLE: "deleting lists is for Owners and Managers." },
|
|
242
|
+
seeAlso: SEE_LISTS,
|
|
243
|
+
examples: ["curviate contact lists delete cl_YOUR_LIST_ID"]
|
|
244
|
+
},
|
|
245
|
+
args: { ...WRITE_SINGLE_FLAGS, id: ID },
|
|
246
|
+
run: online(async (c, f) => {
|
|
247
|
+
if (f.preview) return preview("contactLists.delete", { id: f.id });
|
|
248
|
+
try {
|
|
249
|
+
await c.contactLists.delete(String(f.id ?? ""));
|
|
250
|
+
show({}, f);
|
|
251
|
+
} catch (err) {
|
|
252
|
+
await fail(err, f);
|
|
253
|
+
}
|
|
254
|
+
})
|
|
255
|
+
});
|
|
256
|
+
var membership = (verb) => defineCommand({
|
|
257
|
+
meta: {
|
|
258
|
+
name: verb,
|
|
259
|
+
description: `${verb === "add" ? "Add Contacts to" : "Remove Contacts from"} a Contact list. Name the Contacts by id, or with filter flags (the same as \`curviate contact list\`) to act on every match. Count a filter first: \`curviate contact list <same filters> --total --limit 1\`. Needs Automate.`,
|
|
260
|
+
risk: "high",
|
|
261
|
+
rules: {
|
|
262
|
+
changes: verb === "add" ? "The Contacts join the list." : "The Contacts leave the list; they are not deleted.",
|
|
263
|
+
visible_to: "Your Team; a Motion enrolling from the list sees the change.",
|
|
264
|
+
budget_rows: [],
|
|
265
|
+
retry: "Safe: a Contact already in (or out) is `unchanged`.",
|
|
266
|
+
undo: verb === "add" ? "`curviate contact lists remove` with the same Contacts." : "`curviate contact lists add` with the same Contacts.",
|
|
267
|
+
blast_radius: BULK_RADIUS
|
|
268
|
+
},
|
|
269
|
+
errors: BULK_ERRORS,
|
|
270
|
+
output: BULK_OUTPUT,
|
|
271
|
+
seeAlso: SEE_LISTS,
|
|
272
|
+
examples: [
|
|
273
|
+
`curviate contact lists ${verb} cl_YOUR_LIST_ID con_A con_B`,
|
|
274
|
+
`curviate contact lists ${verb} cl_YOUR_LIST_ID --tag hot --no-email`
|
|
275
|
+
]
|
|
276
|
+
},
|
|
277
|
+
args: {
|
|
278
|
+
...WRITE_SINGLE_FLAGS,
|
|
279
|
+
listId: { type: "positional", description: "Contact list id (cl_...)." },
|
|
280
|
+
...IDS,
|
|
281
|
+
...Object.fromEntries(Object.entries(FILTER_ARGS).filter(([k]) => k !== "list")),
|
|
282
|
+
"from-list": { type: "string", description: "Filter: only Contacts in this Contact list (cl_...); repeatable, or a comma list." }
|
|
283
|
+
},
|
|
284
|
+
run: online(async (c, f) => {
|
|
285
|
+
const listId = named("the list id", (f._ ?? [])[0]);
|
|
286
|
+
const fromList = f["from-list"];
|
|
287
|
+
const filtered = { ...f, ...fromList !== void 0 ? { list: fromList } : {} };
|
|
288
|
+
await bulkUpdate(c, filtered, 1, verb === "add" ? { add_list_id: listId } : { remove_list_id: listId });
|
|
289
|
+
})
|
|
290
|
+
});
|
|
291
|
+
var contactListsCommand = defineCommand({
|
|
292
|
+
meta: { name: "lists", description: "Contact lists: named sets of Contacts a Motion enrolls from." },
|
|
293
|
+
subCommands: { list: listsList, get: listsGet, create: listsCreate, combine: listsCombine, update: listsUpdate, delete: listsDelete, add: membership("add"), remove: membership("remove") },
|
|
294
|
+
async run() {
|
|
295
|
+
const { showHelp } = await import("./examples-DQSVIIXZ.js");
|
|
296
|
+
await showHelp(contactListsCommand, ["curviate", "contact", "lists"]);
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
var TAG_ID = { type: "positional", description: "Tag id, from `curviate contact tags list`." };
|
|
300
|
+
var tagsList = defineCommand({
|
|
301
|
+
meta: { name: "list", description: "List your Team's Tags with how many Contacts carry each.", risk: "read", examples: ["curviate contact tags list"] },
|
|
302
|
+
args: { ...readOnly(GLOBAL_FLAGS) },
|
|
303
|
+
run: online((c, f) => page(f, {}, (p) => c.tags.list(p)))
|
|
304
|
+
});
|
|
305
|
+
var tagsUpdate = defineCommand({
|
|
306
|
+
meta: {
|
|
307
|
+
name: "update",
|
|
308
|
+
description: "Rename a Tag on every Contact that carries it. A name another Tag has is refused. Needs Automate.",
|
|
309
|
+
risk: "write",
|
|
310
|
+
rules: {
|
|
311
|
+
changes: "The Tag's name, on all its Contacts.",
|
|
312
|
+
visible_to: "Your Team.",
|
|
313
|
+
budget_rows: [],
|
|
314
|
+
retry: "Safe: the same call leaves the same name.",
|
|
315
|
+
undo: "Rename it back."
|
|
316
|
+
},
|
|
317
|
+
errors: { NAME_TAKEN: "a Tag of that name exists (409)." },
|
|
318
|
+
examples: ["curviate contact tags update TAG_ID --name warm-lead"]
|
|
319
|
+
},
|
|
320
|
+
args: { ...WRITE_SINGLE_FLAGS, id: TAG_ID, name: { type: "string", required: true, description: "The new name (up to 64 characters)." } },
|
|
321
|
+
run: online(async (c, f) => {
|
|
322
|
+
const name = required("name", f.name, "the Tag's new name");
|
|
323
|
+
if (f.preview) return preview("tags.update", { id: f.id }, { name });
|
|
324
|
+
try {
|
|
325
|
+
show(readableObject(await c.tags.update(String(f.id ?? ""), { name })), f);
|
|
326
|
+
} catch (err) {
|
|
327
|
+
await fail(err, f);
|
|
328
|
+
}
|
|
329
|
+
})
|
|
330
|
+
});
|
|
331
|
+
var tagsDelete = defineCommand({
|
|
332
|
+
meta: {
|
|
333
|
+
name: "delete",
|
|
334
|
+
description: "Delete a Tag and take it off every Contact that carries it. Owners and Managers only.",
|
|
335
|
+
risk: "high",
|
|
336
|
+
rules: {
|
|
337
|
+
changes: "The Tag is removed from every Contact; the Contacts stay.",
|
|
338
|
+
visible_to: "Your Team.",
|
|
339
|
+
budget_rows: [],
|
|
340
|
+
retry: "Safe: a second call answers RESOURCE_NOT_FOUND.",
|
|
341
|
+
undo: "Cannot be undone: tag the Contacts again.",
|
|
342
|
+
blast_radius: "One Tag, on every Contact that carries it (its `contact_count`)."
|
|
343
|
+
},
|
|
344
|
+
errors: { INSUFFICIENT_ROLE: "deleting Tags is for Owners and Managers." },
|
|
345
|
+
seeAlso: ["curviate contact tags list"],
|
|
346
|
+
examples: ["curviate contact tags delete TAG_ID"]
|
|
347
|
+
},
|
|
348
|
+
args: { ...WRITE_SINGLE_FLAGS, id: TAG_ID },
|
|
349
|
+
run: online(async (c, f) => {
|
|
350
|
+
if (f.preview) return preview("tags.delete", { id: f.id });
|
|
351
|
+
try {
|
|
352
|
+
await c.tags.delete(String(f.id ?? ""));
|
|
353
|
+
show({}, f);
|
|
354
|
+
} catch (err) {
|
|
355
|
+
await fail(err, f);
|
|
356
|
+
}
|
|
357
|
+
})
|
|
358
|
+
});
|
|
359
|
+
var tagging = (verb) => defineCommand({
|
|
360
|
+
meta: {
|
|
361
|
+
name: verb,
|
|
362
|
+
description: `${verb === "add" ? "Put a Tag on" : "Take a Tag off"} Contacts, named by id or with filter flags (the same as \`curviate contact list\`) to act on every match. Count a filter first: \`curviate contact list <same filters> --total --limit 1\`. Needs Automate.`,
|
|
363
|
+
risk: "high",
|
|
364
|
+
rules: {
|
|
365
|
+
changes: verb === "add" ? "The Tag is put on the Contacts (created if new)." : "The Tag is taken off the Contacts.",
|
|
366
|
+
visible_to: "Your Team.",
|
|
367
|
+
budget_rows: [],
|
|
368
|
+
retry: "Safe: a Contact already tagged (or not) is `unchanged`.",
|
|
369
|
+
undo: verb === "add" ? "`curviate contact tags remove` with the same Contacts." : "`curviate contact tags add` with the same Contacts.",
|
|
370
|
+
blast_radius: BULK_RADIUS
|
|
371
|
+
},
|
|
372
|
+
errors: BULK_ERRORS,
|
|
373
|
+
output: BULK_OUTPUT,
|
|
374
|
+
seeAlso: ["curviate contact tags list", "curviate contact list"],
|
|
375
|
+
examples: [`curviate contact tags ${verb} hot con_A con_B`, `curviate contact tags ${verb} hot --list cl_YOUR_LIST_ID`]
|
|
376
|
+
},
|
|
377
|
+
args: {
|
|
378
|
+
...WRITE_SINGLE_FLAGS,
|
|
379
|
+
tagName: { type: "positional", description: "The Tag's name (up to 64 characters), any casing." },
|
|
380
|
+
...IDS,
|
|
381
|
+
...FILTER_ARGS
|
|
382
|
+
},
|
|
383
|
+
run: online(async (c, f) => {
|
|
384
|
+
const tag = named("the Tag name", (f._ ?? [])[0]);
|
|
385
|
+
await bulkUpdate(c, f, 1, verb === "add" ? { add_tags: [tag] } : { remove_tags: [tag] });
|
|
386
|
+
})
|
|
387
|
+
});
|
|
388
|
+
var contactTagsCommand = defineCommand({
|
|
389
|
+
meta: { name: "tags", description: "Tags: labels on Contacts." },
|
|
390
|
+
subCommands: { list: tagsList, update: tagsUpdate, delete: tagsDelete, add: tagging("add"), remove: tagging("remove") },
|
|
391
|
+
async run() {
|
|
392
|
+
const { showHelp } = await import("./examples-DQSVIIXZ.js");
|
|
393
|
+
await showHelp(contactTagsCommand, ["curviate", "contact", "tags"]);
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
export {
|
|
397
|
+
contactListsCommand,
|
|
398
|
+
contactTagsCommand
|
|
399
|
+
};
|