@budibase/worker 2.5.9 → 2.5.10-alpha.1

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.5.9",
4
+ "version": "2.5.10-alpha.1",
5
5
  "description": "Budibase background service",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -22,6 +22,7 @@
22
22
  "build:docker": "docker build . -t worker-service --label version=$BUDIBASE_RELEASE_VERSION",
23
23
  "dev:stack:init": "node ./scripts/dev/manage.js init",
24
24
  "dev:builder": "npm run dev:stack:init && nodemon",
25
+ "dev:built": "yarn run dev:stack:init && yarn run run:docker",
25
26
  "test": "bash scripts/test.sh",
26
27
  "test:watch": "jest --watch",
27
28
  "env:multi:enable": "node scripts/multiTenancy.js enable",
@@ -36,10 +37,10 @@
36
37
  "author": "Budibase",
37
38
  "license": "GPL-3.0",
38
39
  "dependencies": {
39
- "@budibase/backend-core": "^2.5.9",
40
- "@budibase/pro": "2.5.8",
41
- "@budibase/string-templates": "^2.5.9",
42
- "@budibase/types": "^2.5.9",
40
+ "@budibase/backend-core": "2.5.10-alpha.1",
41
+ "@budibase/pro": "2.5.10-alpha.0",
42
+ "@budibase/string-templates": "2.5.10-alpha.1",
43
+ "@budibase/types": "2.5.10-alpha.1",
43
44
  "@koa/router": "8.0.8",
44
45
  "@sentry/node": "6.17.7",
45
46
  "@techpass/passport-openidconnect": "0.3.2",
@@ -56,7 +57,6 @@
56
57
  "koa-body": "4.2.0",
57
58
  "koa-compress": "4.0.1",
58
59
  "koa-passport": "4.1.4",
59
- "koa-pino-logger": "3.0.0",
60
60
  "koa-send": "5.0.1",
61
61
  "koa-session": "5.13.1",
62
62
  "koa-static": "5.0.0",
@@ -66,7 +66,6 @@
66
66
  "passport-google-oauth": "2.0.0",
67
67
  "passport-jwt": "4.0.0",
68
68
  "passport-local": "1.0.0",
69
- "pino-pretty": "4.8.0",
70
69
  "pouchdb": "7.3.0",
71
70
  "pouchdb-all-dbs": "1.1.1",
72
71
  "server-destroy": "1.0.1"
@@ -79,6 +78,7 @@
79
78
  "@types/jsonwebtoken": "8.5.1",
80
79
  "@types/koa": "2.13.4",
81
80
  "@types/koa__router": "8.0.8",
81
+ "@types/lodash": "^4.14.191",
82
82
  "@types/node": "14.18.20",
83
83
  "@types/node-fetch": "2.6.1",
84
84
  "@types/pouchdb": "6.4.0",
@@ -89,6 +89,7 @@
89
89
  "copyfiles": "2.4.1",
90
90
  "eslint": "6.8.0",
91
91
  "jest": "28.1.1",
92
+ "lodash": "4.17.21",
92
93
  "nodemon": "2.0.15",
93
94
  "pouchdb-adapter-memory": "7.2.2",
94
95
  "prettier": "2.3.1",
@@ -101,5 +102,5 @@
101
102
  "typescript": "4.7.3",
102
103
  "update-dotenv": "1.1.1"
103
104
  },
104
- "gitHead": "1a054856a4aa2b39142e7b7800f8ae39f5904ecc"
105
+ "gitHead": "9fcfb0a6cd4e4003f0e420b4b180b3b069e93191"
105
106
  }
@@ -30,6 +30,7 @@ async function init() {
30
30
  DEPLOYMENT_ENVIRONMENT: "development",
31
31
  TENANT_FEATURE_FLAGS: "*:LICENSING,*:USER_GROUPS,*:ONBOARDING_TOUR",
32
32
  ENABLE_EMAIL_TEST_MODE: 1,
33
+ HTTP_LOGGING: 0,
33
34
  }
34
35
  let envFile = ""
