@autohq/cli 0.1.160 → 0.1.161

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.
@@ -26434,7 +26434,7 @@ Object.assign(lookup, {
26434
26434
  // package.json
26435
26435
  var package_default = {
26436
26436
  name: "@autohq/cli",
26437
- version: "0.1.160",
26437
+ version: "0.1.161",
26438
26438
  license: "SEE LICENSE IN README.md",
26439
26439
  publishConfig: {
26440
26440
  access: "public"
package/dist/index.js CHANGED
@@ -20383,16 +20383,25 @@ function createApiClient(input) {
20383
20383
  return void 0;
20384
20384
  }
20385
20385
  const project = await activeProject();
20386
- const refreshed = await postJson(
20387
- input.fetch,
20388
- apiUrl(apiPath("/auth/cli/token"), explicitApiBaseUrl),
20389
- {
20390
- grant_type: "refresh_token",
20391
- refresh_token: config2.refreshToken,
20392
- organization_id: project.organizationId,
20393
- project_id: project.projectId
20386
+ let refreshed;
20387
+ try {
20388
+ refreshed = await postJson(
20389
+ input.fetch,
20390
+ apiUrl(apiPath("/auth/cli/token"), explicitApiBaseUrl),
20391
+ {
20392
+ grant_type: "refresh_token",
20393
+ refresh_token: config2.refreshToken,
20394
+ organization_id: project.organizationId,
20395
+ project_id: project.projectId
20396
+ }
20397
+ );
20398
+ } catch (error51) {
20399
+ const message = cliRefreshTokenRecoveryMessage(error51);
20400
+ if (message) {
20401
+ throw new Error(message);
20394
20402
  }
20395
- );
20403
+ throw error51;
20404
+ }
20396
20405
  const updated = {
20397
20406
  ...readConfig(input.configPath),
20398
20407
  serverUrl: config2.serverUrl ?? apiBaseUrl(explicitApiBaseUrl),
@@ -20408,6 +20417,16 @@ function createApiClient(input) {
20408
20417
  cachedAccessTokenExpiresAt = updated.accessTokenExpiresAt;
20409
20418
  return cachedAccessToken;
20410
20419
  }
20420
+ function cliRefreshTokenRecoveryMessage(error51) {
20421
+ const message = error51 instanceof Error ? error51.message : String(error51);
20422
+ if (message === "invalid_refresh_token") {
20423
+ return [
20424
+ "Auto login expired or was revoked (invalid_refresh_token).",
20425
+ "Run `auto auth login` and retry."
20426
+ ].join(" ");
20427
+ }
20428
+ return void 0;
20429
+ }
20411
20430
  async function accessToken(inputOptions = {}) {
20412
20431
  const token2 = input.env.AUTO_API_TOKEN?.trim();
20413
20432
  if (token2) {
@@ -21467,7 +21486,7 @@ var init_package = __esm({
21467
21486
  "package.json"() {
21468
21487
  package_default = {
21469
21488
  name: "@autohq/cli",
21470
- version: "0.1.160",
21489
+ version: "0.1.161",
21471
21490
  license: "SEE LICENSE IN README.md",
21472
21491
  publishConfig: {
21473
21492
  access: "public"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autohq/cli",
3
- "version": "0.1.160",
3
+ "version": "0.1.161",
4
4
  "license": "SEE LICENSE IN README.md",
5
5
  "publishConfig": {
6
6
  "access": "public"