@budibase/backend-core 2.32.17 → 2.33.1

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
@@ -62059,7 +62059,7 @@ var processSearchFilters = (filters) => {
62059
62059
  return filters.reduce((acc, filter) => {
62060
62060
  const filterPropertyKeys = Object.keys(filter).sort((a, b) => {
62061
62061
  return a.localeCompare(b);
62062
- }).filter((key) => key in filter);
62062
+ }).filter((key) => filter[key]);
62063
62063
  if (filterPropertyKeys.length == 1) {
62064
62064
  const key = filterPropertyKeys[0], value = filter[key];
62065
62065
  if (key === "onEmptyFilter") {
@@ -63297,8 +63297,8 @@ var allowDefaultColumnByType = {
63297
63297
  ["attachment_single" /* ATTACHMENT_SINGLE */]: false,
63298
63298
  ["signature_single" /* SIGNATURE_SINGLE */]: false,
63299
63299
  ["link" /* LINK */]: false,
63300
- ["bb_reference" /* BB_REFERENCE */]: false,
63301
- ["bb_reference_single" /* BB_REFERENCE_SINGLE */]: false
63300
+ ["bb_reference" /* BB_REFERENCE */]: true,
63301
+ ["bb_reference_single" /* BB_REFERENCE_SINGLE */]: true
63302
63302
  };
63303
63303
 
63304
63304
  // src/constants/db.ts
@@ -67728,7 +67728,7 @@ var FlagSet = class {
67728
67728
  var flags = new FlagSet({
67729
67729
  DEFAULT_VALUES: Flag.boolean(environment_default.isDev()),
67730
67730
  AUTOMATION_BRANCHING: Flag.boolean(environment_default.isDev()),
67731
- SQS: Flag.boolean(environment_default.isDev()),
67731
+ SQS: Flag.boolean(true),
67732
67732
  ["AI_CUSTOM_CONFIGS" /* AI_CUSTOM_CONFIGS */]: Flag.boolean(environment_default.isDev()),
67733
67733
  ["ENRICHED_RELATIONSHIPS" /* ENRICHED_RELATIONSHIPS */]: Flag.boolean(environment_default.isDev()),
67734
67734
  ["TABLES_DEFAULT_ADMIN" /* TABLES_DEFAULT_ADMIN */]: Flag.boolean(environment_default.isDev())
@@ -75878,7 +75878,9 @@ var InternalBuilder = class {
75878
75878
  const [filterTableName, ...otherProperties] = key.split(".");
75879
75879
  const property = otherProperties.join(".");
75880
75880
  const alias = getTableAlias(filterTableName);
75881
- return fn(q2, alias ? `${alias}.${property}` : property, value);
75881
+ return q2.andWhere(
75882
+ (subquery) => fn(subquery, alias ? `${alias}.${property}` : property, value)
75883
+ );
75882
75884
  };
75883
75885
  for (const key in structure) {
75884
75886
  const value = structure[key];
@@ -75903,6 +75905,9 @@ var InternalBuilder = class {
75903
75905
  value
75904
75906
  );
75905
75907
  } else if (shouldProcessRelationship) {
75908
+ if (allOr) {
75909
+ query = query.or;
75910
+ }
75906
75911
  query = builder.addRelationshipForFilter(query, updatedKey, (q2) => {
75907
75912
  return handleRelationship(q2, updatedKey, value);
75908
75913
  });
@@ -76254,6 +76259,12 @@ var InternalBuilder = class {
76254
76259
  }
76255
76260
  return query;
76256
76261
  }
76262
+ isAggregateField(field) {
76263
+ const found = this.query.resource?.aggregations?.find(
76264
+ (aggregation) => aggregation.name === field
76265
+ );
76266
+ return !!found;
76267
+ }
76257
76268
  addSorting(query) {
76258
76269
  let { sort: sort2, resource } = this.query;
76259
76270
  const primaryKey = this.table.primary;
@@ -76268,13 +76279,17 @@ var InternalBuilder = class {
76268
76279
  if (this.client === "pg" /* POSTGRES */ || this.client === "oracledb" /* ORACLE */) {
76269
76280
  nulls = value.direction === "ascending" /* ASCENDING */ ? "first" : "last";
76270
76281
  }
76271
- let composite = `${aliased}.${key}`;
76272
- if (this.client === "oracledb" /* ORACLE */) {
76273
- query = query.orderByRaw(
76274
- `${this.convertClobs(composite)} ${direction} nulls ${nulls}`
76275
- );
76282
+ if (this.isAggregateField(key)) {
76283
+ query = query.orderBy(key, direction, nulls);
76276
76284
  } else {
76277
- query = query.orderBy(composite, direction, nulls);
76285
+ let composite = `${aliased}.${key}`;
76286
+ if (this.client === "oracledb" /* ORACLE */) {
76287
+ query = query.orderByRaw(
76288
+ `${this.convertClobs(composite)} ${direction} nulls ${nulls}`
76289
+ );
76290
+ } else {
76291
+ query = query.orderBy(composite, direction, nulls);
76292
+ }
76278
76293
  }
76279
76294
  }
76280
76295
  }