@base44-preview/cli 0.0.40-pr.380.5d40f28 → 0.0.40-pr.381.45f0726
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 +64 -47
- package/dist/cli/index.js.map +8 -7
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -233907,21 +233907,6 @@ var DeployFunctionsResponseSchema = exports_external.object({
|
|
|
233907
233907
|
skipped: exports_external.array(exports_external.string()).optional().nullable(),
|
|
233908
233908
|
errors: exports_external.array(exports_external.object({ name: exports_external.string(), message: exports_external.string() })).nullable()
|
|
233909
233909
|
});
|
|
233910
|
-
var FunctionAutomationInfoSchema = exports_external.object({
|
|
233911
|
-
name: exports_external.string(),
|
|
233912
|
-
type: exports_external.string(),
|
|
233913
|
-
is_active: exports_external.boolean()
|
|
233914
|
-
});
|
|
233915
|
-
var FunctionInfoSchema = exports_external.object({
|
|
233916
|
-
name: exports_external.string(),
|
|
233917
|
-
deployment_id: exports_external.string(),
|
|
233918
|
-
entry: exports_external.string(),
|
|
233919
|
-
files: exports_external.array(FunctionFileSchema),
|
|
233920
|
-
automations: exports_external.array(FunctionAutomationInfoSchema)
|
|
233921
|
-
});
|
|
233922
|
-
var ListFunctionsResponseSchema = exports_external.object({
|
|
233923
|
-
functions: exports_external.array(FunctionInfoSchema)
|
|
233924
|
-
});
|
|
233925
233910
|
var LogLevelSchema = exports_external.enum(["info", "warning", "error", "debug"]);
|
|
233926
233911
|
var FunctionLogEntrySchema = exports_external.object({
|
|
233927
233912
|
time: exports_external.string(),
|
|
@@ -233959,19 +233944,15 @@ async function deployFunctions(functions) {
|
|
|
233959
233944
|
}
|
|
233960
233945
|
return result.data;
|
|
233961
233946
|
}
|
|
233962
|
-
async function
|
|
233947
|
+
async function deleteSingleFunction(name2) {
|
|
233963
233948
|
const appClient = getAppClient();
|
|
233964
|
-
let response;
|
|
233965
233949
|
try {
|
|
233966
|
-
|
|
233950
|
+
await appClient.delete(`backend-functions/${encodeURIComponent(name2)}`, {
|
|
233951
|
+
timeout: 60000
|
|
233952
|
+
});
|
|
233967
233953
|
} catch (error48) {
|
|
233968
|
-
throw await ApiError.fromHttpError(error48,
|
|
233954
|
+
throw await ApiError.fromHttpError(error48, `deleting function "${name2}"`);
|
|
233969
233955
|
}
|
|
233970
|
-
const result = ListFunctionsResponseSchema.safeParse(await response.json());
|
|
233971
|
-
if (!result.success) {
|
|
233972
|
-
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
233973
|
-
}
|
|
233974
|
-
return result.data;
|
|
233975
233956
|
}
|
|
233976
233957
|
function buildLogsQueryString(filters) {
|
|
233977
233958
|
const params = new URLSearchParams;
|
|
@@ -243144,6 +243125,63 @@ function getEntitiesPushCommand(context) {
|
|
|
243144
243125
|
}));
|
|
243145
243126
|
}
|
|
243146
243127
|
|
|
243128
|
+
// src/cli/utils/parseNames.ts
|
|
243129
|
+
function parseNames(args) {
|
|
243130
|
+
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
243131
|
+
}
|
|
243132
|
+
|
|
243133
|
+
// src/cli/commands/functions/delete.ts
|
|
243134
|
+
async function deleteFunctionsAction(names) {
|
|
243135
|
+
let deleted = 0;
|
|
243136
|
+
let notFound = 0;
|
|
243137
|
+
let errors4 = 0;
|
|
243138
|
+
let completed = 0;
|
|
243139
|
+
const total = names.length;
|
|
243140
|
+
for (const name2 of names) {
|
|
243141
|
+
R2.step(theme.styles.dim(`[${completed + 1}/${total}] Deleting ${name2}...`));
|
|
243142
|
+
try {
|
|
243143
|
+
await deleteSingleFunction(name2);
|
|
243144
|
+
R2.success(`${name2.padEnd(25)} deleted`);
|
|
243145
|
+
deleted++;
|
|
243146
|
+
} catch (error48) {
|
|
243147
|
+
if (error48 instanceof ApiError && error48.statusCode === 404) {
|
|
243148
|
+
R2.warn(`${name2.padEnd(25)} not found`);
|
|
243149
|
+
notFound++;
|
|
243150
|
+
} else {
|
|
243151
|
+
R2.error(`${name2.padEnd(25)} error: ${error48 instanceof Error ? error48.message : String(error48)}`);
|
|
243152
|
+
errors4++;
|
|
243153
|
+
}
|
|
243154
|
+
}
|
|
243155
|
+
completed++;
|
|
243156
|
+
}
|
|
243157
|
+
if (names.length === 1) {
|
|
243158
|
+
if (deleted)
|
|
243159
|
+
return { outroMessage: `Function "${names[0]}" deleted` };
|
|
243160
|
+
if (notFound)
|
|
243161
|
+
return { outroMessage: `Function "${names[0]}" not found` };
|
|
243162
|
+
return { outroMessage: `Failed to delete "${names[0]}"` };
|
|
243163
|
+
}
|
|
243164
|
+
const parts = [];
|
|
243165
|
+
if (deleted > 0)
|
|
243166
|
+
parts.push(`${deleted}/${total} deleted`);
|
|
243167
|
+
if (notFound > 0)
|
|
243168
|
+
parts.push(`${notFound} not found`);
|
|
243169
|
+
if (errors4 > 0)
|
|
243170
|
+
parts.push(`${errors4} error${errors4 !== 1 ? "s" : ""}`);
|
|
243171
|
+
return { outroMessage: parts.join(", ") };
|
|
243172
|
+
}
|
|
243173
|
+
function getDeleteCommand(context) {
|
|
243174
|
+
return new Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").action(async (rawNames) => {
|
|
243175
|
+
await runCommand(() => {
|
|
243176
|
+
const names = parseNames(rawNames);
|
|
243177
|
+
if (names.length === 0) {
|
|
243178
|
+
throw new InvalidInputError("At least one function name is required");
|
|
243179
|
+
}
|
|
243180
|
+
return deleteFunctionsAction(names);
|
|
243181
|
+
}, { requireAuth: true }, context);
|
|
243182
|
+
});
|
|
243183
|
+
}
|
|
243184
|
+
|
|
243147
243185
|
// src/cli/commands/functions/deploy.ts
|
|
243148
243186
|
async function deployFunctionsAction() {
|
|
243149
243187
|
const { functions } = await readProjectConfig();
|
|
@@ -243182,30 +243220,9 @@ function getDeployCommand(context) {
|
|
|
243182
243220
|
});
|
|
243183
243221
|
}
|
|
243184
243222
|
|
|
243185
|
-
// src/cli/commands/functions/list.ts
|
|
243186
|
-
async function listFunctionsAction() {
|
|
243187
|
-
const { functions } = await listDeployedFunctions();
|
|
243188
|
-
if (functions.length === 0) {
|
|
243189
|
-
return { outroMessage: "No functions on remote" };
|
|
243190
|
-
}
|
|
243191
|
-
for (const fn of functions) {
|
|
243192
|
-
const autoCount = fn.automations.length;
|
|
243193
|
-
const autoLabel = autoCount > 0 ? theme.styles.dim(` (${autoCount} automation${autoCount > 1 ? "s" : ""})`) : "";
|
|
243194
|
-
R2.message(` ${fn.name}${autoLabel}`);
|
|
243195
|
-
}
|
|
243196
|
-
return {
|
|
243197
|
-
outroMessage: `${functions.length} function${functions.length !== 1 ? "s" : ""} on remote`
|
|
243198
|
-
};
|
|
243199
|
-
}
|
|
243200
|
-
function getListCommand(context) {
|
|
243201
|
-
return new Command("list").description("List all deployed functions").action(async () => {
|
|
243202
|
-
await runCommand(listFunctionsAction, { requireAuth: true }, context);
|
|
243203
|
-
});
|
|
243204
|
-
}
|
|
243205
|
-
|
|
243206
243223
|
// src/cli/commands/functions/index.ts
|
|
243207
243224
|
function getFunctionsCommand(context) {
|
|
243208
|
-
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(
|
|
243225
|
+
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getDeleteCommand(context));
|
|
243209
243226
|
}
|
|
243210
243227
|
|
|
243211
243228
|
// src/cli/commands/project/create.ts
|
|
@@ -250936,4 +250953,4 @@ export {
|
|
|
250936
250953
|
CLIExitError
|
|
250937
250954
|
};
|
|
250938
250955
|
|
|
250939
|
-
//# debugId=
|
|
250956
|
+
//# debugId=8B4B4D40C4BDE4A964756E2164756E21
|