@budibase/server 2.6.19 → 2.6.21
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/builder/assets/{index.b131b0de.js → index.69c5c1ea.js} +225 -225
- package/builder/index.html +1 -1
- package/dist/automations/steps/queryRows.js +5 -1
- package/dist/sdk/users/utils.js +30 -23
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/global.js +1 -4
- package/package.json +8 -8
- package/src/automations/steps/queryRows.ts +6 -1
- package/src/sdk/users/utils.ts +32 -24
- package/src/utilities/global.ts +1 -4
package/builder/index.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<link rel="preconnect" href="https://fonts.gstatic.com" />
|
|
9
9
|
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap"
|
|
10
10
|
rel="stylesheet" />
|
|
11
|
-
<script type="module" crossorigin src="/builder/assets/index.
|
|
11
|
+
<script type="module" crossorigin src="/builder/assets/index.69c5c1ea.js"></script>
|
|
12
12
|
<link rel="stylesheet" href="/builder/assets/index.86c992bf.css">
|
|
13
13
|
</head>
|
|
14
14
|
|
|
@@ -39,6 +39,7 @@ const constants_1 = require("../../constants");
|
|
|
39
39
|
const utils_1 = require("./utils");
|
|
40
40
|
const automationUtils = __importStar(require("../automationUtils"));
|
|
41
41
|
const types_1 = require("@budibase/types");
|
|
42
|
+
const backend_core_1 = require("@budibase/backend-core");
|
|
42
43
|
var SortOrder;
|
|
43
44
|
(function (SortOrder) {
|
|
44
45
|
SortOrder["ASCENDING"] = "ascending";
|
|
@@ -140,7 +141,10 @@ function typeCoercion(filters, table) {
|
|
|
140
141
|
const searchParam = filters[key];
|
|
141
142
|
if (typeof searchParam === "object") {
|
|
142
143
|
for (let [property, value] of Object.entries(searchParam)) {
|
|
143
|
-
|
|
144
|
+
// We need to strip numerical prefixes here, so that we can look up
|
|
145
|
+
// the correct field name in the schema
|
|
146
|
+
const columnName = backend_core_1.db.removeKeyNumbering(property);
|
|
147
|
+
const column = table.schema[columnName];
|
|
144
148
|
// convert string inputs
|
|
145
149
|
if (!column || typeof value !== "string") {
|
|
146
150
|
continue;
|
package/dist/sdk/users/utils.js
CHANGED
|
@@ -44,9 +44,11 @@ function combineMetadataAndUser(user, metadata) {
|
|
|
44
44
|
return null;
|
|
45
45
|
}
|
|
46
46
|
exports.combineMetadataAndUser = combineMetadataAndUser;
|
|
47
|
-
function rawUserMetadata() {
|
|
47
|
+
function rawUserMetadata(db) {
|
|
48
48
|
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
|
|
49
|
+
if (!db) {
|
|
50
|
+
db = backend_core_1.context.getAppDB();
|
|
51
|
+
}
|
|
50
52
|
return (yield db.allDocs((0, utils_1.getUserMetadataParams)(null, {
|
|
51
53
|
include_docs: true,
|
|
52
54
|
}))).rows.map(row => row.doc);
|
|
@@ -56,32 +58,37 @@ exports.rawUserMetadata = rawUserMetadata;
|
|
|
56
58
|
function syncGlobalUsers() {
|
|
57
59
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
60
|
// sync user metadata
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const metadata = resp[1];
|
|
63
|
-
const toWrite = [];
|
|
64
|
-
for (let user of users) {
|
|
65
|
-
const combined = combineMetadataAndUser(user, metadata);
|
|
66
|
-
if (combined) {
|
|
67
|
-
toWrite.push(combined);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
let foundEmails = [];
|
|
71
|
-
for (let data of metadata) {
|
|
72
|
-
if (!data._id) {
|
|
61
|
+
const dbs = [backend_core_1.context.getDevAppDB(), backend_core_1.context.getProdAppDB()];
|
|
62
|
+
for (let db of dbs) {
|
|
63
|
+
if (!(yield db.exists())) {
|
|
73
64
|
continue;
|
|
74
65
|
}
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
66
|
+
const resp = yield Promise.all([(0, global_1.getGlobalUsers)(), rawUserMetadata(db)]);
|
|
67
|
+
const users = resp[0];
|
|
68
|
+
const metadata = resp[1];
|
|
69
|
+
const toWrite = [];
|
|
70
|
+
for (let user of users) {
|
|
71
|
+
const combined = combineMetadataAndUser(user, metadata);
|
|
72
|
+
if (combined) {
|
|
73
|
+
toWrite.push(combined);
|
|
74
|
+
}
|
|
79
75
|
}
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
let foundEmails = [];
|
|
77
|
+
for (let data of metadata) {
|
|
78
|
+
if (!data._id) {
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const alreadyExisting = data.email && foundEmails.indexOf(data.email) !== -1;
|
|
82
|
+
const globalId = (0, utils_1.getGlobalIDFromUserMetadataID)(data._id);
|
|
83
|
+
if (!users.find(user => user._id === globalId) || alreadyExisting) {
|
|
84
|
+
toWrite.push(Object.assign(Object.assign({}, data), { _deleted: true }));
|
|
85
|
+
}
|
|
86
|
+
if (data.email) {
|
|
87
|
+
foundEmails.push(data.email);
|
|
88
|
+
}
|
|
82
89
|
}
|
|
90
|
+
yield db.bulkDocs(toWrite);
|
|
83
91
|
}
|
|
84
|
-
yield db.bulkDocs(toWrite);
|
|
85
92
|
});
|
|
86
93
|
}
|
|
87
94
|
exports.syncGlobalUsers = syncGlobalUsers;
|