@budibase/backend-core 2.9.21-alpha.2 → 2.9.23
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 +342 -267
- package/dist/index.js.map +4 -4
- package/dist/index.js.meta.json +1 -1
- package/dist/package.json +7 -7
- package/dist/plugins.js +1 -1
- package/dist/plugins.js.map +2 -2
- package/dist/plugins.js.meta.json +1 -1
- package/dist/src/db/couch/DatabaseImpl.d.ts +2 -1
- package/dist/tests.js +272 -222
- package/dist/tests.js.map +4 -4
- package/dist/tests.js.meta.json +1 -1
- package/package.json +7 -7
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");
|
|
@@ -1923,6 +1930,18 @@ var init_DatabaseImpl = __esm({
|
|
|
1923
1930
|
}
|
|
1924
1931
|
return this.updateOutput(() => db.get(id3));
|
|
1925
1932
|
}
|
|
1933
|
+
async docExists(docId) {
|
|
1934
|
+
const db = await this.checkSetup();
|
|
1935
|
+
let _rev, exists;
|
|
1936
|
+
try {
|
|
1937
|
+
const { etag } = await db.head(docId);
|
|
1938
|
+
_rev = etag;
|
|
1939
|
+
exists = true;
|
|
1940
|
+
} catch (err) {
|
|
1941
|
+
exists = false;
|
|
1942
|
+
}
|
|
1943
|
+
return { _rev, exists };
|
|
1944
|
+
}
|
|
1926
1945
|
async remove(idOrDoc, rev2) {
|
|
1927
1946
|
const db = await this.checkSetup();
|
|
1928
1947
|
let _id;
|
|
@@ -1954,7 +1973,7 @@ var init_DatabaseImpl = __esm({
|
|
|
1954
1973
|
document.createdAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
1955
1974
|
}
|
|
1956
1975
|
document.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
1957
|
-
if (opts
|
|
1976
|
+
if ((opts == null ? void 0 : opts.force) && document._id) {
|
|
1958
1977
|
try {
|
|
1959
1978
|
const existing = await this.get(document._id);
|
|
1960
1979
|
if (existing) {
|
|
@@ -2123,7 +2142,7 @@ async function doInTenant(tenantId, task) {
|
|
|
2123
2142
|
function getIdentity() {
|
|
2124
2143
|
try {
|
|
2125
2144
|
const context = Context.get();
|
|
2126
|
-
return context
|
|
2145
|
+
return context == null ? void 0 : context.identity;
|
|
2127
2146
|
} catch (e) {
|
|
2128
2147
|
}
|
|
2129
2148
|
}
|
|
@@ -2132,7 +2151,7 @@ function getTenantId() {
|
|
|
2132
2151
|
return DEFAULT_TENANT_ID;
|
|
2133
2152
|
}
|
|
2134
2153
|
const context = Context.get();
|
|
2135
|
-
const tenantId = context
|
|
2154
|
+
const tenantId = context == null ? void 0 : context.tenantId;
|
|
2136
2155
|
if (!tenantId) {
|
|
2137
2156
|
throw new Error("Tenant id not found");
|
|
2138
2157
|
}
|
|
@@ -2140,11 +2159,11 @@ function getTenantId() {
|
|
|
2140
2159
|
}
|
|
2141
2160
|
function getAutomationId() {
|
|
2142
2161
|
const context = Context.get();
|
|
2143
|
-
return context
|
|
2162
|
+
return context == null ? void 0 : context.automationId;
|
|
2144
2163
|
}
|
|
2145
2164
|
function getAppId() {
|
|
2146
2165
|
const context = Context.get();
|
|
2147
|
-
const foundId = context
|
|
2166
|
+
const foundId = context == null ? void 0 : context.appId;
|
|
2148
2167
|
if (!foundId && environment_default.isTest() && TEST_APP_ID) {
|
|
2149
2168
|
return TEST_APP_ID;
|
|
2150
2169
|
} else {
|
|
@@ -2156,11 +2175,11 @@ function getGlobalDB() {
|
|
|
2156
2175
|
if (!context || environment_default.MULTI_TENANCY && !context.tenantId) {
|
|
2157
2176
|
throw new Error("Global DB not found");
|
|
2158
2177
|
}
|
|
2159
|
-
return getDB(baseGlobalDBName(context
|
|
2178
|
+
return getDB(baseGlobalDBName(context == null ? void 0 : context.tenantId));
|
|
2160
2179
|
}
|
|
2161
2180
|
function isScim() {
|
|
2162
2181
|
const context = Context.get();
|
|
2163
|
-
const scimCall = context
|
|
2182
|
+
const scimCall = context == null ? void 0 : context.isScim;
|
|
2164
2183
|
return !!scimCall;
|
|
2165
2184
|
}
|
|
2166
2185
|
var TEST_APP_ID;
|
|
@@ -2831,34 +2850,38 @@ async function runQuery(url, body, cookie) {
|
|
|
2831
2850
|
}
|
|
2832
2851
|
return output;
|
|
2833
2852
|
}
|
|
2834
|
-
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;
|
|
2835
2854
|
var init_lucene = __esm({
|
|
2836
2855
|
"src/db/lucene.ts"() {
|
|
2837
2856
|
"use strict";
|
|
2838
2857
|
import_node_fetch2 = __toESM(require("node-fetch"));
|
|
2839
2858
|
init_couch();
|
|
2840
2859
|
QUERY_START_REGEX = /\d[0-9]*:/g;
|
|
2841
|
-
|
|
2842
|
-
#dbName;
|
|
2843
|
-
#index;
|
|
2844
|
-
#query;
|
|
2845
|
-
#limit;
|
|
2846
|
-
#sort;
|
|
2847
|
-
#bookmark;
|
|
2848
|
-
#sortOrder;
|
|
2849
|
-
#sortType;
|
|
2850
|
-
#includeDocs;
|
|
2851
|
-
#version;
|
|
2852
|
-
#indexBuilder;
|
|
2853
|
-
#noEscaping = false;
|
|
2854
|
-
#skip;
|
|
2855
|
-
static {
|
|
2856
|
-
this.maxLimit = 200;
|
|
2857
|
-
}
|
|
2860
|
+
_QueryBuilder = class _QueryBuilder {
|
|
2858
2861
|
constructor(dbName, index2, base) {
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
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, {
|
|
2862
2885
|
allOr: false,
|
|
2863
2886
|
string: {},
|
|
2864
2887
|
fuzzy: {},
|
|
@@ -2872,124 +2895,124 @@ var init_lucene = __esm({
|
|
|
2872
2895
|
notContains: {},
|
|
2873
2896
|
containsAny: {},
|
|
2874
2897
|
...base
|
|
2875
|
-
};
|
|
2876
|
-
this
|
|
2877
|
-
this
|
|
2878
|
-
this
|
|
2879
|
-
this
|
|
2898
|
+
});
|
|
2899
|
+
__privateSet(this, _limit, 50);
|
|
2900
|
+
__privateSet(this, _sortOrder, "ascending");
|
|
2901
|
+
__privateSet(this, _sortType, "string");
|
|
2902
|
+
__privateSet(this, _includeDocs, true);
|
|
2880
2903
|
}
|
|
2881
2904
|
disableEscaping() {
|
|
2882
|
-
this
|
|
2905
|
+
__privateSet(this, _noEscaping, true);
|
|
2883
2906
|
return this;
|
|
2884
2907
|
}
|
|
2885
2908
|
setIndexBuilder(builderFn) {
|
|
2886
|
-
this
|
|
2909
|
+
__privateSet(this, _indexBuilder, builderFn);
|
|
2887
2910
|
return this;
|
|
2888
2911
|
}
|
|
2889
2912
|
setVersion(version) {
|
|
2890
2913
|
if (version != null) {
|
|
2891
|
-
this
|
|
2914
|
+
__privateSet(this, _version, version);
|
|
2892
2915
|
}
|
|
2893
2916
|
return this;
|
|
2894
2917
|
}
|
|
2895
2918
|
setTable(tableId) {
|
|
2896
|
-
this
|
|
2919
|
+
__privateGet(this, _query).equal.tableId = tableId;
|
|
2897
2920
|
return this;
|
|
2898
2921
|
}
|
|
2899
2922
|
setLimit(limit) {
|
|
2900
2923
|
if (limit != null) {
|
|
2901
|
-
this
|
|
2924
|
+
__privateSet(this, _limit, limit);
|
|
2902
2925
|
}
|
|
2903
2926
|
return this;
|
|
2904
2927
|
}
|
|
2905
2928
|
setSort(sort) {
|
|
2906
2929
|
if (sort != null) {
|
|
2907
|
-
this
|
|
2930
|
+
__privateSet(this, _sort, sort);
|
|
2908
2931
|
}
|
|
2909
2932
|
return this;
|
|
2910
2933
|
}
|
|
2911
2934
|
setSortOrder(sortOrder) {
|
|
2912
2935
|
if (sortOrder != null) {
|
|
2913
|
-
this
|
|
2936
|
+
__privateSet(this, _sortOrder, sortOrder);
|
|
2914
2937
|
}
|
|
2915
2938
|
return this;
|
|
2916
2939
|
}
|
|
2917
2940
|
setSortType(sortType) {
|
|
2918
2941
|
if (sortType != null) {
|
|
2919
|
-
this
|
|
2942
|
+
__privateSet(this, _sortType, sortType);
|
|
2920
2943
|
}
|
|
2921
2944
|
return this;
|
|
2922
2945
|
}
|
|
2923
2946
|
setBookmark(bookmark) {
|
|
2924
2947
|
if (bookmark != null) {
|
|
2925
|
-
this
|
|
2948
|
+
__privateSet(this, _bookmark, bookmark);
|
|
2926
2949
|
}
|
|
2927
2950
|
return this;
|
|
2928
2951
|
}
|
|
2929
2952
|
setSkip(skip) {
|
|
2930
|
-
this
|
|
2953
|
+
__privateSet(this, _skip, skip);
|
|
2931
2954
|
return this;
|
|
2932
2955
|
}
|
|
2933
2956
|
excludeDocs() {
|
|
2934
|
-
this
|
|
2957
|
+
__privateSet(this, _includeDocs, false);
|
|
2935
2958
|
return this;
|
|
2936
2959
|
}
|
|
2937
2960
|
includeDocs() {
|
|
2938
|
-
this
|
|
2961
|
+
__privateSet(this, _includeDocs, true);
|
|
2939
2962
|
return this;
|
|
2940
2963
|
}
|
|
2941
2964
|
addString(key, partial) {
|
|
2942
|
-
this
|
|
2965
|
+
__privateGet(this, _query).string[key] = partial;
|
|
2943
2966
|
return this;
|
|
2944
2967
|
}
|
|
2945
2968
|
addFuzzy(key, fuzzy) {
|
|
2946
|
-
this
|
|
2969
|
+
__privateGet(this, _query).fuzzy[key] = fuzzy;
|
|
2947
2970
|
return this;
|
|
2948
2971
|
}
|
|
2949
2972
|
addRange(key, low, high) {
|
|
2950
|
-
this
|
|
2973
|
+
__privateGet(this, _query).range[key] = {
|
|
2951
2974
|
low,
|
|
2952
2975
|
high
|
|
2953
2976
|
};
|
|
2954
2977
|
return this;
|
|
2955
2978
|
}
|
|
2956
2979
|
addEqual(key, value) {
|
|
2957
|
-
this
|
|
2980
|
+
__privateGet(this, _query).equal[key] = value;
|
|
2958
2981
|
return this;
|
|
2959
2982
|
}
|
|
2960
2983
|
addNotEqual(key, value) {
|
|
2961
|
-
this
|
|
2984
|
+
__privateGet(this, _query).notEqual[key] = value;
|
|
2962
2985
|
return this;
|
|
2963
2986
|
}
|
|
2964
2987
|
addEmpty(key, value) {
|
|
2965
|
-
this
|
|
2988
|
+
__privateGet(this, _query).empty[key] = value;
|
|
2966
2989
|
return this;
|
|
2967
2990
|
}
|
|
2968
2991
|
addNotEmpty(key, value) {
|
|
2969
|
-
this
|
|
2992
|
+
__privateGet(this, _query).notEmpty[key] = value;
|
|
2970
2993
|
return this;
|
|
2971
2994
|
}
|
|
2972
2995
|
addOneOf(key, value) {
|
|
2973
|
-
this
|
|
2996
|
+
__privateGet(this, _query).oneOf[key] = value;
|
|
2974
2997
|
return this;
|
|
2975
2998
|
}
|
|
2976
2999
|
addContains(key, value) {
|
|
2977
|
-
this
|
|
3000
|
+
__privateGet(this, _query).contains[key] = value;
|
|
2978
3001
|
return this;
|
|
2979
3002
|
}
|
|
2980
3003
|
addNotContains(key, value) {
|
|
2981
|
-
this
|
|
3004
|
+
__privateGet(this, _query).notContains[key] = value;
|
|
2982
3005
|
return this;
|
|
2983
3006
|
}
|
|
2984
3007
|
addContainsAny(key, value) {
|
|
2985
|
-
this
|
|
3008
|
+
__privateGet(this, _query).containsAny[key] = value;
|
|
2986
3009
|
return this;
|
|
2987
3010
|
}
|
|
2988
3011
|
setAllOr() {
|
|
2989
|
-
this
|
|
3012
|
+
__privateGet(this, _query).allOr = true;
|
|
2990
3013
|
}
|
|
2991
3014
|
handleSpaces(input) {
|
|
2992
|
-
if (this
|
|
3015
|
+
if (__privateGet(this, _noEscaping)) {
|
|
2993
3016
|
return input;
|
|
2994
3017
|
} else {
|
|
2995
3018
|
return input.replace(/ /g, "_");
|
|
@@ -3003,12 +3026,12 @@ var init_lucene = __esm({
|
|
|
3003
3026
|
* @returns {string|*}
|
|
3004
3027
|
*/
|
|
3005
3028
|
preprocess(value, { escape, lowercase, wrap, type } = {}) {
|
|
3006
|
-
const hasVersion = !!this
|
|
3029
|
+
const hasVersion = !!__privateGet(this, _version);
|
|
3007
3030
|
const originalType = typeof value;
|
|
3008
3031
|
if (value && lowercase) {
|
|
3009
3032
|
value = value.toLowerCase ? value.toLowerCase() : value;
|
|
3010
3033
|
}
|
|
3011
|
-
if (!this
|
|
3034
|
+
if (!__privateGet(this, _noEscaping) && escape && originalType === "string") {
|
|
3012
3035
|
value = `${value}`.replace(/[ \/#+\-&|!(){}\]^"~*?:\\]/g, "\\$&");
|
|
3013
3036
|
}
|
|
3014
3037
|
if (originalType === "string" && !isNaN(value) && !type) {
|
|
@@ -3020,7 +3043,7 @@ var init_lucene = __esm({
|
|
|
3020
3043
|
}
|
|
3021
3044
|
isMultiCondition() {
|
|
3022
3045
|
let count = 0;
|
|
3023
|
-
for (let filters of Object.values(this
|
|
3046
|
+
for (let filters of Object.values(__privateGet(this, _query))) {
|
|
3024
3047
|
if (typeof filters === "object") {
|
|
3025
3048
|
count += Object.keys(filters).length;
|
|
3026
3049
|
}
|
|
@@ -3046,13 +3069,13 @@ var init_lucene = __esm({
|
|
|
3046
3069
|
}
|
|
3047
3070
|
buildSearchQuery() {
|
|
3048
3071
|
const builder = this;
|
|
3049
|
-
let allOr = this
|
|
3072
|
+
let allOr = __privateGet(this, _query) && __privateGet(this, _query).allOr;
|
|
3050
3073
|
let query = allOr ? "" : "*:*";
|
|
3051
3074
|
const allPreProcessingOpts = { escape: true, lowercase: true, wrap: true };
|
|
3052
3075
|
let tableId;
|
|
3053
|
-
if (this
|
|
3054
|
-
tableId = this
|
|
3055
|
-
delete this
|
|
3076
|
+
if (__privateGet(this, _query).equal.tableId) {
|
|
3077
|
+
tableId = __privateGet(this, _query).equal.tableId;
|
|
3078
|
+
delete __privateGet(this, _query).equal.tableId;
|
|
3056
3079
|
}
|
|
3057
3080
|
const equal = (key, value) => {
|
|
3058
3081
|
if (!value && value !== 0) {
|
|
@@ -3126,19 +3149,19 @@ var init_lucene = __esm({
|
|
|
3126
3149
|
continue;
|
|
3127
3150
|
}
|
|
3128
3151
|
if (built.length > 0 || query.length > 0) {
|
|
3129
|
-
const mode = opts
|
|
3152
|
+
const mode = (opts == null ? void 0 : opts.mode) ? opts.mode : allOr ? "OR" : "AND";
|
|
3130
3153
|
built += ` ${mode} `;
|
|
3131
3154
|
}
|
|
3132
3155
|
built += expression;
|
|
3133
3156
|
}
|
|
3134
|
-
if (opts
|
|
3157
|
+
if (opts == null ? void 0 : opts.returnBuilt) {
|
|
3135
3158
|
return built;
|
|
3136
3159
|
} else {
|
|
3137
3160
|
query += built;
|
|
3138
3161
|
}
|
|
3139
3162
|
}
|
|
3140
|
-
if (this
|
|
3141
|
-
build(this
|
|
3163
|
+
if (__privateGet(this, _query).string) {
|
|
3164
|
+
build(__privateGet(this, _query).string, (key, value) => {
|
|
3142
3165
|
if (!value) {
|
|
3143
3166
|
return null;
|
|
3144
3167
|
}
|
|
@@ -3150,8 +3173,8 @@ var init_lucene = __esm({
|
|
|
3150
3173
|
return `${key}:${value}*`;
|
|
3151
3174
|
});
|
|
3152
3175
|
}
|
|
3153
|
-
if (this
|
|
3154
|
-
build(this
|
|
3176
|
+
if (__privateGet(this, _query).range) {
|
|
3177
|
+
build(__privateGet(this, _query).range, (key, value) => {
|
|
3155
3178
|
if (!value) {
|
|
3156
3179
|
return null;
|
|
3157
3180
|
}
|
|
@@ -3166,14 +3189,14 @@ var init_lucene = __esm({
|
|
|
3166
3189
|
return `${key}:[${low} TO ${high}]`;
|
|
3167
3190
|
});
|
|
3168
3191
|
}
|
|
3169
|
-
if (this
|
|
3170
|
-
build(this
|
|
3192
|
+
if (__privateGet(this, _query).fuzzy) {
|
|
3193
|
+
build(__privateGet(this, _query).fuzzy, fuzzy);
|
|
3171
3194
|
}
|
|
3172
|
-
if (this
|
|
3173
|
-
build(this
|
|
3195
|
+
if (__privateGet(this, _query).equal) {
|
|
3196
|
+
build(__privateGet(this, _query).equal, equal);
|
|
3174
3197
|
}
|
|
3175
|
-
if (this
|
|
3176
|
-
build(this
|
|
3198
|
+
if (__privateGet(this, _query).notEqual) {
|
|
3199
|
+
build(__privateGet(this, _query).notEqual, (key, value) => {
|
|
3177
3200
|
if (!value) {
|
|
3178
3201
|
return null;
|
|
3179
3202
|
}
|
|
@@ -3183,23 +3206,23 @@ var init_lucene = __esm({
|
|
|
3183
3206
|
return `!${key}:${builder.preprocess(value, allPreProcessingOpts)}`;
|
|
3184
3207
|
});
|
|
3185
3208
|
}
|
|
3186
|
-
if (this
|
|
3187
|
-
build(this
|
|
3209
|
+
if (__privateGet(this, _query).empty) {
|
|
3210
|
+
build(__privateGet(this, _query).empty, (key) => `(*:* -${key}:["" TO *])`);
|
|
3188
3211
|
}
|
|
3189
|
-
if (this
|
|
3190
|
-
build(this
|
|
3212
|
+
if (__privateGet(this, _query).notEmpty) {
|
|
3213
|
+
build(__privateGet(this, _query).notEmpty, (key) => `${key}:["" TO *]`);
|
|
3191
3214
|
}
|
|
3192
|
-
if (this
|
|
3193
|
-
build(this
|
|
3215
|
+
if (__privateGet(this, _query).oneOf) {
|
|
3216
|
+
build(__privateGet(this, _query).oneOf, oneOf);
|
|
3194
3217
|
}
|
|
3195
|
-
if (this
|
|
3196
|
-
build(this
|
|
3218
|
+
if (__privateGet(this, _query).contains) {
|
|
3219
|
+
build(__privateGet(this, _query).contains, contains);
|
|
3197
3220
|
}
|
|
3198
|
-
if (this
|
|
3199
|
-
build(this.compressFilters(this
|
|
3221
|
+
if (__privateGet(this, _query).notContains) {
|
|
3222
|
+
build(this.compressFilters(__privateGet(this, _query).notContains), notContains);
|
|
3200
3223
|
}
|
|
3201
|
-
if (this
|
|
3202
|
-
build(this
|
|
3224
|
+
if (__privateGet(this, _query).containsAny) {
|
|
3225
|
+
build(__privateGet(this, _query).containsAny, containsAny);
|
|
3203
3226
|
}
|
|
3204
3227
|
if (tableId) {
|
|
3205
3228
|
query = this.isMultiCondition() ? `(${query})` : query;
|
|
@@ -3211,63 +3234,75 @@ var init_lucene = __esm({
|
|
|
3211
3234
|
buildSearchBody() {
|
|
3212
3235
|
let body = {
|
|
3213
3236
|
q: this.buildSearchQuery(),
|
|
3214
|
-
limit: Math.min(this
|
|
3215
|
-
include_docs: this
|
|
3237
|
+
limit: Math.min(__privateGet(this, _limit), _QueryBuilder.maxLimit),
|
|
3238
|
+
include_docs: __privateGet(this, _includeDocs)
|
|
3216
3239
|
};
|
|
3217
|
-
if (this
|
|
3218
|
-
body.bookmark = this
|
|
3240
|
+
if (__privateGet(this, _bookmark)) {
|
|
3241
|
+
body.bookmark = __privateGet(this, _bookmark);
|
|
3219
3242
|
}
|
|
3220
|
-
if (this
|
|
3221
|
-
const order = this
|
|
3222
|
-
const type = `<${this
|
|
3223
|
-
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}`;
|
|
3224
3247
|
}
|
|
3225
3248
|
return body;
|
|
3226
3249
|
}
|
|
3227
3250
|
async run() {
|
|
3228
|
-
if (this
|
|
3229
|
-
await this
|
|
3251
|
+
if (__privateGet(this, _skip)) {
|
|
3252
|
+
await __privateMethod(this, _skipItems, skipItems_fn).call(this, __privateGet(this, _skip));
|
|
3230
3253
|
}
|
|
3231
|
-
return await this
|
|
3254
|
+
return await __privateMethod(this, _execute, execute_fn).call(this);
|
|
3232
3255
|
}
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
const
|
|
3258
|
-
|
|
3259
|
-
|
|
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);
|
|
3260
3298
|
return await runQuery(fullPath, body, cookie);
|
|
3261
|
-
}
|
|
3262
|
-
|
|
3263
|
-
await this.#indexBuilder();
|
|
3264
|
-
return await runQuery(fullPath, body, cookie);
|
|
3265
|
-
} else {
|
|
3266
|
-
throw err;
|
|
3267
|
-
}
|
|
3299
|
+
} else {
|
|
3300
|
+
throw err;
|
|
3268
3301
|
}
|
|
3269
3302
|
}
|
|
3270
3303
|
};
|
|
3304
|
+
_QueryBuilder.maxLimit = 200;
|
|
3305
|
+
QueryBuilder = _QueryBuilder;
|
|
3271
3306
|
}
|
|
3272
3307
|
});
|
|
3273
3308
|
|
|
@@ -3420,7 +3455,7 @@ function getFullPath(fileName) {
|
|
|
3420
3455
|
}
|
|
3421
3456
|
function getSingleFileMaxSizeInfo(totalMaxSize) {
|
|
3422
3457
|
const regex = /(\d+)([A-Za-z])/;
|
|
3423
|
-
const match = totalMaxSize
|
|
3458
|
+
const match = totalMaxSize == null ? void 0 : totalMaxSize.match(regex);
|
|
3424
3459
|
if (!match) {
|
|
3425
3460
|
console.warn(`totalMaxSize does not have a valid value`, {
|
|
3426
3461
|
totalMaxSize
|
|
@@ -3452,9 +3487,9 @@ function localFileDestination() {
|
|
|
3452
3487
|
const fileInfo = getSingleFileMaxSizeInfo(environment_default.ROLLING_LOG_MAX_SIZE);
|
|
3453
3488
|
const outFile = rfs.createStream(logsFileName, {
|
|
3454
3489
|
// As we have a rolling size, we want to half the max size
|
|
3455
|
-
size: fileInfo
|
|
3490
|
+
size: fileInfo == null ? void 0 : fileInfo.size,
|
|
3456
3491
|
path: logsPath,
|
|
3457
|
-
maxFiles: fileInfo
|
|
3492
|
+
maxFiles: (fileInfo == null ? void 0 : fileInfo.totalHistoryFiles) || 1,
|
|
3458
3493
|
immutable: true,
|
|
3459
3494
|
history: budibaseLogsHistoryFileName,
|
|
3460
3495
|
initialRotation: false
|
|
@@ -3529,8 +3564,8 @@ var init_logger = __esm({
|
|
|
3529
3564
|
tenantId: getTenantId2(),
|
|
3530
3565
|
appId: getAppId2(),
|
|
3531
3566
|
automationId: getAutomationId2(),
|
|
3532
|
-
identityId: identity
|
|
3533
|
-
identityType: identity
|
|
3567
|
+
identityId: identity == null ? void 0 : identity._id,
|
|
3568
|
+
identityType: identity == null ? void 0 : identity.type,
|
|
3534
3569
|
correlationId: getId()
|
|
3535
3570
|
};
|
|
3536
3571
|
const mergingObject = {
|
|
@@ -3594,30 +3629,30 @@ var init_logger = __esm({
|
|
|
3594
3629
|
pinoInstance = destinations.length ? (0, import_pino.default)(pinoOptions, import_pino.default.multistream(destinations)) : (0, import_pino.default)(pinoOptions);
|
|
3595
3630
|
console.log = (...arg) => {
|
|
3596
3631
|
const [obj, msg] = getLogParams2(arg);
|
|
3597
|
-
pinoInstance
|
|
3632
|
+
pinoInstance == null ? void 0 : pinoInstance.info(obj, msg);
|
|
3598
3633
|
};
|
|
3599
3634
|
console.info = (...arg) => {
|
|
3600
3635
|
const [obj, msg] = getLogParams2(arg);
|
|
3601
|
-
pinoInstance
|
|
3636
|
+
pinoInstance == null ? void 0 : pinoInstance.info(obj, msg);
|
|
3602
3637
|
};
|
|
3603
3638
|
console.warn = (...arg) => {
|
|
3604
3639
|
const [obj, msg] = getLogParams2(arg);
|
|
3605
|
-
pinoInstance
|
|
3640
|
+
pinoInstance == null ? void 0 : pinoInstance.warn(obj, msg);
|
|
3606
3641
|
};
|
|
3607
3642
|
console.error = (...arg) => {
|
|
3608
3643
|
const [obj, msg] = getLogParams2(arg);
|
|
3609
|
-
pinoInstance
|
|
3644
|
+
pinoInstance == null ? void 0 : pinoInstance.error(obj, msg);
|
|
3610
3645
|
};
|
|
3611
3646
|
console.trace = (...arg) => {
|
|
3612
3647
|
const [obj, msg] = getLogParams2(arg);
|
|
3613
3648
|
if (!obj.err) {
|
|
3614
3649
|
obj.err = new Error();
|
|
3615
3650
|
}
|
|
3616
|
-
pinoInstance
|
|
3651
|
+
pinoInstance == null ? void 0 : pinoInstance.trace(obj, msg);
|
|
3617
3652
|
};
|
|
3618
3653
|
console.debug = (...arg) => {
|
|
3619
3654
|
const [obj, msg] = getLogParams2(arg);
|
|
3620
|
-
pinoInstance
|
|
3655
|
+
pinoInstance == null ? void 0 : pinoInstance.debug(obj, msg);
|
|
3621
3656
|
};
|
|
3622
3657
|
const getTenantId2 = () => {
|
|
3623
3658
|
let tenantId;
|
|
@@ -4103,6 +4138,7 @@ async function getSettingsConfigDoc() {
|
|
|
4103
4138
|
async function getPlatformUrl(opts = {
|
|
4104
4139
|
tenantAware: true
|
|
4105
4140
|
}) {
|
|
4141
|
+
var _a;
|
|
4106
4142
|
let platformUrl = environment_default.PLATFORM_URL || "http://localhost:10000";
|
|
4107
4143
|
if (!environment_default.SELF_HOSTED && environment_default.MULTI_TENANCY && opts.tenantAware) {
|
|
4108
4144
|
const tenantId = getTenantId();
|
|
@@ -4110,11 +4146,11 @@ async function getPlatformUrl(opts = {
|
|
|
4110
4146
|
platformUrl = platformUrl.replace("://", `://${tenantId}.`);
|
|
4111
4147
|
}
|
|
4112
4148
|
} else if (environment_default.SELF_HOSTED) {
|
|
4113
|
-
const config = opts
|
|
4149
|
+
const config = (opts == null ? void 0 : opts.config) ? opts.config : (
|
|
4114
4150
|
// direct to db to prevent infinite loop
|
|
4115
|
-
(await getConfig("settings" /* SETTINGS */))
|
|
4151
|
+
(_a = await getConfig("settings" /* SETTINGS */)) == null ? void 0 : _a.config
|
|
4116
4152
|
);
|
|
4117
|
-
if (config
|
|
4153
|
+
if (config == null ? void 0 : config.platformUrl) {
|
|
4118
4154
|
platformUrl = config.platformUrl;
|
|
4119
4155
|
}
|
|
4120
4156
|
}
|
|
@@ -4138,13 +4174,14 @@ var init_configs2 = __esm({
|
|
|
4138
4174
|
"analyticsEnabled" /* ANALYTICS_ENABLED */,
|
|
4139
4175
|
86400 /* ONE_DAY */,
|
|
4140
4176
|
async () => {
|
|
4141
|
-
|
|
4177
|
+
var _a;
|
|
4178
|
+
const config = (opts == null ? void 0 : opts.config) ? opts.config : (
|
|
4142
4179
|
// direct to db to prevent infinite loop
|
|
4143
|
-
(await getConfig("settings" /* SETTINGS */))
|
|
4180
|
+
(_a = await getConfig("settings" /* SETTINGS */)) == null ? void 0 : _a.config
|
|
4144
4181
|
);
|
|
4145
|
-
if (config
|
|
4182
|
+
if ((config == null ? void 0 : config.analyticsEnabled) === false) {
|
|
4146
4183
|
return false;
|
|
4147
|
-
} else if (config
|
|
4184
|
+
} else if ((config == null ? void 0 : config.analyticsEnabled) === true) {
|
|
4148
4185
|
return true;
|
|
4149
4186
|
}
|
|
4150
4187
|
}
|
|
@@ -4646,6 +4683,7 @@ function handleStalled(queue, removeStalledCb) {
|
|
|
4646
4683
|
});
|
|
4647
4684
|
}
|
|
4648
4685
|
function getLogParams(eventType, event, opts = {}, extra = {}) {
|
|
4686
|
+
var _a, _b, _c;
|
|
4649
4687
|
const message = `[BULL] ${eventType}=${event}`;
|
|
4650
4688
|
const err = opts.error;
|
|
4651
4689
|
const bullLog = {
|
|
@@ -4653,11 +4691,11 @@ function getLogParams(eventType, event, opts = {}, extra = {}) {
|
|
|
4653
4691
|
eventType,
|
|
4654
4692
|
event,
|
|
4655
4693
|
job: opts.job,
|
|
4656
|
-
jobId: opts.jobId || opts.job
|
|
4694
|
+
jobId: opts.jobId || ((_a = opts.job) == null ? void 0 : _a.id),
|
|
4657
4695
|
...extra
|
|
4658
4696
|
};
|
|
4659
4697
|
let automationLog;
|
|
4660
|
-
if (opts.job
|
|
4698
|
+
if ((_c = (_b = opts.job) == null ? void 0 : _b.data) == null ? void 0 : _c.automation) {
|
|
4661
4699
|
automationLog = {
|
|
4662
4700
|
_logKey: "automation",
|
|
4663
4701
|
trigger: opts.job ? opts.job.data.automation.definition.trigger.event : void 0
|
|
@@ -4666,9 +4704,11 @@ function getLogParams(eventType, event, opts = {}, extra = {}) {
|
|
|
4666
4704
|
return [message, err, bullLog, automationLog];
|
|
4667
4705
|
}
|
|
4668
4706
|
function logging(queue, jobQueue) {
|
|
4707
|
+
var _a;
|
|
4669
4708
|
const eventType = EventTypeMap[jobQueue];
|
|
4670
4709
|
function doInJobContext(job, task) {
|
|
4671
|
-
|
|
4710
|
+
var _a2;
|
|
4711
|
+
const appId = (_a2 = job.data.event) == null ? void 0 : _a2.appId;
|
|
4672
4712
|
if (appId) {
|
|
4673
4713
|
return doInContext(appId, task);
|
|
4674
4714
|
} else {
|
|
@@ -4682,7 +4722,7 @@ function logging(queue, jobQueue) {
|
|
|
4682
4722
|
}).on("error" /* ERROR */, (error) => {
|
|
4683
4723
|
console.error(...getLogParams(eventType, "error" /* ERROR */, { error }));
|
|
4684
4724
|
});
|
|
4685
|
-
if (process.env.NODE_DEBUG
|
|
4725
|
+
if ((_a = process.env.NODE_DEBUG) == null ? void 0 : _a.includes("bull")) {
|
|
4686
4726
|
queue.on("waiting" /* WAITING */, (jobId) => {
|
|
4687
4727
|
console.info(...getLogParams(eventType, "waiting" /* WAITING */, { jobId }));
|
|
4688
4728
|
}).on("active" /* ACTIVE */, async (job, jobPromise) => {
|
|
@@ -4762,7 +4802,7 @@ function createQueue(jobQueue, opts = {}) {
|
|
|
4762
4802
|
} else {
|
|
4763
4803
|
queue = new inMemoryQueue_default(jobQueue, queueConfig);
|
|
4764
4804
|
}
|
|
4765
|
-
addListeners(queue, jobQueue, opts
|
|
4805
|
+
addListeners(queue, jobQueue, opts == null ? void 0 : opts.removeStalledCb);
|
|
4766
4806
|
QUEUES.push(queue);
|
|
4767
4807
|
if (!cleanupInterval && !environment_default.isTest()) {
|
|
4768
4808
|
cleanupInterval = set(cleanup, CLEANUP_PERIOD_MS);
|
|
@@ -4797,7 +4837,7 @@ var init_queue2 = __esm({
|
|
|
4797
4837
|
});
|
|
4798
4838
|
|
|
4799
4839
|
// src/events/processors/AuditLogsProcessor.ts
|
|
4800
|
-
var AuditLogsProcessor;
|
|
4840
|
+
var _AuditLogsProcessor, AuditLogsProcessor;
|
|
4801
4841
|
var init_AuditLogsProcessor = __esm({
|
|
4802
4842
|
"src/events/processors/AuditLogsProcessor.ts"() {
|
|
4803
4843
|
"use strict";
|
|
@@ -4806,10 +4846,7 @@ var init_AuditLogsProcessor = __esm({
|
|
|
4806
4846
|
init_queue2();
|
|
4807
4847
|
init_utils6();
|
|
4808
4848
|
init_environment2();
|
|
4809
|
-
|
|
4810
|
-
static {
|
|
4811
|
-
this.auditLogsEnabled = false;
|
|
4812
|
-
}
|
|
4849
|
+
_AuditLogsProcessor = class _AuditLogsProcessor {
|
|
4813
4850
|
// can't use constructor as need to return promise
|
|
4814
4851
|
static init(fn) {
|
|
4815
4852
|
_AuditLogsProcessor.auditLogsEnabled = true;
|
|
@@ -4861,9 +4898,12 @@ var init_AuditLogsProcessor = __esm({
|
|
|
4861
4898
|
async identifyGroup(group, timestamp) {
|
|
4862
4899
|
}
|
|
4863
4900
|
shutdown() {
|
|
4864
|
-
|
|
4901
|
+
var _a;
|
|
4902
|
+
(_a = _AuditLogsProcessor.auditLogQueue) == null ? void 0 : _a.close();
|
|
4865
4903
|
}
|
|
4866
4904
|
};
|
|
4905
|
+
_AuditLogsProcessor.auditLogsEnabled = false;
|
|
4906
|
+
AuditLogsProcessor = _AuditLogsProcessor;
|
|
4867
4907
|
}
|
|
4868
4908
|
});
|
|
4869
4909
|
|
|
@@ -5191,12 +5231,13 @@ __export(users_exports2, {
|
|
|
5191
5231
|
isGlobalBuilder: () => isGlobalBuilder
|
|
5192
5232
|
});
|
|
5193
5233
|
function isBuilder(user2, appId) {
|
|
5234
|
+
var _a, _b, _c;
|
|
5194
5235
|
if (!user2) {
|
|
5195
5236
|
return false;
|
|
5196
5237
|
}
|
|
5197
|
-
if (user2.builder
|
|
5238
|
+
if ((_a = user2.builder) == null ? void 0 : _a.global) {
|
|
5198
5239
|
return true;
|
|
5199
|
-
} 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)))) {
|
|
5200
5241
|
return true;
|
|
5201
5242
|
}
|
|
5202
5243
|
return false;
|
|
@@ -5214,24 +5255,27 @@ function isAdminOrBuilder(user2, appId) {
|
|
|
5214
5255
|
return isBuilder(user2, appId) || isAdmin(user2);
|
|
5215
5256
|
}
|
|
5216
5257
|
function hasAppBuilderPermissions(user2) {
|
|
5258
|
+
var _a, _b, _c;
|
|
5217
5259
|
if (!user2) {
|
|
5218
5260
|
return false;
|
|
5219
5261
|
}
|
|
5220
|
-
const appLength = user2.builder
|
|
5221
|
-
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);
|
|
5222
5264
|
return !isGlobalBuilder3 && appLength != null && appLength > 0;
|
|
5223
5265
|
}
|
|
5224
5266
|
function hasBuilderPermissions(user2) {
|
|
5267
|
+
var _a;
|
|
5225
5268
|
if (!user2) {
|
|
5226
5269
|
return false;
|
|
5227
5270
|
}
|
|
5228
|
-
return user2.builder
|
|
5271
|
+
return ((_a = user2.builder) == null ? void 0 : _a.global) || hasAppBuilderPermissions(user2);
|
|
5229
5272
|
}
|
|
5230
5273
|
function hasAdminPermissions(user2) {
|
|
5274
|
+
var _a;
|
|
5231
5275
|
if (!user2) {
|
|
5232
5276
|
return false;
|
|
5233
5277
|
}
|
|
5234
|
-
return !!user2.admin
|
|
5278
|
+
return !!((_a = user2.admin) == null ? void 0 : _a.global);
|
|
5235
5279
|
}
|
|
5236
5280
|
var init_users5 = __esm({
|
|
5237
5281
|
"../shared-core/src/sdk/documents/users.ts"() {
|
|
@@ -5479,8 +5523,8 @@ var init_identification2 = __esm({
|
|
|
5479
5523
|
if (isSSOUser(user2)) {
|
|
5480
5524
|
providerType3 = user2.providerType;
|
|
5481
5525
|
}
|
|
5482
|
-
const accountHolder = account2
|
|
5483
|
-
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;
|
|
5484
5528
|
const installationId = await getInstallationId();
|
|
5485
5529
|
const hosting = account2 ? account2.hosting : getHostingFromEnv();
|
|
5486
5530
|
const environment2 = getDeploymentEnvironment();
|
|
@@ -5647,7 +5691,7 @@ var init_backfill2 = __esm({
|
|
|
5647
5691
|
};
|
|
5648
5692
|
isBackfillingEvent = async (event) => {
|
|
5649
5693
|
const backfill = await getBackfillMetadata();
|
|
5650
|
-
const events2 = backfill
|
|
5694
|
+
const events2 = backfill == null ? void 0 : backfill.eventWhitelist;
|
|
5651
5695
|
if (events2 && events2.includes(event)) {
|
|
5652
5696
|
return true;
|
|
5653
5697
|
} else {
|
|
@@ -6040,11 +6084,12 @@ var init_auth4 = __esm({
|
|
|
6040
6084
|
|
|
6041
6085
|
// src/events/publishers/automation.ts
|
|
6042
6086
|
async function created3(automation, timestamp) {
|
|
6087
|
+
var _a, _b, _c, _d;
|
|
6043
6088
|
const properties = {
|
|
6044
6089
|
appId: automation.appId,
|
|
6045
6090
|
automationId: automation._id,
|
|
6046
|
-
triggerId: automation.definition
|
|
6047
|
-
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,
|
|
6048
6093
|
audited: {
|
|
6049
6094
|
name: automation.name
|
|
6050
6095
|
}
|
|
@@ -6052,20 +6097,22 @@ async function created3(automation, timestamp) {
|
|
|
6052
6097
|
await publishEvent("automation:created" /* AUTOMATION_CREATED */, properties, timestamp);
|
|
6053
6098
|
}
|
|
6054
6099
|
async function triggerUpdated(automation) {
|
|
6100
|
+
var _a, _b, _c, _d;
|
|
6055
6101
|
const properties = {
|
|
6056
6102
|
appId: automation.appId,
|
|
6057
6103
|
automationId: automation._id,
|
|
6058
|
-
triggerId: automation.definition
|
|
6059
|
-
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
|
|
6060
6106
|
};
|
|
6061
6107
|
await publishEvent("automation:trigger:updated" /* AUTOMATION_TRIGGER_UPDATED */, properties);
|
|
6062
6108
|
}
|
|
6063
6109
|
async function deleted3(automation) {
|
|
6110
|
+
var _a, _b, _c, _d;
|
|
6064
6111
|
const properties = {
|
|
6065
6112
|
appId: automation.appId,
|
|
6066
6113
|
automationId: automation._id,
|
|
6067
|
-
triggerId: automation.definition
|
|
6068
|
-
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,
|
|
6069
6116
|
audited: {
|
|
6070
6117
|
name: automation.name
|
|
6071
6118
|
}
|
|
@@ -6073,20 +6120,22 @@ async function deleted3(automation) {
|
|
|
6073
6120
|
await publishEvent("automation:deleted" /* AUTOMATION_DELETED */, properties);
|
|
6074
6121
|
}
|
|
6075
6122
|
async function tested(automation) {
|
|
6123
|
+
var _a, _b, _c, _d;
|
|
6076
6124
|
const properties = {
|
|
6077
6125
|
appId: automation.appId,
|
|
6078
6126
|
automationId: automation._id,
|
|
6079
|
-
triggerId: automation.definition
|
|
6080
|
-
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
|
|
6081
6129
|
};
|
|
6082
6130
|
await publishEvent("automation:tested" /* AUTOMATION_TESTED */, properties);
|
|
6083
6131
|
}
|
|
6084
6132
|
async function stepCreated(automation, step, timestamp) {
|
|
6133
|
+
var _a, _b, _c, _d;
|
|
6085
6134
|
const properties = {
|
|
6086
6135
|
appId: automation.appId,
|
|
6087
6136
|
automationId: automation._id,
|
|
6088
|
-
triggerId: automation.definition
|
|
6089
|
-
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,
|
|
6090
6139
|
stepId: step.id,
|
|
6091
6140
|
stepType: step.stepId,
|
|
6092
6141
|
audited: {
|
|
@@ -6096,11 +6145,12 @@ async function stepCreated(automation, step, timestamp) {
|
|
|
6096
6145
|
await publishEvent("automation:step:created" /* AUTOMATION_STEP_CREATED */, properties, timestamp);
|
|
6097
6146
|
}
|
|
6098
6147
|
async function stepDeleted(automation, step) {
|
|
6148
|
+
var _a, _b, _c, _d;
|
|
6099
6149
|
const properties = {
|
|
6100
6150
|
appId: automation.appId,
|
|
6101
6151
|
automationId: automation._id,
|
|
6102
|
-
triggerId: automation.definition
|
|
6103
|
-
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,
|
|
6104
6154
|
stepId: step.id,
|
|
6105
6155
|
stepType: step.stepId,
|
|
6106
6156
|
audited: {
|
|
@@ -6449,23 +6499,25 @@ var init_role3 = __esm({
|
|
|
6449
6499
|
|
|
6450
6500
|
// src/events/publishers/screen.ts
|
|
6451
6501
|
async function created8(screen, timestamp) {
|
|
6502
|
+
var _a;
|
|
6452
6503
|
const properties = {
|
|
6453
6504
|
layoutId: screen.layoutId,
|
|
6454
6505
|
screenId: screen._id,
|
|
6455
6506
|
roleId: screen.routing.roleId,
|
|
6456
6507
|
audited: {
|
|
6457
|
-
name: screen.routing
|
|
6508
|
+
name: (_a = screen.routing) == null ? void 0 : _a.route
|
|
6458
6509
|
}
|
|
6459
6510
|
};
|
|
6460
6511
|
await publishEvent("screen:created" /* SCREEN_CREATED */, properties, timestamp);
|
|
6461
6512
|
}
|
|
6462
6513
|
async function deleted8(screen) {
|
|
6514
|
+
var _a;
|
|
6463
6515
|
const properties = {
|
|
6464
6516
|
layoutId: screen.layoutId,
|
|
6465
6517
|
screenId: screen._id,
|
|
6466
6518
|
roleId: screen.routing.roleId,
|
|
6467
6519
|
audited: {
|
|
6468
|
-
name: screen.routing
|
|
6520
|
+
name: (_a = screen.routing) == null ? void 0 : _a.route
|
|
6469
6521
|
}
|
|
6470
6522
|
};
|
|
6471
6523
|
await publishEvent("screen:deleted" /* SCREEN_DELETED */, properties);
|
|
@@ -8135,6 +8187,7 @@ var appBuilderUser = (appId, userProps) => {
|
|
|
8135
8187
|
};
|
|
8136
8188
|
};
|
|
8137
8189
|
function ssoUser(opts = {}) {
|
|
8190
|
+
var _a, _b, _c;
|
|
8138
8191
|
const base = user(opts.user);
|
|
8139
8192
|
delete base.password;
|
|
8140
8193
|
if (!opts.details) {
|
|
@@ -8143,9 +8196,9 @@ function ssoUser(opts = {}) {
|
|
|
8143
8196
|
return {
|
|
8144
8197
|
...base,
|
|
8145
8198
|
forceResetPassword: false,
|
|
8146
|
-
oauth2: opts.details
|
|
8147
|
-
provider: opts.details
|
|
8148
|
-
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,
|
|
8149
8202
|
thirdPartyProfile: {
|
|
8150
8203
|
email: base.email,
|
|
8151
8204
|
picture: base.pictureUrl
|
|
@@ -8311,7 +8364,7 @@ __export(testContainerUtils_exports, {
|
|
|
8311
8364
|
var import_child_process = require("child_process");
|
|
8312
8365
|
var dockerPsResult;
|
|
8313
8366
|
function formatDockerPsResult(serverName, port) {
|
|
8314
|
-
const lines = dockerPsResult
|
|
8367
|
+
const lines = dockerPsResult == null ? void 0 : dockerPsResult.split("\n");
|
|
8315
8368
|
let first = true;
|
|
8316
8369
|
if (!lines) {
|
|
8317
8370
|
return null;
|
|
@@ -8368,14 +8421,11 @@ function getContainerInfo(containerName, port) {
|
|
|
8368
8421
|
function getCouchConfig() {
|
|
8369
8422
|
return getContainerInfo("couchdb-service", 5984);
|
|
8370
8423
|
}
|
|
8371
|
-
function getMinioConfig() {
|
|
8372
|
-
return getContainerInfo("minio-service", 9e3);
|
|
8373
|
-
}
|
|
8374
8424
|
function getRedisConfig() {
|
|
8375
8425
|
return getContainerInfo("redis-service", 6379);
|
|
8376
8426
|
}
|
|
8377
8427
|
function setupEnv(...envs) {
|
|
8378
|
-
const couch = getCouchConfig(), minio =
|
|
8428
|
+
const couch = getCouchConfig(), minio = getCouchConfig(), redis2 = getRedisConfig();
|
|
8379
8429
|
const configs = [
|
|
8380
8430
|
{ key: "COUCH_DB_PORT", value: couch.port },
|
|
8381
8431
|
{ key: "COUCH_DB_URL", value: couch.url },
|