@budibase/worker 1.2.6 → 1.2.7

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": "1.2.6",
4
+ "version": "1.2.7",
5
5
  "description": "Budibase background service",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -35,10 +35,10 @@
35
35
  "author": "Budibase",
36
36
  "license": "GPL-3.0",
37
37
  "dependencies": {
38
- "@budibase/backend-core": "^1.2.6",
39
- "@budibase/pro": "1.2.5",
40
- "@budibase/string-templates": "^1.2.6",
41
- "@budibase/types": "^1.2.6",
38
+ "@budibase/backend-core": "^1.2.7",
39
+ "@budibase/pro": "1.2.6",
40
+ "@budibase/string-templates": "^1.2.7",
41
+ "@budibase/types": "^1.2.7",
42
42
  "@koa/router": "8.0.8",
43
43
  "@sentry/node": "6.17.7",
44
44
  "@techpass/passport-openidconnect": "0.3.2",
@@ -101,5 +101,5 @@
101
101
  "./scripts/jestSetup.js"
102
102
  ]
103
103
  },
104
- "gitHead": "7aa3a20ecc0f6d0f4617c6e703bf4f6f1998071e"
104
+ "gitHead": "1f0a254f5a32cfc313e80c10f5cf32eadae2431f"
105
105
  }
@@ -101,7 +101,7 @@ interface SaveUserOpts {
101
101
  bulkCreate?: boolean
102
102
  }
103
103
 
104
- export const buildUser = async (
104
+ const buildUser = async (
105
105
  user: any,
106
106
  opts: SaveUserOpts = {
107
107
  hashPassword: true,
@@ -195,6 +195,11 @@ export const save = async (
195
195
  dbUser
196
196
  )
197
197
 
198
+ // make sure we set the _id field for a new user
199
+ if (!_id) {
200
+ _id = builtUser._id
201
+ }
202
+
198
203
  try {
199
204
  const putOpts = {
200
205
  password: builtUser.password,
@@ -220,7 +225,7 @@ export const save = async (
220
225
  await addTenant(tenantId, _id, email)
221
226
  await cache.user.invalidateUser(response.id)
222
227
  // let server know to sync user
223
- await apps.syncUserInApps(builtUser._id)
228
+ await apps.syncUserInApps(_id)
224
229
 
225
230
  return {
226
231
  _id: response.id,
@@ -305,6 +310,9 @@ export const bulkCreate = async (
305
310
 
306
311
  // Post processing of bulk added users, i.e events and cache operations
307
312
  for (const user of usersToBulkSave) {
313
+ // TODO: Refactor to bulk insert users into the info db
314
+ // instead of relying on looping tenant creation
315
+ await addTenant(tenantId, user._id, user.email)
308
316
  await eventHelpers.handleSaveEvents(user, null)
309
317
  await apps.syncUserInApps(user._id)
310
318
  }