@budibase/worker 2.0.30-alpha.13 → 2.0.30-alpha.15

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@budibase/worker",
3
3
  "email": "hi@budibase.com",
4
- "version": "2.0.30-alpha.13",
4
+ "version": "2.0.30-alpha.15",
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.0.30-alpha.13",
40
- "@budibase/pro": "2.0.30-alpha.12",
41
- "@budibase/string-templates": "2.0.30-alpha.13",
42
- "@budibase/types": "2.0.30-alpha.13",
39
+ "@budibase/backend-core": "2.0.30-alpha.15",
40
+ "@budibase/pro": "2.0.30-alpha.14",
41
+ "@budibase/string-templates": "2.0.30-alpha.15",
42
+ "@budibase/types": "2.0.30-alpha.15",
43
43
  "@koa/router": "8.0.8",
44
44
  "@sentry/node": "6.17.7",
45
45
  "@techpass/passport-openidconnect": "0.3.2",
@@ -72,7 +72,6 @@
72
72
  "devDependencies": {
73
73
  "@types/jest": "26.0.23",
74
74
  "@types/koa": "2.13.4",
75
- "@types/koa-router": "7.4.4",
76
75
  "@types/koa__router": "8.0.11",
77
76
  "@types/node": "14.18.20",
78
77
  "@types/uuid": "8.3.4",
@@ -104,5 +103,5 @@
104
103
  "./scripts/jestSetup.js"
105
104
  ]
106
105
  },
107
- "gitHead": "e8486a69c86fcdfa34ce6db319d005e665ff8649"
106
+ "gitHead": "83d5f70937fc66baa53782da968a06f71ff54d19"
108
107
  }
@@ -7,6 +7,7 @@ import {
7
7
  CloudAccount,
8
8
  InviteUserRequest,
9
9
  InviteUsersRequest,
10
+ SearchUsersRequest,
10
11
  User,
11
12
  } from "@budibase/types"
12
13
  import {
@@ -144,7 +145,8 @@ export const destroy = async (ctx: any) => {
144
145
  }
145
146
 
146
147
  export const search = async (ctx: any) => {
147
- const paginated = await sdk.users.paginatedUsers(ctx.request.body)
148
+ const body = ctx.request.body as SearchUsersRequest
149
+ const paginated = await sdk.users.paginatedUsers(body)
148
150
  // user hashed password shouldn't ever be returned
149
151
  for (let user of paginated.data) {
150
152
  if (user) {
@@ -27,6 +27,7 @@ import {
27
27
  MigrationType,
28
28
  PlatformUserByEmail,
29
29
  RowResponse,
30
+ SearchUsersRequest,
30
31
  User,
31
32
  } from "@budibase/types"
32
33
  import { sendEmail } from "../../utilities/email"
@@ -56,7 +57,8 @@ export const paginatedUsers = async ({
56
57
  page,
57
58
  email,
58
59
  appId,
59
- }: { page?: string; email?: string; appId?: string } = {}) => {
60
+ userIds,
61
+ }: SearchUsersRequest = {}) => {
60
62
  const db = tenancy.getGlobalDB()
61
63
  // get one extra document, to have the next page
62
64
  const opts: any = {
@@ -94,16 +96,7 @@ export const paginatedUsers = async ({
94
96
  */
95
97
  export const getUser = async (userId: string) => {
96
98
  const db = tenancy.getGlobalDB()
97
- let user
98
- try {
99
- user = await db.get(userId)
100
- } catch (err: any) {
101
- // no user found, just return nothing
102
- if (err.status === 404) {
103
- return {}
104
- }
105
- throw err
106
- }
99
+ let user = await db.get(userId)
107
100
  if (user) {
108
101
  delete user.password
109
102
  }