@base44-preview/cli 0.0.33-pr.338.6928fe5 → 0.0.33-pr.338.9ac2209
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 +102 -82
- package/dist/cli/index.js.map +12 -10
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -4,25 +4,43 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
function __accessProp(key) {
|
|
8
|
+
return this[key];
|
|
9
|
+
}
|
|
10
|
+
var __toESMCache_node;
|
|
11
|
+
var __toESMCache_esm;
|
|
7
12
|
var __toESM = (mod, isNodeMode, target) => {
|
|
13
|
+
var canCache = mod != null && typeof mod === "object";
|
|
14
|
+
if (canCache) {
|
|
15
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
16
|
+
var cached = cache.get(mod);
|
|
17
|
+
if (cached)
|
|
18
|
+
return cached;
|
|
19
|
+
}
|
|
8
20
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
21
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
22
|
for (let key of __getOwnPropNames(mod))
|
|
11
23
|
if (!__hasOwnProp.call(to, key))
|
|
12
24
|
__defProp(to, key, {
|
|
13
|
-
get: (
|
|
25
|
+
get: __accessProp.bind(mod, key),
|
|
14
26
|
enumerable: true
|
|
15
27
|
});
|
|
28
|
+
if (canCache)
|
|
29
|
+
cache.set(mod, to);
|
|
16
30
|
return to;
|
|
17
31
|
};
|
|
18
32
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
33
|
+
var __returnValue = (v) => v;
|
|
34
|
+
function __exportSetter(name, newValue) {
|
|
35
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
36
|
+
}
|
|
19
37
|
var __export = (target, all) => {
|
|
20
38
|
for (var name in all)
|
|
21
39
|
__defProp(target, name, {
|
|
22
40
|
get: all[name],
|
|
23
41
|
enumerable: true,
|
|
24
42
|
configurable: true,
|
|
25
|
-
set: (
|
|
43
|
+
set: __exportSetter.bind(all, name)
|
|
26
44
|
});
|
|
27
45
|
};
|
|
28
46
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
@@ -186006,12 +186024,6 @@ var BackendFunctionSchema = FunctionConfigSchema.extend({
|
|
|
186006
186024
|
entryPath: exports_external.string().min(1, "Entry path cannot be empty"),
|
|
186007
186025
|
filePaths: exports_external.array(exports_external.string()).min(1, "Function must have at least one file")
|
|
186008
186026
|
});
|
|
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
186027
|
var DeploySingleFunctionResponseSchema = exports_external.object({
|
|
186016
186028
|
status: exports_external.enum(["deployed", "unchanged"]),
|
|
186017
186029
|
duration_ms: exports_external.number().optional().nullable()
|
|
@@ -186140,26 +186152,12 @@ async function deployOne(fn) {
|
|
|
186140
186152
|
async function pushFunctionsSingle(functions, options) {
|
|
186141
186153
|
if (functions.length === 0)
|
|
186142
186154
|
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
186155
|
const results = [];
|
|
186155
|
-
for (
|
|
186156
|
-
|
|
186157
|
-
|
|
186158
|
-
|
|
186159
|
-
|
|
186160
|
-
results.push(result);
|
|
186161
|
-
options?.onResult?.(result);
|
|
186162
|
-
}
|
|
186156
|
+
for (const fn of functions) {
|
|
186157
|
+
options?.onStart?.([fn.name]);
|
|
186158
|
+
const result = await deployOne(fn);
|
|
186159
|
+
results.push(result);
|
|
186160
|
+
options?.onResult?.(result);
|
|
186163
186161
|
}
|
|
186164
186162
|
return results;
|
|
186165
186163
|
}
|
|
@@ -195102,31 +195100,64 @@ function getEntitiesPushCommand(context) {
|
|
|
195102
195100
|
}));
|
|
195103
195101
|
}
|
|
195104
195102
|
|
|
195103
|
+
// src/cli/utils/parseNames.ts
|
|
195104
|
+
function parseNames(args) {
|
|
195105
|
+
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
195106
|
+
}
|
|
195107
|
+
|
|
195105
195108
|
// src/cli/commands/functions/delete.ts
|
|
195106
|
-
async function
|
|
195107
|
-
|
|
195108
|
-
|
|
195109
|
-
|
|
195110
|
-
|
|
195111
|
-
|
|
195112
|
-
|
|
195113
|
-
R2.
|
|
195114
|
-
|
|
195109
|
+
async function deleteFunctionsAction(names) {
|
|
195110
|
+
let deleted = 0;
|
|
195111
|
+
let notFound = 0;
|
|
195112
|
+
let errors4 = 0;
|
|
195113
|
+
for (const name2 of names) {
|
|
195114
|
+
try {
|
|
195115
|
+
await deleteSingleFunction(name2);
|
|
195116
|
+
R2.success(`${name2} deleted`);
|
|
195117
|
+
deleted++;
|
|
195118
|
+
} catch (error48) {
|
|
195119
|
+
if (error48 instanceof ApiError && error48.statusCode === 404) {
|
|
195120
|
+
R2.warn(`Function "${name2}" not found on remote`);
|
|
195121
|
+
notFound++;
|
|
195122
|
+
} else {
|
|
195123
|
+
R2.error(`${name2} error: ${error48 instanceof Error ? error48.message : String(error48)}`);
|
|
195124
|
+
errors4++;
|
|
195125
|
+
}
|
|
195115
195126
|
}
|
|
195116
|
-
throw error48;
|
|
195117
195127
|
}
|
|
195128
|
+
if (names.length === 1) {
|
|
195129
|
+
if (deleted)
|
|
195130
|
+
return { outroMessage: `Function "${names[0]}" deleted` };
|
|
195131
|
+
if (notFound)
|
|
195132
|
+
return { outroMessage: `Function "${names[0]}" not found` };
|
|
195133
|
+
return { outroMessage: `Failed to delete "${names[0]}"` };
|
|
195134
|
+
}
|
|
195135
|
+
const parts = [];
|
|
195136
|
+
if (deleted > 0)
|
|
195137
|
+
parts.push(`${deleted} deleted`);
|
|
195138
|
+
if (notFound > 0)
|
|
195139
|
+
parts.push(`${notFound} not found`);
|
|
195140
|
+
if (errors4 > 0)
|
|
195141
|
+
parts.push(`${errors4} error${errors4 !== 1 ? "s" : ""}`);
|
|
195142
|
+
return { outroMessage: parts.join(", ") };
|
|
195118
195143
|
}
|
|
195119
195144
|
function getDeleteCommand(context) {
|
|
195120
|
-
return new Command("delete").description("Delete
|
|
195121
|
-
await runCommand(() =>
|
|
195145
|
+
return new Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").action(async (rawNames) => {
|
|
195146
|
+
await runCommand(() => {
|
|
195147
|
+
const names = parseNames(rawNames);
|
|
195148
|
+
if (names.length === 0) {
|
|
195149
|
+
throw new InvalidInputError("At least one function name is required");
|
|
195150
|
+
}
|
|
195151
|
+
return deleteFunctionsAction(names);
|
|
195152
|
+
}, { requireAuth: true }, context);
|
|
195122
195153
|
});
|
|
195123
195154
|
}
|
|
195124
195155
|
|
|
195125
|
-
// src/cli/
|
|
195156
|
+
// src/cli/utils/formatDeployResult.ts
|
|
195126
195157
|
function formatDuration(ms) {
|
|
195127
195158
|
return `${(ms / 1000).toFixed(1)}s`;
|
|
195128
195159
|
}
|
|
195129
|
-
function
|
|
195160
|
+
function formatDeployResult(r) {
|
|
195130
195161
|
const label = r.name.padEnd(25);
|
|
195131
195162
|
if (r.status === "deployed") {
|
|
195132
195163
|
const timing = r.duration_ms ? theme.styles.dim(` (${formatDuration(r.duration_ms)})`) : "";
|
|
@@ -195137,13 +195168,24 @@ function formatResult(r) {
|
|
|
195137
195168
|
R2.error(`${label} error: ${r.error}`);
|
|
195138
195169
|
}
|
|
195139
195170
|
}
|
|
195140
|
-
|
|
195171
|
+
|
|
195172
|
+
// src/cli/commands/functions/deploy.ts
|
|
195173
|
+
async function deployFunctionsAction(names, options) {
|
|
195174
|
+
if (options.force && names.length > 0) {
|
|
195175
|
+
throw new InvalidInputError("--force cannot be used when specifying function names");
|
|
195176
|
+
}
|
|
195141
195177
|
const { functions } = await readProjectConfig();
|
|
195142
|
-
|
|
195143
|
-
if (
|
|
195144
|
-
|
|
195145
|
-
|
|
195178
|
+
let toDeploy;
|
|
195179
|
+
if (names.length > 0) {
|
|
195180
|
+
const notFound = names.filter((n2) => !functions.some((f) => f.name === n2));
|
|
195181
|
+
if (notFound.length > 0) {
|
|
195182
|
+
throw new InvalidInputError(`Function${notFound.length > 1 ? "s" : ""} not found in project: ${notFound.join(", ")}`);
|
|
195146
195183
|
}
|
|
195184
|
+
toDeploy = functions.filter((f) => names.includes(f.name));
|
|
195185
|
+
} else {
|
|
195186
|
+
toDeploy = functions;
|
|
195187
|
+
}
|
|
195188
|
+
if (toDeploy.length === 0) {
|
|
195147
195189
|
return {
|
|
195148
195190
|
outroMessage: "No functions found. Create functions in the 'functions' directory."
|
|
195149
195191
|
};
|
|
@@ -195152,20 +195194,19 @@ async function deployFunctionsAction(name2, options) {
|
|
|
195152
195194
|
let completed = 0;
|
|
195153
195195
|
const total = toDeploy.length;
|
|
195154
195196
|
const results = await pushFunctionsSingle(toDeploy, {
|
|
195155
|
-
|
|
195156
|
-
|
|
195157
|
-
const label = names.length === 1 ? names[0] : `${names.length} functions`;
|
|
195197
|
+
onStart: (startNames) => {
|
|
195198
|
+
const label = startNames.length === 1 ? startNames[0] : `${startNames.length} functions`;
|
|
195158
195199
|
R2.step(theme.styles.dim(`[${completed}/${total}] Deploying ${label}...`));
|
|
195159
195200
|
},
|
|
195160
195201
|
onResult: (r) => {
|
|
195161
195202
|
completed++;
|
|
195162
|
-
|
|
195203
|
+
formatDeployResult(r);
|
|
195163
195204
|
}
|
|
195164
195205
|
});
|
|
195165
195206
|
const succeeded = results.filter((r) => r.status !== "error").length;
|
|
195166
195207
|
const failed = results.filter((r) => r.status === "error").length;
|
|
195167
|
-
if (options.
|
|
195168
|
-
R2.info("
|
|
195208
|
+
if (options.force) {
|
|
195209
|
+
R2.info("Removing remote functions not found locally...");
|
|
195169
195210
|
const allLocalNames = functions.map((f) => f.name);
|
|
195170
195211
|
const pruneResults = await pruneRemovedFunctions(allLocalNames);
|
|
195171
195212
|
for (const pr of pruneResults) {
|
|
@@ -195177,7 +195218,7 @@ async function deployFunctionsAction(name2, options) {
|
|
|
195177
195218
|
}
|
|
195178
195219
|
if (pruneResults.length > 0) {
|
|
195179
195220
|
const pruned = pruneResults.filter((r) => r.deleted).length;
|
|
195180
|
-
R2.info(`${pruned} function${pruned !== 1 ? "s" : ""}
|
|
195221
|
+
R2.info(`${pruned} function${pruned !== 1 ? "s" : ""} removed`);
|
|
195181
195222
|
}
|
|
195182
195223
|
}
|
|
195183
195224
|
const parts = [];
|
|
@@ -195189,17 +195230,10 @@ async function deployFunctionsAction(name2, options) {
|
|
|
195189
195230
|
return { outroMessage: summary };
|
|
195190
195231
|
}
|
|
195191
195232
|
function getDeployCommand(context) {
|
|
195192
|
-
return new Command("deploy").description("Deploy
|
|
195233
|
+
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
195234
|
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 });
|
|
195235
|
+
const names = parseNames(rawNames);
|
|
195236
|
+
return deployFunctionsAction(names, options);
|
|
195203
195237
|
}, { requireAuth: true }, context);
|
|
195204
195238
|
});
|
|
195205
195239
|
}
|
|
@@ -195208,7 +195242,7 @@ function getDeployCommand(context) {
|
|
|
195208
195242
|
async function listFunctionsAction() {
|
|
195209
195243
|
const { functions } = await listDeployedFunctions();
|
|
195210
195244
|
if (functions.length === 0) {
|
|
195211
|
-
return { outroMessage: "No functions
|
|
195245
|
+
return { outroMessage: "No functions on remote" };
|
|
195212
195246
|
}
|
|
195213
195247
|
for (const fn of functions) {
|
|
195214
195248
|
const autoCount = fn.automations.length;
|
|
@@ -195216,11 +195250,11 @@ async function listFunctionsAction() {
|
|
|
195216
195250
|
R2.message(` ${fn.name}${autoLabel}`);
|
|
195217
195251
|
}
|
|
195218
195252
|
return {
|
|
195219
|
-
outroMessage: `${functions.length} function${functions.length !== 1 ? "s" : ""}
|
|
195253
|
+
outroMessage: `${functions.length} function${functions.length !== 1 ? "s" : ""} on remote`
|
|
195220
195254
|
};
|
|
195221
195255
|
}
|
|
195222
195256
|
function getListCommand(context) {
|
|
195223
|
-
return new Command("list").description("List deployed
|
|
195257
|
+
return new Command("list").description("List all deployed functions").action(async () => {
|
|
195224
195258
|
await runCommand(listFunctionsAction, { requireAuth: true }, context);
|
|
195225
195259
|
});
|
|
195226
195260
|
}
|
|
@@ -195408,20 +195442,6 @@ function getCreateCommand(context) {
|
|
|
195408
195442
|
}
|
|
195409
195443
|
|
|
195410
195444
|
// 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
195445
|
async function deployAction(options) {
|
|
195426
195446
|
const projectData = await readProjectConfig(options.projectRoot);
|
|
195427
195447
|
if (!hasResourcesToDeploy(projectData)) {
|
|
@@ -195470,7 +195490,7 @@ ${summaryLines.join(`
|
|
|
195470
195490
|
},
|
|
195471
195491
|
onFunctionResult: (r) => {
|
|
195472
195492
|
functionCompleted++;
|
|
195473
|
-
|
|
195493
|
+
formatDeployResult(r);
|
|
195474
195494
|
}
|
|
195475
195495
|
});
|
|
195476
195496
|
const needsOAuth = filterPendingOAuth(result.connectorResults ?? []);
|
|
@@ -200629,4 +200649,4 @@ export {
|
|
|
200629
200649
|
CLIExitError
|
|
200630
200650
|
};
|
|
200631
200651
|
|
|
200632
|
-
//# debugId=
|
|
200652
|
+
//# debugId=DFA19B91985259E764756E2164756E21
|