@budibase/server 1.0.115 → 1.0.116
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.dae9f8cf.js → index.28d8c64f.js} +1 -1
- package/builder/index.html +1 -1
- package/coverage/clover.xml +1113 -1125
- package/coverage/coverage-final.json +85 -86
- package/coverage/lcov-report/api/controllers/analytics.js.html +1 -1
- package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/controllers/application.js.html +126 -120
- package/coverage/lcov-report/api/controllers/auth.js.html +1 -1
- package/coverage/lcov-report/api/controllers/automation.js.html +21 -21
- package/coverage/lcov-report/api/controllers/backup.js.html +1 -1
- package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
- package/coverage/lcov-report/api/controllers/component.js.html +1 -1
- package/coverage/lcov-report/api/controllers/datasource.js.html +16 -16
- package/coverage/lcov-report/api/controllers/dev.js.html +23 -14
- package/coverage/lcov-report/api/controllers/index.html +17 -17
- package/coverage/lcov-report/api/controllers/integration.js.html +1 -1
- package/coverage/lcov-report/api/controllers/layout.js.html +6 -6
- package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
- package/coverage/lcov-report/api/controllers/migrations.js.html +1 -1
- package/coverage/lcov-report/api/controllers/permission.js.html +15 -15
- package/coverage/lcov-report/api/controllers/query/index.html +1 -1
- package/coverage/lcov-report/api/controllers/query/index.js.html +19 -19
- package/coverage/lcov-report/api/controllers/query/validation.js.html +1 -1
- package/coverage/lcov-report/api/controllers/role.js.html +9 -9
- package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/external.js.html +19 -19
- package/coverage/lcov-report/api/controllers/row/index.html +10 -10
- package/coverage/lcov-report/api/controllers/row/index.js.html +14 -14
- package/coverage/lcov-report/api/controllers/row/internal.js.html +37 -34
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +9 -9
- package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +10 -10
- package/coverage/lcov-report/api/controllers/row/utils.js.html +12 -12
- package/coverage/lcov-report/api/controllers/screen.js.html +7 -7
- package/coverage/lcov-report/api/controllers/script.js.html +4 -4
- package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +9 -9
- package/coverage/lcov-report/api/controllers/table/external.js.html +12 -12
- package/coverage/lcov-report/api/controllers/table/index.html +1 -1
- package/coverage/lcov-report/api/controllers/table/index.js.html +14 -14
- package/coverage/lcov-report/api/controllers/table/internal.js.html +13 -13
- package/coverage/lcov-report/api/controllers/table/utils.js.html +30 -30
- package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
- package/coverage/lcov-report/api/controllers/user.js.html +19 -19
- package/coverage/lcov-report/api/controllers/view/exporters.js.html +4 -4
- package/coverage/lcov-report/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.js.html +14 -14
- package/coverage/lcov-report/api/controllers/view/utils.js.html +12 -12
- package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +7 -7
- package/coverage/lcov-report/api/controllers/webhook.js.html +17 -17
- package/coverage/lcov-report/api/index.html +1 -1
- package/coverage/lcov-report/api/index.js.html +1 -1
- package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
- package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/routes/application.js.html +1 -1
- package/coverage/lcov-report/api/routes/auth.js.html +1 -1
- package/coverage/lcov-report/api/routes/automation.js.html +1 -1
- package/coverage/lcov-report/api/routes/backup.js.html +1 -1
- package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
- package/coverage/lcov-report/api/routes/component.js.html +1 -1
- package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
- package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
- package/coverage/lcov-report/api/routes/dev.js.html +1 -1
- package/coverage/lcov-report/api/routes/index.html +1 -1
- package/coverage/lcov-report/api/routes/index.js.html +1 -1
- package/coverage/lcov-report/api/routes/integration.js.html +1 -1
- package/coverage/lcov-report/api/routes/layout.js.html +1 -1
- package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
- package/coverage/lcov-report/api/routes/migrations.js.html +1 -1
- package/coverage/lcov-report/api/routes/permission.js.html +1 -1
- package/coverage/lcov-report/api/routes/query.js.html +1 -1
- package/coverage/lcov-report/api/routes/role.js.html +1 -1
- package/coverage/lcov-report/api/routes/routing.js.html +1 -1
- package/coverage/lcov-report/api/routes/row.js.html +1 -1
- package/coverage/lcov-report/api/routes/screen.js.html +1 -1
- package/coverage/lcov-report/api/routes/script.js.html +1 -1
- package/coverage/lcov-report/api/routes/static.js.html +1 -1
- package/coverage/lcov-report/api/routes/table.js.html +1 -1
- package/coverage/lcov-report/api/routes/templates.js.html +1 -1
- package/coverage/lcov-report/api/routes/user.js.html +1 -1
- package/coverage/lcov-report/api/routes/utils/index.html +1 -1
- package/coverage/lcov-report/api/routes/utils/validators.js.html +1 -1
- package/coverage/lcov-report/api/routes/view.js.html +1 -1
- package/coverage/lcov-report/api/routes/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/actions.js.html +24 -24
- package/coverage/lcov-report/automations/automationUtils.js.html +5 -5
- package/coverage/lcov-report/automations/bullboard.js.html +16 -16
- package/coverage/lcov-report/automations/index.html +5 -5
- package/coverage/lcov-report/automations/index.js.html +1 -1
- package/coverage/lcov-report/automations/steps/bash.js.html +7 -7
- package/coverage/lcov-report/automations/steps/createRow.js.html +7 -7
- package/coverage/lcov-report/automations/steps/delay.js.html +4 -4
- package/coverage/lcov-report/automations/steps/deleteRow.js.html +7 -7
- package/coverage/lcov-report/automations/steps/discord.js.html +7 -7
- package/coverage/lcov-report/automations/steps/executeQuery.js.html +6 -6
- package/coverage/lcov-report/automations/steps/executeScript.js.html +6 -6
- package/coverage/lcov-report/automations/steps/filter.js.html +7 -7
- package/coverage/lcov-report/automations/steps/index.html +1 -1
- package/coverage/lcov-report/automations/steps/integromat.js.html +5 -5
- package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +8 -8
- package/coverage/lcov-report/automations/steps/queryRows.js.html +10 -10
- package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +5 -5
- package/coverage/lcov-report/automations/steps/serverLog.js.html +3 -3
- package/coverage/lcov-report/automations/steps/slack.js.html +5 -5
- package/coverage/lcov-report/automations/steps/updateRow.js.html +6 -6
- package/coverage/lcov-report/automations/steps/utils.js.html +3 -3
- package/coverage/lcov-report/automations/steps/zapier.js.html +5 -5
- package/coverage/lcov-report/automations/triggerInfo/app.js.html +2 -2
- package/coverage/lcov-report/automations/triggerInfo/cron.js.html +2 -2
- package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.js.html +8 -8
- package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +2 -2
- package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +2 -2
- package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +2 -2
- package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +2 -2
- package/coverage/lcov-report/automations/triggers.js.html +18 -18
- package/coverage/lcov-report/automations/utils.js.html +43 -40
- package/coverage/lcov-report/constants/index.html +1 -1
- package/coverage/lcov-report/constants/index.js.html +27 -27
- package/coverage/lcov-report/constants/layouts.js.html +5 -5
- package/coverage/lcov-report/constants/screens.js.html +4 -4
- package/coverage/lcov-report/db/inMemoryView.js.html +52 -49
- package/coverage/lcov-report/db/index.html +21 -36
- package/coverage/lcov-report/db/index.js.html +49 -10
- package/coverage/lcov-report/db/linkedRows/LinkController.js.html +7 -7
- package/coverage/lcov-report/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.js.html +18 -18
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +13 -13
- package/coverage/lcov-report/db/newid.js.html +2 -2
- package/coverage/lcov-report/db/utils.js.html +13 -13
- package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
- package/coverage/lcov-report/events/index.html +1 -1
- package/coverage/lcov-report/events/index.js.html +5 -5
- package/coverage/lcov-report/events/utils.js.html +3 -3
- package/coverage/lcov-report/index.html +46 -46
- package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
- package/coverage/lcov-report/integrations/tests/index.html +1 -1
- package/coverage/lcov-report/middleware/appInfo.js.html +1 -1
- package/coverage/lcov-report/middleware/authorized.js.html +1 -1
- package/coverage/lcov-report/middleware/builder.js.html +15 -12
- package/coverage/lcov-report/middleware/currentapp.js.html +1 -1
- package/coverage/lcov-report/middleware/index.html +4 -4
- package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
- package/coverage/lcov-report/middleware/publicApi.js.html +1 -1
- package/coverage/lcov-report/middleware/resourceId.js.html +1 -1
- package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
- package/coverage/lcov-report/middleware/usageQuota.js.html +1 -1
- package/coverage/lcov-report/middleware/utils.js.html +1 -1
- package/coverage/lcov-report/threads/automation.js.html +1 -1
- package/coverage/lcov-report/threads/index.html +10 -10
- package/coverage/lcov-report/threads/index.js.html +10 -10
- package/coverage/lcov-report/threads/query.js.html +1 -1
- package/coverage/lcov-report/threads/utils.js.html +19 -22
- package/coverage/lcov-report/utilities/bcrypt.js.html +1 -1
- package/coverage/lcov-report/utilities/budibaseDir.js.html +7 -7
- package/coverage/lcov-report/utilities/centralPath.js.html +4 -4
- package/coverage/lcov-report/utilities/csvParser.js.html +6 -6
- package/coverage/lcov-report/utilities/global.js.html +15 -15
- package/coverage/lcov-report/utilities/index.html +1 -1
- package/coverage/lcov-report/utilities/index.js.html +26 -26
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +8 -8
- package/coverage/lcov-report/utilities/queue/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.js.html +18 -18
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +4 -4
- package/coverage/lcov-report/utilities/scriptRunner.js.html +5 -5
- package/coverage/lcov-report/utilities/security.js.html +8 -8
- package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/index.html +13 -13
- package/coverage/lcov-report/utilities/usageQuota/index.js.html +8 -8
- package/coverage/lcov-report/utilities/usageQuota/rows.js.html +38 -26
- package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
- package/coverage/lcov-report/utilities/users.js.html +5 -5
- package/coverage/lcov-report/utilities/workerRequests.js.html +28 -28
- package/coverage/lcov.info +1392 -1404
- package/dist/api/controllers/application.js +4 -1
- package/dist/api/controllers/deploy/index.js +5 -1
- package/dist/api/controllers/dev.js +9 -5
- package/dist/api/controllers/row/internal.js +2 -1
- package/dist/api/controllers/webhook.js +2 -2
- package/dist/api/routes/tests/utilities/TestFunctions.js +1 -4
- package/dist/app.js +5 -2
- package/dist/automations/utils.js +6 -5
- package/dist/db/inMemoryView.js +33 -31
- package/dist/db/index.js +13 -2
- package/dist/integrations/couchdb.js +19 -25
- package/dist/middleware/builder.js +10 -9
- package/dist/migrations/index.js +1 -5
- package/dist/package.json +5 -5
- package/dist/tests/utilities/TestConfiguration.js +66 -59
- package/dist/threads/utils.js +2 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utilities/fileSystem/index.js +27 -26
- package/dist/utilities/usageQuota/rows.js +16 -16
- package/package.json +6 -6
- package/scripts/exportAppTemplate.js +10 -8
- package/src/api/controllers/application.js +3 -1
- package/src/api/controllers/deploy/index.js +4 -4
- package/src/api/controllers/dev.js +9 -6
- package/src/api/controllers/query/import/tests/index.spec.js +7 -11
- package/src/api/controllers/row/internal.js +2 -1
- package/src/api/controllers/webhook.js +2 -2
- package/src/api/routes/tests/row.spec.js +15 -11
- package/src/api/routes/tests/table.spec.js +3 -2
- package/src/api/routes/tests/utilities/TestFunctions.js +1 -5
- package/src/app.ts +2 -2
- package/src/automations/tests/deleteRow.spec.js +1 -1
- package/src/automations/utils.js +6 -5
- package/src/db/inMemoryView.js +37 -36
- package/src/db/index.js +15 -2
- package/src/db/tests/linkTests.spec.js +8 -7
- package/src/integrations/couchdb.ts +28 -24
- package/src/integrations/tests/airtable.spec.js +3 -1
- package/src/integrations/tests/couchdb.spec.js +4 -1
- package/src/middleware/builder.js +10 -9
- package/src/middleware/tests/authorized.spec.js +0 -1
- package/src/middleware/tests/usageQuota.spec.js +6 -20
- package/src/migrations/functions/tests/appUrls.spec.js +8 -11
- package/src/migrations/functions/tests/userEmailViewCasing.spec.js +13 -10
- package/src/migrations/functions/usageQuotas/tests/syncApps.spec.js +25 -21
- package/src/migrations/functions/usageQuotas/tests/syncRows.spec.js +26 -24
- package/src/migrations/index.ts +1 -2
- package/src/module.d.ts +8 -0
- package/src/tests/utilities/TestConfiguration.js +62 -55
- package/src/threads/utils.js +2 -3
- package/src/utilities/fileSystem/index.js +30 -30
- package/src/utilities/usageQuota/rows.js +22 -18
- package/coverage/lcov-report/db/client.js.html +0 -173
- package/dist/db/client.js +0 -25
- package/scripts/replicateApp.js +0 -50
- package/src/db/client.js +0 -31
|
@@ -2,7 +2,7 @@ const { budibaseTempDir } = require("../budibaseDir")
|
|
|
2
2
|
const fs = require("fs")
|
|
3
3
|
const { join } = require("path")
|
|
4
4
|
const uuid = require("uuid/v4")
|
|
5
|
-
const
|
|
5
|
+
const { doWithDB } = require("@budibase/backend-core/db")
|
|
6
6
|
const { ObjectStoreBuckets } = require("../../constants")
|
|
7
7
|
const {
|
|
8
8
|
upload,
|
|
@@ -151,41 +151,41 @@ exports.streamBackup = async appId => {
|
|
|
151
151
|
* @return {*} either a readable stream or a string
|
|
152
152
|
*/
|
|
153
153
|
exports.exportDB = async (dbName, { stream, filter, exportName } = {}) => {
|
|
154
|
-
|
|
154
|
+
return doWithDB(dbName, async db => {
|
|
155
|
+
// Stream the dump if required
|
|
156
|
+
if (stream) {
|
|
157
|
+
const memStream = new MemoryStream()
|
|
158
|
+
db.dump(memStream, { filter })
|
|
159
|
+
return memStream
|
|
160
|
+
}
|
|
155
161
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
+
// Write the dump to file if required
|
|
163
|
+
if (exportName) {
|
|
164
|
+
const path = join(budibaseTempDir(), exportName)
|
|
165
|
+
const writeStream = fs.createWriteStream(path)
|
|
166
|
+
await db.dump(writeStream, { filter })
|
|
162
167
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
+
// Upload the dump to the object store if self hosted
|
|
169
|
+
if (env.SELF_HOSTED) {
|
|
170
|
+
await streamUpload(
|
|
171
|
+
ObjectStoreBuckets.BACKUPS,
|
|
172
|
+
join(dbName, exportName),
|
|
173
|
+
fs.createReadStream(path)
|
|
174
|
+
)
|
|
175
|
+
}
|
|
168
176
|
|
|
169
|
-
|
|
170
|
-
if (env.SELF_HOSTED) {
|
|
171
|
-
await streamUpload(
|
|
172
|
-
ObjectStoreBuckets.BACKUPS,
|
|
173
|
-
join(dbName, exportName),
|
|
174
|
-
fs.createReadStream(path)
|
|
175
|
-
)
|
|
177
|
+
return fs.createReadStream(path)
|
|
176
178
|
}
|
|
177
179
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
appString
|
|
180
|
+
// Stringify the dump in memory if required
|
|
181
|
+
const memStream = new MemoryStream()
|
|
182
|
+
let appString = ""
|
|
183
|
+
memStream.on("data", chunk => {
|
|
184
|
+
appString += chunk.toString()
|
|
185
|
+
})
|
|
186
|
+
await db.dump(memStream, { filter })
|
|
187
|
+
return appString
|
|
186
188
|
})
|
|
187
|
-
await instanceDb.dump(memStream, { filter })
|
|
188
|
-
return appString
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
/**
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
const { getRowParams, USER_METDATA_PREFIX } = require("../../db/utils")
|
|
2
|
-
const
|
|
3
|
-
|
|
2
|
+
const {
|
|
3
|
+
isDevAppID,
|
|
4
|
+
getDevelopmentAppID,
|
|
5
|
+
doWithDB,
|
|
6
|
+
} = require("@budibase/backend-core/db")
|
|
4
7
|
|
|
5
8
|
const ROW_EXCLUSIONS = [USER_METDATA_PREFIX]
|
|
6
9
|
|
|
@@ -24,22 +27,23 @@ const getAppPairs = appIds => {
|
|
|
24
27
|
|
|
25
28
|
const getAppRows = async appId => {
|
|
26
29
|
// need to specify the app ID, as this is used for different apps in one call
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
return doWithDB(appId, async db => {
|
|
31
|
+
const response = await db.allDocs(
|
|
32
|
+
getRowParams(null, null, {
|
|
33
|
+
include_docs: false,
|
|
34
|
+
})
|
|
35
|
+
)
|
|
36
|
+
return response.rows
|
|
37
|
+
.map(r => r.id)
|
|
38
|
+
.filter(id => {
|
|
39
|
+
for (let exclusion of ROW_EXCLUSIONS) {
|
|
40
|
+
if (id.startsWith(exclusion)) {
|
|
41
|
+
return false
|
|
42
|
+
}
|
|
39
43
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
return true
|
|
45
|
+
})
|
|
46
|
+
})
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
/**
|
|
@@ -58,7 +62,7 @@ exports.getUniqueRows = async appIds => {
|
|
|
58
62
|
continue
|
|
59
63
|
}
|
|
60
64
|
try {
|
|
61
|
-
appRows.
|
|
65
|
+
appRows = appRows.concat(await getAppRows(appId))
|
|
62
66
|
} catch (e) {
|
|
63
67
|
console.error(e)
|
|
64
68
|
// don't error out if we can't count the app rows, just continue
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
<!doctype html>
|
|
3
|
-
<html lang="en">
|
|
4
|
-
|
|
5
|
-
<head>
|
|
6
|
-
<title>Code coverage report for db/client.js</title>
|
|
7
|
-
<meta charset="utf-8" />
|
|
8
|
-
<link rel="stylesheet" href="../prettify.css" />
|
|
9
|
-
<link rel="stylesheet" href="../base.css" />
|
|
10
|
-
<link rel="shortcut icon" type="image/x-icon" href="../favicon.png" />
|
|
11
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
12
|
-
<style type='text/css'>
|
|
13
|
-
.coverage-summary .sorter {
|
|
14
|
-
background-image: url(../sort-arrow-sprite.png);
|
|
15
|
-
}
|
|
16
|
-
</style>
|
|
17
|
-
</head>
|
|
18
|
-
|
|
19
|
-
<body>
|
|
20
|
-
<div class='wrapper'>
|
|
21
|
-
<div class='pad1'>
|
|
22
|
-
<h1><a href="../index.html">All files</a> / <a href="index.html">db</a> client.js</h1>
|
|
23
|
-
<div class='clearfix'>
|
|
24
|
-
|
|
25
|
-
<div class='fl pad1y space-right2'>
|
|
26
|
-
<span class="strong">100% </span>
|
|
27
|
-
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>17/17</span>
|
|
29
|
-
</div>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
<div class='fl pad1y space-right2'>
|
|
33
|
-
<span class="strong">75% </span>
|
|
34
|
-
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>3/4</span>
|
|
36
|
-
</div>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<div class='fl pad1y space-right2'>
|
|
40
|
-
<span class="strong">100% </span>
|
|
41
|
-
<span class="quiet">Functions</span>
|
|
42
|
-
<span class='fraction'>0/0</span>
|
|
43
|
-
</div>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">100% </span>
|
|
48
|
-
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>17/17</span>
|
|
50
|
-
</div>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
</div>
|
|
54
|
-
<p class="quiet">
|
|
55
|
-
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
|
56
|
-
</p>
|
|
57
|
-
</div>
|
|
58
|
-
<div class='status-line high'></div>
|
|
59
|
-
<pre><table class="coverage">
|
|
60
|
-
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
|
61
|
-
<a name='L2'></a><a href='#L2'>2</a>
|
|
62
|
-
<a name='L3'></a><a href='#L3'>3</a>
|
|
63
|
-
<a name='L4'></a><a href='#L4'>4</a>
|
|
64
|
-
<a name='L5'></a><a href='#L5'>5</a>
|
|
65
|
-
<a name='L6'></a><a href='#L6'>6</a>
|
|
66
|
-
<a name='L7'></a><a href='#L7'>7</a>
|
|
67
|
-
<a name='L8'></a><a href='#L8'>8</a>
|
|
68
|
-
<a name='L9'></a><a href='#L9'>9</a>
|
|
69
|
-
<a name='L10'></a><a href='#L10'>10</a>
|
|
70
|
-
<a name='L11'></a><a href='#L11'>11</a>
|
|
71
|
-
<a name='L12'></a><a href='#L12'>12</a>
|
|
72
|
-
<a name='L13'></a><a href='#L13'>13</a>
|
|
73
|
-
<a name='L14'></a><a href='#L14'>14</a>
|
|
74
|
-
<a name='L15'></a><a href='#L15'>15</a>
|
|
75
|
-
<a name='L16'></a><a href='#L16'>16</a>
|
|
76
|
-
<a name='L17'></a><a href='#L17'>17</a>
|
|
77
|
-
<a name='L18'></a><a href='#L18'>18</a>
|
|
78
|
-
<a name='L19'></a><a href='#L19'>19</a>
|
|
79
|
-
<a name='L20'></a><a href='#L20'>20</a>
|
|
80
|
-
<a name='L21'></a><a href='#L21'>21</a>
|
|
81
|
-
<a name='L22'></a><a href='#L22'>22</a>
|
|
82
|
-
<a name='L23'></a><a href='#L23'>23</a>
|
|
83
|
-
<a name='L24'></a><a href='#L24'>24</a>
|
|
84
|
-
<a name='L25'></a><a href='#L25'>25</a>
|
|
85
|
-
<a name='L26'></a><a href='#L26'>26</a>
|
|
86
|
-
<a name='L27'></a><a href='#L27'>27</a>
|
|
87
|
-
<a name='L28'></a><a href='#L28'>28</a>
|
|
88
|
-
<a name='L29'></a><a href='#L29'>29</a>
|
|
89
|
-
<a name='L30'></a><a href='#L30'>30</a>
|
|
90
|
-
<a name='L31'></a><a href='#L31'>31</a>
|
|
91
|
-
<a name='L32'></a><a href='#L32'>32</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">43x</span>
|
|
92
|
-
<span class="cline-any cline-yes">43x</span>
|
|
93
|
-
<span class="cline-any cline-yes">43x</span>
|
|
94
|
-
<span class="cline-any cline-yes">43x</span>
|
|
95
|
-
<span class="cline-any cline-yes">43x</span>
|
|
96
|
-
<span class="cline-any cline-yes">43x</span>
|
|
97
|
-
<span class="cline-any cline-neutral"> </span>
|
|
98
|
-
<span class="cline-any cline-yes">43x</span>
|
|
99
|
-
<span class="cline-any cline-neutral"> </span>
|
|
100
|
-
<span class="cline-any cline-yes">43x</span>
|
|
101
|
-
<span class="cline-any cline-yes">43x</span>
|
|
102
|
-
<span class="cline-any cline-yes">43x</span>
|
|
103
|
-
<span class="cline-any cline-neutral"> </span>
|
|
104
|
-
<span class="cline-any cline-yes">43x</span>
|
|
105
|
-
<span class="cline-any cline-neutral"> </span>
|
|
106
|
-
<span class="cline-any cline-neutral"> </span>
|
|
107
|
-
<span class="cline-any cline-neutral"> </span>
|
|
108
|
-
<span class="cline-any cline-yes">43x</span>
|
|
109
|
-
<span class="cline-any cline-yes">43x</span>
|
|
110
|
-
<span class="cline-any cline-yes">43x</span>
|
|
111
|
-
<span class="cline-any cline-neutral"> </span>
|
|
112
|
-
<span class="cline-any cline-neutral"> </span>
|
|
113
|
-
<span class="cline-any cline-neutral"> </span>
|
|
114
|
-
<span class="cline-any cline-neutral"> </span>
|
|
115
|
-
<span class="cline-any cline-neutral"> </span>
|
|
116
|
-
<span class="cline-any cline-yes">43x</span>
|
|
117
|
-
<span class="cline-any cline-neutral"> </span>
|
|
118
|
-
<span class="cline-any cline-neutral"> </span>
|
|
119
|
-
<span class="cline-any cline-yes">43x</span>
|
|
120
|
-
<span class="cline-any cline-neutral"> </span>
|
|
121
|
-
<span class="cline-any cline-yes">43x</span>
|
|
122
|
-
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">const PouchDB = require("pouchdb")
|
|
123
|
-
const { getCouchUrl } = require("@budibase/backend-core/db")
|
|
124
|
-
const replicationStream = require("pouchdb-replication-stream")
|
|
125
|
-
const allDbs = require("pouchdb-all-dbs")
|
|
126
|
-
const find = require("pouchdb-find")
|
|
127
|
-
const env = require("../environment")
|
|
128
|
-
|
|
129
|
-
const COUCH_DB_URL = getCouchUrl() || "http://localhost:4005"
|
|
130
|
-
|
|
131
|
-
PouchDB.plugin(replicationStream.plugin)
|
|
132
|
-
PouchDB.plugin(find)
|
|
133
|
-
PouchDB.adapter("writableStream", replicationStream.adapters.writableStream)
|
|
134
|
-
|
|
135
|
-
let POUCH_DB_DEFAULTS = {
|
|
136
|
-
prefix: COUCH_DB_URL,
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
if (env.isTest()) {
|
|
140
|
-
PouchDB.plugin(require("pouchdb-adapter-memory"))
|
|
141
|
-
POUCH_DB_DEFAULTS = {
|
|
142
|
-
prefix: undefined,
|
|
143
|
-
adapter: "memory",
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
const Pouch = PouchDB.defaults(POUCH_DB_DEFAULTS)
|
|
148
|
-
|
|
149
|
-
// have to still have pouch alldbs for testing
|
|
150
|
-
allDbs(Pouch)
|
|
151
|
-
|
|
152
|
-
module.exports = Pouch
|
|
153
|
-
</pre></td></tr></table></pre>
|
|
154
|
-
|
|
155
|
-
<div class='push'></div><!-- for sticky footer -->
|
|
156
|
-
</div><!-- /wrapper -->
|
|
157
|
-
<div class='footer quiet pad2 space-top1 center small'>
|
|
158
|
-
Code coverage generated by
|
|
159
|
-
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
160
|
-
at Fri Apr 22 2022 09:55:18 GMT+0000 (Coordinated Universal Time)
|
|
161
|
-
</div>
|
|
162
|
-
</div>
|
|
163
|
-
<script src="../prettify.js"></script>
|
|
164
|
-
<script>
|
|
165
|
-
window.onload = function () {
|
|
166
|
-
prettyPrint();
|
|
167
|
-
};
|
|
168
|
-
</script>
|
|
169
|
-
<script src="../sorter.js"></script>
|
|
170
|
-
<script src="../block-navigation.js"></script>
|
|
171
|
-
</body>
|
|
172
|
-
</html>
|
|
173
|
-
|
package/dist/db/client.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const PouchDB = require("pouchdb");
|
|
3
|
-
const { getCouchUrl } = require("@budibase/backend-core/db");
|
|
4
|
-
const replicationStream = require("pouchdb-replication-stream");
|
|
5
|
-
const allDbs = require("pouchdb-all-dbs");
|
|
6
|
-
const find = require("pouchdb-find");
|
|
7
|
-
const env = require("../environment");
|
|
8
|
-
const COUCH_DB_URL = getCouchUrl() || "http://localhost:4005";
|
|
9
|
-
PouchDB.plugin(replicationStream.plugin);
|
|
10
|
-
PouchDB.plugin(find);
|
|
11
|
-
PouchDB.adapter("writableStream", replicationStream.adapters.writableStream);
|
|
12
|
-
let POUCH_DB_DEFAULTS = {
|
|
13
|
-
prefix: COUCH_DB_URL,
|
|
14
|
-
};
|
|
15
|
-
if (env.isTest()) {
|
|
16
|
-
PouchDB.plugin(require("pouchdb-adapter-memory"));
|
|
17
|
-
POUCH_DB_DEFAULTS = {
|
|
18
|
-
prefix: undefined,
|
|
19
|
-
adapter: "memory",
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
const Pouch = PouchDB.defaults(POUCH_DB_DEFAULTS);
|
|
23
|
-
// have to still have pouch alldbs for testing
|
|
24
|
-
allDbs(Pouch);
|
|
25
|
-
module.exports = Pouch;
|
package/scripts/replicateApp.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Script to replicate your PouchDb (in your home directory) to a remote CouchDB
|
|
3
|
-
* USAGE...
|
|
4
|
-
* node scripts/replicateApp <app_name> <remote_url>
|
|
5
|
-
* e.g. node scripts/replicateApp Mike http://admin:password@127.0.0.1:5984
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
const CouchDB = require("../src/db")
|
|
9
|
-
const { DocumentTypes } = require("../src/db/utils")
|
|
10
|
-
const { getAllDbs } = require("@budibase/backend-core/db")
|
|
11
|
-
|
|
12
|
-
const appName = process.argv[2].toLowerCase()
|
|
13
|
-
const remoteUrl = process.argv[3]
|
|
14
|
-
|
|
15
|
-
console.log(`Replicating from ${appName} to ${remoteUrl}/${appName}`)
|
|
16
|
-
|
|
17
|
-
const run = async () => {
|
|
18
|
-
const dbs = await getAllDbs()
|
|
19
|
-
const appDbNames = dbs.filter(dbName => dbName.startsWith("inst_app"))
|
|
20
|
-
let apps = []
|
|
21
|
-
for (let dbName of appDbNames) {
|
|
22
|
-
const db = new CouchDB(dbName)
|
|
23
|
-
apps.push(db.get(DocumentTypes.APP_METADATA))
|
|
24
|
-
}
|
|
25
|
-
apps = await Promise.all(apps)
|
|
26
|
-
const app = apps.find(
|
|
27
|
-
a => a.name === appName || a.name.toLowerCase() === appName
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
if (!app) {
|
|
31
|
-
console.log(
|
|
32
|
-
`Could not find app... apps: ${apps.map(app => app.name).join(", ")}`
|
|
33
|
-
)
|
|
34
|
-
return
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const instanceDb = new CouchDB(app.appId)
|
|
38
|
-
const remoteDb = new CouchDB(`${remoteUrl}/${appName}`)
|
|
39
|
-
|
|
40
|
-
instanceDb.replicate
|
|
41
|
-
.to(remoteDb)
|
|
42
|
-
.on("complete", function () {
|
|
43
|
-
console.log("SUCCESS!")
|
|
44
|
-
})
|
|
45
|
-
.on("error", function (err) {
|
|
46
|
-
console.log(`FAILED: ${err}`)
|
|
47
|
-
})
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
run()
|
package/src/db/client.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
const PouchDB = require("pouchdb")
|
|
2
|
-
const { getCouchUrl } = require("@budibase/backend-core/db")
|
|
3
|
-
const replicationStream = require("pouchdb-replication-stream")
|
|
4
|
-
const allDbs = require("pouchdb-all-dbs")
|
|
5
|
-
const find = require("pouchdb-find")
|
|
6
|
-
const env = require("../environment")
|
|
7
|
-
|
|
8
|
-
const COUCH_DB_URL = getCouchUrl() || "http://localhost:4005"
|
|
9
|
-
|
|
10
|
-
PouchDB.plugin(replicationStream.plugin)
|
|
11
|
-
PouchDB.plugin(find)
|
|
12
|
-
PouchDB.adapter("writableStream", replicationStream.adapters.writableStream)
|
|
13
|
-
|
|
14
|
-
let POUCH_DB_DEFAULTS = {
|
|
15
|
-
prefix: COUCH_DB_URL,
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if (env.isTest()) {
|
|
19
|
-
PouchDB.plugin(require("pouchdb-adapter-memory"))
|
|
20
|
-
POUCH_DB_DEFAULTS = {
|
|
21
|
-
prefix: undefined,
|
|
22
|
-
adapter: "memory",
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const Pouch = PouchDB.defaults(POUCH_DB_DEFAULTS)
|
|
27
|
-
|
|
28
|
-
// have to still have pouch alldbs for testing
|
|
29
|
-
allDbs(Pouch)
|
|
30
|
-
|
|
31
|
-
module.exports = Pouch
|