@budibase/server 2.7.7-alpha.5 → 2.7.7-alpha.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/builder/assets/{index.4afe46bb.js → index.494fe793.js} +268 -268
- package/builder/assets/{index.3c336b18.css → index.ff9c71fb.css} +1 -1
- package/builder/index.html +2 -2
- package/dist/index.js +7 -14
- package/dist/index.js.map +3 -3
- package/package.json +8 -8
- package/src/api/controllers/backup.ts +14 -6
- package/src/api/routes/backup.ts +1 -1
- package/src/api/routes/tests/backup.spec.ts +18 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/server",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "2.7.7-alpha.
|
|
4
|
+
"version": "2.7.7-alpha.7",
|
|
5
5
|
"description": "Budibase Web Server",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"license": "GPL-3.0",
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@apidevtools/swagger-parser": "10.0.3",
|
|
49
|
-
"@budibase/backend-core": "2.7.7-alpha.
|
|
50
|
-
"@budibase/client": "2.7.7-alpha.
|
|
51
|
-
"@budibase/pro": "2.7.7-alpha.
|
|
52
|
-
"@budibase/shared-core": "2.7.7-alpha.
|
|
53
|
-
"@budibase/string-templates": "2.7.7-alpha.
|
|
54
|
-
"@budibase/types": "2.7.7-alpha.
|
|
49
|
+
"@budibase/backend-core": "2.7.7-alpha.7",
|
|
50
|
+
"@budibase/client": "2.7.7-alpha.7",
|
|
51
|
+
"@budibase/pro": "2.7.7-alpha.7",
|
|
52
|
+
"@budibase/shared-core": "2.7.7-alpha.7",
|
|
53
|
+
"@budibase/string-templates": "2.7.7-alpha.7",
|
|
54
|
+
"@budibase/types": "2.7.7-alpha.7",
|
|
55
55
|
"@bull-board/api": "3.7.0",
|
|
56
56
|
"@bull-board/koa": "3.9.4",
|
|
57
57
|
"@elastic/elasticsearch": "7.10.0",
|
|
@@ -195,5 +195,5 @@
|
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
},
|
|
198
|
-
"gitHead": "
|
|
198
|
+
"gitHead": "9d9022ad8b10316acdce141458bfb434140cdde6"
|
|
199
199
|
}
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import sdk from "../../sdk"
|
|
2
|
-
import { events, context } from "@budibase/backend-core"
|
|
2
|
+
import { events, context, db } from "@budibase/backend-core"
|
|
3
3
|
import { DocumentType } from "../../db/utils"
|
|
4
|
-
import {
|
|
4
|
+
import { Ctx } from "@budibase/types"
|
|
5
|
+
|
|
6
|
+
interface ExportAppDumpRequest {
|
|
7
|
+
excludeRows: boolean
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export async function exportAppDump(ctx: Ctx<ExportAppDumpRequest>) {
|
|
11
|
+
const { appId } = ctx.query as any
|
|
12
|
+
const { excludeRows } = ctx.request.body
|
|
13
|
+
|
|
14
|
+
const [app] = await db.getAppsByIDs([appId])
|
|
15
|
+
const appName = app.name
|
|
5
16
|
|
|
6
|
-
export async function exportAppDump(ctx: any) {
|
|
7
|
-
let { appId, excludeRows } = ctx.query
|
|
8
17
|
// remove the 120 second limit for the request
|
|
9
18
|
ctx.req.setTimeout(0)
|
|
10
|
-
|
|
11
|
-
excludeRows = isQsTrue(excludeRows)
|
|
19
|
+
|
|
12
20
|
const backupIdentifier = `${appName}-export-${new Date().getTime()}.tar.gz`
|
|
13
21
|
ctx.attachment(backupIdentifier)
|
|
14
22
|
ctx.body = await sdk.backups.streamExportApp(appId, excludeRows)
|
package/src/api/routes/backup.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import tk from "timekeeper"
|
|
1
2
|
import * as setup from "./utilities"
|
|
2
3
|
import { events } from "@budibase/backend-core"
|
|
3
4
|
import sdk from "../../../sdk"
|
|
4
5
|
import { checkBuilderEndpoint } from "./utilities/TestFunctions"
|
|
6
|
+
import { mocks } from "@budibase/backend-core/tests"
|
|
5
7
|
|
|
6
8
|
describe("/backups", () => {
|
|
7
9
|
let request = setup.getRequest()
|
|
@@ -16,7 +18,7 @@ describe("/backups", () => {
|
|
|
16
18
|
describe("exportAppDump", () => {
|
|
17
19
|
it("should be able to export app", async () => {
|
|
18
20
|
const res = await request
|
|
19
|
-
.
|
|
21
|
+
.post(`/api/backups/export?appId=${config.getAppId()}`)
|
|
20
22
|
.set(config.defaultHeaders())
|
|
21
23
|
.expect(200)
|
|
22
24
|
expect(res.headers["content-type"]).toEqual("application/gzip")
|
|
@@ -26,10 +28,24 @@ describe("/backups", () => {
|
|
|
26
28
|
it("should apply authorization to endpoint", async () => {
|
|
27
29
|
await checkBuilderEndpoint({
|
|
28
30
|
config,
|
|
29
|
-
method: "
|
|
31
|
+
method: "POST",
|
|
30
32
|
url: `/api/backups/export?appId=${config.getAppId()}`,
|
|
31
33
|
})
|
|
32
34
|
})
|
|
35
|
+
|
|
36
|
+
it("should infer the app name from the app", async () => {
|
|
37
|
+
tk.freeze(mocks.date.MOCK_DATE)
|
|
38
|
+
|
|
39
|
+
const res = await request
|
|
40
|
+
.post(`/api/backups/export?appId=${config.getAppId()}`)
|
|
41
|
+
.set(config.defaultHeaders())
|
|
42
|
+
|
|
43
|
+
expect(res.headers["content-disposition"]).toEqual(
|
|
44
|
+
`attachment; filename="${
|
|
45
|
+
config.getApp()!.name
|
|
46
|
+
}-export-${mocks.date.MOCK_DATE.getTime()}.tar.gz"`
|
|
47
|
+
)
|
|
48
|
+
})
|
|
33
49
|
})
|
|
34
50
|
|
|
35
51
|
describe("calculateBackupStats", () => {
|