@budibase/backend-core 2.29.14 → 2.29.15

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
@@ -55187,16 +55187,12 @@ var buildQuery = (filter) => {
55187
55187
  query.equal = query.equal || {};
55188
55188
  query.equal[field] = true;
55189
55189
  } else {
55190
- query[queryOperator] = {
55191
- ...query[queryOperator],
55192
- [field]: value
55193
- };
55190
+ query[queryOperator] ??= {};
55191
+ query[queryOperator][field] = value;
55194
55192
  }
55195
55193
  } else {
55196
- query[queryOperator] = {
55197
- ...query[queryOperator],
55198
- [field]: value
55199
- };
55194
+ query[queryOperator] ??= {};
55195
+ query[queryOperator][field] = value;
55200
55196
  }
55201
55197
  }
55202
55198
  });
@@ -67690,15 +67686,24 @@ var InternalBuilder = class {
67690
67686
  const alias = opts.aliases?.[name];
67691
67687
  return alias || name;
67692
67688
  }
67693
- function iterate(structure, fn) {
67694
- for (let [key, value] of Object.entries(structure)) {
67689
+ function iterate(structure, fn, complexKeyFn) {
67690
+ for (const key in structure) {
67691
+ const value = structure[key];
67695
67692
  const updatedKey = removeKeyNumbering2(key);
67696
67693
  const isRelationshipField = updatedKey.includes(".");
67697
- if (!opts.relationship && !isRelationshipField) {
67694
+ let castedTypeValue;
67695
+ if (key === "_complexIdOperator" /* COMPLEX_ID_OPERATOR */ && (castedTypeValue = structure[key]) && complexKeyFn) {
67696
+ const alias = getTableAlias(tableName);
67697
+ complexKeyFn(
67698
+ castedTypeValue.id.map(
67699
+ (x) => alias ? `${alias}.${x}` : x
67700
+ ),
67701
+ castedTypeValue.values
67702
+ );
67703
+ } else if (!opts.relationship && !isRelationshipField) {
67698
67704
  const alias = getTableAlias(tableName);
67699
67705
  fn(alias ? `${alias}.${updatedKey}` : updatedKey, value);
67700
- }
67701
- if (opts.relationship && isRelationshipField) {
67706
+ } else if (opts.relationship && isRelationshipField) {
67702
67707
  const [filterTableName, property] = updatedKey.split(".");
67703
67708
  const alias = getTableAlias(filterTableName);
67704
67709
  fn(alias ? `${alias}.${property}` : property, value);
@@ -67771,10 +67776,16 @@ var InternalBuilder = class {
67771
67776
  }
67772
67777
  };
67773
67778
  if (filters.oneOf) {
67774
- iterate(filters.oneOf, (key, array) => {
67775
- const fnc = allOr ? "orWhereIn" : "whereIn";
67776
- query = query[fnc](key, Array.isArray(array) ? array : [array]);
67777
- });
67779
+ const fnc = allOr ? "orWhereIn" : "whereIn";
67780
+ iterate(
67781
+ filters.oneOf,
67782
+ (key, array) => {
67783
+ query = query[fnc](key, Array.isArray(array) ? array : [array]);
67784
+ },
67785
+ (key, array) => {
67786
+ query = query[fnc](key, Array.isArray(array) ? array : [array]);
67787
+ }
67788
+ );
67778
67789
  }
67779
67790
  if (filters.string) {
67780
67791
  iterate(filters.string, (key, value) => {