@budibase/backend-core 2.29.15 → 2.29.16
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 +100 -60
- package/dist/index.js.map +4 -4
- package/dist/index.js.meta.json +1 -1
- package/dist/package.json +4 -4
- package/dist/plugins.js.meta.json +1 -1
- package/dist/src/db/utils.d.ts +1 -0
- package/dist/src/db/utils.js +19 -0
- package/dist/src/db/utils.js.map +1 -1
- package/dist/src/environment.d.ts +2 -0
- package/dist/src/environment.js +2 -1
- package/dist/src/environment.js.map +1 -1
- package/dist/src/users/users.js +3 -3
- package/dist/src/users/users.js.map +1 -1
- package/package.json +4 -4
- package/src/db/utils.ts +26 -0
- package/src/environment.ts +3 -0
- package/src/users/users.ts +5 -4
package/dist/index.js
CHANGED
|
@@ -61,7 +61,7 @@ var require_dayjs_min = __commonJS({
|
|
|
61
61
|
} }, g = "en", D = {};
|
|
62
62
|
D[g] = M;
|
|
63
63
|
var p = "$isDayjsObject", S = function(t2) {
|
|
64
|
-
return t2 instanceof
|
|
64
|
+
return t2 instanceof _2 || !(!t2 || !t2[p]);
|
|
65
65
|
}, w = function t2(e2, n2, r2) {
|
|
66
66
|
var i2;
|
|
67
67
|
if (!e2)
|
|
@@ -81,12 +81,12 @@ var require_dayjs_min = __commonJS({
|
|
|
81
81
|
if (S(t2))
|
|
82
82
|
return t2.clone();
|
|
83
83
|
var n2 = "object" == typeof e2 ? e2 : {};
|
|
84
|
-
return n2.date = t2, n2.args = arguments, new
|
|
84
|
+
return n2.date = t2, n2.args = arguments, new _2(n2);
|
|
85
85
|
}, b = v;
|
|
86
86
|
b.l = w, b.i = S, b.w = function(t2, e2) {
|
|
87
87
|
return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
|
|
88
88
|
};
|
|
89
|
-
var
|
|
89
|
+
var _2 = function() {
|
|
90
90
|
function M2(t2) {
|
|
91
91
|
this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
|
|
92
92
|
}
|
|
@@ -311,13 +311,13 @@ var require_dayjs_min = __commonJS({
|
|
|
311
311
|
}, m2.toString = function() {
|
|
312
312
|
return this.$d.toUTCString();
|
|
313
313
|
}, M2;
|
|
314
|
-
}(), k =
|
|
314
|
+
}(), k = _2.prototype;
|
|
315
315
|
return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach(function(t2) {
|
|
316
316
|
k[t2[1]] = function(e2) {
|
|
317
317
|
return this.$g(e2, t2[0], t2[1]);
|
|
318
318
|
};
|
|
319
319
|
}), O.extend = function(t2, e2) {
|
|
320
|
-
return t2.$i || (t2(e2,
|
|
320
|
+
return t2.$i || (t2(e2, _2, O), t2.$i = true), O;
|
|
321
321
|
}, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
|
|
322
322
|
return O(1e3 * t2);
|
|
323
323
|
}, O.en = D[g], O.Ls = D, O.p = {}, O;
|
|
@@ -797,12 +797,12 @@ var require_nanoclone = __commonJS({
|
|
|
797
797
|
var map;
|
|
798
798
|
try {
|
|
799
799
|
map = Map;
|
|
800
|
-
} catch (
|
|
800
|
+
} catch (_2) {
|
|
801
801
|
}
|
|
802
802
|
var set2;
|
|
803
803
|
try {
|
|
804
804
|
set2 = Set;
|
|
805
|
-
} catch (
|
|
805
|
+
} catch (_2) {
|
|
806
806
|
}
|
|
807
807
|
function baseClone(src, circulars, clones) {
|
|
808
808
|
if (!src || typeof src !== "object" || typeof src === "function") {
|
|
@@ -1110,7 +1110,7 @@ var require_ValidationError = __commonJS({
|
|
|
1110
1110
|
path: path3
|
|
1111
1111
|
});
|
|
1112
1112
|
if (typeof message === "string")
|
|
1113
|
-
return message.replace(strReg, (
|
|
1113
|
+
return message.replace(strReg, (_2, key) => (0, _printValue.default)(params2[key]));
|
|
1114
1114
|
if (typeof message === "function")
|
|
1115
1115
|
return message(params2);
|
|
1116
1116
|
return message;
|
|
@@ -2989,7 +2989,7 @@ var require_object = __commonJS({
|
|
|
2989
2989
|
return;
|
|
2990
2990
|
}
|
|
2991
2991
|
originalValue = originalValue || value;
|
|
2992
|
-
let tests = this._nodes.map((key) => (
|
|
2992
|
+
let tests = this._nodes.map((key) => (_2, cb) => {
|
|
2993
2993
|
let path3 = key.indexOf(".") === -1 ? (opts.path ? `${opts.path}.` : "") + key : `${opts.path || ""}["${key}"]`;
|
|
2994
2994
|
let field = this.fields[key];
|
|
2995
2995
|
if (field && "validate" in field) {
|
|
@@ -3133,7 +3133,7 @@ var require_object = __commonJS({
|
|
|
3133
3133
|
return this.noUnknown(!allow, message);
|
|
3134
3134
|
}
|
|
3135
3135
|
transformKeys(fn) {
|
|
3136
|
-
return this.transform((obj) => obj && (0, _mapKeys.default)(obj, (
|
|
3136
|
+
return this.transform((obj) => obj && (0, _mapKeys.default)(obj, (_2, key) => fn(key)));
|
|
3137
3137
|
}
|
|
3138
3138
|
camelCase() {
|
|
3139
3139
|
return this.transformKeys(_camelCase.default);
|
|
@@ -3266,7 +3266,7 @@ var require_array = __commonJS({
|
|
|
3266
3266
|
index: idx,
|
|
3267
3267
|
originalValue: originalValue[idx]
|
|
3268
3268
|
});
|
|
3269
|
-
tests[idx] = (
|
|
3269
|
+
tests[idx] = (_2, cb) => innerType.validate(item, innerOptions, cb);
|
|
3270
3270
|
}
|
|
3271
3271
|
(0, _runTests.default)({
|
|
3272
3272
|
sync,
|
|
@@ -5333,7 +5333,7 @@ var require_extend = __commonJS({
|
|
|
5333
5333
|
}
|
|
5334
5334
|
return toStr.call(arr) === "[object Array]";
|
|
5335
5335
|
};
|
|
5336
|
-
var
|
|
5336
|
+
var isPlainObject3 = function isPlainObject4(obj) {
|
|
5337
5337
|
if (!obj || toStr.call(obj) !== "[object Object]") {
|
|
5338
5338
|
return false;
|
|
5339
5339
|
}
|
|
@@ -5390,12 +5390,12 @@ var require_extend = __commonJS({
|
|
|
5390
5390
|
src = getProperty(target, name);
|
|
5391
5391
|
copy = getProperty(options2, name);
|
|
5392
5392
|
if (target !== copy) {
|
|
5393
|
-
if (deep && copy && (
|
|
5393
|
+
if (deep && copy && (isPlainObject3(copy) || (copyIsArray = isArray(copy)))) {
|
|
5394
5394
|
if (copyIsArray) {
|
|
5395
5395
|
copyIsArray = false;
|
|
5396
5396
|
clone = src && isArray(src) ? src : [];
|
|
5397
5397
|
} else {
|
|
5398
|
-
clone = src &&
|
|
5398
|
+
clone = src && isPlainObject3(src) ? src : {};
|
|
5399
5399
|
}
|
|
5400
5400
|
setProperty(target, { name, newValue: extend(deep, clone, copy) });
|
|
5401
5401
|
} else if (typeof copy !== "undefined") {
|
|
@@ -30185,7 +30185,7 @@ var require_jsprim = __commonJS({
|
|
|
30185
30185
|
var mod_jsonschema = require_validate();
|
|
30186
30186
|
exports.deepCopy = deepCopy;
|
|
30187
30187
|
exports.deepEqual = deepEqual;
|
|
30188
|
-
exports.isEmpty =
|
|
30188
|
+
exports.isEmpty = isEmpty3;
|
|
30189
30189
|
exports.hasKey = hasKey;
|
|
30190
30190
|
exports.forEachKey = forEachKey;
|
|
30191
30191
|
exports.pluck = pluck;
|
|
@@ -30255,7 +30255,7 @@ var require_jsprim = __commonJS({
|
|
|
30255
30255
|
}
|
|
30256
30256
|
return true;
|
|
30257
30257
|
}
|
|
30258
|
-
function
|
|
30258
|
+
function isEmpty3(obj) {
|
|
30259
30259
|
var key;
|
|
30260
30260
|
for (key in obj)
|
|
30261
30261
|
return false;
|
|
@@ -41945,7 +41945,7 @@ var require_uri_all = __commonJS({
|
|
|
41945
41945
|
uriTokens.push("@");
|
|
41946
41946
|
}
|
|
41947
41947
|
if (components.host !== void 0) {
|
|
41948
|
-
uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, function(
|
|
41948
|
+
uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, function(_2, $1, $2) {
|
|
41949
41949
|
return "[" + $1 + ($2 ? "%25" + $2 : "") + "]";
|
|
41950
41950
|
}));
|
|
41951
41951
|
}
|
|
@@ -52815,7 +52815,7 @@ var require_xml2js = __commonJS({
|
|
|
52815
52815
|
"../../node_modules/webfinger/node_modules/xml2js/lib/xml2js.js"(exports) {
|
|
52816
52816
|
"use strict";
|
|
52817
52817
|
(function() {
|
|
52818
|
-
var events2,
|
|
52818
|
+
var events2, isEmpty3, sax, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) {
|
|
52819
52819
|
for (var key in parent) {
|
|
52820
52820
|
if (__hasProp.call(parent, key))
|
|
52821
52821
|
child[key] = parent[key];
|
|
@@ -52834,7 +52834,7 @@ var require_xml2js = __commonJS({
|
|
|
52834
52834
|
};
|
|
52835
52835
|
sax = require_sax();
|
|
52836
52836
|
events2 = require("events");
|
|
52837
|
-
|
|
52837
|
+
isEmpty3 = function(thing) {
|
|
52838
52838
|
return typeof thing === "object" && thing != null && Object.keys(thing).length === 0;
|
|
52839
52839
|
};
|
|
52840
52840
|
exports.defaults = {
|
|
@@ -52954,7 +52954,7 @@ var require_xml2js = __commonJS({
|
|
|
52954
52954
|
obj = obj[charkey];
|
|
52955
52955
|
}
|
|
52956
52956
|
}
|
|
52957
|
-
if (_this.options.emptyTag !== void 0 &&
|
|
52957
|
+
if (_this.options.emptyTag !== void 0 && isEmpty3(obj)) {
|
|
52958
52958
|
obj = _this.options.emptyTag;
|
|
52959
52959
|
}
|
|
52960
52960
|
if (_this.options.validator != null) {
|
|
@@ -54461,6 +54461,15 @@ var DatasourceFeature = /* @__PURE__ */ ((DatasourceFeature2) => {
|
|
|
54461
54461
|
return DatasourceFeature2;
|
|
54462
54462
|
})(DatasourceFeature || {});
|
|
54463
54463
|
|
|
54464
|
+
// ../types/src/sdk/search.ts
|
|
54465
|
+
var ArrayOperator = /* @__PURE__ */ ((ArrayOperator2) => {
|
|
54466
|
+
ArrayOperator2["CONTAINS"] = "contains";
|
|
54467
|
+
ArrayOperator2["NOT_CONTAINS"] = "notContains";
|
|
54468
|
+
ArrayOperator2["CONTAINS_ANY"] = "containsAny";
|
|
54469
|
+
ArrayOperator2["ONE_OF"] = "oneOf";
|
|
54470
|
+
return ArrayOperator2;
|
|
54471
|
+
})(ArrayOperator || {});
|
|
54472
|
+
|
|
54464
54473
|
// ../types/src/sdk/db.ts
|
|
54465
54474
|
var isDocument = (doc) => {
|
|
54466
54475
|
return typeof doc === "object" && doc._id && doc._rev;
|
|
@@ -54828,6 +54837,7 @@ __export(filters_exports, {
|
|
|
54828
54837
|
ColumnSplitter: () => ColumnSplitter,
|
|
54829
54838
|
NoEmptyFilterStrings: () => NoEmptyFilterStrings,
|
|
54830
54839
|
buildQuery: () => buildQuery,
|
|
54840
|
+
fixupFilterArrays: () => fixupFilterArrays,
|
|
54831
54841
|
getKeyNumbering: () => getKeyNumbering,
|
|
54832
54842
|
getValidOperatorsForType: () => getValidOperatorsForType,
|
|
54833
54843
|
hasFilters: () => hasFilters,
|
|
@@ -54987,7 +54997,7 @@ function isRequired(constraints) {
|
|
|
54987
54997
|
}
|
|
54988
54998
|
|
|
54989
54999
|
// ../shared-core/src/filters.ts
|
|
54990
|
-
var import_lodash =
|
|
55000
|
+
var import_lodash = require("lodash");
|
|
54991
55001
|
var HBS_REGEX = /{{([^{].*?)}}/g;
|
|
54992
55002
|
var getValidOperatorsForType = (fieldType, field, datasource2) => {
|
|
54993
55003
|
const Op = OperatorOptions;
|
|
@@ -55198,6 +55208,26 @@ var buildQuery = (filter) => {
|
|
|
55198
55208
|
});
|
|
55199
55209
|
return query;
|
|
55200
55210
|
};
|
|
55211
|
+
function fixupFilterArrays(filters) {
|
|
55212
|
+
for (const searchField of Object.values(ArrayOperator)) {
|
|
55213
|
+
const field = filters[searchField];
|
|
55214
|
+
if (field == null || !(0, import_lodash.isPlainObject)(field)) {
|
|
55215
|
+
continue;
|
|
55216
|
+
}
|
|
55217
|
+
for (const key of Object.keys(field)) {
|
|
55218
|
+
if (Array.isArray(field[key])) {
|
|
55219
|
+
continue;
|
|
55220
|
+
}
|
|
55221
|
+
const value = field[key];
|
|
55222
|
+
if (typeof value === "string") {
|
|
55223
|
+
field[key] = value.split(",").map((x) => x.trim());
|
|
55224
|
+
} else {
|
|
55225
|
+
field[key] = [value];
|
|
55226
|
+
}
|
|
55227
|
+
}
|
|
55228
|
+
}
|
|
55229
|
+
return filters;
|
|
55230
|
+
}
|
|
55201
55231
|
var search = (docs, query) => {
|
|
55202
55232
|
let result = runQuery(docs, query.query);
|
|
55203
55233
|
if (query.sort) {
|
|
@@ -55221,6 +55251,7 @@ var runQuery = (docs, query) => {
|
|
|
55221
55251
|
return docs;
|
|
55222
55252
|
}
|
|
55223
55253
|
query = cleanupQuery(query);
|
|
55254
|
+
query = fixupFilterArrays(query);
|
|
55224
55255
|
if (!hasFilters(query) && query.onEmptyFilter === "none" /* RETURN_NONE */) {
|
|
55225
55256
|
return [];
|
|
55226
55257
|
}
|
|
@@ -55265,10 +55296,10 @@ var runQuery = (docs, query) => {
|
|
|
55265
55296
|
if (docValue == null || docValue === "") {
|
|
55266
55297
|
return false;
|
|
55267
55298
|
}
|
|
55268
|
-
if (import_lodash.
|
|
55299
|
+
if ((0, import_lodash.isPlainObject)(testValue.low) && (0, import_lodash.isEmpty)(testValue.low)) {
|
|
55269
55300
|
testValue.low = void 0;
|
|
55270
55301
|
}
|
|
55271
|
-
if (import_lodash.
|
|
55302
|
+
if ((0, import_lodash.isPlainObject)(testValue.high) && (0, import_lodash.isEmpty)(testValue.high)) {
|
|
55272
55303
|
testValue.high = void 0;
|
|
55273
55304
|
}
|
|
55274
55305
|
if (testValue.low == null && testValue.high == null) {
|
|
@@ -55324,10 +55355,7 @@ var runQuery = (docs, query) => {
|
|
|
55324
55355
|
};
|
|
55325
55356
|
const not = (f) => (...args) => !f(...args);
|
|
55326
55357
|
const equalMatch = match("equal" /* EQUAL */, _valueMatches);
|
|
55327
|
-
const notEqualMatch = match(
|
|
55328
|
-
"notEqual" /* NOT_EQUAL */,
|
|
55329
|
-
not(_valueMatches)
|
|
55330
|
-
);
|
|
55358
|
+
const notEqualMatch = match("notEqual" /* NOT_EQUAL */, not(_valueMatches));
|
|
55331
55359
|
const _empty = (docValue) => {
|
|
55332
55360
|
if (typeof docValue === "string") {
|
|
55333
55361
|
return docValue === "";
|
|
@@ -55342,21 +55370,18 @@ var runQuery = (docs, query) => {
|
|
|
55342
55370
|
};
|
|
55343
55371
|
const emptyMatch = match("empty" /* EMPTY */, _empty);
|
|
55344
55372
|
const notEmptyMatch = match("notEmpty" /* NOT_EMPTY */, not(_empty));
|
|
55345
|
-
const oneOf = match(
|
|
55346
|
-
"
|
|
55347
|
-
|
|
55348
|
-
if (typeof testValue === "string") {
|
|
55349
|
-
testValue = testValue.split(",");
|
|
55350
|
-
if (typeof docValue === "number") {
|
|
55351
|
-
testValue = testValue.map((item) => parseFloat(item));
|
|
55352
|
-
}
|
|
55353
|
-
}
|
|
55354
|
-
if (!Array.isArray(testValue)) {
|
|
55355
|
-
return false;
|
|
55356
|
-
}
|
|
55357
|
-
return testValue.some((item) => _valueMatches(docValue, item));
|
|
55373
|
+
const oneOf = match("oneOf" /* ONE_OF */, (docValue, testValue) => {
|
|
55374
|
+
if (typeof testValue === "string") {
|
|
55375
|
+
testValue = testValue.split(",");
|
|
55358
55376
|
}
|
|
55359
|
-
|
|
55377
|
+
if (typeof docValue === "number") {
|
|
55378
|
+
testValue = testValue.map((item) => parseFloat(item));
|
|
55379
|
+
}
|
|
55380
|
+
if (!Array.isArray(testValue)) {
|
|
55381
|
+
return false;
|
|
55382
|
+
}
|
|
55383
|
+
return testValue.some((item) => _valueMatches(docValue, item));
|
|
55384
|
+
});
|
|
55360
55385
|
const _contains = (f) => (docValue, testValue) => {
|
|
55361
55386
|
if (!Array.isArray(docValue)) {
|
|
55362
55387
|
return false;
|
|
@@ -55393,10 +55418,7 @@ var runQuery = (docs, query) => {
|
|
|
55393
55418
|
return not(_contains("every"))(docValue, testValue);
|
|
55394
55419
|
}
|
|
55395
55420
|
);
|
|
55396
|
-
const containsAny = match(
|
|
55397
|
-
"containsAny" /* CONTAINS_ANY */,
|
|
55398
|
-
_contains("some")
|
|
55399
|
-
);
|
|
55421
|
+
const containsAny = match("containsAny" /* CONTAINS_ANY */, _contains("some"));
|
|
55400
55422
|
const docMatch = (doc) => {
|
|
55401
55423
|
const filterFunctions = {
|
|
55402
55424
|
string: stringMatch,
|
|
@@ -55581,7 +55603,7 @@ __export(users_exports, {
|
|
|
55581
55603
|
isCreator: () => isCreator,
|
|
55582
55604
|
isGlobalBuilder: () => isGlobalBuilder
|
|
55583
55605
|
});
|
|
55584
|
-
var
|
|
55606
|
+
var _ = __toESM(require("lodash/fp"));
|
|
55585
55607
|
function isBuilder(user, appId) {
|
|
55586
55608
|
if (!user) {
|
|
55587
55609
|
return false;
|
|
@@ -55623,10 +55645,10 @@ function hasAppCreatorPermissions(user) {
|
|
|
55623
55645
|
if (!user) {
|
|
55624
55646
|
return false;
|
|
55625
55647
|
}
|
|
55626
|
-
return
|
|
55627
|
-
|
|
55628
|
-
|
|
55629
|
-
|
|
55648
|
+
return _.flow(
|
|
55649
|
+
_.get("roles"),
|
|
55650
|
+
_.values,
|
|
55651
|
+
_.find((x) => ["CREATOR", "ADMIN"].includes(x)),
|
|
55630
55652
|
(x) => !!x
|
|
55631
55653
|
)(user);
|
|
55632
55654
|
}
|
|
@@ -56018,6 +56040,8 @@ var environment = {
|
|
|
56018
56040
|
COUCH_DB_URL: process.env.COUCH_DB_URL || "http://localhost:4005",
|
|
56019
56041
|
COUCH_DB_SQL_URL: process.env.COUCH_DB_SQL_URL || "http://localhost:4006",
|
|
56020
56042
|
SQS_SEARCH_ENABLE: process.env.SQS_SEARCH_ENABLE,
|
|
56043
|
+
SQS_SEARCH_ENABLE_TENANTS: process.env.SQS_SEARCH_ENABLE_TENANTS?.split(",") || [],
|
|
56044
|
+
SQS_MIGRATION_ENABLE: process.env.SQS_MIGRATION_ENABLE,
|
|
56021
56045
|
COUCH_DB_USERNAME: process.env.COUCH_DB_USER,
|
|
56022
56046
|
COUCH_DB_PASSWORD: process.env.COUCH_DB_PASSWORD,
|
|
56023
56047
|
GOOGLE_CLIENT_ID: process.env.GOOGLE_CLIENT_ID,
|
|
@@ -56617,6 +56641,7 @@ __export(db_exports, {
|
|
|
56617
56641
|
isGlobalUserID: () => isGlobalUserID,
|
|
56618
56642
|
isProdAppID: () => isProdAppID,
|
|
56619
56643
|
isSameAppID: () => isSameAppID,
|
|
56644
|
+
isSqsEnabledForTenant: () => isSqsEnabledForTenant,
|
|
56620
56645
|
isTableId: () => isTableId,
|
|
56621
56646
|
paginatedSearch: () => paginatedSearch,
|
|
56622
56647
|
pagination: () => pagination,
|
|
@@ -57557,7 +57582,7 @@ function getLogReadStream() {
|
|
|
57557
57582
|
}
|
|
57558
57583
|
|
|
57559
57584
|
// src/logging/pino/logger.ts
|
|
57560
|
-
function
|
|
57585
|
+
function isPlainObject2(obj) {
|
|
57561
57586
|
return typeof obj === "object" && obj !== null && !(obj instanceof Error);
|
|
57562
57587
|
}
|
|
57563
57588
|
function isError(obj) {
|
|
@@ -57609,7 +57634,7 @@ if (!environment_default.DISABLE_PINO_LOGGER) {
|
|
|
57609
57634
|
if (isMessage(arg)) {
|
|
57610
57635
|
message = `${message} ${arg}`.trimStart();
|
|
57611
57636
|
}
|
|
57612
|
-
if (
|
|
57637
|
+
if (isPlainObject2(arg)) {
|
|
57613
57638
|
objects.push(arg);
|
|
57614
57639
|
}
|
|
57615
57640
|
if (isError(arg)) {
|
|
@@ -58517,6 +58542,21 @@ function pagination(data, pageSize, {
|
|
|
58517
58542
|
nextPage
|
|
58518
58543
|
};
|
|
58519
58544
|
}
|
|
58545
|
+
function isSqsEnabledForTenant() {
|
|
58546
|
+
const tenantId = getTenantId();
|
|
58547
|
+
if (!environment_default.SQS_SEARCH_ENABLE) {
|
|
58548
|
+
return false;
|
|
58549
|
+
}
|
|
58550
|
+
if (environment_default.isTest() && environment_default.SQS_SEARCH_ENABLE_TENANTS.length === 0) {
|
|
58551
|
+
throw new Error(
|
|
58552
|
+
"to enable SQS you must specify a list of tenants in the SQS_SEARCH_ENABLE_TENANTS env var"
|
|
58553
|
+
);
|
|
58554
|
+
}
|
|
58555
|
+
if (environment_default.SQS_SEARCH_ENABLE_TENANTS.length === 1 && environment_default.SQS_SEARCH_ENABLE_TENANTS[0] === "*") {
|
|
58556
|
+
return true;
|
|
58557
|
+
}
|
|
58558
|
+
return environment_default.SQS_SEARCH_ENABLE_TENANTS.includes(tenantId);
|
|
58559
|
+
}
|
|
58520
58560
|
|
|
58521
58561
|
// src/db/views.ts
|
|
58522
58562
|
var DESIGN_DB = "_design/database";
|
|
@@ -58746,7 +58786,7 @@ var Replication_default = Replication;
|
|
|
58746
58786
|
// src/db/lucene.ts
|
|
58747
58787
|
var import_node_fetch3 = __toESM(require("node-fetch"));
|
|
58748
58788
|
var removeKeyNumbering2 = filters_exports.removeKeyNumbering;
|
|
58749
|
-
function
|
|
58789
|
+
function isEmpty2(value) {
|
|
58750
58790
|
return value == null || value === "";
|
|
58751
58791
|
}
|
|
58752
58792
|
var QueryBuilder = class _QueryBuilder {
|
|
@@ -58969,13 +59009,13 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
58969
59009
|
delete this.#query.equal.tableId;
|
|
58970
59010
|
}
|
|
58971
59011
|
const equal = (key, value) => {
|
|
58972
|
-
if (
|
|
59012
|
+
if (isEmpty2(value)) {
|
|
58973
59013
|
return null;
|
|
58974
59014
|
}
|
|
58975
59015
|
return `${key}:${builder.preprocess(value, allPreProcessingOpts)}`;
|
|
58976
59016
|
};
|
|
58977
59017
|
const contains = (key, value, mode = "AND") => {
|
|
58978
|
-
if (
|
|
59018
|
+
if (isEmpty2(value)) {
|
|
58979
59019
|
return null;
|
|
58980
59020
|
}
|
|
58981
59021
|
if (!Array.isArray(value)) {
|
|
@@ -58990,7 +59030,7 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
58990
59030
|
return `${key}:(${statement})`;
|
|
58991
59031
|
};
|
|
58992
59032
|
const fuzzy = (key, value) => {
|
|
58993
|
-
if (
|
|
59033
|
+
if (isEmpty2(value)) {
|
|
58994
59034
|
return null;
|
|
58995
59035
|
}
|
|
58996
59036
|
value = builder.preprocess(value, {
|
|
@@ -59009,7 +59049,7 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
59009
59049
|
return contains(key, value, "OR");
|
|
59010
59050
|
};
|
|
59011
59051
|
const oneOf = (key, value) => {
|
|
59012
|
-
if (
|
|
59052
|
+
if (isEmpty2(value)) {
|
|
59013
59053
|
return `*:*`;
|
|
59014
59054
|
}
|
|
59015
59055
|
if (!Array.isArray(value)) {
|
|
@@ -59056,7 +59096,7 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
59056
59096
|
}
|
|
59057
59097
|
if (this.#query.string) {
|
|
59058
59098
|
build(this.#query.string, (key, value) => {
|
|
59059
|
-
if (
|
|
59099
|
+
if (isEmpty2(value)) {
|
|
59060
59100
|
return null;
|
|
59061
59101
|
}
|
|
59062
59102
|
value = builder.preprocess(value, {
|
|
@@ -59069,7 +59109,7 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
59069
59109
|
}
|
|
59070
59110
|
if (this.#query.range) {
|
|
59071
59111
|
build(this.#query.range, (key, value) => {
|
|
59072
|
-
if (
|
|
59112
|
+
if (isEmpty2(value)) {
|
|
59073
59113
|
return null;
|
|
59074
59114
|
}
|
|
59075
59115
|
if (value.low == null || value.low === "") {
|
|
@@ -59091,7 +59131,7 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
59091
59131
|
}
|
|
59092
59132
|
if (this.#query.notEqual) {
|
|
59093
59133
|
build(this.#query.notEqual, (key, value) => {
|
|
59094
|
-
if (
|
|
59134
|
+
if (isEmpty2(value)) {
|
|
59095
59135
|
return null;
|
|
59096
59136
|
}
|
|
59097
59137
|
if (typeof value === "boolean") {
|