@vwork/cli 0.1.1 → 0.1.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/config.js CHANGED
@@ -2,7 +2,7 @@ import { existsSync, readFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { parseCommand } from "./command.js";
4
4
  export const DEFAULT_CLI_TRUSTED_USER_ID = "user_cli_dev";
5
- export const DEFAULT_VWORK_API_URL = "https://vwork.vvicat.dev";
5
+ export const DEFAULT_VWORK_API_URL = "https://vwork.vvicat.dev/api";
6
6
  export function resolveCliConfig(argv, env, cwd) {
7
7
  const command = parseCommand(argv);
8
8
  return resolveCliConfigFromFlags(command.flags, env, cwd);
package/dist/functions.js CHANGED
@@ -108,7 +108,7 @@ async function runFunctionRouteCommand(command, client, appPath) {
108
108
  const basePath = `${appPath}/function-routes`;
109
109
  if (action === "list") {
110
110
  const body = await client.request("GET", basePath);
111
- return { rows: body.routes };
111
+ return { rows: body.function_routes ?? body.routes ?? [] };
112
112
  }
113
113
  if (action === "add" || action === "create") {
114
114
  const functionName = stringFlag(command.flags.function) ?? requiredPosition(command, 0, "function name");
@@ -4,7 +4,7 @@ export async function runObservabilityCommand(command, client) {
4
4
  if (action === "access-logs") {
5
5
  const query = new URLSearchParams();
6
6
  const source = stringFlag(command.flags.source);
7
- const app = stringFlag(command.flags.app);
7
+ const app = await resolveAppId(client, stringFlag(command.flags.app));
8
8
  const limit = stringFlag(command.flags.limit);
9
9
  if (source)
10
10
  query.set("source", source);
@@ -18,3 +18,9 @@ export async function runObservabilityCommand(command, client) {
18
18
  }
19
19
  throw new Error(`Unknown observability command: ${action ?? ""}`);
20
20
  }
21
+ async function resolveAppId(client, target) {
22
+ if (!target)
23
+ return undefined;
24
+ const app = await client.request("GET", `/apps/lookup/${encodeURIComponent(target)}`);
25
+ return String(app.id);
26
+ }
@@ -228,6 +228,8 @@ function maxPathLength(path) {
228
228
  return 3;
229
229
  if (path[0] === "functions" && path[1] === "previews")
230
230
  return 3;
231
+ if (path[0] === "functions" && path[1] === "routes")
232
+ return 3;
231
233
  if (path[0] === "functions" && path[1] === "queue-bindings")
232
234
  return 3;
233
235
  return 2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vwork/cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist/*.js",