@budibase/worker 2.9.38 → 2.9.39-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/Dockerfile +1 -1
- package/package.json +21 -6
- package/src/api/controllers/global/self.ts +2 -2
- package/src/api/controllers/global/users.ts +20 -9
- package/src/api/routes/global/tests/appBuilder.spec.ts +3 -1
- package/src/api/routes/global/tests/scim.spec.ts +2 -0
- package/src/environment.ts +2 -0
- package/src/features.ts +13 -0
- package/src/tests/jestEnv.ts +1 -1
package/Dockerfile
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/worker",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "2.9.
|
|
4
|
+
"version": "2.9.39-alpha.1",
|
|
5
5
|
"description": "Budibase background service",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"author": "Budibase",
|
|
39
39
|
"license": "GPL-3.0",
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@budibase/backend-core": "2.9.
|
|
42
|
-
"@budibase/pro": "2.9.
|
|
43
|
-
"@budibase/string-templates": "2.9.
|
|
44
|
-
"@budibase/types": "2.9.
|
|
41
|
+
"@budibase/backend-core": "2.9.39-alpha.1",
|
|
42
|
+
"@budibase/pro": "2.9.39-alpha.1",
|
|
43
|
+
"@budibase/string-templates": "2.9.39-alpha.1",
|
|
44
|
+
"@budibase/types": "2.9.39-alpha.1",
|
|
45
45
|
"@koa/router": "8.0.8",
|
|
46
46
|
"@sentry/node": "6.17.7",
|
|
47
47
|
"@techpass/passport-openidconnect": "0.3.2",
|
|
@@ -103,5 +103,20 @@
|
|
|
103
103
|
"typescript": "4.7.3",
|
|
104
104
|
"update-dotenv": "1.1.1"
|
|
105
105
|
},
|
|
106
|
-
"
|
|
106
|
+
"nx": {
|
|
107
|
+
"targets": {
|
|
108
|
+
"dev:builder": {
|
|
109
|
+
"dependsOn": [
|
|
110
|
+
{
|
|
111
|
+
"comment": "Required for pro usage when submodule not loaded",
|
|
112
|
+
"projects": [
|
|
113
|
+
"@budibase/backend-core"
|
|
114
|
+
],
|
|
115
|
+
"target": "build"
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"gitHead": "9ed9a466a6593c051eed297f4236b5e3d871c049"
|
|
107
122
|
}
|
|
@@ -48,7 +48,7 @@ export async function generateAPIKey(ctx: any) {
|
|
|
48
48
|
} catch (err) {
|
|
49
49
|
devInfo = { _id: id, userId }
|
|
50
50
|
}
|
|
51
|
-
devInfo.apiKey =
|
|
51
|
+
devInfo.apiKey = apiKey
|
|
52
52
|
await db.put(devInfo)
|
|
53
53
|
ctx.body = cleanupDevInfo(devInfo)
|
|
54
54
|
}
|
|
@@ -63,7 +63,7 @@ export async function fetchAPIKey(ctx: any) {
|
|
|
63
63
|
devInfo = {
|
|
64
64
|
_id: id,
|
|
65
65
|
userId: ctx.user._id,
|
|
66
|
-
apiKey:
|
|
66
|
+
apiKey: newApiKey(),
|
|
67
67
|
}
|
|
68
68
|
await db.put(devInfo)
|
|
69
69
|
}
|
|
@@ -25,11 +25,11 @@ import {
|
|
|
25
25
|
import {
|
|
26
26
|
accounts,
|
|
27
27
|
cache,
|
|
28
|
+
ErrorCode,
|
|
28
29
|
events,
|
|
29
30
|
migrations,
|
|
30
|
-
tenancy,
|
|
31
31
|
platform,
|
|
32
|
-
|
|
32
|
+
tenancy,
|
|
33
33
|
} from "@budibase/backend-core"
|
|
34
34
|
import { checkAnyUserExists } from "../../../utilities/users"
|
|
35
35
|
import { isEmailConfigured } from "../../../utilities/email"
|
|
@@ -272,15 +272,15 @@ export const onboardUsers = async (ctx: Ctx<InviteUsersRequest>) => {
|
|
|
272
272
|
password,
|
|
273
273
|
forceResetPassword: true,
|
|
274
274
|
roles: invite.userInfo.apps,
|
|
275
|
-
admin:
|
|
276
|
-
builder:
|
|
275
|
+
admin: invite.userInfo.admin,
|
|
276
|
+
builder: invite.userInfo.builder,
|
|
277
277
|
tenantId: tenancy.getTenantId(),
|
|
278
278
|
}
|
|
279
279
|
})
|
|
280
280
|
let bulkCreateReponse = await userSdk.db.bulkCreate(users, [])
|
|
281
281
|
|
|
282
282
|
// Apply temporary credentials
|
|
283
|
-
|
|
283
|
+
ctx.body = {
|
|
284
284
|
...bulkCreateReponse,
|
|
285
285
|
successful: bulkCreateReponse?.successful.map(user => {
|
|
286
286
|
return {
|
|
@@ -290,8 +290,6 @@ export const onboardUsers = async (ctx: Ctx<InviteUsersRequest>) => {
|
|
|
290
290
|
}),
|
|
291
291
|
created: true,
|
|
292
292
|
}
|
|
293
|
-
|
|
294
|
-
ctx.body = createWithCredentials
|
|
295
293
|
} else {
|
|
296
294
|
ctx.throw(400, "User onboarding failed")
|
|
297
295
|
}
|
|
@@ -370,6 +368,12 @@ export const updateInvite = async (ctx: any) => {
|
|
|
370
368
|
...invite,
|
|
371
369
|
}
|
|
372
370
|
|
|
371
|
+
if (!updateBody?.builder?.apps && updated.info?.builder?.apps) {
|
|
372
|
+
updated.info.builder.apps = []
|
|
373
|
+
} else if (updateBody?.builder) {
|
|
374
|
+
updated.info.builder = updateBody.builder
|
|
375
|
+
}
|
|
376
|
+
|
|
373
377
|
if (!updateBody?.apps || !Object.keys(updateBody?.apps).length) {
|
|
374
378
|
updated.info.apps = []
|
|
375
379
|
} else {
|
|
@@ -394,17 +398,24 @@ export const inviteAccept = async (
|
|
|
394
398
|
// info is an extension of the user object that was stored by global
|
|
395
399
|
const { email, info }: any = await checkInviteCode(inviteCode)
|
|
396
400
|
const user = await tenancy.doInTenant(info.tenantId, async () => {
|
|
397
|
-
let request = {
|
|
401
|
+
let request: any = {
|
|
398
402
|
firstName,
|
|
399
403
|
lastName,
|
|
400
404
|
password,
|
|
401
405
|
email,
|
|
406
|
+
admin: { global: info?.admin?.global || false },
|
|
402
407
|
roles: info.apps,
|
|
403
408
|
tenantId: info.tenantId,
|
|
404
409
|
}
|
|
410
|
+
let builder: { global: boolean; apps?: string[] } = {
|
|
411
|
+
global: info?.builder?.global || false,
|
|
412
|
+
}
|
|
405
413
|
|
|
414
|
+
if (info?.builder?.apps) {
|
|
415
|
+
builder.apps = info.builder.apps
|
|
416
|
+
request.builder = builder
|
|
417
|
+
}
|
|
406
418
|
delete info.apps
|
|
407
|
-
|
|
408
419
|
request = {
|
|
409
420
|
...request,
|
|
410
421
|
...info,
|
package/src/environment.ts
CHANGED
package/src/features.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { features } from "@budibase/backend-core"
|
|
2
|
+
import env from "./environment"
|
|
3
|
+
|
|
4
|
+
enum WorkerFeature {}
|
|
5
|
+
|
|
6
|
+
const featureList: WorkerFeature[] = features.processFeatureEnvVar(
|
|
7
|
+
Object.values(WorkerFeature),
|
|
8
|
+
env.WORKER_FEATURES
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
export function isFeatureEnabled(feature: WorkerFeature) {
|
|
12
|
+
return featureList.includes(feature)
|
|
13
|
+
}
|
package/src/tests/jestEnv.ts
CHANGED