@base44-preview/cli 0.0.33-pr.331.c0ae606 → 0.0.33-pr.338.6928fe5

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
@@ -17446,7 +17446,7 @@ var require_lodash2 = __commonJS((exports, module) => {
17446
17446
  }
17447
17447
  return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
17448
17448
  });
17449
- function join14(array2, separator) {
17449
+ function join12(array2, separator) {
17450
17450
  return array2 == null ? "" : nativeJoin.call(array2, separator);
17451
17451
  }
17452
17452
  function last(array2) {
@@ -17468,7 +17468,7 @@ var require_lodash2 = __commonJS((exports, module) => {
17468
17468
  function nth(array2, n2) {
17469
17469
  return array2 && array2.length ? baseNth(array2, toInteger(n2)) : undefined2;
17470
17470
  }
17471
- var pull2 = baseRest(pullAll);
17471
+ var pull = baseRest(pullAll);
17472
17472
  function pullAll(array2, values2) {
17473
17473
  return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2) : array2;
17474
17474
  }
@@ -19233,7 +19233,7 @@ __p += '`;
19233
19233
  lodash.pickBy = pickBy;
19234
19234
  lodash.property = property;
19235
19235
  lodash.propertyOf = propertyOf;
19236
- lodash.pull = pull2;
19236
+ lodash.pull = pull;
19237
19237
  lodash.pullAll = pullAll;
19238
19238
  lodash.pullAllBy = pullAllBy;
19239
19239
  lodash.pullAllWith = pullAllWith;
@@ -19378,7 +19378,7 @@ __p += '`;
19378
19378
  lodash.isUndefined = isUndefined;
19379
19379
  lodash.isWeakMap = isWeakMap;
19380
19380
  lodash.isWeakSet = isWeakSet;
19381
- lodash.join = join14;
19381
+ lodash.join = join12;
19382
19382
  lodash.kebabCase = kebabCase2;
19383
19383
  lodash.last = last;
19384
19384
  lodash.lastIndexOf = lastIndexOf;
@@ -20007,7 +20007,7 @@ function cleanDoc(doc2) {
20007
20007
  return mapDoc(doc2, (currentDoc) => cleanDocFn(currentDoc));
20008
20008
  }
20009
20009
  function replaceEndOfLine(doc2, replacement = literalline) {
20010
- return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ? join14(replacement, currentDoc.split(`
20010
+ return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" ? join12(replacement, currentDoc.split(`
20011
20011
  `)) : currentDoc);
20012
20012
  }
20013
20013
  function canBreakFn(doc2) {
@@ -20087,7 +20087,7 @@ function indentIfBreak(contents, options) {
20087
20087
  negate: options.negate
20088
20088
  };
20089
20089
  }
20090
- function join14(separator, docs) {
20090
+ function join12(separator, docs) {
20091
20091
  assertDoc(separator);
20092
20092
  assertDocArray(docs);
20093
20093
  const parts = [];
@@ -20798,7 +20798,7 @@ var init_doc = __esm(() => {
20798
20798
  MODE_FLAT = Symbol("MODE_FLAT");
20799
20799
  DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH");
20800
20800
  builders = {
20801
- join: join14,
20801
+ join: join12,
20802
20802
  line,
20803
20803
  softline,
20804
20804
  hardline,
@@ -125712,7 +125712,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
125712
125712
  return mapDoc2(doc2, (currentDoc) => cleanDocFn2(currentDoc));
125713
125713
  }
125714
125714
  function replaceEndOfLine2(doc2, replacement = literalline2) {
125715
- return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ? join16(replacement, currentDoc.split(`
125715
+ return mapDoc2(doc2, (currentDoc) => typeof currentDoc === "string" ? join14(replacement, currentDoc.split(`
125716
125716
  `)) : currentDoc);
125717
125717
  }
125718
125718
  function canBreakFn2(doc2) {
@@ -125798,7 +125798,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
125798
125798
  negate: options8.negate
125799
125799
  };
125800
125800
  }
125801
- function join16(separator, docs) {
125801
+ function join14(separator, docs) {
125802
125802
  assertDoc2(separator);
125803
125803
  assertDocArray2(docs);
125804
125804
  const parts = [];
@@ -126463,7 +126463,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
126463
126463
  }
126464
126464
  }
126465
126465
  var builders2 = {
126466
- join: join16,
126466
+ join: join14,
126467
126467
  line: line3,
126468
126468
  softline: softline2,
126469
126469
  hardline: hardline4,
@@ -155678,10 +155678,10 @@ var require_view = __commonJS((exports, module) => {
155678
155678
  var debug = require_src4()("express:view");
155679
155679
  var path18 = __require("node:path");
155680
155680
  var fs28 = __require("node:fs");
155681
- var dirname12 = path18.dirname;
155681
+ var dirname11 = path18.dirname;
155682
155682
  var basename4 = path18.basename;
155683
155683
  var extname2 = path18.extname;
155684
- var join17 = path18.join;
155684
+ var join15 = path18.join;
155685
155685
  var resolve5 = path18.resolve;
155686
155686
  module.exports = View;
155687
155687
  function View(name2, options8) {
@@ -155717,7 +155717,7 @@ var require_view = __commonJS((exports, module) => {
155717
155717
  for (var i5 = 0;i5 < roots.length && !path19; i5++) {
155718
155718
  var root2 = roots[i5];
155719
155719
  var loc = resolve5(root2, name2);
155720
- var dir = dirname12(loc);
155720
+ var dir = dirname11(loc);
155721
155721
  var file2 = basename4(loc);
155722
155722
  path19 = this.resolve(dir, file2);
155723
155723
  }
@@ -155743,12 +155743,12 @@ var require_view = __commonJS((exports, module) => {
155743
155743
  };
155744
155744
  View.prototype.resolve = function resolve6(dir, file2) {
155745
155745
  var ext = this.ext;
155746
- var path19 = join17(dir, file2);
155746
+ var path19 = join15(dir, file2);
155747
155747
  var stat2 = tryStat(path19);
155748
155748
  if (stat2 && stat2.isFile()) {
155749
155749
  return path19;
155750
155750
  }
155751
- path19 = join17(dir, basename4(file2, ext), "index" + ext);
155751
+ path19 = join15(dir, basename4(file2, ext), "index" + ext);
155752
155752
  stat2 = tryStat(path19);
155753
155753
  if (stat2 && stat2.isFile()) {
155754
155754
  return path19;
@@ -159443,7 +159443,7 @@ var require_send = __commonJS((exports, module) => {
159443
159443
  var Stream2 = __require("stream");
159444
159444
  var util2 = __require("util");
159445
159445
  var extname2 = path18.extname;
159446
- var join17 = path18.join;
159446
+ var join15 = path18.join;
159447
159447
  var normalize = path18.normalize;
159448
159448
  var resolve5 = path18.resolve;
159449
159449
  var sep = path18.sep;
@@ -159615,7 +159615,7 @@ var require_send = __commonJS((exports, module) => {
159615
159615
  return res;
159616
159616
  }
159617
159617
  parts = path19.split(sep);
159618
- path19 = normalize(join17(root2, path19));
159618
+ path19 = normalize(join15(root2, path19));
159619
159619
  } else {
159620
159620
  if (UP_PATH_REGEXP.test(path19)) {
159621
159621
  debug('malicious path "%s"', path19);
@@ -159755,7 +159755,7 @@ var require_send = __commonJS((exports, module) => {
159755
159755
  return self2.onStatError(err);
159756
159756
  return self2.error(404);
159757
159757
  }
159758
- var p4 = join17(path19, self2._index[i5]);
159758
+ var p4 = join15(path19, self2._index[i5]);
159759
159759
  debug('stat "%s"', p4);
159760
159760
  fs28.stat(p4, function(err2, stat2) {
159761
159761
  if (err2)
@@ -162834,7 +162834,7 @@ var {
162834
162834
  } = import__.default;
162835
162835
 
162836
162836
  // src/cli/commands/agents/pull.ts
162837
- import { dirname as dirname7, join as join10 } from "node:path";
162837
+ import { dirname as dirname7, join as join9 } from "node:path";
162838
162838
 
162839
162839
  // node_modules/@clack/core/dist/index.mjs
162840
162840
  var import_picocolors = __toESM(require_picocolors(), 1);
@@ -185309,7 +185309,7 @@ var generateGlobTasks = normalizeArguments(generateTasks);
185309
185309
  var generateGlobTasksSync = normalizeArgumentsSync(generateTasksSync);
185310
185310
 
185311
185311
  // src/core/project/config.ts
185312
- import { dirname as dirname5, join as join7 } from "node:path";
185312
+ import { dirname as dirname5, join as join6 } from "node:path";
185313
185313
 
185314
185314
  // src/core/resources/agent/schema.ts
185315
185315
  var EntityOperationSchema = exports_external.enum(["create", "update", "delete", "read"]);
@@ -186033,34 +186033,6 @@ var ListFunctionsResponseSchema = exports_external.object({
186033
186033
  });
186034
186034
 
186035
186035
  // src/core/resources/function/api.ts
186036
- function toDeployPayloadItem(fn) {
186037
- return {
186038
- name: fn.name,
186039
- entry: fn.entry,
186040
- files: fn.files,
186041
- automations: fn.automations
186042
- };
186043
- }
186044
- async function deployFunctions(functions) {
186045
- const appClient = getAppClient();
186046
- const payload = {
186047
- functions: functions.map(toDeployPayloadItem)
186048
- };
186049
- let response;
186050
- try {
186051
- response = await appClient.put("backend-functions", {
186052
- json: payload,
186053
- timeout: false
186054
- });
186055
- } catch (error48) {
186056
- throw await ApiError.fromHttpError(error48, "deploying functions");
186057
- }
186058
- const result = DeployFunctionsResponseSchema.safeParse(await response.json());
186059
- if (!result.success) {
186060
- throw new SchemaValidationError("Invalid response from server", result.error);
186061
- }
186062
- return result.data;
186063
- }
186064
186036
  async function deploySingleFunction(name2, payload) {
186065
186037
  const appClient = getAppClient();
186066
186038
  let response;
@@ -186148,13 +186120,6 @@ async function loadFunctionCode(fn) {
186148
186120
  }));
186149
186121
  return { ...fn, files: loadedFiles };
186150
186122
  }
186151
- async function pushFunctions(functions) {
186152
- if (functions.length === 0) {
186153
- return { deployed: [], deleted: [], skipped: [], errors: null };
186154
- }
186155
- const functionsWithCode = await Promise.all(functions.map(loadFunctionCode));
186156
- return deployFunctions(functionsWithCode);
186157
- }
186158
186123
  async function deployOne(fn) {
186159
186124
  try {
186160
186125
  const loaded = await loadFunctionCode(fn);
@@ -186175,12 +186140,26 @@ async function deployOne(fn) {
186175
186140
  async function pushFunctionsSingle(functions, options) {
186176
186141
  if (functions.length === 0)
186177
186142
  return [];
186143
+ const concurrency = options?.concurrency ?? 1;
186144
+ if (concurrency <= 1) {
186145
+ const results2 = [];
186146
+ for (const fn of functions) {
186147
+ options?.onStart?.([fn.name]);
186148
+ const result = await deployOne(fn);
186149
+ results2.push(result);
186150
+ options?.onResult?.(result);
186151
+ }
186152
+ return results2;
186153
+ }
186178
186154
  const results = [];
186179
- for (const fn of functions) {
186180
- options?.onStart?.([fn.name]);
186181
- const result = await deployOne(fn);
186182
- results.push(result);
186183
- options?.onResult?.(result);
186155
+ for (let i = 0;i < functions.length; i += concurrency) {
186156
+ const batch = functions.slice(i, i + concurrency);
186157
+ options?.onStart?.(batch.map((fn) => fn.name));
186158
+ const batchResults = await Promise.all(batch.map(deployOne));
186159
+ for (const result of batchResults) {
186160
+ results.push(result);
186161
+ options?.onResult?.(result);
186162
+ }
186184
186163
  }
186185
186164
  return results;
186186
186165
  }
@@ -186203,57 +186182,10 @@ async function pruneRemovedFunctions(localFunctionNames) {
186203
186182
  }
186204
186183
  return results;
186205
186184
  }
186206
- // src/core/resources/function/pull.ts
186207
- import { join as join6 } from "node:path";
186208
- async function writeFunctions(functionsDir, functions) {
186209
- const written = [];
186210
- const skipped = [];
186211
- for (const fn of functions) {
186212
- const functionDir = join6(functionsDir, fn.name);
186213
- const configPath = join6(functionDir, "function.jsonc");
186214
- if (await isFunctionUnchanged(functionDir, fn)) {
186215
- skipped.push(fn.name);
186216
- continue;
186217
- }
186218
- const config5 = {
186219
- name: fn.name,
186220
- entry: fn.entry
186221
- };
186222
- if (fn.automations.length > 0) {
186223
- config5.automations = fn.automations;
186224
- }
186225
- await writeJsonFile(configPath, config5);
186226
- for (const file2 of fn.files) {
186227
- await writeFile(join6(functionDir, file2.path), file2.content);
186228
- }
186229
- written.push(fn.name);
186230
- }
186231
- return { written, skipped };
186232
- }
186233
- async function isFunctionUnchanged(functionDir, fn) {
186234
- if (!await pathExists(functionDir)) {
186235
- return false;
186236
- }
186237
- for (const file2 of fn.files) {
186238
- const filePath = join6(functionDir, file2.path);
186239
- if (!await pathExists(filePath)) {
186240
- return false;
186241
- }
186242
- try {
186243
- const localContent = await readTextFile(filePath);
186244
- if (localContent !== file2.content) {
186245
- return false;
186246
- }
186247
- } catch {
186248
- return false;
186249
- }
186250
- }
186251
- return true;
186252
- }
186253
186185
  // src/core/resources/function/resource.ts
186254
186186
  var functionResource = {
186255
186187
  readAll: readAllFunctions,
186256
- push: pushFunctions
186188
+ push: (functions) => pushFunctionsSingle(functions)
186257
186189
  };
186258
186190
  // src/core/project/config.ts
186259
186191
  async function findConfigInDir(dir) {
@@ -186294,10 +186226,10 @@ async function readProjectConfig(projectRoot) {
186294
186226
  const project = result.data;
186295
186227
  const configDir = dirname5(configPath);
186296
186228
  const [entities, functions, agents, connectors] = await Promise.all([
186297
- entityResource.readAll(join7(configDir, project.entitiesDir)),
186298
- functionResource.readAll(join7(configDir, project.functionsDir)),
186299
- agentResource.readAll(join7(configDir, project.agentsDir)),
186300
- connectorResource.readAll(join7(configDir, project.connectorsDir))
186229
+ entityResource.readAll(join6(configDir, project.entitiesDir)),
186230
+ functionResource.readAll(join6(configDir, project.functionsDir)),
186231
+ agentResource.readAll(join6(configDir, project.agentsDir)),
186232
+ connectorResource.readAll(join6(configDir, project.connectorsDir))
186301
186233
  ]);
186302
186234
  return {
186303
186235
  project: { ...project, root, configPath },
@@ -186394,7 +186326,7 @@ async function readAppConfig(projectRoot) {
186394
186326
  // src/core/project/template.ts
186395
186327
  var import_ejs = __toESM(require_ejs(), 1);
186396
186328
  var import_front_matter = __toESM(require_front_matter(), 1);
186397
- import { dirname as dirname6, join as join8 } from "node:path";
186329
+ import { dirname as dirname6, join as join7 } from "node:path";
186398
186330
  async function listTemplates() {
186399
186331
  const parsed = await readJsonFile(getTemplatesIndexPath());
186400
186332
  const result = TemplatesConfigSchema.safeParse(parsed);
@@ -186404,23 +186336,23 @@ async function listTemplates() {
186404
186336
  return result.data.templates;
186405
186337
  }
186406
186338
  async function renderTemplate(template, destPath, data) {
186407
- const templateDir = join8(getTemplatesDir(), template.path);
186339
+ const templateDir = join7(getTemplatesDir(), template.path);
186408
186340
  const files = await globby("**/*", {
186409
186341
  cwd: templateDir,
186410
186342
  dot: true,
186411
186343
  onlyFiles: true
186412
186344
  });
186413
186345
  for (const file2 of files) {
186414
- const srcPath = join8(templateDir, file2);
186346
+ const srcPath = join7(templateDir, file2);
186415
186347
  try {
186416
186348
  if (file2.endsWith(".ejs")) {
186417
186349
  const rendered = await import_ejs.default.renderFile(srcPath, data);
186418
186350
  const { attributes, body } = import_front_matter.default(rendered);
186419
- const destFile = attributes.outputFileName ? join8(dirname6(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
186420
- const destFilePath = join8(destPath, destFile);
186351
+ const destFile = attributes.outputFileName ? join7(dirname6(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
186352
+ const destFilePath = join7(destPath, destFile);
186421
186353
  await writeFile(destFilePath, body);
186422
186354
  } else {
186423
- const destFilePath = join8(destPath, file2);
186355
+ const destFilePath = join7(destPath, file2);
186424
186356
  await copyFile(srcPath, destFilePath);
186425
186357
  }
186426
186358
  } catch (error48) {
@@ -186523,7 +186455,7 @@ async function getSiteFilePaths(outputDir) {
186523
186455
  // src/core/site/deploy.ts
186524
186456
  import { randomUUID } from "node:crypto";
186525
186457
  import { tmpdir } from "node:os";
186526
- import { join as join9 } from "node:path";
186458
+ import { join as join8 } from "node:path";
186527
186459
  async function deploySite(siteOutputDir) {
186528
186460
  if (!await pathExists(siteOutputDir)) {
186529
186461
  throw new FileNotFoundError(`Output directory does not exist: ${siteOutputDir}. Make sure to build your project first.`, {
@@ -186540,7 +186472,7 @@ async function deploySite(siteOutputDir) {
186540
186472
  ]
186541
186473
  });
186542
186474
  }
186543
- const archivePath = join9(tmpdir(), `base44-site-${randomUUID()}.tar.gz`);
186475
+ const archivePath = join8(tmpdir(), `base44-site-${randomUUID()}.tar.gz`);
186544
186476
  try {
186545
186477
  await createArchive(siteOutputDir, archivePath);
186546
186478
  return await uploadSite(archivePath);
@@ -186565,10 +186497,13 @@ function hasResourcesToDeploy(projectData) {
186565
186497
  const hasConnectors = connectors.length > 0;
186566
186498
  return hasEntities || hasFunctions || hasAgents || hasConnectors || hasSite;
186567
186499
  }
186568
- async function deployAll(projectData) {
186500
+ async function deployAll(projectData, options) {
186569
186501
  const { project, entities, functions, agents, connectors } = projectData;
186570
186502
  await entityResource.push(entities);
186571
- await functionResource.push(functions);
186503
+ await pushFunctionsSingle(functions, {
186504
+ onStart: options?.onFunctionStart,
186505
+ onResult: options?.onFunctionResult
186506
+ });
186572
186507
  await agentResource.push(agents);
186573
186508
  const { results: connectorResults } = await pushConnectors(connectors);
186574
186509
  if (project.site?.outputDirectory) {
@@ -194221,7 +194156,7 @@ function getDashboardUrl(projectId) {
194221
194156
  async function pullAgentsAction() {
194222
194157
  const { project: project2 } = await readProjectConfig();
194223
194158
  const configDir = dirname7(project2.configPath);
194224
- const agentsDir = join10(configDir, project2.agentsDir);
194159
+ const agentsDir = join9(configDir, project2.agentsDir);
194225
194160
  const remoteAgents = await runTask("Fetching agents from Base44", async () => {
194226
194161
  return await fetchAgents();
194227
194162
  }, {
@@ -194315,11 +194250,11 @@ function getWhoamiCommand(context) {
194315
194250
  }
194316
194251
 
194317
194252
  // src/cli/commands/connectors/pull.ts
194318
- import { dirname as dirname8, join as join11 } from "node:path";
194253
+ import { dirname as dirname8, join as join10 } from "node:path";
194319
194254
  async function pullConnectorsAction() {
194320
194255
  const { project: project2 } = await readProjectConfig();
194321
194256
  const configDir = dirname8(project2.configPath);
194322
- const connectorsDir = join11(configDir, project2.connectorsDir);
194257
+ const connectorsDir = join10(configDir, project2.connectorsDir);
194323
194258
  const remoteConnectors = await runTask("Fetching connectors from Base44", async () => {
194324
194259
  return await listConnectors();
194325
194260
  }, {
@@ -195168,53 +195103,22 @@ function getEntitiesPushCommand(context) {
195168
195103
  }
195169
195104
 
195170
195105
  // src/cli/commands/functions/delete.ts
195171
- function parseNames(args) {
195172
- return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
195173
- }
195174
- async function deleteFunctionsAction(names) {
195175
- let deleted = 0;
195176
- let notFound = 0;
195177
- let errors4 = 0;
195178
- for (const name2 of names) {
195179
- try {
195180
- await deleteSingleFunction(name2);
195181
- R2.success(`${name2} deleted`);
195182
- deleted++;
195183
- } catch (error48) {
195184
- if (error48 instanceof ApiError && error48.statusCode === 404) {
195185
- R2.warn(`Function "${name2}" not found on remote`);
195186
- notFound++;
195187
- } else {
195188
- R2.error(`${name2} error: ${error48 instanceof Error ? error48.message : String(error48)}`);
195189
- errors4++;
195190
- }
195106
+ async function deleteFunctionAction(name2) {
195107
+ try {
195108
+ await deleteSingleFunction(name2);
195109
+ R2.success(`${name2} deleted`);
195110
+ return { outroMessage: `Function "${name2}" deleted` };
195111
+ } catch (error48) {
195112
+ if (error48 instanceof ApiError && error48.statusCode === 404) {
195113
+ R2.warn(`Function "${name2}" not found on remote`);
195114
+ return { outroMessage: `Function "${name2}" not found` };
195191
195115
  }
195116
+ throw error48;
195192
195117
  }
195193
- if (names.length === 1) {
195194
- if (deleted)
195195
- return { outroMessage: `Function "${names[0]}" deleted` };
195196
- if (notFound)
195197
- return { outroMessage: `Function "${names[0]}" not found` };
195198
- return { outroMessage: `Failed to delete "${names[0]}"` };
195199
- }
195200
- const parts = [];
195201
- if (deleted > 0)
195202
- parts.push(`${deleted} deleted`);
195203
- if (notFound > 0)
195204
- parts.push(`${notFound} not found`);
195205
- if (errors4 > 0)
195206
- parts.push(`${errors4} error${errors4 !== 1 ? "s" : ""}`);
195207
- return { outroMessage: parts.join(", ") };
195208
195118
  }
195209
195119
  function getDeleteCommand(context) {
195210
- return new Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").action(async (rawNames) => {
195211
- await runCommand(() => {
195212
- const names = parseNames(rawNames);
195213
- if (names.length === 0) {
195214
- throw new InvalidInputError("At least one function name is required");
195215
- }
195216
- return deleteFunctionsAction(names);
195217
- }, { requireAuth: true }, context);
195120
+ return new Command("delete").description("Delete a deployed backend function").argument("<name>", "Name of the function to delete").action(async (name2) => {
195121
+ await runCommand(() => deleteFunctionAction(name2), { requireAuth: true }, context);
195218
195122
  });
195219
195123
  }
195220
195124
 
@@ -195233,25 +195137,13 @@ function formatResult(r) {
195233
195137
  R2.error(`${label} error: ${r.error}`);
195234
195138
  }
195235
195139
  }
195236
- function parseNames2(args) {
195237
- return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
195238
- }
195239
- async function deployFunctionsAction(names, options) {
195240
- if (options.force && names.length > 0) {
195241
- throw new InvalidInputError("--force cannot be used when specifying function names");
195242
- }
195140
+ async function deployFunctionsAction(name2, options) {
195243
195141
  const { functions } = await readProjectConfig();
195244
- let toDeploy;
195245
- if (names.length > 0) {
195246
- const notFound = names.filter((n2) => !functions.some((f) => f.name === n2));
195247
- if (notFound.length > 0) {
195248
- throw new InvalidInputError(`Function${notFound.length > 1 ? "s" : ""} not found in project: ${notFound.join(", ")}`);
195249
- }
195250
- toDeploy = functions.filter((f) => names.includes(f.name));
195251
- } else {
195252
- toDeploy = functions;
195253
- }
195142
+ const toDeploy = name2 ? functions.filter((f) => f.name === name2) : functions;
195254
195143
  if (toDeploy.length === 0) {
195144
+ if (name2) {
195145
+ throw new InvalidInputError(`Function "${name2}" not found in project`);
195146
+ }
195255
195147
  return {
195256
195148
  outroMessage: "No functions found. Create functions in the 'functions' directory."
195257
195149
  };
@@ -195260,8 +195152,9 @@ async function deployFunctionsAction(names, options) {
195260
195152
  let completed = 0;
195261
195153
  const total = toDeploy.length;
195262
195154
  const results = await pushFunctionsSingle(toDeploy, {
195263
- onStart: (startNames) => {
195264
- const label = startNames.length === 1 ? startNames[0] : `${startNames.length} functions`;
195155
+ concurrency: options.concurrency,
195156
+ onStart: (names) => {
195157
+ const label = names.length === 1 ? names[0] : `${names.length} functions`;
195265
195158
  R2.step(theme.styles.dim(`[${completed}/${total}] Deploying ${label}...`));
195266
195159
  },
195267
195160
  onResult: (r) => {
@@ -195271,8 +195164,8 @@ async function deployFunctionsAction(names, options) {
195271
195164
  });
195272
195165
  const succeeded = results.filter((r) => r.status !== "error").length;
195273
195166
  const failed = results.filter((r) => r.status === "error").length;
195274
- if (options.force) {
195275
- R2.info("Removing remote functions not found locally...");
195167
+ if (options.prune) {
195168
+ R2.info("Pruning remote functions not found locally...");
195276
195169
  const allLocalNames = functions.map((f) => f.name);
195277
195170
  const pruneResults = await pruneRemovedFunctions(allLocalNames);
195278
195171
  for (const pr of pruneResults) {
@@ -195284,7 +195177,7 @@ async function deployFunctionsAction(names, options) {
195284
195177
  }
195285
195178
  if (pruneResults.length > 0) {
195286
195179
  const pruned = pruneResults.filter((r) => r.deleted).length;
195287
- R2.info(`${pruned} function${pruned !== 1 ? "s" : ""} removed`);
195180
+ R2.info(`${pruned} function${pruned !== 1 ? "s" : ""} pruned`);
195288
195181
  }
195289
195182
  }
195290
195183
  const parts = [];
@@ -195296,10 +195189,17 @@ async function deployFunctionsAction(names, options) {
195296
195189
  return { outroMessage: summary };
195297
195190
  }
195298
195191
  function getDeployCommand(context) {
195299
- 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) => {
195192
+ return new Command("deploy").description("Deploy local functions to Base44").argument("[name]", "Deploy a single function by name").option("--prune", "Delete remote functions not found locally").option("-c, --concurrency <n>", "Number of functions to deploy in parallel").action(async (name2, options) => {
195300
195193
  await runCommand(() => {
195301
- const names = parseNames2(rawNames);
195302
- return deployFunctionsAction(names, options);
195194
+ let concurrency;
195195
+ if (options.concurrency !== undefined) {
195196
+ const n2 = parseInt(options.concurrency, 10);
195197
+ if (Number.isNaN(n2) || n2 < 1) {
195198
+ throw new InvalidInputError("--concurrency must be a positive integer");
195199
+ }
195200
+ concurrency = n2;
195201
+ }
195202
+ return deployFunctionsAction(name2, { prune: options.prune, concurrency });
195303
195203
  }, { requireAuth: true }, context);
195304
195204
  });
195305
195205
  }
@@ -195320,62 +195220,18 @@ async function listFunctionsAction() {
195320
195220
  };
195321
195221
  }
195322
195222
  function getListCommand(context) {
195323
- return new Command("list").description("List all deployed functions").action(async () => {
195223
+ return new Command("list").description("List deployed backend functions").action(async () => {
195324
195224
  await runCommand(listFunctionsAction, { requireAuth: true }, context);
195325
195225
  });
195326
195226
  }
195327
195227
 
195328
- // src/cli/commands/functions/pull.ts
195329
- import { dirname as dirname9, join as join12 } from "node:path";
195330
- async function pullFunctionsAction(name2) {
195331
- const { project: project2 } = await readProjectConfig();
195332
- const configDir = dirname9(project2.configPath);
195333
- const functionsDir = join12(configDir, project2.functionsDir);
195334
- const remoteFunctions = await runTask("Fetching functions from Base44", async () => {
195335
- const { functions } = await listDeployedFunctions();
195336
- return functions;
195337
- }, {
195338
- successMessage: "Functions fetched successfully",
195339
- errorMessage: "Failed to fetch functions"
195340
- });
195341
- const toPull = name2 ? remoteFunctions.filter((f) => f.name === name2) : remoteFunctions;
195342
- if (name2 && toPull.length === 0) {
195343
- return {
195344
- outroMessage: `Function "${name2}" not found on remote`
195345
- };
195346
- }
195347
- if (toPull.length === 0) {
195348
- return { outroMessage: "No functions found on remote" };
195349
- }
195350
- const { written, skipped } = await runTask("Writing function files", async () => {
195351
- return await writeFunctions(functionsDir, toPull);
195352
- }, {
195353
- successMessage: "Function files written successfully",
195354
- errorMessage: "Failed to write function files"
195355
- });
195356
- if (written.length > 0) {
195357
- R2.success(`Written: ${written.join(", ")}`);
195358
- }
195359
- if (skipped.length > 0) {
195360
- R2.info(`Skipped (unchanged): ${skipped.join(", ")}`);
195361
- }
195362
- return {
195363
- outroMessage: `Pulled ${toPull.length} function${toPull.length !== 1 ? "s" : ""} to ${functionsDir}`
195364
- };
195365
- }
195366
- function getPullCommand(context) {
195367
- return new Command("pull").description("Pull deployed functions from Base44").argument("[name]", "Pull a single function by name").action(async (name2) => {
195368
- await runCommand(() => pullFunctionsAction(name2), { requireAuth: true }, context);
195369
- });
195370
- }
195371
-
195372
195228
  // src/cli/commands/functions/index.ts
195373
195229
  function getFunctionsCommand(context) {
195374
- return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getPullCommand(context)).addCommand(getListCommand(context)).addCommand(getDeleteCommand(context));
195230
+ return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getListCommand(context)).addCommand(getDeleteCommand(context));
195375
195231
  }
195376
195232
 
195377
195233
  // src/cli/commands/project/create.ts
195378
- import { basename as basename3, join as join13, resolve as resolve2 } from "node:path";
195234
+ import { basename as basename3, join as join11, resolve as resolve2 } from "node:path";
195379
195235
  var import_lodash = __toESM(require_lodash(), 1);
195380
195236
  var DEFAULT_TEMPLATE_ID = "backend-only";
195381
195237
  async function getTemplateById(templateId) {
@@ -195511,7 +195367,7 @@ async function executeCreate({
195511
195367
  updateMessage("Building project...");
195512
195368
  await execa({ cwd: resolvedPath, shell: true })`${buildCommand}`;
195513
195369
  updateMessage("Deploying site...");
195514
- return await deploySite(join13(resolvedPath, outputDirectory));
195370
+ return await deploySite(join11(resolvedPath, outputDirectory));
195515
195371
  }, {
195516
195372
  successMessage: theme.colors.base44Orange("Site deployed successfully"),
195517
195373
  errorMessage: "Failed to deploy site"
@@ -195552,6 +195408,20 @@ function getCreateCommand(context) {
195552
195408
  }
195553
195409
 
195554
195410
  // src/cli/commands/project/deploy.ts
195411
+ function formatDuration2(ms) {
195412
+ return `${(ms / 1000).toFixed(1)}s`;
195413
+ }
195414
+ function formatFunctionResult(r) {
195415
+ const label = r.name.padEnd(25);
195416
+ if (r.status === "deployed") {
195417
+ const timing = r.duration_ms ? theme.styles.dim(` (${formatDuration2(r.duration_ms)})`) : "";
195418
+ R2.success(`${label} deployed${timing}`);
195419
+ } else if (r.status === "unchanged") {
195420
+ R2.success(`${label} unchanged`);
195421
+ } else {
195422
+ R2.error(`${label} error: ${r.error}`);
195423
+ }
195424
+ }
195555
195425
  async function deployAction(options) {
195556
195426
  const projectData = await readProjectConfig(options.projectRoot);
195557
195427
  if (!hasResourcesToDeploy(projectData)) {
@@ -195591,11 +195461,17 @@ ${summaryLines.join(`
195591
195461
  ${summaryLines.join(`
195592
195462
  `)}`);
195593
195463
  }
195594
- const result = await runTask("Deploying your app...", async () => {
195595
- return await deployAll(projectData);
195596
- }, {
195597
- successMessage: theme.colors.base44Orange("Deployment completed"),
195598
- errorMessage: "Deployment failed"
195464
+ let functionCompleted = 0;
195465
+ const functionTotal = functions.length;
195466
+ const result = await deployAll(projectData, {
195467
+ onFunctionStart: (names) => {
195468
+ const label = names.length === 1 ? names[0] : `${names.length} functions`;
195469
+ R2.step(theme.styles.dim(`[${functionCompleted}/${functionTotal}] Deploying ${label}...`));
195470
+ },
195471
+ onFunctionResult: (r) => {
195472
+ functionCompleted++;
195473
+ formatFunctionResult(r);
195474
+ }
195599
195475
  });
195600
195476
  const needsOAuth = filterPendingOAuth(result.connectorResults ?? []);
195601
195477
  if (needsOAuth.length > 0) {
@@ -195912,10 +195788,10 @@ function toPascalCase(name2) {
195912
195788
  return name2.split(/[-_\s]+/).map((w8) => w8.charAt(0).toUpperCase() + w8.slice(1)).join("");
195913
195789
  }
195914
195790
  // src/core/types/update-project.ts
195915
- import { join as join16 } from "node:path";
195791
+ import { join as join14 } from "node:path";
195916
195792
  var TYPES_INCLUDE_PATH = `${PROJECT_SUBDIR}/${TYPES_OUTPUT_SUBDIR}/*.d.ts`;
195917
195793
  async function updateProjectConfig(projectRoot) {
195918
- const tsconfigPath = join16(projectRoot, "tsconfig.json");
195794
+ const tsconfigPath = join14(projectRoot, "tsconfig.json");
195919
195795
  if (!await pathExists(tsconfigPath)) {
195920
195796
  return false;
195921
195797
  }
@@ -195958,7 +195834,7 @@ function getTypesCommand(context) {
195958
195834
  }
195959
195835
 
195960
195836
  // src/cli/commands/dev.ts
195961
- import { dirname as dirname13, join as join18 } from "node:path";
195837
+ import { dirname as dirname12, join as join16 } from "node:path";
195962
195838
 
195963
195839
  // src/cli/dev/dev-server/main.ts
195964
195840
  var import_cors = __toESM(require_lib4(), 1);
@@ -196106,10 +195982,10 @@ function createDevLogger() {
196106
195982
 
196107
195983
  // src/cli/dev/dev-server/function-manager.ts
196108
195984
  import { spawn as spawn2, spawnSync as spawnSync2 } from "node:child_process";
196109
- import { dirname as dirname12, join as join17 } from "node:path";
195985
+ import { dirname as dirname11, join as join15 } from "node:path";
196110
195986
  import { fileURLToPath as fileURLToPath7 } from "node:url";
196111
- var __dirname5 = dirname12(fileURLToPath7(import.meta.url));
196112
- var WRAPPER_PATH = join17(__dirname5, "../deno-runtime/main.js");
195987
+ var __dirname5 = dirname11(fileURLToPath7(import.meta.url));
195988
+ var WRAPPER_PATH = join15(__dirname5, "../deno-runtime/main.js");
196113
195989
  var READY_TIMEOUT = 30000;
196114
195990
 
196115
195991
  class FunctionManager {
@@ -196361,8 +196237,8 @@ async function devAction(options8) {
196361
196237
  port,
196362
196238
  loadResources: async () => {
196363
196239
  const { project: project2 } = await readProjectConfig();
196364
- const configDir = dirname13(project2.configPath);
196365
- const functions = await functionResource.readAll(join18(configDir, project2.functionsDir));
196240
+ const configDir = dirname12(project2.configPath);
196241
+ const functions = await functionResource.readAll(join16(configDir, project2.functionsDir));
196366
196242
  return { functions };
196367
196243
  }
196368
196244
  });
@@ -196527,7 +196403,7 @@ function nanoid3(size = 21) {
196527
196403
  }
196528
196404
 
196529
196405
  // node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
196530
- import { dirname as dirname14, posix, sep } from "path";
196406
+ import { dirname as dirname13, posix, sep } from "path";
196531
196407
  function createModulerModifier() {
196532
196408
  const getModuleFromFileName = createGetModuleFromFilename();
196533
196409
  return async (frames) => {
@@ -196536,7 +196412,7 @@ function createModulerModifier() {
196536
196412
  return frames;
196537
196413
  };
196538
196414
  }
196539
- function createGetModuleFromFilename(basePath = process.argv[1] ? dirname14(process.argv[1]) : process.cwd(), isWindows4 = sep === "\\") {
196415
+ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname13(process.argv[1]) : process.cwd(), isWindows4 = sep === "\\") {
196540
196416
  const normalizedBase = isWindows4 ? normalizeWindowsPath2(basePath) : basePath;
196541
196417
  return (filename) => {
196542
196418
  if (!filename)
@@ -200753,4 +200629,4 @@ export {
200753
200629
  CLIExitError
200754
200630
  };
200755
200631
 
200756
- //# debugId=B41FE485BE98CA0764756E2164756E21
200632
+ //# debugId=AF9218E8BC7FC1E564756E2164756E21