@base44-preview/cli 0.0.44-pr.412.e87fc06 → 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,135 +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 };
238441
- }
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, options) {
238477
- const remote = await listDeployedFunctions();
238478
- const localSet = new Set(localFunctionNames);
238479
- const toDelete = remote.functions.filter((f) => !localSet.has(f.name));
238480
- options?.onStart?.(toDelete.length);
238481
- const results = [];
238482
- for (const fn of toDelete) {
238483
- options?.onBeforeDelete?.(fn.name);
238484
- let result;
238485
- try {
238486
- await deleteSingleFunction(fn.name);
238487
- result = { name: fn.name, deleted: true };
238488
- } catch (error48) {
238489
- result = {
238490
- name: fn.name,
238491
- deleted: false,
238492
- error: error48 instanceof Error ? error48.message : String(error48)
238493
- };
238494
- }
238495
- results.push(result);
238496
- options?.onResult?.(result);
238497
- }
238498
- return results;
238499
- }
238500
- // src/core/resources/function/pull.ts
238501
- import { join as join6 } from "node:path";
238502
- import { isDeepStrictEqual as isDeepStrictEqual3 } from "node:util";
238503
- async function writeFunctions(functionsDir, functions) {
238504
- const written = [];
238505
- const skipped = [];
238506
- for (const fn of functions) {
238507
- const functionDir = join6(functionsDir, fn.name);
238508
- const configPath = join6(functionDir, "function.jsonc");
238509
- if (await isFunctionUnchanged(functionDir, fn)) {
238510
- skipped.push(fn.name);
238511
- continue;
238512
- }
238513
- const config5 = {
238514
- name: fn.name,
238515
- entry: fn.entry
238516
- };
238517
- if (fn.automations.length > 0) {
238518
- config5.automations = fn.automations;
238519
- }
238520
- await writeJsonFile(configPath, config5);
238521
- for (const file2 of fn.files) {
238522
- await writeFile(join6(functionDir, file2.path), file2.content);
238523
- }
238524
- written.push(fn.name);
238525
- }
238526
- return { written, skipped };
238417
+ return { ...fn, files: loadedFiles };
238527
238418
  }
