ardent-cli 0.0.7 → 0.0.8
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.js +24 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -104,9 +104,10 @@ async function bootstrapCache() {
|
|
|
104
104
|
"Content-Type": "application/json",
|
|
105
105
|
"Authorization": `Bearer ${token}`
|
|
106
106
|
};
|
|
107
|
-
const [connectorsRes, branchesRes] = await Promise.all([
|
|
107
|
+
const [connectorsRes, branchesRes, meRes] = await Promise.all([
|
|
108
108
|
fetch(`${apiUrl}/v1/cli/connectors`, { headers }),
|
|
109
|
-
fetch(`${apiUrl}/v1/cli/branches`, { headers })
|
|
109
|
+
fetch(`${apiUrl}/v1/cli/branches`, { headers }),
|
|
110
|
+
fetch(`${apiUrl}/v1/cli/me`, { headers })
|
|
110
111
|
]);
|
|
111
112
|
let connectorCount = 0;
|
|
112
113
|
let branchCount = 0;
|
|
@@ -122,6 +123,10 @@ async function bootstrapCache() {
|
|
|
122
123
|
setCacheEntry("branches", branches);
|
|
123
124
|
branchCount = branches.length;
|
|
124
125
|
}
|
|
126
|
+
if (meRes.ok) {
|
|
127
|
+
const user = await meRes.json();
|
|
128
|
+
setConfig("user", user);
|
|
129
|
+
}
|
|
125
130
|
return { connectors: connectorCount, branches: branchCount };
|
|
126
131
|
}
|
|
127
132
|
|
|
@@ -1232,12 +1237,25 @@ function logoutAction() {
|
|
|
1232
1237
|
// src/commands/auth/status.ts
|
|
1233
1238
|
function statusAction() {
|
|
1234
1239
|
const token = getConfig("token");
|
|
1235
|
-
if (token) {
|
|
1236
|
-
console.log("\u2713 Authenticated");
|
|
1237
|
-
console.log(` Token: ${token.slice(0, 8)}...${token.slice(-4)}`);
|
|
1238
|
-
} else {
|
|
1240
|
+
if (!token) {
|
|
1239
1241
|
console.log("\u2717 Not authenticated");
|
|
1240
1242
|
console.log(" Run: ardent login");
|
|
1243
|
+
return;
|
|
1244
|
+
}
|
|
1245
|
+
const user = getConfig("user");
|
|
1246
|
+
console.log("\u2713 Authenticated");
|
|
1247
|
+
if (user?.full_name) {
|
|
1248
|
+
console.log(` Account: ${user.full_name}`);
|
|
1249
|
+
}
|
|
1250
|
+
if (user?.email) {
|
|
1251
|
+
console.log(` Email: ${user.email}`);
|
|
1252
|
+
}
|
|
1253
|
+
if (user?.org_name) {
|
|
1254
|
+
console.log(` Org: ${user.org_name}`);
|
|
1255
|
+
}
|
|
1256
|
+
if (!user) {
|
|
1257
|
+
console.log(` Token: ${token.slice(0, 8)}...${token.slice(-4)}`);
|
|
1258
|
+
console.log(" Run: ardent login to refresh profile info");
|
|
1241
1259
|
}
|
|
1242
1260
|
}
|
|
1243
1261
|
|