@letterstory/cli 0.83.0 → 0.84.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/lib/cli.mjs CHANGED
@@ -57,7 +57,7 @@ import {
57
57
  } from "./commands.mjs";
58
58
 
59
59
  // Keep in sync with cli/package.json.
60
- export const VERSION = "0.83.0";
60
+ export const VERSION = "0.84.0";
61
61
 
62
62
  // Flags that never take a value. Listing them explicitly means `deploy get --json <id>`
63
63
  // can't accidentally swallow the id as --json's value. Every `type: "bool"` flag (and its
@@ -110,6 +110,22 @@ function intPositional(index, label) {
110
110
  };
111
111
  }
112
112
 
113
+ /**
114
+ * A mail message ref: an IMAP UID (sent as a number) or a Gmail message id
115
+ * (hex string). An all-digit Gmail id past the safe-integer range stays a string.
116
+ */
117
+ function messageRefPositional(index, label) {
118
+ return {
119
+ value: (_flags, positionals) => {
120
+ const raw = positionals[index];
121
+ if (raw === undefined) throw new CliError(`Missing required <${label}>`);
122
+ if (/^\d+$/.test(raw) && Number.isSafeInteger(Number(raw))) return Number(raw);
123
+ if (/^[0-9a-f]{1,32}$/i.test(raw)) return raw;
124
+ throw new CliError(`<${label}> must be a message uid or Gmail message id (got ${raw})`);
125
+ },
126
+ };
127
+ }
128
+
113
129
  const SUPPRESSION_REASONS = ["unsubscribe", "bounce", "complaint", "manual"];
114
130
  const MAILER_FOLDERS = ["inbox", "sent"];
115
131
 
@@ -275,7 +291,7 @@ export const ARGS = {
275
291
  },
276
292
  get_mailer_message: {
277
293
  mailer_id: { positional: 0, label: "mailer-id", required: true },
278
- uid: intPositional(1, "uid"),
294
+ uid: messageRefPositional(1, "uid"),
279
295
  folder: { flag: "folder", required: true, enum: MAILER_FOLDERS },
280
296
  },
281
297
  set_mailer_forwarding: {
@@ -26,7 +26,7 @@ function readOffering(flags) {
26
26
  const offering = { value: readOffering };
27
27
 
28
28
  // `--priority high|normal|low|default`: how much the target's questions count in share of
29
- // voice (high = 2 votes, normal = 1, low = ½); default = back to the question-type default.
29
+ // voice (high = 3 votes, normal = 2, low = 1); default = back to high, a target's default.
30
30
  function readPriority(flags) {
31
31
  const v = flagStr(flags.priority);
32
32
  if (v === undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letterstory/cli",
3
- "version": "0.83.0",
3
+ "version": "0.84.0",
4
4
  "description": "Spin up and manage Letterstory phantom blogs from your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",