Merge branch 'master' into BUDI-9296/new-screen-as-modal
This commit is contained in:
commit
eb1b69ea11
|
@ -38,10 +38,10 @@ jobs:
|
|||
submodules: ${{ env.IS_OSS_CONTRIBUTOR == 'false' }}
|
||||
token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }}
|
||||
|
||||
- name: Use Node.js 20.x
|
||||
- name: Use Node.js 22.x
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20.x
|
||||
node-version: 22.x
|
||||
cache: yarn
|
||||
- run: yarn --frozen-lockfile
|
||||
- run: yarn lint
|
||||
|
@ -56,10 +56,10 @@ jobs:
|
|||
token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Use Node.js 20.x
|
||||
- name: Use Node.js 22.x
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20.x
|
||||
node-version: 22.x
|
||||
cache: yarn
|
||||
- run: yarn --frozen-lockfile
|
||||
|
||||
|
@ -83,7 +83,7 @@ jobs:
|
|||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Use Node.js 20.x
|
||||
- name: Use Node.js 22.x
|
||||
uses: azure/setup-helm@v3
|
||||
- run: cd charts/budibase && helm lint .
|
||||
|
||||
|
@ -97,10 +97,10 @@ jobs:
|
|||
token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Use Node.js 20.x
|
||||
- name: Use Node.js 22.x
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20.x
|
||||
node-version: 22.x
|
||||
cache: yarn
|
||||
- name: Pull testcontainers images
|
||||
run: |
|
||||
|
@ -131,10 +131,10 @@ jobs:
|
|||
token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Use Node.js 20.x
|
||||
- name: Use Node.js 22.x
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20.x
|
||||
node-version: 22.x
|
||||
cache: yarn
|
||||
- run: yarn --frozen-lockfile
|
||||
- name: Test worker
|
||||
|
@ -176,10 +176,10 @@ jobs:
|
|||
token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Use Node.js 20.x
|
||||
- name: Use Node.js 22.x
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20.x
|
||||
node-version: 22.x
|
||||
cache: yarn
|
||||
|
||||
- name: Load dotenv
|
||||
|
@ -326,10 +326,10 @@ jobs:
|
|||
submodules: ${{ env.IS_OSS_CONTRIBUTOR == 'false' }}
|
||||
token: ${{ secrets.PERSONAL_ACCESS_TOKEN || github.token }}
|
||||
|
||||
- name: Use Node.js 20.x
|
||||
- name: Use Node.js 22.x
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20.x
|
||||
node-version: 22.x
|
||||
cache: yarn
|
||||
- run: yarn install
|
||||
- name: Check for yarn.lock changes
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
nodejs 20.10.0
|
||||
nodejs 22.15.0
|
||||
python 3.10.0
|
||||
yarn 1.22.22
|
||||
|
|
|
@ -90,7 +90,7 @@ Component libraries are collections of components as well as the definition of t
|
|||
|
||||
#### 1. Prerequisites
|
||||
|
||||
- NodeJS version `20.x.x`
|
||||
- NodeJS version `22.x.x`
|
||||
- Python version `3.x`
|
||||
|
||||
### Using asdf (recommended)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# Docker Single Image for Budibase
|
||||
|
||||
## Overview
|
||||
|
||||
As an alternative to running several docker containers via docker-compose, the files under ./hosting/single can be used to build a docker image containing all of the Budibase components (minio, couch, clouseau etc).
|
||||
We call this the 'single image' container as the Dockerfile adds all the components to a single docker image.
|
||||
|
||||
|
@ -13,16 +14,20 @@ We call this the 'single image' container as the Dockerfile adds all the compone
|
|||
|
||||
### Amend Environment Variables
|
||||
|
||||
Edit the Dockerfile in this directory amending the environment variables to suit your usage. Pay particular attention to changing passwords.
|
||||
Edit the Dockerfile in this directory amending the environment variables to suit your usage. Pay particular attention to changing passwords.
|
||||
The CUSTOM_DOMAIN variable will be used to request a certificate from LetsEncrypt and if successful you can point traffic to port 443. If you choose to use the CUSTOM_DOMAIN variable ensure that the DNS for your custom domain points to the public IP address where you are running Budibase - otherwise the certificate issuance will fail.
|
||||
If you have other arrangements for a proxy in front of the single image container you can omit the CUSTOM_DOMAIN environment variable and the request to LetsEncrypt will be skipped. You can then point traffic to port 80.
|
||||
|
||||
### Build Requirements
|
||||
|
||||
We would suggest building the image with 6GB of RAM and 20GB of free disk space for build artifacts. The resulting image size will use approx 2GB of disk space.
|
||||
|
||||
### Build the Image
|
||||
The guidance below is based on building the Budibase single image on Debian 11 and AlmaLinux 8. If you use another distro or OS you will need to amend the commands to suit.
|
||||
|
||||
The guidance below is based on building the Budibase single image on Debian 11 and AlmaLinux 8. If you use another distro or OS you will need to amend the commands to suit.
|
||||
|
||||
#### Install Node
|
||||
|
||||
Budibase requires a more recent version of node (14+) than is available in the base Debian repos so:
|
||||
|
||||
```
|
||||
|
@ -30,10 +35,13 @@ curl -sL https://deb.nodesource.com/setup_16.x | sudo bash -
|
|||
apt install -y nodejs
|
||||
node -v
|
||||
```
|
||||
|
||||
Install yarn and lerna:
|
||||
|
||||
```
|
||||
npm install -g yarn jest lerna
|
||||
```
|
||||
|
||||
#### Install Docker
|
||||
|
||||
```
|
||||
|
@ -42,45 +50,60 @@ apt install -y docker.io
|
|||
|
||||
Check the versions of each installed version. This process was tested with the version numbers below so YMMV using anything else:
|
||||
|
||||
- Docker: 20.10.5
|
||||
- Docker: 22.11.0
|
||||
- node: 16.15.1
|
||||
- yarn: 1.22.19
|
||||
- lerna: 5.1.4
|
||||
|
||||
#### Get the Code
|
||||
|
||||
Clone the Budibase repo
|
||||
|
||||
```
|
||||
git clone https://github.com/Budibase/budibase.git
|
||||
cd budibase
|
||||
```
|
||||
|
||||
#### Setup Node
|
||||
|
||||
Node setup:
|
||||
|
||||
```
|
||||
node ./hosting/scripts/setup.js
|
||||
yarn
|
||||
yarn build
|
||||
```
|
||||
|
||||
#### Build Image
|
||||
|
||||
The following yarn command does some prep and then runs the docker build command:
|
||||
|
||||
```
|
||||
yarn build:docker:single
|
||||
```
|
||||
|
||||
If the docker build step fails try running that step again manually with:
|
||||
|
||||
```
|
||||
docker build --build-arg TARGETARCH=amd --no-cache -t budibase:latest -f ./hosting/single/Dockerfile .
|
||||
```
|
||||
|
||||
#### Azure App Services
|
||||
|
||||
Azure have some specific requirements for running a container in their App Service. Specifically, installation of SSH to port 2222 and data storage under /home. If you would like to build a budibase container for Azure App Service add the build argument shown below setting it to 'aas'. You can remove the CUSTOM_DOMAIN env variable from the Dockerfile too as Azure terminate SSL before requests reach the container.
|
||||
|
||||
```
|
||||
docker build --build-arg TARGETARCH=amd --build-arg TARGETBUILD=aas -t budibase:latest -f ./hosting/single/Dockerfile .
|
||||
```
|
||||
|
||||
### Run the Container
|
||||
|
||||
```
|
||||
docker run -d -p 80:80 -p 443:443 --name budibase budibase:latest
|
||||
```
|
||||
|
||||
Where:
|
||||
|
||||
- -d runs the container in detached mode
|
||||
- -p forwards ports from your host to the ports inside the container. If you are already using port 80 on your host for something else you can try running with an alternative port e.g. `-p 8080:80`
|
||||
- --name is the name for the container as shown in `docker ps` and can be used with other docker commands e.g. `docker restart budibase`
|
||||
|
@ -90,21 +113,28 @@ When the container runs you should be able to access the container over http at
|
|||
When the Budibase UI appears you will be prompted to create an account to get started.
|
||||
|
||||
### Podman
|
||||
|
||||
The single image container builds fine when using podman in place of docker. You may be prompted for the registry to use for the CouchDB image and the HEALTHCHECK parameter is not OCI compliant so is ignored.
|
||||
|
||||
### Check
|
||||
|
||||
There are many things that could go wrong so if your container is not building or running as expected please check the following before opening a support issue.
|
||||
Verify the healthcheck status of the container:
|
||||
|
||||
```
|
||||
docker ps
|
||||
```
|
||||
|
||||
Check the container logs:
|
||||
|
||||
```
|
||||
docker logs budibase
|
||||
```
|
||||
|
||||
### Support
|
||||
|
||||
This single image build is still a work-in-progress so if you open an issue please provide the following information:
|
||||
|
||||
- The OS and OS version you are building on
|
||||
- The versions you are using of docker, docker-compose, yarn, node, lerna
|
||||
- For build errors please provide zipped output
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
# Docker Image for Running Budibase Tests
|
||||
|
||||
## Overview
|
||||
This image contains the basic setup for running
|
||||
|
||||
This image contains the basic setup for running
|
||||
|
||||
## Usage
|
||||
|
||||
- Build the Image
|
||||
- Run the Container
|
||||
|
||||
|
||||
### Build the Image
|
||||
The guidance below is based on building the Budibase single image on Debian 11 and AlmaLinux 8. If you use another distro or OS you will need to amend the commands to suit.
|
||||
|
||||
The guidance below is based on building the Budibase single image on Debian 11 and AlmaLinux 8. If you use another distro or OS you will need to amend the commands to suit.
|
||||
|
||||
#### Install Node
|
||||
|
||||
Budibase requires a more recent version of node (14+) than is available in the base Debian repos so:
|
||||
|
||||
```
|
||||
|
@ -19,10 +22,13 @@ curl -sL https://deb.nodesource.com/setup_16.x | sudo bash -
|
|||
apt install -y nodejs
|
||||
node -v
|
||||
```
|
||||
|
||||
Install yarn and lerna:
|
||||
|
||||
```
|
||||
npm install -g yarn jest lerna
|
||||
```
|
||||
|
||||
#### Install Docker
|
||||
|
||||
```
|
||||
|
@ -31,26 +37,34 @@ apt install -y docker.io
|
|||
|
||||
Check the versions of each installed version. This process was tested with the version numbers below so YMMV using anything else:
|
||||
|
||||
- Docker: 20.10.5
|
||||
- Docker: 22.11.0
|
||||
- node: 16.15.1
|
||||
- yarn: 1.22.19
|
||||
- lerna: 5.1.4
|
||||
|
||||
#### Get the Code
|
||||
|
||||
Clone the Budibase repo
|
||||
|
||||
```
|
||||
git clone https://github.com/Budibase/budibase.git
|
||||
cd budibase
|
||||
```
|
||||
|
||||
#### Setup Node
|
||||
|
||||
Node setup:
|
||||
|
||||
```
|
||||
node ./hosting/scripts/setup.js
|
||||
yarn
|
||||
yarn build
|
||||
```
|
||||
|
||||
#### Build Image
|
||||
|
||||
The following yarn command does some prep and then runs the docker build command:
|
||||
|
||||
```
|
||||
yarn build:docker:dependencies
|
||||
```
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"@babel/eslint-parser": "7.25.9",
|
||||
"@babel/preset-env": "^7.22.5",
|
||||
"@esbuild-plugins/tsconfig-paths": "^0.1.2",
|
||||
"@types/node": "^20.17.9",
|
||||
"@types/node": "^22.15.3",
|
||||
"@types/proper-lockfile": "^4.1.4",
|
||||
"@typescript-eslint/parser": "8.17.0",
|
||||
"@vitest/eslint-plugin": "^1.1.14",
|
||||
|
@ -119,9 +119,11 @@
|
|||
"fast-xml-parser": "4.4.1",
|
||||
"@azure/identity": "4.2.1",
|
||||
"kind-of": "6.0.3",
|
||||
"globals": "15.13.0"
|
||||
"**/nan": "2.22.0",
|
||||
"globals": "15.13.0",
|
||||
"esm": "npm:esm-wallaby@3.2.32"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20.0.0 <21.0.0"
|
||||
"node": ">=22.0.0 <23.0.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -408,7 +408,7 @@ export async function retrieveDirectory(bucketName: string, path: string) {
|
|||
objects.map(obj => getReadStream(bucketName, obj.Key!))
|
||||
)
|
||||
let count = 0
|
||||
const writePromises: Promise<Error>[] = []
|
||||
const writePromises: Promise<void>[] = []
|
||||
for (let obj of objects) {
|
||||
const filename = obj.Key!
|
||||
const stream = streams[count++]
|
||||
|
@ -423,8 +423,8 @@ export async function retrieveDirectory(bucketName: string, path: string) {
|
|||
})
|
||||
stream.pipe(writeStream)
|
||||
writePromises.push(
|
||||
new Promise((resolve, reject) => {
|
||||
writeStream.on("finish", resolve)
|
||||
new Promise<void>((resolve, reject) => {
|
||||
writeStream.on("finish", () => resolve())
|
||||
stream.on("error", reject)
|
||||
writeStream.on("error", reject)
|
||||
})
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
"@babel/preset-env": "^7.13.12",
|
||||
"@rollup/plugin-replace": "^5.0.3",
|
||||
"@rollup/plugin-typescript": "8.3.0",
|
||||
"@roxi/routify": "2.18.12",
|
||||
"@roxi/routify": "2.18.18",
|
||||
"@sveltejs/vite-plugin-svelte": "1.4.0",
|
||||
"@testing-library/jest-dom": "6.4.2",
|
||||
"@testing-library/svelte": "^4.1.0",
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 03db438be3a05c5b3e083d124f6dea6b6143cb7a
|
||||
Subproject commit f2cbe5aff7645eb9b0b4e864924a1e1171ad85bf
|
|
@ -94,7 +94,7 @@
|
|||
"google-auth-library": "^8.0.1",
|
||||
"google-spreadsheet": "npm:@budibase/google-spreadsheet@4.1.5",
|
||||
"ioredis": "5.3.2",
|
||||
"isolated-vm": "^4.7.2",
|
||||
"isolated-vm": "^5.0.1",
|
||||
"jimp": "1.1.4",
|
||||
"joi": "17.6.0",
|
||||
"js-yaml": "4.1.0",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import {
|
||||
Automation,
|
||||
AutomationStatus,
|
||||
TriggerAutomationStepInputs,
|
||||
TriggerAutomationStepOutputs,
|
||||
} from "@budibase/types"
|
||||
|
@ -19,25 +20,28 @@ export async function run({
|
|||
if (!inputs.automation.automationId) {
|
||||
return {
|
||||
success: false,
|
||||
status: AutomationStatus.ERROR,
|
||||
}
|
||||
} else {
|
||||
const db = context.getAppDB()
|
||||
let automation = await db.get<Automation>(inputs.automation.automationId)
|
||||
|
||||
let timeout = env.AUTOMATION_THREAD_TIMEOUT
|
||||
if (inputs.timeout !== undefined) {
|
||||
timeout = inputs.timeout * 1000
|
||||
}
|
||||
|
||||
const response = await triggers.externalTrigger(
|
||||
automation,
|
||||
{
|
||||
fields: { ...fieldParams },
|
||||
timeout:
|
||||
inputs.timeout * 1000 || env.getDefaults().AUTOMATION_SYNC_TIMEOUT,
|
||||
},
|
||||
{ fields: { ...fieldParams }, timeout },
|
||||
{ getResponses: true }
|
||||
)
|
||||
|
||||
if (triggers.isAutomationResults(response)) {
|
||||
return {
|
||||
success: true,
|
||||
success: response.status === AutomationStatus.SUCCESS,
|
||||
value: response.steps,
|
||||
status: response.status,
|
||||
}
|
||||
} else {
|
||||
throw new Error("Automation did not have a collect block")
|
||||
|
@ -46,6 +50,7 @@ export async function run({
|
|||
} else {
|
||||
return {
|
||||
success: false,
|
||||
status: AutomationStatus.ERROR,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as automation from "../../index"
|
||||
import env from "../../../environment"
|
||||
import TestConfiguration from "../../../tests/utilities/TestConfiguration"
|
||||
import { createAutomationBuilder } from "../utilities/AutomationTestBuilder"
|
||||
import { AutomationStatus } from "@budibase/types"
|
||||
|
||||
describe("Test triggering an automation from another automation", () => {
|
||||
const config = new TestConfiguration()
|
||||
|
@ -29,7 +29,6 @@ describe("Test triggering an automation from another automation", () => {
|
|||
automation: {
|
||||
automationId: automation._id!,
|
||||
},
|
||||
timeout: env.getDefaults().AUTOMATION_THREAD_TIMEOUT,
|
||||
})
|
||||
.test({ fields: {} })
|
||||
|
||||
|
@ -44,10 +43,30 @@ describe("Test triggering an automation from another automation", () => {
|
|||
// @ts-expect-error - incorrect on purpose
|
||||
automationId: null,
|
||||
},
|
||||
timeout: env.getDefaults().AUTOMATION_THREAD_TIMEOUT,
|
||||
})
|
||||
.test({ fields: {} })
|
||||
|
||||
expect(result.steps[0].outputs.success).toBe(false)
|
||||
})
|
||||
|
||||
it("should fail if the child automation times out", async () => {
|
||||
const { automation } = await createAutomationBuilder(config)
|
||||
.onAppAction()
|
||||
.delay({ time: 1000 })
|
||||
.save()
|
||||
|
||||
const result = await createAutomationBuilder(config)
|
||||
.onAppAction()
|
||||
.triggerAutomationRun({
|
||||
automation: {
|
||||
automationId: automation._id!,
|
||||
},
|
||||
timeout: 0.1,
|
||||
})
|
||||
.test({ fields: {} })
|
||||
|
||||
expect(result.steps[0].outputs.success).toBe(false)
|
||||
expect(result.steps[0].outputs.status).toBe(AutomationStatus.TIMED_OUT)
|
||||
expect(result.status).toBe(AutomationStatus.ERROR)
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { createAutomationBuilder } from "../utilities/AutomationTestBuilder"
|
||||
import TestConfiguration from "../../../tests/utilities/TestConfiguration"
|
||||
import { captureAutomationResults } from "../utilities"
|
||||
import { Automation, AutomationIOType } from "@budibase/types"
|
||||
import { Automation, AutomationIOType, AutomationStatus } from "@budibase/types"
|
||||
|
||||
describe("app action trigger", () => {
|
||||
const config = new TestConfiguration()
|
||||
|
@ -77,4 +77,15 @@ describe("app action trigger", () => {
|
|||
boolean: true,
|
||||
})
|
||||
})
|
||||
|
||||
it("should report that it has timed out if the timeout is reached", async () => {
|
||||
const result = await createAutomationBuilder(config)
|
||||
.onAppAction()
|
||||
.delay({
|
||||
time: 1000,
|
||||
})
|
||||
.test({ fields: {}, timeout: 10 })
|
||||
|
||||
expect(result.status).toEqual(AutomationStatus.TIMED_OUT)
|
||||
})
|
||||
})
|
||||
|
|
|
@ -181,7 +181,9 @@ class StepBuilder<
|
|||
return new AutomationRunner<TStep>(this.config, automation)
|
||||
}
|
||||
|
||||
async test(triggerOutput: AutomationTriggerOutputs<TStep>) {
|
||||
async test(
|
||||
triggerOutput: AutomationTriggerOutputs<TStep> & TestAutomationRequest
|
||||
) {
|
||||
const runner = await this.save()
|
||||
return await runner.test(triggerOutput)
|
||||
}
|
||||
|
@ -203,11 +205,12 @@ class AutomationRunner<TStep extends AutomationTriggerStepId> {
|
|||
this.automation = automation
|
||||
}
|
||||
|
||||
async test(triggerOutput: AutomationTriggerOutputs<TStep>) {
|
||||
async test(
|
||||
triggerOutput: AutomationTriggerOutputs<TStep> & TestAutomationRequest
|
||||
) {
|
||||
const response = await this.config.api.automation.test(
|
||||
this.automation._id!,
|
||||
// TODO: figure out why this cast is needed.
|
||||
triggerOutput as TestAutomationRequest
|
||||
triggerOutput
|
||||
)
|
||||
|
||||
if (isDidNotTriggerResponse(response)) {
|
||||
|
|
|
@ -176,7 +176,7 @@ export function isAutomationResults(
|
|||
}
|
||||
|
||||
interface AutomationTriggerParams {
|
||||
fields: Record<string, any>
|
||||
fields?: Record<string, any>
|
||||
timeout?: number
|
||||
appId?: string
|
||||
user?: UserBindings
|
||||
|
@ -206,11 +206,14 @@ export async function externalTrigger(
|
|||
sdk.automations.isAppAction(automation) &&
|
||||
!(await checkTestFlag(automation._id!))
|
||||
) {
|
||||
if (params.fields == null) {
|
||||
params.fields = {}
|
||||
}
|
||||
|
||||
// values are likely to be submitted as strings, so we shall convert to correct type
|
||||
const coercedFields: any = {}
|
||||
const triggerInputs = automation.definition.trigger.inputs
|
||||
const fields =
|
||||
triggerInputs && "fields" in triggerInputs ? triggerInputs.fields : {}
|
||||
const triggerInputs = automation.definition.trigger.inputs || {}
|
||||
const fields = "fields" in triggerInputs ? triggerInputs.fields : {}
|
||||
for (const key of Object.keys(fields || {})) {
|
||||
coercedFields[key] = coerce(params.fields[key], fields[key])
|
||||
}
|
||||
|
|
|
@ -21,8 +21,7 @@ function parseIntSafe(number?: string) {
|
|||
|
||||
const DEFAULTS = {
|
||||
QUERY_THREAD_TIMEOUT: 15000,
|
||||
AUTOMATION_THREAD_TIMEOUT: 15000,
|
||||
AUTOMATION_SYNC_TIMEOUT: 120000,
|
||||
AUTOMATION_THREAD_TIMEOUT: 120000,
|
||||
AUTOMATION_MAX_ITERATIONS: 200,
|
||||
JS_PER_EXECUTION_TIME_LIMIT_MS: 1500,
|
||||
TEMPLATE_REPOSITORY: "app",
|
||||
|
|
|
@ -246,6 +246,7 @@ class Orchestrator {
|
|||
success: false,
|
||||
status: AutomationStatus.STOPPED_ERROR,
|
||||
})
|
||||
result.status = AutomationStatus.STOPPED_ERROR
|
||||
await this.logResult(result)
|
||||
}
|
||||
}
|
||||
|
@ -313,7 +314,11 @@ class Orchestrator {
|
|||
inputs: null,
|
||||
outputs: data.event,
|
||||
}
|
||||
const result: AutomationResults = { trigger, steps: [trigger] }
|
||||
const result: AutomationResults = {
|
||||
trigger,
|
||||
steps: [trigger],
|
||||
status: AutomationStatus.SUCCESS,
|
||||
}
|
||||
|
||||
const ctx: AutomationContext = {
|
||||
trigger: trigger.outputs,
|
||||
|
@ -337,6 +342,12 @@ class Orchestrator {
|
|||
|
||||
result.steps.push(...stepOutputs)
|
||||
|
||||
if (this.stopped) {
|
||||
result.status = AutomationStatus.STOPPED
|
||||
} else if (this.hasErrored(ctx)) {
|
||||
result.status = AutomationStatus.ERROR
|
||||
}
|
||||
|
||||
console.info(
|
||||
`Automation ID: ${
|
||||
this.automation._id
|
||||
|
@ -351,6 +362,7 @@ class Orchestrator {
|
|||
if (e.errno === "ETIME") {
|
||||
span?.addTags({ timedOut: true })
|
||||
console.warn(`Automation execution timed out after ${timeout}ms`)
|
||||
result.status = AutomationStatus.TIMED_OUT
|
||||
} else {
|
||||
throw e
|
||||
}
|
||||
|
@ -490,9 +502,15 @@ class Orchestrator {
|
|||
}
|
||||
|
||||
ctx.loop = { currentItem }
|
||||
const result = await this.executeStep(ctx, stepToLoop)
|
||||
items.push(result.outputs)
|
||||
ctx.loop = undefined
|
||||
try {
|
||||
const result = await this.executeStep(ctx, stepToLoop)
|
||||
items.push(result.outputs)
|
||||
if (result.outputs.success === false) {
|
||||
return stepFailure(stepToLoop, { iterations, items })
|
||||
}
|
||||
} finally {
|
||||
ctx.loop = undefined
|
||||
}
|
||||
}
|
||||
|
||||
const status =
|
||||
|
@ -568,12 +586,22 @@ class Orchestrator {
|
|||
step.schema.inputs.properties
|
||||
)
|
||||
|
||||
const outputs = await fn({
|
||||
inputs,
|
||||
appId: this.appId,
|
||||
emitter: this.emitter,
|
||||
context: ctx,
|
||||
})
|
||||
let outputs
|
||||
try {
|
||||
outputs = await tracer.trace("fn", () =>
|
||||
fn({
|
||||
inputs,
|
||||
appId: this.appId,
|
||||
emitter: this.emitter,
|
||||
context: ctx,
|
||||
})
|
||||
)
|
||||
} catch (err: any) {
|
||||
return stepFailure(step, {
|
||||
status: AutomationStatus.ERROR,
|
||||
error: automationUtils.getError(err),
|
||||
})
|
||||
}
|
||||
|
||||
if (
|
||||
step.stepId === AutomationActionStepId.FILTER &&
|
||||
|
|
|
@ -65,7 +65,7 @@ export interface ClearAutomationLogResponse {
|
|||
}
|
||||
|
||||
export interface TriggerAutomationRequest {
|
||||
fields: Record<string, any>
|
||||
fields?: Record<string, any>
|
||||
timestamp?: number
|
||||
// time in seconds
|
||||
timeout: number
|
||||
|
@ -75,7 +75,8 @@ export type TriggerAutomationResponse = Record<string, any> | undefined
|
|||
export interface TestAutomationRequest {
|
||||
id?: string
|
||||
revision?: string
|
||||
fields: Record<string, any>
|
||||
timeout?: number
|
||||
fields?: Record<string, any>
|
||||
row?: Row
|
||||
oldRow?: Row
|
||||
}
|
||||
|
|
|
@ -223,11 +223,12 @@ export type TriggerAutomationStepInputs = {
|
|||
automation: {
|
||||
automationId: string
|
||||
}
|
||||
timeout: number
|
||||
timeout?: number
|
||||
}
|
||||
|
||||
export type TriggerAutomationStepOutputs = BaseAutomationOutputs & {
|
||||
value?: AutomationResults["steps"]
|
||||
status: AutomationResults["status"]
|
||||
}
|
||||
|
||||
export type UpdateRowStepInputs = {
|
||||
|
|
|
@ -180,10 +180,12 @@ export enum AutomationStatus {
|
|||
STOPPED = "stopped",
|
||||
STOPPED_ERROR = "stopped_error",
|
||||
NO_CONDITION_MET = "No branch condition met",
|
||||
TIMED_OUT = "timed_out",
|
||||
}
|
||||
|
||||
export enum AutomationStoppedReason {
|
||||
TRIGGER_FILTER_NOT_MET = "Automation did not run. Filter conditions in trigger were not met.",
|
||||
TIMED_OUT = "Automation timed out.",
|
||||
}
|
||||
|
||||
export interface AutomationStepResultOutputs {
|
||||
|
@ -214,7 +216,7 @@ export interface AutomationTriggerResult {
|
|||
|
||||
export interface AutomationResults {
|
||||
automationId?: string
|
||||
status?: AutomationStatus
|
||||
status: AutomationStatus
|
||||
trigger: AutomationTriggerResult
|
||||
steps: [AutomationTriggerResult, ...AutomationStepResult[]]
|
||||
}
|
||||
|
|
46
yarn.lock
46
yarn.lock
|
@ -4817,10 +4817,10 @@
|
|||
resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.21.2.tgz#e4291e3c1bc637083f87936c333cdbcad22af63b"
|
||||
integrity sha512-6UUxd0+SKomjdzuAcp+HAmxw1FlGBnl1v2yEPSabtx4lBfdXHDVsW7+lQkgz9cNFJGY3AWR7+V8P5BqkD9L9nA==
|
||||
|
||||
"@roxi/routify@2.18.12":
|
||||
version "2.18.12"
|
||||
resolved "https://registry.yarnpkg.com/@roxi/routify/-/routify-2.18.12.tgz#901ca95b96f274ddddaefbf18424557ee1ae3fae"
|
||||
integrity sha512-0phd3vkrfc3u4ujEMPQxIdSQTXs/od892cHB4ZwmY6xIGDtfrI/CW0QMrO+BPYeZ5iFFVq8w7htvH1SQsLEqtw==
|
||||
"@roxi/routify@2.18.18":
|
||||
version "2.18.18"
|
||||
resolved "https://registry.yarnpkg.com/@roxi/routify/-/routify-2.18.18.tgz#cba6fc80c52d79fa0cae13d227f6af16a352815b"
|
||||
integrity sha512-daCBABx9Qv7JskApuKKrh6u+sXtIVxp9f8R7y07q6/gumGuIYH43V2As3ho29q9mAnorjP/G7REZ4+sflZKdPw==
|
||||
dependencies:
|
||||
"@roxi/ssr" "^0.2.1"
|
||||
"@types/node" "^12.20.52"
|
||||
|
@ -6787,13 +6787,20 @@
|
|||
dependencies:
|
||||
undici-types "~5.26.4"
|
||||
|
||||
"@types/node@^20.17.9", "@types/node@^20.4.5":
|
||||
"@types/node@^20.4.5":
|
||||
version "20.17.9"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.17.9.tgz#5f141d4b7ee125cdee5faefe28de095398865bab"
|
||||
integrity sha512-0JOXkRyLanfGPE2QRCwgxhzlBAvaRdCNMcvbd7jFfpmD4eEXll7LRwy5ymJmyeZqk7Nh7eD2LeUyQ68BbndmXw==
|
||||
dependencies:
|
||||
undici-types "~6.19.2"
|
||||
|
||||
"@types/node@^22.15.3":
|
||||
version "22.15.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-22.15.3.tgz#b7fb9396a8ec5b5dfb1345d8ac2502060e9af68b"
|
||||
integrity sha512-lX7HFZeHf4QG/J7tBZqrCAXwz9J5RD56Y6MpP0eJkka8p+K0RY/yBTW7CYFJ4VGCclxqOLKmiGP5juQc6MKgcw==
|
||||
dependencies:
|
||||
undici-types "~6.21.0"
|
||||
|
||||
"@types/nodemailer@^6.4.17":
|
||||
version "6.4.17"
|
||||
resolved "https://registry.yarnpkg.com/@types/nodemailer/-/nodemailer-6.4.17.tgz#5c82a42aee16a3dd6ea31446a1bd6a447f1ac1a4"
|
||||
|
@ -11407,10 +11414,10 @@ eslint@^8.56.0:
|
|||
strip-ansi "^6.0.1"
|
||||
text-table "^0.2.0"
|
||||
|
||||
esm@^3.2.25:
|
||||
version "3.2.25"
|
||||
resolved "https://registry.yarnpkg.com/esm/-/esm-3.2.25.tgz#342c18c29d56157688ba5ce31f8431fbb795cc10"
|
||||
integrity sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==
|
||||
esm@^3.2.25, "esm@npm:esm-wallaby@3.2.32":
|
||||
version "3.2.32"
|
||||
resolved "https://registry.yarnpkg.com/esm-wallaby/-/esm-wallaby-3.2.32.tgz#0cacc428e788938173260e4a91c75add42e106df"
|
||||
integrity sha512-/E27KRXrtsHoHg2YOoTVrTsRz15puU1M/ul1qPK129gwbRLmHulLSSfGCRAdu4WSzjaHcImnUyBTX3KCPmlfhw==
|
||||
|
||||
espree@^10.0.1, espree@^10.3.0:
|
||||
version "10.3.0"
|
||||
|
@ -14044,10 +14051,10 @@ isobject@^4.0.0:
|
|||
resolved "https://registry.yarnpkg.com/isobject/-/isobject-4.0.0.tgz#3f1c9155e73b192022a80819bacd0343711697b0"
|
||||
integrity sha512-S/2fF5wH8SJA/kmwr6HYhK/RI/OkhD84k8ntalo0iJjZikgq1XFvR5M8NPT1x5F7fBwCG3qHfnzeP/Vh/ZxCUA==
|
||||
|
||||
isolated-vm@^4.7.2:
|
||||
version "4.7.2"
|
||||
resolved "https://registry.yarnpkg.com/isolated-vm/-/isolated-vm-4.7.2.tgz#5670d5cce1d92004f9b825bec5b0b11fc7501b65"
|
||||
integrity sha512-JVEs5gzWObzZK5+OlBplCdYSpokMcdhLSs/xWYYxmYWVfOOFF4oZJsYh7E/FmfX8e7gMioXMpMMeEyX1afuKrg==
|
||||
isolated-vm@^5.0.1:
|
||||
version "5.0.1"
|
||||
resolved "https://registry.yarnpkg.com/isolated-vm/-/isolated-vm-5.0.1.tgz#d87b12cf8889e351cb1598a4aeea00bb458bf20c"
|
||||
integrity sha512-hs7+ff59Z2zDvavfcjuot/r1gm6Bmpt+GoZxmVfxUmXaX5scOvUq/Rnme+mUtSh5lW41hH8gAuvk/yTJDYO8Fg==
|
||||
dependencies:
|
||||
prebuild-install "^7.1.1"
|
||||
|
||||
|
@ -16496,10 +16503,10 @@ named-placeholders@^1.1.3:
|
|||
dependencies:
|
||||
lru-cache "^7.14.1"
|
||||
|
||||
nan@^2.17.0, nan@^2.18.0:
|
||||
version "2.18.0"
|
||||
resolved "https://registry.yarnpkg.com/nan/-/nan-2.18.0.tgz#26a6faae7ffbeb293a39660e88a76b82e30b7554"
|
||||
integrity sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w==
|
||||
nan@2.22.0, nan@^2.17.0, nan@^2.18.0:
|
||||
version "2.22.0"
|
||||
resolved "https://registry.yarnpkg.com/nan/-/nan-2.22.0.tgz#31bc433fc33213c97bad36404bb68063de604de3"
|
||||
integrity sha512-nbajikzWTMwsW+eSsNm3QwlOs7het9gGJU5dDZzRTQGk03vyBOauxgI4VakDzE0PtsGTmXPsXTbbjVhRwR5mpw==
|
||||
|
||||
nanoclone@^0.2.1:
|
||||
version "0.2.1"
|
||||
|
@ -21576,6 +21583,11 @@ undici-types@~6.19.2, undici-types@~6.19.8:
|
|||
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02"
|
||||
integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==
|
||||
|
||||
undici-types@~6.21.0:
|
||||
version "6.21.0"
|
||||
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.21.0.tgz#691d00af3909be93a7faa13be61b3a5b50ef12cb"
|
||||
integrity sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==
|
||||
|
||||
undici@^4.14.1:
|
||||
version "4.16.0"
|
||||
resolved "https://registry.yarnpkg.com/undici/-/undici-4.16.0.tgz#469bb87b3b918818d3d7843d91a1d08da357d5ff"
|
||||
|
|
Loading…
Reference in New Issue