replicas-cli 0.2.420 → 0.2.422

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.
Files changed (2) hide show
  1. package/dist/index.mjs +13 -5
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -22449,9 +22449,7 @@ function classifyCanvasFilename(filename) {
22449
22449
  }
22450
22450
 
22451
22451
  // ../shared/src/pricing.ts
22452
- var INTEGRATION_SOURCES = ["slack", "linear", "github", "gitlab"];
22453
22452
  var AUTOMATED_SOURCES = ["api", "automation"];
22454
- var INTEGRATION_SOURCES_SQL = INTEGRATION_SOURCES.map((s) => `'${s}'`).join(", ");
22455
22453
  var AUTOMATED_SOURCES_SQL = AUTOMATED_SOURCES.map((s) => `'${s}'`).join(", ");
22456
22454
  var PLANS = {
22457
22455
  trial: {
@@ -24494,7 +24492,7 @@ function formatTurnElapsed(ms) {
24494
24492
  }
24495
24493
 
24496
24494
  // ../shared/src/cli-version.ts
24497
- var CLI_VERSION = "0.2.420";
24495
+ var CLI_VERSION = "0.2.422";
24498
24496
 
24499
24497
  // ../shared/src/version.ts
24500
24498
  function compareVersions(v1, v2) {
@@ -27055,9 +27053,16 @@ async function orgAuthenticatedFetch(url2, options) {
27055
27053
  ...options?.headers || {}
27056
27054
  }, options);
27057
27055
  }
27056
+ var ApiError = class extends Error {
27057
+ constructor(message, status) {
27058
+ super(message);
27059
+ this.name = "ApiError";
27060
+ this.status = status;
27061
+ }
27062
+ };
27058
27063
  async function throwResponseError(response) {
27059
27064
  const error51 = await response.json().catch(() => ({ error: "Request failed" }));
27060
- throw new Error(error51.error || `Request failed with status ${response.status}`);
27065
+ throw new ApiError(error51.error || `Request failed with status ${response.status}`, response.status);
27061
27066
  }
27062
27067
  async function apiFetch(url2, headers, options) {
27063
27068
  const requestHeaders = {
@@ -27596,7 +27601,10 @@ async function fetchWorkspaceById(workspaceId) {
27596
27601
  const response = await orgAuthenticatedFetch(
27597
27602
  `/v1/workspaces/${encodeURIComponent(workspaceId)}`
27598
27603
  ).catch((error51) => {
27599
- if (error51 instanceof Error && error51.message.includes("Workspace not found")) return null;
27604
+ if (error51 instanceof ApiError) {
27605
+ if (error51.status === 404) return null;
27606
+ if (error51.status === 410) throw new Error(`Workspace ${workspaceId} has been deleted.`);
27607
+ }
27600
27608
  throw error51;
27601
27609
  });
27602
27610
  return response?.workspace ?? null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.2.420",
3
+ "version": "0.2.422",
4
4
  "description": "CLI for managing Replicas workspaces - SSH into cloud dev environments with automatic port forwarding",
5
5
  "main": "dist/index.mjs",
6
6
  "bin": {