base44 0.0.29 → 0.0.30
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 +86 -22
- package/dist/cli/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="
|
|
1
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="019c4309-9867-7531-b423-92af32bd6dcb")}catch(e){}}();import { createRequire } from "node:module";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __getProtoOf = Object.getPrototypeOf;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -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());
|
|
@@ -153938,22 +153960,63 @@ var FunctionFileSchema = exports_external.object({
|
|
|
153938
153960
|
path: exports_external.string().min(1),
|
|
153939
153961
|
content: exports_external.string()
|
|
153940
153962
|
});
|
|
153963
|
+
var AutomationBaseSchema = exports_external.object({
|
|
153964
|
+
name: exports_external.string().min(1, "Automation name cannot be empty"),
|
|
153965
|
+
description: exports_external.string().nullable().optional(),
|
|
153966
|
+
function_args: exports_external.record(exports_external.string(), exports_external.unknown()).nullable().optional(),
|
|
153967
|
+
is_active: exports_external.boolean().optional().default(true)
|
|
153968
|
+
});
|
|
153969
|
+
var ScheduledOneTimeSchema = AutomationBaseSchema.extend({
|
|
153970
|
+
type: exports_external.literal("scheduled"),
|
|
153971
|
+
schedule_mode: exports_external.literal("one-time"),
|
|
153972
|
+
one_time_date: exports_external.string().min(1, "One-time date is required for one-time schedules")
|
|
153973
|
+
});
|
|
153974
|
+
var ScheduledCronSchema = AutomationBaseSchema.extend({
|
|
153975
|
+
type: exports_external.literal("scheduled"),
|
|
153976
|
+
schedule_mode: exports_external.literal("recurring"),
|
|
153977
|
+
schedule_type: exports_external.literal("cron"),
|
|
153978
|
+
cron_expression: exports_external.string().min(1, "Cron expression is required for cron schedules"),
|
|
153979
|
+
ends_type: exports_external.enum(["never", "on", "after"]).optional().default("never"),
|
|
153980
|
+
ends_on_date: exports_external.string().nullable().optional(),
|
|
153981
|
+
ends_after_count: exports_external.number().int().positive().nullable().optional()
|
|
153982
|
+
});
|
|
153983
|
+
var ScheduledSimpleSchema = AutomationBaseSchema.extend({
|
|
153984
|
+
type: exports_external.literal("scheduled"),
|
|
153985
|
+
schedule_mode: exports_external.literal("recurring"),
|
|
153986
|
+
schedule_type: exports_external.literal("simple"),
|
|
153987
|
+
repeat_unit: exports_external.enum(["minutes", "hours", "days", "weeks", "months"]),
|
|
153988
|
+
repeat_interval: exports_external.number().int().positive().optional(),
|
|
153989
|
+
start_time: exports_external.string().nullable().optional(),
|
|
153990
|
+
repeat_on_days: exports_external.array(exports_external.number().int().min(0).max(6)).nullable().optional(),
|
|
153991
|
+
repeat_on_day_of_month: exports_external.number().int().min(1).max(31).nullable().optional(),
|
|
153992
|
+
ends_type: exports_external.enum(["never", "on", "after"]).optional().default("never"),
|
|
153993
|
+
ends_on_date: exports_external.string().nullable().optional(),
|
|
153994
|
+
ends_after_count: exports_external.number().int().positive().nullable().optional()
|
|
153995
|
+
});
|
|
153996
|
+
var EntityAutomationSchema = AutomationBaseSchema.extend({
|
|
153997
|
+
type: exports_external.literal("entity"),
|
|
153998
|
+
entity_name: exports_external.string().min(1, "Entity name cannot be empty"),
|
|
153999
|
+
event_types: exports_external.array(exports_external.enum(["create", "update", "delete"])).min(1, "At least one event type is required")
|
|
154000
|
+
});
|
|
154001
|
+
var AutomationSchema = exports_external.union([
|
|
154002
|
+
ScheduledOneTimeSchema,
|
|
154003
|
+
ScheduledCronSchema,
|
|
154004
|
+
ScheduledSimpleSchema,
|
|
154005
|
+
EntityAutomationSchema
|
|
154006
|
+
]);
|
|
153941
154007
|
var FunctionConfigSchema = exports_external.object({
|
|
153942
154008
|
name: FunctionNameSchema,
|
|
153943
|
-
entry: exports_external.string().min(1, "Entry point cannot be empty")
|
|
154009
|
+
entry: exports_external.string().min(1, "Entry point cannot be empty"),
|
|
154010
|
+
automations: exports_external.array(AutomationSchema).optional()
|
|
153944
154011
|
});
|
|
153945
154012
|
var BackendFunctionSchema = FunctionConfigSchema.extend({
|
|
153946
154013
|
entryPath: exports_external.string().min(1, "Entry path cannot be empty"),
|
|
153947
154014
|
filePaths: exports_external.array(exports_external.string()).min(1, "Function must have at least one file")
|
|
153948
154015
|
});
|
|
153949
|
-
var FunctionDeploySchema = exports_external.object({
|
|
153950
|
-
name: FunctionNameSchema,
|
|
153951
|
-
entry: exports_external.string().min(1),
|
|
153952
|
-
files: exports_external.array(FunctionFileSchema).min(1, "Function must have at least one file")
|
|
153953
|
-
});
|
|
153954
154016
|
var DeployFunctionsResponseSchema = exports_external.object({
|
|
153955
154017
|
deployed: exports_external.array(exports_external.string()),
|
|
153956
154018
|
deleted: exports_external.array(exports_external.string()),
|
|
154019
|
+
skipped: exports_external.array(exports_external.string()).optional().nullable(),
|
|
153957
154020
|
errors: exports_external.array(exports_external.object({ name: exports_external.string(), message: exports_external.string() })).nullable()
|
|
153958
154021
|
});
|
|
153959
154022
|
|
|
@@ -153962,7 +154025,8 @@ function toDeployPayloadItem(fn) {
|
|
|
153962
154025
|
return {
|
|
153963
154026
|
name: fn.name,
|
|
153964
154027
|
entry: fn.entry,
|
|
153965
|
-
files: fn.files
|
|
154028
|
+
files: fn.files,
|
|
154029
|
+
automations: fn.automations
|
|
153966
154030
|
};
|
|
153967
154031
|
}
|
|
153968
154032
|
async function deployFunctions(functions) {
|
|
@@ -154038,7 +154102,7 @@ async function loadFunctionCode(fn) {
|
|
|
154038
154102
|
}
|
|
154039
154103
|
async function pushFunctions(functions) {
|
|
154040
154104
|
if (functions.length === 0) {
|
|
154041
|
-
return { deployed: [], deleted: [], errors: null };
|
|
154105
|
+
return { deployed: [], deleted: [], skipped: [], errors: null };
|
|
154042
154106
|
}
|
|
154043
154107
|
const functionsWithCode = await Promise.all(functions.map(loadFunctionCode));
|
|
154044
154108
|
return deployFunctions(functionsWithCode);
|
|
@@ -168629,7 +168693,7 @@ var {
|
|
|
168629
168693
|
// package.json
|
|
168630
168694
|
var package_default = {
|
|
168631
168695
|
name: "base44",
|
|
168632
|
-
version: "0.0.
|
|
168696
|
+
version: "0.0.30",
|
|
168633
168697
|
description: "Base44 CLI - Unified interface for managing Base44 applications",
|
|
168634
168698
|
type: "module",
|
|
168635
168699
|
bin: {
|
|
@@ -174453,6 +174517,6 @@ export {
|
|
|
174453
174517
|
CLIExitError
|
|
174454
174518
|
};
|
|
174455
174519
|
|
|
174456
|
-
//# debugId=
|
|
174520
|
+
//# debugId=AB7E11E3B94218E864756E2164756E21
|
|
174457
174521
|
|
|
174458
|
-
//# chunkId=
|
|
174522
|
+
//# chunkId=019c4309-9867-7531-b423-92af32bd6dcb
|