Merge branch 'master' of github.com:Budibase/budibase into develop
This commit is contained in:
commit
e63499384c
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "0.9.59",
|
"version": "0.9.63",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"packages": [
|
"packages": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/auth",
|
"name": "@budibase/auth",
|
||||||
"version": "0.9.59",
|
"version": "0.9.63",
|
||||||
"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",
|
||||||
|
|
|
@ -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.59",
|
"version": "0.9.63",
|
||||||
"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",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/builder",
|
"name": "@budibase/builder",
|
||||||
"version": "0.9.59",
|
"version": "0.9.63",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -65,10 +65,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/bbui": "^0.9.59",
|
"@budibase/bbui": "^0.9.63",
|
||||||
"@budibase/client": "^0.9.59",
|
"@budibase/client": "^0.9.63",
|
||||||
"@budibase/colorpicker": "1.1.2",
|
"@budibase/colorpicker": "1.1.2",
|
||||||
"@budibase/string-templates": "^0.9.59",
|
"@budibase/string-templates": "^0.9.63",
|
||||||
"@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",
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
$: allowDeleteTrigger = !steps.length
|
$: allowDeleteTrigger = !steps.length
|
||||||
|
|
||||||
function deleteStep() {
|
function deleteStep() {
|
||||||
console.log("Running")
|
|
||||||
automationStore.actions.deleteAutomationBlock(block)
|
automationStore.actions.deleteAutomationBlock(block)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -16,11 +16,13 @@
|
||||||
$: automation = $automationStore.selectedAutomation?.automation
|
$: automation = $automationStore.selectedAutomation?.automation
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
// save the automation initially
|
if (!automation?.definition?.trigger?.inputs.schemaUrl) {
|
||||||
await automationStore.actions.save({
|
// save the automation initially
|
||||||
instanceId,
|
await automationStore.actions.save({
|
||||||
automation,
|
instanceId,
|
||||||
})
|
automation,
|
||||||
|
})
|
||||||
|
}
|
||||||
interval = setInterval(async () => {
|
interval = setInterval(async () => {
|
||||||
await automationStore.actions.fetch()
|
await automationStore.actions.fetch()
|
||||||
const outputs = automation?.definition?.trigger.schema.outputs?.properties
|
const outputs = automation?.definition?.trigger.schema.outputs?.properties
|
||||||
|
|
|
@ -9,6 +9,9 @@
|
||||||
$: appUrl = $hostingStore.appUrl
|
$: appUrl = $hostingStore.appUrl
|
||||||
|
|
||||||
function fullWebhookURL(uri) {
|
function fullWebhookURL(uri) {
|
||||||
|
if (!uri) {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
if (production) {
|
if (production) {
|
||||||
return `${appUrl}/${uri}`
|
return `${appUrl}/${uri}`
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/cli",
|
"name": "@budibase/cli",
|
||||||
"version": "0.9.59",
|
"version": "0.9.63",
|
||||||
"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": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/client",
|
"name": "@budibase/client",
|
||||||
"version": "0.9.59",
|
"version": "0.9.63",
|
||||||
"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",
|
||||||
|
@ -18,9 +18,9 @@
|
||||||
"dev:builder": "rollup -cw"
|
"dev:builder": "rollup -cw"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/bbui": "^0.9.59",
|
"@budibase/bbui": "^0.9.63",
|
||||||
"@budibase/standard-components": "^0.9.59",
|
"@budibase/standard-components": "^0.9.63",
|
||||||
"@budibase/string-templates": "^0.9.59",
|
"@budibase/string-templates": "^0.9.63",
|
||||||
"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"
|
||||||
|
|
|
@ -4,6 +4,11 @@ module.exports = async (url, opts) => {
|
||||||
function json(body, status = 200) {
|
function json(body, status = 200) {
|
||||||
return {
|
return {
|
||||||
status,
|
status,
|
||||||
|
headers: {
|
||||||
|
get: () => {
|
||||||
|
return ["application/json"]
|
||||||
|
},
|
||||||
|
},
|
||||||
json: async () => {
|
json: async () => {
|
||||||
return body
|
return body
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/server",
|
"name": "@budibase/server",
|
||||||
"email": "hi@budibase.com",
|
"email": "hi@budibase.com",
|
||||||
"version": "0.9.59",
|
"version": "0.9.63",
|
||||||
"description": "Budibase Web Server",
|
"description": "Budibase Web Server",
|
||||||
"main": "src/electron.js",
|
"main": "src/electron.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -55,9 +55,9 @@
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/auth": "^0.9.59",
|
"@budibase/auth": "^0.9.63",
|
||||||
"@budibase/client": "^0.9.59",
|
"@budibase/client": "^0.9.63",
|
||||||
"@budibase/string-templates": "^0.9.59",
|
"@budibase/string-templates": "^0.9.63",
|
||||||
"@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",
|
||||||
|
@ -110,7 +110,7 @@
|
||||||
"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.59",
|
"@budibase/standard-components": "^0.9.63",
|
||||||
"@jest/test-sequencer": "^24.8.0",
|
"@jest/test-sequencer": "^24.8.0",
|
||||||
"babel-jest": "^27.0.2",
|
"babel-jest": "^27.0.2",
|
||||||
"docker-compose": "^0.23.6",
|
"docker-compose": "^0.23.6",
|
||||||
|
|
|
@ -88,6 +88,8 @@ async function checkForCronTriggers({ appId, oldAuto, newAuto }) {
|
||||||
async function checkForWebhooks({ appId, oldAuto, newAuto }) {
|
async function checkForWebhooks({ appId, oldAuto, newAuto }) {
|
||||||
const oldTrigger = oldAuto ? oldAuto.definition.trigger : null
|
const oldTrigger = oldAuto ? oldAuto.definition.trigger : null
|
||||||
const newTrigger = newAuto ? newAuto.definition.trigger : null
|
const newTrigger = newAuto ? newAuto.definition.trigger : null
|
||||||
|
const triggerChanged =
|
||||||
|
oldTrigger && newTrigger && oldTrigger.id !== newTrigger.id
|
||||||
function isWebhookTrigger(auto) {
|
function isWebhookTrigger(auto) {
|
||||||
return (
|
return (
|
||||||
auto &&
|
auto &&
|
||||||
|
@ -98,25 +100,32 @@ async function checkForWebhooks({ appId, oldAuto, newAuto }) {
|
||||||
// need to delete webhook
|
// need to delete webhook
|
||||||
if (
|
if (
|
||||||
isWebhookTrigger(oldAuto) &&
|
isWebhookTrigger(oldAuto) &&
|
||||||
!isWebhookTrigger(newAuto) &&
|
(!isWebhookTrigger(newAuto) || triggerChanged) &&
|
||||||
oldTrigger.webhookId
|
oldTrigger.webhookId
|
||||||
) {
|
) {
|
||||||
let db = new CouchDB(appId)
|
try {
|
||||||
// need to get the webhook to get the rev
|
let db = new CouchDB(appId)
|
||||||
const webhook = await db.get(oldTrigger.webhookId)
|
// need to get the webhook to get the rev
|
||||||
const ctx = {
|
const webhook = await db.get(oldTrigger.webhookId)
|
||||||
appId,
|
const ctx = {
|
||||||
params: { id: webhook._id, rev: webhook._rev },
|
appId,
|
||||||
|
params: { id: webhook._id, rev: webhook._rev },
|
||||||
|
}
|
||||||
|
// might be updating - reset the inputs to remove the URLs
|
||||||
|
if (newTrigger) {
|
||||||
|
delete newTrigger.webhookId
|
||||||
|
newTrigger.inputs = {}
|
||||||
|
}
|
||||||
|
await webhooks.destroy(ctx)
|
||||||
|
} catch (err) {
|
||||||
|
// don't worry about not being able to delete, if it doesn't exist all good
|
||||||
}
|
}
|
||||||
// might be updating - reset the inputs to remove the URLs
|
|
||||||
if (newTrigger) {
|
|
||||||
delete newTrigger.webhookId
|
|
||||||
newTrigger.inputs = {}
|
|
||||||
}
|
|
||||||
await webhooks.destroy(ctx)
|
|
||||||
}
|
}
|
||||||
// need to create webhook
|
// need to create webhook
|
||||||
else if (!isWebhookTrigger(oldAuto) && isWebhookTrigger(newAuto)) {
|
if (
|
||||||
|
(!isWebhookTrigger(oldAuto) || triggerChanged) &&
|
||||||
|
isWebhookTrigger(newAuto)
|
||||||
|
) {
|
||||||
const ctx = {
|
const ctx = {
|
||||||
appId,
|
appId,
|
||||||
request: {
|
request: {
|
||||||
|
|
|
@ -77,14 +77,34 @@ module.exports.run = async function ({ inputs }) {
|
||||||
requestBody.length !== 0 &&
|
requestBody.length !== 0 &&
|
||||||
BODY_REQUESTS.indexOf(requestMethod) !== -1
|
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 {
|
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 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 {
|
return {
|
||||||
response: await response.json(),
|
response: resp,
|
||||||
success: response.status === 200,
|
success: success,
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
|
|
|
@ -25,7 +25,7 @@ describe("test the outgoing webhook action", () => {
|
||||||
expect(res.success).toEqual(true)
|
expect(res.success).toEqual(true)
|
||||||
expect(res.response.url).toEqual("http://www.test.com")
|
expect(res.response.url).toEqual("http://www.test.com")
|
||||||
expect(res.response.method).toEqual("POST")
|
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 () => {
|
it("should return an error if something goes wrong in fetch", async () => {
|
||||||
|
|
|
@ -24,7 +24,7 @@ exports.generateRowIdField = (keyProps = []) => {
|
||||||
keyProps = [keyProps]
|
keyProps = [keyProps]
|
||||||
}
|
}
|
||||||
// this conserves order and types
|
// this conserves order and types
|
||||||
return encodeURIComponent(JSON.stringify(keyProps))
|
return encodeURIComponent(JSON.stringify(keyProps).replace(/"/g, "'"))
|
||||||
}
|
}
|
||||||
|
|
||||||
// should always return an array
|
// should always return an array
|
||||||
|
|
|
@ -29,11 +29,11 @@
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"svelte"
|
"svelte"
|
||||||
],
|
],
|
||||||
"version": "0.9.59",
|
"version": "0.9.63",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc",
|
"gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/bbui": "^0.9.59",
|
"@budibase/bbui": "^0.9.63",
|
||||||
"@spectrum-css/link": "^3.1.3",
|
"@spectrum-css/link": "^3.1.3",
|
||||||
"@spectrum-css/page": "^3.0.1",
|
"@spectrum-css/page": "^3.0.1",
|
||||||
"@spectrum-css/vars": "^3.0.1",
|
"@spectrum-css/vars": "^3.0.1",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/string-templates",
|
"name": "@budibase/string-templates",
|
||||||
"version": "0.9.59",
|
"version": "0.9.63",
|
||||||
"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",
|
||||||
|
|
|
@ -20,10 +20,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 => {
|
||||||
// null/undefined values produce bad results
|
// null/undefined values produce bad results
|
||||||
if (value == null) {
|
if (value == null || typeof value !== "string") {
|
||||||
return ""
|
return value || ""
|
||||||
}
|
}
|
||||||
let text = new SafeString(unescape(value).replace(/&/g, "&"))
|
if (value && value.string) {
|
||||||
|
value = value.string
|
||||||
|
}
|
||||||
|
let text = new SafeString(value.replace(/&/g, "&"))
|
||||||
if (text == null || typeof text !== "string") {
|
if (text == null || typeof text !== "string") {
|
||||||
return text
|
return text
|
||||||
}
|
}
|
||||||
|
|
|
@ -442,4 +442,15 @@ describe("Cover a few complex use cases", () => {
|
||||||
const output = await processObject(input, tableJson)
|
const output = await processObject(input, tableJson)
|
||||||
expect(output.dataProvider).not.toBe("Invalid Binding")
|
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")
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/worker",
|
"name": "@budibase/worker",
|
||||||
"email": "hi@budibase.com",
|
"email": "hi@budibase.com",
|
||||||
"version": "0.9.59",
|
"version": "0.9.63",
|
||||||
"description": "Budibase background service",
|
"description": "Budibase background service",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -21,8 +21,8 @@
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/auth": "^0.9.59",
|
"@budibase/auth": "^0.9.63",
|
||||||
"@budibase/string-templates": "^0.9.59",
|
"@budibase/string-templates": "^0.9.63",
|
||||||
"@koa/router": "^8.0.0",
|
"@koa/router": "^8.0.0",
|
||||||
"aws-sdk": "^2.811.0",
|
"aws-sdk": "^2.811.0",
|
||||||
"bcryptjs": "^2.4.3",
|
"bcryptjs": "^2.4.3",
|
||||||
|
|
Loading…
Reference in New Issue