@base44-preview/cli 0.0.33-pr.331.bcfcc1c → 0.0.33-pr.331.bd24d14
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 +128 -172
- package/dist/cli/index.js.map +15 -14
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -17446,7 +17446,7 @@ var require_lodash2 = __commonJS((exports, module) => {
|
|
|
17446
17446
|
}
|
|
17447
17447
|
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
|
|
17448
17448
|
});
|
|
17449
|
-
function
|
|
17449
|
+
function join14(array2, separator) {
|
|
17450
17450
|
return array2 == null ? "" : nativeJoin.call(array2, separator);
|
|
17451
17451
|
}
|
|
17452
17452
|
function last(array2) {
|
|
@@ -19378,7 +19378,7 @@ __p += '`;
|
|
|
19378
19378
|
lodash.isUndefined = isUndefined;
|
|
19379
19379
|
lodash.isWeakMap = isWeakMap;
|
|
19380
19380
|
lodash.isWeakSet = isWeakSet;
|
|
19381
|
-
lodash.join =
|
|
19381
|
+
lodash.join = join14;
|
|
19382
19382
|
lodash.kebabCase = kebabCase2;
|
|
19383
19383
|
lodash.last = last;
|
|
19384
19384
|
lodash.lastIndexOf = lastIndexOf;
|
|
@@ -20007,7 +20007,7 @@ function cleanDoc(doc2) {
|
|
|
20007
20007
|
return mapDoc(doc2, (currentDoc) => cleanDocFn(currentDoc));
|
|
20008
20008
|
}
|
|
20009
20009
|
function replaceEndOfLine(doc2, replacement = literalline) {
|
|
20010
|
-
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
20010
|
+
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ? join14(replacement, currentDoc.split(`
|
|
20011
20011
|
`)) : currentDoc);
|
|
20012
20012
|
}
|
|
20013
20013
|
function canBreakFn(doc2) {
|
|
@@ -20087,7 +20087,7 @@ function indentIfBreak(contents, options) {
|
|
|
20087
20087
|
negate: options.negate
|
|
20088
20088
|
};
|
|
20089
20089
|
}
|
|
20090
|
-
function
|
|
20090
|
+
function join14(separator, docs) {
|
|
20091
20091
|
assertDoc(separator);
|
|
20092
20092
|
assertDocArray(docs);
|
|
20093
20093
|
const parts = [];
|
|
@@ -20798,7 +20798,7 @@ var init_doc = __esm(() => {
|
|
|
20798
20798
|
MODE_FLAT = Symbol("MODE_FLAT");
|
|
20799
20799
|
DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
|
|
20800
20800
|
builders = {
|
|
20801
|
-
join:
|
|
20801
|
+
join: join14,
|
|
20802
20802
|
line,
|
|
20803
20803
|
softline,
|
|
20804
20804
|
hardline,
|
|
@@ -125712,7 +125712,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
125712
125712
|
return mapDoc2(doc2, (currentDoc) => cleanDocFn2(currentDoc));
|
|
125713
125713
|
}
|
|
125714
125714
|
function replaceEndOfLine2(doc2, replacement = literalline2) {
|
|
125715
|
-
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
125715
|
+
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ? join16(replacement, currentDoc.split(`
|
|
125716
125716
|
`)) : currentDoc);
|
|
125717
125717
|
}
|
|
125718
125718
|
function canBreakFn2(doc2) {
|
|
@@ -125798,7 +125798,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
125798
125798
|
negate: options8.negate
|
|
125799
125799
|
};
|
|
125800
125800
|
}
|
|
125801
|
-
function
|
|
125801
|
+
function join16(separator, docs) {
|
|
125802
125802
|
assertDoc2(separator);
|
|
125803
125803
|
assertDocArray2(docs);
|
|
125804
125804
|
const parts = [];
|
|
@@ -126463,7 +126463,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
126463
126463
|
}
|
|
126464
126464
|
}
|
|
126465
126465
|
var builders2 = {
|
|
126466
|
-
join:
|
|
126466
|
+
join: join16,
|
|
126467
126467
|
line: line3,
|
|
126468
126468
|
softline: softline2,
|
|
126469
126469
|
hardline: hardline4,
|
|
@@ -155678,10 +155678,10 @@ var require_view = __commonJS((exports, module) => {
|
|
|
155678
155678
|
var debug = require_src4()("express:view");
|
|
155679
155679
|
var path18 = __require("node:path");
|
|
155680
155680
|
var fs28 = __require("node:fs");
|
|
155681
|
-
var
|
|
155681
|
+
var dirname12 = path18.dirname;
|
|
155682
155682
|
var basename4 = path18.basename;
|
|
155683
155683
|
var extname2 = path18.extname;
|
|
155684
|
-
var
|
|
155684
|
+
var join17 = path18.join;
|
|
155685
155685
|
var resolve5 = path18.resolve;
|
|
155686
155686
|
module.exports = View;
|
|
155687
155687
|
function View(name2, options8) {
|
|
@@ -155717,7 +155717,7 @@ var require_view = __commonJS((exports, module) => {
|
|
|
155717
155717
|
for (var i5 = 0;i5 < roots.length && !path19; i5++) {
|
|
155718
155718
|
var root2 = roots[i5];
|
|
155719
155719
|
var loc = resolve5(root2, name2);
|
|
155720
|
-
var dir =
|
|
155720
|
+
var dir = dirname12(loc);
|
|
155721
155721
|
var file2 = basename4(loc);
|
|
155722
155722
|
path19 = this.resolve(dir, file2);
|
|
155723
155723
|
}
|
|
@@ -155743,12 +155743,12 @@ var require_view = __commonJS((exports, module) => {
|
|
|
155743
155743
|
};
|
|
155744
155744
|
View.prototype.resolve = function resolve6(dir, file2) {
|
|
155745
155745
|
var ext = this.ext;
|
|
155746
|
-
var path19 =
|
|
155746
|
+
var path19 = join17(dir, file2);
|
|
155747
155747
|
var stat2 = tryStat(path19);
|
|
155748
155748
|
if (stat2 && stat2.isFile()) {
|
|
155749
155749
|
return path19;
|
|
155750
155750
|
}
|
|
155751
|
-
path19 =
|
|
155751
|
+
path19 = join17(dir, basename4(file2, ext), "index" + ext);
|
|
155752
155752
|
stat2 = tryStat(path19);
|
|
155753
155753
|
if (stat2 && stat2.isFile()) {
|
|
155754
155754
|
return path19;
|
|
@@ -159443,7 +159443,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
159443
159443
|
var Stream2 = __require("stream");
|
|
159444
159444
|
var util2 = __require("util");
|
|
159445
159445
|
var extname2 = path18.extname;
|
|
159446
|
-
var
|
|
159446
|
+
var join17 = path18.join;
|
|
159447
159447
|
var normalize = path18.normalize;
|
|
159448
159448
|
var resolve5 = path18.resolve;
|
|
159449
159449
|
var sep = path18.sep;
|
|
@@ -159615,7 +159615,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
159615
159615
|
return res;
|
|
159616
159616
|
}
|
|
159617
159617
|
parts = path19.split(sep);
|
|
159618
|
-
path19 = normalize(
|
|
159618
|
+
path19 = normalize(join17(root2, path19));
|
|
159619
159619
|
} else {
|
|
159620
159620
|
if (UP_PATH_REGEXP.test(path19)) {
|
|
159621
159621
|
debug('malicious path "%s"', path19);
|
|
@@ -159755,7 +159755,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
159755
159755
|
return self2.onStatError(err);
|
|
159756
159756
|
return self2.error(404);
|
|
159757
159757
|
}
|
|
159758
|
-
var p4 =
|
|
159758
|
+
var p4 = join17(path19, self2._index[i5]);
|
|
159759
159759
|
debug('stat "%s"', p4);
|
|
159760
159760
|
fs28.stat(p4, function(err2, stat2) {
|
|
159761
159761
|
if (err2)
|
|
@@ -186006,15 +186006,8 @@ 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
|
-
status: exports_external.enum(["deployed", "unchanged"
|
|
186017
|
-
error: exports_external.string().optional().nullable(),
|
|
186010
|
+
status: exports_external.enum(["deployed", "unchanged"]),
|
|
186018
186011
|
duration_ms: exports_external.number().optional().nullable()
|
|
186019
186012
|
});
|
|
186020
186013
|
var FunctionAutomationInfoSchema = exports_external.object({
|
|
@@ -186034,34 +186027,6 @@ var ListFunctionsResponseSchema = exports_external.object({
|
|
|
186034
186027
|
});
|
|
186035
186028
|
|
|
186036
186029
|
// src/core/resources/function/api.ts
|
|
186037
|
-
function toDeployPayloadItem(fn) {
|
|
186038
|
-
return {
|
|
186039
|
-
name: fn.name,
|
|
186040
|
-
entry: fn.entry,
|
|
186041
|
-
files: fn.files,
|
|
186042
|
-
automations: fn.automations
|
|
186043
|
-
};
|
|
186044
|
-
}
|
|
186045
|
-
async function deployFunctions(functions) {
|
|
186046
|
-
const appClient = getAppClient();
|
|
186047
|
-
const payload = {
|
|
186048
|
-
functions: functions.map(toDeployPayloadItem)
|
|
186049
|
-
};
|
|
186050
|
-
let response;
|
|
186051
|
-
try {
|
|
186052
|
-
response = await appClient.put("backend-functions", {
|
|
186053
|
-
json: payload,
|
|
186054
|
-
timeout: false
|
|
186055
|
-
});
|
|
186056
|
-
} catch (error48) {
|
|
186057
|
-
throw await ApiError.fromHttpError(error48, "deploying functions");
|
|
186058
|
-
}
|
|
186059
|
-
const result = DeployFunctionsResponseSchema.safeParse(await response.json());
|
|
186060
|
-
if (!result.success) {
|
|
186061
|
-
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
186062
|
-
}
|
|
186063
|
-
return result.data;
|
|
186064
|
-
}
|
|
186065
186030
|
async function deploySingleFunction(name2, payload) {
|
|
186066
186031
|
const appClient = getAppClient();
|
|
186067
186032
|
let response;
|
|
@@ -186149,13 +186114,6 @@ async function loadFunctionCode(fn) {
|
|
|
186149
186114
|
}));
|
|
186150
186115
|
return { ...fn, files: loadedFiles };
|
|
186151
186116
|
}
|
|
186152
|
-
async function pushFunctions(functions) {
|
|
186153
|
-
if (functions.length === 0) {
|
|
186154
|
-
return { deployed: [], deleted: [], skipped: [], errors: null };
|
|
186155
|
-
}
|
|
186156
|
-
const functionsWithCode = await Promise.all(functions.map(loadFunctionCode));
|
|
186157
|
-
return deployFunctions(functionsWithCode);
|
|
186158
|
-
}
|
|
186159
186117
|
async function deployOne(fn) {
|
|
186160
186118
|
try {
|
|
186161
186119
|
const loaded = await loadFunctionCode(fn);
|
|
@@ -186176,26 +186134,12 @@ async function deployOne(fn) {
|
|
|
186176
186134
|
async function pushFunctionsSingle(functions, options) {
|
|
186177
186135
|
if (functions.length === 0)
|
|
186178
186136
|
return [];
|
|
186179
|
-
const concurrency = options?.concurrency ?? 1;
|
|
186180
|
-
if (concurrency <= 1) {
|
|
186181
|
-
const results2 = [];
|
|
186182
|
-
for (const fn of functions) {
|
|
186183
|
-
options?.onStart?.([fn.name]);
|
|
186184
|
-
const result = await deployOne(fn);
|
|
186185
|
-
results2.push(result);
|
|
186186
|
-
options?.onResult?.(result);
|
|
186187
|
-
}
|
|
186188
|
-
return results2;
|
|
186189
|
-
}
|
|
186190
186137
|
const results = [];
|
|
186191
|
-
for (
|
|
186192
|
-
|
|
186193
|
-
|
|
186194
|
-
|
|
186195
|
-
|
|
186196
|
-
results.push(result);
|
|
186197
|
-
options?.onResult?.(result);
|
|
186198
|
-
}
|
|
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);
|
|
186199
186143
|
}
|
|
186200
186144
|
return results;
|
|
186201
186145
|
}
|
|
@@ -186249,6 +186193,20 @@ async function isFunctionUnchanged(functionDir, fn) {
|
|
|
186249
186193
|
if (!await pathExists(functionDir)) {
|
|
186250
186194
|
return false;
|
|
186251
186195
|
}
|
|
186196
|
+
const configPath = join6(functionDir, "function.jsonc");
|
|
186197
|
+
try {
|
|
186198
|
+
const localConfig = await readJsonFile(configPath);
|
|
186199
|
+
if (localConfig.entry !== fn.entry) {
|
|
186200
|
+
return false;
|
|
186201
|
+
}
|
|
186202
|
+
const localAuto = JSON.stringify(localConfig.automations ?? []);
|
|
186203
|
+
const remoteAuto = JSON.stringify(fn.automations);
|
|
186204
|
+
if (localAuto !== remoteAuto) {
|
|
186205
|
+
return false;
|
|
186206
|
+
}
|
|
186207
|
+
} catch {
|
|
186208
|
+
return false;
|
|
186209
|
+
}
|
|
186252
186210
|
for (const file2 of fn.files) {
|
|
186253
186211
|
const filePath = join6(functionDir, file2.path);
|
|
186254
186212
|
if (!await pathExists(filePath)) {
|
|
@@ -186268,7 +186226,7 @@ async function isFunctionUnchanged(functionDir, fn) {
|
|
|
186268
186226
|
// src/core/resources/function/resource.ts
|
|
186269
186227
|
var functionResource = {
|
|
186270
186228
|
readAll: readAllFunctions,
|
|
186271
|
-
push:
|
|
186229
|
+
push: (functions) => pushFunctionsSingle(functions)
|
|
186272
186230
|
};
|
|
186273
186231
|
// src/core/project/config.ts
|
|
186274
186232
|
async function findConfigInDir(dir) {
|
|
@@ -195182,31 +195140,64 @@ function getEntitiesPushCommand(context) {
|
|
|
195182
195140
|
}));
|
|
195183
195141
|
}
|
|
195184
195142
|
|
|
195143
|
+
// src/cli/utils/parseNames.ts
|
|
195144
|
+
function parseNames(args) {
|
|
195145
|
+
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
195146
|
+
}
|
|
195147
|
+
|
|
195185
195148
|
// src/cli/commands/functions/delete.ts
|
|
195186
|
-
async function
|
|
195187
|
-
|
|
195188
|
-
|
|
195189
|
-
|
|
195190
|
-
|
|
195191
|
-
|
|
195192
|
-
|
|
195193
|
-
R2.
|
|
195194
|
-
|
|
195149
|
+
async function deleteFunctionsAction(names) {
|
|
195150
|
+
let deleted = 0;
|
|
195151
|
+
let notFound = 0;
|
|
195152
|
+
let errors4 = 0;
|
|
195153
|
+
for (const name2 of names) {
|
|
195154
|
+
try {
|
|
195155
|
+
await deleteSingleFunction(name2);
|
|
195156
|
+
R2.success(`${name2} deleted`);
|
|
195157
|
+
deleted++;
|
|
195158
|
+
} catch (error48) {
|
|
195159
|
+
if (error48 instanceof ApiError && error48.statusCode === 404) {
|
|
195160
|
+
R2.warn(`Function "${name2}" not found on remote`);
|
|
195161
|
+
notFound++;
|
|
195162
|
+
} else {
|
|
195163
|
+
R2.error(`${name2} error: ${error48 instanceof Error ? error48.message : String(error48)}`);
|
|
195164
|
+
errors4++;
|
|
195165
|
+
}
|
|
195195
195166
|
}
|
|
195196
|
-
throw error48;
|
|
195197
195167
|
}
|
|
195168
|
+
if (names.length === 1) {
|
|
195169
|
+
if (deleted)
|
|
195170
|
+
return { outroMessage: `Function "${names[0]}" deleted` };
|
|
195171
|
+
if (notFound)
|
|
195172
|
+
return { outroMessage: `Function "${names[0]}" not found` };
|
|
195173
|
+
return { outroMessage: `Failed to delete "${names[0]}"` };
|
|
195174
|
+
}
|
|
195175
|
+
const parts = [];
|
|
195176
|
+
if (deleted > 0)
|
|
195177
|
+
parts.push(`${deleted} deleted`);
|
|
195178
|
+
if (notFound > 0)
|
|
195179
|
+
parts.push(`${notFound} not found`);
|
|
195180
|
+
if (errors4 > 0)
|
|
195181
|
+
parts.push(`${errors4} error${errors4 !== 1 ? "s" : ""}`);
|
|
195182
|
+
return { outroMessage: parts.join(", ") };
|
|
195198
195183
|
}
|
|
195199
195184
|
function getDeleteCommand(context) {
|
|
195200
|
-
return new Command("delete").description("Delete
|
|
195201
|
-
await runCommand(() =>
|
|
195185
|
+
return new Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").action(async (rawNames) => {
|
|
195186
|
+
await runCommand(() => {
|
|
195187
|
+
const names = parseNames(rawNames);
|
|
195188
|
+
if (names.length === 0) {
|
|
195189
|
+
throw new InvalidInputError("At least one function name is required");
|
|
195190
|
+
}
|
|
195191
|
+
return deleteFunctionsAction(names);
|
|
195192
|
+
}, { requireAuth: true }, context);
|
|
195202
195193
|
});
|
|
195203
195194
|
}
|
|
195204
195195
|
|
|
195205
|
-
// src/cli/
|
|
195196
|
+
// src/cli/utils/formatDeployResult.ts
|
|
195206
195197
|
function formatDuration(ms) {
|
|
195207
195198
|
return `${(ms / 1000).toFixed(1)}s`;
|
|
195208
195199
|
}
|
|
195209
|
-
function
|
|
195200
|
+
function formatDeployResult(r) {
|
|
195210
195201
|
const label = r.name.padEnd(25);
|
|
195211
195202
|
if (r.status === "deployed") {
|
|
195212
195203
|
const timing = r.duration_ms ? theme.styles.dim(` (${formatDuration(r.duration_ms)})`) : "";
|
|
@@ -195217,13 +195208,24 @@ function formatResult(r) {
|
|
|
195217
195208
|
R2.error(`${label} error: ${r.error}`);
|
|
195218
195209
|
}
|
|
195219
195210
|
}
|
|
195220
|
-
|
|
195211
|
+
|
|
195212
|
+
// src/cli/commands/functions/deploy.ts
|
|
195213
|
+
async function deployFunctionsAction(names, options) {
|
|
195214
|
+
if (options.force && names.length > 0) {
|
|
195215
|
+
throw new InvalidInputError("--force cannot be used when specifying function names");
|
|
195216
|
+
}
|
|
195221
195217
|
const { functions } = await readProjectConfig();
|
|
195222
|
-
|
|
195223
|
-
if (
|
|
195224
|
-
|
|
195225
|
-
|
|
195218
|
+
let toDeploy;
|
|
195219
|
+
if (names.length > 0) {
|
|
195220
|
+
const notFound = names.filter((n2) => !functions.some((f) => f.name === n2));
|
|
195221
|
+
if (notFound.length > 0) {
|
|
195222
|
+
throw new InvalidInputError(`Function${notFound.length > 1 ? "s" : ""} not found in project: ${notFound.join(", ")}`);
|
|
195226
195223
|
}
|
|
195224
|
+
toDeploy = functions.filter((f) => names.includes(f.name));
|
|
195225
|
+
} else {
|
|
195226
|
+
toDeploy = functions;
|
|
195227
|
+
}
|
|
195228
|
+
if (toDeploy.length === 0) {
|
|
195227
195229
|
return {
|
|
195228
195230
|
outroMessage: "No functions found. Create functions in the 'functions' directory."
|
|
195229
195231
|
};
|
|
@@ -195232,20 +195234,19 @@ async function deployFunctionsAction(name2, options) {
|
|
|
195232
195234
|
let completed = 0;
|
|
195233
195235
|
const total = toDeploy.length;
|
|
195234
195236
|
const results = await pushFunctionsSingle(toDeploy, {
|
|
195235
|
-
|
|
195236
|
-
|
|
195237
|
-
const label = names.length === 1 ? names[0] : `${names.length} functions`;
|
|
195237
|
+
onStart: (startNames) => {
|
|
195238
|
+
const label = startNames.length === 1 ? startNames[0] : `${startNames.length} functions`;
|
|
195238
195239
|
R2.step(theme.styles.dim(`[${completed}/${total}] Deploying ${label}...`));
|
|
195239
195240
|
},
|
|
195240
195241
|
onResult: (r) => {
|
|
195241
195242
|
completed++;
|
|
195242
|
-
|
|
195243
|
+
formatDeployResult(r);
|
|
195243
195244
|
}
|
|
195244
195245
|
});
|
|
195245
195246
|
const succeeded = results.filter((r) => r.status !== "error").length;
|
|
195246
195247
|
const failed = results.filter((r) => r.status === "error").length;
|
|
195247
|
-
if (options.
|
|
195248
|
-
R2.info("
|
|
195248
|
+
if (options.force) {
|
|
195249
|
+
R2.info("Removing remote functions not found locally...");
|
|
195249
195250
|
const allLocalNames = functions.map((f) => f.name);
|
|
195250
195251
|
const pruneResults = await pruneRemovedFunctions(allLocalNames);
|
|
195251
195252
|
for (const pr of pruneResults) {
|
|
@@ -195257,7 +195258,7 @@ async function deployFunctionsAction(name2, options) {
|
|
|
195257
195258
|
}
|
|
195258
195259
|
if (pruneResults.length > 0) {
|
|
195259
195260
|
const pruned = pruneResults.filter((r) => r.deleted).length;
|
|
195260
|
-
R2.info(`${pruned} function${pruned !== 1 ? "s" : ""}
|
|
195261
|
+
R2.info(`${pruned} function${pruned !== 1 ? "s" : ""} removed`);
|
|
195261
195262
|
}
|
|
195262
195263
|
}
|
|
195263
195264
|
const parts = [];
|
|
@@ -195269,17 +195270,10 @@ async function deployFunctionsAction(name2, options) {
|
|
|
195269
195270
|
return { outroMessage: summary };
|
|
195270
195271
|
}
|
|
195271
195272
|
function getDeployCommand(context) {
|
|
195272
|
-
return new Command("deploy").description("Deploy
|
|
195273
|
+
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) => {
|
|
195273
195274
|
await runCommand(() => {
|
|
195274
|
-
|
|
195275
|
-
|
|
195276
|
-
const n2 = parseInt(options.concurrency, 10);
|
|
195277
|
-
if (Number.isNaN(n2) || n2 < 1) {
|
|
195278
|
-
throw new InvalidInputError("--concurrency must be a positive integer");
|
|
195279
|
-
}
|
|
195280
|
-
concurrency = n2;
|
|
195281
|
-
}
|
|
195282
|
-
return deployFunctionsAction(name2, { prune: options.prune, concurrency });
|
|
195275
|
+
const names = parseNames(rawNames);
|
|
195276
|
+
return deployFunctionsAction(names, options);
|
|
195283
195277
|
}, { requireAuth: true }, context);
|
|
195284
195278
|
});
|
|
195285
195279
|
}
|
|
@@ -195300,55 +195294,17 @@ async function listFunctionsAction() {
|
|
|
195300
195294
|
};
|
|
195301
195295
|
}
|
|
195302
195296
|
function getListCommand(context) {
|
|
195303
|
-
return new Command("list").description("List deployed
|
|
195297
|
+
return new Command("list").description("List all deployed functions").action(async () => {
|
|
195304
195298
|
await runCommand(listFunctionsAction, { requireAuth: true }, context);
|
|
195305
195299
|
});
|
|
195306
195300
|
}
|
|
195307
195301
|
|
|
195308
|
-
// src/cli/commands/functions/new.ts
|
|
195309
|
-
import { dirname as dirname9, join as join12 } from "node:path";
|
|
195310
|
-
var FUNCTION_TEMPLATE = `Deno.serve(async (req: Request) => {
|
|
195311
|
-
return new Response(JSON.stringify({ message: "Hello from {{name}}!" }), {
|
|
195312
|
-
headers: { "Content-Type": "application/json" },
|
|
195313
|
-
});
|
|
195314
|
-
});
|
|
195315
|
-
`;
|
|
195316
|
-
async function newFunctionAction(name2) {
|
|
195317
|
-
if (name2.includes(".")) {
|
|
195318
|
-
throw new InvalidInputError("Function name cannot contain dots");
|
|
195319
|
-
}
|
|
195320
|
-
const { project: project2, functions } = await readProjectConfig();
|
|
195321
|
-
if (functions.some((f) => f.name === name2)) {
|
|
195322
|
-
throw new InvalidInputError(`Function "${name2}" already exists in this project`);
|
|
195323
|
-
}
|
|
195324
|
-
const configDir = dirname9(project2.configPath);
|
|
195325
|
-
const functionsDir = join12(configDir, project2.functionsDir);
|
|
195326
|
-
const functionDir = join12(functionsDir, name2);
|
|
195327
|
-
if (await pathExists(functionDir)) {
|
|
195328
|
-
throw new InvalidInputError(`Directory "${functionDir}" already exists`);
|
|
195329
|
-
}
|
|
195330
|
-
const configPath = join12(functionDir, "function.jsonc");
|
|
195331
|
-
const entryPath = join12(functionDir, "index.ts");
|
|
195332
|
-
await writeJsonFile(configPath, { name: name2, entry: "index.ts" });
|
|
195333
|
-
await writeFile(entryPath, FUNCTION_TEMPLATE.replace("{{name}}", name2));
|
|
195334
|
-
R2.success(`Created ${configPath}`);
|
|
195335
|
-
R2.success(`Created ${entryPath}`);
|
|
195336
|
-
return {
|
|
195337
|
-
outroMessage: `Function "${name2}" created. Deploy with: base44 functions deploy ${name2}`
|
|
195338
|
-
};
|
|
195339
|
-
}
|
|
195340
|
-
function getNewCommand(context) {
|
|
195341
|
-
return new Command("new").description("Create a new backend function from template").argument("<name>", "Name for the new function").action(async (name2) => {
|
|
195342
|
-
await runCommand(() => newFunctionAction(name2), { requireAuth: false }, context);
|
|
195343
|
-
});
|
|
195344
|
-
}
|
|
195345
|
-
|
|
195346
195302
|
// src/cli/commands/functions/pull.ts
|
|
195347
|
-
import { dirname as
|
|
195303
|
+
import { dirname as dirname9, join as join12 } from "node:path";
|
|
195348
195304
|
async function pullFunctionsAction(name2) {
|
|
195349
195305
|
const { project: project2 } = await readProjectConfig();
|
|
195350
|
-
const configDir =
|
|
195351
|
-
const functionsDir =
|
|
195306
|
+
const configDir = dirname9(project2.configPath);
|
|
195307
|
+
const functionsDir = join12(configDir, project2.functionsDir);
|
|
195352
195308
|
const remoteFunctions = await runTask("Fetching functions from Base44", async () => {
|
|
195353
195309
|
const { functions } = await listDeployedFunctions();
|
|
195354
195310
|
return functions;
|
|
@@ -195382,18 +195338,18 @@ async function pullFunctionsAction(name2) {
|
|
|
195382
195338
|
};
|
|
195383
195339
|
}
|
|
195384
195340
|
function getPullCommand(context) {
|
|
195385
|
-
return new Command("pull").description("Pull deployed functions from Base44
|
|
195341
|
+
return new Command("pull").description("Pull deployed functions from Base44").argument("[name]", "Pull a single function by name").action(async (name2) => {
|
|
195386
195342
|
await runCommand(() => pullFunctionsAction(name2), { requireAuth: true }, context);
|
|
195387
195343
|
});
|
|
195388
195344
|
}
|
|
195389
195345
|
|
|
195390
195346
|
// src/cli/commands/functions/index.ts
|
|
195391
195347
|
function getFunctionsCommand(context) {
|
|
195392
|
-
return new Command("functions").description("Manage backend functions").addCommand(
|
|
195348
|
+
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getPullCommand(context)).addCommand(getListCommand(context)).addCommand(getDeleteCommand(context));
|
|
195393
195349
|
}
|
|
195394
195350
|
|
|
195395
195351
|
// src/cli/commands/project/create.ts
|
|
195396
|
-
import { basename as basename3, join as
|
|
195352
|
+
import { basename as basename3, join as join13, resolve as resolve2 } from "node:path";
|
|
195397
195353
|
var import_lodash = __toESM(require_lodash(), 1);
|
|
195398
195354
|
var DEFAULT_TEMPLATE_ID = "backend-only";
|
|
195399
195355
|
async function getTemplateById(templateId) {
|
|
@@ -195529,7 +195485,7 @@ async function executeCreate({
|
|
|
195529
195485
|
updateMessage("Building project...");
|
|
195530
195486
|
await execa({ cwd: resolvedPath, shell: true })`${buildCommand}`;
|
|
195531
195487
|
updateMessage("Deploying site...");
|
|
195532
|
-
return await deploySite(
|
|
195488
|
+
return await deploySite(join13(resolvedPath, outputDirectory));
|
|
195533
195489
|
}, {
|
|
195534
195490
|
successMessage: theme.colors.base44Orange("Site deployed successfully"),
|
|
195535
195491
|
errorMessage: "Failed to deploy site"
|
|
@@ -195930,10 +195886,10 @@ function toPascalCase(name2) {
|
|
|
195930
195886
|
return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
|
|
195931
195887
|
}
|
|
195932
195888
|
// src/core/types/update-project.ts
|
|
195933
|
-
import { join as
|
|
195889
|
+
import { join as join16 } from "node:path";
|
|
195934
195890
|
var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
|
|
195935
195891
|
async function updateProjectConfig(projectRoot) {
|
|
195936
|
-
const tsconfigPath =
|
|
195892
|
+
const tsconfigPath = join16(projectRoot, "tsconfig.json");
|
|
195937
195893
|
if (!await pathExists(tsconfigPath)) {
|
|
195938
195894
|
return false;
|
|
195939
195895
|
}
|
|
@@ -195976,7 +195932,7 @@ function getTypesCommand(context) {
|
|
|
195976
195932
|
}
|
|
195977
195933
|
|
|
195978
195934
|
// src/cli/commands/dev.ts
|
|
195979
|
-
import { dirname as
|
|
195935
|
+
import { dirname as dirname13, join as join18 } from "node:path";
|
|
195980
195936
|
|
|
195981
195937
|
// src/cli/dev/dev-server/main.ts
|
|
195982
195938
|
var import_cors = __toESM(require_lib4(), 1);
|
|
@@ -196124,10 +196080,10 @@ function createDevLogger() {
|
|
|
196124
196080
|
|
|
196125
196081
|
// src/cli/dev/dev-server/function-manager.ts
|
|
196126
196082
|
import { spawn as spawn2, spawnSync as spawnSync2 } from "node:child_process";
|
|
196127
|
-
import { dirname as
|
|
196083
|
+
import { dirname as dirname12, join as join17 } from "node:path";
|
|
196128
196084
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
196129
|
-
var __dirname5 =
|
|
196130
|
-
var WRAPPER_PATH =
|
|
196085
|
+
var __dirname5 = dirname12(fileURLToPath7(import.meta.url));
|
|
196086
|
+
var WRAPPER_PATH = join17(__dirname5, "../deno-runtime/main.js");
|
|
196131
196087
|
var READY_TIMEOUT = 30000;
|
|
196132
196088
|
|
|
196133
196089
|
class FunctionManager {
|
|
@@ -196379,8 +196335,8 @@ async function devAction(options8) {
|
|
|
196379
196335
|
port,
|
|
196380
196336
|
loadResources: async () => {
|
|
196381
196337
|
const { project: project2 } = await readProjectConfig();
|
|
196382
|
-
const configDir =
|
|
196383
|
-
const functions = await functionResource.readAll(
|
|
196338
|
+
const configDir = dirname13(project2.configPath);
|
|
196339
|
+
const functions = await functionResource.readAll(join18(configDir, project2.functionsDir));
|
|
196384
196340
|
return { functions };
|
|
196385
196341
|
}
|
|
196386
196342
|
});
|
|
@@ -196545,7 +196501,7 @@ function nanoid3(size = 21) {
|
|
|
196545
196501
|
}
|
|
196546
196502
|
|
|
196547
196503
|
// node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
196548
|
-
import { dirname as
|
|
196504
|
+
import { dirname as dirname14, posix, sep } from "path";
|
|
196549
196505
|
function createModulerModifier() {
|
|
196550
196506
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
196551
196507
|
return async (frames) => {
|
|
@@ -196554,7 +196510,7 @@ function createModulerModifier() {
|
|
|
196554
196510
|
return frames;
|
|
196555
196511
|
};
|
|
196556
196512
|
}
|
|
196557
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
196513
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname14(process.argv[1]) : process.cwd(), isWindows4 = sep === "\\") {
|
|
196558
196514
|
const normalizedBase = isWindows4 ? normalizeWindowsPath2(basePath) : basePath;
|
|
196559
196515
|
return (filename) => {
|
|
196560
196516
|
if (!filename)
|
|
@@ -200771,4 +200727,4 @@ export {
|
|
|
200771
200727
|
CLIExitError
|
|
200772
200728
|
};
|
|
200773
200729
|
|
|
200774
|
-
//# debugId=
|
|
200730
|
+
//# debugId=697B3D716023987F64756E2164756E21
|