@batadata/cli 0.2.3 → 0.2.4

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.
@@ -19,7 +19,7 @@ export declare function parseBranchCreateArgs(args: string[]): {
19
19
  purpose?: string;
20
20
  };
21
21
  export declare function connect(): Promise<void>;
22
- export declare function url(): Promise<void>;
22
+ export declare function url(args?: string[]): Promise<void>;
23
23
  export declare function branches(): Promise<void>;
24
24
  export declare function branchCreate(args?: string[]): Promise<void>;
25
25
  export declare function branchDelete(name?: string): Promise<void>;
@@ -10,6 +10,8 @@ import { resolveProjectId, resolveBranchId, findLinkFile, writeLinkFile } from "
10
10
  // Share the exact LSN/timestamp discriminator `bata restore` uses so `db query
11
11
  // --at` classifies a restore point identically.
12
12
  import { classifyRestorePoint } from "./restore.js";
13
+ // Same --project/positional resolution as projects info/delete (0.1.6 fix).
14
+ import { resolveProjectArg } from "./projects.js";
13
15
  async function getConnectionInfo(projectId, token) {
14
16
  // reveal=true so the returned string is actually usable (the owner is asking).
15
17
  const res = await api.get(`/v1/connection-info/${projectId}`, token, { reveal: "true" });
@@ -177,10 +179,14 @@ export async function connect() {
177
179
  process.exit(code || 0);
178
180
  });
179
181
  }
180
- export async function url() {
182
+ export async function url(args = []) {
181
183
  const token = requireToken();
182
184
  const config = loadConfig();
183
- const projectId = resolveProjectId().projectId;
185
+ // Precedence: --project <id> / positional arg > .batadata link > config
186
+ // default. `db url` used to IGNORE --project and silently serve the linked/
187
+ // default project — the same flag-ignored class as the 0.1.6 projects
188
+ // delete/info fix, and the root of the wrong-target benchmark incident.
189
+ const projectId = resolveProjectArg(args) ?? resolveProjectId().projectId;
184
190
  if (!projectId) {
185
191
  emitError("NO_PROJECT", "No default project set.", "Set one with: bata projects info <id>");
186
192
  }
@@ -861,7 +867,7 @@ export async function handleDb(args) {
861
867
  case "connect":
862
868
  return connect();
863
869
  case "url":
864
- return url();
870
+ return url(args.slice(1));
865
871
  case "branches":
866
872
  return branches();
867
873
  case "branch": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@batadata/cli",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "CLI for BataDB — serverless Postgres platform",
5
5
  "bin": {
6
6
  "bata": "./dist/index.js"