@base44-preview/cli 0.1.32-pr.663.447e6da → 0.1.32-pr.663.463d401

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/cli/index.js CHANGED
@@ -249604,17 +249604,21 @@ function isPipedStdin() {
249604
249604
  return false;
249605
249605
  }
249606
249606
  }
249607
- async function readRequestBody(flag, log) {
249607
+ async function readRequestBody(method, flag) {
249608
249608
  if (flag === "@-") {
249609
249609
  return readStdin("--body @-", { trim: false });
249610
249610
  }
249611
249611
  if (flag?.startsWith("@")) {
249612
249612
  return readTextFile(flag.slice(1));
249613
249613
  }
249614
- if (flag === undefined && isPipedStdin()) {
249615
- log.warn("stdin is ignored; pass --body @- to send it as the body.");
249614
+ if (flag !== undefined) {
249615
+ return flag;
249616
249616
  }
249617
- return flag;
249617
+ if (method === "GET" || method === "HEAD" || !isPipedStdin()) {
249618
+ return;
249619
+ }
249620
+ const piped = await readStdin("--body", { trim: false });
249621
+ return piped.trim() ? piped : undefined;
249618
249622
  }
249619
249623
 
249620
249624
  // src/cli/commands/api/catalog.ts
@@ -249720,7 +249724,7 @@ async function fetchAction(ctx, methodArg, path, options, command) {
249720
249724
  }
249721
249725
  });
249722
249726
  await ensureAuth(ctx);
249723
- const body = await readRequestBody(options.body, ctx.log);
249727
+ const body = await readRequestBody(method, options.body);
249724
249728
  const response = await ctx.runTask(`Calling ${method} ${path}`, () => sendApiRequest(method, path, body), {
249725
249729
  successMessage: `Called ${method} ${path}`,
249726
249730
  errorMessage: "Request failed"
@@ -249733,7 +249737,7 @@ function getApiFetchCommand() {
249733
249737
  return new Base44Command("fetch", {
249734
249738
  requireAuth: false,
249735
249739
  requireAppContext: false
249736
- }).description("Call a Base44 API operation, like curl; add --help after a path for its contract").helpOption(false).argument("[method]", "HTTP method, e.g. GET or POST").argument("[path]", 'Concrete path with any query string, e.g. "/api/apps/<app-id>/workflows/runs?status=failed"').option("--body <json>", "Request body: JSON, @file.json, or @- to read it from stdin").option("--output <file>", "Save the response body to a file").option("--read-only", "Refuse, before sending, any operation the spec does not mark read-only").option("--refresh", REFRESH_OPTION_HELP).option("-h, --help", "With a method and path, print that operation's contract; otherwise this help").action(fetchAction);
249740
+ }).description("Call a Base44 API operation, like curl; add --help after a path for its contract").helpOption(false).argument("[method]", "HTTP method, e.g. GET or POST").argument("[path]", 'Concrete path with any query string, e.g. "/api/apps/<app-id>/workflows/runs?status=failed"').option("--body <json>", "Request body: JSON, @file.json, or @- for stdin (piped stdin is read too)").option("--output <file>", "Save the response body to a file").option("--read-only", "Refuse, before sending, any operation the spec does not mark read-only").option("--refresh", REFRESH_OPTION_HELP).option("-h, --help", "With a method and path, print that operation's contract; otherwise this help").action(fetchAction);
249737
249741
  }
249738
249742
 
249739
249743
  // src/cli/commands/api/grep.ts
@@ -273329,4 +273333,4 @@ export {
273329
273333
  runCLI
273330
273334
  };
273331
273335
 
273332
- //# debugId=4F218AD4EF632ED564756E2164756E21
273336
+ //# debugId=CD2605865A84BE8564756E2164756E21