@base44-preview/cli 0.0.33-pr.331.bcfcc1c → 0.0.33-pr.338.6928fe5
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 +81 -223
- package/dist/cli/index.js.map +8 -11
- 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"]);
|
|
@@ -186013,8 +186013,7 @@ var DeployFunctionsResponseSchema = exports_external.object({
|
|
|
186013
186013
|
errors: exports_external.array(exports_external.object({ name: exports_external.string(), message: exports_external.string() })).nullable()
|
|
186014
186014
|
});
|
|
186015
186015
|
var DeploySingleFunctionResponseSchema = exports_external.object({
|
|
186016
|
-
status: exports_external.enum(["deployed", "unchanged"
|
|
186017
|
-
error: exports_external.string().optional().nullable(),
|
|
186016
|
+
status: exports_external.enum(["deployed", "unchanged"]),
|
|
186018
186017
|
duration_ms: exports_external.number().optional().nullable()
|
|
186019
186018
|
});
|
|
186020
186019
|
var FunctionAutomationInfoSchema = exports_external.object({
|
|
@@ -186034,34 +186033,6 @@ var ListFunctionsResponseSchema = exports_external.object({
|
|
|
186034
186033
|
});
|
|
186035
186034
|
|
|
186036
186035
|
// src/core/resources/function/api.ts
|
|
186037
|
-
function toDeployPayloadItem(fn) {
|
|
186038
|
-
return {
|
|
186039
|
-
name: fn.name,
|
|
186040
|
-
entry: fn.entry,
|
|
186041
|
-
files: fn.files,
|
|
186042
|
-
automations: fn.automations
|
|
186043
|
-
};
|
|
186044
|
-
}
|
|
186045
|
-
async function deployFunctions(functions) {
|
|
186046
|
-
const appClient = getAppClient();
|
|
186047
|
-
const payload = {
|
|
186048
|
-
functions: functions.map(toDeployPayloadItem)
|
|
186049
|
-
};
|
|
186050
|
-
let response;
|
|
186051
|
-
try {
|
|
186052
|
-
response = await appClient.put("backend-functions", {
|
|
186053
|
-
json: payload,
|
|
186054
|
-
timeout: false
|
|
186055
|
-
});
|
|
186056
|
-
} catch (error48) {
|
|
186057
|
-
throw await ApiError.fromHttpError(error48, "deploying functions");
|
|
186058
|
-
}
|
|
186059
|
-
const result = DeployFunctionsResponseSchema.safeParse(await response.json());
|
|
186060
|
-
if (!result.success) {
|
|
186061
|
-
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
186062
|
-
}
|
|
186063
|
-
return result.data;
|
|
186064
|
-
}
|
|
186065
186036
|
async function deploySingleFunction(name2, payload) {
|
|
186066
186037
|
const appClient = getAppClient();
|
|
186067
186038
|
let response;
|
|
@@ -186149,13 +186120,6 @@ async function loadFunctionCode(fn) {
|
|
|
186149
186120
|
}));
|
|
186150
186121
|
return { ...fn, files: loadedFiles };
|
|
186151
186122
|
}
|
|
186152
|
-
async function pushFunctions(functions) {
|
|
186153
|
-
if (functions.length === 0) {
|
|
186154
|
-
return { deployed: [], deleted: [], skipped: [], errors: null };
|
|
186155
|
-
}
|
|
186156
|
-
const functionsWithCode = await Promise.all(functions.map(loadFunctionCode));
|
|
186157
|
-
return deployFunctions(functionsWithCode);
|
|
186158
|
-
}
|
|
186159
186123
|
async function deployOne(fn) {
|
|
186160
186124
|
try {
|
|
186161
186125
|
const loaded = await loadFunctionCode(fn);
|
|
@@ -186218,57 +186182,10 @@ async function pruneRemovedFunctions(localFunctionNames) {
|
|
|
186218
186182
|
}
|
|
186219
186183
|
return results;
|
|
186220
186184
|
}
|
|
186221
|
-
// src/core/resources/function/pull.ts
|
|
186222
|
-
import { join as join6 } from "node:path";
|
|
186223
|
-
async function writeFunctions(functionsDir, functions) {
|
|
186224
|
-
const written = [];
|
|
186225
|
-
const skipped = [];
|
|
186226
|
-
for (const fn of functions) {
|
|
186227
|
-
const functionDir = join6(functionsDir, fn.name);
|
|
186228
|
-
const configPath = join6(functionDir, "function.jsonc");
|
|
186229
|
-
if (await isFunctionUnchanged(functionDir, fn)) {
|
|
186230
|
-
skipped.push(fn.name);
|
|
186231
|
-
continue;
|
|
186232
|
-
}
|
|
186233
|
-
const config5 = {
|
|
186234
|
-
name: fn.name,
|
|
186235
|
-
entry: fn.entry
|
|
186236
|
-
};
|
|
186237
|
-
if (fn.automations.length > 0) {
|
|
186238
|
-
config5.automations = fn.automations;
|
|
186239
|
-
}
|
|
186240
|
-
await writeJsonFile(configPath, config5);
|
|
186241
|
-
for (const file2 of fn.files) {
|
|
186242
|
-
await writeFile(join6(functionDir, file2.path), file2.content);
|
|
186243
|
-
}
|
|
186244
|
-
written.push(fn.name);
|
|
186245
|
-
}
|
|
186246
|
-
return { written, skipped };
|
|
186247
|
-
}
|
|
186248
|
-
async function isFunctionUnchanged(functionDir, fn) {
|
|
186249
|
-
if (!await pathExists(functionDir)) {
|
|
186250
|
-
return false;
|
|
186251
|
-
}
|
|
186252
|
-
for (const file2 of fn.files) {
|
|
186253
|
-
const filePath = join6(functionDir, file2.path);
|
|
186254
|
-
if (!await pathExists(filePath)) {
|
|
186255
|
-
return false;
|
|
186256
|
-
}
|
|
186257
|
-
try {
|
|
186258
|
-
const localContent = await readTextFile(filePath);
|
|
186259
|
-
if (localContent !== file2.content) {
|
|
186260
|
-
return false;
|
|
186261
|
-
}
|
|
186262
|
-
} catch {
|
|
186263
|
-
return false;
|
|
186264
|
-
}
|
|
186265
|
-
}
|
|
186266
|
-
return true;
|
|
186267
|
-
}
|
|
186268
186185
|
// src/core/resources/function/resource.ts
|
|
186269
186186
|
var functionResource = {
|
|
186270
186187
|
readAll: readAllFunctions,
|
|
186271
|
-
push:
|
|
186188
|
+
push: (functions) => pushFunctionsSingle(functions)
|
|
186272
186189
|
};
|
|
186273
186190
|
// src/core/project/config.ts
|
|
186274
186191
|
async function findConfigInDir(dir) {
|
|
@@ -186309,10 +186226,10 @@ async function readProjectConfig(projectRoot) {
|
|
|
186309
186226
|
const project = result.data;
|
|
186310
186227
|
const configDir = dirname5(configPath);
|
|
186311
186228
|
const [entities, functions, agents, connectors] = await Promise.all([
|
|
186312
|
-
entityResource.readAll(
|
|
186313
|
-
functionResource.readAll(
|
|
186314
|
-
agentResource.readAll(
|
|
186315
|
-
connectorResource.readAll(
|
|
186229
|
+
entityResource.readAll(join6(configDir, project.entitiesDir)),
|
|
186230
|
+
functionResource.readAll(join6(configDir, project.functionsDir)),
|
|
186231
|
+
agentResource.readAll(join6(configDir, project.agentsDir)),
|
|
186232
|
+
connectorResource.readAll(join6(configDir, project.connectorsDir))
|
|
186316
186233
|
]);
|
|
186317
186234
|
return {
|
|
186318
186235
|
project: { ...project, root, configPath },
|
|
@@ -186409,7 +186326,7 @@ async function readAppConfig(projectRoot) {
|
|
|
186409
186326
|
// src/core/project/template.ts
|
|
186410
186327
|
var import_ejs = __toESM(require_ejs(), 1);
|
|
186411
186328
|
var import_front_matter = __toESM(require_front_matter(), 1);
|
|
186412
|
-
import { dirname as dirname6, join as
|
|
186329
|
+
import { dirname as dirname6, join as join7 } from "node:path";
|
|
186413
186330
|
async function listTemplates() {
|
|
186414
186331
|
const parsed = await readJsonFile(getTemplatesIndexPath());
|
|
186415
186332
|
const result = TemplatesConfigSchema.safeParse(parsed);
|
|
@@ -186419,23 +186336,23 @@ async function listTemplates() {
|
|
|
186419
186336
|
return result.data.templates;
|
|
186420
186337
|
}
|
|
186421
186338
|
async function renderTemplate(template, destPath, data) {
|
|
186422
|
-
const templateDir =
|
|
186339
|
+
const templateDir = join7(getTemplatesDir(), template.path);
|
|
186423
186340
|
const files = await globby("**/*", {
|
|
186424
186341
|
cwd: templateDir,
|
|
186425
186342
|
dot: true,
|
|
186426
186343
|
onlyFiles: true
|
|
186427
186344
|
});
|
|
186428
186345
|
for (const file2 of files) {
|
|
186429
|
-
const srcPath =
|
|
186346
|
+
const srcPath = join7(templateDir, file2);
|
|
186430
186347
|
try {
|
|
186431
186348
|
if (file2.endsWith(".ejs")) {
|
|
186432
186349
|
const rendered = await import_ejs.default.renderFile(srcPath, data);
|
|
186433
186350
|
const { attributes, body } = import_front_matter.default(rendered);
|
|
186434
|
-
const destFile = attributes.outputFileName ?
|
|
186435
|
-
const destFilePath =
|
|
186351
|
+
const destFile = attributes.outputFileName ? join7(dirname6(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
|
|
186352
|
+
const destFilePath = join7(destPath, destFile);
|
|
186436
186353
|
await writeFile(destFilePath, body);
|
|
186437
186354
|
} else {
|
|
186438
|
-
const destFilePath =
|
|
186355
|
+
const destFilePath = join7(destPath, file2);
|
|
186439
186356
|
await copyFile(srcPath, destFilePath);
|
|
186440
186357
|
}
|
|
186441
186358
|
} catch (error48) {
|
|
@@ -186538,7 +186455,7 @@ async function getSiteFilePaths(outputDir) {
|
|
|
186538
186455
|
// src/core/site/deploy.ts
|
|
186539
186456
|
import { randomUUID } from "node:crypto";
|
|
186540
186457
|
import { tmpdir } from "node:os";
|
|
186541
|
-
import { join as
|
|
186458
|
+
import { join as join8 } from "node:path";
|
|
186542
186459
|
async function deploySite(siteOutputDir) {
|
|
186543
186460
|
if (!await pathExists(siteOutputDir)) {
|
|
186544
186461
|
throw new FileNotFoundError(`Output directory does not exist: ${siteOutputDir}. Make sure to build your project first.`, {
|
|
@@ -186555,7 +186472,7 @@ async function deploySite(siteOutputDir) {
|
|
|
186555
186472
|
]
|
|
186556
186473
|
});
|
|
186557
186474
|
}
|
|
186558
|
-
const archivePath =
|
|
186475
|
+
const archivePath = join8(tmpdir(), `base44-site-${randomUUID()}.tar.gz`);
|
|
186559
186476
|
try {
|
|
186560
186477
|
await createArchive(siteOutputDir, archivePath);
|
|
186561
186478
|
return await uploadSite(archivePath);
|
|
@@ -186580,10 +186497,13 @@ function hasResourcesToDeploy(projectData) {
|
|
|
186580
186497
|
const hasConnectors = connectors.length > 0;
|
|
186581
186498
|
return hasEntities || hasFunctions || hasAgents || hasConnectors || hasSite;
|
|
186582
186499
|
}
|
|
186583
|
-
async function deployAll(projectData) {
|
|
186500
|
+
async function deployAll(projectData, options) {
|
|
186584
186501
|
const { project, entities, functions, agents, connectors } = projectData;
|
|
186585
186502
|
await entityResource.push(entities);
|
|
186586
|
-
await
|
|
186503
|
+
await pushFunctionsSingle(functions, {
|
|
186504
|
+
onStart: options?.onFunctionStart,
|
|
186505
|
+
onResult: options?.onFunctionResult
|
|
186506
|
+
});
|
|
186587
186507
|
await agentResource.push(agents);
|
|
186588
186508
|
const { results: connectorResults } = await pushConnectors(connectors);
|
|
186589
186509
|
if (project.site?.outputDirectory) {
|
|
@@ -194236,7 +194156,7 @@ function getDashboardUrl(projectId) {
|
|
|
194236
194156
|
async function pullAgentsAction() {
|
|
194237
194157
|
const { project: project2 } = await readProjectConfig();
|
|
194238
194158
|
const configDir = dirname7(project2.configPath);
|
|
194239
|
-
const agentsDir =
|
|
194159
|
+
const agentsDir = join9(configDir, project2.agentsDir);
|
|
194240
194160
|
const remoteAgents = await runTask("Fetching agents from Base44", async () => {
|
|
194241
194161
|
return await fetchAgents();
|
|
194242
194162
|
}, {
|
|
@@ -194330,11 +194250,11 @@ function getWhoamiCommand(context) {
|
|
|
194330
194250
|
}
|
|
194331
194251
|
|
|
194332
194252
|
// src/cli/commands/connectors/pull.ts
|
|
194333
|
-
import { dirname as dirname8, join as
|
|
194253
|
+
import { dirname as dirname8, join as join10 } from "node:path";
|
|
194334
194254
|
async function pullConnectorsAction() {
|
|
194335
194255
|
const { project: project2 } = await readProjectConfig();
|
|
194336
194256
|
const configDir = dirname8(project2.configPath);
|
|
194337
|
-
const connectorsDir =
|
|
194257
|
+
const connectorsDir = join10(configDir, project2.connectorsDir);
|
|
194338
194258
|
const remoteConnectors = await runTask("Fetching connectors from Base44", async () => {
|
|
194339
194259
|
return await listConnectors();
|
|
194340
194260
|
}, {
|
|
@@ -195305,95 +195225,13 @@ function getListCommand(context) {
|
|
|
195305
195225
|
});
|
|
195306
195226
|
}
|
|
195307
195227
|
|
|
195308
|
-
// src/cli/commands/functions/new.ts
|
|
195309
|
-
import { dirname as dirname9, join as join12 } from "node:path";
|
|
195310
|
-
var FUNCTION_TEMPLATE = `Deno.serve(async (req: Request) => {
|
|
195311
|
-
return new Response(JSON.stringify({ message: "Hello from {{name}}!" }), {
|
|
195312
|
-
headers: { "Content-Type": "application/json" },
|
|
195313
|
-
});
|
|
195314
|
-
});
|
|
195315
|
-
`;
|
|
195316
|
-
async function newFunctionAction(name2) {
|
|
195317
|
-
if (name2.includes(".")) {
|
|
195318
|
-
throw new InvalidInputError("Function name cannot contain dots");
|
|
195319
|
-
}
|
|
195320
|
-
const { project: project2, functions } = await readProjectConfig();
|
|
195321
|
-
if (functions.some((f) => f.name === name2)) {
|
|
195322
|
-
throw new InvalidInputError(`Function "${name2}" already exists in this project`);
|
|
195323
|
-
}
|
|
195324
|
-
const configDir = dirname9(project2.configPath);
|
|
195325
|
-
const functionsDir = join12(configDir, project2.functionsDir);
|
|
195326
|
-
const functionDir = join12(functionsDir, name2);
|
|
195327
|
-
if (await pathExists(functionDir)) {
|
|
195328
|
-
throw new InvalidInputError(`Directory "${functionDir}" already exists`);
|
|
195329
|
-
}
|
|
195330
|
-
const configPath = join12(functionDir, "function.jsonc");
|
|
195331
|
-
const entryPath = join12(functionDir, "index.ts");
|
|
195332
|
-
await writeJsonFile(configPath, { name: name2, entry: "index.ts" });
|
|
195333
|
-
await writeFile(entryPath, FUNCTION_TEMPLATE.replace("{{name}}", name2));
|
|
195334
|
-
R2.success(`Created ${configPath}`);
|
|
195335
|
-
R2.success(`Created ${entryPath}`);
|
|
195336
|
-
return {
|
|
195337
|
-
outroMessage: `Function "${name2}" created. Deploy with: base44 functions deploy ${name2}`
|
|
195338
|
-
};
|
|
195339
|
-
}
|
|
195340
|
-
function getNewCommand(context) {
|
|
195341
|
-
return new Command("new").description("Create a new backend function from template").argument("<name>", "Name for the new function").action(async (name2) => {
|
|
195342
|
-
await runCommand(() => newFunctionAction(name2), { requireAuth: false }, context);
|
|
195343
|
-
});
|
|
195344
|
-
}
|
|
195345
|
-
|
|
195346
|
-
// src/cli/commands/functions/pull.ts
|
|
195347
|
-
import { dirname as dirname10, join as join13 } from "node:path";
|
|
195348
|
-
async function pullFunctionsAction(name2) {
|
|
195349
|
-
const { project: project2 } = await readProjectConfig();
|
|
195350
|
-
const configDir = dirname10(project2.configPath);
|
|
195351
|
-
const functionsDir = join13(configDir, project2.functionsDir);
|
|
195352
|
-
const remoteFunctions = await runTask("Fetching functions from Base44", async () => {
|
|
195353
|
-
const { functions } = await listDeployedFunctions();
|
|
195354
|
-
return functions;
|
|
195355
|
-
}, {
|
|
195356
|
-
successMessage: "Functions fetched successfully",
|
|
195357
|
-
errorMessage: "Failed to fetch functions"
|
|
195358
|
-
});
|
|
195359
|
-
const toPull = name2 ? remoteFunctions.filter((f) => f.name === name2) : remoteFunctions;
|
|
195360
|
-
if (name2 && toPull.length === 0) {
|
|
195361
|
-
return {
|
|
195362
|
-
outroMessage: `Function "${name2}" not found on remote`
|
|
195363
|
-
};
|
|
195364
|
-
}
|
|
195365
|
-
if (toPull.length === 0) {
|
|
195366
|
-
return { outroMessage: "No functions found on remote" };
|
|
195367
|
-
}
|
|
195368
|
-
const { written, skipped } = await runTask("Writing function files", async () => {
|
|
195369
|
-
return await writeFunctions(functionsDir, toPull);
|
|
195370
|
-
}, {
|
|
195371
|
-
successMessage: "Function files written successfully",
|
|
195372
|
-
errorMessage: "Failed to write function files"
|
|
195373
|
-
});
|
|
195374
|
-
if (written.length > 0) {
|
|
195375
|
-
R2.success(`Written: ${written.join(", ")}`);
|
|
195376
|
-
}
|
|
195377
|
-
if (skipped.length > 0) {
|
|
195378
|
-
R2.info(`Skipped (unchanged): ${skipped.join(", ")}`);
|
|
195379
|
-
}
|
|
195380
|
-
return {
|
|
195381
|
-
outroMessage: `Pulled ${toPull.length} function${toPull.length !== 1 ? "s" : ""} to ${functionsDir}`
|
|
195382
|
-
};
|
|
195383
|
-
}
|
|
195384
|
-
function getPullCommand(context) {
|
|
195385
|
-
return new Command("pull").description("Pull deployed functions from Base44 to local files").argument("[name]", "Pull a single function by name").action(async (name2) => {
|
|
195386
|
-
await runCommand(() => pullFunctionsAction(name2), { requireAuth: true }, context);
|
|
195387
|
-
});
|
|
195388
|
-
}
|
|
195389
|
-
|
|
195390
195228
|
// src/cli/commands/functions/index.ts
|
|
195391
195229
|
function getFunctionsCommand(context) {
|
|
195392
|
-
return new Command("functions").description("Manage backend functions").addCommand(
|
|
195230
|
+
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getListCommand(context)).addCommand(getDeleteCommand(context));
|
|
195393
195231
|
}
|
|
195394
195232
|
|
|
195395
195233
|
// src/cli/commands/project/create.ts
|
|
195396
|
-
import { basename as basename3, join as
|
|
195234
|
+
import { basename as basename3, join as join11, resolve as resolve2 } from "node:path";
|
|
195397
195235
|
var import_lodash = __toESM(require_lodash(), 1);
|
|
195398
195236
|
var DEFAULT_TEMPLATE_ID = "backend-only";
|
|
195399
195237
|
async function getTemplateById(templateId) {
|
|
@@ -195529,7 +195367,7 @@ async function executeCreate({
|
|
|
195529
195367
|
updateMessage("Building project...");
|
|
195530
195368
|
await execa({ cwd: resolvedPath, shell: true })`${buildCommand}`;
|
|
195531
195369
|
updateMessage("Deploying site...");
|
|
195532
|
-
return await deploySite(
|
|
195370
|
+
return await deploySite(join11(resolvedPath, outputDirectory));
|
|
195533
195371
|
}, {
|
|
195534
195372
|
successMessage: theme.colors.base44Orange("Site deployed successfully"),
|
|
195535
195373
|
errorMessage: "Failed to deploy site"
|
|
@@ -195570,6 +195408,20 @@ function getCreateCommand(context) {
|
|
|
195570
195408
|
}
|
|
195571
195409
|
|
|
195572
195410
|
// src/cli/commands/project/deploy.ts
|
|
195411
|
+
function formatDuration2(ms) {
|
|
195412
|
+
return `${(ms / 1000).toFixed(1)}s`;
|
|
195413
|
+
}
|
|
195414
|
+
function formatFunctionResult(r) {
|
|
195415
|
+
const label = r.name.padEnd(25);
|
|
195416
|
+
if (r.status === "deployed") {
|
|
195417
|
+
const timing = r.duration_ms ? theme.styles.dim(` (${formatDuration2(r.duration_ms)})`) : "";
|
|
195418
|
+
R2.success(`${label} deployed${timing}`);
|
|
195419
|
+
} else if (r.status === "unchanged") {
|
|
195420
|
+
R2.success(`${label} unchanged`);
|
|
195421
|
+
} else {
|
|
195422
|
+
R2.error(`${label} error: ${r.error}`);
|
|
195423
|
+
}
|
|
195424
|
+
}
|
|
195573
195425
|
async function deployAction(options) {
|
|
195574
195426
|
const projectData = await readProjectConfig(options.projectRoot);
|
|
195575
195427
|
if (!hasResourcesToDeploy(projectData)) {
|
|
@@ -195609,11 +195461,17 @@ ${summaryLines.join(`
|
|
|
195609
195461
|
${summaryLines.join(`
|
|
195610
195462
|
`)}`);
|
|
195611
195463
|
}
|
|
195612
|
-
|
|
195613
|
-
|
|
195614
|
-
|
|
195615
|
-
|
|
195616
|
-
|
|
195464
|
+
let functionCompleted = 0;
|
|
195465
|
+
const functionTotal = functions.length;
|
|
195466
|
+
const result = await deployAll(projectData, {
|
|
195467
|
+
onFunctionStart: (names) => {
|
|
195468
|
+
const label = names.length === 1 ? names[0] : `${names.length} functions`;
|
|
195469
|
+
R2.step(theme.styles.dim(`[${functionCompleted}/${functionTotal}] Deploying ${label}...`));
|
|
195470
|
+
},
|
|
195471
|
+
onFunctionResult: (r) => {
|
|
195472
|
+
functionCompleted++;
|
|
195473
|
+
formatFunctionResult(r);
|
|
195474
|
+
}
|
|
195617
195475
|
});
|
|
195618
195476
|
const needsOAuth = filterPendingOAuth(result.connectorResults ?? []);
|
|
195619
195477
|
if (needsOAuth.length > 0) {
|
|
@@ -195930,10 +195788,10 @@ function toPascalCase(name2) {
|
|
|
195930
195788
|
return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
|
|
195931
195789
|
}
|
|
195932
195790
|
// src/core/types/update-project.ts
|
|
195933
|
-
import { join as
|
|
195791
|
+
import { join as join14 } from "node:path";
|
|
195934
195792
|
var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
|
|
195935
195793
|
async function updateProjectConfig(projectRoot) {
|
|
195936
|
-
const tsconfigPath =
|
|
195794
|
+
const tsconfigPath = join14(projectRoot, "tsconfig.json");
|
|
195937
195795
|
if (!await pathExists(tsconfigPath)) {
|
|
195938
195796
|
return false;
|
|
195939
195797
|
}
|
|
@@ -195976,7 +195834,7 @@ function getTypesCommand(context) {
|
|
|
195976
195834
|
}
|
|
195977
195835
|
|
|
195978
195836
|
// src/cli/commands/dev.ts
|
|
195979
|
-
import { dirname as
|
|
195837
|
+
import { dirname as dirname12, join as join16 } from "node:path";
|
|
195980
195838
|
|
|
195981
195839
|
// src/cli/dev/dev-server/main.ts
|
|
195982
195840
|
var import_cors = __toESM(require_lib4(), 1);
|
|
@@ -196124,10 +195982,10 @@ function createDevLogger() {
|
|
|
196124
195982
|
|
|
196125
195983
|
// src/cli/dev/dev-server/function-manager.ts
|
|
196126
195984
|
import { spawn as spawn2, spawnSync as spawnSync2 } from "node:child_process";
|
|
196127
|
-
import { dirname as
|
|
195985
|
+
import { dirname as dirname11, join as join15 } from "node:path";
|
|
196128
195986
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
196129
|
-
var __dirname5 =
|
|
196130
|
-
var WRAPPER_PATH =
|
|
195987
|
+
var __dirname5 = dirname11(fileURLToPath7(import.meta.url));
|
|
195988
|
+
var WRAPPER_PATH = join15(__dirname5, "../deno-runtime/main.js");
|
|
196131
195989
|
var READY_TIMEOUT = 30000;
|
|
196132
195990
|
|
|
196133
195991
|
class FunctionManager {
|
|
@@ -196379,8 +196237,8 @@ async function devAction(options8) {
|
|
|
196379
196237
|
port,
|
|
196380
196238
|
loadResources: async () => {
|
|
196381
196239
|
const { project: project2 } = await readProjectConfig();
|
|
196382
|
-
const configDir =
|
|
196383
|
-
const functions = await functionResource.readAll(
|
|
196240
|
+
const configDir = dirname12(project2.configPath);
|
|
196241
|
+
const functions = await functionResource.readAll(join16(configDir, project2.functionsDir));
|
|
196384
196242
|
return { functions };
|
|
196385
196243
|
}
|
|
196386
196244
|
});
|
|
@@ -196545,7 +196403,7 @@ function nanoid3(size = 21) {
|
|
|
196545
196403
|
}
|
|
196546
196404
|
|
|
196547
196405
|
// node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
196548
|
-
import { dirname as
|
|
196406
|
+
import { dirname as dirname13, posix, sep } from "path";
|
|
196549
196407
|
function createModulerModifier() {
|
|
196550
196408
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
196551
196409
|
return async (frames) => {
|
|
@@ -196554,7 +196412,7 @@ function createModulerModifier() {
|
|
|
196554
196412
|
return frames;
|
|
196555
196413
|
};
|
|
196556
196414
|
}
|
|
196557
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
196415
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname13(process.argv[1]) : process.cwd(), isWindows4 = sep === "\\") {
|
|
196558
196416
|
const normalizedBase = isWindows4 ? normalizeWindowsPath2(basePath) : basePath;
|
|
196559
196417
|
return (filename) => {
|
|
196560
196418
|
if (!filename)
|
|
@@ -200771,4 +200629,4 @@ export {
|
|
|
200771
200629
|
CLIExitError
|
|
200772
200630
|
};
|
|
200773
200631
|
|
|
200774
|
-
//# debugId=
|
|
200632
|
+
//# debugId=AF9218E8BC7FC1E564756E2164756E21
|