@base44-preview/cli 0.0.37-pr.365.600b1d5 → 0.0.38-pr.367.04e6606

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
@@ -8933,10 +8933,10 @@ var require_ejs = __commonJS((exports) => {
8933
8933
  exports.localsName = _DEFAULT_LOCALS_NAME;
8934
8934
  exports.promiseImpl = new Function("return this;")().Promise;
8935
8935
  exports.resolveInclude = function(name2, filename, isDir) {
8936
- var dirname6 = path11.dirname;
8936
+ var dirname7 = path11.dirname;
8937
8937
  var extname = path11.extname;
8938
8938
  var resolve = path11.resolve;
8939
- var includePath = resolve(isDir ? filename : dirname6(filename), name2);
8939
+ var includePath = resolve(isDir ? filename : dirname7(filename), name2);
8940
8940
  var ext = extname(name2);
8941
8941
  if (!ext) {
8942
8942
  includePath += ".ejs";
@@ -12652,8 +12652,8 @@ var require_main = __commonJS((exports, module) => {
12652
12652
  const shortPaths = [];
12653
12653
  for (const filePath of optionPaths) {
12654
12654
  try {
12655
- const relative = path11.relative(process.cwd(), filePath);
12656
- shortPaths.push(relative);
12655
+ const relative3 = path11.relative(process.cwd(), filePath);
12656
+ shortPaths.push(relative3);
12657
12657
  } catch (e2) {
12658
12658
  if (debug) {
12659
12659
  _debug(`Failed to load ${filePath} ${e2.message}`);
@@ -110477,9 +110477,9 @@ function getMessage2(key2, parameters, self2) {
110477
110477
  assert22.ok(message.length <= parameters.length, `Code: ${key2}; The provided arguments length (${parameters.length}) does not match the required ones (${message.length}).`);
110478
110478
  return Reflect.apply(message, self2, parameters);
110479
110479
  }
110480
- const regex2 = /%[dfijoOs]/g;
110480
+ const regex = /%[dfijoOs]/g;
110481
110481
  let expectedLength = 0;
110482
- while (regex2.exec(message) !== null)
110482
+ while (regex.exec(message) !== null)
110483
110483
  expectedLength++;
110484
110484
  assert22.ok(expectedLength === parameters.length, `Code: ${key2}; The provided arguments length (${parameters.length}) does not match the required ones (${expectedLength}).`);
110485
110485
  if (parameters.length === 0)
@@ -111380,9 +111380,9 @@ function convertEndOfLineOptionToCharacter2(endOfLineOption) {
111380
111380
  return endOfLineOption === OPTION_CR2 ? CHARACTER_CR2 : endOfLineOption === OPTION_CRLF2 ? CHARACTER_CRLF2 : DEFAULT_EOL2;
111381
111381
  }
111382
111382
  function countEndOfLineCharacters(text, endOfLineCharacter) {
111383
- const regex2 = regexps.get(endOfLineCharacter);
111383
+ const regex = regexps.get(endOfLineCharacter);
111384
111384
  if (false) {}
111385
- return text.match(regex2)?.length ?? 0;
111385
+ return text.match(regex)?.length ?? 0;
111386
111386
  }
111387
111387
  function normalizeEndOfLine(text) {
111388
111388
  return method_replace_all_default2(0, text, END_OF_LINE_REGEXP, CHARACTER_LF2);
@@ -113584,8 +113584,8 @@ function legacyIsNextLineEmpty(text, node, locEnd) {
113584
113584
  }
113585
113585
  function makeString(rawText, enclosingQuote, unescapeUnnecessaryEscapes) {
113586
113586
  const otherQuote = enclosingQuote === '"' ? "'" : '"';
113587
- const regex2 = /\\(.)|(["'])/gsu;
113588
- const raw2 = method_replace_all_default2(0, rawText, regex2, (match, escaped, quote) => {
113587
+ const regex = /\\(.)|(["'])/gsu;
113588
+ const raw2 = method_replace_all_default2(0, rawText, regex, (match, escaped, quote) => {
113589
113589
  if (escaped === otherQuote) {
113590
113590
  return escaped;
113591
113591
  }
@@ -117006,17 +117006,17 @@ var init_prettier = __esm(() => {
117006
117006
  }
117007
117007
  const opts = options8 || {};
117008
117008
  const posix = utils3.isWindows(options8);
117009
- const regex2 = isState ? picomatch.compileRe(glob, options8) : picomatch.makeRe(glob, options8, false, true);
117010
- const state = regex2.state;
117011
- delete regex2.state;
117009
+ const regex = isState ? picomatch.compileRe(glob, options8) : picomatch.makeRe(glob, options8, false, true);
117010
+ const state = regex.state;
117011
+ delete regex.state;
117012
117012
  let isIgnored2 = () => false;
117013
117013
  if (opts.ignore) {
117014
117014
  const ignoreOpts = { ...options8, ignore: null, onMatch: null, onResult: null };
117015
117015
  isIgnored2 = picomatch(opts.ignore, ignoreOpts, returnState);
117016
117016
  }
117017
117017
  const matcher = (input, returnObject = false) => {
117018
- const { isMatch, match, output } = picomatch.test(input, regex2, options8, { glob, posix });
117019
- const result = { glob, state, regex: regex2, posix, input, output, match, isMatch };
117018
+ const { isMatch, match, output } = picomatch.test(input, regex, options8, { glob, posix });
117019
+ const result = { glob, state, regex, posix, input, output, match, isMatch };
117020
117020
  if (typeof opts.onResult === "function") {
117021
117021
  opts.onResult(result);
117022
117022
  }
@@ -117041,7 +117041,7 @@ var init_prettier = __esm(() => {
117041
117041
  }
117042
117042
  return matcher;
117043
117043
  };
117044
- picomatch.test = (input, regex2, options8, { glob, posix } = {}) => {
117044
+ picomatch.test = (input, regex, options8, { glob, posix } = {}) => {
117045
117045
  if (typeof input !== "string") {
117046
117046
  throw new TypeError("Expected input to be a string");
117047
117047
  }
@@ -117058,16 +117058,16 @@ var init_prettier = __esm(() => {
117058
117058
  }
117059
117059
  if (match === false || opts.capture === true) {
117060
117060
  if (opts.matchBase === true || opts.basename === true) {
117061
- match = picomatch.matchBase(input, regex2, options8, posix);
117061
+ match = picomatch.matchBase(input, regex, options8, posix);
117062
117062
  } else {
117063
- match = regex2.exec(output);
117063
+ match = regex.exec(output);
117064
117064
  }
117065
117065
  }
117066
117066
  return { isMatch: Boolean(match), match, output };
117067
117067
  };
117068
117068
  picomatch.matchBase = (input, glob, options8, posix = utils3.isWindows(options8)) => {
117069
- const regex2 = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options8);
117070
- return regex2.test(path152.basename(input));
117069
+ const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options8);
117070
+ return regex.test(path152.basename(input));
117071
117071
  };
117072
117072
  picomatch.isMatch = (str, patterns, options8) => picomatch(patterns, options8)(str);
117073
117073
  picomatch.parse = (pattern, options8) => {
@@ -117087,11 +117087,11 @@ var init_prettier = __esm(() => {
117087
117087
  if (state && state.negated === true) {
117088
117088
  source2 = `^(?!${source2}).*$`;
117089
117089
  }
117090
- const regex2 = picomatch.toRegex(source2, options8);
117090
+ const regex = picomatch.toRegex(source2, options8);
117091
117091
  if (returnState === true) {
117092
- regex2.state = state;
117092
+ regex.state = state;
117093
117093
  }
117094
- return regex2;
117094
+ return regex;
117095
117095
  };
117096
117096
  picomatch.makeRe = (input, options8 = {}, returnOutput = false, returnState = false) => {
117097
117097
  if (!input || typeof input !== "string") {
@@ -117255,8 +117255,8 @@ var init_prettier = __esm(() => {
117255
117255
  };
117256
117256
  micromatch2.capture = (glob, input, options8) => {
117257
117257
  let posix = utils3.isWindows(options8);
117258
- let regex2 = picomatch.makeRe(String(glob), { ...options8, capture: true });
117259
- let match = regex2.exec(posix ? utils3.toPosixSlashes(input) : input);
117258
+ let regex = picomatch.makeRe(String(glob), { ...options8, capture: true });
117259
+ let match = regex.exec(posix ? utils3.toPosixSlashes(input) : input);
117260
117260
  if (match) {
117261
117261
  return match.slice(1).map((v10) => v10 === undefined ? "" : v10);
117262
117262
  }
@@ -117434,15 +117434,15 @@ var init_prettier = __esm(() => {
117434
117434
  exports.removeDuplicateSlashes = removeDuplicateSlashes;
117435
117435
  function partitionAbsoluteAndRelative(patterns) {
117436
117436
  const absolute = [];
117437
- const relative2 = [];
117437
+ const relative22 = [];
117438
117438
  for (const pattern of patterns) {
117439
117439
  if (isAbsolute2(pattern)) {
117440
117440
  absolute.push(pattern);
117441
117441
  } else {
117442
- relative2.push(pattern);
117442
+ relative22.push(pattern);
117443
117443
  }
117444
117444
  }
117445
- return [absolute, relative2];
117445
+ return [absolute, relative22];
117446
117446
  }
117447
117447
  exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
117448
117448
  function isAbsolute2(pattern) {
@@ -121695,7 +121695,7 @@ globstar while`, file2, fr10, pattern, pr8, swallowee);
121695
121695
  };
121696
121696
  Object.defineProperty(exports, "__esModule", { value: true });
121697
121697
  var fs42 = __importStar(__require2("fs"));
121698
- var regex2 = {
121698
+ var regex = {
121699
121699
  section: /^\s*\[(([^#;]|\\#|\\;)+)\]\s*([#;].*)?$/,
121700
121700
  param: /^\s*([\w\.\-\_]+)\s*[=:]\s*(.*?)\s*([#;].*)?$/,
121701
121701
  comment: /^\s*[#;].*$/
@@ -121727,14 +121727,14 @@ globstar while`, file2, fr10, pattern, pr8, swallowee);
121727
121727
  var lines = data.split(/\r\n|\r|\n/);
121728
121728
  lines.forEach(function(line3) {
121729
121729
  var match;
121730
- if (regex2.comment.test(line3)) {
121730
+ if (regex.comment.test(line3)) {
121731
121731
  return;
121732
121732
  }
121733
- if (regex2.param.test(line3)) {
121734
- match = line3.match(regex2.param);
121733
+ if (regex.param.test(line3)) {
121734
+ match = line3.match(regex.param);
121735
121735
  sectionBody[match[1]] = match[2];
121736
- } else if (regex2.section.test(line3)) {
121737
- match = line3.match(regex2.section);
121736
+ } else if (regex.section.test(line3)) {
121737
+ match = line3.match(regex.section);
121738
121738
  sectionName = match[1];
121739
121739
  sectionBody = {};
121740
121740
  value.push([sectionName, sectionBody]);
@@ -122820,8 +122820,8 @@ globstar while`, file2, fr10, pattern, pr8, swallowee);
122820
122820
  }
122821
122821
  _make(mode, key2) {
122822
122822
  const str = this.regexPrefix.replace(REGEX_REPLACE_TRAILING_WILDCARD, TRAILING_WILD_CARD_REPLACERS[mode]);
122823
- const regex2 = this.ignoreCase ? new RegExp(str, "i") : new RegExp(str);
122824
- return define2(this, key2, regex2);
122823
+ const regex = this.ignoreCase ? new RegExp(str, "i") : new RegExp(str);
122824
+ return define2(this, key2, regex);
122825
122825
  }
122826
122826
  };
122827
122827
  var createRule = ({
@@ -127617,8 +127617,8 @@ var require_prettier = __commonJS((exports, module) => {
127617
127617
  }
127618
127618
  function makeString2(rawText, enclosingQuote, unescapeUnnecessaryEscapes) {
127619
127619
  const otherQuote = enclosingQuote === '"' ? "'" : '"';
127620
- const regex2 = /\\(.)|(["'])/gsu;
127621
- const raw2 = method_replace_all_default3(0, rawText, regex2, (match, escaped, quote) => {
127620
+ const regex = /\\(.)|(["'])/gsu;
127621
+ const raw2 = method_replace_all_default3(0, rawText, regex, (match, escaped, quote) => {
127622
127622
  if (escaped === otherQuote) {
127623
127623
  return escaped;
127624
127624
  }
@@ -132397,7 +132397,7 @@ var require_url = __commonJS((exports) => {
132397
132397
  exports.fromFileSystemPath = fromFileSystemPath;
132398
132398
  exports.toFileSystemPath = toFileSystemPath;
132399
132399
  exports.safePointerToPath = safePointerToPath;
132400
- exports.relative = relative2;
132400
+ exports.relative = relative4;
132401
132401
  var convert_path_to_posix_1 = __importDefault(require_convert_path_to_posix());
132402
132402
  var path_1 = __importStar(__require("path"));
132403
132403
  var forwardSlashPattern = /\//g;
@@ -132547,7 +132547,7 @@ var require_url = __commonJS((exports) => {
132547
132547
  return decodeURIComponent(value).replace(jsonPointerSlash, "/").replace(jsonPointerTilde, "~");
132548
132548
  });
132549
132549
  }
132550
- function relative2(from, to5) {
132550
+ function relative4(from, to5) {
132551
132551
  if (!isFileSystemPath(from) || !isFileSystemPath(to5)) {
132552
132552
  return resolve6(from, to5);
132553
132553
  }
@@ -138614,7 +138614,7 @@ var require_depd = __commonJS((exports, module) => {
138614
138614
  * Copyright(c) 2014-2018 Douglas Christopher Wilson
138615
138615
  * MIT Licensed
138616
138616
  */
138617
- var relative2 = __require("path").relative;
138617
+ var relative4 = __require("path").relative;
138618
138618
  module.exports = depd;
138619
138619
  var basePath = process.cwd();
138620
138620
  function containsNamespace(str, namespace) {
@@ -138810,7 +138810,7 @@ var require_depd = __commonJS((exports, module) => {
138810
138810
  return formatted;
138811
138811
  }
138812
138812
  function formatLocation(callSite) {
138813
- return relative2(basePath, callSite[0]) + ":" + callSite[1] + ":" + callSite[2];
138813
+ return relative4(basePath, callSite[0]) + ":" + callSite[1] + ":" + callSite[2];
138814
138814
  }
138815
138815
  function getStack() {
138816
138816
  var limit = Error.stackTraceLimit;
@@ -156272,7 +156272,7 @@ var require_view = __commonJS((exports, module) => {
156272
156272
  var debug = require_src4()("express:view");
156273
156273
  var path18 = __require("node:path");
156274
156274
  var fs28 = __require("node:fs");
156275
- var dirname11 = path18.dirname;
156275
+ var dirname12 = path18.dirname;
156276
156276
  var basename4 = path18.basename;
156277
156277
  var extname2 = path18.extname;
156278
156278
  var join15 = path18.join;
@@ -156311,7 +156311,7 @@ var require_view = __commonJS((exports, module) => {
156311
156311
  for (var i5 = 0;i5 < roots.length && !path19; i5++) {
156312
156312
  var root2 = roots[i5];
156313
156313
  var loc = resolve6(root2, name2);
156314
- var dir = dirname11(loc);
156314
+ var dir = dirname12(loc);
156315
156315
  var file2 = basename4(loc);
156316
156316
  path19 = this.resolve(dir, file2);
156317
156317
  }
@@ -156661,12 +156661,12 @@ var require_ipaddr = __commonJS((exports, module) => {
156661
156661
  return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/, "::");
156662
156662
  };
156663
156663
  IPv6.prototype.toRFC5952String = function() {
156664
- var bestMatchIndex, bestMatchLength, match, regex2, string4;
156665
- regex2 = /((^|:)(0(:|$)){2,})/g;
156664
+ var bestMatchIndex, bestMatchLength, match, regex, string4;
156665
+ regex = /((^|:)(0(:|$)){2,})/g;
156666
156666
  string4 = this.toNormalizedString();
156667
156667
  bestMatchIndex = 0;
156668
156668
  bestMatchLength = -1;
156669
- while (match = regex2.exec(string4)) {
156669
+ while (match = regex.exec(string4)) {
156670
156670
  if (match[0].length > bestMatchLength) {
156671
156671
  bestMatchIndex = match.index;
156672
156672
  bestMatchLength = match[0].length;
@@ -161958,8 +161958,8 @@ var require_follow_redirects = __commonJS((exports, module) => {
161958
161958
  }
161959
161959
  return parsed;
161960
161960
  }
161961
- function resolveUrl(relative2, base) {
161962
- return useNativeURL ? new URL2(relative2, base) : parseUrl(url3.resolve(base, relative2));
161961
+ function resolveUrl(relative4, base) {
161962
+ return useNativeURL ? new URL2(relative4, base) : parseUrl(url3.resolve(base, relative4));
161963
161963
  }
161964
161964
  function validateUrl(input) {
161965
161965
  if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) {
@@ -161984,10 +161984,10 @@ var require_follow_redirects = __commonJS((exports, module) => {
161984
161984
  spread.path = spread.search ? spread.pathname + spread.search : spread.pathname;
161985
161985
  return spread;
161986
161986
  }
161987
- function removeMatchingHeaders(regex2, headers) {
161987
+ function removeMatchingHeaders(regex, headers) {
161988
161988
  var lastValue;
161989
161989
  for (var header2 in headers) {
161990
- if (regex2.test(header2)) {
161990
+ if (regex.test(header2)) {
161991
161991
  lastValue = headers[header2];
161992
161992
  delete headers[header2];
161993
161993
  }
@@ -193547,9 +193547,9 @@ var require_dist4 = __commonJS((exports, module) => {
193547
193547
  name2 = "/" + name2;
193548
193548
  let nsp = this._nsps.get(name2);
193549
193549
  if (!nsp) {
193550
- for (const [regex2, parentNamespace] of this.parentNamespacesFromRegExp) {
193551
- if (regex2.test(name2)) {
193552
- debug("attaching namespace %s to parent namespace %s", name2, regex2);
193550
+ for (const [regex, parentNamespace] of this.parentNamespacesFromRegExp) {
193551
+ if (regex.test(name2)) {
193552
+ debug("attaching namespace %s to parent namespace %s", name2, regex);
193553
193553
  return parentNamespace.createChild(name2);
193554
193554
  }
193555
193555
  }
@@ -210671,7 +210671,7 @@ var {
210671
210671
  } = import__.default;
210672
210672
 
210673
210673
  // src/cli/commands/agents/pull.ts
210674
- import { dirname as dirname7, join as join9 } from "node:path";
210674
+ import { dirname as dirname8, join as join9 } from "node:path";
210675
210675
 
210676
210676
  // node_modules/@clack/core/dist/index.mjs
210677
210677
  var import_picocolors = __toESM(require_picocolors(), 1);
@@ -226141,7 +226141,9 @@ import { fileURLToPath } from "node:url";
226141
226141
  var PROJECT_SUBDIR = "base44";
226142
226142
  var CONFIG_FILE_EXTENSION = "jsonc";
226143
226143
  var CONFIG_FILE_EXTENSION_GLOB = "{json,jsonc}";
226144
- var FUNCTION_CONFIG_FILE = `function.${CONFIG_FILE_EXTENSION_GLOB}`;
226144
+ var FUNCTION_CONFIG_GLOB = `**/function.${CONFIG_FILE_EXTENSION_GLOB}`;
226145
+ var ENTRY_FILE_GLOB = "**/entry.{js,ts}";
226146
+ var ENTRY_IGNORE_DOT_PATHS = ["**/*.*/**"];
226145
226147
  var APP_CONFIG_PATTERN = `**/.app.${CONFIG_FILE_EXTENSION_GLOB}`;
226146
226148
  var PROJECT_CONFIG_PATTERNS = [
226147
226149
  `${PROJECT_SUBDIR}/config.${CONFIG_FILE_EXTENSION_GLOB}`,
@@ -233170,7 +233172,7 @@ var generateGlobTasks = normalizeArguments(generateTasks);
233170
233172
  var generateGlobTasksSync = normalizeArgumentsSync(generateTasksSync);
233171
233173
 
233172
233174
  // src/core/project/config.ts
233173
- import { dirname as dirname5, join as join6 } from "node:path";
233175
+ import { dirname as dirname6, join as join6 } from "node:path";
233174
233176
 
233175
233177
  // src/core/resources/agent/schema.ts
233176
233178
  var EntityOperationSchema = exports_external.enum(["create", "update", "delete", "read"]);
@@ -233473,6 +233475,39 @@ var RemoveConnectorResponseSchema = exports_external.object({
233473
233475
  status: data.status,
233474
233476
  integrationType: data.integration_type
233475
233477
  }));
233478
+ var ConnectionConfigFieldSchema = exports_external.object({
233479
+ name: exports_external.string(),
233480
+ display_name: exports_external.string(),
233481
+ description: exports_external.string(),
233482
+ placeholder: exports_external.string(),
233483
+ required: exports_external.boolean(),
233484
+ validation_pattern: exports_external.string().nullable().optional(),
233485
+ validation_error: exports_external.string().nullable().optional()
233486
+ });
233487
+ var AvailableIntegrationSchema = exports_external.object({
233488
+ integration_type: exports_external.string().min(1),
233489
+ display_name: exports_external.string(),
233490
+ description: exports_external.string(),
233491
+ connection_config_fields: exports_external.array(ConnectionConfigFieldSchema)
233492
+ });
233493
+ var ListAvailableIntegrationsResponseSchema = exports_external.object({
233494
+ integrations: exports_external.array(AvailableIntegrationSchema)
233495
+ }).transform((data) => ({
233496
+ integrations: data.integrations.map((i) => ({
233497
+ integrationType: i.integration_type,
233498
+ displayName: i.display_name,
233499
+ description: i.description,
233500
+ connectionConfigFields: i.connection_config_fields.map((f) => ({
233501
+ name: f.name,
233502
+ displayName: f.display_name,
233503
+ description: f.description,
233504
+ placeholder: f.placeholder,
233505
+ required: f.required,
233506
+ validationPattern: f.validation_pattern,
233507
+ validationError: f.validation_error
233508
+ }))
233509
+ }))
233510
+ }));
233476
233511
 
233477
233512
  // src/core/resources/connector/api.ts
233478
233513
  async function listConnectors() {
@@ -233526,6 +233561,20 @@ async function getOAuthStatus(integrationType, connectionId) {
233526
233561
  }
233527
233562
  return result.data;
233528
233563
  }
233564
+ async function listAvailableIntegrations() {
233565
+ const appClient = getAppClient();
233566
+ let response;
233567
+ try {
233568
+ response = await appClient.get("external-auth/available-integrations");
233569
+ } catch (error48) {
233570
+ throw await ApiError.fromHttpError(error48, "listing available integrations");
233571
+ }
233572
+ const result = ListAvailableIntegrationsResponseSchema.safeParse(await response.json());
233573
+ if (!result.success) {
233574
+ throw new SchemaValidationError("Invalid response from server", result.error);
233575
+ }
233576
+ return result.data;
233577
+ }
233529
233578
  async function removeConnector(integrationType) {
233530
233579
  const appClient = getAppClient();
233531
233580
  let response;
@@ -233980,7 +234029,7 @@ async function fetchFunctionLogs(functionName, filters = {}) {
233980
234029
  return result.data;
233981
234030
  }
233982
234031
  // src/core/resources/function/config.ts
233983
- import { dirname as dirname4, join as join5 } from "node:path";
234032
+ import { basename as basename2, dirname as dirname4, join as join5, relative } from "node:path";
233984
234033
  async function readFunctionConfig(configPath) {
233985
234034
  const parsed = await readJsonFile(configPath);
233986
234035
  const result = FunctionConfigSchema.safeParse(parsed);
@@ -233998,7 +234047,7 @@ async function readFunction(configPath) {
233998
234047
  hints: [{ message: "Check the 'entry' field in your function config" }]
233999
234048
  });
234000
234049
  }
234001
- const filePaths = await globby("*.{js,ts,json}", {
234050
+ const filePaths = await globby("**/*.{js,ts,json}", {
234002
234051
  cwd: functionDir,
234003
234052
  absolute: true
234004
234053
  });
@@ -234009,26 +234058,61 @@ async function readAllFunctions(functionsDir) {
234009
234058
  if (!await pathExists(functionsDir)) {
234010
234059
  return [];
234011
234060
  }
234012
- const configFiles = await globby(`*/${FUNCTION_CONFIG_FILE}`, {
234061
+ const configFiles = await globby(FUNCTION_CONFIG_GLOB, {
234013
234062
  cwd: functionsDir,
234014
234063
  absolute: true
234015
234064
  });
234016
- const functions = await Promise.all(configFiles.map((configPath) => readFunction(configPath)));
234065
+ const entryFiles = await globby(ENTRY_FILE_GLOB, {
234066
+ cwd: functionsDir,
234067
+ absolute: true,
234068
+ ignore: ENTRY_IGNORE_DOT_PATHS
234069
+ });
234070
+ const configFilesDirs = new Set(configFiles.map((f) => dirname4(f)));
234071
+ const entryFilesWithoutConfig = entryFiles.filter((entryFile) => !configFilesDirs.has(dirname4(entryFile)));
234072
+ const functionsFromConfig = await Promise.all(configFiles.map((configPath) => readFunction(configPath)));
234073
+ const functionsWithoutConfig = await Promise.all(entryFilesWithoutConfig.map(async (entryFile) => {
234074
+ const functionDir = dirname4(entryFile);
234075
+ const filePaths = await globby("**/*.{js,ts,json}", {
234076
+ cwd: functionDir,
234077
+ absolute: true
234078
+ });
234079
+ const name2 = relative(functionsDir, functionDir).split(/[/\\]/).join("/");
234080
+ if (!name2) {
234081
+ throw new InvalidInputError("entry.ts found directly in the functions directory — it must be inside a named subfolder", {
234082
+ hints: [
234083
+ {
234084
+ message: `Move ${entryFile} into a subfolder (e.g. functions/myFunc/entry.ts)`
234085
+ }
234086
+ ]
234087
+ });
234088
+ }
234089
+ const entry = basename2(entryFile);
234090
+ return { name: name2, entry, entryPath: entryFile, filePaths };
234091
+ }));
234092
+ const functions = [...functionsFromConfig, ...functionsWithoutConfig];
234017
234093
  const names = new Set;
234018
234094
  for (const fn of functions) {
234019
234095
  if (names.has(fn.name)) {
234020
- throw new Error(`Duplicate function name "${fn.name}"`);
234096
+ throw new InvalidInputError(`Duplicate function name "${fn.name}"`, {
234097
+ hints: [
234098
+ {
234099
+ message: "Ensure each function has a unique name (or path for zero-config functions)."
234100
+ }
234101
+ ]
234102
+ });
234021
234103
  }
234022
234104
  names.add(fn.name);
234023
234105
  }
234024
234106
  return functions;
234025
234107
  }
234026
234108
  // src/core/resources/function/deploy.ts
234027
- import { basename as basename2 } from "node:path";
234109
+ import { dirname as dirname5, relative as relative2 } from "node:path";
234028
234110
  async function loadFunctionCode(fn) {
234111
+ const functionDir = dirname5(fn.entryPath);
234029
234112
  const loadedFiles = await Promise.all(fn.filePaths.map(async (filePath) => {
234030
234113
  const content = await readTextFile(filePath);
234031
- return { path: basename2(filePath), content };
234114
+ const path11 = relative2(functionDir, filePath).split(/[/\\]/).join("/");
234115
+ return { path: path11, content };
234032
234116
  }));
234033
234117
  return { ...fn, files: loadedFiles };
234034
234118
  }
@@ -234054,12 +234138,12 @@ async function findConfigInDir(dir) {
234054
234138
  }
234055
234139
  async function findProjectRoot(startPath) {
234056
234140
  let current = startPath || process.cwd();
234057
- while (current !== dirname5(current)) {
234141
+ while (current !== dirname6(current)) {
234058
234142
  const configPath = await findConfigInDir(current);
234059
234143
  if (configPath) {
234060
234144
  return { root: current, configPath };
234061
234145
  }
234062
- current = dirname5(current);
234146
+ current = dirname6(current);
234063
234147
  }
234064
234148
  return null;
234065
234149
  }
@@ -234081,7 +234165,7 @@ async function readProjectConfig(projectRoot) {
234081
234165
  throw new SchemaValidationError("Invalid project configuration", result.error, configPath);
234082
234166
  }
234083
234167
  const project = result.data;
234084
- const configDir = dirname5(configPath);
234168
+ const configDir = dirname6(configPath);
234085
234169
  const [entities, functions, agents, connectors] = await Promise.all([
234086
234170
  entityResource.readAll(join6(configDir, project.entitiesDir)),
234087
234171
  functionResource.readAll(join6(configDir, project.functionsDir)),
@@ -234183,7 +234267,7 @@ async function readAppConfig(projectRoot) {
234183
234267
  // src/core/project/template.ts
234184
234268
  var import_ejs = __toESM(require_ejs(), 1);
234185
234269
  var import_front_matter = __toESM(require_front_matter(), 1);
234186
- import { dirname as dirname6, join as join7 } from "node:path";
234270
+ import { dirname as dirname7, join as join7 } from "node:path";
234187
234271
  async function listTemplates() {
234188
234272
  const parsed = await readJsonFile(getTemplatesIndexPath());
234189
234273
  const result = TemplatesConfigSchema.safeParse(parsed);
@@ -234205,7 +234289,7 @@ async function renderTemplate(template, destPath, data) {
234205
234289
  if (file2.endsWith(".ejs")) {
234206
234290
  const rendered = await import_ejs.default.renderFile(srcPath, data);
234207
234291
  const { attributes, body } = import_front_matter.default(rendered);
234208
- const destFile = attributes.outputFileName ? join7(dirname6(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
234292
+ const destFile = attributes.outputFileName ? join7(dirname7(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
234209
234293
  const destFilePath = join7(destPath, destFile);
234210
234294
  await writeFile(destFilePath, body);
234211
234295
  } else {
@@ -234575,7 +234659,8 @@ async function deleteSecret(name2) {
234575
234659
  let response;
234576
234660
  try {
234577
234661
  response = await appClient.delete("secrets", {
234578
- searchParams: { secret_name: name2 }
234662
+ searchParams: { secret_name: name2 },
234663
+ timeout: false
234579
234664
  });
234580
234665
  } catch (error48) {
234581
234666
  throw await ApiError.fromHttpError(error48, "deleting secret");
@@ -235383,24 +235468,6 @@ async function login() {
235383
235468
  };
235384
235469
  }
235385
235470
 
235386
- // node_modules/ansi-regex/index.js
235387
- function ansiRegex({ onlyFirst = false } = {}) {
235388
- const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
235389
- const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
235390
- const csi = "[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";
235391
- const pattern = `${osc}|${csi}`;
235392
- return new RegExp(pattern, onlyFirst ? undefined : "g");
235393
- }
235394
-
235395
- // node_modules/strip-ansi/index.js
235396
- var regex = ansiRegex();
235397
- function stripAnsi(string4) {
235398
- if (typeof string4 !== "string") {
235399
- throw new TypeError(`Expected a \`string\`, got \`${typeof string4}\``);
235400
- }
235401
- return string4.replace(regex, "");
235402
- }
235403
-
235404
235471
  // node_modules/is-plain-obj/index.js
235405
235472
  function isPlainObject2(value) {
235406
235473
  if (typeof value !== "object" || value === null) {
@@ -241899,7 +241966,7 @@ var {
241899
241966
  // package.json
241900
241967
  var package_default = {
241901
241968
  name: "base44",
241902
- version: "0.0.37",
241969
+ version: "0.0.38",
241903
241970
  description: "Base44 CLI - Unified interface for managing Base44 applications",
241904
241971
  type: "module",
241905
241972
  bin: {
@@ -242017,35 +242084,16 @@ async function checkForUpgrade() {
242017
242084
  }
242018
242085
 
242019
242086
  // src/cli/utils/upgradeNotification.ts
242020
- var UPGRADE_COMMAND = "npm install -g base44@latest";
242021
- function formatUpgradeBox(info) {
242087
+ function formatUpgradeMessage(info) {
242022
242088
  const { shinyOrange } = theme.colors;
242023
242089
  const { bold: bold2 } = theme.styles;
242024
- const lines = [
242025
- shinyOrange(`Update available! ${info.currentVersion} → ${bold2(info.latestVersion)}`),
242026
- shinyOrange(`Run: ${bold2(UPGRADE_COMMAND)}`)
242027
- ];
242028
- const maxVisualWidth = Math.max(...lines.map((l) => stripAnsi(l).length));
242029
- const pad = (line) => {
242030
- const visual = stripAnsi(line).length;
242031
- return `${line}${" ".repeat(maxVisualWidth - visual)}`;
242032
- };
242033
- const top = `┌${"─".repeat(maxVisualWidth + 2)}┐`;
242034
- const bottom = `└${"─".repeat(maxVisualWidth + 2)}┘`;
242035
- const body = lines.map((l) => `│ ${pad(l)} │`).join(`
242036
- `);
242037
- return `${top}
242038
- ${body}
242039
- ${bottom}`;
242040
- }
242041
- function startUpgradeCheck() {
242042
- return checkForUpgrade().catch(() => null);
242090
+ return `${shinyOrange("Update available!")} ${shinyOrange(`${info.currentVersion} → ${info.latestVersion}`)} ${shinyOrange("Run:")} ${bold2(shinyOrange("npm install -g base44@latest"))}`;
242043
242091
  }
242044
- async function printUpgradeNotification(upgradeCheckPromise) {
242092
+ async function printUpgradeNotificationIfAvailable() {
242045
242093
  try {
242046
- const upgradeInfo = await upgradeCheckPromise;
242094
+ const upgradeInfo = await checkForUpgrade();
242047
242095
  if (upgradeInfo) {
242048
- R2.warn(formatUpgradeBox(upgradeInfo));
242096
+ R2.message(formatUpgradeMessage(upgradeInfo));
242049
242097
  }
242050
242098
  } catch {}
242051
242099
  }
@@ -242058,7 +242106,7 @@ async function runCommand(commandFn, options, context) {
242058
242106
  } else {
242059
242107
  We(theme.colors.base44OrangeBackground(" Base 44 "));
242060
242108
  }
242061
- const upgradeCheckPromise = startUpgradeCheck();
242109
+ await printUpgradeNotificationIfAvailable();
242062
242110
  try {
242063
242111
  if (options?.requireAuth) {
242064
242112
  const loggedIn = await isLoggedIn();
@@ -242078,14 +242126,12 @@ async function runCommand(commandFn, options, context) {
242078
242126
  context.errorReporter.setContext({ appId: appConfig.id });
242079
242127
  }
242080
242128
  const result = await commandFn();
242081
- await printUpgradeNotification(upgradeCheckPromise);
242082
242129
  Le(result.outroMessage || "");
242083
242130
  if (result.stdout) {
242084
242131
  process.stdout.write(result.stdout);
242085
242132
  }
242086
242133
  } catch (error48) {
242087
242134
  displayError(error48);
242088
- await printUpgradeNotification(upgradeCheckPromise);
242089
242135
  const errorContext = context.errorReporter.getErrorContext();
242090
242136
  Le(theme.format.errorContext(errorContext));
242091
242137
  throw error48;
@@ -242129,7 +242175,7 @@ function getDashboardUrl(projectId) {
242129
242175
  // src/cli/commands/agents/pull.ts
242130
242176
  async function pullAgentsAction() {
242131
242177
  const { project: project2 } = await readProjectConfig();
242132
- const configDir = dirname7(project2.configPath);
242178
+ const configDir = dirname8(project2.configPath);
242133
242179
  const agentsDir = join9(configDir, project2.agentsDir);
242134
242180
  const remoteAgents = await runTask("Fetching agents from Base44", async () => {
242135
242181
  return await fetchAgents();
@@ -242223,11 +242269,34 @@ function getWhoamiCommand(context) {
242223
242269
  });
242224
242270
  }
242225
242271
 
242272
+ // src/cli/commands/connectors/list-available.ts
242273
+ async function listAvailableAction() {
242274
+ const { integrations } = await runTask("Fetching available integrations from Base44", async () => {
242275
+ return await listAvailableIntegrations();
242276
+ }, {
242277
+ successMessage: "Available integrations fetched successfully",
242278
+ errorMessage: "Failed to fetch available integrations"
242279
+ });
242280
+ if (integrations.length === 0) {
242281
+ return { outroMessage: "No available integrations found." };
242282
+ }
242283
+ return {
242284
+ outroMessage: `Found ${integrations.length} available integrations.`,
242285
+ stdout: `${JSON.stringify(integrations, null, 2)}
242286
+ `
242287
+ };
242288
+ }
242289
+ function getConnectorsListAvailableCommand(context) {
242290
+ return new Command("list-available").description("List all available integration types").action(async () => {
242291
+ await runCommand(listAvailableAction, { requireAuth: true }, context);
242292
+ });
242293
+ }
242294
+
242226
242295
  // src/cli/commands/connectors/pull.ts
242227
- import { dirname as dirname8, join as join10 } from "node:path";
242296
+ import { dirname as dirname9, join as join10 } from "node:path";
242228
242297
  async function pullConnectorsAction() {
242229
242298
  const { project: project2 } = await readProjectConfig();
242230
- const configDir = dirname8(project2.configPath);
242299
+ const configDir = dirname9(project2.configPath);
242231
242300
  const connectorsDir = join10(configDir, project2.connectorsDir);
242232
242301
  const remoteConnectors = await runTask("Fetching connectors from Base44", async () => {
242233
242302
  return await listConnectors();
@@ -243023,7 +243092,7 @@ function getConnectorsPushCommand(context) {
243023
243092
 
243024
243093
  // src/cli/commands/connectors/index.ts
243025
243094
  function getConnectorsCommand(context) {
243026
- return new Command("connectors").description("Manage project connectors (OAuth integrations)").addCommand(getConnectorsPullCommand(context)).addCommand(getConnectorsPushCommand(context));
243095
+ return new Command("connectors").description("Manage project connectors (OAuth integrations)").addCommand(getConnectorsListAvailableCommand(context)).addCommand(getConnectorsPullCommand(context)).addCommand(getConnectorsPushCommand(context));
243027
243096
  }
243028
243097
 
243029
243098
  // src/cli/commands/dashboard/open.ts
@@ -243923,7 +243992,7 @@ function getTypesCommand(context) {
243923
243992
  }
243924
243993
 
243925
243994
  // src/cli/dev/dev-server/main.ts
243926
- import { dirname as dirname14, join as join18 } from "node:path";
243995
+ import { dirname as dirname15, join as join18 } from "node:path";
243927
243996
  var import_cors = __toESM(require_lib4(), 1);
243928
243997
  var import_express4 = __toESM(require_express(), 1);
243929
243998
 
@@ -244082,9 +244151,9 @@ function createDevLogger() {
244082
244151
 
244083
244152
  // src/cli/dev/dev-server/function-manager.ts
244084
244153
  import { spawn as spawn2, spawnSync as spawnSync2 } from "node:child_process";
244085
- import { dirname as dirname11, join as join15 } from "node:path";
244154
+ import { dirname as dirname12, join as join15 } from "node:path";
244086
244155
  import { fileURLToPath as fileURLToPath7 } from "node:url";
244087
- var __dirname5 = dirname11(fileURLToPath7(import.meta.url));
244156
+ var __dirname5 = dirname12(fileURLToPath7(import.meta.url));
244088
244157
  var WRAPPER_PATH = join15(__dirname5, "../deno-runtime/main.js");
244089
244158
  var READY_TIMEOUT = 30000;
244090
244159
 
@@ -244286,9 +244355,8 @@ function createFunctionRouter(manager, logger) {
244286
244355
  var import_nedb = __toESM(require_nedb(), 1);
244287
244356
 
244288
244357
  class Database {
244289
- collections;
244290
- constructor(entities) {
244291
- this.collections = new Map;
244358
+ collections = new Map;
244359
+ load(entities) {
244292
244360
  for (const entity2 of entities) {
244293
244361
  this.collections.set(entity2.name, new import_nedb.default);
244294
244362
  }
@@ -244299,6 +244367,12 @@ class Database {
244299
244367
  getCollectionNames() {
244300
244368
  return Array.from(this.collections.keys());
244301
244369
  }
244370
+ dropAll() {
244371
+ for (const collection of this.collections.values()) {
244372
+ collection.remove({}, { multi: true });
244373
+ }
244374
+ this.collections.clear();
244375
+ }
244302
244376
  }
244303
244377
 
244304
244378
  // node_modules/socket.io/wrapper.mjs
@@ -244654,7 +244728,7 @@ function createCustomIntegrationRoutes(remoteProxy, logger) {
244654
244728
 
244655
244729
  // src/cli/dev/dev-server/watcher.ts
244656
244730
  import { EventEmitter as EventEmitter4 } from "node:events";
244657
- import { relative as relative4 } from "node:path";
244731
+ import { relative as relative6 } from "node:path";
244658
244732
 
244659
244733
  // node_modules/chokidar/index.js
244660
244734
  import { EventEmitter as EventEmitter3 } from "node:events";
@@ -245384,9 +245458,9 @@ class NodeFsHandler {
245384
245458
  if (this.fsw.closed) {
245385
245459
  return;
245386
245460
  }
245387
- const dirname13 = sp2.dirname(file2);
245461
+ const dirname14 = sp2.dirname(file2);
245388
245462
  const basename5 = sp2.basename(file2);
245389
- const parent = this.fsw._getWatchedDir(dirname13);
245463
+ const parent = this.fsw._getWatchedDir(dirname14);
245390
245464
  let prevStats = stats;
245391
245465
  if (parent.has(basename5))
245392
245466
  return;
@@ -245413,7 +245487,7 @@ class NodeFsHandler {
245413
245487
  prevStats = newStats2;
245414
245488
  }
245415
245489
  } catch (error48) {
245416
- this.fsw._remove(dirname13, basename5);
245490
+ this.fsw._remove(dirname14, basename5);
245417
245491
  }
245418
245492
  } else if (parent.has(basename5)) {
245419
245493
  const at13 = newStats.atimeMs;
@@ -245636,11 +245710,11 @@ function createPattern(matcher) {
245636
245710
  if (matcher.path === string4)
245637
245711
  return true;
245638
245712
  if (matcher.recursive) {
245639
- const relative4 = sp3.relative(matcher.path, string4);
245640
- if (!relative4) {
245713
+ const relative6 = sp3.relative(matcher.path, string4);
245714
+ if (!relative6) {
245641
245715
  return false;
245642
245716
  }
245643
- return !relative4.startsWith("..") && !sp3.isAbsolute(relative4);
245717
+ return !relative6.startsWith("..") && !sp3.isAbsolute(relative6);
245644
245718
  }
245645
245719
  return false;
245646
245720
  };
@@ -246275,79 +246349,74 @@ var WATCH_QUEUE_DELAY_MS = 500;
246275
246349
  class WatchBase44 extends EventEmitter4 {
246276
246350
  itemsToWatch;
246277
246351
  logger;
246278
- watchers = [];
246279
- queueWaitForCreation = [];
246352
+ entryNames;
246353
+ watchers = new Map;
246280
246354
  queueWaitForCreationTimeout = null;
246281
246355
  constructor(itemsToWatch, logger) {
246282
246356
  super();
246283
246357
  this.itemsToWatch = itemsToWatch;
246284
246358
  this.logger = logger;
246359
+ this.entryNames = Object.keys(itemsToWatch);
246285
246360
  }
246286
246361
  async start() {
246287
- if (this.watchers.length > 0 || this.queueWaitForCreation.length > 0) {
246362
+ if (this.watchers.size > 0) {
246288
246363
  return;
246289
246364
  }
246290
- for (const item of this.itemsToWatch) {
246291
- if (await pathExists(item.path)) {
246292
- this.watchers.push(this.watchTarget(item));
246293
- } else {
246294
- this.queueWaitForCreation.push(item);
246365
+ for (const name2 of this.entryNames) {
246366
+ const targetPath = this.itemsToWatch[name2];
246367
+ if (await pathExists(targetPath)) {
246368
+ this.watchers.set(name2, this.watchTarget(name2, targetPath));
246295
246369
  }
246296
246370
  }
246297
- this.watchCreationQueue();
246371
+ this.watchEntries();
246298
246372
  }
246299
246373
  async close() {
246300
246374
  if (this.queueWaitForCreationTimeout) {
246301
246375
  clearTimeout(this.queueWaitForCreationTimeout);
246302
246376
  this.queueWaitForCreationTimeout = null;
246303
246377
  }
246304
- for (const watcher of this.watchers) {
246378
+ for (const watcher of this.watchers.values()) {
246305
246379
  await watcher.close();
246306
246380
  }
246307
- this.watchers = [];
246308
- this.queueWaitForCreation = [];
246381
+ this.watchers.clear();
246309
246382
  }
246310
- watchCreationQueue() {
246383
+ watchEntries() {
246311
246384
  if (this.queueWaitForCreationTimeout) {
246312
246385
  clearTimeout(this.queueWaitForCreationTimeout);
246313
246386
  }
246314
246387
  this.queueWaitForCreationTimeout = setTimeout(async () => {
246315
- const toRemove = [];
246316
- for (const entry of this.queueWaitForCreation) {
246317
- if (await pathExists(entry.path)) {
246318
- this.watchers.push(this.watchTarget(entry));
246319
- toRemove.push(entry);
246388
+ for (const name2 of this.entryNames) {
246389
+ const path19 = this.itemsToWatch[name2];
246390
+ const watchItem = this.watchers.get(name2);
246391
+ const exists = await pathExists(path19);
246392
+ if (!watchItem && exists) {
246393
+ this.emit("change", name2, path19);
246394
+ this.watchers.set(name2, this.watchTarget(name2, path19));
246395
+ } else if (watchItem && !exists) {
246396
+ await watchItem.close();
246397
+ this.emit("change", name2, path19);
246398
+ setTimeout(() => {
246399
+ this.watchers.forEach((watcher, watcherName) => {
246400
+ if (watcher.closed) {
246401
+ this.watchers.delete(watcherName);
246402
+ }
246403
+ });
246404
+ });
246320
246405
  }
246321
246406
  }
246322
- this.queueWaitForCreation = this.queueWaitForCreation.filter((entry) => !toRemove.includes(entry));
246323
- if (this.queueWaitForCreation.length > 0) {
246324
- this.watchCreationQueue();
246325
- } else {
246326
- this.queueWaitForCreationTimeout = null;
246327
- }
246407
+ this.queueWaitForCreationTimeout = null;
246408
+ this.watchEntries();
246328
246409
  }, WATCH_QUEUE_DELAY_MS);
246329
246410
  }
246330
- watchTarget(item) {
246331
- const handler = import_debounce.default(async (_event, path19) => {
246332
- this.emit("change", item.name, relative4(item.path, path19));
246333
- }, WATCH_DEBOUNCE_MS);
246334
- const watcher = watch(item.path, {
246411
+ watchTarget(name2, targetPath) {
246412
+ const watcher = watch(targetPath, {
246335
246413
  ignoreInitial: true
246336
246414
  });
246337
- watcher.on("all", handler);
246338
- watcher.on("unlinkDir", async (deletedPath) => {
246339
- if (deletedPath !== item.path) {
246340
- return;
246341
- }
246342
- await watcher.close();
246343
- this.queueWaitForCreation.push(item);
246344
- this.watchCreationQueue();
246345
- setTimeout(() => {
246346
- this.watchers = this.watchers.filter((watcher2) => !watcher2.closed);
246347
- });
246348
- });
246415
+ watcher.on("all", import_debounce.default(async (_event, path19) => {
246416
+ this.emit("change", name2, relative6(targetPath, path19));
246417
+ }, WATCH_DEBOUNCE_MS));
246349
246418
  watcher.on("error", (err) => {
246350
- this.logger.error(`Watch handler failed for ${item.path}`, err instanceof Error ? err : undefined);
246419
+ this.logger.error(`Watch handler failed for ${targetPath}`, err instanceof Error ? err : undefined);
246351
246420
  });
246352
246421
  return watcher;
246353
246422
  }
@@ -246385,7 +246454,8 @@ async function createDevServer(options8) {
246385
246454
  if (functionManager.getFunctionNames().length > 0) {
246386
246455
  R2.info(`Loaded functions: ${functionManager.getFunctionNames().join(", ")}`);
246387
246456
  }
246388
- const db2 = new Database(entities);
246457
+ const db2 = new Database;
246458
+ db2.load(entities);
246389
246459
  if (db2.getCollectionNames().length > 0) {
246390
246460
  R2.info(`Loaded entities: ${db2.getCollectionNames().join(", ")}`);
246391
246461
  }
@@ -246419,16 +246489,14 @@ async function createDevServer(options8) {
246419
246489
  emitEntityEvent = (appId, entityName, event) => {
246420
246490
  broadcastEntityEvent(io6, appId, entityName, event);
246421
246491
  };
246422
- const base44ConfigWatcher = new WatchBase44([
246423
- {
246424
- name: "functions",
246425
- path: join18(dirname14(project2.configPath), project2.functionsDir)
246426
- }
246427
- ], devLogger);
246492
+ const base44ConfigWatcher = new WatchBase44({
246493
+ functions: join18(dirname15(project2.configPath), project2.functionsDir),
246494
+ entities: join18(dirname15(project2.configPath), project2.entitiesDir)
246495
+ }, devLogger);
246428
246496
  base44ConfigWatcher.on("change", async (name2) => {
246429
246497
  try {
246498
+ const { functions: functions2, entities: entities2 } = await options8.loadResources();
246430
246499
  if (name2 === "functions") {
246431
- const { functions: functions2 } = await options8.loadResources();
246432
246500
  const previousFunctionCount = functionManager.getFunctionNames().length;
246433
246501
  functionManager.reload(functions2);
246434
246502
  const names = functionManager.getFunctionNames();
@@ -246438,6 +246506,17 @@ async function createDevServer(options8) {
246438
246506
  devLogger.log("All functions removed");
246439
246507
  }
246440
246508
  }
246509
+ if (name2 === "entities") {
246510
+ const previousEntityCount = db2.getCollectionNames().length;
246511
+ db2.dropAll();
246512
+ if (previousEntityCount > 0) {
246513
+ devLogger.log("Entities directory changed, clearing data...");
246514
+ }
246515
+ db2.load(entities2);
246516
+ if (db2.getCollectionNames().length > 0) {
246517
+ devLogger.log(`Loaded entities: ${db2.getCollectionNames().join(", ")}`);
246518
+ }
246519
+ }
246441
246520
  } catch (error48) {
246442
246521
  const errorMessage = error48 instanceof Error ? error48.message : String(error48);
246443
246522
  devLogger.error(errorMessage);
@@ -246601,7 +246680,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
246601
246680
  import { release, type } from "node:os";
246602
246681
 
246603
246682
  // node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
246604
- import { dirname as dirname15, posix, sep } from "path";
246683
+ import { dirname as dirname16, posix, sep } from "path";
246605
246684
  function createModulerModifier() {
246606
246685
  const getModuleFromFileName = createGetModuleFromFilename();
246607
246686
  return async (frames) => {
@@ -246610,7 +246689,7 @@ function createModulerModifier() {
246610
246689
  return frames;
246611
246690
  };
246612
246691
  }
246613
- function createGetModuleFromFilename(basePath = process.argv[1] ? dirname15(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
246692
+ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname16(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
246614
246693
  const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
246615
246694
  return (filename) => {
246616
246695
  if (!filename)
@@ -249814,9 +249893,9 @@ function matchPropertyGroup(propertyGroup, propertyValues, cohortProperties, deb
249814
249893
  throw new InconclusiveMatchError("can't match cohort without a given cohort property value");
249815
249894
  return propertyGroupType === "AND";
249816
249895
  }
249817
- function isValidRegex(regex2) {
249896
+ function isValidRegex(regex) {
249818
249897
  try {
249819
- new RegExp(regex2);
249898
+ new RegExp(regex);
249820
249899
  return true;
249821
249900
  } catch (err) {
249822
249901
  return false;
@@ -249834,8 +249913,8 @@ function convertToDateTime(value) {
249834
249913
  throw new InconclusiveMatchError(`The date provided ${value} must be a string, number, or date object`);
249835
249914
  }
249836
249915
  function relativeDateParseForFeatureFlagMatching(value) {
249837
- const regex2 = /^-?(?<number>[0-9]+)(?<interval>[a-z])$/;
249838
- const match = value.match(regex2);
249916
+ const regex = /^-?(?<number>[0-9]+)(?<interval>[a-z])$/;
249917
+ const match = value.match(regex);
249839
249918
  const parsedDt = new Date(new Date().toISOString());
249840
249919
  if (!match)
249841
249920
  return null;
@@ -250828,4 +250907,4 @@ export {
250828
250907
  CLIExitError
250829
250908
  };
250830
250909
 
250831
- //# debugId=BFC56E0BF807E18264756E2164756E21
250910
+ //# debugId=A0D3BBBE64FDF64264756E2164756E21