@budibase/worker 2.5.5 → 2.5.6-alpha.10
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/jest.config.ts +5 -5
- package/nodemon.json +6 -2
- package/package.json +9 -8
- package/scripts/dev/manage.js +1 -0
- package/src/api/controllers/global/users.ts +2 -2
- package/src/api/index.ts +1 -1
- package/src/api/routes/global/configs.ts +9 -1
- package/src/api/routes/global/tests/scim.spec.ts +1029 -0
- package/src/api/routes/global/tests/users.spec.ts +10 -4
- package/src/api/routes/index.ts +4 -6
- package/src/environment.ts +0 -1
- package/src/index.ts +7 -7
- package/src/initPro.ts +13 -0
- package/src/middleware/handleScimBody.ts +12 -0
- package/src/sdk/users/users.ts +7 -54
- package/src/tests/TestConfiguration.ts +50 -1
- package/src/tests/api/index.ts +7 -0
- package/src/tests/api/scim/groups.ts +101 -0
- package/src/tests/api/scim/shared.ts +44 -0
- package/src/tests/api/scim/users.ts +94 -0
- package/src/tests/jestEnv.ts +0 -1
- package/src/tests/jestSetup.ts +0 -2
- package/tsconfig.json +4 -14
- package/src/elasticApm.ts +0 -10
- package/src/tests/logging.ts +0 -34
- package/src/utilities/appService.ts +0 -46
package/tsconfig.json
CHANGED
|
@@ -9,23 +9,13 @@
|
|
|
9
9
|
"@budibase/types": ["../types/src"],
|
|
10
10
|
"@budibase/backend-core": ["../backend-core/src"],
|
|
11
11
|
"@budibase/backend-core/*": ["../backend-core/*"],
|
|
12
|
-
"@budibase/pro": ["
|
|
12
|
+
"@budibase/pro": ["../pro/packages/pro/src"]
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"ts-node": {
|
|
16
16
|
"require": ["tsconfig-paths/register"],
|
|
17
17
|
"swc": true
|
|
18
18
|
},
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
{ "path": "../../../budibase-pro/packages/pro" }
|
|
23
|
-
],
|
|
24
|
-
"include": [
|
|
25
|
-
"src/**/*",
|
|
26
|
-
"package.json"
|
|
27
|
-
],
|
|
28
|
-
"exclude": [
|
|
29
|
-
"dist"
|
|
30
|
-
]
|
|
31
|
-
}
|
|
19
|
+
"include": ["src/**/*", "package.json"],
|
|
20
|
+
"exclude": ["dist"]
|
|
21
|
+
}
|
package/src/elasticApm.ts
DELETED
package/src/tests/logging.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export enum LogLevel {
|
|
2
|
-
TRACE = "trace",
|
|
3
|
-
DEBUG = "debug",
|
|
4
|
-
INFO = "info",
|
|
5
|
-
WARN = "warn",
|
|
6
|
-
ERROR = "error",
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const LOG_INDEX: { [key in LogLevel]: number } = {
|
|
10
|
-
[LogLevel.TRACE]: 1,
|
|
11
|
-
[LogLevel.DEBUG]: 2,
|
|
12
|
-
[LogLevel.INFO]: 3,
|
|
13
|
-
[LogLevel.WARN]: 4,
|
|
14
|
-
[LogLevel.ERROR]: 5,
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const setIndex = LOG_INDEX[process.env.LOG_LEVEL as LogLevel]
|
|
18
|
-
|
|
19
|
-
if (setIndex > LOG_INDEX.trace) {
|
|
20
|
-
global.console.trace = jest.fn()
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (setIndex > LOG_INDEX.debug) {
|
|
24
|
-
global.console.debug = jest.fn()
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (setIndex > LOG_INDEX.info) {
|
|
28
|
-
global.console.info = jest.fn()
|
|
29
|
-
global.console.log = jest.fn()
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (setIndex > LOG_INDEX.warn) {
|
|
33
|
-
global.console.warn = jest.fn()
|
|
34
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import fetch from "node-fetch"
|
|
2
|
-
import {
|
|
3
|
-
constants,
|
|
4
|
-
tenancy,
|
|
5
|
-
logging,
|
|
6
|
-
env as coreEnv,
|
|
7
|
-
} from "@budibase/backend-core"
|
|
8
|
-
import { checkSlashesInUrl } from "../utilities"
|
|
9
|
-
import env from "../environment"
|
|
10
|
-
import { SyncUserRequest, User } from "@budibase/types"
|
|
11
|
-
|
|
12
|
-
async function makeAppRequest(url: string, method: string, body: any) {
|
|
13
|
-
if (env.isTest()) {
|
|
14
|
-
return
|
|
15
|
-
}
|
|
16
|
-
const request: any = { headers: {} }
|
|
17
|
-
request.headers[constants.Header.API_KEY] = coreEnv.INTERNAL_API_KEY
|
|
18
|
-
if (tenancy.isTenantIdSet()) {
|
|
19
|
-
request.headers[constants.Header.TENANT_ID] = tenancy.getTenantId()
|
|
20
|
-
}
|
|
21
|
-
if (body) {
|
|
22
|
-
request.headers["Content-Type"] = "application/json"
|
|
23
|
-
request.body = JSON.stringify(body)
|
|
24
|
-
}
|
|
25
|
-
request.method = method
|
|
26
|
-
|
|
27
|
-
// add x-budibase-correlation-id header
|
|
28
|
-
logging.correlation.setHeader(request.headers)
|
|
29
|
-
|
|
30
|
-
return fetch(checkSlashesInUrl(env.APPS_URL + url), request)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export async function syncUserInApps(userId: string, previousUser?: User) {
|
|
34
|
-
const body: SyncUserRequest = {
|
|
35
|
-
previousUser,
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const response = await makeAppRequest(
|
|
39
|
-
`/api/users/metadata/sync/${userId}`,
|
|
40
|
-
"POST",
|
|
41
|
-
body
|
|
42
|
-
)
|
|
43
|
-
if (response && response.status !== 200) {
|
|
44
|
-
throw "Unable to sync user."
|
|
45
|
-
}
|
|
46
|
-
}
|