@base44-preview/cli 0.0.37-pr.365.600b1d5 → 0.0.38-pr.367.aedb65a

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,43 @@ 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
+ notes: exports_external.string().nullable(),
233492
+ usage_guide: exports_external.string().nullable(),
233493
+ connection_config_fields: exports_external.array(ConnectionConfigFieldSchema)
233494
+ });
233495
+ var ListAvailableIntegrationsResponseSchema = exports_external.object({
233496
+ available_integrations: exports_external.array(AvailableIntegrationSchema)
233497
+ }).transform((data) => ({
233498
+ availableIntegrations: data.available_integrations.map((i) => ({
233499
+ integrationType: i.integration_type,
233500
+ displayName: i.display_name,
233501
+ description: i.description,
233502
+ notes: i.notes,
233503
+ usageGuide: i.usage_guide,
233504
+ connectionConfigFields: i.connection_config_fields.map((f) => ({
233505
+ name: f.name,
233506
+ displayName: f.display_name,
233507
+ description: f.description,
233508
+ placeholder: f.placeholder,
233509
+ required: f.required,
233510
+ validationPattern: f.validation_pattern,
233511
+ validationError: f.validation_error
233512
+ }))
233513
+ }))
233514
+ }));
233476
233515
 
233477
233516
  // src/core/resources/connector/api.ts
233478
233517
  async function listConnectors() {
@@ -233526,6 +233565,20 @@ async function getOAuthStatus(integrationType, connectionId) {
233526
233565
  }
233527
233566
  return result.data;
233528
233567
  }
233568
+ async function listAvailableIntegrations() {
233569
+ const appClient = getAppClient();
233570
+ let response;
233571
+ try {
233572
+ response = await appClient.get("external-auth/available-integrations");
233573
+ } catch (error48) {
233574
+ throw await ApiError.fromHttpError(error48, "listing available integrations");
233575
+ }
233576
+ const result = ListAvailableIntegrationsResponseSchema.safeParse(await response.json());
233577
+ if (!result.success) {
233578
+ throw new SchemaValidationError("Invalid response from server", result.error);
233579
+ }
233580
+ return result.data;
233581
+ }
233529
233582
  async function removeConnector(integrationType) {
233530
233583
  const appClient = getAppClient();
233531
233584
  let response;
@@ -233980,7 +234033,7 @@ async function fetchFunctionLogs(functionName, filters = {}) {
233980
234033
  return result.data;
233981
234034
  }
233982
234035
  // src/core/resources/function/config.ts
233983
- import { dirname as dirname4, join as join5 } from "node:path";
234036
+ import { basename as basename2, dirname as dirname4, join as join5, relative } from "node:path";
233984
234037
  async function readFunctionConfig(configPath) {
233985
234038
  const parsed = await readJsonFile(configPath);
233986
234039
  const result = FunctionConfigSchema.safeParse(parsed);
@@ -233998,7 +234051,7 @@ async function readFunction(configPath) {
233998
234051
  hints: [{ message: "Check the 'entry' field in your function config" }]
233999
234052
  });
234000
234053
  }