35
36
  Object.keys(envFileJson).forEach(key => {
@@ -177,7 +177,7 @@ export const destroy = async (ctx: any) => {
177
177
  ctx.throw(400, "Unable to delete self.")
178
178
  }
179
179
 
180
- await userSdk.destroy(id, ctx.user)
180
+ await userSdk.destroy(id)
181
181
 
182
182
  ctx.body = {
183
183
  message: `User ${id} deleted.`,
@@ -197,7 +197,7 @@ export const search = async (ctx: any) => {
197
197
  if (body.paginated === false) {
198
198
  await getAppUsers(ctx)
199
199
  } else {
200
- const paginated = await userSdk.paginatedUsers(body)
200
+ const paginated = await userSdk.core.paginatedUsers(body)
201
201
  // user hashed password shouldn't ever be returned
202
202
  for (let user of paginated.data) {
203
203
  if (user) {
@@ -329,6 +329,7 @@ export const checkInvite = async (ctx: any) => {
329
329
  try {
330
330
  invite = await checkInviteCode(code, false)
331
331
  } catch (e) {
332
+ console.warn("Error getting invite from code", e)
332
333
  ctx.throw(400, "There was a problem with the invite")
333
334
  }
334
335
  ctx.body = {
@@ -415,15 +416,17 @@ export const inviteAccept = async (
415
416
  })
416
417
 
417
418
  ctx.body = {
418
- _id: user._id,
419
- _rev: user._rev,
419
+ _id: user._id!,
420
+ _rev: user._rev!,
420
421
  email: user.email,
421
422
  }
422
423
  } catch (err: any) {
423
424
  if (err.code === ErrorCode.USAGE_LIMIT_EXCEEDED) {
424
425
  // explicitly re-throw limit exceeded errors
425
426
  ctx.throw(400, err)
427
+ return
426
428
  }
429
+ console.warn("Error inviting user", err)
427
430
  ctx.throw(400, "Unable to create new user, invitation invalid.")
428
431
  }
429
432
  }
@@ -1,7 +1,7 @@
1
- import { Account, AccountMetadata } from "@budibase/types"
1
+ import { Account, AccountMetadata, Ctx } from "@budibase/types"
2
2
  import * as accounts from "../../../sdk/accounts"
3
3
 
4
- export const save = async (ctx: any) => {
4
+ export const save = async (ctx: Ctx<Account, AccountMetadata>) => {
5
5
  const account = ctx.request.body as Account
6
6
  let metadata: AccountMetadata = {
7
7
  _id: accounts.metadata.formatAccountMetadataId(account.accountId),
package/src/api/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import Router from "@koa/router"
2
2
  const compress = require("koa-compress")
3
- const zlib = require("zlib")
3
+ import zlib from "zlib"
4
4
  import { routes } from "./routes"
5
5
  import { middleware as pro } from "@budibase/pro"
6
6
  import { auth, middleware } from "@budibase/backend-core"
@@ -58,6 +58,13 @@ function oidcValidation() {
58
58
  }).unknown(true)
59
59
  }
60
60
 
61
+ function scimValidation() {
62
+ // prettier-ignore
63
+ return Joi.object({
64
+ enabled: Joi.boolean().required(),
65
+ }).unknown(true)
66
+ }
67
+
61
68
  function buildConfigSaveValidation() {
62
69
  // prettier-ignore
63
70
  return auth.joiValidator.body(Joi.object({
@@ -74,7 +81,8 @@ function buildConfigSaveValidation() {
74
81
  { is: ConfigType.SETTINGS, then: settingValidation() },
75
82
  { is: ConfigType.ACCOUNT, then: Joi.object().unknown(true) },
76
83
  { is: ConfigType.GOOGLE, then: googleValidation() },
77
- { is: ConfigType.OIDC, then: oidcValidation() }
84
+ { is: ConfigType.OIDC, then: oidcValidation() },
85
+ { is: ConfigType.SCIM, then: scimValidation() }
78
86
  ],
79
87
  }),
80
88
  }).required().unknown(true),