@budibase/server 1.4.17 → 1.4.18-alpha.1
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/Dockerfile +2 -0
- package/builder/assets/{index.2062efc5.js → index.7bac432b.js} +296 -292
- package/builder/assets/index.ffaba7b0.css +6 -0
- package/builder/index.html +2 -2
- package/coverage/clover.xml +144 -182
- package/coverage/coverage-final.json +34 -36
- package/coverage/lcov-report/api/controllers/apikeys.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/datasource.js.html +1 -1
- package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
- package/coverage/lcov-report/api/controllers/index.html +9 -24
- package/coverage/lcov-report/api/controllers/integration.js.html +2 -2
- package/coverage/lcov-report/api/controllers/layout.js.html +1 -1
- 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 +5 -5
- package/coverage/lcov-report/api/controllers/row/internal.js.html +4 -4
- 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/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 +2 -2
- package/coverage/lcov-report/api/routes/apikeys.js.html +2 -2
- package/coverage/lcov-report/api/routes/automation.js.html +2 -2
- package/coverage/lcov-report/api/routes/backup.js.html +2 -2
- package/coverage/lcov-report/api/routes/cloud.js.html +2 -2
- package/coverage/lcov-report/api/routes/component.js.html +2 -2
- package/coverage/lcov-report/api/routes/datasource.js.html +2 -2
- package/coverage/lcov-report/api/routes/deploy.js.html +2 -2
- package/coverage/lcov-report/api/routes/dev.js.html +2 -2
- package/coverage/lcov-report/api/routes/index.html +5 -20
- package/coverage/lcov-report/api/routes/integration.js.html +2 -2
- package/coverage/lcov-report/api/routes/layout.js.html +2 -2
- package/coverage/lcov-report/api/routes/metadata.js.html +2 -2
- package/coverage/lcov-report/api/routes/migrations.js.html +2 -2
- package/coverage/lcov-report/api/routes/permission.js.html +2 -2
- package/coverage/lcov-report/api/routes/query.js.html +2 -2
- package/coverage/lcov-report/api/routes/role.js.html +2 -2
- package/coverage/lcov-report/api/routes/routing.js.html +2 -2
- package/coverage/lcov-report/api/routes/screen.js.html +2 -2
- package/coverage/lcov-report/api/routes/script.js.html +2 -2
- package/coverage/lcov-report/api/routes/table.js.html +2 -2
- package/coverage/lcov-report/api/routes/templates.js.html +2 -2
- package/coverage/lcov-report/api/routes/user.js.html +2 -2
- 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 +2 -2
- package/coverage/lcov-report/api/routes/webhook.js.html +2 -2
- 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 +52 -4
- 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 +5 -5
- package/coverage/lcov-report/db/index.js.html +4 -4
- 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 +11 -11
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +7 -7
- 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 +1 -1
- package/coverage/lcov-report/middleware/index.html +1 -1
- 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/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 +19 -13
- package/coverage/lcov-report/utilities/index.html +24 -24
- package/coverage/lcov-report/utilities/index.js.html +1 -1
- 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 +12 -12
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +8 -8
- 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 +21 -12
- package/coverage/lcov-report/utilities/workerRequests.js.html +33 -3
- package/coverage/lcov.info +236 -290
- package/dist/api/controllers/application.js +2 -0
- package/dist/api/controllers/auth.js +58 -49
- package/dist/api/controllers/integration.js +1 -1
- package/dist/api/controllers/row/internal.js +1 -1
- package/dist/api/routes/analytics.js +1 -1
- package/dist/api/routes/apikeys.js +1 -1
- package/dist/api/routes/auth.js +31 -4
- package/dist/api/routes/automation.js +1 -1
- package/dist/api/routes/backup.js +1 -1
- package/dist/api/routes/cloud.js +1 -1
- package/dist/api/routes/component.js +1 -1
- package/dist/api/routes/datasource.js +1 -1
- package/dist/api/routes/deploy.js +1 -1
- package/dist/api/routes/dev.js +1 -1
- package/dist/api/routes/integration.js +1 -1
- package/dist/api/routes/layout.js +1 -1
- package/dist/api/routes/metadata.js +1 -1
- package/dist/api/routes/migrations.js +1 -1
- package/dist/api/routes/permission.js +1 -1
- package/dist/api/routes/public/applications.js +5 -0
- package/dist/api/routes/public/queries.js +2 -0
- package/dist/api/routes/public/rows.js +5 -0
- package/dist/api/routes/public/tables.js +5 -0
- package/dist/api/routes/public/users.js +5 -0
- package/dist/api/routes/query.js +1 -1
- package/dist/api/routes/role.js +1 -1
- package/dist/api/routes/routing.js +1 -1
- package/dist/api/routes/screen.js +1 -1
- package/dist/api/routes/script.js +1 -1
- package/dist/api/routes/table.js +1 -1
- package/dist/api/routes/templates.js +1 -1
- package/dist/api/routes/user.js +1 -1
- package/dist/api/routes/view.js +1 -1
- package/dist/api/routes/webhook.js +1 -1
- package/dist/automations/steps/sendSmtpEmail.js +10 -2
- package/dist/db/index.js +1 -1
- package/dist/middleware/authorized.js +2 -2
- package/dist/migrations/functions/usageQuotas/syncApps.js +2 -1
- package/dist/migrations/functions/usageQuotas/syncRows.js +2 -1
- package/dist/package.json +6 -6
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/global.js +6 -3
- package/dist/utilities/users.js +4 -2
- package/dist/utilities/workerRequests.js +3 -1
- package/package.json +7 -7
- package/scripts/dev/manage.js +1 -0
- package/specs/openapi.json +22 -0
- package/specs/openapi.yaml +22 -0
- package/src/api/controllers/application.ts +3 -7
- package/src/api/controllers/{auth.js → auth.ts} +20 -18
- package/src/api/controllers/integration.js +1 -1
- package/src/api/controllers/row/internal.js +1 -1
- package/src/api/routes/analytics.js +1 -1
- package/src/api/routes/apikeys.js +1 -1
- package/src/api/routes/auth.ts +8 -0
- package/src/api/routes/automation.js +1 -1
- package/src/api/routes/backup.js +1 -1
- package/src/api/routes/cloud.js +1 -1
- package/src/api/routes/component.js +1 -1
- package/src/api/routes/datasource.js +1 -1
- package/src/api/routes/deploy.js +1 -1
- package/src/api/routes/dev.js +1 -1
- package/src/api/routes/integration.js +1 -1
- package/src/api/routes/layout.js +1 -1
- package/src/api/routes/metadata.js +1 -1
- package/src/api/routes/migrations.js +1 -1
- package/src/api/routes/permission.js +1 -1
- package/src/api/routes/public/applications.ts +5 -0
- package/src/api/routes/public/queries.ts +2 -0
- package/src/api/routes/public/rows.ts +5 -0
- package/src/api/routes/public/tables.ts +5 -0
- package/src/api/routes/public/users.ts +5 -0
- package/src/api/routes/query.js +1 -1
- package/src/api/routes/role.js +1 -1
- package/src/api/routes/routing.js +1 -1
- package/src/api/routes/screen.js +1 -1
- package/src/api/routes/script.js +1 -1
- package/src/api/routes/table.js +1 -1
- package/src/api/routes/templates.js +1 -1
- package/src/api/routes/tests/row.spec.js +3 -1
- package/src/api/routes/user.js +1 -1
- package/src/api/routes/view.js +1 -1
- package/src/api/routes/webhook.js +1 -1
- package/src/automations/steps/sendSmtpEmail.js +18 -2
- package/src/db/index.js +1 -1
- package/src/definitions/openapi.ts +134 -447
- package/src/middleware/authorized.ts +2 -2
- package/src/migrations/functions/usageQuotas/syncApps.ts +2 -1
- package/src/migrations/functions/usageQuotas/syncRows.ts +2 -1
- package/src/migrations/functions/usageQuotas/tests/syncApps.spec.ts +2 -1
- package/src/migrations/functions/usageQuotas/tests/syncRows.spec.ts +2 -1
- package/src/utilities/global.js +6 -4
- package/src/utilities/users.js +5 -2
- package/src/utilities/workerRequests.js +11 -1
- package/builder/assets/index.91c8117f.css +0 -6
- package/coverage/lcov-report/api/controllers/auth.js.html +0 -292
- package/coverage/lcov-report/api/routes/auth.js.html +0 -109
- package/src/api/routes/auth.js +0 -8
package/src/utilities/global.js
CHANGED
|
@@ -43,9 +43,10 @@ exports.updateAppRole = (user, { appId } = {}) => {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
async function checkGroupRoles(user, { appId } = {}) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
if (user.roleId && user.roleId !== BUILTIN_ROLE_IDS.PUBLIC) {
|
|
47
|
+
return user
|
|
48
|
+
}
|
|
49
|
+
user.roleId = await groups.getGroupRoleId(user, appId)
|
|
49
50
|
return user
|
|
50
51
|
}
|
|
51
52
|
|
|
@@ -74,8 +75,9 @@ exports.getRawGlobalUser = async userId => {
|
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
exports.getGlobalUser = async userId => {
|
|
78
|
+
const appId = getAppId()
|
|
77
79
|
let user = await exports.getRawGlobalUser(userId)
|
|
78
|
-
return processUser(user)
|
|
80
|
+
return processUser(user, { appId })
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
exports.getGlobalUsers = async (users = null) => {
|
package/src/utilities/users.js
CHANGED
|
@@ -2,10 +2,11 @@ const { InternalTables } = require("../db/utils")
|
|
|
2
2
|
const { getGlobalUser } = require("../utilities/global")
|
|
3
3
|
const { getAppDB } = require("@budibase/backend-core/context")
|
|
4
4
|
const { getProdAppID } = require("@budibase/backend-core/db")
|
|
5
|
+
const { BUILTIN_ROLE_IDS } = require("@budibase/backend-core/roles")
|
|
5
6
|
|
|
6
7
|
exports.getFullUser = async (ctx, userId) => {
|
|
7
8
|
const global = await getGlobalUser(userId)
|
|
8
|
-
let metadata
|
|
9
|
+
let metadata = {}
|
|
9
10
|
try {
|
|
10
11
|
// this will throw an error if the db doesn't exist, or there is no appId
|
|
11
12
|
const db = getAppDB()
|
|
@@ -15,9 +16,11 @@ exports.getFullUser = async (ctx, userId) => {
|
|
|
15
16
|
delete global._id
|
|
16
17
|
delete global._rev
|
|
17
18
|
}
|
|
19
|
+
delete metadata.csrfToken
|
|
18
20
|
return {
|
|
19
|
-
...global,
|
|
20
21
|
...metadata,
|
|
22
|
+
...global,
|
|
23
|
+
roleId: global.roleId || BUILTIN_ROLE_IDS.PUBLIC,
|
|
21
24
|
tableId: InternalTables.USER_METADATA,
|
|
22
25
|
// make sure the ID is always a local ID, not a global one
|
|
23
26
|
_id: userId,
|
|
@@ -54,7 +54,15 @@ async function checkResponse(response, errorMsg, { ctx } = {}) {
|
|
|
54
54
|
exports.request = request
|
|
55
55
|
|
|
56
56
|
// have to pass in the tenant ID as this could be coming from an automation
|
|
57
|
-
exports.sendSmtpEmail = async (
|
|
57
|
+
exports.sendSmtpEmail = async (
|
|
58
|
+
to,
|
|
59
|
+
from,
|
|
60
|
+
subject,
|
|
61
|
+
contents,
|
|
62
|
+
cc,
|
|
63
|
+
bcc,
|
|
64
|
+
automation
|
|
65
|
+
) => {
|
|
58
66
|
// tenant ID will be set in header
|
|
59
67
|
const response = await fetch(
|
|
60
68
|
checkSlashesInUrl(env.WORKER_URL + `/api/global/email/send`),
|
|
@@ -65,6 +73,8 @@ exports.sendSmtpEmail = async (to, from, subject, contents, automation) => {
|
|
|
65
73
|
from,
|
|
66
74
|
contents,
|
|
67
75
|
subject,
|
|
76
|
+
cc,
|
|
77
|
+
bcc,
|
|
68
78
|
purpose: "custom",
|
|
69
79
|
automation,
|
|
70
80
|
},
|