@base44-preview/cli 0.0.51-pr.503.3e3774c → 0.0.51-pr.503.750a608

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
@@ -124338,7 +124338,7 @@ var init_prettier = __esm(() => {
124338
124338
  const absolute = [];
124339
124339
  const relative22 = [];
124340
124340
  for (const pattern of patterns) {
124341
- if (isAbsolute2(pattern)) {
124341
+ if (isAbsolute3(pattern)) {
124342
124342
  absolute.push(pattern);
124343
124343
  } else {
124344
124344
  relative22.push(pattern);
@@ -124347,10 +124347,10 @@ var init_prettier = __esm(() => {
124347
124347
  return [absolute, relative22];
124348
124348
  }
124349
124349
  exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
124350
- function isAbsolute2(pattern) {
124350
+ function isAbsolute3(pattern) {
124351
124351
  return path152.isAbsolute(pattern);
124352
124352
  }
124353
- exports.isAbsolute = isAbsolute2;
124353
+ exports.isAbsolute = isAbsolute3;
124354
124354
  }
124355
124355
  });
124356
124356
  require_merge22 = __commonJS2({
@@ -241591,9 +241591,9 @@ import { dirname as dirname6, join as join9 } from "node:path";
241591
241591
 
241592
241592
  // src/core/project/plugins.ts
241593
241593
  import { createRequire as createRequire2 } from "node:module";
241594
- import { dirname as dirname3, join as join3, resolve } from "node:path";
241594
+ import { dirname as dirname3, isAbsolute as isAbsolute2, join as join3, resolve } from "node:path";
241595
241595
  function resolvePluginRoot(pluginSource, fromRoot) {
241596
- if (pluginSource.startsWith(".")) {
241596
+ if (pluginSource.startsWith(".") || isAbsolute2(pluginSource)) {
241597
241597
  return resolve(fromRoot, pluginSource);
241598
241598
  }
241599
241599
  const req = createRequire2(join3(fromRoot, "package.json"));
@@ -242943,7 +242943,7 @@ async function readAllEntities(entitiesDir) {
242943
242943
  const names = new Set;
242944
242944
  for (const entity of entities) {
242945
242945
  if (names.has(entity.name)) {
242946
- throw new InvalidInputError(`Duplicate entity name "${entity.name}"`, {
242946
+ throw new ConfigInvalidError(`Duplicate entity name "${entity.name}" in ${entitiesDir}`, entitiesDir, {
242947
242947
  hints: [
242948
242948
  {
242949
242949
  message: `Remove duplicate entities with name "${entity.name}" - only one entity per name is allowed`
@@ -242969,11 +242969,8 @@ var entityResource = {
242969
242969
  };
242970
242970
  // src/core/resources/entity/merge.ts
242971
242971
  function mergePluginEntity(pluginEntity, projectEntity, configPath) {
242972
- const unsupportedFields = [
242973
- projectEntity.title ? "title" : null,
242974
- projectEntity.description ? "description" : null,
242975
- projectEntity.rls ? "rls" : null
242976
- ].filter(Boolean);
242972
+ const projectEntityFields = new Set(Object.keys(projectEntity));
242973
+ const unsupportedFields = ["title", "description", "rls"].filter((field) => projectEntityFields.has(field));
242977
242974
  if (unsupportedFields.length > 0) {
242978
242975
  throw new ConfigInvalidError(`Project entity "${projectEntity.name}" extends a plugin entity and cannot override fields: ${unsupportedFields.join(", ")}.`, configPath);
242979
242976
  }
@@ -242986,7 +242983,7 @@ function mergePluginEntity(pluginEntity, projectEntity, configPath) {
242986
242983
  }
242987
242984
  for (const requiredProperty of projectEntity.required ?? []) {
242988
242985
  if (!addedPropertyNames.has(requiredProperty)) {
242989
- throw new ConfigInvalidError(`Required property "${requiredProperty}" must be declared in project entity "${projectEntity.name}" properties`, configPath);
242986
+ throw new ConfigInvalidError(`Project entity "${projectEntity.name}" can only mark project-added properties as required; "${requiredProperty}" is not declared in the project extension.`, configPath);
242990
242987
  }
242991
242988
  }
242992
242989
  const required2 = pluginEntity.required || projectEntity.required ? [
@@ -243297,7 +243294,7 @@ async function readAllFunctions(functionsDir) {
243297
243294
  const names = new Set;
243298
243295
  for (const fn of functions) {
243299
243296
  if (names.has(fn.name)) {
243300
- throw new InvalidInputError(`Duplicate function name "${fn.name}"`, {
243297
+ throw new ConfigInvalidError(`Duplicate function name "${fn.name}" in ${functionsDir}`, functionsDir, {
243301
243298
  hints: [
243302
243299
  {
243303
243300
  message: "Ensure each function has a unique name (or path for zero-config functions)."
@@ -243464,7 +243461,7 @@ async function findProjectRoot(startPath) {
243464
243461
  }
243465
243462
 
243466
243463
  class ProjectConfigReader {
243467
- pluginNamespaces = new Set;
243464
+ pluginSourceByNamespace = new Map;
243468
243465
  async readProjectConfig(projectRoot) {
243469
243466
  const { root, configPath } = await this.findConfigOrThrow(projectRoot);
243470
243467
  const project = await this.readConfigFile(configPath);
@@ -243476,6 +243473,7 @@ class ProjectConfigReader {
243476
243473
  ...localResources.functions,
243477
243474
  ...pluginResources.functions
243478
243475
  ];
243476
+ this.validateFunctionNames(functions, configPath);
243479
243477
  return {
243480
243478
  project: { ...project, root, configPath },
243481
243479
  entities,
@@ -243522,9 +243520,10 @@ class ProjectConfigReader {
243522
243520
  throw new ConfigInvalidError("Plugin projects cannot define plugins in this version.", configPath);
243523
243521
  }
243524
243522
  }
243525
- registerPluginNamespace(pluginNamespace, configPath) {
243526
- if (this.pluginNamespaces.has(pluginNamespace)) {
243527
- throw new ConfigInvalidError(`Duplicate plugin namespace "${pluginNamespace}" in project configuration`, configPath, {
243523
+ registerPluginNamespace(namespace, source, configPath) {
243524
+ const existingSource = this.pluginSourceByNamespace.get(namespace);
243525
+ if (existingSource) {
243526
+ throw new ConfigInvalidError(`Duplicate plugin namespace "${namespace}" in project configuration: "${existingSource}" and "${source}".`, configPath, {
243528
243527
  hints: [
243529
243528
  {
243530
243529
  message: "Remove the plugin or change plugin namespace"
@@ -243532,21 +243531,21 @@ class ProjectConfigReader {
243532
243531
  ]
243533
243532
  });
243534
243533
  }
243535
- this.pluginNamespaces.add(pluginNamespace);
243534
+ this.pluginSourceByNamespace.set(namespace, source);
243536
243535
  }
243537
243536
  async readPluginConfig(plugin, hostConfigPath) {
243538
243537
  const pluginRoot = resolvePluginRoot(plugin.source, dirname6(hostConfigPath));
243539
243538
  const { configPath } = await this.findConfigOrThrow(pluginRoot);
243540
243539
  const project = await this.readConfigFile(configPath);
243541
- const pluginNamespace = requirePluginNamespace(project, plugin.source, configPath);
243540
+ const namespace = requirePluginNamespace(project, plugin.source, configPath);
243542
243541
  this.assertPluginProjectDoesNotLoadPlugins(project, configPath);
243543
- return { configPath, pluginNamespace, project };
243542
+ return { configPath, namespace, project, source: plugin.source };
243544
243543
  }
243545
- async readPluginResources(project, configPath, pluginNamespace) {
243544
+ async readPluginResources(project, configPath, namespace) {
243546
243545
  const resources = await this.readProjectResources(configPath, project);
243547
243546
  return {
243548
- entities: markPluginEntities(resources.entities, pluginNamespace),
243549
- functions: namespacePluginFunctions(resources.functions, pluginNamespace),
243547
+ entities: markPluginEntities(resources.entities, namespace),
243548
+ functions: namespacePluginFunctions(resources.functions, namespace),
243550
243549
  agents: [],
243551
243550
  connectors: [],
243552
243551
  authConfig: []
@@ -243555,19 +243554,20 @@ class ProjectConfigReader {
243555
243554
  async readPlugins(plugins, configPath) {
243556
243555
  const entities = [];
243557
243556
  const functions = [];
243558
- const entityNameByPluginNamespace = new Map;
243557
+ const pluginSourceByEntityName = new Map;
243559
243558
  for (const plugin of plugins) {
243560
243559
  const {
243561
243560
  configPath: pluginConfigPath,
243562
- pluginNamespace,
243563
- project
243561
+ namespace,
243562
+ project,
243563
+ source
243564
243564
  } = await this.readPluginConfig(plugin, configPath);
243565
- this.registerPluginNamespace(pluginNamespace, pluginConfigPath);
243566
- const pluginData = await this.readPluginResources(project, pluginConfigPath, pluginNamespace);
243565
+ this.registerPluginNamespace(namespace, source, pluginConfigPath);
243566
+ const pluginData = await this.readPluginResources(project, pluginConfigPath, namespace);
243567
243567
  for (const entity of pluginData.entities) {
243568
- const existingPluginNamespace = entityNameByPluginNamespace.get(entity.name);
243569
- if (existingPluginNamespace) {
243570
- throw new ConfigInvalidError(`Entity "${entity.name}" is defined by more than one plugin: "${existingPluginNamespace}" and "${pluginNamespace}".`, pluginConfigPath, {
243568
+ const existingSource = pluginSourceByEntityName.get(entity.name);
243569
+ if (existingSource) {
243570
+ throw new ConfigInvalidError(`Entity "${entity.name}" is defined by more than one plugin: "${existingSource}" and "${source}".`, pluginConfigPath, {
243571
243571
  hints: [
243572
243572
  {
243573
243573
  message: "Plugin entity names are not namespaced. Remove one plugin or rename one of the entities."
@@ -243575,7 +243575,7 @@ class ProjectConfigReader {
243575
243575
  ]
243576
243576
  });
243577
243577
  }
243578
- entityNameByPluginNamespace.set(entity.name, pluginNamespace);
243578
+ pluginSourceByEntityName.set(entity.name, source);
243579
243579
  }
243580
243580
  entities.push(...pluginData.entities);
243581
243581
  functions.push(...pluginData.functions);
@@ -243588,6 +243588,22 @@ class ProjectConfigReader {
243588
243588
  authConfig: []
243589
243589
  };
243590
243590
  }
243591
+ validateFunctionNames(functions, configPath) {
243592
+ const functionsByName = new Map;
243593
+ for (const fn of functions) {
243594
+ const existingFunction = functionsByName.get(fn.name);
243595
+ if (existingFunction) {
243596
+ throw new ConfigInvalidError(`Duplicate function name "${fn.name}" after loading project plugins.`, configPath, {
243597
+ hints: [
243598
+ {
243599
+ message: "Rename the project function or change the plugin namespace/function name so every deploy name is unique."
243600
+ }
243601
+ ]
243602
+ });
243603
+ }
243604
+ functionsByName.set(fn.name, fn);
243605
+ }
243606
+ }
243591
243607
  }
243592
243608
  async function readProjectConfig(projectRoot) {
243593
243609
  const reader = new ProjectConfigReader;
@@ -252803,12 +252819,12 @@ async function pullFunctionsAction({ log, runTask: runTask2 }, name2) {
252803
252819
  successMessage: "Functions fetched successfully",
252804
252820
  errorMessage: "Failed to fetch functions"
252805
252821
  });
252806
- const matchingRemote = name2 ? remoteFunctions.filter((f) => f.name === name2) : remoteFunctions;
252807
252822
  if (name2 && pluginFunctionNames.has(name2)) {
252808
252823
  return {
252809
252824
  outroMessage: `Function "${name2}" is managed by a plugin and was not pulled into ${functionsDir}`
252810
252825
  };
252811
252826
  }
252827
+ const matchingRemote = name2 ? remoteFunctions.filter((f) => f.name === name2) : remoteFunctions;
252812
252828
  if (name2 && matchingRemote.length === 0) {
252813
252829
  return {
252814
252830
  outroMessage: `Function "${name2}" not found on remote`
@@ -261529,4 +261545,4 @@ export {
261529
261545
  CLIExitError
261530
261546
  };
261531
261547
 
261532
- //# debugId=F9698F6E012A29BB64756E2164756E21
261548
+ //# debugId=2ADA1E4C26BBE1A464756E2164756E21