@base44-preview/cli 0.0.33-pr.338.6928fe5 → 0.0.33-pr.338.e51b50f
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 +80 -78
- package/dist/cli/index.js.map +12 -10
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -186006,12 +186006,6 @@ var BackendFunctionSchema = FunctionConfigSchema.extend({
|
|
|
186006
186006
|
entryPath: exports_external.string().min(1, "Entry path cannot be empty"),
|
|
186007
186007
|
filePaths: exports_external.array(exports_external.string()).min(1, "Function must have at least one file")
|
|
186008
186008
|
});
|
|
186009
|
-
var DeployFunctionsResponseSchema = exports_external.object({
|
|
186010
|
-
deployed: exports_external.array(exports_external.string()),
|
|
186011
|
-
deleted: exports_external.array(exports_external.string()),
|
|
186012
|
-
skipped: exports_external.array(exports_external.string()).optional().nullable(),
|
|
186013
|
-
errors: exports_external.array(exports_external.object({ name: exports_external.string(), message: exports_external.string() })).nullable()
|
|
186014
|
-
});
|
|
186015
186009
|
var DeploySingleFunctionResponseSchema = exports_external.object({
|
|
186016
186010
|
status: exports_external.enum(["deployed", "unchanged"]),
|
|
186017
186011
|
duration_ms: exports_external.number().optional().nullable()
|
|
@@ -186140,26 +186134,12 @@ async function deployOne(fn) {
|
|
|
186140
186134
|
async function pushFunctionsSingle(functions, options) {
|
|
186141
186135
|
if (functions.length === 0)
|
|
186142
186136
|
return [];
|
|
186143
|
-
const concurrency = options?.concurrency ?? 1;
|
|
186144
|
-
if (concurrency <= 1) {
|
|
186145
|
-
const results2 = [];
|
|
186146
|
-
for (const fn of functions) {
|
|
186147
|
-
options?.onStart?.([fn.name]);
|
|
186148
|
-
const result = await deployOne(fn);
|
|
186149
|
-
results2.push(result);
|
|
186150
|
-
options?.onResult?.(result);
|
|
186151
|
-
}
|
|
186152
|
-
return results2;
|
|
186153
|
-
}
|
|
186154
186137
|
const results = [];
|
|
186155
|
-
for (
|
|
186156
|
-
|
|
186157
|
-
|
|
186158
|
-
|
|
186159
|
-
|
|
186160
|
-
results.push(result);
|
|
186161
|
-
options?.onResult?.(result);
|
|
186162
|
-
}
|
|
186138
|
+
for (const fn of functions) {
|
|
186139
|
+
options?.onStart?.([fn.name]);
|
|
186140
|
+
const result = await deployOne(fn);
|
|
186141
|
+
results.push(result);
|
|
186142
|
+
options?.onResult?.(result);
|
|
186163
186143
|
}
|
|
186164
186144
|
return results;
|
|
186165
186145
|
}
|
|
@@ -195102,31 +195082,64 @@ function getEntitiesPushCommand(context) {
|
|
|
195102
195082
|
}));
|
|
195103
195083
|
}
|
|
195104
195084
|
|
|
195085
|
+
// src/cli/utils/parseNames.ts
|
|
195086
|
+
function parseNames(args) {
|
|
195087
|
+
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
195088
|
+
}
|
|
195089
|
+
|
|
195105
195090
|
// src/cli/commands/functions/delete.ts
|
|
195106
|
-
async function
|
|
195107
|
-
|
|
195108
|
-
|
|
195109
|
-
|
|
195110
|
-
|
|
195111
|
-
|
|
195112
|
-
|
|
195113
|
-
R2.
|
|
195114
|
-
|
|
195091
|
+
async function deleteFunctionsAction(names) {
|
|
195092
|
+
let deleted = 0;
|
|
195093
|
+
let notFound = 0;
|
|
195094
|
+
let errors4 = 0;
|
|
195095
|
+
for (const name2 of names) {
|
|
195096
|
+
try {
|
|
195097
|
+
await deleteSingleFunction(name2);
|
|
195098
|
+
R2.success(`${name2} deleted`);
|
|
195099
|
+
deleted++;
|
|
195100
|
+
} catch (error48) {
|
|
195101
|
+
if (error48 instanceof ApiError && error48.statusCode === 404) {
|
|
195102
|
+
R2.warn(`Function "${name2}" not found on remote`);
|
|
195103
|
+
notFound++;
|
|
195104
|
+
} else {
|
|
195105
|
+
R2.error(`${name2} error: ${error48 instanceof Error ? error48.message : String(error48)}`);
|
|
195106
|
+
errors4++;
|
|
195107
|
+
}
|
|
195115
195108
|
}
|
|
195116
|
-
throw error48;
|
|
195117
195109
|
}
|
|
195110
|
+
if (names.length === 1) {
|
|
195111
|
+
if (deleted)
|
|
195112
|
+
return { outroMessage: `Function "${names[0]}" deleted` };
|
|
195113
|
+
if (notFound)
|
|
195114
|
+
return { outroMessage: `Function "${names[0]}" not found` };
|
|
195115
|
+
return { outroMessage: `Failed to delete "${names[0]}"` };
|
|
195116
|
+
}
|
|
195117
|
+
const parts = [];
|
|
195118
|
+
if (deleted > 0)
|
|
195119
|
+
parts.push(`${deleted} deleted`);
|
|
195120
|
+
if (notFound > 0)
|
|
195121
|
+
parts.push(`${notFound} not found`);
|
|
195122
|
+
if (errors4 > 0)
|
|
195123
|
+
parts.push(`${errors4} error${errors4 !== 1 ? "s" : ""}`);
|
|
195124
|
+
return { outroMessage: parts.join(", ") };
|
|
195118
195125
|
}
|
|
195119
195126
|
function getDeleteCommand(context) {
|
|
195120
|
-
return new Command("delete").description("Delete
|
|
195121
|
-
await runCommand(() =>
|
|
195127
|
+
return new Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").action(async (rawNames) => {
|
|
195128
|
+
await runCommand(() => {
|
|
195129
|
+
const names = parseNames(rawNames);
|
|
195130
|
+
if (names.length === 0) {
|
|
195131
|
+
throw new InvalidInputError("At least one function name is required");
|
|
195132
|
+
}
|
|
195133
|
+
return deleteFunctionsAction(names);
|
|
195134
|
+
}, { requireAuth: true }, context);
|
|
195122
195135
|
});
|
|
195123
195136
|
}
|
|
195124
195137
|
|
|
195125
|
-
// src/cli/
|
|
195138
|
+
// src/cli/utils/formatDeployResult.ts
|
|
195126
195139
|
function formatDuration(ms) {
|
|
195127
195140
|
return `${(ms / 1000).toFixed(1)}s`;
|
|
195128
195141
|
}
|
|
195129
|
-
function
|
|
195142
|
+
function formatDeployResult(r) {
|
|
195130
195143
|
const label = r.name.padEnd(25);
|
|
195131
195144
|
if (r.status === "deployed") {
|
|
195132
195145
|
const timing = r.duration_ms ? theme.styles.dim(` (${formatDuration(r.duration_ms)})`) : "";
|
|
@@ -195137,13 +195150,24 @@ function formatResult(r) {
|
|
|
195137
195150
|
R2.error(`${label} error: ${r.error}`);
|
|
195138
195151
|
}
|
|
195139
195152
|
}
|
|
195140
|
-
|
|
195153
|
+
|
|
195154
|
+
// src/cli/commands/functions/deploy.ts
|
|
195155
|
+
async function deployFunctionsAction(names, options) {
|
|
195156
|
+
if (options.force && names.length > 0) {
|
|
195157
|
+
throw new InvalidInputError("--force cannot be used when specifying function names");
|
|
195158
|
+
}
|
|
195141
195159
|
const { functions } = await readProjectConfig();
|
|
195142
|
-
|
|
195143
|
-
if (
|
|
195144
|
-
|
|
195145
|
-
|
|
195160
|
+
let toDeploy;
|
|
195161
|
+
if (names.length > 0) {
|
|
195162
|
+
const notFound = names.filter((n2) => !functions.some((f) => f.name === n2));
|
|
195163
|
+
if (notFound.length > 0) {
|
|
195164
|
+
throw new InvalidInputError(`Function${notFound.length > 1 ? "s" : ""} not found in project: ${notFound.join(", ")}`);
|
|
195146
195165
|
}
|
|
195166
|
+
toDeploy = functions.filter((f) => names.includes(f.name));
|
|
195167
|
+
} else {
|
|
195168
|
+
toDeploy = functions;
|
|
195169
|
+
}
|
|
195170
|
+
if (toDeploy.length === 0) {
|
|
195147
195171
|
return {
|
|
195148
195172
|
outroMessage: "No functions found. Create functions in the 'functions' directory."
|
|
195149
195173
|
};
|
|
@@ -195152,20 +195176,19 @@ async function deployFunctionsAction(name2, options) {
|
|
|
195152
195176
|
let completed = 0;
|
|
195153
195177
|
const total = toDeploy.length;
|
|
195154
195178
|
const results = await pushFunctionsSingle(toDeploy, {
|
|
195155
|
-
|
|
195156
|
-
|
|
195157
|
-
const label = names.length === 1 ? names[0] : `${names.length} functions`;
|
|
195179
|
+
onStart: (startNames) => {
|
|
195180
|
+
const label = startNames.length === 1 ? startNames[0] : `${startNames.length} functions`;
|
|
195158
195181
|
R2.step(theme.styles.dim(`[${completed}/${total}] Deploying ${label}...`));
|
|
195159
195182
|
},
|
|
195160
195183
|
onResult: (r) => {
|
|
195161
195184
|
completed++;
|
|
195162
|
-
|
|
195185
|
+
formatDeployResult(r);
|
|
195163
195186
|
}
|
|
195164
195187
|
});
|
|
195165
195188
|
const succeeded = results.filter((r) => r.status !== "error").length;
|
|
195166
195189
|
const failed = results.filter((r) => r.status === "error").length;
|
|
195167
|
-
if (options.
|
|
195168
|
-
R2.info("
|
|
195190
|
+
if (options.force) {
|
|
195191
|
+
R2.info("Removing remote functions not found locally...");
|
|
195169
195192
|
const allLocalNames = functions.map((f) => f.name);
|
|
195170
195193
|
const pruneResults = await pruneRemovedFunctions(allLocalNames);
|
|
195171
195194
|
for (const pr of pruneResults) {
|
|
@@ -195177,7 +195200,7 @@ async function deployFunctionsAction(name2, options) {
|
|
|
195177
195200
|
}
|
|
195178
195201
|
if (pruneResults.length > 0) {
|
|
195179
195202
|
const pruned = pruneResults.filter((r) => r.deleted).length;
|
|
195180
|
-
R2.info(`${pruned} function${pruned !== 1 ? "s" : ""}
|
|
195203
|
+
R2.info(`${pruned} function${pruned !== 1 ? "s" : ""} removed`);
|
|
195181
195204
|
}
|
|
195182
195205
|
}
|
|
195183
195206
|
const parts = [];
|
|
@@ -195189,17 +195212,10 @@ async function deployFunctionsAction(name2, options) {
|
|
|
195189
195212
|
return { outroMessage: summary };
|
|
195190
195213
|
}
|
|
195191
195214
|
function getDeployCommand(context) {
|
|
195192
|
-
return new Command("deploy").description("Deploy
|
|
195215
|
+
return new Command("deploy").description("Deploy functions to Base44").argument("[names...]", "Function names to deploy (deploys all if omitted)").option("--force", "Delete remote functions not found locally").action(async (rawNames, options) => {
|
|
195193
195216
|
await runCommand(() => {
|
|
195194
|
-
|
|
195195
|
-
|
|
195196
|
-
const n2 = parseInt(options.concurrency, 10);
|
|
195197
|
-
if (Number.isNaN(n2) || n2 < 1) {
|
|
195198
|
-
throw new InvalidInputError("--concurrency must be a positive integer");
|
|
195199
|
-
}
|
|
195200
|
-
concurrency = n2;
|
|
195201
|
-
}
|
|
195202
|
-
return deployFunctionsAction(name2, { prune: options.prune, concurrency });
|
|
195217
|
+
const names = parseNames(rawNames);
|
|
195218
|
+
return deployFunctionsAction(names, options);
|
|
195203
195219
|
}, { requireAuth: true }, context);
|
|
195204
195220
|
});
|
|
195205
195221
|
}
|
|
@@ -195220,7 +195236,7 @@ async function listFunctionsAction() {
|
|
|
195220
195236
|
};
|
|
195221
195237
|
}
|
|
195222
195238
|
function getListCommand(context) {
|
|
195223
|
-
return new Command("list").description("List deployed
|
|
195239
|
+
return new Command("list").description("List all deployed functions").action(async () => {
|
|
195224
195240
|
await runCommand(listFunctionsAction, { requireAuth: true }, context);
|
|
195225
195241
|
});
|
|
195226
195242
|
}
|
|
@@ -195408,20 +195424,6 @@ function getCreateCommand(context) {
|
|
|
195408
195424
|
}
|
|
195409
195425
|
|
|
195410
195426
|
// src/cli/commands/project/deploy.ts
|
|
195411
|
-
function formatDuration2(ms) {
|
|
195412
|
-
return `${(ms / 1000).toFixed(1)}s`;
|
|
195413
|
-
}
|
|
195414
|
-
function formatFunctionResult(r) {
|
|
195415
|
-
const label = r.name.padEnd(25);
|
|
195416
|
-
if (r.status === "deployed") {
|
|
195417
|
-
const timing = r.duration_ms ? theme.styles.dim(` (${formatDuration2(r.duration_ms)})`) : "";
|
|
195418
|
-
R2.success(`${label} deployed${timing}`);
|
|
195419
|
-
} else if (r.status === "unchanged") {
|
|
195420
|
-
R2.success(`${label} unchanged`);
|
|
195421
|
-
} else {
|
|
195422
|
-
R2.error(`${label} error: ${r.error}`);
|
|
195423
|
-
}
|
|
195424
|
-
}
|
|
195425
195427
|
async function deployAction(options) {
|
|
195426
195428
|
const projectData = await readProjectConfig(options.projectRoot);
|
|
195427
195429
|
if (!hasResourcesToDeploy(projectData)) {
|
|
@@ -195470,7 +195472,7 @@ ${summaryLines.join(`
|
|
|
195470
195472
|
},
|
|
195471
195473
|
onFunctionResult: (r) => {
|
|
195472
195474
|
functionCompleted++;
|
|
195473
|
-
|
|
195475
|
+
formatDeployResult(r);
|
|
195474
195476
|
}
|
|
195475
195477
|
});
|
|
195476
195478
|
const needsOAuth = filterPendingOAuth(result.connectorResults ?? []);
|
|
@@ -200629,4 +200631,4 @@ export {
|
|
|
200629
200631
|
CLIExitError
|
|
200630
200632
|
};
|
|
200631
200633
|
|
|
200632
|
-
//# debugId=
|
|
200634
|
+
//# debugId=1ACD49D5285119A764756E2164756E21
|