@budibase/server 2.3.18-alpha.24 → 2.3.18-alpha.25

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/server",
3
3
  "email": "hi@budibase.com",
4
- "version": "2.3.18-alpha.24",
4
+ "version": "2.3.18-alpha.25",
5
5
  "description": "Budibase Web Server",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -43,11 +43,11 @@
43
43
  "license": "GPL-3.0",
44
44
  "dependencies": {
45
45
  "@apidevtools/swagger-parser": "10.0.3",
46
- "@budibase/backend-core": "2.3.18-alpha.24",
47
- "@budibase/client": "2.3.18-alpha.24",
48
- "@budibase/pro": "2.3.18-alpha.23",
49
- "@budibase/string-templates": "2.3.18-alpha.24",
50
- "@budibase/types": "2.3.18-alpha.24",
46
+ "@budibase/backend-core": "2.3.18-alpha.25",
47
+ "@budibase/client": "2.3.18-alpha.25",
48
+ "@budibase/pro": "2.3.18-alpha.24",
49
+ "@budibase/string-templates": "2.3.18-alpha.25",
50
+ "@budibase/types": "2.3.18-alpha.25",
51
51
  "@bull-board/api": "3.7.0",
52
52
  "@bull-board/koa": "3.9.4",
53
53
  "@elastic/elasticsearch": "7.10.0",
@@ -174,5 +174,5 @@
174
174
  "optionalDependencies": {
175
175
  "oracledb": "5.3.0"
176
176
  },
177
- "gitHead": "724eebb43c97177c62afa948d7f64335c323dfb4"
177
+ "gitHead": "75f36b7ee6bb179218295e0a38e9baf4b84ea16e"
178
178
  }
@@ -1,2 +1,3 @@
1
1
  export const DB_EXPORT_FILE = "db.txt"
2
2
  export const GLOBAL_DB_EXPORT_FILE = "global.txt"
3
+ export const STATIC_APP_FILES = ["manifest.json", "budibase-client.js"]
@@ -7,10 +7,15 @@ import {
7
7
  TABLE_ROW_PREFIX,
8
8
  USER_METDATA_PREFIX,
9
9
  } from "../../../db/utils"
10
- import { DB_EXPORT_FILE, GLOBAL_DB_EXPORT_FILE } from "./constants"
10
+ import {
11
+ DB_EXPORT_FILE,
12
+ GLOBAL_DB_EXPORT_FILE,
13
+ STATIC_APP_FILES,
14
+ } from "./constants"
11
15
  import fs from "fs"
12
16
  import { join } from "path"
13
17
  import env from "../../../environment"
18
+
14
19
  const uuid = require("uuid/v4")
15
20
  const tar = require("tar")
16
21
  const MemoryStream = require("memorystream")
@@ -91,14 +96,25 @@ export async function exportApp(appId: string, config?: ExportOpts) {
91
96
  const prodAppId = dbCore.getProdAppID(appId)
92
97
  const appPath = `${prodAppId}/`
93
98
  // export bucket contents
94
- let tmpPath
99
+ let tmpPath = createTempFolder(uuid())
95
100
  if (!env.isTest()) {
96
- tmpPath = await objectStore.retrieveDirectory(
97
- ObjectStoreBuckets.APPS,
98
- appPath
99
- )
100
- } else {
101
- tmpPath = createTempFolder(uuid())
101
+ // write just the static files
102
+ if (config?.excludeRows) {
103
+ for (let path of STATIC_APP_FILES) {
104
+ const contents = await objectStore.retrieve(
105
+ ObjectStoreBuckets.APPS,
106
+ join(appPath, path)
107
+ )
108
+ fs.writeFileSync(join(tmpPath, path), contents)
109
+ }
110
+ }
111
+ // get all of the files
112
+ else {
113
+ tmpPath = await objectStore.retrieveDirectory(
114
+ ObjectStoreBuckets.APPS,
115
+ appPath
116
+ )
117
+ }
102
118
  }
103
119
  const downloadedPath = join(tmpPath, appPath)
104
120
  if (fs.existsSync(downloadedPath)) {
@@ -13,13 +13,13 @@ function generateAttachmentFindParams(
13
13
  ) {
14
14
  const params: CouchFindOptions = {
15
15
  selector: {
16
+ $or: attachmentCols.map(col => ({ [col]: { $exists: true } })),
16
17
  _id: {
17
18
  $regex: `^${DocumentType.ROW}${SEPARATOR}${tableId}`,
18
19
  },
19
20
  },
20
21
  limit: FIND_LIMIT,
21
22
  }
22
- attachmentCols.forEach(col => (params.selector[col] = { $exists: true }))
23
23
  if (bookmark) {
24
24
  params.bookmark = bookmark
25
25
  }