@batadata/cli 0.2.1 → 0.2.2
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/commands/connect.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* and execs psql with the connection string.
|
|
6
6
|
*/
|
|
7
7
|
import { execSync, spawn } from "node:child_process";
|
|
8
|
-
import { api } from "../api.js";
|
|
8
|
+
import { api, asList } from "../api.js";
|
|
9
9
|
import { requireToken, loadConfig, isJsonMode } from "../config.js";
|
|
10
10
|
import { colors, log, error, spinner, info as logInfo } from "../utils/logger.js";
|
|
11
11
|
import { emitError } from "../utils/errors.js";
|
|
@@ -35,7 +35,7 @@ export async function connect(args) {
|
|
|
35
35
|
: projRes.status >= 500 || projRes.status === 0 ? "API_UNAVAILABLE"
|
|
36
36
|
: "CLI_ERROR", "Failed to fetch projects.", "");
|
|
37
37
|
}
|
|
38
|
-
const projects =
|
|
38
|
+
const projects = asList(projRes.data);
|
|
39
39
|
const found = projects.find((p) => p.name === projectName || p.id === projectName);
|
|
40
40
|
if (!found) {
|
|
41
41
|
emitError("NOT_FOUND", `Project "${projectName}" not found.`, "");
|
package/dist/commands/status.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Lists projects with branch count, compute status, and storage size.
|
|
5
5
|
* Colorized output: green for running, yellow for suspended, red for error.
|
|
6
6
|
*/
|
|
7
|
-
import { api, apiError, resolveTeamId } from "../api.js";
|
|
7
|
+
import { api, apiError, resolveTeamId, asList } from "../api.js";
|
|
8
8
|
import { requireToken, loadConfig, isJsonMode } from "../config.js";
|
|
9
9
|
import { colors, log, json, spinner, table, heading } from "../utils/logger.js";
|
|
10
10
|
import { emitError } from "../utils/errors.js";
|
|
@@ -55,7 +55,10 @@ export async function status() {
|
|
|
55
55
|
: "CLI_ERROR", apiError(res, "Failed to fetch projects"), "");
|
|
56
56
|
}
|
|
57
57
|
s?.stop();
|
|
58
|
-
|
|
58
|
+
// The list endpoint returns `{ data: [...] }` — a bare Array.isArray(res.data)
|
|
59
|
+
// silently read that envelope as "no projects" while the team had plenty
|
|
60
|
+
// (real regression seen live). asList normalizes every envelope shape.
|
|
61
|
+
const projects = asList(res.data);
|
|
59
62
|
const defaultProj = validDefaultProject(projects, config.defaultProject);
|
|
60
63
|
if (jsonMode) {
|
|
61
64
|
json({
|