@base44-preview/cli 0.0.51-pr.503.3e3774c → 0.0.51-pr.503.6669b14

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)."
@@ -243444,6 +243441,9 @@ var functionResource = {
243444
243441
  push: (functions) => deployFunctionsSequentially(functions)
243445
243442
  };
243446
243443
  // src/core/project/config.ts
243444
+ function describeFunctionSource(fn) {
243445
+ return fn.source.type === "plugin" ? `plugin "${fn.source.namespace}"` : "project";
243446
+ }
243447
243447
  async function findConfigInDir(dir) {
243448
243448
  const files = await globby(PROJECT_CONFIG_PATTERNS, {
243449
243449
  cwd: dir,
@@ -243464,7 +243464,7 @@ async function findProjectRoot(startPath) {
243464
243464
  }
243465
243465
 
243466
243466
  class ProjectConfigReader {
243467
- pluginNamespaces = new Set;
243467
+ pluginSourceByNamespace = new Map;
243468
243468
  async readProjectConfig(projectRoot) {
243469
243469
  const { root, configPath } = await this.findConfigOrThrow(projectRoot);
243470
243470
  const project = await this.readConfigFile(configPath);
@@ -243476,6 +243476,7 @@ class ProjectConfigReader {
243476
243476
  ...localResources.functions,
243477
243477
  ...pluginResources.functions
243478
243478
  ];
243479
+ this.validateFunctionNames(functions, configPath);
243479
243480
  return {
243480
243481
  project: { ...project, root, configPath },
243481
243482
  entities,
@@ -243522,9 +243523,10 @@ class ProjectConfigReader {
243522
243523
  throw new ConfigInvalidError("Plugin projects cannot define plugins in this version.", configPath);
243523
243524
  }
243524
243525
  }
243525
- registerPluginNamespace(pluginNamespace, configPath) {
243526
- if (this.pluginNamespaces.has(pluginNamespace)) {
243527
- throw new ConfigInvalidError(`Duplicate plugin namespace "${pluginNamespace}" in project configuration`, configPath, {
243526
+ registerPluginNamespace(namespace, source, configPath) {
243527
+ const existingSource = this.pluginSourceByNamespace.get(namespace);
243528
+ if (existingSource) {
243529
+ throw new ConfigInvalidError(`Duplicate plugin namespace "${namespace}" in project configuration: "${existingSource}" and "${source}".`, configPath, {
243528
243530
  hints: [
243529
243531
  {
243530
243532
  message: "Remove the plugin or change plugin namespace"
@@ -243532,21 +243534,21 @@ class ProjectConfigReader {
243532
243534
  ]
243533
243535
  });
243534
243536
  }
243535
- this.pluginNamespaces.add(pluginNamespace);
243537
+ this.pluginSourceByNamespace.set(namespace, source);
243536
243538
  }
243537
243539
  async readPluginConfig(plugin, hostConfigPath) {
243538
243540
  const pluginRoot = resolvePluginRoot(plugin.source, dirname6(hostConfigPath));
243539
243541
  const { configPath } = await this.findConfigOrThrow(pluginRoot);
243540
243542
  const project = await this.readConfigFile(configPath);
243541
- const pluginNamespace = requirePluginNamespace(project, plugin.source, configPath);
243543
+ const namespace = requirePluginNamespace(project, plugin.source, configPath);
243542
243544
  this.assertPluginProjectDoesNotLoadPlugins(project, configPath);
243543
- return { configPath, pluginNamespace, project };
243545
+ return { configPath, namespace, project, source: plugin.source };
243544
243546
  }
243545
- async readPluginResources(project, configPath, pluginNamespace) {
243547
+ async readPluginResources(project, configPath, namespace) {
243546
243548
  const resources = await this.readProjectResources(configPath, project);
243547
243549
  return {
243548
- entities: markPluginEntities(resources.entities, pluginNamespace),
243549
- functions: namespacePluginFunctions(resources.functions, pluginNamespace),
243550
+ entities: markPluginEntities(resources.entities, namespace),
243551
+ functions: namespacePluginFunctions(resources.functions, namespace),
243550
243552
  agents: [],
243551
243553
  connectors: [],
243552
243554
  authConfig: []
@@ -243555,19 +243557,20 @@ class ProjectConfigReader {
243555
243557
  async readPlugins(plugins, configPath) {
243556
243558
  const entities = [];
243557
243559
  const functions = [];
243558
- const entityNameByPluginNamespace = new Map;
243560
+ const pluginSourceByEntityName = new Map;
243559
243561
  for (const plugin of plugins) {
243560
243562
  const {
243561
243563
  configPath: pluginConfigPath,
243562
- pluginNamespace,
243563
- project
243564
+ namespace,
243565
+ project,
243566
+ source
243564
243567
  } = await this.readPluginConfig(plugin, configPath);
243565
- this.registerPluginNamespace(pluginNamespace, pluginConfigPath);
243566
- const pluginData = await this.readPluginResources(project, pluginConfigPath, pluginNamespace);
243568
+ this.registerPluginNamespace(namespace, source, pluginConfigPath);
243569
+ const pluginData = await this.readPluginResources(project, pluginConfigPath, namespace);
243567
243570
  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, {
243571
+ const existingSource = pluginSourceByEntityName.get(entity.name);
243572
+ if (existingSource) {
243573
+ throw new ConfigInvalidError(`Entity "${entity.name}" is defined by more than one plugin: "${existingSource}" and "${source}".`, pluginConfigPath, {
243571
243574
  hints: [
243572
243575
  {
243573
243576
  message: "Plugin entity names are not namespaced. Remove one plugin or rename one of the entities."
@@ -243575,7 +243578,7 @@ class ProjectConfigReader {
243575
243578
  ]
243576
243579
  });
243577
243580
  }
243578
- entityNameByPluginNamespace.set(entity.name, pluginNamespace);
243581
+ pluginSourceByEntityName.set(entity.name, source);
243579
243582
  }
243580
243583
  entities.push(...pluginData.entities);
243581
243584
  functions.push(...pluginData.functions);
@@ -243588,6 +243591,22 @@ class ProjectConfigReader {
243588
243591
  authConfig: []
243589
243592
  };
243590
243593
  }
243594
+ validateFunctionNames(functions, configPath) {
243595
+ const functionsByName = new Map;
243596
+ for (const fn of functions) {
243597
+ const existingFunction = functionsByName.get(fn.name);
243598
+ if (existingFunction) {
243599
+ throw new ConfigInvalidError(`Duplicate function name "${fn.name}" after loading project plugins (${describeFunctionSource(existingFunction)} and ${describeFunctionSource(fn)}).`, configPath, {
243600
+ hints: [
243601
+ {
243602
+ message: "Rename the project function or change the plugin namespace/function name so every deploy name is unique."
243603
+ }
243604
+ ]
243605
+ });
243606
+ }
243607
+ functionsByName.set(fn.name, fn);
243608
+ }
243609
+ }
243591
243610
  }
243592
243611
  async function readProjectConfig(projectRoot) {
243593
243612
  const reader = new ProjectConfigReader;
@@ -252803,12 +252822,12 @@ async function pullFunctionsAction({ log, runTask: runTask2 }, name2) {
252803
252822
  successMessage: "Functions fetched successfully",
252804
252823
  errorMessage: "Failed to fetch functions"
252805
252824
  });
252806
- const matchingRemote = name2 ? remoteFunctions.filter((f) => f.name === name2) : remoteFunctions;
252807
252825
  if (name2 && pluginFunctionNames.has(name2)) {
252808
252826
  return {
252809
252827
  outroMessage: `Function "${name2}" is managed by a plugin and was not pulled into ${functionsDir}`
252810
252828
  };
252811
252829
  }
252830
+ const matchingRemote = name2 ? remoteFunctions.filter((f) => f.name === name2) : remoteFunctions;
252812
252831
  if (name2 && matchingRemote.length === 0) {
252813
252832
  return {
252814
252833
  outroMessage: `Function "${name2}" not found on remote`
@@ -261529,4 +261548,4 @@ export {
261529
261548
  CLIExitError
261530
261549
  };
261531
261550
 
261532
- //# debugId=F9698F6E012A29BB64756E2164756E21
261551
+ //# debugId=9FAEFFBF52D07E0464756E2164756E21