@budibase/backend-core 2.29.16 → 2.29.18

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
@@ -54837,6 +54837,7 @@ __export(filters_exports, {
54837
54837
  ColumnSplitter: () => ColumnSplitter,
54838
54838
  NoEmptyFilterStrings: () => NoEmptyFilterStrings,
54839
54839
  buildQuery: () => buildQuery,
54840
+ cleanupQuery: () => cleanupQuery,
54840
54841
  fixupFilterArrays: () => fixupFilterArrays,
54841
54842
  getKeyNumbering: () => getKeyNumbering,
54842
54843
  getValidOperatorsForType: () => getValidOperatorsForType,
@@ -55054,25 +55055,37 @@ var NoEmptyFilterStrings = [
55054
55055
  OperatorOptions.Equals.value,
55055
55056
  OperatorOptions.NotEquals.value,
55056
55057
  OperatorOptions.Contains.value,
55057
- OperatorOptions.NotContains.value
55058
+ OperatorOptions.NotContains.value,
55059
+ OperatorOptions.ContainsAny.value,
55060
+ OperatorOptions.In.value
55058
55061
  ];
55059
55062
  var cleanupQuery = (query) => {
55060
55063
  if (!query) {
55061
55064
  return query;
55062
55065
  }
55063
55066
  for (let filterField of NoEmptyFilterStrings) {
55064
- const operator = filterField;
55065
- if (!query[operator]) {
55067
+ if (!query[filterField]) {
55066
55068
  continue;
55067
55069
  }
55068
- for (let [key, value] of Object.entries(query[operator])) {
55069
- if (value == null || value === "") {
55070
- delete query[operator][key];
55070
+ for (let filterType of Object.keys(query)) {
55071
+ if (filterType !== filterField) {
55072
+ continue;
55073
+ }
55074
+ const value = query[filterType];
55075
+ if (typeof value === "object") {
55076
+ for (let [key, value2] of Object.entries(query[filterType])) {
55077
+ if (value2 == null || value2 === "" || isEmptyArray(value2)) {
55078
+ delete query[filterField][key];
55079
+ }
55080
+ }
55071
55081
  }
55072
55082
  }
55073
55083
  }
55074
55084
  return query;
55075
55085
  };
55086
+ function isEmptyArray(value) {
55087
+ return Array.isArray(value) && value.length === 0;
55088
+ }
55076
55089
  var removeKeyNumbering = (key) => {
55077
55090
  return getKeyNumbering(key).key;
55078
55091
  };
@@ -56038,7 +56051,7 @@ var environment = {
56038
56051
  ENCRYPTION_KEY: process.env.ENCRYPTION_KEY,
56039
56052
  API_ENCRYPTION_KEY: getAPIEncryptionKey(),
56040
56053
  COUCH_DB_URL: process.env.COUCH_DB_URL || "http://localhost:4005",
56041
- COUCH_DB_SQL_URL: process.env.COUCH_DB_SQL_URL || "http://localhost:4006",
56054
+ COUCH_DB_SQL_URL: process.env.COUCH_DB_SQL_URL,
56042
56055
  SQS_SEARCH_ENABLE: process.env.SQS_SEARCH_ENABLE,
56043
56056
  SQS_SEARCH_ENABLE_TENANTS: process.env.SQS_SEARCH_ENABLE_TENANTS?.split(",") || [],
56044
56057
  SQS_MIGRATION_ENABLE: process.env.SQS_MIGRATION_ENABLE,
@@ -56225,7 +56238,9 @@ var getCouchInfo = (connection) => {
56225
56238
  }
56226
56239
  const authCookie = Buffer.from(`${username}:${password}`).toString("base64");
56227
56240
  let sqlUrl = environment_default.COUCH_DB_SQL_URL;
56228
- if (!sqlUrl && urlInfo.url) {
56241
+ if (environment_default.isDev() && !sqlUrl) {
56242
+ sqlUrl = "http://localhost:4006";
56243
+ } else if (!sqlUrl && urlInfo.url) {
56229
56244
  const parsed = new URL(urlInfo.url);
56230
56245
  sqlUrl = urlInfo.url.replace(parsed.port, "4984");
56231
56246
  }
@@ -58547,6 +58562,9 @@ function isSqsEnabledForTenant() {
58547
58562
  if (!environment_default.SQS_SEARCH_ENABLE) {
58548
58563
  return false;
58549
58564
  }
58565
+ if (!isMultiTenant()) {
58566
+ return true;
58567
+ }
58550
58568
  if (environment_default.isTest() && environment_default.SQS_SEARCH_ENABLE_TENANTS.length === 0) {
58551
58569
  throw new Error(
58552
58570
  "to enable SQS you must specify a list of tenants in the SQS_SEARCH_ENABLE_TENANTS env var"