Rename triggers to start with 'on'

This commit is contained in:
Sam Rose 2025-02-06 15:47:10 +00:00
parent ac2f40e955
commit 9f28eb00d4
No known key found for this signature in database
13 changed files with 60 additions and 60 deletions

View File

@ -108,7 +108,7 @@ describe("/automations", () => {
it("Should ensure you can't have a branch as not a last step", async () => { it("Should ensure you can't have a branch as not a last step", async () => {
const automation = createAutomationBuilder(config) const automation = createAutomationBuilder(config)
.appAction() .onAppAction()
.branch({ .branch({
activeBranch: { activeBranch: {
steps: stepBuilder => steps: stepBuilder =>
@ -132,7 +132,7 @@ describe("/automations", () => {
it("Should check validation on an automation that has a branch step with no children", async () => { it("Should check validation on an automation that has a branch step with no children", async () => {
const automation = createAutomationBuilder(config) const automation = createAutomationBuilder(config)
.appAction() .onAppAction()
.branch({}) .branch({})
.serverLog({ text: "Inactive user" }) .serverLog({ text: "Inactive user" })
.build() .build()
@ -148,7 +148,7 @@ describe("/automations", () => {
it("Should check validation on a branch step with empty conditions", async () => { it("Should check validation on a branch step with empty conditions", async () => {
const automation = createAutomationBuilder(config) const automation = createAutomationBuilder(config)
.appAction() .onAppAction()
.branch({ .branch({
activeBranch: { activeBranch: {
steps: stepBuilder => steps: stepBuilder =>
@ -169,7 +169,7 @@ describe("/automations", () => {
it("Should check validation on an branch that has a condition that is not valid", async () => { it("Should check validation on an branch that has a condition that is not valid", async () => {
const automation = createAutomationBuilder(config) const automation = createAutomationBuilder(config)
.appAction() .onAppAction()
.branch({ .branch({
activeBranch: { activeBranch: {
steps: stepBuilder => steps: stepBuilder =>
@ -241,7 +241,7 @@ describe("/automations", () => {
it("should be able to access platformUrl, logoUrl and company in the automation", async () => { it("should be able to access platformUrl, logoUrl and company in the automation", async () => {
const result = await createAutomationBuilder(config) const result = await createAutomationBuilder(config)
.appAction() .onAppAction()
.serverLog({ .serverLog({
text: "{{ settings.url }}", text: "{{ settings.url }}",
}) })

View File

@ -25,7 +25,7 @@ describe("Branching automations", () => {
const branch2Id = "44444444-4444-4444-4444-444444444444" const branch2Id = "44444444-4444-4444-4444-444444444444"
const results = await createAutomationBuilder(config) const results = await createAutomationBuilder(config)
.appAction() .onAppAction()
.serverLog( .serverLog(
{ text: "Starting automation" }, { text: "Starting automation" },
{ stepName: "FirstLog", stepId: firstLogId } { stepName: "FirstLog", stepId: firstLogId }
@ -84,7 +84,7 @@ describe("Branching automations", () => {
it("should execute correct branch based on string equality", async () => { it("should execute correct branch based on string equality", async () => {
const results = await createAutomationBuilder(config) const results = await createAutomationBuilder(config)
.appAction() .onAppAction()
.branch({ .branch({
activeBranch: { activeBranch: {
steps: stepBuilder => stepBuilder.serverLog({ text: "Active user" }), steps: stepBuilder => stepBuilder.serverLog({ text: "Active user" }),
@ -109,7 +109,7 @@ describe("Branching automations", () => {
it("should handle multiple conditions with AND operator", async () => { it("should handle multiple conditions with AND operator", async () => {
const results = await createAutomationBuilder(config) const results = await createAutomationBuilder(config)
.appAction() .onAppAction()
.branch({ .branch({
activeAdminBranch: { activeAdminBranch: {
steps: stepBuilder => steps: stepBuilder =>
@ -137,7 +137,7 @@ describe("Branching automations", () => {
it("should handle multiple conditions with OR operator", async () => { it("should handle multiple conditions with OR operator", async () => {
const results = await createAutomationBuilder(config) const results = await createAutomationBuilder(config)
.appAction() .onAppAction()
.branch({ .branch({
specialBranch: { specialBranch: {
steps: stepBuilder => stepBuilder.serverLog({ text: "Special user" }), steps: stepBuilder => stepBuilder.serverLog({ text: "Special user" }),
@ -169,7 +169,7 @@ describe("Branching automations", () => {
it("should stop the branch automation when no conditions are met", async () => { it("should stop the branch automation when no conditions are met", async () => {
const results = await createAutomationBuilder(config) const results = await createAutomationBuilder(config)
.appAction() .onAppAction()
.createRow({ row: { name: "Test", tableId: table._id } }) .createRow({ row: { name: "Test", tableId: table._id } })
.branch({ .branch({
specialBranch: { specialBranch: {
@ -205,7 +205,7 @@ describe("Branching automations", () => {
it("evaluate multiple conditions", async () => { it("evaluate multiple conditions", async () => {
const results = await createAutomationBuilder(config) const results = await createAutomationBuilder(config)
.appAction() .onAppAction()
.serverLog({ text: "Starting automation" }, { stepId: "aN6znRYHG" }) .serverLog({ text: "Starting automation" }, { stepId: "aN6znRYHG" })
.branch({ .branch({
specialBranch: { specialBranch: {
@ -246,7 +246,7 @@ describe("Branching automations", () => {
it("evaluate multiple conditions with interpolated text", async () => { it("evaluate multiple conditions with interpolated text", async () => {
const results = await createAutomationBuilder(config) const results = await createAutomationBuilder(config)
.appAction() .onAppAction()
.serverLog({ text: "Starting automation" }, { stepId: "aN6znRYHG" }) .serverLog({ text: "Starting automation" }, { stepId: "aN6znRYHG" })
.branch({ .branch({
specialBranch: { specialBranch: {

View File

@ -30,7 +30,7 @@ describe("Automation Scenarios", () => {
const table = await config.api.table.save(basicTable()) const table = await config.api.table.save(basicTable())
const results = await createAutomationBuilder(config) const results = await createAutomationBuilder(config)
.rowUpdated({ tableId: table._id! }) .onRowUpdated({ tableId: table._id! })
.createRow({ .createRow({
row: { row: {
name: "{{trigger.row.name}}", name: "{{trigger.row.name}}",
@ -63,7 +63,7 @@ describe("Automation Scenarios", () => {
await config.api.row.save(table._id!, row) await config.api.row.save(table._id!, row)
await config.api.row.save(table._id!, row) await config.api.row.save(table._id!, row)
const results = await createAutomationBuilder(config) const results = await createAutomationBuilder(config)
.appAction() .onAppAction()
.queryRows({ .queryRows({
tableId: table._id!, tableId: table._id!,
}) })
@ -82,7 +82,7 @@ describe("Automation Scenarios", () => {
await config.api.row.save(table._id!, row) await config.api.row.save(table._id!, row)
await config.api.row.save(table._id!, row) await config.api.row.save(table._id!, row)
const results = await createAutomationBuilder(config) const results = await createAutomationBuilder(config)
.appAction() .onAppAction()
.queryRows({ .queryRows({
tableId: table._id!, tableId: table._id!,
}) })
@ -124,7 +124,7 @@ describe("Automation Scenarios", () => {
}) })
const results = await createAutomationBuilder(config) const results = await createAutomationBuilder(config)
.appAction() .onAppAction()
.createRow( .createRow(
{ {
row: { row: {
@ -193,7 +193,7 @@ describe("Automation Scenarios", () => {
await config.api.row.save(table._id!, row) await config.api.row.save(table._id!, row)
await config.api.row.save(table._id!, row) await config.api.row.save(table._id!, row)
const results = await createAutomationBuilder(config) const results = await createAutomationBuilder(config)
.appAction() .onAppAction()
.queryRows( .queryRows(
{ {
tableId: table._id!, tableId: table._id!,
@ -243,7 +243,7 @@ describe("Automation Scenarios", () => {
it("should stop an automation if the condition is not met", async () => { it("should stop an automation if the condition is not met", async () => {
const results = await createAutomationBuilder(config) const results = await createAutomationBuilder(config)
.appAction() .onAppAction()
.createRow({ .createRow({
row: { row: {
name: "Equal Test", name: "Equal Test",
@ -269,7 +269,7 @@ describe("Automation Scenarios", () => {
it("should continue the automation if the condition is met", async () => { it("should continue the automation if the condition is met", async () => {
const results = await createAutomationBuilder(config) const results = await createAutomationBuilder(config)
.appAction() .onAppAction()
.createRow({ .createRow({
row: { row: {
name: "Not Equal Test", name: "Not Equal Test",
@ -336,7 +336,7 @@ describe("Automation Scenarios", () => {
"should pass the filter when condition is $condition", "should pass the filter when condition is $condition",
async ({ condition, value, rowValue, expectPass }) => { async ({ condition, value, rowValue, expectPass }) => {
const results = await createAutomationBuilder(config) const results = await createAutomationBuilder(config)
.appAction() .onAppAction()
.createRow({ .createRow({
row: { row: {
name: `${condition} Test`, name: `${condition} Test`,
@ -371,7 +371,7 @@ describe("Automation Scenarios", () => {
const table = await config.api.table.save(basicTable()) const table = await config.api.table.save(basicTable())
const results = await createAutomationBuilder(config) const results = await createAutomationBuilder(config)
.rowUpdated({ tableId: table._id! }) .onRowUpdated({ tableId: table._id! })
.serverLog({ text: "{{ [user].[email] }}" }) .serverLog({ text: "{{ [user].[email] }}" })
.run({ .run({
row: { name: "Test", description: "TEST" }, row: { name: "Test", description: "TEST" },
@ -383,7 +383,7 @@ describe("Automation Scenarios", () => {
it("Check user is passed through from app trigger", async () => { it("Check user is passed through from app trigger", async () => {
const results = await createAutomationBuilder(config) const results = await createAutomationBuilder(config)
.appAction() .onAppAction()
.serverLog({ text: "{{ [user].[email] }}" }) .serverLog({ text: "{{ [user].[email] }}" })
.run({ fields: {} }) .run({ fields: {} })
@ -455,7 +455,7 @@ if (descriptions.length) {
}) })
const results = await createAutomationBuilder(config) const results = await createAutomationBuilder(config)
.appAction() .onAppAction()
.executeQuery({ .executeQuery({
query: { query: {
queryId: query._id!, queryId: query._id!,

View File

@ -25,7 +25,7 @@ describe("Execute Bash Automations", () => {
it("should use trigger data in bash command and pass output to subsequent steps", async () => { it("should use trigger data in bash command and pass output to subsequent steps", async () => {
const result = await createAutomationBuilder(config) const result = await createAutomationBuilder(config)
.appAction({ fields: { command: "hello world" } }) .onAppAction({ fields: { command: "hello world" } })
.bash( .bash(
{ code: "echo '{{ trigger.fields.command }}'" }, { code: "echo '{{ trigger.fields.command }}'" },
{ stepName: "Echo Command" } { stepName: "Echo Command" }
@ -44,7 +44,7 @@ describe("Execute Bash Automations", () => {
it("should chain multiple bash commands using previous outputs", async () => { it("should chain multiple bash commands using previous outputs", async () => {
const result = await createAutomationBuilder(config) const result = await createAutomationBuilder(config)
.appAction({ fields: { filename: "testfile.txt" } }) .onAppAction({ fields: { filename: "testfile.txt" } })
.bash( .bash(
{ code: "echo 'initial content' > {{ trigger.fields.filename }}" }, { code: "echo 'initial content' > {{ trigger.fields.filename }}" },
{ stepName: "Create File" } { stepName: "Create File" }
@ -94,7 +94,7 @@ describe("Execute Bash Automations", () => {
it("should handle bash output in conditional logic", async () => { it("should handle bash output in conditional logic", async () => {
const result = await createAutomationBuilder(config) const result = await createAutomationBuilder(config)
.appAction({ fields: { threshold: "5" } }) .onAppAction({ fields: { threshold: "5" } })
.bash( .bash(
{ code: "echo $(( {{ trigger.fields.threshold }} + 5 ))" }, { code: "echo $(( {{ trigger.fields.threshold }} + 5 ))" },
{ stepName: "Calculate Value" } { stepName: "Calculate Value" }

View File

@ -41,7 +41,7 @@ describe("test the create row action", () => {
it("should be able to run the action", async () => { it("should be able to run the action", async () => {
const result = await createAutomationBuilder(config) const result = await createAutomationBuilder(config)
.appAction({ fields: { status: "new" } }) .onAppAction({ fields: { status: "new" } })
.serverLog({ text: "Starting create row flow" }, { stepName: "StartLog" }) .serverLog({ text: "Starting create row flow" }, { stepName: "StartLog" })
.createRow({ row }, { stepName: "CreateRow" }) .createRow({ row }, { stepName: "CreateRow" })
.serverLog( .serverLog(
@ -67,7 +67,7 @@ describe("test the create row action", () => {
it("should return an error (not throw) when bad info provided", async () => { it("should return an error (not throw) when bad info provided", async () => {
const result = await createAutomationBuilder(config) const result = await createAutomationBuilder(config)
.appAction({ fields: { status: "error" } }) .onAppAction({ fields: { status: "error" } })
.serverLog({ text: "Starting error test flow" }, { stepName: "StartLog" }) .serverLog({ text: "Starting error test flow" }, { stepName: "StartLog" })
.createRow( .createRow(
{ {
@ -85,7 +85,7 @@ describe("test the create row action", () => {
it("should check invalid inputs return an error", async () => { it("should check invalid inputs return an error", async () => {
const result = await createAutomationBuilder(config) const result = await createAutomationBuilder(config)
.appAction({ fields: { status: "invalid" } }) .onAppAction({ fields: { status: "invalid" } })
.serverLog({ text: "Testing invalid input" }, { stepName: "StartLog" }) .serverLog({ text: "Testing invalid input" }, { stepName: "StartLog" })
.createRow({ row: {} }, { stepName: "CreateRow" }) .createRow({ row: {} }, { stepName: "CreateRow" })
.filter({ .filter({
@ -123,7 +123,7 @@ describe("test the create row action", () => {
attachmentRow.file_attachment = attachmentObject attachmentRow.file_attachment = attachmentObject
const result = await createAutomationBuilder(config) const result = await createAutomationBuilder(config)
.appAction({ fields: { type: "attachment" } }) .onAppAction({ fields: { type: "attachment" } })
.serverLog( .serverLog(
{ text: "Processing attachment upload" }, { text: "Processing attachment upload" },
{ stepName: "StartLog" } { stepName: "StartLog" }
@ -174,7 +174,7 @@ describe("test the create row action", () => {
attachmentRow.single_file_attachment = attachmentObject attachmentRow.single_file_attachment = attachmentObject
const result = await createAutomationBuilder(config) const result = await createAutomationBuilder(config)
.appAction({ fields: { type: "single-attachment" } }) .onAppAction({ fields: { type: "single-attachment" } })
.serverLog( .serverLog(
{ text: "Processing single attachment" }, { text: "Processing single attachment" },
{ stepName: "StartLog" } { stepName: "StartLog" }
@ -245,7 +245,7 @@ describe("test the create row action", () => {
attachmentRow.single_file_attachment = attachmentObject attachmentRow.single_file_attachment = attachmentObject
const result = await createAutomationBuilder(config) const result = await createAutomationBuilder(config)
.appAction({ fields: { type: "invalid-attachment" } }) .onAppAction({ fields: { type: "invalid-attachment" } })
.serverLog( .serverLog(
{ text: "Testing invalid attachment keys" }, { text: "Testing invalid attachment keys" },
{ stepName: "StartLog" } { stepName: "StartLog" }

View File

@ -27,7 +27,7 @@ describe("cron automations", () => {
}) })
it("should initialise the automation timestamp", async () => { it("should initialise the automation timestamp", async () => {
await createAutomationBuilder(config).cron({ cron: "* * * * *" }).save() await createAutomationBuilder(config).onCron({ cron: "* * * * *" }).save()
tk.travel(Date.now() + oneMinuteInMs) tk.travel(Date.now() + oneMinuteInMs)
await config.publish() await config.publish()

View File

@ -21,7 +21,7 @@ describe("Execute Script Automations", () => {
it("should execute a basic script and return the result", async () => { it("should execute a basic script and return the result", async () => {
const results = await createAutomationBuilder(config) const results = await createAutomationBuilder(config)
.appAction() .onAppAction()
.executeScript({ code: "return 2 + 2" }) .executeScript({ code: "return 2 + 2" })
.run({ fields: {} }) .run({ fields: {} })
@ -30,7 +30,7 @@ describe("Execute Script Automations", () => {
it("should access bindings from previous steps", async () => { it("should access bindings from previous steps", async () => {
const results = await createAutomationBuilder(config) const results = await createAutomationBuilder(config)
.appAction() .onAppAction()
.executeScript( .executeScript(
{ {
code: "return trigger.fields.data.map(x => x * 2)", code: "return trigger.fields.data.map(x => x * 2)",
@ -44,7 +44,7 @@ describe("Execute Script Automations", () => {
it("should handle script execution errors gracefully", async () => { it("should handle script execution errors gracefully", async () => {
const results = await createAutomationBuilder(config) const results = await createAutomationBuilder(config)
.appAction() .onAppAction()
.executeScript({ code: "return nonexistentVariable.map(x => x)" }) .executeScript({ code: "return nonexistentVariable.map(x => x)" })
.run({ fields: {} }) .run({ fields: {} })
@ -56,7 +56,7 @@ describe("Execute Script Automations", () => {
it("should handle conditional logic in scripts", async () => { it("should handle conditional logic in scripts", async () => {
const results = await createAutomationBuilder(config) const results = await createAutomationBuilder(config)
.appAction() .onAppAction()
.executeScript({ .executeScript({
code: ` code: `
if (trigger.fields.value > 5) { if (trigger.fields.value > 5) {
@ -73,7 +73,7 @@ describe("Execute Script Automations", () => {
it("should use multiple steps and validate script execution", async () => { it("should use multiple steps and validate script execution", async () => {
const results = await createAutomationBuilder(config) const results = await createAutomationBuilder(config)
.appAction() .onAppAction()
.serverLog( .serverLog(
{ text: "Starting multi-step automation" }, { text: "Starting multi-step automation" },
{ stepId: "start-log-step" } { stepId: "start-log-step" }

View File

@ -73,7 +73,7 @@ describe("Attempt to run a basic loop automation", () => {
it("should run an automation with a trigger, loop, and create row step", async () => { it("should run an automation with a trigger, loop, and create row step", async () => {
const results = await createAutomationBuilder(config) const results = await createAutomationBuilder(config)
.rowSaved( .onRowSaved(
{ tableId: table._id! }, { tableId: table._id! },
{ {
row: { row: {
@ -116,7 +116,7 @@ describe("Attempt to run a basic loop automation", () => {
it("should run an automation where a loop step is between two normal steps to ensure context correctness", async () => { it("should run an automation where a loop step is between two normal steps to ensure context correctness", async () => {
const results = await createAutomationBuilder(config) const results = await createAutomationBuilder(config)
.rowSaved( .onRowSaved(
{ tableId: table._id! }, { tableId: table._id! },
{ {
row: { row: {
@ -213,7 +213,7 @@ describe("Attempt to run a basic loop automation", () => {
it("should run an automation where a loop is successfully run twice", async () => { it("should run an automation where a loop is successfully run twice", async () => {
const results = await createAutomationBuilder(config) const results = await createAutomationBuilder(config)
.rowSaved( .onRowSaved(
{ tableId: table._id! }, { tableId: table._id! },
{ {
row: { row: {

View File

@ -58,7 +58,7 @@ describe("test the openai action", () => {
// own API key. We don't count this against your quota. // own API key. We don't count this against your quota.
const result = await expectAIUsage(0, () => const result = await expectAIUsage(0, () =>
createAutomationBuilder(config) createAutomationBuilder(config)
.appAction() .onAppAction()
.openai({ prompt: "Hello, world", model: Model.GPT_4O_MINI }) .openai({ prompt: "Hello, world", model: Model.GPT_4O_MINI })
.run({ fields: {} }) .run({ fields: {} })
) )
@ -70,7 +70,7 @@ describe("test the openai action", () => {
it("should present the correct error message when a prompt is not provided", async () => { it("should present the correct error message when a prompt is not provided", async () => {
const result = await expectAIUsage(0, () => const result = await expectAIUsage(0, () =>
createAutomationBuilder(config) createAutomationBuilder(config)
.appAction() .onAppAction()
.openai({ prompt: "", model: Model.GPT_4O_MINI }) .openai({ prompt: "", model: Model.GPT_4O_MINI })
.run({ fields: {} }) .run({ fields: {} })
) )
@ -86,7 +86,7 @@ describe("test the openai action", () => {
const result = await expectAIUsage(0, () => const result = await expectAIUsage(0, () =>
createAutomationBuilder(config) createAutomationBuilder(config)
.appAction() .onAppAction()
.openai({ prompt: "Hello, world", model: Model.GPT_4O_MINI }) .openai({ prompt: "Hello, world", model: Model.GPT_4O_MINI })
.run({ fields: {} }) .run({ fields: {} })
) )
@ -109,7 +109,7 @@ describe("test the openai action", () => {
// key, so we charge users for it. // key, so we charge users for it.
const result = await expectAIUsage(14, () => const result = await expectAIUsage(14, () =>
createAutomationBuilder(config) createAutomationBuilder(config)
.appAction() .onAppAction()
.openai({ model: Model.GPT_4O_MINI, prompt: "Hello, world" }) .openai({ model: Model.GPT_4O_MINI, prompt: "Hello, world" })
.run({ fields: {} }) .run({ fields: {} })
) )

View File

@ -29,7 +29,7 @@ describe("Test a query step automation", () => {
it("should be able to run the query step", async () => { it("should be able to run the query step", async () => {
const result = await createAutomationBuilder(config) const result = await createAutomationBuilder(config)
.appAction() .onAppAction()
.queryRows( .queryRows(
{ {
tableId: table._id!, tableId: table._id!,
@ -54,7 +54,7 @@ describe("Test a query step automation", () => {
it("Returns all rows when onEmptyFilter has no value and no filters are passed", async () => { it("Returns all rows when onEmptyFilter has no value and no filters are passed", async () => {
const result = await createAutomationBuilder(config) const result = await createAutomationBuilder(config)
.appAction() .onAppAction()
.queryRows( .queryRows(
{ {
tableId: table._id!, tableId: table._id!,
@ -75,7 +75,7 @@ describe("Test a query step automation", () => {
it("Returns no rows when onEmptyFilter is RETURN_NONE and theres no filters", async () => { it("Returns no rows when onEmptyFilter is RETURN_NONE and theres no filters", async () => {
const result = await createAutomationBuilder(config) const result = await createAutomationBuilder(config)
.appAction() .onAppAction()
.queryRows( .queryRows(
{ {
tableId: table._id!, tableId: table._id!,
@ -97,7 +97,7 @@ describe("Test a query step automation", () => {
it("Returns no rows when onEmptyFilters RETURN_NONE and a filter is passed with a null value", async () => { it("Returns no rows when onEmptyFilters RETURN_NONE and a filter is passed with a null value", async () => {
const result = await createAutomationBuilder(config) const result = await createAutomationBuilder(config)
.appAction() .onAppAction()
.queryRows( .queryRows(
{ {
tableId: table._id!, tableId: table._id!,
@ -123,7 +123,7 @@ describe("Test a query step automation", () => {
it("Returns rows when onEmptyFilter is RETURN_ALL and no filter is passed", async () => { it("Returns rows when onEmptyFilter is RETURN_ALL and no filter is passed", async () => {
const result = await createAutomationBuilder(config) const result = await createAutomationBuilder(config)
.appAction() .onAppAction()
.queryRows( .queryRows(
{ {
tableId: table._id!, tableId: table._id!,
@ -151,7 +151,7 @@ describe("Test a query step automation", () => {
name: NAME, name: NAME,
}) })
const result = await createAutomationBuilder(config) const result = await createAutomationBuilder(config)
.appAction() .onAppAction()
.queryRows( .queryRows(
{ {
tableId: tableWithSpaces._id!, tableId: tableWithSpaces._id!,

View File

@ -25,7 +25,7 @@ describe("cron trigger", () => {
}) })
await createAutomationBuilder(config) await createAutomationBuilder(config)
.cron({ cron: "* * * * *" }) .onCron({ cron: "* * * * *" })
.serverLog({ .serverLog({
text: "Hello, world!", text: "Hello, world!",
}) })
@ -45,7 +45,7 @@ describe("cron trigger", () => {
it("should fail if the cron expression is invalid", async () => { it("should fail if the cron expression is invalid", async () => {
await createAutomationBuilder(config) await createAutomationBuilder(config)
.cron({ cron: "* * * * * *" }) .onCron({ cron: "* * * * * *" })
.serverLog({ .serverLog({
text: "Hello, world!", text: "Hello, world!",
}) })

View File

@ -12,7 +12,7 @@ describe("Branching automations", () => {
async function createWebhookAutomation() { async function createWebhookAutomation() {
const { automation } = await createAutomationBuilder(config) const { automation } = await createAutomationBuilder(config)
.webhook({ fields: { parameter: "string" } }) .onWebhook({ fields: { parameter: "string" } })
.createRow({ .createRow({
row: { tableId: table._id!, name: "{{ trigger.parameter }}" }, row: { tableId: table._id!, name: "{{ trigger.parameter }}" },
}) })

View File

@ -54,13 +54,13 @@ class TriggerBuilder {
} }
} }
appAction = this.trigger(AutomationTriggerStepId.APP) onAppAction = this.trigger(AutomationTriggerStepId.APP)
rowSaved = this.trigger(AutomationTriggerStepId.ROW_SAVED) onRowSaved = this.trigger(AutomationTriggerStepId.ROW_SAVED)
rowUpdated = this.trigger(AutomationTriggerStepId.ROW_UPDATED) onRowUpdated = this.trigger(AutomationTriggerStepId.ROW_UPDATED)
rowDeleted = this.trigger(AutomationTriggerStepId.ROW_DELETED) onRowDeleted = this.trigger(AutomationTriggerStepId.ROW_DELETED)
webhook = this.trigger(AutomationTriggerStepId.WEBHOOK) onWebhook = this.trigger(AutomationTriggerStepId.WEBHOOK)
cron = this.trigger(AutomationTriggerStepId.CRON) onCron = this.trigger(AutomationTriggerStepId.CRON)
} }
class BranchStepBuilder<TStep extends AutomationTriggerStepId> { class BranchStepBuilder<TStep extends AutomationTriggerStepId> {