@onexapis/cli 1.1.53 → 1.1.54

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/cli.mjs CHANGED
@@ -1799,10 +1799,14 @@ async function getValidTokens() {
1799
1799
  }
1800
1800
  const data = await response.json();
1801
1801
  const body = data.statusCode ? data.body : data;
1802
+ if (!body.IdToken) {
1803
+ await clearAuthTokens();
1804
+ return null;
1805
+ }
1802
1806
  const refreshed = {
1803
1807
  ...tokens,
1804
1808
  accessToken: body.AccessToken || tokens.accessToken,
1805
- idToken: body.IdToken || tokens.idToken,
1809
+ idToken: body.IdToken,
1806
1810
  expiresAt: Math.floor(Date.now() / 1e3) + (body.ExpiresIn || 3600)
1807
1811
  };
1808
1812
  await saveAuthTokens(refreshed);
@@ -4777,10 +4781,13 @@ async function publishCommand(options) {
4777
4781
  );
4778
4782
  const regData = await regResponse.json();
4779
4783
  const regBody = regData.statusCode ? regData.body : regData;
4780
- if (!regResponse.ok && regBody.error && !regBody.error.includes("already registered")) {
4781
- logger.stopSpinner(false, "Registration failed");
4782
- logger.error(regBody.error);
4783
- process.exit(1);
4784
+ if (!regResponse.ok) {
4785
+ const errMsg = regBody.error || regBody.message || "Registration failed";
4786
+ if (!errMsg.includes("already registered")) {
4787
+ logger.stopSpinner(false, "Registration failed");
4788
+ logger.error(errMsg);
4789
+ process.exit(1);
4790
+ }
4784
4791
  }
4785
4792
  logger.stopSpinner(true, regBody.message || "Theme registered");
4786
4793
  } catch (error) {