@voltade/volty 0.1.15 → 0.1.16
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/volty.js +5 -2
- package/package.json +1 -1
package/dist/volty.js
CHANGED
|
@@ -42,6 +42,9 @@ async function apiFetch(ctx, path, init) {
|
|
|
42
42
|
return { ok: res.ok, status: res.status, body };
|
|
43
43
|
}
|
|
44
44
|
var cachePath = (env) => join(tmpdir(), `volty-catalog-${env}-${targetOrg ?? "default"}.json`);
|
|
45
|
+
function staleKeyHint(env) {
|
|
46
|
+
return `: this key is not valid any more, run \`volty auth login --env ${env}\``;
|
|
47
|
+
}
|
|
45
48
|
async function fetchCatalog(ctx, env, useCache = true) {
|
|
46
49
|
const path = cachePath(env);
|
|
47
50
|
if (useCache && existsSync(path)) {
|
|
@@ -53,7 +56,7 @@ async function fetchCatalog(ctx, env, useCache = true) {
|
|
|
53
56
|
}
|
|
54
57
|
const res = await apiFetch(ctx, "/api/v/_catalog");
|
|
55
58
|
if (!res.ok || !res.body.catalog) {
|
|
56
|
-
throw new Error(`could not fetch the operation catalog (HTTP ${res.status})${res.status === 401 ?
|
|
59
|
+
throw new Error(`could not fetch the operation catalog (HTTP ${res.status})${res.status === 401 ? staleKeyHint(env) : ""}`);
|
|
57
60
|
}
|
|
58
61
|
const ops = res.body.catalog;
|
|
59
62
|
const retired = res.body.retired ?? {};
|
|
@@ -76,7 +79,7 @@ async function fetchOrgs(ctx, env, useCache = true) {
|
|
|
76
79
|
}
|
|
77
80
|
const res = await apiFetch(ctx, "/api/cli/orgs");
|
|
78
81
|
if (!res.ok || !res.body.orgs) {
|
|
79
|
-
throw new Error(`could not fetch your org memberships (HTTP ${res.status})${res.status === 401 ?
|
|
82
|
+
throw new Error(`could not fetch your org memberships (HTTP ${res.status})${res.status === 401 ? staleKeyHint(env) : ""}`);
|
|
80
83
|
}
|
|
81
84
|
const orgs = res.body.orgs;
|
|
82
85
|
try {
|
package/package.json
CHANGED