Merge branch 'develop' into feature/onboarding-backend

This commit is contained in:
Rory Powell 2021-09-20 11:27:02 +01:00
commit 96b76231a9
23 changed files with 752 additions and 221 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -49,7 +49,7 @@
if (sortBy === "status") { if (sortBy === "status") {
return enrichedApps.sort((a, b) => { return enrichedApps.sort((a, b) => {
if (a.status === b.status) { 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 return a.status === AppStatus.DEPLOYED ? -1 : 1
}) })
@ -61,7 +61,7 @@
}) })
} else { } else {
return enrichedApps.sort((a, b) => { 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 { AppStatus } from "../../constants"
import api from "../../builderStore/api" import api from "../../builderStore/api"
const extractAppId = id => {
const split = id?.split("_") || []
return split.length ? split[split.length - 1] : null
}
export function createAppStore() { export function createAppStore() {
const store = writable([]) const store = writable([])
@ -18,7 +23,7 @@ export function createAppStore() {
// First append all dev app version // First append all dev app version
devApps.forEach(app => { devApps.forEach(app => {
const id = app.appId.substring(8) const id = extractAppId(app.appId)
appMap[id] = { appMap[id] = {
...app, ...app,
devId: app.appId, devId: app.appId,
@ -28,7 +33,13 @@ export function createAppStore() {
// Then merge with all prod app versions // Then merge with all prod app versions
deployedApps.forEach(app => { 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] = {
...appMap[id], ...appMap[id],
...app, ...app,
@ -40,7 +51,7 @@ export function createAppStore() {
// Transform into an array and clean up // Transform into an array and clean up
const apps = Object.values(appMap) const apps = Object.values(appMap)
apps.forEach(app => { apps.forEach(app => {
app.appId = app.devId.substring(8) app.appId = extractAppId(app.devId)
delete app._id delete app._id
delete app._rev delete app._rev
}) })

View File

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

View File

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

View File

@ -28,59 +28,10 @@
chalk "^2.0.0" chalk "^2.0.0"
js-tokens "^4.0.0" js-tokens "^4.0.0"
"@budibase/bbui@^0.9.125-alpha.11": "@budibase/bbui@^0.9.125-alpha.17":
version "0.9.130" version "0.9.133"
resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-0.9.130.tgz#cad02a7aa16324eb7a056c5dc0162444fa917964" resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-0.9.133.tgz#91a2fb24abaaf91d2cb1e00eb51c493c1290f9ad"
integrity sha512-ULOC++363K8QEMasmsDmleF7AzjulFk/ZxGPlOJcVKJU8Bx5wG1uNFgTyJyGpmnbUWHd67eYUEettfH7I+VoOw== integrity sha512-xbMmc/hee1QRNW7TrbGUBmLr1hMHXqUDA6rdl9N2PGfHFuFWbqlD8PWYanHmLevVet+CjkuKGPSbBghFK2pQyQ==
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==
dependencies: dependencies:
"@adobe/spectrum-css-workflow-icons" "^1.2.1" "@adobe/spectrum-css-workflow-icons" "^1.2.1"
"@spectrum-css/actionbutton" "^1.0.1" "@spectrum-css/actionbutton" "^1.0.1"
@ -154,28 +105,10 @@
to-gfm-code-block "^0.1.1" to-gfm-code-block "^0.1.1"
year "^0.2.1" year "^0.2.1"
"@budibase/standard-components@^0.9.124": "@budibase/string-templates@^0.9.125-alpha.17":
version "0.9.129" version "0.9.133"
resolved "https://registry.yarnpkg.com/@budibase/standard-components/-/standard-components-0.9.129.tgz#f2cdead99b8f25177c4c291be3032fb9ffd1dac3" resolved "https://registry.yarnpkg.com/@budibase/string-templates/-/string-templates-0.9.133.tgz#221d81e080dc4485dcffa989d16e2bbed39f9055"
integrity sha512-RYWBcrz4MGICg9neIPQ4CbU3WTTJoTofi2D4pwA+qvvN3uhqOCcFIZ3+yadZ5Akz2qwMztQ8WDvetowm2srZcA== integrity sha512-SMHcSPwHYdAqol9YCcMoYawp5/ETr9TqGZCUsL+hUUq+LritPwu/miQ++SVvRTQbOR7Mker0S9LO3H8mwYkW8w==
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==
dependencies: dependencies:
"@budibase/handlebars-helpers" "^0.11.4" "@budibase/handlebars-helpers" "^0.11.4"
dayjs "^1.10.4" dayjs "^1.10.4"

View File

@ -1,7 +1,7 @@
{ {
"name": "@budibase/server", "name": "@budibase/server",
"email": "hi@budibase.com", "email": "hi@budibase.com",
"version": "0.9.125-alpha.16", "version": "0.9.125-alpha.18",
"description": "Budibase Web Server", "description": "Budibase Web Server",
"main": "src/index.js", "main": "src/index.js",
"repository": { "repository": {
@ -64,9 +64,9 @@
"author": "Budibase", "author": "Budibase",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"dependencies": { "dependencies": {
"@budibase/auth": "^0.9.125-alpha.16", "@budibase/auth": "^0.9.125-alpha.18",
"@budibase/client": "^0.9.125-alpha.16", "@budibase/client": "^0.9.125-alpha.18",
"@budibase/string-templates": "^0.9.125-alpha.16", "@budibase/string-templates": "^0.9.125-alpha.18",
"@elastic/elasticsearch": "7.10.0", "@elastic/elasticsearch": "7.10.0",
"@koa/router": "8.0.0", "@koa/router": "8.0.0",
"@sendgrid/mail": "7.1.1", "@sendgrid/mail": "7.1.1",
@ -118,7 +118,6 @@
"devDependencies": { "devDependencies": {
"@babel/core": "^7.14.3", "@babel/core": "^7.14.3",
"@babel/preset-env": "^7.14.4", "@babel/preset-env": "^7.14.4",
"@budibase/standard-components": "^0.9.124",
"@jest/test-sequencer": "^24.8.0", "@jest/test-sequencer": "^24.8.0",
"@types/bull": "^3.15.1", "@types/bull": "^3.15.1",
"@types/jest": "^26.0.23", "@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) { exports.test = async function (ctx) {
const appId = ctx.appId const appId = ctx.appId
const db = new CouchDB(appId) const db = new CouchDB(appId)
let automation = await db.get(ctx.params.id) let automation = await db.get(ctx.params.id)
await setTestFlag(automation._id) await setTestFlag(automation._id)
const testInput = prepareTestInput(ctx.request.body)
const response = await triggers.externalTrigger( const response = await triggers.externalTrigger(
automation, automation,
{ {
...ctx.request.body, ...testInput,
appId, appId,
}, },
{ getResponses: true } { getResponses: true }

View File

@ -7,9 +7,10 @@ const Queue = env.isTest()
: require("bull") : require("bull")
const { JobQueues } = require("../constants") const { JobQueues } = require("../constants")
const { utils } = require("@budibase/auth/redis") 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" exports.pathPrefix = "/bulladmin"

View File

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

View File

@ -97,12 +97,16 @@ exports.run = async function ({ inputs }) {
"Content-Type": "application/json", "Content-Type": "application/json",
} }
if (headers && headers.length !== 0) { if (headers) {
try { try {
const customHeaders = JSON.parse(headers) const customHeaders =
typeof headers === "string" ? JSON.parse(headers) : headers
request.headers = { ...request.headers, ...customHeaders } request.headers = { ...request.headers, ...customHeaders }
} catch (err) { } 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" resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@budibase/auth@^0.9.125-alpha.11": "@budibase/auth@^0.9.125-alpha.17":
version "0.9.130" version "0.9.133"
resolved "https://registry.yarnpkg.com/@budibase/auth/-/auth-0.9.130.tgz#04ff77b862e87e22b08ee7bebd5409ff479a2b35" resolved "https://registry.yarnpkg.com/@budibase/auth/-/auth-0.9.133.tgz#280d581820c9069b6bc021f88178c215ee48ad08"
integrity sha512-wCgbnk8YvBtRQhmWd7w9UGNLL1ocJPHCq10652Dxm8nLnY0oAsgzVVoMsMULyTypfHiYtUEnOs7+JQ/nYa2zkA== integrity sha512-DL7zIYRXE6xSKE/qbHMf/SX3+bceGxM4xzUmLTk4OHtEOP/vaUJr35tkhznAZF7VpUR9Yh20D6/Zw8z/3sxj/A==
dependencies: dependencies:
"@techpass/passport-openidconnect" "^0.3.0" "@techpass/passport-openidconnect" "^0.3.0"
aws-sdk "^2.901.0" aws-sdk "^2.901.0"
@ -966,10 +966,10 @@
uuid "^8.3.2" uuid "^8.3.2"
zlib "^1.0.5" zlib "^1.0.5"
"@budibase/bbui@^0.9.127": "@budibase/bbui@^0.9.133":
version "0.9.127" version "0.9.133"
resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-0.9.127.tgz#e038338d69476d45afe1d4c4ef36971d8d0c59bd" resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-0.9.133.tgz#91a2fb24abaaf91d2cb1e00eb51c493c1290f9ad"
integrity sha512-fcUVzC7lOGUxLFEptaLTNSproMQa4cf5tSCo5atU9gDoPHVdIncocPWJuuLM1hM2JIlk8IiJ+up9CdiDur8FsA== integrity sha512-xbMmc/hee1QRNW7TrbGUBmLr1hMHXqUDA6rdl9N2PGfHFuFWbqlD8PWYanHmLevVet+CjkuKGPSbBghFK2pQyQ==
dependencies: dependencies:
"@adobe/spectrum-css-workflow-icons" "^1.2.1" "@adobe/spectrum-css-workflow-icons" "^1.2.1"
"@spectrum-css/actionbutton" "^1.0.1" "@spectrum-css/actionbutton" "^1.0.1"
@ -1015,63 +1015,14 @@
svelte-flatpickr "^3.1.0" svelte-flatpickr "^3.1.0"
svelte-portal "^1.0.0" svelte-portal "^1.0.0"
"@budibase/bbui@^0.9.130": "@budibase/client@^0.9.125-alpha.17":
version "0.9.130" version "0.9.133"
resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-0.9.130.tgz#cad02a7aa16324eb7a056c5dc0162444fa917964" resolved "https://registry.yarnpkg.com/@budibase/client/-/client-0.9.133.tgz#43748e189e9b92d99d1281ab62bd2c5ebed5dbab"
integrity sha512-ULOC++363K8QEMasmsDmleF7AzjulFk/ZxGPlOJcVKJU8Bx5wG1uNFgTyJyGpmnbUWHd67eYUEettfH7I+VoOw== integrity sha512-JrduL9iVMGalZyIUQ+1UN/dhrOZNRJwXU8B4r/eWhVoJf3f3bCuNfpMoT2LN3HY4ooyu37VehD+J5bdDsvlNPw==
dependencies: dependencies:
"@adobe/spectrum-css-workflow-icons" "^1.2.1" "@budibase/bbui" "^0.9.133"
"@spectrum-css/actionbutton" "^1.0.1" "@budibase/standard-components" "^0.9.133"
"@spectrum-css/actiongroup" "^1.0.1" "@budibase/string-templates" "^0.9.133"
"@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"
regexparam "^1.3.0" regexparam "^1.3.0"
shortid "^2.2.15" shortid "^2.2.15"
svelte-spa-router "^3.0.5" svelte-spa-router "^3.0.5"
@ -1104,12 +1055,12 @@
to-gfm-code-block "^0.1.1" to-gfm-code-block "^0.1.1"
year "^0.2.1" year "^0.2.1"
"@budibase/standard-components@^0.9.124": "@budibase/standard-components@^0.9.133":
version "0.9.127" version "0.9.133"
resolved "https://registry.yarnpkg.com/@budibase/standard-components/-/standard-components-0.9.127.tgz#91366b8376eb388f8bcab16e96a2913e4b4af649" resolved "https://registry.yarnpkg.com/@budibase/standard-components/-/standard-components-0.9.133.tgz#789c02b45dc3853b003822c09e18ce7ece4dfa29"
integrity sha512-NlJB+y28/gKRu1FtTZQzEifJNA7N8suaZ8FlZpqh4Aq/LzRh0Q301BXx1emVnPqMW/fEHBum47iRYboO5XSmMA== integrity sha512-xcuwTxsqk1J/YmM4YjThO/Fm0eJ+aZWm0kbFgfN+dNN9fuPlsPOLmlVEWeOUPmBa5XfRyDbx6lDYj0PPEK8CvA==
dependencies: dependencies:
"@budibase/bbui" "^0.9.127" "@budibase/bbui" "^0.9.133"
"@spectrum-css/button" "^3.0.3" "@spectrum-css/button" "^3.0.3"
"@spectrum-css/card" "^3.0.3" "@spectrum-css/card" "^3.0.3"
"@spectrum-css/divider" "^1.0.3" "@spectrum-css/divider" "^1.0.3"
@ -1122,28 +1073,10 @@
svelte-apexcharts "^1.0.2" svelte-apexcharts "^1.0.2"
svelte-flatpickr "^3.1.0" svelte-flatpickr "^3.1.0"
"@budibase/standard-components@^0.9.130": "@budibase/string-templates@^0.9.125-alpha.17", "@budibase/string-templates@^0.9.133":
version "0.9.130" version "0.9.133"
resolved "https://registry.yarnpkg.com/@budibase/standard-components/-/standard-components-0.9.130.tgz#ed24eaafcca959e15c76b81e2340371d268ab131" resolved "https://registry.yarnpkg.com/@budibase/string-templates/-/string-templates-0.9.133.tgz#221d81e080dc4485dcffa989d16e2bbed39f9055"
integrity sha512-hsLKnVciI+is6L42IDDcZ8sW/aLD0UyYLQd/hqMZT8WBf58908ujY3nwFZnxV30uwjSmiZeYCYmK3vbHDD0ljQ== integrity sha512-SMHcSPwHYdAqol9YCcMoYawp5/ETr9TqGZCUsL+hUUq+LritPwu/miQ++SVvRTQbOR7Mker0S9LO3H8mwYkW8w==
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==
dependencies: dependencies:
"@budibase/handlebars-helpers" "^0.11.4" "@budibase/handlebars-helpers" "^0.11.4"
dayjs "^1.10.4" dayjs "^1.10.4"

View File

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

View File

@ -19,6 +19,13 @@ const HELPERS = [
}), }),
// this help is applied to all statements // this help is applied to all statements
new Helper(HelperFunctionNames.ALL, value => { 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 // null/undefined values produce bad results
if (value == null || typeof value !== "string") { if (value == null || typeof value !== "string") {
return value || "" return value || ""

View File

@ -81,6 +81,16 @@ describe("Test that the object processing works correctly", () => {
expect(error).not.toBeNull() 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 () => { it("should be able to handle null objects", async () => {
let error = null let error = null
try { try {

View File

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

File diff suppressed because it is too large Load Diff