@budibase/shared-core 3.0.3 → 3.1.0

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/filters.d.ts CHANGED
@@ -18,7 +18,6 @@ export declare const getValidOperatorsForType: (fieldType: {
18
18
  */
19
19
  export declare const NoEmptyFilterStrings: (keyof SearchQueryFields)[];
20
20
  export declare function recurseLogicalOperators(filters: SearchFilters, fn: (f: SearchFilters) => SearchFilters): SearchFilters;
21
- export declare function recurseSearchFilters(filters: SearchFilters, processFn: (filter: SearchFilters) => SearchFilters): SearchFilters;
22
21
  /**
23
22
  * Removes any fields that contain empty strings that would cause inconsistent
24
23
  * behaviour with how backend tables are filtered (no value means no filter).
package/dist/index.js CHANGED
@@ -17636,7 +17636,6 @@ __export(filters_exports, {
17636
17636
  hasFilters: () => hasFilters,
17637
17637
  limit: () => limit,
17638
17638
  recurseLogicalOperators: () => recurseLogicalOperators,
17639
- recurseSearchFilters: () => recurseSearchFilters,
17640
17639
  removeKeyNumbering: () => removeKeyNumbering,
17641
17640
  runQuery: () => runQuery,
17642
17641
  search: () => search,
@@ -17667,8 +17666,12 @@ var FILTER_ALLOWED_KEYS = [
17667
17666
  "noValue",
17668
17667
  "formulaType"
17669
17668
  ];
17670
- function unreachable(value, message = `No such case in exhaustive switch: ${value}`) {
17671
- throw new Error(message);
17669
+ function unreachable(value, opts) {
17670
+ const message = opts?.message || `No such case in exhaustive switch: ${value}`;
17671
+ const doNotThrow = !!opts?.doNotThrow;
17672
+ if (!doNotThrow) {
17673
+ throw new Error(message);
17674
+ }
17672
17675
  }
17673
17676
  async function parallelForeach(items, task, maxConcurrency) {
17674
17677
  const promises = [];
@@ -18132,17 +18135,6 @@ function recurseLogicalOperators(filters, fn) {
18132
18135
  }
18133
18136
  return filters;
18134
18137
  }
18135
- function recurseSearchFilters(filters, processFn) {
18136
- filters = processFn(filters);
18137
- for (const logical of LOGICAL_OPERATORS) {
18138
- if (filters[logical]) {
18139
- filters[logical].conditions = filters[logical].conditions.map(
18140
- (condition) => recurseSearchFilters(condition, processFn)
18141
- );
18142
- }
18143
- }
18144
- return filters;
18145
- }
18146
18138
  var cleanupQuery = (query) => {
18147
18139
  for (let filterField of NoEmptyFilterStrings) {
18148
18140
  if (!query[filterField]) {