@budibase/server 2.7.28 → 2.7.30

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/index.js CHANGED
@@ -30474,11 +30474,13 @@ function checkDatasourceTypes(schema, config) {
30474
30474
  async function enrichDatasourceWithValues(datasource2) {
30475
30475
  const cloned = (0, import_fp3.cloneDeep)(datasource2);
30476
30476
  const env = await getEnvironmentVariables2();
30477
+ const { entities, ...clonedWithoutEntities } = cloned;
30477
30478
  const processed = (0, import_string_templates2.processObjectSync)(
30478
- cloned,
30479
+ clonedWithoutEntities,
30479
30480
  { env },
30480
30481
  { onlyFound: true }
30481
30482
  );
30483
+ processed.entities = entities;
30482
30484
  const definition26 = await getDefinition(processed.source);
30483
30485
  processed.config = checkDatasourceTypes(definition26, processed.config);
30484
30486
  return {
@@ -31583,6 +31585,12 @@ __export(utils_exports9, {
31583
31585
  getTableId: () => getTableId,
31584
31586
  validate: () => validate4
31585
31587
  });
31588
+ function isForeignKey(key, table2) {
31589
+ const relationships = Object.values(table2.schema).filter(
31590
+ (column) => column.type === "link" /* LINK */
31591
+ );
31592
+ return relationships.some((relationship) => relationship.foreignKey === key);
31593
+ }
31586
31594
  async function getDatasourceAndQuery(json2) {
31587
31595
  const datasourceId = json2.endpoint.datasourceId;
31588
31596
  const datasource2 = await sdk_default.datasources.get(datasourceId);
@@ -31621,6 +31629,9 @@ async function validate4({
31621
31629
  const column = fetchedTable.schema[fieldName];
31622
31630
  const constraints = cloneDeep9(column.constraints);
31623
31631
  const type = column.type;
31632
+ if (isForeignKey(fieldName, fetchedTable)) {
31633
+ continue;
31634
+ }
31624
31635
  if (type === "formula" /* FORMULA */ || column.autocolumn) {
31625
31636
  continue;
31626
31637
  }
@@ -31705,6 +31716,7 @@ var init_utils24 = __esm({
31705
31716
  init_constants4();
31706
31717
  init_src2();
31707
31718
  init_query4();
31719
+ init_src();
31708
31720
  init_exporters();
31709
31721
  init_sdk3();
31710
31722
  validateJs = require("validate.js");