@base44-preview/cli 0.0.41-pr.381.83d161e → 0.0.41-pr.382.2e92b95
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 +204 -128
- package/dist/cli/index.js.map +8 -8
- package/package.json +85 -86
package/dist/cli/index.js
CHANGED
|
@@ -18040,7 +18040,7 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
18040
18040
|
}
|
|
18041
18041
|
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
|
|
18042
18042
|
});
|
|
18043
|
-
function
|
|
18043
|
+
function join15(array2, separator) {
|
|
18044
18044
|
return array2 == null ? "" : nativeJoin.call(array2, separator);
|
|
18045
18045
|
}
|
|
18046
18046
|
function last(array2) {
|
|
@@ -18062,7 +18062,7 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
18062
18062
|
function nth(array2, n2) {
|
|
18063
18063
|
return array2 && array2.length ? baseNth(array2, toInteger(n2)) : undefined2;
|
|
18064
18064
|
}
|
|
18065
|
-
var
|
|
18065
|
+
var pull2 = baseRest(pullAll);
|
|
18066
18066
|
function pullAll(array2, values2) {
|
|
18067
18067
|
return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2) : array2;
|
|
18068
18068
|
}
|
|
@@ -19827,7 +19827,7 @@ __p += '`;
|
|
|
19827
19827
|
lodash.pickBy = pickBy;
|
|
19828
19828
|
lodash.property = property;
|
|
19829
19829
|
lodash.propertyOf = propertyOf;
|
|
19830
|
-
lodash.pull =
|
|
19830
|
+
lodash.pull = pull2;
|
|
19831
19831
|
lodash.pullAll = pullAll;
|
|
19832
19832
|
lodash.pullAllBy = pullAllBy;
|
|
19833
19833
|
lodash.pullAllWith = pullAllWith;
|
|
@@ -19972,7 +19972,7 @@ __p += '`;
|
|
|
19972
19972
|
lodash.isUndefined = isUndefined;
|
|
19973
19973
|
lodash.isWeakMap = isWeakMap;
|
|
19974
19974
|
lodash.isWeakSet = isWeakSet;
|
|
19975
|
-
lodash.join =
|
|
19975
|
+
lodash.join = join15;
|
|
19976
19976
|
lodash.kebabCase = kebabCase2;
|
|
19977
19977
|
lodash.last = last;
|
|
19978
19978
|
lodash.lastIndexOf = lastIndexOf;
|
|
@@ -20601,7 +20601,7 @@ function cleanDoc(doc2) {
|
|
|
20601
20601
|
return mapDoc(doc2, (currentDoc) => cleanDocFn(currentDoc));
|
|
20602
20602
|
}
|
|
20603
20603
|
function replaceEndOfLine(doc2, replacement = literalline) {
|
|
20604
|
-
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
20604
|
+
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ? join15(replacement, currentDoc.split(`
|
|
20605
20605
|
`)) : currentDoc);
|
|
20606
20606
|
}
|
|
20607
20607
|
function canBreakFn(doc2) {
|
|
@@ -20681,7 +20681,7 @@ function indentIfBreak(contents, options) {
|
|
|
20681
20681
|
negate: options.negate
|
|
20682
20682
|
};
|
|
20683
20683
|
}
|
|
20684
|
-
function
|
|
20684
|
+
function join15(separator, docs) {
|
|
20685
20685
|
assertDoc(separator);
|
|
20686
20686
|
assertDocArray(docs);
|
|
20687
20687
|
const parts = [];
|
|
@@ -21392,7 +21392,7 @@ var init_doc = __esm(() => {
|
|
|
21392
21392
|
MODE_FLAT = Symbol("MODE_FLAT");
|
|
21393
21393
|
DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
|
|
21394
21394
|
builders = {
|
|
21395
|
-
join:
|
|
21395
|
+
join: join15,
|
|
21396
21396
|
line,
|
|
21397
21397
|
softline,
|
|
21398
21398
|
hardline,
|
|
@@ -126306,7 +126306,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
126306
126306
|
return mapDoc2(doc2, (currentDoc) => cleanDocFn2(currentDoc));
|
|
126307
126307
|
}
|
|
126308
126308
|
function replaceEndOfLine2(doc2, replacement = literalline2) {
|
|
126309
|
-
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
126309
|
+
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ? join17(replacement, currentDoc.split(`
|
|
126310
126310
|
`)) : currentDoc);
|
|
126311
126311
|
}
|
|
126312
126312
|
function canBreakFn2(doc2) {
|
|
@@ -126392,7 +126392,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
126392
126392
|
negate: options8.negate
|
|
126393
126393
|
};
|
|
126394
126394
|
}
|
|
126395
|
-
function
|
|
126395
|
+
function join17(separator, docs) {
|
|
126396
126396
|
assertDoc2(separator);
|
|
126397
126397
|
assertDocArray2(docs);
|
|
126398
126398
|
const parts = [];
|
|
@@ -127057,7 +127057,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
127057
127057
|
}
|
|
127058
127058
|
}
|
|
127059
127059
|
var builders2 = {
|
|
127060
|
-
join:
|
|
127060
|
+
join: join17,
|
|
127061
127061
|
line: line3,
|
|
127062
127062
|
softline: softline2,
|
|
127063
127063
|
hardline: hardline4,
|
|
@@ -153497,10 +153497,10 @@ var require_view = __commonJS((exports, module) => {
|
|
|
153497
153497
|
var debug = require_src4()("express:view");
|
|
153498
153498
|
var path18 = __require("node:path");
|
|
153499
153499
|
var fs28 = __require("node:fs");
|
|
153500
|
-
var
|
|
153500
|
+
var dirname12 = path18.dirname;
|
|
153501
153501
|
var basename4 = path18.basename;
|
|
153502
153502
|
var extname2 = path18.extname;
|
|
153503
|
-
var
|
|
153503
|
+
var join18 = path18.join;
|
|
153504
153504
|
var resolve6 = path18.resolve;
|
|
153505
153505
|
module.exports = View;
|
|
153506
153506
|
function View(name2, options8) {
|
|
@@ -153536,7 +153536,7 @@ var require_view = __commonJS((exports, module) => {
|
|
|
153536
153536
|
for (var i5 = 0;i5 < roots.length && !path19; i5++) {
|
|
153537
153537
|
var root2 = roots[i5];
|
|
153538
153538
|
var loc = resolve6(root2, name2);
|
|
153539
|
-
var dir =
|
|
153539
|
+
var dir = dirname12(loc);
|
|
153540
153540
|
var file2 = basename4(loc);
|
|
153541
153541
|
path19 = this.resolve(dir, file2);
|
|
153542
153542
|
}
|
|
@@ -153562,12 +153562,12 @@ var require_view = __commonJS((exports, module) => {
|
|
|
153562
153562
|
};
|
|
153563
153563
|
View.prototype.resolve = function resolve7(dir, file2) {
|
|
153564
153564
|
var ext = this.ext;
|
|
153565
|
-
var path19 =
|
|
153565
|
+
var path19 = join18(dir, file2);
|
|
153566
153566
|
var stat2 = tryStat(path19);
|
|
153567
153567
|
if (stat2 && stat2.isFile()) {
|
|
153568
153568
|
return path19;
|
|
153569
153569
|
}
|
|
153570
|
-
path19 =
|
|
153570
|
+
path19 = join18(dir, basename4(file2, ext), "index" + ext);
|
|
153571
153571
|
stat2 = tryStat(path19);
|
|
153572
153572
|
if (stat2 && stat2.isFile()) {
|
|
153573
153573
|
return path19;
|
|
@@ -157262,7 +157262,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
157262
157262
|
var Stream2 = __require("stream");
|
|
157263
157263
|
var util2 = __require("util");
|
|
157264
157264
|
var extname2 = path18.extname;
|
|
157265
|
-
var
|
|
157265
|
+
var join18 = path18.join;
|
|
157266
157266
|
var normalize = path18.normalize;
|
|
157267
157267
|
var resolve6 = path18.resolve;
|
|
157268
157268
|
var sep = path18.sep;
|
|
@@ -157434,7 +157434,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
157434
157434
|
return res;
|
|
157435
157435
|
}
|
|
157436
157436
|
parts = path19.split(sep);
|
|
157437
|
-
path19 = normalize(
|
|
157437
|
+
path19 = normalize(join18(root2, path19));
|
|
157438
157438
|
} else {
|
|
157439
157439
|
if (UP_PATH_REGEXP.test(path19)) {
|
|
157440
157440
|
debug('malicious path "%s"', path19);
|
|
@@ -157574,7 +157574,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
157574
157574
|
return self2.onStatError(err);
|
|
157575
157575
|
return self2.error(404);
|
|
157576
157576
|
}
|
|
157577
|
-
var p4 =
|
|
157577
|
+
var p4 = join18(path19, self2._index[i5]);
|
|
157578
157578
|
debug('stat "%s"', p4);
|
|
157579
157579
|
fs28.stat(p4, function(err2, stat2) {
|
|
157580
157580
|
if (err2)
|
|
@@ -204169,7 +204169,7 @@ var require_buffer_list = __commonJS((exports, module) => {
|
|
|
204169
204169
|
}
|
|
204170
204170
|
}, {
|
|
204171
204171
|
key: "join",
|
|
204172
|
-
value: function
|
|
204172
|
+
value: function join18(s5) {
|
|
204173
204173
|
if (this.length === 0)
|
|
204174
204174
|
return "";
|
|
204175
204175
|
var p4 = this.head;
|
|
@@ -207880,7 +207880,7 @@ var require_dist5 = __commonJS((exports, module) => {
|
|
|
207880
207880
|
});
|
|
207881
207881
|
|
|
207882
207882
|
// src/cli/index.ts
|
|
207883
|
-
import { dirname as
|
|
207883
|
+
import { dirname as dirname16, join as join21 } from "node:path";
|
|
207884
207884
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
207885
207885
|
|
|
207886
207886
|
// ../../node_modules/commander/esm.mjs
|
|
@@ -207900,7 +207900,7 @@ var {
|
|
|
207900
207900
|
} = import__.default;
|
|
207901
207901
|
|
|
207902
207902
|
// src/cli/commands/agents/pull.ts
|
|
207903
|
-
import { dirname as dirname7, join as
|
|
207903
|
+
import { dirname as dirname7, join as join11 } from "node:path";
|
|
207904
207904
|
|
|
207905
207905
|
// ../../node_modules/@clack/core/dist/index.mjs
|
|
207906
207906
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
@@ -230396,7 +230396,7 @@ var generateGlobTasks = normalizeArguments(generateTasks);
|
|
|
230396
230396
|
var generateGlobTasksSync = normalizeArgumentsSync(generateTasksSync);
|
|
230397
230397
|
|
|
230398
230398
|
// src/core/project/config.ts
|
|
230399
|
-
import { dirname as dirname5, join as
|
|
230399
|
+
import { dirname as dirname5, join as join7 } from "node:path";
|
|
230400
230400
|
|
|
230401
230401
|
// src/core/resources/agent/schema.ts
|
|
230402
230402
|
var EntityOperationSchema = exports_external.enum(["create", "update", "delete", "read"]);
|
|
@@ -231132,6 +231132,31 @@ var DeployFunctionsResponseSchema = exports_external.object({
|
|
|
231132
231132
|
skipped: exports_external.array(exports_external.string()).optional().nullable(),
|
|
231133
231133
|
errors: exports_external.array(exports_external.object({ name: exports_external.string(), message: exports_external.string() })).nullable()
|
|
231134
231134
|
});
|
|
231135
|
+
var FunctionAutomationInfoSchema = exports_external.object({
|
|
231136
|
+
name: exports_external.string(),
|
|
231137
|
+
type: exports_external.string(),
|
|
231138
|
+
is_active: exports_external.boolean()
|
|
231139
|
+
}).transform((data) => ({
|
|
231140
|
+
name: data.name,
|
|
231141
|
+
type: data.type,
|
|
231142
|
+
isActive: data.is_active
|
|
231143
|
+
}));
|
|
231144
|
+
var FunctionInfoSchema = exports_external.object({
|
|
231145
|
+
name: exports_external.string(),
|
|
231146
|
+
deployment_id: exports_external.string(),
|
|
231147
|
+
entry: exports_external.string(),
|
|
231148
|
+
files: exports_external.array(FunctionFileSchema),
|
|
231149
|
+
automations: exports_external.array(FunctionAutomationInfoSchema)
|
|
231150
|
+
}).transform((data) => ({
|
|
231151
|
+
name: data.name,
|
|
231152
|
+
deploymentId: data.deployment_id,
|
|
231153
|
+
entry: data.entry,
|
|
231154
|
+
files: data.files,
|
|
231155
|
+
automations: data.automations
|
|
231156
|
+
}));
|
|
231157
|
+
var ListFunctionsResponseSchema = exports_external.object({
|
|
231158
|
+
functions: exports_external.array(FunctionInfoSchema)
|
|
231159
|
+
});
|
|
231135
231160
|
var LogLevelSchema = exports_external.enum(["info", "warning", "error", "debug"]);
|
|
231136
231161
|
var FunctionLogEntrySchema = exports_external.object({
|
|
231137
231162
|
time: exports_external.string(),
|
|
@@ -231169,16 +231194,6 @@ async function deployFunctions(functions) {
|
|
|
231169
231194
|
}
|
|
231170
231195
|
return result.data;
|
|
231171
231196
|
}
|
|
231172
|
-
async function deleteSingleFunction(name2) {
|
|
231173
|
-
const appClient = getAppClient();
|
|
231174
|
-
try {
|
|
231175
|
-
await appClient.delete(`backend-functions/${encodeURIComponent(name2)}`, {
|
|
231176
|
-
timeout: 60000
|
|
231177
|
-
});
|
|
231178
|
-
} catch (error48) {
|
|
231179
|
-
throw await ApiError.fromHttpError(error48, `deleting function "${name2}"`);
|
|
231180
|
-
}
|
|
231181
|
-
}
|
|
231182
231197
|
function buildLogsQueryString(filters) {
|
|
231183
231198
|
const params = new URLSearchParams;
|
|
231184
231199
|
if (filters.since) {
|
|
@@ -231215,6 +231230,20 @@ async function fetchFunctionLogs(functionName, filters = {}) {
|
|
|
231215
231230
|
}
|
|
231216
231231
|
return result.data;
|
|
231217
231232
|
}
|
|
231233
|
+
async function listDeployedFunctions() {
|
|
231234
|
+
const appClient = getAppClient();
|
|
231235
|
+
let response;
|
|
231236
|
+
try {
|
|
231237
|
+
response = await appClient.get("backend-functions", { timeout: 30000 });
|
|
231238
|
+
} catch (error48) {
|
|
231239
|
+
throw await ApiError.fromHttpError(error48, "listing deployed functions");
|
|
231240
|
+
}
|
|
231241
|
+
const result = ListFunctionsResponseSchema.safeParse(await response.json());
|
|
231242
|
+
if (!result.success) {
|
|
231243
|
+
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
231244
|
+
}
|
|
231245
|
+
return result.data;
|
|
231246
|
+
}
|
|
231218
231247
|
// src/core/resources/function/config.ts
|
|
231219
231248
|
import { basename as basename2, dirname as dirname3, join as join5, relative } from "node:path";
|
|
231220
231249
|
async function readFunctionConfig(configPath) {
|
|
@@ -231310,6 +231339,67 @@ async function pushFunctions(functions) {
|
|
|
231310
231339
|
const functionsWithCode = await Promise.all(functions.map(loadFunctionCode));
|
|
231311
231340
|
return deployFunctions(functionsWithCode);
|
|
231312
231341
|
}
|
|
231342
|
+
// src/core/resources/function/pull.ts
|
|
231343
|
+
import { join as join6 } from "node:path";
|
|
231344
|
+
async function writeFunctions(functionsDir, functions) {
|
|
231345
|
+
const written = [];
|
|
231346
|
+
const skipped = [];
|
|
231347
|
+
for (const fn of functions) {
|
|
231348
|
+
const functionDir = join6(functionsDir, fn.name);
|
|
231349
|
+
const configPath = join6(functionDir, "function.jsonc");
|
|
231350
|
+
if (await isFunctionUnchanged(functionDir, fn)) {
|
|
231351
|
+
skipped.push(fn.name);
|
|
231352
|
+
continue;
|
|
231353
|
+
}
|
|
231354
|
+
const config5 = {
|
|
231355
|
+
name: fn.name,
|
|
231356
|
+
entry: fn.entry
|
|
231357
|
+
};
|
|
231358
|
+
if (fn.automations.length > 0) {
|
|
231359
|
+
config5.automations = fn.automations;
|
|
231360
|
+
}
|
|
231361
|
+
await writeJsonFile(configPath, config5);
|
|
231362
|
+
for (const file2 of fn.files) {
|
|
231363
|
+
await writeFile(join6(functionDir, file2.path), file2.content);
|
|
231364
|
+
}
|
|
231365
|
+
written.push(fn.name);
|
|
231366
|
+
}
|
|
231367
|
+
return { written, skipped };
|
|
231368
|
+
}
|
|
231369
|
+
async function isFunctionUnchanged(functionDir, fn) {
|
|
231370
|
+
if (!await pathExists(functionDir)) {
|
|
231371
|
+
return false;
|
|
231372
|
+
}
|
|
231373
|
+
const configPath = join6(functionDir, "function.jsonc");
|
|
231374
|
+
try {
|
|
231375
|
+
const localConfig = await readJsonFile(configPath);
|
|
231376
|
+
if (localConfig.entry !== fn.entry) {
|
|
231377
|
+
return false;
|
|
231378
|
+
}
|
|
231379
|
+
const localAuto = JSON.stringify(localConfig.automations ?? []);
|
|
231380
|
+
const remoteAuto = JSON.stringify(fn.automations);
|
|
231381
|
+
if (localAuto !== remoteAuto) {
|
|
231382
|
+
return false;
|
|
231383
|
+
}
|
|
231384
|
+
} catch {
|
|
231385
|
+
return false;
|
|
231386
|
+
}
|
|
231387
|
+
for (const file2 of fn.files) {
|
|
231388
|
+
const filePath = join6(functionDir, file2.path);
|
|
231389
|
+
if (!await pathExists(filePath)) {
|
|
231390
|
+
return false;
|
|
231391
|
+
}
|
|
231392
|
+
try {
|
|
231393
|
+
const localContent = await readTextFile(filePath);
|
|
231394
|
+
if (localContent !== file2.content) {
|
|
231395
|
+
return false;
|
|
231396
|
+
}
|
|
231397
|
+
} catch {
|
|
231398
|
+
return false;
|
|
231399
|
+
}
|
|
231400
|
+
}
|
|
231401
|
+
return true;
|
|
231402
|
+
}
|
|
231313
231403
|
// src/core/resources/function/resource.ts
|
|
231314
231404
|
var functionResource = {
|
|
231315
231405
|
readAll: readAllFunctions,
|
|
@@ -231354,10 +231444,10 @@ async function readProjectConfig(projectRoot) {
|
|
|
231354
231444
|
const project = result.data;
|
|
231355
231445
|
const configDir = dirname5(configPath);
|
|
231356
231446
|
const [entities, functions, agents, connectors] = await Promise.all([
|
|
231357
|
-
entityResource.readAll(
|
|
231358
|
-
functionResource.readAll(
|
|
231359
|
-
agentResource.readAll(
|
|
231360
|
-
connectorResource.readAll(
|
|
231447
|
+
entityResource.readAll(join7(configDir, project.entitiesDir)),
|
|
231448
|
+
functionResource.readAll(join7(configDir, project.functionsDir)),
|
|
231449
|
+
agentResource.readAll(join7(configDir, project.agentsDir)),
|
|
231450
|
+
connectorResource.readAll(join7(configDir, project.connectorsDir))
|
|
231361
231451
|
]);
|
|
231362
231452
|
return {
|
|
231363
231453
|
project: { ...project, root, configPath },
|
|
@@ -231454,12 +231544,12 @@ async function readAppConfig(projectRoot) {
|
|
|
231454
231544
|
// src/core/project/template.ts
|
|
231455
231545
|
var import_ejs = __toESM(require_ejs(), 1);
|
|
231456
231546
|
var import_front_matter = __toESM(require_front_matter(), 1);
|
|
231457
|
-
import { dirname as dirname6, join as
|
|
231547
|
+
import { dirname as dirname6, join as join9 } from "node:path";
|
|
231458
231548
|
|
|
231459
231549
|
// src/core/assets.ts
|
|
231460
231550
|
import { cpSync, existsSync } from "node:fs";
|
|
231461
231551
|
import { homedir as homedir2 } from "node:os";
|
|
231462
|
-
import { join as
|
|
231552
|
+
import { join as join8 } from "node:path";
|
|
231463
231553
|
// package.json
|
|
231464
231554
|
var package_default = {
|
|
231465
231555
|
name: "base44",
|
|
@@ -231481,10 +231571,10 @@ var package_default = {
|
|
|
231481
231571
|
dev: "./bin/dev.ts",
|
|
231482
231572
|
start: "./bin/run.js",
|
|
231483
231573
|
clean: "rm -rf dist && mkdir -p dist",
|
|
231484
|
-
lint: "biome check src tests",
|
|
231485
|
-
"lint:fix": "biome check --write src tests",
|
|
231486
231574
|
test: "vitest run",
|
|
231487
231575
|
"test:watch": "vitest",
|
|
231576
|
+
lint: "cd ../.. && bun run lint",
|
|
231577
|
+
"lint:fix": "cd ../.. && bun run lint:fix",
|
|
231488
231578
|
"build:binaries": "bun run infra/build-binaries.ts",
|
|
231489
231579
|
"package:binaries": "bun run infra/package-binaries.ts"
|
|
231490
231580
|
},
|
|
@@ -231500,7 +231590,6 @@ var package_default = {
|
|
|
231500
231590
|
url: "https://github.com/base44/cli"
|
|
231501
231591
|
},
|
|
231502
231592
|
devDependencies: {
|
|
231503
|
-
"@biomejs/biome": "^2.0.0",
|
|
231504
231593
|
"@clack/prompts": "^1.0.1",
|
|
231505
231594
|
"@seald-io/nedb": "^4.1.2",
|
|
231506
231595
|
"@types/bun": "^1.2.15",
|
|
@@ -231551,15 +231640,15 @@ var package_default = {
|
|
|
231551
231640
|
};
|
|
231552
231641
|
|
|
231553
231642
|
// src/core/assets.ts
|
|
231554
|
-
var ASSETS_DIR =
|
|
231643
|
+
var ASSETS_DIR = join8(homedir2(), ".base44", "assets", package_default.version);
|
|
231555
231644
|
function getTemplatesDir() {
|
|
231556
|
-
return
|
|
231645
|
+
return join8(ASSETS_DIR, "templates");
|
|
231557
231646
|
}
|
|
231558
231647
|
function getTemplatesIndexPath() {
|
|
231559
|
-
return
|
|
231648
|
+
return join8(ASSETS_DIR, "templates", "templates.json");
|
|
231560
231649
|
}
|
|
231561
231650
|
function getDenoWrapperPath() {
|
|
231562
|
-
return
|
|
231651
|
+
return join8(ASSETS_DIR, "deno-runtime", "main.js");
|
|
231563
231652
|
}
|
|
231564
231653
|
function ensureNpmAssets(sourceDir) {
|
|
231565
231654
|
if (existsSync(ASSETS_DIR))
|
|
@@ -231580,23 +231669,23 @@ async function listTemplates() {
|
|
|
231580
231669
|
return result.data.templates;
|
|
231581
231670
|
}
|
|
231582
231671
|
async function renderTemplate(template, destPath, data) {
|
|
231583
|
-
const templateDir =
|
|
231672
|
+
const templateDir = join9(getTemplatesDir(), template.path);
|
|
231584
231673
|
const files = await globby("**/*", {
|
|
231585
231674
|
cwd: templateDir,
|
|
231586
231675
|
dot: true,
|
|
231587
231676
|
onlyFiles: true
|
|
231588
231677
|
});
|
|
231589
231678
|
for (const file2 of files) {
|
|
231590
|
-
const srcPath =
|
|
231679
|
+
const srcPath = join9(templateDir, file2);
|
|
231591
231680
|
try {
|
|
231592
231681
|
if (file2.endsWith(".ejs")) {
|
|
231593
231682
|
const rendered = await import_ejs.default.renderFile(srcPath, data);
|
|
231594
231683
|
const { attributes, body } = import_front_matter.default(rendered);
|
|
231595
|
-
const destFile = attributes.outputFileName ?
|
|
231596
|
-
const destFilePath =
|
|
231684
|
+
const destFile = attributes.outputFileName ? join9(dirname6(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
|
|
231685
|
+
const destFilePath = join9(destPath, destFile);
|
|
231597
231686
|
await writeFile(destFilePath, body);
|
|
231598
231687
|
} else {
|
|
231599
|
-
const destFilePath =
|
|
231688
|
+
const destFilePath = join9(destPath, file2);
|
|
231600
231689
|
await copyFile(srcPath, destFilePath);
|
|
231601
231690
|
}
|
|
231602
231691
|
} catch (error48) {
|
|
@@ -231695,7 +231784,7 @@ async function getSiteFilePaths(outputDir) {
|
|
|
231695
231784
|
// src/core/site/deploy.ts
|
|
231696
231785
|
import { randomUUID } from "node:crypto";
|
|
231697
231786
|
import { tmpdir } from "node:os";
|
|
231698
|
-
import { join as
|
|
231787
|
+
import { join as join10 } from "node:path";
|
|
231699
231788
|
async function deploySite(siteOutputDir) {
|
|
231700
231789
|
if (!await pathExists(siteOutputDir)) {
|
|
231701
231790
|
throw new InvalidInputError(`Output directory does not exist: ${siteOutputDir}. Make sure to build your project first.`, {
|
|
@@ -231712,7 +231801,7 @@ async function deploySite(siteOutputDir) {
|
|
|
231712
231801
|
]
|
|
231713
231802
|
});
|
|
231714
231803
|
}
|
|
231715
|
-
const archivePath =
|
|
231804
|
+
const archivePath = join10(tmpdir(), `base44-site-${randomUUID()}.tar.gz`);
|
|
231716
231805
|
try {
|
|
231717
231806
|
await createArchive(siteOutputDir, archivePath);
|
|
231718
231807
|
return await uploadSite(archivePath);
|
|
@@ -239401,7 +239490,7 @@ function getDashboardUrl(projectId) {
|
|
|
239401
239490
|
async function pullAgentsAction() {
|
|
239402
239491
|
const { project: project2 } = await readProjectConfig();
|
|
239403
239492
|
const configDir = dirname7(project2.configPath);
|
|
239404
|
-
const agentsDir =
|
|
239493
|
+
const agentsDir = join11(configDir, project2.agentsDir);
|
|
239405
239494
|
const remoteAgents = await runTask("Fetching agents from Base44", async () => {
|
|
239406
239495
|
return await fetchAgents();
|
|
239407
239496
|
}, {
|
|
@@ -239495,11 +239584,11 @@ function getWhoamiCommand(context) {
|
|
|
239495
239584
|
}
|
|
239496
239585
|
|
|
239497
239586
|
// src/cli/commands/connectors/pull.ts
|
|
239498
|
-
import { dirname as dirname8, join as
|
|
239587
|
+
import { dirname as dirname8, join as join12 } from "node:path";
|
|
239499
239588
|
async function pullConnectorsAction() {
|
|
239500
239589
|
const { project: project2 } = await readProjectConfig();
|
|
239501
239590
|
const configDir = dirname8(project2.configPath);
|
|
239502
|
-
const connectorsDir =
|
|
239591
|
+
const connectorsDir = join12(configDir, project2.connectorsDir);
|
|
239503
239592
|
const remoteConnectors = await runTask("Fetching connectors from Base44", async () => {
|
|
239504
239593
|
return await listConnectors();
|
|
239505
239594
|
}, {
|
|
@@ -240347,63 +240436,6 @@ function getEntitiesPushCommand(context) {
|
|
|
240347
240436
|
}));
|
|
240348
240437
|
}
|
|
240349
240438
|
|
|
240350
|
-
// src/cli/utils/parseNames.ts
|
|
240351
|
-
function parseNames(args) {
|
|
240352
|
-
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
240353
|
-
}
|
|
240354
|
-
|
|
240355
|
-
// src/cli/commands/functions/delete.ts
|
|
240356
|
-
async function deleteFunctionsAction(names) {
|
|
240357
|
-
let deleted = 0;
|
|
240358
|
-
let notFound = 0;
|
|
240359
|
-
let errors4 = 0;
|
|
240360
|
-
let completed = 0;
|
|
240361
|
-
const total = names.length;
|
|
240362
|
-
for (const name2 of names) {
|
|
240363
|
-
R2.step(theme.styles.dim(`[${completed + 1}/${total}] Deleting ${name2}...`));
|
|
240364
|
-
try {
|
|
240365
|
-
await deleteSingleFunction(name2);
|
|
240366
|
-
R2.success(`${name2.padEnd(25)} deleted`);
|
|
240367
|
-
deleted++;
|
|
240368
|
-
} catch (error48) {
|
|
240369
|
-
if (error48 instanceof ApiError && error48.statusCode === 404) {
|
|
240370
|
-
R2.warn(`${name2.padEnd(25)} not found`);
|
|
240371
|
-
notFound++;
|
|
240372
|
-
} else {
|
|
240373
|
-
R2.error(`${name2.padEnd(25)} error: ${error48 instanceof Error ? error48.message : String(error48)}`);
|
|
240374
|
-
errors4++;
|
|
240375
|
-
}
|
|
240376
|
-
}
|
|
240377
|
-
completed++;
|
|
240378
|
-
}
|
|
240379
|
-
if (names.length === 1) {
|
|
240380
|
-
if (deleted)
|
|
240381
|
-
return { outroMessage: `Function "${names[0]}" deleted` };
|
|
240382
|
-
if (notFound)
|
|
240383
|
-
return { outroMessage: `Function "${names[0]}" not found` };
|
|
240384
|
-
return { outroMessage: `Failed to delete "${names[0]}"` };
|
|
240385
|
-
}
|
|
240386
|
-
const parts = [];
|
|
240387
|
-
if (deleted > 0)
|
|
240388
|
-
parts.push(`${deleted}/${total} deleted`);
|
|
240389
|
-
if (notFound > 0)
|
|
240390
|
-
parts.push(`${notFound} not found`);
|
|
240391
|
-
if (errors4 > 0)
|
|
240392
|
-
parts.push(`${errors4} error${errors4 !== 1 ? "s" : ""}`);
|
|
240393
|
-
return { outroMessage: parts.join(", ") };
|
|
240394
|
-
}
|
|
240395
|
-
function getDeleteCommand(context) {
|
|
240396
|
-
return new Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").action(async (rawNames) => {
|
|
240397
|
-
await runCommand(() => {
|
|
240398
|
-
const names = parseNames(rawNames);
|
|
240399
|
-
if (names.length === 0) {
|
|
240400
|
-
throw new InvalidInputError("At least one function name is required");
|
|
240401
|
-
}
|
|
240402
|
-
return deleteFunctionsAction(names);
|
|
240403
|
-
}, { requireAuth: true }, context);
|
|
240404
|
-
});
|
|
240405
|
-
}
|
|
240406
|
-
|
|
240407
240439
|
// src/cli/commands/functions/deploy.ts
|
|
240408
240440
|
async function deployFunctionsAction() {
|
|
240409
240441
|
const { functions } = await readProjectConfig();
|
|
@@ -240442,13 +240474,57 @@ function getDeployCommand(context) {
|
|
|
240442
240474
|
});
|
|
240443
240475
|
}
|
|
240444
240476
|
|
|
240477
|
+
// src/cli/commands/functions/pull.ts
|
|
240478
|
+
import { dirname as dirname9, join as join13 } from "node:path";
|
|
240479
|
+
async function pullFunctionsAction(name2) {
|
|
240480
|
+
const { project: project2 } = await readProjectConfig();
|
|
240481
|
+
const configDir = dirname9(project2.configPath);
|
|
240482
|
+
const functionsDir = join13(configDir, project2.functionsDir);
|
|
240483
|
+
const remoteFunctions = await runTask("Fetching functions from Base44", async () => {
|
|
240484
|
+
const { functions } = await listDeployedFunctions();
|
|
240485
|
+
return functions;
|
|
240486
|
+
}, {
|
|
240487
|
+
successMessage: "Functions fetched successfully",
|
|
240488
|
+
errorMessage: "Failed to fetch functions"
|
|
240489
|
+
});
|
|
240490
|
+
const toPull = name2 ? remoteFunctions.filter((f) => f.name === name2) : remoteFunctions;
|
|
240491
|
+
if (name2 && toPull.length === 0) {
|
|
240492
|
+
return {
|
|
240493
|
+
outroMessage: `Function "${name2}" not found on remote`
|
|
240494
|
+
};
|
|
240495
|
+
}
|
|
240496
|
+
if (toPull.length === 0) {
|
|
240497
|
+
return { outroMessage: "No functions found on remote" };
|
|
240498
|
+
}
|
|
240499
|
+
const { written, skipped } = await runTask("Writing function files", async () => {
|
|
240500
|
+
return await writeFunctions(functionsDir, toPull);
|
|
240501
|
+
}, {
|
|
240502
|
+
successMessage: "Function files written successfully",
|
|
240503
|
+
errorMessage: "Failed to write function files"
|
|
240504
|
+
});
|
|
240505
|
+
for (const name3 of written) {
|
|
240506
|
+
R2.success(`${name3.padEnd(25)} written`);
|
|
240507
|
+
}
|
|
240508
|
+
for (const name3 of skipped) {
|
|
240509
|
+
R2.info(`${name3.padEnd(25)} unchanged`);
|
|
240510
|
+
}
|
|
240511
|
+
return {
|
|
240512
|
+
outroMessage: `Pulled ${toPull.length} function${toPull.length !== 1 ? "s" : ""} to ${functionsDir}`
|
|
240513
|
+
};
|
|
240514
|
+
}
|
|
240515
|
+
function getPullCommand(context) {
|
|
240516
|
+
return new Command("pull").description("Pull deployed functions from Base44").argument("[name]", "Pull a single function by name").action(async (name2) => {
|
|
240517
|
+
await runCommand(() => pullFunctionsAction(name2), { requireAuth: true }, context);
|
|
240518
|
+
});
|
|
240519
|
+
}
|
|
240520
|
+
|
|
240445
240521
|
// src/cli/commands/functions/index.ts
|
|
240446
240522
|
function getFunctionsCommand(context) {
|
|
240447
|
-
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(
|
|
240523
|
+
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getPullCommand(context));
|
|
240448
240524
|
}
|
|
240449
240525
|
|
|
240450
240526
|
// src/cli/commands/project/create.ts
|
|
240451
|
-
import { basename as basename3, join as
|
|
240527
|
+
import { basename as basename3, join as join14, resolve as resolve2 } from "node:path";
|
|
240452
240528
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
240453
240529
|
var DEFAULT_TEMPLATE_ID = "backend-only";
|
|
240454
240530
|
async function getTemplateById(templateId) {
|
|
@@ -240584,7 +240660,7 @@ async function executeCreate({
|
|
|
240584
240660
|
updateMessage("Building project...");
|
|
240585
240661
|
await execa({ cwd: resolvedPath, shell: true })`${buildCommand}`;
|
|
240586
240662
|
updateMessage("Deploying site...");
|
|
240587
|
-
return await deploySite(
|
|
240663
|
+
return await deploySite(join14(resolvedPath, outputDirectory));
|
|
240588
240664
|
}, {
|
|
240589
240665
|
successMessage: theme.colors.base44Orange("Site deployed successfully"),
|
|
240590
240666
|
errorMessage: "Failed to deploy site"
|
|
@@ -241210,10 +241286,10 @@ function toPascalCase(name2) {
|
|
|
241210
241286
|
return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
|
|
241211
241287
|
}
|
|
241212
241288
|
// src/core/types/update-project.ts
|
|
241213
|
-
import { join as
|
|
241289
|
+
import { join as join17 } from "node:path";
|
|
241214
241290
|
var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
|
|
241215
241291
|
async function updateProjectConfig(projectRoot) {
|
|
241216
|
-
const tsconfigPath =
|
|
241292
|
+
const tsconfigPath = join17(projectRoot, "tsconfig.json");
|
|
241217
241293
|
if (!await pathExists(tsconfigPath)) {
|
|
241218
241294
|
return false;
|
|
241219
241295
|
}
|
|
@@ -241256,7 +241332,7 @@ function getTypesCommand(context) {
|
|
|
241256
241332
|
}
|
|
241257
241333
|
|
|
241258
241334
|
// src/cli/dev/dev-server/main.ts
|
|
241259
|
-
import { dirname as
|
|
241335
|
+
import { dirname as dirname14, join as join20 } from "node:path";
|
|
241260
241336
|
var import_cors = __toESM(require_lib4(), 1);
|
|
241261
241337
|
var import_express4 = __toESM(require_express(), 1);
|
|
241262
241338
|
|
|
@@ -242720,9 +242796,9 @@ class NodeFsHandler {
|
|
|
242720
242796
|
if (this.fsw.closed) {
|
|
242721
242797
|
return;
|
|
242722
242798
|
}
|
|
242723
|
-
const
|
|
242799
|
+
const dirname13 = sp2.dirname(file2);
|
|
242724
242800
|
const basename5 = sp2.basename(file2);
|
|
242725
|
-
const parent = this.fsw._getWatchedDir(
|
|
242801
|
+
const parent = this.fsw._getWatchedDir(dirname13);
|
|
242726
242802
|
let prevStats = stats;
|
|
242727
242803
|
if (parent.has(basename5))
|
|
242728
242804
|
return;
|
|
@@ -242749,7 +242825,7 @@ class NodeFsHandler {
|
|
|
242749
242825
|
prevStats = newStats2;
|
|
242750
242826
|
}
|
|
242751
242827
|
} catch (error48) {
|
|
242752
|
-
this.fsw._remove(
|
|
242828
|
+
this.fsw._remove(dirname13, basename5);
|
|
242753
242829
|
}
|
|
242754
242830
|
} else if (parent.has(basename5)) {
|
|
242755
242831
|
const at13 = newStats.atimeMs;
|
|
@@ -243752,8 +243828,8 @@ async function createDevServer(options8) {
|
|
|
243752
243828
|
broadcastEntityEvent(io6, appId, entityName, event);
|
|
243753
243829
|
};
|
|
243754
243830
|
const base44ConfigWatcher = new WatchBase44({
|
|
243755
|
-
functions:
|
|
243756
|
-
entities:
|
|
243831
|
+
functions: join20(dirname14(project2.configPath), project2.functionsDir),
|
|
243832
|
+
entities: join20(dirname14(project2.configPath), project2.entitiesDir)
|
|
243757
243833
|
}, devLogger);
|
|
243758
243834
|
base44ConfigWatcher.on("change", async (name2) => {
|
|
243759
243835
|
try {
|
|
@@ -243943,7 +244019,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
|
|
|
243943
244019
|
import { release, type } from "node:os";
|
|
243944
244020
|
|
|
243945
244021
|
// ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
243946
|
-
import { dirname as
|
|
244022
|
+
import { dirname as dirname15, posix, sep } from "path";
|
|
243947
244023
|
function createModulerModifier() {
|
|
243948
244024
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
243949
244025
|
return async (frames) => {
|
|
@@ -243952,7 +244028,7 @@ function createModulerModifier() {
|
|
|
243952
244028
|
return frames;
|
|
243953
244029
|
};
|
|
243954
244030
|
}
|
|
243955
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
244031
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname15(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
|
|
243956
244032
|
const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
|
|
243957
244033
|
return (filename) => {
|
|
243958
244034
|
if (!filename)
|
|
@@ -248141,9 +248217,9 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
|
|
|
248141
248217
|
});
|
|
248142
248218
|
}
|
|
248143
248219
|
// src/cli/index.ts
|
|
248144
|
-
var __dirname4 =
|
|
248220
|
+
var __dirname4 = dirname16(fileURLToPath6(import.meta.url));
|
|
248145
248221
|
async function runCLI() {
|
|
248146
|
-
ensureNpmAssets(
|
|
248222
|
+
ensureNpmAssets(join21(__dirname4, "../assets"));
|
|
248147
248223
|
const errorReporter = new ErrorReporter;
|
|
248148
248224
|
errorReporter.registerProcessErrorHandlers();
|
|
248149
248225
|
const isNonInteractive = !process.stdin.isTTY || !process.stdout.isTTY;
|
|
@@ -248175,4 +248251,4 @@ export {
|
|
|
248175
248251
|
CLIExitError
|
|
248176
248252
|
};
|
|
248177
248253
|
|
|
248178
|
-
//# debugId=
|
|
248254
|
+
//# debugId=1056C7A83C6B58A564756E2164756E21
|