@koda-sl/baker-cli 0.256.0 → 0.257.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/README.md CHANGED
@@ -3024,7 +3024,7 @@ baker scheduled-actions create --template baker-ads --name "Weekly ad review" --
3024
3024
  Rules:
3025
3025
 
3026
3026
  - `--cron` and `--run-at` are mutually exclusive.
3027
- - `--run-at` must be an ISO UTC timestamp ending in `Z`.
3027
+ - `--run-at` must be an ISO UTC timestamp ending in `Z`, and still in the future — a time that has already passed is refused when the op is staged. If a one-off's time passes while the chat is still open, publishing creates the task **switched off** with the reason on it rather than dropping it, so it is never lost.
3028
3028
  - Draft-created ids use `temp_sched_*`; use them with `get`, `update`, or `delete` before publish.
3029
3029
  - Staged commands require `BAKER_CHAT_ID` to point to an `in_progress` chat.
3030
3030
  - `trigger` rejects `temp_sched_*` and only accepts published scheduled-action ids.
package/dist/cli.js CHANGED
@@ -47675,6 +47675,20 @@ function parseBooleanFlag(raw, flagName) {
47675
47675
  }
47676
47676
  failValidation4(`${flagName} must be true or false.`);
47677
47677
  }
47678
+ function validateRunAt(runAt) {
47679
+ if (!runAt.endsWith("Z")) {
47680
+ failValidation4("--run-at must be an ISO UTC timestamp ending in Z.");
47681
+ }
47682
+ const parsed = Date.parse(runAt);
47683
+ if (!Number.isFinite(parsed)) {
47684
+ failValidation4("--run-at must be a valid ISO timestamp.");
47685
+ }
47686
+ if (parsed <= Date.now()) {
47687
+ failValidation4(
47688
+ `--run-at ${runAt} has already passed. A one-off task only runs at a time still to come \u2014 pass a later ISO UTC timestamp, and check which timezone you converted from if you worked it out from a local time.`
47689
+ );
47690
+ }
47691
+ }
47678
47692
  function buildScheduleBody(args, options) {
47679
47693
  const cron = args.cron;
47680
47694
  const runAt = args["run-at"];
@@ -47683,12 +47697,7 @@ function buildScheduleBody(args, options) {
47683
47697
  failValidation4("--cron and --run-at are mutually exclusive.");
47684
47698
  }
47685
47699
  if (runAt) {
47686
- if (!runAt.endsWith("Z")) {
47687
- failValidation4("--run-at must be an ISO UTC timestamp ending in Z.");
47688
- }
47689
- if (!Number.isFinite(Date.parse(runAt))) {
47690
- failValidation4("--run-at must be a valid ISO timestamp.");
47691
- }
47700
+ validateRunAt(runAt);
47692
47701
  return { runAt, ...timezone ? { timezone } : {} };
47693
47702
  }
47694
47703
  if (cron) {
@@ -47713,7 +47722,7 @@ registerSchema({
47713
47722
  cron: { type: "string", description: "5-field cron expression; mutually exclusive with --run-at", required: false },
47714
47723
  "run-at": {
47715
47724
  type: "string",
47716
- description: "ISO UTC timestamp ending in Z; mutually exclusive with --cron",
47725
+ description: "When this runs once, as an ISO UTC timestamp ending in Z. Must still be in the future \u2014 a time that has passed is refused. Mutually exclusive with --cron.",
47717
47726
  required: false
47718
47727
  },
47719
47728
  timezone: { type: "string", description: "IANA timezone override; defaults to Company Timezone", required: false },
@@ -47747,7 +47756,7 @@ var createCommand3 = defineCommand181({
47747
47756
  name: { type: "string", description: "Scheduled action name", required: false },
47748
47757
  description: { type: "string", description: "Description", required: false },
47749
47758
  cron: { type: "string", description: "5-field cron expression", required: false },
47750
- "run-at": { type: "string", description: "ISO UTC timestamp ending in Z", required: false },
47759
+ "run-at": { type: "string", description: "ISO UTC timestamp ending in Z, still in the future", required: false },
47751
47760
  timezone: { type: "string", description: "IANA timezone override", required: false },
47752
47761
  disabled: { type: "boolean", description: "Create disabled", required: false, default: false },
47753
47762
  mode: { type: "string", description: `One of: ${TASK_MODE_IDS.join(", ")}`, required: false },
@@ -48118,7 +48127,7 @@ registerSchema({
48118
48127
  cron: { type: "string", description: "5-field cron expression; mutually exclusive with --run-at", required: false },
48119
48128
  "run-at": {
48120
48129
  type: "string",
48121
- description: "ISO UTC timestamp ending in Z; mutually exclusive with --cron",
48130
+ description: "New one-off run time, as an ISO UTC timestamp ending in Z. Must still be in the future \u2014 a time that has passed is refused. Mutually exclusive with --cron.",
48122
48131
  required: false
48123
48132
  },
48124
48133
  timezone: { type: "string", description: "IANA timezone override", required: false },
@@ -48153,7 +48162,7 @@ var updateCommand3 = defineCommand187({
48153
48162
  name: { type: "string", description: "New name", required: false },
48154
48163
  description: { type: "string", description: "New description", required: false },
48155
48164
  cron: { type: "string", description: "5-field cron expression", required: false },
48156
- "run-at": { type: "string", description: "ISO UTC timestamp ending in Z", required: false },
48165
+ "run-at": { type: "string", description: "ISO UTC timestamp ending in Z, still in the future", required: false },
48157
48166
  timezone: { type: "string", description: "IANA timezone override", required: false },
48158
48167
  enabled: { type: "string", description: "true|false", required: false },
48159
48168
  mode: { type: "string", description: `One of: ${TASK_MODE_IDS.join(", ")}`, required: false },