@base44-preview/cli 0.1.32-pr.663.ab2ede0 → 0.1.32-pr.663.bd6561f

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
@@ -39570,9 +39570,9 @@ function tm(e, t, r) {
39570
39570
  return l(["<", r("name"), r("typeArguments"), " ", ...e.map(r, "attributes"), n.selfClosing ? " />" : ">"]);
39571
39571
  let i = n.attributes?.some((u) => V3(u.value) && u.value.value.includes(`
39572
39572
  `)), o = t.singleAttributePerLine && n.attributes.length > 1 ? E : A;
39573
- return l(["<", r("name"), r("typeArguments"), m(e.map(() => [o, r()], "attributes")), ...rm2(n, t, s)], { shouldBreak: i });
39573
+ return l(["<", r("name"), r("typeArguments"), m(e.map(() => [o, r()], "attributes")), ...rm3(n, t, s)], { shouldBreak: i });
39574
39574
  }
39575
- function rm2(e, t, r) {
39575
+ function rm3(e, t, r) {
39576
39576
  return e.selfClosing ? [A, "/>"] : nm(e, t, r) ? [">"] : [f, ">"];
39577
39577
  }
39578
39578
  function nm(e, t, r) {
@@ -111521,7 +111521,7 @@ function N62(e) {
111521
111521
  function nm2(e, t, a) {
111522
111522
  return ie10(t, a, e.typeParameters) || ie10(t, a, e.parameters) || S7(t, e.type);
111523
111523
  }
111524
- function rm3(e, t, a) {
111524
+ function rm4(e, t, a) {
111525
111525
  return ie10(t, a, e.types);
111526
111526
  }
111527
111527
  function im2(e, t, a) {
@@ -114489,7 +114489,7 @@ ${Me.join(`
114489
114489
  return S7(a, t.elementType);
114490
114490
  }, 190: function(t, a, _) {
114491
114491
  return ie10(a, _, t.elements);
114492
- }, 193: rm3, 194: rm3, 195: function(t, a, _) {
114492
+ }, 193: rm4, 194: rm4, 195: function(t, a, _) {
114493
114493
  return S7(a, t.checkType) || S7(a, t.extendsType) || S7(a, t.trueType) || S7(a, t.falseType);
114494
114494
  }, 196: function(t, a, _) {
114495
114495
  return S7(a, t.typeParameter);
@@ -249307,8 +249307,10 @@ function leftoverRefs(node, schemas, found = new Map) {
249307
249307
  for (const [key, value] of Object.entries(node)) {
249308
249308
  if (key === "$ref" && typeof value === "string" && value.startsWith(SCHEMA_REF_PREFIX) && !found.has(value)) {
249309
249309
  const schema = schemas[value.slice(SCHEMA_REF_PREFIX.length)];
249310
- found.set(value, schema);
249311
- leftoverRefs(schema, schemas, found);
249310
+ if (schema !== undefined) {
249311
+ found.set(value, schema);
249312
+ leftoverRefs(schema, schemas, found);
249313
+ }
249312
249314
  } else {
249313
249315
  leftoverRefs(value, schemas, found);
249314
249316
  }
@@ -249488,6 +249490,7 @@ function matchOperation(operations, method, concretePath) {
249488
249490
  }
249489
249491
  // src/core/api-spec/request.ts
249490
249492
  var MAX_ERROR_BODY_CHARS = 4000;
249493
+ var QUERY_STRING = /\?\S*/g;
249491
249494
  async function readBody(response) {
249492
249495
  try {
249493
249496
  const text = (await response.clone().text()).trim();
@@ -249502,7 +249505,8 @@ async function sendApiRequest(method, path, body) {
249502
249505
  method,
249503
249506
  body,
249504
249507
  headers: body === undefined ? {} : { "Content-Type": "application/json" },
249505
- timeout: false
249508
+ timeout: false,
249509
+ retry: { methods: ["get", "head"] }
249506
249510
  });
249507
249511
  return {
249508
249512
  status: response.status,
@@ -249512,19 +249516,23 @@ async function sendApiRequest(method, path, body) {
249512
249516
  } catch (error) {
249513
249517
  const apiError = await ApiError.fromHttpError(error, `calling ${method} ${path}`);
249514
249518
  const raw = error instanceof HTTPError ? await readBody(error.response) : undefined;
249515
- const message = raw && apiError.statusCode !== undefined ? `Error calling ${method} ${path}: HTTP ${apiError.statusCode}` : apiError.message;
249516
- throw new ApiError(message, {
249517
- statusCode: apiError.statusCode,
249518
- requestUrl: apiError.requestUrl,
249519
- requestMethod: apiError.requestMethod,
249520
- requestId: apiError.requestId,
249521
- hints: apiError.hints,
249522
- details: raw ? [`Response body: ${raw}`] : apiError.details
249523
- });
249519
+ throw redactedApiError(apiError, raw, method, path);
249524
249520
  }
249525
249521
  }
249522
+ function redactedApiError(apiError, raw, method, path) {
249523
+ const reason = apiError.statusCode !== undefined ? `HTTP ${apiError.statusCode}` : (apiError.cause?.message ?? "request failed").replace(QUERY_STRING, "");
249524
+ const message = `Error calling ${method} ${path.split("?", 1)[0]}: ${reason}`;
249525
+ return new ApiError(message, {
249526
+ statusCode: apiError.statusCode,
249527
+ requestUrl: apiError.requestUrl?.split("?", 1)[0],
249528
+ requestMethod: apiError.requestMethod,
249529
+ requestId: apiError.requestId,
249530
+ hints: apiError.hints,
249531
+ details: raw ? [`Response body: ${raw}`] : apiError.details
249532
+ });
249533
+ }
249526
249534
  // src/core/api-spec/spec.ts
249527
- import { rename, stat as stat3 } from "node:fs/promises";
249535
+ import { rename, rm, stat as stat3 } from "node:fs/promises";
249528
249536
  import { join as join22 } from "node:path";
249529
249537
  var SPEC_CACHE_TTL_MS = 60 * 60 * 1000;
249530
249538
  function getSpecCachePath(apiUrl = getBase44ApiUrl()) {
@@ -249579,8 +249587,14 @@ async function loadSpec(options = {}) {
249579
249587
  const text = await downloadSpec();
249580
249588
  const spec = parseSpec(text);
249581
249589
  const partial = `${path}.${process.pid}.tmp`;
249582
- await writeFile(partial, text);
249583
- await rename(partial, path);
249590
+ try {
249591
+ await writeFile(partial, text);
249592
+ await rename(partial, path);
249593
+ } catch {
249594
+ await rm(partial, { force: true }).catch(() => {
249595
+ return;
249596
+ });
249597
+ }
249584
249598
  return { text, spec };
249585
249599
  }
249586
249600
  // src/cli/commands/api/shared.ts
@@ -249636,6 +249650,19 @@ async function readRequestBody(flag, log) {
249636
249650
  }
249637
249651
  return flag;
249638
249652
  }
249653
+ function withoutQuery(path) {
249654
+ return path.split("?", 1)[0] ?? "";
249655
+ }
249656
+ function reportedFetchCommand(method, path, options) {
249657
+ return {
249658
+ name: "api fetch",
249659
+ args: [method, withoutQuery(path)],
249660
+ options: {
249661
+ ...options,
249662
+ ...options.body === undefined ? {} : { body: "[not reported]" }
249663
+ }
249664
+ };
249665
+ }
249639
249666
 
249640
249667
  // src/cli/commands/api/catalog.ts
249641
249668
  async function catalogAction(ctx, area, options) {
@@ -249660,7 +249687,7 @@ async function findOperation(ctx, method, path, { refresh, flag }) {
249660
249687
  const { spec } = await loadSpecTask(ctx, refresh);
249661
249688
  const op = matchOperation(listOperations(spec), method, path);
249662
249689
  if (!op) {
249663
- throw new InvalidInputError(`No operation in the API spec matches ${method} ${path}.`, {
249690
+ throw new InvalidInputError(`No operation in the API spec matches ${method} ${withoutQuery(path)}.`, {
249664
249691
  hints: [
249665
249692
  {
249666
249693
  message: "The cached spec may predate this route; fetch it again",
@@ -249714,6 +249741,9 @@ async function formatResponse({ status, contentType, body }, output, jsonMode) {
249714
249741
  }
249715
249742
  }
249716
249743
  async function fetchAction(ctx, methodArg, path, options, command) {
249744
+ ctx.errorReporter.setContext({
249745
+ command: reportedFetchCommand(methodArg ?? "", path ?? "", { ...options })
249746
+ });
249717
249747
  if (!methodArg || !path) {
249718
249748
  if (options.help) {
249719
249749
  const usage = command.helpInformation();
@@ -249738,13 +249768,6 @@ async function fetchAction(ctx, methodArg, path, options, command) {
249738
249768
  throw new InvalidInputError(`Refused under --read-only: ${op.method} ${op.path} is not a read-only operation. Nothing was sent.`);
249739
249769
  }
249740
249770
  }
249741
- ctx.errorReporter.setContext({
249742
- command: {
249743
- name: "api fetch",
249744
- args: [method, path.split("?", 1)[0] ?? ""],
249745
- options: { ...options, body: options.body && "[not reported]" }
249746
- }
249747
- });
249748
249771
  await ensureAuth(ctx);
249749
249772
  const body = await readRequestBody(options.body, ctx.log);
249750
249773
  const response = await ctx.runTask(`Calling ${method} ${path}`, () => sendApiRequest(method, path, body), {
@@ -262381,7 +262404,7 @@ var bundleAppRequestSchema = objectType({
262381
262404
  var ACTIVATION_MODE = "pull";
262382
262405
 
262383
262406
  // ../functions-compiler/src/deno-bundle.ts
262384
- import { mkdtemp, rm, writeFile as writeFile2 } from "node:fs/promises";
262407
+ import { mkdtemp, rm as rm2, writeFile as writeFile2 } from "node:fs/promises";
262385
262408
  import { tmpdir as tmpdir2 } from "node:os";
262386
262409
  import path21 from "node:path";
262387
262410
 
@@ -262988,7 +263011,7 @@ async function bundleToModule(prepared, nodeModulesDir = "none") {
262988
263011
  warnings: result.warnings.map((w) => w.text)
262989
263012
  };
262990
263013
  } finally {
262991
- await rm(dir, { recursive: true, force: true });
263014
+ await rm2(dir, { recursive: true, force: true });
262992
263015
  }
262993
263016
  }
262994
263017
  function buildFailureErrors(e, dir) {
@@ -273353,4 +273376,4 @@ export {
273353
273376
  runCLI
273354
273377
  };
273355
273378
 
273356
- //# debugId=ED51B8A8CDD1B22D64756E2164756E21
273379
+ //# debugId=45DA033B3116B4E664756E2164756E21