Merge branch 'develop' of github.com:Budibase/budibase into dnd

This commit is contained in:
Andrew Kingston 2021-09-20 10:45:21 +01:00
commit 6ba4c00b80
32 changed files with 764 additions and 245 deletions

View File

@ -128,6 +128,6 @@ static_resources:
- endpoint:
address:
socket_address:
address: couchdb-service.budibase.svc.cluster.local
address: budibase-prod-svc-couchdb
port_value: 5984

View File

@ -1,5 +1,5 @@
{
"version": "0.9.125-alpha.14",
"version": "0.9.125-alpha.17",
"npmClient": "yarn",
"packages": [
"packages/*"

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/auth",
"version": "0.9.125-alpha.14",
"version": "0.9.125-alpha.17",
"description": "Authentication middlewares for budibase builder and apps",
"main": "src/index.js",
"author": "Budibase",

View File

@ -75,6 +75,9 @@ function isDevApp(app) {
* @return {null|string} The tenant ID found within the app ID.
*/
exports.getTenantIDFromAppID = appId => {
if (!appId) {
return null
}
const split = appId.split(SEPARATOR)
const hasDev = split[1] === DocumentTypes.DEV
if ((hasDev && split.length === 3) || (!hasDev && split.length === 2)) {
@ -236,9 +239,12 @@ exports.getAllApps = async (CouchDB, { dev, all, idsOnly } = {}) => {
const split = dbName.split(SEPARATOR)
// it is an app, check the tenantId
if (split[0] === DocumentTypes.APP) {
const noTenantId = split.length === 2 || split[1] === DocumentTypes.DEV
// tenantId is always right before the UUID
const possibleTenantId = split[split.length - 2]
const noTenantId =
split.length === 2 || possibleTenantId === DocumentTypes.DEV
return (
(tenantId === DEFAULT_TENANT_ID && noTenantId) ||
possibleTenantId === tenantId

View File

@ -56,7 +56,6 @@ function init() {
if (CLIENT) {
CLIENT.disconnect()
}
const { redisProtocolUrl, opts, host, port } = getRedisOptions(CLUSTERED)
if (CLUSTERED) {

View File

@ -63,6 +63,7 @@ exports.tryAddTenant = async (tenantId, userId, email) => {
}
if (emailDoc) {
emailDoc.tenantId = tenantId
emailDoc.userId = userId
promises.push(db.put(emailDoc))
}
if (tenants.tenantIds.indexOf(tenantId) === -1) {

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/bbui",
"description": "A UI solution used in the different Budibase projects.",
"version": "0.9.125-alpha.14",
"version": "0.9.125-alpha.17",
"license": "AGPL-3.0",
"svelte": "src/index.js",
"module": "dist/bbui.es.js",

View File

@ -13,7 +13,7 @@
export let enableTime = true
export let value = null
export let placeholder = null
export let appendTo = null
export let appendTo = undefined
const dispatch = createEventDispatcher()
const flatpickrId = `${generateID()}-wrapper`

View File

@ -10,7 +10,7 @@
export let error = null
export let enableTime = true
export let placeholder = null
export let appendTo = null
export let appendTo = undefined
const dispatch = createEventDispatcher()
const onChange = e => {

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/builder",
"version": "0.9.125-alpha.14",
"version": "0.9.125-alpha.17",
"license": "AGPL-3.0",
"private": true,
"scripts": {
@ -65,10 +65,10 @@
}
},
"dependencies": {
"@budibase/bbui": "^0.9.125-alpha.14",
"@budibase/client": "^0.9.125-alpha.14",
"@budibase/bbui": "^0.9.125-alpha.17",
"@budibase/client": "^0.9.125-alpha.17",
"@budibase/colorpicker": "1.1.2",
"@budibase/string-templates": "^0.9.125-alpha.14",
"@budibase/string-templates": "^0.9.125-alpha.17",
"@sentry/browser": "5.19.1",
"@spectrum-css/page": "^3.0.1",
"@spectrum-css/vars": "^3.0.1",

View File

@ -12,7 +12,7 @@
}
// redirect to account portal for authentication in the cloud
if ($admin.cloud && $admin.accountPortalUrl) {
if (!$auth.user && $admin.cloud && $admin.accountPortalUrl) {
window.location.href = $admin.accountPortalUrl
}
})

View File

@ -49,7 +49,7 @@
if (sortBy === "status") {
return enrichedApps.sort((a, b) => {
if (a.status === b.status) {
return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1
return a.name?.toLowerCase() < b.name?.toLowerCase() ? -1 : 1
}
return a.status === AppStatus.DEPLOYED ? -1 : 1
})
@ -61,7 +61,7 @@
})
} else {
return enrichedApps.sort((a, b) => {
return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1
return a.name?.toLowerCase() < b.name?.toLowerCase() ? -1 : 1
})
}
}

View File

@ -3,6 +3,11 @@ import { get } from "builderStore/api"
import { AppStatus } from "../../constants"
import api from "../../builderStore/api"
const extractAppId = id => {
const split = id?.split("_") || []
return split.length ? split[split.length - 1] : null
}
export function createAppStore() {
const store = writable([])
@ -18,7 +23,7 @@ export function createAppStore() {
// First append all dev app version
devApps.forEach(app => {
const id = app.appId.substring(8)
const id = extractAppId(app.appId)
appMap[id] = {
...app,
devId: app.appId,
@ -28,7 +33,13 @@ export function createAppStore() {
// Then merge with all prod app versions
deployedApps.forEach(app => {
const id = app.appId.substring(4)
const id = extractAppId(app.appId)
// Skip any deployed apps which don't have a dev counterpart
if (!appMap[id]) {
return
}
appMap[id] = {
...appMap[id],
...app,
@ -40,7 +51,7 @@ export function createAppStore() {
// Transform into an array and clean up
const apps = Object.values(appMap)
apps.forEach(app => {
app.appId = app.devId.substring(8)
app.appId = extractAppId(app.devId)
delete app._id
delete app._rev
})

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/cli",
"version": "0.9.125-alpha.14",
"version": "0.9.125-alpha.17",
"description": "Budibase CLI, for developers, self hosting and migrations.",
"main": "src/index.js",
"bin": {

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/client",
"version": "0.9.125-alpha.14",
"version": "0.9.125-alpha.17",
"license": "MPL-2.0",
"module": "dist/budibase-client.js",
"main": "dist/budibase-client.js",
@ -19,9 +19,8 @@
"dev:builder": "rollup -cw"
},
"dependencies": {
"@budibase/bbui": "^0.9.125-alpha.14",
"@budibase/standard-components": "^0.9.124",
"@budibase/string-templates": "^0.9.125-alpha.14",
"@budibase/bbui": "^0.9.125-alpha.17",
"@budibase/string-templates": "^0.9.125-alpha.17",
"regexparam": "^1.3.0",
"shortid": "^2.2.15",
"svelte-spa-router": "^3.0.5"

View File

@ -28,59 +28,10 @@
chalk "^2.0.0"
js-tokens "^4.0.0"
"@budibase/bbui@^0.9.125-alpha.11":
version "0.9.130"
resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-0.9.130.tgz#cad02a7aa16324eb7a056c5dc0162444fa917964"
integrity sha512-ULOC++363K8QEMasmsDmleF7AzjulFk/ZxGPlOJcVKJU8Bx5wG1uNFgTyJyGpmnbUWHd67eYUEettfH7I+VoOw==
dependencies:
"@adobe/spectrum-css-workflow-icons" "^1.2.1"
"@spectrum-css/actionbutton" "^1.0.1"
"@spectrum-css/actiongroup" "^1.0.1"
"@spectrum-css/avatar" "^3.0.2"
"@spectrum-css/button" "^3.0.1"
"@spectrum-css/buttongroup" "^3.0.2"
"@spectrum-css/checkbox" "^3.0.2"
"@spectrum-css/dialog" "^3.0.1"
"@spectrum-css/divider" "^1.0.3"
"@spectrum-css/dropzone" "^3.0.2"
"@spectrum-css/fieldgroup" "^3.0.2"
"@spectrum-css/fieldlabel" "^3.0.1"
"@spectrum-css/icon" "^3.0.1"
"@spectrum-css/illustratedmessage" "^3.0.2"
"@spectrum-css/inputgroup" "^3.0.2"
"@spectrum-css/label" "^2.0.10"
"@spectrum-css/link" "^3.1.1"
"@spectrum-css/menu" "^3.0.1"
"@spectrum-css/modal" "^3.0.1"
"@spectrum-css/pagination" "^3.0.3"
"@spectrum-css/picker" "^1.0.1"
"@spectrum-css/popover" "^3.0.1"
"@spectrum-css/progressbar" "^1.0.2"
"@spectrum-css/progresscircle" "^1.0.2"
"@spectrum-css/radio" "^3.0.2"
"@spectrum-css/search" "^3.0.2"
"@spectrum-css/sidenav" "^3.0.2"
"@spectrum-css/statuslight" "^3.0.2"
"@spectrum-css/stepper" "^3.0.3"
"@spectrum-css/switch" "^1.0.2"
"@spectrum-css/table" "^3.0.1"
"@spectrum-css/tabs" "^3.0.1"
"@spectrum-css/tags" "^3.0.2"
"@spectrum-css/textfield" "^3.0.1"
"@spectrum-css/toast" "^3.0.1"
"@spectrum-css/tooltip" "^3.0.3"
"@spectrum-css/treeview" "^3.0.2"
"@spectrum-css/typography" "^3.0.1"
"@spectrum-css/underlay" "^2.0.9"
"@spectrum-css/vars" "^3.0.1"
dayjs "^1.10.4"
svelte-flatpickr "^3.1.0"
svelte-portal "^1.0.0"
"@budibase/bbui@^0.9.129":
version "0.9.129"
resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-0.9.129.tgz#989bf60d404772d4b308382faba7adac6518ec3e"
integrity sha512-U3uO9K3m7Ph5RQpzXx5IIy94s/KdU9Q8eJXFQwH6neYIKQk3OFo8br5px5C7lE38mtazqq9XvQy0f+MUarKk4A==
"@budibase/bbui@^0.9.125-alpha.17":
version "0.9.133"
resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-0.9.133.tgz#91a2fb24abaaf91d2cb1e00eb51c493c1290f9ad"
integrity sha512-xbMmc/hee1QRNW7TrbGUBmLr1hMHXqUDA6rdl9N2PGfHFuFWbqlD8PWYanHmLevVet+CjkuKGPSbBghFK2pQyQ==
dependencies:
"@adobe/spectrum-css-workflow-icons" "^1.2.1"
"@spectrum-css/actionbutton" "^1.0.1"
@ -154,28 +105,10 @@
to-gfm-code-block "^0.1.1"
year "^0.2.1"
"@budibase/standard-components@^0.9.124":
version "0.9.129"
resolved "https://registry.yarnpkg.com/@budibase/standard-components/-/standard-components-0.9.129.tgz#f2cdead99b8f25177c4c291be3032fb9ffd1dac3"
integrity sha512-RYWBcrz4MGICg9neIPQ4CbU3WTTJoTofi2D4pwA+qvvN3uhqOCcFIZ3+yadZ5Akz2qwMztQ8WDvetowm2srZcA==
dependencies:
"@budibase/bbui" "^0.9.129"
"@spectrum-css/button" "^3.0.3"
"@spectrum-css/card" "^3.0.3"
"@spectrum-css/divider" "^1.0.3"
"@spectrum-css/link" "^3.1.3"
"@spectrum-css/page" "^3.0.1"
"@spectrum-css/typography" "^3.0.2"
"@spectrum-css/vars" "^3.0.1"
apexcharts "^3.22.1"
dayjs "^1.10.5"
svelte-apexcharts "^1.0.2"
svelte-flatpickr "^3.1.0"
"@budibase/string-templates@^0.9.125-alpha.11":
version "0.9.130"
resolved "https://registry.yarnpkg.com/@budibase/string-templates/-/string-templates-0.9.130.tgz#1be8affcba0dc8ff2b8044c65dd378dc76a165d0"
integrity sha512-DXO6Um18/k16i3hYilxvQ4RYNHhd29OJGbzjfQZ2v7z4Oin5y+WMZzpjX1hQS5g9f/CBbzu7qd7EHiz/n8gMqg==
"@budibase/string-templates@^0.9.125-alpha.17":
version "0.9.133"
resolved "https://registry.yarnpkg.com/@budibase/string-templates/-/string-templates-0.9.133.tgz#221d81e080dc4485dcffa989d16e2bbed39f9055"
integrity sha512-SMHcSPwHYdAqol9YCcMoYawp5/ETr9TqGZCUsL+hUUq+LritPwu/miQ++SVvRTQbOR7Mker0S9LO3H8mwYkW8w==
dependencies:
"@budibase/handlebars-helpers" "^0.11.4"
dayjs "^1.10.4"

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/server",
"email": "hi@budibase.com",
"version": "0.9.125-alpha.14",
"version": "0.9.125-alpha.17",
"description": "Budibase Web Server",
"main": "src/index.js",
"repository": {
@ -64,9 +64,9 @@
"author": "Budibase",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@budibase/auth": "^0.9.125-alpha.14",
"@budibase/client": "^0.9.125-alpha.14",
"@budibase/string-templates": "^0.9.125-alpha.14",
"@budibase/auth": "^0.9.125-alpha.17",
"@budibase/client": "^0.9.125-alpha.17",
"@budibase/string-templates": "^0.9.125-alpha.17",
"@elastic/elasticsearch": "7.10.0",
"@koa/router": "8.0.0",
"@sendgrid/mail": "7.1.1",
@ -118,7 +118,6 @@
"devDependencies": {
"@babel/core": "^7.14.3",
"@babel/preset-env": "^7.14.4",
"@budibase/standard-components": "^0.9.124",
"@jest/test-sequencer": "^24.8.0",
"@types/bull": "^3.15.1",
"@types/jest": "^26.0.23",

View File

@ -189,15 +189,27 @@ exports.trigger = async function (ctx) {
}
}
function prepareTestInput(input) {
// prepare the test parameters
if (input.id && input.row) {
input.row._id = input.id
}
if (input.revision && input.row) {
input.row._rev = input.revision
}
return input
}
exports.test = async function (ctx) {
const appId = ctx.appId
const db = new CouchDB(appId)
let automation = await db.get(ctx.params.id)
await setTestFlag(automation._id)
const testInput = prepareTestInput(ctx.request.body)
const response = await triggers.externalTrigger(
automation,
{
...ctx.request.body,
...testInput,
appId,
},
{ getResponses: true }

View File

@ -7,9 +7,10 @@ const Queue = env.isTest()
: require("bull")
const { JobQueues } = require("../constants")
const { utils } = require("@budibase/auth/redis")
const { opts } = utils.getRedisOptions()
const { opts, redisProtocolUrl } = utils.getRedisOptions()
let automationQueue = new Queue(JobQueues.AUTOMATIONS, { redis: opts })
const redisConfig = redisProtocolUrl || { redis: opts }
let automationQueue = new Queue(JobQueues.AUTOMATIONS, redisConfig)
exports.pathPrefix = "/bulladmin"

View File

@ -50,7 +50,7 @@ exports.run = async function ({ inputs, context }) {
let stdout,
success = true
try {
stdout = execSync(command, { timeout: 500 })
stdout = execSync(command, { timeout: 500 }).toString()
} catch (err) {
stdout = err.message
success = false

View File

@ -97,12 +97,16 @@ exports.run = async function ({ inputs }) {
"Content-Type": "application/json",
}
if (headers && headers.length !== 0) {
if (headers) {
try {
const customHeaders = JSON.parse(headers)
const customHeaders =
typeof headers === "string" ? JSON.parse(headers) : headers
request.headers = { ...request.headers, ...customHeaders }
} catch (err) {
console.error(err)
return {
success: false,
response: "Unable to process headers, must be a JSON object.",
}
}
}
}

View File

@ -943,10 +943,10 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@budibase/auth@^0.9.125-alpha.11":
version "0.9.130"
resolved "https://registry.yarnpkg.com/@budibase/auth/-/auth-0.9.130.tgz#04ff77b862e87e22b08ee7bebd5409ff479a2b35"
integrity sha512-wCgbnk8YvBtRQhmWd7w9UGNLL1ocJPHCq10652Dxm8nLnY0oAsgzVVoMsMULyTypfHiYtUEnOs7+JQ/nYa2zkA==
"@budibase/auth@^0.9.125-alpha.17":
version "0.9.133"
resolved "https://registry.yarnpkg.com/@budibase/auth/-/auth-0.9.133.tgz#280d581820c9069b6bc021f88178c215ee48ad08"
integrity sha512-DL7zIYRXE6xSKE/qbHMf/SX3+bceGxM4xzUmLTk4OHtEOP/vaUJr35tkhznAZF7VpUR9Yh20D6/Zw8z/3sxj/A==
dependencies:
"@techpass/passport-openidconnect" "^0.3.0"
aws-sdk "^2.901.0"
@ -966,10 +966,10 @@
uuid "^8.3.2"
zlib "^1.0.5"
"@budibase/bbui@^0.9.127":
version "0.9.127"
resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-0.9.127.tgz#e038338d69476d45afe1d4c4ef36971d8d0c59bd"
integrity sha512-fcUVzC7lOGUxLFEptaLTNSproMQa4cf5tSCo5atU9gDoPHVdIncocPWJuuLM1hM2JIlk8IiJ+up9CdiDur8FsA==
"@budibase/bbui@^0.9.133":
version "0.9.133"
resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-0.9.133.tgz#91a2fb24abaaf91d2cb1e00eb51c493c1290f9ad"
integrity sha512-xbMmc/hee1QRNW7TrbGUBmLr1hMHXqUDA6rdl9N2PGfHFuFWbqlD8PWYanHmLevVet+CjkuKGPSbBghFK2pQyQ==
dependencies:
"@adobe/spectrum-css-workflow-icons" "^1.2.1"
"@spectrum-css/actionbutton" "^1.0.1"
@ -1015,63 +1015,14 @@
svelte-flatpickr "^3.1.0"
svelte-portal "^1.0.0"
"@budibase/bbui@^0.9.130":
version "0.9.130"
resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-0.9.130.tgz#cad02a7aa16324eb7a056c5dc0162444fa917964"
integrity sha512-ULOC++363K8QEMasmsDmleF7AzjulFk/ZxGPlOJcVKJU8Bx5wG1uNFgTyJyGpmnbUWHd67eYUEettfH7I+VoOw==
"@budibase/client@^0.9.125-alpha.17":
version "0.9.133"
resolved "https://registry.yarnpkg.com/@budibase/client/-/client-0.9.133.tgz#43748e189e9b92d99d1281ab62bd2c5ebed5dbab"
integrity sha512-JrduL9iVMGalZyIUQ+1UN/dhrOZNRJwXU8B4r/eWhVoJf3f3bCuNfpMoT2LN3HY4ooyu37VehD+J5bdDsvlNPw==
dependencies:
"@adobe/spectrum-css-workflow-icons" "^1.2.1"
"@spectrum-css/actionbutton" "^1.0.1"
"@spectrum-css/actiongroup" "^1.0.1"
"@spectrum-css/avatar" "^3.0.2"
"@spectrum-css/button" "^3.0.1"
"@spectrum-css/buttongroup" "^3.0.2"
"@spectrum-css/checkbox" "^3.0.2"
"@spectrum-css/dialog" "^3.0.1"
"@spectrum-css/divider" "^1.0.3"
"@spectrum-css/dropzone" "^3.0.2"
"@spectrum-css/fieldgroup" "^3.0.2"
"@spectrum-css/fieldlabel" "^3.0.1"
"@spectrum-css/icon" "^3.0.1"
"@spectrum-css/illustratedmessage" "^3.0.2"
"@spectrum-css/inputgroup" "^3.0.2"
"@spectrum-css/label" "^2.0.10"
"@spectrum-css/link" "^3.1.1"
"@spectrum-css/menu" "^3.0.1"
"@spectrum-css/modal" "^3.0.1"
"@spectrum-css/pagination" "^3.0.3"
"@spectrum-css/picker" "^1.0.1"
"@spectrum-css/popover" "^3.0.1"
"@spectrum-css/progressbar" "^1.0.2"
"@spectrum-css/progresscircle" "^1.0.2"
"@spectrum-css/radio" "^3.0.2"
"@spectrum-css/search" "^3.0.2"
"@spectrum-css/sidenav" "^3.0.2"
"@spectrum-css/statuslight" "^3.0.2"
"@spectrum-css/stepper" "^3.0.3"
"@spectrum-css/switch" "^1.0.2"
"@spectrum-css/table" "^3.0.1"
"@spectrum-css/tabs" "^3.0.1"
"@spectrum-css/tags" "^3.0.2"
"@spectrum-css/textfield" "^3.0.1"
"@spectrum-css/toast" "^3.0.1"
"@spectrum-css/tooltip" "^3.0.3"
"@spectrum-css/treeview" "^3.0.2"
"@spectrum-css/typography" "^3.0.1"
"@spectrum-css/underlay" "^2.0.9"
"@spectrum-css/vars" "^3.0.1"
dayjs "^1.10.4"
svelte-flatpickr "^3.1.0"
svelte-portal "^1.0.0"
"@budibase/client@^0.9.125-alpha.11":
version "0.9.130"
resolved "https://registry.yarnpkg.com/@budibase/client/-/client-0.9.130.tgz#efff68349667ad315cda2973d530cfe8a30b10d3"
integrity sha512-PJiOqEf7QF2/MS5CK9WkJl5JYSz/IBDQ1/H665V4Q1Kf5Y/hL+ymXaC5ztWPt6CZlo6dSoAZaD81h7zd6XeuYA==
dependencies:
"@budibase/bbui" "^0.9.130"
"@budibase/standard-components" "^0.9.130"
"@budibase/string-templates" "^0.9.130"
"@budibase/bbui" "^0.9.133"
"@budibase/standard-components" "^0.9.133"
"@budibase/string-templates" "^0.9.133"
regexparam "^1.3.0"
shortid "^2.2.15"
svelte-spa-router "^3.0.5"
@ -1104,12 +1055,12 @@
to-gfm-code-block "^0.1.1"
year "^0.2.1"
"@budibase/standard-components@^0.9.124":
version "0.9.127"
resolved "https://registry.yarnpkg.com/@budibase/standard-components/-/standard-components-0.9.127.tgz#91366b8376eb388f8bcab16e96a2913e4b4af649"
integrity sha512-NlJB+y28/gKRu1FtTZQzEifJNA7N8suaZ8FlZpqh4Aq/LzRh0Q301BXx1emVnPqMW/fEHBum47iRYboO5XSmMA==
"@budibase/standard-components@^0.9.133":
version "0.9.133"
resolved "https://registry.yarnpkg.com/@budibase/standard-components/-/standard-components-0.9.133.tgz#789c02b45dc3853b003822c09e18ce7ece4dfa29"
integrity sha512-xcuwTxsqk1J/YmM4YjThO/Fm0eJ+aZWm0kbFgfN+dNN9fuPlsPOLmlVEWeOUPmBa5XfRyDbx6lDYj0PPEK8CvA==
dependencies:
"@budibase/bbui" "^0.9.127"
"@budibase/bbui" "^0.9.133"
"@spectrum-css/button" "^3.0.3"
"@spectrum-css/card" "^3.0.3"
"@spectrum-css/divider" "^1.0.3"
@ -1122,28 +1073,10 @@
svelte-apexcharts "^1.0.2"
svelte-flatpickr "^3.1.0"
"@budibase/standard-components@^0.9.130":
version "0.9.130"
resolved "https://registry.yarnpkg.com/@budibase/standard-components/-/standard-components-0.9.130.tgz#ed24eaafcca959e15c76b81e2340371d268ab131"
integrity sha512-hsLKnVciI+is6L42IDDcZ8sW/aLD0UyYLQd/hqMZT8WBf58908ujY3nwFZnxV30uwjSmiZeYCYmK3vbHDD0ljQ==
dependencies:
"@budibase/bbui" "^0.9.130"
"@spectrum-css/button" "^3.0.3"
"@spectrum-css/card" "^3.0.3"
"@spectrum-css/divider" "^1.0.3"
"@spectrum-css/link" "^3.1.3"
"@spectrum-css/page" "^3.0.1"
"@spectrum-css/typography" "^3.0.2"
"@spectrum-css/vars" "^3.0.1"
apexcharts "^3.22.1"
dayjs "^1.10.5"
svelte-apexcharts "^1.0.2"
svelte-flatpickr "^3.1.0"
"@budibase/string-templates@^0.9.125-alpha.11", "@budibase/string-templates@^0.9.130":
version "0.9.130"
resolved "https://registry.yarnpkg.com/@budibase/string-templates/-/string-templates-0.9.130.tgz#1be8affcba0dc8ff2b8044c65dd378dc76a165d0"
integrity sha512-DXO6Um18/k16i3hYilxvQ4RYNHhd29OJGbzjfQZ2v7z4Oin5y+WMZzpjX1hQS5g9f/CBbzu7qd7EHiz/n8gMqg==
"@budibase/string-templates@^0.9.125-alpha.17", "@budibase/string-templates@^0.9.133":
version "0.9.133"
resolved "https://registry.yarnpkg.com/@budibase/string-templates/-/string-templates-0.9.133.tgz#221d81e080dc4485dcffa989d16e2bbed39f9055"
integrity sha512-SMHcSPwHYdAqol9YCcMoYawp5/ETr9TqGZCUsL+hUUq+LritPwu/miQ++SVvRTQbOR7Mker0S9LO3H8mwYkW8w==
dependencies:
"@budibase/handlebars-helpers" "^0.11.4"
dayjs "^1.10.4"

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/string-templates",
"version": "0.9.125-alpha.14",
"version": "0.9.125-alpha.17",
"description": "Handlebars wrapper for Budibase templating.",
"main": "src/index.cjs",
"module": "dist/bundle.mjs",

View File

@ -19,6 +19,13 @@ const HELPERS = [
}),
// this help is applied to all statements
new Helper(HelperFunctionNames.ALL, value => {
if (
value != null &&
typeof value === "object" &&
value.toString() === "[object Object]"
) {
return new SafeString(JSON.stringify(value))
}
// null/undefined values produce bad results
if (value == null || typeof value !== "string") {
return value || ""

View File

@ -81,6 +81,16 @@ describe("Test that the object processing works correctly", () => {
expect(error).not.toBeNull()
})
it("check objects get converted to string JSON automatically", async () => {
const row = {a: 1}
const output = await processString("{{ trigger.row }}", {
trigger: {
row,
}
})
expect(JSON.parse(output)).toEqual(row)
})
it("should be able to handle null objects", async () => {
let error = null
try {

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/worker",
"email": "hi@budibase.com",
"version": "0.9.125-alpha.14",
"version": "0.9.125-alpha.17",
"description": "Budibase background service",
"main": "src/index.js",
"repository": {
@ -25,8 +25,8 @@
"author": "Budibase",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@budibase/auth": "^0.9.125-alpha.14",
"@budibase/string-templates": "^0.9.125-alpha.14",
"@budibase/auth": "^0.9.125-alpha.17",
"@budibase/string-templates": "^0.9.125-alpha.17",
"@koa/router": "^8.0.0",
"@techpass/passport-openidconnect": "^0.3.0",
"aws-sdk": "^2.811.0",

View File

@ -96,7 +96,7 @@ exports.reset = async ctx => {
exports.resetUpdate = async ctx => {
const { resetCode, password } = ctx.request.body
try {
const userId = await checkResetPasswordCode(resetCode)
const { userId } = await checkResetPasswordCode(resetCode)
const db = getGlobalDB()
const user = await db.get(userId)
user.password = await hash(password)

View File

@ -6,13 +6,11 @@ const {
} = require("@budibase/auth/db")
const { hash, getGlobalUserByEmail } = require("@budibase/auth").utils
const { UserStatus, EmailTemplatePurpose } = require("../../../constants")
const { DEFAULT_TENANT_ID } = require("@budibase/auth/constants")
const { checkInviteCode } = require("../../../utilities/redis")
const { sendEmail } = require("../../../utilities/email")
const { user: userCache } = require("@budibase/auth/cache")
const { invalidateSessions } = require("@budibase/auth/sessions")
const CouchDB = require("../../../db")
const env = require("../../../environment")
const {
getGlobalDB,
getTenantId,
@ -251,25 +249,14 @@ exports.find = async ctx => {
ctx.body = user
}
exports.tenantLookup = async ctx => {
exports.tenantUserLookup = async ctx => {
const id = ctx.params.id
// lookup, could be email or userId, either will return a doc
const db = new CouchDB(PLATFORM_INFO_DB)
let tenantId = null
try {
const doc = await db.get(id)
if (doc && doc.tenantId) {
tenantId = doc.tenantId
}
ctx.body = await db.get(id)
} catch (err) {
if (!env.MULTI_TENANCY) {
tenantId = DEFAULT_TENANT_ID
} else {
ctx.throw(400, "No tenant found.")
}
}
ctx.body = {
tenantId,
ctx.throw(400, "No tenant user found.")
}
}

View File

@ -94,7 +94,7 @@ router
controller.adminUser
)
.get("/api/global/users/self", controller.getSelf)
.get("/api/global/users/tenant/:id", controller.tenantLookup)
.get("/api/global/users/tenant/:id", controller.tenantUserLookup)
// global endpoint but needs to come at end (blocks other endpoints otherwise)
.get("/api/global/users/:id", adminOnly, controller.find)

View File

@ -51,7 +51,7 @@ function createSMTPTransport(config) {
async function getLinkCode(purpose, email, user, info = null) {
switch (purpose) {
case EmailTemplatePurpose.PASSWORD_RECOVERY:
return getResetPasswordCode(user._id)
return getResetPasswordCode(user._id, info)
case EmailTemplatePurpose.INVITATION:
return getInviteCode(email, info)
default:

View File

@ -63,8 +63,8 @@ exports.shutdown = async () => {
* @param {string} userId the ID of the user which is to be reset.
* @return {Promise<string>} returns the code that was stored to redis.
*/
exports.getResetPasswordCode = async userId => {
return writeACode(utils.Databases.PW_RESETS, userId)
exports.getResetPasswordCode = async (userId, info) => {
return writeACode(utils.Databases.PW_RESETS, { userId, info })
}
/**

File diff suppressed because it is too large Load Diff