@postonus/cli 0.1.43 → 0.1.45

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
@@ -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
+ subreddit: string2().trim().min(1).optional(),
8433
8434
  xLinkHandling: _enum(["first_reply", "plain_text", "keep_live"]).optional(),
8434
8435
  /**
8435
8436
  * Which of the post's media each channel publishes, in publish order, by url.
@@ -8709,6 +8710,7 @@ var postDomainErrors = {
8709
8710
  CONTENT_TOO_LONG: { status: 400, message: "Content exceeds the platform limit.", data: ErrorDataSchema },
8710
8711
  MEDIA_RULE_VIOLATED: { status: 400, message: "Media does not satisfy the platform rules.", data: ErrorDataSchema },
8711
8712
  VIDEO_TOO_LONG: { status: 400, message: "Video exceeds the platform duration limit.", data: ErrorDataSchema },
8713
+ REDDIT_SUBREDDIT_REQUIRED: { status: 400, message: "Reddit subreddit is required in platform settings." },
8712
8714
  SCHEDULE_IN_PAST: { status: 400, message: "Scheduled time must be in the future." },
8713
8715
  THREAD_NOT_ALLOWED: { status: 400, message: "Thread segments require explicit opt-in." },
8714
8716
  INVALID_INTEGRATIONS: { status: 400, message: "Some integrations are invalid or do not belong to you." },
@@ -12871,7 +12873,7 @@ function formatTable(headers, rows, isTty = process.stdout.isTTY) {
12871
12873
  }
12872
12874
 
12873
12875
  // src/version.ts
12874
- var CLI_VERSION = "0.1.43";
12876
+ var CLI_VERSION = "0.1.45";
12875
12877
 
12876
12878
  // src/client.ts
12877
12879
  var DEVICE_CODE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
@@ -13962,7 +13964,13 @@ async function post(text, options) {
13962
13964
  media: media2.map((item) => ({ url: item.url, type: item.type, id: item.mediaId, fileId: item.uploadId }))
13963
13965
  }
13964
13966
  ],
13965
- shared: { ...targets, thread, integrationContent: readCopy(options.copy), xLinkHandling },
13967
+ shared: {
13968
+ ...targets,
13969
+ thread,
13970
+ integrationContent: readCopy(options.copy),
13971
+ xLinkHandling,
13972
+ subreddit: options.subreddit
13973
+ },
13966
13974
  postAction: timing.postAction,
13967
13975
  dryRun: options.dryRun
13968
13976
  });
@@ -13989,9 +13997,9 @@ async function editPost(postId, text, options) {
13989
13997
  const integrationContent = readCopy(options.copy);
13990
13998
  const scheduledAt = options.at ? parseInstant(options.at, "--at") : void 0;
13991
13999
  const xLinkHandling = readXLinkHandling(options.xLinkHandling);
13992
- if (!thread && content === void 0 && !targets.platforms && !targets.selectedIntegrations && !integrationContent && !scheduledAt && !options.media?.length && !xLinkHandling) {
14000
+ if (!thread && content === void 0 && !targets.platforms && !targets.selectedIntegrations && !integrationContent && !scheduledAt && !options.media?.length && !options.subreddit && !xLinkHandling) {
13993
14001
  failUsage(
13994
- "Nothing to change. Pass new text, --thread-file, --at, --to, --channel, --copy, --x-link-handling or --media."
14002
+ "Nothing to change. Pass new text, --thread-file, --at, --to, --channel, --copy, --subreddit, --x-link-handling or --media."
13995
14003
  );
13996
14004
  }
13997
14005
  const { api } = await getApi();
@@ -14004,6 +14012,7 @@ async function editPost(postId, text, options) {
14004
14012
  scheduledAt,
14005
14013
  ...targets,
14006
14014
  integrationContent,
14015
+ subreddit: options.subreddit,
14007
14016
  xLinkHandling,
14008
14017
  media: media2?.map((item) => ({ url: item.url, type: item.type, id: item.mediaId, fileId: item.uploadId })),
14009
14018
  dryRun: options.dryRun
@@ -14297,11 +14306,11 @@ channels.command("connect").description("connect a new channel via OAuth").optio
14297
14306
  program.command("link").description("link current directory to a Postonus workspace").option("-w, --workspace <id>", "workspace to link to").action(linkWorkspace);
14298
14307
  program.command("unlink").description("unlink current directory from its Postonus workspace").action(unlinkWorkspace);
14299
14308
  var collect = (value2, previous = []) => [...previous, value2];
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(
14309
+ 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("--subreddit <name>", "target subreddit for Reddit posts (e.g. programming or r/programming)").option(
14301
14310
  "--x-link-handling <handling>",
14302
14311
  "how to handle links in X posts: 'first_reply' (default), 'plain_text', or 'keep_live'"
14303
14312
  ).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);
14313
+ 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("--subreddit <name>", "target subreddit for Reddit posts (e.g. programming or r/programming)").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);
14305
14314
  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);
14306
14315
  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);
14307
14316
  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);