@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,235 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
print,
|
|
4
|
+
table
|
|
5
|
+
} from "./chunk-5S3MJVI5.js";
|
|
6
|
+
import {
|
|
7
|
+
formatRows,
|
|
8
|
+
writeExport
|
|
9
|
+
} from "./chunk-PPGKQJKU.js";
|
|
10
|
+
import {
|
|
11
|
+
fail,
|
|
12
|
+
listFlag,
|
|
13
|
+
outputOpts,
|
|
14
|
+
rootClient,
|
|
15
|
+
usage
|
|
16
|
+
} from "./chunk-T6GBS5SS.js";
|
|
17
|
+
import {
|
|
18
|
+
buildPreviewOutput
|
|
19
|
+
} from "./chunk-TCUYH5GO.js";
|
|
20
|
+
import {
|
|
21
|
+
intFlag
|
|
22
|
+
} from "./chunk-NNV2OYEF.js";
|
|
23
|
+
import {
|
|
24
|
+
pageDelayFromFlags,
|
|
25
|
+
readCursorFlag,
|
|
26
|
+
readMaxPagesFlag,
|
|
27
|
+
readablePage,
|
|
28
|
+
rejectPaginationModifiersWithoutAll,
|
|
29
|
+
streamAll
|
|
30
|
+
} from "./chunk-L4CIJT6F.js";
|
|
31
|
+
import {
|
|
32
|
+
renderSuccess,
|
|
33
|
+
writeNdjsonItem
|
|
34
|
+
} from "./chunk-QM57YDJE.js";
|
|
35
|
+
import "./chunk-YXVF5UST.js";
|
|
36
|
+
import {
|
|
37
|
+
GLOBAL_FLAGS,
|
|
38
|
+
WRITE_SINGLE_FLAGS,
|
|
39
|
+
readOnly
|
|
40
|
+
} from "./chunk-RYWWSZUH.js";
|
|
41
|
+
import {
|
|
42
|
+
DESCRIPTIONS
|
|
43
|
+
} from "./chunk-73DJ3KNE.js";
|
|
44
|
+
import "./chunk-ZYURL5VK.js";
|
|
45
|
+
|
|
46
|
+
// src/commands/network.ts
|
|
47
|
+
import { defineCommand } from "citty";
|
|
48
|
+
var CONNECTION_FIELDS = [
|
|
49
|
+
"account_id",
|
|
50
|
+
"member_id",
|
|
51
|
+
"public_identifier",
|
|
52
|
+
"public_profile_url",
|
|
53
|
+
"first_name",
|
|
54
|
+
"last_name",
|
|
55
|
+
"headline",
|
|
56
|
+
"job_title",
|
|
57
|
+
"company",
|
|
58
|
+
"location",
|
|
59
|
+
"profile_picture_url",
|
|
60
|
+
"connected_at",
|
|
61
|
+
"first_seen_at",
|
|
62
|
+
"removed_at",
|
|
63
|
+
"observed_at"
|
|
64
|
+
];
|
|
65
|
+
function listParams(f) {
|
|
66
|
+
const q = {};
|
|
67
|
+
if (f.accounts !== void 0) q["account_id"] = listFlag("accounts", f.accounts);
|
|
68
|
+
if (f.query !== void 0) q["q"] = f.query;
|
|
69
|
+
if (f["include-removed"]) q["include_removed"] = true;
|
|
70
|
+
return q;
|
|
71
|
+
}
|
|
72
|
+
async function runList(c, f) {
|
|
73
|
+
rejectPaginationModifiersWithoutAll(f, process);
|
|
74
|
+
const params = listParams(f);
|
|
75
|
+
if (f.limit !== void 0) params["limit"] = intFlag("limit", f.limit, 1, 1e3);
|
|
76
|
+
const cursor = readCursorFlag(f, process);
|
|
77
|
+
if (cursor) params["cursor"] = cursor;
|
|
78
|
+
try {
|
|
79
|
+
if (f.all) {
|
|
80
|
+
const page2 = (p) => c.network.connections.list(p);
|
|
81
|
+
for await (const item of streamAll(page2, params, { maxPages: readMaxPagesFlag(f, process), out: process, pageDelayMs: pageDelayFromFlags(f) })) writeNdjsonItem(process, item, f.fields);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const page = readablePage(await c.network.connections.list(params));
|
|
85
|
+
if (outputOpts(f).json) return renderSuccess(page, outputOpts(f), process);
|
|
86
|
+
print(table(["NAME", "HEADLINE", "ACCOUNT", "CONNECTED"], page.items.map((i) => [[i["first_name"], i["last_name"]].filter(Boolean).join(" "), i["headline"], i["account_id"], i["connected_at"] ?? i["first_seen_at"]])));
|
|
87
|
+
coverageNote(page["coverage"]);
|
|
88
|
+
if (page["cursor"]) print(`next page: --cursor ${String(page["cursor"])}`);
|
|
89
|
+
} catch (err) {
|
|
90
|
+
await fail(err, f);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function coverageNote(coverage) {
|
|
94
|
+
const cov = coverage;
|
|
95
|
+
if (cov?.complete === false) process.stderr.write(`warning: ${cov.accounts_incomplete ?? "some"} Account(s) in scope have not finished their first sync; the list is incomplete. See \`curviate network status\`.
|
|
96
|
+
`);
|
|
97
|
+
}
|
|
98
|
+
async function runStatus(c, f) {
|
|
99
|
+
const params = {};
|
|
100
|
+
if (f.accounts !== void 0) params["account_id"] = listFlag("accounts", f.accounts);
|
|
101
|
+
try {
|
|
102
|
+
const res = await c.network.syncStatus(params);
|
|
103
|
+
if (outputOpts(f).json) return renderSuccess(res, outputOpts(f), process);
|
|
104
|
+
const win = (w) => {
|
|
105
|
+
const r = w;
|
|
106
|
+
return r ? `${r["start"]}-${r["end"]} ${r["effective_timezone"] ?? "no zone"} (${r["zone_state"]})` : null;
|
|
107
|
+
};
|
|
108
|
+
print(table(
|
|
109
|
+
["ACCOUNT", "STATE", "PAUSED", "STORED", "LAST FULL SYNC", "NEXT READ", "RESYNC FROM", "READ WINDOW"],
|
|
110
|
+
(res.items ?? []).map((i) => [i["account_id"], i["state"], i["paused_reason"], i["connections_stored"], i["last_full_sync_at"], i["next_run_at"], i["next_manual_resync_at"], win(i["read_window"])])
|
|
111
|
+
));
|
|
112
|
+
} catch (err) {
|
|
113
|
+
await fail(err, f);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
async function runExport(c, f) {
|
|
117
|
+
if (f.json) usage("export commands take no --json: pass --format json.");
|
|
118
|
+
const format = f.format ?? "ndjson";
|
|
119
|
+
if (!["csv", "json", "ndjson"].includes(format)) usage("--format takes csv, json or ndjson.");
|
|
120
|
+
const fields = f.fields === void 0 ? CONNECTION_FIELDS : listFlag("fields", f.fields);
|
|
121
|
+
const rows = [];
|
|
122
|
+
let first = true;
|
|
123
|
+
try {
|
|
124
|
+
for (let cursor; first || cursor; first = false) {
|
|
125
|
+
const page = readablePage(await c.network.connections.list({ ...listParams(f), limit: 1e3, ...cursor ? { cursor } : {} }));
|
|
126
|
+
if (first) coverageNote(page["coverage"]);
|
|
127
|
+
rows.push(...page.items);
|
|
128
|
+
cursor = page["cursor"];
|
|
129
|
+
}
|
|
130
|
+
await writeExport(f.output, formatRows(rows, fields, format));
|
|
131
|
+
} catch (err) {
|
|
132
|
+
await fail(err, f);
|
|
133
|
+
}
|
|
134
|
+
process.stderr.write(`${rows.length} Connections exported.
|
|
135
|
+
`);
|
|
136
|
+
}
|
|
137
|
+
async function runResync(c, f) {
|
|
138
|
+
if (f.accountId === void 0 === !f.all) usage("name one Account (`curviate network resync <account_id>`) or pass --all for every Account you may operate, not both.");
|
|
139
|
+
const body = f.accountId === void 0 ? {} : { account_id: f.accountId };
|
|
140
|
+
if (f.preview) return print(JSON.stringify(buildPreviewOutput({ method: "network.resync", args: {}, body })));
|
|
141
|
+
try {
|
|
142
|
+
renderSuccess(await c.network.resync(body), outputOpts(f), process);
|
|
143
|
+
} catch (err) {
|
|
144
|
+
await fail(err, f);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
var online = (fn) => async ({ args }) => {
|
|
148
|
+
const f = args;
|
|
149
|
+
await fn(await rootClient(f), f);
|
|
150
|
+
};
|
|
151
|
+
var FILTERS = {
|
|
152
|
+
accounts: { type: "string", description: "Only these Accounts: a comma list of ids (acc_...). Never filled from your profile's default Account." },
|
|
153
|
+
query: { type: "string", description: "Name or headline contains this text (3 to 100 characters)." },
|
|
154
|
+
"include-removed": { type: "boolean", description: "Also list Connections that have left (removed_at set)." }
|
|
155
|
+
};
|
|
156
|
+
var listCmd = defineCommand({
|
|
157
|
+
meta: {
|
|
158
|
+
name: "list",
|
|
159
|
+
description: "List the stored Connections of the Accounts you may operate, newest first: one item per Account and person. Read from Curviate's store: no LinkedIn call, no budget. An empty list with incomplete coverage means not synced yet, never no Connections.",
|
|
160
|
+
risk: "read",
|
|
161
|
+
output: ["A table of name, headline, Account and connection time; --json (or piped) prints the API page with `coverage`."],
|
|
162
|
+
seeAlso: ["curviate network status", "curviate network export"],
|
|
163
|
+
examples: ["curviate network list", "curviate network list --query founder --accounts acc_YOUR_ACCOUNT_ID"]
|
|
164
|
+
},
|
|
165
|
+
args: { ...readOnly(GLOBAL_FLAGS), ...FILTERS },
|
|
166
|
+
run: online(runList)
|
|
167
|
+
});
|
|
168
|
+
var statusCmd = defineCommand({
|
|
169
|
+
meta: {
|
|
170
|
+
name: "status",
|
|
171
|
+
description: "How far each Account's Connection sync is: state, why it is paused, Connections stored, the last full sync, the next read, when a manual resync is allowed again, and the read window.",
|
|
172
|
+
risk: "read",
|
|
173
|
+
examples: ["curviate network status", "curviate network status --accounts acc_YOUR_ACCOUNT_ID"]
|
|
174
|
+
},
|
|
175
|
+
args: { ...readOnly(WRITE_SINGLE_FLAGS), accounts: FILTERS.accounts },
|
|
176
|
+
run: online(runStatus)
|
|
177
|
+
});
|
|
178
|
+
var exportCmd = defineCommand({
|
|
179
|
+
meta: {
|
|
180
|
+
name: "export",
|
|
181
|
+
description: "Export the stored Connections, every page, with the list filters. Writes ndjson (default), json or csv to stdout or a file (mode 0600). A count goes to stderr, and a warning when an Account in scope has not finished its first sync (exit 0).",
|
|
182
|
+
risk: "read",
|
|
183
|
+
output: ["Data only on stdout or the --output file; the count and warnings on stderr. CSV is UTF-8 with a BOM; a cell starting with = + - @ or ' gets a leading '."],
|
|
184
|
+
examples: ["curviate network export --format csv -o connections.csv", "curviate network export --accounts acc_YOUR_ACCOUNT_ID --fields first_name,last_name,public_profile_url"]
|
|
185
|
+
},
|
|
186
|
+
args: {
|
|
187
|
+
"api-key": GLOBAL_FLAGS["api-key"],
|
|
188
|
+
profile: GLOBAL_FLAGS.profile,
|
|
189
|
+
team: GLOBAL_FLAGS.team,
|
|
190
|
+
"base-url": GLOBAL_FLAGS["base-url"],
|
|
191
|
+
timeout: GLOBAL_FLAGS.timeout,
|
|
192
|
+
...FILTERS,
|
|
193
|
+
format: { type: "string", description: "csv, json or ndjson (default ndjson)." },
|
|
194
|
+
output: { type: "string", alias: "o", description: "File to write (mode 0600; replaced only when the export completes), or - for stdout (default)." },
|
|
195
|
+
fields: { type: "string", description: `Columns, comma-separated, in order (default: ${CONNECTION_FIELDS.join(", ")}).` },
|
|
196
|
+
json: { type: "boolean", description: "Not taken by exports: pass --format json." }
|
|
197
|
+
},
|
|
198
|
+
run: online(runExport)
|
|
199
|
+
});
|
|
200
|
+
var resyncCmd = defineCommand({
|
|
201
|
+
meta: {
|
|
202
|
+
name: "resync",
|
|
203
|
+
description: "Start a fresh walk of an Account's Connections now, or of every Account you may operate with --all. Once per Account per day; pages are read inside the Account's read window. Answers queued, cooldown, in_progress or paused per Account: answers, not errors. Needs Automate.",
|
|
204
|
+
risk: "high",
|
|
205
|
+
rules: {
|
|
206
|
+
changes: "Opens a sync walk; Curviate reads the Account's Connections from LinkedIn over the next hours.",
|
|
207
|
+
visible_to: "Nobody: reads only.",
|
|
208
|
+
budget_rows: ["connections_sync"],
|
|
209
|
+
retry: "A second call within the same day answers cooldown; nothing new starts.",
|
|
210
|
+
undo: "Cannot be stopped once queued; the walk ends on its own.",
|
|
211
|
+
blast_radius: "One Account, or with --all every Account you may operate."
|
|
212
|
+
},
|
|
213
|
+
errors: { ACCOUNT_NOT_FOUND: "the Account is not in your Team.", INSUFFICIENT_ROLE: "your role cannot operate the Account.", ACCOUNT_NOT_SHARED: "the Account is not shared with you.", TIER_REQUIRED: "your plan does not include Network." },
|
|
214
|
+
seeAlso: ["curviate network status"],
|
|
215
|
+
examples: ["curviate network resync --all", "curviate network resync acc_YOUR_ACCOUNT_ID"]
|
|
216
|
+
},
|
|
217
|
+
args: {
|
|
218
|
+
...WRITE_SINGLE_FLAGS,
|
|
219
|
+
accountId: { type: "positional", required: false, description: "The Account to resync (acc_...). Omit it with --all." },
|
|
220
|
+
all: { type: "boolean", description: "Resync every Account you may operate." }
|
|
221
|
+
},
|
|
222
|
+
run: online(runResync)
|
|
223
|
+
});
|
|
224
|
+
var networkCommand = defineCommand({
|
|
225
|
+
meta: { name: "network", description: DESCRIPTIONS.network },
|
|
226
|
+
subCommands: { list: listCmd, status: statusCmd, export: exportCmd, resync: resyncCmd },
|
|
227
|
+
async run() {
|
|
228
|
+
const { showHelp } = await import("./examples-DQSVIIXZ.js");
|
|
229
|
+
await showHelp(networkCommand, ["curviate", "network"]);
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
export {
|
|
233
|
+
CONNECTION_FIELDS,
|
|
234
|
+
networkCommand
|
|
235
|
+
};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
AS_ACCOUNT,
|
|
4
|
+
TARGET
|
|
5
|
+
} from "./chunk-UWQPX4AE.js";
|
|
2
6
|
import {
|
|
3
7
|
requireAccount
|
|
4
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-25MO7BYN.js";
|
|
5
9
|
import {
|
|
6
10
|
buildPreviewOutput
|
|
7
11
|
} from "./chunk-TCUYH5GO.js";
|
|
@@ -11,26 +15,28 @@ import {
|
|
|
11
15
|
readMaxPagesFlag,
|
|
12
16
|
readablePage,
|
|
13
17
|
rejectPaginationModifiersWithoutAll,
|
|
18
|
+
streamAll
|
|
19
|
+
} from "./chunk-L4CIJT6F.js";
|
|
20
|
+
import {
|
|
14
21
|
renderError,
|
|
15
22
|
renderSuccess,
|
|
16
23
|
renderUnexpectedError,
|
|
17
|
-
resolveEffectiveConfig,
|
|
18
|
-
streamAll,
|
|
19
24
|
writeNdjsonItem
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-76SWLAZ6.js";
|
|
25
|
+
} from "./chunk-QM57YDJE.js";
|
|
22
26
|
import {
|
|
23
|
-
createClient
|
|
24
|
-
|
|
27
|
+
createClient,
|
|
28
|
+
resolveEffectiveConfig
|
|
29
|
+
} from "./chunk-YXVF5UST.js";
|
|
25
30
|
import {
|
|
26
31
|
GLOBAL_FLAGS,
|
|
27
32
|
WRITE_SINGLE_FLAGS,
|
|
28
33
|
readOnly
|
|
29
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-RYWWSZUH.js";
|
|
30
35
|
import {
|
|
31
36
|
DESCRIPTIONS
|
|
32
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-73DJ3KNE.js";
|
|
33
38
|
import "./chunk-ZYURL5VK.js";
|
|
39
|
+
import "./chunk-2W4RN5ON.js";
|
|
34
40
|
|
|
35
41
|
// src/commands/notification.ts
|
|
36
42
|
import { defineCommand } from "citty";
|
|
@@ -51,7 +57,7 @@ function resolveOutputOpts(flags) {
|
|
|
51
57
|
async function handleSdkError(err, outOpts, out) {
|
|
52
58
|
const { CurviateError } = await import("@curviate/sdk");
|
|
53
59
|
if (err instanceof CurviateError) {
|
|
54
|
-
const { getExitCode } = await import("./exit-codes-
|
|
60
|
+
const { getExitCode } = await import("./exit-codes-7DBETBDT.js");
|
|
55
61
|
renderError(err, outOpts, out);
|
|
56
62
|
process.exit(getExitCode(err));
|
|
57
63
|
}
|
|
@@ -126,7 +132,8 @@ async function runNotificationShowLess(client, flags, out) {
|
|
|
126
132
|
var notificationListCommand = defineCommand({
|
|
127
133
|
meta: {
|
|
128
134
|
name: "list",
|
|
129
|
-
description: "List the connected account's notification cards, newest first, plus the unread badge and a poll watermark.",
|
|
135
|
+
description: "List the connected account's LinkedIn notification cards, newest first, plus the unread badge and a poll watermark. Curviate's own Notifications are `curviate notification list`.",
|
|
136
|
+
risk: "read",
|
|
130
137
|
examples: [
|
|
131
138
|
"curviate core notification list",
|
|
132
139
|
"curviate core notification list --filter mentions"
|
|
@@ -161,6 +168,17 @@ var notificationDeleteCommand = defineCommand({
|
|
|
161
168
|
meta: {
|
|
162
169
|
name: "delete",
|
|
163
170
|
description: "Delete one of your notification cards by its card urn. Self-action, safe to repeat, cannot be undone. An injected card (injected: true) has no card urn and cannot be deleted. LinkedIn may bring editorial and promotional cards back after a delete; `curviate core notification show-less` is the reliable way to suppress those.",
|
|
171
|
+
risk: "high",
|
|
172
|
+
rules: {
|
|
173
|
+
changes: "Deletes one notification card from your LinkedIn account.",
|
|
174
|
+
visible_to: "Only you.",
|
|
175
|
+
budget_rows: [],
|
|
176
|
+
retry: "Safe: repeating it changes nothing.",
|
|
177
|
+
undo: "Cannot be undone; LinkedIn may bring editorial and promotional cards back.",
|
|
178
|
+
blast_radius: "One notification card."
|
|
179
|
+
},
|
|
180
|
+
errors: { ...AS_ACCOUNT, ...TARGET },
|
|
181
|
+
seeAlso: ["curviate core notification list"],
|
|
164
182
|
examples: [
|
|
165
183
|
'curviate core notification delete "urn:li:fsd_notificationCard:(urn:li:fsd_notification:9999,ALL)"'
|
|
166
184
|
]
|
|
@@ -191,6 +209,15 @@ var notificationShowLessCommand = defineCommand({
|
|
|
191
209
|
meta: {
|
|
192
210
|
name: "show-less",
|
|
193
211
|
description: "Apply 'show less like this' to the source of one of your notification cards. For network-activity cards this removes the card, same as delete. Self-action, safe to repeat, cannot be undone.",
|
|
212
|
+
risk: "write",
|
|
213
|
+
rules: {
|
|
214
|
+
changes: "Tells LinkedIn to show less from the source of one notification card.",
|
|
215
|
+
visible_to: "Only you.",
|
|
216
|
+
budget_rows: [],
|
|
217
|
+
retry: "Safe: repeating it changes nothing.",
|
|
218
|
+
undo: "Cannot be undone."
|
|
219
|
+
},
|
|
220
|
+
errors: { ...AS_ACCOUNT, ...TARGET },
|
|
194
221
|
examples: [
|
|
195
222
|
'curviate core notification show-less "urn:li:fsd_notificationCard:(urn:li:fsd_notification:9999,ALL)"'
|
|
196
223
|
]
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
fail,
|
|
4
|
+
outputOpts,
|
|
5
|
+
rootClient,
|
|
6
|
+
usage
|
|
7
|
+
} from "./chunk-T6GBS5SS.js";
|
|
8
|
+
import {
|
|
9
|
+
buildPreviewOutput
|
|
10
|
+
} from "./chunk-TCUYH5GO.js";
|
|
11
|
+
import {
|
|
12
|
+
intFlag
|
|
13
|
+
} from "./chunk-NNV2OYEF.js";
|
|
14
|
+
import {
|
|
15
|
+
pageDelayFromFlags,
|
|
16
|
+
readCursorFlag,
|
|
17
|
+
readMaxPagesFlag,
|
|
18
|
+
readableObject,
|
|
19
|
+
readablePage,
|
|
20
|
+
rejectPaginationModifiersWithoutAll,
|
|
21
|
+
streamAll
|
|
22
|
+
} from "./chunk-L4CIJT6F.js";
|
|
23
|
+
import {
|
|
24
|
+
renderSuccess,
|
|
25
|
+
writeNdjsonItem
|
|
26
|
+
} from "./chunk-QM57YDJE.js";
|
|
27
|
+
import "./chunk-YXVF5UST.js";
|
|
28
|
+
import {
|
|
29
|
+
GLOBAL_FLAGS,
|
|
30
|
+
READ_SINGLE_FLAGS,
|
|
31
|
+
WRITE_SINGLE_FLAGS,
|
|
32
|
+
readOnly
|
|
33
|
+
} from "./chunk-RYWWSZUH.js";
|
|
34
|
+
import {
|
|
35
|
+
DESCRIPTIONS
|
|
36
|
+
} from "./chunk-73DJ3KNE.js";
|
|
37
|
+
import "./chunk-ZYURL5VK.js";
|
|
38
|
+
|
|
39
|
+
// src/commands/notifications.ts
|
|
40
|
+
import { defineCommand } from "citty";
|
|
41
|
+
var online = (fn) => async ({ args }) => {
|
|
42
|
+
const f = args;
|
|
43
|
+
await fn(await rootClient(f), f);
|
|
44
|
+
};
|
|
45
|
+
function preview(method, args, body) {
|
|
46
|
+
process.stdout.write(JSON.stringify(buildPreviewOutput({ method, args, body })) + "\n");
|
|
47
|
+
}
|
|
48
|
+
function ids(f) {
|
|
49
|
+
const all = (f._ && f._.length > 0 ? f._ : f.id !== void 0 ? [f.id] : []).map(String);
|
|
50
|
+
if (all.length === 0 || all.some((v) => v.trim() === "")) usage("pass one or more notification ids (from `curviate notification list`).");
|
|
51
|
+
return all;
|
|
52
|
+
}
|
|
53
|
+
async function runList(c, f) {
|
|
54
|
+
rejectPaginationModifiersWithoutAll(f, process);
|
|
55
|
+
if (f.unread === true && f.archived === true) usage("--unread and --archived cannot be combined: an item is archived or unread, not both. Pass one.");
|
|
56
|
+
const params = { filter: f.unread === true ? "unread" : f.archived === true ? "archived" : "all" };
|
|
57
|
+
if (f.limit !== void 0) params["limit"] = intFlag("limit", f.limit, 1, 100);
|
|
58
|
+
const cursor = readCursorFlag(f, process);
|
|
59
|
+
if (cursor) params["cursor"] = cursor;
|
|
60
|
+
const keep = (item) => f.unread !== false || item.read === true;
|
|
61
|
+
const opts = outputOpts(f);
|
|
62
|
+
try {
|
|
63
|
+
if (f.all) {
|
|
64
|
+
const page = (p) => c.notifications.list(p);
|
|
65
|
+
for await (const item of streamAll(page, params, { maxPages: readMaxPagesFlag(f, process), out: process, pageDelayMs: pageDelayFromFlags(f) })) {
|
|
66
|
+
if (keep(item)) writeNdjsonItem(process, item, f.fields);
|
|
67
|
+
}
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const result = readablePage(await c.notifications.list(params));
|
|
71
|
+
renderSuccess({ ...result, items: result.items.filter(keep) }, opts, process);
|
|
72
|
+
} catch (err) {
|
|
73
|
+
await fail(err, f);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
async function runCount(c, f) {
|
|
77
|
+
try {
|
|
78
|
+
renderSuccess(readableObject(await c.notifications.unreadCount()), outputOpts(f), process);
|
|
79
|
+
} catch (err) {
|
|
80
|
+
await fail(err, f);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
var update = (body) => async (c, f) => {
|
|
84
|
+
const all = ids(f);
|
|
85
|
+
if (f.preview) return preview("notifications.update", { ids: all }, body);
|
|
86
|
+
const { CurviateError } = await import("@curviate/sdk");
|
|
87
|
+
const updated = [];
|
|
88
|
+
const notFound = [];
|
|
89
|
+
let notFoundError;
|
|
90
|
+
for (const id of all) {
|
|
91
|
+
try {
|
|
92
|
+
updated.push(readableObject(await c.notifications.update(id, body)));
|
|
93
|
+
} catch (err) {
|
|
94
|
+
if (err instanceof CurviateError && err.code === "RESOURCE_NOT_FOUND") {
|
|
95
|
+
notFound.push(id);
|
|
96
|
+
notFoundError ?? (notFoundError = err);
|
|
97
|
+
} else {
|
|
98
|
+
return fail(err, f);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
renderSuccess({ updated, not_found: notFound }, outputOpts(f), process);
|
|
103
|
+
if (notFoundError) {
|
|
104
|
+
process.stderr.write(`error: ${notFound.length} of ${all.length} notifications were not found (not yours, or already gone): ${notFound.join(", ")}. The others were applied.
|
|
105
|
+
`);
|
|
106
|
+
const { getExitCode } = await import("./exit-codes-7DBETBDT.js");
|
|
107
|
+
process.exit(getExitCode(notFoundError));
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
var ISO_WITH_OFFSET = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:\d{2})$/;
|
|
111
|
+
async function runReadAll(c, f) {
|
|
112
|
+
if (f.to !== void 0 && !ISO_WITH_OFFSET.test(f.to)) usage("--to takes an ISO 8601 instant with an offset, e.g. 2026-10-08T10:00:00Z.");
|
|
113
|
+
const body = f.to === void 0 ? {} : { before: f.to };
|
|
114
|
+
if (f.preview) return preview("notifications.markAllRead", {}, body);
|
|
115
|
+
try {
|
|
116
|
+
renderSuccess(readableObject(await c.notifications.markAllRead(body)), outputOpts(f), process);
|
|
117
|
+
} catch (err) {
|
|
118
|
+
await fail(err, f);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
var ID = { type: "positional", variadic: true, description: "Notification id (ntf_...), from `curviate notification list`. Several may follow." };
|
|
122
|
+
var IDS_OUTPUT = ["`updated` (the notifications as they now stand) and `not_found` (ids that are not yours). Exit 4 when any was not found; the others were still applied."];
|
|
123
|
+
var SEE = ["curviate notification list", "curviate core notification"];
|
|
124
|
+
var listCmd = defineCommand({
|
|
125
|
+
meta: {
|
|
126
|
+
name: "list",
|
|
127
|
+
description: "List your Curviate Notifications, newest first, with the unread count. Curviate's own, per Team; LinkedIn's notification cards are `curviate core notification list`. --unread lists unread ones, --archived archived ones, neither all (archived kept apart); --no-unread keeps only read ones. Kept for a limited time.",
|
|
128
|
+
risk: "read",
|
|
129
|
+
output: ["`items`, a `cursor` for the next page, and `unread_count`, the Team-wide unread badge, not a count of the items shown."],
|
|
130
|
+
examples: ["curviate notification list", "curviate notification list --unread", "curviate notification list --archived --limit 50"]
|
|
131
|
+
},
|
|
132
|
+
args: {
|
|
133
|
+
...readOnly(GLOBAL_FLAGS),
|
|
134
|
+
unread: { type: "boolean", description: "Only unread notifications (--no-unread: only read ones). Not with --archived." },
|
|
135
|
+
archived: { type: "boolean", description: "Only archived notifications (--no-archived: not archived, which is also the default)." }
|
|
136
|
+
},
|
|
137
|
+
run: online(runList)
|
|
138
|
+
});
|
|
139
|
+
var countCmd = defineCommand({
|
|
140
|
+
meta: {
|
|
141
|
+
name: "count",
|
|
142
|
+
description: "Your unread Curviate Notifications: the number only. Check it at the start of a session.",
|
|
143
|
+
risk: "read",
|
|
144
|
+
examples: ["curviate notification count"]
|
|
145
|
+
},
|
|
146
|
+
args: { ...readOnly(READ_SINGLE_FLAGS) },
|
|
147
|
+
run: online(runCount)
|
|
148
|
+
});
|
|
149
|
+
var markRules = (changes, undo) => ({
|
|
150
|
+
changes,
|
|
151
|
+
visible_to: "Only you; no one else's notifications change.",
|
|
152
|
+
budget_rows: [],
|
|
153
|
+
retry: "Safe: setting a flag that is already set changes nothing.",
|
|
154
|
+
undo
|
|
155
|
+
});
|
|
156
|
+
var readCmd = defineCommand({
|
|
157
|
+
meta: {
|
|
158
|
+
name: "read",
|
|
159
|
+
description: "Mark one or more of your notifications read. Each id is its own request; one that is not yours is reported and the rest still apply.",
|
|
160
|
+
risk: "write",
|
|
161
|
+
rules: markRules("The notifications are marked read.", "Cannot be undone: a notification cannot be marked unread."),
|
|
162
|
+
errors: { RESOURCE_NOT_FOUND: "an id is not one of your notifications (reported, exit 4, the others still apply)." },
|
|
163
|
+
output: IDS_OUTPUT,
|
|
164
|
+
examples: ["curviate notification read ntf_YOUR_NOTIFICATION_ID", "curviate notification read ntf_A ntf_B"]
|
|
165
|
+
},
|
|
166
|
+
args: { ...WRITE_SINGLE_FLAGS, id: ID },
|
|
167
|
+
run: online(update({ read: true }))
|
|
168
|
+
});
|
|
169
|
+
var archiveCmd = defineCommand({
|
|
170
|
+
meta: {
|
|
171
|
+
name: "archive",
|
|
172
|
+
description: "Archive one or more of your notifications: marked read and moved out of `curviate notification list` into `curviate notification list --archived`. A notification that is not yours is reported and the rest still apply.",
|
|
173
|
+
risk: "write",
|
|
174
|
+
rules: markRules("The notifications are archived (and marked read).", "`curviate notification unarchive <id>`; the read mark stays."),
|
|
175
|
+
errors: { RESOURCE_NOT_FOUND: "an id is not one of your notifications (reported, exit 4, the others still apply)." },
|
|
176
|
+
output: IDS_OUTPUT,
|
|
177
|
+
seeAlso: ["curviate notification unarchive"],
|
|
178
|
+
examples: ["curviate notification archive ntf_YOUR_NOTIFICATION_ID", "curviate notification archive ntf_A ntf_B"]
|
|
179
|
+
},
|
|
180
|
+
args: { ...WRITE_SINGLE_FLAGS, id: ID },
|
|
181
|
+
run: online(update({ archived: true }))
|
|
182
|
+
});
|
|
183
|
+
var unarchiveCmd = defineCommand({
|
|
184
|
+
meta: {
|
|
185
|
+
name: "unarchive",
|
|
186
|
+
description: "Move one or more archived notifications back into your list; they stay read.",
|
|
187
|
+
risk: "write",
|
|
188
|
+
rules: markRules("The notifications are unarchived.", "`curviate notification archive <id>`."),
|
|
189
|
+
errors: { RESOURCE_NOT_FOUND: "an id is not one of your notifications (reported, exit 4, the others still apply)." },
|
|
190
|
+
output: IDS_OUTPUT,
|
|
191
|
+
seeAlso: ["curviate notification archive"],
|
|
192
|
+
examples: ["curviate notification unarchive ntf_YOUR_NOTIFICATION_ID"]
|
|
193
|
+
},
|
|
194
|
+
args: { ...WRITE_SINGLE_FLAGS, id: ID },
|
|
195
|
+
run: online(update({ archived: false }))
|
|
196
|
+
});
|
|
197
|
+
var readAllCmd = defineCommand({
|
|
198
|
+
meta: {
|
|
199
|
+
name: "read-all",
|
|
200
|
+
description: "Mark all your unread notifications read, up to a moment: --to, an ISO 8601 instant with an offset (default: now). One that arrives after it stays unread; a future --to acts as now.",
|
|
201
|
+
risk: "high",
|
|
202
|
+
rules: {
|
|
203
|
+
changes: "Every unread notification of yours created at or before the instant is marked read.",
|
|
204
|
+
visible_to: "Only you.",
|
|
205
|
+
budget_rows: [],
|
|
206
|
+
retry: "Safe: a second call marks only what arrived since.",
|
|
207
|
+
undo: "Cannot be undone: a notification cannot be marked unread.",
|
|
208
|
+
blast_radius: "All of your unread notifications in this Team up to the instant: `marked` in the answer says how many."
|
|
209
|
+
},
|
|
210
|
+
errors: { INVALID_REQUEST: "--to is not an ISO 8601 instant with an offset." },
|
|
211
|
+
output: ["`before` (the instant used, UTC), `marked`, and the `unread_count` that remains."],
|
|
212
|
+
seeAlso: SEE,
|
|
213
|
+
examples: ["curviate notification read-all", "curviate notification read-all --to 2026-10-08T10:00:00Z"]
|
|
214
|
+
},
|
|
215
|
+
args: {
|
|
216
|
+
...WRITE_SINGLE_FLAGS,
|
|
217
|
+
to: { type: "string", description: "Mark read what was created up to this instant (ISO 8601 with offset). Default: now." }
|
|
218
|
+
},
|
|
219
|
+
run: online(runReadAll)
|
|
220
|
+
});
|
|
221
|
+
var notificationsCommand = defineCommand({
|
|
222
|
+
meta: { name: "notification", description: DESCRIPTIONS.notification },
|
|
223
|
+
subCommands: { list: listCmd, count: countCmd, read: readCmd, "read-all": readAllCmd, archive: archiveCmd, unarchive: unarchiveCmd },
|
|
224
|
+
async run() {
|
|
225
|
+
const { showHelp } = await import("./examples-DQSVIIXZ.js");
|
|
226
|
+
await showHelp(notificationsCommand, ["curviate", "notification"]);
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
export {
|
|
230
|
+
notificationsCommand
|
|
231
|
+
};
|