@tokenoftrust/cli 1.4.0-rc.6 → 1.4.0-rc.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokenoftrust/cli",
3
- "version": "1.4.0-rc.6",
3
+ "version": "1.4.0-rc.7",
4
4
  "description": "Token of Trust developer CLI — check out a tenant store, run it locally with save→reload, and submit it for preview. Installs the `tot` command.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Token of Trust",
@@ -83,9 +83,17 @@ export function linkPollStatus(res) {
83
83
  (typeof c.status === "string" && c.status) || (typeof c.state === "string" && c.state) || "";
84
84
  const s = raw.toLowerCase();
85
85
  if (!s) return "pending";
86
- if (/^(linked|complete|completed|done|ok|success|active)$/.test(s)) return "linked";
87
- if (/^(pending|waiting|in_?progress|processing|started)$/.test(s)) return "pending";
88
- return s; // an unknown/error status surfaced to the caller
86
+ // The broker namespaces its poll status with a `link_` prefix (e.g. `link_pending`,
87
+ // `link_approved`, `link_denied`) strip it before matching so a normal "still
88
+ // waiting" state isn't misread as an unknown/error status and doesn't abort the poll.
89
+ // (Regression: `link_pending` fell through to the error branch and killed `tot link`
90
+ // the instant the developer hadn't yet finished the browser step.)
91
+ const bare = s.replace(/^link[_-]/, "");
92
+ if (/^(linked|link|complete|completed|done|ok|success|succeeded|active|approved|granted)$/.test(bare))
93
+ return "linked";
94
+ if (/^(pending|waiting|in_?progress|processing|started|created|authorizing|polling)$/.test(bare))
95
+ return "pending";
96
+ return s; // a terminal error status (link_denied, link_expired, …) — surfaced to the caller
89
97
  }
90
98
 
91
99
  /** @param {string[]} argv @param {any} _ctx */