@base44-preview/cli 0.0.41-pr.381.a8fd299 → 0.0.41-pr.382.2c52895
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 +202 -125
- package/dist/cli/index.js.map +8 -8
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -16459,7 +16459,7 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
16459
16459
|
}
|
|
16460
16460
|
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
|
|
16461
16461
|
});
|
|
16462
|
-
function
|
|
16462
|
+
function join11(array2, separator) {
|
|
16463
16463
|
return array2 == null ? "" : nativeJoin.call(array2, separator);
|
|
16464
16464
|
}
|
|
16465
16465
|
function last(array2) {
|
|
@@ -16481,7 +16481,7 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
16481
16481
|
function nth(array2, n2) {
|
|
16482
16482
|
return array2 && array2.length ? baseNth(array2, toInteger(n2)) : undefined2;
|
|
16483
16483
|
}
|
|
16484
|
-
var
|
|
16484
|
+
var pull2 = baseRest(pullAll);
|
|
16485
16485
|
function pullAll(array2, values2) {
|
|
16486
16486
|
return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2) : array2;
|
|
16487
16487
|
}
|
|
@@ -18246,7 +18246,7 @@ __p += '`;
|
|
|
18246
18246
|
lodash.pickBy = pickBy;
|
|
18247
18247
|
lodash.property = property;
|
|
18248
18248
|
lodash.propertyOf = propertyOf;
|
|
18249
|
-
lodash.pull =
|
|
18249
|
+
lodash.pull = pull2;
|
|
18250
18250
|
lodash.pullAll = pullAll;
|
|
18251
18251
|
lodash.pullAllBy = pullAllBy;
|
|
18252
18252
|
lodash.pullAllWith = pullAllWith;
|
|
@@ -18391,7 +18391,7 @@ __p += '`;
|
|
|
18391
18391
|
lodash.isUndefined = isUndefined;
|
|
18392
18392
|
lodash.isWeakMap = isWeakMap;
|
|
18393
18393
|
lodash.isWeakSet = isWeakSet;
|
|
18394
|
-
lodash.join =
|
|
18394
|
+
lodash.join = join11;
|
|
18395
18395
|
lodash.kebabCase = kebabCase;
|
|
18396
18396
|
lodash.last = last;
|
|
18397
18397
|
lodash.lastIndexOf = lastIndexOf;
|
|
@@ -27503,7 +27503,7 @@ function cleanDoc(doc2) {
|
|
|
27503
27503
|
return mapDoc(doc2, (currentDoc) => cleanDocFn(currentDoc));
|
|
27504
27504
|
}
|
|
27505
27505
|
function replaceEndOfLine(doc2, replacement = literalline) {
|
|
27506
|
-
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
27506
|
+
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ? join15(replacement, currentDoc.split(`
|
|
27507
27507
|
`)) : currentDoc);
|
|
27508
27508
|
}
|
|
27509
27509
|
function canBreakFn(doc2) {
|
|
@@ -27583,7 +27583,7 @@ function indentIfBreak(contents, options) {
|
|
|
27583
27583
|
negate: options.negate
|
|
27584
27584
|
};
|
|
27585
27585
|
}
|
|
27586
|
-
function
|
|
27586
|
+
function join15(separator, docs) {
|
|
27587
27587
|
assertDoc(separator);
|
|
27588
27588
|
assertDocArray(docs);
|
|
27589
27589
|
const parts = [];
|
|
@@ -28294,7 +28294,7 @@ var init_doc = __esm(() => {
|
|
|
28294
28294
|
MODE_FLAT = Symbol("MODE_FLAT");
|
|
28295
28295
|
DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
|
|
28296
28296
|
builders = {
|
|
28297
|
-
join:
|
|
28297
|
+
join: join15,
|
|
28298
28298
|
line,
|
|
28299
28299
|
softline,
|
|
28300
28300
|
hardline,
|
|
@@ -133208,7 +133208,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
133208
133208
|
return mapDoc2(doc2, (currentDoc) => cleanDocFn2(currentDoc));
|
|
133209
133209
|
}
|
|
133210
133210
|
function replaceEndOfLine2(doc2, replacement = literalline2) {
|
|
133211
|
-
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
133211
|
+
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ? join17(replacement, currentDoc.split(`
|
|
133212
133212
|
`)) : currentDoc);
|
|
133213
133213
|
}
|
|
133214
133214
|
function canBreakFn2(doc2) {
|
|
@@ -133294,7 +133294,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
133294
133294
|
negate: options8.negate
|
|
133295
133295
|
};
|
|
133296
133296
|
}
|
|
133297
|
-
function
|
|
133297
|
+
function join17(separator, docs) {
|
|
133298
133298
|
assertDoc2(separator);
|
|
133299
133299
|
assertDocArray2(docs);
|
|
133300
133300
|
const parts = [];
|
|
@@ -133959,7 +133959,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
133959
133959
|
}
|
|
133960
133960
|
}
|
|
133961
133961
|
var builders2 = {
|
|
133962
|
-
join:
|
|
133962
|
+
join: join17,
|
|
133963
133963
|
line: line3,
|
|
133964
133964
|
softline: softline2,
|
|
133965
133965
|
hardline: hardline4,
|
|
@@ -160399,10 +160399,10 @@ var require_view = __commonJS((exports, module) => {
|
|
|
160399
160399
|
var debug = require_src4()("express:view");
|
|
160400
160400
|
var path18 = __require("node:path");
|
|
160401
160401
|
var fs28 = __require("node:fs");
|
|
160402
|
-
var
|
|
160402
|
+
var dirname12 = path18.dirname;
|
|
160403
160403
|
var basename4 = path18.basename;
|
|
160404
160404
|
var extname2 = path18.extname;
|
|
160405
|
-
var
|
|
160405
|
+
var join18 = path18.join;
|
|
160406
160406
|
var resolve6 = path18.resolve;
|
|
160407
160407
|
module.exports = View;
|
|
160408
160408
|
function View(name2, options8) {
|
|
@@ -160438,7 +160438,7 @@ var require_view = __commonJS((exports, module) => {
|
|
|
160438
160438
|
for (var i5 = 0;i5 < roots.length && !path19; i5++) {
|
|
160439
160439
|
var root2 = roots[i5];
|
|
160440
160440
|
var loc = resolve6(root2, name2);
|
|
160441
|
-
var dir =
|
|
160441
|
+
var dir = dirname12(loc);
|
|
160442
160442
|
var file2 = basename4(loc);
|
|
160443
160443
|
path19 = this.resolve(dir, file2);
|
|
160444
160444
|
}
|
|
@@ -160464,12 +160464,12 @@ var require_view = __commonJS((exports, module) => {
|
|
|
160464
160464
|
};
|
|
160465
160465
|
View.prototype.resolve = function resolve7(dir, file2) {
|
|
160466
160466
|
var ext = this.ext;
|
|
160467
|
-
var path19 =
|
|
160467
|
+
var path19 = join18(dir, file2);
|
|
160468
160468
|
var stat2 = tryStat(path19);
|
|
160469
160469
|
if (stat2 && stat2.isFile()) {
|
|
160470
160470
|
return path19;
|
|
160471
160471
|
}
|
|
160472
|
-
path19 =
|
|
160472
|
+
path19 = join18(dir, basename4(file2, ext), "index" + ext);
|
|
160473
160473
|
stat2 = tryStat(path19);
|
|
160474
160474
|
if (stat2 && stat2.isFile()) {
|
|
160475
160475
|
return path19;
|
|
@@ -164164,7 +164164,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
164164
164164
|
var Stream2 = __require("stream");
|
|
164165
164165
|
var util2 = __require("util");
|
|
164166
164166
|
var extname2 = path18.extname;
|
|
164167
|
-
var
|
|
164167
|
+
var join18 = path18.join;
|
|
164168
164168
|
var normalize = path18.normalize;
|
|
164169
164169
|
var resolve6 = path18.resolve;
|
|
164170
164170
|
var sep = path18.sep;
|
|
@@ -164336,7 +164336,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
164336
164336
|
return res;
|
|
164337
164337
|
}
|
|
164338
164338
|
parts = path19.split(sep);
|
|
164339
|
-
path19 = normalize(
|
|
164339
|
+
path19 = normalize(join18(root2, path19));
|
|
164340
164340
|
} else {
|
|
164341
164341
|
if (UP_PATH_REGEXP.test(path19)) {
|
|
164342
164342
|
debug('malicious path "%s"', path19);
|
|
@@ -164476,7 +164476,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
164476
164476
|
return self2.onStatError(err);
|
|
164477
164477
|
return self2.error(404);
|
|
164478
164478
|
}
|
|
164479
|
-
var p4 =
|
|
164479
|
+
var p4 = join18(path19, self2._index[i5]);
|
|
164480
164480
|
debug('stat "%s"', p4);
|
|
164481
164481
|
fs28.stat(p4, function(err2, stat2) {
|
|
164482
164482
|
if (err2)
|
|
@@ -211071,7 +211071,7 @@ var require_buffer_list = __commonJS((exports, module) => {
|
|
|
211071
211071
|
}
|
|
211072
211072
|
}, {
|
|
211073
211073
|
key: "join",
|
|
211074
|
-
value: function
|
|
211074
|
+
value: function join18(s5) {
|
|
211075
211075
|
if (this.length === 0)
|
|
211076
211076
|
return "";
|
|
211077
211077
|
var p4 = this.head;
|
|
@@ -214782,7 +214782,7 @@ var require_dist5 = __commonJS((exports, module) => {
|
|
|
214782
214782
|
});
|
|
214783
214783
|
|
|
214784
214784
|
// src/cli/index.ts
|
|
214785
|
-
import { dirname as
|
|
214785
|
+
import { dirname as dirname16, join as join21 } from "node:path";
|
|
214786
214786
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
214787
214787
|
|
|
214788
214788
|
// ../../node_modules/commander/esm.mjs
|
|
@@ -214802,7 +214802,7 @@ var {
|
|
|
214802
214802
|
} = import__.default;
|
|
214803
214803
|
|
|
214804
214804
|
// src/cli/commands/agents/pull.ts
|
|
214805
|
-
import { dirname as dirname7, join as
|
|
214805
|
+
import { dirname as dirname7, join as join11 } from "node:path";
|
|
214806
214806
|
|
|
214807
214807
|
// ../../node_modules/@clack/core/dist/index.mjs
|
|
214808
214808
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
@@ -237298,7 +237298,7 @@ var generateGlobTasks = normalizeArguments(generateTasks);
|
|
|
237298
237298
|
var generateGlobTasksSync = normalizeArgumentsSync(generateTasksSync);
|
|
237299
237299
|
|
|
237300
237300
|
// src/core/project/config.ts
|
|
237301
|
-
import { dirname as dirname5, join as
|
|
237301
|
+
import { dirname as dirname5, join as join7 } from "node:path";
|
|
237302
237302
|
|
|
237303
237303
|
// src/core/resources/agent/schema.ts
|
|
237304
237304
|
var EntityOperationSchema = exports_external.enum(["create", "update", "delete", "read"]);
|
|
@@ -238081,6 +238081,31 @@ var DeployFunctionsResponseSchema = exports_external.object({
|
|
|
238081
238081
|
skipped: exports_external.array(exports_external.string()).optional().nullable(),
|
|
238082
238082
|
errors: exports_external.array(exports_external.object({ name: exports_external.string(), message: exports_external.string() })).nullable()
|
|
238083
238083
|
});
|
|
238084
|
+
var FunctionAutomationInfoSchema = exports_external.object({
|
|
238085
|
+
name: exports_external.string(),
|
|
238086
|
+
type: exports_external.string(),
|
|
238087
|
+
is_active: exports_external.boolean()
|
|
238088
|
+
}).transform((data) => ({
|
|
238089
|
+
name: data.name,
|
|
238090
|
+
type: data.type,
|
|
238091
|
+
isActive: data.is_active
|
|
238092
|
+
}));
|
|
238093
|
+
var FunctionInfoSchema = exports_external.object({
|
|
238094
|
+
name: exports_external.string(),
|
|
238095
|
+
deployment_id: exports_external.string(),
|
|
238096
|
+
entry: exports_external.string(),
|
|
238097
|
+
files: exports_external.array(FunctionFileSchema),
|
|
238098
|
+
automations: exports_external.array(FunctionAutomationInfoSchema)
|
|
238099
|
+
}).transform((data) => ({
|
|
238100
|
+
name: data.name,
|
|
238101
|
+
deploymentId: data.deployment_id,
|
|
238102
|
+
entry: data.entry,
|
|
238103
|
+
files: data.files,
|
|
238104
|
+
automations: data.automations
|
|
238105
|
+
}));
|
|
238106
|
+
var ListFunctionsResponseSchema = exports_external.object({
|
|
238107
|
+
functions: exports_external.array(FunctionInfoSchema)
|
|
238108
|
+
});
|
|
238084
238109
|
var LogLevelSchema = exports_external.enum(["info", "warning", "error", "debug"]);
|
|
238085
238110
|
var FunctionLogEntrySchema = exports_external.object({
|
|
238086
238111
|
time: exports_external.string(),
|
|
@@ -238118,16 +238143,6 @@ async function deployFunctions(functions) {
|
|
|
238118
238143
|
}
|
|
238119
238144
|
return result.data;
|
|
238120
238145
|
}
|
|
238121
|
-
async function deleteSingleFunction(name2) {
|
|
238122
|
-
const appClient = getAppClient();
|
|
238123
|
-
try {
|
|
238124
|
-
await appClient.delete(`backend-functions/${encodeURIComponent(name2)}`, {
|
|
238125
|
-
timeout: 60000
|
|
238126
|
-
});
|
|
238127
|
-
} catch (error48) {
|
|
238128
|
-
throw await ApiError.fromHttpError(error48, `deleting function "${name2}"`);
|
|
238129
|
-
}
|
|
238130
|
-
}
|
|
238131
238146
|
function buildLogsQueryString(filters) {
|
|
238132
238147
|
const params = new URLSearchParams;
|
|
238133
238148
|
if (filters.since) {
|
|
@@ -238164,6 +238179,20 @@ async function fetchFunctionLogs(functionName, filters = {}) {
|
|
|
238164
238179
|
}
|
|
238165
238180
|
return result.data;
|
|
238166
238181
|
}
|
|
238182
|
+
async function listDeployedFunctions() {
|
|
238183
|
+
const appClient = getAppClient();
|
|
238184
|
+
let response;
|
|
238185
|
+
try {
|
|
238186
|
+
response = await appClient.get("backend-functions", { timeout: 30000 });
|
|
238187
|
+
} catch (error48) {
|
|
238188
|
+
throw await ApiError.fromHttpError(error48, "listing deployed functions");
|
|
238189
|
+
}
|
|
238190
|
+
const result = ListFunctionsResponseSchema.safeParse(await response.json());
|
|
238191
|
+
if (!result.success) {
|
|
238192
|
+
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
238193
|
+
}
|
|
238194
|
+
return result.data;
|
|
238195
|
+
}
|
|
238167
238196
|
// src/core/resources/function/config.ts
|
|
238168
238197
|
import { basename as basename2, dirname as dirname3, join as join5, relative } from "node:path";
|
|
238169
238198
|
async function readFunctionConfig(configPath) {
|
|
@@ -238259,6 +238288,67 @@ async function pushFunctions(functions) {
|
|
|
238259
238288
|
const functionsWithCode = await Promise.all(functions.map(loadFunctionCode));
|
|
238260
238289
|
return deployFunctions(functionsWithCode);
|
|
238261
238290
|
}
|
|
238291
|
+
// src/core/resources/function/pull.ts
|
|
238292
|
+
import { join as join6 } from "node:path";
|
|
238293
|
+
async function writeFunctions(functionsDir, functions) {
|
|
238294
|
+
const written = [];
|
|
238295
|
+
const skipped = [];
|
|
238296
|
+
for (const fn of functions) {
|
|
238297
|
+
const functionDir = join6(functionsDir, fn.name);
|
|
238298
|
+
const configPath = join6(functionDir, "function.jsonc");
|
|
238299
|
+
if (await isFunctionUnchanged(functionDir, fn)) {
|
|
238300
|
+
skipped.push(fn.name);
|
|
238301
|
+
continue;
|
|
238302
|
+
}
|
|
238303
|
+
const config5 = {
|
|
238304
|
+
name: fn.name,
|
|
238305
|
+
entry: fn.entry
|
|
238306
|
+
};
|
|
238307
|
+
if (fn.automations.length > 0) {
|
|
238308
|
+
config5.automations = fn.automations;
|
|
238309
|
+
}
|
|
238310
|
+
await writeJsonFile(configPath, config5);
|
|
238311
|
+
for (const file2 of fn.files) {
|
|
238312
|
+
await writeFile(join6(functionDir, file2.path), file2.content);
|
|
238313
|
+
}
|
|
238314
|
+
written.push(fn.name);
|
|
238315
|
+
}
|
|
238316
|
+
return { written, skipped };
|
|
238317
|
+
}
|
|
238318
|
+
async function isFunctionUnchanged(functionDir, fn) {
|
|
238319
|
+
if (!await pathExists(functionDir)) {
|
|
238320
|
+
return false;
|
|
238321
|
+
}
|
|
238322
|
+
const configPath = join6(functionDir, "function.jsonc");
|
|
238323
|
+
try {
|
|
238324
|
+
const localConfig = await readJsonFile(configPath);
|
|
238325
|
+
if (localConfig.entry !== fn.entry) {
|
|
238326
|
+
return false;
|
|
238327
|
+
}
|
|
238328
|
+
const localAuto = JSON.stringify(localConfig.automations ?? []);
|
|
238329
|
+
const remoteAuto = JSON.stringify(fn.automations);
|
|
238330
|
+
if (localAuto !== remoteAuto) {
|
|
238331
|
+
return false;
|
|
238332
|
+
}
|
|
238333
|
+
} catch {
|
|
238334
|
+
return false;
|
|
238335
|
+
}
|
|
238336
|
+
for (const file2 of fn.files) {
|
|
238337
|
+
const filePath = join6(functionDir, file2.path);
|
|
238338
|
+
if (!await pathExists(filePath)) {
|
|
238339
|
+
return false;
|
|
238340
|
+
}
|
|
238341
|
+
try {
|
|
238342
|
+
const localContent = await readTextFile(filePath);
|
|
238343
|
+
if (localContent !== file2.content) {
|
|
238344
|
+
return false;
|
|
238345
|
+
}
|
|
238346
|
+
} catch {
|
|
238347
|
+
return false;
|
|
238348
|
+
}
|
|
238349
|
+
}
|
|
238350
|
+
return true;
|
|
238351
|
+
}
|
|
238262
238352
|
// src/core/resources/function/resource.ts
|
|
238263
238353
|
var functionResource = {
|
|
238264
238354
|
readAll: readAllFunctions,
|
|
@@ -238303,10 +238393,10 @@ async function readProjectConfig(projectRoot) {
|
|
|
238303
238393
|
const project = result.data;
|
|
238304
238394
|
const configDir = dirname5(configPath);
|
|
238305
238395
|
const [entities, functions, agents, connectors] = await Promise.all([
|
|
238306
|
-
entityResource.readAll(
|
|
238307
|
-
functionResource.readAll(
|
|
238308
|
-
agentResource.readAll(
|
|
238309
|
-
connectorResource.readAll(
|
|
238396
|
+
entityResource.readAll(join7(configDir, project.entitiesDir)),
|
|
238397
|
+
functionResource.readAll(join7(configDir, project.functionsDir)),
|
|
238398
|
+
agentResource.readAll(join7(configDir, project.agentsDir)),
|
|
238399
|
+
connectorResource.readAll(join7(configDir, project.connectorsDir))
|
|
238310
238400
|
]);
|
|
238311
238401
|
return {
|
|
238312
238402
|
project: { ...project, root, configPath },
|
|
@@ -238403,12 +238493,12 @@ async function readAppConfig(projectRoot) {
|
|
|
238403
238493
|
// src/core/project/template.ts
|
|
238404
238494
|
var import_ejs = __toESM(require_ejs(), 1);
|
|
238405
238495
|
var import_front_matter = __toESM(require_front_matter(), 1);
|
|
238406
|
-
import { dirname as dirname6, join as
|
|
238496
|
+
import { dirname as dirname6, join as join9 } from "node:path";
|
|
238407
238497
|
|
|
238408
238498
|
// src/core/assets.ts
|
|
238409
238499
|
import { cpSync, existsSync } from "node:fs";
|
|
238410
238500
|
import { homedir as homedir2 } from "node:os";
|
|
238411
|
-
import { join as
|
|
238501
|
+
import { join as join8 } from "node:path";
|
|
238412
238502
|
// package.json
|
|
238413
238503
|
var package_default = {
|
|
238414
238504
|
name: "base44",
|
|
@@ -238501,15 +238591,15 @@ var package_default = {
|
|
|
238501
238591
|
};
|
|
238502
238592
|
|
|
238503
238593
|
// src/core/assets.ts
|
|
238504
|
-
var ASSETS_DIR =
|
|
238594
|
+
var ASSETS_DIR = join8(homedir2(), ".base44", "assets", package_default.version);
|
|
238505
238595
|
function getTemplatesDir() {
|
|
238506
|
-
return
|
|
238596
|
+
return join8(ASSETS_DIR, "templates");
|
|
238507
238597
|
}
|
|
238508
238598
|
function getTemplatesIndexPath() {
|
|
238509
|
-
return
|
|
238599
|
+
return join8(ASSETS_DIR, "templates", "templates.json");
|
|
238510
238600
|
}
|
|
238511
238601
|
function getDenoWrapperPath() {
|
|
238512
|
-
return
|
|
238602
|
+
return join8(ASSETS_DIR, "deno-runtime", "main.js");
|
|
238513
238603
|
}
|
|
238514
238604
|
function ensureNpmAssets(sourceDir) {
|
|
238515
238605
|
if (existsSync(ASSETS_DIR))
|
|
@@ -238530,23 +238620,23 @@ async function listTemplates() {
|
|
|
238530
238620
|
return result.data.templates;
|
|
238531
238621
|
}
|
|
238532
238622
|
async function renderTemplate(template, destPath, data) {
|
|
238533
|
-
const templateDir =
|
|
238623
|
+
const templateDir = join9(getTemplatesDir(), template.path);
|
|
238534
238624
|
const files = await globby("**/*", {
|
|
238535
238625
|
cwd: templateDir,
|
|
238536
238626
|
dot: true,
|
|
238537
238627
|
onlyFiles: true
|
|
238538
238628
|
});
|
|
238539
238629
|
for (const file2 of files) {
|
|
238540
|
-
const srcPath =
|
|
238630
|
+
const srcPath = join9(templateDir, file2);
|
|
238541
238631
|
try {
|
|
238542
238632
|
if (file2.endsWith(".ejs")) {
|
|
238543
238633
|
const rendered = await import_ejs.default.renderFile(srcPath, data);
|
|
238544
238634
|
const { attributes, body } = import_front_matter.default(rendered);
|
|
238545
|
-
const destFile = attributes.outputFileName ?
|
|
238546
|
-
const destFilePath =
|
|
238635
|
+
const destFile = attributes.outputFileName ? join9(dirname6(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
|
|
238636
|
+
const destFilePath = join9(destPath, destFile);
|
|
238547
238637
|
await writeFile(destFilePath, body);
|
|
238548
238638
|
} else {
|
|
238549
|
-
const destFilePath =
|
|
238639
|
+
const destFilePath = join9(destPath, file2);
|
|
238550
238640
|
await copyFile(srcPath, destFilePath);
|
|
238551
238641
|
}
|
|
238552
238642
|
} catch (error48) {
|
|
@@ -238645,7 +238735,7 @@ async function getSiteFilePaths(outputDir) {
|
|
|
238645
238735
|
// src/core/site/deploy.ts
|
|
238646
238736
|
import { randomUUID } from "node:crypto";
|
|
238647
238737
|
import { tmpdir } from "node:os";
|
|
238648
|
-
import { join as
|
|
238738
|
+
import { join as join10 } from "node:path";
|
|
238649
238739
|
async function deploySite(siteOutputDir) {
|
|
238650
238740
|
if (!await pathExists(siteOutputDir)) {
|
|
238651
238741
|
throw new InvalidInputError(`Output directory does not exist: ${siteOutputDir}. Make sure to build your project first.`, {
|
|
@@ -238662,7 +238752,7 @@ async function deploySite(siteOutputDir) {
|
|
|
238662
238752
|
]
|
|
238663
238753
|
});
|
|
238664
238754
|
}
|
|
238665
|
-
const archivePath =
|
|
238755
|
+
const archivePath = join10(tmpdir(), `base44-site-${randomUUID()}.tar.gz`);
|
|
238666
238756
|
try {
|
|
238667
238757
|
await createArchive(siteOutputDir, archivePath);
|
|
238668
238758
|
return await uploadSite(archivePath);
|
|
@@ -246414,7 +246504,7 @@ function formatYaml(data, options = {}) {
|
|
|
246414
246504
|
async function pullAgentsAction() {
|
|
246415
246505
|
const { project: project2 } = await readProjectConfig();
|
|
246416
246506
|
const configDir = dirname7(project2.configPath);
|
|
246417
|
-
const agentsDir =
|
|
246507
|
+
const agentsDir = join11(configDir, project2.agentsDir);
|
|
246418
246508
|
const remoteAgents = await runTask("Fetching agents from Base44", async () => {
|
|
246419
246509
|
return await fetchAgents();
|
|
246420
246510
|
}, {
|
|
@@ -246536,11 +246626,11 @@ function getConnectorsListAvailableCommand(context) {
|
|
|
246536
246626
|
}
|
|
246537
246627
|
|
|
246538
246628
|
// src/cli/commands/connectors/pull.ts
|
|
246539
|
-
import { dirname as dirname8, join as
|
|
246629
|
+
import { dirname as dirname8, join as join12 } from "node:path";
|
|
246540
246630
|
async function pullConnectorsAction() {
|
|
246541
246631
|
const { project: project2 } = await readProjectConfig();
|
|
246542
246632
|
const configDir = dirname8(project2.configPath);
|
|
246543
|
-
const connectorsDir =
|
|
246633
|
+
const connectorsDir = join12(configDir, project2.connectorsDir);
|
|
246544
246634
|
const remoteConnectors = await runTask("Fetching connectors from Base44", async () => {
|
|
246545
246635
|
return await listConnectors();
|
|
246546
246636
|
}, {
|
|
@@ -247388,63 +247478,6 @@ function getEntitiesPushCommand(context) {
|
|
|
247388
247478
|
}));
|
|
247389
247479
|
}
|
|
247390
247480
|
|
|
247391
|
-
// src/cli/utils/parseNames.ts
|
|
247392
|
-
function parseNames(args) {
|
|
247393
|
-
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
247394
|
-
}
|
|
247395
|
-
|
|
247396
|
-
// src/cli/commands/functions/delete.ts
|
|
247397
|
-
async function deleteFunctionsAction(names) {
|
|
247398
|
-
let deleted = 0;
|
|
247399
|
-
let notFound = 0;
|
|
247400
|
-
let errors5 = 0;
|
|
247401
|
-
let completed = 0;
|
|
247402
|
-
const total = names.length;
|
|
247403
|
-
for (const name2 of names) {
|
|
247404
|
-
R2.step(theme.styles.dim(`[${completed + 1}/${total}] Deleting ${name2}...`));
|
|
247405
|
-
try {
|
|
247406
|
-
await deleteSingleFunction(name2);
|
|
247407
|
-
R2.success(`${name2.padEnd(25)} deleted`);
|
|
247408
|
-
deleted++;
|
|
247409
|
-
} catch (error48) {
|
|
247410
|
-
if (error48 instanceof ApiError && error48.statusCode === 404) {
|
|
247411
|
-
R2.warn(`${name2.padEnd(25)} not found`);
|
|
247412
|
-
notFound++;
|
|
247413
|
-
} else {
|
|
247414
|
-
R2.error(`${name2.padEnd(25)} error: ${error48 instanceof Error ? error48.message : String(error48)}`);
|
|
247415
|
-
errors5++;
|
|
247416
|
-
}
|
|
247417
|
-
}
|
|
247418
|
-
completed++;
|
|
247419
|
-
}
|
|
247420
|
-
if (names.length === 1) {
|
|
247421
|
-
if (deleted)
|
|
247422
|
-
return { outroMessage: `Function "${names[0]}" deleted` };
|
|
247423
|
-
if (notFound)
|
|
247424
|
-
return { outroMessage: `Function "${names[0]}" not found` };
|
|
247425
|
-
return { outroMessage: `Failed to delete "${names[0]}"` };
|
|
247426
|
-
}
|
|
247427
|
-
const parts = [];
|
|
247428
|
-
if (deleted > 0)
|
|
247429
|
-
parts.push(`${deleted}/${total} deleted`);
|
|
247430
|
-
if (notFound > 0)
|
|
247431
|
-
parts.push(`${notFound} not found`);
|
|
247432
|
-
if (errors5 > 0)
|
|
247433
|
-
parts.push(`${errors5} error${errors5 !== 1 ? "s" : ""}`);
|
|
247434
|
-
return { outroMessage: parts.join(", ") };
|
|
247435
|
-
}
|
|
247436
|
-
function getDeleteCommand(context) {
|
|
247437
|
-
return new Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").action(async (rawNames) => {
|
|
247438
|
-
await runCommand(() => {
|
|
247439
|
-
const names = parseNames(rawNames);
|
|
247440
|
-
if (names.length === 0) {
|
|
247441
|
-
throw new InvalidInputError("At least one function name is required");
|
|
247442
|
-
}
|
|
247443
|
-
return deleteFunctionsAction(names);
|
|
247444
|
-
}, { requireAuth: true }, context);
|
|
247445
|
-
});
|
|
247446
|
-
}
|
|
247447
|
-
|
|
247448
247481
|
// src/cli/commands/functions/deploy.ts
|
|
247449
247482
|
async function deployFunctionsAction() {
|
|
247450
247483
|
const { functions } = await readProjectConfig();
|
|
@@ -247483,13 +247516,57 @@ function getDeployCommand(context) {
|
|
|
247483
247516
|
});
|
|
247484
247517
|
}
|
|
247485
247518
|
|
|
247519
|
+
// src/cli/commands/functions/pull.ts
|
|
247520
|
+
import { dirname as dirname9, join as join13 } from "node:path";
|
|
247521
|
+
async function pullFunctionsAction(name2) {
|
|
247522
|
+
const { project: project2 } = await readProjectConfig();
|
|
247523
|
+
const configDir = dirname9(project2.configPath);
|
|
247524
|
+
const functionsDir = join13(configDir, project2.functionsDir);
|
|
247525
|
+
const remoteFunctions = await runTask("Fetching functions from Base44", async () => {
|
|
247526
|
+
const { functions } = await listDeployedFunctions();
|
|
247527
|
+
return functions;
|
|
247528
|
+
}, {
|
|
247529
|
+
successMessage: "Functions fetched successfully",
|
|
247530
|
+
errorMessage: "Failed to fetch functions"
|
|
247531
|
+
});
|
|
247532
|
+
const toPull = name2 ? remoteFunctions.filter((f) => f.name === name2) : remoteFunctions;
|
|
247533
|
+
if (name2 && toPull.length === 0) {
|
|
247534
|
+
return {
|
|
247535
|
+
outroMessage: `Function "${name2}" not found on remote`
|
|
247536
|
+
};
|
|
247537
|
+
}
|
|
247538
|
+
if (toPull.length === 0) {
|
|
247539
|
+
return { outroMessage: "No functions found on remote" };
|
|
247540
|
+
}
|
|
247541
|
+
const { written, skipped } = await runTask("Writing function files", async () => {
|
|
247542
|
+
return await writeFunctions(functionsDir, toPull);
|
|
247543
|
+
}, {
|
|
247544
|
+
successMessage: "Function files written successfully",
|
|
247545
|
+
errorMessage: "Failed to write function files"
|
|
247546
|
+
});
|
|
247547
|
+
for (const name3 of written) {
|
|
247548
|
+
R2.success(`${name3.padEnd(25)} written`);
|
|
247549
|
+
}
|
|
247550
|
+
for (const name3 of skipped) {
|
|
247551
|
+
R2.info(`${name3.padEnd(25)} unchanged`);
|
|
247552
|
+
}
|
|
247553
|
+
return {
|
|
247554
|
+
outroMessage: `Pulled ${toPull.length} function${toPull.length !== 1 ? "s" : ""} to ${functionsDir}`
|
|
247555
|
+
};
|
|
247556
|
+
}
|
|
247557
|
+
function getPullCommand(context) {
|
|
247558
|
+
return new Command("pull").description("Pull deployed functions from Base44").argument("[name]", "Pull a single function by name").action(async (name2) => {
|
|
247559
|
+
await runCommand(() => pullFunctionsAction(name2), { requireAuth: true }, context);
|
|
247560
|
+
});
|
|
247561
|
+
}
|
|
247562
|
+
|
|
247486
247563
|
// src/cli/commands/functions/index.ts
|
|
247487
247564
|
function getFunctionsCommand(context) {
|
|
247488
|
-
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(
|
|
247565
|
+
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getPullCommand(context));
|
|
247489
247566
|
}
|
|
247490
247567
|
|
|
247491
247568
|
// src/cli/commands/project/create.ts
|
|
247492
|
-
import { basename as basename3, join as
|
|
247569
|
+
import { basename as basename3, join as join14, resolve as resolve2 } from "node:path";
|
|
247493
247570
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
247494
247571
|
var DEFAULT_TEMPLATE_ID = "backend-only";
|
|
247495
247572
|
async function getTemplateById(templateId) {
|
|
@@ -247625,7 +247702,7 @@ async function executeCreate({
|
|
|
247625
247702
|
updateMessage("Building project...");
|
|
247626
247703
|
await execa({ cwd: resolvedPath, shell: true })`${buildCommand}`;
|
|
247627
247704
|
updateMessage("Deploying site...");
|
|
247628
|
-
return await deploySite(
|
|
247705
|
+
return await deploySite(join14(resolvedPath, outputDirectory));
|
|
247629
247706
|
}, {
|
|
247630
247707
|
successMessage: theme.colors.base44Orange("Site deployed successfully"),
|
|
247631
247708
|
errorMessage: "Failed to deploy site"
|
|
@@ -248253,10 +248330,10 @@ function toPascalCase(name2) {
|
|
|
248253
248330
|
return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
|
|
248254
248331
|
}
|
|
248255
248332
|
// src/core/types/update-project.ts
|
|
248256
|
-
import { join as
|
|
248333
|
+
import { join as join17 } from "node:path";
|
|
248257
248334
|
var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
|
|
248258
248335
|
async function updateProjectConfig(projectRoot) {
|
|
248259
|
-
const tsconfigPath =
|
|
248336
|
+
const tsconfigPath = join17(projectRoot, "tsconfig.json");
|
|
248260
248337
|
if (!await pathExists(tsconfigPath)) {
|
|
248261
248338
|
return false;
|
|
248262
248339
|
}
|
|
@@ -248299,7 +248376,7 @@ function getTypesCommand(context) {
|
|
|
248299
248376
|
}
|
|
248300
248377
|
|
|
248301
248378
|
// src/cli/dev/dev-server/main.ts
|
|
248302
|
-
import { dirname as
|
|
248379
|
+
import { dirname as dirname14, join as join20 } from "node:path";
|
|
248303
248380
|
var import_cors = __toESM(require_lib4(), 1);
|
|
248304
248381
|
var import_express4 = __toESM(require_express(), 1);
|
|
248305
248382
|
|
|
@@ -249779,9 +249856,9 @@ class NodeFsHandler {
|
|
|
249779
249856
|
if (this.fsw.closed) {
|
|
249780
249857
|
return;
|
|
249781
249858
|
}
|
|
249782
|
-
const
|
|
249859
|
+
const dirname13 = sp2.dirname(file2);
|
|
249783
249860
|
const basename5 = sp2.basename(file2);
|
|
249784
|
-
const parent = this.fsw._getWatchedDir(
|
|
249861
|
+
const parent = this.fsw._getWatchedDir(dirname13);
|
|
249785
249862
|
let prevStats = stats;
|
|
249786
249863
|
if (parent.has(basename5))
|
|
249787
249864
|
return;
|
|
@@ -249808,7 +249885,7 @@ class NodeFsHandler {
|
|
|
249808
249885
|
prevStats = newStats2;
|
|
249809
249886
|
}
|
|
249810
249887
|
} catch (error48) {
|
|
249811
|
-
this.fsw._remove(
|
|
249888
|
+
this.fsw._remove(dirname13, basename5);
|
|
249812
249889
|
}
|
|
249813
249890
|
} else if (parent.has(basename5)) {
|
|
249814
249891
|
const at13 = newStats.atimeMs;
|
|
@@ -250829,8 +250906,8 @@ async function createDevServer(options8) {
|
|
|
250829
250906
|
broadcastEntityEvent(io6, appId, entityName, event);
|
|
250830
250907
|
};
|
|
250831
250908
|
const base44ConfigWatcher = new WatchBase44({
|
|
250832
|
-
functions:
|
|
250833
|
-
entities:
|
|
250909
|
+
functions: join20(dirname14(project2.configPath), project2.functionsDir),
|
|
250910
|
+
entities: join20(dirname14(project2.configPath), project2.entitiesDir)
|
|
250834
250911
|
}, devLogger);
|
|
250835
250912
|
base44ConfigWatcher.on("change", async (name2) => {
|
|
250836
250913
|
try {
|
|
@@ -251020,7 +251097,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
|
|
|
251020
251097
|
import { release, type } from "node:os";
|
|
251021
251098
|
|
|
251022
251099
|
// ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
251023
|
-
import { dirname as
|
|
251100
|
+
import { dirname as dirname15, posix, sep } from "path";
|
|
251024
251101
|
function createModulerModifier() {
|
|
251025
251102
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
251026
251103
|
return async (frames) => {
|
|
@@ -251029,7 +251106,7 @@ function createModulerModifier() {
|
|
|
251029
251106
|
return frames;
|
|
251030
251107
|
};
|
|
251031
251108
|
}
|
|
251032
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
251109
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname15(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
|
|
251033
251110
|
const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
|
|
251034
251111
|
return (filename) => {
|
|
251035
251112
|
if (!filename)
|
|
@@ -255218,9 +255295,9 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
|
|
|
255218
255295
|
});
|
|
255219
255296
|
}
|
|
255220
255297
|
// src/cli/index.ts
|
|
255221
|
-
var __dirname4 =
|
|
255298
|
+
var __dirname4 = dirname16(fileURLToPath6(import.meta.url));
|
|
255222
255299
|
async function runCLI() {
|
|
255223
|
-
ensureNpmAssets(
|
|
255300
|
+
ensureNpmAssets(join21(__dirname4, "../assets"));
|
|
255224
255301
|
const errorReporter = new ErrorReporter;
|
|
255225
255302
|
errorReporter.registerProcessErrorHandlers();
|
|
255226
255303
|
const isNonInteractive = !process.stdin.isTTY || !process.stdout.isTTY;
|
|
@@ -255252,4 +255329,4 @@ export {
|
|
|
255252
255329
|
CLIExitError
|
|
255253
255330
|
};
|
|
255254
255331
|
|
|
255255
|
-
//# debugId=
|
|
255332
|
+
//# debugId=AC227C160FCE9CC164756E2164756E21
|