@blinkdotnew/cli 0.2.5 → 0.2.6

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/cli.js CHANGED
@@ -1350,11 +1350,11 @@ Examples:
1350
1350
  "Resolving your LinkedIn identity...",
1351
1351
  () => getPersonId(agentId)
1352
1352
  );
1353
- const urn = encodeURIComponent(`urn:li:person:${personId}`);
1353
+ const authorUrn = encodeURIComponent(`urn:li:person:${personId}`);
1354
1354
  const data = await withSpinner(
1355
1355
  "Fetching posts...",
1356
1356
  () => liExec(
1357
- `ugcPosts?q=authors&authors=List(${urn})&sortBy=LAST_MODIFIED&count=${opts.limit}`,
1357
+ `ugcPosts?q=authors&authors=List(${authorUrn})&sortBy=LAST_MODIFIED&count=${opts.limit}`,
1358
1358
  "GET",
1359
1359
  {},
1360
1360
  agentId
@@ -1371,7 +1371,7 @@ Examples:
1371
1371
  const content = post.specificContent;
1372
1372
  const share = content?.["com.linkedin.ugc.ShareContent"];
1373
1373
  const commentary = share?.shareCommentary;
1374
- const text = commentary?.text ?? post.text?.text ?? "(no text)";
1374
+ const text = commentary?.text ?? "(no text)";
1375
1375
  const preview = text.length > 120 ? text.slice(0, 120) + "\u2026" : text;
1376
1376
  console.log(chalk7.bold(id));
1377
1377
  console.log(` ${chalk7.dim(preview)}`);
@@ -1387,9 +1387,29 @@ Examples:
1387
1387
  `).action(async (text, opts) => {
1388
1388
  requireToken();
1389
1389
  const agentId = requireAgentId(opts.agent);
1390
+ const personId = await withSpinner(
1391
+ "Resolving your LinkedIn identity...",
1392
+ () => getPersonId(agentId)
1393
+ );
1394
+ const visibilityMap = {
1395
+ PUBLIC: "PUBLIC",
1396
+ CONNECTIONS: "CONNECTIONS_ONLY"
1397
+ };
1390
1398
  const data = await withSpinner(
1391
1399
  "Publishing post...",
1392
- () => liExec("/ugcPosts", "POST", { text, visibility: opts.visibility }, agentId)
1400
+ () => liExec("ugcPosts", "POST", {
1401
+ author: `urn:li:person:${personId}`,
1402
+ lifecycleState: "PUBLISHED",
1403
+ specificContent: {
1404
+ "com.linkedin.ugc.ShareContent": {
1405
+ shareCommentary: { text },
1406
+ shareMediaCategory: "NONE"
1407
+ }
1408
+ },
1409
+ visibility: {
1410
+ "com.linkedin.ugc.MemberNetworkVisibility": visibilityMap[opts.visibility] ?? "PUBLIC"
1411
+ }
1412
+ }, agentId)
1393
1413
  );
1394
1414
  if (isJsonMode()) return printJson(data);
1395
1415
  console.log(chalk7.green("\u2713 Post published"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blinkdotnew/cli",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "Blink platform CLI — deploy apps, manage databases, generate AI content",
5
5
  "bin": {
6
6
  "blink": "dist/cli.js"
@@ -89,10 +89,10 @@ Examples:
89
89
  const personId = await withSpinner('Resolving your LinkedIn identity...', () =>
90
90
  getPersonId(agentId)
91
91
  )
92
- const urn = encodeURIComponent(`urn:li:person:${personId}`)
92
+ const authorUrn = encodeURIComponent(`urn:li:person:${personId}`)
93
93
  const data = await withSpinner('Fetching posts...', () =>
94
94
  liExec(
95
- `ugcPosts?q=authors&authors=List(${urn})&sortBy=LAST_MODIFIED&count=${opts.limit}`,
95
+ `ugcPosts?q=authors&authors=List(${authorUrn})&sortBy=LAST_MODIFIED&count=${opts.limit}`,
96
96
  'GET',
97
97
  {},
98
98
  agentId
@@ -106,7 +106,7 @@ Examples:
106
106
  const content = post.specificContent as Record<string, unknown> | undefined
107
107
  const share = content?.['com.linkedin.ugc.ShareContent'] as Record<string, unknown> | undefined
108
108
  const commentary = share?.shareCommentary as Record<string, unknown> | undefined
109
- const text = (commentary?.text ?? (post.text as Record<string, unknown>)?.text ?? '(no text)') as string
109
+ const text = (commentary?.text ?? '(no text)') as string
110
110
  const preview = text.length > 120 ? text.slice(0, 120) + '…' : text
111
111
  console.log(chalk.bold(id))
112
112
  console.log(` ${chalk.dim(preview)}`)
@@ -129,8 +129,27 @@ Examples:
129
129
  .action(async (text: string, opts) => {
130
130
  requireToken()
131
131
  const agentId = requireAgentId(opts.agent)
132
+ const personId = await withSpinner('Resolving your LinkedIn identity...', () =>
133
+ getPersonId(agentId)
134
+ )
135
+ const visibilityMap: Record<string, string> = {
136
+ PUBLIC: 'PUBLIC',
137
+ CONNECTIONS: 'CONNECTIONS_ONLY',
138
+ }
132
139
  const data = await withSpinner('Publishing post...', () =>
133
- liExec('/ugcPosts', 'POST', { text, visibility: opts.visibility }, agentId)
140
+ liExec('ugcPosts', 'POST', {
141
+ author: `urn:li:person:${personId}`,
142
+ lifecycleState: 'PUBLISHED',
143
+ specificContent: {
144
+ 'com.linkedin.ugc.ShareContent': {
145
+ shareCommentary: { text },
146
+ shareMediaCategory: 'NONE',
147
+ },
148
+ },
149
+ visibility: {
150
+ 'com.linkedin.ugc.MemberNetworkVisibility': visibilityMap[opts.visibility] ?? 'PUBLIC',
151
+ },
152
+ }, agentId)
134
153
  )
135
154
  if (isJsonMode()) return printJson(data)
136
155
  console.log(chalk.green('✓ Post published'))