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

This commit is contained in:
mike12345567 2021-06-24 12:28:15 +01:00
commit e63499384c
21 changed files with 105 additions and 53 deletions

View File

@ -1,5 +1,5 @@
{
"version": "0.9.59",
"version": "0.9.63",
"npmClient": "yarn",
"packages": [
"packages/*"

View File

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

View File

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

View File

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

View File

@ -14,7 +14,6 @@
$: allowDeleteTrigger = !steps.length
function deleteStep() {
console.log("Running")
automationStore.actions.deleteAutomationBlock(block)
}
</script>

View File

@ -16,11 +16,13 @@
$: automation = $automationStore.selectedAutomation?.automation
onMount(async () => {
if (!automation?.definition?.trigger?.inputs.schemaUrl) {
// save the automation initially
await automationStore.actions.save({
instanceId,
automation,
})
}
interval = setInterval(async () => {
await automationStore.actions.fetch()
const outputs = automation?.definition?.trigger.schema.outputs?.properties

View File

@ -9,6 +9,9 @@
$: appUrl = $hostingStore.appUrl
function fullWebhookURL(uri) {
if (!uri) {
return ""
}
if (production) {
return `${appUrl}/${uri}`
} else {

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/cli",
"version": "0.9.59",
"version": "0.9.63",
"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.59",
"version": "0.9.63",
"license": "MPL-2.0",
"module": "dist/budibase-client.js",
"main": "dist/budibase-client.js",
@ -18,9 +18,9 @@
"dev:builder": "rollup -cw"
},
"dependencies": {
"@budibase/bbui": "^0.9.59",
"@budibase/standard-components": "^0.9.59",
"@budibase/string-templates": "^0.9.59",
"@budibase/bbui": "^0.9.63",
"@budibase/standard-components": "^0.9.63",
"@budibase/string-templates": "^0.9.63",
"regexparam": "^1.3.0",
"shortid": "^2.2.15",
"svelte-spa-router": "^3.0.5"

View File

@ -4,6 +4,11 @@ module.exports = async (url, opts) => {
function json(body, status = 200) {
return {
status,
headers: {
get: () => {
return ["application/json"]
},
},
json: async () => {
return body
},

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/server",
"email": "hi@budibase.com",
"version": "0.9.59",
"version": "0.9.63",
"description": "Budibase Web Server",
"main": "src/electron.js",
"repository": {
@ -55,9 +55,9 @@
"author": "Budibase",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@budibase/auth": "^0.9.59",
"@budibase/client": "^0.9.59",
"@budibase/string-templates": "^0.9.59",
"@budibase/auth": "^0.9.63",
"@budibase/client": "^0.9.63",
"@budibase/string-templates": "^0.9.63",
"@elastic/elasticsearch": "7.10.0",
"@koa/router": "8.0.0",
"@sendgrid/mail": "7.1.1",
@ -110,7 +110,7 @@
"devDependencies": {
"@babel/core": "^7.14.3",
"@babel/preset-env": "^7.14.4",
"@budibase/standard-components": "^0.9.59",
"@budibase/standard-components": "^0.9.63",
"@jest/test-sequencer": "^24.8.0",
"babel-jest": "^27.0.2",
"docker-compose": "^0.23.6",

View File

@ -88,6 +88,8 @@ async function checkForCronTriggers({ appId, oldAuto, newAuto }) {
async function checkForWebhooks({ appId, oldAuto, newAuto }) {
const oldTrigger = oldAuto ? oldAuto.definition.trigger : null
const newTrigger = newAuto ? newAuto.definition.trigger : null
const triggerChanged =
oldTrigger && newTrigger && oldTrigger.id !== newTrigger.id
function isWebhookTrigger(auto) {
return (
auto &&
@ -98,9 +100,10 @@ async function checkForWebhooks({ appId, oldAuto, newAuto }) {
// need to delete webhook
if (
isWebhookTrigger(oldAuto) &&
!isWebhookTrigger(newAuto) &&
(!isWebhookTrigger(newAuto) || triggerChanged) &&
oldTrigger.webhookId
) {
try {
let db = new CouchDB(appId)
// need to get the webhook to get the rev
const webhook = await db.get(oldTrigger.webhookId)
@ -114,9 +117,15 @@ async function checkForWebhooks({ appId, oldAuto, newAuto }) {
newTrigger.inputs = {}
}
await webhooks.destroy(ctx)
} catch (err) {
// don't worry about not being able to delete, if it doesn't exist all good
}
}
// need to create webhook
else if (!isWebhookTrigger(oldAuto) && isWebhookTrigger(newAuto)) {
if (
(!isWebhookTrigger(oldAuto) || triggerChanged) &&
isWebhookTrigger(newAuto)
) {
const ctx = {
appId,
request: {

View File

@ -77,14 +77,34 @@ module.exports.run = async function ({ inputs }) {
requestBody.length !== 0 &&
BODY_REQUESTS.indexOf(requestMethod) !== -1
) {
request.body = JSON.parse(requestBody)
request.body =
typeof requestBody === "string"
? requestBody
: JSON.stringify(requestBody)
request.headers = {
"Content-Type": "application/json",
}
}
try {
// do a quick JSON parse if there is a body, to generate an error if its invalid
if (request.body) {
JSON.parse(request.body)
}
const response = await fetch(url, request)
const contentType = response.headers.get("content-type")
const success = response.status === 200
let resp
if (!success) {
resp = response.statusText
} else if (contentType && contentType.indexOf("application/json") !== -1) {
resp = await response.json()
} else {
resp = await response.text()
}
return {
response: await response.json(),
success: response.status === 200,
response: resp,
success: success,
}
} catch (err) {
/* istanbul ignore next */

View File

@ -25,7 +25,7 @@ describe("test the outgoing webhook action", () => {
expect(res.success).toEqual(true)
expect(res.response.url).toEqual("http://www.test.com")
expect(res.response.method).toEqual("POST")
expect(res.response.body.a).toEqual(1)
expect(JSON.parse(res.response.body).a).toEqual(1)
})
it("should return an error if something goes wrong in fetch", async () => {

View File

@ -24,7 +24,7 @@ exports.generateRowIdField = (keyProps = []) => {
keyProps = [keyProps]
}
// this conserves order and types
return encodeURIComponent(JSON.stringify(keyProps))
return encodeURIComponent(JSON.stringify(keyProps).replace(/"/g, "'"))
}
// should always return an array

View File

@ -29,11 +29,11 @@
"keywords": [
"svelte"
],
"version": "0.9.59",
"version": "0.9.63",
"license": "MIT",
"gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc",
"dependencies": {
"@budibase/bbui": "^0.9.59",
"@budibase/bbui": "^0.9.63",
"@spectrum-css/link": "^3.1.3",
"@spectrum-css/page": "^3.0.1",
"@spectrum-css/vars": "^3.0.1",

View File

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

View File

@ -20,10 +20,13 @@ const HELPERS = [
// this help is applied to all statements
new Helper(HelperFunctionNames.ALL, value => {
// null/undefined values produce bad results
if (value == null) {
return ""
if (value == null || typeof value !== "string") {
return value || ""
}
let text = new SafeString(unescape(value).replace(/&amp;/g, "&"))
if (value && value.string) {
value = value.string
}
let text = new SafeString(value.replace(/&amp;/g, "&"))
if (text == null || typeof text !== "string") {
return text
}

View File

@ -442,4 +442,15 @@ describe("Cover a few complex use cases", () => {
const output = await processObject(input, tableJson)
expect(output.dataProvider).not.toBe("Invalid Binding")
})
it("should be able to handle external ids", async () => {
const input = {
dataProvider: "{{ literal [_id] }}",
}
const context = {
_id: "%5B%221%22%2C%221%22%5D",
}
const output = await processObject(input, context)
expect(output.dataProvider).toBe("%5B%221%22%2C%221%22%5D")
})
})

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/worker",
"email": "hi@budibase.com",
"version": "0.9.59",
"version": "0.9.63",
"description": "Budibase background service",
"main": "src/index.js",
"repository": {
@ -21,8 +21,8 @@
"author": "Budibase",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@budibase/auth": "^0.9.59",
"@budibase/string-templates": "^0.9.59",
"@budibase/auth": "^0.9.63",
"@budibase/string-templates": "^0.9.63",
"@koa/router": "^8.0.0",
"aws-sdk": "^2.811.0",
"bcryptjs": "^2.4.3",