@budibase/worker 2.8.13 → 2.8.16-alpha.4
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 +6 -6
- package/src/api/controllers/global/email.ts +3 -3
- package/src/api/controllers/global/roles.ts +1 -1
- package/src/api/controllers/global/self.ts +1 -1
- package/src/api/controllers/global/users.ts +1 -1
- package/src/api/controllers/system/logs.ts +13 -0
- package/src/api/routes/index.ts +7 -0
- package/src/api/routes/system/logs.ts +9 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/worker",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "2.8.
|
|
4
|
+
"version": "2.8.16-alpha.4",
|
|
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.8.
|
|
42
|
-
"@budibase/pro": "2.8.
|
|
43
|
-
"@budibase/string-templates": "2.8.
|
|
44
|
-
"@budibase/types": "2.8.
|
|
41
|
+
"@budibase/backend-core": "2.8.16-alpha.4",
|
|
42
|
+
"@budibase/pro": "2.8.16-alpha.4",
|
|
43
|
+
"@budibase/string-templates": "2.8.16-alpha.4",
|
|
44
|
+
"@budibase/types": "2.8.16-alpha.4",
|
|
45
45
|
"@koa/router": "8.0.8",
|
|
46
46
|
"@sentry/node": "6.17.7",
|
|
47
47
|
"@techpass/passport-openidconnect": "0.3.2",
|
|
@@ -104,5 +104,5 @@
|
|
|
104
104
|
"typescript": "4.7.3",
|
|
105
105
|
"update-dotenv": "1.1.1"
|
|
106
106
|
},
|
|
107
|
-
"gitHead": "
|
|
107
|
+
"gitHead": "678ac0869da16991b5e54a87c4cdc404e25fd03c"
|
|
108
108
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { sendEmail as sendEmailFn } from "../../../utilities/email"
|
|
2
2
|
import { tenancy } from "@budibase/backend-core"
|
|
3
|
-
import { BBContext } from "@budibase/types"
|
|
3
|
+
import { BBContext, User } from "@budibase/types"
|
|
4
4
|
|
|
5
5
|
export async function sendEmail(ctx: BBContext) {
|
|
6
6
|
let {
|
|
@@ -16,10 +16,10 @@ export async function sendEmail(ctx: BBContext) {
|
|
|
16
16
|
automation,
|
|
17
17
|
invite,
|
|
18
18
|
} = ctx.request.body
|
|
19
|
-
let user
|
|
19
|
+
let user: any
|
|
20
20
|
if (userId) {
|
|
21
21
|
const db = tenancy.getGlobalDB()
|
|
22
|
-
user = await db.get(userId)
|
|
22
|
+
user = await db.get<User>(userId)
|
|
23
23
|
}
|
|
24
24
|
const response = await sendEmailFn(email, purpose, {
|
|
25
25
|
workspaceId,
|
|
@@ -35,7 +35,7 @@ export async function find(ctx: BBContext) {
|
|
|
35
35
|
const appId = ctx.params.appId
|
|
36
36
|
await context.doInAppContext(dbCore.getDevAppID(appId), async () => {
|
|
37
37
|
const db = context.getAppDB()
|
|
38
|
-
const app = await db.get(dbCore.DocumentType.APP_METADATA)
|
|
38
|
+
const app = await db.get<App>(dbCore.DocumentType.APP_METADATA)
|
|
39
39
|
ctx.body = {
|
|
40
40
|
roles: await roles.getAllRoles(),
|
|
41
41
|
name: app.name,
|
|
@@ -412,7 +412,7 @@ export const inviteAccept = async (
|
|
|
412
412
|
|
|
413
413
|
const saved = await userSdk.save(request)
|
|
414
414
|
const db = tenancy.getGlobalDB()
|
|
415
|
-
const user = await db.get(saved._id)
|
|
415
|
+
const user = await db.get<User>(saved._id)
|
|
416
416
|
await events.user.inviteAccepted(user)
|
|
417
417
|
return saved
|
|
418
418
|
})
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { UserCtx } from "@budibase/types"
|
|
2
|
+
import { installation, logging } from "@budibase/backend-core"
|
|
3
|
+
|
|
4
|
+
export async function getLogs(ctx: UserCtx) {
|
|
5
|
+
const logReadStream = logging.system.getLogReadStream()
|
|
6
|
+
|
|
7
|
+
const { installId } = await installation.getInstall()
|
|
8
|
+
|
|
9
|
+
const fileName = `${installId}-${Date.now()}.log`
|
|
10
|
+
|
|
11
|
+
ctx.set("content-disposition", `attachment; filename=${fileName}`)
|
|
12
|
+
ctx.body = logReadStream
|
|
13
|
+
}
|
package/src/api/routes/index.ts
CHANGED
|
@@ -16,6 +16,9 @@ import licenseRoutes from "./global/license"
|
|
|
16
16
|
import migrationRoutes from "./system/migrations"
|
|
17
17
|
import accountRoutes from "./system/accounts"
|
|
18
18
|
import restoreRoutes from "./system/restore"
|
|
19
|
+
import systemLogRoutes from "./system/logs"
|
|
20
|
+
|
|
21
|
+
import env from "../../environment"
|
|
19
22
|
|
|
20
23
|
export const routes: Router[] = [
|
|
21
24
|
configRoutes,
|
|
@@ -38,3 +41,7 @@ export const routes: Router[] = [
|
|
|
38
41
|
eventRoutes,
|
|
39
42
|
pro.scim,
|
|
40
43
|
]
|
|
44
|
+
|
|
45
|
+
if (env.SELF_HOSTED) {
|
|
46
|
+
routes.push(systemLogRoutes)
|
|
47
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Router from "@koa/router"
|
|
2
|
+
import { middleware } from "@budibase/backend-core"
|
|
3
|
+
import * as controller from "../../controllers/system/logs"
|
|
4
|
+
|
|
5
|
+
const router: Router = new Router()
|
|
6
|
+
|
|
7
|
+
router.get("/api/system/logs", middleware.adminOnly, controller.getLogs)
|
|
8
|
+
|
|
9
|
+
export default router
|