@base44-preview/cli 0.0.36-pr.355.6973e5e → 0.0.36-pr.355.de61fc4

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
@@ -225896,47 +225896,34 @@ function getTestOverrides() {
225896
225896
  }
225897
225897
 
225898
225898
  // src/core/clients/schemas.ts
225899
- var ApiErrorResponseSchema = exports_external.object({
225900
- error_type: exports_external.string().optional(),
225901
- message: exports_external.union([exports_external.string(), exports_external.record(exports_external.string(), exports_external.unknown())]).nullable().optional(),
225902
- detail: exports_external.union([
225903
- exports_external.string(),
225904
- exports_external.record(exports_external.string(), exports_external.unknown()),
225905
- exports_external.array(exports_external.unknown())
225906
- ]).nullable().optional(),
225907
- traceback: exports_external.string().nullable().optional(),
225899
+ var ApiErrorResponseSchema = exports_external.looseObject({
225900
+ message: exports_external.unknown().optional(),
225901
+ detail: exports_external.unknown().optional(),
225908
225902
  extra_data: exports_external.looseObject({
225909
- reason: exports_external.string().optional(),
225910
- errors: exports_external.array(exports_external.union([
225911
- exports_external.object({ name: exports_external.string(), message: exports_external.string() }),
225912
- exports_external.string()
225913
- ])).optional()
225914
- }).optional().nullable()
225903
+ reason: exports_external.string().optional().catch(undefined),
225904
+ errors: exports_external.array(exports_external.looseObject({ name: exports_external.string(), message: exports_external.string() })).optional().catch(undefined)
225905
+ }).optional().nullable().catch(undefined)
225915
225906
  });
225916
225907
 
225917
225908
  // src/core/errors.ts
225918
- function formatApiError(errorBody) {
225919
- const result = ApiErrorResponseSchema.safeParse(errorBody);
225920
- if (result.success) {
225921
- const { message, detail } = result.data;
225922
- const content = message ?? detail;
225923
- if (typeof content === "string") {
225909
+ function formatApiError(errorBody, parsed) {
225910
+ const data = parsed ?? ApiErrorResponseSchema.safeParse(errorBody).data;
225911
+ if (data) {
225912
+ const content = data.message ?? data.detail;
225913
+ if (typeof content === "string")
225924
225914
  return content;
225925
- }
225926
- if (content !== undefined) {
225915
+ if (content !== undefined)
225927
225916
  return JSON.stringify(content, null, 2);
225928
- }
225929
225917
  }
225930
- if (typeof errorBody === "string") {
225918
+ if (typeof errorBody === "string")
225931
225919
  return errorBody;
225932
- }
225933
225920
  return JSON.stringify(errorBody, null, 2);
225934
225921
  }
225935
225922
  function parseErrorDetails(extraData) {
225936
225923
  const errors3 = extraData?.errors;
225937
225924
  if (!errors3 || errors3.length === 0)
225938
225925
  return;
225939
- return errors3.map((item) => typeof item === "string" ? item : item.name ? `${item.name}: ${item.message}` : item.message);
225926
+ return errors3.map((e2) => `${e2.name}: ${e2.message}`);
225940
225927
  }
225941
225928
 
225942
225929
  class CLIError extends Error {
@@ -226057,11 +226044,12 @@ class ApiError extends SystemError {
226057
226044
  let details;
226058
226045
  try {
226059
226046
  responseBody = await error48.response.clone().json();
226060
- message = formatApiError(responseBody);
226061
226047
  const parsed = ApiErrorResponseSchema.safeParse(responseBody);
226062
- if (parsed.success) {
226063
- hints = ApiError.getReasonHints(parsed.data);
226064
- details = parseErrorDetails(parsed.data.extra_data);
226048
+ const parsedData = parsed.success ? parsed.data : undefined;
226049
+ message = formatApiError(responseBody, parsedData);
226050
+ if (parsedData) {
226051
+ hints = ApiError.getReasonHints(parsedData);
226052
+ details = parseErrorDetails(parsedData.extra_data);
226065
226053
  }
226066
226054
  } catch {
226067
226055
  message = error48.message;
@@ -226132,7 +226120,7 @@ class ApiError extends SystemError {
226132
226120
  }
226133
226121
  ]
226134
226122
  };
226135
- const reason = parsedResponse?.extra_data?.reason;
226123
+ const reason = parsedResponse.extra_data?.reason;
226136
226124
  if (typeof reason !== "string")
226137
226125
  return;
226138
226126
  return REASON_HINTS[reason];
@@ -241721,7 +241709,7 @@ function displayError(error48) {
241721
241709
  R2.error(errorMessage);
241722
241710
  if (isCLIError(error48)) {
241723
241711
  if (error48.details.length > 0) {
241724
- R2.error(theme.format.details(error48.details));
241712
+ R2.info(theme.format.details(error48.details));
241725
241713
  }
241726
241714
  const hints = theme.format.agentHints(error48.hints);
241727
241715
  if (hints) {
@@ -248717,4 +248705,4 @@ export {
248717
248705
  CLIExitError
248718
248706
  };
248719
248707
 
248720
- //# debugId=8F6EC7A541FD9CD264756E2164756E21
248708
+ //# debugId=D0BF76099731C25564756E2164756E21