@base44-preview/cli 0.0.33-pr.331.c0ae606 → 0.0.33-pr.338.e51b50f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +75 -197
- package/dist/cli/index.js.map +14 -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 join12(array2, separator) {
|
|
17450
17450
|
return array2 == null ? "" : nativeJoin.call(array2, separator);
|
|
17451
17451
|
}
|
|
17452
17452
|
function last(array2) {
|
|
@@ -17468,7 +17468,7 @@ var require_lodash2 = __commonJS((exports, module) => {
|
|
|
17468
17468
|
function nth(array2, n2) {
|
|
17469
17469
|
return array2 && array2.length ? baseNth(array2, toInteger(n2)) : undefined2;
|
|
17470
17470
|
}
|
|
17471
|
-
var
|
|
17471
|
+
var pull = baseRest(pullAll);
|
|
17472
17472
|
function pullAll(array2, values2) {
|
|
17473
17473
|
return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2) : array2;
|
|
17474
17474
|
}
|
|
@@ -19233,7 +19233,7 @@ __p += '`;
|
|
|
19233
19233
|
lodash.pickBy = pickBy;
|
|
19234
19234
|
lodash.property = property;
|
|
19235
19235
|
lodash.propertyOf = propertyOf;
|
|
19236
|
-
lodash.pull =
|
|
19236
|
+
lodash.pull = pull;
|
|
19237
19237
|
lodash.pullAll = pullAll;
|
|
19238
19238
|
lodash.pullAllBy = pullAllBy;
|
|
19239
19239
|
lodash.pullAllWith = pullAllWith;
|
|
@@ -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 = join12;
|
|
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" ? join12(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 join12(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: join12,
|
|
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" ? join14(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 join14(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: join14,
|
|
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 dirname11 = path18.dirname;
|
|
155682
155682
|
var basename4 = path18.basename;
|
|
155683
155683
|
var extname2 = path18.extname;
|
|
155684
|
-
var
|
|
155684
|
+
var join15 = 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 = dirname11(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 = join15(dir, file2);
|
|
155747
155747
|
var stat2 = tryStat(path19);
|
|
155748
155748
|
if (stat2 && stat2.isFile()) {
|
|
155749
155749
|
return path19;
|
|
155750
155750
|
}
|
|
155751
|
-
path19 =
|
|
155751
|
+
path19 = join15(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 join15 = 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(join15(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 = join15(path19, self2._index[i5]);
|
|
159759
159759
|
debug('stat "%s"', p4);
|
|
159760
159760
|
fs28.stat(p4, function(err2, stat2) {
|
|
159761
159761
|
if (err2)
|
|
@@ -162834,7 +162834,7 @@ var {
|
|
|
162834
162834
|
} = import__.default;
|
|
162835
162835
|
|
|
162836
162836
|
// src/cli/commands/agents/pull.ts
|
|
162837
|
-
import { dirname as dirname7, join as
|
|
162837
|
+
import { dirname as dirname7, join as join9 } from "node:path";
|
|
162838
162838
|
|
|
162839
162839
|
// node_modules/@clack/core/dist/index.mjs
|
|
162840
162840
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
@@ -185309,7 +185309,7 @@ var generateGlobTasks = normalizeArguments(generateTasks);
|
|
|
185309
185309
|
var generateGlobTasksSync = normalizeArgumentsSync(generateTasksSync);
|
|
185310
185310
|
|
|
185311
185311
|
// src/core/project/config.ts
|
|
185312
|
-
import { dirname as dirname5, join as
|
|
185312
|
+
import { dirname as dirname5, join as join6 } from "node:path";
|
|
185313
185313
|
|
|
185314
185314
|
// src/core/resources/agent/schema.ts
|
|
185315
185315
|
var EntityOperationSchema = exports_external.enum(["create", "update", "delete", "read"]);
|
|
@@ -186006,12 +186006,6 @@ var BackendFunctionSchema = FunctionConfigSchema.extend({
|
|
|
186006
186006
|
entryPath: exports_external.string().min(1, "Entry path cannot be empty"),
|
|
186007
186007
|
filePaths: exports_external.array(exports_external.string()).min(1, "Function must have at least one file")
|
|
186008
186008
|
});
|
|
186009
|
-
var DeployFunctionsResponseSchema = exports_external.object({
|
|
186010
|
-
deployed: exports_external.array(exports_external.string()),
|
|
186011
|
-
deleted: exports_external.array(exports_external.string()),
|
|
186012
|
-
skipped: exports_external.array(exports_external.string()).optional().nullable(),
|
|
186013
|
-
errors: exports_external.array(exports_external.object({ name: exports_external.string(), message: exports_external.string() })).nullable()
|
|
186014
|
-
});
|
|
186015
186009
|
var DeploySingleFunctionResponseSchema = exports_external.object({
|
|
186016
186010
|
status: exports_external.enum(["deployed", "unchanged"]),
|
|
186017
186011
|
duration_ms: exports_external.number().optional().nullable()
|
|
@@ -186033,34 +186027,6 @@ var ListFunctionsResponseSchema = exports_external.object({
|
|
|
186033
186027
|
});
|
|
186034
186028
|
|
|
186035
186029
|
// src/core/resources/function/api.ts
|
|
186036
|
-
function toDeployPayloadItem(fn) {
|
|
186037
|
-
return {
|
|
186038
|
-
name: fn.name,
|
|
186039
|
-
entry: fn.entry,
|
|
186040
|
-
files: fn.files,
|
|
186041
|
-
automations: fn.automations
|
|
186042
|
-
};
|
|
186043
|
-
}
|
|
186044
|
-
async function deployFunctions(functions) {
|
|
186045
|
-
const appClient = getAppClient();
|
|
186046
|
-
const payload = {
|
|
186047
|
-
functions: functions.map(toDeployPayloadItem)
|
|
186048
|
-
};
|
|
186049
|
-
let response;
|
|
186050
|
-
try {
|
|
186051
|
-
response = await appClient.put("backend-functions", {
|
|
186052
|
-
json: payload,
|
|
186053
|
-
timeout: false
|
|
186054
|
-
});
|
|
186055
|
-
} catch (error48) {
|
|
186056
|
-
throw await ApiError.fromHttpError(error48, "deploying functions");
|
|
186057
|
-
}
|
|
186058
|
-
const result = DeployFunctionsResponseSchema.safeParse(await response.json());
|
|
186059
|
-
if (!result.success) {
|
|
186060
|
-
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
186061
|
-
}
|
|
186062
|
-
return result.data;
|
|
186063
|
-
}
|
|
186064
186030
|
async function deploySingleFunction(name2, payload) {
|
|
186065
186031
|
const appClient = getAppClient();
|
|
186066
186032
|
let response;
|
|
@@ -186148,13 +186114,6 @@ async function loadFunctionCode(fn) {
|
|
|
186148
186114
|
}));
|
|
186149
186115
|
return { ...fn, files: loadedFiles };
|
|
186150
186116
|
}
|
|
186151
|
-
async function pushFunctions(functions) {
|
|
186152
|
-
if (functions.length === 0) {
|
|
186153
|
-
return { deployed: [], deleted: [], skipped: [], errors: null };
|
|
186154
|
-
}
|
|
186155
|
-
const functionsWithCode = await Promise.all(functions.map(loadFunctionCode));
|
|
186156
|
-
return deployFunctions(functionsWithCode);
|
|
186157
|
-
}
|
|
186158
186117
|
async function deployOne(fn) {
|
|
186159
186118
|
try {
|
|
186160
186119
|
const loaded = await loadFunctionCode(fn);
|
|
@@ -186203,57 +186162,10 @@ async function pruneRemovedFunctions(localFunctionNames) {
|
|
|
186203
186162
|
}
|
|
186204
186163
|
return results;
|
|
186205
186164
|
}
|
|
186206
|
-
// src/core/resources/function/pull.ts
|
|
186207
|
-
import { join as join6 } from "node:path";
|
|
186208
|
-
async function writeFunctions(functionsDir, functions) {
|
|
186209
|
-
const written = [];
|
|
186210
|
-
const skipped = [];
|
|
186211
|
-
for (const fn of functions) {
|
|
186212
|
-
const functionDir = join6(functionsDir, fn.name);
|
|
186213
|
-
const configPath = join6(functionDir, "function.jsonc");
|
|
186214
|
-
if (await isFunctionUnchanged(functionDir, fn)) {
|
|
186215
|
-
skipped.push(fn.name);
|
|
186216
|
-
continue;
|
|
186217
|
-
}
|
|
186218
|
-
const config5 = {
|
|
186219
|
-
name: fn.name,
|
|
186220
|
-
entry: fn.entry
|
|
186221
|
-
};
|
|
186222
|
-
if (fn.automations.length > 0) {
|
|
186223
|
-
config5.automations = fn.automations;
|
|
186224
|
-
}
|
|
186225
|
-
await writeJsonFile(configPath, config5);
|
|
186226
|
-
for (const file2 of fn.files) {
|
|
186227
|
-
await writeFile(join6(functionDir, file2.path), file2.content);
|
|
186228
|
-
}
|
|
186229
|
-
written.push(fn.name);
|
|
186230
|
-
}
|
|
186231
|
-
return { written, skipped };
|
|
186232
|
-
}
|
|
186233
|
-
async function isFunctionUnchanged(functionDir, fn) {
|
|
186234
|
-
if (!await pathExists(functionDir)) {
|
|
186235
|
-
return false;
|
|
186236
|
-
}
|
|
186237
|
-
for (const file2 of fn.files) {
|
|
186238
|
-
const filePath = join6(functionDir, file2.path);
|
|
186239
|
-
if (!await pathExists(filePath)) {
|
|
186240
|
-
return false;
|
|
186241
|
-
}
|
|
186242
|
-
try {
|
|
186243
|
-
const localContent = await readTextFile(filePath);
|
|
186244
|
-
if (localContent !== file2.content) {
|
|
186245
|
-
return false;
|
|
186246
|
-
}
|
|
186247
|
-
} catch {
|
|
186248
|
-
return false;
|
|
186249
|
-
}
|
|
186250
|
-
}
|
|
186251
|
-
return true;
|
|
186252
|
-
}
|
|
186253
186165
|
// src/core/resources/function/resource.ts
|
|
186254
186166
|
var functionResource = {
|
|
186255
186167
|
readAll: readAllFunctions,
|
|
186256
|
-
push:
|
|
186168
|
+
push: (functions) => pushFunctionsSingle(functions)
|
|
186257
186169
|
};
|
|
186258
186170
|
// src/core/project/config.ts
|
|
186259
186171
|
async function findConfigInDir(dir) {
|
|
@@ -186294,10 +186206,10 @@ async function readProjectConfig(projectRoot) {
|
|
|
186294
186206
|
const project = result.data;
|
|
186295
186207
|
const configDir = dirname5(configPath);
|
|
186296
186208
|
const [entities, functions, agents, connectors] = await Promise.all([
|
|
186297
|
-
entityResource.readAll(
|
|
186298
|
-
functionResource.readAll(
|
|
186299
|
-
agentResource.readAll(
|
|
186300
|
-
connectorResource.readAll(
|
|
186209
|
+
entityResource.readAll(join6(configDir, project.entitiesDir)),
|
|
186210
|
+
functionResource.readAll(join6(configDir, project.functionsDir)),
|
|
186211
|
+
agentResource.readAll(join6(configDir, project.agentsDir)),
|
|
186212
|
+
connectorResource.readAll(join6(configDir, project.connectorsDir))
|
|
186301
186213
|
]);
|
|
186302
186214
|
return {
|
|
186303
186215
|
project: { ...project, root, configPath },
|
|
@@ -186394,7 +186306,7 @@ async function readAppConfig(projectRoot) {
|
|
|
186394
186306
|
// src/core/project/template.ts
|
|
186395
186307
|
var import_ejs = __toESM(require_ejs(), 1);
|
|
186396
186308
|
var import_front_matter = __toESM(require_front_matter(), 1);
|
|
186397
|
-
import { dirname as dirname6, join as
|
|
186309
|
+
import { dirname as dirname6, join as join7 } from "node:path";
|
|
186398
186310
|
async function listTemplates() {
|
|
186399
186311
|
const parsed = await readJsonFile(getTemplatesIndexPath());
|
|
186400
186312
|
const result = TemplatesConfigSchema.safeParse(parsed);
|
|
@@ -186404,23 +186316,23 @@ async function listTemplates() {
|
|
|
186404
186316
|
return result.data.templates;
|
|
186405
186317
|
}
|
|
186406
186318
|
async function renderTemplate(template, destPath, data) {
|
|
186407
|
-
const templateDir =
|
|
186319
|
+
const templateDir = join7(getTemplatesDir(), template.path);
|
|
186408
186320
|
const files = await globby("**/*", {
|
|
186409
186321
|
cwd: templateDir,
|
|
186410
186322
|
dot: true,
|
|
186411
186323
|
onlyFiles: true
|
|
186412
186324
|
});
|
|
186413
186325
|
for (const file2 of files) {
|
|
186414
|
-
const srcPath =
|
|
186326
|
+
const srcPath = join7(templateDir, file2);
|
|
186415
186327
|
try {
|
|
186416
186328
|
if (file2.endsWith(".ejs")) {
|
|
186417
186329
|
const rendered = await import_ejs.default.renderFile(srcPath, data);
|
|
186418
186330
|
const { attributes, body } = import_front_matter.default(rendered);
|
|
186419
|
-
const destFile = attributes.outputFileName ?
|
|
186420
|
-
const destFilePath =
|
|
186331
|
+
const destFile = attributes.outputFileName ? join7(dirname6(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
|
|
186332
|
+
const destFilePath = join7(destPath, destFile);
|
|
186421
186333
|
await writeFile(destFilePath, body);
|
|
186422
186334
|
} else {
|
|
186423
|
-
const destFilePath =
|
|
186335
|
+
const destFilePath = join7(destPath, file2);
|
|
186424
186336
|
await copyFile(srcPath, destFilePath);
|
|
186425
186337
|
}
|
|
186426
186338
|
} catch (error48) {
|
|
@@ -186523,7 +186435,7 @@ async function getSiteFilePaths(outputDir) {
|
|
|
186523
186435
|
// src/core/site/deploy.ts
|
|
186524
186436
|
import { randomUUID } from "node:crypto";
|
|
186525
186437
|
import { tmpdir } from "node:os";
|
|
186526
|
-
import { join as
|
|
186438
|
+
import { join as join8 } from "node:path";
|
|
186527
186439
|
async function deploySite(siteOutputDir) {
|
|
186528
186440
|
if (!await pathExists(siteOutputDir)) {
|
|
186529
186441
|
throw new FileNotFoundError(`Output directory does not exist: ${siteOutputDir}. Make sure to build your project first.`, {
|
|
@@ -186540,7 +186452,7 @@ async function deploySite(siteOutputDir) {
|
|
|
186540
186452
|
]
|
|
186541
186453
|
});
|
|
186542
186454
|
}
|
|
186543
|
-
const archivePath =
|
|
186455
|
+
const archivePath = join8(tmpdir(), `base44-site-${randomUUID()}.tar.gz`);
|
|
186544
186456
|
try {
|
|
186545
186457
|
await createArchive(siteOutputDir, archivePath);
|
|
186546
186458
|
return await uploadSite(archivePath);
|
|
@@ -186565,10 +186477,13 @@ function hasResourcesToDeploy(projectData) {
|
|
|
186565
186477
|
const hasConnectors = connectors.length > 0;
|
|
186566
186478
|
return hasEntities || hasFunctions || hasAgents || hasConnectors || hasSite;
|
|
186567
186479
|
}
|
|
186568
|
-
async function deployAll(projectData) {
|
|
186480
|
+
async function deployAll(projectData, options) {
|
|
186569
186481
|
const { project, entities, functions, agents, connectors } = projectData;
|
|
186570
186482
|
await entityResource.push(entities);
|
|
186571
|
-
await
|
|
186483
|
+
await pushFunctionsSingle(functions, {
|
|
186484
|
+
onStart: options?.onFunctionStart,
|
|
186485
|
+
onResult: options?.onFunctionResult
|
|
186486
|
+
});
|
|
186572
186487
|
await agentResource.push(agents);
|
|
186573
186488
|
const { results: connectorResults } = await pushConnectors(connectors);
|
|
186574
186489
|
if (project.site?.outputDirectory) {
|
|
@@ -194221,7 +194136,7 @@ function getDashboardUrl(projectId) {
|
|
|
194221
194136
|
async function pullAgentsAction() {
|
|
194222
194137
|
const { project: project2 } = await readProjectConfig();
|
|
194223
194138
|
const configDir = dirname7(project2.configPath);
|
|
194224
|
-
const agentsDir =
|
|
194139
|
+
const agentsDir = join9(configDir, project2.agentsDir);
|
|
194225
194140
|
const remoteAgents = await runTask("Fetching agents from Base44", async () => {
|
|
194226
194141
|
return await fetchAgents();
|
|
194227
194142
|
}, {
|
|
@@ -194315,11 +194230,11 @@ function getWhoamiCommand(context) {
|
|
|
194315
194230
|
}
|
|
194316
194231
|
|
|
194317
194232
|
// src/cli/commands/connectors/pull.ts
|
|
194318
|
-
import { dirname as dirname8, join as
|
|
194233
|
+
import { dirname as dirname8, join as join10 } from "node:path";
|
|
194319
194234
|
async function pullConnectorsAction() {
|
|
194320
194235
|
const { project: project2 } = await readProjectConfig();
|
|
194321
194236
|
const configDir = dirname8(project2.configPath);
|
|
194322
|
-
const connectorsDir =
|
|
194237
|
+
const connectorsDir = join10(configDir, project2.connectorsDir);
|
|
194323
194238
|
const remoteConnectors = await runTask("Fetching connectors from Base44", async () => {
|
|
194324
194239
|
return await listConnectors();
|
|
194325
194240
|
}, {
|
|
@@ -195167,10 +195082,12 @@ function getEntitiesPushCommand(context) {
|
|
|
195167
195082
|
}));
|
|
195168
195083
|
}
|
|
195169
195084
|
|
|
195170
|
-
// src/cli/
|
|
195085
|
+
// src/cli/utils/parseNames.ts
|
|
195171
195086
|
function parseNames(args) {
|
|
195172
195087
|
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
195173
195088
|
}
|
|
195089
|
+
|
|
195090
|
+
// src/cli/commands/functions/delete.ts
|
|
195174
195091
|
async function deleteFunctionsAction(names) {
|
|
195175
195092
|
let deleted = 0;
|
|
195176
195093
|
let notFound = 0;
|
|
@@ -195218,11 +195135,11 @@ function getDeleteCommand(context) {
|
|
|
195218
195135
|
});
|
|
195219
195136
|
}
|
|
195220
195137
|
|
|
195221
|
-
// src/cli/
|
|
195138
|
+
// src/cli/utils/formatDeployResult.ts
|
|
195222
195139
|
function formatDuration(ms) {
|
|
195223
195140
|
return `${(ms / 1000).toFixed(1)}s`;
|
|
195224
195141
|
}
|
|
195225
|
-
function
|
|
195142
|
+
function formatDeployResult(r) {
|
|
195226
195143
|
const label = r.name.padEnd(25);
|
|
195227
195144
|
if (r.status === "deployed") {
|
|
195228
195145
|
const timing = r.duration_ms ? theme.styles.dim(` (${formatDuration(r.duration_ms)})`) : "";
|
|
@@ -195233,9 +195150,8 @@ function formatResult(r) {
|
|
|
195233
195150
|
R2.error(`${label} error: ${r.error}`);
|
|
195234
195151
|
}
|
|
195235
195152
|
}
|
|
195236
|
-
|
|
195237
|
-
|
|
195238
|
-
}
|
|
195153
|
+
|
|
195154
|
+
// src/cli/commands/functions/deploy.ts
|
|
195239
195155
|
async function deployFunctionsAction(names, options) {
|
|
195240
195156
|
if (options.force && names.length > 0) {
|
|
195241
195157
|
throw new InvalidInputError("--force cannot be used when specifying function names");
|
|
@@ -195266,7 +195182,7 @@ async function deployFunctionsAction(names, options) {
|
|
|
195266
195182
|
},
|
|
195267
195183
|
onResult: (r) => {
|
|
195268
195184
|
completed++;
|
|
195269
|
-
|
|
195185
|
+
formatDeployResult(r);
|
|
195270
195186
|
}
|
|
195271
195187
|
});
|
|
195272
195188
|
const succeeded = results.filter((r) => r.status !== "error").length;
|
|
@@ -195298,7 +195214,7 @@ async function deployFunctionsAction(names, options) {
|
|
|
195298
195214
|
function getDeployCommand(context) {
|
|
195299
195215
|
return new Command("deploy").description("Deploy functions to Base44").argument("[names...]", "Function names to deploy (deploys all if omitted)").option("--force", "Delete remote functions not found locally").action(async (rawNames, options) => {
|
|
195300
195216
|
await runCommand(() => {
|
|
195301
|
-
const names =
|
|
195217
|
+
const names = parseNames(rawNames);
|
|
195302
195218
|
return deployFunctionsAction(names, options);
|
|
195303
195219
|
}, { requireAuth: true }, context);
|
|
195304
195220
|
});
|
|
@@ -195325,57 +195241,13 @@ function getListCommand(context) {
|
|
|
195325
195241
|
});
|
|
195326
195242
|
}
|
|
195327
195243
|
|
|
195328
|
-
// src/cli/commands/functions/pull.ts
|
|
195329
|
-
import { dirname as dirname9, join as join12 } from "node:path";
|
|
195330
|
-
async function pullFunctionsAction(name2) {
|
|
195331
|
-
const { project: project2 } = await readProjectConfig();
|
|
195332
|
-
const configDir = dirname9(project2.configPath);
|
|
195333
|
-
const functionsDir = join12(configDir, project2.functionsDir);
|
|
195334
|
-
const remoteFunctions = await runTask("Fetching functions from Base44", async () => {
|
|
195335
|
-
const { functions } = await listDeployedFunctions();
|
|
195336
|
-
return functions;
|
|
195337
|
-
}, {
|
|
195338
|
-
successMessage: "Functions fetched successfully",
|
|
195339
|
-
errorMessage: "Failed to fetch functions"
|
|
195340
|
-
});
|
|
195341
|
-
const toPull = name2 ? remoteFunctions.filter((f) => f.name === name2) : remoteFunctions;
|
|
195342
|
-
if (name2 && toPull.length === 0) {
|
|
195343
|
-
return {
|
|
195344
|
-
outroMessage: `Function "${name2}" not found on remote`
|
|
195345
|
-
};
|
|
195346
|
-
}
|
|
195347
|
-
if (toPull.length === 0) {
|
|
195348
|
-
return { outroMessage: "No functions found on remote" };
|
|
195349
|
-
}
|
|
195350
|
-
const { written, skipped } = await runTask("Writing function files", async () => {
|
|
195351
|
-
return await writeFunctions(functionsDir, toPull);
|
|
195352
|
-
}, {
|
|
195353
|
-
successMessage: "Function files written successfully",
|
|
195354
|
-
errorMessage: "Failed to write function files"
|
|
195355
|
-
});
|
|
195356
|
-
if (written.length > 0) {
|
|
195357
|
-
R2.success(`Written: ${written.join(", ")}`);
|
|
195358
|
-
}
|
|
195359
|
-
if (skipped.length > 0) {
|
|
195360
|
-
R2.info(`Skipped (unchanged): ${skipped.join(", ")}`);
|
|
195361
|
-
}
|
|
195362
|
-
return {
|
|
195363
|
-
outroMessage: `Pulled ${toPull.length} function${toPull.length !== 1 ? "s" : ""} to ${functionsDir}`
|
|
195364
|
-
};
|
|
195365
|
-
}
|
|
195366
|
-
function getPullCommand(context) {
|
|
195367
|
-
return new Command("pull").description("Pull deployed functions from Base44").argument("[name]", "Pull a single function by name").action(async (name2) => {
|
|
195368
|
-
await runCommand(() => pullFunctionsAction(name2), { requireAuth: true }, context);
|
|
195369
|
-
});
|
|
195370
|
-
}
|
|
195371
|
-
|
|
195372
195244
|
// src/cli/commands/functions/index.ts
|
|
195373
195245
|
function getFunctionsCommand(context) {
|
|
195374
|
-
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(
|
|
195246
|
+
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getListCommand(context)).addCommand(getDeleteCommand(context));
|
|
195375
195247
|
}
|
|
195376
195248
|
|
|
195377
195249
|
// src/cli/commands/project/create.ts
|
|
195378
|
-
import { basename as basename3, join as
|
|
195250
|
+
import { basename as basename3, join as join11, resolve as resolve2 } from "node:path";
|
|
195379
195251
|
var import_lodash = __toESM(require_lodash(), 1);
|
|
195380
195252
|
var DEFAULT_TEMPLATE_ID = "backend-only";
|
|
195381
195253
|
async function getTemplateById(templateId) {
|
|
@@ -195511,7 +195383,7 @@ async function executeCreate({
|
|
|
195511
195383
|
updateMessage("Building project...");
|
|
195512
195384
|
await execa({ cwd: resolvedPath, shell: true })`${buildCommand}`;
|
|
195513
195385
|
updateMessage("Deploying site...");
|
|
195514
|
-
return await deploySite(
|
|
195386
|
+
return await deploySite(join11(resolvedPath, outputDirectory));
|
|
195515
195387
|
}, {
|
|
195516
195388
|
successMessage: theme.colors.base44Orange("Site deployed successfully"),
|
|
195517
195389
|
errorMessage: "Failed to deploy site"
|
|
@@ -195591,11 +195463,17 @@ ${summaryLines.join(`
|
|
|
195591
195463
|
${summaryLines.join(`
|
|
195592
195464
|
`)}`);
|
|
195593
195465
|
}
|
|
195594
|
-
|
|
195595
|
-
|
|
195596
|
-
|
|
195597
|
-
|
|
195598
|
-
|
|
195466
|
+
let functionCompleted = 0;
|
|
195467
|
+
const functionTotal = functions.length;
|
|
195468
|
+
const result = await deployAll(projectData, {
|
|
195469
|
+
onFunctionStart: (names) => {
|
|
195470
|
+
const label = names.length === 1 ? names[0] : `${names.length} functions`;
|
|
195471
|
+
R2.step(theme.styles.dim(`[${functionCompleted}/${functionTotal}] Deploying ${label}...`));
|
|
195472
|
+
},
|
|
195473
|
+
onFunctionResult: (r) => {
|
|
195474
|
+
functionCompleted++;
|
|
195475
|
+
formatDeployResult(r);
|
|
195476
|
+
}
|
|
195599
195477
|
});
|
|
195600
195478
|
const needsOAuth = filterPendingOAuth(result.connectorResults ?? []);
|
|
195601
195479
|
if (needsOAuth.length > 0) {
|
|
@@ -195912,10 +195790,10 @@ function toPascalCase(name2) {
|
|
|
195912
195790
|
return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
|
|
195913
195791
|
}
|
|
195914
195792
|
// src/core/types/update-project.ts
|
|
195915
|
-
import { join as
|
|
195793
|
+
import { join as join14 } from "node:path";
|
|
195916
195794
|
var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
|
|
195917
195795
|
async function updateProjectConfig(projectRoot) {
|
|
195918
|
-
const tsconfigPath =
|
|
195796
|
+
const tsconfigPath = join14(projectRoot, "tsconfig.json");
|
|
195919
195797
|
if (!await pathExists(tsconfigPath)) {
|
|
195920
195798
|
return false;
|
|
195921
195799
|
}
|
|
@@ -195958,7 +195836,7 @@ function getTypesCommand(context) {
|
|
|
195958
195836
|
}
|
|
195959
195837
|
|
|
195960
195838
|
// src/cli/commands/dev.ts
|
|
195961
|
-
import { dirname as
|
|
195839
|
+
import { dirname as dirname12, join as join16 } from "node:path";
|
|
195962
195840
|
|
|
195963
195841
|
// src/cli/dev/dev-server/main.ts
|
|
195964
195842
|
var import_cors = __toESM(require_lib4(), 1);
|
|
@@ -196106,10 +195984,10 @@ function createDevLogger() {
|
|
|
196106
195984
|
|
|
196107
195985
|
// src/cli/dev/dev-server/function-manager.ts
|
|
196108
195986
|
import { spawn as spawn2, spawnSync as spawnSync2 } from "node:child_process";
|
|
196109
|
-
import { dirname as
|
|
195987
|
+
import { dirname as dirname11, join as join15 } from "node:path";
|
|
196110
195988
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
196111
|
-
var __dirname5 =
|
|
196112
|
-
var WRAPPER_PATH =
|
|
195989
|
+
var __dirname5 = dirname11(fileURLToPath7(import.meta.url));
|
|
195990
|
+
var WRAPPER_PATH = join15(__dirname5, "../deno-runtime/main.js");
|
|
196113
195991
|
var READY_TIMEOUT = 30000;
|
|
196114
195992
|
|
|
196115
195993
|
class FunctionManager {
|
|
@@ -196361,8 +196239,8 @@ async function devAction(options8) {
|
|
|
196361
196239
|
port,
|
|
196362
196240
|
loadResources: async () => {
|
|
196363
196241
|
const { project: project2 } = await readProjectConfig();
|
|
196364
|
-
const configDir =
|
|
196365
|
-
const functions = await functionResource.readAll(
|
|
196242
|
+
const configDir = dirname12(project2.configPath);
|
|
196243
|
+
const functions = await functionResource.readAll(join16(configDir, project2.functionsDir));
|
|
196366
196244
|
return { functions };
|
|
196367
196245
|
}
|
|
196368
196246
|
});
|
|
@@ -196527,7 +196405,7 @@ function nanoid3(size = 21) {
|
|
|
196527
196405
|
}
|
|
196528
196406
|
|
|
196529
196407
|
// node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
196530
|
-
import { dirname as
|
|
196408
|
+
import { dirname as dirname13, posix, sep } from "path";
|
|
196531
196409
|
function createModulerModifier() {
|
|
196532
196410
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
196533
196411
|
return async (frames) => {
|
|
@@ -196536,7 +196414,7 @@ function createModulerModifier() {
|
|
|
196536
196414
|
return frames;
|
|
196537
196415
|
};
|
|
196538
196416
|
}
|
|
196539
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
196417
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname13(process.argv[1]) : process.cwd(), isWindows4 = sep === "\\") {
|
|
196540
196418
|
const normalizedBase = isWindows4 ? normalizeWindowsPath2(basePath) : basePath;
|
|
196541
196419
|
return (filename) => {
|
|
196542
196420
|
if (!filename)
|
|
@@ -200753,4 +200631,4 @@ export {
|
|
|
200753
200631
|
CLIExitError
|
|
200754
200632
|
};
|
|
200755
200633
|
|
|
200756
|
-
//# debugId=
|
|
200634
|
+
//# debugId=1ACD49D5285119A764756E2164756E21
|