diff --git a/packages/bbui/src/index.js b/packages/bbui/src/index.js
index 3de0bc2f46..b56aa597ad 100644
--- a/packages/bbui/src/index.js
+++ b/packages/bbui/src/index.js
@@ -75,6 +75,7 @@ export { default as ListItem } from "./List/ListItem.svelte"
export { default as IconSideNav } from "./IconSideNav/IconSideNav.svelte"
export { default as IconSideNavItem } from "./IconSideNav/IconSideNavItem.svelte"
export { default as Slider } from "./Form/Slider.svelte"
+export { default as Accordion } from "./Accordion/Accordion.svelte"
// Renderers
export { default as BoldRenderer } from "./Table/BoldRenderer.svelte"
diff --git a/packages/bbui/yarn.lock b/packages/bbui/yarn.lock
index 72e36a6474..16f1feb920 100644
--- a/packages/bbui/yarn.lock
+++ b/packages/bbui/yarn.lock
@@ -109,6 +109,11 @@
estree-walker "^1.0.1"
picomatch "^2.2.2"
+"@spectrum-css/accordion@3.0.24":
+ version "3.0.24"
+ resolved "https://registry.yarnpkg.com/@spectrum-css/accordion/-/accordion-3.0.24.tgz#f89066c120c57b0cfc9aba66d60c39fc1cf69f74"
+ integrity sha512-jNOmUsxmiT3lRLButnN5KKHM94fd+87fjiF8L0c4uRNgJl6ZsBuxPXrM15lV4y1f8D2IACAw01/ZkGRAeaCOFA==
+
"@spectrum-css/actionbutton@1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@spectrum-css/actionbutton/-/actionbutton-1.0.1.tgz#9c75da37ea6915919fb574c74bd60dacc03b6577"
diff --git a/packages/builder/package.json b/packages/builder/package.json
index 82c939d1f4..68ac91264c 100644
--- a/packages/builder/package.json
+++ b/packages/builder/package.json
@@ -1,6 +1,6 @@
{
"name": "@budibase/builder",
- "version": "2.2.12-alpha.32",
+ "version": "2.2.12-alpha.41",
"license": "GPL-3.0",
"private": true,
"scripts": {
@@ -71,11 +71,12 @@
}
},
"dependencies": {
- "@budibase/bbui": "2.2.12-alpha.32",
- "@budibase/client": "2.2.12-alpha.32",
- "@budibase/frontend-core": "2.2.12-alpha.32",
- "@budibase/string-templates": "2.2.12-alpha.32",
+ "@budibase/bbui": "2.2.12-alpha.41",
+ "@budibase/client": "2.2.12-alpha.41",
+ "@budibase/frontend-core": "2.2.12-alpha.41",
+ "@budibase/string-templates": "2.2.12-alpha.41",
"@sentry/browser": "5.19.1",
+ "@spectrum-css/accordion": "^3.0.24",
"@spectrum-css/page": "^3.0.1",
"@spectrum-css/vars": "^3.0.1",
"codemirror": "^5.59.0",
diff --git a/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/IntegrationConfigForm.svelte b/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/IntegrationConfigForm.svelte
index 05649e1773..6b35f3313f 100644
--- a/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/IntegrationConfigForm.svelte
+++ b/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/IntegrationConfigForm.svelte
@@ -6,6 +6,7 @@
Toggle,
Button,
TextArea,
+ Accordion,
} from "@budibase/bbui"
import KeyValueBuilder from "components/integration/KeyValueBuilder.svelte"
import { capitalise } from "helpers"
@@ -51,15 +52,24 @@
let addButton
- function getDisplayName(key) {
+ function getDisplayName(key, fieldKey) {
let name
- if (schema[key]?.display) {
+ if (fieldKey && schema[key]["fields"][fieldKey]?.display) {
+ name = schema[key]["fields"][fieldKey].display
+ } else if (fieldKey) {
+ name = fieldKey
+ } else if (schema[key]?.display) {
name = schema[key].display
} else {
name = key
}
return capitalise(name)
}
+ function getFieldGroupKeys(fieldGroup) {
+ return Object.entries(schema[fieldGroup].fields || {})
+ .filter(el => filter(el))
+ .map(([key]) => key)
+ }
diff --git a/packages/sdk/package.json b/packages/sdk/package.json
index ad4f5615f1..2e51566f8c 100644
--- a/packages/sdk/package.json
+++ b/packages/sdk/package.json
@@ -1,6 +1,6 @@
{
"name": "@budibase/sdk",
- "version": "2.2.12-alpha.32",
+ "version": "2.2.12-alpha.41",
"description": "Budibase Public API SDK",
"author": "Budibase",
"license": "MPL-2.0",
diff --git a/packages/sdk/yarn.lock b/packages/sdk/yarn.lock
index 4e8d6d718f..c3106e4ed7 100644
--- a/packages/sdk/yarn.lock
+++ b/packages/sdk/yarn.lock
@@ -225,9 +225,9 @@ concat-map@0.0.1:
integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==
cookiejar@^2.1.2:
- version "2.1.3"
- resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.1.3.tgz#fc7a6216e408e74414b90230050842dacda75acc"
- integrity sha512-JxbCBUdrfr6AQjOXrxoTvAMJO4HBTUIlBzslcJPAz+/KT8yk53fXun51u+RenNYvad/+Vc2DIz5o9UxlCDymFQ==
+ version "2.1.4"
+ resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.1.4.tgz#ee669c1fea2cf42dc31585469d193fef0d65771b"
+ integrity sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==
debug@^4.1.1:
version "4.3.4"
diff --git a/packages/server/package.json b/packages/server/package.json
index 0ba9468623..eb6ac3def1 100644
--- a/packages/server/package.json
+++ b/packages/server/package.json
@@ -1,7 +1,7 @@
{
"name": "@budibase/server",
"email": "hi@budibase.com",
- "version": "2.2.12-alpha.32",
+ "version": "2.2.12-alpha.41",
"description": "Budibase Web Server",
"main": "src/index.ts",
"repository": {
@@ -43,11 +43,11 @@
"license": "GPL-3.0",
"dependencies": {
"@apidevtools/swagger-parser": "10.0.3",
- "@budibase/backend-core": "2.2.12-alpha.32",
- "@budibase/client": "2.2.12-alpha.32",
- "@budibase/pro": "2.2.12-alpha.32",
- "@budibase/string-templates": "2.2.12-alpha.32",
- "@budibase/types": "2.2.12-alpha.32",
+ "@budibase/backend-core": "2.2.12-alpha.41",
+ "@budibase/client": "2.2.12-alpha.41",
+ "@budibase/pro": "2.2.12-alpha.41",
+ "@budibase/string-templates": "2.2.12-alpha.41",
+ "@budibase/types": "2.2.12-alpha.41",
"@bull-board/api": "3.7.0",
"@bull-board/koa": "3.9.4",
"@elastic/elasticsearch": "7.10.0",
diff --git a/packages/server/src/automations/tests/loop.spec.ts b/packages/server/src/automations/tests/loop.spec.ts
new file mode 100644
index 0000000000..b64f7b16f8
--- /dev/null
+++ b/packages/server/src/automations/tests/loop.spec.ts
@@ -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)
+ })
+})
diff --git a/packages/server/src/automations/triggers.ts b/packages/server/src/automations/triggers.ts
index f4b34bc9e8..78f8a87b0c 100644
--- a/packages/server/src/automations/triggers.ts
+++ b/packages/server/src/automations/triggers.ts
@@ -109,8 +109,13 @@ export async function externalTrigger(
}
params.fields = coercedFields
}
- const data = { automation, event: params }
+ const data: Record = { automation, event: params }
if (getResponses) {
+ data.event = {
+ ...data.event,
+ appId: context.getAppId(),
+ automation,
+ }
return utils.processEvent({ data })
} else {
return automationQueue.add(data, JOB_OPTS)
diff --git a/packages/server/src/integrations/mongodb.ts b/packages/server/src/integrations/mongodb.ts
index 9ccefbda58..38b3891fe4 100644
--- a/packages/server/src/integrations/mongodb.ts
+++ b/packages/server/src/integrations/mongodb.ts
@@ -12,11 +12,16 @@ import {
FindOneAndUpdateOptions,
UpdateOptions,
OperationOptions,
+ MongoClientOptions,
} from "mongodb"
+import environment from "../environment"
interface MongoDBConfig {
connectionString: string
db: string
+ tlsCertificateFile: string
+ tlsCertificateKeyFile: string
+ tlsCAFile: string
}
interface MongoDBQuery {
@@ -26,292 +31,331 @@ interface MongoDBQuery {
}
}
-const SCHEMA: Integration = {
- docs: "https://github.com/mongodb/node-mongodb-native",
- friendlyName: "MongoDB",
- type: "Non-relational",
- description:
- "MongoDB is a general purpose, document-based, distributed database built for modern application developers and for the cloud era.",
- datasource: {
- connectionString: {
- type: DatasourceFieldType.STRING,
- required: true,
- default: "mongodb://localhost:27017",
- },
- db: {
- type: DatasourceFieldType.STRING,
- required: true,
- },
- },
- query: {
- create: {
- type: QueryType.JSON,
- },
- read: {
- type: QueryType.JSON,
- },
- update: {
- type: QueryType.JSON,
- },
- delete: {
- type: QueryType.JSON,
- },
- aggregate: {
- type: QueryType.JSON,
- readable: true,
- steps: [
- {
- key: "$addFields",
- template: "{\n\t\n}",
- },
- {
- key: "$bucket",
- template: `{
- "groupBy": "",
- "boundaries": [],
- "default": "",
- "output": {}
-}`,
- },
- {
- key: "$bucketAuto",
- template: `{
- "groupBy": "",
- "buckets": 1,
- "output": {},
- "granularity": "R5"
-}`,
- },
- {
- key: "$changeStream",
- template: `{
- "allChangesForCluster": true,
- "fullDocument": "",
- "fullDocumentBeforeChange": "",
- "resumeAfter": 1,
- "showExpandedEvents": true,
- "startAfter": {},
- "startAtOperationTime": ""
-}`,
- },
- {
- key: "$collStats",
- template: `{
- "latencyStats": { "histograms": true } },
- "storageStats": { "scale": 1 } },
- "count": {},
- "queryExecStats": {}
-}`,
- },
- {
- key: "$count",
- template: ``,
- },
- {
- key: "$densify",
- template: `{
- "field": "",
- "partitionByFields": [],
- "range": {
- "step": 1,
- "unit": 1,
- "bounds": "full"
- }
-}`,
- },
- {
- key: "$documents",
- template: `[]`,
- },
- {
- key: "$facet",
- template: `{\n\t\n}`,
- },
- {
- key: "$fill",
- template: `{
- "partitionBy": "",
- "partitionByFields": [],
- "sortBy": {},
- "output": {}
-}`,
- },
- {
- key: "$geoNear",
- template: `{
- "near": {
- "type": "Point",
- "coordinates": [
- -73.98142, 40.71782
- ]
- },
- "key": "location",
- "distanceField": "dist.calculated",
- "query": { "category": "Parks" }
-}`,
- },
- {
- key: "$graphLookup",
- template: `{
- "from": "",
- "startWith": "",
- "connectFromField": "",
- "connectToField": "",
- "as": "",
- "maxDepth": 1,
- "depthField": "",
- "restrictSearchWithMatch": {}
-}`,
- },
- {
- key: "$group",
- template: `{
- "_id": ""
-}`,
- },
- {
- key: "$indexStats",
- template: "{\n\t\n}",
- },
- {
- key: "$limit",
- template: `1`,
- },
- {
- key: "$listLocalSessions",
- template: `{\n\t\n}`,
- },
- {
- key: "$listSessions",
- template: `{\n\t\n}`,
- },
- {
- key: "$lookup",
- template: `{
- "from": "",
- "localField": "",
- "foreignField": "",
- "as": ""
-}`,
- },
- {
- key: "$match",
- template: "{\n\t\n}",
- },
- {
- key: "$merge",
- template: `{
- "into": {},
- "on": "_id",
- "whenMatched": "replace",
- "whenNotMatched": "insert"
-}`,
- },
- {
- key: "$out",
- template: `{
- "db": "",
- "coll": ""
-}`,
- },
- {
- key: "$planCacheStats",
- template: "{\n\t\n}",
- },
- {
- key: "$project",
- template: "{\n\t\n}",
- },
- {
- key: "$redact",
- template: "",
- },
- {
- key: "$replaceRoot",
- template: `{ "newRoot": "" }`,
- },
- {
- key: "$replaceWith",
- template: ``,
- },
- {
- key: "$sample",
- template: `{ "size": 3 }`,
- },
- {
- key: "$set",
- template: "{\n\t\n}",
- },
- {
- key: "$setWindowFields",
- template: `{
- "partitionBy": "",
- "sortBy": {},
- "output": {}
-}`,
- },
- {
- key: "$skip",
- template: `1`,
- },
- {
- key: "$sort",
- template: "{\n\t\n}",
- },
- {
- key: "$sortByCount",
- template: "",
- },
- {
- key: "$unionWith",
- template: `{
- "coll": "",
- "pipeline": []
-}`,
- },
- {
- key: "$unset",
- template: "",
- },
- {
- key: "$unwind",
- template: `{
- "path": "",
- "includeArrayIndex": "",
- "preserveNullAndEmptyArrays": true
-}`,
- },
- ],
- },
- },
- extra: {
- collection: {
- displayName: "Collection",
- type: DatasourceFieldType.STRING,
- required: true,
- },
- actionType: {
- displayName: "Query Type",
- type: DatasourceFieldType.LIST,
- required: true,
- data: {
- read: ["find", "findOne", "findOneAndUpdate", "count", "distinct"],
- create: ["insertOne", "insertMany"],
- update: ["updateOne", "updateMany"],
- delete: ["deleteOne", "deleteMany"],
- aggregate: ["json", "pipeline"],
+const getSchema = () => {
+ let schema = {
+ docs: "https://github.com/mongodb/node-mongodb-native",
+ friendlyName: "MongoDB",
+ type: "Non-relational",
+ description:
+ "MongoDB is a general purpose, document-based, distributed database built for modern application developers and for the cloud era.",
+ datasource: {
+ connectionString: {
+ type: DatasourceFieldType.STRING,
+ required: true,
+ default: "mongodb://localhost:27017",
+ display: "Connection string",
+ },
+ db: {
+ type: DatasourceFieldType.STRING,
+ required: true,
+ display: "DB",
},
},
- },
+ query: {
+ create: {
+ type: QueryType.JSON,
+ },
+ read: {
+ type: QueryType.JSON,
+ },
+ update: {
+ type: QueryType.JSON,
+ },
+ delete: {
+ type: QueryType.JSON,
+ },
+ aggregate: {
+ type: QueryType.JSON,
+ readable: true,
+ steps: [
+ {
+ key: "$addFields",
+ template: "{\n\t\n}",
+ },
+ {
+ key: "$bucket",
+ template: `{
+ "groupBy": "",
+ "boundaries": [],
+ "default": "",
+ "output": {}
+ }`,
+ },
+ {
+ key: "$bucketAuto",
+ template: `{
+ "groupBy": "",
+ "buckets": 1,
+ "output": {},
+ "granularity": "R5"
+ }`,
+ },
+ {
+ key: "$changeStream",
+ template: `{
+ "allChangesForCluster": true,
+ "fullDocument": "",
+ "fullDocumentBeforeChange": "",
+ "resumeAfter": 1,
+ "showExpandedEvents": true,
+ "startAfter": {},
+ "startAtOperationTime": ""
+ }`,
+ },
+ {
+ key: "$collStats",
+ template: `{
+ "latencyStats": { "histograms": true } },
+ "storageStats": { "scale": 1 } },
+ "count": {},
+ "queryExecStats": {}
+ }`,
+ },
+ {
+ key: "$count",
+ template: ``,
+ },
+ {
+ key: "$densify",
+ template: `{
+ "field": "",
+ "partitionByFields": [],
+ "range": {
+ "step": 1,
+ "unit": 1,
+ "bounds": "full"
+ }
+ }`,
+ },
+ {
+ key: "$documents",
+ template: `[]`,
+ },
+ {
+ key: "$facet",
+ template: `{\n\t\n}`,
+ },
+ {
+ key: "$fill",
+ template: `{
+ "partitionBy": "",
+ "partitionByFields": [],
+ "sortBy": {},
+ "output": {}
+ }`,
+ },
+ {
+ key: "$geoNear",
+ template: `{
+ "near": {
+ "type": "Point",
+ "coordinates": [
+ -73.98142, 40.71782
+ ]
+ },
+ "key": "location",
+ "distanceField": "dist.calculated",
+ "query": { "category": "Parks" }
+ }`,
+ },
+ {
+ key: "$graphLookup",
+ template: `{
+ "from": "",
+ "startWith": "",
+ "connectFromField": "",
+ "connectToField": "",
+ "as": "",
+ "maxDepth": 1,
+ "depthField": "",
+ "restrictSearchWithMatch": {}
+ }`,
+ },
+ {
+ key: "$group",
+ template: `{
+ "_id": ""
+ }`,
+ },
+ {
+ key: "$indexStats",
+ template: "{\n\t\n}",
+ },
+ {
+ key: "$limit",
+ template: `1`,
+ },
+ {
+ key: "$listLocalSessions",
+ template: `{\n\t\n}`,
+ },
+ {
+ key: "$listSessions",
+ template: `{\n\t\n}`,
+ },
+ {
+ key: "$lookup",
+ template: `{
+ "from": "",
+ "localField": "",
+ "foreignField": "",
+ "as": ""
+ }`,
+ },
+ {
+ key: "$match",
+ template: "{\n\t\n}",
+ },
+ {
+ key: "$merge",
+ template: `{
+ "into": {},
+ "on": "_id",
+ "whenMatched": "replace",
+ "whenNotMatched": "insert"
+ }`,
+ },
+ {
+ key: "$out",
+ template: `{
+ "db": "",
+ "coll": ""
+ }`,
+ },
+ {
+ key: "$planCacheStats",
+ template: "{\n\t\n}",
+ },
+ {
+ key: "$project",
+ template: "{\n\t\n}",
+ },
+ {
+ key: "$redact",
+ template: "",
+ },
+ {
+ key: "$replaceRoot",
+ template: `{ "newRoot": "" }`,
+ },
+ {
+ key: "$replaceWith",
+ template: ``,
+ },
+ {
+ key: "$sample",
+ template: `{ "size": 3 }`,
+ },
+ {
+ key: "$set",
+ template: "{\n\t\n}",
+ },
+ {
+ key: "$setWindowFields",
+ template: `{
+ "partitionBy": "",
+ "sortBy": {},
+ "output": {}
+ }`,
+ },
+ {
+ key: "$skip",
+ template: `1`,
+ },
+ {
+ key: "$sort",
+ template: "{\n\t\n}",
+ },
+ {
+ key: "$sortByCount",
+ template: "",
+ },
+ {
+ key: "$unionWith",
+ template: `{
+ "coll": "",
+ "pipeline": []
+ }`,
+ },
+ {
+ key: "$unset",
+ template: "",
+ },
+ {
+ key: "$unwind",
+ template: `{
+ "path": "",
+ "includeArrayIndex": "",
+ "preserveNullAndEmptyArrays": true
+ }`,
+ },
+ ],
+ },
+ },
+ extra: {
+ collection: {
+ displayName: "Collection",
+ type: DatasourceFieldType.STRING,
+ required: true,
+ },
+ actionType: {
+ displayName: "Query Type",
+ type: DatasourceFieldType.LIST,
+ required: true,
+ data: {
+ read: ["find", "findOne", "findOneAndUpdate", "count", "distinct"],
+ create: ["insertOne", "insertMany"],
+ update: ["updateOne", "updateMany"],
+ delete: ["deleteOne", "deleteMany"],
+ aggregate: ["json", "pipeline"],
+ },
+ },
+ },
+ }
+ if (environment.SELF_HOSTED) {
+ schema.datasource = {
+ ...schema.datasource,
+ //@ts-ignore
+ tls: {
+ type: DatasourceFieldType.FIELD_GROUP,
+ display: "Configure SSL",
+ fields: {
+ tlsCertificateFile: {
+ type: DatasourceFieldType.STRING,
+ required: false,
+ display: "Certificate file path",
+ },
+ tlsCertificateKeyFile: {
+ type: DatasourceFieldType.STRING,
+ required: false,
+ display: "Certificate Key file path",
+ },
+ tlsCAFile: {
+ type: DatasourceFieldType.STRING,
+ required: false,
+ display: "CA file path",
+ },
+ },
+ },
+ }
+ }
+ return schema
}
+const SCHEMA: Integration = getSchema()
+
class MongoIntegration implements IntegrationBase {
private config: MongoDBConfig
private client: any
constructor(config: MongoDBConfig) {
this.config = config
- this.client = new MongoClient(config.connectionString)
+ const options: MongoClientOptions = {
+ tlsCertificateFile: config.tlsCertificateFile || undefined,
+ tlsCertificateKeyFile: config.tlsCertificateKeyFile || undefined,
+ tlsCAFile: config.tlsCAFile || undefined,
+ }
+ this.client = new MongoClient(config.connectionString, options)
}
async connect() {
diff --git a/packages/server/src/tests/utilities/structures.ts b/packages/server/src/tests/utilities/structures.ts
index a412be4931..9d66fecc5e 100644
--- a/packages/server/src/tests/utilities/structures.ts
+++ b/packages/server/src/tests/utilities/structures.ts
@@ -1,8 +1,14 @@
-import { roles, permissions } from "@budibase/backend-core"
+import { permissions, roles } from "@budibase/backend-core"
import { createHomeScreen } from "../../constants/screens"
import { EMPTY_LAYOUT } from "../../constants/layouts"
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")
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) {
return {
name: "Test Contact",
diff --git a/packages/server/src/threads/automation.ts b/packages/server/src/threads/automation.ts
index 44951869f4..d765ef8472 100644
--- a/packages/server/src/threads/automation.ts
+++ b/packages/server/src/threads/automation.ts
@@ -37,9 +37,13 @@ function getLoopIterations(loopStep: LoopStep, input: LoopInput) {
if (!loopStep || !binding) {
return 1
}
- return Array.isArray(binding)
- ? binding.length
- : automationUtils.stringSplit(binding).length
+ if (Array.isArray(binding)) {
+ return binding.length
+ }
+ if (typeof binding === "string") {
+ return automationUtils.stringSplit(binding).length
+ }
+ return 1
}
/**
@@ -280,13 +284,13 @@ class Orchestrator {
break
}
- let item
+ let item = []
if (
typeof loopStep.inputs.binding === "string" &&
loopStep.inputs.option === "String"
) {
item = automationUtils.stringSplit(newInput.binding)
- } else {
+ } else if (Array.isArray(loopStep.inputs.binding)) {
item = loopStep.inputs.binding
}
this._context.steps[loopStepNumber] = {
diff --git a/packages/server/tsconfig.json b/packages/server/tsconfig.json
index bdf42a17e3..dba0d6328a 100644
--- a/packages/server/tsconfig.json
+++ b/packages/server/tsconfig.json
@@ -13,7 +13,8 @@
}
},
"ts-node": {
- "require": ["tsconfig-paths/register"]
+ "require": ["tsconfig-paths/register"],
+ "swc": true
},
"references": [
{ "path": "../types" },
diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock
index 0514fed5d6..c1647399d5 100644
--- a/packages/server/yarn.lock
+++ b/packages/server/yarn.lock
@@ -1273,13 +1273,13 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
-"@budibase/backend-core@2.2.12-alpha.32":
- version "2.2.12-alpha.32"
- resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.12-alpha.32.tgz#5d53fdde38e80fdade73c59cb81623041984a5fc"
- integrity sha512-XoaqGrttx01wlblI0+O23R9uS5FTMgK07juY6mUkdReCK46IvmG7FFnuYu0euKVRbhChSf5X8S+fvKIAEi1ZFw==
+"@budibase/backend-core@2.2.12-alpha.41":
+ version "2.2.12-alpha.41"
+ resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.12-alpha.41.tgz#9fa210c3c94481c38af5aad71ac246451dda6e43"
+ integrity sha512-vYb8x6JgncYdT8VqVi/WfScg4Ng0O1wtt9SspNPKnOX2CR7rA8VH6PW1QMRa5uUYvBFupg6UbY9jFqu2XXtujg==
dependencies:
"@budibase/nano" "10.1.1"
- "@budibase/types" "2.2.12-alpha.32"
+ "@budibase/types" "2.2.12-alpha.41"
"@shopify/jest-koa-mocks" "5.0.1"
"@techpass/passport-openidconnect" "0.3.2"
aws-cloudfront-sign "2.2.0"
@@ -1374,13 +1374,13 @@
qs "^6.11.0"
tough-cookie "^4.1.2"
-"@budibase/pro@2.2.12-alpha.32":
- version "2.2.12-alpha.32"
- resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.12-alpha.32.tgz#4f35b0ada97458cc69ee41ebb40d56b361518065"
- integrity sha512-Kn/IahgIb9Ydzmasv4Bhlh3rvyAC2tBVSoI33OZ/6PKF0vPYJNJkFds3iGELNV7SyWoLbVWb2z5SQ4SSaOYsJw==
+"@budibase/pro@2.2.12-alpha.41":
+ version "2.2.12-alpha.41"
+ resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.12-alpha.41.tgz#c1923d52d7cd2ace665e44b196c91578b1b50bbe"
+ integrity sha512-J1yN74Gixa8UzkD44Ydzj2iR+5WRbJtjZzn7NFI3VB1A2sTLxmilSBRyCALzhF3UMpueaBRjwWBovbF/De106A==
dependencies:
- "@budibase/backend-core" "2.2.12-alpha.32"
- "@budibase/types" "2.2.12-alpha.32"
+ "@budibase/backend-core" "2.2.12-alpha.41"
+ "@budibase/types" "2.2.12-alpha.41"
"@koa/router" "8.0.8"
bull "4.10.1"
joi "17.6.0"
@@ -1405,10 +1405,10 @@
svelte-apexcharts "^1.0.2"
svelte-flatpickr "^3.1.0"
-"@budibase/types@2.2.12-alpha.32":
- version "2.2.12-alpha.32"
- resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.12-alpha.32.tgz#71af8e8cff66acbfd65aa87e66183dd95d76ce6f"
- integrity sha512-ZZwmO+0ORGEFbU/EQvtnjo1VonUbBdsciFkTOiopVupU5iNY2oCKgbYTQiTZZisQrRuiKdPV6P17uV+YTkjQSQ==
+"@budibase/types@2.2.12-alpha.41":
+ version "2.2.12-alpha.41"
+ resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.12-alpha.41.tgz#662115c5ba09f3c2057a96321e233c819cfae84b"
+ integrity sha512-+uzr668cuvDTMqy7roWiG/qQzOzQO7uWYtysaHPsQQG5PxA0ZuwixJOvvX1qOr1rgv9Is54p9J7dvzvtKW/wAw==
"@bull-board/api@3.7.0":
version "3.7.0"
@@ -5474,9 +5474,9 @@ cookie@^0.5.0:
integrity sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==
cookiejar@^2.1.0:
- version "2.1.3"
- resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.1.3.tgz#fc7a6216e408e74414b90230050842dacda75acc"
- integrity sha512-JxbCBUdrfr6AQjOXrxoTvAMJO4HBTUIlBzslcJPAz+/KT8yk53fXun51u+RenNYvad/+Vc2DIz5o9UxlCDymFQ==
+ version "2.1.4"
+ resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.1.4.tgz#ee669c1fea2cf42dc31585469d193fef0d65771b"
+ integrity sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==
cookies@~0.8.0:
version "0.8.0"
diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json
index b523f2cd0e..d70ebc28b2 100644
--- a/packages/string-templates/package.json
+++ b/packages/string-templates/package.json
@@ -1,6 +1,6 @@
{
"name": "@budibase/string-templates",
- "version": "2.2.12-alpha.32",
+ "version": "2.2.12-alpha.41",
"description": "Handlebars wrapper for Budibase templating.",
"main": "src/index.cjs",
"module": "dist/bundle.mjs",
diff --git a/packages/types/package.json b/packages/types/package.json
index 8a27829c47..6d7c09d9a9 100644
--- a/packages/types/package.json
+++ b/packages/types/package.json
@@ -1,6 +1,6 @@
{
"name": "@budibase/types",
- "version": "2.2.12-alpha.32",
+ "version": "2.2.12-alpha.41",
"description": "Budibase types",
"main": "dist/index.js",
"types": "dist/index.d.ts",
diff --git a/packages/types/src/documents/app/automation.ts b/packages/types/src/documents/app/automation.ts
index 184fed629d..0aa11d808b 100644
--- a/packages/types/src/documents/app/automation.ts
+++ b/packages/types/src/documents/app/automation.ts
@@ -50,6 +50,7 @@ export interface AutomationStepSchema {
internal?: boolean
deprecated?: boolean
stepId: AutomationTriggerStepId | AutomationActionStepId
+ blockToLoop?: string
inputs: {
[key: string]: any
}
diff --git a/packages/types/src/sdk/datasources.ts b/packages/types/src/sdk/datasources.ts
index 279a76446f..1847725c9d 100644
--- a/packages/types/src/sdk/datasources.ts
+++ b/packages/types/src/sdk/datasources.ts
@@ -33,6 +33,7 @@ export enum DatasourceFieldType {
OBJECT = "object",
JSON = "json",
FILE = "file",
+ FIELD_GROUP = "fieldGroup",
}
export enum SourceName {
@@ -95,6 +96,16 @@ export interface ExtraQueryConfig {
}
}
+export interface DatasourceConfig {
+ [key: string]: {
+ type: string
+ display?: string
+ required?: boolean
+ default?: any
+ deprecated?: boolean
+ }
+}
+
export interface Integration {
docs: string
plus?: boolean
@@ -104,7 +115,7 @@ export interface Integration {
friendlyName: string
type?: string
iconUrl?: string
- datasource: {}
+ datasource: DatasourceConfig
query: {
[key: string]: QueryDefinition
}
diff --git a/packages/worker/package.json b/packages/worker/package.json
index 3cef4d12f6..83761f0a31 100644
--- a/packages/worker/package.json
+++ b/packages/worker/package.json
@@ -1,7 +1,7 @@
{
"name": "@budibase/worker",
"email": "hi@budibase.com",
- "version": "2.2.12-alpha.32",
+ "version": "2.2.12-alpha.41",
"description": "Budibase background service",
"main": "src/index.ts",
"repository": {
@@ -36,10 +36,10 @@
"author": "Budibase",
"license": "GPL-3.0",
"dependencies": {
- "@budibase/backend-core": "2.2.12-alpha.32",
- "@budibase/pro": "2.2.12-alpha.32",
- "@budibase/string-templates": "2.2.12-alpha.32",
- "@budibase/types": "2.2.12-alpha.32",
+ "@budibase/backend-core": "2.2.12-alpha.41",
+ "@budibase/pro": "2.2.12-alpha.41",
+ "@budibase/string-templates": "2.2.12-alpha.41",
+ "@budibase/types": "2.2.12-alpha.41",
"@koa/router": "8.0.8",
"@sentry/node": "6.17.7",
"@techpass/passport-openidconnect": "0.3.2",
diff --git a/packages/worker/tsconfig.json b/packages/worker/tsconfig.json
index 3f6d4b30dc..3c8500d248 100644
--- a/packages/worker/tsconfig.json
+++ b/packages/worker/tsconfig.json
@@ -13,7 +13,8 @@
}
},
"ts-node": {
- "require": ["tsconfig-paths/register"]
+ "require": ["tsconfig-paths/register"],
+ "swc": true
},
"references": [
{ "path": "../types" },
diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock
index 052edf0197..f172c7f774 100644
--- a/packages/worker/yarn.lock
+++ b/packages/worker/yarn.lock
@@ -470,13 +470,13 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
-"@budibase/backend-core@2.2.12-alpha.32":
- version "2.2.12-alpha.32"
- resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.12-alpha.32.tgz#5d53fdde38e80fdade73c59cb81623041984a5fc"
- integrity sha512-XoaqGrttx01wlblI0+O23R9uS5FTMgK07juY6mUkdReCK46IvmG7FFnuYu0euKVRbhChSf5X8S+fvKIAEi1ZFw==
+"@budibase/backend-core@2.2.12-alpha.41":
+ version "2.2.12-alpha.41"
+ resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.12-alpha.41.tgz#9fa210c3c94481c38af5aad71ac246451dda6e43"
+ integrity sha512-vYb8x6JgncYdT8VqVi/WfScg4Ng0O1wtt9SspNPKnOX2CR7rA8VH6PW1QMRa5uUYvBFupg6UbY9jFqu2XXtujg==
dependencies:
"@budibase/nano" "10.1.1"
- "@budibase/types" "2.2.12-alpha.32"
+ "@budibase/types" "2.2.12-alpha.41"
"@shopify/jest-koa-mocks" "5.0.1"
"@techpass/passport-openidconnect" "0.3.2"
aws-cloudfront-sign "2.2.0"
@@ -521,23 +521,23 @@
qs "^6.11.0"
tough-cookie "^4.1.2"
-"@budibase/pro@2.2.12-alpha.32":
- version "2.2.12-alpha.32"
- resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.12-alpha.32.tgz#4f35b0ada97458cc69ee41ebb40d56b361518065"
- integrity sha512-Kn/IahgIb9Ydzmasv4Bhlh3rvyAC2tBVSoI33OZ/6PKF0vPYJNJkFds3iGELNV7SyWoLbVWb2z5SQ4SSaOYsJw==
+"@budibase/pro@2.2.12-alpha.41":
+ version "2.2.12-alpha.41"
+ resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.12-alpha.41.tgz#c1923d52d7cd2ace665e44b196c91578b1b50bbe"
+ integrity sha512-J1yN74Gixa8UzkD44Ydzj2iR+5WRbJtjZzn7NFI3VB1A2sTLxmilSBRyCALzhF3UMpueaBRjwWBovbF/De106A==
dependencies:
- "@budibase/backend-core" "2.2.12-alpha.32"
- "@budibase/types" "2.2.12-alpha.32"
+ "@budibase/backend-core" "2.2.12-alpha.41"
+ "@budibase/types" "2.2.12-alpha.41"
"@koa/router" "8.0.8"
bull "4.10.1"
joi "17.6.0"
jsonwebtoken "8.5.1"
node-fetch "^2.6.1"
-"@budibase/types@2.2.12-alpha.32":
- version "2.2.12-alpha.32"
- resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.12-alpha.32.tgz#71af8e8cff66acbfd65aa87e66183dd95d76ce6f"
- integrity sha512-ZZwmO+0ORGEFbU/EQvtnjo1VonUbBdsciFkTOiopVupU5iNY2oCKgbYTQiTZZisQrRuiKdPV6P17uV+YTkjQSQ==
+"@budibase/types@2.2.12-alpha.41":
+ version "2.2.12-alpha.41"
+ resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.12-alpha.41.tgz#662115c5ba09f3c2057a96321e233c819cfae84b"
+ integrity sha512-+uzr668cuvDTMqy7roWiG/qQzOzQO7uWYtysaHPsQQG5PxA0ZuwixJOvvX1qOr1rgv9Is54p9J7dvzvtKW/wAw==
"@cspotcode/source-map-support@^0.8.0":
version "0.8.1"
@@ -2680,9 +2680,9 @@ cookie@^0.5.0:
integrity sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==
cookiejar@^2.1.3:
- version "2.1.3"
- resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.1.3.tgz#fc7a6216e408e74414b90230050842dacda75acc"
- integrity sha512-JxbCBUdrfr6AQjOXrxoTvAMJO4HBTUIlBzslcJPAz+/KT8yk53fXun51u+RenNYvad/+Vc2DIz5o9UxlCDymFQ==
+ version "2.1.4"
+ resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.1.4.tgz#ee669c1fea2cf42dc31585469d193fef0d65771b"
+ integrity sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==
cookies@~0.8.0:
version "0.8.0"
diff --git a/pull_request_template.md b/pull_request_template.md
index ade39d55e4..36e2f425d5 100644
--- a/pull_request_template.md
+++ b/pull_request_template.md
@@ -11,5 +11,8 @@ Addresses:
## Screenshots
_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.
+