@base44-preview/cli 0.0.38-pr.330.d128357 → 0.0.38-pr.367.04e6606
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 +189 -433
- package/dist/cli/index.js.map +16 -22
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -18040,7 +18040,7 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
18040
18040
|
}
|
|
18041
18041
|
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
|
|
18042
18042
|
});
|
|
18043
|
-
function
|
|
18043
|
+
function join12(array2, separator) {
|
|
18044
18044
|
return array2 == null ? "" : nativeJoin.call(array2, separator);
|
|
18045
18045
|
}
|
|
18046
18046
|
function last(array2) {
|
|
@@ -18062,7 +18062,7 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
18062
18062
|
function nth(array2, n2) {
|
|
18063
18063
|
return array2 && array2.length ? baseNth(array2, toInteger(n2)) : undefined2;
|
|
18064
18064
|
}
|
|
18065
|
-
var
|
|
18065
|
+
var pull = baseRest(pullAll);
|
|
18066
18066
|
function pullAll(array2, values2) {
|
|
18067
18067
|
return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2) : array2;
|
|
18068
18068
|
}
|
|
@@ -19827,7 +19827,7 @@ __p += '`;
|
|
|
19827
19827
|
lodash.pickBy = pickBy;
|
|
19828
19828
|
lodash.property = property;
|
|
19829
19829
|
lodash.propertyOf = propertyOf;
|
|
19830
|
-
lodash.pull =
|
|
19830
|
+
lodash.pull = pull;
|
|
19831
19831
|
lodash.pullAll = pullAll;
|
|
19832
19832
|
lodash.pullAllBy = pullAllBy;
|
|
19833
19833
|
lodash.pullAllWith = pullAllWith;
|
|
@@ -19972,7 +19972,7 @@ __p += '`;
|
|
|
19972
19972
|
lodash.isUndefined = isUndefined;
|
|
19973
19973
|
lodash.isWeakMap = isWeakMap;
|
|
19974
19974
|
lodash.isWeakSet = isWeakSet;
|
|
19975
|
-
lodash.join =
|
|
19975
|
+
lodash.join = join12;
|
|
19976
19976
|
lodash.kebabCase = kebabCase2;
|
|
19977
19977
|
lodash.last = last;
|
|
19978
19978
|
lodash.lastIndexOf = lastIndexOf;
|
|
@@ -20601,7 +20601,7 @@ function cleanDoc(doc2) {
|
|
|
20601
20601
|
return mapDoc(doc2, (currentDoc) => cleanDocFn(currentDoc));
|
|
20602
20602
|
}
|
|
20603
20603
|
function replaceEndOfLine(doc2, replacement = literalline) {
|
|
20604
|
-
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
20604
|
+
return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ? join12(replacement, currentDoc.split(`
|
|
20605
20605
|
`)) : currentDoc);
|
|
20606
20606
|
}
|
|
20607
20607
|
function canBreakFn(doc2) {
|
|
@@ -20681,7 +20681,7 @@ function indentIfBreak(contents, options) {
|
|
|
20681
20681
|
negate: options.negate
|
|
20682
20682
|
};
|
|
20683
20683
|
}
|
|
20684
|
-
function
|
|
20684
|
+
function join12(separator, docs) {
|
|
20685
20685
|
assertDoc(separator);
|
|
20686
20686
|
assertDocArray(docs);
|
|
20687
20687
|
const parts = [];
|
|
@@ -21392,7 +21392,7 @@ var init_doc = __esm(() => {
|
|
|
21392
21392
|
MODE_FLAT = Symbol("MODE_FLAT");
|
|
21393
21393
|
DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
|
|
21394
21394
|
builders = {
|
|
21395
|
-
join:
|
|
21395
|
+
join: join12,
|
|
21396
21396
|
line,
|
|
21397
21397
|
softline,
|
|
21398
21398
|
hardline,
|
|
@@ -126306,7 +126306,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
126306
126306
|
return mapDoc2(doc2, (currentDoc) => cleanDocFn2(currentDoc));
|
|
126307
126307
|
}
|
|
126308
126308
|
function replaceEndOfLine2(doc2, replacement = literalline2) {
|
|
126309
|
-
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ?
|
|
126309
|
+
return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ? join14(replacement, currentDoc.split(`
|
|
126310
126310
|
`)) : currentDoc);
|
|
126311
126311
|
}
|
|
126312
126312
|
function canBreakFn2(doc2) {
|
|
@@ -126392,7 +126392,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
126392
126392
|
negate: options8.negate
|
|
126393
126393
|
};
|
|
126394
126394
|
}
|
|
126395
|
-
function
|
|
126395
|
+
function join14(separator, docs) {
|
|
126396
126396
|
assertDoc2(separator);
|
|
126397
126397
|
assertDocArray2(docs);
|
|
126398
126398
|
const parts = [];
|
|
@@ -127057,7 +127057,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
127057
127057
|
}
|
|
127058
127058
|
}
|
|
127059
127059
|
var builders2 = {
|
|
127060
|
-
join:
|
|
127060
|
+
join: join14,
|
|
127061
127061
|
line: line3,
|
|
127062
127062
|
softline: softline2,
|
|
127063
127063
|
hardline: hardline4,
|
|
@@ -156272,10 +156272,10 @@ var require_view = __commonJS((exports, module) => {
|
|
|
156272
156272
|
var debug = require_src4()("express:view");
|
|
156273
156273
|
var path18 = __require("node:path");
|
|
156274
156274
|
var fs28 = __require("node:fs");
|
|
156275
|
-
var
|
|
156275
|
+
var dirname12 = path18.dirname;
|
|
156276
156276
|
var basename4 = path18.basename;
|
|
156277
156277
|
var extname2 = path18.extname;
|
|
156278
|
-
var
|
|
156278
|
+
var join15 = path18.join;
|
|
156279
156279
|
var resolve6 = path18.resolve;
|
|
156280
156280
|
module.exports = View;
|
|
156281
156281
|
function View(name2, options8) {
|
|
@@ -156311,7 +156311,7 @@ var require_view = __commonJS((exports, module) => {
|
|
|
156311
156311
|
for (var i5 = 0;i5 < roots.length && !path19; i5++) {
|
|
156312
156312
|
var root2 = roots[i5];
|
|
156313
156313
|
var loc = resolve6(root2, name2);
|
|
156314
|
-
var dir =
|
|
156314
|
+
var dir = dirname12(loc);
|
|
156315
156315
|
var file2 = basename4(loc);
|
|
156316
156316
|
path19 = this.resolve(dir, file2);
|
|
156317
156317
|
}
|
|
@@ -156337,12 +156337,12 @@ var require_view = __commonJS((exports, module) => {
|
|
|
156337
156337
|
};
|
|
156338
156338
|
View.prototype.resolve = function resolve7(dir, file2) {
|
|
156339
156339
|
var ext = this.ext;
|
|
156340
|
-
var path19 =
|
|
156340
|
+
var path19 = join15(dir, file2);
|
|
156341
156341
|
var stat2 = tryStat(path19);
|
|
156342
156342
|
if (stat2 && stat2.isFile()) {
|
|
156343
156343
|
return path19;
|
|
156344
156344
|
}
|
|
156345
|
-
path19 =
|
|
156345
|
+
path19 = join15(dir, basename4(file2, ext), "index" + ext);
|
|
156346
156346
|
stat2 = tryStat(path19);
|
|
156347
156347
|
if (stat2 && stat2.isFile()) {
|
|
156348
156348
|
return path19;
|
|
@@ -160037,7 +160037,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
160037
160037
|
var Stream2 = __require("stream");
|
|
160038
160038
|
var util2 = __require("util");
|
|
160039
160039
|
var extname2 = path18.extname;
|
|
160040
|
-
var
|
|
160040
|
+
var join15 = path18.join;
|
|
160041
160041
|
var normalize = path18.normalize;
|
|
160042
160042
|
var resolve6 = path18.resolve;
|
|
160043
160043
|
var sep = path18.sep;
|
|
@@ -160209,7 +160209,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
160209
160209
|
return res;
|
|
160210
160210
|
}
|
|
160211
160211
|
parts = path19.split(sep);
|
|
160212
|
-
path19 = normalize(
|
|
160212
|
+
path19 = normalize(join15(root2, path19));
|
|
160213
160213
|
} else {
|
|
160214
160214
|
if (UP_PATH_REGEXP.test(path19)) {
|
|
160215
160215
|
debug('malicious path "%s"', path19);
|
|
@@ -160349,7 +160349,7 @@ var require_send = __commonJS((exports, module) => {
|
|
|
160349
160349
|
return self2.onStatError(err);
|
|
160350
160350
|
return self2.error(404);
|
|
160351
160351
|
}
|
|
160352
|
-
var p4 =
|
|
160352
|
+
var p4 = join15(path19, self2._index[i5]);
|
|
160353
160353
|
debug('stat "%s"', p4);
|
|
160354
160354
|
fs28.stat(p4, function(err2, stat2) {
|
|
160355
160355
|
if (err2)
|
|
@@ -206944,7 +206944,7 @@ var require_buffer_list = __commonJS((exports, module) => {
|
|
|
206944
206944
|
}
|
|
206945
206945
|
}, {
|
|
206946
206946
|
key: "join",
|
|
206947
|
-
value: function
|
|
206947
|
+
value: function join16(s5) {
|
|
206948
206948
|
if (this.length === 0)
|
|
206949
206949
|
return "";
|
|
206950
206950
|
var p4 = this.head;
|
|
@@ -210671,7 +210671,7 @@ var {
|
|
|
210671
210671
|
} = import__.default;
|
|
210672
210672
|
|
|
210673
210673
|
// src/cli/commands/agents/pull.ts
|
|
210674
|
-
import { dirname as dirname8, join as
|
|
210674
|
+
import { dirname as dirname8, join as join9 } from "node:path";
|
|
210675
210675
|
|
|
210676
210676
|
// node_modules/@clack/core/dist/index.mjs
|
|
210677
210677
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
@@ -233172,7 +233172,7 @@ var generateGlobTasks = normalizeArguments(generateTasks);
|
|
|
233172
233172
|
var generateGlobTasksSync = normalizeArgumentsSync(generateTasksSync);
|
|
233173
233173
|
|
|
233174
233174
|
// src/core/project/config.ts
|
|
233175
|
-
import { dirname as dirname6, join as
|
|
233175
|
+
import { dirname as dirname6, join as join6 } from "node:path";
|
|
233176
233176
|
|
|
233177
233177
|
// src/core/resources/agent/schema.ts
|
|
233178
233178
|
var EntityOperationSchema = exports_external.enum(["create", "update", "delete", "read"]);
|
|
@@ -233475,6 +233475,39 @@ var RemoveConnectorResponseSchema = exports_external.object({
|
|
|
233475
233475
|
status: data.status,
|
|
233476
233476
|
integrationType: data.integration_type
|
|
233477
233477
|
}));
|
|
233478
|
+
var ConnectionConfigFieldSchema = exports_external.object({
|
|
233479
|
+
name: exports_external.string(),
|
|
233480
|
+
display_name: exports_external.string(),
|
|
233481
|
+
description: exports_external.string(),
|
|
233482
|
+
placeholder: exports_external.string(),
|
|
233483
|
+
required: exports_external.boolean(),
|
|
233484
|
+
validation_pattern: exports_external.string().nullable().optional(),
|
|
233485
|
+
validation_error: exports_external.string().nullable().optional()
|
|
233486
|
+
});
|
|
233487
|
+
var AvailableIntegrationSchema = exports_external.object({
|
|
233488
|
+
integration_type: exports_external.string().min(1),
|
|
233489
|
+
display_name: exports_external.string(),
|
|
233490
|
+
description: exports_external.string(),
|
|
233491
|
+
connection_config_fields: exports_external.array(ConnectionConfigFieldSchema)
|
|
233492
|
+
});
|
|
233493
|
+
var ListAvailableIntegrationsResponseSchema = exports_external.object({
|
|
233494
|
+
integrations: exports_external.array(AvailableIntegrationSchema)
|
|
233495
|
+
}).transform((data) => ({
|
|
233496
|
+
integrations: data.integrations.map((i) => ({
|
|
233497
|
+
integrationType: i.integration_type,
|
|
233498
|
+
displayName: i.display_name,
|
|
233499
|
+
description: i.description,
|
|
233500
|
+
connectionConfigFields: i.connection_config_fields.map((f) => ({
|
|
233501
|
+
name: f.name,
|
|
233502
|
+
displayName: f.display_name,
|
|
233503
|
+
description: f.description,
|
|
233504
|
+
placeholder: f.placeholder,
|
|
233505
|
+
required: f.required,
|
|
233506
|
+
validationPattern: f.validation_pattern,
|
|
233507
|
+
validationError: f.validation_error
|
|
233508
|
+
}))
|
|
233509
|
+
}))
|
|
233510
|
+
}));
|
|
233478
233511
|
|
|
233479
233512
|
// src/core/resources/connector/api.ts
|
|
233480
233513
|
async function listConnectors() {
|
|
@@ -233528,6 +233561,20 @@ async function getOAuthStatus(integrationType, connectionId) {
|
|
|
233528
233561
|
}
|
|
233529
233562
|
return result.data;
|
|
233530
233563
|
}
|
|
233564
|
+
async function listAvailableIntegrations() {
|
|
233565
|
+
const appClient = getAppClient();
|
|
233566
|
+
let response;
|
|
233567
|
+
try {
|
|
233568
|
+
response = await appClient.get("external-auth/available-integrations");
|
|
233569
|
+
} catch (error48) {
|
|
233570
|
+
throw await ApiError.fromHttpError(error48, "listing available integrations");
|
|
233571
|
+
}
|
|
233572
|
+
const result = ListAvailableIntegrationsResponseSchema.safeParse(await response.json());
|
|
233573
|
+
if (!result.success) {
|
|
233574
|
+
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
233575
|
+
}
|
|
233576
|
+
return result.data;
|
|
233577
|
+
}
|
|
233531
233578
|
async function removeConnector(integrationType) {
|
|
233532
233579
|
const appClient = getAppClient();
|
|
233533
233580
|
let response;
|
|
@@ -233902,23 +233949,11 @@ var BackendFunctionSchema = FunctionConfigSchema.extend({
|
|
|
233902
233949
|
entryPath: exports_external.string().min(1, "Entry path cannot be empty"),
|
|
233903
233950
|
filePaths: exports_external.array(exports_external.string()).min(1, "Function must have at least one file")
|
|
233904
233951
|
});
|
|
233905
|
-
var
|
|
233906
|
-
|
|
233907
|
-
|
|
233908
|
-
|
|
233909
|
-
name: exports_external.string(),
|
|
233910
|
-
type: exports_external.string(),
|
|
233911
|
-
is_active: exports_external.boolean()
|
|
233912
|
-
});
|
|
233913
|
-
var FunctionInfoSchema = exports_external.object({
|
|
233914
|
-
name: exports_external.string(),
|
|
233915
|
-
deployment_id: exports_external.string(),
|
|
233916
|
-
entry: exports_external.string(),
|
|
233917
|
-
files: exports_external.array(FunctionFileSchema),
|
|
233918
|
-
automations: exports_external.array(FunctionAutomationInfoSchema)
|
|
233919
|
-
});
|
|
233920
|
-
var ListFunctionsResponseSchema = exports_external.object({
|
|
233921
|
-
functions: exports_external.array(FunctionInfoSchema)
|
|
233952
|
+
var DeployFunctionsResponseSchema = exports_external.object({
|
|
233953
|
+
deployed: exports_external.array(exports_external.string()),
|
|
233954
|
+
deleted: exports_external.array(exports_external.string()),
|
|
233955
|
+
skipped: exports_external.array(exports_external.string()).optional().nullable(),
|
|
233956
|
+
errors: exports_external.array(exports_external.object({ name: exports_external.string(), message: exports_external.string() })).nullable()
|
|
233922
233957
|
});
|
|
233923
233958
|
var LogLevelSchema = exports_external.enum(["info", "warning", "error", "debug"]);
|
|
233924
233959
|
var FunctionLogEntrySchema = exports_external.object({
|
|
@@ -233929,37 +233964,29 @@ var FunctionLogEntrySchema = exports_external.object({
|
|
|
233929
233964
|
var FunctionLogsResponseSchema = exports_external.array(FunctionLogEntrySchema);
|
|
233930
233965
|
|
|
233931
233966
|
// src/core/resources/function/api.ts
|
|
233932
|
-
|
|
233933
|
-
|
|
233934
|
-
|
|
233935
|
-
|
|
233936
|
-
|
|
233937
|
-
|
|
233938
|
-
|
|
233939
|
-
}
|
|
233940
|
-
const result = DeploySingleFunctionResponseSchema.safeParse(await response.json());
|
|
233941
|
-
if (!result.success) {
|
|
233942
|
-
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
233943
|
-
}
|
|
233944
|
-
return result.data;
|
|
233945
|
-
}
|
|
233946
|
-
async function deleteSingleFunction(name2) {
|
|
233947
|
-
const appClient = getAppClient();
|
|
233948
|
-
try {
|
|
233949
|
-
await appClient.delete(`backend-functions/${encodeURIComponent(name2)}`, { timeout: 60000 });
|
|
233950
|
-
} catch (error48) {
|
|
233951
|
-
throw await ApiError.fromHttpError(error48, `deleting function "${name2}"`);
|
|
233952
|
-
}
|
|
233967
|
+
function toDeployPayloadItem(fn) {
|
|
233968
|
+
return {
|
|
233969
|
+
name: fn.name,
|
|
233970
|
+
entry: fn.entry,
|
|
233971
|
+
files: fn.files,
|
|
233972
|
+
automations: fn.automations
|
|
233973
|
+
};
|
|
233953
233974
|
}
|
|
233954
|
-
async function
|
|
233975
|
+
async function deployFunctions(functions) {
|
|
233955
233976
|
const appClient = getAppClient();
|
|
233977
|
+
const payload = {
|
|
233978
|
+
functions: functions.map(toDeployPayloadItem)
|
|
233979
|
+
};
|
|
233956
233980
|
let response;
|
|
233957
233981
|
try {
|
|
233958
|
-
response = await appClient.
|
|
233982
|
+
response = await appClient.put("backend-functions", {
|
|
233983
|
+
json: payload,
|
|
233984
|
+
timeout: false
|
|
233985
|
+
});
|
|
233959
233986
|
} catch (error48) {
|
|
233960
|
-
throw await ApiError.fromHttpError(error48, "
|
|
233987
|
+
throw await ApiError.fromHttpError(error48, "deploying functions");
|
|
233961
233988
|
}
|
|
233962
|
-
const result =
|
|
233989
|
+
const result = DeployFunctionsResponseSchema.safeParse(await response.json());
|
|
233963
233990
|
if (!result.success) {
|
|
233964
233991
|
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
233965
233992
|
}
|
|
@@ -234082,131 +234109,24 @@ async function readAllFunctions(functionsDir) {
|
|
|
234082
234109
|
import { dirname as dirname5, relative as relative2 } from "node:path";
|
|
234083
234110
|
async function loadFunctionCode(fn) {
|
|
234084
234111
|
const functionDir = dirname5(fn.entryPath);
|
|
234085
|
-
const
|
|
234112
|
+
const loadedFiles = await Promise.all(fn.filePaths.map(async (filePath) => {
|
|
234086
234113
|
const content = await readTextFile(filePath);
|
|
234087
234114
|
const path11 = relative2(functionDir, filePath).split(/[/\\]/).join("/");
|
|
234088
234115
|
return { path: path11, content };
|
|
234089
234116
|
}));
|
|
234090
|
-
return { ...fn, files:
|
|
234117
|
+
return { ...fn, files: loadedFiles };
|
|
234091
234118
|
}
|
|
234092
|
-
async function
|
|
234093
|
-
|
|
234094
|
-
|
|
234095
|
-
const functionWithCode = await loadFunctionCode(fn);
|
|
234096
|
-
const response = await deploySingleFunction(functionWithCode.name, {
|
|
234097
|
-
entry: functionWithCode.entry,
|
|
234098
|
-
files: functionWithCode.files,
|
|
234099
|
-
automations: functionWithCode.automations
|
|
234100
|
-
});
|
|
234101
|
-
return {
|
|
234102
|
-
name: functionWithCode.name,
|
|
234103
|
-
status: response.status,
|
|
234104
|
-
durationMs: Date.now() - start
|
|
234105
|
-
};
|
|
234106
|
-
} catch (error48) {
|
|
234107
|
-
return {
|
|
234108
|
-
name: fn.name,
|
|
234109
|
-
status: "error",
|
|
234110
|
-
error: error48 instanceof Error ? error48.message : String(error48)
|
|
234111
|
-
};
|
|
234112
|
-
}
|
|
234113
|
-
}
|
|
234114
|
-
async function deployFunctionsSequentially(functions, options) {
|
|
234115
|
-
if (functions.length === 0)
|
|
234116
|
-
return [];
|
|
234117
|
-
const results = [];
|
|
234118
|
-
for (const fn of functions) {
|
|
234119
|
-
options?.onStart?.([fn.name]);
|
|
234120
|
-
const result = await deployOne(fn);
|
|
234121
|
-
results.push(result);
|
|
234122
|
-
options?.onResult?.(result);
|
|
234123
|
-
}
|
|
234124
|
-
return results;
|
|
234125
|
-
}
|
|
234126
|
-
async function pruneRemovedFunctions(localFunctionNames) {
|
|
234127
|
-
const remote = await listDeployedFunctions();
|
|
234128
|
-
const localSet = new Set(localFunctionNames);
|
|
234129
|
-
const toDelete = remote.functions.filter((f) => !localSet.has(f.name));
|
|
234130
|
-
const results = [];
|
|
234131
|
-
for (const fn of toDelete) {
|
|
234132
|
-
try {
|
|
234133
|
-
await deleteSingleFunction(fn.name);
|
|
234134
|
-
results.push({ name: fn.name, deleted: true });
|
|
234135
|
-
} catch (error48) {
|
|
234136
|
-
results.push({
|
|
234137
|
-
name: fn.name,
|
|
234138
|
-
deleted: false,
|
|
234139
|
-
error: error48 instanceof Error ? error48.message : String(error48)
|
|
234140
|
-
});
|
|
234141
|
-
}
|
|
234142
|
-
}
|
|
234143
|
-
return results;
|
|
234144
|
-
}
|
|
234145
|
-
// src/core/resources/function/pull.ts
|
|
234146
|
-
import { join as join6 } from "node:path";
|
|
234147
|
-
async function writeFunctions(functionsDir, functions) {
|
|
234148
|
-
const written = [];
|
|
234149
|
-
const skipped = [];
|
|
234150
|
-
for (const fn of functions) {
|
|
234151
|
-
const functionDir = join6(functionsDir, fn.name);
|
|
234152
|
-
const configPath = join6(functionDir, "function.jsonc");
|
|
234153
|
-
if (await isFunctionUnchanged(functionDir, fn)) {
|
|
234154
|
-
skipped.push(fn.name);
|
|
234155
|
-
continue;
|
|
234156
|
-
}
|
|
234157
|
-
const config5 = {
|
|
234158
|
-
name: fn.name,
|
|
234159
|
-
entry: fn.entry
|
|
234160
|
-
};
|
|
234161
|
-
if (fn.automations.length > 0) {
|
|
234162
|
-
config5.automations = fn.automations;
|
|
234163
|
-
}
|
|
234164
|
-
await writeJsonFile(configPath, config5);
|
|
234165
|
-
for (const file2 of fn.files) {
|
|
234166
|
-
await writeFile(join6(functionDir, file2.path), file2.content);
|
|
234167
|
-
}
|
|
234168
|
-
written.push(fn.name);
|
|
234169
|
-
}
|
|
234170
|
-
return { written, skipped };
|
|
234171
|
-
}
|
|
234172
|
-
async function isFunctionUnchanged(functionDir, fn) {
|
|
234173
|
-
if (!await pathExists(functionDir)) {
|
|
234174
|
-
return false;
|
|
234175
|
-
}
|
|
234176
|
-
const configPath = join6(functionDir, "function.jsonc");
|
|
234177
|
-
try {
|
|
234178
|
-
const localConfig = await readJsonFile(configPath);
|
|
234179
|
-
if (localConfig.entry !== fn.entry) {
|
|
234180
|
-
return false;
|
|
234181
|
-
}
|
|
234182
|
-
const localAuto = JSON.stringify(localConfig.automations ?? []);
|
|
234183
|
-
const remoteAuto = JSON.stringify(fn.automations);
|
|
234184
|
-
if (localAuto !== remoteAuto) {
|
|
234185
|
-
return false;
|
|
234186
|
-
}
|
|
234187
|
-
} catch {
|
|
234188
|
-
return false;
|
|
234189
|
-
}
|
|
234190
|
-
for (const file2 of fn.files) {
|
|
234191
|
-
const filePath = join6(functionDir, file2.path);
|
|
234192
|
-
if (!await pathExists(filePath)) {
|
|
234193
|
-
return false;
|
|
234194
|
-
}
|
|
234195
|
-
try {
|
|
234196
|
-
const localContent = await readTextFile(filePath);
|
|
234197
|
-
if (localContent !== file2.content) {
|
|
234198
|
-
return false;
|
|
234199
|
-
}
|
|
234200
|
-
} catch {
|
|
234201
|
-
return false;
|
|
234202
|
-
}
|
|
234119
|
+
async function pushFunctions(functions) {
|
|
234120
|
+
if (functions.length === 0) {
|
|
234121
|
+
return { deployed: [], deleted: [], skipped: [], errors: null };
|
|
234203
234122
|
}
|
|
234204
|
-
|
|
234123
|
+
const functionsWithCode = await Promise.all(functions.map(loadFunctionCode));
|
|
234124
|
+
return deployFunctions(functionsWithCode);
|
|
234205
234125
|
}
|
|
234206
234126
|
// src/core/resources/function/resource.ts
|
|
234207
234127
|
var functionResource = {
|
|
234208
234128
|
readAll: readAllFunctions,
|
|
234209
|
-
push:
|
|
234129
|
+
push: pushFunctions
|
|
234210
234130
|
};
|
|
234211
234131
|
// src/core/project/config.ts
|
|
234212
234132
|
async function findConfigInDir(dir) {
|
|
@@ -234247,10 +234167,10 @@ async function readProjectConfig(projectRoot) {
|
|
|
234247
234167
|
const project = result.data;
|
|
234248
234168
|
const configDir = dirname6(configPath);
|
|
234249
234169
|
const [entities, functions, agents, connectors] = await Promise.all([
|
|
234250
|
-
entityResource.readAll(
|
|
234251
|
-
functionResource.readAll(
|
|
234252
|
-
agentResource.readAll(
|
|
234253
|
-
connectorResource.readAll(
|
|
234170
|
+
entityResource.readAll(join6(configDir, project.entitiesDir)),
|
|
234171
|
+
functionResource.readAll(join6(configDir, project.functionsDir)),
|
|
234172
|
+
agentResource.readAll(join6(configDir, project.agentsDir)),
|
|
234173
|
+
connectorResource.readAll(join6(configDir, project.connectorsDir))
|
|
234254
234174
|
]);
|
|
234255
234175
|
return {
|
|
234256
234176
|
project: { ...project, root, configPath },
|
|
@@ -234347,7 +234267,7 @@ async function readAppConfig(projectRoot) {
|
|
|
234347
234267
|
// src/core/project/template.ts
|
|
234348
234268
|
var import_ejs = __toESM(require_ejs(), 1);
|
|
234349
234269
|
var import_front_matter = __toESM(require_front_matter(), 1);
|
|
234350
|
-
import { dirname as dirname7, join as
|
|
234270
|
+
import { dirname as dirname7, join as join7 } from "node:path";
|
|
234351
234271
|
async function listTemplates() {
|
|
234352
234272
|
const parsed = await readJsonFile(getTemplatesIndexPath());
|
|
234353
234273
|
const result = TemplatesConfigSchema.safeParse(parsed);
|
|
@@ -234357,23 +234277,23 @@ async function listTemplates() {
|
|
|
234357
234277
|
return result.data.templates;
|
|
234358
234278
|
}
|
|
234359
234279
|
async function renderTemplate(template, destPath, data) {
|
|
234360
|
-
const templateDir =
|
|
234280
|
+
const templateDir = join7(getTemplatesDir(), template.path);
|
|
234361
234281
|
const files = await globby("**/*", {
|
|
234362
234282
|
cwd: templateDir,
|
|
234363
234283
|
dot: true,
|
|
234364
234284
|
onlyFiles: true
|
|
234365
234285
|
});
|
|
234366
234286
|
for (const file2 of files) {
|
|
234367
|
-
const srcPath =
|
|
234287
|
+
const srcPath = join7(templateDir, file2);
|
|
234368
234288
|
try {
|
|
234369
234289
|
if (file2.endsWith(".ejs")) {
|
|
234370
234290
|
const rendered = await import_ejs.default.renderFile(srcPath, data);
|
|
234371
234291
|
const { attributes, body } = import_front_matter.default(rendered);
|
|
234372
|
-
const destFile = attributes.outputFileName ?
|
|
234373
|
-
const destFilePath =
|
|
234292
|
+
const destFile = attributes.outputFileName ? join7(dirname7(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
|
|
234293
|
+
const destFilePath = join7(destPath, destFile);
|
|
234374
234294
|
await writeFile(destFilePath, body);
|
|
234375
234295
|
} else {
|
|
234376
|
-
const destFilePath =
|
|
234296
|
+
const destFilePath = join7(destPath, file2);
|
|
234377
234297
|
await copyFile(srcPath, destFilePath);
|
|
234378
234298
|
}
|
|
234379
234299
|
} catch (error48) {
|
|
@@ -234476,7 +234396,7 @@ async function getSiteFilePaths(outputDir) {
|
|
|
234476
234396
|
// src/core/site/deploy.ts
|
|
234477
234397
|
import { randomUUID } from "node:crypto";
|
|
234478
234398
|
import { tmpdir } from "node:os";
|
|
234479
|
-
import { join as
|
|
234399
|
+
import { join as join8 } from "node:path";
|
|
234480
234400
|
async function deploySite(siteOutputDir) {
|
|
234481
234401
|
if (!await pathExists(siteOutputDir)) {
|
|
234482
234402
|
throw new InvalidInputError(`Output directory does not exist: ${siteOutputDir}. Make sure to build your project first.`, {
|
|
@@ -234493,7 +234413,7 @@ async function deploySite(siteOutputDir) {
|
|
|
234493
234413
|
]
|
|
234494
234414
|
});
|
|
234495
234415
|
}
|
|
234496
|
-
const archivePath =
|
|
234416
|
+
const archivePath = join8(tmpdir(), `base44-site-${randomUUID()}.tar.gz`);
|
|
234497
234417
|
try {
|
|
234498
234418
|
await createArchive(siteOutputDir, archivePath);
|
|
234499
234419
|
return await uploadSite(archivePath);
|
|
@@ -234518,13 +234438,10 @@ function hasResourcesToDeploy(projectData) {
|
|
|
234518
234438
|
const hasConnectors = connectors.length > 0;
|
|
234519
234439
|
return hasEntities || hasFunctions || hasAgents || hasConnectors || hasSite;
|
|
234520
234440
|
}
|
|
234521
|
-
async function deployAll(projectData
|
|
234441
|
+
async function deployAll(projectData) {
|
|
234522
234442
|
const { project, entities, functions, agents, connectors } = projectData;
|
|
234523
234443
|
await entityResource.push(entities);
|
|
234524
|
-
await
|
|
234525
|
-
onStart: options?.onFunctionStart,
|
|
234526
|
-
onResult: options?.onFunctionResult
|
|
234527
|
-
});
|
|
234444
|
+
await functionResource.push(functions);
|
|
234528
234445
|
await agentResource.push(agents);
|
|
234529
234446
|
const { results: connectorResults } = await pushConnectors(connectors);
|
|
234530
234447
|
if (project.site?.outputDirectory) {
|
|
@@ -234742,7 +234659,8 @@ async function deleteSecret(name2) {
|
|
|
234742
234659
|
let response;
|
|
234743
234660
|
try {
|
|
234744
234661
|
response = await appClient.delete("secrets", {
|
|
234745
|
-
searchParams: { secret_name: name2 }
|
|
234662
|
+
searchParams: { secret_name: name2 },
|
|
234663
|
+
timeout: false
|
|
234746
234664
|
});
|
|
234747
234665
|
} catch (error48) {
|
|
234748
234666
|
throw await ApiError.fromHttpError(error48, "deleting secret");
|
|
@@ -242258,7 +242176,7 @@ function getDashboardUrl(projectId) {
|
|
|
242258
242176
|
async function pullAgentsAction() {
|
|
242259
242177
|
const { project: project2 } = await readProjectConfig();
|
|
242260
242178
|
const configDir = dirname8(project2.configPath);
|
|
242261
|
-
const agentsDir =
|
|
242179
|
+
const agentsDir = join9(configDir, project2.agentsDir);
|
|
242262
242180
|
const remoteAgents = await runTask("Fetching agents from Base44", async () => {
|
|
242263
242181
|
return await fetchAgents();
|
|
242264
242182
|
}, {
|
|
@@ -242351,12 +242269,35 @@ function getWhoamiCommand(context) {
|
|
|
242351
242269
|
});
|
|
242352
242270
|
}
|
|
242353
242271
|
|
|
242272
|
+
// src/cli/commands/connectors/list-available.ts
|
|
242273
|
+
async function listAvailableAction() {
|
|
242274
|
+
const { integrations } = await runTask("Fetching available integrations from Base44", async () => {
|
|
242275
|
+
return await listAvailableIntegrations();
|
|
242276
|
+
}, {
|
|
242277
|
+
successMessage: "Available integrations fetched successfully",
|
|
242278
|
+
errorMessage: "Failed to fetch available integrations"
|
|
242279
|
+
});
|
|
242280
|
+
if (integrations.length === 0) {
|
|
242281
|
+
return { outroMessage: "No available integrations found." };
|
|
242282
|
+
}
|
|
242283
|
+
return {
|
|
242284
|
+
outroMessage: `Found ${integrations.length} available integrations.`,
|
|
242285
|
+
stdout: `${JSON.stringify(integrations, null, 2)}
|
|
242286
|
+
`
|
|
242287
|
+
};
|
|
242288
|
+
}
|
|
242289
|
+
function getConnectorsListAvailableCommand(context) {
|
|
242290
|
+
return new Command("list-available").description("List all available integration types").action(async () => {
|
|
242291
|
+
await runCommand(listAvailableAction, { requireAuth: true }, context);
|
|
242292
|
+
});
|
|
242293
|
+
}
|
|
242294
|
+
|
|
242354
242295
|
// src/cli/commands/connectors/pull.ts
|
|
242355
|
-
import { dirname as dirname9, join as
|
|
242296
|
+
import { dirname as dirname9, join as join10 } from "node:path";
|
|
242356
242297
|
async function pullConnectorsAction() {
|
|
242357
242298
|
const { project: project2 } = await readProjectConfig();
|
|
242358
242299
|
const configDir = dirname9(project2.configPath);
|
|
242359
|
-
const connectorsDir =
|
|
242300
|
+
const connectorsDir = join10(configDir, project2.connectorsDir);
|
|
242360
242301
|
const remoteConnectors = await runTask("Fetching connectors from Base44", async () => {
|
|
242361
242302
|
return await listConnectors();
|
|
242362
242303
|
}, {
|
|
@@ -243151,7 +243092,7 @@ function getConnectorsPushCommand(context) {
|
|
|
243151
243092
|
|
|
243152
243093
|
// src/cli/commands/connectors/index.ts
|
|
243153
243094
|
function getConnectorsCommand(context) {
|
|
243154
|
-
return new Command("connectors").description("Manage project connectors (OAuth integrations)").addCommand(getConnectorsPullCommand(context)).addCommand(getConnectorsPushCommand(context));
|
|
243095
|
+
return new Command("connectors").description("Manage project connectors (OAuth integrations)").addCommand(getConnectorsListAvailableCommand(context)).addCommand(getConnectorsPullCommand(context)).addCommand(getConnectorsPushCommand(context));
|
|
243155
243096
|
}
|
|
243156
243097
|
|
|
243157
243098
|
// src/cli/commands/dashboard/open.ts
|
|
@@ -243204,225 +243145,46 @@ function getEntitiesPushCommand(context) {
|
|
|
243204
243145
|
}));
|
|
243205
243146
|
}
|
|
243206
243147
|
|
|
243207
|
-
// src/cli/utils/parseNames.ts
|
|
243208
|
-
function parseNames(args) {
|
|
243209
|
-
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
243210
|
-
}
|
|
243211
|
-
|
|
243212
|
-
// src/cli/commands/functions/delete.ts
|
|
243213
|
-
async function deleteFunctionsAction(names) {
|
|
243214
|
-
let deleted = 0;
|
|
243215
|
-
let notFound = 0;
|
|
243216
|
-
let errors4 = 0;
|
|
243217
|
-
let completed = 0;
|
|
243218
|
-
const total = names.length;
|
|
243219
|
-
for (const name2 of names) {
|
|
243220
|
-
R2.step(theme.styles.dim(`[${completed + 1}/${total}] Deleting ${name2}...`));
|
|
243221
|
-
try {
|
|
243222
|
-
await deleteSingleFunction(name2);
|
|
243223
|
-
R2.success(`${name2.padEnd(25)} deleted`);
|
|
243224
|
-
deleted++;
|
|
243225
|
-
} catch (error48) {
|
|
243226
|
-
if (error48 instanceof ApiError && error48.statusCode === 404) {
|
|
243227
|
-
R2.warn(`${name2.padEnd(25)} not found`);
|
|
243228
|
-
notFound++;
|
|
243229
|
-
} else {
|
|
243230
|
-
R2.error(`${name2.padEnd(25)} error: ${error48 instanceof Error ? error48.message : String(error48)}`);
|
|
243231
|
-
errors4++;
|
|
243232
|
-
}
|
|
243233
|
-
}
|
|
243234
|
-
completed++;
|
|
243235
|
-
}
|
|
243236
|
-
if (names.length === 1) {
|
|
243237
|
-
if (deleted)
|
|
243238
|
-
return { outroMessage: `Function "${names[0]}" deleted` };
|
|
243239
|
-
if (notFound)
|
|
243240
|
-
return { outroMessage: `Function "${names[0]}" not found` };
|
|
243241
|
-
return { outroMessage: `Failed to delete "${names[0]}"` };
|
|
243242
|
-
}
|
|
243243
|
-
const parts = [];
|
|
243244
|
-
if (deleted > 0)
|
|
243245
|
-
parts.push(`${deleted}/${total} deleted`);
|
|
243246
|
-
if (notFound > 0)
|
|
243247
|
-
parts.push(`${notFound} not found`);
|
|
243248
|
-
if (errors4 > 0)
|
|
243249
|
-
parts.push(`${errors4} error${errors4 !== 1 ? "s" : ""}`);
|
|
243250
|
-
return { outroMessage: parts.join(", ") };
|
|
243251
|
-
}
|
|
243252
|
-
function getDeleteCommand(context) {
|
|
243253
|
-
return new Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").action(async (rawNames) => {
|
|
243254
|
-
await runCommand(() => {
|
|
243255
|
-
const names = parseNames(rawNames);
|
|
243256
|
-
if (names.length === 0) {
|
|
243257
|
-
throw new InvalidInputError("At least one function name is required");
|
|
243258
|
-
}
|
|
243259
|
-
return deleteFunctionsAction(names);
|
|
243260
|
-
}, { requireAuth: true }, context);
|
|
243261
|
-
});
|
|
243262
|
-
}
|
|
243263
|
-
|
|
243264
|
-
// src/cli/utils/formatDeployResult.ts
|
|
243265
|
-
function formatDuration(ms) {
|
|
243266
|
-
return `${(ms / 1000).toFixed(1)}s`;
|
|
243267
|
-
}
|
|
243268
|
-
function formatDeployResult(result) {
|
|
243269
|
-
const label = result.name.padEnd(25);
|
|
243270
|
-
if (result.status === "deployed") {
|
|
243271
|
-
const timing = result.durationMs ? theme.styles.dim(` (${formatDuration(result.durationMs)})`) : "";
|
|
243272
|
-
R2.success(`${label} deployed${timing}`);
|
|
243273
|
-
} else if (result.status === "unchanged") {
|
|
243274
|
-
R2.success(`${label} unchanged`);
|
|
243275
|
-
} else {
|
|
243276
|
-
R2.error(`${label} error: ${result.error}`);
|
|
243277
|
-
}
|
|
243278
|
-
}
|
|
243279
|
-
|
|
243280
243148
|
// src/cli/commands/functions/deploy.ts
|
|
243281
|
-
function
|
|
243282
|
-
if (names.length === 0)
|
|
243283
|
-
return allFunctions;
|
|
243284
|
-
const notFound = names.filter((n2) => !allFunctions.some((f) => f.name === n2));
|
|
243285
|
-
if (notFound.length > 0) {
|
|
243286
|
-
throw new InvalidInputError(`Function${notFound.length > 1 ? "s" : ""} not found in project: ${notFound.join(", ")}`);
|
|
243287
|
-
}
|
|
243288
|
-
return allFunctions.filter((f) => names.includes(f.name));
|
|
243289
|
-
}
|
|
243290
|
-
function formatPruneResults(pruneResults) {
|
|
243291
|
-
for (const pruneResult of pruneResults) {
|
|
243292
|
-
if (pruneResult.deleted) {
|
|
243293
|
-
R2.success(`${pruneResult.name.padEnd(25)} deleted`);
|
|
243294
|
-
} else {
|
|
243295
|
-
R2.error(`${pruneResult.name.padEnd(25)} error: ${pruneResult.error}`);
|
|
243296
|
-
}
|
|
243297
|
-
}
|
|
243298
|
-
if (pruneResults.length > 0) {
|
|
243299
|
-
const pruned = pruneResults.filter((r) => r.deleted).length;
|
|
243300
|
-
R2.info(`${pruned} function${pruned !== 1 ? "s" : ""} removed`);
|
|
243301
|
-
}
|
|
243302
|
-
}
|
|
243303
|
-
function buildDeploySummary(results) {
|
|
243304
|
-
const deployed = results.filter((r) => r.status !== "error").length;
|
|
243305
|
-
const failed = results.filter((r) => r.status === "error").length;
|
|
243306
|
-
const parts = [];
|
|
243307
|
-
if (deployed > 0)
|
|
243308
|
-
parts.push(`${deployed}/${results.length} deployed`);
|
|
243309
|
-
if (failed > 0)
|
|
243310
|
-
parts.push(`${failed} error${failed !== 1 ? "s" : ""}`);
|
|
243311
|
-
return parts.join(", ") || "No functions deployed";
|
|
243312
|
-
}
|
|
243313
|
-
async function deployFunctionsAction(names, options) {
|
|
243314
|
-
if (options.force && names.length > 0) {
|
|
243315
|
-
throw new InvalidInputError("--force cannot be used when specifying function names");
|
|
243316
|
-
}
|
|
243149
|
+
async function deployFunctionsAction() {
|
|
243317
243150
|
const { functions } = await readProjectConfig();
|
|
243318
|
-
|
|
243319
|
-
if (toDeploy.length === 0) {
|
|
243151
|
+
if (functions.length === 0) {
|
|
243320
243152
|
return {
|
|
243321
243153
|
outroMessage: "No functions found. Create functions in the 'functions' directory."
|
|
243322
243154
|
};
|
|
243323
243155
|
}
|
|
243324
|
-
R2.info(`Found ${
|
|
243325
|
-
|
|
243326
|
-
|
|
243327
|
-
const results = await deployFunctionsSequentially(toDeploy, {
|
|
243328
|
-
onStart: (startNames) => {
|
|
243329
|
-
const label = startNames.length === 1 ? startNames[0] : `${startNames.length} functions`;
|
|
243330
|
-
R2.step(theme.styles.dim(`[${completed + 1}/${total}] Deploying ${label}...`));
|
|
243331
|
-
},
|
|
243332
|
-
onResult: (result) => {
|
|
243333
|
-
completed++;
|
|
243334
|
-
formatDeployResult(result);
|
|
243335
|
-
}
|
|
243336
|
-
});
|
|
243337
|
-
if (options.force) {
|
|
243338
|
-
R2.info("Removing remote functions not found locally...");
|
|
243339
|
-
const allLocalNames = functions.map((f) => f.name);
|
|
243340
|
-
const pruneResults = await pruneRemovedFunctions(allLocalNames);
|
|
243341
|
-
formatPruneResults(pruneResults);
|
|
243342
|
-
}
|
|
243343
|
-
return { outroMessage: buildDeploySummary(results) };
|
|
243344
|
-
}
|
|
243345
|
-
function getDeployCommand(context) {
|
|
243346
|
-
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) => {
|
|
243347
|
-
await runCommand(() => {
|
|
243348
|
-
const names = parseNames(rawNames);
|
|
243349
|
-
return deployFunctionsAction(names, options);
|
|
243350
|
-
}, { requireAuth: true }, context);
|
|
243351
|
-
});
|
|
243352
|
-
}
|
|
243353
|
-
|
|
243354
|
-
// src/cli/commands/functions/list.ts
|
|
243355
|
-
async function listFunctionsAction() {
|
|
243356
|
-
const { functions } = await listDeployedFunctions();
|
|
243357
|
-
if (functions.length === 0) {
|
|
243358
|
-
return { outroMessage: "No functions on remote" };
|
|
243359
|
-
}
|
|
243360
|
-
for (const fn of functions) {
|
|
243361
|
-
const autoCount = fn.automations.length;
|
|
243362
|
-
const autoLabel = autoCount > 0 ? theme.styles.dim(` (${autoCount} automation${autoCount > 1 ? "s" : ""})`) : "";
|
|
243363
|
-
R2.message(` ${fn.name}${autoLabel}`);
|
|
243364
|
-
}
|
|
243365
|
-
return {
|
|
243366
|
-
outroMessage: `${functions.length} function${functions.length !== 1 ? "s" : ""} on remote`
|
|
243367
|
-
};
|
|
243368
|
-
}
|
|
243369
|
-
function getListCommand(context) {
|
|
243370
|
-
return new Command("list").description("List all deployed functions").action(async () => {
|
|
243371
|
-
await runCommand(listFunctionsAction, { requireAuth: true }, context);
|
|
243372
|
-
});
|
|
243373
|
-
}
|
|
243374
|
-
|
|
243375
|
-
// src/cli/commands/functions/pull.ts
|
|
243376
|
-
import { dirname as dirname10, join as join12 } from "node:path";
|
|
243377
|
-
async function pullFunctionsAction(name2) {
|
|
243378
|
-
const { project: project2 } = await readProjectConfig();
|
|
243379
|
-
const configDir = dirname10(project2.configPath);
|
|
243380
|
-
const functionsDir = join12(configDir, project2.functionsDir);
|
|
243381
|
-
const remoteFunctions = await runTask("Fetching functions from Base44", async () => {
|
|
243382
|
-
const { functions } = await listDeployedFunctions();
|
|
243383
|
-
return functions;
|
|
243156
|
+
R2.info(`Found ${functions.length} ${functions.length === 1 ? "function" : "functions"} to deploy`);
|
|
243157
|
+
const result = await runTask("Deploying functions to Base44", async () => {
|
|
243158
|
+
return await pushFunctions(functions);
|
|
243384
243159
|
}, {
|
|
243385
|
-
successMessage: "Functions
|
|
243386
|
-
errorMessage: "Failed to
|
|
243160
|
+
successMessage: "Functions deployed successfully",
|
|
243161
|
+
errorMessage: "Failed to deploy functions"
|
|
243387
243162
|
});
|
|
243388
|
-
|
|
243389
|
-
|
|
243390
|
-
return {
|
|
243391
|
-
outroMessage: `Function "${name2}" not found on remote`
|
|
243392
|
-
};
|
|
243393
|
-
}
|
|
243394
|
-
if (toPull.length === 0) {
|
|
243395
|
-
return { outroMessage: "No functions found on remote" };
|
|
243163
|
+
if (result.deployed.length > 0) {
|
|
243164
|
+
R2.success(`Deployed: ${result.deployed.join(", ")}`);
|
|
243396
243165
|
}
|
|
243397
|
-
|
|
243398
|
-
|
|
243399
|
-
}, {
|
|
243400
|
-
successMessage: "Function files written successfully",
|
|
243401
|
-
errorMessage: "Failed to write function files"
|
|
243402
|
-
});
|
|
243403
|
-
for (const name3 of written) {
|
|
243404
|
-
R2.success(`${name3.padEnd(25)} written`);
|
|
243166
|
+
if (result.deleted.length > 0) {
|
|
243167
|
+
R2.warn(`Deleted: ${result.deleted.join(", ")}`);
|
|
243405
243168
|
}
|
|
243406
|
-
|
|
243407
|
-
|
|
243169
|
+
if (result.errors && result.errors.length > 0) {
|
|
243170
|
+
throw new ApiError("Function deployment errors", {
|
|
243171
|
+
details: result.errors.map((e2) => `'${e2.name}': ${e2.message}`),
|
|
243172
|
+
hints: [
|
|
243173
|
+
{ message: "Check the function code for syntax errors" },
|
|
243174
|
+
{ message: "Ensure all imports are valid" }
|
|
243175
|
+
]
|
|
243176
|
+
});
|
|
243408
243177
|
}
|
|
243409
|
-
return {
|
|
243410
|
-
outroMessage: `Pulled ${toPull.length} function${toPull.length !== 1 ? "s" : ""} to ${functionsDir}`
|
|
243411
|
-
};
|
|
243412
|
-
}
|
|
243413
|
-
function getPullCommand(context) {
|
|
243414
|
-
return new Command("pull").description("Pull deployed functions from Base44").argument("[name]", "Pull a single function by name").action(async (name2) => {
|
|
243415
|
-
await runCommand(() => pullFunctionsAction(name2), { requireAuth: true }, context);
|
|
243416
|
-
});
|
|
243178
|
+
return { outroMessage: "Functions deployed to Base44" };
|
|
243417
243179
|
}
|
|
243418
|
-
|
|
243419
|
-
|
|
243420
|
-
|
|
243421
|
-
|
|
243180
|
+
function getFunctionsDeployCommand(context) {
|
|
243181
|
+
return new Command("functions").description("Manage project functions").addCommand(new Command("deploy").description("Deploy local functions to Base44").action(async () => {
|
|
243182
|
+
await runCommand(deployFunctionsAction, { requireAuth: true }, context);
|
|
243183
|
+
}));
|
|
243422
243184
|
}
|
|
243423
243185
|
|
|
243424
243186
|
// src/cli/commands/project/create.ts
|
|
243425
|
-
import { basename as basename3, join as
|
|
243187
|
+
import { basename as basename3, join as join11, resolve as resolve2 } from "node:path";
|
|
243426
243188
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
243427
243189
|
var DEFAULT_TEMPLATE_ID = "backend-only";
|
|
243428
243190
|
async function getTemplateById(templateId) {
|
|
@@ -243558,7 +243320,7 @@ async function executeCreate({
|
|
|
243558
243320
|
updateMessage("Building project...");
|
|
243559
243321
|
await execa({ cwd: resolvedPath, shell: true })`${buildCommand}`;
|
|
243560
243322
|
updateMessage("Deploying site...");
|
|
243561
|
-
return await deploySite(
|
|
243323
|
+
return await deploySite(join11(resolvedPath, outputDirectory));
|
|
243562
243324
|
}, {
|
|
243563
243325
|
successMessage: theme.colors.base44Orange("Site deployed successfully"),
|
|
243564
243326
|
errorMessage: "Failed to deploy site"
|
|
@@ -243638,17 +243400,11 @@ ${summaryLines.join(`
|
|
|
243638
243400
|
${summaryLines.join(`
|
|
243639
243401
|
`)}`);
|
|
243640
243402
|
}
|
|
243641
|
-
|
|
243642
|
-
|
|
243643
|
-
|
|
243644
|
-
|
|
243645
|
-
|
|
243646
|
-
R2.step(theme.styles.dim(`[${functionCompleted + 1}/${functionTotal}] Deploying ${label}...`));
|
|
243647
|
-
},
|
|
243648
|
-
onFunctionResult: (r) => {
|
|
243649
|
-
functionCompleted++;
|
|
243650
|
-
formatDeployResult(r);
|
|
243651
|
-
}
|
|
243403
|
+
const result = await runTask("Deploying your app...", async () => {
|
|
243404
|
+
return await deployAll(projectData);
|
|
243405
|
+
}, {
|
|
243406
|
+
successMessage: theme.colors.base44Orange("Deployment completed"),
|
|
243407
|
+
errorMessage: "Deployment failed"
|
|
243652
243408
|
});
|
|
243653
243409
|
const needsOAuth = filterPendingOAuth(result.connectorResults ?? []);
|
|
243654
243410
|
if (needsOAuth.length > 0) {
|
|
@@ -243666,7 +243422,7 @@ ${summaryLines.join(`
|
|
|
243666
243422
|
}
|
|
243667
243423
|
return { outroMessage: "App deployed successfully" };
|
|
243668
243424
|
}
|
|
243669
|
-
function
|
|
243425
|
+
function getDeployCommand(context) {
|
|
243670
243426
|
return new Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").action(async (options) => {
|
|
243671
243427
|
await runCommand(() => deployAction({
|
|
243672
243428
|
...options,
|
|
@@ -244190,10 +243946,10 @@ function toPascalCase(name2) {
|
|
|
244190
243946
|
return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
|
|
244191
243947
|
}
|
|
244192
243948
|
// src/core/types/update-project.ts
|
|
244193
|
-
import { join as
|
|
243949
|
+
import { join as join14 } from "node:path";
|
|
244194
243950
|
var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
|
|
244195
243951
|
async function updateProjectConfig(projectRoot) {
|
|
244196
|
-
const tsconfigPath =
|
|
243952
|
+
const tsconfigPath = join14(projectRoot, "tsconfig.json");
|
|
244197
243953
|
if (!await pathExists(tsconfigPath)) {
|
|
244198
243954
|
return false;
|
|
244199
243955
|
}
|
|
@@ -244236,7 +243992,7 @@ function getTypesCommand(context) {
|
|
|
244236
243992
|
}
|
|
244237
243993
|
|
|
244238
243994
|
// src/cli/dev/dev-server/main.ts
|
|
244239
|
-
import { dirname as
|
|
243995
|
+
import { dirname as dirname15, join as join18 } from "node:path";
|
|
244240
243996
|
var import_cors = __toESM(require_lib4(), 1);
|
|
244241
243997
|
var import_express4 = __toESM(require_express(), 1);
|
|
244242
243998
|
|
|
@@ -244395,10 +244151,10 @@ function createDevLogger() {
|
|
|
244395
244151
|
|
|
244396
244152
|
// src/cli/dev/dev-server/function-manager.ts
|
|
244397
244153
|
import { spawn as spawn2, spawnSync as spawnSync2 } from "node:child_process";
|
|
244398
|
-
import { dirname as
|
|
244154
|
+
import { dirname as dirname12, join as join15 } from "node:path";
|
|
244399
244155
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
244400
|
-
var __dirname5 =
|
|
244401
|
-
var WRAPPER_PATH =
|
|
244156
|
+
var __dirname5 = dirname12(fileURLToPath7(import.meta.url));
|
|
244157
|
+
var WRAPPER_PATH = join15(__dirname5, "../deno-runtime/main.js");
|
|
244402
244158
|
var READY_TIMEOUT = 30000;
|
|
244403
244159
|
|
|
244404
244160
|
class FunctionManager {
|
|
@@ -245702,9 +245458,9 @@ class NodeFsHandler {
|
|
|
245702
245458
|
if (this.fsw.closed) {
|
|
245703
245459
|
return;
|
|
245704
245460
|
}
|
|
245705
|
-
const
|
|
245461
|
+
const dirname14 = sp2.dirname(file2);
|
|
245706
245462
|
const basename5 = sp2.basename(file2);
|
|
245707
|
-
const parent = this.fsw._getWatchedDir(
|
|
245463
|
+
const parent = this.fsw._getWatchedDir(dirname14);
|
|
245708
245464
|
let prevStats = stats;
|
|
245709
245465
|
if (parent.has(basename5))
|
|
245710
245466
|
return;
|
|
@@ -245731,7 +245487,7 @@ class NodeFsHandler {
|
|
|
245731
245487
|
prevStats = newStats2;
|
|
245732
245488
|
}
|
|
245733
245489
|
} catch (error48) {
|
|
245734
|
-
this.fsw._remove(
|
|
245490
|
+
this.fsw._remove(dirname14, basename5);
|
|
245735
245491
|
}
|
|
245736
245492
|
} else if (parent.has(basename5)) {
|
|
245737
245493
|
const at13 = newStats.atimeMs;
|
|
@@ -246734,8 +246490,8 @@ async function createDevServer(options8) {
|
|
|
246734
246490
|
broadcastEntityEvent(io6, appId, entityName, event);
|
|
246735
246491
|
};
|
|
246736
246492
|
const base44ConfigWatcher = new WatchBase44({
|
|
246737
|
-
functions:
|
|
246738
|
-
entities:
|
|
246493
|
+
functions: join18(dirname15(project2.configPath), project2.functionsDir),
|
|
246494
|
+
entities: join18(dirname15(project2.configPath), project2.entitiesDir)
|
|
246739
246495
|
}, devLogger);
|
|
246740
246496
|
base44ConfigWatcher.on("change", async (name2) => {
|
|
246741
246497
|
try {
|
|
@@ -246904,13 +246660,13 @@ function createProgram(context) {
|
|
|
246904
246660
|
program2.addCommand(getLogoutCommand(context));
|
|
246905
246661
|
program2.addCommand(getCreateCommand(context));
|
|
246906
246662
|
program2.addCommand(getDashboardCommand(context));
|
|
246907
|
-
program2.addCommand(
|
|
246663
|
+
program2.addCommand(getDeployCommand(context));
|
|
246908
246664
|
program2.addCommand(getLinkCommand(context));
|
|
246909
246665
|
program2.addCommand(getEjectCommand(context));
|
|
246910
246666
|
program2.addCommand(getEntitiesPushCommand(context));
|
|
246911
246667
|
program2.addCommand(getAgentsCommand(context));
|
|
246912
246668
|
program2.addCommand(getConnectorsCommand(context));
|
|
246913
|
-
program2.addCommand(
|
|
246669
|
+
program2.addCommand(getFunctionsDeployCommand(context));
|
|
246914
246670
|
program2.addCommand(getSecretsCommand(context));
|
|
246915
246671
|
program2.addCommand(getSiteCommand(context));
|
|
246916
246672
|
program2.addCommand(getTypesCommand(context));
|
|
@@ -246924,7 +246680,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
|
|
|
246924
246680
|
import { release, type } from "node:os";
|
|
246925
246681
|
|
|
246926
246682
|
// node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
246927
|
-
import { dirname as
|
|
246683
|
+
import { dirname as dirname16, posix, sep } from "path";
|
|
246928
246684
|
function createModulerModifier() {
|
|
246929
246685
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
246930
246686
|
return async (frames) => {
|
|
@@ -246933,7 +246689,7 @@ function createModulerModifier() {
|
|
|
246933
246689
|
return frames;
|
|
246934
246690
|
};
|
|
246935
246691
|
}
|
|
246936
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
246692
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname16(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
|
|
246937
246693
|
const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
|
|
246938
246694
|
return (filename) => {
|
|
246939
246695
|
if (!filename)
|
|
@@ -251151,4 +250907,4 @@ export {
|
|
|
251151
250907
|
CLIExitError
|
|
251152
250908
|
};
|
|
251153
250909
|
|
|
251154
|
-
//# debugId=
|
|
250910
|
+
//# debugId=A0D3BBBE64FDF64264756E2164756E21
|