Merge branch 'develop' into bug/sev3/automation-mysql-id-relationship-uri-decode
This commit is contained in:
commit
64eff3bab5
38 changed files with 273 additions and 162 deletions
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "2.0.34-alpha.7",
|
||||
"version": "2.0.40-alpha.0",
|
||||
"npmClient": "yarn",
|
||||
"packages": [
|
||||
"packages/*"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/backend-core",
|
||||
"version": "2.0.34-alpha.7",
|
||||
"version": "2.0.40-alpha.0",
|
||||
"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.7",
|
||||
"@budibase/types": "2.0.40-alpha.0",
|
||||
"@shopify/jest-koa-mocks": "5.0.1",
|
||||
"@techpass/passport-openidconnect": "0.3.2",
|
||||
"aws-sdk": "2.1030.0",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@budibase/bbui",
|
||||
"description": "A UI solution used in the different Budibase projects.",
|
||||
"version": "2.0.34-alpha.7",
|
||||
"version": "2.0.40-alpha.0",
|
||||
"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.7",
|
||||
"@budibase/string-templates": "2.0.40-alpha.0",
|
||||
"@spectrum-css/actionbutton": "^1.0.1",
|
||||
"@spectrum-css/actiongroup": "^1.0.1",
|
||||
"@spectrum-css/avatar": "^3.0.2",
|
||||
|
|
|
@ -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}
|
||||
>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/builder",
|
||||
"version": "2.0.34-alpha.7",
|
||||
"version": "2.0.40-alpha.0",
|
||||
"license": "GPL-3.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
@ -71,10 +71,10 @@
|
|||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@budibase/bbui": "2.0.34-alpha.7",
|
||||
"@budibase/client": "2.0.34-alpha.7",
|
||||
"@budibase/frontend-core": "2.0.34-alpha.7",
|
||||
"@budibase/string-templates": "2.0.34-alpha.7",
|
||||
"@budibase/bbui": "2.0.40-alpha.0",
|
||||
"@budibase/client": "2.0.40-alpha.0",
|
||||
"@budibase/frontend-core": "2.0.40-alpha.0",
|
||||
"@budibase/string-templates": "2.0.40-alpha.0",
|
||||
"@sentry/browser": "5.19.1",
|
||||
"@spectrum-css/page": "^3.0.1",
|
||||
"@spectrum-css/vars": "^3.0.1",
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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++
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -28,15 +28,13 @@ export const createValidationStore = () => {
|
|||
let propertyValidator
|
||||
switch (type) {
|
||||
case "number":
|
||||
propertyValidator = number().transform(value =>
|
||||
isNaN(value) ? undefined : value
|
||||
)
|
||||
propertyValidator = number().nullable()
|
||||
break
|
||||
case "email":
|
||||
propertyValidator = string().email()
|
||||
propertyValidator = string().email().nullable()
|
||||
break
|
||||
default:
|
||||
propertyValidator = string()
|
||||
propertyValidator = string().nullable()
|
||||
}
|
||||
|
||||
if (required) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/cli",
|
||||
"version": "2.0.34-alpha.7",
|
||||
"version": "2.0.40-alpha.0",
|
||||
"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.7",
|
||||
"@budibase/string-templates": "2.0.34-alpha.7",
|
||||
"@budibase/types": "2.0.34-alpha.7",
|
||||
"@budibase/backend-core": "2.0.40-alpha.0",
|
||||
"@budibase/string-templates": "2.0.40-alpha.0",
|
||||
"@budibase/types": "2.0.40-alpha.0",
|
||||
"axios": "0.21.2",
|
||||
"chalk": "4.1.0",
|
||||
"cli-progress": "3.11.2",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/client",
|
||||
"version": "2.0.34-alpha.7",
|
||||
"version": "2.0.40-alpha.0",
|
||||
"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.7",
|
||||
"@budibase/frontend-core": "2.0.34-alpha.7",
|
||||
"@budibase/string-templates": "2.0.34-alpha.7",
|
||||
"@budibase/bbui": "2.0.40-alpha.0",
|
||||
"@budibase/frontend-core": "2.0.40-alpha.0",
|
||||
"@budibase/string-templates": "2.0.40-alpha.0",
|
||||
"@spectrum-css/button": "^3.0.3",
|
||||
"@spectrum-css/card": "^3.0.3",
|
||||
"@spectrum-css/divider": "^1.0.3",
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
validation,
|
||||
formStep
|
||||
)
|
||||
|
||||
$: schemaType = fieldSchema?.type !== "formula" ? fieldSchema?.type : "string"
|
||||
|
||||
// Focus label when editing
|
||||
|
|
|
@ -143,6 +143,7 @@
|
|||
|
||||
// Create validation function based on field schema
|
||||
const schemaConstraints = schema?.[field]?.constraints
|
||||
|
||||
const validator = disableValidation
|
||||
? null
|
||||
: createValidatorFromConstraints(
|
||||
|
|
|
@ -671,9 +671,15 @@ has@^1.0.3:
|
|||
function-bind "^1.1.1"
|
||||
|
||||
html5-qrcode@^2.2.1:
|
||||
<<<<<<< HEAD
|
||||
version "2.2.4"
|
||||
resolved "https://registry.yarnpkg.com/html5-qrcode/-/html5-qrcode-2.2.4.tgz#99e4b36fbd8fbc4956036cf3f21ea3e98c3463d1"
|
||||
integrity sha512-X8wVVsHpNb35tl7KcoCGAboc6Nep2VyT3CIMjFvrfWrHbHTC0yYTjE+DhO/VcswY2MfHy1uB7b1G9+L13gM6dQ==
|
||||
=======
|
||||
version "2.2.3"
|
||||
resolved "https://registry.yarnpkg.com/html5-qrcode/-/html5-qrcode-2.2.3.tgz#5acb826860365e7c7ab91e1e14528ea16a502e8a"
|
||||
integrity sha512-9CtEz5FVT56T76entiQxyrASzBWl8Rm30NHiQH8T163Eml5LS14BoZlYel9igxbikOt7O8KhvrT3awN1Y2HMqw==
|
||||
>>>>>>> 50f0a0509d79dcee7a0f12608054279d65662b10
|
||||
|
||||
htmlparser2@^6.0.0:
|
||||
version "6.1.0"
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@budibase/frontend-core",
|
||||
"version": "2.0.34-alpha.7",
|
||||
"version": "2.0.40-alpha.0",
|
||||
"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.7",
|
||||
"@budibase/bbui": "2.0.40-alpha.0",
|
||||
"lodash": "^4.17.21",
|
||||
"svelte": "^3.46.2"
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/sdk",
|
||||
"version": "2.0.34-alpha.7",
|
||||
"version": "2.0.40-alpha.0",
|
||||
"description": "Budibase Public API SDK",
|
||||
"author": "Budibase",
|
||||
"license": "MPL-2.0",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@budibase/server",
|
||||
"email": "hi@budibase.com",
|
||||
"version": "2.0.34-alpha.7",
|
||||
"version": "2.0.40-alpha.0",
|
||||
"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.7",
|
||||
"@budibase/client": "2.0.34-alpha.7",
|
||||
"@budibase/pro": "2.0.34-alpha.7",
|
||||
"@budibase/string-templates": "2.0.34-alpha.7",
|
||||
"@budibase/types": "2.0.34-alpha.7",
|
||||
"@budibase/backend-core": "2.0.40-alpha.0",
|
||||
"@budibase/client": "2.0.40-alpha.0",
|
||||
"@budibase/pro": "2.0.40-alpha.0",
|
||||
"@budibase/string-templates": "2.0.40-alpha.0",
|
||||
"@budibase/types": "2.0.40-alpha.0",
|
||||
"@bull-board/api": "3.7.0",
|
||||
"@bull-board/koa": "3.9.4",
|
||||
"@elastic/elasticsearch": "7.10.0",
|
||||
|
|
|
@ -58,52 +58,35 @@ export const save = async (ctx: any) => {
|
|||
if (body && body._id) {
|
||||
return patch(ctx)
|
||||
}
|
||||
try {
|
||||
const { row, table } = await quotas.addRow(() =>
|
||||
quotas.addQuery(() => pickApi(tableId).save(ctx), {
|
||||
datasourceId: tableId,
|
||||
})
|
||||
)
|
||||
ctx.status = 200
|
||||
ctx.eventEmitter && ctx.eventEmitter.emitRow(`row:save`, appId, row, table)
|
||||
ctx.message = `${table.name} saved successfully`
|
||||
ctx.body = row
|
||||
} catch (err) {
|
||||
ctx.throw(400, err)
|
||||
}
|
||||
}
|
||||
|
||||
export async function fetchView(ctx: any) {
|
||||
const tableId = getTableId(ctx)
|
||||
try {
|
||||
ctx.body = await quotas.addQuery(() => pickApi(tableId).fetchView(ctx), {
|
||||
const { row, table } = await quotas.addRow(() =>
|
||||
quotas.addQuery(() => pickApi(tableId).save(ctx), {
|
||||
datasourceId: tableId,
|
||||
})
|
||||
} catch (err) {
|
||||
ctx.throw(400, err)
|
||||
}
|
||||
)
|
||||
ctx.status = 200
|
||||
ctx.eventEmitter && ctx.eventEmitter.emitRow(`row:save`, appId, row, table)
|
||||
ctx.message = `${table.name} saved successfully`
|
||||
ctx.body = row
|
||||
}
|
||||
export async function fetchView(ctx: any) {
|
||||
const tableId = getTableId(ctx)
|
||||
ctx.body = await quotas.addQuery(() => pickApi(tableId).fetchView(ctx), {
|
||||
datasourceId: tableId,
|
||||
})
|
||||
}
|
||||
|
||||
export async function fetch(ctx: any) {
|
||||
const tableId = getTableId(ctx)
|
||||
try {
|
||||
ctx.body = await quotas.addQuery(() => pickApi(tableId).fetch(ctx), {
|
||||
datasourceId: tableId,
|
||||
})
|
||||
} catch (err) {
|
||||
ctx.throw(400, err)
|
||||
}
|
||||
ctx.body = await quotas.addQuery(() => pickApi(tableId).fetch(ctx), {
|
||||
datasourceId: tableId,
|
||||
})
|
||||
}
|
||||
|
||||
export async function find(ctx: any) {
|
||||
const tableId = getTableId(ctx)
|
||||
try {
|
||||
ctx.body = await quotas.addQuery(() => pickApi(tableId).find(ctx), {
|
||||
datasourceId: tableId,
|
||||
})
|
||||
} catch (err) {
|
||||
ctx.throw(400, err)
|
||||
}
|
||||
ctx.body = await quotas.addQuery(() => pickApi(tableId).find(ctx), {
|
||||
datasourceId: tableId,
|
||||
})
|
||||
}
|
||||
|
||||
export async function destroy(ctx: any) {
|
||||
|
@ -140,46 +123,30 @@ export async function destroy(ctx: any) {
|
|||
|
||||
export async function search(ctx: any) {
|
||||
const tableId = getTableId(ctx)
|
||||
try {
|
||||
ctx.status = 200
|
||||
ctx.body = await quotas.addQuery(() => pickApi(tableId).search(ctx), {
|
||||
datasourceId: tableId,
|
||||
})
|
||||
} catch (err) {
|
||||
ctx.throw(400, err)
|
||||
}
|
||||
ctx.status = 200
|
||||
ctx.body = await quotas.addQuery(() => pickApi(tableId).search(ctx), {
|
||||
datasourceId: tableId,
|
||||
})
|
||||
}
|
||||
|
||||
export async function validate(ctx: any) {
|
||||
const tableId = getTableId(ctx)
|
||||
try {
|
||||
ctx.body = await pickApi(tableId).validate(ctx)
|
||||
} catch (err) {
|
||||
ctx.throw(400, err)
|
||||
}
|
||||
ctx.body = await pickApi(tableId).validate(ctx)
|
||||
}
|
||||
|
||||
export async function fetchEnrichedRow(ctx: any) {
|
||||
const tableId = getTableId(ctx)
|
||||
try {
|
||||
ctx.body = await quotas.addQuery(
|
||||
() => pickApi(tableId).fetchEnrichedRow(ctx),
|
||||
{
|
||||
datasourceId: tableId,
|
||||
}
|
||||
)
|
||||
} catch (err) {
|
||||
ctx.throw(400, err)
|
||||
}
|
||||
ctx.body = await quotas.addQuery(
|
||||
() => pickApi(tableId).fetchEnrichedRow(ctx),
|
||||
{
|
||||
datasourceId: tableId,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
export const exportRows = async (ctx: any) => {
|
||||
const tableId = getTableId(ctx)
|
||||
try {
|
||||
ctx.body = await quotas.addQuery(() => pickApi(tableId).exportRows(ctx), {
|
||||
datasourceId: tableId,
|
||||
})
|
||||
} catch (err) {
|
||||
ctx.throw(400, err)
|
||||
}
|
||||
ctx.body = await quotas.addQuery(() => pickApi(tableId).exportRows(ctx), {
|
||||
datasourceId: tableId,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ exports.patch = async ctx => {
|
|||
})
|
||||
|
||||
if (!validateResult.valid) {
|
||||
throw { validation: validateResult.errors }
|
||||
ctx.throw(400, { validation: validateResult.errors })
|
||||
}
|
||||
|
||||
// returned row is cleaned and prepared for writing to DB
|
||||
|
|
|
@ -111,6 +111,8 @@ export const serveApp = async function (ctx: any) {
|
|||
const App = require("./templates/BudibaseApp.svelte").default
|
||||
const plugins = enrichPluginURLs(appInfo.usedPlugins)
|
||||
const { head, html, css } = App.render({
|
||||
metaImage:
|
||||
"https://res.cloudinary.com/daog6scxm/image/upload/v1666109324/meta-images/budibase-meta-image_uukc1m.png",
|
||||
title: appInfo.name,
|
||||
production: env.isProd(),
|
||||
appId,
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<script>
|
||||
export let title = ""
|
||||
export let favicon = ""
|
||||
export let metaImage = ""
|
||||
export let url = ""
|
||||
|
||||
export let clientLibPath
|
||||
export let usedPlugins
|
||||
|
@ -12,6 +14,15 @@
|
|||
name="viewport"
|
||||
content="width=device-width, initial-scale=1.0, viewport-fit=cover"
|
||||
/>
|
||||
<!-- Opengraph Meta Tags -->
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta name="twitter:site" content="@budibase" />
|
||||
<meta name="twitter:image" content={metaImage} />
|
||||
<meta name="twitter:title" content="{title} - built with Budibase" />
|
||||
<meta property="og:site_name" content="Budibase" />
|
||||
<meta property="og:title" content="{title} - built with Budibase" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:image" content={metaImage} />
|
||||
|
||||
<title>{title}</title>
|
||||
<link rel="icon" type="image/png" href={favicon} />
|
||||
|
|
|
@ -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 => {
|
||||
|
|
|
@ -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`)
|
||||
})
|
||||
})
|
|
@ -120,6 +120,9 @@ async function updateAutomations(prodAppId: string, db: PouchDB.Database) {
|
|||
* @returns {Object} Returns a fs read stream which can be loaded into the database.
|
||||
*/
|
||||
async function getTemplateStream(template: TemplateType) {
|
||||
if (template.file && template.file.type !== "text/plain") {
|
||||
throw new Error("Cannot import a non-text based file.")
|
||||
}
|
||||
if (template.file) {
|
||||
return fs.createReadStream(template.file.path)
|
||||
} else if (template.key) {
|
||||
|
@ -156,7 +159,7 @@ export async function importApp(
|
|||
) {
|
||||
let prodAppId = dbCore.getProdAppID(appId)
|
||||
let dbStream: any
|
||||
const isTar = template.file && template.file.type === "application/gzip"
|
||||
const isTar = template.file && template?.file?.type?.endsWith("gzip")
|
||||
const isDirectory =
|
||||
template.file && fs.lstatSync(template.file.path).isDirectory()
|
||||
if (template.file && (isTar || isDirectory)) {
|
||||
|
|
|
@ -1094,12 +1094,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.7":
|
||||
version "2.0.34-alpha.7"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.0.34-alpha.7.tgz#cb51d0433694fdc8603882deeef1e2cb931083a4"
|
||||
integrity sha512-he8s48GkotnYFeGk6M6F6EvgaKwFbcLBo+nx51J+hKP/nnc6wUihw1JLiu6qv4nfsi6ufkjWK8KuRYLL4mkXXA==
|
||||
"@budibase/backend-core@2.0.40-alpha.0":
|
||||
version "2.0.40-alpha.0"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.0.40-alpha.0.tgz#197df7756b8352bbda189e0f497b8df64a4a09de"
|
||||
integrity sha512-7HjMzpSMDcxgJwUrWvibK0Koj348JyAkMhtSjGxj7s8lhu+z9GcqiWNHssx5sdramShmbSkcNny5vnM+A9w+tQ==
|
||||
dependencies:
|
||||
"@budibase/types" "2.0.34-alpha.7"
|
||||
"@budibase/types" "2.0.40-alpha.0"
|
||||
"@shopify/jest-koa-mocks" "5.0.1"
|
||||
"@techpass/passport-openidconnect" "0.3.2"
|
||||
aws-sdk "2.1030.0"
|
||||
|
@ -1181,13 +1181,13 @@
|
|||
svelte-flatpickr "^3.2.3"
|
||||
svelte-portal "^1.0.0"
|
||||
|
||||
"@budibase/pro@2.0.34-alpha.7":
|
||||
version "2.0.34-alpha.7"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.0.34-alpha.7.tgz#5eb16030569474994c1f47a19f9447a2eff5f97e"
|
||||
integrity sha512-TwHrt62uC9pySUirnSLJ67pVikvPsFKz8NqwQJkyP0ZEtx29jSV8FZmLbYN8GrLd0n6xJ7DxBztX9ua/0Jt+pg==
|
||||
"@budibase/pro@2.0.40-alpha.0":
|
||||
version "2.0.40-alpha.0"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.0.40-alpha.0.tgz#748fdad163159cc04b5b2b3103179c9e3bb22ab1"
|
||||
integrity sha512-brBVT2B/nzZw8iYnC6Xhu0+x3JprgEsN1s40tQaYbVAvXB6GuHCtnkJ6mDoGDB5xQTilNdx+xNfF/qpZQv7h9w==
|
||||
dependencies:
|
||||
"@budibase/backend-core" "2.0.34-alpha.7"
|
||||
"@budibase/types" "2.0.34-alpha.7"
|
||||
"@budibase/backend-core" "2.0.40-alpha.0"
|
||||
"@budibase/types" "2.0.40-alpha.0"
|
||||
"@koa/router" "8.0.8"
|
||||
bull "4.10.1"
|
||||
joi "17.6.0"
|
||||
|
@ -1211,10 +1211,10 @@
|
|||
svelte-apexcharts "^1.0.2"
|
||||
svelte-flatpickr "^3.1.0"
|
||||
|
||||
"@budibase/types@2.0.34-alpha.7":
|
||||
version "2.0.34-alpha.7"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.0.34-alpha.7.tgz#4ea62b08ba6ebda069add3abdec3c0efd0f4d93e"
|
||||
integrity sha512-QOvLx4lopEEowS39HTRXC6m/AIR0RfPhQq2wKRQ55wLmRSxxuN4VzGAnAAn1qyG0Y2+xCHlR1dNQeRzTH7T5og==
|
||||
"@budibase/types@2.0.40-alpha.0":
|
||||
version "2.0.40-alpha.0"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.0.40-alpha.0.tgz#22664329f7662cbf6fc4755f08fb1e6eed65f8c7"
|
||||
integrity sha512-Z/PZrzkiK4MfsngSzyYmCnYHcGmTQci6achej3q2qPtnG7+AZpmTDszovznMytfyNA+TMvFesECzBy1p+KBTDQ==
|
||||
|
||||
"@bull-board/api@3.7.0":
|
||||
version "3.7.0"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/string-templates",
|
||||
"version": "2.0.34-alpha.7",
|
||||
"version": "2.0.40-alpha.0",
|
||||
"description": "Handlebars wrapper for Budibase templating.",
|
||||
"main": "src/index.cjs",
|
||||
"module": "dist/bundle.mjs",
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/types",
|
||||
"version": "2.0.34-alpha.7",
|
||||
"version": "2.0.40-alpha.0",
|
||||
"description": "Budibase types",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@budibase/worker",
|
||||
"email": "hi@budibase.com",
|
||||
"version": "2.0.34-alpha.7",
|
||||
"version": "2.0.40-alpha.0",
|
||||
"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.7",
|
||||
"@budibase/pro": "2.0.34-alpha.7",
|
||||
"@budibase/string-templates": "2.0.34-alpha.7",
|
||||
"@budibase/types": "2.0.34-alpha.7",
|
||||
"@budibase/backend-core": "2.0.40-alpha.0",
|
||||
"@budibase/pro": "2.0.40-alpha.0",
|
||||
"@budibase/string-templates": "2.0.40-alpha.0",
|
||||
"@budibase/types": "2.0.40-alpha.0",
|
||||
"@koa/router": "8.0.8",
|
||||
"@sentry/node": "6.17.7",
|
||||
"@techpass/passport-openidconnect": "0.3.2",
|
||||
|
|
|
@ -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.7":
|
||||
version "2.0.34-alpha.7"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.0.34-alpha.7.tgz#cb51d0433694fdc8603882deeef1e2cb931083a4"
|
||||
integrity sha512-he8s48GkotnYFeGk6M6F6EvgaKwFbcLBo+nx51J+hKP/nnc6wUihw1JLiu6qv4nfsi6ufkjWK8KuRYLL4mkXXA==
|
||||
"@budibase/backend-core@2.0.40-alpha.0":
|
||||
version "2.0.40-alpha.0"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.0.40-alpha.0.tgz#197df7756b8352bbda189e0f497b8df64a4a09de"
|
||||
integrity sha512-7HjMzpSMDcxgJwUrWvibK0Koj348JyAkMhtSjGxj7s8lhu+z9GcqiWNHssx5sdramShmbSkcNny5vnM+A9w+tQ==
|
||||
dependencies:
|
||||
"@budibase/types" "2.0.34-alpha.7"
|
||||
"@budibase/types" "2.0.40-alpha.0"
|
||||
"@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.7":
|
||||
version "2.0.34-alpha.7"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.0.34-alpha.7.tgz#5eb16030569474994c1f47a19f9447a2eff5f97e"
|
||||
integrity sha512-TwHrt62uC9pySUirnSLJ67pVikvPsFKz8NqwQJkyP0ZEtx29jSV8FZmLbYN8GrLd0n6xJ7DxBztX9ua/0Jt+pg==
|
||||
"@budibase/pro@2.0.40-alpha.0":
|
||||
version "2.0.40-alpha.0"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.0.40-alpha.0.tgz#748fdad163159cc04b5b2b3103179c9e3bb22ab1"
|
||||
integrity sha512-brBVT2B/nzZw8iYnC6Xhu0+x3JprgEsN1s40tQaYbVAvXB6GuHCtnkJ6mDoGDB5xQTilNdx+xNfF/qpZQv7h9w==
|
||||
dependencies:
|
||||
"@budibase/backend-core" "2.0.34-alpha.7"
|
||||
"@budibase/types" "2.0.34-alpha.7"
|
||||
"@budibase/backend-core" "2.0.40-alpha.0"
|
||||
"@budibase/types" "2.0.40-alpha.0"
|
||||
"@koa/router" "8.0.8"
|
||||
bull "4.10.1"
|
||||
joi "17.6.0"
|
||||
node-fetch "^2.6.1"
|
||||
|
||||
"@budibase/types@2.0.34-alpha.7":
|
||||
version "2.0.34-alpha.7"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.0.34-alpha.7.tgz#4ea62b08ba6ebda069add3abdec3c0efd0f4d93e"
|
||||
integrity sha512-QOvLx4lopEEowS39HTRXC6m/AIR0RfPhQq2wKRQ55wLmRSxxuN4VzGAnAAn1qyG0Y2+xCHlR1dNQeRzTH7T5og==
|
||||
"@budibase/types@2.0.40-alpha.0":
|
||||
version "2.0.40-alpha.0"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.0.40-alpha.0.tgz#22664329f7662cbf6fc4755f08fb1e6eed65f8c7"
|
||||
integrity sha512-Z/PZrzkiK4MfsngSzyYmCnYHcGmTQci6achej3q2qPtnG7+AZpmTDszovznMytfyNA+TMvFesECzBy1p+KBTDQ==
|
||||
|
||||
"@cspotcode/source-map-consumer@0.8.0":
|
||||
version "0.8.0"
|
||||
|
|
|
@ -7,6 +7,7 @@ import { RouteConfig } from "../fixtures/types/routing"
|
|||
import { AppPackageResponse } from "../fixtures/types/appPackage"
|
||||
import { DeployConfig } from "../fixtures/types/deploy"
|
||||
import { responseMessage } from "../fixtures/types/responseMessage"
|
||||
import { UnpublishAppResponse } from "../fixtures/types/unpublishAppResponse"
|
||||
|
||||
export default class AppApi {
|
||||
api: InternalAPIClient
|
||||
|
@ -100,4 +101,14 @@ export default class AppApi {
|
|||
const json = await response.json()
|
||||
return [response, json]
|
||||
}
|
||||
|
||||
async unpublish(appId: string): Promise<[Response, UnpublishAppResponse]> {
|
||||
const response = await this.api.del(`/applications/${appId}?unpublish=1`)
|
||||
expect(response).toHaveStatusCode(200)
|
||||
const json = await response.json()
|
||||
expect(json.data.ok).toBe(true)
|
||||
expect(json.ok).toBe(true)
|
||||
expect(json.status).toBe(200)
|
||||
return [response, json]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
export interface UnpublishAppResponse {
|
||||
data: {
|
||||
ok: boolean
|
||||
},
|
||||
ok: boolean,
|
||||
status: number
|
||||
}
|
|
@ -63,7 +63,7 @@ describe("Internal API - /applications endpoints", () => {
|
|||
})
|
||||
})
|
||||
|
||||
it("POST - Create an application from a template, publish and check it renders", async () => {
|
||||
it("Publish app flow", async () => {
|
||||
// create the app
|
||||
const appName = generator.word()
|
||||
const app = await createAppFromTemplate()
|
||||
|
@ -83,6 +83,10 @@ describe("Internal API - /applications endpoints", () => {
|
|||
const [publishedAppResponse, publishedAppRenders] =
|
||||
await config.applications.canRender()
|
||||
expect(publishedAppRenders).toBe(true)
|
||||
|
||||
// unpublish app
|
||||
await config.applications.unpublish(<string>app.appId)
|
||||
|
||||
})
|
||||
|
||||
it("POST - Sync application before deployment", async () => {
|
||||
|
|
Loading…
Reference in a new issue