@base44-preview/cli 0.1.7-pr.584.b9b7274 → 0.1.7-pr.584.c04fce8

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
@@ -23419,12 +23419,12 @@ var require_isexe = __commonJS((exports, module) => {
23419
23419
  if (typeof Promise !== "function") {
23420
23420
  throw new TypeError("callback not provided");
23421
23421
  }
23422
- return new Promise(function(resolve4, reject) {
23422
+ return new Promise(function(resolve3, reject) {
23423
23423
  isexe(path11, options || {}, function(er, is) {
23424
23424
  if (er) {
23425
23425
  reject(er);
23426
23426
  } else {
23427
- resolve4(is);
23427
+ resolve3(is);
23428
23428
  }
23429
23429
  });
23430
23430
  });
@@ -23486,27 +23486,27 @@ var require_which = __commonJS((exports, module) => {
23486
23486
  opt = {};
23487
23487
  const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
23488
23488
  const found = [];
23489
- const step = (i) => new Promise((resolve4, reject) => {
23489
+ const step = (i) => new Promise((resolve3, reject) => {
23490
23490
  if (i === pathEnv.length)
23491
- return opt.all && found.length ? resolve4(found) : reject(getNotFoundError(cmd));
23491
+ return opt.all && found.length ? resolve3(found) : reject(getNotFoundError(cmd));
23492
23492
  const ppRaw = pathEnv[i];
23493
23493
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
23494
23494
  const pCmd = path11.join(pathPart, cmd);
23495
23495
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
23496
- resolve4(subStep(p, i, 0));
23496
+ resolve3(subStep(p, i, 0));
23497
23497
  });
23498
- const subStep = (p, i, ii) => new Promise((resolve4, reject) => {
23498
+ const subStep = (p, i, ii) => new Promise((resolve3, reject) => {
23499
23499
  if (ii === pathExt.length)
23500
- return resolve4(step(i + 1));
23500
+ return resolve3(step(i + 1));
23501
23501
  const ext = pathExt[ii];
23502
23502
  isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
23503
23503
  if (!er && is) {
23504
23504
  if (opt.all)
23505
23505
  found.push(p + ext);
23506
23506
  else
23507
- return resolve4(p + ext);
23507
+ return resolve3(p + ext);
23508
23508
  }
23509
- return resolve4(subStep(p, i, ii + 1));
23509
+ return resolve3(subStep(p, i, ii + 1));
23510
23510
  });
23511
23511
  });
23512
23512
  return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
@@ -27034,7 +27034,7 @@ var require_lodash8 = __commonJS((exports, module) => {
27034
27034
  }
27035
27035
  return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
27036
27036
  });
27037
- function join15(array2, separator) {
27037
+ function join17(array2, separator) {
27038
27038
  return array2 == null ? "" : nativeJoin.call(array2, separator);
27039
27039
  }
27040
27040
  function last(array2) {
@@ -28966,7 +28966,7 @@ __p += '`;
28966
28966
  lodash.isUndefined = isUndefined;
28967
28967
  lodash.isWeakMap = isWeakMap;
28968
28968
  lodash.isWeakSet = isWeakSet;
28969
- lodash.join = join15;
28969
+ lodash.join = join17;
28970
28970
  lodash.kebabCase = kebabCase;
28971
28971
  lodash.last = last;
28972
28972
  lodash.lastIndexOf = lastIndexOf;
@@ -138287,11 +138287,11 @@ var require_prettier = __commonJS((exports, module) => {
138287
138287
  var require_formatter = __commonJS((exports) => {
138288
138288
  var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
138289
138289
  function adopt(value) {
138290
- return value instanceof P9 ? value : new P9(function(resolve16) {
138291
- resolve16(value);
138290
+ return value instanceof P9 ? value : new P9(function(resolve15) {
138291
+ resolve15(value);
138292
138292
  });
138293
138293
  }
138294
- return new (P9 || (P9 = Promise))(function(resolve16, reject) {
138294
+ return new (P9 || (P9 = Promise))(function(resolve15, reject) {
138295
138295
  function fulfilled(value) {
138296
138296
  try {
138297
138297
  step(generator.next(value));
@@ -138307,7 +138307,7 @@ var require_formatter = __commonJS((exports) => {
138307
138307
  }
138308
138308
  }
138309
138309
  function step(result) {
138310
- result.done ? resolve16(result.value) : adopt(result.value).then(fulfilled, rejected);
138310
+ result.done ? resolve15(result.value) : adopt(result.value).then(fulfilled, rejected);
138311
138311
  }
138312
138312
  step((generator = generator.apply(thisArg, _arguments || [])).next());
138313
138313
  });
@@ -142960,7 +142960,7 @@ var require_url = __commonJS((exports) => {
142960
142960
  };
142961
142961
  Object.defineProperty(exports, "__esModule", { value: true });
142962
142962
  exports.parse = undefined;
142963
- exports.resolve = resolve16;
142963
+ exports.resolve = resolve15;
142964
142964
  exports.cwd = cwd;
142965
142965
  exports.getProtocol = getProtocol;
142966
142966
  exports.getExtension = getExtension;
@@ -142988,7 +142988,7 @@ var require_url = __commonJS((exports) => {
142988
142988
  var urlDecodePatterns = [/%23/g, "#", /%24/g, "$", /%26/g, "&", /%2C/g, ",", /%40/g, "@"];
142989
142989
  var parse11 = (u4) => new URL(u4);
142990
142990
  exports.parse = parse11;
142991
- function resolve16(from, to5) {
142991
+ function resolve15(from, to5) {
142992
142992
  const fromUrl = new URL((0, convert_path_to_posix_1.default)(from), "https://aaa.nonexistanturl.com");
142993
142993
  const resolvedUrl = new URL((0, convert_path_to_posix_1.default)(to5), fromUrl);
142994
142994
  const endSpaces = to5.match(/(\s*)$/)?.[1] || "";
@@ -143124,7 +143124,7 @@ var require_url = __commonJS((exports) => {
143124
143124
  }
143125
143125
  function relative5(from, to5) {
143126
143126
  if (!isFileSystemPath(from) || !isFileSystemPath(to5)) {
143127
- return resolve16(from, to5);
143127
+ return resolve15(from, to5);
143128
143128
  }
143129
143129
  const fromDir = path_1.default.dirname(stripHash(from));
143130
143130
  const toPath4 = stripHash(to5);
@@ -143800,7 +143800,7 @@ var require_plugins = __commonJS((exports) => {
143800
143800
  let plugin;
143801
143801
  let lastError;
143802
143802
  let index = 0;
143803
- return new Promise((resolve16, reject) => {
143803
+ return new Promise((resolve15, reject) => {
143804
143804
  runNextPlugin();
143805
143805
  function runNextPlugin() {
143806
143806
  plugin = plugins[index++];
@@ -143828,7 +143828,7 @@ var require_plugins = __commonJS((exports) => {
143828
143828
  }
143829
143829
  }
143830
143830
  function onSuccess(result) {
143831
- resolve16({
143831
+ resolve15({
143832
143832
  plugin,
143833
143833
  result
143834
143834
  });
@@ -145161,11 +145161,11 @@ var require_lib3 = __commonJS((exports) => {
145161
145161
  var require_resolver = __commonJS((exports) => {
145162
145162
  var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
145163
145163
  function adopt(value) {
145164
- return value instanceof P9 ? value : new P9(function(resolve16) {
145165
- resolve16(value);
145164
+ return value instanceof P9 ? value : new P9(function(resolve15) {
145165
+ resolve15(value);
145166
145166
  });
145167
145167
  }
145168
- return new (P9 || (P9 = Promise))(function(resolve16, reject) {
145168
+ return new (P9 || (P9 = Promise))(function(resolve15, reject) {
145169
145169
  function fulfilled(value) {
145170
145170
  try {
145171
145171
  step(generator.next(value));
@@ -145181,7 +145181,7 @@ var require_resolver = __commonJS((exports) => {
145181
145181
  }
145182
145182
  }
145183
145183
  function step(result) {
145184
- result.done ? resolve16(result.value) : adopt(result.value).then(fulfilled, rejected);
145184
+ result.done ? resolve15(result.value) : adopt(result.value).then(fulfilled, rejected);
145185
145185
  }
145186
145186
  step((generator = generator.apply(thisArg, _arguments || [])).next());
145187
145187
  });
@@ -145302,11 +145302,11 @@ var require_optionValidator = __commonJS((exports) => {
145302
145302
  var require_src3 = __commonJS((exports) => {
145303
145303
  var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P9, generator) {
145304
145304
  function adopt(value) {
145305
- return value instanceof P9 ? value : new P9(function(resolve16) {
145306
- resolve16(value);
145305
+ return value instanceof P9 ? value : new P9(function(resolve15) {
145306
+ resolve15(value);
145307
145307
  });
145308
145308
  }
145309
- return new (P9 || (P9 = Promise))(function(resolve16, reject) {
145309
+ return new (P9 || (P9 = Promise))(function(resolve15, reject) {
145310
145310
  function fulfilled(value) {
145311
145311
  try {
145312
145312
  step(generator.next(value));
@@ -145322,7 +145322,7 @@ var require_src3 = __commonJS((exports) => {
145322
145322
  }
145323
145323
  }
145324
145324
  function step(result) {
145325
- result.done ? resolve16(result.value) : adopt(result.value).then(fulfilled, rejected);
145325
+ result.done ? resolve15(result.value) : adopt(result.value).then(fulfilled, rejected);
145326
145326
  }
145327
145327
  step((generator = generator.apply(thisArg, _arguments || [])).next());
145328
145328
  });
@@ -150984,11 +150984,11 @@ var require_raw_body = __commonJS((exports, module) => {
150984
150984
  if (done) {
150985
150985
  return readStream(stream, encoding, length, limit, wrap(done));
150986
150986
  }
150987
- return new Promise(function executor(resolve16, reject) {
150987
+ return new Promise(function executor(resolve15, reject) {
150988
150988
  readStream(stream, encoding, length, limit, function onRead2(err, buf) {
150989
150989
  if (err)
150990
150990
  return reject(err);
150991
- resolve16(buf);
150991
+ resolve15(buf);
150992
150992
  });
150993
150993
  });
150994
150994
  }
@@ -164113,7 +164113,7 @@ var require_view = __commonJS((exports, module) => {
164113
164113
  var basename6 = path18.basename;
164114
164114
  var extname3 = path18.extname;
164115
164115
  var join29 = path18.join;
164116
- var resolve16 = path18.resolve;
164116
+ var resolve15 = path18.resolve;
164117
164117
  module.exports = View;
164118
164118
  function View(name2, options8) {
164119
164119
  var opts = options8 || {};
@@ -164147,7 +164147,7 @@ var require_view = __commonJS((exports, module) => {
164147
164147
  debug('lookup "%s"', name2);
164148
164148
  for (var i5 = 0;i5 < roots.length && !path19; i5++) {
164149
164149
  var root2 = roots[i5];
164150
- var loc = resolve16(root2, name2);
164150
+ var loc = resolve15(root2, name2);
164151
164151
  var dir = dirname21(loc);
164152
164152
  var file2 = basename6(loc);
164153
164153
  path19 = this.resolve(dir, file2);
@@ -164172,7 +164172,7 @@ var require_view = __commonJS((exports, module) => {
164172
164172
  });
164173
164173
  sync = false;
164174
164174
  };
164175
- View.prototype.resolve = function resolve17(dir, file2) {
164175
+ View.prototype.resolve = function resolve16(dir, file2) {
164176
164176
  var ext = this.ext;
164177
164177
  var path19 = join29(dir, file2);
164178
164178
  var stat4 = tryStat(path19);
@@ -166331,7 +166331,7 @@ var require_application = __commonJS((exports, module) => {
166331
166331
  var compileETag = require_utils10().compileETag;
166332
166332
  var compileQueryParser = require_utils10().compileQueryParser;
166333
166333
  var compileTrust = require_utils10().compileTrust;
166334
- var resolve16 = __require("node:path").resolve;
166334
+ var resolve15 = __require("node:path").resolve;
166335
166335
  var once9 = require_once();
166336
166336
  var Router = require_router();
166337
166337
  var slice = Array.prototype.slice;
@@ -166385,7 +166385,7 @@ var require_application = __commonJS((exports, module) => {
166385
166385
  this.mountpath = "/";
166386
166386
  this.locals.settings = this.settings;
166387
166387
  this.set("view", View);
166388
- this.set("views", resolve16("views"));
166388
+ this.set("views", resolve15("views"));
166389
166389
  this.set("jsonp callback name", "callback");
166390
166390
  if (env4 === "production") {
166391
166391
  this.enable("view cache");
@@ -167876,7 +167876,7 @@ var require_send = __commonJS((exports, module) => {
167876
167876
  var extname3 = path18.extname;
167877
167877
  var join29 = path18.join;
167878
167878
  var normalize2 = path18.normalize;
167879
- var resolve16 = path18.resolve;
167879
+ var resolve15 = path18.resolve;
167880
167880
  var sep2 = path18.sep;
167881
167881
  var BYTES_RANGE_REGEXP = /^ *bytes=/;
167882
167882
  var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1000;
@@ -167905,7 +167905,7 @@ var require_send = __commonJS((exports, module) => {
167905
167905
  this._maxage = opts.maxAge || opts.maxage;
167906
167906
  this._maxage = typeof this._maxage === "string" ? ms9(this._maxage) : Number(this._maxage);
167907
167907
  this._maxage = !isNaN(this._maxage) ? Math.min(Math.max(0, this._maxage), MAX_MAXAGE) : 0;
167908
- this._root = opts.root ? resolve16(opts.root) : null;
167908
+ this._root = opts.root ? resolve15(opts.root) : null;
167909
167909
  }
167910
167910
  util2.inherits(SendStream, Stream2);
167911
167911
  SendStream.prototype.error = function error48(status, err) {
@@ -168054,7 +168054,7 @@ var require_send = __commonJS((exports, module) => {
168054
168054
  return res;
168055
168055
  }
168056
168056
  parts = normalize2(path19).split(sep2);
168057
- path19 = resolve16(path19);
168057
+ path19 = resolve15(path19);
168058
168058
  }
168059
168059
  if (containsDotFile(parts)) {
168060
168060
  debug('%s dotfile "%s"', this._dotfiles, path19);
@@ -168382,7 +168382,7 @@ var require_response = __commonJS((exports, module) => {
168382
168382
  var cookie = require_cookie();
168383
168383
  var send = require_send();
168384
168384
  var extname3 = path18.extname;
168385
- var resolve16 = path18.resolve;
168385
+ var resolve15 = path18.resolve;
168386
168386
  var vary = require_vary();
168387
168387
  var { Buffer: Buffer7 } = __require("node:buffer");
168388
168388
  var res = Object.create(http.ServerResponse.prototype);
@@ -168591,7 +168591,7 @@ var require_response = __commonJS((exports, module) => {
168591
168591
  }
168592
168592
  opts = Object.create(opts);
168593
168593
  opts.headers = headers;
168594
- var fullPath = !opts.root ? resolve16(path19) : path19;
168594
+ var fullPath = !opts.root ? resolve15(path19) : path19;
168595
168595
  return this.sendFile(fullPath, opts, done);
168596
168596
  };
168597
168597
  res.contentType = res.type = function contentType(type) {
@@ -168852,7 +168852,7 @@ var require_serve_static = __commonJS((exports, module) => {
168852
168852
  var encodeUrl = require_encodeurl();
168853
168853
  var escapeHtml = require_escape_html();
168854
168854
  var parseUrl = require_parseurl();
168855
- var resolve16 = __require("path").resolve;
168855
+ var resolve15 = __require("path").resolve;
168856
168856
  var send = require_send();
168857
168857
  var url3 = __require("url");
168858
168858
  module.exports = serveStatic;
@@ -168871,7 +168871,7 @@ var require_serve_static = __commonJS((exports, module) => {
168871
168871
  throw new TypeError("option setHeaders must be function");
168872
168872
  }
168873
168873
  opts.maxage = opts.maxage || opts.maxAge || 0;
168874
- opts.root = resolve16(root2);
168874
+ opts.root = resolve15(root2);
168875
168875
  var onDirectory = redirect ? createRedirectDirectoryListener() : createNotFoundDirectoryListener();
168876
168876
  return function serveStatic2(req, res, next) {
168877
168877
  if (req.method !== "GET" && req.method !== "HEAD") {
@@ -172245,8 +172245,8 @@ var require_executor = __commonJS((exports, module) => {
172245
172245
  }
172246
172246
  resetBuffer() {
172247
172247
  this.buffer = new Waterfall;
172248
- this.buffer.chain(new Promise((resolve16) => {
172249
- this._triggerBuffer = resolve16;
172248
+ this.buffer.chain(new Promise((resolve15) => {
172249
+ this._triggerBuffer = resolve15;
172250
172250
  }));
172251
172251
  if (this.ready)
172252
172252
  this._triggerBuffer();
@@ -173266,7 +173266,7 @@ var require_storage = __commonJS((exports, module) => {
173266
173266
  throw e8;
173267
173267
  }
173268
173268
  };
173269
- var writeFileLinesAsync = (filename, lines, mode = DEFAULT_FILE_MODE) => new Promise((resolve16, reject) => {
173269
+ var writeFileLinesAsync = (filename, lines, mode = DEFAULT_FILE_MODE) => new Promise((resolve15, reject) => {
173270
173270
  try {
173271
173271
  const stream = writeFileStream(filename, { mode });
173272
173272
  const readable2 = Readable6.from(lines);
@@ -173283,7 +173283,7 @@ var require_storage = __commonJS((exports, module) => {
173283
173283
  if (err)
173284
173284
  reject(err);
173285
173285
  else
173286
- resolve16();
173286
+ resolve15();
173287
173287
  });
173288
173288
  });
173289
173289
  readable2.on("error", (err) => {
@@ -173454,7 +173454,7 @@ var require_persistence = __commonJS((exports, module) => {
173454
173454
  return { data: tdata, indexes };
173455
173455
  }
173456
173456
  treatRawStreamAsync(rawStream) {
173457
- return new Promise((resolve16, reject) => {
173457
+ return new Promise((resolve15, reject) => {
173458
173458
  const dataById = {};
173459
173459
  const indexes = {};
173460
173460
  let corruptItems = 0;
@@ -173497,7 +173497,7 @@ var require_persistence = __commonJS((exports, module) => {
173497
173497
  }
173498
173498
  }
173499
173499
  const data = Object.values(dataById);
173500
- resolve16({ data, indexes });
173500
+ resolve15({ data, indexes });
173501
173501
  });
173502
173502
  lineStream.on("error", function(err) {
173503
173503
  reject(err, null);
@@ -199108,13 +199108,13 @@ var require_broadcast_operator = __commonJS((exports) => {
199108
199108
  return true;
199109
199109
  }
199110
199110
  emitWithAck(ev2, ...args) {
199111
- return new Promise((resolve16, reject) => {
199111
+ return new Promise((resolve15, reject) => {
199112
199112
  args.push((err, responses) => {
199113
199113
  if (err) {
199114
199114
  err.responses = responses;
199115
199115
  return reject(err);
199116
199116
  } else {
199117
- return resolve16(responses);
199117
+ return resolve15(responses);
199118
199118
  }
199119
199119
  });
199120
199120
  this.emit(ev2, ...args);
@@ -199302,12 +199302,12 @@ var require_socket2 = __commonJS((exports) => {
199302
199302
  }
199303
199303
  emitWithAck(ev2, ...args) {
199304
199304
  const withErr = this.flags.timeout !== undefined;
199305
- return new Promise((resolve16, reject) => {
199305
+ return new Promise((resolve15, reject) => {
199306
199306
  args.push((arg1, arg2) => {
199307
199307
  if (withErr) {
199308
- return arg1 ? reject(arg1) : resolve16(arg2);
199308
+ return arg1 ? reject(arg1) : resolve15(arg2);
199309
199309
  } else {
199310
- return resolve16(arg1);
199310
+ return resolve15(arg1);
199311
199311
  }
199312
199312
  });
199313
199313
  this.emit(ev2, ...args);
@@ -199762,13 +199762,13 @@ var require_namespace = __commonJS((exports) => {
199762
199762
  return true;
199763
199763
  }
199764
199764
  serverSideEmitWithAck(ev2, ...args) {
199765
- return new Promise((resolve16, reject) => {
199765
+ return new Promise((resolve15, reject) => {
199766
199766
  args.push((err, responses) => {
199767
199767
  if (err) {
199768
199768
  err.responses = responses;
199769
199769
  return reject(err);
199770
199770
  } else {
199771
- return resolve16(responses);
199771
+ return resolve15(responses);
199772
199772
  }
199773
199773
  });
199774
199774
  this.serverSideEmit(ev2, ...args);
@@ -203303,7 +203303,7 @@ var require_cluster_adapter = __commonJS((exports) => {
203303
203303
  return localSockets;
203304
203304
  }
203305
203305
  const requestId = randomId();
203306
- return new Promise((resolve16, reject) => {
203306
+ return new Promise((resolve15, reject) => {
203307
203307
  const timeout3 = setTimeout(() => {
203308
203308
  const storedRequest2 = this.requests.get(requestId);
203309
203309
  if (storedRequest2) {
@@ -203313,7 +203313,7 @@ var require_cluster_adapter = __commonJS((exports) => {
203313
203313
  }, opts.flags.timeout || DEFAULT_TIMEOUT);
203314
203314
  const storedRequest = {
203315
203315
  type: MessageType.FETCH_SOCKETS,
203316
- resolve: resolve16,
203316
+ resolve: resolve15,
203317
203317
  timeout: timeout3,
203318
203318
  current: 0,
203319
203319
  expected: expectedResponseCount,
@@ -203523,7 +203523,7 @@ var require_cluster_adapter = __commonJS((exports) => {
203523
203523
  return localSockets;
203524
203524
  }
203525
203525
  const requestId = randomId();
203526
- return new Promise((resolve16, reject) => {
203526
+ return new Promise((resolve15, reject) => {
203527
203527
  const timeout3 = setTimeout(() => {
203528
203528
  const storedRequest2 = this.customRequests.get(requestId);
203529
203529
  if (storedRequest2) {
@@ -203533,7 +203533,7 @@ var require_cluster_adapter = __commonJS((exports) => {
203533
203533
  }, opts.flags.timeout || DEFAULT_TIMEOUT);
203534
203534
  const storedRequest = {
203535
203535
  type: MessageType.FETCH_SOCKETS,
203536
- resolve: resolve16,
203536
+ resolve: resolve15,
203537
203537
  timeout: timeout3,
203538
203538
  missingUids: new Set([...this.nodesMap.keys()]),
203539
203539
  responses: localSockets
@@ -204262,13 +204262,13 @@ var require_dist4 = __commonJS((exports, module) => {
204262
204262
  this.engine.close();
204263
204263
  (0, uws_1.restoreAdapter)();
204264
204264
  if (this.httpServer) {
204265
- return new Promise((resolve16) => {
204265
+ return new Promise((resolve15) => {
204266
204266
  this.httpServer.close((err) => {
204267
204267
  fn9 && fn9(err);
204268
204268
  if (err) {
204269
204269
  debug("server was not running");
204270
204270
  }
204271
- resolve16();
204271
+ resolve15();
204272
204272
  });
204273
204273
  });
204274
204274
  } else {
@@ -218930,14 +218930,14 @@ var require_async_iterator = __commonJS((exports, module) => {
218930
218930
  };
218931
218931
  }
218932
218932
  function readAndResolve(iter) {
218933
- var resolve16 = iter[kLastResolve];
218934
- if (resolve16 !== null) {
218933
+ var resolve15 = iter[kLastResolve];
218934
+ if (resolve15 !== null) {
218935
218935
  var data = iter[kStream].read();
218936
218936
  if (data !== null) {
218937
218937
  iter[kLastPromise] = null;
218938
218938
  iter[kLastResolve] = null;
218939
218939
  iter[kLastReject] = null;
218940
- resolve16(createIterResult(data, false));
218940
+ resolve15(createIterResult(data, false));
218941
218941
  }
218942
218942
  }
218943
218943
  }
@@ -218945,13 +218945,13 @@ var require_async_iterator = __commonJS((exports, module) => {
218945
218945
  process.nextTick(readAndResolve, iter);
218946
218946
  }
218947
218947
  function wrapForNext(lastPromise, iter) {
218948
- return function(resolve16, reject) {
218948
+ return function(resolve15, reject) {
218949
218949
  lastPromise.then(function() {
218950
218950
  if (iter[kEnded]) {
218951
- resolve16(createIterResult(undefined, true));
218951
+ resolve15(createIterResult(undefined, true));
218952
218952
  return;
218953
218953
  }
218954
- iter[kHandlePromise](resolve16, reject);
218954
+ iter[kHandlePromise](resolve15, reject);
218955
218955
  }, reject);
218956
218956
  };
218957
218957
  }
@@ -218970,12 +218970,12 @@ var require_async_iterator = __commonJS((exports, module) => {
218970
218970
  return Promise.resolve(createIterResult(undefined, true));
218971
218971
  }
218972
218972
  if (this[kStream].destroyed) {
218973
- return new Promise(function(resolve16, reject) {
218973
+ return new Promise(function(resolve15, reject) {
218974
218974
  process.nextTick(function() {
218975
218975
  if (_this[kError]) {
218976
218976
  reject(_this[kError]);
218977
218977
  } else {
218978
- resolve16(createIterResult(undefined, true));
218978
+ resolve15(createIterResult(undefined, true));
218979
218979
  }
218980
218980
  });
218981
218981
  });
@@ -218998,13 +218998,13 @@ var require_async_iterator = __commonJS((exports, module) => {
218998
218998
  return this;
218999
218999
  }), _defineProperty(_Object$setPrototypeO, "return", function _return() {
219000
219000
  var _this2 = this;
219001
- return new Promise(function(resolve16, reject) {
219001
+ return new Promise(function(resolve15, reject) {
219002
219002
  _this2[kStream].destroy(null, function(err) {
219003
219003
  if (err) {
219004
219004
  reject(err);
219005
219005
  return;
219006
219006
  }
219007
- resolve16(createIterResult(undefined, true));
219007
+ resolve15(createIterResult(undefined, true));
219008
219008
  });
219009
219009
  });
219010
219010
  }), _Object$setPrototypeO), AsyncIteratorPrototype);
@@ -219026,15 +219026,15 @@ var require_async_iterator = __commonJS((exports, module) => {
219026
219026
  value: stream._readableState.endEmitted,
219027
219027
  writable: true
219028
219028
  }), _defineProperty(_Object$create, kHandlePromise, {
219029
- value: function value(resolve16, reject) {
219029
+ value: function value(resolve15, reject) {
219030
219030
  var data = iterator[kStream].read();
219031
219031
  if (data) {
219032
219032
  iterator[kLastPromise] = null;
219033
219033
  iterator[kLastResolve] = null;
219034
219034
  iterator[kLastReject] = null;
219035
- resolve16(createIterResult(data, false));
219035
+ resolve15(createIterResult(data, false));
219036
219036
  } else {
219037
- iterator[kLastResolve] = resolve16;
219037
+ iterator[kLastResolve] = resolve15;
219038
219038
  iterator[kLastReject] = reject;
219039
219039
  }
219040
219040
  },
@@ -219053,12 +219053,12 @@ var require_async_iterator = __commonJS((exports, module) => {
219053
219053
  iterator[kError] = err;
219054
219054
  return;
219055
219055
  }
219056
- var resolve16 = iterator[kLastResolve];
219057
- if (resolve16 !== null) {
219056
+ var resolve15 = iterator[kLastResolve];
219057
+ if (resolve15 !== null) {
219058
219058
  iterator[kLastPromise] = null;
219059
219059
  iterator[kLastResolve] = null;
219060
219060
  iterator[kLastReject] = null;
219061
- resolve16(createIterResult(undefined, true));
219061
+ resolve15(createIterResult(undefined, true));
219062
219062
  }
219063
219063
  iterator[kEnded] = true;
219064
219064
  });
@@ -219070,7 +219070,7 @@ var require_async_iterator = __commonJS((exports, module) => {
219070
219070
 
219071
219071
  // ../../node_modules/readable-stream/lib/internal/streams/from.js
219072
219072
  var require_from = __commonJS((exports, module) => {
219073
- function asyncGeneratorStep(gen, resolve16, reject, _next, _throw, key2, arg) {
219073
+ function asyncGeneratorStep(gen, resolve15, reject, _next, _throw, key2, arg) {
219074
219074
  try {
219075
219075
  var info = gen[key2](arg);
219076
219076
  var value = info.value;
@@ -219079,7 +219079,7 @@ var require_from = __commonJS((exports, module) => {
219079
219079
  return;
219080
219080
  }
219081
219081
  if (info.done) {
219082
- resolve16(value);
219082
+ resolve15(value);
219083
219083
  } else {
219084
219084
  Promise.resolve(value).then(_next, _throw);
219085
219085
  }
@@ -219087,13 +219087,13 @@ var require_from = __commonJS((exports, module) => {
219087
219087
  function _asyncToGenerator(fn9) {
219088
219088
  return function() {
219089
219089
  var self2 = this, args = arguments;
219090
- return new Promise(function(resolve16, reject) {
219090
+ return new Promise(function(resolve15, reject) {
219091
219091
  var gen = fn9.apply(self2, args);
219092
219092
  function _next(value) {
219093
- asyncGeneratorStep(gen, resolve16, reject, _next, _throw, "next", value);
219093
+ asyncGeneratorStep(gen, resolve15, reject, _next, _throw, "next", value);
219094
219094
  }
219095
219095
  function _throw(err) {
219096
- asyncGeneratorStep(gen, resolve16, reject, _next, _throw, "throw", err);
219096
+ asyncGeneratorStep(gen, resolve15, reject, _next, _throw, "throw", err);
219097
219097
  }
219098
219098
  _next(undefined);
219099
219099
  });
@@ -247439,7 +247439,7 @@ async function createProjectFilesForExistingProject(options) {
247439
247439
  };
247440
247440
  }
247441
247441
  // src/core/project/deploy.ts
247442
- import { resolve as resolve3 } from "node:path";
247442
+ import { resolve as resolve6 } from "node:path";
247443
247443
 
247444
247444
  // src/core/site/api.ts
247445
247445
  async function uploadSite(archivePath) {
@@ -247506,340 +247506,89 @@ async function createArchive(pathToArchive, targetArchivePath) {
247506
247506
  cwd: pathToArchive
247507
247507
  }, ["."]);
247508
247508
  }
247509
- // src/core/project/deploy.ts
247510
- function hasResourcesToDeploy(projectData) {
247511
- const {
247512
- project,
247513
- entities,
247514
- functions,
247515
- agents,
247516
- agentSkills,
247517
- connectors,
247518
- authConfig
247519
- } = projectData;
247520
- const hasSite = Boolean(project.site?.outputDirectory);
247521
- const hasEntities = entities.length > 0;
247522
- const hasFunctions = functions.length > 0;
247523
- const hasAgents = agents.length > 0;
247524
- const hasAgentSkills = agentSkills.length > 0;
247525
- const hasConnectors = connectors.length > 0;
247526
- const hasAuthConfig = authConfig.length > 0;
247527
- const hasVisibility = Boolean(project.visibility);
247528
- return hasEntities || hasFunctions || hasAgents || hasAgentSkills || hasConnectors || hasAuthConfig || hasVisibility || hasSite;
247529
- }
247530
- async function deployAll(projectData, options) {
247531
- const {
247532
- project,
247533
- entities,
247534
- functions,
247535
- agents,
247536
- agentSkills,
247537
- connectors,
247538
- authConfig
247539
- } = projectData;
247540
- await setAppVisibility(project.visibility);
247541
- if (project.visibility) {
247542
- options?.onVisibilitySet?.(project.visibility);
247543
- }
247544
- await entityResource.push(entities);
247545
- await deployFunctionsSequentially(functions, {
247546
- onStart: options?.onFunctionStart,
247547
- onResult: options?.onFunctionResult
247548
- });
247549
- await agentSkillResource.push(agentSkills);
247550
- await agentResource.push(agents);
247551
- await authConfigResource.push(authConfig);
247552
- const skipConnectorSync = connectors.length === 0 && hasWorkspaceApiKeyAuth();
247553
- const connectorResults = skipConnectorSync ? [] : (await pushConnectors(connectors)).results;
247554
- if ((options?.site ?? true) && project.site?.outputDirectory) {
247555
- const outputDir = resolve3(project.root, project.site.outputDirectory);
247556
- const { appUrl } = await deploySite(outputDir);
247557
- return { appUrl, connectorResults };
247558
- }
247559
- return { connectorResults };
247560
- }
247561
- // src/core/clients/base44-client.ts
247562
- var retriedRequests = new WeakSet;
247563
- async function captureRequestBody(request, options) {
247564
- if (request.body == null) {
247565
- return;
247566
- }
247567
- try {
247568
- const cloned = request.clone();
247569
- const text = await cloned.text();
247570
- options.context.__requestBody = text;
247571
- } catch {}
247572
- }
247573
- async function handleUnauthorized(request, _options, response) {
247574
- if (response.status !== 401) {
247575
- return;
247576
- }
247577
- if (hasWorkspaceApiKeyAuth()) {
247578
- return;
247579
- }
247580
- if (retriedRequests.has(request)) {
247581
- return;
247582
- }
247583
- const newAccessToken = await refreshAndSaveTokens();
247584
- if (!newAccessToken) {
247585
- return;
247586
- }
247587
- retriedRequests.add(request);
247588
- const requestId = request.headers.get("X-Request-ID");
247589
- return distribution_default(request.clone(), {
247590
- headers: {
247591
- ...requestId && { "X-Request-ID": requestId },
247592
- Authorization: `Bearer ${newAccessToken}`
247593
- }
247594
- });
247595
- }
247596
- var base44Client = distribution_default.create({
247597
- prefixUrl: getBase44ApiUrl(),
247598
- headers: {
247599
- "User-Agent": "Base44 CLI"
247600
- },
247601
- hooks: {
247602
- beforeRequest: [
247603
- (request) => {
247604
- request.headers.set("X-Request-ID", randomUUID2());
247605
- },
247606
- captureRequestBody,
247607
- async (request) => {
247608
- const workspaceApiKey = getWorkspaceApiKeyFromEnv();
247609
- if (workspaceApiKey && isWorkspaceApiKey(workspaceApiKey)) {
247610
- request.headers.set("api_key", workspaceApiKey);
247611
- return;
247612
- }
247613
- try {
247614
- const auth = await readAuth();
247615
- if (isTokenExpired(auth)) {
247616
- const newAccessToken = await refreshAndSaveTokens();
247617
- if (newAccessToken) {
247618
- request.headers.set("Authorization", `Bearer ${newAccessToken}`);
247619
- return;
247620
- }
247621
- }
247622
- request.headers.set("Authorization", `Bearer ${auth.accessToken}`);
247623
- } catch {}
247624
- }
247625
- ],
247626
- afterResponse: [handleUnauthorized]
247627
- }
247628
- });
247629
- function getAppClient() {
247630
- const { id } = getAppContext();
247631
- return base44Client.extend({
247632
- prefixUrl: new URL(`/api/apps/${id}/`, getBase44ApiUrl()).href
247633
- });
247634
- }
247635
- function getSandboxClient(appId) {
247636
- return base44Client.extend({
247637
- prefixUrl: new URL(`/api/apps/${appId}/sandbox-bridge/`, getBase44ApiUrl()).href
247638
- });
247639
- }
247640
- // src/core/clients/oauth-client.ts
247641
- import { randomUUID as randomUUID3 } from "node:crypto";
247642
- var oauthClient = distribution_default.create({
247643
- prefixUrl: getBase44ApiUrl(),
247644
- headers: {
247645
- "User-Agent": "Base44 CLI"
247646
- },
247647
- hooks: {
247648
- beforeRequest: [
247649
- (request) => {
247650
- request.headers.set("X-Request-ID", randomUUID3());
247651
- }
247652
- ]
247653
- }
247509
+ // src/core/site/deploy-app.ts
247510
+ import { resolve as resolve5 } from "node:path";
247511
+
247512
+ // src/core/deployments/api.ts
247513
+ import { readFile as readFile2 } from "node:fs/promises";
247514
+
247515
+ // src/core/deployments/schema.ts
247516
+ var GIT_HASH_PATTERN = /^[a-fA-F0-9]{7,64}$/;
247517
+ var CreateDeploymentResponseSchema = exports_external.object({
247518
+ deployment_id: exports_external.string(),
247519
+ asset_buckets: exports_external.array(exports_external.array(exports_external.string()))
247520
+ }).transform((data) => ({
247521
+ deploymentId: data.deployment_id,
247522
+ assetBuckets: data.asset_buckets
247523
+ }));
247524
+ var AssetUploadResponseSchema = exports_external.looseObject({
247525
+ result: exports_external.looseObject({ jwt: exports_external.string().nullable().optional() }).nullable().optional()
247654
247526
  });
247655
- // src/core/auth/api.ts
247656
- async function generateDeviceCode() {
247657
- const response = await oauthClient.post("oauth/device/code", {
247658
- json: {
247659
- client_id: AUTH_CLIENT_ID,
247660
- scope: "apps:read apps:write sandbox:write"
247661
- },
247662
- throwHttpErrors: false
247663
- });
247664
- if (!response.ok) {
247665
- throw new ApiError(`Failed to generate device code: ${response.status} ${response.statusText}`, { statusCode: response.status });
247666
- }
247667
- const result = DeviceCodeResponseSchema.safeParse(await response.json());
247668
- if (!result.success) {
247669
- throw new SchemaValidationError("Invalid device code response from server", result.error);
247670
- }
247671
- return result.data;
247672
- }
247673
- async function getTokenFromDeviceCode(deviceCode) {
247674
- const searchParams = new URLSearchParams;
247675
- searchParams.set("grant_type", "urn:ietf:params:oauth:grant-type:device_code");
247676
- searchParams.set("device_code", deviceCode);
247677
- searchParams.set("client_id", AUTH_CLIENT_ID);
247678
- const response = await oauthClient.post("oauth/token", {
247679
- body: searchParams.toString(),
247680
- headers: {
247681
- "Content-Type": "application/x-www-form-urlencoded"
247682
- },
247683
- throwHttpErrors: false
247684
- });
247685
- const json2 = await response.json();
247686
- if (!response.ok) {
247687
- const errorResult = OAuthErrorSchema.safeParse(json2);
247688
- if (!errorResult.success) {
247689
- throw new SchemaValidationError("Token request failed", errorResult.error);
247690
- }
247691
- const { error: error48, error_description } = errorResult.data;
247692
- if (error48 === "authorization_pending" || error48 === "slow_down") {
247693
- return null;
247694
- }
247695
- throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
247696
- statusCode: response.status
247527
+ var FinalizeDeploymentResponseSchema = exports_external.object({
247528
+ deployment_id: exports_external.string()
247529
+ }).transform((data) => ({
247530
+ deploymentId: data.deployment_id
247531
+ }));
247532
+
247533
+ // src/core/deployments/api.ts
247534
+ var MODULE_CONTENT_TYPES = {
247535
+ esm: "application/javascript+module",
247536
+ sourcemap: "application/source-map",
247537
+ wasm: "application/wasm",
247538
+ text: "text/plain",
247539
+ data: "application/octet-stream"
247540
+ };
247541
+ async function createDeployment(request) {
247542
+ const appClient = getAppClient();
247543
+ let response;
247544
+ try {
247545
+ response = await appClient.post("deployments", {
247546
+ json: request,
247547
+ timeout: 120000
247697
247548
  });
247549
+ } catch (error48) {
247550
+ throw await ApiError.fromHttpError(error48, "creating deployment");
247698
247551
  }
247699
- const result = TokenResponseSchema.safeParse(json2);
247552
+ const result = CreateDeploymentResponseSchema.safeParse(await response.json());
247700
247553
  if (!result.success) {
247701
- throw new SchemaValidationError("Invalid token response from server", result.error);
247554
+ throw new SchemaValidationError("Invalid response from server", result.error);
247702
247555
  }
247703
247556
  return result.data;
247704
247557
  }
247705
- async function renewAccessToken(refreshToken) {
247706
- const searchParams = new URLSearchParams;
247707
- searchParams.set("grant_type", "refresh_token");
247708
- searchParams.set("refresh_token", refreshToken);
247709
- searchParams.set("client_id", AUTH_CLIENT_ID);
247710
- const response = await oauthClient.post("oauth/token", {
247711
- body: searchParams.toString(),
247712
- headers: {
247713
- "Content-Type": "application/x-www-form-urlencoded"
247714
- },
247715
- throwHttpErrors: false
247558
+ async function uploadAssetBucket(deploymentId, formData) {
247559
+ const appClient = getAppClient();
247560
+ const response = await appClient.post(`deployments/${encodeURIComponent(deploymentId)}/assets`, {
247561
+ searchParams: { base64: "true" },
247562
+ body: formData,
247563
+ timeout: 120000,
247564
+ retry: 0
247716
247565
  });
247717
- const json2 = await response.json();
247718
- if (!response.ok) {
247719
- const errorResult = OAuthErrorSchema.safeParse(json2);
247720
- if (!errorResult.success) {
247721
- throw new ApiError(`Token refresh failed: ${response.statusText}`, {
247722
- statusCode: response.status
247723
- });
247724
- }
247725
- const { error: error48, error_description } = errorResult.data;
247726
- throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
247727
- statusCode: response.status
247728
- });
247729
- }
247730
- const result = TokenResponseSchema.safeParse(json2);
247731
- if (!result.success) {
247732
- throw new SchemaValidationError("Invalid token response from server", result.error);
247733
- }
247734
- return result.data;
247566
+ const parsed = AssetUploadResponseSchema.safeParse(await response.json());
247567
+ const jwt3 = parsed.success ? parsed.data.result?.jwt : null;
247568
+ return jwt3 || null;
247735
247569
  }
247736
- async function getUserInfo(accessToken) {
247737
- const response = await oauthClient.get("oauth/userinfo", {
247738
- headers: { Authorization: `Bearer ${accessToken}` }
247739
- });
247740
- if (!response.ok) {
247741
- throw new ApiError(`Failed to fetch user info: ${response.status}`, {
247742
- statusCode: response.status
247743
- });
247744
- }
247745
- const result = UserInfoSchema.safeParse(await response.json());
247746
- if (!result.success) {
247747
- throw new SchemaValidationError("Invalid UserInfo response from server", result.error);
247570
+ async function finalizeDeployment(deploymentId, completionJwt, modules) {
247571
+ const appClient = getAppClient();
247572
+ const formData = new FormData;
247573
+ formData.append("payload", JSON.stringify({ completion_jwt: completionJwt }));
247574
+ for (const module of modules) {
247575
+ const content = await readFile2(module.absolutePath);
247576
+ formData.append(module.name, new File([new Uint8Array(content)], module.name, {
247577
+ type: MODULE_CONTENT_TYPES[module.type]
247578
+ }));
247748
247579
  }
247749
- return result.data;
247750
- }
247751
- // src/cli/commands/auth/login-flow.ts
247752
- async function generateAndDisplayDeviceCode(log, runTask) {
247753
- const deviceCodeResponse = await runTask("Generating device code...", async () => {
247754
- return await generateDeviceCode();
247755
- }, {
247756
- successMessage: "Device code generated",
247757
- errorMessage: "Failed to generate device code"
247758
- });
247759
- log.info(`Verification code: ${theme.styles.bold(deviceCodeResponse.userCode)}` + `
247760
- Please confirm this code at: ${deviceCodeResponse.verificationUri}`);
247761
- return deviceCodeResponse;
247762
- }
247763
- async function waitForAuthentication(deviceCode, expiresIn, interval, runTask) {
247764
- let tokenResponse;
247580
+ let response;
247765
247581
  try {
247766
- await runTask("Waiting for authentication...", async () => {
247767
- await pWaitFor(async () => {
247768
- const result = await getTokenFromDeviceCode(deviceCode);
247769
- if (result !== null) {
247770
- tokenResponse = result;
247771
- return true;
247772
- }
247773
- return false;
247774
- }, {
247775
- interval: interval * 1000,
247776
- timeout: expiresIn * 1000
247777
- });
247778
- }, {
247779
- successMessage: "Authentication completed!",
247780
- errorMessage: "Authentication failed"
247781
- });
247582
+ response = await appClient.post(`deployments/${encodeURIComponent(deploymentId)}/finalize`, { body: formData, timeout: 180000 });
247782
247583
  } catch (error48) {
247783
- if (error48 instanceof Error && error48.message.includes("timed out")) {
247784
- throw new AuthExpiredError("Authentication timed out. Please try again.");
247785
- }
247786
- throw error48;
247787
- }
247788
- if (tokenResponse === undefined) {
247789
- throw new InternalError("Failed to retrieve authentication token.");
247790
- }
247791
- return tokenResponse;
247792
- }
247793
- async function saveAuthData(response, userInfo) {
247794
- const expiresAt = Date.now() + response.expiresIn * 1000;
247795
- await writeAuth({
247796
- accessToken: response.accessToken,
247797
- refreshToken: response.refreshToken,
247798
- expiresAt,
247799
- email: userInfo.email,
247800
- name: userInfo.name
247801
- });
247802
- }
247803
- async function login({
247804
- log,
247805
- runTask
247806
- }) {
247807
- const deviceCodeResponse = await generateAndDisplayDeviceCode(log, runTask);
247808
- const token = await waitForAuthentication(deviceCodeResponse.deviceCode, deviceCodeResponse.expiresIn, deviceCodeResponse.interval, runTask);
247809
- const userInfo = await getUserInfo(token.accessToken);
247810
- await saveAuthData(token, userInfo);
247811
- return {
247812
- outroMessage: `Successfully logged in as ${theme.styles.bold(userInfo.email)}`
247813
- };
247814
- }
247815
-
247816
- // src/cli/utils/command/middleware.ts
247817
- async function ensureAuth(ctx) {
247818
- if (hasWorkspaceApiKeyAuth()) {
247819
- ctx.errorReporter.setContext({
247820
- user: { email: "workspace-api-key", name: "Workspace API key" }
247821
- });
247822
- return;
247584
+ throw await ApiError.fromHttpError(error48, "finalizing deployment");
247823
247585
  }
247824
- await seedAuthFromEnv();
247825
- const loggedIn = await isLoggedIn();
247826
- if (!loggedIn) {
247827
- ctx.log.info("You need to login first to continue.");
247828
- await login(ctx);
247586
+ const result = FinalizeDeploymentResponseSchema.safeParse(await response.json());
247587
+ if (!result.success) {
247588
+ throw new SchemaValidationError("Invalid response from server", result.error);
247829
247589
  }
247830
- try {
247831
- const userInfo = await readAuth();
247832
- ctx.errorReporter.setContext({
247833
- user: { email: userInfo.email, name: userInfo.name }
247834
- });
247835
- } catch {}
247836
- }
247837
- async function ensureAppContext(ctx, options = {}) {
247838
- const appContext = await initAppContext(options);
247839
- ctx.app = appContext;
247840
- ctx.errorReporter.setContext({ appId: appContext.id });
247590
+ return result.data;
247841
247591
  }
247842
-
247843
247592
  // ../../node_modules/is-plain-obj/index.js
247844
247593
  function isPlainObject2(value) {
247845
247594
  if (typeof value !== "object" || value === null) {
@@ -247937,13 +247686,13 @@ var getJoinLength = (uint8Arrays) => {
247937
247686
  var isTemplateString = (templates) => Array.isArray(templates) && Array.isArray(templates.raw);
247938
247687
  var parseTemplates = (templates, expressions) => {
247939
247688
  let tokens = [];
247940
- for (const [index, template2] of templates.entries()) {
247689
+ for (const [index, template] of templates.entries()) {
247941
247690
  tokens = parseTemplate({
247942
247691
  templates,
247943
247692
  expressions,
247944
247693
  tokens,
247945
247694
  index,
247946
- template: template2
247695
+ template
247947
247696
  });
247948
247697
  }
247949
247698
  if (tokens.length === 0) {
@@ -247952,11 +247701,11 @@ var parseTemplates = (templates, expressions) => {
247952
247701
  const [file2, ...commandArguments] = tokens;
247953
247702
  return [file2, commandArguments, {}];
247954
247703
  };
247955
- var parseTemplate = ({ templates, expressions, tokens, index, template: template2 }) => {
247956
- if (template2 === undefined) {
247704
+ var parseTemplate = ({ templates, expressions, tokens, index, template }) => {
247705
+ if (template === undefined) {
247957
247706
  throw new TypeError(`Invalid backslash sequence: ${templates.raw[index]}`);
247958
247707
  }
247959
- const { nextTokens, leadingWhitespaces, trailingWhitespaces } = splitByWhitespaces(template2, templates.raw[index]);
247708
+ const { nextTokens, leadingWhitespaces, trailingWhitespaces } = splitByWhitespaces(template, templates.raw[index]);
247960
247709
  const newTokens = concatTokens(tokens, nextTokens, leadingWhitespaces);
247961
247710
  if (index === expressions.length) {
247962
247711
  return newTokens;
@@ -247965,18 +247714,18 @@ var parseTemplate = ({ templates, expressions, tokens, index, template: template
247965
247714
  const expressionTokens = Array.isArray(expression) ? expression.map((expression2) => parseExpression(expression2)) : [parseExpression(expression)];
247966
247715
  return concatTokens(newTokens, expressionTokens, trailingWhitespaces);
247967
247716
  };
247968
- var splitByWhitespaces = (template2, rawTemplate) => {
247717
+ var splitByWhitespaces = (template, rawTemplate) => {
247969
247718
  if (rawTemplate.length === 0) {
247970
247719
  return { nextTokens: [], leadingWhitespaces: false, trailingWhitespaces: false };
247971
247720
  }
247972
247721
  const nextTokens = [];
247973
247722
  let templateStart = 0;
247974
247723
  const leadingWhitespaces = DELIMITERS.has(rawTemplate[0]);
247975
- for (let templateIndex = 0, rawIndex = 0;templateIndex < template2.length; templateIndex += 1, rawIndex += 1) {
247724
+ for (let templateIndex = 0, rawIndex = 0;templateIndex < template.length; templateIndex += 1, rawIndex += 1) {
247976
247725
  const rawCharacter = rawTemplate[rawIndex];
247977
247726
  if (DELIMITERS.has(rawCharacter)) {
247978
247727
  if (templateStart !== templateIndex) {
247979
- nextTokens.push(template2.slice(templateStart, templateIndex));
247728
+ nextTokens.push(template.slice(templateStart, templateIndex));
247980
247729
  }
247981
247730
  templateStart = templateIndex + 1;
247982
247731
  } else if (rawCharacter === "\\") {
@@ -247992,9 +247741,9 @@ var splitByWhitespaces = (template2, rawTemplate) => {
247992
247741
  }
247993
247742
  }
247994
247743
  }
247995
- const trailingWhitespaces = templateStart === template2.length;
247744
+ const trailingWhitespaces = templateStart === template.length;
247996
247745
  if (!trailingWhitespaces) {
247997
- nextTokens.push(template2.slice(templateStart));
247746
+ nextTokens.push(template.slice(templateStart));
247998
247747
  }
247999
247748
  return { nextTokens, leadingWhitespaces, trailingWhitespaces };
248000
247749
  };
@@ -249388,8 +249137,8 @@ var disconnect = (anyProcess) => {
249388
249137
  // ../../node_modules/execa/lib/utils/deferred.js
249389
249138
  var createDeferred = () => {
249390
249139
  const methods = {};
249391
- const promise2 = new Promise((resolve4, reject) => {
249392
- Object.assign(methods, { resolve: resolve4, reject });
249140
+ const promise2 = new Promise((resolve3, reject) => {
249141
+ Object.assign(methods, { resolve: resolve3, reject });
249393
249142
  });
249394
249143
  return Object.assign(promise2, methods);
249395
249144
  };
@@ -253753,11 +253502,11 @@ var addConcurrentStream = (concurrentStreams, stream, waitName) => {
253753
253502
  const promises = weakMap.get(stream);
253754
253503
  const promise2 = createDeferred();
253755
253504
  promises.push(promise2);
253756
- const resolve4 = promise2.resolve.bind(promise2);
253757
- return { resolve: resolve4, promises };
253505
+ const resolve3 = promise2.resolve.bind(promise2);
253506
+ return { resolve: resolve3, promises };
253758
253507
  };
253759
- var waitForConcurrentStreams = async ({ resolve: resolve4, promises }, subprocess) => {
253760
- resolve4();
253508
+ var waitForConcurrentStreams = async ({ resolve: resolve3, promises }, subprocess) => {
253509
+ resolve3();
253761
253510
  const [isSubprocessExit] = await Promise.race([
253762
253511
  Promise.allSettled([true, subprocess]),
253763
253512
  Promise.all([false, ...promises])
@@ -254336,464 +254085,6 @@ var {
254336
254085
  getCancelSignal: getCancelSignal2
254337
254086
  } = getIpcExport();
254338
254087
 
254339
- // src/cli/utils/version-check.ts
254340
- async function checkForUpgrade() {
254341
- const testLatestVersion = getTestOverrides()?.latestVersion;
254342
- if (testLatestVersion !== undefined) {
254343
- if (testLatestVersion === null) {
254344
- return null;
254345
- }
254346
- const currentVersion = package_default.version;
254347
- if (testLatestVersion !== currentVersion) {
254348
- return { currentVersion, latestVersion: testLatestVersion };
254349
- }
254350
- return null;
254351
- }
254352
- try {
254353
- const { stdout } = await execa("npm", ["view", "base44", "version"], {
254354
- timeout: 1000,
254355
- shell: true,
254356
- env: { CI: "1" }
254357
- });
254358
- const latestVersion = stdout.trim();
254359
- const currentVersion = package_default.version;
254360
- if (latestVersion !== currentVersion) {
254361
- return { currentVersion, latestVersion };
254362
- }
254363
- return null;
254364
- } catch {
254365
- return null;
254366
- }
254367
- }
254368
-
254369
- // src/cli/utils/upgradeNotification.ts
254370
- function detectInstallMethod(distribution) {
254371
- if (distribution !== "binary") {
254372
- return "npm";
254373
- }
254374
- const execPath2 = process.execPath.toLowerCase();
254375
- if (execPath2.includes("/homebrew/") || execPath2.includes("/cellar/")) {
254376
- return "brew";
254377
- }
254378
- return "binary";
254379
- }
254380
- function getUpgradeInstruction(method) {
254381
- switch (method) {
254382
- case "npm":
254383
- return "Run: npm install -g base44@latest";
254384
- case "brew":
254385
- return "Run: brew upgrade base44";
254386
- case "binary":
254387
- return "Download Base44 CLI from: https://github.com/base44/cli/releases/latest";
254388
- }
254389
- }
254390
- function startUpgradeCheck() {
254391
- return checkForUpgrade().catch(() => null);
254392
- }
254393
- function formatUpgradeMessage(info, distribution) {
254394
- const { shinyOrange } = theme.colors;
254395
- const { bold: bold2 } = theme.styles;
254396
- const instruction = getUpgradeInstruction(detectInstallMethod(distribution));
254397
- return [
254398
- shinyOrange(`Update available! ${info.currentVersion} → ${bold2(info.latestVersion)}`),
254399
- shinyOrange(instruction)
254400
- ].join(`
254401
- `);
254402
- }
254403
- function formatPlainUpgradeMessage(info, distribution) {
254404
- const instruction = getUpgradeInstruction(detectInstallMethod(distribution));
254405
- return `Update available: ${info.currentVersion} → ${info.latestVersion}. ${instruction}`;
254406
- }
254407
- async function printUpgradeNotification(upgradeCheckPromise, distribution) {
254408
- try {
254409
- const upgradeInfo = await upgradeCheckPromise;
254410
- if (upgradeInfo) {
254411
- Ve(formatUpgradeMessage(upgradeInfo, distribution));
254412
- }
254413
- } catch {}
254414
- }
254415
-
254416
- // src/cli/utils/command/render.ts
254417
- async function showCommandStart(fullBanner) {
254418
- if (fullBanner) {
254419
- await printBanner();
254420
- We("");
254421
- } else {
254422
- We(theme.colors.base44OrangeBackground(" Base 44 "));
254423
- }
254424
- }
254425
- async function showCommandEnd(result, upgradeCheckPromise, distribution) {
254426
- await printUpgradeNotification(upgradeCheckPromise, distribution);
254427
- Le(result.outroMessage || "");
254428
- if (result.stdout) {
254429
- process.stdout.write(result.stdout);
254430
- }
254431
- }
254432
- function showThemedError(error48, context) {
254433
- const errorMessage = error48 instanceof Error ? error48.message : String(error48);
254434
- R2.error(errorMessage);
254435
- if (isCLIError(error48)) {
254436
- if (error48.details.length > 0) {
254437
- R2.info(theme.format.details(error48.details));
254438
- }
254439
- const hints = theme.format.agentHints(error48.hints);
254440
- if (hints) {
254441
- R2.error(hints);
254442
- }
254443
- }
254444
- if (process.env.DEBUG === "1" && error48 instanceof Error && error48.stack) {
254445
- R2.error(theme.styles.dim(error48.stack));
254446
- }
254447
- const errorContext = context.errorReporter.getErrorContext();
254448
- Le(theme.format.errorContext(errorContext));
254449
- }
254450
- function showPlainError(error48) {
254451
- const errorMessage = error48 instanceof Error ? error48.message : String(error48);
254452
- process.stderr.write(`Error: ${errorMessage}
254453
- `);
254454
- if (isCLIError(error48)) {
254455
- for (const detail of error48.details) {
254456
- process.stderr.write(` ${detail}
254457
- `);
254458
- }
254459
- for (const hint of error48.hints) {
254460
- const cmd = hint.command ? ` (${hint.command})` : "";
254461
- process.stderr.write(` Hint: ${hint.message}${cmd}
254462
- `);
254463
- }
254464
- }
254465
- if (process.env.DEBUG === "1" && error48 instanceof Error && error48.stack) {
254466
- process.stderr.write(`${error48.stack}
254467
- `);
254468
- }
254469
- }
254470
-
254471
- // src/cli/utils/command/Base44Command.ts
254472
- function writeJsonSuccess(result) {
254473
- if (result.stdout) {
254474
- if (result.outroMessage) {
254475
- process.stderr.write(`${result.outroMessage}
254476
- `);
254477
- }
254478
- process.stdout.write(result.stdout);
254479
- return;
254480
- }
254481
- process.stdout.write(`${JSON.stringify({ output: stripAnsi(result.outroMessage ?? "") })}
254482
- `);
254483
- }
254484
- function writeJsonError(error48) {
254485
- const envelope = {
254486
- error: error48 instanceof Error ? error48.message : String(error48)
254487
- };
254488
- if (isCLIError(error48)) {
254489
- envelope.code = error48.code;
254490
- if (error48.details.length > 0) {
254491
- envelope.details = error48.details;
254492
- }
254493
- if (error48.hints.length > 0) {
254494
- envelope.hints = error48.hints;
254495
- }
254496
- }
254497
- process.stdout.write(`${JSON.stringify(envelope)}
254498
- `);
254499
- }
254500
-
254501
- class Base44Command extends Command {
254502
- _context;
254503
- _commandOptions;
254504
- constructor(name2, options) {
254505
- super(name2);
254506
- this._commandOptions = {
254507
- requireAuth: options?.requireAuth ?? true,
254508
- requireAppContext: options?.requireAppContext ?? true,
254509
- fullBanner: options?.fullBanner ?? false
254510
- };
254511
- }
254512
- setContext(context) {
254513
- this._context = context;
254514
- }
254515
- get context() {
254516
- if (!this._context) {
254517
- throw new Error("Base44Command context not set. Ensure the command is registered via createProgram().");
254518
- }
254519
- return this._context;
254520
- }
254521
- action(fn) {
254522
- return super.action(async (...args) => {
254523
- const jsonMode = this.context.jsonMode;
254524
- const quiet = this.context.isNonInteractive || jsonMode;
254525
- if (!quiet) {
254526
- await showCommandStart(this._commandOptions.fullBanner);
254527
- }
254528
- const upgradeCheckPromise = startUpgradeCheck();
254529
- try {
254530
- if (this._commandOptions.requireAuth) {
254531
- await ensureAuth(this.context);
254532
- }
254533
- if (this._commandOptions.requireAppContext) {
254534
- const { appId } = this.optsWithGlobals();
254535
- await ensureAppContext(this.context, { appId });
254536
- }
254537
- const result = await fn(this.context, ...args) ?? {};
254538
- if (!quiet) {
254539
- await showCommandEnd(result, upgradeCheckPromise, this.context.distribution);
254540
- } else if (jsonMode) {
254541
- writeJsonSuccess(result);
254542
- const upgradeInfo = await upgradeCheckPromise;
254543
- if (upgradeInfo) {
254544
- process.stderr.write(`${formatPlainUpgradeMessage(upgradeInfo, this.context.distribution)}
254545
- `);
254546
- }
254547
- } else {
254548
- if (result.outroMessage) {
254549
- process.stdout.write(`${result.outroMessage}
254550
- `);
254551
- }
254552
- if (result.stdout) {
254553
- process.stdout.write(result.stdout);
254554
- }
254555
- const upgradeInfo = await upgradeCheckPromise;
254556
- if (upgradeInfo) {
254557
- process.stderr.write(`${formatPlainUpgradeMessage(upgradeInfo, this.context.distribution)}
254558
- `);
254559
- }
254560
- }
254561
- } catch (error48) {
254562
- if (jsonMode) {
254563
- writeJsonError(error48);
254564
- } else if (quiet) {
254565
- showPlainError(error48);
254566
- } else {
254567
- showThemedError(error48, this.context);
254568
- }
254569
- throw error48;
254570
- }
254571
- });
254572
- }
254573
- }
254574
- // src/cli/utils/confirm-push.ts
254575
- async function confirmPush({
254576
- isNonInteractive,
254577
- yes,
254578
- log,
254579
- warning
254580
- }) {
254581
- if (isNonInteractive && !yes) {
254582
- throw new InvalidInputError("--yes is required in non-interactive mode");
254583
- }
254584
- if (yes) {
254585
- return true;
254586
- }
254587
- log.warn(warning);
254588
- const proceed = await Re({
254589
- message: "Are you sure you want to continue?"
254590
- });
254591
- return !Ct(proceed) && proceed;
254592
- }
254593
- // src/cli/utils/json.ts
254594
- function toJsonStdout(result) {
254595
- return `${JSON.stringify(result, null, 2)}
254596
- `;
254597
- }
254598
- // src/cli/errors.ts
254599
- class CLIExitError extends Error {
254600
- code;
254601
- constructor(code2) {
254602
- super(`CLI exited with code ${code2}`);
254603
- this.code = code2;
254604
- this.name = "CLIExitError";
254605
- }
254606
- }
254607
-
254608
- // src/cli/utils/prompts.ts
254609
- var onPromptCancel = () => {
254610
- Ne("Operation cancelled.");
254611
- throw new CLIExitError(0);
254612
- };
254613
- // src/cli/utils/runTask.ts
254614
- function createInteractiveRunTask() {
254615
- return async (startMessage, operation, options) => {
254616
- const s = bt2();
254617
- s.start(startMessage);
254618
- const updateMessage = (message) => s.message(message);
254619
- try {
254620
- const result = await operation(updateMessage);
254621
- s.stop(options?.successMessage || startMessage);
254622
- return result;
254623
- } catch (error48) {
254624
- s.error(options?.errorMessage || "Failed");
254625
- throw error48;
254626
- }
254627
- };
254628
- }
254629
- function createSimpleRunTask(log) {
254630
- return async (startMessage, operation, options) => {
254631
- log.info(startMessage);
254632
- const updateMessage = (message) => log.info(message);
254633
- try {
254634
- const result = await operation(updateMessage);
254635
- log.success(options?.successMessage || startMessage);
254636
- return result;
254637
- } catch (error48) {
254638
- log.error(options?.errorMessage || "Failed");
254639
- throw error48;
254640
- }
254641
- };
254642
- }
254643
- // src/cli/utils/stdin.ts
254644
- async function readStdin(flagName = "--stdin", options = {}) {
254645
- if (process.stdin.isTTY) {
254646
- throw new InvalidInputError(`${flagName} requires piped input (e.g., echo <value> | base44 ...)`);
254647
- }
254648
- const chunks = [];
254649
- for await (const chunk of process.stdin) {
254650
- chunks.push(chunk);
254651
- }
254652
- const text = Buffer.concat(chunks).toString("utf-8");
254653
- return options.trim === false ? text : text.trim();
254654
- }
254655
-
254656
- // src/cli/utils/secret-input.ts
254657
- async function resolveSecret(options) {
254658
- if (options.fromStdin) {
254659
- const value = await readStdin("--client-secret-stdin");
254660
- if (value)
254661
- return value;
254662
- }
254663
- if (options.flagValue) {
254664
- return options.flagValue;
254665
- }
254666
- if (options.envVar) {
254667
- const envValue = process.env[options.envVar];
254668
- if (envValue)
254669
- return envValue;
254670
- }
254671
- if (!options.isNonInteractive) {
254672
- const value = await He({
254673
- message: options.promptMessage,
254674
- validate: (v) => {
254675
- if (!v || v.trim().length === 0) {
254676
- return `${options.name} is required`;
254677
- }
254678
- }
254679
- });
254680
- if (Ct(value)) {
254681
- throw new CLIExitError(0);
254682
- }
254683
- return value;
254684
- }
254685
- throw new InvalidInputError(`Missing required ${options.name}.`, {
254686
- hints: options.hints ?? [
254687
- {
254688
- message: `Provide the ${options.name} via flag, stdin, or environment variable (${options.envVar ?? "N/A"})`
254689
- }
254690
- ]
254691
- });
254692
- }
254693
- // src/cli/utils/urls.ts
254694
- function getDashboardUrl(projectId) {
254695
- const id = projectId ?? getAppContext().id;
254696
- return `${getBase44ApiUrl()}/apps/${id}/editor/workspace/overview`;
254697
- }
254698
- function getConnectorsUrl(projectId) {
254699
- const id = projectId ?? getAppContext().id;
254700
- return `${getBase44ApiUrl()}/apps/${id}/editor/workspace/app-connections`;
254701
- }
254702
- // src/cli/utils/yaml.ts
254703
- var import_lodash = __toESM(require_lodash8(), 1);
254704
- var YAML_INDENT = 2;
254705
- var stripEmptyReplacer = (_key, value) => {
254706
- if (typeof value === "number" || typeof value === "boolean")
254707
- return value;
254708
- if (import_lodash.isEmpty(value))
254709
- return;
254710
- return value;
254711
- };
254712
- function formatYaml(data, options = {}) {
254713
- const { stripEmpty = true } = options;
254714
- const replacer = stripEmpty ? stripEmptyReplacer : undefined;
254715
- return $stringify(data, replacer, { indent: YAML_INDENT }).trimEnd();
254716
- }
254717
- // src/core/deployments/api.ts
254718
- import { readFile as readFile2 } from "node:fs/promises";
254719
-
254720
- // src/core/deployments/schema.ts
254721
- var GIT_HASH_PATTERN = /^[a-fA-F0-9]{7,64}$/;
254722
- var CreateDeploymentResponseSchema = exports_external.object({
254723
- deployment_id: exports_external.string(),
254724
- asset_buckets: exports_external.array(exports_external.array(exports_external.string()))
254725
- }).transform((data) => ({
254726
- deploymentId: data.deployment_id,
254727
- assetBuckets: data.asset_buckets
254728
- }));
254729
- var AssetUploadResponseSchema = exports_external.looseObject({
254730
- result: exports_external.looseObject({ jwt: exports_external.string().nullable().optional() }).nullable().optional()
254731
- });
254732
- var FinalizeDeploymentResponseSchema = exports_external.object({
254733
- deployment_id: exports_external.string()
254734
- }).transform((data) => ({
254735
- deploymentId: data.deployment_id
254736
- }));
254737
-
254738
- // src/core/deployments/api.ts
254739
- var MODULE_CONTENT_TYPES = {
254740
- esm: "application/javascript+module",
254741
- sourcemap: "application/source-map",
254742
- wasm: "application/wasm",
254743
- text: "text/plain",
254744
- data: "application/octet-stream"
254745
- };
254746
- async function createDeployment(request) {
254747
- const appClient = getAppClient();
254748
- let response;
254749
- try {
254750
- response = await appClient.post("deployments", {
254751
- json: request,
254752
- timeout: 120000
254753
- });
254754
- } catch (error48) {
254755
- throw await ApiError.fromHttpError(error48, "creating deployment");
254756
- }
254757
- const result = CreateDeploymentResponseSchema.safeParse(await response.json());
254758
- if (!result.success) {
254759
- throw new SchemaValidationError("Invalid response from server", result.error);
254760
- }
254761
- return result.data;
254762
- }
254763
- async function uploadAssetBucket(deploymentId, formData) {
254764
- const appClient = getAppClient();
254765
- const response = await appClient.post(`deployments/${encodeURIComponent(deploymentId)}/assets`, {
254766
- searchParams: { base64: "true" },
254767
- body: formData,
254768
- timeout: 120000,
254769
- retry: 0
254770
- });
254771
- const parsed = AssetUploadResponseSchema.safeParse(await response.json());
254772
- const jwt3 = parsed.success ? parsed.data.result?.jwt : null;
254773
- return jwt3 || null;
254774
- }
254775
- async function finalizeDeployment(deploymentId, completionJwt, modules) {
254776
- const appClient = getAppClient();
254777
- const formData = new FormData;
254778
- formData.append("payload", JSON.stringify({ completion_jwt: completionJwt }));
254779
- for (const module of modules) {
254780
- const content = await readFile2(module.absolutePath);
254781
- formData.append(module.name, new File([new Uint8Array(content)], module.name, {
254782
- type: MODULE_CONTENT_TYPES[module.type]
254783
- }));
254784
- }
254785
- let response;
254786
- try {
254787
- response = await appClient.post(`deployments/${encodeURIComponent(deploymentId)}/finalize`, { body: formData, timeout: 180000 });
254788
- } catch (error48) {
254789
- throw await ApiError.fromHttpError(error48, "finalizing deployment");
254790
- }
254791
- const result = FinalizeDeploymentResponseSchema.safeParse(await response.json());
254792
- if (!result.success) {
254793
- throw new SchemaValidationError("Invalid response from server", result.error);
254794
- }
254795
- return result.data;
254796
- }
254797
254088
  // src/core/deployments/manifest.ts
254798
254089
  import { createHash } from "node:crypto";
254799
254090
  import { readdir as readdir2, readFile as readFile3, stat } from "node:fs/promises";
@@ -254946,7 +254237,7 @@ async function collectFilePaths(dir, relativeDir, isIgnored) {
254946
254237
 
254947
254238
  // src/core/deployments/modules.ts
254948
254239
  import { stat as stat2 } from "node:fs/promises";
254949
- import { relative as relative3, resolve as resolve4, sep } from "node:path";
254240
+ import { relative as relative3, resolve as resolve3, sep } from "node:path";
254950
254241
  var MAX_TOTAL_MODULE_BYTES = 40 * 1024 * 1024;
254951
254242
  var MODULE_IGNORE = ["wrangler.json", ".dev.vars"];
254952
254243
  var RULE_TYPE_TO_MODULE_TYPE = {
@@ -254958,15 +254249,15 @@ var RULE_TYPE_TO_MODULE_TYPE = {
254958
254249
  function toPosix(path16) {
254959
254250
  return path16.split(sep).join("/");
254960
254251
  }
254961
- async function collectModules(config12) {
254962
- const entryPath = resolve4(config12.configDir, config12.main);
254252
+ async function collectModules(config9) {
254253
+ const entryPath = resolve3(config9.configDir, config9.main);
254963
254254
  if (!await pathExists(entryPath)) {
254964
- throw new InvalidInputError(`Worker entry module does not exist: ${entryPath} (from "main" in ${config12.configPath})`, {
254255
+ throw new InvalidInputError(`Worker entry module does not exist: ${entryPath} (from "main" in ${config9.configPath})`, {
254965
254256
  hints: [{ message: "Rebuild the project to regenerate the artifact" }]
254966
254257
  });
254967
254258
  }
254968
254259
  const modulesByName = new Map;
254969
- const entryName = toPosix(relative3(config12.configDir, entryPath));
254260
+ const entryName = toPosix(relative3(config9.configDir, entryPath));
254970
254261
  modulesByName.set(entryName, {
254971
254262
  name: entryName,
254972
254263
  absolutePath: entryPath,
@@ -254974,16 +254265,16 @@ async function collectModules(config12) {
254974
254265
  type: "esm"
254975
254266
  });
254976
254267
  const ignore = [...MODULE_IGNORE];
254977
- if (config12.assetsDirectory?.startsWith(config12.configDir + sep)) {
254978
- ignore.push(`${toPosix(relative3(config12.configDir, config12.assetsDirectory))}/**`);
254268
+ if (config9.assetsDirectory?.startsWith(config9.configDir + sep)) {
254269
+ ignore.push(`${toPosix(relative3(config9.configDir, config9.assetsDirectory))}/**`);
254979
254270
  }
254980
- for (const rule of config12.rules) {
254271
+ for (const rule of config9.rules) {
254981
254272
  const type = RULE_TYPE_TO_MODULE_TYPE[rule.type];
254982
254273
  if (!type) {
254983
- throw new InvalidInputError(`Unsupported module rule type "${rule.type}" in ${config12.configPath}. Supported: ${Object.keys(RULE_TYPE_TO_MODULE_TYPE).join(", ")}.`);
254274
+ throw new InvalidInputError(`Unsupported module rule type "${rule.type}" in ${config9.configPath}. Supported: ${Object.keys(RULE_TYPE_TO_MODULE_TYPE).join(", ")}.`);
254984
254275
  }
254985
254276
  const matches = await globby(rule.globs, {
254986
- cwd: config12.configDir,
254277
+ cwd: config9.configDir,
254987
254278
  onlyFiles: true,
254988
254279
  dot: true,
254989
254280
  ignore
@@ -254992,28 +254283,28 @@ async function collectModules(config12) {
254992
254283
  if (!modulesByName.has(match)) {
254993
254284
  modulesByName.set(match, {
254994
254285
  name: match,
254995
- absolutePath: resolve4(config12.configDir, match),
254286
+ absolutePath: resolve3(config9.configDir, match),
254996
254287
  size: 0,
254997
254288
  type
254998
254289
  });
254999
254290
  }
255000
254291
  }
255001
254292
  }
255002
- if (config12.uploadSourceMaps) {
254293
+ if (config9.uploadSourceMaps) {
255003
254294
  const maps = await globby("**/*.map", {
255004
- cwd: config12.configDir,
254295
+ cwd: config9.configDir,
255005
254296
  onlyFiles: true,
255006
254297
  dot: true,
255007
254298
  ignore
255008
254299
  });
255009
254300
  for (const map2 of maps.sort()) {
255010
- addSourcemap(modulesByName, config12.configDir, map2);
254301
+ addSourcemap(modulesByName, config9.configDir, map2);
255011
254302
  }
255012
254303
  } else {
255013
254304
  for (const name2 of [...modulesByName.keys()]) {
255014
254305
  const mapName = `${name2}.map`;
255015
- if (await pathExists(resolve4(config12.configDir, mapName))) {
255016
- addSourcemap(modulesByName, config12.configDir, mapName);
254306
+ if (await pathExists(resolve3(config9.configDir, mapName))) {
254307
+ addSourcemap(modulesByName, config9.configDir, mapName);
255017
254308
  }
255018
254309
  }
255019
254310
  }
@@ -255033,7 +254324,7 @@ function addSourcemap(modulesByName, configDir, name2) {
255033
254324
  return;
255034
254325
  modulesByName.set(name2, {
255035
254326
  name: name2,
255036
- absolutePath: resolve4(configDir, name2),
254327
+ absolutePath: resolve3(configDir, name2),
255037
254328
  size: 0,
255038
254329
  type: "sourcemap"
255039
254330
  });
@@ -255116,18 +254407,16 @@ async function buildBucketForm(bucket, filesByHash) {
255116
254407
  return formData;
255117
254408
  }
255118
254409
  function sleep3(ms) {
255119
- return new Promise((resolve5) => setTimeout(resolve5, ms));
254410
+ return new Promise((resolve4) => setTimeout(resolve4, ms));
255120
254411
  }
255121
254412
 
255122
254413
  // src/core/deployments/wrangler-config.ts
255123
- import { dirname as dirname10, join as join16, resolve as resolve5 } from "node:path";
254414
+ import { dirname as dirname10, join as join16, resolve as resolve4 } from "node:path";
255124
254415
  var WRANGLER_REDIRECT_PATH = join16(".wrangler", "deploy", "config.json");
255125
254416
  var RedirectConfigSchema = exports_external.looseObject({
255126
254417
  configPath: exports_external.string().min(1)
255127
254418
  });
255128
- var BindingArraySchema = exports_external.array(exports_external.unknown()).optional();
255129
254419
  var WranglerConfigSchema = exports_external.looseObject({
255130
- name: exports_external.string().optional(),
255131
254420
  main: exports_external.string().min(1, "wrangler config is missing a 'main' entry module"),
255132
254421
  no_bundle: exports_external.boolean().optional(),
255133
254422
  rules: exports_external.array(exports_external.looseObject({ type: exports_external.string(), globs: exports_external.array(exports_external.string()) })).optional(),
@@ -255142,19 +254431,7 @@ var WranglerConfigSchema = exports_external.looseObject({
255142
254431
  compatibility_date: exports_external.string().optional(),
255143
254432
  compatibility_flags: exports_external.array(exports_external.string()).optional(),
255144
254433
  vars: exports_external.record(exports_external.string(), exports_external.unknown()).optional(),
255145
- upload_source_maps: exports_external.boolean().optional(),
255146
- kv_namespaces: BindingArraySchema,
255147
- d1_databases: BindingArraySchema,
255148
- r2_buckets: BindingArraySchema,
255149
- durable_objects: exports_external.looseObject({ bindings: BindingArraySchema }).optional(),
255150
- services: BindingArraySchema,
255151
- queues: exports_external.looseObject({
255152
- producers: BindingArraySchema,
255153
- consumers: BindingArraySchema
255154
- }).optional(),
255155
- hyperdrive: BindingArraySchema,
255156
- analytics_engine_datasets: BindingArraySchema,
255157
- vectorize: BindingArraySchema
254434
+ upload_source_maps: exports_external.boolean().optional()
255158
254435
  });
255159
254436
  async function detectFullStackArtifact(projectRoot) {
255160
254437
  const redirectPath = join16(projectRoot, WRANGLER_REDIRECT_PATH);
@@ -255189,28 +254466,26 @@ async function resolveWranglerConfig(projectRoot) {
255189
254466
  if (!result.success) {
255190
254467
  throw new ConfigInvalidError(`Invalid wrangler config: ${exports_external.prettifyError(result.error)}`, configPath);
255191
254468
  }
255192
- const config12 = result.data;
255193
- if (config12.no_bundle !== true) {
254469
+ const config9 = result.data;
254470
+ if (config9.no_bundle !== true) {
255194
254471
  throw new InvalidInputError("This framework's output requires bundling; not yet supported. Base44 full-stack deploys only support pre-bundled Workers output (no_bundle: true).");
255195
254472
  }
255196
- assertNoUnsupportedBindings(config12, configPath);
255197
254473
  const configDir = dirname10(configPath);
255198
- const assetsDirectory = config12.assets?.directory ? resolve5(configDir, config12.assets.directory) : null;
254474
+ const assetsDirectory = config9.assets?.directory ? resolve4(configDir, config9.assets.directory) : null;
255199
254475
  return {
255200
254476
  configPath,
255201
254477
  configDir,
255202
- name: config12.name ?? null,
255203
- main: config12.main,
254478
+ main: config9.main,
255204
254479
  assetsDirectory,
255205
- assetsConfig: config12.assets ? toResolvedAssetsConfig(config12.assets) : null,
255206
- compatibilityDate: config12.compatibility_date ?? null,
255207
- compatibilityFlags: config12.compatibility_flags ?? [],
255208
- vars: config12.vars ?? {},
255209
- rules: (config12.rules ?? []).map((rule) => ({
254480
+ assetsConfig: config9.assets ? toResolvedAssetsConfig(config9.assets) : null,
254481
+ compatibilityDate: config9.compatibility_date ?? null,
254482
+ compatibilityFlags: config9.compatibility_flags ?? [],
254483
+ vars: config9.vars ?? {},
254484
+ rules: (config9.rules ?? []).map((rule) => ({
255210
254485
  type: rule.type,
255211
254486
  globs: rule.globs
255212
254487
  })),
255213
- uploadSourceMaps: config12.upload_source_maps ?? false
254488
+ uploadSourceMaps: config9.upload_source_maps ?? false
255214
254489
  };
255215
254490
  }
255216
254491
  async function resolveRedirectedConfigPath(redirectPath) {
@@ -255219,7 +254494,7 @@ async function resolveRedirectedConfigPath(redirectPath) {
255219
254494
  if (!result.success) {
255220
254495
  throw new ConfigInvalidError(`Invalid deploy redirect file: ${exports_external.prettifyError(result.error)}`, redirectPath);
255221
254496
  }
255222
- const configPath = resolve5(dirname10(redirectPath), result.data.configPath);
254497
+ const configPath = resolve4(dirname10(redirectPath), result.data.configPath);
255223
254498
  if (!await pathExists(configPath)) {
255224
254499
  throw new ConfigInvalidError(`Wrangler config referenced by ${redirectPath} does not exist: ${configPath}`, redirectPath, {
255225
254500
  hints: [{ message: "Rebuild the project to regenerate the artifact" }]
@@ -255236,26 +254511,6 @@ function toResolvedAssetsConfig(assets) {
255236
254511
  redirects: assets.redirects
255237
254512
  };
255238
254513
  }
255239
- function assertNoUnsupportedBindings(config12, configPath) {
255240
- const bindingSources = {
255241
- kv_namespaces: config12.kv_namespaces,
255242
- d1_databases: config12.d1_databases,
255243
- r2_buckets: config12.r2_buckets,
255244
- "durable_objects.bindings": config12.durable_objects?.bindings,
255245
- services: config12.services,
255246
- "queues.producers": config12.queues?.producers,
255247
- "queues.consumers": config12.queues?.consumers,
255248
- hyperdrive: config12.hyperdrive,
255249
- analytics_engine_datasets: config12.analytics_engine_datasets,
255250
- vectorize: config12.vectorize
255251
- };
255252
- const used = Object.entries(bindingSources).filter(([, values]) => (values?.length ?? 0) > 0).map(([name2]) => name2);
255253
- if (used.length > 0) {
255254
- throw new InvalidInputError(`Unsupported bindings for Base44 full-stack deploys: ${used.join(", ")}. Remove them or file a feature request.`, {
255255
- hints: [{ message: `Edit the bindings in ${configPath}` }]
255256
- });
255257
- }
255258
- }
255259
254514
 
255260
254515
  // src/core/deployments/deploy.ts
255261
254516
  async function resolveGitHash(projectRoot, explicit) {
@@ -255283,25 +254538,25 @@ async function gitHead(projectRoot) {
255283
254538
  }
255284
254539
  async function deployFullStack(options) {
255285
254540
  const { projectRoot, gitHash, progress } = options;
255286
- const config12 = await resolveWranglerConfig(projectRoot);
255287
- if (!config12.compatibilityFlags.includes("nodejs_compat")) {
254541
+ const config9 = await resolveWranglerConfig(projectRoot);
254542
+ if (!config9.compatibilityFlags.includes("nodejs_compat")) {
255288
254543
  progress?.onWarning?.("The wrangler config has no 'nodejs_compat' compatibility flag; Node.js built-ins will be unavailable at runtime. Enable it in your framework's Cloudflare adapter settings if your server code needs Node APIs.");
255289
254544
  }
255290
- if (config12.vars && Object.keys(config12.vars).length > 0) {
254545
+ if (config9.vars && Object.keys(config9.vars).length > 0) {
255291
254546
  progress?.onWarning?.("wrangler 'vars' are not supported and were ignored — a worker's environment comes from the app's secrets (base44 secrets set).");
255292
254547
  }
255293
- const modules = await collectModules(config12);
254548
+ const modules = await collectModules(config9);
255294
254549
  let assets = { manifest: {}, filesByHash: new Map };
255295
- if (config12.assetsDirectory && await pathExists(config12.assetsDirectory)) {
255296
- assets = await buildAssetManifest(config12.assetsDirectory, getAppContext().id);
254550
+ if (config9.assetsDirectory && await pathExists(config9.assetsDirectory)) {
254551
+ assets = await buildAssetManifest(config9.assetsDirectory, getAppContext().id);
255297
254552
  }
255298
254553
  const created = await createDeployment({
255299
254554
  git_hash: gitHash,
255300
254555
  config: {
255301
- main: config12.main,
255302
- compatibility_date: config12.compatibilityDate,
255303
- compatibility_flags: config12.compatibilityFlags,
255304
- assets: buildAssetsConfig(config12.assetsConfig, progress)
254556
+ main: config9.main,
254557
+ compatibility_date: config9.compatibilityDate,
254558
+ compatibility_flags: config9.compatibilityFlags,
254559
+ assets: buildAssetsConfig(config9.assetsConfig, progress)
255305
254560
  },
255306
254561
  asset_manifest: assets.manifest
255307
254562
  });
@@ -255331,6 +254586,757 @@ function buildAssetsConfig(assetsConfig, progress) {
255331
254586
  run_worker_first: runWorkerFirst
255332
254587
  };
255333
254588
  }
254589
+ // src/core/site/deploy-app.ts
254590
+ async function planAppDeploy(target) {
254591
+ if (await detectFullStackArtifact(target.root)) {
254592
+ return { kind: "full-stack" };
254593
+ }
254594
+ const outputDirectory = target.site?.outputDirectory;
254595
+ return outputDirectory ? { kind: "static", outputDir: resolve5(target.root, outputDirectory) } : { kind: "none" };
254596
+ }
254597
+ async function detectAppDeployKind(target) {
254598
+ return (await planAppDeploy(target)).kind;
254599
+ }
254600
+ async function hasBuiltArtifact(target) {
254601
+ const plan = await planAppDeploy(target);
254602
+ if (plan.kind === "full-stack")
254603
+ return true;
254604
+ if (plan.kind === "none")
254605
+ return false;
254606
+ return await pathExists(plan.outputDir);
254607
+ }
254608
+ async function deployAppSite(target, options = {}) {
254609
+ const plan = await planAppDeploy(target);
254610
+ switch (plan.kind) {
254611
+ case "full-stack": {
254612
+ const gitHash = await resolveGitHash(target.root, options.gitHash);
254613
+ const { deploymentId } = await deployFullStack({
254614
+ projectRoot: target.root,
254615
+ gitHash,
254616
+ progress: options.progress
254617
+ });
254618
+ return { kind: "full-stack", deploymentId, gitHash };
254619
+ }
254620
+ case "static": {
254621
+ const { appUrl } = await deploySite(plan.outputDir);
254622
+ return { kind: "static", appUrl };
254623
+ }
254624
+ case "none":
254625
+ return { kind: "none" };
254626
+ }
254627
+ }
254628
+ // src/core/project/deploy.ts
254629
+ function hasResourcesToDeploy(projectData) {
254630
+ const {
254631
+ project,
254632
+ entities,
254633
+ functions,
254634
+ agents,
254635
+ agentSkills,
254636
+ connectors,
254637
+ authConfig
254638
+ } = projectData;
254639
+ const hasSite = Boolean(project.site?.outputDirectory || project.site?.buildCommand);
254640
+ const hasEntities = entities.length > 0;
254641
+ const hasFunctions = functions.length > 0;
254642
+ const hasAgents = agents.length > 0;
254643
+ const hasAgentSkills = agentSkills.length > 0;
254644
+ const hasConnectors = connectors.length > 0;
254645
+ const hasAuthConfig = authConfig.length > 0;
254646
+ const hasVisibility = Boolean(project.visibility);
254647
+ return hasEntities || hasFunctions || hasAgents || hasAgentSkills || hasConnectors || hasAuthConfig || hasVisibility || hasSite;
254648
+ }
254649
+ async function deployAll(projectData, options) {
254650
+ const {
254651
+ project,
254652
+ entities,
254653
+ functions,
254654
+ agents,
254655
+ agentSkills,
254656
+ connectors,
254657
+ authConfig
254658
+ } = projectData;
254659
+ await setAppVisibility(project.visibility);
254660
+ if (project.visibility) {
254661
+ options?.onVisibilitySet?.(project.visibility);
254662
+ }
254663
+ await entityResource.push(entities);
254664
+ await deployFunctionsSequentially(functions, {
254665
+ onStart: options?.onFunctionStart,
254666
+ onResult: options?.onFunctionResult
254667
+ });
254668
+ await agentSkillResource.push(agentSkills);
254669
+ await agentResource.push(agents);
254670
+ await authConfigResource.push(authConfig);
254671
+ const skipConnectorSync = connectors.length === 0 && hasWorkspaceApiKeyAuth();
254672
+ const connectorResults = skipConnectorSync ? [] : (await pushConnectors(connectors)).results;
254673
+ if ((options?.site ?? true) && project.site?.outputDirectory) {
254674
+ const outputDir = resolve6(project.root, project.site.outputDirectory);
254675
+ const { appUrl } = await deploySite(outputDir);
254676
+ return { appUrl, connectorResults };
254677
+ }
254678
+ return { connectorResults };
254679
+ }
254680
+ // src/core/clients/base44-client.ts
254681
+ var retriedRequests = new WeakSet;
254682
+ async function captureRequestBody(request, options) {
254683
+ if (request.body == null) {
254684
+ return;
254685
+ }
254686
+ try {
254687
+ const cloned = request.clone();
254688
+ const text = await cloned.text();
254689
+ options.context.__requestBody = text;
254690
+ } catch {}
254691
+ }
254692
+ async function handleUnauthorized(request, _options, response) {
254693
+ if (response.status !== 401) {
254694
+ return;
254695
+ }
254696
+ if (hasWorkspaceApiKeyAuth()) {
254697
+ return;
254698
+ }
254699
+ if (retriedRequests.has(request)) {
254700
+ return;
254701
+ }
254702
+ const newAccessToken = await refreshAndSaveTokens();
254703
+ if (!newAccessToken) {
254704
+ return;
254705
+ }
254706
+ retriedRequests.add(request);
254707
+ const requestId = request.headers.get("X-Request-ID");
254708
+ return distribution_default(request.clone(), {
254709
+ headers: {
254710
+ ...requestId && { "X-Request-ID": requestId },
254711
+ Authorization: `Bearer ${newAccessToken}`
254712
+ }
254713
+ });
254714
+ }
254715
+ var base44Client = distribution_default.create({
254716
+ prefixUrl: getBase44ApiUrl(),
254717
+ headers: {
254718
+ "User-Agent": "Base44 CLI"
254719
+ },
254720
+ hooks: {
254721
+ beforeRequest: [
254722
+ (request) => {
254723
+ request.headers.set("X-Request-ID", randomUUID2());
254724
+ },
254725
+ captureRequestBody,
254726
+ async (request) => {
254727
+ const workspaceApiKey = getWorkspaceApiKeyFromEnv();
254728
+ if (workspaceApiKey && isWorkspaceApiKey(workspaceApiKey)) {
254729
+ request.headers.set("api_key", workspaceApiKey);
254730
+ return;
254731
+ }
254732
+ try {
254733
+ const auth = await readAuth();
254734
+ if (isTokenExpired(auth)) {
254735
+ const newAccessToken = await refreshAndSaveTokens();
254736
+ if (newAccessToken) {
254737
+ request.headers.set("Authorization", `Bearer ${newAccessToken}`);
254738
+ return;
254739
+ }
254740
+ }
254741
+ request.headers.set("Authorization", `Bearer ${auth.accessToken}`);
254742
+ } catch {}
254743
+ }
254744
+ ],
254745
+ afterResponse: [handleUnauthorized]
254746
+ }
254747
+ });
254748
+ function getAppClient() {
254749
+ const { id } = getAppContext();
254750
+ return base44Client.extend({
254751
+ prefixUrl: new URL(`/api/apps/${id}/`, getBase44ApiUrl()).href
254752
+ });
254753
+ }
254754
+ function getSandboxClient(appId) {
254755
+ return base44Client.extend({
254756
+ prefixUrl: new URL(`/api/apps/${appId}/sandbox-bridge/`, getBase44ApiUrl()).href
254757
+ });
254758
+ }
254759
+ // src/core/clients/oauth-client.ts
254760
+ import { randomUUID as randomUUID3 } from "node:crypto";
254761
+ var oauthClient = distribution_default.create({
254762
+ prefixUrl: getBase44ApiUrl(),
254763
+ headers: {
254764
+ "User-Agent": "Base44 CLI"
254765
+ },
254766
+ hooks: {
254767
+ beforeRequest: [
254768
+ (request) => {
254769
+ request.headers.set("X-Request-ID", randomUUID3());
254770
+ }
254771
+ ]
254772
+ }
254773
+ });
254774
+ // src/core/auth/api.ts
254775
+ async function generateDeviceCode() {
254776
+ const response = await oauthClient.post("oauth/device/code", {
254777
+ json: {
254778
+ client_id: AUTH_CLIENT_ID,
254779
+ scope: "apps:read apps:write sandbox:write"
254780
+ },
254781
+ throwHttpErrors: false
254782
+ });
254783
+ if (!response.ok) {
254784
+ throw new ApiError(`Failed to generate device code: ${response.status} ${response.statusText}`, { statusCode: response.status });
254785
+ }
254786
+ const result = DeviceCodeResponseSchema.safeParse(await response.json());
254787
+ if (!result.success) {
254788
+ throw new SchemaValidationError("Invalid device code response from server", result.error);
254789
+ }
254790
+ return result.data;
254791
+ }
254792
+ async function getTokenFromDeviceCode(deviceCode) {
254793
+ const searchParams = new URLSearchParams;
254794
+ searchParams.set("grant_type", "urn:ietf:params:oauth:grant-type:device_code");
254795
+ searchParams.set("device_code", deviceCode);
254796
+ searchParams.set("client_id", AUTH_CLIENT_ID);
254797
+ const response = await oauthClient.post("oauth/token", {
254798
+ body: searchParams.toString(),
254799
+ headers: {
254800
+ "Content-Type": "application/x-www-form-urlencoded"
254801
+ },
254802
+ throwHttpErrors: false
254803
+ });
254804
+ const json2 = await response.json();
254805
+ if (!response.ok) {
254806
+ const errorResult = OAuthErrorSchema.safeParse(json2);
254807
+ if (!errorResult.success) {
254808
+ throw new SchemaValidationError("Token request failed", errorResult.error);
254809
+ }
254810
+ const { error: error48, error_description } = errorResult.data;
254811
+ if (error48 === "authorization_pending" || error48 === "slow_down") {
254812
+ return null;
254813
+ }
254814
+ throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
254815
+ statusCode: response.status
254816
+ });
254817
+ }
254818
+ const result = TokenResponseSchema.safeParse(json2);
254819
+ if (!result.success) {
254820
+ throw new SchemaValidationError("Invalid token response from server", result.error);
254821
+ }
254822
+ return result.data;
254823
+ }
254824
+ async function renewAccessToken(refreshToken) {
254825
+ const searchParams = new URLSearchParams;
254826
+ searchParams.set("grant_type", "refresh_token");
254827
+ searchParams.set("refresh_token", refreshToken);
254828
+ searchParams.set("client_id", AUTH_CLIENT_ID);
254829
+ const response = await oauthClient.post("oauth/token", {
254830
+ body: searchParams.toString(),
254831
+ headers: {
254832
+ "Content-Type": "application/x-www-form-urlencoded"
254833
+ },
254834
+ throwHttpErrors: false
254835
+ });
254836
+ const json2 = await response.json();
254837
+ if (!response.ok) {
254838
+ const errorResult = OAuthErrorSchema.safeParse(json2);
254839
+ if (!errorResult.success) {
254840
+ throw new ApiError(`Token refresh failed: ${response.statusText}`, {
254841
+ statusCode: response.status
254842
+ });
254843
+ }
254844
+ const { error: error48, error_description } = errorResult.data;
254845
+ throw new ApiError(error_description ?? `OAuth error: ${error48}`, {
254846
+ statusCode: response.status
254847
+ });
254848
+ }
254849
+ const result = TokenResponseSchema.safeParse(json2);
254850
+ if (!result.success) {
254851
+ throw new SchemaValidationError("Invalid token response from server", result.error);
254852
+ }
254853
+ return result.data;
254854
+ }
254855
+ async function getUserInfo(accessToken) {
254856
+ const response = await oauthClient.get("oauth/userinfo", {
254857
+ headers: { Authorization: `Bearer ${accessToken}` }
254858
+ });
254859
+ if (!response.ok) {
254860
+ throw new ApiError(`Failed to fetch user info: ${response.status}`, {
254861
+ statusCode: response.status
254862
+ });
254863
+ }
254864
+ const result = UserInfoSchema.safeParse(await response.json());
254865
+ if (!result.success) {
254866
+ throw new SchemaValidationError("Invalid UserInfo response from server", result.error);
254867
+ }
254868
+ return result.data;
254869
+ }
254870
+ // src/cli/commands/auth/login-flow.ts
254871
+ async function generateAndDisplayDeviceCode(log, runTask) {
254872
+ const deviceCodeResponse = await runTask("Generating device code...", async () => {
254873
+ return await generateDeviceCode();
254874
+ }, {
254875
+ successMessage: "Device code generated",
254876
+ errorMessage: "Failed to generate device code"
254877
+ });
254878
+ log.info(`Verification code: ${theme.styles.bold(deviceCodeResponse.userCode)}` + `
254879
+ Please confirm this code at: ${deviceCodeResponse.verificationUri}`);
254880
+ return deviceCodeResponse;
254881
+ }
254882
+ async function waitForAuthentication(deviceCode, expiresIn, interval, runTask) {
254883
+ let tokenResponse;
254884
+ try {
254885
+ await runTask("Waiting for authentication...", async () => {
254886
+ await pWaitFor(async () => {
254887
+ const result = await getTokenFromDeviceCode(deviceCode);
254888
+ if (result !== null) {
254889
+ tokenResponse = result;
254890
+ return true;
254891
+ }
254892
+ return false;
254893
+ }, {
254894
+ interval: interval * 1000,
254895
+ timeout: expiresIn * 1000
254896
+ });
254897
+ }, {
254898
+ successMessage: "Authentication completed!",
254899
+ errorMessage: "Authentication failed"
254900
+ });
254901
+ } catch (error48) {
254902
+ if (error48 instanceof Error && error48.message.includes("timed out")) {
254903
+ throw new AuthExpiredError("Authentication timed out. Please try again.");
254904
+ }
254905
+ throw error48;
254906
+ }
254907
+ if (tokenResponse === undefined) {
254908
+ throw new InternalError("Failed to retrieve authentication token.");
254909
+ }
254910
+ return tokenResponse;
254911
+ }
254912
+ async function saveAuthData(response, userInfo) {
254913
+ const expiresAt = Date.now() + response.expiresIn * 1000;
254914
+ await writeAuth({
254915
+ accessToken: response.accessToken,
254916
+ refreshToken: response.refreshToken,
254917
+ expiresAt,
254918
+ email: userInfo.email,
254919
+ name: userInfo.name
254920
+ });
254921
+ }
254922
+ async function login({
254923
+ log,
254924
+ runTask
254925
+ }) {
254926
+ const deviceCodeResponse = await generateAndDisplayDeviceCode(log, runTask);
254927
+ const token = await waitForAuthentication(deviceCodeResponse.deviceCode, deviceCodeResponse.expiresIn, deviceCodeResponse.interval, runTask);
254928
+ const userInfo = await getUserInfo(token.accessToken);
254929
+ await saveAuthData(token, userInfo);
254930
+ return {
254931
+ outroMessage: `Successfully logged in as ${theme.styles.bold(userInfo.email)}`
254932
+ };
254933
+ }
254934
+
254935
+ // src/cli/utils/command/middleware.ts
254936
+ async function ensureAuth(ctx) {
254937
+ if (hasWorkspaceApiKeyAuth()) {
254938
+ ctx.errorReporter.setContext({
254939
+ user: { email: "workspace-api-key", name: "Workspace API key" }
254940
+ });
254941
+ return;
254942
+ }
254943
+ await seedAuthFromEnv();
254944
+ const loggedIn = await isLoggedIn();
254945
+ if (!loggedIn) {
254946
+ ctx.log.info("You need to login first to continue.");
254947
+ await login(ctx);
254948
+ }
254949
+ try {
254950
+ const userInfo = await readAuth();
254951
+ ctx.errorReporter.setContext({
254952
+ user: { email: userInfo.email, name: userInfo.name }
254953
+ });
254954
+ } catch {}
254955
+ }
254956
+ async function ensureAppContext(ctx, options = {}) {
254957
+ const appContext = await initAppContext(options);
254958
+ ctx.app = appContext;
254959
+ ctx.errorReporter.setContext({ appId: appContext.id });
254960
+ }
254961
+
254962
+ // src/cli/utils/version-check.ts
254963
+ async function checkForUpgrade() {
254964
+ const testLatestVersion = getTestOverrides()?.latestVersion;
254965
+ if (testLatestVersion !== undefined) {
254966
+ if (testLatestVersion === null) {
254967
+ return null;
254968
+ }
254969
+ const currentVersion = package_default.version;
254970
+ if (testLatestVersion !== currentVersion) {
254971
+ return { currentVersion, latestVersion: testLatestVersion };
254972
+ }
254973
+ return null;
254974
+ }
254975
+ try {
254976
+ const { stdout } = await execa("npm", ["view", "base44", "version"], {
254977
+ timeout: 1000,
254978
+ shell: true,
254979
+ env: { CI: "1" }
254980
+ });
254981
+ const latestVersion = stdout.trim();
254982
+ const currentVersion = package_default.version;
254983
+ if (latestVersion !== currentVersion) {
254984
+ return { currentVersion, latestVersion };
254985
+ }
254986
+ return null;
254987
+ } catch {
254988
+ return null;
254989
+ }
254990
+ }
254991
+
254992
+ // src/cli/utils/upgradeNotification.ts
254993
+ function detectInstallMethod(distribution) {
254994
+ if (distribution !== "binary") {
254995
+ return "npm";
254996
+ }
254997
+ const execPath2 = process.execPath.toLowerCase();
254998
+ if (execPath2.includes("/homebrew/") || execPath2.includes("/cellar/")) {
254999
+ return "brew";
255000
+ }
255001
+ return "binary";
255002
+ }
255003
+ function getUpgradeInstruction(method) {
255004
+ switch (method) {
255005
+ case "npm":
255006
+ return "Run: npm install -g base44@latest";
255007
+ case "brew":
255008
+ return "Run: brew upgrade base44";
255009
+ case "binary":
255010
+ return "Download Base44 CLI from: https://github.com/base44/cli/releases/latest";
255011
+ }
255012
+ }
255013
+ function startUpgradeCheck() {
255014
+ return checkForUpgrade().catch(() => null);
255015
+ }
255016
+ function formatUpgradeMessage(info, distribution) {
255017
+ const { shinyOrange } = theme.colors;
255018
+ const { bold: bold2 } = theme.styles;
255019
+ const instruction = getUpgradeInstruction(detectInstallMethod(distribution));
255020
+ return [
255021
+ shinyOrange(`Update available! ${info.currentVersion} → ${bold2(info.latestVersion)}`),
255022
+ shinyOrange(instruction)
255023
+ ].join(`
255024
+ `);
255025
+ }
255026
+ function formatPlainUpgradeMessage(info, distribution) {
255027
+ const instruction = getUpgradeInstruction(detectInstallMethod(distribution));
255028
+ return `Update available: ${info.currentVersion} → ${info.latestVersion}. ${instruction}`;
255029
+ }
255030
+ async function printUpgradeNotification(upgradeCheckPromise, distribution) {
255031
+ try {
255032
+ const upgradeInfo = await upgradeCheckPromise;
255033
+ if (upgradeInfo) {
255034
+ Ve(formatUpgradeMessage(upgradeInfo, distribution));
255035
+ }
255036
+ } catch {}
255037
+ }
255038
+
255039
+ // src/cli/utils/command/render.ts
255040
+ async function showCommandStart(fullBanner) {
255041
+ if (fullBanner) {
255042
+ await printBanner();
255043
+ We("");
255044
+ } else {
255045
+ We(theme.colors.base44OrangeBackground(" Base 44 "));
255046
+ }
255047
+ }
255048
+ async function showCommandEnd(result, upgradeCheckPromise, distribution) {
255049
+ await printUpgradeNotification(upgradeCheckPromise, distribution);
255050
+ Le(result.outroMessage || "");
255051
+ if (result.stdout) {
255052
+ process.stdout.write(result.stdout);
255053
+ }
255054
+ }
255055
+ function showThemedError(error48, context) {
255056
+ const errorMessage = error48 instanceof Error ? error48.message : String(error48);
255057
+ R2.error(errorMessage);
255058
+ if (isCLIError(error48)) {
255059
+ if (error48.details.length > 0) {
255060
+ R2.info(theme.format.details(error48.details));
255061
+ }
255062
+ const hints = theme.format.agentHints(error48.hints);
255063
+ if (hints) {
255064
+ R2.error(hints);
255065
+ }
255066
+ }
255067
+ if (process.env.DEBUG === "1" && error48 instanceof Error && error48.stack) {
255068
+ R2.error(theme.styles.dim(error48.stack));
255069
+ }
255070
+ const errorContext = context.errorReporter.getErrorContext();
255071
+ Le(theme.format.errorContext(errorContext));
255072
+ }
255073
+ function showPlainError(error48) {
255074
+ const errorMessage = error48 instanceof Error ? error48.message : String(error48);
255075
+ process.stderr.write(`Error: ${errorMessage}
255076
+ `);
255077
+ if (isCLIError(error48)) {
255078
+ for (const detail of error48.details) {
255079
+ process.stderr.write(` ${detail}
255080
+ `);
255081
+ }
255082
+ for (const hint of error48.hints) {
255083
+ const cmd = hint.command ? ` (${hint.command})` : "";
255084
+ process.stderr.write(` Hint: ${hint.message}${cmd}
255085
+ `);
255086
+ }
255087
+ }
255088
+ if (process.env.DEBUG === "1" && error48 instanceof Error && error48.stack) {
255089
+ process.stderr.write(`${error48.stack}
255090
+ `);
255091
+ }
255092
+ }
255093
+
255094
+ // src/cli/utils/command/Base44Command.ts
255095
+ function writeJsonSuccess(result) {
255096
+ if (result.stdout) {
255097
+ if (result.outroMessage) {
255098
+ process.stderr.write(`${result.outroMessage}
255099
+ `);
255100
+ }
255101
+ process.stdout.write(result.stdout);
255102
+ return;
255103
+ }
255104
+ process.stdout.write(`${JSON.stringify({ output: stripAnsi(result.outroMessage ?? "") })}
255105
+ `);
255106
+ }
255107
+ function writeJsonError(error48) {
255108
+ const envelope = {
255109
+ error: error48 instanceof Error ? error48.message : String(error48)
255110
+ };
255111
+ if (isCLIError(error48)) {
255112
+ envelope.code = error48.code;
255113
+ if (error48.details.length > 0) {
255114
+ envelope.details = error48.details;
255115
+ }
255116
+ if (error48.hints.length > 0) {
255117
+ envelope.hints = error48.hints;
255118
+ }
255119
+ }
255120
+ process.stdout.write(`${JSON.stringify(envelope)}
255121
+ `);
255122
+ }
255123
+
255124
+ class Base44Command extends Command {
255125
+ _context;
255126
+ _commandOptions;
255127
+ constructor(name2, options) {
255128
+ super(name2);
255129
+ this._commandOptions = {
255130
+ requireAuth: options?.requireAuth ?? true,
255131
+ requireAppContext: options?.requireAppContext ?? true,
255132
+ fullBanner: options?.fullBanner ?? false
255133
+ };
255134
+ }
255135
+ setContext(context) {
255136
+ this._context = context;
255137
+ }
255138
+ get context() {
255139
+ if (!this._context) {
255140
+ throw new Error("Base44Command context not set. Ensure the command is registered via createProgram().");
255141
+ }
255142
+ return this._context;
255143
+ }
255144
+ action(fn) {
255145
+ return super.action(async (...args) => {
255146
+ const jsonMode = this.context.jsonMode;
255147
+ const quiet = this.context.isNonInteractive || jsonMode;
255148
+ if (!quiet) {
255149
+ await showCommandStart(this._commandOptions.fullBanner);
255150
+ }
255151
+ const upgradeCheckPromise = startUpgradeCheck();
255152
+ try {
255153
+ if (this._commandOptions.requireAuth) {
255154
+ await ensureAuth(this.context);
255155
+ }
255156
+ if (this._commandOptions.requireAppContext) {
255157
+ const { appId } = this.optsWithGlobals();
255158
+ await ensureAppContext(this.context, { appId });
255159
+ }
255160
+ const result = await fn(this.context, ...args) ?? {};
255161
+ if (!quiet) {
255162
+ await showCommandEnd(result, upgradeCheckPromise, this.context.distribution);
255163
+ } else if (jsonMode) {
255164
+ writeJsonSuccess(result);
255165
+ const upgradeInfo = await upgradeCheckPromise;
255166
+ if (upgradeInfo) {
255167
+ process.stderr.write(`${formatPlainUpgradeMessage(upgradeInfo, this.context.distribution)}
255168
+ `);
255169
+ }
255170
+ } else {
255171
+ if (result.outroMessage) {
255172
+ process.stdout.write(`${result.outroMessage}
255173
+ `);
255174
+ }
255175
+ if (result.stdout) {
255176
+ process.stdout.write(result.stdout);
255177
+ }
255178
+ const upgradeInfo = await upgradeCheckPromise;
255179
+ if (upgradeInfo) {
255180
+ process.stderr.write(`${formatPlainUpgradeMessage(upgradeInfo, this.context.distribution)}
255181
+ `);
255182
+ }
255183
+ }
255184
+ } catch (error48) {
255185
+ if (jsonMode) {
255186
+ writeJsonError(error48);
255187
+ } else if (quiet) {
255188
+ showPlainError(error48);
255189
+ } else {
255190
+ showThemedError(error48, this.context);
255191
+ }
255192
+ throw error48;
255193
+ }
255194
+ });
255195
+ }
255196
+ }
255197
+ // src/cli/utils/confirm-push.ts
255198
+ async function confirmPush({
255199
+ isNonInteractive,
255200
+ yes,
255201
+ log,
255202
+ warning
255203
+ }) {
255204
+ if (isNonInteractive && !yes) {
255205
+ throw new InvalidInputError("--yes is required in non-interactive mode");
255206
+ }
255207
+ if (yes) {
255208
+ return true;
255209
+ }
255210
+ log.warn(warning);
255211
+ const proceed = await Re({
255212
+ message: "Are you sure you want to continue?"
255213
+ });
255214
+ return !Ct(proceed) && proceed;
255215
+ }
255216
+ // src/cli/utils/json.ts
255217
+ function toJsonStdout(result) {
255218
+ return `${JSON.stringify(result, null, 2)}
255219
+ `;
255220
+ }
255221
+ // src/cli/errors.ts
255222
+ class CLIExitError extends Error {
255223
+ code;
255224
+ constructor(code2) {
255225
+ super(`CLI exited with code ${code2}`);
255226
+ this.code = code2;
255227
+ this.name = "CLIExitError";
255228
+ }
255229
+ }
255230
+
255231
+ // src/cli/utils/prompts.ts
255232
+ var onPromptCancel = () => {
255233
+ Ne("Operation cancelled.");
255234
+ throw new CLIExitError(0);
255235
+ };
255236
+ // src/cli/utils/runTask.ts
255237
+ function createInteractiveRunTask() {
255238
+ return async (startMessage, operation, options) => {
255239
+ const s = bt2();
255240
+ s.start(startMessage);
255241
+ const updateMessage = (message) => s.message(message);
255242
+ try {
255243
+ const result = await operation(updateMessage);
255244
+ s.stop(options?.successMessage || startMessage);
255245
+ return result;
255246
+ } catch (error48) {
255247
+ s.error(options?.errorMessage || "Failed");
255248
+ throw error48;
255249
+ }
255250
+ };
255251
+ }
255252
+ function createSimpleRunTask(log) {
255253
+ return async (startMessage, operation, options) => {
255254
+ log.info(startMessage);
255255
+ const updateMessage = (message) => log.info(message);
255256
+ try {
255257
+ const result = await operation(updateMessage);
255258
+ log.success(options?.successMessage || startMessage);
255259
+ return result;
255260
+ } catch (error48) {
255261
+ log.error(options?.errorMessage || "Failed");
255262
+ throw error48;
255263
+ }
255264
+ };
255265
+ }
255266
+ // src/cli/utils/stdin.ts
255267
+ async function readStdin(flagName = "--stdin", options = {}) {
255268
+ if (process.stdin.isTTY) {
255269
+ throw new InvalidInputError(`${flagName} requires piped input (e.g., echo <value> | base44 ...)`);
255270
+ }
255271
+ const chunks = [];
255272
+ for await (const chunk of process.stdin) {
255273
+ chunks.push(chunk);
255274
+ }
255275
+ const text = Buffer.concat(chunks).toString("utf-8");
255276
+ return options.trim === false ? text : text.trim();
255277
+ }
255278
+
255279
+ // src/cli/utils/secret-input.ts
255280
+ async function resolveSecret(options) {
255281
+ if (options.fromStdin) {
255282
+ const value = await readStdin("--client-secret-stdin");
255283
+ if (value)
255284
+ return value;
255285
+ }
255286
+ if (options.flagValue) {
255287
+ return options.flagValue;
255288
+ }
255289
+ if (options.envVar) {
255290
+ const envValue = process.env[options.envVar];
255291
+ if (envValue)
255292
+ return envValue;
255293
+ }
255294
+ if (!options.isNonInteractive) {
255295
+ const value = await He({
255296
+ message: options.promptMessage,
255297
+ validate: (v) => {
255298
+ if (!v || v.trim().length === 0) {
255299
+ return `${options.name} is required`;
255300
+ }
255301
+ }
255302
+ });
255303
+ if (Ct(value)) {
255304
+ throw new CLIExitError(0);
255305
+ }
255306
+ return value;
255307
+ }
255308
+ throw new InvalidInputError(`Missing required ${options.name}.`, {
255309
+ hints: options.hints ?? [
255310
+ {
255311
+ message: `Provide the ${options.name} via flag, stdin, or environment variable (${options.envVar ?? "N/A"})`
255312
+ }
255313
+ ]
255314
+ });
255315
+ }
255316
+ // src/cli/utils/urls.ts
255317
+ function getDashboardUrl(projectId) {
255318
+ const id = projectId ?? getAppContext().id;
255319
+ return `${getBase44ApiUrl()}/apps/${id}/editor/workspace/overview`;
255320
+ }
255321
+ function getConnectorsUrl(projectId) {
255322
+ const id = projectId ?? getAppContext().id;
255323
+ return `${getBase44ApiUrl()}/apps/${id}/editor/workspace/app-connections`;
255324
+ }
255325
+ // src/cli/utils/yaml.ts
255326
+ var import_lodash = __toESM(require_lodash8(), 1);
255327
+ var YAML_INDENT = 2;
255328
+ var stripEmptyReplacer = (_key, value) => {
255329
+ if (typeof value === "number" || typeof value === "boolean")
255330
+ return value;
255331
+ if (import_lodash.isEmpty(value))
255332
+ return;
255333
+ return value;
255334
+ };
255335
+ function formatYaml(data, options = {}) {
255336
+ const { stripEmpty = true } = options;
255337
+ const replacer = stripEmpty ? stripEmptyReplacer : undefined;
255338
+ return $stringify(data, replacer, { indent: YAML_INDENT }).trimEnd();
255339
+ }
255334
255340
  // src/core/utils/dependencies.ts
255335
255341
  import { spawnSync as spawnSync2 } from "node:child_process";
255336
255342
  function verifyDenoInstalled(context) {
@@ -255648,7 +255654,7 @@ function getAuthPushCommand() {
255648
255654
  }
255649
255655
 
255650
255656
  // src/cli/commands/auth/social-login.ts
255651
- import { dirname as dirname15, join as join21, resolve as resolve6 } from "node:path";
255657
+ import { dirname as dirname15, join as join21, resolve as resolve7 } from "node:path";
255652
255658
  var PROVIDER_LABELS = {
255653
255659
  google: "Google",
255654
255660
  microsoft: "Microsoft",
@@ -255688,7 +255694,7 @@ async function socialLoginAction({ log, isNonInteractive, runTask: runTask2 }, p
255688
255694
  let clientSecret;
255689
255695
  if (useCustomOAuth && oauth && oauthCli && hasSecretOptions(options)) {
255690
255696
  if (options.envFile) {
255691
- const secrets = await parseEnvFile(resolve6(options.envFile));
255697
+ const secrets = await parseEnvFile(resolve7(options.envFile));
255692
255698
  const value = secrets[oauthCli.envVar];
255693
255699
  if (!value) {
255694
255700
  throw new InvalidInputError(`Key "${oauthCli.envVar}" not found in ${options.envFile}.`);
@@ -255744,7 +255750,7 @@ function getSocialLoginCommand() {
255744
255750
  }
255745
255751
 
255746
255752
  // src/cli/commands/auth/sso.ts
255747
- import { dirname as dirname16, join as join22, resolve as resolve7 } from "node:path";
255753
+ import { dirname as dirname16, join as join22, resolve as resolve8 } from "node:path";
255748
255754
  var SSOConfigFileSchema = exports_external.object({
255749
255755
  provider: exports_external.enum(Object.values(KNOWN_SSO_PROVIDERS)),
255750
255756
  clientId: exports_external.string(),
@@ -255760,7 +255766,7 @@ var SSOConfigFileSchema = exports_external.object({
255760
255766
  ssoName: exports_external.string().optional()
255761
255767
  });
255762
255768
  async function loadSSOConfigFile(filePath) {
255763
- const resolved = resolve7(filePath);
255769
+ const resolved = resolve8(filePath);
255764
255770
  const raw2 = await readJsonFile(resolved);
255765
255771
  const result = SSOConfigFileSchema.safeParse(raw2);
255766
255772
  if (!result.success) {
@@ -255848,7 +255854,7 @@ async function ssoEnableAction({ isNonInteractive, runTask: runTask2 }, options)
255848
255854
  }
255849
255855
  let clientSecret;
255850
255856
  if (merged.envFile && !merged.clientSecret) {
255851
- const secrets2 = await parseEnvFile(resolve7(merged.envFile));
255857
+ const secrets2 = await parseEnvFile(resolve8(merged.envFile));
255852
255858
  const value = secrets2.sso_client_secret;
255853
255859
  if (!value) {
255854
255860
  throw new InvalidInputError(`Key "sso_client_secret" not found in ${merged.envFile}.`);
@@ -256486,19 +256492,19 @@ var baseOpen = async (options) => {
256486
256492
  }
256487
256493
  const subprocess = childProcess3.spawn(command2, cliArguments, childProcessOptions);
256488
256494
  if (options.wait) {
256489
- return new Promise((resolve8, reject) => {
256495
+ return new Promise((resolve9, reject) => {
256490
256496
  subprocess.once("error", reject);
256491
256497
  subprocess.once("close", (exitCode) => {
256492
256498
  if (!options.allowNonzeroExitCode && exitCode !== 0) {
256493
256499
  reject(new Error(`Exited with code ${exitCode}`));
256494
256500
  return;
256495
256501
  }
256496
- resolve8(subprocess);
256502
+ resolve9(subprocess);
256497
256503
  });
256498
256504
  });
256499
256505
  }
256500
256506
  if (isFallbackAttempt) {
256501
- return new Promise((resolve8, reject) => {
256507
+ return new Promise((resolve9, reject) => {
256502
256508
  subprocess.once("error", reject);
256503
256509
  subprocess.once("spawn", () => {
256504
256510
  subprocess.once("close", (exitCode) => {
@@ -256508,17 +256514,17 @@ var baseOpen = async (options) => {
256508
256514
  return;
256509
256515
  }
256510
256516
  subprocess.unref();
256511
- resolve8(subprocess);
256517
+ resolve9(subprocess);
256512
256518
  });
256513
256519
  });
256514
256520
  });
256515
256521
  }
256516
256522
  subprocess.unref();
256517
- return new Promise((resolve8, reject) => {
256523
+ return new Promise((resolve9, reject) => {
256518
256524
  subprocess.once("error", reject);
256519
256525
  subprocess.once("spawn", () => {
256520
256526
  subprocess.off("error", reject);
256521
- resolve8(subprocess);
256527
+ resolve9(subprocess);
256522
256528
  });
256523
256529
  });
256524
256530
  };
@@ -256781,10 +256787,10 @@ function getConnectorsListAvailableCommand() {
256781
256787
  }
256782
256788
 
256783
256789
  // src/cli/commands/connectors/pull.ts
256784
- import { dirname as dirname17, join as join23, resolve as resolve8 } from "node:path";
256790
+ import { dirname as dirname17, join as join23, resolve as resolve9 } from "node:path";
256785
256791
  async function resolveConnectorsDir(options) {
256786
256792
  if (!getAppContext().projectRoot) {
256787
- return resolve8(options.dir ?? "connectors");
256793
+ return resolve9(options.dir ?? "connectors");
256788
256794
  }
256789
256795
  const { project: project2 } = await readProjectConfig();
256790
256796
  return join23(dirname17(project2.configPath), project2.connectorsDir);
@@ -256828,10 +256834,10 @@ function getConnectorsPullCommand() {
256828
256834
  }
256829
256835
 
256830
256836
  // src/cli/commands/connectors/push.ts
256831
- import { resolve as resolve9 } from "node:path";
256837
+ import { resolve as resolve10 } from "node:path";
256832
256838
  async function readConnectorsToPush(options) {
256833
256839
  if (!getAppContext().projectRoot) {
256834
- return readAllConnectors(resolve9(options.dir ?? "connectors"));
256840
+ return readAllConnectors(resolve10(options.dir ?? "connectors"));
256835
256841
  }
256836
256842
  const { connectors } = await readProjectConfig();
256837
256843
  return connectors;
@@ -257258,7 +257264,7 @@ function getFunctionsCommand() {
257258
257264
  }
257259
257265
 
257260
257266
  // src/cli/commands/project/create.ts
257261
- import { basename as basename4, resolve as resolve10 } from "node:path";
257267
+ import { basename as basename4, resolve as resolve11 } from "node:path";
257262
257268
  var import_kebabCase = __toESM(require_kebabCase(), 1);
257263
257269
 
257264
257270
  // src/cli/commands/project/scaffold-shared.ts
@@ -257450,7 +257456,7 @@ async function createInteractive(options, ctx) {
257450
257456
  }, ctx);
257451
257457
  }
257452
257458
  async function createNonInteractive(options, ctx) {
257453
- ctx.log.info(`Creating a new project at ${resolve10(options.path)}`);
257459
+ ctx.log.info(`Creating a new project at ${resolve11(options.path)}`);
257454
257460
  const template2 = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
257455
257461
  return await executeCreate({
257456
257462
  template: template2,
@@ -257474,7 +257480,7 @@ async function executeCreate({
257474
257480
  }, ctx) {
257475
257481
  const { log, runTask: runTask2 } = ctx;
257476
257482
  const name2 = rawName.trim();
257477
- const resolvedPath = resolve10(projectPath);
257483
+ const resolvedPath = resolve11(projectPath);
257478
257484
  const organizationId = await resolveWorkspaceId(ctx, flagWorkspaceId, isInteractive);
257479
257485
  const { projectId } = await runTask2("Setting up your project...", async () => {
257480
257486
  return await createProjectFiles({
@@ -257524,8 +257530,46 @@ Examples:
257524
257530
  $ base44 create my-app --workspace 507f1f77bcf86cd799439011 Creates a base44 project in the given workspace`).hook("preAction", validateCreateOptions).action(createAction);
257525
257531
  }
257526
257532
 
257533
+ // src/cli/commands/site/run-app-deploy.ts
257534
+ async function runAppSiteDeploy({ runTask: runTask2, log }, target, options = {}) {
257535
+ const kind = await detectAppDeployKind(target);
257536
+ if (kind === "none")
257537
+ return { kind: "none" };
257538
+ const isFullStack = kind === "full-stack";
257539
+ const progressLines = [];
257540
+ const warnings = [];
257541
+ const result = await runTask2(isFullStack ? "Deploying full-stack app..." : "Creating archive and deploying site...", async (updateMessage) => await deployAppSite(target, {
257542
+ gitHash: options.gitHash,
257543
+ progress: {
257544
+ onWarning: (message) => {
257545
+ warnings.push(message);
257546
+ },
257547
+ onAssets: ({ totalAssets, newAssets }) => {
257548
+ const line = `Found ${totalAssets} static assets (${newAssets} new)`;
257549
+ progressLines.push(line);
257550
+ updateMessage(line);
257551
+ },
257552
+ onAssetUpload: ({ uploadedFiles, totalFiles }) => {
257553
+ updateMessage(`Uploaded ${uploadedFiles} of ${totalFiles} assets`);
257554
+ },
257555
+ onWorker: ({ moduleCount }) => {
257556
+ updateMessage(`Deploying worker (${moduleCount} modules)…`);
257557
+ }
257558
+ }
257559
+ }), {
257560
+ successMessage: isFullStack ? theme.colors.base44Orange("Full-stack app deployed") : "Site deployed successfully",
257561
+ errorMessage: isFullStack ? "Full-stack deploy failed" : "Deployment failed"
257562
+ });
257563
+ for (const line of progressLines) {
257564
+ log.message(theme.styles.dim(line));
257565
+ }
257566
+ for (const warning of warnings) {
257567
+ log.warn(warning);
257568
+ }
257569
+ return result;
257570
+ }
257571
+
257527
257572
  // src/cli/commands/project/deploy.ts
257528
- import { resolve as resolve11 } from "node:path";
257529
257573
  async function deployAction(ctx, options = {}) {
257530
257574
  const { isNonInteractive, log } = ctx;
257531
257575
  if (isNonInteractive && !options.yes) {
@@ -257536,9 +257580,8 @@ async function deployAction(ctx, options = {}) {
257536
257580
  }
257537
257581
  const projectData = await readProjectConfig(options.projectRoot);
257538
257582
  const { project: project2, entities, functions, agents, connectors, authConfig } = projectData;
257539
- let fullStackArtifact = await detectFullStackArtifact(project2.root);
257540
- const isFullStackCandidate = fullStackArtifact !== null || Boolean(project2.site?.buildCommand);
257541
- if (!hasResourcesToDeploy(projectData) && !isFullStackCandidate) {
257583
+ const plannedSite = await detectAppDeployKind(project2);
257584
+ if (!hasResourcesToDeploy(projectData) && plannedSite === "none") {
257542
257585
  return {
257543
257586
  outroMessage: "No resources found to deploy"
257544
257587
  };
@@ -257562,7 +257605,7 @@ async function deployAction(ctx, options = {}) {
257562
257605
  if (project2.visibility) {
257563
257606
  summaryLines.push(` - Visibility: ${project2.visibility}`);
257564
257607
  }
257565
- if (fullStackArtifact) {
257608
+ if (plannedSite === "full-stack") {
257566
257609
  summaryLines.push(" - Full-stack app");
257567
257610
  } else if (project2.site?.outputDirectory) {
257568
257611
  summaryLines.push(` - Site from ${project2.site.outputDirectory}`);
@@ -257598,16 +257641,10 @@ ${summaryLines.join(`
257598
257641
  formatDeployResult(r, log);
257599
257642
  }
257600
257643
  });
257601
- await buildSiteIfNeeded(ctx, projectData, options, fullStackArtifact);
257602
- fullStackArtifact = await detectFullStackArtifact(project2.root);
257603
- let appUrl;
257604
- let fullStackResult;
257605
- if (fullStackArtifact) {
257606
- fullStackResult = await runFullStackDeploy(ctx, project2.root, options);
257607
- } else if (project2.site?.outputDirectory) {
257608
- const outputDir = resolve11(project2.root, project2.site.outputDirectory);
257609
- ({ appUrl } = await deploySite(outputDir));
257610
- }
257644
+ await buildSiteIfNeeded(ctx, projectData, options);
257645
+ const siteResult = await runAppSiteDeploy(ctx, project2, {
257646
+ gitHash: options.gitHash
257647
+ });
257611
257648
  const connectorResults = result.connectorResults ?? [];
257612
257649
  await handleOAuthConnectors(connectorResults, isNonInteractive, options, log);
257613
257650
  const stripeResult = connectorResults.find((r) => r.type === "stripe");
@@ -257615,27 +257652,26 @@ ${summaryLines.join(`
257615
257652
  printStripeResult(stripeResult, log);
257616
257653
  }
257617
257654
  log.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl())}`);
257618
- if (appUrl) {
257619
- log.message(`${theme.styles.header("App URL")}: ${theme.colors.links(appUrl)}`);
257655
+ if (siteResult.kind === "static") {
257656
+ log.message(`${theme.styles.header("App URL")}: ${theme.colors.links(siteResult.appUrl)}`);
257620
257657
  }
257621
- if (fullStackResult) {
257622
- printFullStackSummary(fullStackResult, log);
257658
+ if (siteResult.kind === "full-stack") {
257659
+ printFullStackSummary(siteResult, log);
257623
257660
  }
257624
257661
  return {
257625
257662
  outroMessage: "App deployed successfully",
257626
- stdout: ctx.jsonMode && fullStackResult ? `${JSON.stringify({
257627
- deploymentId: fullStackResult.deploymentId,
257628
- gitHash: fullStackResult.gitHash
257663
+ stdout: ctx.jsonMode && siteResult.kind === "full-stack" ? `${JSON.stringify({
257664
+ deploymentId: siteResult.deploymentId,
257665
+ gitHash: siteResult.gitHash
257629
257666
  }, null, 2)}
257630
257667
  ` : undefined
257631
257668
  };
257632
257669
  }
257633
- async function buildSiteIfNeeded({ runTask: runTask2 }, { project: project2 }, options, fullStackArtifact) {
257670
+ async function buildSiteIfNeeded({ runTask: runTask2 }, { project: project2 }, options) {
257634
257671
  const site2 = project2.site;
257635
257672
  if (!site2?.buildCommand || options.prebuilt)
257636
257673
  return;
257637
- const artifactPresent = fullStackArtifact !== null || (site2.outputDirectory ? await pathExists(resolve11(project2.root, site2.outputDirectory)) : false);
257638
- if (artifactPresent && !options.build)
257674
+ if (await hasBuiltArtifact(project2) && !options.build)
257639
257675
  return;
257640
257676
  const { installCommand, buildCommand } = site2;
257641
257677
  await runTask2(installCommand ? "Installing dependencies..." : "Building project...", async (updateMessage) => {
@@ -257649,41 +257685,6 @@ async function buildSiteIfNeeded({ runTask: runTask2 }, { project: project2 }, o
257649
257685
  errorMessage: "Failed to build project"
257650
257686
  });
257651
257687
  }
257652
- async function runFullStackDeploy({ runTask: runTask2, log }, projectRoot, options) {
257653
- const gitHash = await resolveGitHash(projectRoot, options.gitHash);
257654
- const progressLines = [];
257655
- const warnings = [];
257656
- const deployment = await runTask2("Deploying full-stack app...", async (updateMessage) => await deployFullStack({
257657
- projectRoot,
257658
- gitHash,
257659
- progress: {
257660
- onWarning: (message) => {
257661
- warnings.push(message);
257662
- },
257663
- onAssets: ({ totalAssets, newAssets }) => {
257664
- const line = `Found ${totalAssets} static assets (${newAssets} new)`;
257665
- progressLines.push(line);
257666
- updateMessage(line);
257667
- },
257668
- onAssetUpload: ({ uploadedFiles, totalFiles }) => {
257669
- updateMessage(`Uploaded ${uploadedFiles} of ${totalFiles} assets`);
257670
- },
257671
- onWorker: ({ moduleCount }) => {
257672
- updateMessage(`Deploying worker (${moduleCount} modules)…`);
257673
- }
257674
- }
257675
- }), {
257676
- successMessage: theme.colors.base44Orange("Full-stack app deployed"),
257677
- errorMessage: "Full-stack deploy failed"
257678
- });
257679
- for (const line of progressLines) {
257680
- log.message(theme.styles.dim(line));
257681
- }
257682
- for (const warning of warnings) {
257683
- log.warn(warning);
257684
- }
257685
- return deployment;
257686
- }
257687
257688
  function printFullStackSummary(deployment, log) {
257688
257689
  log.message(`${theme.styles.header("Deployment")}: ${deployment.deploymentId} ${theme.styles.dim(`(commit ${deployment.gitHash.slice(0, 12)})`)}`);
257689
257690
  }
@@ -258553,40 +258554,50 @@ function getSecretsCommand() {
258553
258554
  }
258554
258555
 
258555
258556
  // src/cli/commands/site/deploy.ts
258556
- import { resolve as resolve14 } from "node:path";
258557
- async function deployAction2({ isNonInteractive, runTask: runTask2 }, options) {
258557
+ async function deployAction2(ctx, options) {
258558
+ const { isNonInteractive } = ctx;
258558
258559
  if (isNonInteractive && !options.yes) {
258559
258560
  throw new InvalidInputError("--yes is required in non-interactive mode");
258560
258561
  }
258561
258562
  const { project: project2 } = await readProjectConfig();
258562
- if (!project2.site?.outputDirectory) {
258563
+ const kind = await detectAppDeployKind(project2);
258564
+ if (kind === "none") {
258563
258565
  throw new ConfigNotFoundError("No site configuration found.", {
258564
258566
  hints: [
258565
258567
  {
258566
258568
  message: `Add 'site.outputDirectory' to your config.jsonc (e.g., "site": { "outputDirectory": "dist" })`
258569
+ },
258570
+ {
258571
+ message: "Full-stack apps ship from their build artifact — run your framework's build first"
258567
258572
  }
258568
258573
  ]
258569
258574
  });
258570
258575
  }
258571
- const outputDir = resolve14(project2.root, project2.site.outputDirectory);
258572
258576
  if (!options.yes) {
258573
258577
  const shouldDeploy = await Re({
258574
- message: `Deploy site from ${project2.site.outputDirectory}?`
258578
+ message: kind === "full-stack" ? "Deploy full-stack app?" : `Deploy site from ${project2.site?.outputDirectory}?`
258575
258579
  });
258576
258580
  if (Ct(shouldDeploy) || !shouldDeploy) {
258577
258581
  return { outroMessage: "Deployment cancelled" };
258578
258582
  }
258579
258583
  }
258580
- const result = await runTask2("Creating archive and deploying site...", async () => {
258581
- return await deploySite(outputDir);
258582
- }, {
258583
- successMessage: "Site deployed successfully",
258584
- errorMessage: "Deployment failed"
258584
+ const result = await runAppSiteDeploy(ctx, project2, {
258585
+ gitHash: options.gitHash
258585
258586
  });
258586
- return { outroMessage: `Visit your site at: ${result.appUrl}` };
258587
+ if (result.kind === "full-stack") {
258588
+ return {
258589
+ outroMessage: `Deployment ${result.deploymentId} (commit ${result.gitHash.slice(0, 12)})`,
258590
+ stdout: ctx.jsonMode ? `${JSON.stringify({ deploymentId: result.deploymentId, gitHash: result.gitHash }, null, 2)}
258591
+ ` : undefined
258592
+ };
258593
+ }
258594
+ if (result.kind === "static") {
258595
+ return { outroMessage: `Visit your site at: ${result.appUrl}` };
258596
+ }
258597
+ return { outroMessage: "Nothing to deploy" };
258587
258598
  }
258588
258599
  function getSiteDeployCommand() {
258589
- return new Base44Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").action(deployAction2);
258600
+ return new Base44Command("deploy").description("Deploy the built site to Base44 hosting (full-stack apps deploy their Workers build)").option("-y, --yes", "Skip confirmation prompt").option("--git-hash <hash>", "Commit the full-stack build came from (defaults to the checkout's HEAD)").action(deployAction2);
258590
258601
  }
258591
258602
 
258592
258603
  // src/cli/commands/site/open.ts
@@ -258958,14 +258969,14 @@ var getLocalHosts = () => {
258958
258969
  }
258959
258970
  return results;
258960
258971
  };
258961
- var checkAvailablePort = (options8) => new Promise((resolve16, reject) => {
258972
+ var checkAvailablePort = (options8) => new Promise((resolve15, reject) => {
258962
258973
  const server = net.createServer();
258963
258974
  server.unref();
258964
258975
  server.on("error", reject);
258965
258976
  server.listen(options8, () => {
258966
258977
  const { port } = server.address();
258967
258978
  server.close(() => {
258968
- resolve16(port);
258979
+ resolve15(port);
258969
258980
  });
258970
258981
  });
258971
258982
  });
@@ -259210,7 +259221,7 @@ class FunctionManager extends BaseFunctionManager {
259210
259221
  });
259211
259222
  }
259212
259223
  waitForReady(name2, runningFunc) {
259213
- return new Promise((resolve16, reject) => {
259224
+ return new Promise((resolve15, reject) => {
259214
259225
  runningFunc.process.on("exit", (code2) => {
259215
259226
  if (!runningFunc.ready) {
259216
259227
  clearTimeout(timeout3);
@@ -259233,7 +259244,7 @@ class FunctionManager extends BaseFunctionManager {
259233
259244
  runningFunc.ready = true;
259234
259245
  clearTimeout(timeout3);
259235
259246
  runningFunc.process.stdout?.off("data", onData);
259236
- resolve16(runningFunc.port);
259247
+ resolve15(runningFunc.port);
259237
259248
  }
259238
259249
  };
259239
259250
  runningFunc.process.stdout?.on("data", onData);
@@ -261667,7 +261678,7 @@ class NodeFsHandler {
261667
261678
  this._addToNodeFs(path19, initialAdd, wh2, depth + 1);
261668
261679
  }
261669
261680
  }).on(EV.ERROR, this._boundHandleError);
261670
- return new Promise((resolve17, reject) => {
261681
+ return new Promise((resolve16, reject) => {
261671
261682
  if (!stream)
261672
261683
  return reject();
261673
261684
  stream.once(STR_END, () => {
@@ -261676,7 +261687,7 @@ class NodeFsHandler {
261676
261687
  return;
261677
261688
  }
261678
261689
  const wasThrottled = throttler ? throttler.clear() : false;
261679
- resolve17(undefined);
261690
+ resolve16(undefined);
261680
261691
  previous.getChildren().filter((item) => {
261681
261692
  return item !== directory && !current.has(item);
261682
261693
  }).forEach((item) => {
@@ -262593,7 +262604,7 @@ async function createDevServer(options8) {
262593
262604
  }
262594
262605
  remoteProxy(req, res, next);
262595
262606
  });
262596
- const server = await new Promise((resolve18, reject) => {
262607
+ const server = await new Promise((resolve17, reject) => {
262597
262608
  const s5 = app.listen(port, "127.0.0.1", (err) => {
262598
262609
  if (err) {
262599
262610
  if ("code" in err && err.code === "EADDRINUSE") {
@@ -262602,7 +262613,7 @@ async function createDevServer(options8) {
262602
262613
  reject(err);
262603
262614
  }
262604
262615
  } else {
262605
- resolve18(s5);
262616
+ resolve17(s5);
262606
262617
  }
262607
262618
  });
262608
262619
  });
@@ -262652,13 +262663,13 @@ async function createDevServer(options8) {
262652
262663
  if (!server.listening) {
262653
262664
  return;
262654
262665
  }
262655
- await new Promise((resolve18, reject) => {
262666
+ await new Promise((resolve17, reject) => {
262656
262667
  server.close((error48) => {
262657
262668
  if (error48) {
262658
262669
  reject(error48);
262659
262670
  return;
262660
262671
  }
262661
- resolve18();
262672
+ resolve17();
262662
262673
  });
262663
262674
  });
262664
262675
  };
@@ -262729,15 +262740,15 @@ class ServeRunner {
262729
262740
  return;
262730
262741
  }
262731
262742
  this.stopping = true;
262732
- const exited = new Promise((resolve18) => child.once("exit", () => resolve18()));
262743
+ const exited = new Promise((resolve17) => child.once("exit", () => resolve17()));
262733
262744
  if (process23.platform === "win32" && child.pid) {
262734
262745
  const taskkill = spawn3("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
262735
262746
  stdio: "ignore",
262736
262747
  windowsHide: true
262737
262748
  });
262738
- await new Promise((resolve18) => {
262739
- taskkill.once("exit", () => resolve18());
262740
- taskkill.once("error", () => resolve18());
262749
+ await new Promise((resolve17) => {
262750
+ taskkill.once("exit", () => resolve17());
262751
+ taskkill.once("error", () => resolve17());
262741
262752
  });
262742
262753
  } else if (child.pid) {
262743
262754
  try {
@@ -262907,13 +262918,13 @@ async function runScript(options8) {
262907
262918
  }
262908
262919
  // src/cli/commands/exec.ts
262909
262920
  function readStdin2() {
262910
- return new Promise((resolve18, reject) => {
262921
+ return new Promise((resolve17, reject) => {
262911
262922
  let data = "";
262912
262923
  process.stdin.setEncoding("utf-8");
262913
262924
  process.stdin.on("data", (chunk) => {
262914
262925
  data += chunk;
262915
262926
  });
262916
- process.stdin.on("end", () => resolve18(data));
262927
+ process.stdin.on("end", () => resolve17(data));
262917
262928
  process.stdin.on("error", reject);
262918
262929
  });
262919
262930
  }
@@ -262984,7 +262995,7 @@ Examples:
262984
262995
  }
262985
262996
 
262986
262997
  // src/cli/commands/project/eject.ts
262987
- import { resolve as resolve18 } from "node:path";
262998
+ import { resolve as resolve17 } from "node:path";
262988
262999
  var import_kebabCase2 = __toESM(require_kebabCase(), 1);
262989
263000
  async function eject(ctx, options8, command2) {
262990
263001
  const { log, runTask: runTask2, isNonInteractive } = ctx;
@@ -263048,7 +263059,7 @@ async function eject(ctx, options8, command2) {
263048
263059
  Ne("Operation cancelled.");
263049
263060
  throw new CLIExitError(0);
263050
263061
  }
263051
- const resolvedPath = resolve18(selectedPath);
263062
+ const resolvedPath = resolve17(selectedPath);
263052
263063
  await runTask2("Downloading your project's code...", async (updateMessage) => {
263053
263064
  await createProjectFilesForExistingProject({
263054
263065
  projectId,
@@ -265423,14 +265434,14 @@ async function addSourceContext(frames) {
265423
265434
  return frames;
265424
265435
  }
265425
265436
  function getContextLinesFromFile(path19, ranges, output) {
265426
- return new Promise((resolve19) => {
265437
+ return new Promise((resolve18) => {
265427
265438
  const stream = createReadStream2(path19);
265428
265439
  const lineReaded = createInterface2({
265429
265440
  input: stream
265430
265441
  });
265431
265442
  function destroyStreamAndResolve() {
265432
265443
  stream.destroy();
265433
- resolve19();
265444
+ resolve18();
265434
265445
  }
265435
265446
  let lineNumber = 0;
265436
265447
  let currentRangeIndex = 0;
@@ -266542,15 +266553,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
266542
266553
  return true;
266543
266554
  if (this.featureFlagsPoller === undefined)
266544
266555
  return false;
266545
- return new Promise((resolve19) => {
266556
+ return new Promise((resolve18) => {
266546
266557
  const timeout3 = setTimeout(() => {
266547
266558
  cleanup();
266548
- resolve19(false);
266559
+ resolve18(false);
266549
266560
  }, timeoutMs);
266550
266561
  const cleanup = this._events.on("localEvaluationFlagsLoaded", (count2) => {
266551
266562
  clearTimeout(timeout3);
266552
266563
  cleanup();
266553
- resolve19(count2 > 0);
266564
+ resolve18(count2 > 0);
266554
266565
  });
266555
266566
  });
266556
266567
  }
@@ -267375,4 +267386,4 @@ export {
267375
267386
  CLIExitError
267376
267387
  };
267377
267388
 
267378
- //# debugId=ACC632618E19D78664756E2164756E21
267389
+ //# debugId=FB9E6446856AEBA564756E2164756E21