@budibase/server 1.0.220-alpha.1 → 1.0.220
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.58a51c8a.css +6 -0
- package/builder/assets/index.e14e1be2.js +977 -0
- package/builder/assets/{vendor.001dcf8c.js → vendor.7f11b0ca.js} +74 -74
- package/builder/index.html +3 -3
- package/coverage/clover.xml +175 -201
- package/coverage/coverage-final.json +6 -6
- package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/controllers/auth.js.html +1 -1
- package/coverage/lcov-report/api/controllers/automation.js.html +1 -1
- 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 +1 -1
- package/coverage/lcov-report/api/controllers/dev.js.html +13 -166
- package/coverage/lcov-report/api/controllers/index.html +28 -28
- package/coverage/lcov-report/api/controllers/integration.js.html +1 -1
- package/coverage/lcov-report/api/controllers/layout.js.html +18 -39
- 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 +1 -1
- package/coverage/lcov-report/api/controllers/query/index.html +1 -1
- package/coverage/lcov-report/api/controllers/query/validation.js.html +1 -1
- package/coverage/lcov-report/api/controllers/role.js.html +1 -1
- package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/external.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/index.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internal.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/screen.js.html +1 -1
- package/coverage/lcov-report/api/controllers/script.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/external.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/index.html +1 -1
- package/coverage/lcov-report/api/controllers/table/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
- package/coverage/lcov-report/api/controllers/user.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +1 -1
- package/coverage/lcov-report/api/controllers/webhook.js.html +1 -1
- 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/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 +2 -5
- package/coverage/lcov-report/api/routes/index.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/screen.js.html +1 -1
- package/coverage/lcov-report/api/routes/script.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 +5 -5
- package/coverage/lcov-report/api/routes/utils/validators.js.html +16 -4
- 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 +1 -1
- package/coverage/lcov-report/automations/automationUtils.js.html +1 -1
- package/coverage/lcov-report/automations/bullboard.js.html +1 -1
- package/coverage/lcov-report/automations/index.html +1 -1
- package/coverage/lcov-report/automations/index.js.html +1 -1
- package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
- package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
- package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
- package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
- package/coverage/lcov-report/automations/steps/index.html +1 -1
- package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
- package/coverage/lcov-report/automations/steps/loop.js.html +1 -1
- package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
- package/coverage/lcov-report/automations/steps/queryRows.js.html +1 -1
- package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +1 -1
- package/coverage/lcov-report/automations/steps/serverLog.js.html +1 -1
- package/coverage/lcov-report/automations/steps/slack.js.html +1 -1
- package/coverage/lcov-report/automations/steps/updateRow.js.html +1 -1
- package/coverage/lcov-report/automations/steps/utils.js.html +1 -1
- package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/triggers.js.html +1 -1
- package/coverage/lcov-report/constants/index.html +1 -1
- package/coverage/lcov-report/constants/index.js.html +1 -1
- package/coverage/lcov-report/constants/layouts.js.html +1 -1
- package/coverage/lcov-report/constants/screens.js.html +1 -1
- package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
- package/coverage/lcov-report/db/index.html +1 -1
- package/coverage/lcov-report/db/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/LinkController.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +1 -1
- package/coverage/lcov-report/db/newid.js.html +1 -1
- package/coverage/lcov-report/db/utils.js.html +1 -1
- 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 +1 -1
- package/coverage/lcov-report/events/utils.js.html +1 -1
- package/coverage/lcov-report/index.html +34 -34
- 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/builder.js.html +1 -1
- package/coverage/lcov-report/middleware/currentapp.js.html +18 -6
- package/coverage/lcov-report/middleware/index.html +11 -11
- 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/utils.js.html +1 -1
- package/coverage/lcov-report/threads/automation.js.html +1 -1
- package/coverage/lcov-report/threads/index.html +1 -1
- package/coverage/lcov-report/threads/query.js.html +1 -1
- package/coverage/lcov-report/threads/utils.js.html +1 -1
- package/coverage/lcov-report/utilities/budibaseDir.js.html +1 -1
- package/coverage/lcov-report/utilities/centralPath.js.html +1 -1
- package/coverage/lcov-report/utilities/csvParser.js.html +1 -1
- package/coverage/lcov-report/utilities/global.js.html +1 -1
- package/coverage/lcov-report/utilities/index.html +15 -15
- package/coverage/lcov-report/utilities/index.js.html +9 -24
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +1 -1
- 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 +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +1 -1
- package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
- package/coverage/lcov-report/utilities/security.js.html +1 -1
- package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/rows.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
- package/coverage/lcov-report/utilities/users.js.html +1 -1
- package/coverage/lcov-report/utilities/workerRequests.js.html +1 -1
- package/coverage/lcov.info +271 -315
- package/dist/api/controllers/application.js +17 -17
- package/dist/api/controllers/dev.js +2 -40
- package/dist/api/controllers/layout.js +6 -11
- package/dist/api/controllers/static/index.js +1 -5
- package/dist/api/routes/dev.js +1 -2
- package/dist/api/routes/utils/validators.js +4 -0
- package/dist/middleware/currentapp.js +3 -0
- package/dist/package.json +6 -6
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/index.js +1 -5
- package/package.json +7 -7
- package/src/api/controllers/application.ts +17 -23
- package/src/api/controllers/dev.js +2 -53
- package/src/api/controllers/layout.js +10 -17
- package/src/api/controllers/static/index.js +1 -6
- package/src/api/routes/dev.js +0 -1
- package/src/api/routes/tests/application.spec.js +5 -7
- package/src/api/routes/utils/validators.js +4 -0
- package/src/middleware/currentapp.js +4 -0
- package/src/utilities/index.js +1 -6
- package/builder/assets/index.7786f497.css +0 -6
- package/builder/assets/index.b4622e74.js +0 -978
package/dist/utilities/index.js
CHANGED
|
@@ -57,12 +57,8 @@ exports.objectStoreUrl = () => {
|
|
|
57
57
|
* @return {string} The URL to be inserted into appPackage response or server rendered
|
|
58
58
|
* app index file.
|
|
59
59
|
*/
|
|
60
|
-
exports.clientLibraryPath = (appId, version
|
|
60
|
+
exports.clientLibraryPath = (appId, version) => {
|
|
61
61
|
if (env.isProd()) {
|
|
62
|
-
// TODO: remove - for beta testing UI
|
|
63
|
-
if (ctx && ctx.cookies.get("beta:design_ui")) {
|
|
64
|
-
return "https://cdn.budi.live/beta:design_ui/budibase-client.js";
|
|
65
|
-
}
|
|
66
62
|
let url = `${exports.objectStoreUrl()}/${sanitizeKey(appId)}/budibase-client.js`;
|
|
67
63
|
// append app version to bust the cache
|
|
68
64
|
if (version) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/server",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "1.0.220
|
|
4
|
+
"version": "1.0.220",
|
|
5
5
|
"description": "Budibase Web Server",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -77,10 +77,10 @@
|
|
|
77
77
|
"license": "GPL-3.0",
|
|
78
78
|
"dependencies": {
|
|
79
79
|
"@apidevtools/swagger-parser": "10.0.3",
|
|
80
|
-
"@budibase/backend-core": "^1.0.220
|
|
81
|
-
"@budibase/client": "^1.0.220
|
|
82
|
-
"@budibase/pro": "1.0.220-alpha.
|
|
83
|
-
"@budibase/string-templates": "^1.0.220
|
|
80
|
+
"@budibase/backend-core": "^1.0.220",
|
|
81
|
+
"@budibase/client": "^1.0.220",
|
|
82
|
+
"@budibase/pro": "1.0.220-alpha.3",
|
|
83
|
+
"@budibase/string-templates": "^1.0.220",
|
|
84
84
|
"@bull-board/api": "3.7.0",
|
|
85
85
|
"@bull-board/koa": "3.9.4",
|
|
86
86
|
"@elastic/elasticsearch": "7.10.0",
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
"@babel/core": "7.17.4",
|
|
152
152
|
"@babel/preset-env": "7.16.11",
|
|
153
153
|
"@budibase/standard-components": "^0.9.139",
|
|
154
|
-
"@budibase/types": "^1.0.220
|
|
154
|
+
"@budibase/types": "^1.0.220",
|
|
155
155
|
"@jest/test-sequencer": "24.9.0",
|
|
156
156
|
"@types/apidoc": "0.50.0",
|
|
157
157
|
"@types/bson": "4.2.0",
|
|
@@ -195,5 +195,5 @@
|
|
|
195
195
|
"optionalDependencies": {
|
|
196
196
|
"oracledb": "5.3.0"
|
|
197
197
|
},
|
|
198
|
-
"gitHead": "
|
|
198
|
+
"gitHead": "c2160f8a2fb3f6b893f9916fa122dd67c60d6244"
|
|
199
199
|
}
|
|
@@ -229,11 +229,7 @@ export const fetchAppPackage = async (ctx: any) => {
|
|
|
229
229
|
application,
|
|
230
230
|
screens,
|
|
231
231
|
layouts,
|
|
232
|
-
clientLibPath: clientLibraryPath(
|
|
233
|
-
ctx.params.appId,
|
|
234
|
-
application.version,
|
|
235
|
-
ctx
|
|
236
|
-
),
|
|
232
|
+
clientLibPath: clientLibraryPath(ctx.params.appId, application.version),
|
|
237
233
|
}
|
|
238
234
|
}
|
|
239
235
|
|
|
@@ -280,16 +276,26 @@ const performAppCreate = async (ctx: any) => {
|
|
|
280
276
|
updatedAt: new Date().toISOString(),
|
|
281
277
|
createdAt: new Date().toISOString(),
|
|
282
278
|
status: AppStatus.DEV,
|
|
279
|
+
navigation: {
|
|
280
|
+
navigation: "Top",
|
|
281
|
+
title: name,
|
|
282
|
+
navWidth: "Large",
|
|
283
|
+
navBackground: "var(--spectrum-global-color-gray-100)",
|
|
284
|
+
links: [
|
|
285
|
+
{
|
|
286
|
+
url: "/home",
|
|
287
|
+
text: "Home",
|
|
288
|
+
},
|
|
289
|
+
],
|
|
290
|
+
},
|
|
291
|
+
theme: "spectrum--light",
|
|
292
|
+
customTheme: {
|
|
293
|
+
buttonBorderRadius: "16px",
|
|
294
|
+
},
|
|
283
295
|
}
|
|
284
296
|
const response = await db.put(newApplication, { force: true })
|
|
285
297
|
newApplication._rev = response.rev
|
|
286
298
|
|
|
287
|
-
// Only create the default home screens and layout if we aren't importing
|
|
288
|
-
// an app
|
|
289
|
-
if (useTemplate !== "true") {
|
|
290
|
-
await createEmptyAppPackage(ctx, newApplication)
|
|
291
|
-
}
|
|
292
|
-
|
|
293
299
|
/* istanbul ignore next */
|
|
294
300
|
if (!env.isTest()) {
|
|
295
301
|
await createApp(appId)
|
|
@@ -569,15 +575,3 @@ const updateAppPackage = async (appPackage: any, appId: any) => {
|
|
|
569
575
|
return newAppPackage
|
|
570
576
|
})
|
|
571
577
|
}
|
|
572
|
-
|
|
573
|
-
const createEmptyAppPackage = async (ctx: any, app: any) => {
|
|
574
|
-
const db = getAppDB()
|
|
575
|
-
|
|
576
|
-
let screensAndLayouts = []
|
|
577
|
-
for (let layout of BASE_LAYOUTS) {
|
|
578
|
-
const cloned = cloneDeep(layout)
|
|
579
|
-
screensAndLayouts.push(await processObject(cloned, app))
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
await db.bulkDocs(screensAndLayouts)
|
|
583
|
-
}
|
|
@@ -3,12 +3,8 @@ const env = require("../../environment")
|
|
|
3
3
|
const { checkSlashesInUrl } = require("../../utilities")
|
|
4
4
|
const { request } = require("../../utilities/workerRequests")
|
|
5
5
|
const { clearLock } = require("../../utilities/redis")
|
|
6
|
-
const {
|
|
7
|
-
|
|
8
|
-
getProdAppID,
|
|
9
|
-
dangerousGetDB,
|
|
10
|
-
} = require("@budibase/backend-core/db")
|
|
11
|
-
const { DocumentTypes, getRowParams } = require("../../db/utils")
|
|
6
|
+
const { Replication, getProdAppID } = require("@budibase/backend-core/db")
|
|
7
|
+
const { DocumentTypes } = require("../../db/utils")
|
|
12
8
|
const { app: appCache } = require("@budibase/backend-core/cache")
|
|
13
9
|
const { getProdAppDB, getAppDB } = require("@budibase/backend-core/context")
|
|
14
10
|
const { events } = require("@budibase/backend-core")
|
|
@@ -137,50 +133,3 @@ exports.getBudibaseVersion = async ctx => {
|
|
|
137
133
|
}
|
|
138
134
|
await events.installation.versionChecked(version)
|
|
139
135
|
}
|
|
140
|
-
|
|
141
|
-
// TODO: remove as part of beta program
|
|
142
|
-
exports.checkBetaAccess = async ctx => {
|
|
143
|
-
// go to the cloud platform if running self hosted
|
|
144
|
-
if (env.SELF_HOSTED || !env.MULTI_TENANCY) {
|
|
145
|
-
let baseUrl = ""
|
|
146
|
-
if (env.ACCOUNT_PORTAL_URL) {
|
|
147
|
-
baseUrl = env.ACCOUNT_PORTAL_URL.replace("account.", "")
|
|
148
|
-
} else {
|
|
149
|
-
baseUrl = "https://budibase.app"
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
const response = await fetch(
|
|
153
|
-
`${baseUrl}/api/beta/access?email=${ctx.query.email}`
|
|
154
|
-
)
|
|
155
|
-
const json = await response.json()
|
|
156
|
-
ctx.body = json
|
|
157
|
-
return
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
const userToCheck = ctx.query.email
|
|
161
|
-
const BETA_USERS_DB = "app_bb_f9b77d06b9db4e3ca185476ab87a2364"
|
|
162
|
-
const BETA_USERS_TABLE = "ta_8c2c6df1c03f49cfb6340e85e066dd15"
|
|
163
|
-
|
|
164
|
-
try {
|
|
165
|
-
const db = dangerousGetDB(BETA_USERS_DB)
|
|
166
|
-
const betaUsers = (
|
|
167
|
-
await db.allDocs(
|
|
168
|
-
getRowParams(BETA_USERS_TABLE, null, {
|
|
169
|
-
include_docs: true,
|
|
170
|
-
})
|
|
171
|
-
)
|
|
172
|
-
).rows.map(row => row.doc)
|
|
173
|
-
|
|
174
|
-
let access = false
|
|
175
|
-
for (let betaUser of betaUsers) {
|
|
176
|
-
if (betaUser["Email address"].trim() === userToCheck) {
|
|
177
|
-
access = true
|
|
178
|
-
break
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
ctx.body = { access }
|
|
182
|
-
} catch (err) {
|
|
183
|
-
console.error(err)
|
|
184
|
-
ctx.body = { access: false }
|
|
185
|
-
}
|
|
186
|
-
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
const {
|
|
2
|
-
EMPTY_LAYOUT,
|
|
3
|
-
BASE_LAYOUT_PROP_IDS,
|
|
4
|
-
} = require("../../constants/layouts")
|
|
1
|
+
const { EMPTY_LAYOUT } = require("../../constants/layouts")
|
|
5
2
|
const { generateLayoutID, getScreenParams } = require("../../db/utils")
|
|
6
3
|
const { getAppDB } = require("@budibase/backend-core/context")
|
|
7
4
|
const { events } = require("@budibase/backend-core")
|
|
@@ -32,19 +29,15 @@ exports.destroy = async function (ctx) {
|
|
|
32
29
|
const layoutId = ctx.params.layoutId,
|
|
33
30
|
layoutRev = ctx.params.layoutRev
|
|
34
31
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
).rows.map(element => element.doc.layoutId)
|
|
45
|
-
if (layoutsUsedByScreens.includes(layoutId)) {
|
|
46
|
-
ctx.throw(400, "Cannot delete a layout that's being used by a screen")
|
|
47
|
-
}
|
|
32
|
+
const layoutsUsedByScreens = (
|
|
33
|
+
await db.allDocs(
|
|
34
|
+
getScreenParams(null, {
|
|
35
|
+
include_docs: true,
|
|
36
|
+
})
|
|
37
|
+
)
|
|
38
|
+
).rows.map(element => element.doc.layoutId)
|
|
39
|
+
if (layoutsUsedByScreens.includes(layoutId)) {
|
|
40
|
+
ctx.throw(400, "Cannot delete a layout that's being used by a screen")
|
|
48
41
|
}
|
|
49
42
|
|
|
50
43
|
await db.remove(layoutId, layoutRev)
|
|
@@ -73,12 +73,7 @@ exports.toggleBetaUiFeature = async function (ctx) {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
exports.serveBuilder = async function (ctx) {
|
|
76
|
-
|
|
77
|
-
const designUiCookie = ctx.cookies.get("beta:design_ui")
|
|
78
|
-
// TODO: get this from the tmp Dir that we downloaded from MinIO
|
|
79
|
-
const uiPath = designUiCookie ? "new_design_ui" : "builder"
|
|
80
|
-
|
|
81
|
-
let builderPath = resolve(TOP_LEVEL_PATH, uiPath)
|
|
76
|
+
const builderPath = resolve(TOP_LEVEL_PATH, "builder")
|
|
82
77
|
await send(ctx, ctx.file, { root: builderPath })
|
|
83
78
|
if (!ctx.file.includes("assets/")) {
|
|
84
79
|
await events.serve.servedBuilder()
|
package/src/api/routes/dev.js
CHANGED
|
@@ -22,6 +22,5 @@ router
|
|
|
22
22
|
.get("/api/dev/version", authorized(BUILDER), controller.getBudibaseVersion)
|
|
23
23
|
.delete("/api/dev/:appId/lock", authorized(BUILDER), controller.clearLock)
|
|
24
24
|
.post("/api/dev/:appId/revert", authorized(BUILDER), controller.revert)
|
|
25
|
-
.get("/api/beta/access", controller.checkBetaAccess)
|
|
26
25
|
|
|
27
26
|
module.exports = router
|
|
@@ -59,14 +59,13 @@ describe("/applications", () => {
|
|
|
59
59
|
expect(events.app.templateImported).toBeCalledTimes(1)
|
|
60
60
|
})
|
|
61
61
|
|
|
62
|
-
|
|
63
62
|
it("creates app from file", async () => {
|
|
64
63
|
const res = await request
|
|
65
64
|
.post("/api/applications")
|
|
66
65
|
.field("name", "My App")
|
|
67
66
|
.field("useTemplate", "true")
|
|
68
67
|
.set(config.defaultHeaders())
|
|
69
|
-
.attach(
|
|
68
|
+
.attach("templateFile", "src/api/routes/tests/data/export.txt")
|
|
70
69
|
.expect("Content-Type", /json/)
|
|
71
70
|
.expect(200)
|
|
72
71
|
expect(res.body._id).toBeDefined()
|
|
@@ -107,8 +106,7 @@ describe("/applications", () => {
|
|
|
107
106
|
.set(config.defaultHeaders())
|
|
108
107
|
.expect("Content-Type", /json/)
|
|
109
108
|
.expect(200)
|
|
110
|
-
|
|
111
|
-
expect(res.body.layouts.length).toEqual(2)
|
|
109
|
+
expect(res.body.libraries.length).toEqual(1)
|
|
112
110
|
})
|
|
113
111
|
})
|
|
114
112
|
|
|
@@ -120,7 +118,7 @@ describe("/applications", () => {
|
|
|
120
118
|
.expect("Content-Type", /json/)
|
|
121
119
|
.expect(200)
|
|
122
120
|
expect(res.body.application).toBeDefined()
|
|
123
|
-
expect(res.body.
|
|
121
|
+
expect(res.body.application.appId).toEqual(config.getAppId())
|
|
124
122
|
})
|
|
125
123
|
})
|
|
126
124
|
|
|
@@ -171,7 +169,7 @@ describe("/applications", () => {
|
|
|
171
169
|
.set(config.defaultHeaders())
|
|
172
170
|
.expect("Content-Type", /json/)
|
|
173
171
|
.expect(200)
|
|
174
|
-
|
|
172
|
+
expect(events.app.versionUpdated).toBeCalledTimes(1)
|
|
175
173
|
})
|
|
176
174
|
it("should be able to revert the app client library version", async () => {
|
|
177
175
|
// We need to first update the version so that we can then revert
|
|
@@ -185,7 +183,7 @@ describe("/applications", () => {
|
|
|
185
183
|
.set(config.defaultHeaders())
|
|
186
184
|
.expect("Content-Type", /json/)
|
|
187
185
|
.expect(200)
|
|
188
|
-
|
|
186
|
+
expect(events.app.versionReverted).toBeCalledTimes(1)
|
|
189
187
|
})
|
|
190
188
|
})
|
|
191
189
|
|
|
@@ -9,6 +9,7 @@ const Joi = require("joi")
|
|
|
9
9
|
|
|
10
10
|
const OPTIONAL_STRING = Joi.string().optional().allow(null).allow("")
|
|
11
11
|
const OPTIONAL_NUMBER = Joi.number().optional().allow(null)
|
|
12
|
+
const OPTIONAL_BOOLEAN = Joi.boolean().optional().allow(null)
|
|
12
13
|
|
|
13
14
|
exports.tableValidator = () => {
|
|
14
15
|
// prettier-ignore
|
|
@@ -160,9 +161,12 @@ exports.screenValidator = () => {
|
|
|
160
161
|
// prettier-ignore
|
|
161
162
|
return joiValidator.body(Joi.object({
|
|
162
163
|
name: Joi.string().required(),
|
|
164
|
+
showNavigation: OPTIONAL_BOOLEAN,
|
|
165
|
+
width: OPTIONAL_STRING,
|
|
163
166
|
routing: Joi.object({
|
|
164
167
|
route: Joi.string().required(),
|
|
165
168
|
roleId: Joi.string().required().allow(""),
|
|
169
|
+
homeScreen: OPTIONAL_BOOLEAN,
|
|
166
170
|
}).required().unknown(true),
|
|
167
171
|
props: Joi.object({
|
|
168
172
|
_id: Joi.string().required(),
|
|
@@ -74,6 +74,10 @@ module.exports = async (ctx, next) => {
|
|
|
74
74
|
try {
|
|
75
75
|
await getRole(roleHeader)
|
|
76
76
|
roleId = roleHeader
|
|
77
|
+
|
|
78
|
+
// Delete admin and builder flags so that the specified role is honoured
|
|
79
|
+
delete ctx.user.builder
|
|
80
|
+
delete ctx.user.admin
|
|
77
81
|
} catch (error) {
|
|
78
82
|
// Swallow error and do nothing
|
|
79
83
|
}
|
package/src/utilities/index.js
CHANGED
|
@@ -54,13 +54,8 @@ exports.objectStoreUrl = () => {
|
|
|
54
54
|
* @return {string} The URL to be inserted into appPackage response or server rendered
|
|
55
55
|
* app index file.
|
|
56
56
|
*/
|
|
57
|
-
exports.clientLibraryPath = (appId, version
|
|
57
|
+
exports.clientLibraryPath = (appId, version) => {
|
|
58
58
|
if (env.isProd()) {
|
|
59
|
-
// TODO: remove - for beta testing UI
|
|
60
|
-
if (ctx && ctx.cookies.get("beta:design_ui")) {
|
|
61
|
-
return "https://cdn.budi.live/beta:design_ui/budibase-client.js"
|
|
62
|
-
}
|
|
63
|
-
|
|
64
59
|
let url = `${exports.objectStoreUrl()}/${sanitizeKey(
|
|
65
60
|
appId
|
|
66
61
|
)}/budibase-client.js`
|