@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.js CHANGED
@@ -1842,10 +1842,14 @@ async function getValidTokens() {
1842
1842
  }
1843
1843
  const data = await response.json();
1844
1844
  const body = data.statusCode ? data.body : data;
1845
+ if (!body.IdToken) {
1846
+ await clearAuthTokens();
1847
+ return null;
1848
+ }
1845
1849
  const refreshed = {
1846
1850
  ...tokens,
1847
1851
  accessToken: body.AccessToken || tokens.accessToken,
1848
- idToken: body.IdToken || tokens.idToken,
1852
+ idToken: body.IdToken,
1849
1853
  expiresAt: Math.floor(Date.now() / 1e3) + (body.ExpiresIn || 3600)
1850
1854
  };
1851
1855
  await saveAuthTokens(refreshed);
@@ -4820,10 +4824,13 @@ async function publishCommand(options) {
4820
4824
  );
4821
4825
  const regData = await regResponse.json();
4822
4826
  const regBody = regData.statusCode ? regData.body : regData;
4823
- if (!regResponse.ok && regBody.error && !regBody.error.includes("already registered")) {
4824
- logger.stopSpinner(false, "Registration failed");
4825
- logger.error(regBody.error);
4826
- process.exit(1);
4827
+ if (!regResponse.ok) {
4828
+ const errMsg = regBody.error || regBody.message || "Registration failed";
4829
+ if (!errMsg.includes("already registered")) {
4830
+ logger.stopSpinner(false, "Registration failed");
4831
+ logger.error(errMsg);
4832
+ process.exit(1);
4833
+ }
4827
4834
  }
4828
4835
  logger.stopSpinner(true, regBody.message || "Theme registered");
4829
4836
  } catch (error) {