@base44-preview/cli 0.0.40-pr.381.45f0726 → 0.0.40-pr.382.07e2a4c

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 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 join13(array2, separator) {
18043
+ function join15(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 pull = baseRest(pullAll);
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 = 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 = join13;
19975
+ lodash.join = join15;
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" ? join13(replacement, currentDoc.split(`
20604
+ return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ? join15(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 join13(separator, docs) {
20684
+ function join15(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: join13,
21395
+ join: join15,
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" ? join15(replacement, currentDoc.split(`
126309
+ return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ? join17(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 join15(separator, docs) {
126395
+ function join17(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: join15,
127060
+ join: join17,
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 dirname11 = path18.dirname;
156275
+ var dirname12 = path18.dirname;
156276
156276
  var basename4 = path18.basename;
156277
156277
  var extname2 = path18.extname;
156278
- var join16 = path18.join;
156278
+ var join18 = 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 = dirname11(loc);
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 = join16(dir, file2);
156340
+ var path19 = join18(dir, file2);
156341
156341
  var stat2 = tryStat(path19);
156342
156342
  if (stat2 && stat2.isFile()) {
156343
156343
  return path19;
156344
156344
  }
156345
- path19 = join16(dir, basename4(file2, ext), "index" + ext);
156345
+ path19 = join18(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 join16 = path18.join;
160040
+ var join18 = 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(join16(root2, path19));
160212
+ path19 = normalize(join18(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 = join16(path19, self2._index[i5]);
160352
+ var p4 = join18(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 join16(s5) {
206947
+ value: function join18(s5) {
206948
206948
  if (this.length === 0)
206949
206949
  return "";
206950
206950
  var p4 = this.head;
@@ -210655,7 +210655,7 @@ var require_dist5 = __commonJS((exports, module) => {
210655
210655
  });
210656
210656
 
210657
210657
  // src/cli/index.ts
210658
- import { dirname as dirname15, join as join19 } from "node:path";
210658
+ import { dirname as dirname16, join as join21 } from "node:path";
210659
210659
  import { fileURLToPath as fileURLToPath6 } from "node:url";
210660
210660
 
210661
210661
  // node_modules/commander/esm.mjs
@@ -210675,7 +210675,7 @@ var {
210675
210675
  } = import__.default;
210676
210676
 
210677
210677
  // src/cli/commands/agents/pull.ts
210678
- import { dirname as dirname7, join as join10 } from "node:path";
210678
+ import { dirname as dirname7, join as join11 } from "node:path";
210679
210679
 
210680
210680
  // node_modules/@clack/core/dist/index.mjs
210681
210681
  var import_picocolors = __toESM(require_picocolors(), 1);
@@ -233171,7 +233171,7 @@ var generateGlobTasks = normalizeArguments(generateTasks);
233171
233171
  var generateGlobTasksSync = normalizeArgumentsSync(generateTasksSync);
233172
233172
 
233173
233173
  // src/core/project/config.ts
233174
- import { dirname as dirname5, join as join6 } from "node:path";
233174
+ import { dirname as dirname5, join as join7 } from "node:path";
233175
233175
 
233176
233176
  // src/core/resources/agent/schema.ts
233177
233177
  var EntityOperationSchema = exports_external.enum(["create", "update", "delete", "read"]);
@@ -233907,6 +233907,21 @@ var DeployFunctionsResponseSchema = exports_external.object({
233907
233907
  skipped: exports_external.array(exports_external.string()).optional().nullable(),
233908
233908
  errors: exports_external.array(exports_external.object({ name: exports_external.string(), message: exports_external.string() })).nullable()
233909
233909
  });
233910
+ var FunctionAutomationInfoSchema = exports_external.object({
233911
+ name: exports_external.string(),
233912
+ type: exports_external.string(),
233913
+ is_active: exports_external.boolean()
233914
+ });
233915
+ var FunctionInfoSchema = exports_external.object({
233916
+ name: exports_external.string(),
233917
+ deployment_id: exports_external.string(),
233918
+ entry: exports_external.string(),
233919
+ files: exports_external.array(FunctionFileSchema),
233920
+ automations: exports_external.array(FunctionAutomationInfoSchema)
233921
+ });
233922
+ var ListFunctionsResponseSchema = exports_external.object({
233923
+ functions: exports_external.array(FunctionInfoSchema)
233924
+ });
233910
233925
  var LogLevelSchema = exports_external.enum(["info", "warning", "error", "debug"]);
233911
233926
  var FunctionLogEntrySchema = exports_external.object({
233912
233927
  time: exports_external.string(),
@@ -233944,15 +233959,19 @@ async function deployFunctions(functions) {
233944
233959
  }
233945
233960
  return result.data;
233946
233961
  }
233947
- async function deleteSingleFunction(name2) {
233962
+ async function listDeployedFunctions() {
233948
233963
  const appClient = getAppClient();
233964
+ let response;
233949
233965
  try {
233950
- await appClient.delete(`backend-functions/${encodeURIComponent(name2)}`, {
233951
- timeout: 60000
233952
- });
233966
+ response = await appClient.get("backend-functions", { timeout: 30000 });
233953
233967
  } catch (error48) {
233954
- throw await ApiError.fromHttpError(error48, `deleting function "${name2}"`);
233968
+ throw await ApiError.fromHttpError(error48, "listing deployed functions");
233955
233969
  }
233970
+ const result = ListFunctionsResponseSchema.safeParse(await response.json());
233971
+ if (!result.success) {
233972
+ throw new SchemaValidationError("Invalid response from server", result.error);
233973
+ }
233974
+ return result.data;
233956
233975
  }
233957
233976
  function buildLogsQueryString(filters) {
233958
233977
  const params = new URLSearchParams;
@@ -234085,6 +234104,67 @@ async function pushFunctions(functions) {
234085
234104
  const functionsWithCode = await Promise.all(functions.map(loadFunctionCode));
234086
234105
  return deployFunctions(functionsWithCode);
234087
234106
  }
234107
+ // src/core/resources/function/pull.ts
234108
+ import { join as join6 } from "node:path";
234109
+ async function writeFunctions(functionsDir, functions) {
234110
+ const written = [];
234111
+ const skipped = [];
234112
+ for (const fn of functions) {
234113
+ const functionDir = join6(functionsDir, fn.name);
234114
+ const configPath = join6(functionDir, "function.jsonc");
234115
+ if (await isFunctionUnchanged(functionDir, fn)) {
234116
+ skipped.push(fn.name);
234117
+ continue;
234118
+ }
234119
+ const config5 = {
234120
+ name: fn.name,
234121
+ entry: fn.entry
234122
+ };
234123
+ if (fn.automations.length > 0) {
234124
+ config5.automations = fn.automations;
234125
+ }
234126
+ await writeJsonFile(configPath, config5);
234127
+ for (const file2 of fn.files) {
234128
+ await writeFile(join6(functionDir, file2.path), file2.content);
234129
+ }
234130
+ written.push(fn.name);
234131
+ }
234132
+ return { written, skipped };
234133
+ }
234134
+ async function isFunctionUnchanged(functionDir, fn) {
234135
+ if (!await pathExists(functionDir)) {
234136
+ return false;
234137
+ }
234138
+ const configPath = join6(functionDir, "function.jsonc");
234139
+ try {
234140
+ const localConfig = await readJsonFile(configPath);
234141
+ if (localConfig.entry !== fn.entry) {
234142
+ return false;
234143
+ }
234144
+ const localAuto = JSON.stringify(localConfig.automations ?? []);
234145
+ const remoteAuto = JSON.stringify(fn.automations);
234146
+ if (localAuto !== remoteAuto) {
234147
+ return false;
234148
+ }
234149
+ } catch {
234150
+ return false;
234151
+ }
234152
+ for (const file2 of fn.files) {
234153
+ const filePath = join6(functionDir, file2.path);
234154
+ if (!await pathExists(filePath)) {
234155
+ return false;
234156
+ }
234157
+ try {
234158
+ const localContent = await readTextFile(filePath);
234159
+ if (localContent !== file2.content) {
234160
+ return false;
234161
+ }
234162
+ } catch {
234163
+ return false;
234164
+ }
234165
+ }
234166
+ return true;
234167
+ }
234088
234168
  // src/core/resources/function/resource.ts
234089
234169
  var functionResource = {
234090
234170
  readAll: readAllFunctions,
@@ -234129,10 +234209,10 @@ async function readProjectConfig(projectRoot) {
234129
234209
  const project = result.data;
234130
234210
  const configDir = dirname5(configPath);
234131
234211
  const [entities, functions, agents, connectors] = await Promise.all([
234132
- entityResource.readAll(join6(configDir, project.entitiesDir)),
234133
- functionResource.readAll(join6(configDir, project.functionsDir)),
234134
- agentResource.readAll(join6(configDir, project.agentsDir)),
234135
- connectorResource.readAll(join6(configDir, project.connectorsDir))
234212
+ entityResource.readAll(join7(configDir, project.entitiesDir)),
234213
+ functionResource.readAll(join7(configDir, project.functionsDir)),
234214
+ agentResource.readAll(join7(configDir, project.agentsDir)),
234215
+ connectorResource.readAll(join7(configDir, project.connectorsDir))
234136
234216
  ]);
234137
234217
  return {
234138
234218
  project: { ...project, root, configPath },
@@ -234229,12 +234309,12 @@ async function readAppConfig(projectRoot) {
234229
234309
  // src/core/project/template.ts
234230
234310
  var import_ejs = __toESM(require_ejs(), 1);
234231
234311
  var import_front_matter = __toESM(require_front_matter(), 1);
234232
- import { dirname as dirname6, join as join8 } from "node:path";
234312
+ import { dirname as dirname6, join as join9 } from "node:path";
234233
234313
 
234234
234314
  // src/core/assets.ts
234235
234315
  import { cpSync, existsSync } from "node:fs";
234236
234316
  import { homedir as homedir2 } from "node:os";
234237
- import { join as join7 } from "node:path";
234317
+ import { join as join8 } from "node:path";
234238
234318
  // package.json
234239
234319
  var package_default = {
234240
234320
  name: "base44",
@@ -234329,15 +234409,15 @@ var package_default = {
234329
234409
  };
234330
234410
 
234331
234411
  // src/core/assets.ts
234332
- var ASSETS_DIR = join7(homedir2(), ".base44", "assets", package_default.version);
234412
+ var ASSETS_DIR = join8(homedir2(), ".base44", "assets", package_default.version);
234333
234413
  function getTemplatesDir() {
234334
- return join7(ASSETS_DIR, "templates");
234414
+ return join8(ASSETS_DIR, "templates");
234335
234415
  }
234336
234416
  function getTemplatesIndexPath() {
234337
- return join7(ASSETS_DIR, "templates", "templates.json");
234417
+ return join8(ASSETS_DIR, "templates", "templates.json");
234338
234418
  }
234339
234419
  function getDenoWrapperPath() {
234340
- return join7(ASSETS_DIR, "deno-runtime", "main.js");
234420
+ return join8(ASSETS_DIR, "deno-runtime", "main.js");
234341
234421
  }
234342
234422
  function ensureNpmAssets(sourceDir) {
234343
234423
  if (existsSync(ASSETS_DIR))
@@ -234358,23 +234438,23 @@ async function listTemplates() {
234358
234438
  return result.data.templates;
234359
234439
  }
234360
234440
  async function renderTemplate(template, destPath, data) {
234361
- const templateDir = join8(getTemplatesDir(), template.path);
234441
+ const templateDir = join9(getTemplatesDir(), template.path);
234362
234442
  const files = await globby("**/*", {
234363
234443
  cwd: templateDir,
234364
234444
  dot: true,
234365
234445
  onlyFiles: true
234366
234446
  });
234367
234447
  for (const file2 of files) {
234368
- const srcPath = join8(templateDir, file2);
234448
+ const srcPath = join9(templateDir, file2);
234369
234449
  try {
234370
234450
  if (file2.endsWith(".ejs")) {
234371
234451
  const rendered = await import_ejs.default.renderFile(srcPath, data);
234372
234452
  const { attributes, body } = import_front_matter.default(rendered);
234373
- const destFile = attributes.outputFileName ? join8(dirname6(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
234374
- const destFilePath = join8(destPath, destFile);
234453
+ const destFile = attributes.outputFileName ? join9(dirname6(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
234454
+ const destFilePath = join9(destPath, destFile);
234375
234455
  await writeFile(destFilePath, body);
234376
234456
  } else {
234377
- const destFilePath = join8(destPath, file2);
234457
+ const destFilePath = join9(destPath, file2);
234378
234458
  await copyFile(srcPath, destFilePath);
234379
234459
  }
234380
234460
  } catch (error48) {
@@ -234473,7 +234553,7 @@ async function getSiteFilePaths(outputDir) {
234473
234553
  // src/core/site/deploy.ts
234474
234554
  import { randomUUID } from "node:crypto";
234475
234555
  import { tmpdir } from "node:os";
234476
- import { join as join9 } from "node:path";
234556
+ import { join as join10 } from "node:path";
234477
234557
  async function deploySite(siteOutputDir) {
234478
234558
  if (!await pathExists(siteOutputDir)) {
234479
234559
  throw new InvalidInputError(`Output directory does not exist: ${siteOutputDir}. Make sure to build your project first.`, {
@@ -234490,7 +234570,7 @@ async function deploySite(siteOutputDir) {
234490
234570
  ]
234491
234571
  });
234492
234572
  }
234493
- const archivePath = join9(tmpdir(), `base44-site-${randomUUID()}.tar.gz`);
234573
+ const archivePath = join10(tmpdir(), `base44-site-${randomUUID()}.tar.gz`);
234494
234574
  try {
234495
234575
  await createArchive(siteOutputDir, archivePath);
234496
234576
  return await uploadSite(archivePath);
@@ -242179,7 +242259,7 @@ function getDashboardUrl(projectId) {
242179
242259
  async function pullAgentsAction() {
242180
242260
  const { project: project2 } = await readProjectConfig();
242181
242261
  const configDir = dirname7(project2.configPath);
242182
- const agentsDir = join10(configDir, project2.agentsDir);
242262
+ const agentsDir = join11(configDir, project2.agentsDir);
242183
242263
  const remoteAgents = await runTask("Fetching agents from Base44", async () => {
242184
242264
  return await fetchAgents();
242185
242265
  }, {
@@ -242273,11 +242353,11 @@ function getWhoamiCommand(context) {
242273
242353
  }
242274
242354
 
242275
242355
  // src/cli/commands/connectors/pull.ts
242276
- import { dirname as dirname8, join as join11 } from "node:path";
242356
+ import { dirname as dirname8, join as join12 } from "node:path";
242277
242357
  async function pullConnectorsAction() {
242278
242358
  const { project: project2 } = await readProjectConfig();
242279
242359
  const configDir = dirname8(project2.configPath);
242280
- const connectorsDir = join11(configDir, project2.connectorsDir);
242360
+ const connectorsDir = join12(configDir, project2.connectorsDir);
242281
242361
  const remoteConnectors = await runTask("Fetching connectors from Base44", async () => {
242282
242362
  return await listConnectors();
242283
242363
  }, {
@@ -243125,63 +243205,6 @@ function getEntitiesPushCommand(context) {
243125
243205
  }));
243126
243206
  }
243127
243207
 
243128
- // src/cli/utils/parseNames.ts
243129
- function parseNames(args) {
243130
- return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
243131
- }
243132
-
243133
- // src/cli/commands/functions/delete.ts
243134
- async function deleteFunctionsAction(names) {
243135
- let deleted = 0;
243136
- let notFound = 0;
243137
- let errors4 = 0;
243138
- let completed = 0;
243139
- const total = names.length;
243140
- for (const name2 of names) {
243141
- R2.step(theme.styles.dim(`[${completed + 1}/${total}] Deleting ${name2}...`));
243142
- try {
243143
- await deleteSingleFunction(name2);
243144
- R2.success(`${name2.padEnd(25)} deleted`);
243145
- deleted++;
243146
- } catch (error48) {
243147
- if (error48 instanceof ApiError && error48.statusCode === 404) {
243148
- R2.warn(`${name2.padEnd(25)} not found`);
243149
- notFound++;
243150
- } else {
243151
- R2.error(`${name2.padEnd(25)} error: ${error48 instanceof Error ? error48.message : String(error48)}`);
243152
- errors4++;
243153
- }
243154
- }
243155
- completed++;
243156
- }
243157
- if (names.length === 1) {
243158
- if (deleted)
243159
- return { outroMessage: `Function "${names[0]}" deleted` };
243160
- if (notFound)
243161
- return { outroMessage: `Function "${names[0]}" not found` };
243162
- return { outroMessage: `Failed to delete "${names[0]}"` };
243163
- }
243164
- const parts = [];
243165
- if (deleted > 0)
243166
- parts.push(`${deleted}/${total} deleted`);
243167
- if (notFound > 0)
243168
- parts.push(`${notFound} not found`);
243169
- if (errors4 > 0)
243170
- parts.push(`${errors4} error${errors4 !== 1 ? "s" : ""}`);
243171
- return { outroMessage: parts.join(", ") };
243172
- }
243173
- function getDeleteCommand(context) {
243174
- return new Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").action(async (rawNames) => {
243175
- await runCommand(() => {
243176
- const names = parseNames(rawNames);
243177
- if (names.length === 0) {
243178
- throw new InvalidInputError("At least one function name is required");
243179
- }
243180
- return deleteFunctionsAction(names);
243181
- }, { requireAuth: true }, context);
243182
- });
243183
- }
243184
-
243185
243208
  // src/cli/commands/functions/deploy.ts
243186
243209
  async function deployFunctionsAction() {
243187
243210
  const { functions } = await readProjectConfig();
@@ -243220,13 +243243,57 @@ function getDeployCommand(context) {
243220
243243
  });
243221
243244
  }
243222
243245
 
243246
+ // src/cli/commands/functions/pull.ts
243247
+ import { dirname as dirname9, join as join13 } from "node:path";
243248
+ async function pullFunctionsAction(name2) {
243249
+ const { project: project2 } = await readProjectConfig();
243250
+ const configDir = dirname9(project2.configPath);
243251
+ const functionsDir = join13(configDir, project2.functionsDir);
243252
+ const remoteFunctions = await runTask("Fetching functions from Base44", async () => {
243253
+ const { functions } = await listDeployedFunctions();
243254
+ return functions;
243255
+ }, {
243256
+ successMessage: "Functions fetched successfully",
243257
+ errorMessage: "Failed to fetch functions"
243258
+ });
243259
+ const toPull = name2 ? remoteFunctions.filter((f) => f.name === name2) : remoteFunctions;
243260
+ if (name2 && toPull.length === 0) {
243261
+ return {
243262
+ outroMessage: `Function "${name2}" not found on remote`
243263
+ };
243264
+ }
243265
+ if (toPull.length === 0) {
243266
+ return { outroMessage: "No functions found on remote" };
243267
+ }
243268
+ const { written, skipped } = await runTask("Writing function files", async () => {
243269
+ return await writeFunctions(functionsDir, toPull);
243270
+ }, {
243271
+ successMessage: "Function files written successfully",
243272
+ errorMessage: "Failed to write function files"
243273
+ });
243274
+ for (const name3 of written) {
243275
+ R2.success(`${name3.padEnd(25)} written`);
243276
+ }
243277
+ for (const name3 of skipped) {
243278
+ R2.info(`${name3.padEnd(25)} unchanged`);
243279
+ }
243280
+ return {
243281
+ outroMessage: `Pulled ${toPull.length} function${toPull.length !== 1 ? "s" : ""} to ${functionsDir}`
243282
+ };
243283
+ }
243284
+ function getPullCommand(context) {
243285
+ return new Command("pull").description("Pull deployed functions from Base44").argument("[name]", "Pull a single function by name").action(async (name2) => {
243286
+ await runCommand(() => pullFunctionsAction(name2), { requireAuth: true }, context);
243287
+ });
243288
+ }
243289
+
243223
243290
  // src/cli/commands/functions/index.ts
243224
243291
  function getFunctionsCommand(context) {
243225
- return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getDeleteCommand(context));
243292
+ return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getPullCommand(context));
243226
243293
  }
243227
243294
 
243228
243295
  // src/cli/commands/project/create.ts
243229
- import { basename as basename3, join as join12, resolve as resolve2 } from "node:path";
243296
+ import { basename as basename3, join as join14, resolve as resolve2 } from "node:path";
243230
243297
  var import_kebabCase = __toESM(require_kebabCase(), 1);
243231
243298
  var DEFAULT_TEMPLATE_ID = "backend-only";
243232
243299
  async function getTemplateById(templateId) {
@@ -243362,7 +243429,7 @@ async function executeCreate({
243362
243429
  updateMessage("Building project...");
243363
243430
  await execa({ cwd: resolvedPath, shell: true })`${buildCommand}`;
243364
243431
  updateMessage("Deploying site...");
243365
- return await deploySite(join12(resolvedPath, outputDirectory));
243432
+ return await deploySite(join14(resolvedPath, outputDirectory));
243366
243433
  }, {
243367
243434
  successMessage: theme.colors.base44Orange("Site deployed successfully"),
243368
243435
  errorMessage: "Failed to deploy site"
@@ -243988,10 +244055,10 @@ function toPascalCase(name2) {
243988
244055
  return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
243989
244056
  }
243990
244057
  // src/core/types/update-project.ts
243991
- import { join as join15 } from "node:path";
244058
+ import { join as join17 } from "node:path";
243992
244059
  var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
243993
244060
  async function updateProjectConfig(projectRoot) {
243994
- const tsconfigPath = join15(projectRoot, "tsconfig.json");
244061
+ const tsconfigPath = join17(projectRoot, "tsconfig.json");
243995
244062
  if (!await pathExists(tsconfigPath)) {
243996
244063
  return false;
243997
244064
  }
@@ -244034,7 +244101,7 @@ function getTypesCommand(context) {
244034
244101
  }
244035
244102
 
244036
244103
  // src/cli/dev/dev-server/main.ts
244037
- import { dirname as dirname13, join as join18 } from "node:path";
244104
+ import { dirname as dirname14, join as join20 } from "node:path";
244038
244105
  var import_cors = __toESM(require_lib4(), 1);
244039
244106
  var import_express4 = __toESM(require_express(), 1);
244040
244107
 
@@ -245498,9 +245565,9 @@ class NodeFsHandler {
245498
245565
  if (this.fsw.closed) {
245499
245566
  return;
245500
245567
  }
245501
- const dirname12 = sp2.dirname(file2);
245568
+ const dirname13 = sp2.dirname(file2);
245502
245569
  const basename5 = sp2.basename(file2);
245503
- const parent = this.fsw._getWatchedDir(dirname12);
245570
+ const parent = this.fsw._getWatchedDir(dirname13);
245504
245571
  let prevStats = stats;
245505
245572
  if (parent.has(basename5))
245506
245573
  return;
@@ -245527,7 +245594,7 @@ class NodeFsHandler {
245527
245594
  prevStats = newStats2;
245528
245595
  }
245529
245596
  } catch (error48) {
245530
- this.fsw._remove(dirname12, basename5);
245597
+ this.fsw._remove(dirname13, basename5);
245531
245598
  }
245532
245599
  } else if (parent.has(basename5)) {
245533
245600
  const at13 = newStats.atimeMs;
@@ -246530,8 +246597,8 @@ async function createDevServer(options8) {
246530
246597
  broadcastEntityEvent(io6, appId, entityName, event);
246531
246598
  };
246532
246599
  const base44ConfigWatcher = new WatchBase44({
246533
- functions: join18(dirname13(project2.configPath), project2.functionsDir),
246534
- entities: join18(dirname13(project2.configPath), project2.entitiesDir)
246600
+ functions: join20(dirname14(project2.configPath), project2.functionsDir),
246601
+ entities: join20(dirname14(project2.configPath), project2.entitiesDir)
246535
246602
  }, devLogger);
246536
246603
  base44ConfigWatcher.on("change", async (name2) => {
246537
246604
  try {
@@ -246721,7 +246788,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
246721
246788
  import { release, type } from "node:os";
246722
246789
 
246723
246790
  // node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
246724
- import { dirname as dirname14, posix, sep } from "path";
246791
+ import { dirname as dirname15, posix, sep } from "path";
246725
246792
  function createModulerModifier() {
246726
246793
  const getModuleFromFileName = createGetModuleFromFilename();
246727
246794
  return async (frames) => {
@@ -246730,7 +246797,7 @@ function createModulerModifier() {
246730
246797
  return frames;
246731
246798
  };
246732
246799
  }
246733
- function createGetModuleFromFilename(basePath = process.argv[1] ? dirname14(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
246800
+ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname15(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
246734
246801
  const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
246735
246802
  return (filename) => {
246736
246803
  if (!filename)
@@ -250919,9 +250986,9 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
250919
250986
  });
250920
250987
  }
250921
250988
  // src/cli/index.ts
250922
- var __dirname4 = dirname15(fileURLToPath6(import.meta.url));
250989
+ var __dirname4 = dirname16(fileURLToPath6(import.meta.url));
250923
250990
  async function runCLI() {
250924
- ensureNpmAssets(join19(__dirname4, "../assets"));
250991
+ ensureNpmAssets(join21(__dirname4, "../assets"));
250925
250992
  const errorReporter = new ErrorReporter;
250926
250993
  errorReporter.registerProcessErrorHandlers();
250927
250994
  const isNonInteractive = !process.stdin.isTTY || !process.stdout.isTTY;
@@ -250953,4 +251020,4 @@ export {
250953
251020
  CLIExitError
250954
251021
  };
250955
251022
 
250956
- //# debugId=8B4B4D40C4BDE4A964756E2164756E21
251023
+ //# debugId=F91D0DB4151EAA5F64756E2164756E21