@base44-preview/cli 0.1.32-pr.663.ac8cbb8 → 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);
@@ -249214,44 +249214,6 @@ function areaListing(area, operations, max = AREA_OPERATIONS_MAX) {
249214
249214
  truncated: operations.length > max
249215
249215
  };
249216
249216
  }
249217
- // src/core/api-spec/grep.ts
249218
- var CONTEXT_CHARS = 40;
249219
- var MAX_SNIPPETS = 3;
249220
- var MAX_SNIPPET_CHARS = 200;
249221
- function unescapeJson(snippet) {
249222
- return snippet.replace(/\\[nrt]/g, " ").replace(/\\"/g, '"');
249223
- }
249224
- function snippets(text, pattern) {
249225
- const found = [];
249226
- for (const match of text.matchAll(pattern)) {
249227
- const start = Math.max(0, match.index - CONTEXT_CHARS);
249228
- const end = match.index + match[0].length + CONTEXT_CHARS;
249229
- found.push(unescapeJson(text.slice(start, Math.min(end, start + MAX_SNIPPET_CHARS))));
249230
- if (found.length === MAX_SNIPPETS || match[0].length === 0) {
249231
- break;
249232
- }
249233
- }
249234
- return found;
249235
- }
249236
- function grepSpec(spec, operations, pattern, options = {}) {
249237
- const regex = new RegExp(pattern, options.ignoreCase ? "gi" : "g");
249238
- const hits = [];
249239
- for (const op of operations) {
249240
- const { summary, description, parameters, requestBody, responses } = op.operation;
249241
- const matches = snippets(`${op.endpoint} ${JSON.stringify({ summary, description, parameters, requestBody, responses })}`, regex);
249242
- if (matches.length > 0) {
249243
- hits.push({ ...toOperationSummary(op), matches });
249244
- }
249245
- }
249246
- const schemas = options.schemas === false ? {} : spec.components?.schemas;
249247
- for (const [schema, definition] of Object.entries(schemas ?? {})) {
249248
- const matches = snippets(JSON.stringify(definition), regex);
249249
- if (matches.length > 0) {
249250
- hits.push({ schema, matches });
249251
- }
249252
- }
249253
- return hits.slice(0, options.limit ?? 20);
249254
- }
249255
249217
  // src/core/api-spec/schema.ts
249256
249218
  var HTTP_METHODS = [
249257
249219
  "get",
@@ -249272,7 +249234,7 @@ var ParameterSchema = looseObject({
249272
249234
  example: unknown().optional()
249273
249235
  });
249274
249236
  var MediaTypesSchema = record(string2(), looseObject({ schema: unknown().optional() }));
249275
- var RequestBodySchema = looseObject({
249237
+ var MediaContentSchema = looseObject({
249276
249238
  content: MediaTypesSchema.optional()
249277
249239
  });
249278
249240
  var ResponseObjectSchema = looseObject({
@@ -249302,88 +249264,7 @@ var OpenApiSpecSchema = looseObject({
249302
249264
  security: array(SecurityRequirementSchema).optional()
249303
249265
  });
249304
249266
 
249305
- // src/core/api-spec/operations.ts
249306
- var PERSONAL_ACCESS_TOKEN_SCHEME = "PersonalAccessTokenAuth";
249307
- var READ_ONLY_SCOPE = "read_only";
249308
- function isReadOnly(operation, spec) {
249309
- const security = operation.security ?? spec.security ?? [];
249310
- return security.some((requirement) => requirement[PERSONAL_ACCESS_TOKEN_SCHEME]?.includes(READ_ONLY_SCOPE));
249311
- }
249312
- function parameterText(operation) {
249313
- return (operation.parameters ?? []).flatMap((parameter) => {
249314
- const parsed = ParameterSchema.safeParse(parameter);
249315
- return parsed.success ? [parsed.data.name, parsed.data.description ?? ""] : [];
249316
- }).join(" ");
249317
- }
249318
- function mergeParameters(shared, own) {
249319
- if (!shared?.length) {
249320
- return own;
249321
- }
249322
- const key = (parameter) => {
249323
- const parsed = ParameterSchema.safeParse(parameter);
249324
- return parsed.success ? `${parsed.data.in}:${parsed.data.name}` : undefined;
249325
- };
249326
- const ownKeys = new Set((own ?? []).map(key));
249327
- return [
249328
- ...shared.filter((parameter) => !ownKeys.has(key(parameter))),
249329
- ...own ?? []
249330
- ];
249331
- }
249332
- function listOperations(spec) {
249333
- return Object.entries(spec.paths).flatMap(([path, item]) => HTTP_METHODS.flatMap((method) => {
249334
- const declared = item[method];
249335
- if (!declared) {
249336
- return [];
249337
- }
249338
- const operation = {
249339
- ...declared,
249340
- parameters: mergeParameters(item.parameters, declared.parameters)
249341
- };
249342
- return [
249343
- {
249344
- endpoint: `${method.toUpperCase()} ${path}`,
249345
- method: method.toUpperCase(),
249346
- path,
249347
- summary: operation.summary ?? "",
249348
- description: operation.description ?? "",
249349
- parameterText: parameterText(operation),
249350
- readOnly: isReadOnly(operation, spec),
249351
- operation
249352
- }
249353
- ];
249354
- }));
249355
- }
249356
- function pathSegments(path) {
249357
- const pathname = path.split(/[?#]/, 1)[0] ?? "";
249358
- return pathname.split("/").filter(Boolean);
249359
- }
249360
- function segmentPattern(segment) {
249361
- const source = segment.split(/(\{[^}]+\})/).map((part) => part.startsWith("{") ? "[^/]+" : part.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("");
249362
- return new RegExp(`^${source}$`);
249363
- }
249364
- function specificity(templateSegments) {
249365
- return templateSegments.map((segment) => segment.includes("{") ? 0 : 1);
249366
- }
249367
- function compareSpecificity(a, b) {
249368
- for (let i = 0;i < a.length; i++) {
249369
- if (a[i] !== b[i]) {
249370
- return (b[i] ?? 0) - (a[i] ?? 0);
249371
- }
249372
- }
249373
- return 0;
249374
- }
249375
- function matchOperation(operations, method, concretePath) {
249376
- const upperMethod = method.toUpperCase();
249377
- const segments = pathSegments(concretePath);
249378
- const candidates = operations.filter((op) => {
249379
- if (op.method !== upperMethod) {
249380
- return false;
249381
- }
249382
- const template = pathSegments(op.path);
249383
- return template.length === segments.length && template.every((part, i) => segmentPattern(part).test(segments[i] ?? ""));
249384
- });
249385
- return candidates.sort((a, b) => compareSpecificity(specificity(pathSegments(a.path)), specificity(pathSegments(b.path))))[0];
249386
- }
249267
+ // src/core/api-spec/contract.ts
249387
249268
  var SCHEMA_REF_PREFIX = "#/components/schemas/";
249388
249269
  var MAX_REF_DEPTH = 4;
249389
249270
  var FRAMEWORK_VALIDATION_ERROR = "Validation Error";
@@ -249411,12 +249292,8 @@ function inlineRefs(node, schemas, seen = new Set, depth = 0) {
249411
249292
  inlineRefs(value, schemas, seen, depth)
249412
249293
  ]));
249413
249294
  }
249414
- function jsonSchemaOf(value) {
249415
- const parsed = RequestBodySchema.safeParse(value);
249416
- return parsed.success ? parsed.data.content?.["application/json"]?.schema : undefined;
249417
- }
249418
- function requestBodyOf(value) {
249419
- const parsed = RequestBodySchema.safeParse(value);
249295
+ function bodyOf(value) {
249296
+ const parsed = MediaContentSchema.safeParse(value);
249420
249297
  const content = parsed.success ? parsed.data.content ?? {} : {};
249421
249298
  const contentType = "application/json" in content ? "application/json" : Object.keys(content)[0];
249422
249299
  return contentType ? { contentType, schema: content[contentType]?.schema } : {};
@@ -249430,8 +249307,10 @@ function leftoverRefs(node, schemas, found = new Map) {
249430
249307
  for (const [key, value] of Object.entries(node)) {
249431
249308
  if (key === "$ref" && typeof value === "string" && value.startsWith(SCHEMA_REF_PREFIX) && !found.has(value)) {
249432
249309
  const schema = schemas[value.slice(SCHEMA_REF_PREFIX.length)];
249433
- found.set(value, schema);
249434
- leftoverRefs(schema, schemas, found);
249310
+ if (schema !== undefined) {
249311
+ found.set(value, schema);
249312
+ leftoverRefs(schema, schemas, found);
249313
+ }
249435
249314
  } else {
249436
249315
  leftoverRefs(value, schemas, found);
249437
249316
  }
@@ -249439,22 +249318,63 @@ function leftoverRefs(node, schemas, found = new Map) {
249439
249318
  }
249440
249319
  return found;
249441
249320
  }
249321
+ var SCHEMA_DATA_KEYS = new Set([
249322
+ "example",
249323
+ "examples",
249324
+ "default",
249325
+ "enum",
249326
+ "const"
249327
+ ]);
249328
+ var DOCS_CALLOUT = /<(Info|Note|Tip|Check|Warning)>([\s\S]*?)<\/\1>/g;
249329
+ var RELATIVE_LINK = /\[([^\]]+)\]\(\/[^)]*\)/g;
249330
+ function cleanText(text) {
249331
+ return text.replace(DOCS_CALLOUT, (_, kind, body) => kind === "Warning" ? `Warning: ${body}` : body).replace(RELATIVE_LINK, "$1");
249332
+ }
249333
+ function slimSchema(node, isPropertyMap = false) {
249334
+ if (Array.isArray(node)) {
249335
+ return node.map((item) => slimSchema(item));
249336
+ }
249337
+ if (node === null || typeof node !== "object") {
249338
+ return node;
249339
+ }
249340
+ const entries = Object.entries(node);
249341
+ if (isPropertyMap) {
249342
+ return Object.fromEntries(entries.map(([name, value]) => [name, slimSchema(value)]));
249343
+ }
249344
+ const slim = {};
249345
+ for (const [key, value] of entries) {
249346
+ if (key === "title" && typeof value === "string") {
249347
+ continue;
249348
+ }
249349
+ slim[key] = SCHEMA_DATA_KEYS.has(key) ? value : key === "properties" ? slimSchema(value, true) : key === "description" && typeof value === "string" ? cleanText(value) : slimSchema(value);
249350
+ }
249351
+ const { anyOf, ...rest } = slim;
249352
+ const nullable = Array.isArray(anyOf) && anyOf.length === 2 ? nullableType(anyOf) : undefined;
249353
+ return nullable ? { type: [nullable, "null"], ...rest } : slim;
249354
+ }
249355
+ function nullableType(variants) {
249356
+ const types = variants.map((variant) => variant !== null && typeof variant === "object" && Object.keys(variant).length === 1 && typeof variant.type === "string" ? variant.type : undefined);
249357
+ if (types.includes(undefined) || !types.includes("null")) {
249358
+ return;
249359
+ }
249360
+ return types.find((type) => type !== "null");
249361
+ }
249442
249362
  function getOperationContract(spec, op) {
249443
249363
  const schemas = spec.components?.schemas ?? {};
249444
- const inline = (node) => node === undefined ? null : inlineRefs(node, schemas);
249364
+ const inline = (node) => node === undefined ? null : slimSchema(inlineRefs(node, schemas));
249445
249365
  const responses = Object.entries(op.operation.responses ?? {}).flatMap(([status, response]) => {
249446
249366
  const parsed = ResponseObjectSchema.safeParse(response);
249447
249367
  return parsed.success ? [[status, parsed.data]] : [];
249448
249368
  });
249449
- const success = responses.filter(([status]) => status.startsWith("2")).sort(([a], [b]) => a.localeCompare(b)).map(([, response]) => jsonSchemaOf(response)).find(Boolean);
249369
+ const success = responses.filter(([status]) => status.startsWith("2")).sort(([a], [b]) => a.localeCompare(b)).map(([, response]) => bodyOf(response).schema).find(Boolean);
249450
249370
  const errors = responses.filter(([status, response]) => !status.startsWith("2") && response.description !== FRAMEWORK_VALIDATION_ERROR);
249451
- const requestBody = requestBodyOf(op.operation.requestBody);
249371
+ const requestBody = bodyOf(op.operation.requestBody);
249452
249372
  const contract = {
249453
249373
  endpoint: op.endpoint,
249454
249374
  method: op.method,
249455
249375
  path: op.path,
249456
249376
  summary: op.summary,
249457
- description: op.description,
249377
+ description: cleanText(op.description),
249458
249378
  parameters: (op.operation.parameters ?? []).flatMap((parameter) => {
249459
249379
  const parsed = ParameterSchema.safeParse(parameter);
249460
249380
  if (!parsed.success) {
@@ -249468,7 +249388,7 @@ function getOperationContract(spec, op) {
249468
249388
  in: location2,
249469
249389
  required: required ?? false,
249470
249390
  schema: inline(schema ?? {}),
249471
- ...description && !inSchema ? { description } : {},
249391
+ ...description && !inSchema ? { description: cleanText(description) } : {},
249472
249392
  ..."example" in parsed.data ? { example: parsed.data.example } : {}
249473
249393
  }
249474
249394
  ];
@@ -249476,16 +249396,101 @@ function getOperationContract(spec, op) {
249476
249396
  ...requestBody.contentType && requestBody.contentType !== "application/json" ? { requestBodyContentType: requestBody.contentType } : {},
249477
249397
  requestBodySchema: inline(requestBody.schema),
249478
249398
  responseSchema: inline(success),
249479
- errors: Object.fromEntries(errors.map(([status, response]) => [status, response.description ?? ""]))
249399
+ errors: Object.fromEntries(errors.map(([status, response]) => [
249400
+ status,
249401
+ cleanText(response.description ?? "")
249402
+ ]))
249480
249403
  };
249481
249404
  const refs = leftoverRefs(contract, schemas);
249482
249405
  return {
249483
249406
  ...contract,
249484
- ...refs.size > 0 ? { refs: Object.fromEntries(refs) } : {}
249407
+ ...refs.size > 0 ? {
249408
+ refs: Object.fromEntries([...refs].map(([ref, schema]) => [ref, slimSchema(schema)]))
249409
+ } : {}
249410
+ };
249411
+ }
249412
+ // src/core/api-spec/grep.ts
249413
+ function grepOperations(spec, operations, pattern, options = {}) {
249414
+ const regex = new RegExp(pattern, options.ignoreCase ? "i" : "");
249415
+ return operations.filter((op) => regex.test(JSON.stringify(getOperationContract(spec, op)))).slice(0, options.limit ?? 20).map(toOperationSummary);
249416
+ }
249417
+ // src/core/api-spec/operations.ts
249418
+ var PERSONAL_ACCESS_TOKEN_SCHEME = "PersonalAccessTokenAuth";
249419
+ var READ_ONLY_SCOPE = "read_only";
249420
+ function isReadOnly(operation, spec) {
249421
+ const security = operation.security ?? spec.security ?? [];
249422
+ return security.some((requirement) => requirement[PERSONAL_ACCESS_TOKEN_SCHEME]?.includes(READ_ONLY_SCOPE));
249423
+ }
249424
+ function parameterText(operation) {
249425
+ return (operation.parameters ?? []).flatMap((parameter) => {
249426
+ const parsed = ParameterSchema.safeParse(parameter);
249427
+ return parsed.success ? [parsed.data.name, parsed.data.description ?? ""] : [];
249428
+ }).join(" ");
249429
+ }
249430
+ function mergeParameters(shared, own) {
249431
+ if (!shared?.length) {
249432
+ return own;
249433
+ }
249434
+ const key = (parameter) => {
249435
+ const parsed = ParameterSchema.safeParse(parameter);
249436
+ return parsed.success ? `${parsed.data.in}:${parsed.data.name}` : undefined;
249485
249437
  };
249438
+ const ownKeys = new Set((own ?? []).map(key));
249439
+ return [
249440
+ ...shared.filter((parameter) => !ownKeys.has(key(parameter))),
249441
+ ...own ?? []
249442
+ ];
249443
+ }
249444
+ function listOperations(spec) {
249445
+ return Object.entries(spec.paths).flatMap(([path, item]) => HTTP_METHODS.flatMap((method) => {
249446
+ const declared = item[method];
249447
+ if (!declared) {
249448
+ return [];
249449
+ }
249450
+ const operation = {
249451
+ ...declared,
249452
+ parameters: mergeParameters(item.parameters, declared.parameters)
249453
+ };
249454
+ return [
249455
+ {
249456
+ endpoint: `${method.toUpperCase()} ${path}`,
249457
+ method: method.toUpperCase(),
249458
+ path,
249459
+ summary: operation.summary ?? "",
249460
+ description: operation.description ?? "",
249461
+ parameterText: parameterText(operation),
249462
+ readOnly: isReadOnly(operation, spec),
249463
+ operation
249464
+ }
249465
+ ];
249466
+ }));
249467
+ }
249468
+ function pathSegments(path) {
249469
+ const pathname = path.split(/[?#]/, 1)[0] ?? "";
249470
+ return pathname.split("/").filter(Boolean);
249471
+ }
249472
+ function segmentPattern(segment) {
249473
+ const source = segment.split(/(\{[^}]+\})/).map((part) => part.startsWith("{") ? "[^/]+" : part.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("");
249474
+ return new RegExp(`^${source}$`);
249475
+ }
249476
+ function literalSegments(path) {
249477
+ return pathSegments(path).map((segment) => segment.includes("{") ? "0" : "1").join("");
249478
+ }
249479
+ function matchOperation(operations, method, concretePath) {
249480
+ const upperMethod = method.toUpperCase();
249481
+ const segments = pathSegments(concretePath);
249482
+ const candidates = operations.filter((op) => {
249483
+ if (op.method !== upperMethod) {
249484
+ return false;
249485
+ }
249486
+ const template = pathSegments(op.path);
249487
+ return template.length === segments.length && template.every((part, i) => segmentPattern(part).test(segments[i] ?? ""));
249488
+ });
249489
+ return candidates.sort((a, b) => literalSegments(b.path).localeCompare(literalSegments(a.path)))[0];
249486
249490
  }
249487
249491
  // src/core/api-spec/request.ts
249488
249492
  var MAX_ERROR_BODY_CHARS = 4000;
249493
+ var QUERY_STRING = /\?\S*/g;
249489
249494
  async function readBody(response) {
249490
249495
  try {
249491
249496
  const text = (await response.clone().text()).trim();
@@ -249500,7 +249505,8 @@ async function sendApiRequest(method, path, body) {
249500
249505
  method,
249501
249506
  body,
249502
249507
  headers: body === undefined ? {} : { "Content-Type": "application/json" },
249503
- timeout: false
249508
+ timeout: false,
249509
+ retry: { methods: ["get", "head"] }
249504
249510
  });
249505
249511
  return {
249506
249512
  status: response.status,
@@ -249510,18 +249516,23 @@ async function sendApiRequest(method, path, body) {
249510
249516
  } catch (error) {
249511
249517
  const apiError = await ApiError.fromHttpError(error, `calling ${method} ${path}`);
249512
249518
  const raw = error instanceof HTTPError ? await readBody(error.response) : undefined;
249513
- throw new ApiError(apiError.message, {
249514
- statusCode: apiError.statusCode,
249515
- requestUrl: apiError.requestUrl,
249516
- requestMethod: apiError.requestMethod,
249517
- requestId: apiError.requestId,
249518
- hints: apiError.hints,
249519
- details: raw ? [`Response body: ${raw}`] : apiError.details
249520
- });
249519
+ throw redactedApiError(apiError, raw, method, path);
249521
249520
  }
249522
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
+ }
249523
249534
  // src/core/api-spec/spec.ts
249524
- import { rename, stat as stat3 } from "node:fs/promises";
249535
+ import { rename, rm, stat as stat3 } from "node:fs/promises";
249525
249536
  import { join as join22 } from "node:path";
249526
249537
  var SPEC_CACHE_TTL_MS = 60 * 60 * 1000;
249527
249538
  function getSpecCachePath(apiUrl = getBase44ApiUrl()) {
@@ -249576,8 +249587,14 @@ async function loadSpec(options = {}) {
249576
249587
  const text = await downloadSpec();
249577
249588
  const spec = parseSpec(text);
249578
249589
  const partial = `${path}.${process.pid}.tmp`;
249579
- await writeFile(partial, text);
249580
- 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
+ }
249581
249598
  return { text, spec };
249582
249599
  }
249583
249600
  // src/cli/commands/api/shared.ts
@@ -249633,6 +249650,19 @@ async function readRequestBody(flag, log) {
249633
249650
  }
249634
249651
  return flag;
249635
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
+ }
249636
249666
 
249637
249667
  // src/cli/commands/api/catalog.ts
249638
249668
  async function catalogAction(ctx, area, options) {
@@ -249657,7 +249687,7 @@ async function findOperation(ctx, method, path, { refresh, flag }) {
249657
249687
  const { spec } = await loadSpecTask(ctx, refresh);
249658
249688
  const op = matchOperation(listOperations(spec), method, path);
249659
249689
  if (!op) {
249660
- 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)}.`, {
249661
249691
  hints: [
249662
249692
  {
249663
249693
  message: "The cached spec may predate this route; fetch it again",
@@ -249711,6 +249741,9 @@ async function formatResponse({ status, contentType, body }, output, jsonMode) {
249711
249741
  }
249712
249742
  }
249713
249743
  async function fetchAction(ctx, methodArg, path, options, command) {
249744
+ ctx.errorReporter.setContext({
249745
+ command: reportedFetchCommand(methodArg ?? "", path ?? "", { ...options })
249746
+ });
249714
249747
  if (!methodArg || !path) {
249715
249748
  if (options.help) {
249716
249749
  const usage = command.helpInformation();
@@ -249735,13 +249768,6 @@ async function fetchAction(ctx, methodArg, path, options, command) {
249735
249768
  throw new InvalidInputError(`Refused under --read-only: ${op.method} ${op.path} is not a read-only operation. Nothing was sent.`);
249736
249769
  }
249737
249770
  }
249738
- ctx.errorReporter.setContext({
249739
- command: {
249740
- name: "api fetch",
249741
- args: [method, path.split("?", 1)[0] ?? ""],
249742
- options: { ...options, body: options.body && "[not reported]" }
249743
- }
249744
- });
249745
249771
  await ensureAuth(ctx);
249746
249772
  const body = await readRequestBody(options.body, ctx.log);
249747
249773
  const response = await ctx.runTask(`Calling ${method} ${path}`, () => sendApiRequest(method, path, body), {
@@ -249778,11 +249804,9 @@ async function grepAction(ctx, pattern, options) {
249778
249804
  if (options.readOnly) {
249779
249805
  operations = operations.filter((op) => op.readOnly);
249780
249806
  }
249781
- const narrowed = options.area !== undefined || options.readOnly === true;
249782
- const hits = grepSpec(spec, operations, pattern, {
249807
+ const hits = grepOperations(spec, operations, pattern, {
249783
249808
  ignoreCase: options.ignoreCase,
249784
- limit,
249785
- schemas: !narrowed
249809
+ limit
249786
249810
  });
249787
249811
  return { stdout: formatJson(hits) };
249788
249812
  }
@@ -249790,7 +249814,7 @@ function getApiGrepCommand() {
249790
249814
  return new Base44Command("grep", {
249791
249815
  requireAuth: false,
249792
249816
  requireAppContext: false
249793
- }).description("Search the API spec with a regular expression, for when search misses").argument("<pattern>", 'Regular expression, e.g. "runs.*status"').option("--area <area>", "Search only one area's operations (see base44 api catalog)").option("-i, --ignore-case", "Case-insensitive match").option("--limit <n>", "Most operations or schemas to return (default 20)").option("--read-only", READ_ONLY_FILTER_HELP).option("--refresh", REFRESH_OPTION_HELP).action(grepAction);
249817
+ }).description("Search the API spec with a regular expression, for when search misses").argument("<pattern>", 'Regular expression, e.g. "runs.*status"').option("--area <area>", "Search only one area's operations (see base44 api catalog)").option("-i, --ignore-case", "Case-insensitive match").option("--limit <n>", "Most operations to return (default 20)").option("--read-only", READ_ONLY_FILTER_HELP).option("--refresh", REFRESH_OPTION_HELP).action(grepAction);
249794
249818
  }
249795
249819
 
249796
249820
  // src/cli/commands/api/search.ts
@@ -262350,7 +262374,7 @@ var nativeEnumType = ZodNativeEnum.create;
262350
262374
  var promiseType = ZodPromise.create;
262351
262375
  var effectsType = ZodEffects.create;
262352
262376
  var optionalType = ZodOptional2.create;
262353
- var nullableType = ZodNullable2.create;
262377
+ var nullableType2 = ZodNullable2.create;
262354
262378
  var preprocessType = ZodEffects.createWithPreprocess;
262355
262379
  var pipelineType = ZodPipeline.create;
262356
262380
  // ../functions-compiler/src/contracts.ts
@@ -262380,7 +262404,7 @@ var bundleAppRequestSchema = objectType({
262380
262404
  var ACTIVATION_MODE = "pull";
262381
262405
 
262382
262406
  // ../functions-compiler/src/deno-bundle.ts
262383
- import { mkdtemp, rm, writeFile as writeFile2 } from "node:fs/promises";
262407
+ import { mkdtemp, rm as rm2, writeFile as writeFile2 } from "node:fs/promises";
262384
262408
  import { tmpdir as tmpdir2 } from "node:os";
262385
262409
  import path21 from "node:path";
262386
262410
 
@@ -262987,7 +263011,7 @@ async function bundleToModule(prepared, nodeModulesDir = "none") {
262987
263011
  warnings: result.warnings.map((w) => w.text)
262988
263012
  };
262989
263013
  } finally {
262990
- await rm(dir, { recursive: true, force: true });
263014
+ await rm2(dir, { recursive: true, force: true });
262991
263015
  }
262992
263016
  }
262993
263017
  function buildFailureErrors(e, dir) {
@@ -273352,4 +273376,4 @@ export {
273352
273376
  runCLI
273353
273377
  };
273354
273378
 
273355
- //# debugId=47D4434C61AEF7C764756E2164756E21
273379
+ //# debugId=45DA033B3116B4E664756E2164756E21