-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update workflow version struct #6716
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
packages/twenty-server/src/modules/workflow/common/types/workflow-action.type.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
packages/twenty-server/src/modules/workflow/common/types/workflow-step.type.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { WorkflowCodeSettings } from 'src/modules/workflow/common/types/workflow-settings.type'; | ||
|
||
export enum WorkflowStepType { | ||
CODE_ACTION = 'CODE_ACTION', | ||
} | ||
|
||
type BaseWorkflowStep = { | ||
id: string; | ||
name: string; | ||
valid: boolean; | ||
}; | ||
|
||
export type WorkflowCodeStep = BaseWorkflowStep & { | ||
type: WorkflowStepType.CODE_ACTION; | ||
settings: WorkflowCodeSettings; | ||
}; | ||
|
||
export type WorkflowStep = WorkflowCodeStep; |
5 changes: 1 addition & 4 deletions
5
packages/twenty-server/src/modules/workflow/common/types/workflow-trigger.type.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
...erver/src/modules/workflow/workflow-action-executor/workflow-action-executor.exception.ts
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
...-server/src/modules/workflow/workflow-action-executor/workflow-action-executor.factory.ts
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
...y-server/src/modules/workflow/workflow-action-executor/workflow-action-executor.module.ts
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...ty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.exception.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { CustomException } from 'src/utils/custom-exception'; | ||
|
||
export class WorkflowStepExecutorException extends CustomException { | ||
code: WorkflowStepExecutorExceptionCode; | ||
constructor(message: string, code: WorkflowStepExecutorExceptionCode) { | ||
super(message, code); | ||
} | ||
} | ||
|
||
export enum WorkflowStepExecutorExceptionCode { | ||
SCOPED_WORKSPACE_NOT_FOUND = 'SCOPED_WORKSPACE_NOT_FOUND', | ||
INVALID_STEP_TYPE = 'INVALID_STEP_TYPE', | ||
} |
26 changes: 26 additions & 0 deletions
26
...enty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.factory.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
|
||
import { WorkflowStepType } from 'src/modules/workflow/common/types/workflow-step.type'; | ||
import { | ||
WorkflowStepExecutorException, | ||
WorkflowStepExecutorExceptionCode, | ||
} from 'src/modules/workflow/workflow-step-executor/workflow-step-executor.exception'; | ||
import { WorkflowStepExecutor } from 'src/modules/workflow/workflow-step-executor/workflow-step-executor.interface'; | ||
import { CodeActionExecutor } from 'src/modules/workflow/workflow-step-executor/workflow-step-executors/code-action-executor'; | ||
|
||
@Injectable() | ||
export class WorkflowStepExecutorFactory { | ||
constructor(private readonly codeActionExecutor: CodeActionExecutor) {} | ||
|
||
get(stepType: WorkflowStepType): WorkflowStepExecutor { | ||
switch (stepType) { | ||
case WorkflowStepType.CODE_ACTION: | ||
return this.codeActionExecutor; | ||
default: | ||
throw new WorkflowStepExecutorException( | ||
`Workflow step executor not found for step type '${stepType}'`, | ||
WorkflowStepExecutorExceptionCode.INVALID_STEP_TYPE, | ||
); | ||
} | ||
} | ||
} |
8 changes: 4 additions & 4 deletions
8
...tor/workflow-action-executor.interface.ts → ...cutor/workflow-step-executor.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import { WorkflowAction } from 'src/modules/workflow/common/types/workflow-action.type'; | ||
import { WorkflowResult } from 'src/modules/workflow/common/types/workflow-result.type'; | ||
import { WorkflowStep } from 'src/modules/workflow/common/types/workflow-step.type'; | ||
|
||
export interface WorkflowActionExecutor { | ||
export interface WorkflowStepExecutor { | ||
execute({ | ||
action, | ||
step, | ||
payload, | ||
}: { | ||
action: WorkflowAction; | ||
step: WorkflowStep; | ||
payload?: object; | ||
}): Promise<WorkflowResult>; | ||
} |
17 changes: 17 additions & 0 deletions
17
...wenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Module } from '@nestjs/common'; | ||
|
||
import { ServerlessFunctionModule } from 'src/engine/metadata-modules/serverless-function/serverless-function.module'; | ||
import { ScopedWorkspaceContextFactory } from 'src/engine/twenty-orm/factories/scoped-workspace-context.factory'; | ||
import { WorkflowStepExecutorFactory } from 'src/modules/workflow/workflow-step-executor/workflow-step-executor.factory'; | ||
import { CodeActionExecutor } from 'src/modules/workflow/workflow-step-executor/workflow-step-executors/code-action-executor'; | ||
|
||
@Module({ | ||
imports: [ServerlessFunctionModule], | ||
providers: [ | ||
WorkflowStepExecutorFactory, | ||
CodeActionExecutor, | ||
ScopedWorkspaceContextFactory, | ||
], | ||
exports: [WorkflowStepExecutorFactory], | ||
}) | ||
export class WorkflowStepExecutorModule {} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Add a
type
field toBaseWorkflowStep
for better type safety when handling different step types