Merge branch 'develop' into feature/test-image
This commit is contained in:
commit
2145442437
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "2.2.12-alpha.35",
|
"version": "2.2.12-alpha.40",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"packages": [
|
"packages": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/backend-core",
|
"name": "@budibase/backend-core",
|
||||||
"version": "2.2.12-alpha.35",
|
"version": "2.2.12-alpha.40",
|
||||||
"description": "Budibase backend core libraries used in server and worker",
|
"description": "Budibase backend core libraries used in server and worker",
|
||||||
"main": "dist/src/index.js",
|
"main": "dist/src/index.js",
|
||||||
"types": "dist/src/index.d.ts",
|
"types": "dist/src/index.d.ts",
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/nano": "10.1.1",
|
"@budibase/nano": "10.1.1",
|
||||||
"@budibase/types": "2.2.12-alpha.35",
|
"@budibase/types": "2.2.12-alpha.40",
|
||||||
"@shopify/jest-koa-mocks": "5.0.1",
|
"@shopify/jest-koa-mocks": "5.0.1",
|
||||||
"@techpass/passport-openidconnect": "0.3.2",
|
"@techpass/passport-openidconnect": "0.3.2",
|
||||||
"aws-cloudfront-sign": "2.2.0",
|
"aws-cloudfront-sign": "2.2.0",
|
||||||
|
|
|
@ -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": "2.2.12-alpha.35",
|
"version": "2.2.12-alpha.40",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"svelte": "src/index.js",
|
"svelte": "src/index.js",
|
||||||
"module": "dist/bbui.es.js",
|
"module": "dist/bbui.es.js",
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@adobe/spectrum-css-workflow-icons": "1.2.1",
|
"@adobe/spectrum-css-workflow-icons": "1.2.1",
|
||||||
"@budibase/string-templates": "2.2.12-alpha.35",
|
"@budibase/string-templates": "2.2.12-alpha.40",
|
||||||
"@spectrum-css/accordion": "3.0.24",
|
"@spectrum-css/accordion": "3.0.24",
|
||||||
"@spectrum-css/actionbutton": "1.0.1",
|
"@spectrum-css/actionbutton": "1.0.1",
|
||||||
"@spectrum-css/actiongroup": "1.0.1",
|
"@spectrum-css/actiongroup": "1.0.1",
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import { createEventDispatcher } from "svelte"
|
import { createEventDispatcher } from "svelte"
|
||||||
import FancyField from "./FancyField.svelte"
|
import FancyField from "./FancyField.svelte"
|
||||||
import FancyFieldLabel from "./FancyFieldLabel.svelte"
|
import FancyFieldLabel from "./FancyFieldLabel.svelte"
|
||||||
|
import { fade } from "svelte/transition"
|
||||||
|
|
||||||
export let label
|
export let label
|
||||||
export let value
|
export let value
|
||||||
|
@ -9,6 +10,7 @@
|
||||||
export let disabled = false
|
export let disabled = false
|
||||||
export let error = null
|
export let error = null
|
||||||
export let validate = null
|
export let validate = null
|
||||||
|
export let suffix = null
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
|
@ -38,6 +40,9 @@
|
||||||
on:blur={() => (focused = false)}
|
on:blur={() => (focused = false)}
|
||||||
class:placeholder
|
class:placeholder
|
||||||
/>
|
/>
|
||||||
|
{#if suffix && !placeholder}
|
||||||
|
<div in:fade|local={{ duration: 130 }} class="suffix">{suffix}</div>
|
||||||
|
{/if}
|
||||||
</FancyField>
|
</FancyField>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -52,6 +57,8 @@
|
||||||
color: var(--spectrum-global-color-gray-900);
|
color: var(--spectrum-global-color-gray-900);
|
||||||
outline: none;
|
outline: none;
|
||||||
border: none;
|
border: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
}
|
}
|
||||||
input.placeholder {
|
input.placeholder {
|
||||||
transform: translateY(0);
|
transform: translateY(0);
|
||||||
|
@ -60,4 +67,11 @@
|
||||||
left: 0;
|
left: 0;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
.suffix {
|
||||||
|
color: var(--spectrum-global-color-gray-600);
|
||||||
|
transform: translateY(9px);
|
||||||
|
font-size: 15px;
|
||||||
|
line-height: 17px;
|
||||||
|
font-family: var(--font-sans);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
let wrapper
|
let wrapper
|
||||||
|
|
||||||
$: placeholder = !value
|
$: placeholder = !value
|
||||||
|
$: selectedLabel = getSelectedLabel(value)
|
||||||
|
|
||||||
const extractProperty = (value, property) => {
|
const extractProperty = (value, property) => {
|
||||||
if (value && typeof value === "object") {
|
if (value && typeof value === "object") {
|
||||||
|
@ -37,6 +38,17 @@
|
||||||
}
|
}
|
||||||
open = false
|
open = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getSelectedLabel = value => {
|
||||||
|
if (!value || !options?.length) {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
const selectedOption = options.find(x => getOptionValue(x) === value)
|
||||||
|
if (!selectedOption) {
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
return getOptionLabel(selectedOption)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<FancyField
|
<FancyField
|
||||||
|
@ -53,7 +65,7 @@
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div class="value" class:placeholder>
|
<div class="value" class:placeholder>
|
||||||
{value || ""}
|
{selectedLabel || ""}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="arrow">
|
<div class="arrow">
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/builder",
|
"name": "@budibase/builder",
|
||||||
"version": "2.2.12-alpha.35",
|
"version": "2.2.12-alpha.40",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -71,10 +71,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/bbui": "2.2.12-alpha.35",
|
"@budibase/bbui": "2.2.12-alpha.40",
|
||||||
"@budibase/client": "2.2.12-alpha.35",
|
"@budibase/client": "2.2.12-alpha.40",
|
||||||
"@budibase/frontend-core": "2.2.12-alpha.35",
|
"@budibase/frontend-core": "2.2.12-alpha.40",
|
||||||
"@budibase/string-templates": "2.2.12-alpha.35",
|
"@budibase/string-templates": "2.2.12-alpha.40",
|
||||||
"@sentry/browser": "5.19.1",
|
"@sentry/browser": "5.19.1",
|
||||||
"@spectrum-css/accordion": "^3.0.24",
|
"@spectrum-css/accordion": "^3.0.24",
|
||||||
"@spectrum-css/page": "^3.0.1",
|
"@spectrum-css/page": "^3.0.1",
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
export let close
|
export let close
|
||||||
|
|
||||||
const colNotSet = "Please specify a column name"
|
const colNotSet = "Please specify a column name"
|
||||||
|
const relationshipAlreadyExists =
|
||||||
|
"A relationship between these tables already exists."
|
||||||
const relationshipTypes = [
|
const relationshipTypes = [
|
||||||
{
|
{
|
||||||
label: "One to Many",
|
label: "One to Many",
|
||||||
|
@ -154,6 +156,10 @@
|
||||||
if (!isMany && !fromPrimary) {
|
if (!isMany && !fromPrimary) {
|
||||||
errObj.fromPrimary = "Please pick the primary key"
|
errObj.fromPrimary = "Please pick the primary key"
|
||||||
}
|
}
|
||||||
|
if (isMany && relationshipExists()) {
|
||||||
|
errObj.fromTable = relationshipAlreadyExists
|
||||||
|
errObj.toTable = relationshipAlreadyExists
|
||||||
|
}
|
||||||
|
|
||||||
// currently don't support relationships back onto the table itself, needs to relate out
|
// currently don't support relationships back onto the table itself, needs to relate out
|
||||||
const tableError = "From/to/through tables must be different"
|
const tableError = "From/to/through tables must be different"
|
||||||
|
@ -271,6 +277,35 @@
|
||||||
toRelationship = relateTo
|
toRelationship = relateTo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function relationshipExists() {
|
||||||
|
if (
|
||||||
|
originalFromTable &&
|
||||||
|
originalToTable &&
|
||||||
|
originalFromTable === fromTable &&
|
||||||
|
originalToTable === toTable
|
||||||
|
) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
let fromThroughLinks = Object.values(
|
||||||
|
datasource.entities[fromTable.name].schema
|
||||||
|
).filter(value => value.through)
|
||||||
|
let toThroughLinks = Object.values(
|
||||||
|
datasource.entities[toTable.name].schema
|
||||||
|
).filter(value => value.through)
|
||||||
|
|
||||||
|
const matchAgainstUserInput = (fromTableId, toTableId) =>
|
||||||
|
(fromTableId === fromId && toTableId === toId) ||
|
||||||
|
(fromTableId === toId && toTableId === fromId)
|
||||||
|
|
||||||
|
return !!fromThroughLinks.find(from =>
|
||||||
|
toThroughLinks.find(
|
||||||
|
to =>
|
||||||
|
from.through === to.through &&
|
||||||
|
matchAgainstUserInput(from.tableId, to.tableId)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
function removeExistingRelationship() {
|
function removeExistingRelationship() {
|
||||||
if (originalFromTable && originalFromColumnName) {
|
if (originalFromTable && originalFromColumnName) {
|
||||||
delete datasource.entities[originalFromTable.name].schema[
|
delete datasource.entities[originalFromTable.name].schema[
|
||||||
|
@ -332,8 +367,13 @@
|
||||||
bind:error={errors.fromTable}
|
bind:error={errors.fromTable}
|
||||||
on:change={e => {
|
on:change={e => {
|
||||||
fromColumn = tableOptions.find(opt => opt.value === e.detail)?.label || ""
|
fromColumn = tableOptions.find(opt => opt.value === e.detail)?.label || ""
|
||||||
|
if (errors.fromTable === relationshipAlreadyExists) {
|
||||||
|
errors.toColumn = null
|
||||||
|
}
|
||||||
errors.fromTable = null
|
errors.fromTable = null
|
||||||
errors.fromColumn = null
|
errors.fromColumn = null
|
||||||
|
errors.toTable = null
|
||||||
|
errors.throughTable = null
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{#if isManyToOne && fromTable}
|
{#if isManyToOne && fromTable}
|
||||||
|
@ -352,8 +392,13 @@
|
||||||
bind:error={errors.toTable}
|
bind:error={errors.toTable}
|
||||||
on:change={e => {
|
on:change={e => {
|
||||||
toColumn = tableOptions.find(opt => opt.value === e.detail)?.label || ""
|
toColumn = tableOptions.find(opt => opt.value === e.detail)?.label || ""
|
||||||
|
if (errors.toTable === relationshipAlreadyExists) {
|
||||||
|
errors.fromColumn = null
|
||||||
|
}
|
||||||
errors.toTable = null
|
errors.toTable = null
|
||||||
errors.toColumn = null
|
errors.toColumn = null
|
||||||
|
errors.fromTable = null
|
||||||
|
errors.throughTable = null
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{#if isManyToMany}
|
{#if isManyToMany}
|
||||||
|
@ -362,6 +407,11 @@
|
||||||
options={tableOptions}
|
options={tableOptions}
|
||||||
bind:value={throughId}
|
bind:value={throughId}
|
||||||
bind:error={errors.throughTable}
|
bind:error={errors.throughTable}
|
||||||
|
on:change={() => {
|
||||||
|
errors.fromTable = null
|
||||||
|
errors.toTable = null
|
||||||
|
errors.throughTable = null
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
{#if fromTable && toTable && throughTable}
|
{#if fromTable && toTable && throughTable}
|
||||||
<Select
|
<Select
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
size="S"
|
size="S"
|
||||||
on:click
|
on:click
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
$goto($admin.accountPortalUrl + "/portal/upgrade")
|
window.open($admin.accountPortalUrl + "/portal/upgrade", "_blank")
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Upgrade
|
Upgrade
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/cli",
|
"name": "@budibase/cli",
|
||||||
"version": "2.2.12-alpha.35",
|
"version": "2.2.12-alpha.40",
|
||||||
"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": {
|
||||||
|
@ -26,9 +26,9 @@
|
||||||
"outputPath": "build"
|
"outputPath": "build"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/backend-core": "2.2.12-alpha.35",
|
"@budibase/backend-core": "2.2.12-alpha.40",
|
||||||
"@budibase/string-templates": "2.2.12-alpha.35",
|
"@budibase/string-templates": "2.2.12-alpha.40",
|
||||||
"@budibase/types": "2.2.12-alpha.35",
|
"@budibase/types": "2.2.12-alpha.40",
|
||||||
"axios": "0.21.2",
|
"axios": "0.21.2",
|
||||||
"chalk": "4.1.0",
|
"chalk": "4.1.0",
|
||||||
"cli-progress": "3.11.2",
|
"cli-progress": "3.11.2",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/client",
|
"name": "@budibase/client",
|
||||||
"version": "2.2.12-alpha.35",
|
"version": "2.2.12-alpha.40",
|
||||||
"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,9 @@
|
||||||
"dev:builder": "rollup -cw"
|
"dev:builder": "rollup -cw"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/bbui": "2.2.12-alpha.35",
|
"@budibase/bbui": "2.2.12-alpha.40",
|
||||||
"@budibase/frontend-core": "2.2.12-alpha.35",
|
"@budibase/frontend-core": "2.2.12-alpha.40",
|
||||||
"@budibase/string-templates": "2.2.12-alpha.35",
|
"@budibase/string-templates": "2.2.12-alpha.40",
|
||||||
"@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",
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/frontend-core",
|
"name": "@budibase/frontend-core",
|
||||||
"version": "2.2.12-alpha.35",
|
"version": "2.2.12-alpha.40",
|
||||||
"description": "Budibase frontend core libraries used in builder and client",
|
"description": "Budibase frontend core libraries used in builder and client",
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"svelte": "src/index.js",
|
"svelte": "src/index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/bbui": "2.2.12-alpha.35",
|
"@budibase/bbui": "2.2.12-alpha.40",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"svelte": "^3.46.2"
|
"svelte": "^3.46.2"
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="user">
|
<div class="user">
|
||||||
<img
|
<img
|
||||||
|
alt="a-happy-budibase-user"
|
||||||
src="https://icon-library.com/images/male-user-icon/male-user-icon-24.jpg"
|
src="https://icon-library.com/images/male-user-icon/male-user-icon-24.jpg"
|
||||||
/>
|
/>
|
||||||
<div class="author">
|
<div class="author">
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/sdk",
|
"name": "@budibase/sdk",
|
||||||
"version": "2.2.12-alpha.35",
|
"version": "2.2.12-alpha.40",
|
||||||
"description": "Budibase Public API SDK",
|
"description": "Budibase Public API SDK",
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/server",
|
"name": "@budibase/server",
|
||||||
"email": "hi@budibase.com",
|
"email": "hi@budibase.com",
|
||||||
"version": "2.2.12-alpha.35",
|
"version": "2.2.12-alpha.40",
|
||||||
"description": "Budibase Web Server",
|
"description": "Budibase Web Server",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -43,11 +43,11 @@
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apidevtools/swagger-parser": "10.0.3",
|
"@apidevtools/swagger-parser": "10.0.3",
|
||||||
"@budibase/backend-core": "2.2.12-alpha.35",
|
"@budibase/backend-core": "2.2.12-alpha.40",
|
||||||
"@budibase/client": "2.2.12-alpha.35",
|
"@budibase/client": "2.2.12-alpha.40",
|
||||||
"@budibase/pro": "2.2.12-alpha.35",
|
"@budibase/pro": "2.2.12-alpha.40",
|
||||||
"@budibase/string-templates": "2.2.12-alpha.35",
|
"@budibase/string-templates": "2.2.12-alpha.40",
|
||||||
"@budibase/types": "2.2.12-alpha.35",
|
"@budibase/types": "2.2.12-alpha.40",
|
||||||
"@bull-board/api": "3.7.0",
|
"@bull-board/api": "3.7.0",
|
||||||
"@bull-board/koa": "3.9.4",
|
"@bull-board/koa": "3.9.4",
|
||||||
"@elastic/elasticsearch": "7.10.0",
|
"@elastic/elasticsearch": "7.10.0",
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
import * as automation from "../index"
|
||||||
|
import * as triggers from "../triggers"
|
||||||
|
import { loopAutomation } from "../../tests/utilities/structures"
|
||||||
|
import { context } from "@budibase/backend-core"
|
||||||
|
import * as setup from "./utilities"
|
||||||
|
|
||||||
|
describe("Attempt to run a basic loop automation", () => {
|
||||||
|
let config = setup.getConfig(),
|
||||||
|
table: any,
|
||||||
|
row: any
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await automation.init()
|
||||||
|
await config.init()
|
||||||
|
table = await config.createTable()
|
||||||
|
row = await config.createRow()
|
||||||
|
})
|
||||||
|
|
||||||
|
afterAll(setup.afterAll)
|
||||||
|
|
||||||
|
async function runLoop(loopOpts?: any) {
|
||||||
|
const appId = config.getAppId()
|
||||||
|
return await context.doInAppContext(appId, async () => {
|
||||||
|
const params = { fields: { appId } }
|
||||||
|
return await triggers.externalTrigger(
|
||||||
|
loopAutomation(table._id, loopOpts),
|
||||||
|
params,
|
||||||
|
{ getResponses: true }
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
it("attempt to run a basic loop", async () => {
|
||||||
|
const resp = await runLoop()
|
||||||
|
expect(resp.steps[2].outputs.iterations).toBe(1)
|
||||||
|
})
|
||||||
|
|
||||||
|
it("test a loop with a string", async () => {
|
||||||
|
const resp = await runLoop({
|
||||||
|
type: "String",
|
||||||
|
binding: "a,b,c",
|
||||||
|
})
|
||||||
|
expect(resp.steps[2].outputs.iterations).toBe(3)
|
||||||
|
})
|
||||||
|
})
|
|
@ -109,8 +109,13 @@ export async function externalTrigger(
|
||||||
}
|
}
|
||||||
params.fields = coercedFields
|
params.fields = coercedFields
|
||||||
}
|
}
|
||||||
const data = { automation, event: params }
|
const data: Record<string, any> = { automation, event: params }
|
||||||
if (getResponses) {
|
if (getResponses) {
|
||||||
|
data.event = {
|
||||||
|
...data.event,
|
||||||
|
appId: context.getAppId(),
|
||||||
|
automation,
|
||||||
|
}
|
||||||
return utils.processEvent({ data })
|
return utils.processEvent({ data })
|
||||||
} else {
|
} else {
|
||||||
return automationQueue.add(data, JOB_OPTS)
|
return automationQueue.add(data, JOB_OPTS)
|
||||||
|
|
|
@ -1,8 +1,14 @@
|
||||||
import { roles, permissions } from "@budibase/backend-core"
|
import { permissions, roles } from "@budibase/backend-core"
|
||||||
import { createHomeScreen } from "../../constants/screens"
|
import { createHomeScreen } from "../../constants/screens"
|
||||||
import { EMPTY_LAYOUT } from "../../constants/layouts"
|
import { EMPTY_LAYOUT } from "../../constants/layouts"
|
||||||
import { cloneDeep } from "lodash/fp"
|
import { cloneDeep } from "lodash/fp"
|
||||||
import { TRIGGER_DEFINITIONS, ACTION_DEFINITIONS } from "../../automations"
|
import { ACTION_DEFINITIONS, TRIGGER_DEFINITIONS } from "../../automations"
|
||||||
|
import {
|
||||||
|
Automation,
|
||||||
|
AutomationActionStepId,
|
||||||
|
AutomationTriggerStepId,
|
||||||
|
} from "@budibase/types"
|
||||||
|
|
||||||
const { v4: uuidv4 } = require("uuid")
|
const { v4: uuidv4 } = require("uuid")
|
||||||
|
|
||||||
export const TENANT_ID = "default"
|
export const TENANT_ID = "default"
|
||||||
|
@ -116,6 +122,63 @@ export function basicAutomation() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function loopAutomation(tableId: string, loopOpts?: any): Automation {
|
||||||
|
if (!loopOpts) {
|
||||||
|
loopOpts = {
|
||||||
|
option: "Array",
|
||||||
|
binding: "{{ steps.1.rows }}",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const automation: any = {
|
||||||
|
name: "looping",
|
||||||
|
type: "automation",
|
||||||
|
definition: {
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
id: "b",
|
||||||
|
type: "ACTION",
|
||||||
|
stepId: AutomationActionStepId.QUERY_ROWS,
|
||||||
|
internal: true,
|
||||||
|
inputs: {
|
||||||
|
tableId,
|
||||||
|
},
|
||||||
|
schema: ACTION_DEFINITIONS.QUERY_ROWS.schema,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "c",
|
||||||
|
type: "ACTION",
|
||||||
|
stepId: AutomationActionStepId.LOOP,
|
||||||
|
internal: true,
|
||||||
|
inputs: loopOpts,
|
||||||
|
blockToLoop: "d",
|
||||||
|
schema: ACTION_DEFINITIONS.LOOP.schema,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "d",
|
||||||
|
type: "ACTION",
|
||||||
|
internal: true,
|
||||||
|
stepId: AutomationActionStepId.SERVER_LOG,
|
||||||
|
inputs: {
|
||||||
|
text: "log statement",
|
||||||
|
},
|
||||||
|
schema: ACTION_DEFINITIONS.SERVER_LOG.schema,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
trigger: {
|
||||||
|
id: "a",
|
||||||
|
type: "TRIGGER",
|
||||||
|
event: "row:save",
|
||||||
|
stepId: AutomationTriggerStepId.ROW_SAVED,
|
||||||
|
inputs: {
|
||||||
|
tableId,
|
||||||
|
},
|
||||||
|
schema: TRIGGER_DEFINITIONS.ROW_SAVED.schema,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return automation as Automation
|
||||||
|
}
|
||||||
|
|
||||||
export function basicRow(tableId: string) {
|
export function basicRow(tableId: string) {
|
||||||
return {
|
return {
|
||||||
name: "Test Contact",
|
name: "Test Contact",
|
||||||
|
|
|
@ -37,9 +37,13 @@ function getLoopIterations(loopStep: LoopStep, input: LoopInput) {
|
||||||
if (!loopStep || !binding) {
|
if (!loopStep || !binding) {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
return Array.isArray(binding)
|
if (Array.isArray(binding)) {
|
||||||
? binding.length
|
return binding.length
|
||||||
: automationUtils.stringSplit(binding).length
|
}
|
||||||
|
if (typeof binding === "string") {
|
||||||
|
return automationUtils.stringSplit(binding).length
|
||||||
|
}
|
||||||
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -280,13 +284,13 @@ class Orchestrator {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
let item
|
let item = []
|
||||||
if (
|
if (
|
||||||
typeof loopStep.inputs.binding === "string" &&
|
typeof loopStep.inputs.binding === "string" &&
|
||||||
loopStep.inputs.option === "String"
|
loopStep.inputs.option === "String"
|
||||||
) {
|
) {
|
||||||
item = automationUtils.stringSplit(newInput.binding)
|
item = automationUtils.stringSplit(newInput.binding)
|
||||||
} else {
|
} else if (Array.isArray(loopStep.inputs.binding)) {
|
||||||
item = loopStep.inputs.binding
|
item = loopStep.inputs.binding
|
||||||
}
|
}
|
||||||
this._context.steps[loopStepNumber] = {
|
this._context.steps[loopStepNumber] = {
|
||||||
|
|
|
@ -1278,13 +1278,13 @@
|
||||||
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/backend-core@2.2.12-alpha.35":
|
"@budibase/backend-core@2.2.12-alpha.40":
|
||||||
version "2.2.12-alpha.35"
|
version "2.2.12-alpha.40"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.12-alpha.35.tgz#36045cdccee548d86a5d0951606d41d0de96bd5c"
|
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.12-alpha.40.tgz#49bae56f5d8c1511100d64c447171c96e1929b26"
|
||||||
integrity sha512-CdIioYKH6y8KQRMWJ2esiOeCOOs3RIGGAAY7DYw71ejjxtCcAZ8Fnez+xIgTFqI6Hee64HjMbX2Tc3OO4J/Kxg==
|
integrity sha512-wvArhOlcSGq3K9hE6zFcFB5zztzZjmAA+I3+2DYud9/8KxBOyQmPlUyRRrHXsrtURDiEtLDyIc/AG9pvDEFwGw==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@budibase/nano" "10.1.1"
|
"@budibase/nano" "10.1.1"
|
||||||
"@budibase/types" "2.2.12-alpha.35"
|
"@budibase/types" "2.2.12-alpha.40"
|
||||||
"@shopify/jest-koa-mocks" "5.0.1"
|
"@shopify/jest-koa-mocks" "5.0.1"
|
||||||
"@techpass/passport-openidconnect" "0.3.2"
|
"@techpass/passport-openidconnect" "0.3.2"
|
||||||
aws-cloudfront-sign "2.2.0"
|
aws-cloudfront-sign "2.2.0"
|
||||||
|
@ -1379,13 +1379,13 @@
|
||||||
qs "^6.11.0"
|
qs "^6.11.0"
|
||||||
tough-cookie "^4.1.2"
|
tough-cookie "^4.1.2"
|
||||||
|
|
||||||
"@budibase/pro@2.2.12-alpha.35":
|
"@budibase/pro@2.2.12-alpha.40":
|
||||||
version "2.2.12-alpha.35"
|
version "2.2.12-alpha.40"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.12-alpha.35.tgz#6b0f3c2e616b9603b05292dede50d44d3e2d60fe"
|
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.12-alpha.40.tgz#e41af1af7db36aac4e27412b58cf6a25ab921606"
|
||||||
integrity sha512-bFaPfocgEUDT3kZV/BWjui9kGr/hn5mfTlj/pPMGQnA/8E9sToJR5bjKjjFrZUr1YrclFDUkaEsixWBK1hWPaw==
|
integrity sha512-Z7kW/KLu0Bst8+JVHdYJYpr65SVavFH55mmqDcCD/j44pNxZKchNBCYe5KTukNwtJS7wnLPAinQI52dDhYcpfg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@budibase/backend-core" "2.2.12-alpha.35"
|
"@budibase/backend-core" "2.2.12-alpha.40"
|
||||||
"@budibase/types" "2.2.12-alpha.35"
|
"@budibase/types" "2.2.12-alpha.40"
|
||||||
"@koa/router" "8.0.8"
|
"@koa/router" "8.0.8"
|
||||||
bull "4.10.1"
|
bull "4.10.1"
|
||||||
joi "17.6.0"
|
joi "17.6.0"
|
||||||
|
@ -1410,10 +1410,10 @@
|
||||||
svelte-apexcharts "^1.0.2"
|
svelte-apexcharts "^1.0.2"
|
||||||
svelte-flatpickr "^3.1.0"
|
svelte-flatpickr "^3.1.0"
|
||||||
|
|
||||||
"@budibase/types@2.2.12-alpha.35":
|
"@budibase/types@2.2.12-alpha.40":
|
||||||
version "2.2.12-alpha.35"
|
version "2.2.12-alpha.40"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.12-alpha.35.tgz#35c812289a3ca97c18629c4cf3607bf1aa3539da"
|
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.12-alpha.40.tgz#114c2de00f502736d90b18238ed31eb0b2ef6a19"
|
||||||
integrity sha512-mkGA/Ago7ckqPeoq70DLN2flbIYpaJgniwd7Tz6zlSrLlBC+fBUSdjzxeXE3FASr3NtC7qHyVS6ZMXEpou6/QQ==
|
integrity sha512-YLCycoImazSypq89w+1l3LHEMZ9qEh5NPBJ5DQ07Un/1Sq5H4QxVLK8r7Z1VtxIqtAh95H3nMPnAB/vLpJEL8Q==
|
||||||
|
|
||||||
"@bull-board/api@3.7.0":
|
"@bull-board/api@3.7.0":
|
||||||
version "3.7.0"
|
version "3.7.0"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/string-templates",
|
"name": "@budibase/string-templates",
|
||||||
"version": "2.2.12-alpha.35",
|
"version": "2.2.12-alpha.40",
|
||||||
"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",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/types",
|
"name": "@budibase/types",
|
||||||
"version": "2.2.12-alpha.35",
|
"version": "2.2.12-alpha.40",
|
||||||
"description": "Budibase types",
|
"description": "Budibase types",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
|
|
|
@ -50,6 +50,7 @@ export interface AutomationStepSchema {
|
||||||
internal?: boolean
|
internal?: boolean
|
||||||
deprecated?: boolean
|
deprecated?: boolean
|
||||||
stepId: AutomationTriggerStepId | AutomationActionStepId
|
stepId: AutomationTriggerStepId | AutomationActionStepId
|
||||||
|
blockToLoop?: string
|
||||||
inputs: {
|
inputs: {
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/worker",
|
"name": "@budibase/worker",
|
||||||
"email": "hi@budibase.com",
|
"email": "hi@budibase.com",
|
||||||
"version": "2.2.12-alpha.35",
|
"version": "2.2.12-alpha.40",
|
||||||
"description": "Budibase background service",
|
"description": "Budibase background service",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -36,10 +36,10 @@
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/backend-core": "2.2.12-alpha.35",
|
"@budibase/backend-core": "2.2.12-alpha.40",
|
||||||
"@budibase/pro": "2.2.12-alpha.35",
|
"@budibase/pro": "2.2.12-alpha.40",
|
||||||
"@budibase/string-templates": "2.2.12-alpha.35",
|
"@budibase/string-templates": "2.2.12-alpha.40",
|
||||||
"@budibase/types": "2.2.12-alpha.35",
|
"@budibase/types": "2.2.12-alpha.40",
|
||||||
"@koa/router": "8.0.8",
|
"@koa/router": "8.0.8",
|
||||||
"@sentry/node": "6.17.7",
|
"@sentry/node": "6.17.7",
|
||||||
"@techpass/passport-openidconnect": "0.3.2",
|
"@techpass/passport-openidconnect": "0.3.2",
|
||||||
|
|
|
@ -475,13 +475,13 @@
|
||||||
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/backend-core@2.2.12-alpha.35":
|
"@budibase/backend-core@2.2.12-alpha.40":
|
||||||
version "2.2.12-alpha.35"
|
version "2.2.12-alpha.40"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.12-alpha.35.tgz#36045cdccee548d86a5d0951606d41d0de96bd5c"
|
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.12-alpha.40.tgz#49bae56f5d8c1511100d64c447171c96e1929b26"
|
||||||
integrity sha512-CdIioYKH6y8KQRMWJ2esiOeCOOs3RIGGAAY7DYw71ejjxtCcAZ8Fnez+xIgTFqI6Hee64HjMbX2Tc3OO4J/Kxg==
|
integrity sha512-wvArhOlcSGq3K9hE6zFcFB5zztzZjmAA+I3+2DYud9/8KxBOyQmPlUyRRrHXsrtURDiEtLDyIc/AG9pvDEFwGw==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@budibase/nano" "10.1.1"
|
"@budibase/nano" "10.1.1"
|
||||||
"@budibase/types" "2.2.12-alpha.35"
|
"@budibase/types" "2.2.12-alpha.40"
|
||||||
"@shopify/jest-koa-mocks" "5.0.1"
|
"@shopify/jest-koa-mocks" "5.0.1"
|
||||||
"@techpass/passport-openidconnect" "0.3.2"
|
"@techpass/passport-openidconnect" "0.3.2"
|
||||||
aws-cloudfront-sign "2.2.0"
|
aws-cloudfront-sign "2.2.0"
|
||||||
|
@ -526,23 +526,23 @@
|
||||||
qs "^6.11.0"
|
qs "^6.11.0"
|
||||||
tough-cookie "^4.1.2"
|
tough-cookie "^4.1.2"
|
||||||
|
|
||||||
"@budibase/pro@2.2.12-alpha.35":
|
"@budibase/pro@2.2.12-alpha.40":
|
||||||
version "2.2.12-alpha.35"
|
version "2.2.12-alpha.40"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.12-alpha.35.tgz#6b0f3c2e616b9603b05292dede50d44d3e2d60fe"
|
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.12-alpha.40.tgz#e41af1af7db36aac4e27412b58cf6a25ab921606"
|
||||||
integrity sha512-bFaPfocgEUDT3kZV/BWjui9kGr/hn5mfTlj/pPMGQnA/8E9sToJR5bjKjjFrZUr1YrclFDUkaEsixWBK1hWPaw==
|
integrity sha512-Z7kW/KLu0Bst8+JVHdYJYpr65SVavFH55mmqDcCD/j44pNxZKchNBCYe5KTukNwtJS7wnLPAinQI52dDhYcpfg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@budibase/backend-core" "2.2.12-alpha.35"
|
"@budibase/backend-core" "2.2.12-alpha.40"
|
||||||
"@budibase/types" "2.2.12-alpha.35"
|
"@budibase/types" "2.2.12-alpha.40"
|
||||||
"@koa/router" "8.0.8"
|
"@koa/router" "8.0.8"
|
||||||
bull "4.10.1"
|
bull "4.10.1"
|
||||||
joi "17.6.0"
|
joi "17.6.0"
|
||||||
jsonwebtoken "8.5.1"
|
jsonwebtoken "8.5.1"
|
||||||
node-fetch "^2.6.1"
|
node-fetch "^2.6.1"
|
||||||
|
|
||||||
"@budibase/types@2.2.12-alpha.35":
|
"@budibase/types@2.2.12-alpha.40":
|
||||||
version "2.2.12-alpha.35"
|
version "2.2.12-alpha.40"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.12-alpha.35.tgz#35c812289a3ca97c18629c4cf3607bf1aa3539da"
|
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.12-alpha.40.tgz#114c2de00f502736d90b18238ed31eb0b2ef6a19"
|
||||||
integrity sha512-mkGA/Ago7ckqPeoq70DLN2flbIYpaJgniwd7Tz6zlSrLlBC+fBUSdjzxeXE3FASr3NtC7qHyVS6ZMXEpou6/QQ==
|
integrity sha512-YLCycoImazSypq89w+1l3LHEMZ9qEh5NPBJ5DQ07Un/1Sq5H4QxVLK8r7Z1VtxIqtAh95H3nMPnAB/vLpJEL8Q==
|
||||||
|
|
||||||
"@cspotcode/source-map-support@^0.8.0":
|
"@cspotcode/source-map-support@^0.8.0":
|
||||||
version "0.8.1"
|
version "0.8.1"
|
||||||
|
|
|
@ -11,5 +11,8 @@ Addresses:
|
||||||
## Screenshots
|
## Screenshots
|
||||||
_If a UI facing feature, a short video of the happy path, and some screenshots of the new functionality._
|
_If a UI facing feature, a short video of the happy path, and some screenshots of the new functionality._
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
- [ ] I have reviewed the budibase documentatation to verify if this feature requires any changes. If changes or new docs are required I have written them.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue