merge with master

This commit is contained in:
Martin McKeaveney 2022-10-31 13:44:23 +00:00
commit c2966025b4
28 changed files with 213 additions and 85 deletions

View File

@ -1,5 +1,5 @@
{
"version": "2.0.34-alpha.10",
"version": "2.0.39",
"npmClient": "yarn",
"packages": [
"packages/*"

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/backend-core",
"version": "2.0.34-alpha.10",
"version": "2.0.39",
"description": "Budibase backend core libraries used in server and worker",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
@ -20,7 +20,7 @@
"test:watch": "jest --watchAll"
},
"dependencies": {
"@budibase/types": "2.0.34-alpha.10",
"@budibase/types": "^2.0.39",
"@shopify/jest-koa-mocks": "5.0.1",
"@techpass/passport-openidconnect": "0.3.2",
"aws-sdk": "2.1030.0",

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/bbui",
"description": "A UI solution used in the different Budibase projects.",
"version": "2.0.34-alpha.10",
"version": "2.0.39",
"license": "MPL-2.0",
"svelte": "src/index.js",
"module": "dist/bbui.es.js",
@ -38,7 +38,7 @@
],
"dependencies": {
"@adobe/spectrum-css-workflow-icons": "^1.2.1",
"@budibase/string-templates": "2.0.34-alpha.10",
"@budibase/string-templates": "^2.0.39",
"@spectrum-css/actionbutton": "^1.0.1",
"@spectrum-css/actiongroup": "^1.0.1",
"@spectrum-css/avatar": "^3.0.2",

View File

@ -139,7 +139,7 @@
{#if open}
<div
use:clickOutside={handleOutsideClick}
transition:fly={{ y: -20, duration: 200 }}
transition:fly|local={{ y: -20, duration: 200 }}
class="spectrum-Popover spectrum-Popover--bottom spectrum-Picker-popover is-open"
class:spectrum-Popover--align-right={alignRight}
>

View File

@ -1,6 +1,6 @@
<script>
import Picker from "./Picker.svelte"
import { createEventDispatcher } from "svelte"
import { createEventDispatcher, onMount } from "svelte"
export let value = []
export let id = null
@ -16,8 +16,33 @@
export let autoWidth = false
const dispatch = createEventDispatcher()
const parseValues = value => {
return Array.isArray(value)
? value.reduce((acc, entry) => {
if (typeof ele === "string" && entry.trim() === "") {
return acc
}
let processedOption = String(entry)
if (options.indexOf(processedOption) > -1) {
acc.push(processedOption)
}
return acc
}, [])
: []
}
let loaded = false
$: combinedValues = value ? [...value].concat(options) : []
$: superSet = new Set(combinedValues)
$: if (loaded && options.length != superSet.size) {
// ensure that the values being pushed in are valid.
dispatch("change", parseValues(value))
}
$: selectedLookupMap = getSelectedLookupMap(value)
$: optionLookupMap = getOptionLookupMap(options)
$: fieldText = getFieldText(value, optionLookupMap, placeholder)
$: isOptionSelected = optionValue => selectedLookupMap[optionValue] === true
$: toggleOption = makeToggleOption(selectedLookupMap, value)
@ -70,6 +95,10 @@
}
}
}
onMount(() => {
loaded = true
})
</script>
<Picker

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/builder",
"version": "2.0.34-alpha.10",
"version": "2.0.39",
"license": "GPL-3.0",
"private": true,
"scripts": {
@ -71,10 +71,10 @@
}
},
"dependencies": {
"@budibase/bbui": "2.0.34-alpha.10",
"@budibase/client": "2.0.34-alpha.10",
"@budibase/frontend-core": "2.0.34-alpha.10",
"@budibase/string-templates": "2.0.34-alpha.10",
"@budibase/bbui": "^2.0.39",
"@budibase/client": "^2.0.39",
"@budibase/frontend-core": "^2.0.39",
"@budibase/string-templates": "^2.0.39",
"@sentry/browser": "5.19.1",
"@spectrum-css/page": "^3.0.1",
"@spectrum-css/vars": "^3.0.1",

View File

@ -7,7 +7,7 @@
export let webhookModal
</script>
<div class="title">
<div class="nav">
<Tabs selected="Automations">
<Tab title="Automations">
<AutomationList />
@ -27,12 +27,15 @@
top: var(--spacing-l);
right: var(--spacing-xl);
}
.title {
.nav {
overflow-y: auto;
background: var(--background);
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: stretch;
position: relative;
border-right: var(--border-light);
padding-bottom: 60px;
}
</style>

View File

@ -120,7 +120,7 @@
allSteps[idx]?.stepId === ActionStepID.LOOP &&
allSteps.find(x => x.blockToLoop === block.id)
// If the previous block was a loop block, decerement the index so the following
// If the previous block was a loop block, decrement the index so the following
// steps are in the correct order
if (wasLoopBlock) {
loopBlockCount++

View File

@ -14,6 +14,12 @@
export let block
export let isTestModal
$: parsedBindings = bindings.map(binding => {
let clone = Object.assign({}, binding)
clone.icon = "ShareAndroid"
return clone
})
let table
let schemaFields
@ -79,6 +85,10 @@
return [value]
}
if (type === "json") {
return value.value
}
return value
}
@ -109,7 +119,7 @@
{isTestModal}
{field}
{schema}
{bindings}
bindings={parsedBindings}
{value}
{onChange}
/>
@ -124,7 +134,7 @@
on:change={e => onChange(e, field, schema.type)}
label={field}
type="string"
{bindings}
bindings={parsedBindings}
fillWidth={true}
allowJS={true}
updateOnChange={false}

View File

@ -5,11 +5,13 @@
DatePicker,
Multiselect,
TextArea,
Label,
} from "@budibase/bbui"
import LinkedRowSelector from "components/common/LinkedRowSelector.svelte"
import DrawerBindableInput from "../../common/bindings/DrawerBindableInput.svelte"
import ModalBindableInput from "../../common/bindings/ModalBindableInput.svelte"
import AutomationBindingPanel from "../../common/bindings/ServerBindingPanel.svelte"
import Editor from "components/integration/QueryEditor.svelte"
export let onChange
export let field
@ -18,6 +20,12 @@
export let bindings
export let isTestModal
$: parsedBindings = bindings.map(binding => {
let clone = Object.assign({}, binding)
clone.icon = "ShareAndroid"
return clone
})
function schemaHasOptions(schema) {
return !!schema.constraints?.inclusion?.length
}
@ -50,6 +58,20 @@
/>
{:else if schema.type === "longform"}
<TextArea label={field} bind:value={value[field]} />
{:else if schema.type === "json"}
<span>
<Label>{field}</Label>
<Editor
editorHeight="150"
mode="json"
on:change={e => {
if (e.detail?.value !== value[field]) {
onChange(e, field, schema.type)
}
}}
value={value[field]}
/>
</span>
{:else if schema.type === "link"}
<LinkedRowSelector bind:linkedRows={value[field]} {schema} />
{:else if schema.type === "string" || schema.type === "number"}
@ -60,7 +82,7 @@
on:change={e => onChange(e, field)}
label={field}
type="string"
{bindings}
bindings={parsedBindings}
fillWidth={true}
allowJS={true}
updateOnChange={false}

View File

@ -70,7 +70,11 @@
.map(([key, error]) => ({ dataPath: key, message: error }))
.flat()
}
} else if (error.status === 400) {
} else if (error.status === 400 && response?.validationErrors) {
errors = Object.keys(response.validationErrors).map(field => ({
message: `${field} ${response.validationErrors[field][0]}`,
}))
} else {
errors = [{ message: response?.message || "Unknown error" }]
}
} else {

View File

@ -247,7 +247,7 @@
return
}
hoverTarget = {
title: binding.display?.name || binding.fieldSchema.name,
title: binding.display?.name || binding.fieldSchema?.name,
description: binding.description,
}
popover.show()

View File

@ -305,6 +305,9 @@
getOptionLabel={x => x}
getOptionValue={x => x}
value={rule.value}
on:change={e => {
rule.value = e.detail
}}
/>
{:else if rule.type === "boolean"}
<Select

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/cli",
"version": "2.0.34-alpha.10",
"version": "2.0.39",
"description": "Budibase CLI, for developers, self hosting and migrations.",
"main": "src/index.js",
"bin": {
@ -26,9 +26,9 @@
"outputPath": "build"
},
"dependencies": {
"@budibase/backend-core": "2.0.34-alpha.10",
"@budibase/string-templates": "2.0.34-alpha.10",
"@budibase/types": "2.0.34-alpha.10",
"@budibase/backend-core": "^2.0.39",
"@budibase/string-templates": "^2.0.39",
"@budibase/types": "^2.0.39",
"axios": "0.21.2",
"chalk": "4.1.0",
"cli-progress": "3.11.2",

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/client",
"version": "2.0.34-alpha.10",
"version": "2.0.39",
"license": "MPL-2.0",
"module": "dist/budibase-client.js",
"main": "dist/budibase-client.js",
@ -19,9 +19,9 @@
"dev:builder": "rollup -cw"
},
"dependencies": {
"@budibase/bbui": "2.0.34-alpha.10",
"@budibase/frontend-core": "2.0.34-alpha.10",
"@budibase/string-templates": "2.0.34-alpha.10",
"@budibase/bbui": "^2.0.39",
"@budibase/frontend-core": "^2.0.39",
"@budibase/string-templates": "^2.0.39",
"@spectrum-css/button": "^3.0.3",
"@spectrum-css/card": "^3.0.3",
"@spectrum-css/divider": "^1.0.3",

View File

@ -32,6 +32,7 @@
validation,
formStep
)
$: schemaType = fieldSchema?.type !== "formula" ? fieldSchema?.type : "string"
// Focus label when editing

View File

@ -143,6 +143,7 @@
// Create validation function based on field schema
const schemaConstraints = schema?.[field]?.constraints
const validator = disableValidation
? null
: createValidatorFromConstraints(

View File

@ -1,12 +1,12 @@
{
"name": "@budibase/frontend-core",
"version": "2.0.34-alpha.10",
"version": "2.0.39",
"description": "Budibase frontend core libraries used in builder and client",
"author": "Budibase",
"license": "MPL-2.0",
"svelte": "src/index.js",
"dependencies": {
"@budibase/bbui": "2.0.34-alpha.10",
"@budibase/bbui": "^2.0.39",
"lodash": "^4.17.21",
"svelte": "^3.46.2"
}

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/sdk",
"version": "2.0.34-alpha.10",
"version": "2.0.39",
"description": "Budibase Public API SDK",
"author": "Budibase",
"license": "MPL-2.0",

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/server",
"email": "hi@budibase.com",
"version": "2.0.34-alpha.10",
"version": "2.0.39",
"description": "Budibase Web Server",
"main": "src/index.ts",
"repository": {
@ -77,11 +77,11 @@
"license": "GPL-3.0",
"dependencies": {
"@apidevtools/swagger-parser": "10.0.3",
"@budibase/backend-core": "2.0.34-alpha.10",
"@budibase/client": "2.0.34-alpha.10",
"@budibase/pro": "2.0.34-alpha.10",
"@budibase/string-templates": "2.0.34-alpha.10",
"@budibase/types": "2.0.34-alpha.10",
"@budibase/backend-core": "^2.0.39",
"@budibase/client": "^2.0.39",
"@budibase/pro": "2.0.39",
"@budibase/string-templates": "^2.0.39",
"@budibase/types": "^2.0.39",
"@bull-board/api": "3.7.0",
"@bull-board/koa": "3.9.4",
"@elastic/elasticsearch": "7.10.0",

View File

@ -1,5 +1,4 @@
const {
findHBSBlocks,
decodeJSBinding,
isJSBinding,
encodeJSBinding,
@ -82,24 +81,34 @@ exports.getError = err => {
}
exports.substituteLoopStep = (hbsString, substitute) => {
let blocks = []
let checkForJS = isJSBinding(hbsString)
let substitutedHbsString = ""
let open = checkForJS ? `$("` : "{{"
let closed = checkForJS ? `")` : "}}"
if (checkForJS) {
hbsString = decodeJSBinding(hbsString)
blocks.push(hbsString)
} else {
blocks = findHBSBlocks(hbsString)
}
for (let block of blocks) {
block = block.replace(/loop/, substitute)
if (checkForJS) {
hbsString = encodeJSBinding(block)
} else {
hbsString = block
let pointer = 0,
openPointer = 0,
closedPointer = 0
while (pointer < hbsString.length) {
openPointer = hbsString.indexOf(open, pointer)
closedPointer = hbsString.indexOf(closed, pointer) + 2
if (openPointer < 0 || closedPointer < 0) {
substitutedHbsString += hbsString.substring(pointer)
break
}
let before = hbsString.substring(pointer, openPointer)
let block = hbsString
.substring(openPointer, closedPointer)
.replace(/loop/, substitute)
substitutedHbsString += before + block
pointer = closedPointer
}
return hbsString
if (checkForJS) {
substitutedHbsString = encodeJSBinding(substitutedHbsString)
}
return substitutedHbsString
}
exports.stringSplit = value => {

View File

@ -0,0 +1,17 @@
const automationUtils = require("../automationUtils")
describe("automationUtils", () => {
test("substituteLoopStep should allow multiple loop binding substitutes", () => {
expect(automationUtils.substituteLoopStep(
`{{ loop.currentItem._id }} {{ loop.currentItem._id }} {{ loop.currentItem._id }}`,
"step.2"))
.toBe(`{{ step.2.currentItem._id }} {{ step.2.currentItem._id }} {{ step.2.currentItem._id }}`)
})
test("substituteLoopStep should handle not subsituting outside of curly braces", () => {
expect(automationUtils.substituteLoopStep(
`loop {{ loop.currentItem._id }}loop loop{{ loop.currentItem._id }}loop`,
"step.2"))
.toBe(`loop {{ step.2.currentItem._id }}loop loop{{ step.2.currentItem._id }}loop`)
})
})

View File

@ -1094,12 +1094,21 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
<<<<<<< HEAD
"@budibase/backend-core@2.0.34-alpha.10":
version "2.0.34-alpha.10"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.0.34-alpha.10.tgz#ee3e3f0b76001e15ecb26a9ed54afba779dbc190"
integrity sha512-cXTZ5q6s5eacfdMtZ/XABTLnVjj6dvbmeSM07wzDTvlIvYzUH5FpU/Vk1atZybeyank/7ttAzGI7LTs6Kz1e3g==
dependencies:
"@budibase/types" "2.0.34-alpha.10"
=======
"@budibase/backend-core@2.0.39":
version "2.0.39"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.0.39.tgz#7b09d664763fe11177160e3f3f868163851ca100"
integrity sha512-vtWJXyxq+GsLiPF0le9yCTvd9kFRlyUXOpMZqwdM8f5M095lU3ZqK4PYScrtRaOSeQ9LO0u5yrSdG9pFZ5vPCw==
dependencies:
"@budibase/types" "^2.0.39"
>>>>>>> 51d5c60b955f6de5805545ee295b834f2fa8b657
"@shopify/jest-koa-mocks" "5.0.1"
"@techpass/passport-openidconnect" "0.3.2"
aws-sdk "2.1030.0"
@ -1181,6 +1190,7 @@
svelte-flatpickr "^3.2.3"
svelte-portal "^1.0.0"
<<<<<<< HEAD
"@budibase/pro@2.0.34-alpha.10":
version "2.0.34-alpha.10"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.0.34-alpha.10.tgz#0ec55bd5b34c495dcb35853972e7a4e66967c8e1"
@ -1188,6 +1198,15 @@
dependencies:
"@budibase/backend-core" "2.0.34-alpha.10"
"@budibase/types" "2.0.34-alpha.10"
=======
"@budibase/pro@2.0.39":
version "2.0.39"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.0.39.tgz#0830b531d2b3751fbda70320889991bff8495b64"
integrity sha512-mNowoCtot6OOntc+XgSUR9G0cILxIBWzyKmXSxa1IwnlLThCK3ZtOjc9m2BpxRRs8SOkAyPWyBezuWi82x0tEw==
dependencies:
"@budibase/backend-core" "2.0.39"
"@budibase/types" "2.0.39"
>>>>>>> 51d5c60b955f6de5805545ee295b834f2fa8b657
"@koa/router" "8.0.8"
bull "4.10.1"
joi "17.6.0"
@ -1211,10 +1230,17 @@
svelte-apexcharts "^1.0.2"
svelte-flatpickr "^3.1.0"
<<<<<<< HEAD
"@budibase/types@2.0.34-alpha.10":
version "2.0.34-alpha.10"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.0.34-alpha.10.tgz#6a16d4fd97136de58acbe62319b03c7144a6fb44"
integrity sha512-zD1dZ/KGw9xbTL0AntenEkLxYIhtKiL72qgDLKQTA9kLjme1ePECealqmmQjPsf3Zj694MNN6PjSJ00C51CVNg==
=======
"@budibase/types@2.0.39", "@budibase/types@^2.0.39":
version "2.0.39"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.0.39.tgz#dd6580367e08175fbe18152ac7bf0a59937eab79"
integrity sha512-FTp4If33Q8a112jTtPjjVQwZj9xLe15781mjgBKQI76+lNLxeRVMIe7QU/Pq3qPc4uJl8MpNlY2ZXhd9XA5y4g==
>>>>>>> 51d5c60b955f6de5805545ee295b834f2fa8b657
"@bull-board/api@3.7.0":
version "3.7.0"

View File

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

View File

@ -323,6 +323,9 @@ module.exports.doesContainStrings = (template, strings) => {
* @return {string[]} The found HBS blocks.
*/
module.exports.findHBSBlocks = string => {
if (!string || typeof string !== "string") {
return []
}
let regexp = new RegExp(FIND_ANY_HBS_REGEX)
let matches = string.match(regexp)
if (matches == null) {

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/types",
"version": "2.0.34-alpha.10",
"version": "2.0.39",
"description": "Budibase types",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/worker",
"email": "hi@budibase.com",
"version": "2.0.34-alpha.10",
"version": "2.0.39",
"description": "Budibase background service",
"main": "src/index.ts",
"repository": {
@ -36,10 +36,10 @@
"author": "Budibase",
"license": "GPL-3.0",
"dependencies": {
"@budibase/backend-core": "2.0.34-alpha.10",
"@budibase/pro": "2.0.34-alpha.10",
"@budibase/string-templates": "2.0.34-alpha.10",
"@budibase/types": "2.0.34-alpha.10",
"@budibase/backend-core": "^2.0.39",
"@budibase/pro": "2.0.39",
"@budibase/string-templates": "^2.0.39",
"@budibase/types": "^2.0.39",
"@koa/router": "8.0.8",
"@sentry/node": "6.17.7",
"@techpass/passport-openidconnect": "0.3.2",

View File

@ -291,12 +291,12 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@budibase/backend-core@2.0.34-alpha.10":
version "2.0.34-alpha.10"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.0.34-alpha.10.tgz#ee3e3f0b76001e15ecb26a9ed54afba779dbc190"
integrity sha512-cXTZ5q6s5eacfdMtZ/XABTLnVjj6dvbmeSM07wzDTvlIvYzUH5FpU/Vk1atZybeyank/7ttAzGI7LTs6Kz1e3g==
"@budibase/backend-core@2.0.39":
version "2.0.39"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.0.39.tgz#7b09d664763fe11177160e3f3f868163851ca100"
integrity sha512-vtWJXyxq+GsLiPF0le9yCTvd9kFRlyUXOpMZqwdM8f5M095lU3ZqK4PYScrtRaOSeQ9LO0u5yrSdG9pFZ5vPCw==
dependencies:
"@budibase/types" "2.0.34-alpha.10"
"@budibase/types" "^2.0.39"
"@shopify/jest-koa-mocks" "5.0.1"
"@techpass/passport-openidconnect" "0.3.2"
aws-sdk "2.1030.0"
@ -328,22 +328,22 @@
uuid "8.3.2"
zlib "1.0.5"
"@budibase/pro@2.0.34-alpha.10":
version "2.0.34-alpha.10"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.0.34-alpha.10.tgz#0ec55bd5b34c495dcb35853972e7a4e66967c8e1"
integrity sha512-R1esoxSwYRlEtM3C5uobBP4l0yc4uM1h+kfonsrHXr9/HvQkOyu76JURZFHSEkdHUFqerAZ7a1AE6Z7xCTamQw==
"@budibase/pro@2.0.39":
version "2.0.39"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.0.39.tgz#0830b531d2b3751fbda70320889991bff8495b64"
integrity sha512-mNowoCtot6OOntc+XgSUR9G0cILxIBWzyKmXSxa1IwnlLThCK3ZtOjc9m2BpxRRs8SOkAyPWyBezuWi82x0tEw==
dependencies:
"@budibase/backend-core" "2.0.34-alpha.10"
"@budibase/types" "2.0.34-alpha.10"
"@budibase/backend-core" "2.0.39"
"@budibase/types" "2.0.39"
"@koa/router" "8.0.8"
bull "4.10.1"
joi "17.6.0"
node-fetch "^2.6.1"
"@budibase/types@2.0.34-alpha.10":
version "2.0.34-alpha.10"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.0.34-alpha.10.tgz#6a16d4fd97136de58acbe62319b03c7144a6fb44"
integrity sha512-zD1dZ/KGw9xbTL0AntenEkLxYIhtKiL72qgDLKQTA9kLjme1ePECealqmmQjPsf3Zj694MNN6PjSJ00C51CVNg==
"@budibase/types@2.0.39", "@budibase/types@^2.0.39":
version "2.0.39"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.0.39.tgz#dd6580367e08175fbe18152ac7bf0a59937eab79"
integrity sha512-FTp4If33Q8a112jTtPjjVQwZj9xLe15781mjgBKQI76+lNLxeRVMIe7QU/Pq3qPc4uJl8MpNlY2ZXhd9XA5y4g==
"@cspotcode/source-map-consumer@0.8.0":
version "0.8.0"