@budibase/worker 2.2.12-alpha.17 → 2.2.12-alpha.19
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/coverage/clover.xml +224 -223
- package/coverage/coverage-final.json +2 -2
- package/coverage/lcov-report/index.html +10 -10
- package/coverage/lcov-report/src/api/controllers/global/auth.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/global/configs.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/global/email.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/global/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/global/license.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/global/roles.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/global/self.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/global/templates.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/global/users.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/global/workspaces.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/system/accounts.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/system/environment.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/system/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/system/migrations.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/system/restore.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/system/status.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/system/tenants.ts.html +1 -1
- package/coverage/lcov-report/src/api/index.html +1 -1
- package/coverage/lcov-report/src/api/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/global/auth.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/global/configs.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/global/email.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/global/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/global/license.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/global/roles.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/global/self.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/global/templates.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/global/users.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/global/workspaces.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/system/accounts.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/system/environment.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/system/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/system/migrations.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/system/restore.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/system/status.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/system/tenants.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/validation/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/validation/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/validation/users.ts.html +1 -1
- package/coverage/lcov-report/src/constants/index.html +1 -1
- package/coverage/lcov-report/src/constants/index.ts.html +1 -1
- package/coverage/lcov-report/src/constants/templates/index.html +1 -1
- package/coverage/lcov-report/src/constants/templates/index.ts.html +1 -1
- package/coverage/lcov-report/src/db/index.html +1 -1
- package/coverage/lcov-report/src/db/index.ts.html +1 -1
- package/coverage/lcov-report/src/environment.ts.html +1 -1
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/index.ts.html +1 -1
- package/coverage/lcov-report/src/middleware/cloudRestricted.ts.html +1 -1
- package/coverage/lcov-report/src/middleware/index.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/globalInfoSyncUsers.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/index.html +1 -1
- package/coverage/lcov-report/src/migrations/index.html +1 -1
- package/coverage/lcov-report/src/migrations/index.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/accounts/accounts.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/accounts/index.html +1 -1
- package/coverage/lcov-report/src/sdk/accounts/index.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/index.html +1 -1
- package/coverage/lcov-report/src/sdk/index.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/users/events.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/users/index.html +1 -1
- package/coverage/lcov-report/src/sdk/users/index.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/users/users.ts.html +11 -5
- package/coverage/lcov-report/src/tests/TestConfiguration.ts.html +1 -1
- package/coverage/lcov-report/src/tests/api/accounts.ts.html +1 -1
- package/coverage/lcov-report/src/tests/api/auth.ts.html +1 -1
- package/coverage/lcov-report/src/tests/api/base.ts.html +1 -1
- package/coverage/lcov-report/src/tests/api/configs.ts.html +1 -1
- package/coverage/lcov-report/src/tests/api/email.ts.html +1 -1
- package/coverage/lcov-report/src/tests/api/environment.ts.html +1 -1
- package/coverage/lcov-report/src/tests/api/groups.ts.html +1 -1
- package/coverage/lcov-report/src/tests/api/index.html +1 -1
- package/coverage/lcov-report/src/tests/api/index.ts.html +1 -1
- package/coverage/lcov-report/src/tests/api/license.ts.html +1 -1
- package/coverage/lcov-report/src/tests/api/migrations.ts.html +1 -1
- package/coverage/lcov-report/src/tests/api/restore.ts.html +1 -1
- package/coverage/lcov-report/src/tests/api/roles.ts.html +1 -1
- package/coverage/lcov-report/src/tests/api/self.ts.html +1 -1
- package/coverage/lcov-report/src/tests/api/status.ts.html +1 -1
- package/coverage/lcov-report/src/tests/api/templates.ts.html +1 -1
- package/coverage/lcov-report/src/tests/api/tenants.ts.html +1 -1
- package/coverage/lcov-report/src/tests/api/users.ts.html +1 -1
- package/coverage/lcov-report/src/tests/controllers.ts.html +1 -1
- package/coverage/lcov-report/src/tests/index.html +1 -1
- package/coverage/lcov-report/src/tests/index.ts.html +1 -1
- package/coverage/lcov-report/src/tests/mocks/email.ts.html +1 -1
- package/coverage/lcov-report/src/tests/mocks/index.html +1 -1
- package/coverage/lcov-report/src/tests/mocks/index.ts.html +1 -1
- package/coverage/lcov-report/src/tests/structures/configs.ts.html +1 -1
- package/coverage/lcov-report/src/tests/structures/groups.ts.html +1 -1
- package/coverage/lcov-report/src/tests/structures/index.html +1 -1
- package/coverage/lcov-report/src/tests/structures/index.ts.html +1 -1
- package/coverage/lcov-report/src/tests/structures/users.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/appService.ts.html +23 -8
- package/coverage/lcov-report/src/utilities/email.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/fileSystem.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/index.html +11 -11
- package/coverage/lcov-report/src/utilities/index.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/redis.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/templates.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/users.ts.html +1 -1
- package/coverage/lcov.info +336 -335
- package/package.json +6 -6
- package/src/sdk/users/users.ts +5 -3
- package/src/utilities/appService.ts +7 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/worker",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "2.2.12-alpha.
|
|
4
|
+
"version": "2.2.12-alpha.19",
|
|
5
5
|
"description": "Budibase background service",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"author": "Budibase",
|
|
37
37
|
"license": "GPL-3.0",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@budibase/backend-core": "2.2.12-alpha.
|
|
40
|
-
"@budibase/pro": "2.2.12-alpha.
|
|
41
|
-
"@budibase/string-templates": "2.2.12-alpha.
|
|
42
|
-
"@budibase/types": "2.2.12-alpha.
|
|
39
|
+
"@budibase/backend-core": "2.2.12-alpha.19",
|
|
40
|
+
"@budibase/pro": "2.2.12-alpha.18",
|
|
41
|
+
"@budibase/string-templates": "2.2.12-alpha.19",
|
|
42
|
+
"@budibase/types": "2.2.12-alpha.19",
|
|
43
43
|
"@koa/router": "8.0.8",
|
|
44
44
|
"@sentry/node": "6.17.7",
|
|
45
45
|
"@techpass/passport-openidconnect": "0.3.2",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"typescript": "4.7.3",
|
|
98
98
|
"update-dotenv": "1.1.1"
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "0af40aa059919c42ffc8ce184bd4103d6e889ba1"
|
|
101
101
|
}
|
package/src/sdk/users/users.ts
CHANGED
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
SearchUsersRequest,
|
|
32
32
|
User,
|
|
33
33
|
ThirdPartyUser,
|
|
34
|
+
isUser,
|
|
34
35
|
} from "@budibase/types"
|
|
35
36
|
import { sendEmail } from "../../utilities/email"
|
|
36
37
|
import { EmailTemplatePurpose } from "../../constants"
|
|
@@ -265,8 +266,9 @@ export const save = async (
|
|
|
265
266
|
await eventHelpers.handleSaveEvents(builtUser, dbUser)
|
|
266
267
|
await addTenant(tenantId, _id, email)
|
|
267
268
|
await cache.user.invalidateUser(response.id)
|
|
269
|
+
|
|
268
270
|
// let server know to sync user
|
|
269
|
-
await apps.syncUserInApps(_id)
|
|
271
|
+
await apps.syncUserInApps(_id, dbUser)
|
|
270
272
|
|
|
271
273
|
await Promise.all(groupPromises)
|
|
272
274
|
|
|
@@ -572,7 +574,7 @@ export const destroy = async (id: string, currentUser: any) => {
|
|
|
572
574
|
await cache.user.invalidateUser(userId)
|
|
573
575
|
await sessions.invalidateSessions(userId, { reason: "deletion" })
|
|
574
576
|
// let server know to sync user
|
|
575
|
-
await apps.syncUserInApps(userId)
|
|
577
|
+
await apps.syncUserInApps(userId, dbUser)
|
|
576
578
|
}
|
|
577
579
|
|
|
578
580
|
const bulkDeleteProcessing = async (dbUser: User) => {
|
|
@@ -582,7 +584,7 @@ const bulkDeleteProcessing = async (dbUser: User) => {
|
|
|
582
584
|
await cache.user.invalidateUser(userId)
|
|
583
585
|
await sessions.invalidateSessions(userId, { reason: "bulk-deletion" })
|
|
584
586
|
// let server know to sync user
|
|
585
|
-
await apps.syncUserInApps(userId)
|
|
587
|
+
await apps.syncUserInApps(userId, dbUser)
|
|
586
588
|
}
|
|
587
589
|
|
|
588
590
|
export const invite = async (
|
|
@@ -2,6 +2,7 @@ import fetch from "node-fetch"
|
|
|
2
2
|
import { constants, tenancy, logging } from "@budibase/backend-core"
|
|
3
3
|
import { checkSlashesInUrl } from "../utilities"
|
|
4
4
|
import env from "../environment"
|
|
5
|
+
import { SyncUserRequest, User } from "@budibase/types"
|
|
5
6
|
|
|
6
7
|
async function makeAppRequest(url: string, method: string, body: any) {
|
|
7
8
|
if (env.isTest()) {
|
|
@@ -24,11 +25,15 @@ async function makeAppRequest(url: string, method: string, body: any) {
|
|
|
24
25
|
return fetch(checkSlashesInUrl(env.APPS_URL + url), request)
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
export async function syncUserInApps(userId: string) {
|
|
28
|
+
export async function syncUserInApps(userId: string, previousUser?: User) {
|
|
29
|
+
const body: SyncUserRequest = {
|
|
30
|
+
previousUser,
|
|
31
|
+
}
|
|
32
|
+
|
|
28
33
|
const response = await makeAppRequest(
|
|
29
34
|
`/api/users/metadata/sync/${userId}`,
|
|
30
35
|
"POST",
|
|
31
|
-
|
|
36
|
+
body
|
|
32
37
|
)
|
|
33
38
|
if (response && response.status !== 200) {
|
|
34
39
|
throw "Unable to sync user."
|