@base44-preview/cli 0.0.38-pr.381.74c3c3d → 0.0.38-pr.382.a4f0192
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 +182 -113
- package/dist/cli/index.js.map +8 -8
- 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 join14(array2, separator) {
|
|
18044
18044
|
return array2 == null ? "" : nativeJoin.call(array2, separator);
|
|
18045
18045
|
}
|
|
18046
18046
|
function last(array2) {
|
|
@@ -18062,7 +18062,7 @@ var require_lodash = __commonJS((exports, module) => {
|
|
|
18062
18062
|
function nth(array2, n2) {
|
|
18063
18063
|
return array2 && array2.length ? baseNth(array2, toInteger(n2)) : undefined2;
|
|
18064
18064
|
}
|
|
18065
|
-
var
|
|
18065
|
+
var pull2 = baseRest(pullAll);
|
|
18066
18066
|
function pullAll(array2, values2) {
|
|
18067
18067
|
return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2) : array2;
|
|
18068
18068
|
}
|
|
@@ -19827,7 +19827,7 @@ __p += '`;
|
|
|
19827
19827
|
lodash.pickBy = pickBy;
|
|
19828
19828
|
lodash.property = property;
|
|
19829
19829
|
lodash.propertyOf = propertyOf;
|
|
19830
|
-
lodash.pull =
|
|
19830
|
+
lodash.pull = pull2;
|
|
19831
19831
|
lodash.pullAll = pullAll;
|
|
19832
19832
|
lodash.pullAllBy = pullAllBy;
|
|
19833
19833
|
lodash.pullAllWith = pullAllWith;
|
|
@@ -19972,7 +19972,7 @@ __p += '`;
|
|
|
19972
19972
|
lodash.isUndefined = isUndefined;
|
|
19973
19973
|
lodash.isWeakMap = isWeakMap;
|
|
19974
19974
|
lodash.isWeakSet = isWeakSet;
|
|
19975
|
-
lodash.join =
|
|
19975
|
+
lodash.join = join14;
|
|
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" ? join14(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 join14(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: join14,
|
|
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" ? join16(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 join16(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: join16,
|
|
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 dirname13 = path18.dirname;
|
|
156276
156276
|
var basename4 = path18.basename;
|
|
156277
156277
|
var extname2 = path18.extname;
|
|
156278
|
-
var
|
|
156278
|
+
var join17 = 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 = dirname13(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 = join17(dir, file2);
|
|
156341
156341
|
var stat2 = tryStat(path19);
|
|
156342
156342
|
if (stat2 && stat2.isFile()) {
|
|
156343
156343
|
return path19;
|
|
156344
156344
|
}
|
|
156345
|
-
path19 =
|
|
156345
|
+
path19 = join17(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 join17 = 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(join17(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 = join17(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 join18(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 join10 } from "node:path";
|
|
210675
210675
|
|
|
210676
210676
|
// node_modules/@clack/core/dist/index.mjs
|
|
210677
210677
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
@@ -233175,7 +233175,7 @@ var generateGlobTasks = normalizeArguments(generateTasks);
|
|
|
233175
233175
|
var generateGlobTasksSync = normalizeArgumentsSync(generateTasksSync);
|
|
233176
233176
|
|
|
233177
233177
|
// src/core/project/config.ts
|
|
233178
|
-
import { dirname as dirname6, join as
|
|
233178
|
+
import { dirname as dirname6, join as join7 } from "node:path";
|
|
233179
233179
|
|
|
233180
233180
|
// src/core/resources/agent/schema.ts
|
|
233181
233181
|
var EntityOperationSchema = exports_external.enum(["create", "update", "delete", "read"]);
|
|
@@ -233911,6 +233911,21 @@ var DeployFunctionsResponseSchema = exports_external.object({
|
|
|
233911
233911
|
skipped: exports_external.array(exports_external.string()).optional().nullable(),
|
|
233912
233912
|
errors: exports_external.array(exports_external.object({ name: exports_external.string(), message: exports_external.string() })).nullable()
|
|
233913
233913
|
});
|
|
233914
|
+
var FunctionAutomationInfoSchema = exports_external.object({
|
|
233915
|
+
name: exports_external.string(),
|
|
233916
|
+
type: exports_external.string(),
|
|
233917
|
+
is_active: exports_external.boolean()
|
|
233918
|
+
});
|
|
233919
|
+
var FunctionInfoSchema = exports_external.object({
|
|
233920
|
+
name: exports_external.string(),
|
|
233921
|
+
deployment_id: exports_external.string(),
|
|
233922
|
+
entry: exports_external.string(),
|
|
233923
|
+
files: exports_external.array(FunctionFileSchema),
|
|
233924
|
+
automations: exports_external.array(FunctionAutomationInfoSchema)
|
|
233925
|
+
});
|
|
233926
|
+
var ListFunctionsResponseSchema = exports_external.object({
|
|
233927
|
+
functions: exports_external.array(FunctionInfoSchema)
|
|
233928
|
+
});
|
|
233914
233929
|
var LogLevelSchema = exports_external.enum(["info", "warning", "error", "debug"]);
|
|
233915
233930
|
var FunctionLogEntrySchema = exports_external.object({
|
|
233916
233931
|
time: exports_external.string(),
|
|
@@ -233948,13 +233963,19 @@ async function deployFunctions(functions) {
|
|
|
233948
233963
|
}
|
|
233949
233964
|
return result.data;
|
|
233950
233965
|
}
|
|
233951
|
-
async function
|
|
233966
|
+
async function listDeployedFunctions() {
|
|
233952
233967
|
const appClient = getAppClient();
|
|
233968
|
+
let response;
|
|
233953
233969
|
try {
|
|
233954
|
-
await appClient.
|
|
233970
|
+
response = await appClient.get("backend-functions", { timeout: 30000 });
|
|
233955
233971
|
} catch (error48) {
|
|
233956
|
-
throw await ApiError.fromHttpError(error48,
|
|
233972
|
+
throw await ApiError.fromHttpError(error48, "listing deployed functions");
|
|
233957
233973
|
}
|
|
233974
|
+
const result = ListFunctionsResponseSchema.safeParse(await response.json());
|
|
233975
|
+
if (!result.success) {
|
|
233976
|
+
throw new SchemaValidationError("Invalid response from server", result.error);
|
|
233977
|
+
}
|
|
233978
|
+
return result.data;
|
|
233958
233979
|
}
|
|
233959
233980
|
function buildLogsQueryString(filters) {
|
|
233960
233981
|
const params = new URLSearchParams;
|
|
@@ -234087,6 +234108,67 @@ async function pushFunctions(functions) {
|
|
|
234087
234108
|
const functionsWithCode = await Promise.all(functions.map(loadFunctionCode));
|
|
234088
234109
|
return deployFunctions(functionsWithCode);
|
|
234089
234110
|
}
|
|
234111
|
+
// src/core/resources/function/pull.ts
|
|
234112
|
+
import { join as join6 } from "node:path";
|
|
234113
|
+
async function writeFunctions(functionsDir, functions) {
|
|
234114
|
+
const written = [];
|
|
234115
|
+
const skipped = [];
|
|
234116
|
+
for (const fn of functions) {
|
|
234117
|
+
const functionDir = join6(functionsDir, fn.name);
|
|
234118
|
+
const configPath = join6(functionDir, "function.jsonc");
|
|
234119
|
+
if (await isFunctionUnchanged(functionDir, fn)) {
|
|
234120
|
+
skipped.push(fn.name);
|
|
234121
|
+
continue;
|
|
234122
|
+
}
|
|
234123
|
+
const config5 = {
|
|
234124
|
+
name: fn.name,
|
|
234125
|
+
entry: fn.entry
|
|
234126
|
+
};
|
|
234127
|
+
if (fn.automations.length > 0) {
|
|
234128
|
+
config5.automations = fn.automations;
|
|
234129
|
+
}
|
|
234130
|
+
await writeJsonFile(configPath, config5);
|
|
234131
|
+
for (const file2 of fn.files) {
|
|
234132
|
+
await writeFile(join6(functionDir, file2.path), file2.content);
|
|
234133
|
+
}
|
|
234134
|
+
written.push(fn.name);
|
|
234135
|
+
}
|
|
234136
|
+
return { written, skipped };
|
|
234137
|
+
}
|
|
234138
|
+
async function isFunctionUnchanged(functionDir, fn) {
|
|
234139
|
+
if (!await pathExists(functionDir)) {
|
|
234140
|
+
return false;
|
|
234141
|
+
}
|
|
234142
|
+
const configPath = join6(functionDir, "function.jsonc");
|
|
234143
|
+
try {
|
|
234144
|
+
const localConfig = await readJsonFile(configPath);
|
|
234145
|
+
if (localConfig.entry !== fn.entry) {
|
|
234146
|
+
return false;
|
|
234147
|
+
}
|
|
234148
|
+
const localAuto = JSON.stringify(localConfig.automations ?? []);
|
|
234149
|
+
const remoteAuto = JSON.stringify(fn.automations);
|
|
234150
|
+
if (localAuto !== remoteAuto) {
|
|
234151
|
+
return false;
|
|
234152
|
+
}
|
|
234153
|
+
} catch {
|
|
234154
|
+
return false;
|
|
234155
|
+
}
|
|
234156
|
+
for (const file2 of fn.files) {
|
|
234157
|
+
const filePath = join6(functionDir, file2.path);
|
|
234158
|
+
if (!await pathExists(filePath)) {
|
|
234159
|
+
return false;
|
|
234160
|
+
}
|
|
234161
|
+
try {
|
|
234162
|
+
const localContent = await readTextFile(filePath);
|
|
234163
|
+
if (localContent !== file2.content) {
|
|
234164
|
+
return false;
|
|
234165
|
+
}
|
|
234166
|
+
} catch {
|
|
234167
|
+
return false;
|
|
234168
|
+
}
|
|
234169
|
+
}
|
|
234170
|
+
return true;
|
|
234171
|
+
}
|
|
234090
234172
|
// src/core/resources/function/resource.ts
|
|
234091
234173
|
var functionResource = {
|
|
234092
234174
|
readAll: readAllFunctions,
|
|
@@ -234131,10 +234213,10 @@ async function readProjectConfig(projectRoot) {
|
|
|
234131
234213
|
const project = result.data;
|
|
234132
234214
|
const configDir = dirname6(configPath);
|
|
234133
234215
|
const [entities, functions, agents, connectors] = await Promise.all([
|
|
234134
|
-
entityResource.readAll(
|
|
234135
|
-
functionResource.readAll(
|
|
234136
|
-
agentResource.readAll(
|
|
234137
|
-
connectorResource.readAll(
|
|
234216
|
+
entityResource.readAll(join7(configDir, project.entitiesDir)),
|
|
234217
|
+
functionResource.readAll(join7(configDir, project.functionsDir)),
|
|
234218
|
+
agentResource.readAll(join7(configDir, project.agentsDir)),
|
|
234219
|
+
connectorResource.readAll(join7(configDir, project.connectorsDir))
|
|
234138
234220
|
]);
|
|
234139
234221
|
return {
|
|
234140
234222
|
project: { ...project, root, configPath },
|
|
@@ -234231,7 +234313,7 @@ async function readAppConfig(projectRoot) {
|
|
|
234231
234313
|
// src/core/project/template.ts
|
|
234232
234314
|
var import_ejs = __toESM(require_ejs(), 1);
|
|
234233
234315
|
var import_front_matter = __toESM(require_front_matter(), 1);
|
|
234234
|
-
import { dirname as dirname7, join as
|
|
234316
|
+
import { dirname as dirname7, join as join8 } from "node:path";
|
|
234235
234317
|
async function listTemplates() {
|
|
234236
234318
|
const parsed = await readJsonFile(getTemplatesIndexPath());
|
|
234237
234319
|
const result = TemplatesConfigSchema.safeParse(parsed);
|
|
@@ -234241,23 +234323,23 @@ async function listTemplates() {
|
|
|
234241
234323
|
return result.data.templates;
|
|
234242
234324
|
}
|
|
234243
234325
|
async function renderTemplate(template, destPath, data) {
|
|
234244
|
-
const templateDir =
|
|
234326
|
+
const templateDir = join8(getTemplatesDir(), template.path);
|
|
234245
234327
|
const files = await globby("**/*", {
|
|
234246
234328
|
cwd: templateDir,
|
|
234247
234329
|
dot: true,
|
|
234248
234330
|
onlyFiles: true
|
|
234249
234331
|
});
|
|
234250
234332
|
for (const file2 of files) {
|
|
234251
|
-
const srcPath =
|
|
234333
|
+
const srcPath = join8(templateDir, file2);
|
|
234252
234334
|
try {
|
|
234253
234335
|
if (file2.endsWith(".ejs")) {
|
|
234254
234336
|
const rendered = await import_ejs.default.renderFile(srcPath, data);
|
|
234255
234337
|
const { attributes, body } = import_front_matter.default(rendered);
|
|
234256
|
-
const destFile = attributes.outputFileName ?
|
|
234257
|
-
const destFilePath =
|
|
234338
|
+
const destFile = attributes.outputFileName ? join8(dirname7(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
|
|
234339
|
+
const destFilePath = join8(destPath, destFile);
|
|
234258
234340
|
await writeFile(destFilePath, body);
|
|
234259
234341
|
} else {
|
|
234260
|
-
const destFilePath =
|
|
234342
|
+
const destFilePath = join8(destPath, file2);
|
|
234261
234343
|
await copyFile(srcPath, destFilePath);
|
|
234262
234344
|
}
|
|
234263
234345
|
} catch (error48) {
|
|
@@ -234360,7 +234442,7 @@ async function getSiteFilePaths(outputDir) {
|
|
|
234360
234442
|
// src/core/site/deploy.ts
|
|
234361
234443
|
import { randomUUID } from "node:crypto";
|
|
234362
234444
|
import { tmpdir } from "node:os";
|
|
234363
|
-
import { join as
|
|
234445
|
+
import { join as join9 } from "node:path";
|
|
234364
234446
|
async function deploySite(siteOutputDir) {
|
|
234365
234447
|
if (!await pathExists(siteOutputDir)) {
|
|
234366
234448
|
throw new InvalidInputError(`Output directory does not exist: ${siteOutputDir}. Make sure to build your project first.`, {
|
|
@@ -234377,7 +234459,7 @@ async function deploySite(siteOutputDir) {
|
|
|
234377
234459
|
]
|
|
234378
234460
|
});
|
|
234379
234461
|
}
|
|
234380
|
-
const archivePath =
|
|
234462
|
+
const archivePath = join9(tmpdir(), `base44-site-${randomUUID()}.tar.gz`);
|
|
234381
234463
|
try {
|
|
234382
234464
|
await createArchive(siteOutputDir, archivePath);
|
|
234383
234465
|
return await uploadSite(archivePath);
|
|
@@ -242155,7 +242237,7 @@ function getDashboardUrl(projectId) {
|
|
|
242155
242237
|
async function pullAgentsAction() {
|
|
242156
242238
|
const { project: project2 } = await readProjectConfig();
|
|
242157
242239
|
const configDir = dirname8(project2.configPath);
|
|
242158
|
-
const agentsDir =
|
|
242240
|
+
const agentsDir = join10(configDir, project2.agentsDir);
|
|
242159
242241
|
const remoteAgents = await runTask("Fetching agents from Base44", async () => {
|
|
242160
242242
|
return await fetchAgents();
|
|
242161
242243
|
}, {
|
|
@@ -242249,11 +242331,11 @@ function getWhoamiCommand(context) {
|
|
|
242249
242331
|
}
|
|
242250
242332
|
|
|
242251
242333
|
// src/cli/commands/connectors/pull.ts
|
|
242252
|
-
import { dirname as dirname9, join as
|
|
242334
|
+
import { dirname as dirname9, join as join11 } from "node:path";
|
|
242253
242335
|
async function pullConnectorsAction() {
|
|
242254
242336
|
const { project: project2 } = await readProjectConfig();
|
|
242255
242337
|
const configDir = dirname9(project2.configPath);
|
|
242256
|
-
const connectorsDir =
|
|
242338
|
+
const connectorsDir = join11(configDir, project2.connectorsDir);
|
|
242257
242339
|
const remoteConnectors = await runTask("Fetching connectors from Base44", async () => {
|
|
242258
242340
|
return await listConnectors();
|
|
242259
242341
|
}, {
|
|
@@ -243101,63 +243183,6 @@ function getEntitiesPushCommand(context) {
|
|
|
243101
243183
|
}));
|
|
243102
243184
|
}
|
|
243103
243185
|
|
|
243104
|
-
// src/cli/utils/parseNames.ts
|
|
243105
|
-
function parseNames(args) {
|
|
243106
|
-
return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
|
|
243107
|
-
}
|
|
243108
|
-
|
|
243109
|
-
// src/cli/commands/functions/delete.ts
|
|
243110
|
-
async function deleteFunctionsAction(names) {
|
|
243111
|
-
let deleted = 0;
|
|
243112
|
-
let notFound = 0;
|
|
243113
|
-
let errors4 = 0;
|
|
243114
|
-
let completed = 0;
|
|
243115
|
-
const total = names.length;
|
|
243116
|
-
for (const name2 of names) {
|
|
243117
|
-
R2.step(theme.styles.dim(`[${completed + 1}/${total}] Deleting ${name2}...`));
|
|
243118
|
-
try {
|
|
243119
|
-
await deleteSingleFunction(name2);
|
|
243120
|
-
R2.success(`${name2.padEnd(25)} deleted`);
|
|
243121
|
-
deleted++;
|
|
243122
|
-
} catch (error48) {
|
|
243123
|
-
if (error48 instanceof ApiError && error48.statusCode === 404) {
|
|
243124
|
-
R2.warn(`${name2.padEnd(25)} not found`);
|
|
243125
|
-
notFound++;
|
|
243126
|
-
} else {
|
|
243127
|
-
R2.error(`${name2.padEnd(25)} error: ${error48 instanceof Error ? error48.message : String(error48)}`);
|
|
243128
|
-
errors4++;
|
|
243129
|
-
}
|
|
243130
|
-
}
|
|
243131
|
-
completed++;
|
|
243132
|
-
}
|
|
243133
|
-
if (names.length === 1) {
|
|
243134
|
-
if (deleted)
|
|
243135
|
-
return { outroMessage: `Function "${names[0]}" deleted` };
|
|
243136
|
-
if (notFound)
|
|
243137
|
-
return { outroMessage: `Function "${names[0]}" not found` };
|
|
243138
|
-
return { outroMessage: `Failed to delete "${names[0]}"` };
|
|
243139
|
-
}
|
|
243140
|
-
const parts = [];
|
|
243141
|
-
if (deleted > 0)
|
|
243142
|
-
parts.push(`${deleted}/${total} deleted`);
|
|
243143
|
-
if (notFound > 0)
|
|
243144
|
-
parts.push(`${notFound} not found`);
|
|
243145
|
-
if (errors4 > 0)
|
|
243146
|
-
parts.push(`${errors4} error${errors4 !== 1 ? "s" : ""}`);
|
|
243147
|
-
return { outroMessage: parts.join(", ") };
|
|
243148
|
-
}
|
|
243149
|
-
function getDeleteCommand(context) {
|
|
243150
|
-
return new Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").action(async (rawNames) => {
|
|
243151
|
-
await runCommand(() => {
|
|
243152
|
-
const names = parseNames(rawNames);
|
|
243153
|
-
if (names.length === 0) {
|
|
243154
|
-
throw new InvalidInputError("At least one function name is required");
|
|
243155
|
-
}
|
|
243156
|
-
return deleteFunctionsAction(names);
|
|
243157
|
-
}, { requireAuth: true }, context);
|
|
243158
|
-
});
|
|
243159
|
-
}
|
|
243160
|
-
|
|
243161
243186
|
// src/cli/commands/functions/deploy.ts
|
|
243162
243187
|
async function deployFunctionsAction() {
|
|
243163
243188
|
const { functions } = await readProjectConfig();
|
|
@@ -243196,13 +243221,57 @@ function getDeployCommand(context) {
|
|
|
243196
243221
|
});
|
|
243197
243222
|
}
|
|
243198
243223
|
|
|
243224
|
+
// src/cli/commands/functions/pull.ts
|
|
243225
|
+
import { dirname as dirname10, join as join12 } from "node:path";
|
|
243226
|
+
async function pullFunctionsAction(name2) {
|
|
243227
|
+
const { project: project2 } = await readProjectConfig();
|
|
243228
|
+
const configDir = dirname10(project2.configPath);
|
|
243229
|
+
const functionsDir = join12(configDir, project2.functionsDir);
|
|
243230
|
+
const remoteFunctions = await runTask("Fetching functions from Base44", async () => {
|
|
243231
|
+
const { functions } = await listDeployedFunctions();
|
|
243232
|
+
return functions;
|
|
243233
|
+
}, {
|
|
243234
|
+
successMessage: "Functions fetched successfully",
|
|
243235
|
+
errorMessage: "Failed to fetch functions"
|
|
243236
|
+
});
|
|
243237
|
+
const toPull = name2 ? remoteFunctions.filter((f) => f.name === name2) : remoteFunctions;
|
|
243238
|
+
if (name2 && toPull.length === 0) {
|
|
243239
|
+
return {
|
|
243240
|
+
outroMessage: `Function "${name2}" not found on remote`
|
|
243241
|
+
};
|
|
243242
|
+
}
|
|
243243
|
+
if (toPull.length === 0) {
|
|
243244
|
+
return { outroMessage: "No functions found on remote" };
|
|
243245
|
+
}
|
|
243246
|
+
const { written, skipped } = await runTask("Writing function files", async () => {
|
|
243247
|
+
return await writeFunctions(functionsDir, toPull);
|
|
243248
|
+
}, {
|
|
243249
|
+
successMessage: "Function files written successfully",
|
|
243250
|
+
errorMessage: "Failed to write function files"
|
|
243251
|
+
});
|
|
243252
|
+
for (const name3 of written) {
|
|
243253
|
+
R2.success(`${name3.padEnd(25)} written`);
|
|
243254
|
+
}
|
|
243255
|
+
for (const name3 of skipped) {
|
|
243256
|
+
R2.info(`${name3.padEnd(25)} unchanged`);
|
|
243257
|
+
}
|
|
243258
|
+
return {
|
|
243259
|
+
outroMessage: `Pulled ${toPull.length} function${toPull.length !== 1 ? "s" : ""} to ${functionsDir}`
|
|
243260
|
+
};
|
|
243261
|
+
}
|
|
243262
|
+
function getPullCommand(context) {
|
|
243263
|
+
return new Command("pull").description("Pull deployed functions from Base44").argument("[name]", "Pull a single function by name").action(async (name2) => {
|
|
243264
|
+
await runCommand(() => pullFunctionsAction(name2), { requireAuth: true }, context);
|
|
243265
|
+
});
|
|
243266
|
+
}
|
|
243267
|
+
|
|
243199
243268
|
// src/cli/commands/functions/index.ts
|
|
243200
243269
|
function getFunctionsCommand(context) {
|
|
243201
|
-
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(
|
|
243270
|
+
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getPullCommand(context));
|
|
243202
243271
|
}
|
|
243203
243272
|
|
|
243204
243273
|
// src/cli/commands/project/create.ts
|
|
243205
|
-
import { basename as basename3, join as
|
|
243274
|
+
import { basename as basename3, join as join13, resolve as resolve2 } from "node:path";
|
|
243206
243275
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
243207
243276
|
var DEFAULT_TEMPLATE_ID = "backend-only";
|
|
243208
243277
|
async function getTemplateById(templateId) {
|
|
@@ -243338,7 +243407,7 @@ async function executeCreate({
|
|
|
243338
243407
|
updateMessage("Building project...");
|
|
243339
243408
|
await execa({ cwd: resolvedPath, shell: true })`${buildCommand}`;
|
|
243340
243409
|
updateMessage("Deploying site...");
|
|
243341
|
-
return await deploySite(
|
|
243410
|
+
return await deploySite(join13(resolvedPath, outputDirectory));
|
|
243342
243411
|
}, {
|
|
243343
243412
|
successMessage: theme.colors.base44Orange("Site deployed successfully"),
|
|
243344
243413
|
errorMessage: "Failed to deploy site"
|
|
@@ -243964,10 +244033,10 @@ function toPascalCase(name2) {
|
|
|
243964
244033
|
return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
|
|
243965
244034
|
}
|
|
243966
244035
|
// src/core/types/update-project.ts
|
|
243967
|
-
import { join as
|
|
244036
|
+
import { join as join16 } from "node:path";
|
|
243968
244037
|
var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
|
|
243969
244038
|
async function updateProjectConfig(projectRoot) {
|
|
243970
|
-
const tsconfigPath =
|
|
244039
|
+
const tsconfigPath = join16(projectRoot, "tsconfig.json");
|
|
243971
244040
|
if (!await pathExists(tsconfigPath)) {
|
|
243972
244041
|
return false;
|
|
243973
244042
|
}
|
|
@@ -244010,7 +244079,7 @@ function getTypesCommand(context) {
|
|
|
244010
244079
|
}
|
|
244011
244080
|
|
|
244012
244081
|
// src/cli/dev/dev-server/main.ts
|
|
244013
|
-
import { dirname as
|
|
244082
|
+
import { dirname as dirname16, join as join20 } from "node:path";
|
|
244014
244083
|
var import_cors = __toESM(require_lib4(), 1);
|
|
244015
244084
|
var import_express4 = __toESM(require_express(), 1);
|
|
244016
244085
|
|
|
@@ -244169,10 +244238,10 @@ function createDevLogger() {
|
|
|
244169
244238
|
|
|
244170
244239
|
// src/cli/dev/dev-server/function-manager.ts
|
|
244171
244240
|
import { spawn as spawn2, spawnSync as spawnSync2 } from "node:child_process";
|
|
244172
|
-
import { dirname as
|
|
244241
|
+
import { dirname as dirname13, join as join17 } from "node:path";
|
|
244173
244242
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
244174
|
-
var __dirname5 =
|
|
244175
|
-
var WRAPPER_PATH =
|
|
244243
|
+
var __dirname5 = dirname13(fileURLToPath7(import.meta.url));
|
|
244244
|
+
var WRAPPER_PATH = join17(__dirname5, "../deno-runtime/main.js");
|
|
244176
244245
|
var READY_TIMEOUT = 30000;
|
|
244177
244246
|
|
|
244178
244247
|
class FunctionManager {
|
|
@@ -245476,9 +245545,9 @@ class NodeFsHandler {
|
|
|
245476
245545
|
if (this.fsw.closed) {
|
|
245477
245546
|
return;
|
|
245478
245547
|
}
|
|
245479
|
-
const
|
|
245548
|
+
const dirname15 = sp2.dirname(file2);
|
|
245480
245549
|
const basename5 = sp2.basename(file2);
|
|
245481
|
-
const parent = this.fsw._getWatchedDir(
|
|
245550
|
+
const parent = this.fsw._getWatchedDir(dirname15);
|
|
245482
245551
|
let prevStats = stats;
|
|
245483
245552
|
if (parent.has(basename5))
|
|
245484
245553
|
return;
|
|
@@ -245505,7 +245574,7 @@ class NodeFsHandler {
|
|
|
245505
245574
|
prevStats = newStats2;
|
|
245506
245575
|
}
|
|
245507
245576
|
} catch (error48) {
|
|
245508
|
-
this.fsw._remove(
|
|
245577
|
+
this.fsw._remove(dirname15, basename5);
|
|
245509
245578
|
}
|
|
245510
245579
|
} else if (parent.has(basename5)) {
|
|
245511
245580
|
const at13 = newStats.atimeMs;
|
|
@@ -246508,8 +246577,8 @@ async function createDevServer(options8) {
|
|
|
246508
246577
|
broadcastEntityEvent(io6, appId, entityName, event);
|
|
246509
246578
|
};
|
|
246510
246579
|
const base44ConfigWatcher = new WatchBase44({
|
|
246511
|
-
functions:
|
|
246512
|
-
entities:
|
|
246580
|
+
functions: join20(dirname16(project2.configPath), project2.functionsDir),
|
|
246581
|
+
entities: join20(dirname16(project2.configPath), project2.entitiesDir)
|
|
246513
246582
|
}, devLogger);
|
|
246514
246583
|
base44ConfigWatcher.on("change", async (name2) => {
|
|
246515
246584
|
try {
|
|
@@ -246698,7 +246767,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
|
|
|
246698
246767
|
import { release, type } from "node:os";
|
|
246699
246768
|
|
|
246700
246769
|
// node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
246701
|
-
import { dirname as
|
|
246770
|
+
import { dirname as dirname17, posix, sep } from "path";
|
|
246702
246771
|
function createModulerModifier() {
|
|
246703
246772
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
246704
246773
|
return async (frames) => {
|
|
@@ -246707,7 +246776,7 @@ function createModulerModifier() {
|
|
|
246707
246776
|
return frames;
|
|
246708
246777
|
};
|
|
246709
246778
|
}
|
|
246710
|
-
function createGetModuleFromFilename(basePath = process.argv[1] ?
|
|
246779
|
+
function createGetModuleFromFilename(basePath = process.argv[1] ? dirname17(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
|
|
246711
246780
|
const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
|
|
246712
246781
|
return (filename) => {
|
|
246713
246782
|
if (!filename)
|
|
@@ -250925,4 +250994,4 @@ export {
|
|
|
250925
250994
|
CLIExitError
|
|
250926
250995
|
};
|
|
250927
250996
|
|
|
250928
|
-
//# debugId=
|
|
250997
|
+
//# debugId=76C7A3E02032C16C64756E2164756E21
|