some pr comments

This commit is contained in:
Peter Clement 2024-09-13 12:25:39 +01:00
parent c980742081
commit 7e767e4089
4 changed files with 30 additions and 20 deletions

View File

@ -255,12 +255,15 @@ describe("Loop automations", () => {
option: LoopStepType.ARRAY,
binding: [1, 2, 3],
},
"FirstLoopStep"
{ stepName: "FirstLoopStep" }
)
.serverLog(
{ text: "Message {{loop.currentItem}}" },
{ stepName: "FirstLoopLog" }
)
.serverLog({ text: "Message {{loop.currentItem}}" }, "FirstLoopLog")
.serverLog(
{ text: "{{steps.FirstLoopLog.iterations}}" },
"FirstLoopIterationLog"
{ stepName: "FirstLoopIterationLog" }
)
.run()

View File

@ -217,7 +217,7 @@ describe("Automation Scenarios", () => {
{
tableId: table._id!,
},
"InitialQueryStep"
{ stepName: "InitialQueryStep" }
)
.deleteRow({
tableId: table._id!,

View File

@ -105,74 +105,80 @@ class BaseStepBuilder {
}
// STEPS
createRow(inputs: CreateRowStepInputs, stepName?: string): this {
createRow(inputs: CreateRowStepInputs, opts?: { stepName?: string }): this {
return this.step(
AutomationActionStepId.CREATE_ROW,
BUILTIN_ACTION_DEFINITIONS.CREATE_ROW,
inputs,
stepName
opts?.stepName
)
}
updateRow(inputs: UpdateRowStepInputs, stepName?: string): this {
updateRow(inputs: UpdateRowStepInputs, opts?: { stepName?: string }): this {
return this.step(
AutomationActionStepId.UPDATE_ROW,
BUILTIN_ACTION_DEFINITIONS.UPDATE_ROW,
inputs,
stepName
opts?.stepName
)
}
deleteRow(inputs: DeleteRowStepInputs, stepName?: string): this {
deleteRow(inputs: DeleteRowStepInputs, opts?: { stepName?: string }): this {
return this.step(
AutomationActionStepId.DELETE_ROW,
BUILTIN_ACTION_DEFINITIONS.DELETE_ROW,
inputs,
stepName
opts?.stepName
)
}
sendSmtpEmail(inputs: SmtpEmailStepInputs, stepName?: string): this {
sendSmtpEmail(
inputs: SmtpEmailStepInputs,
opts?: { stepName?: string }
): this {
return this.step(
AutomationActionStepId.SEND_EMAIL_SMTP,
BUILTIN_ACTION_DEFINITIONS.SEND_EMAIL_SMTP,
inputs,
stepName
opts?.stepName
)
}
executeQuery(inputs: ExecuteQueryStepInputs, stepName?: string): this {
executeQuery(
inputs: ExecuteQueryStepInputs,
opts?: { stepName?: string }
): this {
return this.step(
AutomationActionStepId.EXECUTE_QUERY,
BUILTIN_ACTION_DEFINITIONS.EXECUTE_QUERY,
inputs,
stepName
opts?.stepName
)
}
queryRows(inputs: QueryRowsStepInputs, stepName?: string): this {
queryRows(inputs: QueryRowsStepInputs, opts?: { stepName?: string }): this {
return this.step(
AutomationActionStepId.QUERY_ROWS,
BUILTIN_ACTION_DEFINITIONS.QUERY_ROWS,
inputs,
stepName
opts?.stepName
)
}
loop(inputs: LoopStepInputs, stepName?: string): this {
loop(inputs: LoopStepInputs, opts?: { stepName?: string }): this {
return this.step(
AutomationActionStepId.LOOP,
BUILTIN_ACTION_DEFINITIONS.LOOP,
inputs,
stepName
opts?.stepName
)
}
serverLog(input: ServerLogStepInputs, stepName?: string): this {
serverLog(input: ServerLogStepInputs, opts?: { stepName?: string }): this {
return this.step(
AutomationActionStepId.SERVER_LOG,
BUILTIN_ACTION_DEFINITIONS.SERVER_LOG,
input,
stepName
opts?.stepName
)
}
}

View File

@ -124,6 +124,7 @@ export interface Automation extends Document {
definition: {
steps: AutomationStep[]
trigger: AutomationTrigger
// stepNames is used to lookup step names from their correspnding step ID.
stepNames?: Record<string, string>
}
screenId?: string