@base44-preview/cli 0.0.44-pr.412.e5a2e1d → 0.0.44-pr.417.2c58950

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
@@ -16459,7 +16459,7 @@ var require_lodash = __commonJS((exports, module) => {
16459
16459
  }
16460
16460
  return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
16461
16461
  });
16462
- function join11(array2, separator) {
16462
+ function join10(array2, separator) {
16463
16463
  return array2 == null ? "" : nativeJoin.call(array2, separator);
16464
16464
  }
16465
16465
  function last(array2) {
@@ -16481,7 +16481,7 @@ var require_lodash = __commonJS((exports, module) => {
16481
16481
  function nth(array2, n2) {
16482
16482
  return array2 && array2.length ? baseNth(array2, toInteger(n2)) : undefined2;
16483
16483
  }
16484
- var pull3 = baseRest(pullAll);
16484
+ var pull2 = baseRest(pullAll);
16485
16485
  function pullAll(array2, values2) {
16486
16486
  return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2) : array2;
16487
16487
  }
@@ -18246,7 +18246,7 @@ __p += '`;
18246
18246
  lodash.pickBy = pickBy;
18247
18247
  lodash.property = property;
18248
18248
  lodash.propertyOf = propertyOf;
18249
- lodash.pull = pull3;
18249
+ lodash.pull = pull2;
18250
18250
  lodash.pullAll = pullAll;
18251
18251
  lodash.pullAllBy = pullAllBy;
18252
18252
  lodash.pullAllWith = pullAllWith;
@@ -18391,7 +18391,7 @@ __p += '`;
18391
18391
  lodash.isUndefined = isUndefined;
18392
18392
  lodash.isWeakMap = isWeakMap;
18393
18393
  lodash.isWeakSet = isWeakSet;
18394
- lodash.join = join11;
18394
+ lodash.join = join10;
18395
18395
  lodash.kebabCase = kebabCase;
18396
18396
  lodash.last = last;
18397
18397
  lodash.lastIndexOf = lastIndexOf;
@@ -27503,7 +27503,7 @@ function cleanDoc(doc2) {
27503
27503
  return mapDoc(doc2, (currentDoc) => cleanDocFn(currentDoc));
27504
27504
  }
27505
27505
  function replaceEndOfLine(doc2, replacement = literalline) {
27506
- return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ? join15(replacement, currentDoc.split(`
27506
+ return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ? join13(replacement, currentDoc.split(`
27507
27507
  `)) : currentDoc);
27508
27508
  }
27509
27509
  function canBreakFn(doc2) {
@@ -27583,7 +27583,7 @@ function indentIfBreak(contents, options) {
27583
27583
  negate: options.negate
27584
27584
  };
27585
27585
  }
27586
- function join15(separator, docs) {
27586
+ function join13(separator, docs) {
27587
27587
  assertDoc(separator);
27588
27588
  assertDocArray(docs);
27589
27589
  const parts = [];
@@ -28294,7 +28294,7 @@ var init_doc = __esm(() => {
28294
28294
  MODE_FLAT = Symbol("MODE_FLAT");
28295
28295
  DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
28296
28296
  builders = {
28297
- join: join15,
28297
+ join: join13,
28298
28298
  line,
28299
28299
  softline,
28300
28300
  hardline,
@@ -133208,7 +133208,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
133208
133208
  return mapDoc2(doc2, (currentDoc) => cleanDocFn2(currentDoc));
133209
133209
  }
133210
133210
  function replaceEndOfLine2(doc2, replacement = literalline2) {
133211
- return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ? join17(replacement, currentDoc.split(`
133211
+ return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ? join15(replacement, currentDoc.split(`
133212
133212
  `)) : currentDoc);
133213
133213
  }
133214
133214
  function canBreakFn2(doc2) {
@@ -133294,7 +133294,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
133294
133294
  negate: options8.negate
133295
133295
  };
133296
133296
  }
133297
- function join17(separator, docs) {
133297
+ function join15(separator, docs) {
133298
133298
  assertDoc2(separator);
133299
133299
  assertDocArray2(docs);
133300
133300
  const parts = [];
@@ -133959,7 +133959,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
133959
133959
  }
133960
133960
  }
133961
133961
  var builders2 = {
133962
- join: join17,
133962
+ join: join15,
133963
133963
  line: line3,
133964
133964
  softline: softline2,
133965
133965
  hardline: hardline4,
@@ -160399,10 +160399,10 @@ var require_view = __commonJS((exports, module) => {
160399
160399
  var debug = require_src4()("express:view");
160400
160400
  var path18 = __require("node:path");
160401
160401
  var fs28 = __require("node:fs");
160402
- var dirname12 = path18.dirname;
160402
+ var dirname11 = path18.dirname;
160403
160403
  var basename4 = path18.basename;
160404
160404
  var extname2 = path18.extname;
160405
- var join18 = path18.join;
160405
+ var join16 = path18.join;
160406
160406
  var resolve6 = path18.resolve;
160407
160407
  module.exports = View;
160408
160408
  function View(name2, options8) {
@@ -160438,7 +160438,7 @@ var require_view = __commonJS((exports, module) => {
160438
160438
  for (var i5 = 0;i5 < roots.length && !path19; i5++) {
160439
160439
  var root2 = roots[i5];
160440
160440
  var loc = resolve6(root2, name2);
160441
- var dir = dirname12(loc);
160441
+ var dir = dirname11(loc);
160442
160442
  var file2 = basename4(loc);
160443
160443
  path19 = this.resolve(dir, file2);
160444
160444
  }
@@ -160464,12 +160464,12 @@ var require_view = __commonJS((exports, module) => {
160464
160464
  };
160465
160465
  View.prototype.resolve = function resolve7(dir, file2) {
160466
160466
  var ext = this.ext;
160467
- var path19 = join18(dir, file2);
160467
+ var path19 = join16(dir, file2);
160468
160468
  var stat2 = tryStat(path19);
160469
160469
  if (stat2 && stat2.isFile()) {
160470
160470
  return path19;
160471
160471
  }
160472
- path19 = join18(dir, basename4(file2, ext), "index" + ext);
160472
+ path19 = join16(dir, basename4(file2, ext), "index" + ext);
160473
160473
  stat2 = tryStat(path19);
160474
160474
  if (stat2 && stat2.isFile()) {
160475
160475
  return path19;
@@ -164164,7 +164164,7 @@ var require_send = __commonJS((exports, module) => {
164164
164164
  var Stream2 = __require("stream");
164165
164165
  var util2 = __require("util");
164166
164166
  var extname2 = path18.extname;
164167
- var join18 = path18.join;
164167
+ var join16 = path18.join;
164168
164168
  var normalize = path18.normalize;
164169
164169
  var resolve6 = path18.resolve;
164170
164170
  var sep = path18.sep;
@@ -164336,7 +164336,7 @@ var require_send = __commonJS((exports, module) => {
164336
164336
  return res;
164337
164337
  }
164338
164338
  parts = path19.split(sep);
164339
- path19 = normalize(join18(root2, path19));
164339
+ path19 = normalize(join16(root2, path19));
164340
164340
  } else {
164341
164341
  if (UP_PATH_REGEXP.test(path19)) {
164342
164342
  debug('malicious path "%s"', path19);
@@ -164476,7 +164476,7 @@ var require_send = __commonJS((exports, module) => {
164476
164476
  return self2.onStatError(err);
164477
164477
  return self2.error(404);
164478
164478
  }
164479
- var p4 = join18(path19, self2._index[i5]);
164479
+ var p4 = join16(path19, self2._index[i5]);
164480
164480
  debug('stat "%s"', p4);
164481
164481
  fs28.stat(p4, function(err2, stat2) {
164482
164482
  if (err2)
@@ -211071,7 +211071,7 @@ var require_buffer_list = __commonJS((exports, module) => {
211071
211071
  }
211072
211072
  }, {
211073
211073
  key: "join",
211074
- value: function join18(s5) {
211074
+ value: function join16(s5) {
211075
211075
  if (this.length === 0)
211076
211076
  return "";
211077
211077
  var p4 = this.head;
@@ -214782,7 +214782,7 @@ var require_dist5 = __commonJS((exports, module) => {
214782
214782
  });
214783
214783
 
214784
214784
  // src/cli/index.ts
214785
- import { dirname as dirname16, join as join21 } from "node:path";
214785
+ import { dirname as dirname15, join as join19 } from "node:path";
214786
214786
  import { fileURLToPath as fileURLToPath6 } from "node:url";
214787
214787
 
214788
214788
  // ../../node_modules/commander/esm.mjs
@@ -214802,7 +214802,7 @@ var {
214802
214802
  } = import__.default;
214803
214803
 
214804
214804
  // src/cli/commands/agents/pull.ts
214805
- import { dirname as dirname7, join as join11 } from "node:path";
214805
+ import { dirname as dirname7, join as join10 } from "node:path";
214806
214806
 
214807
214807
  // ../../node_modules/@clack/core/dist/index.mjs
214808
214808
  var import_picocolors = __toESM(require_picocolors(), 1);
@@ -237317,7 +237317,7 @@ var generateGlobTasks = normalizeArguments(generateTasks);
237317
237317
  var generateGlobTasksSync = normalizeArgumentsSync(generateTasksSync);
237318
237318
 
237319
237319
  // src/core/project/config.ts
237320
- import { dirname as dirname5, join as join7 } from "node:path";
237320
+ import { dirname as dirname5, join as join6 } from "node:path";
237321
237321
 
237322
237322
  // src/core/resources/agent/schema.ts
237323
237323
  var EntityOperationSchema = exports_external.enum(["create", "update", "delete", "read"]);
@@ -238249,24 +238249,11 @@ var BackendFunctionSchema = FunctionConfigSchema.extend({
238249
238249
  entryPath: exports_external.string().min(1, "Entry path cannot be empty"),
238250
238250
  filePaths: exports_external.array(exports_external.string()).min(1, "Function must have at least one file")
238251
238251
  });
238252
- var DeploySingleFunctionResponseSchema = exports_external.object({
238253
- status: exports_external.enum(["deployed", "unchanged"])
238254
- });
238255
- var FunctionInfoSchema = exports_external.object({
238256
- name: exports_external.string(),
238257
- deployment_id: exports_external.string(),
238258
- entry: exports_external.string(),
238259
- files: exports_external.array(FunctionFileSchema),
238260
- automations: exports_external.array(AutomationSchema)
238261
- }).transform((data) => ({
238262
- name: data.name,
238263
- deploymentId: data.deployment_id,
238264
- entry: data.entry,
238265
- files: data.files,
238266
- automations: data.automations
238267
- }));
238268
- var ListFunctionsResponseSchema = exports_external.object({
238269
- functions: exports_external.array(FunctionInfoSchema)
238252
+ var DeployFunctionsResponseSchema = exports_external.object({
238253
+ deployed: exports_external.array(exports_external.string()),
238254
+ deleted: exports_external.array(exports_external.string()),
238255
+ skipped: exports_external.array(exports_external.string()).optional().nullable(),
238256
+ errors: exports_external.array(exports_external.object({ name: exports_external.string(), message: exports_external.string() })).nullable()
238270
238257
  });
238271
238258
  var LogLevelSchema = exports_external.enum(["info", "warning", "error", "debug"]);
238272
238259
  var FunctionLogEntrySchema = exports_external.object({
@@ -238277,39 +238264,29 @@ var FunctionLogEntrySchema = exports_external.object({
238277
238264
  var FunctionLogsResponseSchema = exports_external.array(FunctionLogEntrySchema);
238278
238265
 
238279
238266
  // src/core/resources/function/api.ts
238280
- async function deploySingleFunction(name2, payload) {
238281
- const appClient = getAppClient();
238282
- let response;
238283
- try {
238284
- response = await appClient.put(`backend-functions/${encodeURIComponent(name2)}`, { json: payload, timeout: false });
238285
- } catch (error48) {
238286
- throw await ApiError.fromHttpError(error48, `deploying function "${name2}"`);
238287
- }
238288
- const result = DeploySingleFunctionResponseSchema.safeParse(await response.json());
238289
- if (!result.success) {
238290
- throw new SchemaValidationError("Invalid response from server", result.error);
238291
- }
238292
- return result.data;
238293
- }
238294
- async function deleteSingleFunction(name2) {
238295
- const appClient = getAppClient();
238296
- try {
238297
- await appClient.delete(`backend-functions/${encodeURIComponent(name2)}`, {
238298
- timeout: 60000
238299
- });
238300
- } catch (error48) {
238301
- throw await ApiError.fromHttpError(error48, `deleting function "${name2}"`);
238302
- }
238267
+ function toDeployPayloadItem(fn) {
238268
+ return {
238269
+ name: fn.name,
238270
+ entry: fn.entry,
238271
+ files: fn.files,
238272
+ automations: fn.automations
238273
+ };
238303
238274
  }
238304
- async function listDeployedFunctions() {
238275
+ async function deployFunctions(functions) {
238305
238276
  const appClient = getAppClient();
238277
+ const payload = {
238278
+ functions: functions.map(toDeployPayloadItem)
238279
+ };
238306
238280
  let response;
238307
238281
  try {
238308
- response = await appClient.get("backend-functions", { timeout: 30000 });
238282
+ response = await appClient.put("backend-functions", {
238283
+ json: payload,
238284
+ timeout: false
238285
+ });
238309
238286
  } catch (error48) {
238310
- throw await ApiError.fromHttpError(error48, "listing deployed functions");
238287
+ throw await ApiError.fromHttpError(error48, "deploying functions");
238311
238288
  }
238312
- const result = ListFunctionsResponseSchema.safeParse(await response.json());
238289
+ const result = DeployFunctionsResponseSchema.safeParse(await response.json());
238313
238290
  if (!result.success) {
238314
238291
  throw new SchemaValidationError("Invalid response from server", result.error);
238315
238292
  }
@@ -238432,130 +238409,24 @@ async function readAllFunctions(functionsDir) {
238432
238409
  import { dirname as dirname4, relative as relative2 } from "node:path";
238433
238410
  async function loadFunctionCode(fn) {
238434
238411
  const functionDir = dirname4(fn.entryPath);
238435
- const resolvedFiles = await Promise.all(fn.filePaths.map(async (filePath) => {
238412
+ const loadedFiles = await Promise.all(fn.filePaths.map(async (filePath) => {
238436
238413
  const content = await readTextFile(filePath);
238437
238414
  const path11 = relative2(functionDir, filePath).split(/[/\\]/).join("/");
238438
238415
  return { path: path11, content };
238439
238416
  }));
238440
- return { ...fn, files: resolvedFiles };
238417
+ return { ...fn, files: loadedFiles };
238441
238418
  }
238442
- async function deployOne(fn) {
238443
- const start = Date.now();
238444
- try {
238445
- const functionWithCode = await loadFunctionCode(fn);
238446
- const response = await deploySingleFunction(functionWithCode.name, {
238447
- entry: functionWithCode.entry,
238448
- files: functionWithCode.files,
238449
- automations: functionWithCode.automations
238450
- });
238451
- return {
238452
- name: functionWithCode.name,
238453
- status: response.status,
238454
- durationMs: Date.now() - start
238455
- };
238456
- } catch (error48) {
238457
- return {
238458
- name: fn.name,
238459
- status: "error",
238460
- error: error48 instanceof Error ? error48.message : String(error48)
238461
- };
238462
- }
238463
- }
238464
- async function deployFunctionsSequentially(functions, options) {
238465
- if (functions.length === 0)
238466
- return [];
238467
- const results = [];
238468
- for (const fn of functions) {
238469
- options?.onStart?.([fn.name]);
238470
- const result = await deployOne(fn);
238471
- results.push(result);
238472
- options?.onResult?.(result);
238473
- }
238474
- return results;
238475
- }
238476
- async function pruneRemovedFunctions(localFunctionNames) {
238477
- const remote = await listDeployedFunctions();
238478
- const localSet = new Set(localFunctionNames);
238479
- const toDelete = remote.functions.filter((f) => !localSet.has(f.name));
238480
- const results = [];
238481
- for (const fn of toDelete) {
238482
- try {
238483
- await deleteSingleFunction(fn.name);
238484
- results.push({ name: fn.name, deleted: true });
238485
- } catch (error48) {
238486
- results.push({
238487
- name: fn.name,
238488
- deleted: false,
238489
- error: error48 instanceof Error ? error48.message : String(error48)
238490
- });
238491
- }
238492
- }
238493
- return results;
238494
- }
238495
- // src/core/resources/function/pull.ts
238496
- import { join as join6 } from "node:path";
238497
- import { isDeepStrictEqual as isDeepStrictEqual3 } from "node:util";
238498
- async function writeFunctions(functionsDir, functions) {
238499
- const written = [];
238500
- const skipped = [];
238501
- for (const fn of functions) {
238502
- const functionDir = join6(functionsDir, fn.name);
238503
- const configPath = join6(functionDir, "function.jsonc");
238504
- if (await isFunctionUnchanged(functionDir, fn)) {
238505
- skipped.push(fn.name);
238506
- continue;
238507
- }
238508
- const config5 = {
238509
- name: fn.name,
238510
- entry: fn.entry
238511
- };
238512
- if (fn.automations.length > 0) {
238513
- config5.automations = fn.automations;
238514
- }
238515
- await writeJsonFile(configPath, config5);
238516
- for (const file2 of fn.files) {
238517
- await writeFile(join6(functionDir, file2.path), file2.content);
238518
- }
238519
- written.push(fn.name);
238520
- }
238521
- return { written, skipped };
238522
- }
238523
- async function isFunctionUnchanged(functionDir, fn) {
238524
- if (!await pathExists(functionDir)) {
238525
- return false;
238526
- }
238527
- const configPath = join6(functionDir, "function.jsonc");
238528
- try {
238529
- const localConfig = await readJsonFile(configPath);
238530
- if (localConfig.entry !== fn.entry) {
238531
- return false;
238532
- }
238533
- if (!isDeepStrictEqual3(localConfig.automations ?? [], fn.automations)) {
238534
- return false;
238535
- }
238536
- } catch {
238537
- return false;
238538
- }
238539
- for (const file2 of fn.files) {
238540
- const filePath = join6(functionDir, file2.path);
238541
- if (!await pathExists(filePath)) {
238542
- return false;
238543
- }
238544
- try {
238545
- const localContent = await readTextFile(filePath);
238546
- if (localContent !== file2.content) {
238547
- return false;
238548
- }
238549
- } catch {
238550
- return false;
238551
- }
238419
+ async function pushFunctions(functions) {
238420
+ if (functions.length === 0) {
238421
+ return { deployed: [], deleted: [], skipped: [], errors: null };
238552
238422
  }
238553
- return true;
238423
+ const functionsWithCode = await Promise.all(functions.map(loadFunctionCode));
238424
+ return deployFunctions(functionsWithCode);
238554
238425
  }
238555
238426
  // src/core/resources/function/resource.ts
238556
238427
  var functionResource = {
238557
238428
  readAll: readAllFunctions,
238558
- push: (functions) => deployFunctionsSequentially(functions)
238429
+ push: pushFunctions
238559
238430
  };
238560
238431
  // src/core/project/config.ts
238561
238432
  async function findConfigInDir(dir) {
@@ -238596,10 +238467,10 @@ async function readProjectConfig(projectRoot) {
238596
238467
  const project = result.data;
238597
238468
  const configDir = dirname5(configPath);
238598
238469
  const [entities, functions, agents, connectors] = await Promise.all([
238599
- entityResource.readAll(join7(configDir, project.entitiesDir)),
238600
- functionResource.readAll(join7(configDir, project.functionsDir)),
238601
- agentResource.readAll(join7(configDir, project.agentsDir)),
238602
- connectorResource.readAll(join7(configDir, project.connectorsDir))
238470
+ entityResource.readAll(join6(configDir, project.entitiesDir)),
238471
+ functionResource.readAll(join6(configDir, project.functionsDir)),
238472
+ agentResource.readAll(join6(configDir, project.agentsDir)),
238473
+ connectorResource.readAll(join6(configDir, project.connectorsDir))
238603
238474
  ]);
238604
238475
  return {
238605
238476
  project: { ...project, root, configPath },
@@ -238696,12 +238567,12 @@ async function readAppConfig(projectRoot) {
238696
238567
  // src/core/project/template.ts
238697
238568
  var import_ejs = __toESM(require_ejs(), 1);
238698
238569
  var import_front_matter = __toESM(require_front_matter(), 1);
238699
- import { dirname as dirname6, join as join9 } from "node:path";
238570
+ import { dirname as dirname6, join as join8 } from "node:path";
238700
238571
 
238701
238572
  // src/core/assets.ts
238702
238573
  import { cpSync, existsSync } from "node:fs";
238703
238574
  import { homedir as homedir2 } from "node:os";
238704
- import { join as join8 } from "node:path";
238575
+ import { join as join7 } from "node:path";
238705
238576
  // package.json
238706
238577
  var package_default = {
238707
238578
  name: "base44",
@@ -238794,15 +238665,15 @@ var package_default = {
238794
238665
  };
238795
238666
 
238796
238667
  // src/core/assets.ts
238797
- var ASSETS_DIR = join8(homedir2(), ".base44", "assets", package_default.version);
238668
+ var ASSETS_DIR = join7(homedir2(), ".base44", "assets", package_default.version);
238798
238669
  function getTemplatesDir() {
238799
- return join8(ASSETS_DIR, "templates");
238670
+ return join7(ASSETS_DIR, "templates");
238800
238671
  }
238801
238672
  function getTemplatesIndexPath() {
238802
- return join8(ASSETS_DIR, "templates", "templates.json");
238673
+ return join7(ASSETS_DIR, "templates", "templates.json");
238803
238674
  }
238804
238675
  function getDenoWrapperPath() {
238805
- return join8(ASSETS_DIR, "deno-runtime", "main.js");
238676
+ return join7(ASSETS_DIR, "deno-runtime", "main.js");
238806
238677
  }
238807
238678
  function ensureNpmAssets(sourceDir) {
238808
238679
  if (existsSync(ASSETS_DIR))
@@ -238823,23 +238694,23 @@ async function listTemplates() {
238823
238694
  return result.data.templates;
238824
238695
  }
238825
238696
  async function renderTemplate(template, destPath, data) {
238826
- const templateDir = join9(getTemplatesDir(), template.path);
238697
+ const templateDir = join8(getTemplatesDir(), template.path);
238827
238698
  const files = await globby("**/*", {
238828
238699
  cwd: templateDir,
238829
238700
  dot: true,
238830
238701
  onlyFiles: true
238831
238702
  });
238832
238703
  for (const file2 of files) {
238833
- const srcPath = join9(templateDir, file2);
238704
+ const srcPath = join8(templateDir, file2);
238834
238705
  try {
238835
238706
  if (file2.endsWith(".ejs")) {
238836
238707
  const rendered = await import_ejs.default.renderFile(srcPath, data);
238837
238708
  const { attributes, body } = import_front_matter.default(rendered);
238838
- const destFile = attributes.outputFileName ? join9(dirname6(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
238839
- const destFilePath = join9(destPath, destFile);
238709
+ const destFile = attributes.outputFileName ? join8(dirname6(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
238710
+ const destFilePath = join8(destPath, destFile);
238840
238711
  await writeFile(destFilePath, body);
238841
238712
  } else {
238842
- const destFilePath = join9(destPath, file2);
238713
+ const destFilePath = join8(destPath, file2);
238843
238714
  await copyFile(srcPath, destFilePath);
238844
238715
  }
238845
238716
  } catch (error48) {
@@ -238938,7 +238809,7 @@ async function getSiteFilePaths(outputDir) {
238938
238809
  // src/core/site/deploy.ts
238939
238810
  import { randomUUID } from "node:crypto";
238940
238811
  import { tmpdir } from "node:os";
238941
- import { join as join10 } from "node:path";
238812
+ import { join as join9 } from "node:path";
238942
238813
  async function deploySite(siteOutputDir) {
238943
238814
  if (!await pathExists(siteOutputDir)) {
238944
238815
  throw new InvalidInputError(`Output directory does not exist: ${siteOutputDir}. Make sure to build your project first.`, {
@@ -238955,7 +238826,7 @@ async function deploySite(siteOutputDir) {
238955
238826
  ]
238956
238827
  });
238957
238828
  }
238958
- const archivePath = join10(tmpdir(), `base44-site-${randomUUID()}.tar.gz`);
238829
+ const archivePath = join9(tmpdir(), `base44-site-${randomUUID()}.tar.gz`);
238959
238830
  try {
238960
238831
  await createArchive(siteOutputDir, archivePath);
238961
238832
  return await uploadSite(archivePath);
@@ -238980,13 +238851,10 @@ function hasResourcesToDeploy(projectData) {
238980
238851
  const hasConnectors = connectors.length > 0;
238981
238852
  return hasEntities || hasFunctions || hasAgents || hasConnectors || hasSite;
238982
238853
  }
238983
- async function deployAll(projectData, options) {
238854
+ async function deployAll(projectData) {
238984
238855
  const { project, entities, functions, agents, connectors } = projectData;
238985
238856
  await entityResource.push(entities);
238986
- await deployFunctionsSequentially(functions, {
238987
- onStart: options?.onFunctionStart,
238988
- onResult: options?.onFunctionResult
238989
- });
238857
+ await functionResource.push(functions);
238990
238858
  await agentResource.push(agents);
238991
238859
  const { results: connectorResults } = await pushConnectors(connectors);
238992
238860
  if (project.site?.outputDirectory) {
@@ -246743,7 +246611,7 @@ function formatYaml(data, options = {}) {
246743
246611
  async function pullAgentsAction() {
246744
246612
  const { project: project2 } = await readProjectConfig();
246745
246613
  const configDir = dirname7(project2.configPath);
246746
- const agentsDir = join11(configDir, project2.agentsDir);
246614
+ const agentsDir = join10(configDir, project2.agentsDir);
246747
246615
  const remoteAgents = await runTask("Fetching agents from Base44", async () => {
246748
246616
  return await fetchAgents();
246749
246617
  }, {
@@ -246865,11 +246733,11 @@ function getConnectorsListAvailableCommand(context) {
246865
246733
  }
246866
246734
 
246867
246735
  // src/cli/commands/connectors/pull.ts
246868
- import { dirname as dirname8, join as join12 } from "node:path";
246736
+ import { dirname as dirname8, join as join11 } from "node:path";
246869
246737
  async function pullConnectorsAction() {
246870
246738
  const { project: project2 } = await readProjectConfig();
246871
246739
  const configDir = dirname8(project2.configPath);
246872
- const connectorsDir = join12(configDir, project2.connectorsDir);
246740
+ const connectorsDir = join11(configDir, project2.connectorsDir);
246873
246741
  const remoteConnectors = await runTask("Fetching connectors from Base44", async () => {
246874
246742
  return await pullAllConnectors();
246875
246743
  }, {
@@ -247738,229 +247606,46 @@ function getEntitiesPushCommand(context) {
247738
247606
  }));
247739
247607
  }
247740
247608
 
247741
- // src/cli/commands/functions/delete.ts
247742
- async function deleteFunctionsAction(names) {
247743
- let deleted = 0;
247744
- let notFound = 0;
247745
- let errors5 = 0;
247746
- for (const name2 of names) {
247747
- try {
247748
- await runTask(`Deleting ${name2}...`, () => deleteSingleFunction(name2), {
247749
- successMessage: `${name2} deleted`,
247750
- errorMessage: `Failed to delete ${name2}`
247751
- });
247752
- deleted++;
247753
- } catch (error48) {
247754
- if (error48 instanceof ApiError && error48.statusCode === 404) {
247755
- notFound++;
247756
- } else {
247757
- errors5++;
247758
- }
247759
- }
247760
- }
247761
- if (names.length === 1) {
247762
- if (deleted)
247763
- return { outroMessage: `Function "${names[0]}" deleted` };
247764
- if (notFound)
247765
- return { outroMessage: `Function "${names[0]}" not found` };
247766
- return { outroMessage: `Failed to delete "${names[0]}"` };
247767
- }
247768
- const total = names.length;
247769
- const parts = [];
247770
- if (deleted > 0)
247771
- parts.push(`${deleted}/${total} deleted`);
247772
- if (notFound > 0)
247773
- parts.push(`${notFound} not found`);
247774
- if (errors5 > 0)
247775
- parts.push(`${errors5} error${errors5 !== 1 ? "s" : ""}`);
247776
- return { outroMessage: parts.join(", ") };
247777
- }
247778
- function parseNames(args) {
247779
- return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
247780
- }
247781
- function validateNames(command) {
247782
- const names = parseNames(command.args);
247783
- if (names.length === 0) {
247784
- command.error("At least one function name is required");
247785
- }
247786
- }
247787
- function getDeleteCommand(context) {
247788
- return new Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").hook("preAction", validateNames).action(async (rawNames) => {
247789
- const names = parseNames(rawNames);
247790
- await runCommand(() => deleteFunctionsAction(names), { requireAuth: true }, context);
247791
- });
247792
- }
247793
-
247794
- // src/cli/commands/functions/formatDeployResult.ts
247795
- function formatDuration(ms) {
247796
- return `${(ms / 1000).toFixed(1)}s`;
247797
- }
247798
- function formatDeployResult(result) {
247799
- const label = result.name.padEnd(25);
247800
- if (result.status === "deployed") {
247801
- const timing = result.durationMs ? theme.styles.dim(` (${formatDuration(result.durationMs)})`) : "";
247802
- R2.success(`${label} deployed${timing}`);
247803
- } else if (result.status === "unchanged") {
247804
- R2.success(`${label} unchanged`);
247805
- } else {
247806
- R2.error(`${label} error: ${result.error}`);
247807
- }
247808
- }
247809
-
247810
- // src/cli/commands/functions/parseNames.ts
247811
- function parseNames2(args) {
247812
- return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
247813
- }
247814
-
247815
247609
  // src/cli/commands/functions/deploy.ts
247816
- function resolveFunctionsToDeploy(names, allFunctions) {
247817
- if (names.length === 0)
247818
- return allFunctions;
247819
- const notFound = names.filter((n2) => !allFunctions.some((f) => f.name === n2));
247820
- if (notFound.length > 0) {
247821
- throw new InvalidInputError(`Function${notFound.length > 1 ? "s" : ""} not found in project: ${notFound.join(", ")}`);
247822
- }
247823
- return allFunctions.filter((f) => names.includes(f.name));
247824
- }
247825
- function formatPruneResults(pruneResults) {
247826
- for (const pruneResult of pruneResults) {
247827
- if (pruneResult.deleted) {
247828
- R2.success(`${pruneResult.name.padEnd(25)} deleted`);
247829
- } else {
247830
- R2.error(`${pruneResult.name.padEnd(25)} error: ${pruneResult.error}`);
247831
- }
247832
- }
247833
- if (pruneResults.length > 0) {
247834
- const pruned = pruneResults.filter((r) => r.deleted).length;
247835
- R2.info(`${pruned} function${pruned !== 1 ? "s" : ""} removed`);
247836
- }
247837
- }
247838
- function buildDeploySummary(results) {
247839
- const deployed = results.filter((r) => r.status === "deployed").length;
247840
- const unchanged = results.filter((r) => r.status === "unchanged").length;
247841
- const failed = results.filter((r) => r.status === "error").length;
247842
- const parts = [];
247843
- if (deployed > 0)
247844
- parts.push(`${deployed} deployed`);
247845
- if (unchanged > 0)
247846
- parts.push(`${unchanged} unchanged`);
247847
- if (failed > 0)
247848
- parts.push(`${failed} error${failed !== 1 ? "s" : ""}`);
247849
- return parts.join(", ") || "No functions deployed";
247850
- }
247851
- async function deployFunctionsAction(names, options) {
247852
- if (options.force && names.length > 0) {
247853
- throw new InvalidInputError("--force cannot be used when specifying function names");
247854
- }
247610
+ async function deployFunctionsAction() {
247855
247611
  const { functions } = await readProjectConfig();
247856
- const toDeploy = resolveFunctionsToDeploy(names, functions);
247857
- if (toDeploy.length === 0) {
247612
+ if (functions.length === 0) {
247858
247613
  return {
247859
247614
  outroMessage: "No functions found. Create functions in the 'functions' directory."
247860
247615
  };
247861
247616
  }
247862
- R2.info(`Found ${toDeploy.length} ${toDeploy.length === 1 ? "function" : "functions"} to deploy`);
247863
- let completed = 0;
247864
- const total = toDeploy.length;
247865
- const results = await deployFunctionsSequentially(toDeploy, {
247866
- onStart: (startNames) => {
247867
- const label = startNames.length === 1 ? startNames[0] : `${startNames.length} functions`;
247868
- R2.step(theme.styles.dim(`[${completed + 1}/${total}] Deploying ${label}...`));
247869
- },
247870
- onResult: (result) => {
247871
- completed++;
247872
- formatDeployResult(result);
247873
- }
247874
- });
247875
- if (options.force) {
247876
- R2.info("Removing remote functions not found locally...");
247877
- const allLocalNames = functions.map((f) => f.name);
247878
- const pruneResults = await pruneRemovedFunctions(allLocalNames);
247879
- formatPruneResults(pruneResults);
247880
- }
247881
- return { outroMessage: buildDeploySummary(results) };
247882
- }
247883
- function getDeployCommand(context) {
247884
- 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) => {
247885
- await runCommand(() => {
247886
- const names = parseNames2(rawNames);
247887
- return deployFunctionsAction(names, options);
247888
- }, { requireAuth: true }, context);
247889
- });
247890
- }
247891
-
247892
- // src/cli/commands/functions/list.ts
247893
- async function listFunctionsAction() {
247894
- const { functions } = await runTask("Fetching functions...", async () => listDeployedFunctions(), { errorMessage: "Failed to fetch functions" });
247895
- if (functions.length === 0) {
247896
- return { outroMessage: "No functions on remote" };
247897
- }
247898
- for (const fn of functions) {
247899
- const automationCount = fn.automations.length;
247900
- const automationLabel = automationCount > 0 ? theme.styles.dim(` (${automationCount} automation${automationCount > 1 ? "s" : ""})`) : "";
247901
- R2.message(` ${fn.name}${automationLabel}`);
247902
- }
247903
- return {
247904
- outroMessage: `${functions.length} function${functions.length !== 1 ? "s" : ""} on remote`
247905
- };
247906
- }
247907
- function getListCommand(context) {
247908
- return new Command("list").description("List all deployed functions").action(async () => {
247909
- await runCommand(listFunctionsAction, { requireAuth: true }, context);
247910
- });
247911
- }
247912
-
247913
- // src/cli/commands/functions/pull.ts
247914
- import { dirname as dirname9, join as join13 } from "node:path";
247915
- async function pullFunctionsAction(name2) {
247916
- const { project: project2 } = await readProjectConfig();
247917
- const configDir = dirname9(project2.configPath);
247918
- const functionsDir = join13(configDir, project2.functionsDir);
247919
- const remoteFunctions = await runTask("Fetching functions from Base44", async () => {
247920
- const { functions } = await listDeployedFunctions();
247921
- return functions;
247617
+ R2.info(`Found ${functions.length} ${functions.length === 1 ? "function" : "functions"} to deploy`);
247618
+ const result = await runTask("Deploying functions to Base44", async () => {
247619
+ return await pushFunctions(functions);
247922
247620
  }, {
247923
- successMessage: "Functions fetched successfully",
247924
- errorMessage: "Failed to fetch functions"
247621
+ successMessage: "Functions deployed successfully",
247622
+ errorMessage: "Failed to deploy functions"
247925
247623
  });
247926
- const toPull = name2 ? remoteFunctions.filter((f) => f.name === name2) : remoteFunctions;
247927
- if (name2 && toPull.length === 0) {
247928
- return {
247929
- outroMessage: `Function "${name2}" not found on remote`
247930
- };
247624
+ if (result.deployed.length > 0) {
247625
+ R2.success(`Deployed: ${result.deployed.join(", ")}`);
247931
247626
  }
247932
- if (toPull.length === 0) {
247933
- return { outroMessage: "No functions found on remote" };
247934
- }
247935
- const { written, skipped } = await runTask("Writing function files", async () => {
247936
- return await writeFunctions(functionsDir, toPull);
247937
- }, {
247938
- successMessage: "Function files written successfully",
247939
- errorMessage: "Failed to write function files"
247940
- });
247941
- for (const name3 of written) {
247942
- R2.success(`${name3.padEnd(25)} written`);
247627
+ if (result.deleted.length > 0) {
247628
+ R2.warn(`Deleted: ${result.deleted.join(", ")}`);
247943
247629
  }
247944
- for (const name3 of skipped) {
247945
- R2.info(`${name3.padEnd(25)} unchanged`);
247630
+ if (result.errors && result.errors.length > 0) {
247631
+ throw new ApiError("Function deployment errors", {
247632
+ details: result.errors.map((e2) => `'${e2.name}': ${e2.message}`),
247633
+ hints: [
247634
+ { message: "Check the function code for syntax errors" },
247635
+ { message: "Ensure all imports are valid" }
247636
+ ]
247637
+ });
247946
247638
  }
247947
- return {
247948
- outroMessage: `Pulled ${toPull.length} function${toPull.length !== 1 ? "s" : ""} to ${functionsDir}`
247949
- };
247639
+ return { outroMessage: "Functions deployed to Base44" };
247950
247640
  }
247951
- function getPullCommand(context) {
247952
- return new Command("pull").description("Pull deployed functions from Base44").argument("[name]", "Pull a single function by name").action(async (name2) => {
247953
- await runCommand(() => pullFunctionsAction(name2), { requireAuth: true }, context);
247954
- });
247955
- }
247956
-
247957
- // src/cli/commands/functions/index.ts
247958
- function getFunctionsCommand(context) {
247959
- return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getDeleteCommand(context)).addCommand(getListCommand(context)).addCommand(getPullCommand(context));
247641
+ function getFunctionsDeployCommand(context) {
247642
+ return new Command("functions").description("Manage project functions").addCommand(new Command("deploy").description("Deploy local functions to Base44").action(async () => {
247643
+ await runCommand(deployFunctionsAction, { requireAuth: true }, context);
247644
+ }));
247960
247645
  }
247961
247646
 
247962
247647
  // src/cli/commands/project/create.ts
247963
- import { basename as basename3, join as join14, resolve as resolve2 } from "node:path";
247648
+ import { basename as basename3, join as join12, resolve as resolve2 } from "node:path";
247964
247649
  var import_kebabCase = __toESM(require_kebabCase(), 1);
247965
247650
  var DEFAULT_TEMPLATE_ID = "backend-only";
247966
247651
  async function getTemplateById(templateId) {
@@ -248097,7 +247782,7 @@ async function executeCreate({
248097
247782
  updateMessage("Building project...");
248098
247783
  await execa({ cwd: resolvedPath, shell: true })`${buildCommand}`;
248099
247784
  updateMessage("Deploying site...");
248100
- return await deploySite(join14(resolvedPath, outputDirectory));
247785
+ return await deploySite(join12(resolvedPath, outputDirectory));
248101
247786
  }, {
248102
247787
  successMessage: theme.colors.base44Orange("Site deployed successfully"),
248103
247788
  errorMessage: "Failed to deploy site"
@@ -248184,17 +247869,11 @@ ${summaryLines.join(`
248184
247869
  ${summaryLines.join(`
248185
247870
  `)}`);
248186
247871
  }
248187
- let functionCompleted = 0;
248188
- const functionTotal = functions.length;
248189
- const result = await deployAll(projectData, {
248190
- onFunctionStart: (names) => {
248191
- const label = names.length === 1 ? names[0] : `${names.length} functions`;
248192
- R2.step(theme.styles.dim(`[${functionCompleted + 1}/${functionTotal}] Deploying ${label}...`));
248193
- },
248194
- onFunctionResult: (r) => {
248195
- functionCompleted++;
248196
- formatDeployResult(r);
248197
- }
247872
+ const result = await runTask("Deploying your app...", async () => {
247873
+ return await deployAll(projectData);
247874
+ }, {
247875
+ successMessage: theme.colors.base44Orange("Deployment completed"),
247876
+ errorMessage: "Deployment failed"
248198
247877
  });
248199
247878
  const connectorResults = result.connectorResults ?? [];
248200
247879
  await handleOAuthConnectors(connectorResults, options);
@@ -248208,7 +247887,7 @@ ${summaryLines.join(`
248208
247887
  }
248209
247888
  return { outroMessage: "App deployed successfully" };
248210
247889
  }
248211
- function getDeployCommand2(context) {
247890
+ function getDeployCommand(context) {
248212
247891
  return new Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").action(async (options) => {
248213
247892
  await runCommand(() => deployAction({
248214
247893
  ...options,
@@ -248753,10 +248432,10 @@ function toPascalCase(name2) {
248753
248432
  return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
248754
248433
  }
248755
248434
  // src/core/types/update-project.ts
248756
- import { join as join17 } from "node:path";
248435
+ import { join as join15 } from "node:path";
248757
248436
  var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
248758
248437
  async function updateProjectConfig(projectRoot) {
248759
- const tsconfigPath = join17(projectRoot, "tsconfig.json");
248438
+ const tsconfigPath = join15(projectRoot, "tsconfig.json");
248760
248439
  if (!await pathExists(tsconfigPath)) {
248761
248440
  return false;
248762
248441
  }
@@ -248799,7 +248478,7 @@ function getTypesCommand(context) {
248799
248478
  }
248800
248479
 
248801
248480
  // src/cli/dev/dev-server/main.ts
248802
- import { dirname as dirname14, join as join20 } from "node:path";
248481
+ import { dirname as dirname13, join as join18 } from "node:path";
248803
248482
  var import_cors = __toESM(require_lib4(), 1);
248804
248483
  var import_express4 = __toESM(require_express(), 1);
248805
248484
 
@@ -250279,9 +249958,9 @@ class NodeFsHandler {
250279
249958
  if (this.fsw.closed) {
250280
249959
  return;
250281
249960
  }
250282
- const dirname13 = sp2.dirname(file2);
249961
+ const dirname12 = sp2.dirname(file2);
250283
249962
  const basename5 = sp2.basename(file2);
250284
- const parent = this.fsw._getWatchedDir(dirname13);
249963
+ const parent = this.fsw._getWatchedDir(dirname12);
250285
249964
  let prevStats = stats;
250286
249965
  if (parent.has(basename5))
250287
249966
  return;
@@ -250308,7 +249987,7 @@ class NodeFsHandler {
250308
249987
  prevStats = newStats2;
250309
249988
  }
250310
249989
  } catch (error48) {
250311
- this.fsw._remove(dirname13, basename5);
249990
+ this.fsw._remove(dirname12, basename5);
250312
249991
  }
250313
249992
  } else if (parent.has(basename5)) {
250314
249993
  const at13 = newStats.atimeMs;
@@ -251329,8 +251008,8 @@ async function createDevServer(options8) {
251329
251008
  broadcastEntityEvent(io6, appId, entityName, event);
251330
251009
  };
251331
251010
  const base44ConfigWatcher = new WatchBase44({
251332
- functions: join20(dirname14(project2.configPath), project2.functionsDir),
251333
- entities: join20(dirname14(project2.configPath), project2.entitiesDir)
251011
+ functions: join18(dirname13(project2.configPath), project2.functionsDir),
251012
+ entities: join18(dirname13(project2.configPath), project2.entitiesDir)
251334
251013
  }, devLogger);
251335
251014
  base44ConfigWatcher.on("change", async (name2) => {
251336
251015
  try {
@@ -251500,13 +251179,13 @@ function createProgram(context) {
251500
251179
  program2.addCommand(getLogoutCommand(context));
251501
251180
  program2.addCommand(getCreateCommand(context));
251502
251181
  program2.addCommand(getDashboardCommand(context));
251503
- program2.addCommand(getDeployCommand2(context));
251182
+ program2.addCommand(getDeployCommand(context));
251504
251183
  program2.addCommand(getLinkCommand(context));
251505
251184
  program2.addCommand(getEjectCommand(context));
251506
251185
  program2.addCommand(getEntitiesPushCommand(context));
251507
251186
  program2.addCommand(getAgentsCommand(context));
251508
251187
  program2.addCommand(getConnectorsCommand(context));
251509
- program2.addCommand(getFunctionsCommand(context));
251188
+ program2.addCommand(getFunctionsDeployCommand(context));
251510
251189
  program2.addCommand(getSecretsCommand(context));
251511
251190
  program2.addCommand(getSiteCommand(context));
251512
251191
  program2.addCommand(getTypesCommand(context));
@@ -251520,7 +251199,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
251520
251199
  import { release, type } from "node:os";
251521
251200
 
251522
251201
  // ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
251523
- import { dirname as dirname15, posix, sep } from "path";
251202
+ import { dirname as dirname14, posix, sep } from "path";
251524
251203
  function createModulerModifier() {
251525
251204
  const getModuleFromFileName = createGetModuleFromFilename();
251526
251205
  return async (frames) => {
@@ -251529,7 +251208,7 @@ function createModulerModifier() {
251529
251208
  return frames;
251530
251209
  };
251531
251210
  }
251532
- function createGetModuleFromFilename(basePath = process.argv[1] ? dirname15(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
251211
+ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname14(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
251533
251212
  const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
251534
251213
  return (filename) => {
251535
251214
  if (!filename)
@@ -255718,9 +255397,9 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
255718
255397
  });
255719
255398
  }
255720
255399
  // src/cli/index.ts
255721
- var __dirname4 = dirname16(fileURLToPath6(import.meta.url));
255400
+ var __dirname4 = dirname15(fileURLToPath6(import.meta.url));
255722
255401
  async function runCLI(options8) {
255723
- ensureNpmAssets(join21(__dirname4, "../assets"));
255402
+ ensureNpmAssets(join19(__dirname4, "../assets"));
255724
255403
  const errorReporter = new ErrorReporter;
255725
255404
  errorReporter.registerProcessErrorHandlers();
255726
255405
  const isNonInteractive = !process.stdin.isTTY || !process.stdout.isTTY;
@@ -255753,4 +255432,4 @@ export {
255753
255432
  CLIExitError
255754
255433
  };
255755
255434
 
255756
- //# debugId=8533D2C01A675ED464756E2164756E21
255435
+ //# debugId=3630160A15E12A6F64756E2164756E21