@budibase/backend-core 2.9.26-alpha.3 → 2.9.28
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 +330 -267
- 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 +1 -1
- package/dist/plugins.js.map +2 -2
- package/dist/plugins.js.meta.json +1 -1
- package/dist/tests.js +260 -222
- package/dist/tests.js.map +4 -4
- package/dist/tests.js.meta.json +1 -1
- package/package.json +4 -4
package/dist/tests.js
CHANGED
|
@@ -29,6 +29,28 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
29
|
mod
|
|
30
30
|
));
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
+
var __accessCheck = (obj, member, msg) => {
|
|
33
|
+
if (!member.has(obj))
|
|
34
|
+
throw TypeError("Cannot " + msg);
|
|
35
|
+
};
|
|
36
|
+
var __privateGet = (obj, member, getter) => {
|
|
37
|
+
__accessCheck(obj, member, "read from private field");
|
|
38
|
+
return getter ? getter.call(obj) : member.get(obj);
|
|
39
|
+
};
|
|
40
|
+
var __privateAdd = (obj, member, value) => {
|
|
41
|
+
if (member.has(obj))
|
|
42
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
43
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
44
|
+
};
|
|
45
|
+
var __privateSet = (obj, member, value, setter) => {
|
|
46
|
+
__accessCheck(obj, member, "write to private field");
|
|
47
|
+
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
48
|
+
return value;
|
|
49
|
+
};
|
|
50
|
+
var __privateMethod = (obj, member, method) => {
|
|
51
|
+
__accessCheck(obj, member, "access private method");
|
|
52
|
+
return method;
|
|
53
|
+
};
|
|
32
54
|
|
|
33
55
|
// ../types/src/sdk/automations/index.ts
|
|
34
56
|
var init_automations = __esm({
|
|
@@ -649,13 +671,6 @@ var init_permissions = __esm({
|
|
|
649
671
|
}
|
|
650
672
|
});
|
|
651
673
|
|
|
652
|
-
// ../types/src/sdk/row.ts
|
|
653
|
-
var init_row = __esm({
|
|
654
|
-
"../types/src/sdk/row.ts"() {
|
|
655
|
-
"use strict";
|
|
656
|
-
}
|
|
657
|
-
});
|
|
658
|
-
|
|
659
674
|
// ../types/src/sdk/index.ts
|
|
660
675
|
var init_sdk = __esm({
|
|
661
676
|
"../types/src/sdk/index.ts"() {
|
|
@@ -681,7 +696,6 @@ var init_sdk = __esm({
|
|
|
681
696
|
init_cli();
|
|
682
697
|
init_websocket();
|
|
683
698
|
init_permissions();
|
|
684
|
-
init_row();
|
|
685
699
|
}
|
|
686
700
|
});
|
|
687
701
|
|
|
@@ -856,7 +870,7 @@ var init_document = __esm({
|
|
|
856
870
|
});
|
|
857
871
|
|
|
858
872
|
// ../types/src/documents/app/row.ts
|
|
859
|
-
var
|
|
873
|
+
var init_row = __esm({
|
|
860
874
|
"../types/src/documents/app/row.ts"() {
|
|
861
875
|
"use strict";
|
|
862
876
|
}
|
|
@@ -911,7 +925,7 @@ var init_app3 = __esm({
|
|
|
911
925
|
init_screen2();
|
|
912
926
|
init_view2();
|
|
913
927
|
init_document();
|
|
914
|
-
|
|
928
|
+
init_row();
|
|
915
929
|
init_user4();
|
|
916
930
|
init_backup2();
|
|
917
931
|
init_webhook();
|
|
@@ -1197,7 +1211,7 @@ var init_datasource3 = __esm({
|
|
|
1197
1211
|
});
|
|
1198
1212
|
|
|
1199
1213
|
// ../types/src/api/web/app/row.ts
|
|
1200
|
-
var
|
|
1214
|
+
var init_row2 = __esm({
|
|
1201
1215
|
"../types/src/api/web/app/row.ts"() {
|
|
1202
1216
|
"use strict";
|
|
1203
1217
|
}
|
|
@@ -1230,7 +1244,7 @@ var init_app4 = __esm({
|
|
|
1230
1244
|
"use strict";
|
|
1231
1245
|
init_backup3();
|
|
1232
1246
|
init_datasource3();
|
|
1233
|
-
|
|
1247
|
+
init_row2();
|
|
1234
1248
|
init_view3();
|
|
1235
1249
|
init_rows2();
|
|
1236
1250
|
init_table4();
|
|
@@ -1323,13 +1337,6 @@ var init_pagination = __esm({
|
|
|
1323
1337
|
}
|
|
1324
1338
|
});
|
|
1325
1339
|
|
|
1326
|
-
// ../types/src/api/web/searchFilter.ts
|
|
1327
|
-
var init_searchFilter = __esm({
|
|
1328
|
-
"../types/src/api/web/searchFilter.ts"() {
|
|
1329
|
-
"use strict";
|
|
1330
|
-
}
|
|
1331
|
-
});
|
|
1332
|
-
|
|
1333
1340
|
// ../types/src/api/web/index.ts
|
|
1334
1341
|
var init_web = __esm({
|
|
1335
1342
|
"../types/src/api/web/index.ts"() {
|
|
@@ -1344,7 +1351,6 @@ var init_web = __esm({
|
|
|
1344
1351
|
init_app4();
|
|
1345
1352
|
init_global2();
|
|
1346
1353
|
init_pagination();
|
|
1347
|
-
init_searchFilter();
|
|
1348
1354
|
}
|
|
1349
1355
|
});
|
|
1350
1356
|
|
|
@@ -1653,15 +1659,12 @@ var init_identity = __esm({
|
|
|
1653
1659
|
});
|
|
1654
1660
|
|
|
1655
1661
|
// src/context/Context.ts
|
|
1656
|
-
var import_async_hooks, Context;
|
|
1662
|
+
var import_async_hooks, _Context, Context;
|
|
1657
1663
|
var init_Context = __esm({
|
|
1658
1664
|
"src/context/Context.ts"() {
|
|
1659
1665
|
"use strict";
|
|
1660
1666
|
import_async_hooks = require("async_hooks");
|
|
1661
|
-
|
|
1662
|
-
static {
|
|
1663
|
-
this.storage = new import_async_hooks.AsyncLocalStorage();
|
|
1664
|
-
}
|
|
1667
|
+
_Context = class _Context {
|
|
1665
1668
|
static run(context, func) {
|
|
1666
1669
|
return _Context.storage.run(context, () => func());
|
|
1667
1670
|
}
|
|
@@ -1669,6 +1672,8 @@ var init_Context = __esm({
|
|
|
1669
1672
|
return _Context.storage.getStore();
|
|
1670
1673
|
}
|
|
1671
1674
|
};
|
|
1675
|
+
_Context.storage = new import_async_hooks.AsyncLocalStorage();
|
|
1676
|
+
Context = _Context;
|
|
1672
1677
|
}
|
|
1673
1678
|
});
|
|
1674
1679
|
|
|
@@ -1687,17 +1692,18 @@ var init_connections = __esm({
|
|
|
1687
1692
|
"use strict";
|
|
1688
1693
|
init_environment2();
|
|
1689
1694
|
getCouchInfo = (connection) => {
|
|
1695
|
+
var _a, _b;
|
|
1690
1696
|
const urlInfo = getUrlInfo(connection);
|
|
1691
1697
|
let username;
|
|
1692
1698
|
let password;
|
|
1693
|
-
if (urlInfo.auth
|
|
1699
|
+
if ((_a = urlInfo.auth) == null ? void 0 : _a.username) {
|
|
1694
1700
|
username = urlInfo.auth.username;
|
|
1695
1701
|
} else if (environment_default.COUCH_DB_USERNAME) {
|
|
1696
1702
|
username = environment_default.COUCH_DB_USERNAME;
|
|
1697
1703
|
} else if (!environment_default.isTest()) {
|
|
1698
1704
|
throw new Error("CouchDB username not set");
|
|
1699
1705
|
}
|
|
1700
|
-
if (urlInfo.auth
|
|
1706
|
+
if ((_b = urlInfo.auth) == null ? void 0 : _b.password) {
|
|
1701
1707
|
password = urlInfo.auth.password;
|
|
1702
1708
|
} else if (environment_default.COUCH_DB_PASSWORD) {
|
|
1703
1709
|
password = environment_default.COUCH_DB_PASSWORD;
|
|
@@ -1890,7 +1896,8 @@ var init_DatabaseImpl = __esm({
|
|
|
1890
1896
|
return this.instanceNano || _DatabaseImpl.nano;
|
|
1891
1897
|
}
|
|
1892
1898
|
async checkSetup() {
|
|
1893
|
-
|
|
1899
|
+
var _a;
|
|
1900
|
+
let shouldCreate = !((_a = this.pouchOpts) == null ? void 0 : _a.skip_setup);
|
|
1894
1901
|
let exists = await this.exists();
|
|
1895
1902
|
if (!shouldCreate && !exists) {
|
|
1896
1903
|
throw new Error("DB does not exist");
|
|
@@ -1966,7 +1973,7 @@ var init_DatabaseImpl = __esm({
|
|
|
1966
1973
|
document.createdAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
1967
1974
|
}
|
|
1968
1975
|
document.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
1969
|
-
if (opts
|
|
1976
|
+
if ((opts == null ? void 0 : opts.force) && document._id) {
|
|
1970
1977
|
try {
|
|
1971
1978
|
const existing = await this.get(document._id);
|
|
1972
1979
|
if (existing) {
|
|
@@ -2135,7 +2142,7 @@ async function doInTenant(tenantId, task) {
|
|
|
2135
2142
|
function getIdentity() {
|
|
2136
2143
|
try {
|
|
2137
2144
|
const context = Context.get();
|
|
2138
|
-
return context
|
|
2145
|
+
return context == null ? void 0 : context.identity;
|
|
2139
2146
|
} catch (e) {
|
|
2140
2147
|
}
|
|
2141
2148
|
}
|
|
@@ -2144,7 +2151,7 @@ function getTenantId() {
|
|
|
2144
2151
|
return DEFAULT_TENANT_ID;
|
|
2145
2152
|
}
|
|
2146
2153
|
const context = Context.get();
|
|
2147
|
-
const tenantId = context
|
|
2154
|
+
const tenantId = context == null ? void 0 : context.tenantId;
|
|
2148
2155
|
if (!tenantId) {
|
|
2149
2156
|
throw new Error("Tenant id not found");
|
|
2150
2157
|
}
|
|
@@ -2152,11 +2159,11 @@ function getTenantId() {
|
|
|
2152
2159
|
}
|
|
2153
2160
|
function getAutomationId() {
|
|
2154
2161
|
const context = Context.get();
|
|
2155
|
-
return context
|
|
2162
|
+
return context == null ? void 0 : context.automationId;
|
|
2156
2163
|
}
|
|
2157
2164
|
function getAppId() {
|
|
2158
2165
|
const context = Context.get();
|
|
2159
|
-
const foundId = context
|
|
2166
|
+
const foundId = context == null ? void 0 : context.appId;
|
|
2160
2167
|
if (!foundId && environment_default.isTest() && TEST_APP_ID) {
|
|
2161
2168
|
return TEST_APP_ID;
|
|
2162
2169
|
} else {
|
|
@@ -2168,11 +2175,11 @@ function getGlobalDB() {
|
|
|
2168
2175
|
if (!context || environment_default.MULTI_TENANCY && !context.tenantId) {
|
|
2169
2176
|
throw new Error("Global DB not found");
|
|
2170
2177
|
}
|
|
2171
|
-
return getDB(baseGlobalDBName(context
|
|
2178
|
+
return getDB(baseGlobalDBName(context == null ? void 0 : context.tenantId));
|
|
2172
2179
|
}
|
|
2173
2180
|
function isScim() {
|
|
2174
2181
|
const context = Context.get();
|
|
2175
|
-
const scimCall = context
|
|
2182
|
+
const scimCall = context == null ? void 0 : context.isScim;
|
|
2176
2183
|
return !!scimCall;
|
|
2177
2184
|
}
|
|
2178
2185
|
var TEST_APP_ID;
|
|
@@ -2843,34 +2850,38 @@ async function runQuery(url, body, cookie) {
|
|
|
2843
2850
|
}
|
|
2844
2851
|
return output;
|
|
2845
2852
|
}
|
|
2846
|
-
var import_node_fetch2, QUERY_START_REGEX, QueryBuilder;
|
|
2853
|
+
var import_node_fetch2, QUERY_START_REGEX, _dbName, _index, _query, _limit, _sort, _bookmark, _sortOrder, _sortType, _includeDocs, _version, _indexBuilder, _noEscaping, _skip, _skipItems, skipItems_fn, _execute, execute_fn, _QueryBuilder, QueryBuilder;
|
|
2847
2854
|
var init_lucene = __esm({
|
|
2848
2855
|
"src/db/lucene.ts"() {
|
|
2849
2856
|
"use strict";
|
|
2850
2857
|
import_node_fetch2 = __toESM(require("node-fetch"));
|
|
2851
2858
|
init_couch();
|
|
2852
2859
|
QUERY_START_REGEX = /\d[0-9]*:/g;
|
|
2853
|
-
|
|
2854
|
-
#dbName;
|
|
2855
|
-
#index;
|
|
2856
|
-
#query;
|
|
2857
|
-
#limit;
|
|
2858
|
-
#sort;
|
|
2859
|
-
#bookmark;
|
|
2860
|
-
#sortOrder;
|
|
2861
|
-
#sortType;
|
|
2862
|
-
#includeDocs;
|
|
2863
|
-
#version;
|
|
2864
|
-
#indexBuilder;
|
|
2865
|
-
#noEscaping = false;
|
|
2866
|
-
#skip;
|
|
2867
|
-
static {
|
|
2868
|
-
this.maxLimit = 200;
|
|
2869
|
-
}
|
|
2860
|
+
_QueryBuilder = class _QueryBuilder {
|
|
2870
2861
|
constructor(dbName, index2, base) {
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2862
|
+
/**
|
|
2863
|
+
* Lucene queries do not support pagination and use bookmarks instead.
|
|
2864
|
+
* For the given builder, walk through pages using bookmarks until the desired
|
|
2865
|
+
* page has been met.
|
|
2866
|
+
*/
|
|
2867
|
+
__privateAdd(this, _skipItems);
|
|
2868
|
+
__privateAdd(this, _execute);
|
|
2869
|
+
__privateAdd(this, _dbName, void 0);
|
|
2870
|
+
__privateAdd(this, _index, void 0);
|
|
2871
|
+
__privateAdd(this, _query, void 0);
|
|
2872
|
+
__privateAdd(this, _limit, void 0);
|
|
2873
|
+
__privateAdd(this, _sort, void 0);
|
|
2874
|
+
__privateAdd(this, _bookmark, void 0);
|
|
2875
|
+
__privateAdd(this, _sortOrder, void 0);
|
|
2876
|
+
__privateAdd(this, _sortType, void 0);
|
|
2877
|
+
__privateAdd(this, _includeDocs, void 0);
|
|
2878
|
+
__privateAdd(this, _version, void 0);
|
|
2879
|
+
__privateAdd(this, _indexBuilder, void 0);
|
|
2880
|
+
__privateAdd(this, _noEscaping, false);
|
|
2881
|
+
__privateAdd(this, _skip, void 0);
|
|
2882
|
+
__privateSet(this, _dbName, dbName);
|
|
2883
|
+
__privateSet(this, _index, index2);
|
|
2884
|
+
__privateSet(this, _query, {
|
|
2874
2885
|
allOr: false,
|
|
2875
2886
|
string: {},
|
|
2876
2887
|
fuzzy: {},
|
|
@@ -2884,124 +2895,124 @@ var init_lucene = __esm({
|
|
|
2884
2895
|
notContains: {},
|
|
2885
2896
|
containsAny: {},
|
|
2886
2897
|
...base
|
|
2887
|
-
};
|
|
2888
|
-
this
|
|
2889
|
-
this
|
|
2890
|
-
this
|
|
2891
|
-
this
|
|
2898
|
+
});
|
|
2899
|
+
__privateSet(this, _limit, 50);
|
|
2900
|
+
__privateSet(this, _sortOrder, "ascending");
|
|
2901
|
+
__privateSet(this, _sortType, "string");
|
|
2902
|
+
__privateSet(this, _includeDocs, true);
|
|
2892
2903
|
}
|
|
2893
2904
|
disableEscaping() {
|
|
2894
|
-
this
|
|
2905
|
+
__privateSet(this, _noEscaping, true);
|
|
2895
2906
|
return this;
|
|
2896
2907
|
}
|
|
2897
2908
|
setIndexBuilder(builderFn) {
|
|
2898
|
-
this
|
|
2909
|
+
__privateSet(this, _indexBuilder, builderFn);
|
|
2899
2910
|
return this;
|
|
2900
2911
|
}
|
|
2901
2912
|
setVersion(version) {
|
|
2902
2913
|
if (version != null) {
|
|
2903
|
-
this
|
|
2914
|
+
__privateSet(this, _version, version);
|
|
2904
2915
|
}
|
|
2905
2916
|
return this;
|
|
2906
2917
|
}
|
|
2907
2918
|
setTable(tableId) {
|
|
2908
|
-
this
|
|
2919
|
+
__privateGet(this, _query).equal.tableId = tableId;
|
|
2909
2920
|
return this;
|
|
2910
2921
|
}
|
|
2911
2922
|
setLimit(limit) {
|
|
2912
2923
|
if (limit != null) {
|
|
2913
|
-
this
|
|
2924
|
+
__privateSet(this, _limit, limit);
|
|
2914
2925
|
}
|
|
2915
2926
|
return this;
|
|
2916
2927
|
}
|
|
2917
2928
|
setSort(sort) {
|
|
2918
2929
|
if (sort != null) {
|
|
2919
|
-
this
|
|
2930
|
+
__privateSet(this, _sort, sort);
|
|
2920
2931
|
}
|
|
2921
2932
|
return this;
|
|
2922
2933
|
}
|
|
2923
2934
|
setSortOrder(sortOrder) {
|
|
2924
2935
|
if (sortOrder != null) {
|
|
2925
|
-
this
|
|
2936
|
+
__privateSet(this, _sortOrder, sortOrder);
|
|
2926
2937
|
}
|
|
2927
2938
|
return this;
|
|
2928
2939
|
}
|
|
2929
2940
|
setSortType(sortType) {
|
|
2930
2941
|
if (sortType != null) {
|
|
2931
|
-
this
|
|
2942
|
+
__privateSet(this, _sortType, sortType);
|
|
2932
2943
|
}
|
|
2933
2944
|
return this;
|
|
2934
2945
|
}
|
|
2935
2946
|
setBookmark(bookmark) {
|
|
2936
2947
|
if (bookmark != null) {
|
|
2937
|
-
this
|
|
2948
|
+
__privateSet(this, _bookmark, bookmark);
|
|
2938
2949
|
}
|
|
2939
2950
|
return this;
|
|
2940
2951
|
}
|
|
2941
2952
|
setSkip(skip) {
|
|
2942
|
-
this
|
|
2953
|
+
__privateSet(this, _skip, skip);
|
|
2943
2954
|
return this;
|
|
2944
2955
|
}
|
|
2945
2956
|
excludeDocs() {
|
|
2946
|
-
this
|
|
2957
|
+
__privateSet(this, _includeDocs, false);
|
|
2947
2958
|
return this;
|
|
2948
2959
|
}
|
|
2949
2960
|
includeDocs() {
|
|
2950
|
-
this
|
|
2961
|
+
__privateSet(this, _includeDocs, true);
|
|
2951
2962
|
return this;
|
|
2952
2963
|
}
|
|
2953
2964
|
addString(key, partial) {
|
|
2954
|
-
this
|
|
2965
|
+
__privateGet(this, _query).string[key] = partial;
|
|
2955
2966
|
return this;
|
|
2956
2967
|
}
|
|
2957
2968
|
addFuzzy(key, fuzzy) {
|
|
2958
|
-
this
|
|
2969
|
+
__privateGet(this, _query).fuzzy[key] = fuzzy;
|
|
2959
2970
|
return this;
|
|
2960
2971
|
}
|
|
2961
2972
|
addRange(key, low, high) {
|
|
2962
|
-
this
|
|
2973
|
+
__privateGet(this, _query).range[key] = {
|
|
2963
2974
|
low,
|
|
2964
2975
|
high
|
|
2965
2976
|
};
|
|
2966
2977
|
return this;
|
|
2967
2978
|
}
|
|
2968
2979
|
addEqual(key, value) {
|
|
2969
|
-
this
|
|
2980
|
+
__privateGet(this, _query).equal[key] = value;
|
|
2970
2981
|
return this;
|
|
2971
2982
|
}
|
|
2972
2983
|
addNotEqual(key, value) {
|
|
2973
|
-
this
|
|
2984
|
+
__privateGet(this, _query).notEqual[key] = value;
|
|
2974
2985
|
return this;
|
|
2975
2986
|
}
|
|
2976
2987
|
addEmpty(key, value) {
|
|
2977
|
-
this
|
|
2988
|
+
__privateGet(this, _query).empty[key] = value;
|
|
2978
2989
|
return this;
|
|
2979
2990
|
}
|
|
2980
2991
|
addNotEmpty(key, value) {
|
|
2981
|
-
this
|
|
2992
|
+
__privateGet(this, _query).notEmpty[key] = value;
|
|
2982
2993
|
return this;
|
|
2983
2994
|
}
|
|
2984
2995
|
addOneOf(key, value) {
|
|
2985
|
-
this
|
|
2996
|
+
__privateGet(this, _query).oneOf[key] = value;
|
|
2986
2997
|
return this;
|
|
2987
2998
|
}
|
|
2988
2999
|
addContains(key, value) {
|
|
2989
|
-
this
|
|
3000
|
+
__privateGet(this, _query).contains[key] = value;
|
|
2990
3001
|
return this;
|
|
2991
3002
|
}
|
|
2992
3003
|
addNotContains(key, value) {
|
|
2993
|
-
this
|
|
3004
|
+
__privateGet(this, _query).notContains[key] = value;
|
|
2994
3005
|
return this;
|
|
2995
3006
|
}
|
|
2996
3007
|
addContainsAny(key, value) {
|
|
2997
|
-
this
|
|
3008
|
+
__privateGet(this, _query).containsAny[key] = value;
|
|
2998
3009
|
return this;
|
|
2999
3010
|
}
|
|
3000
3011
|
setAllOr() {
|
|
3001
|
-
this
|
|
3012
|
+
__privateGet(this, _query).allOr = true;
|
|
3002
3013
|
}
|
|
3003
3014
|
handleSpaces(input) {
|
|
3004
|
-
if (this
|
|
3015
|
+
if (__privateGet(this, _noEscaping)) {
|
|
3005
3016
|
return input;
|
|
3006
3017
|
} else {
|
|
3007
3018
|
return input.replace(/ /g, "_");
|
|
@@ -3015,12 +3026,12 @@ var init_lucene = __esm({
|
|
|
3015
3026
|
* @returns {string|*}
|
|
3016
3027
|
*/
|
|
3017
3028
|
preprocess(value, { escape, lowercase, wrap, type } = {}) {
|
|
3018
|
-
const hasVersion = !!this
|
|
3029
|
+
const hasVersion = !!__privateGet(this, _version);
|
|
3019
3030
|
const originalType = typeof value;
|
|
3020
3031
|
if (value && lowercase) {
|
|
3021
3032
|
value = value.toLowerCase ? value.toLowerCase() : value;
|
|
3022
3033
|
}
|
|
3023
|
-
if (!this
|
|
3034
|
+
if (!__privateGet(this, _noEscaping) && escape && originalType === "string") {
|
|
3024
3035
|
value = `${value}`.replace(/[ \/#+\-&|!(){}\]^"~*?:\\]/g, "\\$&");
|
|
3025
3036
|
}
|
|
3026
3037
|
if (originalType === "string" && !isNaN(value) && !type) {
|
|
@@ -3032,7 +3043,7 @@ var init_lucene = __esm({
|
|
|
3032
3043
|
}
|
|
3033
3044
|
isMultiCondition() {
|
|
3034
3045
|
let count = 0;
|
|
3035
|
-
for (let filters of Object.values(this
|
|
3046
|
+
for (let filters of Object.values(__privateGet(this, _query))) {
|
|
3036
3047
|
if (typeof filters === "object") {
|
|
3037
3048
|
count += Object.keys(filters).length;
|
|
3038
3049
|
}
|
|
@@ -3058,13 +3069,13 @@ var init_lucene = __esm({
|
|
|
3058
3069
|
}
|
|
3059
3070
|
buildSearchQuery() {
|
|
3060
3071
|
const builder = this;
|
|
3061
|
-
let allOr = this
|
|
3072
|
+
let allOr = __privateGet(this, _query) && __privateGet(this, _query).allOr;
|
|
3062
3073
|
let query = allOr ? "" : "*:*";
|
|
3063
3074
|
const allPreProcessingOpts = { escape: true, lowercase: true, wrap: true };
|
|
3064
3075
|
let tableId;
|
|
3065
|
-
if (this
|
|
3066
|
-
tableId = this
|
|
3067
|
-
delete this
|
|
3076
|
+
if (__privateGet(this, _query).equal.tableId) {
|
|
3077
|
+
tableId = __privateGet(this, _query).equal.tableId;
|
|
3078
|
+
delete __privateGet(this, _query).equal.tableId;
|
|
3068
3079
|
}
|
|
3069
3080
|
const equal = (key, value) => {
|
|
3070
3081
|
if (!value && value !== 0) {
|
|
@@ -3138,19 +3149,19 @@ var init_lucene = __esm({
|
|
|
3138
3149
|
continue;
|
|
3139
3150
|
}
|
|
3140
3151
|
if (built.length > 0 || query.length > 0) {
|
|
3141
|
-
const mode = opts
|
|
3152
|
+
const mode = (opts == null ? void 0 : opts.mode) ? opts.mode : allOr ? "OR" : "AND";
|
|
3142
3153
|
built += ` ${mode} `;
|
|
3143
3154
|
}
|
|
3144
3155
|
built += expression;
|
|
3145
3156
|
}
|
|
3146
|
-
if (opts
|
|
3157
|
+
if (opts == null ? void 0 : opts.returnBuilt) {
|
|
3147
3158
|
return built;
|
|
3148
3159
|
} else {
|
|
3149
3160
|
query += built;
|
|
3150
3161
|
}
|
|
3151
3162
|
}
|
|
3152
|
-
if (this
|
|
3153
|
-
build(this
|
|
3163
|
+
if (__privateGet(this, _query).string) {
|
|
3164
|
+
build(__privateGet(this, _query).string, (key, value) => {
|
|
3154
3165
|
if (!value) {
|
|
3155
3166
|
return null;
|
|
3156
3167
|
}
|
|
@@ -3162,8 +3173,8 @@ var init_lucene = __esm({
|
|
|
3162
3173
|
return `${key}:${value}*`;
|
|
3163
3174
|
});
|
|
3164
3175
|
}
|
|
3165
|
-
if (this
|
|
3166
|
-
build(this
|
|
3176
|
+
if (__privateGet(this, _query).range) {
|
|
3177
|
+
build(__privateGet(this, _query).range, (key, value) => {
|
|
3167
3178
|
if (!value) {
|
|
3168
3179
|
return null;
|
|
3169
3180
|
}
|
|
@@ -3178,14 +3189,14 @@ var init_lucene = __esm({
|
|
|
3178
3189
|
return `${key}:[${low} TO ${high}]`;
|
|
3179
3190
|
});
|
|
3180
3191
|
}
|
|
3181
|
-
if (this
|
|
3182
|
-
build(this
|
|
3192
|
+
if (__privateGet(this, _query).fuzzy) {
|
|
3193
|
+
build(__privateGet(this, _query).fuzzy, fuzzy);
|
|
3183
3194
|
}
|
|
3184
|
-
if (this
|
|
3185
|
-
build(this
|
|
3195
|
+
if (__privateGet(this, _query).equal) {
|
|
3196
|
+
build(__privateGet(this, _query).equal, equal);
|
|
3186
3197
|
}
|
|
3187
|
-
if (this
|
|
3188
|
-
build(this
|
|
3198
|
+
if (__privateGet(this, _query).notEqual) {
|
|
3199
|
+
build(__privateGet(this, _query).notEqual, (key, value) => {
|
|
3189
3200
|
if (!value) {
|
|
3190
3201
|
return null;
|
|
3191
3202
|
}
|
|
@@ -3195,23 +3206,23 @@ var init_lucene = __esm({
|
|
|
3195
3206
|
return `!${key}:${builder.preprocess(value, allPreProcessingOpts)}`;
|
|
3196
3207
|
});
|
|
3197
3208
|
}
|
|
3198
|
-
if (this
|
|
3199
|
-
build(this
|
|
3209
|
+
if (__privateGet(this, _query).empty) {
|
|
3210
|
+
build(__privateGet(this, _query).empty, (key) => `(*:* -${key}:["" TO *])`);
|
|
3200
3211
|
}
|
|
3201
|
-
if (this
|
|
3202
|
-
build(this
|
|
3212
|
+
if (__privateGet(this, _query).notEmpty) {
|
|
3213
|
+
build(__privateGet(this, _query).notEmpty, (key) => `${key}:["" TO *]`);
|
|
3203
3214
|
}
|
|
3204
|
-
if (this
|
|
3205
|
-
build(this
|
|
3215
|
+
if (__privateGet(this, _query).oneOf) {
|
|
3216
|
+
build(__privateGet(this, _query).oneOf, oneOf);
|
|
3206
3217
|
}
|
|
3207
|
-
if (this
|
|
3208
|
-
build(this
|
|
3218
|
+
if (__privateGet(this, _query).contains) {
|
|
3219
|
+
build(__privateGet(this, _query).contains, contains);
|
|
3209
3220
|
}
|
|
3210
|
-
if (this
|
|
3211
|
-
build(this.compressFilters(this
|
|
3221
|
+
if (__privateGet(this, _query).notContains) {
|
|
3222
|
+
build(this.compressFilters(__privateGet(this, _query).notContains), notContains);
|
|
3212
3223
|
}
|
|
3213
|
-
if (this
|
|
3214
|
-
build(this
|
|
3224
|
+
if (__privateGet(this, _query).containsAny) {
|
|
3225
|
+
build(__privateGet(this, _query).containsAny, containsAny);
|
|
3215
3226
|
}
|
|
3216
3227
|
if (tableId) {
|
|
3217
3228
|
query = this.isMultiCondition() ? `(${query})` : query;
|
|
@@ -3223,63 +3234,75 @@ var init_lucene = __esm({
|
|
|
3223
3234
|
buildSearchBody() {
|
|
3224
3235
|
let body = {
|
|
3225
3236
|
q: this.buildSearchQuery(),
|
|
3226
|
-
limit: Math.min(this
|
|
3227
|
-
include_docs: this
|
|
3237
|
+
limit: Math.min(__privateGet(this, _limit), _QueryBuilder.maxLimit),
|
|
3238
|
+
include_docs: __privateGet(this, _includeDocs)
|
|
3228
3239
|
};
|
|
3229
|
-
if (this
|
|
3230
|
-
body.bookmark = this
|
|
3240
|
+
if (__privateGet(this, _bookmark)) {
|
|
3241
|
+
body.bookmark = __privateGet(this, _bookmark);
|
|
3231
3242
|
}
|
|
3232
|
-
if (this
|
|
3233
|
-
const order = this
|
|
3234
|
-
const type = `<${this
|
|
3235
|
-
body.sort = `${order}${this.handleSpaces(this
|
|
3243
|
+
if (__privateGet(this, _sort)) {
|
|
3244
|
+
const order = __privateGet(this, _sortOrder) === "descending" ? "-" : "";
|
|
3245
|
+
const type = `<${__privateGet(this, _sortType)}>`;
|
|
3246
|
+
body.sort = `${order}${this.handleSpaces(__privateGet(this, _sort))}${type}`;
|
|
3236
3247
|
}
|
|
3237
3248
|
return body;
|
|
3238
3249
|
}
|
|
3239
3250
|
async run() {
|
|
3240
|
-
if (this
|
|
3241
|
-
await this
|
|
3251
|
+
if (__privateGet(this, _skip)) {
|
|
3252
|
+
await __privateMethod(this, _skipItems, skipItems_fn).call(this, __privateGet(this, _skip));
|
|
3242
3253
|
}
|
|
3243
|
-
return await this
|
|
3254
|
+
return await __privateMethod(this, _execute, execute_fn).call(this);
|
|
3244
3255
|
}
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
const
|
|
3270
|
-
|
|
3271
|
-
|
|
3256
|
+
};
|
|
3257
|
+
_dbName = new WeakMap();
|
|
3258
|
+
_index = new WeakMap();
|
|
3259
|
+
_query = new WeakMap();
|
|
3260
|
+
_limit = new WeakMap();
|
|
3261
|
+
_sort = new WeakMap();
|
|
3262
|
+
_bookmark = new WeakMap();
|
|
3263
|
+
_sortOrder = new WeakMap();
|
|
3264
|
+
_sortType = new WeakMap();
|
|
3265
|
+
_includeDocs = new WeakMap();
|
|
3266
|
+
_version = new WeakMap();
|
|
3267
|
+
_indexBuilder = new WeakMap();
|
|
3268
|
+
_noEscaping = new WeakMap();
|
|
3269
|
+
_skip = new WeakMap();
|
|
3270
|
+
_skipItems = new WeakSet();
|
|
3271
|
+
skipItems_fn = async function(skip) {
|
|
3272
|
+
const prevIncludeDocs = __privateGet(this, _includeDocs);
|
|
3273
|
+
const prevLimit = __privateGet(this, _limit);
|
|
3274
|
+
this.excludeDocs();
|
|
3275
|
+
let skipRemaining = skip;
|
|
3276
|
+
let iterationFetched = 0;
|
|
3277
|
+
do {
|
|
3278
|
+
const toSkip = Math.min(_QueryBuilder.maxLimit, skipRemaining);
|
|
3279
|
+
this.setLimit(toSkip);
|
|
3280
|
+
const { bookmark, rows } = await __privateMethod(this, _execute, execute_fn).call(this);
|
|
3281
|
+
this.setBookmark(bookmark);
|
|
3282
|
+
iterationFetched = rows.length;
|
|
3283
|
+
skipRemaining -= rows.length;
|
|
3284
|
+
} while (skipRemaining > 0 && iterationFetched > 0);
|
|
3285
|
+
__privateSet(this, _includeDocs, prevIncludeDocs);
|
|
3286
|
+
__privateSet(this, _limit, prevLimit);
|
|
3287
|
+
};
|
|
3288
|
+
_execute = new WeakSet();
|
|
3289
|
+
execute_fn = async function() {
|
|
3290
|
+
const { url, cookie } = getCouchInfo();
|
|
3291
|
+
const fullPath = `${url}/${__privateGet(this, _dbName)}/_design/database/_search/${__privateGet(this, _index)}`;
|
|
3292
|
+
const body = this.buildSearchBody();
|
|
3293
|
+
try {
|
|
3294
|
+
return await runQuery(fullPath, body, cookie);
|
|
3295
|
+
} catch (err) {
|
|
3296
|
+
if (err.status === 404 && __privateGet(this, _indexBuilder)) {
|
|
3297
|
+
await __privateGet(this, _indexBuilder).call(this);
|
|
3272
3298
|
return await runQuery(fullPath, body, cookie);
|
|
3273
|
-
}
|
|
3274
|
-
|
|
3275
|
-
await this.#indexBuilder();
|
|
3276
|
-
return await runQuery(fullPath, body, cookie);
|
|
3277
|
-
} else {
|
|
3278
|
-
throw err;
|
|
3279
|
-
}
|
|
3299
|
+
} else {
|
|
3300
|
+
throw err;
|
|
3280
3301
|
}
|
|
3281
3302
|
}
|
|
3282
3303
|
};
|
|
3304
|
+
_QueryBuilder.maxLimit = 200;
|
|
3305
|
+
QueryBuilder = _QueryBuilder;
|
|
3283
3306
|
}
|
|
3284
3307
|
});
|
|
3285
3308
|
|
|
@@ -3432,7 +3455,7 @@ function getFullPath(fileName) {
|
|
|
3432
3455
|
}
|
|
3433
3456
|
function getSingleFileMaxSizeInfo(totalMaxSize) {
|
|
3434
3457
|
const regex = /(\d+)([A-Za-z])/;
|
|
3435
|
-
const match = totalMaxSize
|
|
3458
|
+
const match = totalMaxSize == null ? void 0 : totalMaxSize.match(regex);
|
|
3436
3459
|
if (!match) {
|
|
3437
3460
|
console.warn(`totalMaxSize does not have a valid value`, {
|
|
3438
3461
|
totalMaxSize
|
|
@@ -3464,9 +3487,9 @@ function localFileDestination() {
|
|
|
3464
3487
|
const fileInfo = getSingleFileMaxSizeInfo(environment_default.ROLLING_LOG_MAX_SIZE);
|
|
3465
3488
|
const outFile = rfs.createStream(logsFileName, {
|
|
3466
3489
|
// As we have a rolling size, we want to half the max size
|
|
3467
|
-
size: fileInfo
|
|
3490
|
+
size: fileInfo == null ? void 0 : fileInfo.size,
|
|
3468
3491
|
path: logsPath,
|
|
3469
|
-
maxFiles: fileInfo
|
|
3492
|
+
maxFiles: (fileInfo == null ? void 0 : fileInfo.totalHistoryFiles) || 1,
|
|
3470
3493
|
immutable: true,
|
|
3471
3494
|
history: budibaseLogsHistoryFileName,
|
|
3472
3495
|
initialRotation: false
|
|
@@ -3541,8 +3564,8 @@ var init_logger = __esm({
|
|
|
3541
3564
|
tenantId: getTenantId2(),
|
|
3542
3565
|
appId: getAppId2(),
|
|
3543
3566
|
automationId: getAutomationId2(),
|
|
3544
|
-
identityId: identity
|
|
3545
|
-
identityType: identity
|
|
3567
|
+
identityId: identity == null ? void 0 : identity._id,
|
|
3568
|
+
identityType: identity == null ? void 0 : identity.type,
|
|
3546
3569
|
correlationId: getId()
|
|
3547
3570
|
};
|
|
3548
3571
|
const mergingObject = {
|
|
@@ -3606,30 +3629,30 @@ var init_logger = __esm({
|
|
|
3606
3629
|
pinoInstance = destinations.length ? (0, import_pino.default)(pinoOptions, import_pino.default.multistream(destinations)) : (0, import_pino.default)(pinoOptions);
|
|
3607
3630
|
console.log = (...arg) => {
|
|
3608
3631
|
const [obj, msg] = getLogParams2(arg);
|
|
3609
|
-
pinoInstance
|
|
3632
|
+
pinoInstance == null ? void 0 : pinoInstance.info(obj, msg);
|
|
3610
3633
|
};
|
|
3611
3634
|
console.info = (...arg) => {
|
|
3612
3635
|
const [obj, msg] = getLogParams2(arg);
|
|
3613
|
-
pinoInstance
|
|
3636
|
+
pinoInstance == null ? void 0 : pinoInstance.info(obj, msg);
|
|
3614
3637
|
};
|
|
3615
3638
|
console.warn = (...arg) => {
|
|
3616
3639
|
const [obj, msg] = getLogParams2(arg);
|
|
3617
|
-
pinoInstance
|
|
3640
|
+
pinoInstance == null ? void 0 : pinoInstance.warn(obj, msg);
|
|
3618
3641
|
};
|
|
3619
3642
|
console.error = (...arg) => {
|
|
3620
3643
|
const [obj, msg] = getLogParams2(arg);
|
|
3621
|
-
pinoInstance
|
|
3644
|
+
pinoInstance == null ? void 0 : pinoInstance.error(obj, msg);
|
|
3622
3645
|
};
|
|
3623
3646
|
console.trace = (...arg) => {
|
|
3624
3647
|
const [obj, msg] = getLogParams2(arg);
|
|
3625
3648
|
if (!obj.err) {
|
|
3626
3649
|
obj.err = new Error();
|
|
3627
3650
|
}
|
|
3628
|
-
pinoInstance
|
|
3651
|
+
pinoInstance == null ? void 0 : pinoInstance.trace(obj, msg);
|
|
3629
3652
|
};
|
|
3630
3653
|
console.debug = (...arg) => {
|
|
3631
3654
|
const [obj, msg] = getLogParams2(arg);
|
|
3632
|
-
pinoInstance
|
|
3655
|
+
pinoInstance == null ? void 0 : pinoInstance.debug(obj, msg);
|
|
3633
3656
|
};
|
|
3634
3657
|
const getTenantId2 = () => {
|
|
3635
3658
|
let tenantId;
|
|
@@ -4115,6 +4138,7 @@ async function getSettingsConfigDoc() {
|
|
|
4115
4138
|
async function getPlatformUrl(opts = {
|
|
4116
4139
|
tenantAware: true
|
|
4117
4140
|
}) {
|
|
4141
|
+
var _a;
|
|
4118
4142
|
let platformUrl = environment_default.PLATFORM_URL || "http://localhost:10000";
|
|
4119
4143
|
if (!environment_default.SELF_HOSTED && environment_default.MULTI_TENANCY && opts.tenantAware) {
|
|
4120
4144
|
const tenantId = getTenantId();
|
|
@@ -4122,11 +4146,11 @@ async function getPlatformUrl(opts = {
|
|
|
4122
4146
|
platformUrl = platformUrl.replace("://", `://${tenantId}.`);
|
|
4123
4147
|
}
|
|
4124
4148
|
} else if (environment_default.SELF_HOSTED) {
|
|
4125
|
-
const config = opts
|
|
4149
|
+
const config = (opts == null ? void 0 : opts.config) ? opts.config : (
|
|
4126
4150
|
// direct to db to prevent infinite loop
|
|
4127
|
-
(await getConfig("settings" /* SETTINGS */))
|
|
4151
|
+
(_a = await getConfig("settings" /* SETTINGS */)) == null ? void 0 : _a.config
|
|
4128
4152
|
);
|
|
4129
|
-
if (config
|
|
4153
|
+
if (config == null ? void 0 : config.platformUrl) {
|
|
4130
4154
|
platformUrl = config.platformUrl;
|
|
4131
4155
|
}
|
|
4132
4156
|
}
|
|
@@ -4150,13 +4174,14 @@ var init_configs2 = __esm({
|
|
|
4150
4174
|
"analyticsEnabled" /* ANALYTICS_ENABLED */,
|
|
4151
4175
|
86400 /* ONE_DAY */,
|
|
4152
4176
|
async () => {
|
|
4153
|
-
|
|
4177
|
+
var _a;
|
|
4178
|
+
const config = (opts == null ? void 0 : opts.config) ? opts.config : (
|
|
4154
4179
|
// direct to db to prevent infinite loop
|
|
4155
|
-
(await getConfig("settings" /* SETTINGS */))
|
|
4180
|
+
(_a = await getConfig("settings" /* SETTINGS */)) == null ? void 0 : _a.config
|
|
4156
4181
|
);
|
|
4157
|
-
if (config
|
|
4182
|
+
if ((config == null ? void 0 : config.analyticsEnabled) === false) {
|
|
4158
4183
|
return false;
|
|
4159
|
-
} else if (config
|
|
4184
|
+
} else if ((config == null ? void 0 : config.analyticsEnabled) === true) {
|
|
4160
4185
|
return true;
|
|
4161
4186
|
}
|
|
4162
4187
|
}
|
|
@@ -4658,6 +4683,7 @@ function handleStalled(queue, removeStalledCb) {
|
|
|
4658
4683
|
});
|
|
4659
4684
|
}
|
|
4660
4685
|
function getLogParams(eventType, event, opts = {}, extra = {}) {
|
|
4686
|
+
var _a, _b, _c;
|
|
4661
4687
|
const message = `[BULL] ${eventType}=${event}`;
|
|
4662
4688
|
const err = opts.error;
|
|
4663
4689
|
const bullLog = {
|
|
@@ -4665,11 +4691,11 @@ function getLogParams(eventType, event, opts = {}, extra = {}) {
|
|
|
4665
4691
|
eventType,
|
|
4666
4692
|
event,
|
|
4667
4693
|
job: opts.job,
|
|
4668
|
-
jobId: opts.jobId || opts.job
|
|
4694
|
+
jobId: opts.jobId || ((_a = opts.job) == null ? void 0 : _a.id),
|
|
4669
4695
|
...extra
|
|
4670
4696
|
};
|
|
4671
4697
|
let automationLog;
|
|
4672
|
-
if (opts.job
|
|
4698
|
+
if ((_c = (_b = opts.job) == null ? void 0 : _b.data) == null ? void 0 : _c.automation) {
|
|
4673
4699
|
automationLog = {
|
|
4674
4700
|
_logKey: "automation",
|
|
4675
4701
|
trigger: opts.job ? opts.job.data.automation.definition.trigger.event : void 0
|
|
@@ -4678,9 +4704,11 @@ function getLogParams(eventType, event, opts = {}, extra = {}) {
|
|
|
4678
4704
|
return [message, err, bullLog, automationLog];
|
|
4679
4705
|
}
|
|
4680
4706
|
function logging(queue, jobQueue) {
|
|
4707
|
+
var _a;
|
|
4681
4708
|
const eventType = EventTypeMap[jobQueue];
|
|
4682
4709
|
function doInJobContext(job, task) {
|
|
4683
|
-
|
|
4710
|
+
var _a2;
|
|
4711
|
+
const appId = (_a2 = job.data.event) == null ? void 0 : _a2.appId;
|
|
4684
4712
|
if (appId) {
|
|
4685
4713
|
return doInContext(appId, task);
|
|
4686
4714
|
} else {
|
|
@@ -4694,7 +4722,7 @@ function logging(queue, jobQueue) {
|
|
|
4694
4722
|
}).on("error" /* ERROR */, (error) => {
|
|
4695
4723
|
console.error(...getLogParams(eventType, "error" /* ERROR */, { error }));
|
|
4696
4724
|
});
|
|
4697
|
-
if (process.env.NODE_DEBUG
|
|
4725
|
+
if ((_a = process.env.NODE_DEBUG) == null ? void 0 : _a.includes("bull")) {
|
|
4698
4726
|
queue.on("waiting" /* WAITING */, (jobId) => {
|
|
4699
4727
|
console.info(...getLogParams(eventType, "waiting" /* WAITING */, { jobId }));
|
|
4700
4728
|
}).on("active" /* ACTIVE */, async (job, jobPromise) => {
|
|
@@ -4774,7 +4802,7 @@ function createQueue(jobQueue, opts = {}) {
|
|
|
4774
4802
|
} else {
|
|
4775
4803
|
queue = new inMemoryQueue_default(jobQueue, queueConfig);
|
|
4776
4804
|
}
|
|
4777
|
-
addListeners(queue, jobQueue, opts
|
|
4805
|
+
addListeners(queue, jobQueue, opts == null ? void 0 : opts.removeStalledCb);
|
|
4778
4806
|
QUEUES.push(queue);
|
|
4779
4807
|
if (!cleanupInterval && !environment_default.isTest()) {
|
|
4780
4808
|
cleanupInterval = set(cleanup, CLEANUP_PERIOD_MS);
|
|
@@ -4809,7 +4837,7 @@ var init_queue2 = __esm({
|
|
|
4809
4837
|
});
|
|
4810
4838
|
|
|
4811
4839
|
// src/events/processors/AuditLogsProcessor.ts
|
|
4812
|
-
var AuditLogsProcessor;
|
|
4840
|
+
var _AuditLogsProcessor, AuditLogsProcessor;
|
|
4813
4841
|
var init_AuditLogsProcessor = __esm({
|
|
4814
4842
|
"src/events/processors/AuditLogsProcessor.ts"() {
|
|
4815
4843
|
"use strict";
|
|
@@ -4818,10 +4846,7 @@ var init_AuditLogsProcessor = __esm({
|
|
|
4818
4846
|
init_queue2();
|
|
4819
4847
|
init_utils6();
|
|
4820
4848
|
init_environment2();
|
|
4821
|
-
|
|
4822
|
-
static {
|
|
4823
|
-
this.auditLogsEnabled = false;
|
|
4824
|
-
}
|
|
4849
|
+
_AuditLogsProcessor = class _AuditLogsProcessor {
|
|
4825
4850
|
// can't use constructor as need to return promise
|
|
4826
4851
|
static init(fn) {
|
|
4827
4852
|
_AuditLogsProcessor.auditLogsEnabled = true;
|
|
@@ -4873,9 +4898,12 @@ var init_AuditLogsProcessor = __esm({
|
|
|
4873
4898
|
async identifyGroup(group, timestamp) {
|
|
4874
4899
|
}
|
|
4875
4900
|
shutdown() {
|
|
4876
|
-
|
|
4901
|
+
var _a;
|
|
4902
|
+
(_a = _AuditLogsProcessor.auditLogQueue) == null ? void 0 : _a.close();
|
|
4877
4903
|
}
|
|
4878
4904
|
};
|
|
4905
|
+
_AuditLogsProcessor.auditLogsEnabled = false;
|
|
4906
|
+
AuditLogsProcessor = _AuditLogsProcessor;
|
|
4879
4907
|
}
|
|
4880
4908
|
});
|
|
4881
4909
|
|
|
@@ -5203,12 +5231,13 @@ __export(users_exports2, {
|
|
|
5203
5231
|
isGlobalBuilder: () => isGlobalBuilder
|
|
5204
5232
|
});
|
|
5205
5233
|
function isBuilder(user2, appId) {
|
|
5234
|
+
var _a, _b, _c;
|
|
5206
5235
|
if (!user2) {
|
|
5207
5236
|
return false;
|
|
5208
5237
|
}
|
|
5209
|
-
if (user2.builder
|
|
5238
|
+
if ((_a = user2.builder) == null ? void 0 : _a.global) {
|
|
5210
5239
|
return true;
|
|
5211
|
-
} else if (appId && user2.builder
|
|
5240
|
+
} else if (appId && ((_c = (_b = user2.builder) == null ? void 0 : _b.apps) == null ? void 0 : _c.includes(getProdAppID2(appId)))) {
|
|
5212
5241
|
return true;
|
|
5213
5242
|
}
|
|
5214
5243
|
return false;
|
|
@@ -5226,24 +5255,27 @@ function isAdminOrBuilder(user2, appId) {
|
|
|
5226
5255
|
return isBuilder(user2, appId) || isAdmin(user2);
|
|
5227
5256
|
}
|
|
5228
5257
|
function hasAppBuilderPermissions(user2) {
|
|
5258
|
+
var _a, _b, _c;
|
|
5229
5259
|
if (!user2) {
|
|
5230
5260
|
return false;
|
|
5231
5261
|
}
|
|
5232
|
-
const appLength = user2.builder
|
|
5233
|
-
const isGlobalBuilder3 = !!user2.builder
|
|
5262
|
+
const appLength = (_b = (_a = user2.builder) == null ? void 0 : _a.apps) == null ? void 0 : _b.length;
|
|
5263
|
+
const isGlobalBuilder3 = !!((_c = user2.builder) == null ? void 0 : _c.global);
|
|
5234
5264
|
return !isGlobalBuilder3 && appLength != null && appLength > 0;
|
|
5235
5265
|
}
|
|
5236
5266
|
function hasBuilderPermissions(user2) {
|
|
5267
|
+
var _a;
|
|
5237
5268
|
if (!user2) {
|
|
5238
5269
|
return false;
|
|
5239
5270
|
}
|
|
5240
|
-
return user2.builder
|
|
5271
|
+
return ((_a = user2.builder) == null ? void 0 : _a.global) || hasAppBuilderPermissions(user2);
|
|
5241
5272
|
}
|
|
5242
5273
|
function hasAdminPermissions(user2) {
|
|
5274
|
+
var _a;
|
|
5243
5275
|
if (!user2) {
|
|
5244
5276
|
return false;
|
|
5245
5277
|
}
|
|
5246
|
-
return !!user2.admin
|
|
5278
|
+
return !!((_a = user2.admin) == null ? void 0 : _a.global);
|
|
5247
5279
|
}
|
|
5248
5280
|
var init_users5 = __esm({
|
|
5249
5281
|
"../shared-core/src/sdk/documents/users.ts"() {
|
|
@@ -5491,8 +5523,8 @@ var init_identification2 = __esm({
|
|
|
5491
5523
|
if (isSSOUser(user2)) {
|
|
5492
5524
|
providerType3 = user2.providerType;
|
|
5493
5525
|
}
|
|
5494
|
-
const accountHolder = account2
|
|
5495
|
-
const verified2 = account2 && account2
|
|
5526
|
+
const accountHolder = (account2 == null ? void 0 : account2.budibaseUserId) === user2._id || false;
|
|
5527
|
+
const verified2 = account2 && (account2 == null ? void 0 : account2.budibaseUserId) === user2._id ? account2.verified : false;
|
|
5496
5528
|
const installationId = await getInstallationId();
|
|
5497
5529
|
const hosting = account2 ? account2.hosting : getHostingFromEnv();
|
|
5498
5530
|
const environment2 = getDeploymentEnvironment();
|
|
@@ -5659,7 +5691,7 @@ var init_backfill2 = __esm({
|
|
|
5659
5691
|
};
|
|
5660
5692
|
isBackfillingEvent = async (event) => {
|
|
5661
5693
|
const backfill = await getBackfillMetadata();
|
|
5662
|
-
const events2 = backfill
|
|
5694
|
+
const events2 = backfill == null ? void 0 : backfill.eventWhitelist;
|
|
5663
5695
|
if (events2 && events2.includes(event)) {
|
|
5664
5696
|
return true;
|
|
5665
5697
|
} else {
|
|
@@ -6052,11 +6084,12 @@ var init_auth4 = __esm({
|
|
|
6052
6084
|
|
|
6053
6085
|
// src/events/publishers/automation.ts
|
|
6054
6086
|
async function created3(automation, timestamp) {
|
|
6087
|
+
var _a, _b, _c, _d;
|
|
6055
6088
|
const properties = {
|
|
6056
6089
|
appId: automation.appId,
|
|
6057
6090
|
automationId: automation._id,
|
|
6058
|
-
triggerId: automation.definition
|
|
6059
|
-
triggerType: automation.definition
|
|
6091
|
+
triggerId: (_b = (_a = automation.definition) == null ? void 0 : _a.trigger) == null ? void 0 : _b.id,
|
|
6092
|
+
triggerType: (_d = (_c = automation.definition) == null ? void 0 : _c.trigger) == null ? void 0 : _d.stepId,
|
|
6060
6093
|
audited: {
|
|
6061
6094
|
name: automation.name
|
|
6062
6095
|
}
|
|
@@ -6064,20 +6097,22 @@ async function created3(automation, timestamp) {
|
|
|
6064
6097
|
await publishEvent("automation:created" /* AUTOMATION_CREATED */, properties, timestamp);
|
|
6065
6098
|
}
|
|
6066
6099
|
async function triggerUpdated(automation) {
|
|
6100
|
+
var _a, _b, _c, _d;
|
|
6067
6101
|
const properties = {
|
|
6068
6102
|
appId: automation.appId,
|
|
6069
6103
|
automationId: automation._id,
|
|
6070
|
-
triggerId: automation.definition
|
|
6071
|
-
triggerType: automation.definition
|
|
6104
|
+
triggerId: (_b = (_a = automation.definition) == null ? void 0 : _a.trigger) == null ? void 0 : _b.id,
|
|
6105
|
+
triggerType: (_d = (_c = automation.definition) == null ? void 0 : _c.trigger) == null ? void 0 : _d.stepId
|
|
6072
6106
|
};
|
|
6073
6107
|
await publishEvent("automation:trigger:updated" /* AUTOMATION_TRIGGER_UPDATED */, properties);
|
|
6074
6108
|
}
|
|
6075
6109
|
async function deleted3(automation) {
|
|
6110
|
+
var _a, _b, _c, _d;
|
|
6076
6111
|
const properties = {
|
|
6077
6112
|
appId: automation.appId,
|
|
6078
6113
|
automationId: automation._id,
|
|
6079
|
-
triggerId: automation.definition
|
|
6080
|
-
triggerType: automation.definition
|
|
6114
|
+
triggerId: (_b = (_a = automation.definition) == null ? void 0 : _a.trigger) == null ? void 0 : _b.id,
|
|
6115
|
+
triggerType: (_d = (_c = automation.definition) == null ? void 0 : _c.trigger) == null ? void 0 : _d.stepId,
|
|
6081
6116
|
audited: {
|
|
6082
6117
|
name: automation.name
|
|
6083
6118
|
}
|
|
@@ -6085,20 +6120,22 @@ async function deleted3(automation) {
|
|
|
6085
6120
|
await publishEvent("automation:deleted" /* AUTOMATION_DELETED */, properties);
|
|
6086
6121
|
}
|
|
6087
6122
|
async function tested(automation) {
|
|
6123
|
+
var _a, _b, _c, _d;
|
|
6088
6124
|
const properties = {
|
|
6089
6125
|
appId: automation.appId,
|
|
6090
6126
|
automationId: automation._id,
|
|
6091
|
-
triggerId: automation.definition
|
|
6092
|
-
triggerType: automation.definition
|
|
6127
|
+
triggerId: (_b = (_a = automation.definition) == null ? void 0 : _a.trigger) == null ? void 0 : _b.id,
|
|
6128
|
+
triggerType: (_d = (_c = automation.definition) == null ? void 0 : _c.trigger) == null ? void 0 : _d.stepId
|
|
6093
6129
|
};
|
|
6094
6130
|
await publishEvent("automation:tested" /* AUTOMATION_TESTED */, properties);
|
|
6095
6131
|
}
|
|
6096
6132
|
async function stepCreated(automation, step, timestamp) {
|
|
6133
|
+
var _a, _b, _c, _d;
|
|
6097
6134
|
const properties = {
|
|
6098
6135
|
appId: automation.appId,
|
|
6099
6136
|
automationId: automation._id,
|
|
6100
|
-
triggerId: automation.definition
|
|
6101
|
-
triggerType: automation.definition
|
|
6137
|
+
triggerId: (_b = (_a = automation.definition) == null ? void 0 : _a.trigger) == null ? void 0 : _b.id,
|
|
6138
|
+
triggerType: (_d = (_c = automation.definition) == null ? void 0 : _c.trigger) == null ? void 0 : _d.stepId,
|
|
6102
6139
|
stepId: step.id,
|
|
6103
6140
|
stepType: step.stepId,
|
|
6104
6141
|
audited: {
|
|
@@ -6108,11 +6145,12 @@ async function stepCreated(automation, step, timestamp) {
|
|
|
6108
6145
|
await publishEvent("automation:step:created" /* AUTOMATION_STEP_CREATED */, properties, timestamp);
|
|
6109
6146
|
}
|
|
6110
6147
|
async function stepDeleted(automation, step) {
|
|
6148
|
+
var _a, _b, _c, _d;
|
|
6111
6149
|
const properties = {
|
|
6112
6150
|
appId: automation.appId,
|
|
6113
6151
|
automationId: automation._id,
|
|
6114
|
-
triggerId: automation.definition
|
|
6115
|
-
triggerType: automation.definition
|
|
6152
|
+
triggerId: (_b = (_a = automation.definition) == null ? void 0 : _a.trigger) == null ? void 0 : _b.id,
|
|
6153
|
+
triggerType: (_d = (_c = automation.definition) == null ? void 0 : _c.trigger) == null ? void 0 : _d.stepId,
|
|
6116
6154
|
stepId: step.id,
|
|
6117
6155
|
stepType: step.stepId,
|
|
6118
6156
|
audited: {
|
|
@@ -6461,23 +6499,25 @@ var init_role3 = __esm({
|
|
|
6461
6499
|
|
|
6462
6500
|
// src/events/publishers/screen.ts
|
|
6463
6501
|
async function created8(screen, timestamp) {
|
|
6502
|
+
var _a;
|
|
6464
6503
|
const properties = {
|
|
6465
6504
|
layoutId: screen.layoutId,
|
|
6466
6505
|
screenId: screen._id,
|
|
6467
6506
|
roleId: screen.routing.roleId,
|
|
6468
6507
|
audited: {
|
|
6469
|
-
name: screen.routing
|
|
6508
|
+
name: (_a = screen.routing) == null ? void 0 : _a.route
|
|
6470
6509
|
}
|
|
6471
6510
|
};
|
|
6472
6511
|
await publishEvent("screen:created" /* SCREEN_CREATED */, properties, timestamp);
|
|
6473
6512
|
}
|
|
6474
6513
|
async function deleted8(screen) {
|
|
6514
|
+
var _a;
|
|
6475
6515
|
const properties = {
|
|
6476
6516
|
layoutId: screen.layoutId,
|
|
6477
6517
|
screenId: screen._id,
|
|
6478
6518
|
roleId: screen.routing.roleId,
|
|
6479
6519
|
audited: {
|
|
6480
|
-
name: screen.routing
|
|
6520
|
+
name: (_a = screen.routing) == null ? void 0 : _a.route
|
|
6481
6521
|
}
|
|
6482
6522
|
};
|
|
6483
6523
|
await publishEvent("screen:deleted" /* SCREEN_DELETED */, properties);
|
|
@@ -8147,6 +8187,7 @@ var appBuilderUser = (appId, userProps) => {
|
|
|
8147
8187
|
};
|
|
8148
8188
|
};
|
|
8149
8189
|
function ssoUser(opts = {}) {
|
|
8190
|
+
var _a, _b, _c;
|
|
8150
8191
|
const base = user(opts.user);
|
|
8151
8192
|
delete base.password;
|
|
8152
8193
|
if (!opts.details) {
|
|
@@ -8155,9 +8196,9 @@ function ssoUser(opts = {}) {
|
|
|
8155
8196
|
return {
|
|
8156
8197
|
...base,
|
|
8157
8198
|
forceResetPassword: false,
|
|
8158
|
-
oauth2: opts.details
|
|
8159
|
-
provider: opts.details
|
|
8160
|
-
providerType: opts.details
|
|
8199
|
+
oauth2: (_a = opts.details) == null ? void 0 : _a.oauth2,
|
|
8200
|
+
provider: (_b = opts.details) == null ? void 0 : _b.provider,
|
|
8201
|
+
providerType: (_c = opts.details) == null ? void 0 : _c.providerType,
|
|
8161
8202
|
thirdPartyProfile: {
|
|
8162
8203
|
email: base.email,
|
|
8163
8204
|
picture: base.pictureUrl
|
|
@@ -8323,7 +8364,7 @@ __export(testContainerUtils_exports, {
|
|
|
8323
8364
|
var import_child_process = require("child_process");
|
|
8324
8365
|
var dockerPsResult;
|
|
8325
8366
|
function formatDockerPsResult(serverName, port) {
|
|
8326
|
-
const lines = dockerPsResult
|
|
8367
|
+
const lines = dockerPsResult == null ? void 0 : dockerPsResult.split("\n");
|
|
8327
8368
|
let first = true;
|
|
8328
8369
|
if (!lines) {
|
|
8329
8370
|
return null;
|
|
@@ -8380,14 +8421,11 @@ function getContainerInfo(containerName, port) {
|
|
|
8380
8421
|
function getCouchConfig() {
|
|
8381
8422
|
return getContainerInfo("couchdb-service", 5984);
|
|
8382
8423
|
}
|
|
8383
|
-
function getMinioConfig() {
|
|
8384
|
-
return getContainerInfo("minio-service", 9e3);
|
|
8385
|
-
}
|
|
8386
8424
|
function getRedisConfig() {
|
|
8387
8425
|
return getContainerInfo("redis-service", 6379);
|
|
8388
8426
|
}
|
|
8389
8427
|
function setupEnv(...envs) {
|
|
8390
|
-
const couch = getCouchConfig(), minio =
|
|
8428
|
+
const couch = getCouchConfig(), minio = getCouchConfig(), redis2 = getRedisConfig();
|
|
8391
8429
|
const configs = [
|
|
8392
8430
|
{ key: "COUCH_DB_PORT", value: couch.port },
|
|
8393
8431
|
{ key: "COUCH_DB_URL", value: couch.url },
|