pr comments
This commit is contained in:
parent
5d31976835
commit
f00593ff26
|
@ -30,7 +30,7 @@ describe("Branching automations", () => {
|
|||
.appAction({ fields: {} })
|
||||
.serverLog(
|
||||
{ text: "Starting automation" },
|
||||
{ stepName: "FirstLog", id: firstLogId }
|
||||
{ stepName: "FirstLog", stepId: firstLogId }
|
||||
)
|
||||
.branch({
|
||||
topLevelBranch1: {
|
||||
|
@ -38,14 +38,14 @@ describe("Branching automations", () => {
|
|||
stepBuilder
|
||||
.serverLog(
|
||||
{ text: "Branch 1" },
|
||||
{ id: "66666666-6666-6666-6666-666666666666" }
|
||||
{ stepId: "66666666-6666-6666-6666-666666666666" }
|
||||
)
|
||||
.branch({
|
||||
branch1: {
|
||||
steps: stepBuilder =>
|
||||
stepBuilder.serverLog(
|
||||
{ text: "Branch 1.1" },
|
||||
{ id: branch1LogId }
|
||||
{ stepId: branch1LogId }
|
||||
),
|
||||
condition: {
|
||||
equal: { [`{{ steps.${firstLogId}.success }}`]: true },
|
||||
|
@ -55,7 +55,7 @@ describe("Branching automations", () => {
|
|||
steps: stepBuilder =>
|
||||
stepBuilder.serverLog(
|
||||
{ text: "Branch 1.2" },
|
||||
{ id: branch2LogId }
|
||||
{ stepId: branch2LogId }
|
||||
),
|
||||
condition: {
|
||||
equal: { [`{{ steps.${firstLogId}.success }}`]: false },
|
||||
|
@ -68,7 +68,7 @@ describe("Branching automations", () => {
|
|||
},
|
||||
topLevelBranch2: {
|
||||
steps: stepBuilder =>
|
||||
stepBuilder.serverLog({ text: "Branch 2" }, { id: branch2Id }),
|
||||
stepBuilder.serverLog({ text: "Branch 2" }, { stepId: branch2Id }),
|
||||
condition: {
|
||||
equal: { [`{{ steps.${firstLogId}.success }}`]: false },
|
||||
},
|
||||
|
|
|
@ -64,9 +64,9 @@ class BaseStepBuilder {
|
|||
stepId: TStep,
|
||||
stepSchema: Omit<AutomationStep, "id" | "stepId" | "inputs">,
|
||||
inputs: AutomationStepInputs<TStep>,
|
||||
opts?: { stepName?: string; id?: string }
|
||||
opts?: { stepName?: string; stepId?: string }
|
||||
): this {
|
||||
const id = opts?.id || uuidv4()
|
||||
const id = opts?.stepId || uuidv4()
|
||||
this.steps.push({
|
||||
...stepSchema,
|
||||
inputs: inputs as any,
|
||||
|
@ -107,7 +107,7 @@ class BaseStepBuilder {
|
|||
// STEPS
|
||||
createRow(
|
||||
inputs: CreateRowStepInputs,
|
||||
opts?: { stepName?: string; id?: string }
|
||||
opts?: { stepName?: string; stepId?: string }
|
||||
): this {
|
||||
return this.step(
|
||||
AutomationActionStepId.CREATE_ROW,
|
||||
|
@ -119,7 +119,7 @@ class BaseStepBuilder {
|
|||
|
||||
updateRow(
|
||||
inputs: UpdateRowStepInputs,
|
||||
opts?: { stepName?: string; id?: string }
|
||||
opts?: { stepName?: string; stepId?: string }
|
||||
): this {
|
||||
return this.step(
|
||||
AutomationActionStepId.UPDATE_ROW,
|
||||
|
@ -131,7 +131,7 @@ class BaseStepBuilder {
|
|||
|
||||
deleteRow(
|
||||
inputs: DeleteRowStepInputs,
|
||||
opts?: { stepName?: string; id?: string }
|
||||
opts?: { stepName?: string; stepId?: string }
|
||||
): this {
|
||||
return this.step(
|
||||
AutomationActionStepId.DELETE_ROW,
|
||||
|
@ -143,7 +143,7 @@ class BaseStepBuilder {
|
|||
|
||||
sendSmtpEmail(
|
||||
inputs: SmtpEmailStepInputs,
|
||||
opts?: { stepName?: string; id?: string }
|
||||
opts?: { stepName?: string; stepId?: string }
|
||||
): this {
|
||||
return this.step(
|
||||
AutomationActionStepId.SEND_EMAIL_SMTP,
|
||||
|
@ -155,7 +155,7 @@ class BaseStepBuilder {
|
|||
|
||||
executeQuery(
|
||||
inputs: ExecuteQueryStepInputs,
|
||||
opts?: { stepName?: string; id?: string }
|
||||
opts?: { stepName?: string; stepId?: string }
|
||||
): this {
|
||||
return this.step(
|
||||
AutomationActionStepId.EXECUTE_QUERY,
|
||||
|
@ -167,7 +167,7 @@ class BaseStepBuilder {
|
|||
|
||||
queryRows(
|
||||
inputs: QueryRowsStepInputs,
|
||||
opts?: { stepName?: string; id?: string }
|
||||
opts?: { stepName?: string; stepId?: string }
|
||||
): this {
|
||||
return this.step(
|
||||
AutomationActionStepId.QUERY_ROWS,
|
||||
|
@ -178,7 +178,7 @@ class BaseStepBuilder {
|
|||
}
|
||||
loop(
|
||||
inputs: LoopStepInputs,
|
||||
opts?: { stepName?: string; id?: string }
|
||||
opts?: { stepName?: string; stepId?: string }
|
||||
): this {
|
||||
return this.step(
|
||||
AutomationActionStepId.LOOP,
|
||||
|
@ -190,7 +190,7 @@ class BaseStepBuilder {
|
|||
|
||||
serverLog(
|
||||
input: ServerLogStepInputs,
|
||||
opts?: { stepName?: string; id?: string }
|
||||
opts?: { stepName?: string; stepId?: string }
|
||||
): this {
|
||||
return this.step(
|
||||
AutomationActionStepId.SERVER_LOG,
|
||||
|
|
|
@ -15,8 +15,8 @@ export interface TriggerOutput {
|
|||
|
||||
export interface AutomationContext extends AutomationResults {
|
||||
steps: any[]
|
||||
stepsById?: Record<string, any>
|
||||
stepsByName?: Record<string, any>
|
||||
stepsById: Record<string, any>
|
||||
stepsByName: Record<string, any>
|
||||
env?: Record<string, string>
|
||||
trigger: any
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ class Orchestrator {
|
|||
private job: Job
|
||||
private loopStepOutputs: LoopStep[]
|
||||
private stopped: boolean
|
||||
private executionOutput: AutomationContext
|
||||
private executionOutput: Omit<AutomationContext, "stepsByName" | "stepsById">
|
||||
|
||||
constructor(job: AutomationJob) {
|
||||
let automation = job.data.automation
|
||||
|
@ -458,9 +458,9 @@ class Orchestrator {
|
|||
inputs: steps[stepToLoopIndex].inputs,
|
||||
})
|
||||
|
||||
this.context.stepsById![steps[stepToLoopIndex].id] = tempOutput
|
||||
this.context.stepsById[steps[stepToLoopIndex].id] = tempOutput
|
||||
const stepName = steps[stepToLoopIndex].name || steps[stepToLoopIndex].id
|
||||
this.context.stepsByName![stepName] = tempOutput
|
||||
this.context.stepsByName[stepName] = tempOutput
|
||||
this.context.steps[this.context.steps.length] = tempOutput
|
||||
this.context.steps = this.context.steps.filter(
|
||||
item => !item.hasOwnProperty.call(item, "currentItem")
|
||||
|
|
Loading…
Reference in New Issue