234001
- const filePaths = await globby("*.{js,ts,json}", {
234054
+ const filePaths = await globby("**/*.{js,ts,json}", {
234002
234055
  cwd: functionDir,
234003
234056
  absolute: true
234004
234057
  });
@@ -234009,26 +234062,61 @@ async function readAllFunctions(functionsDir) {
234009
234062
  if (!await pathExists(functionsDir)) {
234010
234063
  return [];
234011
234064
  }
234012
- const configFiles = await globby(`*/${FUNCTION_CONFIG_FILE}`, {
234065
+ const configFiles = await globby(FUNCTION_CONFIG_GLOB, {
234013
234066
  cwd: functionsDir,
234014
234067
  absolute: true
234015
234068
  });
234016
- const functions = await Promise.all(configFiles.map((configPath) => readFunction(configPath)));
234069
+ const entryFiles = await globby(ENTRY_FILE_GLOB, {
234070
+ cwd: functionsDir,
234071
+ absolute: true,
234072
+ ignore: ENTRY_IGNORE_DOT_PATHS
234073
+ });
234074
+ const configFilesDirs = new Set(configFiles.map((f) => dirname4(f)));
234075
+ const entryFilesWithoutConfig = entryFiles.filter((entryFile) => !configFilesDirs.has(dirname4(entryFile)));
234076
+ const functionsFromConfig = await Promise.all(configFiles.map((configPath) => readFunction(configPath)));
234077
+ const functionsWithoutConfig = await Promise.all(entryFilesWithoutConfig.map(async (entryFile) => {
234078
+ const functionDir = dirname4(entryFile);
234079
+ const filePaths = await globby("**/*.{js,ts,json}", {
234080
+ cwd: functionDir,
234081
+ absolute: true
234082
+ });
234083
+ const name2 = relative(functionsDir, functionDir).split(/[/\\]/).join("/");
234084
+ if (!name2) {
234085
+ throw new InvalidInputError("entry.ts found directly in the functions directory — it must be inside a named subfolder", {
234086
+ hints: [
234087
+ {
234088
+ message: `Move ${entryFile} into a subfolder (e.g. functions/myFunc/entry.ts)`
234089
+ }
234090
+ ]
234091
+ });
234092
+ }
234093
+ const entry = basename2(entryFile);
234094
+ return { name: name2, entry, entryPath: entryFile, filePaths };
234095
+ }));
234096
+ const functions = [...functionsFromConfig, ...functionsWithoutConfig];
234017
234097
  const names = new Set;
234018
234098
  for (const fn of functions) {
234019
234099
  if (names.has(fn.name)) {
234020
- throw new Error(`Duplicate function name "${fn.name}"`);
234100
+ throw new InvalidInputError(`Duplicate function name "${fn.name}"`, {
234101
+ hints: [
234102
+ {
234103
+ message: "Ensure each function has a unique name (or path for zero-config functions)."
234104
+ }
234105
+ ]
234106
+ });
234021
234107
  }
234022
234108
  names.add(fn.name);
234023
234109
  }
234024
234110
  return functions;
234025
234111
  }
234026
234112
  // src/core/resources/function/deploy.ts
234027
- import { basename as basename2 } from "node:path";
234113
+ import { dirname as dirname5, relative as relative2 } from "node:path";
234028
234114
  async function loadFunctionCode(fn) {
234115
+ const functionDir = dirname5(fn.entryPath);
234029
234116
  const loadedFiles = await Promise.all(fn.filePaths.map(async (filePath) => {
234030
234117
  const content = await readTextFile(filePath);
234031
- return { path: basename2(filePath), content };
234118
+ const path11 = relative2(functionDir, filePath).split(/[/\\]/).join("/");
234119
+ return { path: path11, content };
234032
234120
  }));
234033
234121
  return { ...fn, files: loadedFiles };
234034
234122
  }
@@ -234054,12 +234142,12 @@ async function findConfigInDir(dir) {
234054
234142
  }
234055
234143
  async function findProjectRoot(startPath) {
234056
234144
  let current = startPath || process.cwd();
234057
- while (current !== dirname5(current)) {
234145
+ while (current !== dirname6(current)) {
234058
234146
  const configPath = await findConfigInDir(current);
234059
234147
  if (configPath) {
234060
234148
  return { root: current, configPath };
234061
234149
  }
234062
- current = dirname5(current);
234150
+ current = dirname6(current);
234063
234151
  }
234064
234152
  return null;
234065
234153
  }
@@ -234081,7 +234169,7 @@ async function readProjectConfig(projectRoot) {
234081
234169
  throw new SchemaValidationError("Invalid project configuration", result.error, configPath);
234082
234170
  }
234083
234171
  const project = result.data;
234084
- const configDir = dirname5(configPath);
234172
+ const configDir = dirname6(configPath);
234085
234173
  const [entities, functions, agents, connectors] = await Promise.all([
234086
234174
  entityResource.readAll(join6(configDir, project.entitiesDir)),
234087
234175
  functionResource.readAll(join6(configDir, project.functionsDir)),
@@ -234183,7 +234271,7 @@ async function readAppConfig(projectRoot) {
234183
234271
  // src/core/project/template.ts
234184
234272
  var import_ejs = __toESM(require_ejs(), 1);
234185
234273
  var import_front_matter = __toESM(require_front_matter(), 1);
234186
- import { dirname as dirname6, join as join7 } from "node:path";
234274
+ import { dirname as dirname7, join as join7 } from "node:path";
234187
234275
  async function listTemplates() {
234188
234276
  const parsed = await readJsonFile(getTemplatesIndexPath());
234189
234277
  const result = TemplatesConfigSchema.safeParse(parsed);
@@ -234205,7 +234293,7 @@ async function renderTemplate(template, destPath, data) {
234205
234293
  if (file2.endsWith(".ejs")) {
234206
234294
  const rendered = await import_ejs.default.renderFile(srcPath, data);
234207
234295
  const { attributes, body } = import_front_matter.default(rendered);
234208
- const destFile = attributes.outputFileName ? join7(dirname6(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
234296
+ const destFile = attributes.outputFileName ? join7(dirname7(file2), attributes.outputFileName) : file2.replace(/\.ejs$/, "");
234209
234297
  const destFilePath = join7(destPath, destFile);
234210
234298
  await writeFile(destFilePath, body);
234211
234299
  } else {
@@ -235383,24 +235471,6 @@ async function login() {
235383
235471
  };
235384
235472
  }
235385
235473
 
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
235474
  // node_modules/is-plain-obj/index.js
235405
235475
  function isPlainObject2(value) {
235406
235476
  if (typeof value !== "object" || value === null) {
@@ -241899,7 +241969,7 @@ var {
241899
241969
  // package.json
241900
241970
  var package_default = {
241901
241971
  name: "base44",
241902
- version: "0.0.37",
241972
+ version: "0.0.38",
241903
241973
  description: "Base44 CLI - Unified interface for managing Base44 applications",
241904
241974
  type: "module",
241905
241975
  bin: {
@@ -242017,35 +242087,16 @@ async function checkForUpgrade() {
242017
242087
  }
242018
242088
 
242019
242089
  // src/cli/utils/upgradeNotification.ts
242020
- var UPGRADE_COMMAND = "npm install -g base44@latest";
242021
- function formatUpgradeBox(info) {
242090
+ function formatUpgradeMessage(info) {
242022
242091
  const { shinyOrange } = theme.colors;
242023
242092
  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);
242093
+ return `${shinyOrange("Update available!")} ${shinyOrange(`${info.currentVersion} → ${info.latestVersion}`)} ${shinyOrange("Run:")} ${bold2(shinyOrange("npm install -g base44@latest"))}`;
242043
242094
  }
242044
- async function printUpgradeNotification(upgradeCheckPromise) {
242095
+ async function printUpgradeNotificationIfAvailable() {
242045
242096
  try {
242046
- const upgradeInfo = await upgradeCheckPromise;
242097
+ const upgradeInfo = await checkForUpgrade();
242047
242098
  if (upgradeInfo) {
242048
- R2.warn(formatUpgradeBox(upgradeInfo));
242099
+ R2.message(formatUpgradeMessage(upgradeInfo));
242049
242100
  }
242050
242101
  } catch {}
242051
242102
  }
@@ -242058,7 +242109,7 @@ async function runCommand(commandFn, options, context) {
242058
242109
  } else {
242059
242110
  We(theme.colors.base44OrangeBackground(" Base 44 "));
242060
242111
  }
242061
- const upgradeCheckPromise = startUpgradeCheck();
242112
+ await printUpgradeNotificationIfAvailable();
242062
242113
  try {
242063
242114
  if (options?.requireAuth) {
242064
242115
  const loggedIn = await isLoggedIn();
@@ -242078,14 +242129,12 @@ async function runCommand(commandFn, options, context) {
242078
242129
  context.errorReporter.setContext({ appId: appConfig.id });
242079
242130
  }
242080
242131
  const result = await commandFn();
242081
- await printUpgradeNotification(upgradeCheckPromise);
242082
242132
  Le(result.outroMessage || "");
242083
242133
  if (result.stdout) {
242084
242134
  process.stdout.write(result.stdout);
242085
242135
  }
242086
242136
  } catch (error48) {
242087
242137
  displayError(error48);
242088
- await printUpgradeNotification(upgradeCheckPromise);
242089
242138
  const errorContext = context.errorReporter.getErrorContext();
242090
242139
  Le(theme.format.errorContext(errorContext));
242091
242140
  throw error48;
@@ -242129,7 +242178,7 @@ function getDashboardUrl(projectId) {
242129
242178
  // src/cli/commands/agents/pull.ts
242130
242179
  async function pullAgentsAction() {
242131
242180
  const { project: project2 } = await readProjectConfig();
242132
- const configDir = dirname7(project2.configPath);
242181
+ const configDir = dirname8(project2.configPath);
242133
242182
  const agentsDir = join9(configDir, project2.agentsDir);
242134
242183
  const remoteAgents = await runTask("Fetching agents from Base44", async () => {
242135
242184
  return await fetchAgents();
@@ -242223,11 +242272,36 @@ function getWhoamiCommand(context) {
242223
242272
  });
242224
242273
  }
242225
242274
 
242275
+ // src/cli/commands/connectors/list-available.ts
242276
+ async function listAvailableAction() {
242277
+ const { availableIntegrations } = await runTask("Fetching available integrations from Base44", async () => {
242278
+ return await listAvailableIntegrations();
242279
+ }, {
242280
+ successMessage: "Available integrations fetched successfully",
242281
+ errorMessage: "Failed to fetch available integrations"
242282
+ });
242283
+ if (availableIntegrations.length === 0) {
242284
+ return { outroMessage: "No available integrations found." };
242285
+ }
242286
+ for (const integration of availableIntegrations) {
242287
+ R2.info(`${theme.styles.bold(integration.displayName)} ${theme.styles.dim(`(${integration.integrationType})`)}${integration.description ? `
242288
+ ${theme.styles.dim(integration.description)}` : ""}`);
242289
+ }
242290
+ return {
242291
+ outroMessage: `Found ${availableIntegrations.length} available integrations.`
242292
+ };
242293
+ }
242294
+ function getConnectorsListAvailableCommand(context) {
242295
+ return new Command("list-available").description("List all available integration types").action(async () => {
242296
+ await runCommand(listAvailableAction, { requireAuth: true }, context);
242297
+ });
242298
+ }
242299
+
242226
242300
  // src/cli/commands/connectors/pull.ts
242227
- import { dirname as dirname8, join as join10 } from "node:path";
242301
+ import { dirname as dirname9, join as join10 } from "node:path";
242228
242302
  async function pullConnectorsAction() {
242229
242303
  const { project: project2 } = await readProjectConfig();
242230
- const configDir = dirname8(project2.configPath);
242304
+ const configDir = dirname9(project2.configPath);
242231
242305
  const connectorsDir = join10(configDir, project2.connectorsDir);
242232
242306
  const remoteConnectors = await runTask("Fetching connectors from Base44", async () => {
242233
242307
  return await listConnectors();
@@ -243023,7 +243097,7 @@ function getConnectorsPushCommand(context) {
243023
243097
 
243024
243098
  // src/cli/commands/connectors/index.ts
243025
243099
  function getConnectorsCommand(context) {
243026
- return new Command("connectors").description("Manage project connectors (OAuth integrations)").addCommand(getConnectorsPullCommand(context)).addCommand(getConnectorsPushCommand(context));
243100
+ return new Command("connectors").description("Manage project connectors (OAuth integrations)").addCommand(getConnectorsListAvailableCommand(context)).addCommand(getConnectorsPullCommand(context)).addCommand(getConnectorsPushCommand(context));
243027
243101
  }
243028
243102
 
243029
243103
  // src/cli/commands/dashboard/open.ts
@@ -243923,7 +243997,7 @@ function getTypesCommand(context) {
243923
243997
  }
243924
243998
 
243925
243999
  // src/cli/dev/dev-server/main.ts
243926
- import { dirname as dirname14, join as join18 } from "node:path";
244000
+ import { dirname as dirname15, join as join18 } from "node:path";
243927
244001
  var import_cors = __toESM(require_lib4(), 1);
243928
244002
  var import_express4 = __toESM(require_express(), 1);
243929
244003
 
@@ -244082,9 +244156,9 @@ function createDevLogger() {
244082
244156
 
244083
244157
  // src/cli/dev/dev-server/function-manager.ts
244084
244158
  import { spawn as spawn2, spawnSync as spawnSync2 } from "node:child_process";
244085
- import { dirname as dirname11, join as join15 } from "node:path";
244159
+ import { dirname as dirname12, join as join15 } from "node:path";
244086
244160
  import { fileURLToPath as fileURLToPath7 } from "node:url";
244087
- var __dirname5 = dirname11(fileURLToPath7(import.meta.url));
244161
+ var __dirname5 = dirname12(fileURLToPath7(import.meta.url));
244088
244162
  var WRAPPER_PATH = join15(__dirname5, "../deno-runtime/main.js");
244089
244163
  var READY_TIMEOUT = 30000;
244090
244164
 
@@ -244286,9 +244360,8 @@ function createFunctionRouter(manager, logger) {
244286
244360
  var import_nedb = __toESM(require_nedb(), 1);
244287
244361
 
244288
244362
  class Database {
244289
- collections;
244290
- constructor(entities) {
244291
- this.collections = new Map;
244363
+ collections = new Map;
244364
+ load(entities) {
244292
244365
  for (const entity2 of entities) {
244293
244366
  this.collections.set(entity2.name, new import_nedb.default);
244294
244367
  }
@@ -244299,6 +244372,12 @@ class Database {
244299
244372
  getCollectionNames() {
244300
244373
  return Array.from(this.collections.keys());
244301
244374
  }
244375
+ dropAll() {
244376
+ for (const collection of this.collections.values()) {
244377
+ collection.remove({}, { multi: true });
244378
+ }
244379
+ this.collections.clear();
244380
+ }
244302
244381
  }
244303
244382
 
244304
244383
  // node_modules/socket.io/wrapper.mjs
@@ -244654,7 +244733,7 @@ function createCustomIntegrationRoutes(remoteProxy, logger) {
244654
244733
 
244655
244734
  // src/cli/dev/dev-server/watcher.ts
244656
244735
  import { EventEmitter as EventEmitter4 } from "node:events";
244657
- import { relative as relative4 } from "node:path";
244736
+ import { relative as relative6 } from "node:path";
244658
244737
 
244659
244738
  // node_modules/chokidar/index.js
244660
244739
  import { EventEmitter as EventEmitter3 } from "node:events";
@@ -245384,9 +245463,9 @@ class NodeFsHandler {
245384
245463
  if (this.fsw.closed) {
245385
245464
  return;
245386
245465
  }
245387
- const dirname13 = sp2.dirname(file2);
245466
+ const dirname14 = sp2.dirname(file2);
245388
245467
  const basename5 = sp2.basename(file2);
245389
- const parent = this.fsw._getWatchedDir(dirname13);
245468
+ const parent = this.fsw._getWatchedDir(dirname14);
245390
245469
  let prevStats = stats;
245391
245470
  if (parent.has(basename5))
245392
245471
  return;
@@ -245413,7 +245492,7 @@ class NodeFsHandler {
245413
245492
  prevStats = newStats2;
245414
245493
  }
245415
245494
  } catch (error48) {
245416
- this.fsw._remove(dirname13, basename5);
245495
+ this.fsw._remove(dirname14, basename5);
245417
245496
  }
245418
245497
  } else if (parent.has(basename5)) {
245419
245498
  const at13 = newStats.atimeMs;
@@ -245636,11 +245715,11 @@ function createPattern(matcher) {
245636
245715
  if (matcher.path === string4)
245637
245716
  return true;
245638
245717
  if (matcher.recursive) {
245639
- const relative4 = sp3.relative(matcher.path, string4);
245640
- if (!relative4) {
245718
+ const relative6 = sp3.relative(matcher.path, string4);
245719
+ if (!relative6) {
245641
245720
  return false;
245642
245721
  }
245643
- return !relative4.startsWith("..") && !sp3.isAbsolute(relative4);
245722
+ return !relative6.startsWith("..") && !sp3.isAbsolute(relative6);
245644
245723
  }
245645
245724
  return false;
245646
245725
  };
@@ -246275,79 +246354,74 @@ var WATCH_QUEUE_DELAY_MS = 500;
246275
246354
  class WatchBase44 extends EventEmitter4 {
246276
246355
  itemsToWatch;
246277
246356
  logger;
246278
- watchers = [];
246279
- queueWaitForCreation = [];
246357
+ entryNames;
246358
+ watchers = new Map;
246280
246359
  queueWaitForCreationTimeout = null;
246281
246360
  constructor(itemsToWatch, logger) {
246282
246361
  super();
246283
246362
  this.itemsToWatch = itemsToWatch;
246284
246363
  this.logger = logger;
246364
+ this.entryNames = Object.keys(itemsToWatch);
246285
246365
  }
246286
246366
  async start() {
246287
- if (this.watchers.length > 0 || this.queueWaitForCreation.length > 0) {
246367
+ if (this.watchers.size > 0) {
246288
246368
  return;
246289
246369
  }
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);
246370
+ for (const name2 of this.entryNames) {
246371
+ const targetPath = this.itemsToWatch[name2];
246372
+ if (await pathExists(targetPath)) {
246373
+ this.watchers.set(name2, this.watchTarget(name2, targetPath));
246295
246374
  }
246296
246375
  }
246297
- this.watchCreationQueue();
246376
+ this.watchEntries();
246298
246377
  }
246299
246378
  async close() {
246300
246379
  if (this.queueWaitForCreationTimeout) {
246301
246380
  clearTimeout(this.queueWaitForCreationTimeout);
246302
246381
  this.queueWaitForCreationTimeout = null;
246303
246382
  }
246304
- for (const watcher of this.watchers) {
246383
+ for (const watcher of this.watchers.values()) {
246305
246384
  await watcher.close();
246306
246385
  }
246307
- this.watchers = [];
246308
- this.queueWaitForCreation = [];
246386
+ this.watchers.clear();
246309
246387
  }
246310
- watchCreationQueue() {
246388
+ watchEntries() {
246311
246389
  if (this.queueWaitForCreationTimeout) {
246312
246390
  clearTimeout(this.queueWaitForCreationTimeout);
246313
246391
  }
246314
246392
  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);
246393
+ for (const name2 of this.entryNames) {
246394
+ const path19 = this.itemsToWatch[name2];
246395
+ const watchItem = this.watchers.get(name2);
246396
+ const exists = await pathExists(path19);
246397
+ if (!watchItem && exists) {
246398
+ this.emit("change", name2, path19);
246399
+ this.watchers.set(name2, this.watchTarget(name2, path19));
246400
+ } else if (watchItem && !exists) {
246401
+ await watchItem.close();
246402
+ this.emit("change", name2, path19);
246403
+ setTimeout(() => {
246404
+ this.watchers.forEach((watcher, watcherName) => {
246405
+ if (watcher.closed) {
246406
+ this.watchers.delete(watcherName);
246407
+ }
246408
+ });
246409
+ });
246320
246410
  }
246321
246411
  }
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
- }
246412
+ this.queueWaitForCreationTimeout = null;
246413
+ this.watchEntries();
246328
246414
  }, WATCH_QUEUE_DELAY_MS);
246329
246415
  }
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, {
246416
+ watchTarget(name2, targetPath) {
246417
+ const watcher = watch(targetPath, {
246335
246418
  ignoreInitial: true
246336
246419
  });
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
- });
246420
+ watcher.on("all", import_debounce.default(async (_event, path19) => {
246421
+ this.emit("change", name2, relative6(targetPath, path19));
246422
+ }, WATCH_DEBOUNCE_MS));
246349
246423
  watcher.on("error", (err) => {
246350
- this.logger.error(`Watch handler failed for ${item.path}`, err instanceof Error ? err : undefined);
246424
+ this.logger.error(`Watch handler failed for ${targetPath}`, err instanceof Error ? err : undefined);
246351
246425
  });
246352
246426
  return watcher;
246353
246427
  }
@@ -246385,7 +246459,8 @@ async function createDevServer(options8) {
246385
246459
  if (functionManager.getFunctionNames().length > 0) {
246386
246460
  R2.info(`Loaded functions: ${functionManager.getFunctionNames().join(", ")}`);
246387
246461
  }
246388
- const db2 = new Database(entities);
246462
+ const db2 = new Database;
246463
+ db2.load(entities);
246389
246464
  if (db2.getCollectionNames().length > 0) {
246390
246465
  R2.info(`Loaded entities: ${db2.getCollectionNames().join(", ")}`);
246391
246466
  }
@@ -246419,16 +246494,14 @@ async function createDevServer(options8) {
246419
246494
  emitEntityEvent = (appId, entityName, event) => {
246420
246495
  broadcastEntityEvent(io6, appId, entityName, event);
246421
246496
  };
246422
- const base44ConfigWatcher = new WatchBase44([
246423
- {
246424
- name: "functions",
246425
- path: join18(dirname14(project2.configPath), project2.functionsDir)
246426
- }
246427
- ], devLogger);
246497
+ const base44ConfigWatcher = new WatchBase44({
246498
+ functions: join18(dirname15(project2.configPath), project2.functionsDir),
246499
+ entities: join18(dirname15(project2.configPath), project2.entitiesDir)
246500
+ }, devLogger);
246428
246501
  base44ConfigWatcher.on("change", async (name2) => {
246429
246502
  try {
246503
+ const { functions: functions2, entities: entities2 } = await options8.loadResources();
246430
246504
  if (name2 === "functions") {
246431
- const { functions: functions2 } = await options8.loadResources();
246432
246505
  const previousFunctionCount = functionManager.getFunctionNames().length;
246433
246506
  functionManager.reload(functions2);
246434
246507
  const names = functionManager.getFunctionNames();
@@ -246438,6 +246511,17 @@ async function createDevServer(options8) {
246438
246511
  devLogger.log("All functions removed");
246439
246512
  }
246440
246513
  }
246514
+ if (name2 === "entities") {
246515
+ const previousEntityCount = db2.getCollectionNames().length;
246516
+ db2.dropAll();
246517
+ if (previousEntityCount > 0) {
246518
+ devLogger.log("Entities directory changed, clearing data...");
246519
+ }
246520
+ db2.load(entities2);
246521
+ if (db2.getCollectionNames().length > 0) {
246522
+ devLogger.log(`Loaded entities: ${db2.getCollectionNames().join(", ")}`);
246523
+ }
246524
+ }
246441
246525
  } catch (error48) {
246442
246526
  const errorMessage = error48 instanceof Error ? error48.message : String(error48);
246443
246527
  devLogger.error(errorMessage);
@@ -246601,7 +246685,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
246601
246685
  import { release, type } from "node:os";
246602
246686
 
246603
246687
  // node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
246604
- import { dirname as dirname15, posix, sep } from "path";
246688
+ import { dirname as dirname16, posix, sep } from "path";
246605
246689
  function createModulerModifier() {
246606
246690
  const getModuleFromFileName = createGetModuleFromFilename();
246607
246691
  return async (frames) => {
@@ -246610,7 +246694,7 @@ function createModulerModifier() {
246610
246694
  return frames;
246611
246695
  };
246612
246696
  }
246613
- function createGetModuleFromFilename(basePath = process.argv[1] ? dirname15(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
246697
+ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname16(process.argv[1]) : process.cwd(), isWindows5 = sep === "\\") {
246614
246698
  const normalizedBase = isWindows5 ? normalizeWindowsPath2(basePath) : basePath;
246615
246699
  return (filename) => {
246616
246700
  if (!filename)
@@ -249814,9 +249898,9 @@ function matchPropertyGroup(propertyGroup, propertyValues, cohortProperties, deb
249814
249898
  throw new InconclusiveMatchError("can't match cohort without a given cohort property value");
249815
249899
  return propertyGroupType === "AND";
249816
249900
  }
249817
- function isValidRegex(regex2) {
249901
+ function isValidRegex(regex) {
249818
249902
  try {
249819
- new RegExp(regex2);
249903
+ new RegExp(regex);
249820
249904
  return true;
249821
249905
  } catch (err) {
249822
249906
  return false;
@@ -249834,8 +249918,8 @@ function convertToDateTime(value) {
249834
249918
  throw new InconclusiveMatchError(`The date provided ${value} must be a string, number, or date object`);
249835
249919
  }
249836
249920
  function relativeDateParseForFeatureFlagMatching(value) {
249837
- const regex2 = /^-?(?<number>[0-9]+)(?<interval>[a-z])$/;
249838
- const match = value.match(regex2);
249921
+ const regex = /^-?(?<number>[0-9]+)(?<interval>[a-z])$/;
249922
+ const match = value.match(regex);
249839
249923
  const parsedDt = new Date(new Date().toISOString());
249840
249924
  if (!match)
249841
249925
  return null;
@@ -250828,4 +250912,4 @@ export {
250828
250912
  CLIExitError
250829
250913
  };
250830
250914
 
250831
- //# debugId=BFC56E0BF807E18264756E2164756E21
250915
+ //# debugId=35BD46803B68EE0A64756E2164756E21