@base44-preview/cli 0.0.29-pr.215.46bb898 → 0.0.29-pr.218.c1fc196
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 +33 -11
- package/dist/cli/index.js.map +5 -5
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -152313,7 +152313,7 @@ var ApiErrorResponseSchema = exports_external.object({
|
|
|
152313
152313
|
exports_external.array(exports_external.unknown())
|
|
152314
152314
|
]).nullable().optional(),
|
|
152315
152315
|
traceback: exports_external.string().nullable().optional(),
|
|
152316
|
-
extra_data: exports_external.string().optional().nullable()
|
|
152316
|
+
extra_data: exports_external.record(exports_external.string(), exports_external.unknown()).optional().nullable()
|
|
152317
152317
|
});
|
|
152318
152318
|
|
|
152319
152319
|
// src/core/errors.ts
|
|
@@ -152420,8 +152420,8 @@ class ApiError extends SystemError {
|
|
|
152420
152420
|
requestMethod;
|
|
152421
152421
|
requestBody;
|
|
152422
152422
|
responseBody;
|
|
152423
|
-
constructor(message, options) {
|
|
152424
|
-
const hints = options?.hints ?? ApiError.getDefaultHints(options?.statusCode);
|
|
152423
|
+
constructor(message, options, parsedResponse) {
|
|
152424
|
+
const hints = options?.hints ?? ApiError.getReasonHints(parsedResponse) ?? ApiError.getDefaultHints(options?.statusCode);
|
|
152425
152425
|
super(message, { hints, cause: options?.cause });
|
|
152426
152426
|
this.statusCode = options?.statusCode;
|
|
152427
152427
|
this.requestUrl = options?.requestUrl;
|
|
@@ -152433,9 +152433,14 @@ class ApiError extends SystemError {
|
|
|
152433
152433
|
if (error48 instanceof HTTPError) {
|
|
152434
152434
|
let message;
|
|
152435
152435
|
let responseBody;
|
|
152436
|
+
let parsedErrorResponse;
|
|
152436
152437
|
try {
|
|
152437
152438
|
responseBody = await error48.response.clone().json();
|
|
152438
152439
|
message = formatApiError(responseBody);
|
|
152440
|
+
const parsed = ApiErrorResponseSchema.safeParse(responseBody);
|
|
152441
|
+
if (parsed.success) {
|
|
152442
|
+
parsedErrorResponse = parsed.data;
|
|
152443
|
+
}
|
|
152439
152444
|
} catch {
|
|
152440
152445
|
message = error48.message;
|
|
152441
152446
|
}
|
|
@@ -152447,7 +152452,7 @@ class ApiError extends SystemError {
|
|
|
152447
152452
|
requestBody,
|
|
152448
152453
|
responseBody,
|
|
152449
152454
|
cause: error48
|
|
152450
|
-
});
|
|
152455
|
+
}, parsedErrorResponse);
|
|
152451
152456
|
}
|
|
152452
152457
|
if (error48 instanceof Error) {
|
|
152453
152458
|
return new ApiError(`Error ${context}: ${error48.message}`, {
|
|
@@ -152466,8 +152471,31 @@ class ApiError extends SystemError {
|
|
|
152466
152471
|
if (statusCode === 404) {
|
|
152467
152472
|
return [{ message: "The requested resource was not found" }];
|
|
152468
152473
|
}
|
|
152474
|
+
if (statusCode === 428) {
|
|
152475
|
+
return [
|
|
152476
|
+
{
|
|
152477
|
+
message: "The server rejected the request due to a precondition failure. Check the error message above for details"
|
|
152478
|
+
}
|
|
152479
|
+
];
|
|
152480
|
+
}
|
|
152469
152481
|
return [{ message: "Check your network connection and try again" }];
|
|
152470
152482
|
}
|
|
152483
|
+
static getReasonHints(parsedResponse) {
|
|
152484
|
+
const REASON_HINTS = {
|
|
152485
|
+
requires_backend_platform_app: [
|
|
152486
|
+
{
|
|
152487
|
+
message: "This feature requires an app created with the Base44 CLI. Remove `base44/.app.jsonc` and run 'base44 link' to connect your project to a CLI-created app."
|
|
152488
|
+
},
|
|
152489
|
+
{
|
|
152490
|
+
message: "Read more at https://docs.base44.com/developers/backend/overview/introduction"
|
|
152491
|
+
}
|
|
152492
|
+
]
|
|
152493
|
+
};
|
|
152494
|
+
const reason = parsedResponse?.extra_data?.reason;
|
|
152495
|
+
if (typeof reason !== "string")
|
|
152496
|
+
return;
|
|
152497
|
+
return REASON_HINTS[reason];
|
|
152498
|
+
}
|
|
152471
152499
|
}
|
|
152472
152500
|
|
|
152473
152501
|
class FileNotFoundError extends SystemError {
|
|
@@ -153886,12 +153914,6 @@ async function syncEntities(entities) {
|
|
|
153886
153914
|
}
|
|
153887
153915
|
});
|
|
153888
153916
|
} catch (error48) {
|
|
153889
|
-
if (error48 instanceof HTTPError && error48.response.status === 428) {
|
|
153890
|
-
throw new ApiError("Cannot delete entity that has existing records", {
|
|
153891
|
-
statusCode: 428,
|
|
153892
|
-
cause: error48
|
|
153893
|
-
});
|
|
153894
|
-
}
|
|
153895
153917
|
throw await ApiError.fromHttpError(error48, "syncing entities");
|
|
153896
153918
|
}
|
|
153897
153919
|
const result = SyncEntitiesResponseSchema.safeParse(await response.json());
|
|
@@ -174453,4 +174475,4 @@ export {
|
|
|
174453
174475
|
CLIExitError
|
|
174454
174476
|
};
|
|
174455
174477
|
|
|
174456
|
-
//# debugId=
|
|
174478
|
+
//# debugId=F76B677080E81DB264756E2164756E21
|