@postonus/cli 0.1.42 → 0.1.43

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/index.js CHANGED
@@ -25,7 +25,7 @@ var PLAN_CONFIGS = {
25
25
  ownedWorkspaces: 1,
26
26
  defaultMonthlyPosts: 300,
27
27
  maxDrafts: UNLIMITED,
28
- perPlatformMonthlyPosts: { TWITTER: 100 },
28
+ perPlatformMonthlyPosts: { TWITTER: 50 },
29
29
  mediaStorageGb: 10,
30
30
  vaCredits: 60,
31
31
  requestsPerMinute: 600,
@@ -53,7 +53,7 @@ var PLAN_CONFIGS = {
53
53
  ownedWorkspaces: 3,
54
54
  defaultMonthlyPosts: UNLIMITED,
55
55
  maxDrafts: UNLIMITED,
56
- perPlatformMonthlyPosts: { TWITTER: 500 },
56
+ perPlatformMonthlyPosts: { TWITTER: 200 },
57
57
  mediaStorageGb: 50,
58
58
  vaCredits: 300,
59
59
  requestsPerMinute: 1800,
@@ -78,7 +78,7 @@ var PLAN_CONFIGS = {
78
78
  ownedWorkspaces: UNLIMITED,
79
79
  defaultMonthlyPosts: UNLIMITED,
80
80
  maxDrafts: UNLIMITED,
81
- perPlatformMonthlyPosts: { TWITTER: 2e3 },
81
+ perPlatformMonthlyPosts: { TWITTER: 1e3 },
82
82
  mediaStorageGb: UNLIMITED,
83
83
  vaCredits: UNLIMITED,
84
84
  // Finite on purpose — see the `requestsPerMinute` doc comment.
@@ -8430,6 +8430,7 @@ var SharedPostFields = {
8430
8430
  integrationContent: record(string2(), string2()).optional(),
8431
8431
  integrationFirstComment: record(string2(), string2()).optional(),
8432
8432
  integrationSettings: IntegrationSettingsInputSchema.optional(),
8433
+ xLinkHandling: _enum(["first_reply", "plain_text", "keep_live"]).optional(),
8433
8434
  /**
8434
8435
  * Which of the post's media each channel publishes, in publish order, by url.
8435
8436
  * Omit a channel to send it as much of the post's media as its platform can
@@ -12870,7 +12871,7 @@ function formatTable(headers, rows, isTty = process.stdout.isTTY) {
12870
12871
  }
12871
12872
 
12872
12873
  // src/version.ts
12873
- var CLI_VERSION = "0.1.42";
12874
+ var CLI_VERSION = "0.1.43";
12874
12875
 
12875
12876
  // src/client.ts
12876
12877
  var DEVICE_CODE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
@@ -13895,6 +13896,13 @@ function readCopy(pairs) {
13895
13896
  })
13896
13897
  );
13897
13898
  }
13899
+ function readXLinkHandling(value2) {
13900
+ if (!value2) return void 0;
13901
+ if (value2 === "first_reply" || value2 === "plain_text" || value2 === "keep_live") {
13902
+ return value2;
13903
+ }
13904
+ return failUsage("--x-link-handling must be 'first_reply', 'plain_text', or 'keep_live'.");
13905
+ }
13898
13906
  function readTiming(options) {
13899
13907
  const chosen = [options.at, options.optimal, options.now, options.draft].filter(Boolean);
13900
13908
  if (chosen.length > 1) failUsage("Use one of --at, --optimal, --now or --draft.");
@@ -13939,6 +13947,7 @@ async function post(text, options) {
13939
13947
  const timing = readTiming(options);
13940
13948
  const project = await readProjectConfig();
13941
13949
  const targets = readTargets(options, project?.defaultPlatforms);
13950
+ const xLinkHandling = readXLinkHandling(options.xLinkHandling);
13942
13951
  if (timing.postAction !== "DRAFT" && !targets.platforms && !targets.selectedIntegrations) {
13943
13952
  failUsage("Say where to post: --to x,linkedin or --channel <id> (or use --draft).");
13944
13953
  }
@@ -13953,7 +13962,7 @@ async function post(text, options) {
13953
13962
  media: media2.map((item) => ({ url: item.url, type: item.type, id: item.mediaId, fileId: item.uploadId }))
13954
13963
  }
13955
13964
  ],
13956
- shared: { ...targets, thread, integrationContent: readCopy(options.copy) },
13965
+ shared: { ...targets, thread, integrationContent: readCopy(options.copy), xLinkHandling },
13957
13966
  postAction: timing.postAction,
13958
13967
  dryRun: options.dryRun
13959
13968
  });
@@ -13979,8 +13988,11 @@ async function editPost(postId, text, options) {
13979
13988
  const targets = readTargets(options);
13980
13989
  const integrationContent = readCopy(options.copy);
13981
13990
  const scheduledAt = options.at ? parseInstant(options.at, "--at") : void 0;
13982
- if (!thread && content === void 0 && !targets.platforms && !targets.selectedIntegrations && !integrationContent && !scheduledAt && !options.media?.length) {
13983
- failUsage("Nothing to change. Pass new text, --thread-file, --at, --to, --channel, --copy or --media.");
13991
+ const xLinkHandling = readXLinkHandling(options.xLinkHandling);
13992
+ if (!thread && content === void 0 && !targets.platforms && !targets.selectedIntegrations && !integrationContent && !scheduledAt && !options.media?.length && !xLinkHandling) {
13993
+ failUsage(
13994
+ "Nothing to change. Pass new text, --thread-file, --at, --to, --channel, --copy, --x-link-handling or --media."
13995
+ );
13984
13996
  }
13985
13997
  const { api } = await getApi();
13986
13998
  const media2 = options.media?.length ? await uploadAll(api, options.media) : void 0;
@@ -13992,6 +14004,7 @@ async function editPost(postId, text, options) {
13992
14004
  scheduledAt,
13993
14005
  ...targets,
13994
14006
  integrationContent,
14007
+ xLinkHandling,
13995
14008
  media: media2?.map((item) => ({ url: item.url, type: item.type, id: item.mediaId, fileId: item.uploadId })),
13996
14009
  dryRun: options.dryRun
13997
14010
  });
@@ -14284,8 +14297,11 @@ channels.command("connect").description("connect a new channel via OAuth").optio
14284
14297
  program.command("link").description("link current directory to a Postonus workspace").option("-w, --workspace <id>", "workspace to link to").action(linkWorkspace);
14285
14298
  program.command("unlink").description("unlink current directory from its Postonus workspace").action(unlinkWorkspace);
14286
14299
  var collect = (value2, previous = []) => [...previous, value2];
14287
- var postCommand = program.command("post").alias("posts").description("create a post: scheduled, now, at the next optimal time, or as a draft").argument("[text]", "post content; also accepts piped stdin").option("-t, --to <platforms>", "comma-separated platforms, e.g. x,linkedin").option("-c, --channel <id>", "a channel id from `postonus channels list`; repeatable", collect).option("--channels <ids>", "channel ids; comma-separated or repeatable", collect).option("-a, --at <time>", "RFC 3339 time with an offset").option("-o, --optimal", "the next recommended window").option("--now", "publish as soon as the queue picks it up").option("-d, --draft", "save as a draft without scheduling").option("-f, --file <path>", "read content from a file").option("--thread-file <path>", "read a thread: segments separated by a line of ---").option("-e, --editor", "compose in $EDITOR").option("-m, --media <path...>", "attach local image or video files").option("--copy <channelId=text>", "text that replaces the body on one channel; repeatable", collect).option("--dry-run", "run every server check and show the result without saving").action(post);
14288
- postCommand.command("edit").description("change a post; only the flags given change").argument("<postId>", "post id from `postonus queue list`").argument("[text]", "new content").option("-t, --to <platforms>", "replace the channels with these platforms").option("-c, --channel <id>", "replace the channels with these ids; repeatable", collect).option("--channels <ids>", "alias for --channel", collect).option("-a, --at <time>", "move every channel to this RFC 3339 time").option("-f, --file <path>", "read new content from a file").option("--thread-file <path>", "replace the body with a thread file").option("-m, --media <path...>", "replace the media with these files").option("--copy <channelId=text>", "replace one channel's copy; repeatable", collect).option("--dry-run", "run every server check and show the result without saving").action(editPost);
14300
+ var postCommand = program.command("post").alias("posts").description("create a post: scheduled, now, at the next optimal time, or as a draft").argument("[text]", "post content; also accepts piped stdin").option("-t, --to <platforms>", "comma-separated platforms, e.g. x,linkedin").option("-c, --channel <id>", "a channel id from `postonus channels list`; repeatable", collect).option("--channels <ids>", "channel ids; comma-separated or repeatable", collect).option("-a, --at <time>", "RFC 3339 time with an offset").option("-o, --optimal", "the next recommended window").option("--now", "publish as soon as the queue picks it up").option("-d, --draft", "save as a draft without scheduling").option("-f, --file <path>", "read content from a file").option("--thread-file <path>", "read a thread: segments separated by a line of ---").option("-e, --editor", "compose in $EDITOR").option("-m, --media <path...>", "attach local image or video files").option("--copy <channelId=text>", "text that replaces the body on one channel; repeatable", collect).option(
14301
+ "--x-link-handling <handling>",
14302
+ "how to handle links in X posts: 'first_reply' (default), 'plain_text', or 'keep_live'"
14303
+ ).option("--dry-run", "run every server check and show the result without saving").action(post);
14304
+ postCommand.command("edit").description("change a post; only the flags given change").argument("<postId>", "post id from `postonus queue list`").argument("[text]", "new content").option("-t, --to <platforms>", "replace the channels with these platforms").option("-c, --channel <id>", "replace the channels with these ids; repeatable", collect).option("--channels <ids>", "alias for --channel", collect).option("-a, --at <time>", "move every channel to this RFC 3339 time").option("-f, --file <path>", "read new content from a file").option("--thread-file <path>", "replace the body with a thread file").option("-m, --media <path...>", "replace the media with these files").option("--copy <channelId=text>", "replace one channel's copy; repeatable", collect).option("--x-link-handling <handling>", "how to handle links in X posts: 'first_reply', 'plain_text', or 'keep_live'").option("--dry-run", "run every server check and show the result without saving").action(editPost);
14289
14305
  postCommand.command("delete").alias("rm").alias("del").description("delete a post and every schedule on it").argument("<postId>", "post id from `postonus queue list`").option("--remote", "also delete published copies on their platforms").option("-y, --yes", "skip confirmation prompt").action(deletePost);
14290
14306
  postCommand.command("retry").description("queue a failed schedule to publish again").argument("<scheduleId>", "schedule id from `postonus queue list --status failed`").option("--content <text>", "replacement copy for this channel only").action(retrySchedule);
14291
14307
  program.command("best-times").description("recommended posting windows for the given platforms").requiredOption("-t, --to <platforms>", "comma-separated platforms, e.g. x,linkedin").option("-n, --limit <count>", "how many times to list (1-20)", "5").option("--count <count>", "alias for --limit (deprecated)").action(bestTimes);