replicas-cli 0.2.421 → 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.
- package/dist/index.mjs +13 -3
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -24492,7 +24492,7 @@ function formatTurnElapsed(ms) {
|
|
|
24492
24492
|
}
|
|
24493
24493
|
|
|
24494
24494
|
// ../shared/src/cli-version.ts
|
|
24495
|
-
var CLI_VERSION = "0.2.
|
|
24495
|
+
var CLI_VERSION = "0.2.422";
|
|
24496
24496
|
|
|
24497
24497
|
// ../shared/src/version.ts
|
|
24498
24498
|
function compareVersions(v1, v2) {
|
|
@@ -27053,9 +27053,16 @@ async function orgAuthenticatedFetch(url2, options) {
|
|
|
27053
27053
|
...options?.headers || {}
|
|
27054
27054
|
}, options);
|
|
27055
27055
|
}
|
|
27056
|
+
var ApiError = class extends Error {
|
|
27057
|
+
constructor(message, status) {
|
|
27058
|
+
super(message);
|
|
27059
|
+
this.name = "ApiError";
|
|
27060
|
+
this.status = status;
|
|
27061
|
+
}
|
|
27062
|
+
};
|
|
27056
27063
|
async function throwResponseError(response) {
|
|
27057
27064
|
const error51 = await response.json().catch(() => ({ error: "Request failed" }));
|
|
27058
|
-
throw new
|
|
27065
|
+
throw new ApiError(error51.error || `Request failed with status ${response.status}`, response.status);
|
|
27059
27066
|
}
|
|
27060
27067
|
async function apiFetch(url2, headers, options) {
|
|
27061
27068
|
const requestHeaders = {
|
|
@@ -27594,7 +27601,10 @@ async function fetchWorkspaceById(workspaceId) {
|
|
|
27594
27601
|
const response = await orgAuthenticatedFetch(
|
|
27595
27602
|
`/v1/workspaces/${encodeURIComponent(workspaceId)}`
|
|
27596
27603
|
).catch((error51) => {
|
|
27597
|
-
if (error51 instanceof
|
|
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
|
+
}
|
|
27598
27608
|
throw error51;
|
|
27599
27609
|
});
|
|
27600
27610
|
return response?.workspace ?? null;
|