@batadata/cli 0.2.2 → 0.2.3
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 +7 -1
- package/dist/commands/db.js +19 -2
- package/package.json +1 -1
package/dist/commands/connect.js
CHANGED
|
@@ -79,7 +79,13 @@ export async function connect(args) {
|
|
|
79
79
|
process.exit(1);
|
|
80
80
|
}
|
|
81
81
|
log();
|
|
82
|
-
logInfo(`Connecting to ${colors.cyan(connRes.data.project_name)}`);
|
|
82
|
+
logInfo(`Connecting to ${colors.cyan(connRes.data.project_name)} ${colors.dim(`(${connRes.data.project_id})`)}`);
|
|
83
|
+
if (!projectName || projectName.startsWith("-")) {
|
|
84
|
+
// No explicit project argument — this resolved through the link/config
|
|
85
|
+
// default. Say so loudly: a silently-resolved default once pointed a
|
|
86
|
+
// benchmark harness at an entirely different project.
|
|
87
|
+
log(` ${colors.yellow("!")} resolved from the linked/default project, not an explicit argument`);
|
|
88
|
+
}
|
|
83
89
|
log(` ${colors.dim(connectionUri)}`);
|
|
84
90
|
log();
|
|
85
91
|
// Check if psql is available
|
package/dist/commands/db.js
CHANGED
|
@@ -27,6 +27,9 @@ async function getConnectionInfo(projectId, token) {
|
|
|
27
27
|
database: c.params?.database,
|
|
28
28
|
user: c.params?.user,
|
|
29
29
|
password: c.params?.password,
|
|
30
|
+
project_id: res.data?.project_id,
|
|
31
|
+
project_name: res.data?.project_name,
|
|
32
|
+
branch_name: c.branch_name,
|
|
30
33
|
};
|
|
31
34
|
}
|
|
32
35
|
function formatDate(iso) {
|
|
@@ -186,10 +189,24 @@ export async function url() {
|
|
|
186
189
|
emitError("NOT_FOUND", "Could not fetch connection string.", "");
|
|
187
190
|
}
|
|
188
191
|
if (isJsonMode()) {
|
|
189
|
-
json({
|
|
192
|
+
json({
|
|
193
|
+
direct: conn.connection_uri,
|
|
194
|
+
pooled: conn.pooled_uri ?? null,
|
|
195
|
+
// Identity of what was resolved (link > config default when no explicit
|
|
196
|
+
// project) — so a script can ASSERT it got the project it meant. A
|
|
197
|
+
// silently-resolved default once handed a benchmark harness another
|
|
198
|
+
// project's URI; the URI alone gives no way to notice.
|
|
199
|
+
project_id: conn.project_id ?? projectId,
|
|
200
|
+
project_name: conn.project_name ?? null,
|
|
201
|
+
branch_name: conn.branch_name ?? null,
|
|
202
|
+
});
|
|
190
203
|
return;
|
|
191
204
|
}
|
|
192
|
-
//
|
|
205
|
+
// Raw URL on stdout for piping; resolved identity on STDERR so pipes stay
|
|
206
|
+
// clean but a human (or a captured log) always sees WHICH project answered.
|
|
207
|
+
process.stderr.write(`# project: ${conn.project_name ?? "?"} (${conn.project_id ?? projectId})` +
|
|
208
|
+
(conn.branch_name ? ` · branch: ${conn.branch_name}` : "") +
|
|
209
|
+
"\n");
|
|
193
210
|
process.stdout.write(conn.connection_uri + "\n");
|
|
194
211
|
}
|
|
195
212
|
export async function branches() {
|