238528
- async function isFunctionUnchanged(functionDir, fn) {
238529
- if (!await pathExists(functionDir)) {
238530
- return false;
238531
- }
238532
- const configPath = join6(functionDir, "function.jsonc");
238533
- try {
238534
- const localConfig = await readJsonFile(configPath);
238535
- if (localConfig.entry !== fn.entry) {
238536
- return false;
238537
- }
238538
- if (!isDeepStrictEqual3(localConfig.automations ?? [], fn.automations)) {
238539
- return false;
238540
- }
238541
- } catch {
238542
- return false;
238543
- }
238544
- for (const file2 of fn.files) {
238545
- const filePath = join6(functionDir, file2.path);
238546
- if (!await pathExists(filePath)) {
238547
- return false;
238548
- }
238549
- try {
238550
- const localContent = await readTextFile(filePath);
238551
- if (localContent !== file2.content) {
238552
- return false;
238553
- }
238554
- } catch {
238555
- return false;
238556
- }
238419
+ async function pushFunctions(functions) {
238420
+ if (functions.length === 0) {
238421
+ return { deployed: [], deleted: [], skipped: [], errors: null };
238557
238422
  }
238558
- return true;
238423
+ const functionsWithCode = await Promise.all(functions.map(loadFunctionCode));
238424
+ return deployFunctions(functionsWithCode);
238559
238425
  }
238560
238426
  // src/core/resources/function/resource.ts
238561
238427
  var functionResource = {
238562
238428
  readAll: readAllFunctions,
238563
- push: (functions) => deployFunctionsSequentially(functions)
238429
+ push: pushFunctions
238564
238430
  };
238565
238431
  // src/core/project/config.ts
238566
238432
  async function findConfigInDir(dir) {
@@ -238601,10 +238467,10 @@ async function readProjectConfig(projectRoot) {
238601
238467
  const project = result.data;
238602
238468
  const configDir = dirname5(configPath);
238603
238469
  const [entities, functions, agents, connectors] = await Promise.all([
238604
- entityResource.readAll(join7(configDir, project.entitiesDir)),
238605
- functionResource.readAll(join7(configDir, project.functionsDir)),
238606
- agentResource.readAll(join7(configDir, project.agentsDir)),
238607
- 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))
238608
238474
  ]);
238609
238475
  return {
238610
238476
  project: { ...project, root, configPath },
@@ -238701,12 +238567,12 @@ async function readAppConfig(projectRoot) {
238701
238567
  // src/core/project/template.ts
238702
238568
  var import_ejs = __toESM(require_ejs(), 1);
238703
238569
  var import_front_matter = __toESM(require_front_matter(), 1);
238704
- import { dirname as dirname6, join as join9 } from "node:path";
238570
+ import { dirname as dirname6, join as join8 } from "node:path";
238705
238571
 
238706
238572
  // src/core/assets.ts
238707
238573
  import { cpSync, existsSync } from "node:fs";
238708
238574
  import { homedir as homedir2 } from "node:os";
238709
- import { join as join8 } from "node:path";
238575
+ import { join as join7 } from "node:path";
238710
238576
  // package.json
238711
238577
  var package_default = {
238712
238578
  name: "base44",
@@ -238799,15 +238665,15 @@ var package_default = {
238799
238665
  };
238800
238666
 
238801
238667
  // src/core/assets.ts
238802
- var ASSETS_DIR = join8(homedir2(), ".base44", "assets", package_default.version);
238668
+ var ASSETS_DIR = join7(homedir2(), ".base44", "assets", package_default.version);
238803
238669
  function getTemplatesDir() {
238804
- return join8(ASSETS_DIR, "templates");
238670
+ return join7(ASSETS_DIR, "templates");
238805
238671
  }
238806
238672
  function getTemplatesIndexPath() {
238807
- return join8(ASSETS_DIR, "templates", "templates.json");
238673
+ return join7(ASSETS_DIR, "templates", "templates.json");
238808
238674
  }
238809
238675
  function getDenoWrapperPath() {
238810
- return join8(ASSETS_DIR, "deno-runtime", "main.js");
238676
+ return join7(ASSETS_DIR, "deno-runtime", "main.js");
238811
238677
  }
238812
238678
  function ensureNpmAssets(sourceDir) {
238813
238679
  if (existsSync(ASSETS_DIR))
@@ -238828,23 +238694,23 @@ async function listTemplates() {
238828
238694
  return result.data.templates;
238829
238695
  }
238830
238696
  async function renderTemplate(template, destPath, data) {
238831
- const templateDir = join9(getTemplatesDir(), template.path);
238697
+ const templateDir = join8(getTemplatesDir(), template.path);
238832
238698
  const files = await globby("**/*", {
238833
238699
  cwd: templateDir,
238834
238700
  dot: true,
238835
238701
  onlyFiles: true
238836
238702
  });
238837
238703
  for (const file2 of files) {
238838
- const srcPath = join9(templateDir, file2);
238704
+ const srcPath = join8(templateDir, file2);
238839
238705
  try {
238840
238706
  if (file2.endsWith(".ejs")) {
238841
238707
  const rendered = await import_ejs.default.renderFile(srcPath, data);
238842
238708
  const { attributes, body } = import_front_matter.default(rendered);
238843
- const destFile = attributes.outputFileName ? join9(dirname6(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
238844
- const destFilePath = join9(destPath, destFile);
238709
+ const destFile = attributes.outputFileName ? join8(dirname6(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
238710
+ const destFilePath = join8(destPath, destFile);
238845
238711
  await writeFile(destFilePath, body);
238846
238712
  } else {
238847
- const destFilePath = join9(destPath, file2);
238713
+ const destFilePath = join8(destPath, file2);
238848
238714
  await copyFile(srcPath, destFilePath);
238849
238715
  }
238850
238716
  } catch (error48) {
@@ -238943,7 +238809,7 @@ async function getSiteFilePaths(outputDir) {
238943
238809
  // src/core/site/deploy.ts
238944
238810
  import { randomUUID } from "node:crypto";
238945
238811
  import { tmpdir } from "node:os";
238946
- import { join as join10 } from "node:path";
238812
+ import { join as join9 } from "node:path";
238947
238813
  async function deploySite(siteOutputDir) {
238948
238814
  if (!await pathExists(siteOutputDir)) {
238949
238815
  throw new InvalidInputError(`Output directory does not exist: ${siteOutputDir}. Make sure to build your project first.`, {
@@ -238960,7 +238826,7 @@ async function deploySite(siteOutputDir) {
238960
238826
  ]
238961
238827
  });
238962
238828
  }
238963
- const archivePath = join10(tmpdir(), `base44-site-${randomUUID()}.tar.gz`);
238829
+ const archivePath = join9(tmpdir(), `base44-site-${randomUUID()}.tar.gz`);
238964
238830
  try {
238965
238831
  await createArchive(siteOutputDir, archivePath);
238966
238832
  return await uploadSite(archivePath);
@@ -238985,13 +238851,10 @@ function hasResourcesToDeploy(projectData) {
238985
238851
  const hasConnectors = connectors.length > 0;
238986
238852
  return hasEntities || hasFunctions || hasAgents || hasConnectors || hasSite;
238987
238853
  }
238988
- async function deployAll(projectData, options) {
238854
+ async function deployAll(projectData) {
238989
238855
  const { project, entities, functions, agents, connectors } = projectData;
238990
238856
  await entityResource.push(entities);
238991
- await deployFunctionsSequentially(functions, {
238992
- onStart: options?.onFunctionStart,
238993
- onResult: options?.onFunctionResult
238994
- });
238857
+ await functionResource.push(functions);
238995
238858
  await agentResource.push(agents);
238996
238859
  const { results: connectorResults } = await pushConnectors(connectors);
238997
238860
  if (project.site?.outputDirectory) {
@@ -246748,7 +246611,7 @@ function formatYaml(data, options = {}) {
246748
246611
  async function pullAgentsAction() {
246749
246612
  const { project: project2 } = await readProjectConfig();
246750
246613
  const configDir = dirname7(project2.configPath);
246751
- const agentsDir = join11(configDir, project2.agentsDir);
246614
+ const agentsDir = join10(configDir, project2.agentsDir);
246752
246615
  const remoteAgents = await runTask("Fetching agents from Base44", async () => {
246753
246616
  return await fetchAgents();
246754
246617
  }, {
@@ -246870,11 +246733,11 @@ function getConnectorsListAvailableCommand(context) {
246870
246733
  }
246871
246734
 
246872
246735
  // src/cli/commands/connectors/pull.ts
246873
- import { dirname as dirname8, join as join12 } from "node:path";
246736
+ import { dirname as dirname8, join as join11 } from "node:path";
246874
246737
  async function pullConnectorsAction() {
246875
246738
  const { project: project2 } = await readProjectConfig();
246876
246739
  const configDir = dirname8(project2.configPath);
246877
- const connectorsDir = join12(configDir, project2.connectorsDir);
246740
+ const connectorsDir = join11(configDir, project2.connectorsDir);
246878
246741
  const remoteConnectors = await runTask("Fetching connectors from Base44", async () => {
246879
246742
  return await pullAllConnectors();
246880
246743
  }, {
@@ -247743,242 +247606,46 @@ function getEntitiesPushCommand(context) {
247743
247606
  }));
247744
247607
  }
247745
247608
 
247746
- // src/cli/commands/functions/delete.ts
247747
- async function deleteFunctionsAction(names) {
247748
- let deleted = 0;
247749
- let notFound = 0;
247750
- let errors5 = 0;
247751
- for (const name2 of names) {
247752
- try {
247753
- await runTask(`Deleting ${name2}...`, () => deleteSingleFunction(name2), {
247754
- successMessage: `${name2} deleted`,
247755
- errorMessage: `Failed to delete ${name2}`
247756
- });
247757
- deleted++;
247758
- } catch (error48) {
247759
- if (error48 instanceof ApiError && error48.statusCode === 404) {
247760
- notFound++;
247761
- } else {
247762
- errors5++;
247763
- }
247764
- }
247765
- }
247766
- if (names.length === 1) {
247767
- if (deleted)
247768
- return { outroMessage: `Function "${names[0]}" deleted` };
247769
- if (notFound)
247770
- return { outroMessage: `Function "${names[0]}" not found` };
247771
- return { outroMessage: `Failed to delete "${names[0]}"` };
247772
- }
247773
- const total = names.length;
247774
- const parts = [];
247775
- if (deleted > 0)
247776
- parts.push(`${deleted}/${total} deleted`);
247777
- if (notFound > 0)
247778
- parts.push(`${notFound} not found`);
247779
- if (errors5 > 0)
247780
- parts.push(`${errors5} error${errors5 !== 1 ? "s" : ""}`);
247781
- return { outroMessage: parts.join(", ") };
247782
- }
247783
- function parseNames(args) {
247784
- return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
247785
- }
247786
- function validateNames(command) {
247787
- const names = parseNames(command.args);
247788
- if (names.length === 0) {
247789
- command.error("At least one function name is required");
247790
- }
247791
- }
247792
- function getDeleteCommand(context) {
247793
- return new Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").hook("preAction", validateNames).action(async (rawNames) => {
247794
- const names = parseNames(rawNames);
247795
- await runCommand(() => deleteFunctionsAction(names), { requireAuth: true }, context);
247796
- });
247797
- }
247798
-
247799
- // src/cli/commands/functions/formatDeployResult.ts
247800
- function formatDuration(ms) {
247801
- return `${(ms / 1000).toFixed(1)}s`;
247802
- }
247803
- function formatDeployResult(result) {
247804
- const label = result.name.padEnd(25);
247805
- if (result.status === "deployed") {
247806
- const timing = result.durationMs ? theme.styles.dim(` (${formatDuration(result.durationMs)})`) : "";
247807
- R2.success(`${label} deployed${timing}`);
247808
- } else if (result.status === "unchanged") {
247809
- R2.success(`${label} unchanged`);
247810
- } else {
247811
- R2.error(`${label} error: ${result.error}`);
247812
- }
247813
- }
247814
-
247815
- // src/cli/commands/functions/parseNames.ts
247816
- function parseNames2(args) {
247817
- return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
247818
- }
247819
-
247820
247609
  // src/cli/commands/functions/deploy.ts
247821
- function resolveFunctionsToDeploy(names, allFunctions) {
247822
- if (names.length === 0)
247823
- return allFunctions;
247824
- const notFound = names.filter((n2) => !allFunctions.some((f) => f.name === n2));
247825
- if (notFound.length > 0) {
247826
- throw new InvalidInputError(`Function${notFound.length > 1 ? "s" : ""} not found in project: ${notFound.join(", ")}`);
247827
- }
247828
- return allFunctions.filter((f) => names.includes(f.name));
247829
- }
247830
- function formatPruneResult(pruneResult) {
247831
- if (pruneResult.deleted) {
247832
- R2.success(`${pruneResult.name.padEnd(25)} deleted`);
247833
- } else {
247834
- R2.error(`${pruneResult.name.padEnd(25)} error: ${pruneResult.error}`);
247835
- }
247836
- }
247837
- function formatPruneSummary(pruneResults) {
247838
- if (pruneResults.length > 0) {
247839
- const pruned = pruneResults.filter((r) => r.deleted).length;
247840
- R2.info(`${pruned} deleted`);
247841
- }
247842
- }
247843
- function buildDeploySummary(results) {
247844
- const deployed = results.filter((r) => r.status === "deployed").length;
247845
- const unchanged = results.filter((r) => r.status === "unchanged").length;
247846
- const failed = results.filter((r) => r.status === "error").length;
247847
- const parts = [];
247848
- if (deployed > 0)
247849
- parts.push(`${deployed} deployed`);
247850
- if (unchanged > 0)
247851
- parts.push(`${unchanged} unchanged`);
247852
- if (failed > 0)
247853
- parts.push(`${failed} error${failed !== 1 ? "s" : ""}`);
247854
- return parts.join(", ") || "No functions deployed";
247855
- }
247856
- async function deployFunctionsAction(names, options) {
247857
- if (options.force && names.length > 0) {
247858
- throw new InvalidInputError("--force cannot be used when specifying function names");
247859
- }
247610
+ async function deployFunctionsAction() {
247860
247611
  const { functions } = await readProjectConfig();
247861
- const toDeploy = resolveFunctionsToDeploy(names, functions);
247862
- if (toDeploy.length === 0) {
247612
+ if (functions.length === 0) {
247863
247613
  return {
247864
247614
  outroMessage: "No functions found. Create functions in the 'functions' directory."
247865
247615
  };
247866
247616
  }
247867
- R2.info(`Found ${toDeploy.length} ${toDeploy.length === 1 ? "function" : "functions"} to deploy`);
247868
- let completed = 0;
247869
- const total = toDeploy.length;
247870
- const results = await deployFunctionsSequentially(toDeploy, {
247871
- onStart: (startNames) => {
247872
- const label = startNames.length === 1 ? startNames[0] : `${startNames.length} functions`;
247873
- R2.step(theme.styles.dim(`[${completed + 1}/${total}] Deploying ${label}...`));
247874
- },
247875
- onResult: (result) => {
247876
- completed++;
247877
- formatDeployResult(result);
247878
- }
247879
- });
247880
- if (options.force) {
247881
- const allLocalNames = functions.map((f) => f.name);
247882
- let pruneCompleted = 0;
247883
- let pruneTotal = 0;
247884
- const pruneResults = await pruneRemovedFunctions(allLocalNames, {
247885
- onStart: (total2) => {
247886
- pruneTotal = total2;
247887
- if (total2 > 0) {
247888
- R2.info(`Found ${total2} remote ${total2 === 1 ? "function" : "functions"} to delete`);
247889
- }
247890
- },
247891
- onBeforeDelete: (name2) => {
247892
- pruneCompleted++;
247893
- R2.step(theme.styles.dim(`[${pruneCompleted}/${pruneTotal}] Deleting ${name2}...`));
247894
- },
247895
- onResult: formatPruneResult
247896
- });
247897
- formatPruneSummary(pruneResults);
247898
- }
247899
- return { outroMessage: buildDeploySummary(results) };
247900
- }
247901
- function getDeployCommand(context) {
247902
- 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) => {
247903
- await runCommand(() => {
247904
- const names = parseNames2(rawNames);
247905
- return deployFunctionsAction(names, options);
247906
- }, { requireAuth: true }, context);
247907
- });
247908
- }
247909
-
247910
- // src/cli/commands/functions/list.ts
247911
- async function listFunctionsAction() {
247912
- const { functions } = await runTask("Fetching functions...", async () => listDeployedFunctions(), { errorMessage: "Failed to fetch functions" });
247913
- if (functions.length === 0) {
247914
- return { outroMessage: "No functions on remote" };
247915
- }
247916
- for (const fn of functions) {
247917
- const automationCount = fn.automations.length;
247918
- const automationLabel = automationCount > 0 ? theme.styles.dim(` (${automationCount} automation${automationCount > 1 ? "s" : ""})`) : "";
247919
- R2.message(` ${fn.name}${automationLabel}`);
247920
- }
247921
- return {
247922
- outroMessage: `${functions.length} function${functions.length !== 1 ? "s" : ""} on remote`
247923
- };
247924
- }
247925
- function getListCommand(context) {
247926
- return new Command("list").description("List all deployed functions").action(async () => {
247927
- await runCommand(listFunctionsAction, { requireAuth: true }, context);
247928
- });
247929
- }
247930
-
247931
- // src/cli/commands/functions/pull.ts
247932
- import { dirname as dirname9, join as join13 } from "node:path";
247933
- async function pullFunctionsAction(name2) {
247934
- const { project: project2 } = await readProjectConfig();
247935
- const configDir = dirname9(project2.configPath);
247936
- const functionsDir = join13(configDir, project2.functionsDir);
247937
- const remoteFunctions = await runTask("Fetching functions from Base44", async () => {
247938
- const { functions } = await listDeployedFunctions();
247939
- 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);
247940
247620
  }, {
247941
- successMessage: "Functions fetched successfully",
247942
- errorMessage: "Failed to fetch functions"
247621
+ successMessage: "Functions deployed successfully",
247622
+ errorMessage: "Failed to deploy functions"
247943
247623
  });
247944
- const toPull = name2 ? remoteFunctions.filter((f) => f.name === name2) : remoteFunctions;
247945
- if (name2 && toPull.length === 0) {
247946
- return {
247947
- outroMessage: `Function "${name2}" not found on remote`
247948
- };
247624
+ if (result.deployed.length > 0) {
247625
+ R2.success(`Deployed: ${result.deployed.join(", ")}`);
247949
247626
  }
247950
- if (toPull.length === 0) {
247951
- return { outroMessage: "No functions found on remote" };
247952
- }
247953
- const { written, skipped } = await runTask("Writing function files", async () => {
247954
- return await writeFunctions(functionsDir, toPull);
247955
- }, {
247956
- successMessage: "Function files written successfully",
247957
- errorMessage: "Failed to write function files"
247958
- });
247959
- for (const name3 of written) {
247960
- R2.success(`${name3.padEnd(25)} written`);
247627
+ if (result.deleted.length > 0) {
247628
+ R2.warn(`Deleted: ${result.deleted.join(", ")}`);
247961
247629
  }
247962
- for (const name3 of skipped) {
247963
- 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
+ });
247964
247638
  }
247965
- return {
247966
- outroMessage: `Pulled ${toPull.length} function${toPull.length !== 1 ? "s" : ""} to ${functionsDir}`
247967
- };
247639
+ return { outroMessage: "Functions deployed to Base44" };
247968
247640
  }
247969
- function getPullCommand(context) {
247970
- return new Command("pull").description("Pull deployed functions from Base44").argument("[name]", "Pull a single function by name").action(async (name2) => {
247971
- await runCommand(() => pullFunctionsAction(name2), { requireAuth: true }, context);
247972
- });
247973
- }
247974
-
247975
- // src/cli/commands/functions/index.ts
247976
- function getFunctionsCommand(context) {
247977
- 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
+ }));
247978
247645
  }
247979
247646
 
247980
247647
  // src/cli/commands/project/create.ts
247981
- 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";
247982
247649
  var import_kebabCase = __toESM(require_kebabCase(), 1);
247983
247650
  var DEFAULT_TEMPLATE_ID = "backend-only";
247984
247651
  async function getTemplateById(templateId) {
@@ -248115,7 +247782,7 @@ async function executeCreate({
248115
247782
  updateMessage("Building project...");
248116
247783
  await execa({ cwd: resolvedPath, shell: true })`${buildCommand}`;
248117
247784
  updateMessage("Deploying site...");
248118
- return await deploySite(join14(resolvedPath, outputDirectory));
247785
+ return await deploySite(join12(resolvedPath, outputDirectory));
248119
247786
  }, {
248120
247787
  successMessage: theme.colors.base44Orange("Site deployed successfully"),
248121
247788
  errorMessage: "Failed to deploy site"
@@ -248202,17 +247869,11 @@ ${summaryLines.join(`
248202
247869
  ${summaryLines.join(`
248203
247870
  `)}`);
248204
247871
  }
248205
- let functionCompleted = 0;
248206
- const functionTotal = functions.length;
248207
- const result = await deployAll(projectData, {
248208
- onFunctionStart: (names) => {
248209
- const label = names.length === 1 ? names[0] : `${names.length} functions`;
248210
- R2.step(theme.styles.dim(`[${functionCompleted + 1}/${functionTotal}] Deploying ${label}...`));
248211
- },
248212
- onFunctionResult: (r) => {
248213
- functionCompleted++;
248214
- formatDeployResult(r);
248215
- }
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"
248216
247877
  });
248217
247878
  const connectorResults = result.connectorResults ?? [];
248218
247879
  await handleOAuthConnectors(connectorResults, options);
@@ -248226,7 +247887,7 @@ ${summaryLines.join(`
248226
247887
  }
248227
247888
  return { outroMessage: "App deployed successfully" };
248228
247889
  }
248229
- function getDeployCommand2(context) {
247890
+ function getDeployCommand(context) {
248230
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) => {
248231
247892
  await runCommand(() => deployAction({
248232
247893
  ...options,
@@ -248771,10 +248432,10 @@ function toPascalCase(name2) {
248771
248432
  return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
248772
248433
  }
248773
248434
  // src/core/types/update-project.ts
248774
- import { join as join17 } from "node:path";
248435
+ import { join as join15 } from "node:path";
248775
248436
  var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
248776
248437
  async function updateProjectConfig(projectRoot) {
248777
- const tsconfigPath = join17(projectRoot, "tsconfig.json");
248438
+ const tsconfigPath = join15(projectRoot, "tsconfig.json");
248778
248439
  if (!await pathExists(tsconfigPath)) {
248779
248440
  return false;
248780
248441
  }
@@ -248817,7 +248478,7 @@ function getTypesCommand(context) {
248817
248478
  }
248818
248479
 
248819
248480
  // src/cli/dev/dev-server/main.ts
248820
- import { dirname as dirname14, join as join20 } from "node:path";
248481
+ import { dirname as dirname13, join as join18 } from "node:path";
248821
248482
  var import_cors = __toESM(require_lib4(), 1);
248822
248483
  var import_express4 = __toESM(require_express(), 1);
248823
248484
 
@@ -250297,9 +249958,9 @@ class NodeFsHandler {
250297
249958
  if (this.fsw.closed) {
250298
249959
  return;
250299
249960
  }
250300
- const dirname13 = sp2.dirname(file2);
249961
+ const dirname12 = sp2.dirname(file2);
250301
249962
  const basename5 = sp2.basename(file2);
250302
- const parent = this.fsw._getWatchedDir(dirname13);
249963
+ const parent = this.fsw._getWatchedDir(dirname12);
250303
249964
  let prevStats = stats;
250304
249965
  if (parent.has(basename5))
250305
249966
  return;
@@ -250326,7 +249987,7 @@ class NodeFsHandler {
250326
249987
  prevStats = newStats2;
250327
249988
  }
250328
249989
  } catch (error48) {
250329
- this.fsw._remove(dirname13, basename5);
249990
+ this.fsw._remove(dirname12, basename5);
250330
249991
  }
250331
249992
  } else if (parent.has(basename5)) {
250332
249993
  const at13 = newStats.atimeMs;
@@ -251347,8 +251008,8 @@ async function createDevServer(options8) {
251347
251008
  broadcastEntityEvent(io6, appId, entityName, event);
251348
251009
  };
251349
251010
  const base44ConfigWatcher = new WatchBase44({
251350
- functions: join20(dirname14(project2.configPath), project2.functionsDir),
251351
- entities: join20(dirname14(project2.configPath), project2.entitiesDir)
251011
+ functions: join18(dirname13(project2.configPath), project2.functionsDir),
251012
+ entities: join18(dirname13(project2.configPath), project2.entitiesDir)
251352
251013
  }, devLogger);
251353
251014
  base44ConfigWatcher.on("change", async (name2) => {
251354
251015
  try {
@@ -251518,13 +251179,13 @@ function createProgram(context) {
251518
251179
  program2.addCommand(getLogoutCommand(context));
251519
251180
  program2.addCommand(getCreateCommand(context));
251520
251181
  program2.addCommand(getDashboardCommand(context));
251521
- program2.addCommand(getDeployCommand2(context));
251182
+ program2.addCommand(getDeployCommand(context));
251522
251183
  program2.addCommand(getLinkCommand(context));
251523
251184
  program2.addCommand(getEjectCommand(context));
251524
251185
  program2.addCommand(getEntitiesPushCommand(context));
251525
251186
  program2.addCommand(getAgentsCommand(context));
251526
251187
  program2.addCommand(getConnectorsCommand(context));
251527
- program2.addCommand(getFunctionsCommand(context));
251188
+ program2.addCommand(getFunctionsDeployCommand(context));
251528
251189
  program2.addCommand(getSecretsCommand(context));
251529
251190
  program2.addCommand(getSiteCommand(context));
251530
251191
  program2.addCommand(getTypesCommand(context));
@@ -251538,7 +251199,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
251538
251199
  import { release, type } from "node:os";
251539
251200
 
251540
251201
  // ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
251541
- import { dirname as dirname15, posix, sep } from "path";
251202
+ import { dirname as dirname14, posix, sep } from "path";
251542
251203
  function createModulerModifier() {
251543
251204
  const getModuleFromFileName = createGetModuleFromFilename();
251544
251205
  return async (frames) => {
@@ -251547,7 +251208,7 @@ function createModulerModifier() {
251547
251208
  return frames;
251548
251209
  };
251549
251210
  }
251550
- 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 === "\\") {
251551
251212
  const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
251552
251213
  return (filename) => {
251553
251214
  if (!filename)
@@ -255736,9 +255397,9 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
255736
255397
  });
255737
255398
  }
255738
255399
  // src/cli/index.ts
255739
- var __dirname4 = dirname16(fileURLToPath6(import.meta.url));
255400
+ var __dirname4 = dirname15(fileURLToPath6(import.meta.url));
255740
255401
  async function runCLI(options8) {
255741
- ensureNpmAssets(join21(__dirname4, "../assets"));
255402
+ ensureNpmAssets(join19(__dirname4, "../assets"));
255742
255403
  const errorReporter = new ErrorReporter;
255743
255404
  errorReporter.registerProcessErrorHandlers();
255744
255405
  const isNonInteractive = !process.stdin.isTTY || !process.stdout.isTTY;
@@ -255771,4 +255432,4 @@ export {
255771
255432
  CLIExitError
255772
255433
  };
255773
255434
 
255774
- //# debugId=9A2E9C491721ADA564756E2164756E21
255435
+ //# debugId=3630160A15E12A6F64756E2164756E21