@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/dist/utilities/global.js
CHANGED
|
@@ -122,10 +122,7 @@ function getGlobalUsers(userIds, opts) {
|
|
|
122
122
|
delete user.forceResetPassword;
|
|
123
123
|
return user;
|
|
124
124
|
});
|
|
125
|
-
if (!appId) {
|
|
126
|
-
return globalUsers;
|
|
127
|
-
}
|
|
128
|
-
if (opts === null || opts === void 0 ? void 0 : opts.noProcessing) {
|
|
125
|
+
if ((opts === null || opts === void 0 ? void 0 : opts.noProcessing) || !appId) {
|
|
129
126
|
return globalUsers;
|
|
130
127
|
}
|
|
131
128
|
else {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/server",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "2.6.
|
|
4
|
+
"version": "2.6.21",
|
|
5
5
|
"description": "Budibase Web Server",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"license": "GPL-3.0",
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@apidevtools/swagger-parser": "10.0.3",
|
|
48
|
-
"@budibase/backend-core": "^2.6.
|
|
49
|
-
"@budibase/client": "^2.6.
|
|
50
|
-
"@budibase/pro": "2.6.
|
|
51
|
-
"@budibase/shared-core": "^2.6.
|
|
52
|
-
"@budibase/string-templates": "^2.6.
|
|
53
|
-
"@budibase/types": "^2.6.
|
|
48
|
+
"@budibase/backend-core": "^2.6.21",
|
|
49
|
+
"@budibase/client": "^2.6.21",
|
|
50
|
+
"@budibase/pro": "2.6.20",
|
|
51
|
+
"@budibase/shared-core": "^2.6.21",
|
|
52
|
+
"@budibase/string-templates": "^2.6.21",
|
|
53
|
+
"@budibase/types": "^2.6.21",
|
|
54
54
|
"@bull-board/api": "3.7.0",
|
|
55
55
|
"@bull-board/koa": "3.9.4",
|
|
56
56
|
"@elastic/elasticsearch": "7.10.0",
|
|
@@ -176,5 +176,5 @@
|
|
|
176
176
|
"optionalDependencies": {
|
|
177
177
|
"oracledb": "5.3.0"
|
|
178
178
|
},
|
|
179
|
-
"gitHead": "
|
|
179
|
+
"gitHead": "ccc0f794fa81b3f815df0c135e8874b66d44e0e9"
|
|
180
180
|
}
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
SearchFilters,
|
|
14
14
|
Table,
|
|
15
15
|
} from "@budibase/types"
|
|
16
|
+
import { db as dbCore } from "@budibase/backend-core"
|
|
16
17
|
|
|
17
18
|
enum SortOrder {
|
|
18
19
|
ASCENDING = "ascending",
|
|
@@ -117,7 +118,11 @@ function typeCoercion(filters: SearchFilters, table: Table) {
|
|
|
117
118
|
const searchParam = filters[key]
|
|
118
119
|
if (typeof searchParam === "object") {
|
|
119
120
|
for (let [property, value] of Object.entries(searchParam)) {
|
|
120
|
-
|
|
121
|
+
// We need to strip numerical prefixes here, so that we can look up
|
|
122
|
+
// the correct field name in the schema
|
|
123
|
+
const columnName = dbCore.removeKeyNumbering(property)
|
|
124
|
+
const column = table.schema[columnName]
|
|
125
|
+
|
|
121
126
|
// convert string inputs
|
|
122
127
|
if (!column || typeof value !== "string") {
|
|
123
128
|
continue
|
package/src/sdk/users/utils.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
InternalTables,
|
|
8
8
|
} from "../../db/utils"
|
|
9
9
|
import { isEqual } from "lodash"
|
|
10
|
-
import { ContextUser, UserMetadata, User } from "@budibase/types"
|
|
10
|
+
import { ContextUser, UserMetadata, User, Database } from "@budibase/types"
|
|
11
11
|
|
|
12
12
|
export function combineMetadataAndUser(
|
|
13
13
|
user: ContextUser,
|
|
@@ -51,8 +51,10 @@ export function combineMetadataAndUser(
|
|
|
51
51
|
return null
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
export async function rawUserMetadata() {
|
|
55
|
-
|
|
54
|
+
export async function rawUserMetadata(db?: Database) {
|
|
55
|
+
if (!db) {
|
|
56
|
+
db = context.getAppDB()
|
|
57
|
+
}
|
|
56
58
|
return (
|
|
57
59
|
await db.allDocs(
|
|
58
60
|
getUserMetadataParams(null, {
|
|
@@ -64,30 +66,36 @@ export async function rawUserMetadata() {
|
|
|
64
66
|
|
|
65
67
|
export async function syncGlobalUsers() {
|
|
66
68
|
// sync user metadata
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const metadata = resp[1] as UserMetadata[]
|
|
71
|
-
const toWrite = []
|
|
72
|
-
for (let user of users) {
|
|
73
|
-
const combined = combineMetadataAndUser(user, metadata)
|
|
74
|
-
if (combined) {
|
|
75
|
-
toWrite.push(combined)
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
let foundEmails: string[] = []
|
|
79
|
-
for (let data of metadata) {
|
|
80
|
-
if (!data._id) {
|
|
69
|
+
const dbs = [context.getDevAppDB(), context.getProdAppDB()]
|
|
70
|
+
for (let db of dbs) {
|
|
71
|
+
if (!(await db.exists())) {
|
|
81
72
|
continue
|
|
82
73
|
}
|
|
83
|
-
const
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
74
|
+
const resp = await Promise.all([getGlobalUsers(), rawUserMetadata(db)])
|
|
75
|
+
const users = resp[0] as User[]
|
|
76
|
+
const metadata = resp[1] as UserMetadata[]
|
|
77
|
+
const toWrite = []
|
|
78
|
+
for (let user of users) {
|
|
79
|
+
const combined = combineMetadataAndUser(user, metadata)
|
|
80
|
+
if (combined) {
|
|
81
|
+
toWrite.push(combined)
|
|
82
|
+
}
|
|
87
83
|
}
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
let foundEmails: string[] = []
|
|
85
|
+
for (let data of metadata) {
|
|
86
|
+
if (!data._id) {
|
|
87
|
+
continue
|
|
88
|
+
}
|
|
89
|
+
const alreadyExisting =
|
|
90
|
+
data.email && foundEmails.indexOf(data.email) !== -1
|
|
91
|
+
const globalId = getGlobalIDFromUserMetadataID(data._id)
|
|
92
|
+
if (!users.find(user => user._id === globalId) || alreadyExisting) {
|
|
93
|
+
toWrite.push({ ...data, _deleted: true })
|
|
94
|
+
}
|
|
95
|
+
if (data.email) {
|
|
96
|
+
foundEmails.push(data.email)
|
|
97
|
+
}
|
|
90
98
|
}
|
|
99
|
+
await db.bulkDocs(toWrite)
|
|
91
100
|
}
|
|
92
|
-
await db.bulkDocs(toWrite)
|
|
93
101
|
}
|
package/src/utilities/global.ts
CHANGED
|
@@ -122,11 +122,8 @@ export async function getGlobalUsers(
|
|
|
122
122
|
delete user.forceResetPassword
|
|
123
123
|
return user
|
|
124
124
|
})
|
|
125
|
-
if (!appId) {
|
|
126
|
-
return globalUsers
|
|
127
|
-
}
|
|
128
125
|
|
|
129
|
-
if (opts?.noProcessing) {
|
|
126
|
+
if (opts?.noProcessing || !appId) {
|
|
130
127
|
return globalUsers
|
|
131
128
|
} else {
|
|
132
129
|
// pass in the groups, meaning we don't actually need to retrieve them for
|