From 6339a4ebf91f0865ae99f0d7cc2c6b99f9cb5a6b Mon Sep 17 00:00:00 2001 From: martmull Date: Mon, 9 Sep 2024 14:35:33 +0200 Subject: [PATCH 01/24] Add system action executor --- .../common/types/workflow-settings.type.ts | 6 ++++ ...t.type.ts => workflow-step-result.type.ts} | 2 +- .../common/types/workflow-step.type.ts | 13 +++++++-- .../types/workflow-system-action.type.ts | 3 ++ .../workflow-step-executor.factory.ts | 8 +++++- .../workflow-step-executor.interface.ts | 4 +-- .../workflow-step-executor.module.ts | 5 +++- .../code-action-executor.ts | 4 +-- .../system-action-executor.ts | 27 ++++++++++++++++++ .../workflow-system-action.exception.ts | 12 ++++++++ .../workflow-system-action.factory.ts | 28 +++++++++++++++++++ .../workflow-system-action.interface.ts | 12 ++++++++ .../workflow-system-action.module.ts | 10 +++++++ .../send-email-action.ts | 23 +++++++++++++++ 14 files changed, 148 insertions(+), 9 deletions(-) rename packages/twenty-server/src/modules/workflow/common/types/{workflow-result.type.ts => workflow-step-result.type.ts} (80%) create mode 100644 packages/twenty-server/src/modules/workflow/common/types/workflow-system-action.type.ts create mode 100644 packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executors/system-action-executor.ts create mode 100644 packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.exception.ts create mode 100644 packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.factory.ts create mode 100644 packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.interface.ts create mode 100644 packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.module.ts create mode 100644 packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action.ts diff --git a/packages/twenty-server/src/modules/workflow/common/types/workflow-settings.type.ts b/packages/twenty-server/src/modules/workflow/common/types/workflow-settings.type.ts index dde3025dfe6e..0331b6c9f41c 100644 --- a/packages/twenty-server/src/modules/workflow/common/types/workflow-settings.type.ts +++ b/packages/twenty-server/src/modules/workflow/common/types/workflow-settings.type.ts @@ -1,3 +1,5 @@ +import { WorkflowSystemActionType } from 'src/modules/workflow/common/types/workflow-system-action.type'; + type BaseWorkflowSettings = { errorHandlingOptions: { retryOnFailure: { @@ -12,3 +14,7 @@ type BaseWorkflowSettings = { export type WorkflowCodeSettings = BaseWorkflowSettings & { serverlessFunctionId: string; }; + +export type WorkflowSystemActionSettings = BaseWorkflowSettings & { + systemActionType: WorkflowSystemActionType; +}; diff --git a/packages/twenty-server/src/modules/workflow/common/types/workflow-result.type.ts b/packages/twenty-server/src/modules/workflow/common/types/workflow-step-result.type.ts similarity index 80% rename from packages/twenty-server/src/modules/workflow/common/types/workflow-result.type.ts rename to packages/twenty-server/src/modules/workflow/common/types/workflow-step-result.type.ts index 613ad5a99018..ec93f688d202 100644 --- a/packages/twenty-server/src/modules/workflow/common/types/workflow-result.type.ts +++ b/packages/twenty-server/src/modules/workflow/common/types/workflow-step-result.type.ts @@ -4,7 +4,7 @@ type WorkflowError = { stackTrace: string; }; -export type WorkflowResult = { +export type WorkflowStepResult = { data: object | null; error?: WorkflowError; }; diff --git a/packages/twenty-server/src/modules/workflow/common/types/workflow-step.type.ts b/packages/twenty-server/src/modules/workflow/common/types/workflow-step.type.ts index ef3c7069662f..b1e925af5949 100644 --- a/packages/twenty-server/src/modules/workflow/common/types/workflow-step.type.ts +++ b/packages/twenty-server/src/modules/workflow/common/types/workflow-step.type.ts @@ -1,7 +1,11 @@ -import { WorkflowCodeSettings } from 'src/modules/workflow/common/types/workflow-settings.type'; +import { + WorkflowCodeSettings, + WorkflowSystemActionSettings, +} from 'src/modules/workflow/common/types/workflow-settings.type'; export enum WorkflowStepType { CODE_ACTION = 'CODE_ACTION', + SYSTEM_ACTION = 'SYSTEM_ACTION', } type BaseWorkflowStep = { @@ -15,4 +19,9 @@ export type WorkflowCodeStep = BaseWorkflowStep & { settings: WorkflowCodeSettings; }; -export type WorkflowStep = WorkflowCodeStep; +export type WorkflowSystemStep = BaseWorkflowStep & { + type: WorkflowStepType.SYSTEM_ACTION; + settings: WorkflowSystemActionSettings; +}; + +export type WorkflowStep = WorkflowCodeStep | WorkflowSystemStep; diff --git a/packages/twenty-server/src/modules/workflow/common/types/workflow-system-action.type.ts b/packages/twenty-server/src/modules/workflow/common/types/workflow-system-action.type.ts new file mode 100644 index 000000000000..11855785eb3f --- /dev/null +++ b/packages/twenty-server/src/modules/workflow/common/types/workflow-system-action.type.ts @@ -0,0 +1,3 @@ +export enum WorkflowSystemActionType { + SEND_EMAIL = 'SEND_EMAIL', +} diff --git a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.factory.ts b/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.factory.ts index 72f46451e669..5cbd5045d13e 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.factory.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.factory.ts @@ -7,15 +7,21 @@ import { } 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'; +import { SystemActionExecutor } from 'src/modules/workflow/workflow-step-executor/workflow-step-executors/system-action-executor'; @Injectable() export class WorkflowStepExecutorFactory { - constructor(private readonly codeActionExecutor: CodeActionExecutor) {} + constructor( + private readonly codeActionExecutor: CodeActionExecutor, + private readonly systemActionExecutor: SystemActionExecutor, + ) {} get(stepType: WorkflowStepType): WorkflowStepExecutor { switch (stepType) { case WorkflowStepType.CODE_ACTION: return this.codeActionExecutor; + case WorkflowStepType.SYSTEM_ACTION: + return this.systemActionExecutor; default: throw new WorkflowStepExecutorException( `Workflow step executor not found for step type '${stepType}'`, diff --git a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.interface.ts b/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.interface.ts index 169ebc2ca92c..fd7ff8f49732 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.interface.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.interface.ts @@ -1,4 +1,4 @@ -import { WorkflowResult } from 'src/modules/workflow/common/types/workflow-result.type'; +import { WorkflowStepResult } from 'src/modules/workflow/common/types/workflow-step-result.type'; import { WorkflowStep } from 'src/modules/workflow/common/types/workflow-step.type'; export interface WorkflowStepExecutor { @@ -8,5 +8,5 @@ export interface WorkflowStepExecutor { }: { step: WorkflowStep; payload?: object; - }): Promise; + }): Promise; } diff --git a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.module.ts b/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.module.ts index 293a3614bba9..c982b3b23a4e 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.module.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.module.ts @@ -4,12 +4,15 @@ import { ServerlessFunctionModule } from 'src/engine/metadata-modules/serverless 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'; +import { SystemActionExecutor } from 'src/modules/workflow/workflow-step-executor/workflow-step-executors/system-action-executor'; +import { WorkflowSystemActionModule } from 'src/modules/workflow/workflow-system-action/workflow-system-action.module'; @Module({ - imports: [ServerlessFunctionModule], + imports: [ServerlessFunctionModule, WorkflowSystemActionModule], providers: [ WorkflowStepExecutorFactory, CodeActionExecutor, + SystemActionExecutor, ScopedWorkspaceContextFactory, ], exports: [WorkflowStepExecutorFactory], diff --git a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executors/code-action-executor.ts b/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executors/code-action-executor.ts index 1627ef1db1c6..ca7ffdefa1d1 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executors/code-action-executor.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executors/code-action-executor.ts @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common'; import { ServerlessFunctionService } from 'src/engine/metadata-modules/serverless-function/serverless-function.service'; import { ScopedWorkspaceContextFactory } from 'src/engine/twenty-orm/factories/scoped-workspace-context.factory'; -import { WorkflowResult } from 'src/modules/workflow/common/types/workflow-result.type'; +import { WorkflowStepResult } from 'src/modules/workflow/common/types/workflow-step-result.type'; import { WorkflowCodeStep } from 'src/modules/workflow/common/types/workflow-step.type'; import { WorkflowStepExecutorException, @@ -23,7 +23,7 @@ export class CodeActionExecutor implements WorkflowStepExecutor { }: { step: WorkflowCodeStep; payload?: object; - }): Promise { + }): Promise { const { workspaceId } = this.scopedWorkspaceContextFactory.create(); if (!workspaceId) { diff --git a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executors/system-action-executor.ts b/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executors/system-action-executor.ts new file mode 100644 index 000000000000..a6ba377cf7a0 --- /dev/null +++ b/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executors/system-action-executor.ts @@ -0,0 +1,27 @@ +import { Injectable } from '@nestjs/common'; + +import { WorkflowStepExecutor } from 'src/modules/workflow/workflow-step-executor/workflow-step-executor.interface'; +import { WorkflowSystemStep } from 'src/modules/workflow/common/types/workflow-step.type'; +import { WorkflowStepResult } from 'src/modules/workflow/common/types/workflow-step-result.type'; +import { WorkflowSystemActionFactory } from 'src/modules/workflow/workflow-system-action/workflow-system-action.factory'; + +@Injectable() +export class SystemActionExecutor implements WorkflowStepExecutor { + constructor( + private readonly workflowSystemActionFactory: WorkflowSystemActionFactory, + ) {} + + async execute({ + step, + payload, + }: { + step: WorkflowSystemStep; + payload?: object; + }): Promise { + const workflowSystemAction = this.workflowSystemActionFactory.get( + step.settings.systemActionType, + ); + + return await workflowSystemAction.execute({ step, payload }); + } +} diff --git a/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.exception.ts b/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.exception.ts new file mode 100644 index 000000000000..74721b5784e2 --- /dev/null +++ b/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.exception.ts @@ -0,0 +1,12 @@ +import { CustomException } from 'src/utils/custom-exception'; + +export class WorkflowSystemActionException extends CustomException { + code: WorkflowSystemActionExceptionCode; + constructor(message: string, code: WorkflowSystemActionExceptionCode) { + super(message, code); + } +} + +export enum WorkflowSystemActionExceptionCode { + INVALID_SYSTEM_ACTION_TYPE = 'INVALID_SYSTEM_ACTION_TYPE', +} diff --git a/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.factory.ts b/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.factory.ts new file mode 100644 index 000000000000..993148c95b18 --- /dev/null +++ b/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.factory.ts @@ -0,0 +1,28 @@ +import { Injectable } from '@nestjs/common'; + +import { WorkflowSystemAction } from 'src/modules/workflow/workflow-system-action/workflow-system-action.interface'; +import { + WorkflowSystemActionException, + WorkflowSystemActionExceptionCode, +} from 'src/modules/workflow/workflow-system-action/workflow-system-action.exception'; +import { SendEmailAction } from 'src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action'; +import { WorkflowSystemActionType } from 'src/modules/workflow/common/types/workflow-system-action.type'; + +@Injectable() +export class WorkflowSystemActionFactory { + constructor(private readonly sendEmailAction: SendEmailAction) {} + + get( + workflowSystemActionType: WorkflowSystemActionType, + ): WorkflowSystemAction { + switch (workflowSystemActionType) { + case WorkflowSystemActionType.SEND_EMAIL: + return this.sendEmailAction; + default: + throw new WorkflowSystemActionException( + `Workflow system action not found for system action type '${workflowSystemActionType}'`, + WorkflowSystemActionExceptionCode.INVALID_SYSTEM_ACTION_TYPE, + ); + } + } +} diff --git a/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.interface.ts b/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.interface.ts new file mode 100644 index 000000000000..314c2232eece --- /dev/null +++ b/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.interface.ts @@ -0,0 +1,12 @@ +import { WorkflowSystemStep } from 'src/modules/workflow/common/types/workflow-step.type'; +import { WorkflowStepResult } from 'src/modules/workflow/common/types/workflow-step-result.type'; + +export interface WorkflowSystemAction { + execute({ + step, + payload, + }: { + step: WorkflowSystemStep; + payload?: object; + }): Promise; +} diff --git a/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.module.ts b/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.module.ts new file mode 100644 index 000000000000..fcd294c5f547 --- /dev/null +++ b/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.module.ts @@ -0,0 +1,10 @@ +import { Module } from '@nestjs/common'; + +import { WorkflowSystemActionFactory } from 'src/modules/workflow/workflow-system-action/workflow-system-action.factory'; +import { SendEmailAction } from 'src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action'; + +@Module({ + providers: [WorkflowSystemActionFactory, SendEmailAction], + exports: [WorkflowSystemActionFactory], +}) +export class WorkflowSystemActionModule {} diff --git a/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action.ts b/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action.ts new file mode 100644 index 000000000000..109989fdb301 --- /dev/null +++ b/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action.ts @@ -0,0 +1,23 @@ +import { Injectable } from '@nestjs/common'; + +import { WorkflowSystemAction } from 'src/modules/workflow/workflow-system-action/workflow-system-action.interface'; +import { WorkflowStep } from 'src/modules/workflow/common/types/workflow-step.type'; +import { WorkflowStepResult } from 'src/modules/workflow/common/types/workflow-step-result.type'; + +@Injectable() +export class SendEmailAction implements WorkflowSystemAction { + async execute({ + step, + payload, + }: { + step: WorkflowStep; + payload?: object; + }): Promise { + return { + data: { + step, + payload, + }, + }; + } +} From e484c6094ae5744c1c30c20ea73f2a2cd79ce909 Mon Sep 17 00:00:00 2001 From: martmull Date: Mon, 9 Sep 2024 17:25:35 +0200 Subject: [PATCH 02/24] Add send email step --- .../src/emails/workflow-action.email.tsx | 28 +++++++++ packages/twenty-emails/src/index.ts | 1 + .../settings/workflow-base-settings.type.ts | 10 ++++ .../settings/workflow-code-settings.type.ts | 5 ++ .../workflow-system-action-settings.type.ts | 19 ++++++ .../common/types/workflow-settings.type.ts | 20 ------- .../common/types/workflow-step.type.ts | 6 +- .../send-email-action.ts | 58 ++++++++++++++++--- 8 files changed, 114 insertions(+), 33 deletions(-) create mode 100644 packages/twenty-emails/src/emails/workflow-action.email.tsx create mode 100644 packages/twenty-server/src/modules/workflow/common/types/settings/workflow-base-settings.type.ts create mode 100644 packages/twenty-server/src/modules/workflow/common/types/settings/workflow-code-settings.type.ts create mode 100644 packages/twenty-server/src/modules/workflow/common/types/settings/workflow-system-action-settings.type.ts delete mode 100644 packages/twenty-server/src/modules/workflow/common/types/workflow-settings.type.ts diff --git a/packages/twenty-emails/src/emails/workflow-action.email.tsx b/packages/twenty-emails/src/emails/workflow-action.email.tsx new file mode 100644 index 000000000000..13eedb17bf3f --- /dev/null +++ b/packages/twenty-emails/src/emails/workflow-action.email.tsx @@ -0,0 +1,28 @@ +import { BaseEmail } from 'src/components/BaseEmail'; +import { Title } from 'src/components/Title'; +import { MainText } from 'src/components/MainText'; +import { CallToAction } from 'src/components/CallToAction'; + +type WorkflowActionEmailProps = { + mainText?: string; + title?: string; + callToAction?: { + value: string; + href: string; + }; +}; +export const WorkflowActionEmail = ({ + mainText, + title, + callToAction, +}: WorkflowActionEmailProps) => { + return ( + + {title && } + {mainText && <MainText>{mainText}</MainText>} + {callToAction && ( + <CallToAction value={callToAction.value} href={callToAction.href} /> + )} + </BaseEmail> + ); +}; diff --git a/packages/twenty-emails/src/index.ts b/packages/twenty-emails/src/index.ts index ddecb05c8655..9fca13d73b55 100644 --- a/packages/twenty-emails/src/index.ts +++ b/packages/twenty-emails/src/index.ts @@ -3,3 +3,4 @@ export * from './emails/delete-inactive-workspaces.email'; export * from './emails/password-reset-link.email'; export * from './emails/password-update-notify.email'; export * from './emails/send-invite-link.email'; +export * from './emails/workflow-action.email'; diff --git a/packages/twenty-server/src/modules/workflow/common/types/settings/workflow-base-settings.type.ts b/packages/twenty-server/src/modules/workflow/common/types/settings/workflow-base-settings.type.ts new file mode 100644 index 000000000000..b6a2c2a90584 --- /dev/null +++ b/packages/twenty-server/src/modules/workflow/common/types/settings/workflow-base-settings.type.ts @@ -0,0 +1,10 @@ +export type BaseWorkflowSettings = { + errorHandlingOptions: { + retryOnFailure: { + value: boolean; + }; + continueOnFailure: { + value: boolean; + }; + }; +}; diff --git a/packages/twenty-server/src/modules/workflow/common/types/settings/workflow-code-settings.type.ts b/packages/twenty-server/src/modules/workflow/common/types/settings/workflow-code-settings.type.ts new file mode 100644 index 000000000000..f74868c38a80 --- /dev/null +++ b/packages/twenty-server/src/modules/workflow/common/types/settings/workflow-code-settings.type.ts @@ -0,0 +1,5 @@ +import { BaseWorkflowSettings } from 'src/modules/workflow/common/types/settings/workflow-base-settings.type'; + +export type WorkflowCodeSettings = BaseWorkflowSettings & { + serverlessFunctionId: string; +}; diff --git a/packages/twenty-server/src/modules/workflow/common/types/settings/workflow-system-action-settings.type.ts b/packages/twenty-server/src/modules/workflow/common/types/settings/workflow-system-action-settings.type.ts new file mode 100644 index 000000000000..e13a55cbfc58 --- /dev/null +++ b/packages/twenty-server/src/modules/workflow/common/types/settings/workflow-system-action-settings.type.ts @@ -0,0 +1,19 @@ +import { BaseWorkflowSettings } from 'src/modules/workflow/common/types/settings/workflow-base-settings.type'; +import { WorkflowSystemActionType } from 'src/modules/workflow/common/types/workflow-system-action.type'; + +type BaseSystemActionSettings = BaseWorkflowSettings & { + systemActionType: WorkflowSystemActionType; +}; + +export type WorkflowSystemSendEmailActionSettings = BaseSystemActionSettings & { + subject: string; + template?: string; + title?: string; + callToAction?: { + value: string; + href: string; + }; +}; + +export type WorkflowSystemActionSettings = + WorkflowSystemSendEmailActionSettings; diff --git a/packages/twenty-server/src/modules/workflow/common/types/workflow-settings.type.ts b/packages/twenty-server/src/modules/workflow/common/types/workflow-settings.type.ts deleted file mode 100644 index 0331b6c9f41c..000000000000 --- a/packages/twenty-server/src/modules/workflow/common/types/workflow-settings.type.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { WorkflowSystemActionType } from 'src/modules/workflow/common/types/workflow-system-action.type'; - -type BaseWorkflowSettings = { - errorHandlingOptions: { - retryOnFailure: { - value: boolean; - }; - continueOnFailure: { - value: boolean; - }; - }; -}; - -export type WorkflowCodeSettings = BaseWorkflowSettings & { - serverlessFunctionId: string; -}; - -export type WorkflowSystemActionSettings = BaseWorkflowSettings & { - systemActionType: WorkflowSystemActionType; -}; diff --git a/packages/twenty-server/src/modules/workflow/common/types/workflow-step.type.ts b/packages/twenty-server/src/modules/workflow/common/types/workflow-step.type.ts index b1e925af5949..523b515ae3b1 100644 --- a/packages/twenty-server/src/modules/workflow/common/types/workflow-step.type.ts +++ b/packages/twenty-server/src/modules/workflow/common/types/workflow-step.type.ts @@ -1,7 +1,5 @@ -import { - WorkflowCodeSettings, - WorkflowSystemActionSettings, -} from 'src/modules/workflow/common/types/workflow-settings.type'; +import { WorkflowCodeSettings } from 'src/modules/workflow/common/types/settings/workflow-code-settings.type'; +import { WorkflowSystemActionSettings } from 'src/modules/workflow/common/types/settings/workflow-system-action-settings.type'; export enum WorkflowStepType { CODE_ACTION = 'CODE_ACTION', diff --git a/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action.ts b/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action.ts index 109989fdb301..a59ab8cfd998 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action.ts @@ -1,23 +1,63 @@ import { Injectable } from '@nestjs/common'; +import { WorkflowActionEmail } from 'twenty-emails'; +import { render } from '@react-email/components'; + import { WorkflowSystemAction } from 'src/modules/workflow/workflow-system-action/workflow-system-action.interface'; -import { WorkflowStep } from 'src/modules/workflow/common/types/workflow-step.type'; +import { WorkflowSystemStep } from 'src/modules/workflow/common/types/workflow-step.type'; import { WorkflowStepResult } from 'src/modules/workflow/common/types/workflow-step-result.type'; +import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EmailService } from 'src/engine/integrations/email/email.service'; +import { isDefined } from 'src/utils/is-defined'; @Injectable() export class SendEmailAction implements WorkflowSystemAction { + constructor( + private readonly environmentService: EnvironmentService, + private readonly emailService: EmailService, + ) {} + async execute({ step, payload, }: { - step: WorkflowStep; - payload?: object; - }): Promise<WorkflowStepResult> { - return { - data: { - step, - payload, - }, + step: WorkflowSystemStep; + payload: { + email: string; + [key: string]: string; }; + }): Promise<WorkflowStepResult> { + let mainText = step.settings.template; + + if (isDefined(payload)) { + Object.keys(payload).forEach( + (key: string) => + (mainText = mainText?.replace(`{{${key}}}`, payload[key])), + ); + } + + const email = WorkflowActionEmail({ + mainText: mainText, + title: step.settings.title, + callToAction: step.settings.callToAction, + }); + const html = render(email, { + pretty: true, + }); + const text = render(email, { + plainText: true, + }); + + await this.emailService.send({ + from: `${this.environmentService.get( + 'EMAIL_FROM_NAME', + )} <${this.environmentService.get('EMAIL_FROM_ADDRESS')}>`, + to: payload.email, + subject: step.settings.subject, + text, + html, + }); + + return { data: null }; } } From 452824286b5da4cc6652e77b81bd994cbbadb8e5 Mon Sep 17 00:00:00 2001 From: martmull <martmull@hotmail.fr> Date: Tue, 10 Sep 2024 08:11:59 +0200 Subject: [PATCH 03/24] Remove logo from workflow email --- packages/twenty-emails/src/components/BaseEmail.tsx | 9 +++++++-- packages/twenty-emails/src/components/BaseHead.tsx | 2 +- .../twenty-emails/src/emails/workflow-action.email.tsx | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/twenty-emails/src/components/BaseEmail.tsx b/packages/twenty-emails/src/components/BaseEmail.tsx index c98c7013b9b3..8222958ba88f 100644 --- a/packages/twenty-emails/src/components/BaseEmail.tsx +++ b/packages/twenty-emails/src/components/BaseEmail.tsx @@ -6,14 +6,19 @@ import { Logo } from 'src/components/Logo'; type BaseEmailProps = PropsWithChildren<{ width?: number; + withLogo?: boolean; }>; -export const BaseEmail = ({ children, width }: BaseEmailProps) => { +export const BaseEmail = ({ + children, + width, + withLogo = true, +}: BaseEmailProps) => { return ( <Html lang="en"> <BaseHead /> <Container width={width || 290}> - <Logo /> + {withLogo && <Logo />} {children} </Container> </Html> diff --git a/packages/twenty-emails/src/components/BaseHead.tsx b/packages/twenty-emails/src/components/BaseHead.tsx index 389369b26154..ba1db296a2cb 100644 --- a/packages/twenty-emails/src/components/BaseHead.tsx +++ b/packages/twenty-emails/src/components/BaseHead.tsx @@ -5,7 +5,7 @@ import { emailTheme } from 'src/common-style'; export const BaseHead = () => { return ( <Head> - <title>Twenty email + An email from Twenty { return ( - + {title && } {mainText && <MainText>{mainText}</MainText>} {callToAction && ( From cb33021530d4e6427ede58a328524fb6ae018298 Mon Sep 17 00:00:00 2001 From: martmull <martmull@hotmail.fr> Date: Tue, 10 Sep 2024 15:26:50 +0200 Subject: [PATCH 04/24] Sanitize html --- .../twenty-emails/src/emails/workflow-action.email.tsx | 9 +++++---- .../settings/workflow-system-action-settings.type.ts | 2 +- .../workflow-system-actions/send-email-action.ts | 9 +++++++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/twenty-emails/src/emails/workflow-action.email.tsx b/packages/twenty-emails/src/emails/workflow-action.email.tsx index 58d98c5a7f9b..cb0e2d6e5d7d 100644 --- a/packages/twenty-emails/src/emails/workflow-action.email.tsx +++ b/packages/twenty-emails/src/emails/workflow-action.email.tsx @@ -1,10 +1,9 @@ import { BaseEmail } from 'src/components/BaseEmail'; import { Title } from 'src/components/Title'; -import { MainText } from 'src/components/MainText'; import { CallToAction } from 'src/components/CallToAction'; type WorkflowActionEmailProps = { - mainText?: string; + dangerousHTML?: string; title?: string; callToAction?: { value: string; @@ -12,14 +11,16 @@ type WorkflowActionEmailProps = { }; }; export const WorkflowActionEmail = ({ - mainText, + dangerousHTML, title, callToAction, }: WorkflowActionEmailProps) => { return ( <BaseEmail withLogo={false}> {title && <Title value={title} />} - {mainText && <MainText>{mainText}</MainText>} + {dangerousHTML && ( + <div dangerouslySetInnerHTML={{ __html: dangerousHTML }} /> + )} {callToAction && ( <CallToAction value={callToAction.value} href={callToAction.href} /> )} diff --git a/packages/twenty-server/src/modules/workflow/common/types/settings/workflow-system-action-settings.type.ts b/packages/twenty-server/src/modules/workflow/common/types/settings/workflow-system-action-settings.type.ts index e13a55cbfc58..98957a8dbf0c 100644 --- a/packages/twenty-server/src/modules/workflow/common/types/settings/workflow-system-action-settings.type.ts +++ b/packages/twenty-server/src/modules/workflow/common/types/settings/workflow-system-action-settings.type.ts @@ -6,7 +6,7 @@ type BaseSystemActionSettings = BaseWorkflowSettings & { }; export type WorkflowSystemSendEmailActionSettings = BaseSystemActionSettings & { - subject: string; + subject?: string; template?: string; title?: string; callToAction?: { diff --git a/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action.ts b/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action.ts index a59ab8cfd998..4b5030a755c5 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action.ts @@ -2,6 +2,8 @@ import { Injectable } from '@nestjs/common'; import { WorkflowActionEmail } from 'twenty-emails'; import { render } from '@react-email/components'; +import { JSDOM } from 'jsdom'; +import DOMPurify from 'dompurify'; import { WorkflowSystemAction } from 'src/modules/workflow/workflow-system-action/workflow-system-action.interface'; import { WorkflowSystemStep } from 'src/modules/workflow/common/types/workflow-step.type'; @@ -35,9 +37,12 @@ export class SendEmailAction implements WorkflowSystemAction { (mainText = mainText?.replace(`{{${key}}}`, payload[key])), ); } + const window = new JSDOM('').window; + const purify = DOMPurify(window); + const safeHTML = purify.sanitize(mainText || ''); const email = WorkflowActionEmail({ - mainText: mainText, + dangerousHTML: safeHTML, title: step.settings.title, callToAction: step.settings.callToAction, }); @@ -53,7 +58,7 @@ export class SendEmailAction implements WorkflowSystemAction { 'EMAIL_FROM_NAME', )} <${this.environmentService.get('EMAIL_FROM_ADDRESS')}>`, to: payload.email, - subject: step.settings.subject, + subject: step.settings.subject || '', text, html, }); From 2e44781656380283a329e3c276e6c3d71e113583 Mon Sep 17 00:00:00 2001 From: martmull <martmull@hotmail.fr> Date: Tue, 10 Sep 2024 16:45:29 +0200 Subject: [PATCH 05/24] Fix typing --- .../common/types/workflow-step-result.type.ts | 2 +- .../workflow-step-executors/code-action-executor.ts | 6 +++++- .../system-action-executor.ts | 12 ++++++++---- .../workflow-system-actions/send-email-action.ts | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/packages/twenty-server/src/modules/workflow/common/types/workflow-step-result.type.ts b/packages/twenty-server/src/modules/workflow/common/types/workflow-step-result.type.ts index ec93f688d202..243d1e5e6a65 100644 --- a/packages/twenty-server/src/modules/workflow/common/types/workflow-step-result.type.ts +++ b/packages/twenty-server/src/modules/workflow/common/types/workflow-step-result.type.ts @@ -5,6 +5,6 @@ type WorkflowError = { }; export type WorkflowStepResult = { - data: object | null; + data?: object; error?: WorkflowError; }; diff --git a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executors/code-action-executor.ts b/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executors/code-action-executor.ts index ca7ffdefa1d1..87a48f1c304d 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executors/code-action-executor.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executors/code-action-executor.ts @@ -40,6 +40,10 @@ export class CodeActionExecutor implements WorkflowStepExecutor { payload || {}, ); - return { data: result.data, ...(result.error && { error: result.error }) }; + if (result.error) { + return { error: result.error }; + } + + return { data: result.data || {} }; } } diff --git a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executors/system-action-executor.ts b/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executors/system-action-executor.ts index a6ba377cf7a0..bdef67299f54 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executors/system-action-executor.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executors/system-action-executor.ts @@ -18,10 +18,14 @@ export class SystemActionExecutor implements WorkflowStepExecutor { step: WorkflowSystemStep; payload?: object; }): Promise<WorkflowStepResult> { - const workflowSystemAction = this.workflowSystemActionFactory.get( - step.settings.systemActionType, - ); + try { + const workflowSystemAction = this.workflowSystemActionFactory.get( + step.settings.systemActionType, + ); - return await workflowSystemAction.execute({ step, payload }); + return await workflowSystemAction.execute({ step, payload }); + } catch (error) { + return { error }; + } } } diff --git a/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action.ts b/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action.ts index 4b5030a755c5..d810c5d0c61f 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action.ts @@ -63,6 +63,6 @@ export class SendEmailAction implements WorkflowSystemAction { html, }); - return { data: null }; + return { data: {} }; } } From 4978270d9bf6f38aa1d9a193d43e87d1a47fd016 Mon Sep 17 00:00:00 2001 From: martmull <martmull@hotmail.fr> Date: Tue, 10 Sep 2024 17:00:31 +0200 Subject: [PATCH 06/24] Remove front check --- .../src/modules/workflow/utils/generateWorkflowDiagram.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/packages/twenty-front/src/modules/workflow/utils/generateWorkflowDiagram.ts b/packages/twenty-front/src/modules/workflow/utils/generateWorkflowDiagram.ts index 80559ff94ca0..ccc7247fe4a5 100644 --- a/packages/twenty-front/src/modules/workflow/utils/generateWorkflowDiagram.ts +++ b/packages/twenty-front/src/modules/workflow/utils/generateWorkflowDiagram.ts @@ -50,13 +50,6 @@ export const generateWorkflowDiagram = ({ }, }); - // Recursively generate flow for the next action if it exists - if (step.type !== 'CODE_ACTION') { - // processNode(action.nextAction, nodeId, xPos + 150, yPos + 100); - - throw new Error('Other types as code actions are not supported yet.'); - } - return nodeId; }; From 52ac80db8b7e44b70c32901b3a2b47bc8fafc6c2 Mon Sep 17 00:00:00 2001 From: martmull <martmull@hotmail.fr> Date: Tue, 10 Sep 2024 17:59:03 +0200 Subject: [PATCH 07/24] Fix missing data in deleted event --- .../workspace-query-runner.service.ts | 43 +++++++++++++------ 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/workspace-query-runner.service.ts b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/workspace-query-runner.service.ts index 827dd2893941..d5cb7b867824 100644 --- a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/workspace-query-runner.service.ts +++ b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/workspace-query-runner.service.ts @@ -1,7 +1,7 @@ import { Injectable, Logger } from '@nestjs/common'; import isEmpty from 'lodash.isempty'; -import { DataSource } from 'typeorm'; +import { DataSource, In } from 'typeorm'; import { Record as IRecord, @@ -498,7 +498,7 @@ export class WorkspaceQueryRunnerService { args.filter?.id?.in?.forEach((id) => assertIsValidUuid(id)); const existingRecords = await repository.find({ - where: { id: { in: args.filter?.id?.in } }, + where: { id: In(args.filter?.id?.in) }, }); const mappedRecords = new Map( existingRecords.map((record) => [record.id, record]), @@ -618,6 +618,19 @@ export class WorkspaceQueryRunnerService { }); } + const repository = + await this.twentyORMGlobalManager.getRepositoryForWorkspace( + authContext.workspace.id, + objectMetadataItem.nameSingular, + ); + + const existingRecords = await repository.find({ + where: { id: In(args.filter?.id?.in) }, + }); + const mappedRecords = new Map( + existingRecords.map((record) => [record.id, record]), + ); + const result = await this.execute(query, authContext.workspace.id); const parsedResults = ( @@ -637,17 +650,21 @@ export class WorkspaceQueryRunnerService { this.workspaceEventEmitter.emit( `${objectMetadataItem.nameSingular}.deleted`, - parsedResults.map( - (record) => - ({ - userId: authContext.user?.id, - recordId: record.id, - objectMetadata: objectMetadataItem, - properties: { - before: this.removeNestedProperties(record), - }, - }) satisfies ObjectRecordDeleteEvent<any>, - ), + parsedResults.map((record) => { + const existingRecord = mappedRecords.get(record.id); + + return { + userId: authContext.user?.id, + recordId: record.id, + objectMetadata: objectMetadataItem, + properties: { + before: this.removeNestedProperties({ + ...existingRecord, + ...record, + }), + }, + } satisfies ObjectRecordDeleteEvent<any>; + }), authContext.workspace.id, ); From d030c01d9cfa4cfccfbc47a13aada33e04a65cb2 Mon Sep 17 00:00:00 2001 From: martmull <martmull@hotmail.fr> Date: Tue, 10 Sep 2024 18:21:52 +0200 Subject: [PATCH 08/24] Validate email --- .../workflow-system-actions/send-email-action.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action.ts b/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action.ts index d810c5d0c61f..f9e16e108db7 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action.ts @@ -1,9 +1,10 @@ -import { Injectable } from '@nestjs/common'; +import { Injectable, Logger } from '@nestjs/common'; import { WorkflowActionEmail } from 'twenty-emails'; import { render } from '@react-email/components'; import { JSDOM } from 'jsdom'; import DOMPurify from 'dompurify'; +import { z } from 'zod'; import { WorkflowSystemAction } from 'src/modules/workflow/workflow-system-action/workflow-system-action.interface'; import { WorkflowSystemStep } from 'src/modules/workflow/common/types/workflow-step.type'; @@ -14,6 +15,7 @@ import { isDefined } from 'src/utils/is-defined'; @Injectable() export class SendEmailAction implements WorkflowSystemAction { + private readonly logger = new Logger(SendEmailAction.name); constructor( private readonly environmentService: EnvironmentService, private readonly emailService: EmailService, @@ -29,6 +31,16 @@ export class SendEmailAction implements WorkflowSystemAction { [key: string]: string; }; }): Promise<WorkflowStepResult> { + const emailSchema = z.string().trim().email('Invalid email'); + + const result = emailSchema.safeParse(payload.email); + + if (!result.success) { + this.logger.warn(`Email '${payload.email}' invalid`); + + return { data: { success: false } }; + } + let mainText = step.settings.template; if (isDefined(payload)) { @@ -63,6 +75,6 @@ export class SendEmailAction implements WorkflowSystemAction { html, }); - return { data: {} }; + return { data: { success: true } }; } } From 5b5056590e3e424d68e87fac5ff631ee319fcd7d Mon Sep 17 00:00:00 2001 From: martmull <martmull@hotmail.fr> Date: Tue, 10 Sep 2024 20:14:38 +0200 Subject: [PATCH 09/24] Use templating --- packages/twenty-server/package.json | 1 + .../workflow-system-actions/send-email-action.ts | 10 ++-------- yarn.lock | 3 ++- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/twenty-server/package.json b/packages/twenty-server/package.json index 0b91d978cd6e..380d3c226111 100644 --- a/packages/twenty-server/package.json +++ b/packages/twenty-server/package.json @@ -29,6 +29,7 @@ "cache-manager-redis-yet": "^4.1.2", "class-validator": "patch:class-validator@0.14.0#./patches/class-validator+0.14.0.patch", "graphql-middleware": "^6.1.35", + "handlebars": "^4.7.8", "jsdom": "~22.1.0", "jwt-decode": "^4.0.0", "langchain": "^0.2.6", diff --git a/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action.ts b/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action.ts index f9e16e108db7..a5862a04910f 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action.ts @@ -5,13 +5,13 @@ import { render } from '@react-email/components'; import { JSDOM } from 'jsdom'; import DOMPurify from 'dompurify'; import { z } from 'zod'; +import Handlebars from 'handlebars'; import { WorkflowSystemAction } from 'src/modules/workflow/workflow-system-action/workflow-system-action.interface'; import { WorkflowSystemStep } from 'src/modules/workflow/common/types/workflow-step.type'; import { WorkflowStepResult } from 'src/modules/workflow/common/types/workflow-step-result.type'; import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; import { EmailService } from 'src/engine/integrations/email/email.service'; -import { isDefined } from 'src/utils/is-defined'; @Injectable() export class SendEmailAction implements WorkflowSystemAction { @@ -41,14 +41,8 @@ export class SendEmailAction implements WorkflowSystemAction { return { data: { success: false } }; } - let mainText = step.settings.template; + const mainText = Handlebars.compile(step.settings.template)(payload); - if (isDefined(payload)) { - Object.keys(payload).forEach( - (key: string) => - (mainText = mainText?.replace(`{{${key}}}`, payload[key])), - ); - } const window = new JSDOM('').window; const purify = DOMPurify(window); const safeHTML = purify.sanitize(mainText || ''); diff --git a/yarn.lock b/yarn.lock index 846d206ac345..73add1cfabd7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -29402,7 +29402,7 @@ __metadata: languageName: node linkType: hard -"handlebars@npm:^4.7.7": +"handlebars@npm:^4.7.7, handlebars@npm:^4.7.8": version: 4.7.8 resolution: "handlebars@npm:4.7.8" dependencies: @@ -47171,6 +47171,7 @@ __metadata: cache-manager-redis-yet: "npm:^4.1.2" class-validator: "patch:class-validator@0.14.0#./patches/class-validator+0.14.0.patch" graphql-middleware: "npm:^6.1.35" + handlebars: "npm:^4.7.8" jsdom: "npm:~22.1.0" jwt-decode: "npm:^4.0.0" langchain: "npm:^0.2.6" From 77e78a853001daa291e491dfd4da5a35fc33339d Mon Sep 17 00:00:00 2001 From: martmull <martmull@hotmail.fr> Date: Wed, 11 Sep 2024 09:55:18 +0200 Subject: [PATCH 10/24] Remove useless factory --- .../settings/workflow-base-settings.type.ts | 10 --- .../settings/workflow-code-settings.type.ts | 5 -- .../workflow-system-action-settings.type.ts | 19 ----- .../common/types/workflow-step.type.ts | 36 ++++++--- .../types/workflow-system-action.type.ts | 3 - .../code-action-executor.factory.ts} | 3 +- .../send-email-action-executor.factory.ts | 77 +++++++++++++++++++ .../workflow-step-executor.factory.ts | 12 +-- .../workflow-step-executor.module.ts | 11 ++- .../system-action-executor.ts | 31 -------- .../workflow-system-action.exception.ts | 12 --- .../workflow-system-action.factory.ts | 28 ------- .../workflow-system-action.interface.ts | 12 --- .../workflow-system-action.module.ts | 10 --- .../send-email-action.ts | 74 ------------------ 15 files changed, 116 insertions(+), 227 deletions(-) delete mode 100644 packages/twenty-server/src/modules/workflow/common/types/settings/workflow-base-settings.type.ts delete mode 100644 packages/twenty-server/src/modules/workflow/common/types/settings/workflow-code-settings.type.ts delete mode 100644 packages/twenty-server/src/modules/workflow/common/types/settings/workflow-system-action-settings.type.ts delete mode 100644 packages/twenty-server/src/modules/workflow/common/types/workflow-system-action.type.ts rename packages/twenty-server/src/modules/workflow/workflow-step-executor/{workflow-step-executors/code-action-executor.ts => factories/code-action-executor.factory.ts} (89%) create mode 100644 packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/send-email-action-executor.factory.ts delete mode 100644 packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executors/system-action-executor.ts delete mode 100644 packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.exception.ts delete mode 100644 packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.factory.ts delete mode 100644 packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.interface.ts delete mode 100644 packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.module.ts delete mode 100644 packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action.ts diff --git a/packages/twenty-server/src/modules/workflow/common/types/settings/workflow-base-settings.type.ts b/packages/twenty-server/src/modules/workflow/common/types/settings/workflow-base-settings.type.ts deleted file mode 100644 index b6a2c2a90584..000000000000 --- a/packages/twenty-server/src/modules/workflow/common/types/settings/workflow-base-settings.type.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type BaseWorkflowSettings = { - errorHandlingOptions: { - retryOnFailure: { - value: boolean; - }; - continueOnFailure: { - value: boolean; - }; - }; -}; diff --git a/packages/twenty-server/src/modules/workflow/common/types/settings/workflow-code-settings.type.ts b/packages/twenty-server/src/modules/workflow/common/types/settings/workflow-code-settings.type.ts deleted file mode 100644 index f74868c38a80..000000000000 --- a/packages/twenty-server/src/modules/workflow/common/types/settings/workflow-code-settings.type.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { BaseWorkflowSettings } from 'src/modules/workflow/common/types/settings/workflow-base-settings.type'; - -export type WorkflowCodeSettings = BaseWorkflowSettings & { - serverlessFunctionId: string; -}; diff --git a/packages/twenty-server/src/modules/workflow/common/types/settings/workflow-system-action-settings.type.ts b/packages/twenty-server/src/modules/workflow/common/types/settings/workflow-system-action-settings.type.ts deleted file mode 100644 index 98957a8dbf0c..000000000000 --- a/packages/twenty-server/src/modules/workflow/common/types/settings/workflow-system-action-settings.type.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { BaseWorkflowSettings } from 'src/modules/workflow/common/types/settings/workflow-base-settings.type'; -import { WorkflowSystemActionType } from 'src/modules/workflow/common/types/workflow-system-action.type'; - -type BaseSystemActionSettings = BaseWorkflowSettings & { - systemActionType: WorkflowSystemActionType; -}; - -export type WorkflowSystemSendEmailActionSettings = BaseSystemActionSettings & { - subject?: string; - template?: string; - title?: string; - callToAction?: { - value: string; - href: string; - }; -}; - -export type WorkflowSystemActionSettings = - WorkflowSystemSendEmailActionSettings; diff --git a/packages/twenty-server/src/modules/workflow/common/types/workflow-step.type.ts b/packages/twenty-server/src/modules/workflow/common/types/workflow-step.type.ts index 523b515ae3b1..13f73ae41c64 100644 --- a/packages/twenty-server/src/modules/workflow/common/types/workflow-step.type.ts +++ b/packages/twenty-server/src/modules/workflow/common/types/workflow-step.type.ts @@ -1,11 +1,19 @@ -import { WorkflowCodeSettings } from 'src/modules/workflow/common/types/settings/workflow-code-settings.type'; -import { WorkflowSystemActionSettings } from 'src/modules/workflow/common/types/settings/workflow-system-action-settings.type'; - export enum WorkflowStepType { CODE_ACTION = 'CODE_ACTION', - SYSTEM_ACTION = 'SYSTEM_ACTION', + SEND_EMAIL_ACTION = 'SEND_EMAIL_ACTION', } +type BaseWorkflowSettings = { + errorHandlingOptions: { + retryOnFailure: { + value: boolean; + }; + continueOnFailure: { + value: boolean; + }; + }; +}; + type BaseWorkflowStep = { id: string; name: string; @@ -14,12 +22,22 @@ type BaseWorkflowStep = { export type WorkflowCodeStep = BaseWorkflowStep & { type: WorkflowStepType.CODE_ACTION; - settings: WorkflowCodeSettings; + settings: BaseWorkflowSettings & { + serverlessFunctionId: string; + }; }; -export type WorkflowSystemStep = BaseWorkflowStep & { - type: WorkflowStepType.SYSTEM_ACTION; - settings: WorkflowSystemActionSettings; +export type WorkflowSendEmailStep = BaseWorkflowStep & { + type: WorkflowStepType.SEND_EMAIL_ACTION; + settings: BaseWorkflowSettings & { + subject?: string; + template?: string; + title?: string; + callToAction?: { + value: string; + href: string; + }; + }; }; -export type WorkflowStep = WorkflowCodeStep | WorkflowSystemStep; +export type WorkflowStep = WorkflowCodeStep | WorkflowSendEmailStep; diff --git a/packages/twenty-server/src/modules/workflow/common/types/workflow-system-action.type.ts b/packages/twenty-server/src/modules/workflow/common/types/workflow-system-action.type.ts deleted file mode 100644 index 11855785eb3f..000000000000 --- a/packages/twenty-server/src/modules/workflow/common/types/workflow-system-action.type.ts +++ /dev/null @@ -1,3 +0,0 @@ -export enum WorkflowSystemActionType { - SEND_EMAIL = 'SEND_EMAIL', -} diff --git a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executors/code-action-executor.ts b/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/code-action-executor.factory.ts similarity index 89% rename from packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executors/code-action-executor.ts rename to packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/code-action-executor.factory.ts index 87a48f1c304d..6eafdab95afe 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executors/code-action-executor.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/code-action-executor.factory.ts @@ -8,10 +8,9 @@ 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'; @Injectable() -export class CodeActionExecutor implements WorkflowStepExecutor { +export class CodeActionExecutorFactory { constructor( private readonly serverlessFunctionService: ServerlessFunctionService, private readonly scopedWorkspaceContextFactory: ScopedWorkspaceContextFactory, diff --git a/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/send-email-action-executor.factory.ts b/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/send-email-action-executor.factory.ts new file mode 100644 index 000000000000..bdf66f350981 --- /dev/null +++ b/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/send-email-action-executor.factory.ts @@ -0,0 +1,77 @@ +import { Injectable, Logger } from '@nestjs/common'; + +import { z } from 'zod'; +import Handlebars from 'handlebars'; +import { JSDOM } from 'jsdom'; +import DOMPurify from 'dompurify'; +import { WorkflowActionEmail } from 'twenty-emails'; +import { render } from '@react-email/components'; + +import { WorkflowStepResult } from 'src/modules/workflow/common/types/workflow-step-result.type'; +import { WorkflowSendEmailStep } from 'src/modules/workflow/common/types/workflow-step.type'; +import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EmailService } from 'src/engine/integrations/email/email.service'; + +@Injectable() +export class SendEmailActionExecutorFactory { + private readonly logger = new Logger(SendEmailActionExecutorFactory.name); + constructor( + private readonly environmentService: EnvironmentService, + private readonly emailService: EmailService, + ) {} + + async execute({ + step, + payload, + }: { + step: WorkflowSendEmailStep; + payload: { + email: string; + [key: string]: string; + }; + }): Promise<WorkflowStepResult> { + try { + const emailSchema = z.string().trim().email('Invalid email'); + + const result = emailSchema.safeParse(payload.email); + + if (!result.success) { + this.logger.warn(`Email '${payload.email}' invalid`); + + return { data: { success: false } }; + } + + const mainText = Handlebars.compile(step.settings.template)(payload); + + const window = new JSDOM('').window; + const purify = DOMPurify(window); + const safeHTML = purify.sanitize(mainText || ''); + + const email = WorkflowActionEmail({ + dangerousHTML: safeHTML, + title: step.settings.title, + callToAction: step.settings.callToAction, + }); + const html = render(email, { + pretty: true, + }); + const text = render(email, { + plainText: true, + }); + + await this.emailService.send({ + from: `${this.environmentService.get( + 'EMAIL_FROM_NAME', + )} <${this.environmentService.get('EMAIL_FROM_ADDRESS')}>`, + to: payload.email, + subject: step.settings.subject || '', + text, + html, + }); + + return { data: { success: true } }; + } catch (error) { + return { error }; + } + } +} diff --git a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.factory.ts b/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.factory.ts index 5cbd5045d13e..1c7a50ce5bb6 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.factory.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.factory.ts @@ -6,22 +6,22 @@ import { 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'; -import { SystemActionExecutor } from 'src/modules/workflow/workflow-step-executor/workflow-step-executors/system-action-executor'; +import { CodeActionExecutorFactory } from 'src/modules/workflow/workflow-step-executor/factories/code-action-executor.factory'; +import { SendEmailActionExecutorFactory } from 'src/modules/workflow/workflow-step-executor/factories/send-email-action-executor.factory'; @Injectable() export class WorkflowStepExecutorFactory { constructor( - private readonly codeActionExecutor: CodeActionExecutor, - private readonly systemActionExecutor: SystemActionExecutor, + private readonly codeActionExecutor: CodeActionExecutorFactory, + private readonly sendEmailActionExecutor: SendEmailActionExecutorFactory, ) {} get(stepType: WorkflowStepType): WorkflowStepExecutor { switch (stepType) { case WorkflowStepType.CODE_ACTION: return this.codeActionExecutor; - case WorkflowStepType.SYSTEM_ACTION: - return this.systemActionExecutor; + case WorkflowStepType.SEND_EMAIL_ACTION: + return this.sendEmailActionExecutor; default: throw new WorkflowStepExecutorException( `Workflow step executor not found for step type '${stepType}'`, diff --git a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.module.ts b/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.module.ts index c982b3b23a4e..7e738cc09508 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.module.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.module.ts @@ -3,16 +3,15 @@ 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'; -import { SystemActionExecutor } from 'src/modules/workflow/workflow-step-executor/workflow-step-executors/system-action-executor'; -import { WorkflowSystemActionModule } from 'src/modules/workflow/workflow-system-action/workflow-system-action.module'; +import { CodeActionExecutorFactory } from 'src/modules/workflow/workflow-step-executor/factories/code-action-executor.factory'; +import { SendEmailActionExecutorFactory } from 'src/modules/workflow/workflow-step-executor/factories/send-email-action-executor.factory'; @Module({ - imports: [ServerlessFunctionModule, WorkflowSystemActionModule], + imports: [ServerlessFunctionModule], providers: [ WorkflowStepExecutorFactory, - CodeActionExecutor, - SystemActionExecutor, + CodeActionExecutorFactory, + SendEmailActionExecutorFactory, ScopedWorkspaceContextFactory, ], exports: [WorkflowStepExecutorFactory], diff --git a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executors/system-action-executor.ts b/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executors/system-action-executor.ts deleted file mode 100644 index bdef67299f54..000000000000 --- a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executors/system-action-executor.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Injectable } from '@nestjs/common'; - -import { WorkflowStepExecutor } from 'src/modules/workflow/workflow-step-executor/workflow-step-executor.interface'; -import { WorkflowSystemStep } from 'src/modules/workflow/common/types/workflow-step.type'; -import { WorkflowStepResult } from 'src/modules/workflow/common/types/workflow-step-result.type'; -import { WorkflowSystemActionFactory } from 'src/modules/workflow/workflow-system-action/workflow-system-action.factory'; - -@Injectable() -export class SystemActionExecutor implements WorkflowStepExecutor { - constructor( - private readonly workflowSystemActionFactory: WorkflowSystemActionFactory, - ) {} - - async execute({ - step, - payload, - }: { - step: WorkflowSystemStep; - payload?: object; - }): Promise<WorkflowStepResult> { - try { - const workflowSystemAction = this.workflowSystemActionFactory.get( - step.settings.systemActionType, - ); - - return await workflowSystemAction.execute({ step, payload }); - } catch (error) { - return { error }; - } - } -} diff --git a/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.exception.ts b/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.exception.ts deleted file mode 100644 index 74721b5784e2..000000000000 --- a/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.exception.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { CustomException } from 'src/utils/custom-exception'; - -export class WorkflowSystemActionException extends CustomException { - code: WorkflowSystemActionExceptionCode; - constructor(message: string, code: WorkflowSystemActionExceptionCode) { - super(message, code); - } -} - -export enum WorkflowSystemActionExceptionCode { - INVALID_SYSTEM_ACTION_TYPE = 'INVALID_SYSTEM_ACTION_TYPE', -} diff --git a/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.factory.ts b/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.factory.ts deleted file mode 100644 index 993148c95b18..000000000000 --- a/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.factory.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Injectable } from '@nestjs/common'; - -import { WorkflowSystemAction } from 'src/modules/workflow/workflow-system-action/workflow-system-action.interface'; -import { - WorkflowSystemActionException, - WorkflowSystemActionExceptionCode, -} from 'src/modules/workflow/workflow-system-action/workflow-system-action.exception'; -import { SendEmailAction } from 'src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action'; -import { WorkflowSystemActionType } from 'src/modules/workflow/common/types/workflow-system-action.type'; - -@Injectable() -export class WorkflowSystemActionFactory { - constructor(private readonly sendEmailAction: SendEmailAction) {} - - get( - workflowSystemActionType: WorkflowSystemActionType, - ): WorkflowSystemAction { - switch (workflowSystemActionType) { - case WorkflowSystemActionType.SEND_EMAIL: - return this.sendEmailAction; - default: - throw new WorkflowSystemActionException( - `Workflow system action not found for system action type '${workflowSystemActionType}'`, - WorkflowSystemActionExceptionCode.INVALID_SYSTEM_ACTION_TYPE, - ); - } - } -} diff --git a/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.interface.ts b/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.interface.ts deleted file mode 100644 index 314c2232eece..000000000000 --- a/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.interface.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { WorkflowSystemStep } from 'src/modules/workflow/common/types/workflow-step.type'; -import { WorkflowStepResult } from 'src/modules/workflow/common/types/workflow-step-result.type'; - -export interface WorkflowSystemAction { - execute({ - step, - payload, - }: { - step: WorkflowSystemStep; - payload?: object; - }): Promise<WorkflowStepResult>; -} diff --git a/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.module.ts b/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.module.ts deleted file mode 100644 index fcd294c5f547..000000000000 --- a/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-action.module.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Module } from '@nestjs/common'; - -import { WorkflowSystemActionFactory } from 'src/modules/workflow/workflow-system-action/workflow-system-action.factory'; -import { SendEmailAction } from 'src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action'; - -@Module({ - providers: [WorkflowSystemActionFactory, SendEmailAction], - exports: [WorkflowSystemActionFactory], -}) -export class WorkflowSystemActionModule {} diff --git a/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action.ts b/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action.ts deleted file mode 100644 index a5862a04910f..000000000000 --- a/packages/twenty-server/src/modules/workflow/workflow-system-action/workflow-system-actions/send-email-action.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { Injectable, Logger } from '@nestjs/common'; - -import { WorkflowActionEmail } from 'twenty-emails'; -import { render } from '@react-email/components'; -import { JSDOM } from 'jsdom'; -import DOMPurify from 'dompurify'; -import { z } from 'zod'; -import Handlebars from 'handlebars'; - -import { WorkflowSystemAction } from 'src/modules/workflow/workflow-system-action/workflow-system-action.interface'; -import { WorkflowSystemStep } from 'src/modules/workflow/common/types/workflow-step.type'; -import { WorkflowStepResult } from 'src/modules/workflow/common/types/workflow-step-result.type'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; -import { EmailService } from 'src/engine/integrations/email/email.service'; - -@Injectable() -export class SendEmailAction implements WorkflowSystemAction { - private readonly logger = new Logger(SendEmailAction.name); - constructor( - private readonly environmentService: EnvironmentService, - private readonly emailService: EmailService, - ) {} - - async execute({ - step, - payload, - }: { - step: WorkflowSystemStep; - payload: { - email: string; - [key: string]: string; - }; - }): Promise<WorkflowStepResult> { - const emailSchema = z.string().trim().email('Invalid email'); - - const result = emailSchema.safeParse(payload.email); - - if (!result.success) { - this.logger.warn(`Email '${payload.email}' invalid`); - - return { data: { success: false } }; - } - - const mainText = Handlebars.compile(step.settings.template)(payload); - - const window = new JSDOM('').window; - const purify = DOMPurify(window); - const safeHTML = purify.sanitize(mainText || ''); - - const email = WorkflowActionEmail({ - dangerousHTML: safeHTML, - title: step.settings.title, - callToAction: step.settings.callToAction, - }); - const html = render(email, { - pretty: true, - }); - const text = render(email, { - plainText: true, - }); - - await this.emailService.send({ - from: `${this.environmentService.get( - 'EMAIL_FROM_NAME', - )} <${this.environmentService.get('EMAIL_FROM_ADDRESS')}>`, - to: payload.email, - subject: step.settings.subject || '', - text, - html, - }); - - return { data: { success: true } }; - } -} From 2f4a6dec681e4bbbf190855c1ee11d0178a26d2b Mon Sep 17 00:00:00 2001 From: martmull <martmull@hotmail.fr> Date: Wed, 11 Sep 2024 10:33:37 +0200 Subject: [PATCH 11/24] Remove useless changes --- packages/twenty-emails/src/components/BaseEmail.tsx | 9 ++------- packages/twenty-emails/src/components/BaseHead.tsx | 2 +- .../twenty-emails/src/emails/workflow-action.email.tsx | 2 +- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/packages/twenty-emails/src/components/BaseEmail.tsx b/packages/twenty-emails/src/components/BaseEmail.tsx index 8222958ba88f..c98c7013b9b3 100644 --- a/packages/twenty-emails/src/components/BaseEmail.tsx +++ b/packages/twenty-emails/src/components/BaseEmail.tsx @@ -6,19 +6,14 @@ import { Logo } from 'src/components/Logo'; type BaseEmailProps = PropsWithChildren<{ width?: number; - withLogo?: boolean; }>; -export const BaseEmail = ({ - children, - width, - withLogo = true, -}: BaseEmailProps) => { +export const BaseEmail = ({ children, width }: BaseEmailProps) => { return ( <Html lang="en"> <BaseHead /> <Container width={width || 290}> - {withLogo && <Logo />} + <Logo /> {children} </Container> </Html> diff --git a/packages/twenty-emails/src/components/BaseHead.tsx b/packages/twenty-emails/src/components/BaseHead.tsx index ba1db296a2cb..389369b26154 100644 --- a/packages/twenty-emails/src/components/BaseHead.tsx +++ b/packages/twenty-emails/src/components/BaseHead.tsx @@ -5,7 +5,7 @@ import { emailTheme } from 'src/common-style'; export const BaseHead = () => { return ( <Head> - <title>An email from Twenty + Twenty email { return ( - + {title && } {dangerousHTML && ( <div dangerouslySetInnerHTML={{ __html: dangerousHTML }} /> From fa03414a7d07b62f193769dbd8efb9da339a9d18 Mon Sep 17 00:00:00 2001 From: martmull <martmull@hotmail.fr> Date: Wed, 11 Sep 2024 14:09:10 +0200 Subject: [PATCH 12/24] Code review return: fix factory naming --- ...tor.factory.ts => code.workflow-step-executor.ts} | 2 +- ...ctory.ts => send-email.workflow-step-executor.ts} | 4 ++-- .../workflow-step-executor.factory.ts | 12 ++++++------ .../workflow-step-executor.module.ts | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) rename packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/{code-action-executor.factory.ts => code.workflow-step-executor.ts} (97%) rename packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/{send-email-action-executor.factory.ts => send-email.workflow-step-executor.ts} (94%) diff --git a/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/code-action-executor.factory.ts b/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/code.workflow-step-executor.ts similarity index 97% rename from packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/code-action-executor.factory.ts rename to packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/code.workflow-step-executor.ts index 6eafdab95afe..594d40211c5e 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/code-action-executor.factory.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/code.workflow-step-executor.ts @@ -10,7 +10,7 @@ import { } from 'src/modules/workflow/workflow-step-executor/workflow-step-executor.exception'; @Injectable() -export class CodeActionExecutorFactory { +export class CodeWorkflowStepExecutor { constructor( private readonly serverlessFunctionService: ServerlessFunctionService, private readonly scopedWorkspaceContextFactory: ScopedWorkspaceContextFactory, diff --git a/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/send-email-action-executor.factory.ts b/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/send-email.workflow-step-executor.ts similarity index 94% rename from packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/send-email-action-executor.factory.ts rename to packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/send-email.workflow-step-executor.ts index bdf66f350981..26e9780f68ba 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/send-email-action-executor.factory.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/send-email.workflow-step-executor.ts @@ -13,8 +13,8 @@ import { EnvironmentService } from 'src/engine/integrations/environment/environm import { EmailService } from 'src/engine/integrations/email/email.service'; @Injectable() -export class SendEmailActionExecutorFactory { - private readonly logger = new Logger(SendEmailActionExecutorFactory.name); +export class SendEmailWorkflowStepExecutor { + private readonly logger = new Logger(SendEmailWorkflowStepExecutor.name); constructor( private readonly environmentService: EnvironmentService, private readonly emailService: EmailService, diff --git a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.factory.ts b/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.factory.ts index 1c7a50ce5bb6..6f7da5274a74 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.factory.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.factory.ts @@ -6,22 +6,22 @@ import { 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 { CodeActionExecutorFactory } from 'src/modules/workflow/workflow-step-executor/factories/code-action-executor.factory'; -import { SendEmailActionExecutorFactory } from 'src/modules/workflow/workflow-step-executor/factories/send-email-action-executor.factory'; +import { CodeWorkflowStepExecutor } from 'src/modules/workflow/workflow-step-executor/factories/code.workflow-step-executor'; +import { SendEmailWorkflowStepExecutor } from 'src/modules/workflow/workflow-step-executor/factories/send-email.workflow-step-executor'; @Injectable() export class WorkflowStepExecutorFactory { constructor( - private readonly codeActionExecutor: CodeActionExecutorFactory, - private readonly sendEmailActionExecutor: SendEmailActionExecutorFactory, + private readonly codeWorkflowStepExecutor: CodeWorkflowStepExecutor, + private readonly sendEmailWorkflowStepExecutor: SendEmailWorkflowStepExecutor, ) {} get(stepType: WorkflowStepType): WorkflowStepExecutor { switch (stepType) { case WorkflowStepType.CODE_ACTION: - return this.codeActionExecutor; + return this.codeWorkflowStepExecutor; case WorkflowStepType.SEND_EMAIL_ACTION: - return this.sendEmailActionExecutor; + return this.sendEmailWorkflowStepExecutor; default: throw new WorkflowStepExecutorException( `Workflow step executor not found for step type '${stepType}'`, diff --git a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.module.ts b/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.module.ts index 7e738cc09508..b7d5ef6b649b 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.module.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.module.ts @@ -3,15 +3,15 @@ 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 { CodeActionExecutorFactory } from 'src/modules/workflow/workflow-step-executor/factories/code-action-executor.factory'; -import { SendEmailActionExecutorFactory } from 'src/modules/workflow/workflow-step-executor/factories/send-email-action-executor.factory'; +import { CodeWorkflowStepExecutor } from 'src/modules/workflow/workflow-step-executor/factories/code.workflow-step-executor'; +import { SendEmailWorkflowStepExecutor } from 'src/modules/workflow/workflow-step-executor/factories/send-email.workflow-step-executor'; @Module({ imports: [ServerlessFunctionModule], providers: [ WorkflowStepExecutorFactory, - CodeActionExecutorFactory, - SendEmailActionExecutorFactory, + CodeWorkflowStepExecutor, + SendEmailWorkflowStepExecutor, ScopedWorkspaceContextFactory, ], exports: [WorkflowStepExecutorFactory], From 8fca8763b030c7c9f684fdbcbd08a3d6ca873ad8 Mon Sep 17 00:00:00 2001 From: martmull <martmull@hotmail.fr> Date: Wed, 11 Sep 2024 14:15:23 +0200 Subject: [PATCH 13/24] Code review return: separate types --- .../types/workflow-step-settings.type.ts | 24 +++++++++++++++ .../common/types/workflow-step.type.ts | 30 +++++-------------- 2 files changed, 31 insertions(+), 23 deletions(-) create mode 100644 packages/twenty-server/src/modules/workflow/common/types/workflow-step-settings.type.ts diff --git a/packages/twenty-server/src/modules/workflow/common/types/workflow-step-settings.type.ts b/packages/twenty-server/src/modules/workflow/common/types/workflow-step-settings.type.ts new file mode 100644 index 000000000000..99b334d0f5f5 --- /dev/null +++ b/packages/twenty-server/src/modules/workflow/common/types/workflow-step-settings.type.ts @@ -0,0 +1,24 @@ +type BaseWorkflowStepSettings = { + errorHandlingOptions: { + retryOnFailure: { + value: boolean; + }; + continueOnFailure: { + value: boolean; + }; + }; +}; + +export type WorkflowCodeStepSettings = BaseWorkflowStepSettings & { + serverlessFunctionId: string; +}; + +export type WorkflowSendEmailStepSettings = BaseWorkflowStepSettings & { + subject?: string; + template?: string; + title?: string; + callToAction?: { + value: string; + href: string; + }; +}; diff --git a/packages/twenty-server/src/modules/workflow/common/types/workflow-step.type.ts b/packages/twenty-server/src/modules/workflow/common/types/workflow-step.type.ts index 13f73ae41c64..51332530bdaa 100644 --- a/packages/twenty-server/src/modules/workflow/common/types/workflow-step.type.ts +++ b/packages/twenty-server/src/modules/workflow/common/types/workflow-step.type.ts @@ -1,19 +1,13 @@ +import { + WorkflowCodeStepSettings, + WorkflowSendEmailStepSettings, +} from 'src/modules/workflow/common/types/workflow-step-settings.type'; + export enum WorkflowStepType { CODE_ACTION = 'CODE_ACTION', SEND_EMAIL_ACTION = 'SEND_EMAIL_ACTION', } -type BaseWorkflowSettings = { - errorHandlingOptions: { - retryOnFailure: { - value: boolean; - }; - continueOnFailure: { - value: boolean; - }; - }; -}; - type BaseWorkflowStep = { id: string; name: string; @@ -22,22 +16,12 @@ type BaseWorkflowStep = { export type WorkflowCodeStep = BaseWorkflowStep & { type: WorkflowStepType.CODE_ACTION; - settings: BaseWorkflowSettings & { - serverlessFunctionId: string; - }; + settings: WorkflowCodeStepSettings; }; export type WorkflowSendEmailStep = BaseWorkflowStep & { type: WorkflowStepType.SEND_EMAIL_ACTION; - settings: BaseWorkflowSettings & { - subject?: string; - template?: string; - title?: string; - callToAction?: { - value: string; - href: string; - }; - }; + settings: WorkflowSendEmailStepSettings; }; export type WorkflowStep = WorkflowCodeStep | WorkflowSendEmailStep; From 4bcb22652398facf2b876cdeee2af7e513db3525 Mon Sep 17 00:00:00 2001 From: martmull <martmull@hotmail.fr> Date: Wed, 11 Sep 2024 14:19:07 +0200 Subject: [PATCH 14/24] Code review return: update naming --- .../workflow/common/types/workflow-step-result.type.ts | 2 +- .../workflow-executor.workspace-service.ts | 8 ++++---- .../factories/code.workflow-step-executor.ts | 2 +- .../factories/send-email.workflow-step-executor.ts | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/twenty-server/src/modules/workflow/common/types/workflow-step-result.type.ts b/packages/twenty-server/src/modules/workflow/common/types/workflow-step-result.type.ts index 243d1e5e6a65..3b6c765284f4 100644 --- a/packages/twenty-server/src/modules/workflow/common/types/workflow-step-result.type.ts +++ b/packages/twenty-server/src/modules/workflow/common/types/workflow-step-result.type.ts @@ -5,6 +5,6 @@ type WorkflowError = { }; export type WorkflowStepResult = { - data?: object; + result?: object; error?: WorkflowError; }; diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.workspace-service.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.workspace-service.ts index b157a8d14cf2..2db39c643c9b 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.workspace-service.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.workspace-service.ts @@ -10,7 +10,7 @@ import { WorkflowStepExecutorFactory } from 'src/modules/workflow/workflow-step- const MAX_RETRIES_ON_FAILURE = 3; export type WorkflowExecutionOutput = { - data?: object; + result?: object; error?: object; }; @@ -33,7 +33,7 @@ export class WorkflowExecutorWorkspaceService { }): Promise<WorkflowExecutionOutput> { if (currentStepIndex >= steps.length) { return { - data: payload, + result: payload, }; } @@ -48,11 +48,11 @@ export class WorkflowExecutorWorkspaceService { payload, }); - if (result.data) { + if (result.result) { return await this.execute({ currentStepIndex: currentStepIndex + 1, steps, - payload: result.data, + payload: result.result, }); } diff --git a/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/code.workflow-step-executor.ts b/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/code.workflow-step-executor.ts index 594d40211c5e..7ad62808c433 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/code.workflow-step-executor.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/code.workflow-step-executor.ts @@ -43,6 +43,6 @@ export class CodeWorkflowStepExecutor { return { error: result.error }; } - return { data: result.data || {} }; + return { result: result.data || {} }; } } diff --git a/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/send-email.workflow-step-executor.ts b/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/send-email.workflow-step-executor.ts index 26e9780f68ba..610f17e168d8 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/send-email.workflow-step-executor.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/send-email.workflow-step-executor.ts @@ -38,7 +38,7 @@ export class SendEmailWorkflowStepExecutor { if (!result.success) { this.logger.warn(`Email '${payload.email}' invalid`); - return { data: { success: false } }; + return { result: { success: false } }; } const mainText = Handlebars.compile(step.settings.template)(payload); @@ -69,7 +69,7 @@ export class SendEmailWorkflowStepExecutor { html, }); - return { data: { success: true } }; + return { result: { success: true } }; } catch (error) { return { error }; } From f99d80509e6981c29c5c30bb91ad874dd007ecf3 Mon Sep 17 00:00:00 2001 From: martmull <martmull@hotmail.fr> Date: Wed, 11 Sep 2024 14:52:18 +0200 Subject: [PATCH 15/24] Code review return: reorganize folders --- .../workflow-executor.exception.ts | 0 .../workflow-step-executor.exception.ts | 0 .../workflow-step-executor.factory.ts | 9 +++++---- .../code.workflow-step-executor.ts | 2 +- .../send-email.workflow-step-executor.ts | 0 .../workflow-step-executor.interface.ts | 0 .../workflow-executor.workspace-service.ts | 4 ++-- .../workflow-executor.module.ts | 18 ++++++++++++++---- .../workflow-runner/jobs/run-workflow.job.ts | 2 +- .../workflow-step-executor.module.ts | 19 ------------------- 10 files changed, 23 insertions(+), 31 deletions(-) rename packages/twenty-server/src/modules/workflow/workflow-executor/{ => exceptions}/workflow-executor.exception.ts (100%) rename packages/twenty-server/src/modules/workflow/{workflow-step-executor => workflow-executor/exceptions}/workflow-step-executor.exception.ts (100%) rename packages/twenty-server/src/modules/workflow/{ => workflow-executor/factories}/workflow-step-executor/workflow-step-executor.factory.ts (75%) rename packages/twenty-server/src/modules/workflow/{workflow-step-executor/factories => workflow-executor/factories/workflow-step-executor/workflow-step-executors}/code.workflow-step-executor.ts (94%) rename packages/twenty-server/src/modules/workflow/{workflow-step-executor/factories => workflow-executor/factories/workflow-step-executor/workflow-step-executors}/send-email.workflow-step-executor.ts (100%) rename packages/twenty-server/src/modules/workflow/{workflow-step-executor => workflow-executor/interfaces}/workflow-step-executor.interface.ts (100%) rename packages/twenty-server/src/modules/workflow/workflow-executor/{ => services}/workflow-executor.workspace-service.ts (92%) delete mode 100644 packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.module.ts diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.exception.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/exceptions/workflow-executor.exception.ts similarity index 100% rename from packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.exception.ts rename to packages/twenty-server/src/modules/workflow/workflow-executor/exceptions/workflow-executor.exception.ts diff --git a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.exception.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/exceptions/workflow-step-executor.exception.ts similarity index 100% rename from packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.exception.ts rename to packages/twenty-server/src/modules/workflow/workflow-executor/exceptions/workflow-step-executor.exception.ts diff --git a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.factory.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executor.factory.ts similarity index 75% rename from packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.factory.ts rename to packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executor.factory.ts index 6f7da5274a74..b2e54f71430d 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.factory.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executor.factory.ts @@ -1,13 +1,14 @@ import { Injectable } from '@nestjs/common'; +import { WorkflowStepExecutor } from 'src/modules/workflow/workflow-executor/interfaces/workflow-step-executor.interface'; + 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 { CodeWorkflowStepExecutor } from 'src/modules/workflow/workflow-step-executor/factories/code.workflow-step-executor'; -import { SendEmailWorkflowStepExecutor } from 'src/modules/workflow/workflow-step-executor/factories/send-email.workflow-step-executor'; +} from 'src/modules/workflow/workflow-executor/exceptions/workflow-step-executor.exception'; +import { CodeWorkflowStepExecutor } from 'src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executors/code.workflow-step-executor'; +import { SendEmailWorkflowStepExecutor } from 'src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executors/send-email.workflow-step-executor'; @Injectable() export class WorkflowStepExecutorFactory { diff --git a/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/code.workflow-step-executor.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executors/code.workflow-step-executor.ts similarity index 94% rename from packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/code.workflow-step-executor.ts rename to packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executors/code.workflow-step-executor.ts index 7ad62808c433..82f7d925cedd 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/code.workflow-step-executor.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executors/code.workflow-step-executor.ts @@ -7,7 +7,7 @@ import { WorkflowCodeStep } from 'src/modules/workflow/common/types/workflow-ste import { WorkflowStepExecutorException, WorkflowStepExecutorExceptionCode, -} from 'src/modules/workflow/workflow-step-executor/workflow-step-executor.exception'; +} from 'src/modules/workflow/workflow-executor/exceptions/workflow-step-executor.exception'; @Injectable() export class CodeWorkflowStepExecutor { diff --git a/packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/send-email.workflow-step-executor.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executors/send-email.workflow-step-executor.ts similarity index 100% rename from packages/twenty-server/src/modules/workflow/workflow-step-executor/factories/send-email.workflow-step-executor.ts rename to packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executors/send-email.workflow-step-executor.ts diff --git a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.interface.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/interfaces/workflow-step-executor.interface.ts similarity index 100% rename from packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.interface.ts rename to packages/twenty-server/src/modules/workflow/workflow-executor/interfaces/workflow-step-executor.interface.ts diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.workspace-service.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/services/workflow-executor.workspace-service.ts similarity index 92% rename from packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.workspace-service.ts rename to packages/twenty-server/src/modules/workflow/workflow-executor/services/workflow-executor.workspace-service.ts index 2db39c643c9b..c51b79cb9177 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.workspace-service.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/services/workflow-executor.workspace-service.ts @@ -4,8 +4,8 @@ import { WorkflowStep } from 'src/modules/workflow/common/types/workflow-step.ty import { WorkflowExecutorException, WorkflowExecutorExceptionCode, -} from 'src/modules/workflow/workflow-executor/workflow-executor.exception'; -import { WorkflowStepExecutorFactory } from 'src/modules/workflow/workflow-step-executor/workflow-step-executor.factory'; +} from 'src/modules/workflow/workflow-executor/exceptions/workflow-executor.exception'; +import { WorkflowStepExecutorFactory } from 'src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executor.factory'; const MAX_RETRIES_ON_FAILURE = 3; diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.module.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.module.ts index d01b7aa11d99..978586f28fb3 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.module.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.module.ts @@ -1,12 +1,22 @@ import { Module } from '@nestjs/common'; import { WorkflowCommonModule } from 'src/modules/workflow/common/workflow-common.module'; -import { WorkflowExecutorWorkspaceService } from 'src/modules/workflow/workflow-executor/workflow-executor.workspace-service'; -import { WorkflowStepExecutorModule } from 'src/modules/workflow/workflow-step-executor/workflow-step-executor.module'; +import { WorkflowExecutorWorkspaceService } from 'src/modules/workflow/workflow-executor/services/workflow-executor.workspace-service'; +import { WorkflowStepExecutorFactory } from 'src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executor.factory'; +import { CodeWorkflowStepExecutor } from 'src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executors/code.workflow-step-executor'; +import { SendEmailWorkflowStepExecutor } from 'src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executors/send-email.workflow-step-executor'; +import { ServerlessFunctionModule } from 'src/engine/metadata-modules/serverless-function/serverless-function.module'; +import { ScopedWorkspaceContextFactory } from 'src/engine/twenty-orm/factories/scoped-workspace-context.factory'; @Module({ - imports: [WorkflowCommonModule, WorkflowStepExecutorModule], - providers: [WorkflowExecutorWorkspaceService], + imports: [WorkflowCommonModule, ServerlessFunctionModule], + providers: [ + WorkflowExecutorWorkspaceService, + ScopedWorkspaceContextFactory, + WorkflowStepExecutorFactory, + CodeWorkflowStepExecutor, + SendEmailWorkflowStepExecutor, + ], exports: [WorkflowExecutorWorkspaceService], }) export class WorkflowExecutorModule {} diff --git a/packages/twenty-server/src/modules/workflow/workflow-runner/jobs/run-workflow.job.ts b/packages/twenty-server/src/modules/workflow/workflow-runner/jobs/run-workflow.job.ts index 1630b14c15a7..2408c51e5405 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-runner/jobs/run-workflow.job.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-runner/jobs/run-workflow.job.ts @@ -5,7 +5,7 @@ import { Processor } from 'src/engine/integrations/message-queue/decorators/proc import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; import { WorkflowCommonWorkspaceService } from 'src/modules/workflow/common/services/workflow-common.workspace-service'; import { WorkflowRunStatus } from 'src/modules/workflow/common/standard-objects/workflow-run.workspace-entity'; -import { WorkflowExecutorWorkspaceService } from 'src/modules/workflow/workflow-executor/workflow-executor.workspace-service'; +import { WorkflowExecutorWorkspaceService } from 'src/modules/workflow/workflow-executor/services/workflow-executor.workspace-service'; import { WorkflowRunWorkspaceService } from 'src/modules/workflow/workflow-runner/workflow-run/workflow-run.workspace-service'; export type RunWorkflowJobData = { diff --git a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.module.ts b/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.module.ts deleted file mode 100644 index b7d5ef6b649b..000000000000 --- a/packages/twenty-server/src/modules/workflow/workflow-step-executor/workflow-step-executor.module.ts +++ /dev/null @@ -1,19 +0,0 @@ -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 { CodeWorkflowStepExecutor } from 'src/modules/workflow/workflow-step-executor/factories/code.workflow-step-executor'; -import { SendEmailWorkflowStepExecutor } from 'src/modules/workflow/workflow-step-executor/factories/send-email.workflow-step-executor'; - -@Module({ - imports: [ServerlessFunctionModule], - providers: [ - WorkflowStepExecutorFactory, - CodeWorkflowStepExecutor, - SendEmailWorkflowStepExecutor, - ScopedWorkspaceContextFactory, - ], - exports: [WorkflowStepExecutorFactory], -}) -export class WorkflowStepExecutorModule {} From 98fdcfb9eafc06375f051806f48e16caabb57bf4 Mon Sep 17 00:00:00 2001 From: martmull <martmull@hotmail.fr> Date: Wed, 11 Sep 2024 14:56:21 +0200 Subject: [PATCH 16/24] Code review return: split workflow/common --- .../utils/assert-workflow-version-is-draft.util.ts | 2 +- .../common/services/workflow-common.workspace-service.ts | 2 +- .../standard-objects/workflow-version.workspace-entity.ts | 4 ++-- .../workflow-step-executor/workflow-step-executor.factory.ts | 2 +- .../workflow-step-executors/code.workflow-step-executor.ts | 4 ++-- .../send-email.workflow-step-executor.ts | 4 ++-- .../interfaces/workflow-step-executor.interface.ts | 4 ++-- .../services/workflow-executor.workspace-service.ts | 2 +- .../types/workflow-step-result.type.ts | 0 .../types/workflow-step-settings.type.ts | 0 .../{common => workflow-executor}/types/workflow-step.type.ts | 2 +- .../database-event-trigger/database-event-trigger.service.ts | 2 +- .../types/workflow-trigger.type.ts | 0 .../utils/assert-version-can-be-activated.util.ts | 2 +- .../workflow-trigger/workflow-trigger.workspace-service.ts | 2 +- 15 files changed, 16 insertions(+), 16 deletions(-) rename packages/twenty-server/src/modules/workflow/{common => workflow-executor}/types/workflow-step-result.type.ts (100%) rename packages/twenty-server/src/modules/workflow/{common => workflow-executor}/types/workflow-step-settings.type.ts (100%) rename packages/twenty-server/src/modules/workflow/{common => workflow-executor}/types/workflow-step.type.ts (87%) rename packages/twenty-server/src/modules/workflow/{common => workflow-trigger}/types/workflow-trigger.type.ts (100%) diff --git a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/utils/assert-workflow-version-is-draft.util.ts b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/utils/assert-workflow-version-is-draft.util.ts index 2604f63fb2ca..23a8a617c1b2 100644 --- a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/utils/assert-workflow-version-is-draft.util.ts +++ b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/utils/assert-workflow-version-is-draft.util.ts @@ -6,7 +6,7 @@ import { WorkflowVersionStatus, WorkflowVersionWorkspaceEntity, } from 'src/modules/workflow/common/standard-objects/workflow-version.workspace-entity'; -import { WorkflowTrigger } from 'src/modules/workflow/common/types/workflow-trigger.type'; +import { WorkflowTrigger } from 'src/modules/workflow/workflow-trigger/types/workflow-trigger.type'; export const assertWorkflowVersionIsDraft = ( workflowVersion: Omit<WorkflowVersionWorkspaceEntity, 'trigger'> & { diff --git a/packages/twenty-server/src/modules/workflow/common/services/workflow-common.workspace-service.ts b/packages/twenty-server/src/modules/workflow/common/services/workflow-common.workspace-service.ts index 6cc0478e265c..ac71258f4ba8 100644 --- a/packages/twenty-server/src/modules/workflow/common/services/workflow-common.workspace-service.ts +++ b/packages/twenty-server/src/modules/workflow/common/services/workflow-common.workspace-service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common'; import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager'; import { WorkflowVersionWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-version.workspace-entity'; -import { WorkflowTrigger } from 'src/modules/workflow/common/types/workflow-trigger.type'; +import { WorkflowTrigger } from 'src/modules/workflow/workflow-trigger/types/workflow-trigger.type'; import { WorkflowTriggerException, WorkflowTriggerExceptionCode, diff --git a/packages/twenty-server/src/modules/workflow/common/standard-objects/workflow-version.workspace-entity.ts b/packages/twenty-server/src/modules/workflow/common/standard-objects/workflow-version.workspace-entity.ts index 8149cfcc39f4..da9b56e9b75f 100644 --- a/packages/twenty-server/src/modules/workflow/common/standard-objects/workflow-version.workspace-entity.ts +++ b/packages/twenty-server/src/modules/workflow/common/standard-objects/workflow-version.workspace-entity.ts @@ -21,8 +21,8 @@ import { import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids'; import { WorkflowRunWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-run.workspace-entity'; import { WorkflowWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow.workspace-entity'; -import { WorkflowStep } from 'src/modules/workflow/common/types/workflow-step.type'; -import { WorkflowTrigger } from 'src/modules/workflow/common/types/workflow-trigger.type'; +import { WorkflowStep } from 'src/modules/workflow/workflow-executor/types/workflow-step.type'; +import { WorkflowTrigger } from 'src/modules/workflow/workflow-trigger/types/workflow-trigger.type'; export enum WorkflowVersionStatus { DRAFT = 'DRAFT', diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executor.factory.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executor.factory.ts index b2e54f71430d..88a35c23d5c5 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executor.factory.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executor.factory.ts @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common'; import { WorkflowStepExecutor } from 'src/modules/workflow/workflow-executor/interfaces/workflow-step-executor.interface'; -import { WorkflowStepType } from 'src/modules/workflow/common/types/workflow-step.type'; +import { WorkflowStepType } from 'src/modules/workflow/workflow-executor/types/workflow-step.type'; import { WorkflowStepExecutorException, WorkflowStepExecutorExceptionCode, diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executors/code.workflow-step-executor.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executors/code.workflow-step-executor.ts index 82f7d925cedd..bdbba548e780 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executors/code.workflow-step-executor.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executors/code.workflow-step-executor.ts @@ -2,8 +2,8 @@ import { Injectable } from '@nestjs/common'; import { ServerlessFunctionService } from 'src/engine/metadata-modules/serverless-function/serverless-function.service'; import { ScopedWorkspaceContextFactory } from 'src/engine/twenty-orm/factories/scoped-workspace-context.factory'; -import { WorkflowStepResult } from 'src/modules/workflow/common/types/workflow-step-result.type'; -import { WorkflowCodeStep } from 'src/modules/workflow/common/types/workflow-step.type'; +import { WorkflowStepResult } from 'src/modules/workflow/workflow-executor/types/workflow-step-result.type'; +import { WorkflowCodeStep } from 'src/modules/workflow/workflow-executor/types/workflow-step.type'; import { WorkflowStepExecutorException, WorkflowStepExecutorExceptionCode, diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executors/send-email.workflow-step-executor.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executors/send-email.workflow-step-executor.ts index 610f17e168d8..f5625011b909 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executors/send-email.workflow-step-executor.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executors/send-email.workflow-step-executor.ts @@ -7,8 +7,8 @@ import DOMPurify from 'dompurify'; import { WorkflowActionEmail } from 'twenty-emails'; import { render } from '@react-email/components'; -import { WorkflowStepResult } from 'src/modules/workflow/common/types/workflow-step-result.type'; -import { WorkflowSendEmailStep } from 'src/modules/workflow/common/types/workflow-step.type'; +import { WorkflowStepResult } from 'src/modules/workflow/workflow-executor/types/workflow-step-result.type'; +import { WorkflowSendEmailStep } from 'src/modules/workflow/workflow-executor/types/workflow-step.type'; import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; import { EmailService } from 'src/engine/integrations/email/email.service'; diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/interfaces/workflow-step-executor.interface.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/interfaces/workflow-step-executor.interface.ts index fd7ff8f49732..9d23fc8802a0 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/interfaces/workflow-step-executor.interface.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/interfaces/workflow-step-executor.interface.ts @@ -1,5 +1,5 @@ -import { WorkflowStepResult } from 'src/modules/workflow/common/types/workflow-step-result.type'; -import { WorkflowStep } from 'src/modules/workflow/common/types/workflow-step.type'; +import { WorkflowStepResult } from 'src/modules/workflow/workflow-executor/types/workflow-step-result.type'; +import { WorkflowStep } from 'src/modules/workflow/workflow-executor/types/workflow-step.type'; export interface WorkflowStepExecutor { execute({ diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/services/workflow-executor.workspace-service.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/services/workflow-executor.workspace-service.ts index c51b79cb9177..4b975f017d82 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/services/workflow-executor.workspace-service.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/services/workflow-executor.workspace-service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@nestjs/common'; -import { WorkflowStep } from 'src/modules/workflow/common/types/workflow-step.type'; +import { WorkflowStep } from 'src/modules/workflow/workflow-executor/types/workflow-step.type'; import { WorkflowExecutorException, WorkflowExecutorExceptionCode, diff --git a/packages/twenty-server/src/modules/workflow/common/types/workflow-step-result.type.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/types/workflow-step-result.type.ts similarity index 100% rename from packages/twenty-server/src/modules/workflow/common/types/workflow-step-result.type.ts rename to packages/twenty-server/src/modules/workflow/workflow-executor/types/workflow-step-result.type.ts diff --git a/packages/twenty-server/src/modules/workflow/common/types/workflow-step-settings.type.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/types/workflow-step-settings.type.ts similarity index 100% rename from packages/twenty-server/src/modules/workflow/common/types/workflow-step-settings.type.ts rename to packages/twenty-server/src/modules/workflow/workflow-executor/types/workflow-step-settings.type.ts diff --git a/packages/twenty-server/src/modules/workflow/common/types/workflow-step.type.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/types/workflow-step.type.ts similarity index 87% rename from packages/twenty-server/src/modules/workflow/common/types/workflow-step.type.ts rename to packages/twenty-server/src/modules/workflow/workflow-executor/types/workflow-step.type.ts index 51332530bdaa..291c28dc9880 100644 --- a/packages/twenty-server/src/modules/workflow/common/types/workflow-step.type.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/types/workflow-step.type.ts @@ -1,7 +1,7 @@ import { WorkflowCodeStepSettings, WorkflowSendEmailStepSettings, -} from 'src/modules/workflow/common/types/workflow-step-settings.type'; +} from 'src/modules/workflow/workflow-executor/types/workflow-step-settings.type'; export enum WorkflowStepType { CODE_ACTION = 'CODE_ACTION', diff --git a/packages/twenty-server/src/modules/workflow/workflow-trigger/database-event-trigger/database-event-trigger.service.ts b/packages/twenty-server/src/modules/workflow/workflow-trigger/database-event-trigger/database-event-trigger.service.ts index 4db20d091aae..da8affbb6df5 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-trigger/database-event-trigger/database-event-trigger.service.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-trigger/database-event-trigger/database-event-trigger.service.ts @@ -4,7 +4,7 @@ import { EntityManager } from 'typeorm'; import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager'; import { WorkflowEventListenerWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-event-listener.workspace-entity'; -import { WorkflowDatabaseEventTrigger } from 'src/modules/workflow/common/types/workflow-trigger.type'; +import { WorkflowDatabaseEventTrigger } from 'src/modules/workflow/workflow-trigger/types/workflow-trigger.type'; @Injectable() export class DatabaseEventTriggerService { diff --git a/packages/twenty-server/src/modules/workflow/common/types/workflow-trigger.type.ts b/packages/twenty-server/src/modules/workflow/workflow-trigger/types/workflow-trigger.type.ts similarity index 100% rename from packages/twenty-server/src/modules/workflow/common/types/workflow-trigger.type.ts rename to packages/twenty-server/src/modules/workflow/workflow-trigger/types/workflow-trigger.type.ts diff --git a/packages/twenty-server/src/modules/workflow/workflow-trigger/utils/assert-version-can-be-activated.util.ts b/packages/twenty-server/src/modules/workflow/workflow-trigger/utils/assert-version-can-be-activated.util.ts index a75e7732361b..827e8e0161ca 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-trigger/utils/assert-version-can-be-activated.util.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-trigger/utils/assert-version-can-be-activated.util.ts @@ -6,7 +6,7 @@ import { WorkflowWorkspaceEntity } from 'src/modules/workflow/common/standard-ob import { WorkflowTrigger, WorkflowTriggerType, -} from 'src/modules/workflow/common/types/workflow-trigger.type'; +} from 'src/modules/workflow/workflow-trigger/types/workflow-trigger.type'; import { WorkflowTriggerException, WorkflowTriggerExceptionCode, diff --git a/packages/twenty-server/src/modules/workflow/workflow-trigger/workflow-trigger.workspace-service.ts b/packages/twenty-server/src/modules/workflow/workflow-trigger/workflow-trigger.workspace-service.ts index 4e02b8b888fa..4c9afa94931f 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-trigger/workflow-trigger.workspace-service.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-trigger/workflow-trigger.workspace-service.ts @@ -17,7 +17,7 @@ import { WorkflowWorkspaceEntity } from 'src/modules/workflow/common/standard-ob import { WorkflowTrigger, WorkflowTriggerType, -} from 'src/modules/workflow/common/types/workflow-trigger.type'; +} from 'src/modules/workflow/workflow-trigger/types/workflow-trigger.type'; import { WorkflowRunnerWorkspaceService } from 'src/modules/workflow/workflow-runner/workflow-runner.workspace-service'; import { WorkflowVersionStatusUpdate } from 'src/modules/workflow/workflow-status/jobs/workflow-statuses-update.job'; import { DatabaseEventTriggerService } from 'src/modules/workflow/workflow-trigger/database-event-trigger/database-event-trigger.service'; From 3e74a5daf2474071cb84c08ee75bded757ef4742 Mon Sep 17 00:00:00 2001 From: martmull <martmull@hotmail.fr> Date: Wed, 11 Sep 2024 15:01:55 +0200 Subject: [PATCH 17/24] Simplify folder tree --- .../workflow-step-executor.factory.ts | 4 ++-- .../workflow-step-executors/code.workflow-step-executor.ts | 0 .../send-email.workflow-step-executor.ts | 0 .../services/workflow-executor.workspace-service.ts | 2 +- .../workflow/workflow-executor/workflow-executor.module.ts | 6 +++--- 5 files changed, 6 insertions(+), 6 deletions(-) rename packages/twenty-server/src/modules/workflow/workflow-executor/factories/{workflow-step-executor => }/workflow-step-executor.factory.ts (85%) rename packages/twenty-server/src/modules/workflow/workflow-executor/factories/{workflow-step-executor => }/workflow-step-executors/code.workflow-step-executor.ts (100%) rename packages/twenty-server/src/modules/workflow/workflow-executor/factories/{workflow-step-executor => }/workflow-step-executors/send-email.workflow-step-executor.ts (100%) diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executor.factory.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor.factory.ts similarity index 85% rename from packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executor.factory.ts rename to packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor.factory.ts index 88a35c23d5c5..12f660a77e19 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executor.factory.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor.factory.ts @@ -7,8 +7,8 @@ import { WorkflowStepExecutorException, WorkflowStepExecutorExceptionCode, } from 'src/modules/workflow/workflow-executor/exceptions/workflow-step-executor.exception'; -import { CodeWorkflowStepExecutor } from 'src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executors/code.workflow-step-executor'; -import { SendEmailWorkflowStepExecutor } from 'src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executors/send-email.workflow-step-executor'; +import { CodeWorkflowStepExecutor } from 'src/modules/workflow/workflow-executor/factories/workflow-step-executors/code.workflow-step-executor'; +import { SendEmailWorkflowStepExecutor } from 'src/modules/workflow/workflow-executor/factories/workflow-step-executors/send-email.workflow-step-executor'; @Injectable() export class WorkflowStepExecutorFactory { diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executors/code.workflow-step-executor.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executors/code.workflow-step-executor.ts similarity index 100% rename from packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executors/code.workflow-step-executor.ts rename to packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executors/code.workflow-step-executor.ts diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executors/send-email.workflow-step-executor.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executors/send-email.workflow-step-executor.ts similarity index 100% rename from packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executors/send-email.workflow-step-executor.ts rename to packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executors/send-email.workflow-step-executor.ts diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/services/workflow-executor.workspace-service.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/services/workflow-executor.workspace-service.ts index 4b975f017d82..1b9bffb4e671 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/services/workflow-executor.workspace-service.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/services/workflow-executor.workspace-service.ts @@ -5,7 +5,7 @@ import { WorkflowExecutorException, WorkflowExecutorExceptionCode, } from 'src/modules/workflow/workflow-executor/exceptions/workflow-executor.exception'; -import { WorkflowStepExecutorFactory } from 'src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executor.factory'; +import { WorkflowStepExecutorFactory } from 'src/modules/workflow/workflow-executor/factories/workflow-step-executor.factory'; const MAX_RETRIES_ON_FAILURE = 3; diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.module.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.module.ts index 978586f28fb3..070ddb2cb843 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.module.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.module.ts @@ -2,9 +2,9 @@ import { Module } from '@nestjs/common'; import { WorkflowCommonModule } from 'src/modules/workflow/common/workflow-common.module'; import { WorkflowExecutorWorkspaceService } from 'src/modules/workflow/workflow-executor/services/workflow-executor.workspace-service'; -import { WorkflowStepExecutorFactory } from 'src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executor.factory'; -import { CodeWorkflowStepExecutor } from 'src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executors/code.workflow-step-executor'; -import { SendEmailWorkflowStepExecutor } from 'src/modules/workflow/workflow-executor/factories/workflow-step-executor/workflow-step-executors/send-email.workflow-step-executor'; +import { WorkflowStepExecutorFactory } from 'src/modules/workflow/workflow-executor/factories/workflow-step-executor.factory'; +import { CodeWorkflowStepExecutor } from 'src/modules/workflow/workflow-executor/factories/workflow-step-executors/code.workflow-step-executor'; +import { SendEmailWorkflowStepExecutor } from 'src/modules/workflow/workflow-executor/factories/workflow-step-executors/send-email.workflow-step-executor'; import { ServerlessFunctionModule } from 'src/engine/metadata-modules/serverless-function/serverless-function.module'; import { ScopedWorkspaceContextFactory } from 'src/engine/twenty-orm/factories/scoped-workspace-context.factory'; From 5726382ec6641334885cf6064e44c3fd54109023 Mon Sep 17 00:00:00 2001 From: martmull <martmull@hotmail.fr> Date: Wed, 11 Sep 2024 15:51:22 +0200 Subject: [PATCH 18/24] Reorganize workflow-runner --- .../workflow-run.exception.ts | 0 .../workflow-runner/jobs/run-workflow.job.ts | 2 +- .../workflow-run.workspace-service.ts | 2 +- .../workflow-runner.workspace-service.ts | 2 +- .../workflow-run/workflow-run.module.ts | 11 ----------- .../workflow-runner/workflow-runner.module.ts | 12 ++++++++---- .../jobs/workflow-event-trigger.job.ts | 2 +- .../workflow-trigger.workspace-service.ts | 2 +- 8 files changed, 13 insertions(+), 20 deletions(-) rename packages/twenty-server/src/modules/workflow/workflow-runner/{workflow-run => exceptions}/workflow-run.exception.ts (100%) rename packages/twenty-server/src/modules/workflow/workflow-runner/{workflow-run => services}/workflow-run.workspace-service.ts (97%) rename packages/twenty-server/src/modules/workflow/workflow-runner/{ => services}/workflow-runner.workspace-service.ts (95%) delete mode 100644 packages/twenty-server/src/modules/workflow/workflow-runner/workflow-run/workflow-run.module.ts diff --git a/packages/twenty-server/src/modules/workflow/workflow-runner/workflow-run/workflow-run.exception.ts b/packages/twenty-server/src/modules/workflow/workflow-runner/exceptions/workflow-run.exception.ts similarity index 100% rename from packages/twenty-server/src/modules/workflow/workflow-runner/workflow-run/workflow-run.exception.ts rename to packages/twenty-server/src/modules/workflow/workflow-runner/exceptions/workflow-run.exception.ts diff --git a/packages/twenty-server/src/modules/workflow/workflow-runner/jobs/run-workflow.job.ts b/packages/twenty-server/src/modules/workflow/workflow-runner/jobs/run-workflow.job.ts index 2408c51e5405..8d25b1bfa4d5 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-runner/jobs/run-workflow.job.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-runner/jobs/run-workflow.job.ts @@ -6,7 +6,7 @@ import { MessageQueue } from 'src/engine/integrations/message-queue/message-queu import { WorkflowCommonWorkspaceService } from 'src/modules/workflow/common/services/workflow-common.workspace-service'; import { WorkflowRunStatus } from 'src/modules/workflow/common/standard-objects/workflow-run.workspace-entity'; import { WorkflowExecutorWorkspaceService } from 'src/modules/workflow/workflow-executor/services/workflow-executor.workspace-service'; -import { WorkflowRunWorkspaceService } from 'src/modules/workflow/workflow-runner/workflow-run/workflow-run.workspace-service'; +import { WorkflowRunWorkspaceService } from 'src/modules/workflow/workflow-runner/services/workflow-run.workspace-service'; export type RunWorkflowJobData = { workspaceId: string; diff --git a/packages/twenty-server/src/modules/workflow/workflow-runner/workflow-run/workflow-run.workspace-service.ts b/packages/twenty-server/src/modules/workflow/workflow-runner/services/workflow-run.workspace-service.ts similarity index 97% rename from packages/twenty-server/src/modules/workflow/workflow-runner/workflow-run/workflow-run.workspace-service.ts rename to packages/twenty-server/src/modules/workflow/workflow-runner/services/workflow-run.workspace-service.ts index 126984f01251..4cf525e6352f 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-runner/workflow-run/workflow-run.workspace-service.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-runner/services/workflow-run.workspace-service.ts @@ -10,7 +10,7 @@ import { import { WorkflowRunException, WorkflowRunExceptionCode, -} from 'src/modules/workflow/workflow-runner/workflow-run/workflow-run.exception'; +} from 'src/modules/workflow/workflow-runner/exceptions/workflow-run.exception'; @Injectable() export class WorkflowRunWorkspaceService { diff --git a/packages/twenty-server/src/modules/workflow/workflow-runner/workflow-runner.workspace-service.ts b/packages/twenty-server/src/modules/workflow/workflow-runner/services/workflow-runner.workspace-service.ts similarity index 95% rename from packages/twenty-server/src/modules/workflow/workflow-runner/workflow-runner.workspace-service.ts rename to packages/twenty-server/src/modules/workflow/workflow-runner/services/workflow-runner.workspace-service.ts index bc43bd1b5a0d..a2e573dbc2cd 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-runner/workflow-runner.workspace-service.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-runner/services/workflow-runner.workspace-service.ts @@ -8,7 +8,7 @@ import { RunWorkflowJob, RunWorkflowJobData, } from 'src/modules/workflow/workflow-runner/jobs/run-workflow.job'; -import { WorkflowRunWorkspaceService } from 'src/modules/workflow/workflow-runner/workflow-run/workflow-run.workspace-service'; +import { WorkflowRunWorkspaceService } from 'src/modules/workflow/workflow-runner/services/workflow-run.workspace-service'; @Injectable() export class WorkflowRunnerWorkspaceService { diff --git a/packages/twenty-server/src/modules/workflow/workflow-runner/workflow-run/workflow-run.module.ts b/packages/twenty-server/src/modules/workflow/workflow-runner/workflow-run/workflow-run.module.ts deleted file mode 100644 index 55a987bc97fe..000000000000 --- a/packages/twenty-server/src/modules/workflow/workflow-runner/workflow-run/workflow-run.module.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Module } from '@nestjs/common'; - -import { WorkflowCommonModule } from 'src/modules/workflow/common/workflow-common.module'; -import { WorkflowRunWorkspaceService } from 'src/modules/workflow/workflow-runner/workflow-run/workflow-run.workspace-service'; - -@Module({ - imports: [WorkflowCommonModule], - providers: [WorkflowRunWorkspaceService], - exports: [WorkflowRunWorkspaceService], -}) -export class WorkflowRunModule {} diff --git a/packages/twenty-server/src/modules/workflow/workflow-runner/workflow-runner.module.ts b/packages/twenty-server/src/modules/workflow/workflow-runner/workflow-runner.module.ts index bf33e5b21f02..847a14ed18fa 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-runner/workflow-runner.module.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-runner/workflow-runner.module.ts @@ -3,12 +3,16 @@ import { Module } from '@nestjs/common'; import { WorkflowCommonModule } from 'src/modules/workflow/common/workflow-common.module'; import { WorkflowExecutorModule } from 'src/modules/workflow/workflow-executor/workflow-executor.module'; import { RunWorkflowJob } from 'src/modules/workflow/workflow-runner/jobs/run-workflow.job'; -import { WorkflowRunModule } from 'src/modules/workflow/workflow-runner/workflow-run/workflow-run.module'; -import { WorkflowRunnerWorkspaceService } from 'src/modules/workflow/workflow-runner/workflow-runner.workspace-service'; +import { WorkflowRunnerWorkspaceService } from 'src/modules/workflow/workflow-runner/services/workflow-runner.workspace-service'; +import { WorkflowRunWorkspaceService } from 'src/modules/workflow/workflow-runner/services/workflow-run.workspace-service'; @Module({ - imports: [WorkflowRunModule, WorkflowCommonModule, WorkflowExecutorModule], - providers: [WorkflowRunnerWorkspaceService, RunWorkflowJob], + imports: [WorkflowCommonModule, WorkflowExecutorModule], + providers: [ + WorkflowRunnerWorkspaceService, + WorkflowRunWorkspaceService, + RunWorkflowJob, + ], exports: [WorkflowRunnerWorkspaceService], }) export class WorkflowRunnerModule {} diff --git a/packages/twenty-server/src/modules/workflow/workflow-trigger/jobs/workflow-event-trigger.job.ts b/packages/twenty-server/src/modules/workflow/workflow-trigger/jobs/workflow-event-trigger.job.ts index 465204bd4bc0..786ab51d685e 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-trigger/jobs/workflow-event-trigger.job.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-trigger/jobs/workflow-event-trigger.job.ts @@ -10,7 +10,7 @@ import { WorkflowVersionWorkspaceEntity, } from 'src/modules/workflow/common/standard-objects/workflow-version.workspace-entity'; import { WorkflowWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow.workspace-entity'; -import { WorkflowRunnerWorkspaceService } from 'src/modules/workflow/workflow-runner/workflow-runner.workspace-service'; +import { WorkflowRunnerWorkspaceService } from 'src/modules/workflow/workflow-runner/services/workflow-runner.workspace-service'; import { WorkflowTriggerException, WorkflowTriggerExceptionCode, diff --git a/packages/twenty-server/src/modules/workflow/workflow-trigger/workflow-trigger.workspace-service.ts b/packages/twenty-server/src/modules/workflow/workflow-trigger/workflow-trigger.workspace-service.ts index 4c9afa94931f..d64ea8558c0b 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-trigger/workflow-trigger.workspace-service.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-trigger/workflow-trigger.workspace-service.ts @@ -18,7 +18,7 @@ import { WorkflowTrigger, WorkflowTriggerType, } from 'src/modules/workflow/workflow-trigger/types/workflow-trigger.type'; -import { WorkflowRunnerWorkspaceService } from 'src/modules/workflow/workflow-runner/workflow-runner.workspace-service'; +import { WorkflowRunnerWorkspaceService } from 'src/modules/workflow/workflow-runner/services/workflow-runner.workspace-service'; import { WorkflowVersionStatusUpdate } from 'src/modules/workflow/workflow-status/jobs/workflow-statuses-update.job'; import { DatabaseEventTriggerService } from 'src/modules/workflow/workflow-trigger/database-event-trigger/database-event-trigger.service'; import { assertVersionCanBeActivated } from 'src/modules/workflow/workflow-trigger/utils/assert-version-can-be-activated.util'; From 611b4ca15ad884adbe401d89c139891edbd4f57c Mon Sep 17 00:00:00 2001 From: martmull <martmull@hotmail.fr> Date: Wed, 11 Sep 2024 15:53:10 +0200 Subject: [PATCH 19/24] Reorganize workflow-status --- .../{ => constants}/workflow-status.constants.ts | 0 .../workflow-status.enum.ts} | 0 .../utils/get-status-combination-from-array.util.ts | 4 ++-- .../utils/get-status-combination-from-update.util.ts | 2 +- .../utils/get-statuses-from-combination.util.ts | 4 ++-- 5 files changed, 5 insertions(+), 5 deletions(-) rename packages/twenty-server/src/modules/workflow/workflow-status/{ => constants}/workflow-status.constants.ts (100%) rename packages/twenty-server/src/modules/workflow/workflow-status/{workflow-status.enums.ts => enums/workflow-status.enum.ts} (100%) diff --git a/packages/twenty-server/src/modules/workflow/workflow-status/workflow-status.constants.ts b/packages/twenty-server/src/modules/workflow/workflow-status/constants/workflow-status.constants.ts similarity index 100% rename from packages/twenty-server/src/modules/workflow/workflow-status/workflow-status.constants.ts rename to packages/twenty-server/src/modules/workflow/workflow-status/constants/workflow-status.constants.ts diff --git a/packages/twenty-server/src/modules/workflow/workflow-status/workflow-status.enums.ts b/packages/twenty-server/src/modules/workflow/workflow-status/enums/workflow-status.enum.ts similarity index 100% rename from packages/twenty-server/src/modules/workflow/workflow-status/workflow-status.enums.ts rename to packages/twenty-server/src/modules/workflow/workflow-status/enums/workflow-status.enum.ts diff --git a/packages/twenty-server/src/modules/workflow/workflow-status/utils/get-status-combination-from-array.util.ts b/packages/twenty-server/src/modules/workflow/workflow-status/utils/get-status-combination-from-array.util.ts index 1df699db437e..267b4a68114e 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-status/utils/get-status-combination-from-array.util.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-status/utils/get-status-combination-from-array.util.ts @@ -7,8 +7,8 @@ import { DEACTIVATED_AND_DRAFT_STATUSES, DEACTIVATED_STATUSES, DRAFT_STATUSES, -} from 'src/modules/workflow/workflow-status/workflow-status.constants'; -import { WorkflowStatusCombination } from 'src/modules/workflow/workflow-status/workflow-status.enums'; +} from 'src/modules/workflow/workflow-status/constants/workflow-status.constants'; +import { WorkflowStatusCombination } from 'src/modules/workflow/workflow-status/enums/workflow-status.enum'; export const getStatusCombinationFromArray = ( statuses: WorkflowStatus[], diff --git a/packages/twenty-server/src/modules/workflow/workflow-status/utils/get-status-combination-from-update.util.ts b/packages/twenty-server/src/modules/workflow/workflow-status/utils/get-status-combination-from-update.util.ts index ecf0fe2f9e74..634133990a87 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-status/utils/get-status-combination-from-update.util.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-status/utils/get-status-combination-from-update.util.ts @@ -1,5 +1,5 @@ import { WorkflowVersionStatus } from 'src/modules/workflow/common/standard-objects/workflow-version.workspace-entity'; -import { WorkflowStatusCombination } from 'src/modules/workflow/workflow-status/workflow-status.enums'; +import { WorkflowStatusCombination } from 'src/modules/workflow/workflow-status/enums/workflow-status.enum'; export const getStatusCombinationFromUpdate = ( previousCombination: WorkflowStatusCombination, diff --git a/packages/twenty-server/src/modules/workflow/workflow-status/utils/get-statuses-from-combination.util.ts b/packages/twenty-server/src/modules/workflow/workflow-status/utils/get-statuses-from-combination.util.ts index e8f65beae576..72c53862e533 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-status/utils/get-statuses-from-combination.util.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-status/utils/get-statuses-from-combination.util.ts @@ -6,8 +6,8 @@ import { DEACTIVATED_STATUSES, DRAFT_STATUSES, NO_STATUSES, -} from 'src/modules/workflow/workflow-status/workflow-status.constants'; -import { WorkflowStatusCombination } from 'src/modules/workflow/workflow-status/workflow-status.enums'; +} from 'src/modules/workflow/workflow-status/constants/workflow-status.constants'; +import { WorkflowStatusCombination } from 'src/modules/workflow/workflow-status/enums/workflow-status.enum'; export const getWorkflowStatusesFromCombination = ( combination: WorkflowStatusCombination, From c8b0b4a5bb457b7194648a8634e506bc443dc103 Mon Sep 17 00:00:00 2001 From: martmull <martmull@hotmail.fr> Date: Wed, 11 Sep 2024 16:02:56 +0200 Subject: [PATCH 20/24] Rename services folders --- .../workflow-trigger-graphql-api-exception.filter.ts | 2 +- .../core-modules/workflow/workflow-trigger.resolver.ts | 2 +- .../common/query-hooks/workflow-query-hook.module.ts | 2 +- .../workflow-version-validation.workspace-service.ts | 2 +- .../src/modules/workflow/common/workflow-common.module.ts | 2 +- .../workflow-common.workspace-service.ts | 2 +- .../workflow/workflow-executor/workflow-executor.module.ts | 2 +- .../workflow-executor.workspace-service.ts | 0 .../workflow/workflow-runner/jobs/run-workflow.job.ts | 6 +++--- .../workflow/workflow-runner/workflow-runner.module.ts | 4 ++-- .../workflow-run.workspace-service.ts | 2 +- .../workflow-runner.workspace-service.ts | 2 +- .../{ => exceptions}/workflow-trigger.exception.ts | 0 .../workflow-trigger/jobs/workflow-event-trigger.job.ts | 4 ++-- .../utils/assert-version-can-be-activated.util.ts | 2 +- .../workflow/workflow-trigger/workflow-trigger.module.ts | 2 +- .../workflow-trigger.workspace-service.ts | 6 +++--- 17 files changed, 21 insertions(+), 21 deletions(-) rename packages/twenty-server/src/modules/workflow/common/{services => workspace-services}/workflow-common.workspace-service.ts (95%) rename packages/twenty-server/src/modules/workflow/workflow-executor/{services => workspace-services}/workflow-executor.workspace-service.ts (100%) rename packages/twenty-server/src/modules/workflow/workflow-runner/{services => workspace-services}/workflow-run.workspace-service.ts (97%) rename packages/twenty-server/src/modules/workflow/workflow-runner/{services => workspace-services}/workflow-runner.workspace-service.ts (95%) rename packages/twenty-server/src/modules/workflow/workflow-trigger/{ => exceptions}/workflow-trigger.exception.ts (100%) rename packages/twenty-server/src/modules/workflow/workflow-trigger/{ => workspace-services}/workflow-trigger.workspace-service.ts (97%) diff --git a/packages/twenty-server/src/engine/core-modules/workflow/filters/workflow-trigger-graphql-api-exception.filter.ts b/packages/twenty-server/src/engine/core-modules/workflow/filters/workflow-trigger-graphql-api-exception.filter.ts index 1bbfdc27342c..a274ccd4370b 100644 --- a/packages/twenty-server/src/engine/core-modules/workflow/filters/workflow-trigger-graphql-api-exception.filter.ts +++ b/packages/twenty-server/src/engine/core-modules/workflow/filters/workflow-trigger-graphql-api-exception.filter.ts @@ -7,7 +7,7 @@ import { import { WorkflowTriggerException, WorkflowTriggerExceptionCode, -} from 'src/modules/workflow/workflow-trigger/workflow-trigger.exception'; +} from 'src/modules/workflow/workflow-trigger/exceptions/workflow-trigger.exception'; @Catch(WorkflowTriggerException) export class WorkflowTriggerGraphqlApiExceptionFilter diff --git a/packages/twenty-server/src/engine/core-modules/workflow/workflow-trigger.resolver.ts b/packages/twenty-server/src/engine/core-modules/workflow/workflow-trigger.resolver.ts index 630832a18edc..ef2c735a389c 100644 --- a/packages/twenty-server/src/engine/core-modules/workflow/workflow-trigger.resolver.ts +++ b/packages/twenty-server/src/engine/core-modules/workflow/workflow-trigger.resolver.ts @@ -8,7 +8,7 @@ import { WorkflowTriggerGraphqlApiExceptionFilter } from 'src/engine/core-module import { AuthUser } from 'src/engine/decorators/auth/auth-user.decorator'; import { AuthWorkspaceMemberId } from 'src/engine/decorators/auth/auth-workspace-member-id.decorator'; import { JwtAuthGuard } from 'src/engine/guards/jwt.auth.guard'; -import { WorkflowTriggerWorkspaceService } from 'src/modules/workflow/workflow-trigger/workflow-trigger.workspace-service'; +import { WorkflowTriggerWorkspaceService } from 'src/modules/workflow/workflow-trigger/workspace-services/workflow-trigger.workspace-service'; @Resolver() @UseGuards(JwtAuthGuard) diff --git a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-query-hook.module.ts b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-query-hook.module.ts index 7601f628cbc1..0c05ca21b0b9 100644 --- a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-query-hook.module.ts +++ b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-query-hook.module.ts @@ -13,7 +13,7 @@ import { WorkflowCreateManyPreQueryHook } from 'src/modules/workflow/common/quer import { WorkflowCreateOnePreQueryHook } from 'src/modules/workflow/common/query-hooks/workflow/workflow-create-one.pre-query.hook'; import { WorkflowUpdateManyPreQueryHook } from 'src/modules/workflow/common/query-hooks/workflow/workflow-update-many.pre-query.hook'; import { WorkflowUpdateOnePreQueryHook } from 'src/modules/workflow/common/query-hooks/workflow/workflow-update-one.pre-query.hook'; -import { WorkflowCommonWorkspaceService } from 'src/modules/workflow/common/services/workflow-common.workspace-service'; +import { WorkflowCommonWorkspaceService } from 'src/modules/workflow/common/workspace-services/workflow-common.workspace-service'; @Module({ providers: [ diff --git a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/services/workflow-version-validation.workspace-service.ts b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/services/workflow-version-validation.workspace-service.ts index 114cc3f476df..e4959affc531 100644 --- a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/services/workflow-version-validation.workspace-service.ts +++ b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/services/workflow-version-validation.workspace-service.ts @@ -12,7 +12,7 @@ import { WorkflowQueryValidationExceptionCode, } from 'src/modules/workflow/common/query-hooks/workflow-query-validation.exception'; import { assertWorkflowVersionIsDraft } from 'src/modules/workflow/common/query-hooks/workflow-version/utils/assert-workflow-version-is-draft.util'; -import { WorkflowCommonWorkspaceService } from 'src/modules/workflow/common/services/workflow-common.workspace-service'; +import { WorkflowCommonWorkspaceService } from 'src/modules/workflow/common/workspace-services/workflow-common.workspace-service'; import { WorkflowVersionStatus, WorkflowVersionWorkspaceEntity, diff --git a/packages/twenty-server/src/modules/workflow/common/workflow-common.module.ts b/packages/twenty-server/src/modules/workflow/common/workflow-common.module.ts index bc9b9a9f086c..fc23aa8ff88a 100644 --- a/packages/twenty-server/src/modules/workflow/common/workflow-common.module.ts +++ b/packages/twenty-server/src/modules/workflow/common/workflow-common.module.ts @@ -1,7 +1,7 @@ import { Module } from '@nestjs/common'; import { WorkflowQueryHookModule } from 'src/modules/workflow/common/query-hooks/workflow-query-hook.module'; -import { WorkflowCommonWorkspaceService } from 'src/modules/workflow/common/services/workflow-common.workspace-service'; +import { WorkflowCommonWorkspaceService } from 'src/modules/workflow/common/workspace-services/workflow-common.workspace-service'; @Module({ imports: [WorkflowQueryHookModule], diff --git a/packages/twenty-server/src/modules/workflow/common/services/workflow-common.workspace-service.ts b/packages/twenty-server/src/modules/workflow/common/workspace-services/workflow-common.workspace-service.ts similarity index 95% rename from packages/twenty-server/src/modules/workflow/common/services/workflow-common.workspace-service.ts rename to packages/twenty-server/src/modules/workflow/common/workspace-services/workflow-common.workspace-service.ts index ac71258f4ba8..a1db5af0d26c 100644 --- a/packages/twenty-server/src/modules/workflow/common/services/workflow-common.workspace-service.ts +++ b/packages/twenty-server/src/modules/workflow/common/workspace-services/workflow-common.workspace-service.ts @@ -6,7 +6,7 @@ import { WorkflowTrigger } from 'src/modules/workflow/workflow-trigger/types/wor import { WorkflowTriggerException, WorkflowTriggerExceptionCode, -} from 'src/modules/workflow/workflow-trigger/workflow-trigger.exception'; +} from 'src/modules/workflow/workflow-trigger/exceptions/workflow-trigger.exception'; @Injectable() export class WorkflowCommonWorkspaceService { diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.module.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.module.ts index 070ddb2cb843..c0a41111691a 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.module.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.module.ts @@ -1,7 +1,7 @@ import { Module } from '@nestjs/common'; import { WorkflowCommonModule } from 'src/modules/workflow/common/workflow-common.module'; -import { WorkflowExecutorWorkspaceService } from 'src/modules/workflow/workflow-executor/services/workflow-executor.workspace-service'; +import { WorkflowExecutorWorkspaceService } from 'src/modules/workflow/workflow-executor/workspace-services/workflow-executor.workspace-service'; import { WorkflowStepExecutorFactory } from 'src/modules/workflow/workflow-executor/factories/workflow-step-executor.factory'; import { CodeWorkflowStepExecutor } from 'src/modules/workflow/workflow-executor/factories/workflow-step-executors/code.workflow-step-executor'; import { SendEmailWorkflowStepExecutor } from 'src/modules/workflow/workflow-executor/factories/workflow-step-executors/send-email.workflow-step-executor'; diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/services/workflow-executor.workspace-service.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/workspace-services/workflow-executor.workspace-service.ts similarity index 100% rename from packages/twenty-server/src/modules/workflow/workflow-executor/services/workflow-executor.workspace-service.ts rename to packages/twenty-server/src/modules/workflow/workflow-executor/workspace-services/workflow-executor.workspace-service.ts diff --git a/packages/twenty-server/src/modules/workflow/workflow-runner/jobs/run-workflow.job.ts b/packages/twenty-server/src/modules/workflow/workflow-runner/jobs/run-workflow.job.ts index 8d25b1bfa4d5..0f8b66b55c71 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-runner/jobs/run-workflow.job.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-runner/jobs/run-workflow.job.ts @@ -3,10 +3,10 @@ import { Scope } from '@nestjs/common'; import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { WorkflowCommonWorkspaceService } from 'src/modules/workflow/common/services/workflow-common.workspace-service'; +import { WorkflowCommonWorkspaceService } from 'src/modules/workflow/common/workspace-services/workflow-common.workspace-service'; import { WorkflowRunStatus } from 'src/modules/workflow/common/standard-objects/workflow-run.workspace-entity'; -import { WorkflowExecutorWorkspaceService } from 'src/modules/workflow/workflow-executor/services/workflow-executor.workspace-service'; -import { WorkflowRunWorkspaceService } from 'src/modules/workflow/workflow-runner/services/workflow-run.workspace-service'; +import { WorkflowExecutorWorkspaceService } from 'src/modules/workflow/workflow-executor/workspace-services/workflow-executor.workspace-service'; +import { WorkflowRunWorkspaceService } from 'src/modules/workflow/workflow-runner/workspace-services/workflow-run.workspace-service'; export type RunWorkflowJobData = { workspaceId: string; diff --git a/packages/twenty-server/src/modules/workflow/workflow-runner/workflow-runner.module.ts b/packages/twenty-server/src/modules/workflow/workflow-runner/workflow-runner.module.ts index 847a14ed18fa..72871ae837e4 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-runner/workflow-runner.module.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-runner/workflow-runner.module.ts @@ -3,8 +3,8 @@ import { Module } from '@nestjs/common'; import { WorkflowCommonModule } from 'src/modules/workflow/common/workflow-common.module'; import { WorkflowExecutorModule } from 'src/modules/workflow/workflow-executor/workflow-executor.module'; import { RunWorkflowJob } from 'src/modules/workflow/workflow-runner/jobs/run-workflow.job'; -import { WorkflowRunnerWorkspaceService } from 'src/modules/workflow/workflow-runner/services/workflow-runner.workspace-service'; -import { WorkflowRunWorkspaceService } from 'src/modules/workflow/workflow-runner/services/workflow-run.workspace-service'; +import { WorkflowRunnerWorkspaceService } from 'src/modules/workflow/workflow-runner/workspace-services/workflow-runner.workspace-service'; +import { WorkflowRunWorkspaceService } from 'src/modules/workflow/workflow-runner/workspace-services/workflow-run.workspace-service'; @Module({ imports: [WorkflowCommonModule, WorkflowExecutorModule], diff --git a/packages/twenty-server/src/modules/workflow/workflow-runner/services/workflow-run.workspace-service.ts b/packages/twenty-server/src/modules/workflow/workflow-runner/workspace-services/workflow-run.workspace-service.ts similarity index 97% rename from packages/twenty-server/src/modules/workflow/workflow-runner/services/workflow-run.workspace-service.ts rename to packages/twenty-server/src/modules/workflow/workflow-runner/workspace-services/workflow-run.workspace-service.ts index 4cf525e6352f..00162c595f96 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-runner/services/workflow-run.workspace-service.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-runner/workspace-services/workflow-run.workspace-service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common'; import { ActorMetadata } from 'src/engine/metadata-modules/field-metadata/composite-types/actor.composite-type'; import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager'; -import { WorkflowCommonWorkspaceService } from 'src/modules/workflow/common/services/workflow-common.workspace-service'; +import { WorkflowCommonWorkspaceService } from 'src/modules/workflow/common/workspace-services/workflow-common.workspace-service'; import { WorkflowRunStatus, WorkflowRunWorkspaceEntity, diff --git a/packages/twenty-server/src/modules/workflow/workflow-runner/services/workflow-runner.workspace-service.ts b/packages/twenty-server/src/modules/workflow/workflow-runner/workspace-services/workflow-runner.workspace-service.ts similarity index 95% rename from packages/twenty-server/src/modules/workflow/workflow-runner/services/workflow-runner.workspace-service.ts rename to packages/twenty-server/src/modules/workflow/workflow-runner/workspace-services/workflow-runner.workspace-service.ts index a2e573dbc2cd..d3faac5f900e 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-runner/services/workflow-runner.workspace-service.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-runner/workspace-services/workflow-runner.workspace-service.ts @@ -8,7 +8,7 @@ import { RunWorkflowJob, RunWorkflowJobData, } from 'src/modules/workflow/workflow-runner/jobs/run-workflow.job'; -import { WorkflowRunWorkspaceService } from 'src/modules/workflow/workflow-runner/services/workflow-run.workspace-service'; +import { WorkflowRunWorkspaceService } from 'src/modules/workflow/workflow-runner/workspace-services/workflow-run.workspace-service'; @Injectable() export class WorkflowRunnerWorkspaceService { diff --git a/packages/twenty-server/src/modules/workflow/workflow-trigger/workflow-trigger.exception.ts b/packages/twenty-server/src/modules/workflow/workflow-trigger/exceptions/workflow-trigger.exception.ts similarity index 100% rename from packages/twenty-server/src/modules/workflow/workflow-trigger/workflow-trigger.exception.ts rename to packages/twenty-server/src/modules/workflow/workflow-trigger/exceptions/workflow-trigger.exception.ts diff --git a/packages/twenty-server/src/modules/workflow/workflow-trigger/jobs/workflow-event-trigger.job.ts b/packages/twenty-server/src/modules/workflow/workflow-trigger/jobs/workflow-event-trigger.job.ts index 786ab51d685e..10fad4d00f12 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-trigger/jobs/workflow-event-trigger.job.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-trigger/jobs/workflow-event-trigger.job.ts @@ -10,11 +10,11 @@ import { WorkflowVersionWorkspaceEntity, } from 'src/modules/workflow/common/standard-objects/workflow-version.workspace-entity'; import { WorkflowWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow.workspace-entity'; -import { WorkflowRunnerWorkspaceService } from 'src/modules/workflow/workflow-runner/services/workflow-runner.workspace-service'; +import { WorkflowRunnerWorkspaceService } from 'src/modules/workflow/workflow-runner/workspace-services/workflow-runner.workspace-service'; import { WorkflowTriggerException, WorkflowTriggerExceptionCode, -} from 'src/modules/workflow/workflow-trigger/workflow-trigger.exception'; +} from 'src/modules/workflow/workflow-trigger/exceptions/workflow-trigger.exception'; export type WorkflowEventTriggerJobData = { workspaceId: string; diff --git a/packages/twenty-server/src/modules/workflow/workflow-trigger/utils/assert-version-can-be-activated.util.ts b/packages/twenty-server/src/modules/workflow/workflow-trigger/utils/assert-version-can-be-activated.util.ts index 827e8e0161ca..ba31ffc96277 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-trigger/utils/assert-version-can-be-activated.util.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-trigger/utils/assert-version-can-be-activated.util.ts @@ -10,7 +10,7 @@ import { import { WorkflowTriggerException, WorkflowTriggerExceptionCode, -} from 'src/modules/workflow/workflow-trigger/workflow-trigger.exception'; +} from 'src/modules/workflow/workflow-trigger/exceptions/workflow-trigger.exception'; export function assertVersionCanBeActivated( workflowVersion: Omit<WorkflowVersionWorkspaceEntity, 'trigger'> & { diff --git a/packages/twenty-server/src/modules/workflow/workflow-trigger/workflow-trigger.module.ts b/packages/twenty-server/src/modules/workflow/workflow-trigger/workflow-trigger.module.ts index dbf7e6feb393..ecd72856dd5a 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-trigger/workflow-trigger.module.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-trigger/workflow-trigger.module.ts @@ -5,7 +5,7 @@ import { WorkflowCommonModule } from 'src/modules/workflow/common/workflow-commo import { WorkflowRunnerModule } from 'src/modules/workflow/workflow-runner/workflow-runner.module'; import { DatabaseEventTriggerModule } from 'src/modules/workflow/workflow-trigger/database-event-trigger/database-event-trigger.module'; import { WorkflowEventTriggerJob } from 'src/modules/workflow/workflow-trigger/jobs/workflow-event-trigger.job'; -import { WorkflowTriggerWorkspaceService } from 'src/modules/workflow/workflow-trigger/workflow-trigger.workspace-service'; +import { WorkflowTriggerWorkspaceService } from 'src/modules/workflow/workflow-trigger/workspace-services/workflow-trigger.workspace-service'; @Module({ imports: [ diff --git a/packages/twenty-server/src/modules/workflow/workflow-trigger/workflow-trigger.workspace-service.ts b/packages/twenty-server/src/modules/workflow/workflow-trigger/workspace-services/workflow-trigger.workspace-service.ts similarity index 97% rename from packages/twenty-server/src/modules/workflow/workflow-trigger/workflow-trigger.workspace-service.ts rename to packages/twenty-server/src/modules/workflow/workflow-trigger/workspace-services/workflow-trigger.workspace-service.ts index d64ea8558c0b..47d252766009 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-trigger/workflow-trigger.workspace-service.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-trigger/workspace-services/workflow-trigger.workspace-service.ts @@ -8,7 +8,7 @@ import { ScopedWorkspaceContextFactory } from 'src/engine/twenty-orm/factories/s import { WorkspaceRepository } from 'src/engine/twenty-orm/repository/workspace.repository'; import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager'; import { WorkspaceEventEmitter } from 'src/engine/workspace-event-emitter/workspace-event-emitter'; -import { WorkflowCommonWorkspaceService } from 'src/modules/workflow/common/services/workflow-common.workspace-service'; +import { WorkflowCommonWorkspaceService } from 'src/modules/workflow/common/workspace-services/workflow-common.workspace-service'; import { WorkflowVersionStatus, WorkflowVersionWorkspaceEntity, @@ -18,14 +18,14 @@ import { WorkflowTrigger, WorkflowTriggerType, } from 'src/modules/workflow/workflow-trigger/types/workflow-trigger.type'; -import { WorkflowRunnerWorkspaceService } from 'src/modules/workflow/workflow-runner/services/workflow-runner.workspace-service'; +import { WorkflowRunnerWorkspaceService } from 'src/modules/workflow/workflow-runner/workspace-services/workflow-runner.workspace-service'; import { WorkflowVersionStatusUpdate } from 'src/modules/workflow/workflow-status/jobs/workflow-statuses-update.job'; import { DatabaseEventTriggerService } from 'src/modules/workflow/workflow-trigger/database-event-trigger/database-event-trigger.service'; import { assertVersionCanBeActivated } from 'src/modules/workflow/workflow-trigger/utils/assert-version-can-be-activated.util'; import { WorkflowTriggerException, WorkflowTriggerExceptionCode, -} from 'src/modules/workflow/workflow-trigger/workflow-trigger.exception'; +} from 'src/modules/workflow/workflow-trigger/exceptions/workflow-trigger.exception'; @Injectable() export class WorkflowTriggerWorkspaceService { From b3bde02c76deb4090a431270820b147523bd7b17 Mon Sep 17 00:00:00 2001 From: martmull <martmull@hotmail.fr> Date: Wed, 11 Sep 2024 16:08:37 +0200 Subject: [PATCH 21/24] Simplify workflow/common --- .../workflow-query-validation.exception.ts | 0 .../workflow-create-many.pre-query.hook.ts | 2 +- .../workflow-create-one.pre-query.hook.ts | 2 +- .../query-hooks/workflow-query-hook.module.ts | 26 +++++++++---------- ...workflow-run-create-many.pre-query.hook.ts | 2 +- .../workflow-run-create-one.pre-query.hook.ts | 2 +- ...workflow-run-delete-many.pre-query.hook.ts | 2 +- .../workflow-run-delete-one.pre-query.hook.ts | 2 +- ...workflow-run-update-many.pre-query.hook.ts | 2 +- .../workflow-run-update-one.pre-query.hook.ts | 2 +- .../workflow-update-many.pre-query.hook.ts | 2 +- .../workflow-update-one.pre-query.hook.ts | 2 +- ...flow-version-create-many.pre-query.hook.ts | 2 +- ...kflow-version-create-one.pre-query.hook.ts | 2 +- ...flow-version-delete-many.pre-query.hook.ts | 2 +- ...kflow-version-delete-one.pre-query.hook.ts | 2 +- ...flow-version-update-many.pre-query.hook.ts | 2 +- ...kflow-version-update-one.pre-query.hook.ts | 2 +- ...sert-workflow-statuses-not-set-or-empty.ts | 2 +- .../utils/assert-workflow-statuses-not-set.ts | 2 +- .../assert-workflow-version-is-draft.util.ts | 2 +- ...ow-version-validation.workspace-service.ts | 4 +-- 22 files changed, 34 insertions(+), 34 deletions(-) rename packages/twenty-server/src/modules/workflow/common/{query-hooks => exceptions}/workflow-query-validation.exception.ts (100%) rename packages/twenty-server/src/modules/workflow/common/query-hooks/{workflow => }/workflow-create-many.pre-query.hook.ts (93%) rename packages/twenty-server/src/modules/workflow/common/query-hooks/{workflow => }/workflow-create-one.pre-query.hook.ts (92%) rename packages/twenty-server/src/modules/workflow/common/query-hooks/{workflow-run => }/workflow-run-create-many.pre-query.hook.ts (92%) rename packages/twenty-server/src/modules/workflow/common/query-hooks/{workflow-run => }/workflow-run-create-one.pre-query.hook.ts (92%) rename packages/twenty-server/src/modules/workflow/common/query-hooks/{workflow-run => }/workflow-run-delete-many.pre-query.hook.ts (92%) rename packages/twenty-server/src/modules/workflow/common/query-hooks/{workflow-run => }/workflow-run-delete-one.pre-query.hook.ts (90%) rename packages/twenty-server/src/modules/workflow/common/query-hooks/{workflow-run => }/workflow-run-update-many.pre-query.hook.ts (92%) rename packages/twenty-server/src/modules/workflow/common/query-hooks/{workflow-run => }/workflow-run-update-one.pre-query.hook.ts (92%) rename packages/twenty-server/src/modules/workflow/common/query-hooks/{workflow => }/workflow-update-many.pre-query.hook.ts (92%) rename packages/twenty-server/src/modules/workflow/common/query-hooks/{workflow => }/workflow-update-one.pre-query.hook.ts (93%) rename packages/twenty-server/src/modules/workflow/common/query-hooks/{workflow-version => }/workflow-version-create-many.pre-query.hook.ts (93%) rename packages/twenty-server/src/modules/workflow/common/query-hooks/{workflow-version => }/workflow-version-create-one.pre-query.hook.ts (92%) rename packages/twenty-server/src/modules/workflow/common/query-hooks/{workflow-version => }/workflow-version-delete-many.pre-query.hook.ts (92%) rename packages/twenty-server/src/modules/workflow/common/query-hooks/{workflow-version => }/workflow-version-delete-one.pre-query.hook.ts (91%) rename packages/twenty-server/src/modules/workflow/common/query-hooks/{workflow-version => }/workflow-version-update-many.pre-query.hook.ts (92%) rename packages/twenty-server/src/modules/workflow/common/query-hooks/{workflow-version => }/workflow-version-update-one.pre-query.hook.ts (92%) rename packages/twenty-server/src/modules/workflow/common/{query-hooks/workflow => }/utils/assert-workflow-statuses-not-set-or-empty.ts (85%) rename packages/twenty-server/src/modules/workflow/common/{query-hooks/workflow => }/utils/assert-workflow-statuses-not-set.ts (84%) rename packages/twenty-server/src/modules/workflow/common/{query-hooks/workflow-version => }/utils/assert-workflow-version-is-draft.util.ts (89%) rename packages/twenty-server/src/modules/workflow/common/{query-hooks/workflow-version/services => workspace-services}/workflow-version-validation.workspace-service.ts (94%) diff --git a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-query-validation.exception.ts b/packages/twenty-server/src/modules/workflow/common/exceptions/workflow-query-validation.exception.ts similarity index 100% rename from packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-query-validation.exception.ts rename to packages/twenty-server/src/modules/workflow/common/exceptions/workflow-query-validation.exception.ts diff --git a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow/workflow-create-many.pre-query.hook.ts b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-create-many.pre-query.hook.ts similarity index 93% rename from packages/twenty-server/src/modules/workflow/common/query-hooks/workflow/workflow-create-many.pre-query.hook.ts rename to packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-create-many.pre-query.hook.ts index cb6f6d943c5e..ecff415a8097 100644 --- a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow/workflow-create-many.pre-query.hook.ts +++ b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-create-many.pre-query.hook.ts @@ -3,7 +3,7 @@ import { CreateManyResolverArgs } from 'src/engine/api/graphql/workspace-resolve import { WorkspaceQueryHook } from 'src/engine/api/graphql/workspace-query-runner/workspace-query-hook/decorators/workspace-query-hook.decorator'; import { AuthContext } from 'src/engine/core-modules/auth/types/auth-context.type'; -import { assertWorkflowStatusesNotSetOrEmpty } from 'src/modules/workflow/common/query-hooks/workflow/utils/assert-workflow-statuses-not-set-or-empty'; +import { assertWorkflowStatusesNotSetOrEmpty } from 'src/modules/workflow/common/utils/assert-workflow-statuses-not-set-or-empty'; import { WorkflowWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow.workspace-entity'; @WorkspaceQueryHook(`workflow.createMany`) diff --git a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow/workflow-create-one.pre-query.hook.ts b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-create-one.pre-query.hook.ts similarity index 92% rename from packages/twenty-server/src/modules/workflow/common/query-hooks/workflow/workflow-create-one.pre-query.hook.ts rename to packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-create-one.pre-query.hook.ts index 92371364920b..f00b9515b6e1 100644 --- a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow/workflow-create-one.pre-query.hook.ts +++ b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-create-one.pre-query.hook.ts @@ -3,7 +3,7 @@ import { CreateOneResolverArgs } from 'src/engine/api/graphql/workspace-resolver import { WorkspaceQueryHook } from 'src/engine/api/graphql/workspace-query-runner/workspace-query-hook/decorators/workspace-query-hook.decorator'; import { AuthContext } from 'src/engine/core-modules/auth/types/auth-context.type'; -import { assertWorkflowStatusesNotSetOrEmpty } from 'src/modules/workflow/common/query-hooks/workflow/utils/assert-workflow-statuses-not-set-or-empty'; +import { assertWorkflowStatusesNotSetOrEmpty } from 'src/modules/workflow/common/utils/assert-workflow-statuses-not-set-or-empty'; import { WorkflowWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow.workspace-entity'; @WorkspaceQueryHook(`workflow.createOne`) diff --git a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-query-hook.module.ts b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-query-hook.module.ts index 0c05ca21b0b9..e8ebaa724899 100644 --- a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-query-hook.module.ts +++ b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-query-hook.module.ts @@ -1,18 +1,18 @@ import { Module } from '@nestjs/common'; -import { WorkflowRunCreateManyPreQueryHook } from 'src/modules/workflow/common/query-hooks/workflow-run/workflow-run-create-many.pre-query.hook'; -import { WorkflowRunCreateOnePreQueryHook } from 'src/modules/workflow/common/query-hooks/workflow-run/workflow-run-create-one.pre-query.hook'; -import { WorkflowVersionValidationWorkspaceService } from 'src/modules/workflow/common/query-hooks/workflow-version/services/workflow-version-validation.workspace-service'; -import { WorkflowVersionCreateManyPreQueryHook } from 'src/modules/workflow/common/query-hooks/workflow-version/workflow-version-create-many.pre-query.hook'; -import { WorkflowVersionCreateOnePreQueryHook } from 'src/modules/workflow/common/query-hooks/workflow-version/workflow-version-create-one.pre-query.hook'; -import { WorkflowVersionDeleteManyPreQueryHook } from 'src/modules/workflow/common/query-hooks/workflow-version/workflow-version-delete-many.pre-query.hook'; -import { WorkflowVersionDeleteOnePreQueryHook } from 'src/modules/workflow/common/query-hooks/workflow-version/workflow-version-delete-one.pre-query.hook'; -import { WorkflowVersionUpdateManyPreQueryHook } from 'src/modules/workflow/common/query-hooks/workflow-version/workflow-version-update-many.pre-query.hook'; -import { WorkflowVersionUpdateOnePreQueryHook } from 'src/modules/workflow/common/query-hooks/workflow-version/workflow-version-update-one.pre-query.hook'; -import { WorkflowCreateManyPreQueryHook } from 'src/modules/workflow/common/query-hooks/workflow/workflow-create-many.pre-query.hook'; -import { WorkflowCreateOnePreQueryHook } from 'src/modules/workflow/common/query-hooks/workflow/workflow-create-one.pre-query.hook'; -import { WorkflowUpdateManyPreQueryHook } from 'src/modules/workflow/common/query-hooks/workflow/workflow-update-many.pre-query.hook'; -import { WorkflowUpdateOnePreQueryHook } from 'src/modules/workflow/common/query-hooks/workflow/workflow-update-one.pre-query.hook'; +import { WorkflowRunCreateManyPreQueryHook } from 'src/modules/workflow/common/query-hooks/workflow-run-create-many.pre-query.hook'; +import { WorkflowRunCreateOnePreQueryHook } from 'src/modules/workflow/common/query-hooks/workflow-run-create-one.pre-query.hook'; +import { WorkflowVersionValidationWorkspaceService } from 'src/modules/workflow/common/workspace-services/workflow-version-validation.workspace-service'; +import { WorkflowVersionCreateManyPreQueryHook } from 'src/modules/workflow/common/query-hooks/workflow-version-create-many.pre-query.hook'; +import { WorkflowVersionCreateOnePreQueryHook } from 'src/modules/workflow/common/query-hooks/workflow-version-create-one.pre-query.hook'; +import { WorkflowVersionDeleteManyPreQueryHook } from 'src/modules/workflow/common/query-hooks/workflow-version-delete-many.pre-query.hook'; +import { WorkflowVersionDeleteOnePreQueryHook } from 'src/modules/workflow/common/query-hooks/workflow-version-delete-one.pre-query.hook'; +import { WorkflowVersionUpdateManyPreQueryHook } from 'src/modules/workflow/common/query-hooks/workflow-version-update-many.pre-query.hook'; +import { WorkflowVersionUpdateOnePreQueryHook } from 'src/modules/workflow/common/query-hooks/workflow-version-update-one.pre-query.hook'; +import { WorkflowCreateManyPreQueryHook } from 'src/modules/workflow/common/query-hooks/workflow-create-many.pre-query.hook'; +import { WorkflowCreateOnePreQueryHook } from 'src/modules/workflow/common/query-hooks/workflow-create-one.pre-query.hook'; +import { WorkflowUpdateManyPreQueryHook } from 'src/modules/workflow/common/query-hooks/workflow-update-many.pre-query.hook'; +import { WorkflowUpdateOnePreQueryHook } from 'src/modules/workflow/common/query-hooks/workflow-update-one.pre-query.hook'; import { WorkflowCommonWorkspaceService } from 'src/modules/workflow/common/workspace-services/workflow-common.workspace-service'; @Module({ diff --git a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run/workflow-run-create-many.pre-query.hook.ts b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run-create-many.pre-query.hook.ts similarity index 92% rename from packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run/workflow-run-create-many.pre-query.hook.ts rename to packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run-create-many.pre-query.hook.ts index d12dd3166309..b598f43a73be 100644 --- a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run/workflow-run-create-many.pre-query.hook.ts +++ b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run-create-many.pre-query.hook.ts @@ -5,7 +5,7 @@ import { WorkspaceQueryHook } from 'src/engine/api/graphql/workspace-query-runne import { WorkflowQueryValidationException, WorkflowQueryValidationExceptionCode, -} from 'src/modules/workflow/common/query-hooks/workflow-query-validation.exception'; +} from 'src/modules/workflow/common/exceptions/workflow-query-validation.exception'; import { WorkflowRunWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-run.workspace-entity'; @WorkspaceQueryHook(`workflowRun.createMany`) diff --git a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run/workflow-run-create-one.pre-query.hook.ts b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run-create-one.pre-query.hook.ts similarity index 92% rename from packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run/workflow-run-create-one.pre-query.hook.ts rename to packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run-create-one.pre-query.hook.ts index f8620b11b03c..0f103947727d 100644 --- a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run/workflow-run-create-one.pre-query.hook.ts +++ b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run-create-one.pre-query.hook.ts @@ -5,7 +5,7 @@ import { WorkspaceQueryHook } from 'src/engine/api/graphql/workspace-query-runne import { WorkflowQueryValidationException, WorkflowQueryValidationExceptionCode, -} from 'src/modules/workflow/common/query-hooks/workflow-query-validation.exception'; +} from 'src/modules/workflow/common/exceptions/workflow-query-validation.exception'; import { WorkflowRunWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-run.workspace-entity'; @WorkspaceQueryHook(`workflowRun.createOne`) diff --git a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run/workflow-run-delete-many.pre-query.hook.ts b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run-delete-many.pre-query.hook.ts similarity index 92% rename from packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run/workflow-run-delete-many.pre-query.hook.ts rename to packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run-delete-many.pre-query.hook.ts index da9dbbaac96d..4f791dcad095 100644 --- a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run/workflow-run-delete-many.pre-query.hook.ts +++ b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run-delete-many.pre-query.hook.ts @@ -5,7 +5,7 @@ import { WorkspaceQueryHook } from 'src/engine/api/graphql/workspace-query-runne import { WorkflowQueryValidationException, WorkflowQueryValidationExceptionCode, -} from 'src/modules/workflow/common/query-hooks/workflow-query-validation.exception'; +} from 'src/modules/workflow/common/exceptions/workflow-query-validation.exception'; import { WorkflowRunWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-run.workspace-entity'; @WorkspaceQueryHook(`workflowRun.deleteMany`) diff --git a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run/workflow-run-delete-one.pre-query.hook.ts b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run-delete-one.pre-query.hook.ts similarity index 90% rename from packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run/workflow-run-delete-one.pre-query.hook.ts rename to packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run-delete-one.pre-query.hook.ts index dcfb87744787..29bd27814742 100644 --- a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run/workflow-run-delete-one.pre-query.hook.ts +++ b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run-delete-one.pre-query.hook.ts @@ -5,7 +5,7 @@ import { WorkspaceQueryHook } from 'src/engine/api/graphql/workspace-query-runne import { WorkflowQueryValidationException, WorkflowQueryValidationExceptionCode, -} from 'src/modules/workflow/common/query-hooks/workflow-query-validation.exception'; +} from 'src/modules/workflow/common/exceptions/workflow-query-validation.exception'; @WorkspaceQueryHook(`workflowRun.deleteOne`) export class WorkflowRunDeleteOnePreQueryHook diff --git a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run/workflow-run-update-many.pre-query.hook.ts b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run-update-many.pre-query.hook.ts similarity index 92% rename from packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run/workflow-run-update-many.pre-query.hook.ts rename to packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run-update-many.pre-query.hook.ts index 5b1342ed8672..ceb835b42553 100644 --- a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run/workflow-run-update-many.pre-query.hook.ts +++ b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run-update-many.pre-query.hook.ts @@ -5,7 +5,7 @@ import { WorkspaceQueryHook } from 'src/engine/api/graphql/workspace-query-runne import { WorkflowQueryValidationException, WorkflowQueryValidationExceptionCode, -} from 'src/modules/workflow/common/query-hooks/workflow-query-validation.exception'; +} from 'src/modules/workflow/common/exceptions/workflow-query-validation.exception'; import { WorkflowRunWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-run.workspace-entity'; @WorkspaceQueryHook(`workflowRun.updateMany`) diff --git a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run/workflow-run-update-one.pre-query.hook.ts b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run-update-one.pre-query.hook.ts similarity index 92% rename from packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run/workflow-run-update-one.pre-query.hook.ts rename to packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run-update-one.pre-query.hook.ts index f33f1783c642..385da0f9dbce 100644 --- a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run/workflow-run-update-one.pre-query.hook.ts +++ b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-run-update-one.pre-query.hook.ts @@ -5,7 +5,7 @@ import { WorkspaceQueryHook } from 'src/engine/api/graphql/workspace-query-runne import { WorkflowQueryValidationException, WorkflowQueryValidationExceptionCode, -} from 'src/modules/workflow/common/query-hooks/workflow-query-validation.exception'; +} from 'src/modules/workflow/common/exceptions/workflow-query-validation.exception'; import { WorkflowRunWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-run.workspace-entity'; @WorkspaceQueryHook(`workflowRun.updateOne`) diff --git a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow/workflow-update-many.pre-query.hook.ts b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-update-many.pre-query.hook.ts similarity index 92% rename from packages/twenty-server/src/modules/workflow/common/query-hooks/workflow/workflow-update-many.pre-query.hook.ts rename to packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-update-many.pre-query.hook.ts index e18e1d017ed8..fa802edb2fa0 100644 --- a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow/workflow-update-many.pre-query.hook.ts +++ b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-update-many.pre-query.hook.ts @@ -5,7 +5,7 @@ import { WorkspaceQueryHook } from 'src/engine/api/graphql/workspace-query-runne import { WorkflowQueryValidationException, WorkflowQueryValidationExceptionCode, -} from 'src/modules/workflow/common/query-hooks/workflow-query-validation.exception'; +} from 'src/modules/workflow/common/exceptions/workflow-query-validation.exception'; import { WorkflowWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow.workspace-entity'; @WorkspaceQueryHook(`workflow.updateMany`) diff --git a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow/workflow-update-one.pre-query.hook.ts b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-update-one.pre-query.hook.ts similarity index 93% rename from packages/twenty-server/src/modules/workflow/common/query-hooks/workflow/workflow-update-one.pre-query.hook.ts rename to packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-update-one.pre-query.hook.ts index 096c8044ef3e..0c57c119cc90 100644 --- a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow/workflow-update-one.pre-query.hook.ts +++ b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-update-one.pre-query.hook.ts @@ -3,7 +3,7 @@ import { UpdateOneResolverArgs } from 'src/engine/api/graphql/workspace-resolver import { WorkspaceQueryHook } from 'src/engine/api/graphql/workspace-query-runner/workspace-query-hook/decorators/workspace-query-hook.decorator'; import { AuthContext } from 'src/engine/core-modules/auth/types/auth-context.type'; -import { assertWorkflowStatusesNotSet } from 'src/modules/workflow/common/query-hooks/workflow/utils/assert-workflow-statuses-not-set'; +import { assertWorkflowStatusesNotSet } from 'src/modules/workflow/common/utils/assert-workflow-statuses-not-set'; import { WorkflowWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow.workspace-entity'; @WorkspaceQueryHook(`workflow.updateOne`) diff --git a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/workflow-version-create-many.pre-query.hook.ts b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version-create-many.pre-query.hook.ts similarity index 93% rename from packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/workflow-version-create-many.pre-query.hook.ts rename to packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version-create-many.pre-query.hook.ts index 8d27ac88bf9c..51849295a70f 100644 --- a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/workflow-version-create-many.pre-query.hook.ts +++ b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version-create-many.pre-query.hook.ts @@ -6,7 +6,7 @@ import { import { WorkspaceQueryHook } from 'src/engine/api/graphql/workspace-query-runner/workspace-query-hook/decorators/workspace-query-hook.decorator'; import { AuthContext } from 'src/engine/core-modules/auth/types/auth-context.type'; -import { WorkflowVersionValidationWorkspaceService } from 'src/modules/workflow/common/query-hooks/workflow-version/services/workflow-version-validation.workspace-service'; +import { WorkflowVersionValidationWorkspaceService } from 'src/modules/workflow/common/workspace-services/workflow-version-validation.workspace-service'; import { WorkflowVersionWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-version.workspace-entity'; @WorkspaceQueryHook(`workflowVersion.createMany`) diff --git a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/workflow-version-create-one.pre-query.hook.ts b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version-create-one.pre-query.hook.ts similarity index 92% rename from packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/workflow-version-create-one.pre-query.hook.ts rename to packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version-create-one.pre-query.hook.ts index 98d5c9d05d1b..0741ec96d39d 100644 --- a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/workflow-version-create-one.pre-query.hook.ts +++ b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version-create-one.pre-query.hook.ts @@ -3,7 +3,7 @@ import { CreateOneResolverArgs } from 'src/engine/api/graphql/workspace-resolver import { WorkspaceQueryHook } from 'src/engine/api/graphql/workspace-query-runner/workspace-query-hook/decorators/workspace-query-hook.decorator'; import { AuthContext } from 'src/engine/core-modules/auth/types/auth-context.type'; -import { WorkflowVersionValidationWorkspaceService } from 'src/modules/workflow/common/query-hooks/workflow-version/services/workflow-version-validation.workspace-service'; +import { WorkflowVersionValidationWorkspaceService } from 'src/modules/workflow/common/workspace-services/workflow-version-validation.workspace-service'; import { WorkflowVersionWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-version.workspace-entity'; @WorkspaceQueryHook(`workflowVersion.createOne`) diff --git a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/workflow-version-delete-many.pre-query.hook.ts b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version-delete-many.pre-query.hook.ts similarity index 92% rename from packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/workflow-version-delete-many.pre-query.hook.ts rename to packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version-delete-many.pre-query.hook.ts index f47e11472397..35279e1e347c 100644 --- a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/workflow-version-delete-many.pre-query.hook.ts +++ b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version-delete-many.pre-query.hook.ts @@ -5,7 +5,7 @@ import { WorkspaceQueryHook } from 'src/engine/api/graphql/workspace-query-runne import { WorkflowQueryValidationException, WorkflowQueryValidationExceptionCode, -} from 'src/modules/workflow/common/query-hooks/workflow-query-validation.exception'; +} from 'src/modules/workflow/common/exceptions/workflow-query-validation.exception'; import { WorkflowVersionWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-version.workspace-entity'; @WorkspaceQueryHook(`workflowVersion.deleteMany`) diff --git a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/workflow-version-delete-one.pre-query.hook.ts b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version-delete-one.pre-query.hook.ts similarity index 91% rename from packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/workflow-version-delete-one.pre-query.hook.ts rename to packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version-delete-one.pre-query.hook.ts index f4cd1a48f1fe..75304e77e24c 100644 --- a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/workflow-version-delete-one.pre-query.hook.ts +++ b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version-delete-one.pre-query.hook.ts @@ -3,7 +3,7 @@ import { DeleteOneResolverArgs } from 'src/engine/api/graphql/workspace-resolver import { WorkspaceQueryHook } from 'src/engine/api/graphql/workspace-query-runner/workspace-query-hook/decorators/workspace-query-hook.decorator'; import { AuthContext } from 'src/engine/core-modules/auth/types/auth-context.type'; -import { WorkflowVersionValidationWorkspaceService } from 'src/modules/workflow/common/query-hooks/workflow-version/services/workflow-version-validation.workspace-service'; +import { WorkflowVersionValidationWorkspaceService } from 'src/modules/workflow/common/workspace-services/workflow-version-validation.workspace-service'; @WorkspaceQueryHook(`workflowVersion.deleteOne`) export class WorkflowVersionDeleteOnePreQueryHook diff --git a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/workflow-version-update-many.pre-query.hook.ts b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version-update-many.pre-query.hook.ts similarity index 92% rename from packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/workflow-version-update-many.pre-query.hook.ts rename to packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version-update-many.pre-query.hook.ts index beba6071f4ae..5a8e52060f6a 100644 --- a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/workflow-version-update-many.pre-query.hook.ts +++ b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version-update-many.pre-query.hook.ts @@ -5,7 +5,7 @@ import { WorkspaceQueryHook } from 'src/engine/api/graphql/workspace-query-runne import { WorkflowQueryValidationException, WorkflowQueryValidationExceptionCode, -} from 'src/modules/workflow/common/query-hooks/workflow-query-validation.exception'; +} from 'src/modules/workflow/common/exceptions/workflow-query-validation.exception'; import { WorkflowVersionWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-version.workspace-entity'; @WorkspaceQueryHook(`workflowVersion.updateMany`) diff --git a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/workflow-version-update-one.pre-query.hook.ts b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version-update-one.pre-query.hook.ts similarity index 92% rename from packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/workflow-version-update-one.pre-query.hook.ts rename to packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version-update-one.pre-query.hook.ts index a8421cc113b0..584e834d82db 100644 --- a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/workflow-version-update-one.pre-query.hook.ts +++ b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version-update-one.pre-query.hook.ts @@ -3,7 +3,7 @@ import { UpdateOneResolverArgs } from 'src/engine/api/graphql/workspace-resolver import { WorkspaceQueryHook } from 'src/engine/api/graphql/workspace-query-runner/workspace-query-hook/decorators/workspace-query-hook.decorator'; import { AuthContext } from 'src/engine/core-modules/auth/types/auth-context.type'; -import { WorkflowVersionValidationWorkspaceService } from 'src/modules/workflow/common/query-hooks/workflow-version/services/workflow-version-validation.workspace-service'; +import { WorkflowVersionValidationWorkspaceService } from 'src/modules/workflow/common/workspace-services/workflow-version-validation.workspace-service'; import { WorkflowVersionWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-version.workspace-entity'; @WorkspaceQueryHook(`workflowVersion.updateOne`) diff --git a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow/utils/assert-workflow-statuses-not-set-or-empty.ts b/packages/twenty-server/src/modules/workflow/common/utils/assert-workflow-statuses-not-set-or-empty.ts similarity index 85% rename from packages/twenty-server/src/modules/workflow/common/query-hooks/workflow/utils/assert-workflow-statuses-not-set-or-empty.ts rename to packages/twenty-server/src/modules/workflow/common/utils/assert-workflow-statuses-not-set-or-empty.ts index 1bead159279e..ca9b73197581 100644 --- a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow/utils/assert-workflow-statuses-not-set-or-empty.ts +++ b/packages/twenty-server/src/modules/workflow/common/utils/assert-workflow-statuses-not-set-or-empty.ts @@ -1,7 +1,7 @@ import { WorkflowQueryValidationException, WorkflowQueryValidationExceptionCode, -} from 'src/modules/workflow/common/query-hooks/workflow-query-validation.exception'; +} from 'src/modules/workflow/common/exceptions/workflow-query-validation.exception'; import { WorkflowStatus } from 'src/modules/workflow/common/standard-objects/workflow.workspace-entity'; export const assertWorkflowStatusesNotSetOrEmpty = ( diff --git a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow/utils/assert-workflow-statuses-not-set.ts b/packages/twenty-server/src/modules/workflow/common/utils/assert-workflow-statuses-not-set.ts similarity index 84% rename from packages/twenty-server/src/modules/workflow/common/query-hooks/workflow/utils/assert-workflow-statuses-not-set.ts rename to packages/twenty-server/src/modules/workflow/common/utils/assert-workflow-statuses-not-set.ts index 0949551c262b..e16f026c787d 100644 --- a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow/utils/assert-workflow-statuses-not-set.ts +++ b/packages/twenty-server/src/modules/workflow/common/utils/assert-workflow-statuses-not-set.ts @@ -1,7 +1,7 @@ import { WorkflowQueryValidationException, WorkflowQueryValidationExceptionCode, -} from 'src/modules/workflow/common/query-hooks/workflow-query-validation.exception'; +} from 'src/modules/workflow/common/exceptions/workflow-query-validation.exception'; import { WorkflowStatus } from 'src/modules/workflow/common/standard-objects/workflow.workspace-entity'; export const assertWorkflowStatusesNotSet = ( diff --git a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/utils/assert-workflow-version-is-draft.util.ts b/packages/twenty-server/src/modules/workflow/common/utils/assert-workflow-version-is-draft.util.ts similarity index 89% rename from packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/utils/assert-workflow-version-is-draft.util.ts rename to packages/twenty-server/src/modules/workflow/common/utils/assert-workflow-version-is-draft.util.ts index 23a8a617c1b2..6c55ef5c54b1 100644 --- a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/utils/assert-workflow-version-is-draft.util.ts +++ b/packages/twenty-server/src/modules/workflow/common/utils/assert-workflow-version-is-draft.util.ts @@ -1,7 +1,7 @@ import { WorkflowQueryValidationException, WorkflowQueryValidationExceptionCode, -} from 'src/modules/workflow/common/query-hooks/workflow-query-validation.exception'; +} from 'src/modules/workflow/common/exceptions/workflow-query-validation.exception'; import { WorkflowVersionStatus, WorkflowVersionWorkspaceEntity, diff --git a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/services/workflow-version-validation.workspace-service.ts b/packages/twenty-server/src/modules/workflow/common/workspace-services/workflow-version-validation.workspace-service.ts similarity index 94% rename from packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/services/workflow-version-validation.workspace-service.ts rename to packages/twenty-server/src/modules/workflow/common/workspace-services/workflow-version-validation.workspace-service.ts index e4959affc531..1a9054ccc117 100644 --- a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-version/services/workflow-version-validation.workspace-service.ts +++ b/packages/twenty-server/src/modules/workflow/common/workspace-services/workflow-version-validation.workspace-service.ts @@ -10,8 +10,8 @@ import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager'; import { WorkflowQueryValidationException, WorkflowQueryValidationExceptionCode, -} from 'src/modules/workflow/common/query-hooks/workflow-query-validation.exception'; -import { assertWorkflowVersionIsDraft } from 'src/modules/workflow/common/query-hooks/workflow-version/utils/assert-workflow-version-is-draft.util'; +} from 'src/modules/workflow/common/exceptions/workflow-query-validation.exception'; +import { assertWorkflowVersionIsDraft } from 'src/modules/workflow/common/utils/assert-workflow-version-is-draft.util'; import { WorkflowCommonWorkspaceService } from 'src/modules/workflow/common/workspace-services/workflow-common.workspace-service'; import { WorkflowVersionStatus, From 6ecd69d094da5d69631babf699ab56bfcde27955 Mon Sep 17 00:00:00 2001 From: martmull <martmull@hotmail.fr> Date: Wed, 11 Sep 2024 16:30:19 +0200 Subject: [PATCH 22/24] Merge integration and core_modules --- packages/twenty-server/src/app.module.ts | 7 +- packages/twenty-server/src/command/command.ts | 4 +- ...t-data-seed-demo-workspace.cron.command.ts | 6 +- ...p-data-seed-demo-workspace.cron.command.ts | 6 +- .../data-seed-demo-workspace.module.ts | 2 +- .../jobs/data-seed-demo-workspace.job.ts | 6 +- .../data-seed-demo-workspace.service.ts | 2 +- .../data-seed-dev-workspace.command.ts | 6 +- .../0-24/0-24-upgrade-version.module.ts | 2 +- .../src/database/typeorm/typeorm.module.ts | 2 +- .../src/database/typeorm/typeorm.service.ts | 2 +- .../graphql-config/graphql-config.service.ts | 6 +- .../graphql/metadata-graphql-api.module.ts | 6 +- .../api/graphql/metadata.module-factory.ts | 6 +- .../0-20-record-position-backfill.command.ts | 6 +- .../jobs/call-webhook-jobs.job.ts | 10 +-- .../jobs/call-webhook.job.ts | 6 +- .../jobs/record-position-backfill.job.ts | 6 +- .../listeners/entity-events-to-db.listener.ts | 14 ++-- .../listeners/telemetry.listener.ts | 4 +- .../workspace-query-runner.service.ts | 14 ++-- .../core-query-builder.factory.ts | 2 +- .../src/engine/api/rest/rest-api.service.ts | 2 +- .../ai-sql-query/ai-sql-query.module.ts | 6 +- .../ai-sql-query/ai-sql-query.service.ts | 4 +- .../analytics/analytics.resolver.spec.ts | 2 +- .../analytics/analytics.resolver.ts | 2 +- .../analytics/analytics.service.spec.ts | 2 +- .../analytics/analytics.service.ts | 2 +- .../core-modules/auth/auth.resolver.spec.ts | 2 +- .../engine/core-modules/auth/auth.resolver.ts | 2 +- .../google-apis-auth.controller.ts | 2 +- ...pis-oauth-exchange-code-for-token.guard.ts | 2 +- .../google-apis-oauth-request-code.guard.ts | 2 +- .../guards/google-provider-enabled.guard.ts | 2 +- .../microsoft-provider-enabled.guard.ts | 2 +- .../auth/services/auth.service.spec.ts | 4 +- .../auth/services/auth.service.ts | 6 +- .../auth/services/google-apis.service.ts | 8 +- .../auth/services/sign-in-up.service.spec.ts | 2 +- .../auth/services/sign-in-up.service.ts | 2 +- .../auth/services/token.service.spec.ts | 4 +- .../auth/services/token.service.ts | 4 +- .../google-apis-oauth-common.auth.strategy.ts | 2 +- ...h-exchange-code-for-token.auth.strategy.ts | 2 +- ...e-apis-oauth-request-code.auth.strategy.ts | 2 +- .../auth/strategies/google.auth.strategy.ts | 2 +- .../auth/strategies/jwt.auth.strategy.ts | 2 +- .../strategies/microsoft.auth.strategy.ts | 2 +- .../billing/jobs/update-subscription.job.ts | 6 +- .../billing-workspace-member.listener.ts | 10 +-- .../billing-portal.workspace-service.ts | 2 +- .../services/billing-subscription.service.ts | 2 +- .../billing/services/billing.service.ts | 2 +- .../billing/stripe/stripe.service.ts | 2 +- .../cache-storage.module-factory.ts | 4 +- .../cache-storage/cache-storage.module.ts | 8 +- .../cache-storage/cache-storage.service.ts | 2 +- .../decorators/cache-storage.decorator.ts | 2 +- .../types/cache-storage-namespace.enum.ts | 0 .../types/cache-storage-type.enum.ts | 0 .../captcha/captcha.constants.ts | 0 .../captcha/captcha.guard.ts | 2 +- .../captcha/captcha.module-factory.ts | 4 +- .../captcha/captcha.module.ts | 10 +-- .../captcha/captcha.service.ts | 6 +- .../drivers/google-recaptcha.driver.ts | 6 +- .../interfaces/captcha-driver.interface.ts | 2 +- .../interfaces/captcha-server-response.ts | 0 .../captcha/drivers/turnstile.driver.ts | 6 +- .../captcha/interfaces/captcha.interface.ts | 0 .../core-modules/captcha/interfaces/index.ts | 1 + .../client-config/client-config.entity.ts | 2 +- .../client-config.resolver.spec.ts | 2 +- .../client-config/client-config.resolver.ts | 2 +- .../engine/core-modules/core-engine.module.ts | 69 ++++++++++++++++- .../interfaces/email-driver.interface.ts | 0 .../email/drivers/logger.driver.ts | 2 +- .../email/drivers/smtp.driver.ts | 2 +- .../email/email-sender.job.ts | 8 +- .../email/email-sender.service.ts | 4 +- .../email/email.constants.ts | 0 .../email/email.module-factory.ts | 4 +- .../email/email.module.ts | 12 +-- .../email/email.service.ts | 8 +- .../email/interfaces/email.interface.ts | 0 .../cast-to-log-level-array.decorator.spec.ts | 2 +- .../cast-to-positive-number.decorator.spec.ts | 2 +- .../decorators/cast-to-boolean.decorator.ts | 0 .../cast-to-log-level-array.decorator.ts | 0 .../cast-to-positive-number.decorator.ts | 0 .../cast-to-string-array.decorator.ts | 0 .../decorators/is-aws-region.decorator.ts | 0 .../decorators/is-duration.decorator.ts | 0 .../is-strictly-lower-than.decorator.ts | 0 .../environment/environment-variables.ts | 42 +++++----- .../environment.module-definition.ts | 0 .../environment/environment.module.ts | 6 +- .../environment/environment.service.spec.ts | 2 +- .../environment/environment.service.ts | 2 +- .../interfaces/aws-region.interface.ts | 0 .../interfaces/node-environment.interface.ts | 0 .../interfaces/support.interface.ts | 0 .../types/object-record-create.event.ts | 2 +- .../types/object-record-delete.event.ts | 2 +- .../types/object-record-update.event.ts | 2 +- .../types/object-record.base.event.ts | 0 .../object-record-changed-values.spec.ts | 2 +- .../object-record-changed-properties.util.ts | 0 .../utils/object-record-changed-values.ts | 0 .../utils/object-record-diff-merge.ts | 0 .../exception-handler.service.spec.ts | 4 +- .../drivers/console.driver.ts | 6 +- .../drivers/sentry.driver.ts | 6 +- .../exception-handler.constants.ts | 0 .../exception-handler.module-definition.ts | 2 +- .../exception-handler.module-factory.ts | 6 +- .../exception-handler.module.ts | 12 +-- .../exception-handler.service.ts | 6 +- .../hooks/use-sentry-tracing.ts | 0 .../exception-handler-driver.interface.ts | 10 +++ .../exception-handler-options.interface.ts | 2 +- .../exception-handler-user.interface.ts | 0 .../interfaces/exception-handler.interface.ts | 0 .../exception-handler/interfaces/index.ts | 2 + .../__tests__/file-storage.service.spec.ts | 4 +- .../interfaces/storage-driver.interface.ts | 0 .../file-storage/drivers/local.driver.ts | 4 +- .../file-storage/drivers/s3.driver.ts | 4 +- .../file-storage/file-storage.constants.ts | 0 .../file-storage.module-definition.ts | 2 +- .../file-storage.module-factory.ts | 4 +- .../file-storage/file-storage.module.ts | 10 +-- .../file-storage/file-storage.service.ts | 4 +- .../interfaces/file-storage-exception.ts | 0 .../interfaces/file-storage.interface.ts | 4 +- .../file-storage/interfaces/index.ts | 1 + .../file-storage/utils/read-file-content.ts | 0 .../file/controllers/file.controller.ts | 2 +- .../file/file-upload/file-upload.module.ts | 2 +- .../services/file-upload.service.ts | 2 +- .../engine/core-modules/file/file.module.ts | 2 +- .../file/guards/file-path-guard.ts | 2 +- .../file/services/file.service.spec.ts | 4 +- .../file/services/file.service.ts | 4 +- .../graphql/engine-graphql.module.ts | 2 +- .../hooks/use-graphql-error-handler.hook.ts | 2 +- .../src/engine/core-modules/jwt/jwt.module.ts | 4 +- .../llm-prompt-template-driver.interface.ts | 0 .../llm-chat-model/drivers/openai.driver.ts | 2 +- .../interfaces/llm-chat-model.interface.ts | 0 .../llm-chat-model.constants.ts | 0 .../llm-chat-model.module-factory.ts | 4 +- .../llm-chat-model/llm-chat-model.module.ts | 8 +- .../llm-chat-model/llm-chat-model.service.ts | 4 +- .../llm-tracing/drivers/console.driver.ts | 2 +- .../llm-tracing-driver.interface.ts | 0 .../llm-tracing/drivers/langfuse.driver.ts | 2 +- .../interfaces/llm-tracing.interface.ts | 2 +- .../llm-tracing/llm-tracing.constants.ts | 0 .../llm-tracing/llm-tracing.module-factory.ts | 4 +- .../llm-tracing/llm-tracing.module.ts | 10 +-- .../llm-tracing/llm-tracing.service.ts | 4 +- .../logger/__tests__/logger.service.spec.ts | 4 +- .../core-modules/logger/interfaces/index.ts | 1 + .../logger/interfaces/logger.interface.ts | 0 .../logger/logger.constants.ts | 0 .../logger/logger.module-definition.ts | 2 +- .../logger/logger.module-factory.ts | 4 +- .../logger/logger.module.ts | 8 +- .../logger/logger.service.ts | 2 +- .../decorators/message-queue.decorator.ts | 4 +- .../decorators/process.decorator.ts | 2 +- .../decorators/processor.decorator.ts | 4 +- .../message-queue/drivers/bullmq.driver.ts | 10 +-- .../interfaces/job-options.interface.ts | 0 .../message-queue-driver.interface.ts | 8 +- .../message-queue/drivers/pg-boss.driver.ts | 10 +-- .../message-queue/drivers/sync.driver.ts | 6 +- .../message-queue/interfaces/index.ts | 1 + .../interfaces/message-queue-job.interface.ts | 0 .../message-queue-module-options.interface.ts | 4 +- .../message-queue-worker-options.interface.ts | 0 .../message-queue/jobs.module.ts | 4 +- .../message-queue-core.module.ts | 18 ++--- .../message-queue-metadata.accessor.ts | 6 +- .../message-queue/message-queue.constants.ts | 0 .../message-queue/message-queue.explorer.ts | 12 +-- .../message-queue.module-definition.ts | 2 +- .../message-queue.module-factory.ts | 4 +- .../message-queue/message-queue.module.ts | 8 +- ...essage-queue-task-assigned.service.spec.ts | 6 +- .../services/message-queue.service.ts | 10 +-- .../utils/get-queue-token.util.ts | 0 .../open-api/open-api.service.spec.ts | 2 +- .../core-modules/open-api/open-api.service.ts | 2 +- .../postgres-credentials.module.ts | 2 +- .../postgres-credentials.service.ts | 2 +- .../drivers/base-serverless.driver.ts | 10 +-- .../drivers/constants/build-file-name.ts | 0 .../drivers/constants/common-layer-name.ts | 0 .../constants/serverless-tmpdir-folder.ts | 0 .../drivers/constants/source-file-name.ts | 0 .../interfaces/serverless-driver.interface.ts | 0 .../serverless/drivers/lambda.driver.ts | 14 ++-- .../serverless/drivers/layers/1/package.json | 0 .../serverless/drivers/layers/1/yarn.lock | 0 .../engine/.yarn/releases/yarn-4.4.0.cjs | 0 .../drivers/layers/engine/.yarnrc.yml | 0 .../drivers/layers/last-layer-version.ts | 0 .../serverless/drivers/local.driver.ts | 20 ++--- .../drivers/utils/compile-typescript.ts | 0 .../utils/copy-and-build-dependencies.ts | 2 +- .../drivers/utils/create-zip-file.ts | 0 .../utils/get-last-layer-dependencies.ts | 2 +- .../utils/get-layer-dependencies-dir-name.ts | 2 +- .../utils/lambda-build-directory-manager.ts | 2 +- .../serverless/serverless-module.factory.ts | 6 +- .../serverless/serverless.constants.ts | 0 .../serverless/serverless.interface.ts | 4 +- .../serverless/serverless.module.ts | 10 +-- .../serverless/serverless.service.ts | 4 +- .../utils/serverless-get-folder.utils.ts | 0 .../throttler/throttler.service.ts | 6 +- .../user-workspace/user-workspace.service.ts | 2 +- .../user/services/user.service.ts | 2 +- .../engine/core-modules/user/user.resolver.ts | 4 +- .../handle-workspace-member-deleted.job.ts | 6 +- .../services/workspace.service.spec.ts | 4 +- .../workspace/services/workspace.service.ts | 4 +- .../workspace-workspace-member.listener.ts | 10 +-- .../src/engine/guards/demo.env.guard.ts | 2 +- .../integrations/captcha/interfaces/index.ts | 1 - .../exception-handler-driver.interface.ts | 10 --- .../exception-handler/interfaces/index.ts | 2 - .../file-storage/interfaces/index.ts | 1 - .../integrations/integrations.module.ts | 76 ------------------- .../integrations/logger/interfaces/index.ts | 1 - .../message-queue/interfaces/index.ts | 1 - ...-field-metadata-default-value.validator.ts | 2 +- .../remote-server/remote-server.service.ts | 2 +- .../serverless-function.module.ts | 2 +- .../serverless-function.service.ts | 20 ++--- ...l-hydrate-request-from-token.middleware.ts | 2 +- .../factories/workspace-datasource.factory.ts | 2 +- .../utils/global-exception-handler.util.ts | 4 +- .../workspace-cache-storage.service.ts | 6 +- .../clean-inactive-workspaces.command.ts | 6 +- ...-clean-inactive-workspaces.cron.command.ts | 6 +- ...-clean-inactive-workspaces.cron.command.ts | 6 +- .../crons/clean-inactive-workspace.job.ts | 10 +-- .../services/workspace-status.service.ts | 2 +- .../workspace-manager.module.ts | 2 +- packages/twenty-server/src/main.ts | 2 +- ...ocklist-item-delete-calendar-events.job.ts | 8 +- .../blocklist-reimport-calendar-events.job.ts | 8 +- .../listeners/calendar-blocklist.listener.ts | 12 +-- ...ed-account-associated-calendar-data.job.ts | 6 +- ...vent-cleaner-connected-account.listener.ts | 8 +- .../calendar-event-list-fetch.cron.command.ts | 6 +- .../calendar-ongoing-stale.cron.command.ts | 6 +- .../calendar-event-list-fetch.cron.job.ts | 12 +-- .../jobs/calendar-ongoing-stale.cron.job.ts | 12 +-- .../google-calendar-driver.module.ts | 2 +- .../jobs/calendar-event-list-fetch.job.ts | 6 +- .../jobs/calendar-ongoing-stale.job.ts | 6 +- .../services/calendar-save-events.service.ts | 6 +- ...eate-company-and-contact-after-sync.job.ts | 6 +- ...event-participant-match-participant.job.ts | 6 +- ...ent-participant-unmatch-participant.job.ts | 6 +- ...endar-event-participant-person.listener.ts | 12 +-- ...t-participant-workspace-member.listener.ts | 12 +-- .../calendar-channel-sync-status.service.ts | 6 +- .../listeners/connected-account.listener.ts | 2 +- .../google-oauth2-client-manager.service.ts | 2 +- ...ected-account-delete-one.pre-query.hook.ts | 2 +- ...google-api-refresh-access-token.service.ts | 2 +- .../jobs/create-company-and-contact.job.ts | 6 +- ...acts-creation-calendar-channel.listener.ts | 10 +-- ...tacts-creation-message-channel.listener.ts | 10 +-- .../create-company-and-contact.service.ts | 2 +- ...ging-blocklist-item-delete-messages.job.ts | 8 +- ...ssaging-blocklist-reimport-messages.job.ts | 8 +- .../listeners/messaging-blocklist.listener.ts | 12 +-- .../message-channel-sync-status.service.ts | 6 +- ...-connected-account-deletion-cleanup.job.ts | 6 +- ...sage-cleaner-connected-account.listener.ts | 8 +- ...messaging-single-message-import.command.ts | 6 +- ...ssaging-message-list-fetch.cron.command.ts | 6 +- .../messaging-messages-import.cron.command.ts | 6 +- .../messaging-ongoing-stale.cron.command.ts | 6 +- .../messaging-message-list-fetch.cron.job.ts | 12 +-- .../messaging-messages-import.cron.job.ts | 12 +-- .../jobs/messaging-ongoing-stale.cron.job.ts | 12 +-- .../gmail/messaging-gmail-driver.module.ts | 2 +- ...-single-message-to-cache-for-import.job.ts | 12 +-- .../jobs/messaging-clean-cache.ts | 12 +-- .../jobs/messaging-message-list-fetch.job.ts | 6 +- .../jobs/messaging-messages-import.job.ts | 6 +- .../jobs/messaging-ongoing-stale.job.ts | 6 +- ...import-manager-message-channel.listener.ts | 8 +- ...ssaging-full-message-list-fetch.service.ts | 6 +- .../messaging-messages-import.service.ts | 6 +- ...ging-partial-message-list-fetch.service.ts | 6 +- ...es-and-enqueue-contact-creation.service.ts | 6 +- ...ssage-participant-match-participant.job.ts | 6 +- ...age-participant-unmatch-participant.job.ts | 6 +- ...eate-company-and-contact-after-sync.job.ts | 6 +- .../message-participant-person.listener.ts | 12 +-- ...e-participant-workspace-member.listener.ts | 12 +-- ...nel-sync-status-monitoring.cron.command.ts | 6 +- ...age-channel-sync-status-monitoring.cron.ts | 6 +- .../services/messaging-telemetry.service.ts | 2 +- .../create-audit-log-from-internal-event.ts | 8 +- ...meline-activity-from-internal-event.job.ts | 8 +- .../timeline-activity.repository.ts | 2 +- .../services/timeline-activity.service.ts | 2 +- .../send-email.workflow-step-executor.ts | 4 +- .../workflow-runner/jobs/run-workflow.job.ts | 6 +- .../workflow-runner.workspace-service.ts | 6 +- .../jobs/workflow-statuses-update.job.ts | 6 +- .../workflow-version-status.listener.ts | 10 +-- .../database-event-trigger.listener.ts | 12 +-- .../jobs/workflow-event-trigger.job.ts | 6 +- .../src/queue-worker/queue-worker.module.ts | 8 +- .../src/queue-worker/queue-worker.ts | 4 +- 326 files changed, 769 insertions(+), 783 deletions(-) rename packages/twenty-server/src/engine/{integrations => core-modules}/cache-storage/cache-storage.module-factory.ts (91%) rename packages/twenty-server/src/engine/{integrations => core-modules}/cache-storage/cache-storage.module.ts (79%) rename packages/twenty-server/src/engine/{integrations => core-modules}/cache-storage/cache-storage.service.ts (96%) rename packages/twenty-server/src/engine/{integrations => core-modules}/cache-storage/decorators/cache-storage.decorator.ts (78%) rename packages/twenty-server/src/engine/{integrations => core-modules}/cache-storage/types/cache-storage-namespace.enum.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/cache-storage/types/cache-storage-type.enum.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/captcha/captcha.constants.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/captcha/captcha.guard.ts (91%) rename packages/twenty-server/src/engine/{integrations => core-modules}/captcha/captcha.module-factory.ts (85%) rename packages/twenty-server/src/engine/{integrations => core-modules}/captcha/captcha.module.ts (76%) rename packages/twenty-server/src/engine/{integrations => core-modules}/captcha/captcha.service.ts (71%) rename packages/twenty-server/src/engine/{integrations => core-modules}/captcha/drivers/google-recaptcha.driver.ts (86%) rename packages/twenty-server/src/engine/{integrations => core-modules}/captcha/drivers/interfaces/captcha-driver.interface.ts (64%) rename packages/twenty-server/src/engine/{integrations => core-modules}/captcha/drivers/interfaces/captcha-server-response.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/captcha/drivers/turnstile.driver.ts (86%) rename packages/twenty-server/src/engine/{integrations => core-modules}/captcha/interfaces/captcha.interface.ts (100%) create mode 100644 packages/twenty-server/src/engine/core-modules/captcha/interfaces/index.ts rename packages/twenty-server/src/engine/{integrations => core-modules}/email/drivers/interfaces/email-driver.interface.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/email/drivers/logger.driver.ts (90%) rename packages/twenty-server/src/engine/{integrations => core-modules}/email/drivers/smtp.driver.ts (92%) rename packages/twenty-server/src/engine/{integrations => core-modules}/email/email-sender.job.ts (63%) rename packages/twenty-server/src/engine/{integrations => core-modules}/email/email-sender.service.ts (76%) rename packages/twenty-server/src/engine/{integrations => core-modules}/email/email.constants.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/email/email.module-factory.ts (89%) rename packages/twenty-server/src/engine/{integrations => core-modules}/email/email.module.ts (65%) rename packages/twenty-server/src/engine/{integrations => core-modules}/email/email.service.ts (70%) rename packages/twenty-server/src/engine/{integrations => core-modules}/email/interfaces/email.interface.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/environment/decorators/__tests__/cast-to-log-level-array.decorator.spec.ts (96%) rename packages/twenty-server/src/engine/{integrations => core-modules}/environment/decorators/__tests__/cast-to-positive-number.decorator.spec.ts (96%) rename packages/twenty-server/src/engine/{integrations => core-modules}/environment/decorators/cast-to-boolean.decorator.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/environment/decorators/cast-to-log-level-array.decorator.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/environment/decorators/cast-to-positive-number.decorator.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/environment/decorators/cast-to-string-array.decorator.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/environment/decorators/is-aws-region.decorator.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/environment/decorators/is-duration.decorator.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/environment/decorators/is-strictly-lower-than.decorator.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/environment/environment-variables.ts (85%) rename packages/twenty-server/src/engine/{integrations => core-modules}/environment/environment.module-definition.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/environment/environment.module.ts (51%) rename packages/twenty-server/src/engine/{integrations => core-modules}/environment/environment.service.spec.ts (83%) rename packages/twenty-server/src/engine/{integrations => core-modules}/environment/environment.service.ts (88%) rename packages/twenty-server/src/engine/{integrations => core-modules}/environment/interfaces/aws-region.interface.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/environment/interfaces/node-environment.interface.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/environment/interfaces/support.interface.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/event-emitter/types/object-record-create.event.ts (70%) rename packages/twenty-server/src/engine/{integrations => core-modules}/event-emitter/types/object-record-delete.event.ts (71%) rename packages/twenty-server/src/engine/{integrations => core-modules}/event-emitter/types/object-record-update.event.ts (77%) rename packages/twenty-server/src/engine/{integrations => core-modules}/event-emitter/types/object-record.base.event.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/event-emitter/utils/__tests__/object-record-changed-values.spec.ts (96%) rename packages/twenty-server/src/engine/{integrations => core-modules}/event-emitter/utils/object-record-changed-properties.util.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/event-emitter/utils/object-record-changed-values.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/event-emitter/utils/object-record-diff-merge.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/exception-handler/__tests__/exception-handler.service.spec.ts (83%) rename packages/twenty-server/src/engine/{integrations => core-modules}/exception-handler/drivers/console.driver.ts (74%) rename packages/twenty-server/src/engine/{integrations => core-modules}/exception-handler/drivers/sentry.driver.ts (94%) rename packages/twenty-server/src/engine/{integrations => core-modules}/exception-handler/exception-handler.constants.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/exception-handler/exception-handler.module-definition.ts (71%) rename packages/twenty-server/src/engine/{integrations => core-modules}/exception-handler/exception-handler.module-factory.ts (86%) rename packages/twenty-server/src/engine/{integrations => core-modules}/exception-handler/exception-handler.module.ts (67%) rename packages/twenty-server/src/engine/{integrations => core-modules}/exception-handler/exception-handler.service.ts (69%) rename packages/twenty-server/src/engine/{integrations => core-modules}/exception-handler/hooks/use-sentry-tracing.ts (100%) create mode 100644 packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler-driver.interface.ts rename packages/twenty-server/src/engine/{integrations => core-modules}/exception-handler/interfaces/exception-handler-options.interface.ts (59%) rename packages/twenty-server/src/engine/{integrations => core-modules}/exception-handler/interfaces/exception-handler-user.interface.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/exception-handler/interfaces/exception-handler.interface.ts (100%) create mode 100644 packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/index.ts rename packages/twenty-server/src/engine/{integrations => core-modules}/file-storage/__tests__/file-storage.service.spec.ts (82%) rename packages/twenty-server/src/engine/{integrations => core-modules}/file-storage/drivers/interfaces/storage-driver.interface.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/file-storage/drivers/local.driver.ts (94%) rename packages/twenty-server/src/engine/{integrations => core-modules}/file-storage/drivers/s3.driver.ts (97%) rename packages/twenty-server/src/engine/{integrations => core-modules}/file-storage/file-storage.constants.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/file-storage/file-storage.module-definition.ts (72%) rename packages/twenty-server/src/engine/{integrations => core-modules}/file-storage/file-storage.module-factory.ts (93%) rename packages/twenty-server/src/engine/{integrations => core-modules}/file-storage/file-storage.module.ts (68%) rename packages/twenty-server/src/engine/{integrations => core-modules}/file-storage/file-storage.service.ts (80%) rename packages/twenty-server/src/engine/{integrations => core-modules}/file-storage/interfaces/file-storage-exception.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/file-storage/interfaces/file-storage.interface.ts (85%) create mode 100644 packages/twenty-server/src/engine/core-modules/file-storage/interfaces/index.ts rename packages/twenty-server/src/engine/{integrations => core-modules}/file-storage/utils/read-file-content.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/llm-chat-model/drivers/interfaces/llm-prompt-template-driver.interface.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/llm-chat-model/drivers/openai.driver.ts (89%) rename packages/twenty-server/src/engine/{integrations => core-modules}/llm-chat-model/interfaces/llm-chat-model.interface.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/llm-chat-model/llm-chat-model.constants.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/llm-chat-model/llm-chat-model.module-factory.ts (76%) rename packages/twenty-server/src/engine/{integrations => core-modules}/llm-chat-model/llm-chat-model.module.ts (77%) rename packages/twenty-server/src/engine/{integrations => core-modules}/llm-chat-model/llm-chat-model.service.ts (74%) rename packages/twenty-server/src/engine/{integrations => core-modules}/llm-tracing/drivers/console.driver.ts (92%) rename packages/twenty-server/src/engine/{integrations => core-modules}/llm-tracing/drivers/interfaces/llm-tracing-driver.interface.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/llm-tracing/drivers/langfuse.driver.ts (91%) rename packages/twenty-server/src/engine/{integrations => core-modules}/llm-tracing/interfaces/llm-tracing.interface.ts (91%) rename packages/twenty-server/src/engine/{integrations => core-modules}/llm-tracing/llm-tracing.constants.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/llm-tracing/llm-tracing.module-factory.ts (88%) rename packages/twenty-server/src/engine/{integrations => core-modules}/llm-tracing/llm-tracing.module.ts (75%) rename packages/twenty-server/src/engine/{integrations => core-modules}/llm-tracing/llm-tracing.service.ts (78%) rename packages/twenty-server/src/engine/{integrations => core-modules}/logger/__tests__/logger.service.spec.ts (80%) create mode 100644 packages/twenty-server/src/engine/core-modules/logger/interfaces/index.ts rename packages/twenty-server/src/engine/{integrations => core-modules}/logger/interfaces/logger.interface.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/logger/logger.constants.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/logger/logger.module-definition.ts (74%) rename packages/twenty-server/src/engine/{integrations => core-modules}/logger/logger.module-factory.ts (85%) rename packages/twenty-server/src/engine/{integrations => core-modules}/logger/logger.module.ts (80%) rename packages/twenty-server/src/engine/{integrations => core-modules}/logger/logger.service.ts (92%) rename packages/twenty-server/src/engine/{integrations => core-modules}/message-queue/decorators/message-queue.decorator.ts (63%) rename packages/twenty-server/src/engine/{integrations => core-modules}/message-queue/decorators/process.decorator.ts (90%) rename packages/twenty-server/src/engine/{integrations => core-modules}/message-queue/decorators/processor.decorator.ts (91%) rename packages/twenty-server/src/engine/{integrations => core-modules}/message-queue/drivers/bullmq.driver.ts (86%) rename packages/twenty-server/src/engine/{integrations => core-modules}/message-queue/drivers/interfaces/job-options.interface.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/message-queue/drivers/interfaces/message-queue-driver.interface.ts (72%) rename packages/twenty-server/src/engine/{integrations => core-modules}/message-queue/drivers/pg-boss.driver.ts (83%) rename packages/twenty-server/src/engine/{integrations => core-modules}/message-queue/drivers/sync.driver.ts (85%) create mode 100644 packages/twenty-server/src/engine/core-modules/message-queue/interfaces/index.ts rename packages/twenty-server/src/engine/{integrations => core-modules}/message-queue/interfaces/message-queue-job.interface.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/message-queue/interfaces/message-queue-module-options.interface.ts (83%) rename packages/twenty-server/src/engine/{integrations => core-modules}/message-queue/interfaces/message-queue-worker-options.interface.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/message-queue/jobs.module.ts (96%) rename packages/twenty-server/src/engine/{integrations => core-modules}/message-queue/message-queue-core.module.ts (84%) rename packages/twenty-server/src/engine/{integrations => core-modules}/message-queue/message-queue-metadata.accessor.ts (77%) rename packages/twenty-server/src/engine/{integrations => core-modules}/message-queue/message-queue.constants.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/message-queue/message-queue.explorer.ts (91%) rename packages/twenty-server/src/engine/{integrations => core-modules}/message-queue/message-queue.module-definition.ts (80%) rename packages/twenty-server/src/engine/{integrations => core-modules}/message-queue/message-queue.module-factory.ts (92%) rename packages/twenty-server/src/engine/{integrations => core-modules}/message-queue/message-queue.module.ts (74%) rename packages/twenty-server/src/engine/{integrations => core-modules}/message-queue/services/__tests__/message-queue-task-assigned.service.spec.ts (85%) rename packages/twenty-server/src/engine/{integrations => core-modules}/message-queue/services/message-queue.service.ts (78%) rename packages/twenty-server/src/engine/{integrations => core-modules}/message-queue/utils/get-queue-token.util.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/serverless/drivers/base-serverless.driver.ts (71%) rename packages/twenty-server/src/engine/{integrations => core-modules}/serverless/drivers/constants/build-file-name.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/serverless/drivers/constants/common-layer-name.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/serverless/drivers/constants/serverless-tmpdir-folder.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/serverless/drivers/constants/source-file-name.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/serverless/drivers/interfaces/serverless-driver.interface.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/serverless/drivers/lambda.driver.ts (95%) rename packages/twenty-server/src/engine/{integrations => core-modules}/serverless/drivers/layers/1/package.json (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/serverless/drivers/layers/1/yarn.lock (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/serverless/drivers/layers/engine/.yarn/releases/yarn-4.4.0.cjs (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/serverless/drivers/layers/engine/.yarnrc.yml (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/serverless/drivers/layers/last-layer-version.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/serverless/drivers/local.driver.ts (90%) rename packages/twenty-server/src/engine/{integrations => core-modules}/serverless/drivers/utils/compile-typescript.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/serverless/drivers/utils/copy-and-build-dependencies.ts (88%) rename packages/twenty-server/src/engine/{integrations => core-modules}/serverless/drivers/utils/create-zip-file.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/serverless/drivers/utils/get-last-layer-dependencies.ts (82%) rename packages/twenty-server/src/engine/{integrations => core-modules}/serverless/drivers/utils/get-layer-dependencies-dir-name.ts (86%) rename packages/twenty-server/src/engine/{integrations => core-modules}/serverless/drivers/utils/lambda-build-directory-manager.ts (94%) rename packages/twenty-server/src/engine/{integrations => core-modules}/serverless/serverless-module.factory.ts (89%) rename packages/twenty-server/src/engine/{integrations => core-modules}/serverless/serverless.constants.ts (100%) rename packages/twenty-server/src/engine/{integrations => core-modules}/serverless/serverless.interface.ts (85%) rename packages/twenty-server/src/engine/{integrations => core-modules}/serverless/serverless.module.ts (73%) rename packages/twenty-server/src/engine/{integrations => core-modules}/serverless/serverless.service.ts (89%) rename packages/twenty-server/src/engine/{integrations => core-modules}/serverless/utils/serverless-get-folder.utils.ts (100%) delete mode 100644 packages/twenty-server/src/engine/integrations/captcha/interfaces/index.ts delete mode 100644 packages/twenty-server/src/engine/integrations/exception-handler/interfaces/exception-handler-driver.interface.ts delete mode 100644 packages/twenty-server/src/engine/integrations/exception-handler/interfaces/index.ts delete mode 100644 packages/twenty-server/src/engine/integrations/file-storage/interfaces/index.ts delete mode 100644 packages/twenty-server/src/engine/integrations/integrations.module.ts delete mode 100644 packages/twenty-server/src/engine/integrations/logger/interfaces/index.ts delete mode 100644 packages/twenty-server/src/engine/integrations/message-queue/interfaces/index.ts diff --git a/packages/twenty-server/src/app.module.ts b/packages/twenty-server/src/app.module.ts index 4641f3a04bde..35af3a3e26ac 100644 --- a/packages/twenty-server/src/app.module.ts +++ b/packages/twenty-server/src/app.module.ts @@ -18,15 +18,14 @@ import { GraphQLConfigModule } from 'src/engine/api/graphql/graphql-config/graph import { GraphQLConfigService } from 'src/engine/api/graphql/graphql-config/graphql-config.service'; import { MetadataGraphQLApiModule } from 'src/engine/api/graphql/metadata-graphql-api.module'; import { RestApiModule } from 'src/engine/api/rest/rest-api.module'; -import { MessageQueueDriverType } from 'src/engine/integrations/message-queue/interfaces'; -import { MessageQueueModule } from 'src/engine/integrations/message-queue/message-queue.module'; +import { MessageQueueDriverType } from 'src/engine/core-modules/message-queue/interfaces'; +import { MessageQueueModule } from 'src/engine/core-modules/message-queue/message-queue.module'; import { WorkspaceMetadataVersionModule } from 'src/engine/metadata-modules/workspace-metadata-version/workspace-metadata-version.module'; import { GraphQLHydrateRequestFromTokenMiddleware } from 'src/engine/middlewares/graphql-hydrate-request-from-token.middleware'; import { TwentyORMModule } from 'src/engine/twenty-orm/twenty-orm.module'; import { ModulesModule } from 'src/modules/modules.module'; import { CoreEngineModule } from './engine/core-modules/core-engine.module'; -import { IntegrationsModule } from './engine/integrations/integrations.module'; @Module({ imports: [ @@ -47,8 +46,6 @@ import { IntegrationsModule } from './engine/integrations/integrations.module'; useClass: GraphQLConfigService, }), TwentyORMModule, - // Integrations module, contains all the integrations with other services - IntegrationsModule, // Core engine module, contains all the core modules CoreEngineModule, // Modules module, contains all business logic modules diff --git a/packages/twenty-server/src/command/command.ts b/packages/twenty-server/src/command/command.ts index 7fbd410349df..5e45fde2ad74 100644 --- a/packages/twenty-server/src/command/command.ts +++ b/packages/twenty-server/src/command/command.ts @@ -1,7 +1,7 @@ import { CommandFactory } from 'nest-commander'; -import { ExceptionHandlerService } from 'src/engine/integrations/exception-handler/exception-handler.service'; -import { LoggerService } from 'src/engine/integrations/logger/logger.service'; +import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service'; +import { LoggerService } from 'src/engine/core-modules/logger/logger.service'; import { shouldFilterException } from 'src/engine/utils/global-exception-handler.util'; import { CommandModule } from './command.module'; diff --git a/packages/twenty-server/src/database/commands/data-seed-demo-workspace/crons/start-data-seed-demo-workspace.cron.command.ts b/packages/twenty-server/src/database/commands/data-seed-demo-workspace/crons/start-data-seed-demo-workspace.cron.command.ts index bdf120095b23..bc2c1c395d57 100644 --- a/packages/twenty-server/src/database/commands/data-seed-demo-workspace/crons/start-data-seed-demo-workspace.cron.command.ts +++ b/packages/twenty-server/src/database/commands/data-seed-demo-workspace/crons/start-data-seed-demo-workspace.cron.command.ts @@ -2,9 +2,9 @@ import { Command, CommandRunner } from 'nest-commander'; import { dataSeedDemoWorkspaceCronPattern } from 'src/database/commands/data-seed-demo-workspace/crons/data-seed-demo-workspace-cron-pattern'; import { DataSeedDemoWorkspaceJob } from 'src/database/commands/data-seed-demo-workspace/jobs/data-seed-demo-workspace.job'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; @Command({ name: 'workspace-seed-demo:cron:start', diff --git a/packages/twenty-server/src/database/commands/data-seed-demo-workspace/crons/stop-data-seed-demo-workspace.cron.command.ts b/packages/twenty-server/src/database/commands/data-seed-demo-workspace/crons/stop-data-seed-demo-workspace.cron.command.ts index 99dd1558bf7f..a5fbf20ddf65 100644 --- a/packages/twenty-server/src/database/commands/data-seed-demo-workspace/crons/stop-data-seed-demo-workspace.cron.command.ts +++ b/packages/twenty-server/src/database/commands/data-seed-demo-workspace/crons/stop-data-seed-demo-workspace.cron.command.ts @@ -2,9 +2,9 @@ import { Command, CommandRunner } from 'nest-commander'; import { dataSeedDemoWorkspaceCronPattern } from 'src/database/commands/data-seed-demo-workspace/crons/data-seed-demo-workspace-cron-pattern'; import { DataSeedDemoWorkspaceJob } from 'src/database/commands/data-seed-demo-workspace/jobs/data-seed-demo-workspace.job'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; @Command({ name: 'workspace-seed-demo:cron:stop', diff --git a/packages/twenty-server/src/database/commands/data-seed-demo-workspace/data-seed-demo-workspace.module.ts b/packages/twenty-server/src/database/commands/data-seed-demo-workspace/data-seed-demo-workspace.module.ts index 10d644c03f44..63a808235ee3 100644 --- a/packages/twenty-server/src/database/commands/data-seed-demo-workspace/data-seed-demo-workspace.module.ts +++ b/packages/twenty-server/src/database/commands/data-seed-demo-workspace/data-seed-demo-workspace.module.ts @@ -1,6 +1,6 @@ import { Module } from '@nestjs/common'; -import { EnvironmentModule } from 'src/engine/integrations/environment/environment.module'; +import { EnvironmentModule } from 'src/engine/core-modules/environment/environment.module'; import { WorkspaceManagerModule } from 'src/engine/workspace-manager/workspace-manager.module'; import { DataSeedDemoWorkspaceService } from 'src/database/commands/data-seed-demo-workspace/services/data-seed-demo-workspace.service'; diff --git a/packages/twenty-server/src/database/commands/data-seed-demo-workspace/jobs/data-seed-demo-workspace.job.ts b/packages/twenty-server/src/database/commands/data-seed-demo-workspace/jobs/data-seed-demo-workspace.job.ts index 14655209c009..af89585182d5 100644 --- a/packages/twenty-server/src/database/commands/data-seed-demo-workspace/jobs/data-seed-demo-workspace.job.ts +++ b/packages/twenty-server/src/database/commands/data-seed-demo-workspace/jobs/data-seed-demo-workspace.job.ts @@ -1,7 +1,7 @@ import { DataSeedDemoWorkspaceService } from 'src/database/commands/data-seed-demo-workspace/services/data-seed-demo-workspace.service'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; @Processor(MessageQueue.cronQueue) export class DataSeedDemoWorkspaceJob { diff --git a/packages/twenty-server/src/database/commands/data-seed-demo-workspace/services/data-seed-demo-workspace.service.ts b/packages/twenty-server/src/database/commands/data-seed-demo-workspace/services/data-seed-demo-workspace.service.ts index 9be19725af5c..316caecac6f8 100644 --- a/packages/twenty-server/src/database/commands/data-seed-demo-workspace/services/data-seed-demo-workspace.service.ts +++ b/packages/twenty-server/src/database/commands/data-seed-demo-workspace/services/data-seed-demo-workspace.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@nestjs/common'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; import { WorkspaceManagerService } from 'src/engine/workspace-manager/workspace-manager.service'; import { deleteCoreSchema, diff --git a/packages/twenty-server/src/database/commands/data-seed-dev-workspace.command.ts b/packages/twenty-server/src/database/commands/data-seed-dev-workspace.command.ts index 84277637fac5..4a6fda198de1 100644 --- a/packages/twenty-server/src/database/commands/data-seed-dev-workspace.command.ts +++ b/packages/twenty-server/src/database/commands/data-seed-dev-workspace.command.ts @@ -32,9 +32,9 @@ import { rawDataSource } from 'src/database/typeorm/raw/raw.datasource'; import { TypeORMService } from 'src/database/typeorm/typeorm.service'; import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum'; import { FeatureFlagEntity } from 'src/engine/core-modules/feature-flag/feature-flag.entity'; -import { CacheStorageService } from 'src/engine/integrations/cache-storage/cache-storage.service'; -import { InjectCacheStorage } from 'src/engine/integrations/cache-storage/decorators/cache-storage.decorator'; -import { CacheStorageNamespace } from 'src/engine/integrations/cache-storage/types/cache-storage-namespace.enum'; +import { CacheStorageService } from 'src/engine/core-modules/cache-storage/cache-storage.service'; +import { InjectCacheStorage } from 'src/engine/core-modules/cache-storage/decorators/cache-storage.decorator'; +import { CacheStorageNamespace } from 'src/engine/core-modules/cache-storage/types/cache-storage-namespace.enum'; import { DataSourceService } from 'src/engine/metadata-modules/data-source/data-source.service'; import { FieldMetadataService } from 'src/engine/metadata-modules/field-metadata/field-metadata.service'; import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity'; diff --git a/packages/twenty-server/src/database/commands/upgrade-version/0-24/0-24-upgrade-version.module.ts b/packages/twenty-server/src/database/commands/upgrade-version/0-24/0-24-upgrade-version.module.ts index 689938ba3468..55643804686e 100644 --- a/packages/twenty-server/src/database/commands/upgrade-version/0-24/0-24-upgrade-version.module.ts +++ b/packages/twenty-server/src/database/commands/upgrade-version/0-24/0-24-upgrade-version.module.ts @@ -8,7 +8,7 @@ import { TypeORMModule } from 'src/database/typeorm/typeorm.module'; import { KeyValuePair } from 'src/engine/core-modules/key-value-pair/key-value-pair.entity'; import { OnboardingModule } from 'src/engine/core-modules/onboarding/onboarding.module'; import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; -import { FileStorageModule } from 'src/engine/integrations/file-storage/file-storage.module'; +import { FileStorageModule } from 'src/engine/core-modules/file-storage/file-storage.module'; import { DataSourceModule } from 'src/engine/metadata-modules/data-source/data-source.module'; import { FieldMetadataEntity } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity'; import { FieldMetadataModule } from 'src/engine/metadata-modules/field-metadata/field-metadata.module'; diff --git a/packages/twenty-server/src/database/typeorm/typeorm.module.ts b/packages/twenty-server/src/database/typeorm/typeorm.module.ts index b24fe05bad94..15733f0c632d 100644 --- a/packages/twenty-server/src/database/typeorm/typeorm.module.ts +++ b/packages/twenty-server/src/database/typeorm/typeorm.module.ts @@ -2,7 +2,7 @@ import { Module } from '@nestjs/common'; import { TypeOrmModule, TypeOrmModuleOptions } from '@nestjs/typeorm'; import { typeORMCoreModuleOptions } from 'src/database/typeorm/core/core.datasource'; -import { EnvironmentModule } from 'src/engine/integrations/environment/environment.module'; +import { EnvironmentModule } from 'src/engine/core-modules/environment/environment.module'; import { TypeORMService } from './typeorm.service'; diff --git a/packages/twenty-server/src/database/typeorm/typeorm.service.ts b/packages/twenty-server/src/database/typeorm/typeorm.service.ts index ca1f9c44cf64..a56f3580dabd 100644 --- a/packages/twenty-server/src/database/typeorm/typeorm.service.ts +++ b/packages/twenty-server/src/database/typeorm/typeorm.service.ts @@ -2,7 +2,7 @@ import { Injectable, OnModuleDestroy, OnModuleInit } from '@nestjs/common'; import { DataSource } from 'typeorm'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; import { DataSourceEntity } from 'src/engine/metadata-modules/data-source/data-source.entity'; import { User } from 'src/engine/core-modules/user/user.entity'; import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; diff --git a/packages/twenty-server/src/engine/api/graphql/graphql-config/graphql-config.service.ts b/packages/twenty-server/src/engine/api/graphql/graphql-config/graphql-config.service.ts index 8c0521173fee..39dcda62f7d9 100644 --- a/packages/twenty-server/src/engine/api/graphql/graphql-config/graphql-config.service.ts +++ b/packages/twenty-server/src/engine/api/graphql/graphql-config/graphql-config.service.ts @@ -20,9 +20,9 @@ import { CoreEngineModule } from 'src/engine/core-modules/core-engine.module'; import { useGraphQLErrorHandlerHook } from 'src/engine/core-modules/graphql/hooks/use-graphql-error-handler.hook'; import { User } from 'src/engine/core-modules/user/user.entity'; import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; -import { ExceptionHandlerService } from 'src/engine/integrations/exception-handler/exception-handler.service'; -import { useSentryTracing } from 'src/engine/integrations/exception-handler/hooks/use-sentry-tracing'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; +import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service'; +import { useSentryTracing } from 'src/engine/core-modules/exception-handler/hooks/use-sentry-tracing'; import { handleExceptionAndConvertToGraphQLError } from 'src/engine/utils/global-exception-handler.util'; import { renderApolloPlayground } from 'src/engine/utils/render-apollo-playground.util'; diff --git a/packages/twenty-server/src/engine/api/graphql/metadata-graphql-api.module.ts b/packages/twenty-server/src/engine/api/graphql/metadata-graphql-api.module.ts index 3d0627ce7336..f7ac4328f21a 100644 --- a/packages/twenty-server/src/engine/api/graphql/metadata-graphql-api.module.ts +++ b/packages/twenty-server/src/engine/api/graphql/metadata-graphql-api.module.ts @@ -7,9 +7,9 @@ import { GraphQLConfigModule } from 'src/engine/api/graphql/graphql-config/graph import { metadataModuleFactory } from 'src/engine/api/graphql/metadata.module-factory'; import { DataloaderModule } from 'src/engine/dataloaders/dataloader.module'; import { DataloaderService } from 'src/engine/dataloaders/dataloader.service'; -import { CacheStorageNamespace } from 'src/engine/integrations/cache-storage/types/cache-storage-namespace.enum'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; -import { ExceptionHandlerService } from 'src/engine/integrations/exception-handler/exception-handler.service'; +import { CacheStorageNamespace } from 'src/engine/core-modules/cache-storage/types/cache-storage-namespace.enum'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; +import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service'; import { MetadataEngineModule } from 'src/engine/metadata-modules/metadata-engine.module'; import { WorkspaceMigrationModule } from 'src/engine/metadata-modules/workspace-migration/workspace-migration.module'; import { WorkspaceMigrationRunnerModule } from 'src/engine/workspace-manager/workspace-migration-runner/workspace-migration-runner.module'; diff --git a/packages/twenty-server/src/engine/api/graphql/metadata.module-factory.ts b/packages/twenty-server/src/engine/api/graphql/metadata.module-factory.ts index 5297b747b954..52b75eab3979 100644 --- a/packages/twenty-server/src/engine/api/graphql/metadata.module-factory.ts +++ b/packages/twenty-server/src/engine/api/graphql/metadata.module-factory.ts @@ -6,9 +6,9 @@ import { useThrottler } from 'src/engine/api/graphql/graphql-config/hooks/use-th import { MetadataGraphQLApiModule } from 'src/engine/api/graphql/metadata-graphql-api.module'; import { useGraphQLErrorHandlerHook } from 'src/engine/core-modules/graphql/hooks/use-graphql-error-handler.hook'; import { DataloaderService } from 'src/engine/dataloaders/dataloader.service'; -import { CacheStorageService } from 'src/engine/integrations/cache-storage/cache-storage.service'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; -import { ExceptionHandlerService } from 'src/engine/integrations/exception-handler/exception-handler.service'; +import { CacheStorageService } from 'src/engine/core-modules/cache-storage/cache-storage.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; +import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service'; import { renderApolloPlayground } from 'src/engine/utils/render-apollo-playground.util'; export const metadataModuleFactory = async ( diff --git a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/commands/0-20-record-position-backfill.command.ts b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/commands/0-20-record-position-backfill.command.ts index ddc2f06a4dbf..a5ddfc065856 100644 --- a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/commands/0-20-record-position-backfill.command.ts +++ b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/commands/0-20-record-position-backfill.command.ts @@ -4,9 +4,9 @@ import { RecordPositionBackfillJob, RecordPositionBackfillJobData, } from 'src/engine/api/graphql/workspace-query-runner/jobs/record-position-backfill.job'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; export type RecordPositionBackfillCommandOptions = { workspaceId: string; diff --git a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/jobs/call-webhook-jobs.job.ts b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/jobs/call-webhook-jobs.job.ts index 74e955093e6d..d0bbc6872c06 100644 --- a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/jobs/call-webhook-jobs.job.ts +++ b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/jobs/call-webhook-jobs.job.ts @@ -8,11 +8,11 @@ import { CallWebhookJob, CallWebhookJobData, } from 'src/engine/api/graphql/workspace-query-runner/jobs/call-webhook.job'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { TwentyORMGlobalManager } from 'src/engine/twenty-orm/twenty-orm-global.manager'; import { WebhookWorkspaceEntity } from 'src/modules/webhook/standard-objects/webhook.workspace-entity'; diff --git a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/jobs/call-webhook.job.ts b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/jobs/call-webhook.job.ts index 6e0d7af5240b..bbaff49a4951 100644 --- a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/jobs/call-webhook.job.ts +++ b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/jobs/call-webhook.job.ts @@ -1,9 +1,9 @@ import { HttpService } from '@nestjs/axios'; import { Logger } from '@nestjs/common'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; export type CallWebhookJobData = { targetUrl: string; diff --git a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/jobs/record-position-backfill.job.ts b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/jobs/record-position-backfill.job.ts index 8619f1182814..67cf1dd555b9 100644 --- a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/jobs/record-position-backfill.job.ts +++ b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/jobs/record-position-backfill.job.ts @@ -1,7 +1,7 @@ import { RecordPositionBackfillService } from 'src/engine/api/graphql/workspace-query-runner/services/record-position-backfill-service'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; export type RecordPositionBackfillJobData = { workspaceId: string; diff --git a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/listeners/entity-events-to-db.listener.ts b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/listeners/entity-events-to-db.listener.ts index 48e0917205f3..eb9ddbf06a6f 100644 --- a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/listeners/entity-events-to-db.listener.ts +++ b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/listeners/entity-events-to-db.listener.ts @@ -1,13 +1,13 @@ import { Injectable } from '@nestjs/common'; import { OnEvent } from '@nestjs/event-emitter'; -import { ObjectRecordCreateEvent } from 'src/engine/integrations/event-emitter/types/object-record-create.event'; -import { ObjectRecordUpdateEvent } from 'src/engine/integrations/event-emitter/types/object-record-update.event'; -import { ObjectRecordBaseEvent } from 'src/engine/integrations/event-emitter/types/object-record.base.event'; -import { objectRecordChangedValues } from 'src/engine/integrations/event-emitter/utils/object-record-changed-values'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { ObjectRecordCreateEvent } from 'src/engine/core-modules/event-emitter/types/object-record-create.event'; +import { ObjectRecordUpdateEvent } from 'src/engine/core-modules/event-emitter/types/object-record-update.event'; +import { ObjectRecordBaseEvent } from 'src/engine/core-modules/event-emitter/types/object-record.base.event'; +import { objectRecordChangedValues } from 'src/engine/core-modules/event-emitter/utils/object-record-changed-values'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { WorkspaceEventBatch } from 'src/engine/workspace-event-emitter/workspace-event.type'; import { CreateAuditLogFromInternalEvent } from 'src/modules/timeline/jobs/create-audit-log-from-internal-event'; import { UpsertTimelineActivityFromInternalEvent } from 'src/modules/timeline/jobs/upsert-timeline-activity-from-internal-event.job'; diff --git a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/listeners/telemetry.listener.ts b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/listeners/telemetry.listener.ts index f9609794d7ac..2afa537a687e 100644 --- a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/listeners/telemetry.listener.ts +++ b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/listeners/telemetry.listener.ts @@ -2,8 +2,8 @@ import { Injectable } from '@nestjs/common'; import { OnEvent } from '@nestjs/event-emitter'; import { AnalyticsService } from 'src/engine/core-modules/analytics/analytics.service'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; -import { ObjectRecordCreateEvent } from 'src/engine/integrations/event-emitter/types/object-record-create.event'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; +import { ObjectRecordCreateEvent } from 'src/engine/core-modules/event-emitter/types/object-record-create.event'; import { WorkspaceEventBatch } from 'src/engine/workspace-event-emitter/workspace-event.type'; @Injectable() diff --git a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/workspace-query-runner.service.ts b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/workspace-query-runner.service.ts index d5cb7b867824..bfdb65b8a6ce 100644 --- a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/workspace-query-runner.service.ts +++ b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/workspace-query-runner.service.ts @@ -45,13 +45,13 @@ import { import { DuplicateService } from 'src/engine/core-modules/duplicate/duplicate.service'; import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum'; import { FeatureFlagService } from 'src/engine/core-modules/feature-flag/services/feature-flag.service'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; -import { ObjectRecordCreateEvent } from 'src/engine/integrations/event-emitter/types/object-record-create.event'; -import { ObjectRecordDeleteEvent } from 'src/engine/integrations/event-emitter/types/object-record-delete.event'; -import { ObjectRecordUpdateEvent } from 'src/engine/integrations/event-emitter/types/object-record-update.event'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; +import { ObjectRecordCreateEvent } from 'src/engine/core-modules/event-emitter/types/object-record-create.event'; +import { ObjectRecordDeleteEvent } from 'src/engine/core-modules/event-emitter/types/object-record-delete.event'; +import { ObjectRecordUpdateEvent } from 'src/engine/core-modules/event-emitter/types/object-record-update.event'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { assertMutationNotOnRemoteObject } from 'src/engine/metadata-modules/object-metadata/utils/assert-mutation-not-on-remote-object.util'; import { TwentyORMGlobalManager } from 'src/engine/twenty-orm/twenty-orm-global.manager'; import { computeObjectTargetTable } from 'src/engine/utils/compute-object-target-table.util'; diff --git a/packages/twenty-server/src/engine/api/rest/core/query-builder/core-query-builder.factory.ts b/packages/twenty-server/src/engine/api/rest/core/query-builder/core-query-builder.factory.ts index 90c3069d8972..1c30fa89df6e 100644 --- a/packages/twenty-server/src/engine/api/rest/core/query-builder/core-query-builder.factory.ts +++ b/packages/twenty-server/src/engine/api/rest/core/query-builder/core-query-builder.factory.ts @@ -19,7 +19,7 @@ import { parseCoreBatchPath } from 'src/engine/api/rest/core/query-builder/utils import { parseCorePath } from 'src/engine/api/rest/core/query-builder/utils/path-parsers/parse-core-path.utils'; import { Query } from 'src/engine/api/rest/core/types/query.type'; import { TokenService } from 'src/engine/core-modules/auth/services/token.service'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity'; import { ObjectMetadataService } from 'src/engine/metadata-modules/object-metadata/object-metadata.service'; diff --git a/packages/twenty-server/src/engine/api/rest/rest-api.service.ts b/packages/twenty-server/src/engine/api/rest/rest-api.service.ts index d6b4d21640c3..128df3f96b33 100644 --- a/packages/twenty-server/src/engine/api/rest/rest-api.service.ts +++ b/packages/twenty-server/src/engine/api/rest/rest-api.service.ts @@ -6,7 +6,7 @@ import { AxiosResponse } from 'axios'; import { Query } from 'src/engine/api/rest/core/types/query.type'; import { getServerUrl } from 'src/utils/get-server-url'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; import { RestApiException } from 'src/engine/api/rest/errors/RestApiException'; export enum GraphqlApiType { diff --git a/packages/twenty-server/src/engine/core-modules/ai-sql-query/ai-sql-query.module.ts b/packages/twenty-server/src/engine/core-modules/ai-sql-query/ai-sql-query.module.ts index f416a0898787..0e0e9997c192 100644 --- a/packages/twenty-server/src/engine/core-modules/ai-sql-query/ai-sql-query.module.ts +++ b/packages/twenty-server/src/engine/core-modules/ai-sql-query/ai-sql-query.module.ts @@ -7,9 +7,9 @@ import { AISQLQueryResolver } from 'src/engine/core-modules/ai-sql-query/ai-sql- import { AISQLQueryService } from 'src/engine/core-modules/ai-sql-query/ai-sql-query.service'; import { FeatureFlagEntity } from 'src/engine/core-modules/feature-flag/feature-flag.entity'; import { WorkspaceQueryRunnerModule } from 'src/engine/api/graphql/workspace-query-runner/workspace-query-runner.module'; -import { LLMChatModelModule } from 'src/engine/integrations/llm-chat-model/llm-chat-model.module'; -import { EnvironmentModule } from 'src/engine/integrations/environment/environment.module'; -import { LLMTracingModule } from 'src/engine/integrations/llm-tracing/llm-tracing.module'; +import { LLMChatModelModule } from 'src/engine/core-modules/llm-chat-model/llm-chat-model.module'; +import { EnvironmentModule } from 'src/engine/core-modules/environment/environment.module'; +import { LLMTracingModule } from 'src/engine/core-modules/llm-tracing/llm-tracing.module'; import { ObjectMetadataModule } from 'src/engine/metadata-modules/object-metadata/object-metadata.module'; import { WorkspaceSyncMetadataModule } from 'src/engine/workspace-manager/workspace-sync-metadata/workspace-sync-metadata.module'; @Module({ diff --git a/packages/twenty-server/src/engine/core-modules/ai-sql-query/ai-sql-query.service.ts b/packages/twenty-server/src/engine/core-modules/ai-sql-query/ai-sql-query.service.ts index 63809b96c33d..81cd32ec4a35 100644 --- a/packages/twenty-server/src/engine/core-modules/ai-sql-query/ai-sql-query.service.ts +++ b/packages/twenty-server/src/engine/core-modules/ai-sql-query/ai-sql-query.service.ts @@ -11,8 +11,8 @@ import { zodToJsonSchema } from 'zod-to-json-schema'; import { WorkspaceQueryRunnerService } from 'src/engine/api/graphql/workspace-query-runner/workspace-query-runner.service'; import { sqlGenerationPromptTemplate } from 'src/engine/core-modules/ai-sql-query/ai-sql-query.prompt-templates'; import { AISQLQueryResult } from 'src/engine/core-modules/ai-sql-query/dtos/ai-sql-query-result.dto'; -import { LLMChatModelService } from 'src/engine/integrations/llm-chat-model/llm-chat-model.service'; -import { LLMTracingService } from 'src/engine/integrations/llm-tracing/llm-tracing.service'; +import { LLMChatModelService } from 'src/engine/core-modules/llm-chat-model/llm-chat-model.service'; +import { LLMTracingService } from 'src/engine/core-modules/llm-tracing/llm-tracing.service'; import { DEFAULT_LABEL_IDENTIFIER_FIELD_NAME } from 'src/engine/metadata-modules/object-metadata/object-metadata.constants'; import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity'; import { WorkspaceDataSourceService } from 'src/engine/workspace-datasource/workspace-datasource.service'; diff --git a/packages/twenty-server/src/engine/core-modules/analytics/analytics.resolver.spec.ts b/packages/twenty-server/src/engine/core-modules/analytics/analytics.resolver.spec.ts index f6f1e07d422f..ba23dc9a2c22 100644 --- a/packages/twenty-server/src/engine/core-modules/analytics/analytics.resolver.spec.ts +++ b/packages/twenty-server/src/engine/core-modules/analytics/analytics.resolver.spec.ts @@ -1,7 +1,7 @@ import { Test, TestingModule } from '@nestjs/testing'; import { HttpService } from '@nestjs/axios'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; import { AnalyticsResolver } from './analytics.resolver'; import { AnalyticsService } from './analytics.service'; diff --git a/packages/twenty-server/src/engine/core-modules/analytics/analytics.resolver.ts b/packages/twenty-server/src/engine/core-modules/analytics/analytics.resolver.ts index 7fcba0c9f0f5..6233ce683f66 100644 --- a/packages/twenty-server/src/engine/core-modules/analytics/analytics.resolver.ts +++ b/packages/twenty-server/src/engine/core-modules/analytics/analytics.resolver.ts @@ -8,7 +8,7 @@ import { AuthWorkspace } from 'src/engine/decorators/auth/auth-workspace.decorat import { AuthUser } from 'src/engine/decorators/auth/auth-user.decorator'; import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; import { User } from 'src/engine/core-modules/user/user.entity'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; import { AnalyticsService } from './analytics.service'; import { Analytics } from './analytics.entity'; diff --git a/packages/twenty-server/src/engine/core-modules/analytics/analytics.service.spec.ts b/packages/twenty-server/src/engine/core-modules/analytics/analytics.service.spec.ts index c2cbd7a2f675..a22ede293be4 100644 --- a/packages/twenty-server/src/engine/core-modules/analytics/analytics.service.spec.ts +++ b/packages/twenty-server/src/engine/core-modules/analytics/analytics.service.spec.ts @@ -1,7 +1,7 @@ import { Test, TestingModule } from '@nestjs/testing'; import { HttpService } from '@nestjs/axios'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; import { AnalyticsService } from './analytics.service'; diff --git a/packages/twenty-server/src/engine/core-modules/analytics/analytics.service.ts b/packages/twenty-server/src/engine/core-modules/analytics/analytics.service.ts index 73851f71ea5b..085f4437837f 100644 --- a/packages/twenty-server/src/engine/core-modules/analytics/analytics.service.ts +++ b/packages/twenty-server/src/engine/core-modules/analytics/analytics.service.ts @@ -1,7 +1,7 @@ import { Injectable, Logger } from '@nestjs/common'; import { HttpService } from '@nestjs/axios'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; type CreateEventInput = { type: string; diff --git a/packages/twenty-server/src/engine/core-modules/auth/auth.resolver.spec.ts b/packages/twenty-server/src/engine/core-modules/auth/auth.resolver.spec.ts index 30e521f7ba41..cca5dc1deb02 100644 --- a/packages/twenty-server/src/engine/core-modules/auth/auth.resolver.spec.ts +++ b/packages/twenty-server/src/engine/core-modules/auth/auth.resolver.spec.ts @@ -6,7 +6,7 @@ import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; import { UserService } from 'src/engine/core-modules/user/services/user.service'; import { UserWorkspaceService } from 'src/engine/core-modules/user-workspace/user-workspace.service'; import { User } from 'src/engine/core-modules/user/user.entity'; -import { CaptchaGuard } from 'src/engine/integrations/captcha/captcha.guard'; +import { CaptchaGuard } from 'src/engine/core-modules/captcha/captcha.guard'; import { AuthResolver } from './auth.resolver'; diff --git a/packages/twenty-server/src/engine/core-modules/auth/auth.resolver.ts b/packages/twenty-server/src/engine/core-modules/auth/auth.resolver.ts index 2987054701a3..6dbcd832a451 100644 --- a/packages/twenty-server/src/engine/core-modules/auth/auth.resolver.ts +++ b/packages/twenty-server/src/engine/core-modules/auth/auth.resolver.ts @@ -22,7 +22,7 @@ import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; import { AuthUser } from 'src/engine/decorators/auth/auth-user.decorator'; import { AuthWorkspace } from 'src/engine/decorators/auth/auth-workspace.decorator'; import { JwtAuthGuard } from 'src/engine/guards/jwt.auth.guard'; -import { CaptchaGuard } from 'src/engine/integrations/captcha/captcha.guard'; +import { CaptchaGuard } from 'src/engine/core-modules/captcha/captcha.guard'; import { ChallengeInput } from './dto/challenge.input'; import { ImpersonateInput } from './dto/impersonate.input'; diff --git a/packages/twenty-server/src/engine/core-modules/auth/controllers/google-apis-auth.controller.ts b/packages/twenty-server/src/engine/core-modules/auth/controllers/google-apis-auth.controller.ts index 783556dbe513..330e382b276d 100644 --- a/packages/twenty-server/src/engine/core-modules/auth/controllers/google-apis-auth.controller.ts +++ b/packages/twenty-server/src/engine/core-modules/auth/controllers/google-apis-auth.controller.ts @@ -20,7 +20,7 @@ import { GoogleAPIsService } from 'src/engine/core-modules/auth/services/google- import { TokenService } from 'src/engine/core-modules/auth/services/token.service'; import { GoogleAPIsRequest } from 'src/engine/core-modules/auth/types/google-api-request.type'; import { OnboardingService } from 'src/engine/core-modules/onboarding/onboarding.service'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; @Controller('auth/google-apis') @UseFilters(AuthRestApiExceptionFilter) diff --git a/packages/twenty-server/src/engine/core-modules/auth/guards/google-apis-oauth-exchange-code-for-token.guard.ts b/packages/twenty-server/src/engine/core-modules/auth/guards/google-apis-oauth-exchange-code-for-token.guard.ts index 5ef0fcf1db19..77c6b41ce1d0 100644 --- a/packages/twenty-server/src/engine/core-modules/auth/guards/google-apis-oauth-exchange-code-for-token.guard.ts +++ b/packages/twenty-server/src/engine/core-modules/auth/guards/google-apis-oauth-exchange-code-for-token.guard.ts @@ -7,7 +7,7 @@ import { } from 'src/engine/core-modules/auth/auth.exception'; import { GoogleAPIsOauthExchangeCodeForTokenStrategy } from 'src/engine/core-modules/auth/strategies/google-apis-oauth-exchange-code-for-token.auth.strategy'; import { setRequestExtraParams } from 'src/engine/core-modules/auth/utils/google-apis-set-request-extra-params.util'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; @Injectable() export class GoogleAPIsOauthExchangeCodeForTokenGuard extends AuthGuard( diff --git a/packages/twenty-server/src/engine/core-modules/auth/guards/google-apis-oauth-request-code.guard.ts b/packages/twenty-server/src/engine/core-modules/auth/guards/google-apis-oauth-request-code.guard.ts index fadeb2b1bfb2..04d860d5ebc5 100644 --- a/packages/twenty-server/src/engine/core-modules/auth/guards/google-apis-oauth-request-code.guard.ts +++ b/packages/twenty-server/src/engine/core-modules/auth/guards/google-apis-oauth-request-code.guard.ts @@ -7,7 +7,7 @@ import { } from 'src/engine/core-modules/auth/auth.exception'; import { GoogleAPIsOauthRequestCodeStrategy } from 'src/engine/core-modules/auth/strategies/google-apis-oauth-request-code.auth.strategy'; import { setRequestExtraParams } from 'src/engine/core-modules/auth/utils/google-apis-set-request-extra-params.util'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; @Injectable() export class GoogleAPIsOauthRequestCodeGuard extends AuthGuard('google-apis') { diff --git a/packages/twenty-server/src/engine/core-modules/auth/guards/google-provider-enabled.guard.ts b/packages/twenty-server/src/engine/core-modules/auth/guards/google-provider-enabled.guard.ts index ed1db3ac9ddb..b78fa7f64af5 100644 --- a/packages/twenty-server/src/engine/core-modules/auth/guards/google-provider-enabled.guard.ts +++ b/packages/twenty-server/src/engine/core-modules/auth/guards/google-provider-enabled.guard.ts @@ -7,7 +7,7 @@ import { AuthExceptionCode, } from 'src/engine/core-modules/auth/auth.exception'; import { GoogleStrategy } from 'src/engine/core-modules/auth/strategies/google.auth.strategy'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; @Injectable() export class GoogleProviderEnabledGuard implements CanActivate { diff --git a/packages/twenty-server/src/engine/core-modules/auth/guards/microsoft-provider-enabled.guard.ts b/packages/twenty-server/src/engine/core-modules/auth/guards/microsoft-provider-enabled.guard.ts index 435c0bb04599..9594c41bd371 100644 --- a/packages/twenty-server/src/engine/core-modules/auth/guards/microsoft-provider-enabled.guard.ts +++ b/packages/twenty-server/src/engine/core-modules/auth/guards/microsoft-provider-enabled.guard.ts @@ -7,7 +7,7 @@ import { AuthExceptionCode, } from 'src/engine/core-modules/auth/auth.exception'; import { MicrosoftStrategy } from 'src/engine/core-modules/auth/strategies/microsoft.auth.strategy'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; @Injectable() export class MicrosoftProviderEnabledGuard implements CanActivate { diff --git a/packages/twenty-server/src/engine/core-modules/auth/services/auth.service.spec.ts b/packages/twenty-server/src/engine/core-modules/auth/services/auth.service.spec.ts index b15cdec249a7..7b4f1309a352 100644 --- a/packages/twenty-server/src/engine/core-modules/auth/services/auth.service.spec.ts +++ b/packages/twenty-server/src/engine/core-modules/auth/services/auth.service.spec.ts @@ -5,8 +5,8 @@ import { UserService } from 'src/engine/core-modules/user/services/user.service' import { WorkspaceManagerService } from 'src/engine/workspace-manager/workspace-manager.service'; import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; import { User } from 'src/engine/core-modules/user/user.entity'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; -import { EmailService } from 'src/engine/integrations/email/email.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; +import { EmailService } from 'src/engine/core-modules/email/email.service'; import { SignInUpService } from 'src/engine/core-modules/auth/services/sign-in-up.service'; import { AppToken } from 'src/engine/core-modules/app-token/app-token.entity'; diff --git a/packages/twenty-server/src/engine/core-modules/auth/services/auth.service.ts b/packages/twenty-server/src/engine/core-modules/auth/services/auth.service.ts index 0830e57fb831..cec729573441 100644 --- a/packages/twenty-server/src/engine/core-modules/auth/services/auth.service.ts +++ b/packages/twenty-server/src/engine/core-modules/auth/services/auth.service.ts @@ -9,7 +9,7 @@ import ms from 'ms'; import { PasswordUpdateNotifyEmail } from 'twenty-emails'; import { Repository } from 'typeorm'; -import { NodeEnvironment } from 'src/engine/integrations/environment/interfaces/node-environment.interface'; +import { NodeEnvironment } from 'src/engine/core-modules/environment/interfaces/node-environment.interface'; import { AppToken, @@ -36,8 +36,8 @@ import { WorkspaceMember } from 'src/engine/core-modules/user/dtos/workspace-mem import { UserService } from 'src/engine/core-modules/user/services/user.service'; import { User } from 'src/engine/core-modules/user/user.entity'; import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; -import { EmailService } from 'src/engine/integrations/email/email.service'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EmailService } from 'src/engine/core-modules/email/email.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; import { TokenService } from './token.service'; diff --git a/packages/twenty-server/src/engine/core-modules/auth/services/google-apis.service.ts b/packages/twenty-server/src/engine/core-modules/auth/services/google-apis.service.ts index dcee921d280a..b20072ed54f1 100644 --- a/packages/twenty-server/src/engine/core-modules/auth/services/google-apis.service.ts +++ b/packages/twenty-server/src/engine/core-modules/auth/services/google-apis.service.ts @@ -3,10 +3,10 @@ import { Injectable } from '@nestjs/common'; import { EntityManager } from 'typeorm'; import { v4 } from 'uuid'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { InjectObjectMetadataRepository } from 'src/engine/object-metadata-repository/object-metadata-repository.decorator'; import { TwentyORMGlobalManager } from 'src/engine/twenty-orm/twenty-orm-global.manager'; import { diff --git a/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.spec.ts b/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.spec.ts index e3bb7af39ec0..eb2974d9d5f8 100644 --- a/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.spec.ts +++ b/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.spec.ts @@ -8,7 +8,7 @@ import { OnboardingService } from 'src/engine/core-modules/onboarding/onboarding import { UserWorkspaceService } from 'src/engine/core-modules/user-workspace/user-workspace.service'; import { User } from 'src/engine/core-modules/user/user.entity'; import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; describe('SignInUpService', () => { let service: SignInUpService; diff --git a/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.ts b/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.ts index 450b6e1a0ce4..63286c37273c 100644 --- a/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.ts +++ b/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.ts @@ -25,7 +25,7 @@ import { Workspace, WorkspaceActivationStatus, } from 'src/engine/core-modules/workspace/workspace.entity'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; import { getImageBufferFromUrl } from 'src/utils/image'; export type SignInUpServiceInput = { diff --git a/packages/twenty-server/src/engine/core-modules/auth/services/token.service.spec.ts b/packages/twenty-server/src/engine/core-modules/auth/services/token.service.spec.ts index 29e2df741b82..777b1febde7f 100644 --- a/packages/twenty-server/src/engine/core-modules/auth/services/token.service.spec.ts +++ b/packages/twenty-server/src/engine/core-modules/auth/services/token.service.spec.ts @@ -14,8 +14,8 @@ import { JwtAuthStrategy } from 'src/engine/core-modules/auth/strategies/jwt.aut import { JwtWrapperService } from 'src/engine/core-modules/jwt/services/jwt-wrapper.service'; import { User } from 'src/engine/core-modules/user/user.entity'; import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; -import { EmailService } from 'src/engine/integrations/email/email.service'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EmailService } from 'src/engine/core-modules/email/email.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; import { TwentyORMGlobalManager } from 'src/engine/twenty-orm/twenty-orm-global.manager'; import { TokenService } from './token.service'; diff --git a/packages/twenty-server/src/engine/core-modules/auth/services/token.service.ts b/packages/twenty-server/src/engine/core-modules/auth/services/token.service.ts index 4cf18c206060..2189ddb41045 100644 --- a/packages/twenty-server/src/engine/core-modules/auth/services/token.service.ts +++ b/packages/twenty-server/src/engine/core-modules/auth/services/token.service.ts @@ -42,8 +42,8 @@ import { Workspace, WorkspaceActivationStatus, } from 'src/engine/core-modules/workspace/workspace.entity'; -import { EmailService } from 'src/engine/integrations/email/email.service'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EmailService } from 'src/engine/core-modules/email/email.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; import { TwentyORMGlobalManager } from 'src/engine/twenty-orm/twenty-orm-global.manager'; import { WorkspaceMemberWorkspaceEntity } from 'src/modules/workspace-member/standard-objects/workspace-member.workspace-entity'; diff --git a/packages/twenty-server/src/engine/core-modules/auth/strategies/google-apis-oauth-common.auth.strategy.ts b/packages/twenty-server/src/engine/core-modules/auth/strategies/google-apis-oauth-common.auth.strategy.ts index 64b69bf35b5d..8636924735f9 100644 --- a/packages/twenty-server/src/engine/core-modules/auth/strategies/google-apis-oauth-common.auth.strategy.ts +++ b/packages/twenty-server/src/engine/core-modules/auth/strategies/google-apis-oauth-common.auth.strategy.ts @@ -3,7 +3,7 @@ import { PassportStrategy } from '@nestjs/passport'; import { Strategy } from 'passport-google-oauth20'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; export type GoogleAPIScopeConfig = { isCalendarEnabled?: boolean; diff --git a/packages/twenty-server/src/engine/core-modules/auth/strategies/google-apis-oauth-exchange-code-for-token.auth.strategy.ts b/packages/twenty-server/src/engine/core-modules/auth/strategies/google-apis-oauth-exchange-code-for-token.auth.strategy.ts index 4d5dfe5c2f00..244b1066d846 100644 --- a/packages/twenty-server/src/engine/core-modules/auth/strategies/google-apis-oauth-exchange-code-for-token.auth.strategy.ts +++ b/packages/twenty-server/src/engine/core-modules/auth/strategies/google-apis-oauth-exchange-code-for-token.auth.strategy.ts @@ -4,7 +4,7 @@ import { VerifyCallback } from 'passport-google-oauth20'; import { GoogleAPIsOauthCommonStrategy } from 'src/engine/core-modules/auth/strategies/google-apis-oauth-common.auth.strategy'; import { GoogleAPIsRequest } from 'src/engine/core-modules/auth/types/google-api-request.type'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; export type GoogleAPIScopeConfig = { isCalendarEnabled?: boolean; diff --git a/packages/twenty-server/src/engine/core-modules/auth/strategies/google-apis-oauth-request-code.auth.strategy.ts b/packages/twenty-server/src/engine/core-modules/auth/strategies/google-apis-oauth-request-code.auth.strategy.ts index 128ba607cd45..f93642bc7ece 100644 --- a/packages/twenty-server/src/engine/core-modules/auth/strategies/google-apis-oauth-request-code.auth.strategy.ts +++ b/packages/twenty-server/src/engine/core-modules/auth/strategies/google-apis-oauth-request-code.auth.strategy.ts @@ -1,7 +1,7 @@ import { Injectable } from '@nestjs/common'; import { GoogleAPIsOauthCommonStrategy } from 'src/engine/core-modules/auth/strategies/google-apis-oauth-common.auth.strategy'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; export type GoogleAPIScopeConfig = { isCalendarEnabled?: boolean; diff --git a/packages/twenty-server/src/engine/core-modules/auth/strategies/google.auth.strategy.ts b/packages/twenty-server/src/engine/core-modules/auth/strategies/google.auth.strategy.ts index 6cf51366ffb7..22ba144477ed 100644 --- a/packages/twenty-server/src/engine/core-modules/auth/strategies/google.auth.strategy.ts +++ b/packages/twenty-server/src/engine/core-modules/auth/strategies/google.auth.strategy.ts @@ -4,7 +4,7 @@ import { PassportStrategy } from '@nestjs/passport'; import { Request } from 'express'; import { Strategy, VerifyCallback } from 'passport-google-oauth20'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; export type GoogleRequest = Omit< Request, diff --git a/packages/twenty-server/src/engine/core-modules/auth/strategies/jwt.auth.strategy.ts b/packages/twenty-server/src/engine/core-modules/auth/strategies/jwt.auth.strategy.ts index 6f74363572d2..3a81540048ef 100644 --- a/packages/twenty-server/src/engine/core-modules/auth/strategies/jwt.auth.strategy.ts +++ b/packages/twenty-server/src/engine/core-modules/auth/strategies/jwt.auth.strategy.ts @@ -13,7 +13,7 @@ import { import { AuthContext } from 'src/engine/core-modules/auth/types/auth-context.type'; import { User } from 'src/engine/core-modules/user/user.entity'; import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; import { DataSourceService } from 'src/engine/metadata-modules/data-source/data-source.service'; import { ApiKeyWorkspaceEntity } from 'src/modules/api-key/standard-objects/api-key.workspace-entity'; diff --git a/packages/twenty-server/src/engine/core-modules/auth/strategies/microsoft.auth.strategy.ts b/packages/twenty-server/src/engine/core-modules/auth/strategies/microsoft.auth.strategy.ts index 8eae65a81d44..48a097734b6a 100644 --- a/packages/twenty-server/src/engine/core-modules/auth/strategies/microsoft.auth.strategy.ts +++ b/packages/twenty-server/src/engine/core-modules/auth/strategies/microsoft.auth.strategy.ts @@ -8,7 +8,7 @@ import { AuthException, AuthExceptionCode, } from 'src/engine/core-modules/auth/auth.exception'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; export type MicrosoftRequest = Omit< Request, diff --git a/packages/twenty-server/src/engine/core-modules/billing/jobs/update-subscription.job.ts b/packages/twenty-server/src/engine/core-modules/billing/jobs/update-subscription.job.ts index 45d723329f9b..a91446b1c572 100644 --- a/packages/twenty-server/src/engine/core-modules/billing/jobs/update-subscription.job.ts +++ b/packages/twenty-server/src/engine/core-modules/billing/jobs/update-subscription.job.ts @@ -3,9 +3,9 @@ import { Logger, Scope } from '@nestjs/common'; import { BillingSubscriptionService } from 'src/engine/core-modules/billing/services/billing-subscription.service'; import { StripeService } from 'src/engine/core-modules/billing/stripe/stripe.service'; import { UserWorkspaceService } from 'src/engine/core-modules/user-workspace/user-workspace.service'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; export type UpdateSubscriptionJobData = { workspaceId: string }; @Processor({ diff --git a/packages/twenty-server/src/engine/core-modules/billing/listeners/billing-workspace-member.listener.ts b/packages/twenty-server/src/engine/core-modules/billing/listeners/billing-workspace-member.listener.ts index 0d6f03ef49a8..13d41985007b 100644 --- a/packages/twenty-server/src/engine/core-modules/billing/listeners/billing-workspace-member.listener.ts +++ b/packages/twenty-server/src/engine/core-modules/billing/listeners/billing-workspace-member.listener.ts @@ -5,11 +5,11 @@ import { UpdateSubscriptionJob, UpdateSubscriptionJobData, } from 'src/engine/core-modules/billing/jobs/update-subscription.job'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; -import { ObjectRecordCreateEvent } from 'src/engine/integrations/event-emitter/types/object-record-create.event'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; +import { ObjectRecordCreateEvent } from 'src/engine/core-modules/event-emitter/types/object-record-create.event'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { WorkspaceEventBatch } from 'src/engine/workspace-event-emitter/workspace-event.type'; import { WorkspaceMemberWorkspaceEntity } from 'src/modules/workspace-member/standard-objects/workspace-member.workspace-entity'; diff --git a/packages/twenty-server/src/engine/core-modules/billing/services/billing-portal.workspace-service.ts b/packages/twenty-server/src/engine/core-modules/billing/services/billing-portal.workspace-service.ts index d4a7a333f394..b63e1fd042ba 100644 --- a/packages/twenty-server/src/engine/core-modules/billing/services/billing-portal.workspace-service.ts +++ b/packages/twenty-server/src/engine/core-modules/billing/services/billing-portal.workspace-service.ts @@ -9,7 +9,7 @@ import { StripeService } from 'src/engine/core-modules/billing/stripe/stripe.ser import { UserWorkspaceService } from 'src/engine/core-modules/user-workspace/user-workspace.service'; import { User } from 'src/engine/core-modules/user/user.entity'; import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; import { assert } from 'src/utils/assert'; export enum WebhookEvent { diff --git a/packages/twenty-server/src/engine/core-modules/billing/services/billing-subscription.service.ts b/packages/twenty-server/src/engine/core-modules/billing/services/billing-subscription.service.ts index 15fb1df7151d..248d3fa6ebbd 100644 --- a/packages/twenty-server/src/engine/core-modules/billing/services/billing-subscription.service.ts +++ b/packages/twenty-server/src/engine/core-modules/billing/services/billing-subscription.service.ts @@ -18,7 +18,7 @@ import { StripeService } from 'src/engine/core-modules/billing/stripe/stripe.ser import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum'; import { FeatureFlagEntity } from 'src/engine/core-modules/feature-flag/feature-flag.entity'; import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; @Injectable() export class BillingSubscriptionService { diff --git a/packages/twenty-server/src/engine/core-modules/billing/services/billing.service.ts b/packages/twenty-server/src/engine/core-modules/billing/services/billing.service.ts index 455b30cfe096..8004d46e5c70 100644 --- a/packages/twenty-server/src/engine/core-modules/billing/services/billing.service.ts +++ b/packages/twenty-server/src/engine/core-modules/billing/services/billing.service.ts @@ -6,7 +6,7 @@ import { SubscriptionStatus } from 'src/engine/core-modules/billing/entities/bil import { BillingSubscriptionService } from 'src/engine/core-modules/billing/services/billing-subscription.service'; import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum'; import { FeatureFlagService } from 'src/engine/core-modules/feature-flag/services/feature-flag.service'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; @Injectable() export class BillingService { diff --git a/packages/twenty-server/src/engine/core-modules/billing/stripe/stripe.service.ts b/packages/twenty-server/src/engine/core-modules/billing/stripe/stripe.service.ts index 7dba53b26ba7..c62eb845f7fe 100644 --- a/packages/twenty-server/src/engine/core-modules/billing/stripe/stripe.service.ts +++ b/packages/twenty-server/src/engine/core-modules/billing/stripe/stripe.service.ts @@ -7,7 +7,7 @@ import { AvailableProduct } from 'src/engine/core-modules/billing/interfaces/ava import { ProductPriceEntity } from 'src/engine/core-modules/billing/dto/product-price.entity'; import { BillingSubscriptionItem } from 'src/engine/core-modules/billing/entities/billing-subscription-item.entity'; import { User } from 'src/engine/core-modules/user/user.entity'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; @Injectable() export class StripeService { diff --git a/packages/twenty-server/src/engine/integrations/cache-storage/cache-storage.module-factory.ts b/packages/twenty-server/src/engine/core-modules/cache-storage/cache-storage.module-factory.ts similarity index 91% rename from packages/twenty-server/src/engine/integrations/cache-storage/cache-storage.module-factory.ts rename to packages/twenty-server/src/engine/core-modules/cache-storage/cache-storage.module-factory.ts index 9894699387be..ce7cb740a511 100644 --- a/packages/twenty-server/src/engine/integrations/cache-storage/cache-storage.module-factory.ts +++ b/packages/twenty-server/src/engine/core-modules/cache-storage/cache-storage.module-factory.ts @@ -2,8 +2,8 @@ import { CacheModuleOptions } from '@nestjs/common'; import { redisStore } from 'cache-manager-redis-yet'; -import { CacheStorageType } from 'src/engine/integrations/cache-storage/types/cache-storage-type.enum'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { CacheStorageType } from 'src/engine/core-modules/cache-storage/types/cache-storage-type.enum'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; export const cacheStorageModuleFactory = ( environmentService: EnvironmentService, diff --git a/packages/twenty-server/src/engine/integrations/cache-storage/cache-storage.module.ts b/packages/twenty-server/src/engine/core-modules/cache-storage/cache-storage.module.ts similarity index 79% rename from packages/twenty-server/src/engine/integrations/cache-storage/cache-storage.module.ts rename to packages/twenty-server/src/engine/core-modules/cache-storage/cache-storage.module.ts index b2af3906259a..2308379d01ac 100644 --- a/packages/twenty-server/src/engine/integrations/cache-storage/cache-storage.module.ts +++ b/packages/twenty-server/src/engine/core-modules/cache-storage/cache-storage.module.ts @@ -2,10 +2,10 @@ import { Module, Global, Inject, OnModuleDestroy } from '@nestjs/common'; import { CacheModule, CACHE_MANAGER, Cache } from '@nestjs/cache-manager'; import { ConfigModule } from '@nestjs/config'; -import { CacheStorageService } from 'src/engine/integrations/cache-storage/cache-storage.service'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; -import { cacheStorageModuleFactory } from 'src/engine/integrations/cache-storage/cache-storage.module-factory'; -import { CacheStorageNamespace } from 'src/engine/integrations/cache-storage/types/cache-storage-namespace.enum'; +import { CacheStorageService } from 'src/engine/core-modules/cache-storage/cache-storage.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; +import { cacheStorageModuleFactory } from 'src/engine/core-modules/cache-storage/cache-storage.module-factory'; +import { CacheStorageNamespace } from 'src/engine/core-modules/cache-storage/types/cache-storage-namespace.enum'; @Global() @Module({ diff --git a/packages/twenty-server/src/engine/integrations/cache-storage/cache-storage.service.ts b/packages/twenty-server/src/engine/core-modules/cache-storage/cache-storage.service.ts similarity index 96% rename from packages/twenty-server/src/engine/integrations/cache-storage/cache-storage.service.ts rename to packages/twenty-server/src/engine/core-modules/cache-storage/cache-storage.service.ts index 6f6bd3e1e15b..e5195c18ad8a 100644 --- a/packages/twenty-server/src/engine/integrations/cache-storage/cache-storage.service.ts +++ b/packages/twenty-server/src/engine/core-modules/cache-storage/cache-storage.service.ts @@ -3,7 +3,7 @@ import { CACHE_MANAGER, Cache } from '@nestjs/cache-manager'; import { RedisCache } from 'cache-manager-redis-yet'; -import { CacheStorageNamespace } from 'src/engine/integrations/cache-storage/types/cache-storage-namespace.enum'; +import { CacheStorageNamespace } from 'src/engine/core-modules/cache-storage/types/cache-storage-namespace.enum'; @Injectable() export class CacheStorageService { diff --git a/packages/twenty-server/src/engine/integrations/cache-storage/decorators/cache-storage.decorator.ts b/packages/twenty-server/src/engine/core-modules/cache-storage/decorators/cache-storage.decorator.ts similarity index 78% rename from packages/twenty-server/src/engine/integrations/cache-storage/decorators/cache-storage.decorator.ts rename to packages/twenty-server/src/engine/core-modules/cache-storage/decorators/cache-storage.decorator.ts index 4782059b269f..0cd48cce30ca 100644 --- a/packages/twenty-server/src/engine/integrations/cache-storage/decorators/cache-storage.decorator.ts +++ b/packages/twenty-server/src/engine/core-modules/cache-storage/decorators/cache-storage.decorator.ts @@ -1,6 +1,6 @@ import { Inject } from '@nestjs/common'; -import { CacheStorageNamespace } from 'src/engine/integrations/cache-storage/types/cache-storage-namespace.enum'; +import { CacheStorageNamespace } from 'src/engine/core-modules/cache-storage/types/cache-storage-namespace.enum'; export const InjectCacheStorage = ( cacheStorageNamespace: CacheStorageNamespace, diff --git a/packages/twenty-server/src/engine/integrations/cache-storage/types/cache-storage-namespace.enum.ts b/packages/twenty-server/src/engine/core-modules/cache-storage/types/cache-storage-namespace.enum.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/cache-storage/types/cache-storage-namespace.enum.ts rename to packages/twenty-server/src/engine/core-modules/cache-storage/types/cache-storage-namespace.enum.ts diff --git a/packages/twenty-server/src/engine/integrations/cache-storage/types/cache-storage-type.enum.ts b/packages/twenty-server/src/engine/core-modules/cache-storage/types/cache-storage-type.enum.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/cache-storage/types/cache-storage-type.enum.ts rename to packages/twenty-server/src/engine/core-modules/cache-storage/types/cache-storage-type.enum.ts diff --git a/packages/twenty-server/src/engine/integrations/captcha/captcha.constants.ts b/packages/twenty-server/src/engine/core-modules/captcha/captcha.constants.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/captcha/captcha.constants.ts rename to packages/twenty-server/src/engine/core-modules/captcha/captcha.constants.ts diff --git a/packages/twenty-server/src/engine/integrations/captcha/captcha.guard.ts b/packages/twenty-server/src/engine/core-modules/captcha/captcha.guard.ts similarity index 91% rename from packages/twenty-server/src/engine/integrations/captcha/captcha.guard.ts rename to packages/twenty-server/src/engine/core-modules/captcha/captcha.guard.ts index 46bed4fbded6..dc4513621c31 100644 --- a/packages/twenty-server/src/engine/integrations/captcha/captcha.guard.ts +++ b/packages/twenty-server/src/engine/core-modules/captcha/captcha.guard.ts @@ -6,7 +6,7 @@ import { } from '@nestjs/common'; import { GqlExecutionContext } from '@nestjs/graphql'; -import { CaptchaService } from 'src/engine/integrations/captcha/captcha.service'; +import { CaptchaService } from 'src/engine/core-modules/captcha/captcha.service'; @Injectable() export class CaptchaGuard implements CanActivate { diff --git a/packages/twenty-server/src/engine/integrations/captcha/captcha.module-factory.ts b/packages/twenty-server/src/engine/core-modules/captcha/captcha.module-factory.ts similarity index 85% rename from packages/twenty-server/src/engine/integrations/captcha/captcha.module-factory.ts rename to packages/twenty-server/src/engine/core-modules/captcha/captcha.module-factory.ts index fc391f4050fd..c6a1e4c23edc 100644 --- a/packages/twenty-server/src/engine/integrations/captcha/captcha.module-factory.ts +++ b/packages/twenty-server/src/engine/core-modules/captcha/captcha.module-factory.ts @@ -1,8 +1,8 @@ import { CaptchaDriverOptions, CaptchaModuleOptions, -} from 'src/engine/integrations/captcha/interfaces'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +} from 'src/engine/core-modules/captcha/interfaces'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; export const captchaModuleFactory = ( environmentService: EnvironmentService, diff --git a/packages/twenty-server/src/engine/integrations/captcha/captcha.module.ts b/packages/twenty-server/src/engine/core-modules/captcha/captcha.module.ts similarity index 76% rename from packages/twenty-server/src/engine/integrations/captcha/captcha.module.ts rename to packages/twenty-server/src/engine/core-modules/captcha/captcha.module.ts index 506e51f42b2f..8c9dd1935189 100644 --- a/packages/twenty-server/src/engine/integrations/captcha/captcha.module.ts +++ b/packages/twenty-server/src/engine/core-modules/captcha/captcha.module.ts @@ -1,13 +1,13 @@ import { DynamicModule, Global } from '@nestjs/common'; -import { CAPTCHA_DRIVER } from 'src/engine/integrations/captcha/captcha.constants'; -import { CaptchaService } from 'src/engine/integrations/captcha/captcha.service'; -import { GoogleRecaptchaDriver } from 'src/engine/integrations/captcha/drivers/google-recaptcha.driver'; -import { TurnstileDriver } from 'src/engine/integrations/captcha/drivers/turnstile.driver'; +import { CAPTCHA_DRIVER } from 'src/engine/core-modules/captcha/captcha.constants'; +import { CaptchaService } from 'src/engine/core-modules/captcha/captcha.service'; +import { GoogleRecaptchaDriver } from 'src/engine/core-modules/captcha/drivers/google-recaptcha.driver'; +import { TurnstileDriver } from 'src/engine/core-modules/captcha/drivers/turnstile.driver'; import { CaptchaDriverType, CaptchaModuleAsyncOptions, -} from 'src/engine/integrations/captcha/interfaces'; +} from 'src/engine/core-modules/captcha/interfaces'; @Global() export class CaptchaModule { diff --git a/packages/twenty-server/src/engine/integrations/captcha/captcha.service.ts b/packages/twenty-server/src/engine/core-modules/captcha/captcha.service.ts similarity index 71% rename from packages/twenty-server/src/engine/integrations/captcha/captcha.service.ts rename to packages/twenty-server/src/engine/core-modules/captcha/captcha.service.ts index 58af667e04e1..7a0c85e5d644 100644 --- a/packages/twenty-server/src/engine/integrations/captcha/captcha.service.ts +++ b/packages/twenty-server/src/engine/core-modules/captcha/captcha.service.ts @@ -1,9 +1,9 @@ import { Inject, Injectable } from '@nestjs/common'; -import { CaptchaDriver } from 'src/engine/integrations/captcha/drivers/interfaces/captcha-driver.interface'; +import { CaptchaDriver } from 'src/engine/core-modules/captcha/drivers/interfaces/captcha-driver.interface'; -import { CAPTCHA_DRIVER } from 'src/engine/integrations/captcha/captcha.constants'; -import { CaptchaValidateResult } from 'src/engine/integrations/captcha/interfaces'; +import { CAPTCHA_DRIVER } from 'src/engine/core-modules/captcha/captcha.constants'; +import { CaptchaValidateResult } from 'src/engine/core-modules/captcha/interfaces'; @Injectable() export class CaptchaService implements CaptchaDriver { diff --git a/packages/twenty-server/src/engine/integrations/captcha/drivers/google-recaptcha.driver.ts b/packages/twenty-server/src/engine/core-modules/captcha/drivers/google-recaptcha.driver.ts similarity index 86% rename from packages/twenty-server/src/engine/integrations/captcha/drivers/google-recaptcha.driver.ts rename to packages/twenty-server/src/engine/core-modules/captcha/drivers/google-recaptcha.driver.ts index 85b766124fd3..008d8705b419 100644 --- a/packages/twenty-server/src/engine/integrations/captcha/drivers/google-recaptcha.driver.ts +++ b/packages/twenty-server/src/engine/core-modules/captcha/drivers/google-recaptcha.driver.ts @@ -1,12 +1,12 @@ import axios, { AxiosInstance } from 'axios'; -import { CaptchaDriver } from 'src/engine/integrations/captcha/drivers/interfaces/captcha-driver.interface'; -import { CaptchaServerResponse } from 'src/engine/integrations/captcha/drivers/interfaces/captcha-server-response'; +import { CaptchaDriver } from 'src/engine/core-modules/captcha/drivers/interfaces/captcha-driver.interface'; +import { CaptchaServerResponse } from 'src/engine/core-modules/captcha/drivers/interfaces/captcha-server-response'; import { CaptchaDriverOptions, CaptchaValidateResult, -} from 'src/engine/integrations/captcha/interfaces'; +} from 'src/engine/core-modules/captcha/interfaces'; export class GoogleRecaptchaDriver implements CaptchaDriver { private readonly siteKey: string; diff --git a/packages/twenty-server/src/engine/integrations/captcha/drivers/interfaces/captcha-driver.interface.ts b/packages/twenty-server/src/engine/core-modules/captcha/drivers/interfaces/captcha-driver.interface.ts similarity index 64% rename from packages/twenty-server/src/engine/integrations/captcha/drivers/interfaces/captcha-driver.interface.ts rename to packages/twenty-server/src/engine/core-modules/captcha/drivers/interfaces/captcha-driver.interface.ts index 532640a79ba6..b40d6f97301e 100644 --- a/packages/twenty-server/src/engine/integrations/captcha/drivers/interfaces/captcha-driver.interface.ts +++ b/packages/twenty-server/src/engine/core-modules/captcha/drivers/interfaces/captcha-driver.interface.ts @@ -1,4 +1,4 @@ -import { CaptchaValidateResult } from 'src/engine/integrations/captcha/interfaces'; +import { CaptchaValidateResult } from 'src/engine/core-modules/captcha/interfaces'; export interface CaptchaDriver { validate(token: string): Promise<CaptchaValidateResult>; diff --git a/packages/twenty-server/src/engine/integrations/captcha/drivers/interfaces/captcha-server-response.ts b/packages/twenty-server/src/engine/core-modules/captcha/drivers/interfaces/captcha-server-response.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/captcha/drivers/interfaces/captcha-server-response.ts rename to packages/twenty-server/src/engine/core-modules/captcha/drivers/interfaces/captcha-server-response.ts diff --git a/packages/twenty-server/src/engine/integrations/captcha/drivers/turnstile.driver.ts b/packages/twenty-server/src/engine/core-modules/captcha/drivers/turnstile.driver.ts similarity index 86% rename from packages/twenty-server/src/engine/integrations/captcha/drivers/turnstile.driver.ts rename to packages/twenty-server/src/engine/core-modules/captcha/drivers/turnstile.driver.ts index 5dbe5d3e1eb0..ff21d8f62efc 100644 --- a/packages/twenty-server/src/engine/integrations/captcha/drivers/turnstile.driver.ts +++ b/packages/twenty-server/src/engine/core-modules/captcha/drivers/turnstile.driver.ts @@ -1,12 +1,12 @@ import axios, { AxiosInstance } from 'axios'; -import { CaptchaDriver } from 'src/engine/integrations/captcha/drivers/interfaces/captcha-driver.interface'; -import { CaptchaServerResponse } from 'src/engine/integrations/captcha/drivers/interfaces/captcha-server-response'; +import { CaptchaDriver } from 'src/engine/core-modules/captcha/drivers/interfaces/captcha-driver.interface'; +import { CaptchaServerResponse } from 'src/engine/core-modules/captcha/drivers/interfaces/captcha-server-response'; import { CaptchaDriverOptions, CaptchaValidateResult, -} from 'src/engine/integrations/captcha/interfaces'; +} from 'src/engine/core-modules/captcha/interfaces'; export class TurnstileDriver implements CaptchaDriver { private readonly siteKey: string; diff --git a/packages/twenty-server/src/engine/integrations/captcha/interfaces/captcha.interface.ts b/packages/twenty-server/src/engine/core-modules/captcha/interfaces/captcha.interface.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/captcha/interfaces/captcha.interface.ts rename to packages/twenty-server/src/engine/core-modules/captcha/interfaces/captcha.interface.ts diff --git a/packages/twenty-server/src/engine/core-modules/captcha/interfaces/index.ts b/packages/twenty-server/src/engine/core-modules/captcha/interfaces/index.ts new file mode 100644 index 000000000000..24484ea4bc81 --- /dev/null +++ b/packages/twenty-server/src/engine/core-modules/captcha/interfaces/index.ts @@ -0,0 +1 @@ +export * from 'packages/twenty-server/src/engine/core-modules/captcha/interfaces/captcha.interface'; diff --git a/packages/twenty-server/src/engine/core-modules/client-config/client-config.entity.ts b/packages/twenty-server/src/engine/core-modules/client-config/client-config.entity.ts index 478c89da0cd7..eefb2509be39 100644 --- a/packages/twenty-server/src/engine/core-modules/client-config/client-config.entity.ts +++ b/packages/twenty-server/src/engine/core-modules/client-config/client-config.entity.ts @@ -1,6 +1,6 @@ import { Field, ObjectType } from '@nestjs/graphql'; -import { CaptchaDriverType } from 'src/engine/integrations/captcha/interfaces'; +import { CaptchaDriverType } from 'src/engine/core-modules/captcha/interfaces'; @ObjectType() class AuthProviders { diff --git a/packages/twenty-server/src/engine/core-modules/client-config/client-config.resolver.spec.ts b/packages/twenty-server/src/engine/core-modules/client-config/client-config.resolver.spec.ts index a723405b2851..d1ecf6935710 100644 --- a/packages/twenty-server/src/engine/core-modules/client-config/client-config.resolver.spec.ts +++ b/packages/twenty-server/src/engine/core-modules/client-config/client-config.resolver.spec.ts @@ -1,6 +1,6 @@ import { Test, TestingModule } from '@nestjs/testing'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; import { ClientConfigResolver } from './client-config.resolver'; diff --git a/packages/twenty-server/src/engine/core-modules/client-config/client-config.resolver.ts b/packages/twenty-server/src/engine/core-modules/client-config/client-config.resolver.ts index c8222a3418f8..54844671bbb3 100644 --- a/packages/twenty-server/src/engine/core-modules/client-config/client-config.resolver.ts +++ b/packages/twenty-server/src/engine/core-modules/client-config/client-config.resolver.ts @@ -1,6 +1,6 @@ import { Resolver, Query } from '@nestjs/graphql'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; import { ClientConfig } from './client-config.entity'; diff --git a/packages/twenty-server/src/engine/core-modules/core-engine.module.ts b/packages/twenty-server/src/engine/core-modules/core-engine.module.ts index 27312a15159d..501afd4cbdea 100644 --- a/packages/twenty-server/src/engine/core-modules/core-engine.module.ts +++ b/packages/twenty-server/src/engine/core-modules/core-engine.module.ts @@ -1,4 +1,6 @@ import { Module } from '@nestjs/common'; +import { HttpAdapterHost } from '@nestjs/core'; +import { EventEmitterModule } from '@nestjs/event-emitter'; import { ActorModule } from 'src/engine/core-modules/actor/actor.module'; import { AISQLQueryModule } from 'src/engine/core-modules/ai-sql-query/ai-sql-query.module'; @@ -15,10 +17,32 @@ import { UserModule } from 'src/engine/core-modules/user/user.module'; import { WorkflowTriggerApiModule } from 'src/engine/core-modules/workflow/workflow-trigger-api.module'; import { WorkspaceModule } from 'src/engine/core-modules/workspace/workspace.module'; import { WorkspaceEventEmitterModule } from 'src/engine/workspace-event-emitter/workspace-event-emitter.module'; +import { EnvironmentModule } from 'src/engine/core-modules/environment/environment.module'; +import { FileStorageModule } from 'src/engine/core-modules/file-storage/file-storage.module'; +import { fileStorageModuleFactory } from 'src/engine/core-modules/file-storage/file-storage.module-factory'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; +import { LoggerModule } from 'src/engine/core-modules/logger/logger.module'; +import { loggerModuleFactory } from 'src/engine/core-modules/logger/logger.module-factory'; +import { MessageQueueModule } from 'src/engine/core-modules/message-queue/message-queue.module'; +import { messageQueueModuleFactory } from 'src/engine/core-modules/message-queue/message-queue.module-factory'; +import { ExceptionHandlerModule } from 'src/engine/core-modules/exception-handler/exception-handler.module'; +import { exceptionHandlerModuleFactory } from 'src/engine/core-modules/exception-handler/exception-handler.module-factory'; +import { EmailModule } from 'src/engine/core-modules/email/email.module'; +import { emailModuleFactory } from 'src/engine/core-modules/email/email.module-factory'; +import { CaptchaModule } from 'src/engine/core-modules/captcha/captcha.module'; +import { captchaModuleFactory } from 'src/engine/core-modules/captcha/captcha.module-factory'; +import { CacheStorageModule } from 'src/engine/core-modules/cache-storage/cache-storage.module'; +import { LLMChatModelModule } from 'src/engine/core-modules/llm-chat-model/llm-chat-model.module'; +import { llmChatModelModuleFactory } from 'src/engine/core-modules/llm-chat-model/llm-chat-model.module-factory'; +import { LLMTracingModule } from 'src/engine/core-modules/llm-tracing/llm-tracing.module'; +import { llmTracingModuleFactory } from 'src/engine/core-modules/llm-tracing/llm-tracing.module-factory'; +import { ServerlessModule } from 'src/engine/core-modules/serverless/serverless.module'; +import { serverlessModuleFactory } from 'src/engine/core-modules/serverless/serverless-module.factory'; +import { FileStorageService } from 'src/engine/core-modules/file-storage/file-storage.service'; -import { AnalyticsModule } from './analytics/analytics.module'; -import { ClientConfigModule } from './client-config/client-config.module'; import { FileModule } from './file/file.module'; +import { ClientConfigModule } from './client-config/client-config.module'; +import { AnalyticsModule } from './analytics/analytics.module'; @Module({ imports: [ @@ -40,6 +64,47 @@ import { FileModule } from './file/file.module'; WorkflowTriggerApiModule, WorkspaceEventEmitterModule, ActorModule, + EnvironmentModule.forRoot({}), + FileStorageModule.forRootAsync({ + useFactory: fileStorageModuleFactory, + inject: [EnvironmentService], + }), + LoggerModule.forRootAsync({ + useFactory: loggerModuleFactory, + inject: [EnvironmentService], + }), + MessageQueueModule.registerAsync({ + useFactory: messageQueueModuleFactory, + inject: [EnvironmentService], + }), + ExceptionHandlerModule.forRootAsync({ + useFactory: exceptionHandlerModuleFactory, + inject: [EnvironmentService, HttpAdapterHost], + }), + EmailModule.forRoot({ + useFactory: emailModuleFactory, + inject: [EnvironmentService], + }), + CaptchaModule.forRoot({ + useFactory: captchaModuleFactory, + inject: [EnvironmentService], + }), + EventEmitterModule.forRoot({ + wildcard: true, + }), + CacheStorageModule, + LLMChatModelModule.forRoot({ + useFactory: llmChatModelModuleFactory, + inject: [EnvironmentService], + }), + LLMTracingModule.forRoot({ + useFactory: llmTracingModuleFactory, + inject: [EnvironmentService], + }), + ServerlessModule.forRootAsync({ + useFactory: serverlessModuleFactory, + inject: [EnvironmentService, FileStorageService], + }), ], exports: [ AnalyticsModule, diff --git a/packages/twenty-server/src/engine/integrations/email/drivers/interfaces/email-driver.interface.ts b/packages/twenty-server/src/engine/core-modules/email/drivers/interfaces/email-driver.interface.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/email/drivers/interfaces/email-driver.interface.ts rename to packages/twenty-server/src/engine/core-modules/email/drivers/interfaces/email-driver.interface.ts diff --git a/packages/twenty-server/src/engine/integrations/email/drivers/logger.driver.ts b/packages/twenty-server/src/engine/core-modules/email/drivers/logger.driver.ts similarity index 90% rename from packages/twenty-server/src/engine/integrations/email/drivers/logger.driver.ts rename to packages/twenty-server/src/engine/core-modules/email/drivers/logger.driver.ts index a3138de0bd36..c8dd1e345709 100644 --- a/packages/twenty-server/src/engine/integrations/email/drivers/logger.driver.ts +++ b/packages/twenty-server/src/engine/core-modules/email/drivers/logger.driver.ts @@ -2,7 +2,7 @@ import { Logger } from '@nestjs/common'; import { SendMailOptions } from 'nodemailer'; -import { EmailDriver } from 'src/engine/integrations/email/drivers/interfaces/email-driver.interface'; +import { EmailDriver } from 'src/engine/core-modules/email/drivers/interfaces/email-driver.interface'; export class LoggerDriver implements EmailDriver { private readonly logger = new Logger(LoggerDriver.name); diff --git a/packages/twenty-server/src/engine/integrations/email/drivers/smtp.driver.ts b/packages/twenty-server/src/engine/core-modules/email/drivers/smtp.driver.ts similarity index 92% rename from packages/twenty-server/src/engine/integrations/email/drivers/smtp.driver.ts rename to packages/twenty-server/src/engine/core-modules/email/drivers/smtp.driver.ts index 94445854ec06..5f325170e10e 100644 --- a/packages/twenty-server/src/engine/integrations/email/drivers/smtp.driver.ts +++ b/packages/twenty-server/src/engine/core-modules/email/drivers/smtp.driver.ts @@ -3,7 +3,7 @@ import { Logger } from '@nestjs/common'; import { createTransport, Transporter, SendMailOptions } from 'nodemailer'; import SMTPConnection from 'nodemailer/lib/smtp-connection'; -import { EmailDriver } from 'src/engine/integrations/email/drivers/interfaces/email-driver.interface'; +import { EmailDriver } from 'src/engine/core-modules/email/drivers/interfaces/email-driver.interface'; export class SmtpDriver implements EmailDriver { private readonly logger = new Logger(SmtpDriver.name); diff --git a/packages/twenty-server/src/engine/integrations/email/email-sender.job.ts b/packages/twenty-server/src/engine/core-modules/email/email-sender.job.ts similarity index 63% rename from packages/twenty-server/src/engine/integrations/email/email-sender.job.ts rename to packages/twenty-server/src/engine/core-modules/email/email-sender.job.ts index d97117d5063c..85203d80bdb6 100644 --- a/packages/twenty-server/src/engine/integrations/email/email-sender.job.ts +++ b/packages/twenty-server/src/engine/core-modules/email/email-sender.job.ts @@ -1,9 +1,9 @@ import { SendMailOptions } from 'nodemailer'; -import { EmailSenderService } from 'src/engine/integrations/email/email-sender.service'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; +import { EmailSenderService } from 'src/engine/core-modules/email/email-sender.service'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; @Processor(MessageQueue.emailQueue) export class EmailSenderJob { diff --git a/packages/twenty-server/src/engine/integrations/email/email-sender.service.ts b/packages/twenty-server/src/engine/core-modules/email/email-sender.service.ts similarity index 76% rename from packages/twenty-server/src/engine/integrations/email/email-sender.service.ts rename to packages/twenty-server/src/engine/core-modules/email/email-sender.service.ts index 96ec2196f03d..05306fe54927 100644 --- a/packages/twenty-server/src/engine/integrations/email/email-sender.service.ts +++ b/packages/twenty-server/src/engine/core-modules/email/email-sender.service.ts @@ -2,9 +2,9 @@ import { Inject, Injectable } from '@nestjs/common'; import { SendMailOptions } from 'nodemailer'; -import { EmailDriver } from 'src/engine/integrations/email/drivers/interfaces/email-driver.interface'; +import { EmailDriver } from 'src/engine/core-modules/email/drivers/interfaces/email-driver.interface'; -import { EMAIL_DRIVER } from 'src/engine/integrations/email/email.constants'; +import { EMAIL_DRIVER } from 'src/engine/core-modules/email/email.constants'; @Injectable() export class EmailSenderService implements EmailDriver { diff --git a/packages/twenty-server/src/engine/integrations/email/email.constants.ts b/packages/twenty-server/src/engine/core-modules/email/email.constants.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/email/email.constants.ts rename to packages/twenty-server/src/engine/core-modules/email/email.constants.ts diff --git a/packages/twenty-server/src/engine/integrations/email/email.module-factory.ts b/packages/twenty-server/src/engine/core-modules/email/email.module-factory.ts similarity index 89% rename from packages/twenty-server/src/engine/integrations/email/email.module-factory.ts rename to packages/twenty-server/src/engine/core-modules/email/email.module-factory.ts index 870f30db2fab..447d857e837f 100644 --- a/packages/twenty-server/src/engine/integrations/email/email.module-factory.ts +++ b/packages/twenty-server/src/engine/core-modules/email/email.module-factory.ts @@ -1,9 +1,9 @@ import { EmailDriver, EmailModuleOptions, -} from 'src/engine/integrations/email/interfaces/email.interface'; +} from 'src/engine/core-modules/email/interfaces/email.interface'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; export const emailModuleFactory = ( environmentService: EnvironmentService, diff --git a/packages/twenty-server/src/engine/integrations/email/email.module.ts b/packages/twenty-server/src/engine/core-modules/email/email.module.ts similarity index 65% rename from packages/twenty-server/src/engine/integrations/email/email.module.ts rename to packages/twenty-server/src/engine/core-modules/email/email.module.ts index f97c246ab664..0a6b5c3a5854 100644 --- a/packages/twenty-server/src/engine/integrations/email/email.module.ts +++ b/packages/twenty-server/src/engine/core-modules/email/email.module.ts @@ -1,12 +1,12 @@ import { DynamicModule, Global } from '@nestjs/common'; -import { EmailModuleAsyncOptions } from 'src/engine/integrations/email/interfaces/email.interface'; +import { EmailModuleAsyncOptions } from 'src/engine/core-modules/email/interfaces/email.interface'; -import { EMAIL_DRIVER } from 'src/engine/integrations/email/email.constants'; -import { LoggerDriver } from 'src/engine/integrations/email/drivers/logger.driver'; -import { SmtpDriver } from 'src/engine/integrations/email/drivers/smtp.driver'; -import { EmailService } from 'src/engine/integrations/email/email.service'; -import { EmailSenderService } from 'src/engine/integrations/email/email-sender.service'; +import { EMAIL_DRIVER } from 'src/engine/core-modules/email/email.constants'; +import { LoggerDriver } from 'src/engine/core-modules/email/drivers/logger.driver'; +import { SmtpDriver } from 'src/engine/core-modules/email/drivers/smtp.driver'; +import { EmailService } from 'src/engine/core-modules/email/email.service'; +import { EmailSenderService } from 'src/engine/core-modules/email/email-sender.service'; @Global() export class EmailModule { diff --git a/packages/twenty-server/src/engine/integrations/email/email.service.ts b/packages/twenty-server/src/engine/core-modules/email/email.service.ts similarity index 70% rename from packages/twenty-server/src/engine/integrations/email/email.service.ts rename to packages/twenty-server/src/engine/core-modules/email/email.service.ts index 79217adb8d1e..6aa24c1e6688 100644 --- a/packages/twenty-server/src/engine/integrations/email/email.service.ts +++ b/packages/twenty-server/src/engine/core-modules/email/email.service.ts @@ -2,10 +2,10 @@ import { Injectable } from '@nestjs/common'; import { SendMailOptions } from 'nodemailer'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; -import { EmailSenderJob } from 'src/engine/integrations/email/email-sender.job'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; +import { EmailSenderJob } from 'src/engine/core-modules/email/email-sender.job'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; @Injectable() export class EmailService { diff --git a/packages/twenty-server/src/engine/integrations/email/interfaces/email.interface.ts b/packages/twenty-server/src/engine/core-modules/email/interfaces/email.interface.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/email/interfaces/email.interface.ts rename to packages/twenty-server/src/engine/core-modules/email/interfaces/email.interface.ts diff --git a/packages/twenty-server/src/engine/integrations/environment/decorators/__tests__/cast-to-log-level-array.decorator.spec.ts b/packages/twenty-server/src/engine/core-modules/environment/decorators/__tests__/cast-to-log-level-array.decorator.spec.ts similarity index 96% rename from packages/twenty-server/src/engine/integrations/environment/decorators/__tests__/cast-to-log-level-array.decorator.spec.ts rename to packages/twenty-server/src/engine/core-modules/environment/decorators/__tests__/cast-to-log-level-array.decorator.spec.ts index 43447e2de1e8..a35e03676ea3 100644 --- a/packages/twenty-server/src/engine/integrations/environment/decorators/__tests__/cast-to-log-level-array.decorator.spec.ts +++ b/packages/twenty-server/src/engine/core-modules/environment/decorators/__tests__/cast-to-log-level-array.decorator.spec.ts @@ -1,6 +1,6 @@ import { plainToClass } from 'class-transformer'; -import { CastToLogLevelArray } from 'src/engine/integrations/environment/decorators/cast-to-log-level-array.decorator'; +import { CastToLogLevelArray } from 'src/engine/core-modules/environment/decorators/cast-to-log-level-array.decorator'; class TestClass { @CastToLogLevelArray() diff --git a/packages/twenty-server/src/engine/integrations/environment/decorators/__tests__/cast-to-positive-number.decorator.spec.ts b/packages/twenty-server/src/engine/core-modules/environment/decorators/__tests__/cast-to-positive-number.decorator.spec.ts similarity index 96% rename from packages/twenty-server/src/engine/integrations/environment/decorators/__tests__/cast-to-positive-number.decorator.spec.ts rename to packages/twenty-server/src/engine/core-modules/environment/decorators/__tests__/cast-to-positive-number.decorator.spec.ts index f3f77fb4c333..cf302e0fd7c6 100644 --- a/packages/twenty-server/src/engine/integrations/environment/decorators/__tests__/cast-to-positive-number.decorator.spec.ts +++ b/packages/twenty-server/src/engine/core-modules/environment/decorators/__tests__/cast-to-positive-number.decorator.spec.ts @@ -1,6 +1,6 @@ import { plainToClass } from 'class-transformer'; -import { CastToPositiveNumber } from 'src/engine/integrations/environment/decorators/cast-to-positive-number.decorator'; +import { CastToPositiveNumber } from 'src/engine/core-modules/environment/decorators/cast-to-positive-number.decorator'; class TestClass { @CastToPositiveNumber() diff --git a/packages/twenty-server/src/engine/integrations/environment/decorators/cast-to-boolean.decorator.ts b/packages/twenty-server/src/engine/core-modules/environment/decorators/cast-to-boolean.decorator.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/environment/decorators/cast-to-boolean.decorator.ts rename to packages/twenty-server/src/engine/core-modules/environment/decorators/cast-to-boolean.decorator.ts diff --git a/packages/twenty-server/src/engine/integrations/environment/decorators/cast-to-log-level-array.decorator.ts b/packages/twenty-server/src/engine/core-modules/environment/decorators/cast-to-log-level-array.decorator.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/environment/decorators/cast-to-log-level-array.decorator.ts rename to packages/twenty-server/src/engine/core-modules/environment/decorators/cast-to-log-level-array.decorator.ts diff --git a/packages/twenty-server/src/engine/integrations/environment/decorators/cast-to-positive-number.decorator.ts b/packages/twenty-server/src/engine/core-modules/environment/decorators/cast-to-positive-number.decorator.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/environment/decorators/cast-to-positive-number.decorator.ts rename to packages/twenty-server/src/engine/core-modules/environment/decorators/cast-to-positive-number.decorator.ts diff --git a/packages/twenty-server/src/engine/integrations/environment/decorators/cast-to-string-array.decorator.ts b/packages/twenty-server/src/engine/core-modules/environment/decorators/cast-to-string-array.decorator.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/environment/decorators/cast-to-string-array.decorator.ts rename to packages/twenty-server/src/engine/core-modules/environment/decorators/cast-to-string-array.decorator.ts diff --git a/packages/twenty-server/src/engine/integrations/environment/decorators/is-aws-region.decorator.ts b/packages/twenty-server/src/engine/core-modules/environment/decorators/is-aws-region.decorator.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/environment/decorators/is-aws-region.decorator.ts rename to packages/twenty-server/src/engine/core-modules/environment/decorators/is-aws-region.decorator.ts diff --git a/packages/twenty-server/src/engine/integrations/environment/decorators/is-duration.decorator.ts b/packages/twenty-server/src/engine/core-modules/environment/decorators/is-duration.decorator.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/environment/decorators/is-duration.decorator.ts rename to packages/twenty-server/src/engine/core-modules/environment/decorators/is-duration.decorator.ts diff --git a/packages/twenty-server/src/engine/integrations/environment/decorators/is-strictly-lower-than.decorator.ts b/packages/twenty-server/src/engine/core-modules/environment/decorators/is-strictly-lower-than.decorator.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/environment/decorators/is-strictly-lower-than.decorator.ts rename to packages/twenty-server/src/engine/core-modules/environment/decorators/is-strictly-lower-than.decorator.ts diff --git a/packages/twenty-server/src/engine/integrations/environment/environment-variables.ts b/packages/twenty-server/src/engine/core-modules/environment/environment-variables.ts similarity index 85% rename from packages/twenty-server/src/engine/integrations/environment/environment-variables.ts rename to packages/twenty-server/src/engine/core-modules/environment/environment-variables.ts index ae8c304f72ca..04052f64fe4c 100644 --- a/packages/twenty-server/src/engine/integrations/environment/environment-variables.ts +++ b/packages/twenty-server/src/engine/core-modules/environment/environment-variables.ts @@ -15,29 +15,29 @@ import { validateSync, } from 'class-validator'; -import { EmailDriver } from 'src/engine/integrations/email/interfaces/email.interface'; -import { NodeEnvironment } from 'src/engine/integrations/environment/interfaces/node-environment.interface'; -import { LLMChatModelDriver } from 'src/engine/integrations/llm-chat-model/interfaces/llm-chat-model.interface'; -import { LLMTracingDriver } from 'src/engine/integrations/llm-tracing/interfaces/llm-tracing.interface'; - -import { CacheStorageType } from 'src/engine/integrations/cache-storage/types/cache-storage-type.enum'; -import { CaptchaDriverType } from 'src/engine/integrations/captcha/interfaces'; -import { CastToStringArray } from 'src/engine/integrations/environment/decorators/cast-to-string-array.decorator'; -import { IsStrictlyLowerThan } from 'src/engine/integrations/environment/decorators/is-strictly-lower-than.decorator'; -import { ExceptionHandlerDriver } from 'src/engine/integrations/exception-handler/interfaces'; -import { StorageDriverType } from 'src/engine/integrations/file-storage/interfaces'; -import { LoggerDriverType } from 'src/engine/integrations/logger/interfaces'; -import { MessageQueueDriverType } from 'src/engine/integrations/message-queue/interfaces'; -import { ServerlessDriverType } from 'src/engine/integrations/serverless/serverless.interface'; +import { EmailDriver } from 'src/engine/core-modules/email/interfaces/email.interface'; +import { NodeEnvironment } from 'src/engine/core-modules/environment/interfaces/node-environment.interface'; +import { LLMChatModelDriver } from 'src/engine/core-modules/llm-chat-model/interfaces/llm-chat-model.interface'; +import { LLMTracingDriver } from 'src/engine/core-modules/llm-tracing/interfaces/llm-tracing.interface'; + +import { CacheStorageType } from 'src/engine/core-modules/cache-storage/types/cache-storage-type.enum'; +import { CaptchaDriverType } from 'src/engine/core-modules/captcha/interfaces'; +import { CastToStringArray } from 'src/engine/core-modules/environment/decorators/cast-to-string-array.decorator'; +import { IsStrictlyLowerThan } from 'src/engine/core-modules/environment/decorators/is-strictly-lower-than.decorator'; +import { ExceptionHandlerDriver } from 'src/engine/core-modules/exception-handler/interfaces'; +import { StorageDriverType } from 'src/engine/core-modules/file-storage/interfaces'; +import { LoggerDriverType } from 'src/engine/core-modules/logger/interfaces'; +import { MessageQueueDriverType } from 'src/engine/core-modules/message-queue/interfaces'; +import { ServerlessDriverType } from 'src/engine/core-modules/serverless/serverless.interface'; import { assert } from 'src/utils/assert'; -import { CastToBoolean } from './decorators/cast-to-boolean.decorator'; -import { CastToLogLevelArray } from './decorators/cast-to-log-level-array.decorator'; -import { CastToPositiveNumber } from './decorators/cast-to-positive-number.decorator'; -import { IsAWSRegion } from './decorators/is-aws-region.decorator'; -import { IsDuration } from './decorators/is-duration.decorator'; -import { AwsRegion } from './interfaces/aws-region.interface'; -import { SupportDriver } from './interfaces/support.interface'; +import { CastToBoolean } from 'packages/twenty-server/src/engine/core-modules/environment/decorators/cast-to-boolean.decorator'; +import { CastToLogLevelArray } from 'packages/twenty-server/src/engine/core-modules/environment/decorators/cast-to-log-level-array.decorator'; +import { CastToPositiveNumber } from 'packages/twenty-server/src/engine/core-modules/environment/decorators/cast-to-positive-number.decorator'; +import { IsAWSRegion } from 'packages/twenty-server/src/engine/core-modules/environment/decorators/is-aws-region.decorator'; +import { IsDuration } from 'packages/twenty-server/src/engine/core-modules/environment/decorators/is-duration.decorator'; +import { AwsRegion } from 'packages/twenty-server/src/engine/core-modules/environment/interfaces/aws-region.interface'; +import { SupportDriver } from 'packages/twenty-server/src/engine/core-modules/environment/interfaces/support.interface'; export class EnvironmentVariables { // Misc diff --git a/packages/twenty-server/src/engine/integrations/environment/environment.module-definition.ts b/packages/twenty-server/src/engine/core-modules/environment/environment.module-definition.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/environment/environment.module-definition.ts rename to packages/twenty-server/src/engine/core-modules/environment/environment.module-definition.ts diff --git a/packages/twenty-server/src/engine/integrations/environment/environment.module.ts b/packages/twenty-server/src/engine/core-modules/environment/environment.module.ts similarity index 51% rename from packages/twenty-server/src/engine/integrations/environment/environment.module.ts rename to packages/twenty-server/src/engine/core-modules/environment/environment.module.ts index c42fd6ee9780..a3d4d48888c0 100644 --- a/packages/twenty-server/src/engine/integrations/environment/environment.module.ts +++ b/packages/twenty-server/src/engine/core-modules/environment/environment.module.ts @@ -1,9 +1,9 @@ import { Global, Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; -import { EnvironmentService } from './environment.service'; -import { ConfigurableModuleClass } from './environment.module-definition'; -import { validate } from './environment-variables'; +import { EnvironmentService } from 'packages/twenty-server/src/engine/core-modules/environment/environment.service'; +import { ConfigurableModuleClass } from 'packages/twenty-server/src/engine/core-modules/environment/environment.module-definition'; +import { validate } from 'packages/twenty-server/src/engine/core-modules/environment/environment-variables'; @Global() @Module({ diff --git a/packages/twenty-server/src/engine/integrations/environment/environment.service.spec.ts b/packages/twenty-server/src/engine/core-modules/environment/environment.service.spec.ts similarity index 83% rename from packages/twenty-server/src/engine/integrations/environment/environment.service.spec.ts rename to packages/twenty-server/src/engine/core-modules/environment/environment.service.spec.ts index 9b8c737424a8..8424e196adbe 100644 --- a/packages/twenty-server/src/engine/integrations/environment/environment.service.spec.ts +++ b/packages/twenty-server/src/engine/core-modules/environment/environment.service.spec.ts @@ -1,7 +1,7 @@ import { Test, TestingModule } from '@nestjs/testing'; import { ConfigService } from '@nestjs/config'; -import { EnvironmentService } from './environment.service'; +import { EnvironmentService } from 'packages/twenty-server/src/engine/core-modules/environment/environment.service'; describe('EnvironmentService', () => { let service: EnvironmentService; diff --git a/packages/twenty-server/src/engine/integrations/environment/environment.service.ts b/packages/twenty-server/src/engine/core-modules/environment/environment.service.ts similarity index 88% rename from packages/twenty-server/src/engine/integrations/environment/environment.service.ts rename to packages/twenty-server/src/engine/core-modules/environment/environment.service.ts index 8440249551fa..3860fdabde0b 100644 --- a/packages/twenty-server/src/engine/integrations/environment/environment.service.ts +++ b/packages/twenty-server/src/engine/core-modules/environment/environment.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; -import { EnvironmentVariables } from 'src/engine/integrations/environment/environment-variables'; +import { EnvironmentVariables } from 'src/engine/core-modules/environment/environment-variables'; @Injectable() export class EnvironmentService { diff --git a/packages/twenty-server/src/engine/integrations/environment/interfaces/aws-region.interface.ts b/packages/twenty-server/src/engine/core-modules/environment/interfaces/aws-region.interface.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/environment/interfaces/aws-region.interface.ts rename to packages/twenty-server/src/engine/core-modules/environment/interfaces/aws-region.interface.ts diff --git a/packages/twenty-server/src/engine/integrations/environment/interfaces/node-environment.interface.ts b/packages/twenty-server/src/engine/core-modules/environment/interfaces/node-environment.interface.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/environment/interfaces/node-environment.interface.ts rename to packages/twenty-server/src/engine/core-modules/environment/interfaces/node-environment.interface.ts diff --git a/packages/twenty-server/src/engine/integrations/environment/interfaces/support.interface.ts b/packages/twenty-server/src/engine/core-modules/environment/interfaces/support.interface.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/environment/interfaces/support.interface.ts rename to packages/twenty-server/src/engine/core-modules/environment/interfaces/support.interface.ts diff --git a/packages/twenty-server/src/engine/integrations/event-emitter/types/object-record-create.event.ts b/packages/twenty-server/src/engine/core-modules/event-emitter/types/object-record-create.event.ts similarity index 70% rename from packages/twenty-server/src/engine/integrations/event-emitter/types/object-record-create.event.ts rename to packages/twenty-server/src/engine/core-modules/event-emitter/types/object-record-create.event.ts index 0e3d6e22c686..62221beaabab 100644 --- a/packages/twenty-server/src/engine/integrations/event-emitter/types/object-record-create.event.ts +++ b/packages/twenty-server/src/engine/core-modules/event-emitter/types/object-record-create.event.ts @@ -1,4 +1,4 @@ -import { ObjectRecordBaseEvent } from 'src/engine/integrations/event-emitter/types/object-record.base.event'; +import { ObjectRecordBaseEvent } from 'src/engine/core-modules/event-emitter/types/object-record.base.event'; export class ObjectRecordCreateEvent<T> extends ObjectRecordBaseEvent { properties: { diff --git a/packages/twenty-server/src/engine/integrations/event-emitter/types/object-record-delete.event.ts b/packages/twenty-server/src/engine/core-modules/event-emitter/types/object-record-delete.event.ts similarity index 71% rename from packages/twenty-server/src/engine/integrations/event-emitter/types/object-record-delete.event.ts rename to packages/twenty-server/src/engine/core-modules/event-emitter/types/object-record-delete.event.ts index 01e981bdc76e..644ab0658a0f 100644 --- a/packages/twenty-server/src/engine/integrations/event-emitter/types/object-record-delete.event.ts +++ b/packages/twenty-server/src/engine/core-modules/event-emitter/types/object-record-delete.event.ts @@ -1,4 +1,4 @@ -import { ObjectRecordBaseEvent } from 'src/engine/integrations/event-emitter/types/object-record.base.event'; +import { ObjectRecordBaseEvent } from 'src/engine/core-modules/event-emitter/types/object-record.base.event'; export class ObjectRecordDeleteEvent<T> extends ObjectRecordBaseEvent { properties: { diff --git a/packages/twenty-server/src/engine/integrations/event-emitter/types/object-record-update.event.ts b/packages/twenty-server/src/engine/core-modules/event-emitter/types/object-record-update.event.ts similarity index 77% rename from packages/twenty-server/src/engine/integrations/event-emitter/types/object-record-update.event.ts rename to packages/twenty-server/src/engine/core-modules/event-emitter/types/object-record-update.event.ts index aa4b59e7208c..66d9f26455d2 100644 --- a/packages/twenty-server/src/engine/integrations/event-emitter/types/object-record-update.event.ts +++ b/packages/twenty-server/src/engine/core-modules/event-emitter/types/object-record-update.event.ts @@ -1,4 +1,4 @@ -import { ObjectRecordBaseEvent } from 'src/engine/integrations/event-emitter/types/object-record.base.event'; +import { ObjectRecordBaseEvent } from 'src/engine/core-modules/event-emitter/types/object-record.base.event'; export class ObjectRecordUpdateEvent<T> extends ObjectRecordBaseEvent { properties: { diff --git a/packages/twenty-server/src/engine/integrations/event-emitter/types/object-record.base.event.ts b/packages/twenty-server/src/engine/core-modules/event-emitter/types/object-record.base.event.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/event-emitter/types/object-record.base.event.ts rename to packages/twenty-server/src/engine/core-modules/event-emitter/types/object-record.base.event.ts diff --git a/packages/twenty-server/src/engine/integrations/event-emitter/utils/__tests__/object-record-changed-values.spec.ts b/packages/twenty-server/src/engine/core-modules/event-emitter/utils/__tests__/object-record-changed-values.spec.ts similarity index 96% rename from packages/twenty-server/src/engine/integrations/event-emitter/utils/__tests__/object-record-changed-values.spec.ts rename to packages/twenty-server/src/engine/core-modules/event-emitter/utils/__tests__/object-record-changed-values.spec.ts index 6772e1f8715e..c9c1806698f6 100644 --- a/packages/twenty-server/src/engine/integrations/event-emitter/utils/__tests__/object-record-changed-values.spec.ts +++ b/packages/twenty-server/src/engine/core-modules/event-emitter/utils/__tests__/object-record-changed-values.spec.ts @@ -1,6 +1,6 @@ import { ObjectMetadataInterface } from 'src/engine/metadata-modules/field-metadata/interfaces/object-metadata.interface'; -import { objectRecordChangedValues } from 'src/engine/integrations/event-emitter/utils/object-record-changed-values'; +import { objectRecordChangedValues } from 'src/engine/core-modules/event-emitter/utils/object-record-changed-values'; const mockObjectMetadata: ObjectMetadataInterface = { id: '1', diff --git a/packages/twenty-server/src/engine/integrations/event-emitter/utils/object-record-changed-properties.util.ts b/packages/twenty-server/src/engine/core-modules/event-emitter/utils/object-record-changed-properties.util.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/event-emitter/utils/object-record-changed-properties.util.ts rename to packages/twenty-server/src/engine/core-modules/event-emitter/utils/object-record-changed-properties.util.ts diff --git a/packages/twenty-server/src/engine/integrations/event-emitter/utils/object-record-changed-values.ts b/packages/twenty-server/src/engine/core-modules/event-emitter/utils/object-record-changed-values.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/event-emitter/utils/object-record-changed-values.ts rename to packages/twenty-server/src/engine/core-modules/event-emitter/utils/object-record-changed-values.ts diff --git a/packages/twenty-server/src/engine/integrations/event-emitter/utils/object-record-diff-merge.ts b/packages/twenty-server/src/engine/core-modules/event-emitter/utils/object-record-diff-merge.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/event-emitter/utils/object-record-diff-merge.ts rename to packages/twenty-server/src/engine/core-modules/event-emitter/utils/object-record-diff-merge.ts diff --git a/packages/twenty-server/src/engine/integrations/exception-handler/__tests__/exception-handler.service.spec.ts b/packages/twenty-server/src/engine/core-modules/exception-handler/__tests__/exception-handler.service.spec.ts similarity index 83% rename from packages/twenty-server/src/engine/integrations/exception-handler/__tests__/exception-handler.service.spec.ts rename to packages/twenty-server/src/engine/core-modules/exception-handler/__tests__/exception-handler.service.spec.ts index bae07ba64875..5255347d511e 100644 --- a/packages/twenty-server/src/engine/integrations/exception-handler/__tests__/exception-handler.service.spec.ts +++ b/packages/twenty-server/src/engine/core-modules/exception-handler/__tests__/exception-handler.service.spec.ts @@ -1,7 +1,7 @@ import { Test, TestingModule } from '@nestjs/testing'; -import { EXCEPTION_HANDLER_DRIVER } from 'src/engine/integrations/exception-handler/exception-handler.constants'; -import { ExceptionHandlerService } from 'src/engine/integrations/exception-handler/exception-handler.service'; +import { EXCEPTION_HANDLER_DRIVER } from 'src/engine/core-modules/exception-handler/exception-handler.constants'; +import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service'; describe('ExceptionHandlerService', () => { let service: ExceptionHandlerService; diff --git a/packages/twenty-server/src/engine/integrations/exception-handler/drivers/console.driver.ts b/packages/twenty-server/src/engine/core-modules/exception-handler/drivers/console.driver.ts similarity index 74% rename from packages/twenty-server/src/engine/integrations/exception-handler/drivers/console.driver.ts rename to packages/twenty-server/src/engine/core-modules/exception-handler/drivers/console.driver.ts index f77e02085776..8f58ebf84920 100644 --- a/packages/twenty-server/src/engine/integrations/exception-handler/drivers/console.driver.ts +++ b/packages/twenty-server/src/engine/core-modules/exception-handler/drivers/console.driver.ts @@ -1,8 +1,8 @@ /* eslint-disable no-console */ -import { ExceptionHandlerUser } from 'src/engine/integrations/exception-handler/interfaces/exception-handler-user.interface'; -import { ExceptionHandlerOptions } from 'src/engine/integrations/exception-handler/interfaces/exception-handler-options.interface'; +import { ExceptionHandlerUser } from 'src/engine/core-modules/exception-handler/interfaces/exception-handler-user.interface'; +import { ExceptionHandlerOptions } from 'src/engine/core-modules/exception-handler/interfaces/exception-handler-options.interface'; -import { ExceptionHandlerDriverInterface } from 'src/engine/integrations/exception-handler/interfaces'; +import { ExceptionHandlerDriverInterface } from 'src/engine/core-modules/exception-handler/interfaces'; export class ExceptionHandlerConsoleDriver implements ExceptionHandlerDriverInterface diff --git a/packages/twenty-server/src/engine/integrations/exception-handler/drivers/sentry.driver.ts b/packages/twenty-server/src/engine/core-modules/exception-handler/drivers/sentry.driver.ts similarity index 94% rename from packages/twenty-server/src/engine/integrations/exception-handler/drivers/sentry.driver.ts rename to packages/twenty-server/src/engine/core-modules/exception-handler/drivers/sentry.driver.ts index 1ece102d327b..6d252c3615f8 100644 --- a/packages/twenty-server/src/engine/integrations/exception-handler/drivers/sentry.driver.ts +++ b/packages/twenty-server/src/engine/core-modules/exception-handler/drivers/sentry.driver.ts @@ -1,13 +1,13 @@ import * as Sentry from '@sentry/node'; import { ProfilingIntegration } from '@sentry/profiling-node'; -import { ExceptionHandlerUser } from 'src/engine/integrations/exception-handler/interfaces/exception-handler-user.interface'; -import { ExceptionHandlerOptions } from 'src/engine/integrations/exception-handler/interfaces/exception-handler-options.interface'; +import { ExceptionHandlerUser } from 'src/engine/core-modules/exception-handler/interfaces/exception-handler-user.interface'; +import { ExceptionHandlerOptions } from 'src/engine/core-modules/exception-handler/interfaces/exception-handler-options.interface'; import { ExceptionHandlerDriverInterface, ExceptionHandlerSentryDriverFactoryOptions, -} from 'src/engine/integrations/exception-handler/interfaces'; +} from 'src/engine/core-modules/exception-handler/interfaces'; export class ExceptionHandlerSentryDriver implements ExceptionHandlerDriverInterface diff --git a/packages/twenty-server/src/engine/integrations/exception-handler/exception-handler.constants.ts b/packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.constants.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/exception-handler/exception-handler.constants.ts rename to packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.constants.ts diff --git a/packages/twenty-server/src/engine/integrations/exception-handler/exception-handler.module-definition.ts b/packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module-definition.ts similarity index 71% rename from packages/twenty-server/src/engine/integrations/exception-handler/exception-handler.module-definition.ts rename to packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module-definition.ts index 2410d6616d74..f9965a0823e6 100644 --- a/packages/twenty-server/src/engine/integrations/exception-handler/exception-handler.module-definition.ts +++ b/packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module-definition.ts @@ -1,6 +1,6 @@ import { ConfigurableModuleBuilder } from '@nestjs/common'; -import { ExceptionHandlerModuleOptions } from './interfaces'; +import { ExceptionHandlerModuleOptions } from 'packages/twenty-server/src/engine/core-modules/exception-handler/interfaces'; export const { ConfigurableModuleClass, diff --git a/packages/twenty-server/src/engine/integrations/exception-handler/exception-handler.module-factory.ts b/packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module-factory.ts similarity index 86% rename from packages/twenty-server/src/engine/integrations/exception-handler/exception-handler.module-factory.ts rename to packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module-factory.ts index fed287d51d1f..006eb4c6c138 100644 --- a/packages/twenty-server/src/engine/integrations/exception-handler/exception-handler.module-factory.ts +++ b/packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module-factory.ts @@ -1,8 +1,8 @@ import { HttpAdapterHost } from '@nestjs/core'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; -import { OPTIONS_TYPE } from 'src/engine/integrations/exception-handler/exception-handler.module-definition'; -import { ExceptionHandlerDriver } from 'src/engine/integrations/exception-handler/interfaces'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; +import { OPTIONS_TYPE } from 'src/engine/core-modules/exception-handler/exception-handler.module-definition'; +import { ExceptionHandlerDriver } from 'src/engine/core-modules/exception-handler/interfaces'; /** * ExceptionHandler Module factory diff --git a/packages/twenty-server/src/engine/integrations/exception-handler/exception-handler.module.ts b/packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module.ts similarity index 67% rename from packages/twenty-server/src/engine/integrations/exception-handler/exception-handler.module.ts rename to packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module.ts index 8c4ae87a8312..760d8b925b92 100644 --- a/packages/twenty-server/src/engine/integrations/exception-handler/exception-handler.module.ts +++ b/packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module.ts @@ -1,16 +1,16 @@ import { DynamicModule, Global, Module } from '@nestjs/common'; -import { ExceptionHandlerSentryDriver } from 'src/engine/integrations/exception-handler/drivers/sentry.driver'; -import { ExceptionHandlerConsoleDriver } from 'src/engine/integrations/exception-handler/drivers/console.driver'; +import { ExceptionHandlerSentryDriver } from 'src/engine/core-modules/exception-handler/drivers/sentry.driver'; +import { ExceptionHandlerConsoleDriver } from 'src/engine/core-modules/exception-handler/drivers/console.driver'; -import { ExceptionHandlerService } from './exception-handler.service'; -import { ExceptionHandlerDriver } from './interfaces'; -import { EXCEPTION_HANDLER_DRIVER } from './exception-handler.constants'; +import { ExceptionHandlerService } from 'packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.service'; +import { ExceptionHandlerDriver } from 'packages/twenty-server/src/engine/core-modules/exception-handler/interfaces'; +import { EXCEPTION_HANDLER_DRIVER } from 'packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.constants'; import { ConfigurableModuleClass, OPTIONS_TYPE, ASYNC_OPTIONS_TYPE, -} from './exception-handler.module-definition'; +} from 'packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module-definition'; @Global() @Module({ diff --git a/packages/twenty-server/src/engine/integrations/exception-handler/exception-handler.service.ts b/packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.service.ts similarity index 69% rename from packages/twenty-server/src/engine/integrations/exception-handler/exception-handler.service.ts rename to packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.service.ts index ac46ae3465de..a532587d7af4 100644 --- a/packages/twenty-server/src/engine/integrations/exception-handler/exception-handler.service.ts +++ b/packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.service.ts @@ -1,9 +1,9 @@ import { Inject, Injectable } from '@nestjs/common'; -import { ExceptionHandlerOptions } from 'src/engine/integrations/exception-handler/interfaces/exception-handler-options.interface'; +import { ExceptionHandlerOptions } from 'src/engine/core-modules/exception-handler/interfaces/exception-handler-options.interface'; -import { ExceptionHandlerDriverInterface } from 'src/engine/integrations/exception-handler/interfaces'; -import { EXCEPTION_HANDLER_DRIVER } from 'src/engine/integrations/exception-handler/exception-handler.constants'; +import { ExceptionHandlerDriverInterface } from 'src/engine/core-modules/exception-handler/interfaces'; +import { EXCEPTION_HANDLER_DRIVER } from 'src/engine/core-modules/exception-handler/exception-handler.constants'; @Injectable() export class ExceptionHandlerService { diff --git a/packages/twenty-server/src/engine/integrations/exception-handler/hooks/use-sentry-tracing.ts b/packages/twenty-server/src/engine/core-modules/exception-handler/hooks/use-sentry-tracing.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/exception-handler/hooks/use-sentry-tracing.ts rename to packages/twenty-server/src/engine/core-modules/exception-handler/hooks/use-sentry-tracing.ts diff --git a/packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler-driver.interface.ts b/packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler-driver.interface.ts new file mode 100644 index 000000000000..9c6ccb6ae118 --- /dev/null +++ b/packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler-driver.interface.ts @@ -0,0 +1,10 @@ +import { ExceptionHandlerOptions } from 'packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler-options.interface'; +import { ExceptionHandlerUser } from 'packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler-user.interface'; + +export interface ExceptionHandlerDriverInterface { + captureExceptions( + exceptions: ReadonlyArray<any>, + options?: ExceptionHandlerOptions, + ): string[]; + captureMessage(message: string, user?: ExceptionHandlerUser): void; +} diff --git a/packages/twenty-server/src/engine/integrations/exception-handler/interfaces/exception-handler-options.interface.ts b/packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler-options.interface.ts similarity index 59% rename from packages/twenty-server/src/engine/integrations/exception-handler/interfaces/exception-handler-options.interface.ts rename to packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler-options.interface.ts index f01c7e169446..c6842717d7a4 100644 --- a/packages/twenty-server/src/engine/integrations/exception-handler/interfaces/exception-handler-options.interface.ts +++ b/packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler-options.interface.ts @@ -1,6 +1,6 @@ import { OperationTypeNode } from 'graphql'; -import { ExceptionHandlerUser } from './exception-handler-user.interface'; +import { ExceptionHandlerUser } from 'packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler-user.interface'; export interface ExceptionHandlerOptions { operation?: { diff --git a/packages/twenty-server/src/engine/integrations/exception-handler/interfaces/exception-handler-user.interface.ts b/packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler-user.interface.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/exception-handler/interfaces/exception-handler-user.interface.ts rename to packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler-user.interface.ts diff --git a/packages/twenty-server/src/engine/integrations/exception-handler/interfaces/exception-handler.interface.ts b/packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler.interface.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/exception-handler/interfaces/exception-handler.interface.ts rename to packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler.interface.ts diff --git a/packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/index.ts b/packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/index.ts new file mode 100644 index 000000000000..d3f22e0f7278 --- /dev/null +++ b/packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/index.ts @@ -0,0 +1,2 @@ +export * from 'packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler.interface'; +export * from 'packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler-driver.interface'; diff --git a/packages/twenty-server/src/engine/integrations/file-storage/__tests__/file-storage.service.spec.ts b/packages/twenty-server/src/engine/core-modules/file-storage/__tests__/file-storage.service.spec.ts similarity index 82% rename from packages/twenty-server/src/engine/integrations/file-storage/__tests__/file-storage.service.spec.ts rename to packages/twenty-server/src/engine/core-modules/file-storage/__tests__/file-storage.service.spec.ts index 4ef268cf6ca5..21210726eb07 100644 --- a/packages/twenty-server/src/engine/integrations/file-storage/__tests__/file-storage.service.spec.ts +++ b/packages/twenty-server/src/engine/core-modules/file-storage/__tests__/file-storage.service.spec.ts @@ -1,7 +1,7 @@ import { Test, TestingModule } from '@nestjs/testing'; -import { STORAGE_DRIVER } from 'src/engine/integrations/file-storage/file-storage.constants'; -import { FileStorageService } from 'src/engine/integrations/file-storage/file-storage.service'; +import { STORAGE_DRIVER } from 'src/engine/core-modules/file-storage/file-storage.constants'; +import { FileStorageService } from 'src/engine/core-modules/file-storage/file-storage.service'; describe('FileStorageService', () => { let service: FileStorageService; diff --git a/packages/twenty-server/src/engine/integrations/file-storage/drivers/interfaces/storage-driver.interface.ts b/packages/twenty-server/src/engine/core-modules/file-storage/drivers/interfaces/storage-driver.interface.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/file-storage/drivers/interfaces/storage-driver.interface.ts rename to packages/twenty-server/src/engine/core-modules/file-storage/drivers/interfaces/storage-driver.interface.ts diff --git a/packages/twenty-server/src/engine/integrations/file-storage/drivers/local.driver.ts b/packages/twenty-server/src/engine/core-modules/file-storage/drivers/local.driver.ts similarity index 94% rename from packages/twenty-server/src/engine/integrations/file-storage/drivers/local.driver.ts rename to packages/twenty-server/src/engine/core-modules/file-storage/drivers/local.driver.ts index fdfa3943a9ec..6ecdf4e08e97 100644 --- a/packages/twenty-server/src/engine/integrations/file-storage/drivers/local.driver.ts +++ b/packages/twenty-server/src/engine/core-modules/file-storage/drivers/local.driver.ts @@ -6,9 +6,9 @@ import { Readable } from 'stream'; import { FileStorageException, FileStorageExceptionCode, -} from 'src/engine/integrations/file-storage/interfaces/file-storage-exception'; +} from 'src/engine/core-modules/file-storage/interfaces/file-storage-exception'; -import { StorageDriver } from './interfaces/storage-driver.interface'; +import { StorageDriver } from 'packages/twenty-server/src/engine/core-modules/file-storage/drivers/interfaces/storage-driver.interface'; export interface LocalDriverOptions { storagePath: string; diff --git a/packages/twenty-server/src/engine/integrations/file-storage/drivers/s3.driver.ts b/packages/twenty-server/src/engine/core-modules/file-storage/drivers/s3.driver.ts similarity index 97% rename from packages/twenty-server/src/engine/integrations/file-storage/drivers/s3.driver.ts rename to packages/twenty-server/src/engine/core-modules/file-storage/drivers/s3.driver.ts index 4c4adb6bb164..11d857eb5705 100644 --- a/packages/twenty-server/src/engine/integrations/file-storage/drivers/s3.driver.ts +++ b/packages/twenty-server/src/engine/core-modules/file-storage/drivers/s3.driver.ts @@ -18,11 +18,11 @@ import { import { FileStorageException, FileStorageExceptionCode, -} from 'src/engine/integrations/file-storage/interfaces/file-storage-exception'; +} from 'src/engine/core-modules/file-storage/interfaces/file-storage-exception'; import { isDefined } from 'src/utils/is-defined'; -import { StorageDriver } from './interfaces/storage-driver.interface'; +import { StorageDriver } from 'packages/twenty-server/src/engine/core-modules/file-storage/drivers/interfaces/storage-driver.interface'; export interface S3DriverOptions extends S3ClientConfig { bucketName: string; diff --git a/packages/twenty-server/src/engine/integrations/file-storage/file-storage.constants.ts b/packages/twenty-server/src/engine/core-modules/file-storage/file-storage.constants.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/file-storage/file-storage.constants.ts rename to packages/twenty-server/src/engine/core-modules/file-storage/file-storage.constants.ts diff --git a/packages/twenty-server/src/engine/integrations/file-storage/file-storage.module-definition.ts b/packages/twenty-server/src/engine/core-modules/file-storage/file-storage.module-definition.ts similarity index 72% rename from packages/twenty-server/src/engine/integrations/file-storage/file-storage.module-definition.ts rename to packages/twenty-server/src/engine/core-modules/file-storage/file-storage.module-definition.ts index 2b81d2cdb487..c9c10ba52d4b 100644 --- a/packages/twenty-server/src/engine/integrations/file-storage/file-storage.module-definition.ts +++ b/packages/twenty-server/src/engine/core-modules/file-storage/file-storage.module-definition.ts @@ -1,6 +1,6 @@ import { ConfigurableModuleBuilder } from '@nestjs/common'; -import { FileStorageModuleOptions } from './interfaces'; +import { FileStorageModuleOptions } from 'packages/twenty-server/src/engine/core-modules/file-storage/interfaces'; export const { ConfigurableModuleClass, diff --git a/packages/twenty-server/src/engine/integrations/file-storage/file-storage.module-factory.ts b/packages/twenty-server/src/engine/core-modules/file-storage/file-storage.module-factory.ts similarity index 93% rename from packages/twenty-server/src/engine/integrations/file-storage/file-storage.module-factory.ts rename to packages/twenty-server/src/engine/core-modules/file-storage/file-storage.module-factory.ts index f28597500da4..1683645c6ee0 100644 --- a/packages/twenty-server/src/engine/integrations/file-storage/file-storage.module-factory.ts +++ b/packages/twenty-server/src/engine/core-modules/file-storage/file-storage.module-factory.ts @@ -1,10 +1,10 @@ import { fromNodeProviderChain } from '@aws-sdk/credential-providers'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; import { FileStorageModuleOptions, StorageDriverType, -} from 'src/engine/integrations/file-storage/interfaces'; +} from 'src/engine/core-modules/file-storage/interfaces'; import { resolveAbsolutePath } from 'src/utils/resolve-absolute-path'; /** diff --git a/packages/twenty-server/src/engine/integrations/file-storage/file-storage.module.ts b/packages/twenty-server/src/engine/core-modules/file-storage/file-storage.module.ts similarity index 68% rename from packages/twenty-server/src/engine/integrations/file-storage/file-storage.module.ts rename to packages/twenty-server/src/engine/core-modules/file-storage/file-storage.module.ts index d1f0f64defa5..bb58af96850c 100644 --- a/packages/twenty-server/src/engine/integrations/file-storage/file-storage.module.ts +++ b/packages/twenty-server/src/engine/core-modules/file-storage/file-storage.module.ts @@ -1,14 +1,14 @@ import { DynamicModule, Global } from '@nestjs/common'; -import { FileStorageService } from './file-storage.service'; +import { FileStorageService } from 'packages/twenty-server/src/engine/core-modules/file-storage/file-storage.service'; import { FileStorageModuleAsyncOptions, FileStorageModuleOptions, -} from './interfaces'; -import { STORAGE_DRIVER } from './file-storage.constants'; +} from 'packages/twenty-server/src/engine/core-modules/file-storage/interfaces'; +import { STORAGE_DRIVER } from 'packages/twenty-server/src/engine/core-modules/file-storage/file-storage.constants'; -import { LocalDriver } from './drivers/local.driver'; -import { S3Driver } from './drivers/s3.driver'; +import { LocalDriver } from 'packages/twenty-server/src/engine/core-modules/file-storage/drivers/local.driver'; +import { S3Driver } from 'packages/twenty-server/src/engine/core-modules/file-storage/drivers/s3.driver'; @Global() export class FileStorageModule { diff --git a/packages/twenty-server/src/engine/integrations/file-storage/file-storage.service.ts b/packages/twenty-server/src/engine/core-modules/file-storage/file-storage.service.ts similarity index 80% rename from packages/twenty-server/src/engine/integrations/file-storage/file-storage.service.ts rename to packages/twenty-server/src/engine/core-modules/file-storage/file-storage.service.ts index a6eeb6c2041c..d530493598e5 100644 --- a/packages/twenty-server/src/engine/integrations/file-storage/file-storage.service.ts +++ b/packages/twenty-server/src/engine/core-modules/file-storage/file-storage.service.ts @@ -2,9 +2,9 @@ import { Inject, Injectable } from '@nestjs/common'; import { Readable } from 'stream'; -import { STORAGE_DRIVER } from './file-storage.constants'; +import { STORAGE_DRIVER } from 'packages/twenty-server/src/engine/core-modules/file-storage/file-storage.constants'; -import { StorageDriver } from './drivers/interfaces/storage-driver.interface'; +import { StorageDriver } from 'packages/twenty-server/src/engine/core-modules/file-storage/drivers/interfaces/storage-driver.interface'; @Injectable() export class FileStorageService implements StorageDriver { diff --git a/packages/twenty-server/src/engine/integrations/file-storage/interfaces/file-storage-exception.ts b/packages/twenty-server/src/engine/core-modules/file-storage/interfaces/file-storage-exception.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/file-storage/interfaces/file-storage-exception.ts rename to packages/twenty-server/src/engine/core-modules/file-storage/interfaces/file-storage-exception.ts diff --git a/packages/twenty-server/src/engine/integrations/file-storage/interfaces/file-storage.interface.ts b/packages/twenty-server/src/engine/core-modules/file-storage/interfaces/file-storage.interface.ts similarity index 85% rename from packages/twenty-server/src/engine/integrations/file-storage/interfaces/file-storage.interface.ts rename to packages/twenty-server/src/engine/core-modules/file-storage/interfaces/file-storage.interface.ts index 9d85a83ec554..cff95d73639a 100644 --- a/packages/twenty-server/src/engine/integrations/file-storage/interfaces/file-storage.interface.ts +++ b/packages/twenty-server/src/engine/core-modules/file-storage/interfaces/file-storage.interface.ts @@ -1,7 +1,7 @@ import { FactoryProvider, ModuleMetadata } from '@nestjs/common'; -import { S3DriverOptions } from 'src/engine/integrations/file-storage/drivers/s3.driver'; -import { LocalDriverOptions } from 'src/engine/integrations/file-storage/drivers/local.driver'; +import { S3DriverOptions } from 'src/engine/core-modules/file-storage/drivers/s3.driver'; +import { LocalDriverOptions } from 'src/engine/core-modules/file-storage/drivers/local.driver'; export enum StorageDriverType { S3 = 's3', diff --git a/packages/twenty-server/src/engine/core-modules/file-storage/interfaces/index.ts b/packages/twenty-server/src/engine/core-modules/file-storage/interfaces/index.ts new file mode 100644 index 000000000000..abfccbe34b10 --- /dev/null +++ b/packages/twenty-server/src/engine/core-modules/file-storage/interfaces/index.ts @@ -0,0 +1 @@ +export * from 'packages/twenty-server/src/engine/core-modules/file-storage/interfaces/file-storage.interface'; diff --git a/packages/twenty-server/src/engine/integrations/file-storage/utils/read-file-content.ts b/packages/twenty-server/src/engine/core-modules/file-storage/utils/read-file-content.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/file-storage/utils/read-file-content.ts rename to packages/twenty-server/src/engine/core-modules/file-storage/utils/read-file-content.ts diff --git a/packages/twenty-server/src/engine/core-modules/file/controllers/file.controller.ts b/packages/twenty-server/src/engine/core-modules/file/controllers/file.controller.ts index 2124c2b17969..967df311994d 100644 --- a/packages/twenty-server/src/engine/core-modules/file/controllers/file.controller.ts +++ b/packages/twenty-server/src/engine/core-modules/file/controllers/file.controller.ts @@ -5,7 +5,7 @@ import { Response } from 'express'; import { FileStorageException, FileStorageExceptionCode, -} from 'src/engine/integrations/file-storage/interfaces/file-storage-exception'; +} from 'src/engine/core-modules/file-storage/interfaces/file-storage-exception'; import { checkFilePath, diff --git a/packages/twenty-server/src/engine/core-modules/file/file-upload/file-upload.module.ts b/packages/twenty-server/src/engine/core-modules/file/file-upload/file-upload.module.ts index d33c45f7a1e0..d0de77e23c6d 100644 --- a/packages/twenty-server/src/engine/core-modules/file/file-upload/file-upload.module.ts +++ b/packages/twenty-server/src/engine/core-modules/file/file-upload/file-upload.module.ts @@ -3,7 +3,7 @@ import { Module } from '@nestjs/common'; import { FileUploadResolver } from 'src/engine/core-modules/file/file-upload/resolvers/file-upload.resolver'; import { FileUploadService } from 'src/engine/core-modules/file/file-upload/services/file-upload.service'; import { FileModule } from 'src/engine/core-modules/file/file.module'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; @Module({ imports: [FileModule], diff --git a/packages/twenty-server/src/engine/core-modules/file/file-upload/services/file-upload.service.ts b/packages/twenty-server/src/engine/core-modules/file/file-upload/services/file-upload.service.ts index e408178e8cd2..80cd2ffd9db9 100644 --- a/packages/twenty-server/src/engine/core-modules/file/file-upload/services/file-upload.service.ts +++ b/packages/twenty-server/src/engine/core-modules/file/file-upload/services/file-upload.service.ts @@ -9,7 +9,7 @@ import { FileFolder } from 'src/engine/core-modules/file/interfaces/file-folder. import { settings } from 'src/engine/constants/settings'; import { FileService } from 'src/engine/core-modules/file/services/file.service'; -import { FileStorageService } from 'src/engine/integrations/file-storage/file-storage.service'; +import { FileStorageService } from 'src/engine/core-modules/file-storage/file-storage.service'; import { getCropSize } from 'src/utils/image'; @Injectable() diff --git a/packages/twenty-server/src/engine/core-modules/file/file.module.ts b/packages/twenty-server/src/engine/core-modules/file/file.module.ts index c7d4c838cf61..73afa155921b 100644 --- a/packages/twenty-server/src/engine/core-modules/file/file.module.ts +++ b/packages/twenty-server/src/engine/core-modules/file/file.module.ts @@ -2,7 +2,7 @@ import { Module } from '@nestjs/common'; import { FilePathGuard } from 'src/engine/core-modules/file/guards/file-path-guard'; import { JwtModule } from 'src/engine/core-modules/jwt/jwt.module'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; import { FileController } from './controllers/file.controller'; import { FileService } from './services/file.service'; diff --git a/packages/twenty-server/src/engine/core-modules/file/guards/file-path-guard.ts b/packages/twenty-server/src/engine/core-modules/file/guards/file-path-guard.ts index db9f466c5d3b..890d060dd84b 100644 --- a/packages/twenty-server/src/engine/core-modules/file/guards/file-path-guard.ts +++ b/packages/twenty-server/src/engine/core-modules/file/guards/file-path-guard.ts @@ -7,7 +7,7 @@ import { } from '@nestjs/common'; import { JwtWrapperService } from 'src/engine/core-modules/jwt/services/jwt-wrapper.service'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; @Injectable() export class FilePathGuard implements CanActivate { diff --git a/packages/twenty-server/src/engine/core-modules/file/services/file.service.spec.ts b/packages/twenty-server/src/engine/core-modules/file/services/file.service.spec.ts index 3a65700006a8..ecc5ee5fa422 100644 --- a/packages/twenty-server/src/engine/core-modules/file/services/file.service.spec.ts +++ b/packages/twenty-server/src/engine/core-modules/file/services/file.service.spec.ts @@ -1,8 +1,8 @@ import { Test, TestingModule } from '@nestjs/testing'; import { JwtWrapperService } from 'src/engine/core-modules/jwt/services/jwt-wrapper.service'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; -import { FileStorageService } from 'src/engine/integrations/file-storage/file-storage.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; +import { FileStorageService } from 'src/engine/core-modules/file-storage/file-storage.service'; import { FileService } from './file.service'; diff --git a/packages/twenty-server/src/engine/core-modules/file/services/file.service.ts b/packages/twenty-server/src/engine/core-modules/file/services/file.service.ts index d56d769f96ed..a1c59e700806 100644 --- a/packages/twenty-server/src/engine/core-modules/file/services/file.service.ts +++ b/packages/twenty-server/src/engine/core-modules/file/services/file.service.ts @@ -6,8 +6,8 @@ import { addMilliseconds } from 'date-fns'; import ms from 'ms'; import { JwtWrapperService } from 'src/engine/core-modules/jwt/services/jwt-wrapper.service'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; -import { FileStorageService } from 'src/engine/integrations/file-storage/file-storage.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; +import { FileStorageService } from 'src/engine/core-modules/file-storage/file-storage.service'; @Injectable() export class FileService { diff --git a/packages/twenty-server/src/engine/core-modules/graphql/engine-graphql.module.ts b/packages/twenty-server/src/engine/core-modules/graphql/engine-graphql.module.ts index ae592e22c802..0df672199146 100644 --- a/packages/twenty-server/src/engine/core-modules/graphql/engine-graphql.module.ts +++ b/packages/twenty-server/src/engine/core-modules/graphql/engine-graphql.module.ts @@ -1,7 +1,7 @@ import { Module } from '@nestjs/common'; import { useGraphQLErrorHandlerHook } from 'src/engine/core-modules/graphql/hooks/use-graphql-error-handler.hook'; -import { ExceptionHandlerModule } from 'src/engine/integrations/exception-handler/exception-handler.module'; +import { ExceptionHandlerModule } from 'src/engine/core-modules/exception-handler/exception-handler.module'; @Module({ imports: [ExceptionHandlerModule], diff --git a/packages/twenty-server/src/engine/core-modules/graphql/hooks/use-graphql-error-handler.hook.ts b/packages/twenty-server/src/engine/core-modules/graphql/hooks/use-graphql-error-handler.hook.ts index 9785cde8a2db..ff466d3f3324 100644 --- a/packages/twenty-server/src/engine/core-modules/graphql/hooks/use-graphql-error-handler.hook.ts +++ b/packages/twenty-server/src/engine/core-modules/graphql/hooks/use-graphql-error-handler.hook.ts @@ -11,7 +11,7 @@ import { GraphQLContext } from 'src/engine/api/graphql/graphql-config/interfaces import { generateGraphQLErrorFromError } from 'src/engine/core-modules/graphql/utils/generate-graphql-error-from-error.util'; import { BaseGraphQLError } from 'src/engine/core-modules/graphql/utils/graphql-errors.util'; import { shouldCaptureException } from 'src/engine/core-modules/graphql/utils/should-capture-exception.util'; -import { ExceptionHandlerService } from 'src/engine/integrations/exception-handler/exception-handler.service'; +import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service'; type GraphQLErrorHandlerHookOptions = { /** diff --git a/packages/twenty-server/src/engine/core-modules/jwt/jwt.module.ts b/packages/twenty-server/src/engine/core-modules/jwt/jwt.module.ts index 6acbd76a01b1..306f1640e008 100644 --- a/packages/twenty-server/src/engine/core-modules/jwt/jwt.module.ts +++ b/packages/twenty-server/src/engine/core-modules/jwt/jwt.module.ts @@ -3,8 +3,8 @@ import { Module } from '@nestjs/common'; import { JwtModule as NestJwtModule } from '@nestjs/jwt'; import { JwtWrapperService } from 'src/engine/core-modules/jwt/services/jwt-wrapper.service'; -import { EnvironmentModule } from 'src/engine/integrations/environment/environment.module'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentModule } from 'src/engine/core-modules/environment/environment.module'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; const InternalJwtModule = NestJwtModule.registerAsync({ useFactory: async (environmentService: EnvironmentService) => { diff --git a/packages/twenty-server/src/engine/integrations/llm-chat-model/drivers/interfaces/llm-prompt-template-driver.interface.ts b/packages/twenty-server/src/engine/core-modules/llm-chat-model/drivers/interfaces/llm-prompt-template-driver.interface.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/llm-chat-model/drivers/interfaces/llm-prompt-template-driver.interface.ts rename to packages/twenty-server/src/engine/core-modules/llm-chat-model/drivers/interfaces/llm-prompt-template-driver.interface.ts diff --git a/packages/twenty-server/src/engine/integrations/llm-chat-model/drivers/openai.driver.ts b/packages/twenty-server/src/engine/core-modules/llm-chat-model/drivers/openai.driver.ts similarity index 89% rename from packages/twenty-server/src/engine/integrations/llm-chat-model/drivers/openai.driver.ts rename to packages/twenty-server/src/engine/core-modules/llm-chat-model/drivers/openai.driver.ts index 652a854ef831..d1510b44d686 100644 --- a/packages/twenty-server/src/engine/integrations/llm-chat-model/drivers/openai.driver.ts +++ b/packages/twenty-server/src/engine/core-modules/llm-chat-model/drivers/openai.driver.ts @@ -1,7 +1,7 @@ import { BaseChatModel } from '@langchain/core/language_models/chat_models'; import { ChatOpenAI } from '@langchain/openai'; -import { LLMChatModelDriver } from 'src/engine/integrations/llm-chat-model/drivers/interfaces/llm-prompt-template-driver.interface'; +import { LLMChatModelDriver } from 'src/engine/core-modules/llm-chat-model/drivers/interfaces/llm-prompt-template-driver.interface'; export class OpenAIDriver implements LLMChatModelDriver { private chatModel: BaseChatModel; diff --git a/packages/twenty-server/src/engine/integrations/llm-chat-model/interfaces/llm-chat-model.interface.ts b/packages/twenty-server/src/engine/core-modules/llm-chat-model/interfaces/llm-chat-model.interface.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/llm-chat-model/interfaces/llm-chat-model.interface.ts rename to packages/twenty-server/src/engine/core-modules/llm-chat-model/interfaces/llm-chat-model.interface.ts diff --git a/packages/twenty-server/src/engine/integrations/llm-chat-model/llm-chat-model.constants.ts b/packages/twenty-server/src/engine/core-modules/llm-chat-model/llm-chat-model.constants.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/llm-chat-model/llm-chat-model.constants.ts rename to packages/twenty-server/src/engine/core-modules/llm-chat-model/llm-chat-model.constants.ts diff --git a/packages/twenty-server/src/engine/integrations/llm-chat-model/llm-chat-model.module-factory.ts b/packages/twenty-server/src/engine/core-modules/llm-chat-model/llm-chat-model.module-factory.ts similarity index 76% rename from packages/twenty-server/src/engine/integrations/llm-chat-model/llm-chat-model.module-factory.ts rename to packages/twenty-server/src/engine/core-modules/llm-chat-model/llm-chat-model.module-factory.ts index 2d91f280ce54..e0ea03e54ba7 100644 --- a/packages/twenty-server/src/engine/integrations/llm-chat-model/llm-chat-model.module-factory.ts +++ b/packages/twenty-server/src/engine/core-modules/llm-chat-model/llm-chat-model.module-factory.ts @@ -1,6 +1,6 @@ -import { LLMChatModelDriver } from 'src/engine/integrations/llm-chat-model/interfaces/llm-chat-model.interface'; +import { LLMChatModelDriver } from 'src/engine/core-modules/llm-chat-model/interfaces/llm-chat-model.interface'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; export const llmChatModelModuleFactory = ( environmentService: EnvironmentService, diff --git a/packages/twenty-server/src/engine/integrations/llm-chat-model/llm-chat-model.module.ts b/packages/twenty-server/src/engine/core-modules/llm-chat-model/llm-chat-model.module.ts similarity index 77% rename from packages/twenty-server/src/engine/integrations/llm-chat-model/llm-chat-model.module.ts rename to packages/twenty-server/src/engine/core-modules/llm-chat-model/llm-chat-model.module.ts index 279993f72868..518c3389a32d 100644 --- a/packages/twenty-server/src/engine/integrations/llm-chat-model/llm-chat-model.module.ts +++ b/packages/twenty-server/src/engine/core-modules/llm-chat-model/llm-chat-model.module.ts @@ -3,11 +3,11 @@ import { DynamicModule, Global } from '@nestjs/common'; import { LLMChatModelDriver, LLMChatModelModuleAsyncOptions, -} from 'src/engine/integrations/llm-chat-model/interfaces/llm-chat-model.interface'; +} from 'src/engine/core-modules/llm-chat-model/interfaces/llm-chat-model.interface'; -import { LLM_CHAT_MODEL_DRIVER } from 'src/engine/integrations/llm-chat-model/llm-chat-model.constants'; -import { OpenAIDriver } from 'src/engine/integrations/llm-chat-model/drivers/openai.driver'; -import { LLMChatModelService } from 'src/engine/integrations/llm-chat-model/llm-chat-model.service'; +import { LLM_CHAT_MODEL_DRIVER } from 'src/engine/core-modules/llm-chat-model/llm-chat-model.constants'; +import { OpenAIDriver } from 'src/engine/core-modules/llm-chat-model/drivers/openai.driver'; +import { LLMChatModelService } from 'src/engine/core-modules/llm-chat-model/llm-chat-model.service'; @Global() export class LLMChatModelModule { diff --git a/packages/twenty-server/src/engine/integrations/llm-chat-model/llm-chat-model.service.ts b/packages/twenty-server/src/engine/core-modules/llm-chat-model/llm-chat-model.service.ts similarity index 74% rename from packages/twenty-server/src/engine/integrations/llm-chat-model/llm-chat-model.service.ts rename to packages/twenty-server/src/engine/core-modules/llm-chat-model/llm-chat-model.service.ts index 62beea8c6eca..9a98eeb3c6e5 100644 --- a/packages/twenty-server/src/engine/integrations/llm-chat-model/llm-chat-model.service.ts +++ b/packages/twenty-server/src/engine/core-modules/llm-chat-model/llm-chat-model.service.ts @@ -1,8 +1,8 @@ import { Injectable, Inject } from '@nestjs/common'; -import { LLMChatModelDriver } from 'src/engine/integrations/llm-chat-model/drivers/interfaces/llm-prompt-template-driver.interface'; +import { LLMChatModelDriver } from 'src/engine/core-modules/llm-chat-model/drivers/interfaces/llm-prompt-template-driver.interface'; -import { LLM_CHAT_MODEL_DRIVER } from 'src/engine/integrations/llm-chat-model/llm-chat-model.constants'; +import { LLM_CHAT_MODEL_DRIVER } from 'src/engine/core-modules/llm-chat-model/llm-chat-model.constants'; @Injectable() export class LLMChatModelService { diff --git a/packages/twenty-server/src/engine/integrations/llm-tracing/drivers/console.driver.ts b/packages/twenty-server/src/engine/core-modules/llm-tracing/drivers/console.driver.ts similarity index 92% rename from packages/twenty-server/src/engine/integrations/llm-tracing/drivers/console.driver.ts rename to packages/twenty-server/src/engine/core-modules/llm-tracing/drivers/console.driver.ts index 6c1ae4015018..754df2586c95 100644 --- a/packages/twenty-server/src/engine/integrations/llm-tracing/drivers/console.driver.ts +++ b/packages/twenty-server/src/engine/core-modules/llm-tracing/drivers/console.driver.ts @@ -3,7 +3,7 @@ import { BaseCallbackHandler } from '@langchain/core/callbacks/base'; import { Run } from '@langchain/core/tracers/base'; import { ConsoleCallbackHandler } from '@langchain/core/tracers/console'; -import { LLMTracingDriver } from 'src/engine/integrations/llm-tracing/drivers/interfaces/llm-tracing-driver.interface'; +import { LLMTracingDriver } from 'src/engine/core-modules/llm-tracing/drivers/interfaces/llm-tracing-driver.interface'; class WithMetadataConsoleCallbackHandler extends ConsoleCallbackHandler { private metadata: Record<string, unknown>; diff --git a/packages/twenty-server/src/engine/integrations/llm-tracing/drivers/interfaces/llm-tracing-driver.interface.ts b/packages/twenty-server/src/engine/core-modules/llm-tracing/drivers/interfaces/llm-tracing-driver.interface.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/llm-tracing/drivers/interfaces/llm-tracing-driver.interface.ts rename to packages/twenty-server/src/engine/core-modules/llm-tracing/drivers/interfaces/llm-tracing-driver.interface.ts diff --git a/packages/twenty-server/src/engine/integrations/llm-tracing/drivers/langfuse.driver.ts b/packages/twenty-server/src/engine/core-modules/llm-tracing/drivers/langfuse.driver.ts similarity index 91% rename from packages/twenty-server/src/engine/integrations/llm-tracing/drivers/langfuse.driver.ts rename to packages/twenty-server/src/engine/core-modules/llm-tracing/drivers/langfuse.driver.ts index b9b84aad0860..3d44ba970298 100644 --- a/packages/twenty-server/src/engine/integrations/llm-tracing/drivers/langfuse.driver.ts +++ b/packages/twenty-server/src/engine/core-modules/llm-tracing/drivers/langfuse.driver.ts @@ -1,7 +1,7 @@ import { BaseCallbackHandler } from '@langchain/core/callbacks/base'; import CallbackHandler from 'langfuse-langchain'; -import { LLMTracingDriver } from 'src/engine/integrations/llm-tracing/drivers/interfaces/llm-tracing-driver.interface'; +import { LLMTracingDriver } from 'src/engine/core-modules/llm-tracing/drivers/interfaces/llm-tracing-driver.interface'; export interface LangfuseDriverOptions { secretKey: string; diff --git a/packages/twenty-server/src/engine/integrations/llm-tracing/interfaces/llm-tracing.interface.ts b/packages/twenty-server/src/engine/core-modules/llm-tracing/interfaces/llm-tracing.interface.ts similarity index 91% rename from packages/twenty-server/src/engine/integrations/llm-tracing/interfaces/llm-tracing.interface.ts rename to packages/twenty-server/src/engine/core-modules/llm-tracing/interfaces/llm-tracing.interface.ts index a97031499b10..99dcdbd157ea 100644 --- a/packages/twenty-server/src/engine/integrations/llm-tracing/interfaces/llm-tracing.interface.ts +++ b/packages/twenty-server/src/engine/core-modules/llm-tracing/interfaces/llm-tracing.interface.ts @@ -1,6 +1,6 @@ import { ModuleMetadata, FactoryProvider } from '@nestjs/common'; -import { LangfuseDriverOptions } from 'src/engine/integrations/llm-tracing/drivers/langfuse.driver'; +import { LangfuseDriverOptions } from 'src/engine/core-modules/llm-tracing/drivers/langfuse.driver'; export enum LLMTracingDriver { Langfuse = 'langfuse', diff --git a/packages/twenty-server/src/engine/integrations/llm-tracing/llm-tracing.constants.ts b/packages/twenty-server/src/engine/core-modules/llm-tracing/llm-tracing.constants.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/llm-tracing/llm-tracing.constants.ts rename to packages/twenty-server/src/engine/core-modules/llm-tracing/llm-tracing.constants.ts diff --git a/packages/twenty-server/src/engine/integrations/llm-tracing/llm-tracing.module-factory.ts b/packages/twenty-server/src/engine/core-modules/llm-tracing/llm-tracing.module-factory.ts similarity index 88% rename from packages/twenty-server/src/engine/integrations/llm-tracing/llm-tracing.module-factory.ts rename to packages/twenty-server/src/engine/core-modules/llm-tracing/llm-tracing.module-factory.ts index 754158e2a81e..94abe251ebb6 100644 --- a/packages/twenty-server/src/engine/integrations/llm-tracing/llm-tracing.module-factory.ts +++ b/packages/twenty-server/src/engine/core-modules/llm-tracing/llm-tracing.module-factory.ts @@ -1,6 +1,6 @@ -import { LLMTracingDriver } from 'src/engine/integrations/llm-tracing/interfaces/llm-tracing.interface'; +import { LLMTracingDriver } from 'src/engine/core-modules/llm-tracing/interfaces/llm-tracing.interface'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; export const llmTracingModuleFactory = ( environmentService: EnvironmentService, diff --git a/packages/twenty-server/src/engine/integrations/llm-tracing/llm-tracing.module.ts b/packages/twenty-server/src/engine/core-modules/llm-tracing/llm-tracing.module.ts similarity index 75% rename from packages/twenty-server/src/engine/integrations/llm-tracing/llm-tracing.module.ts rename to packages/twenty-server/src/engine/core-modules/llm-tracing/llm-tracing.module.ts index 9e9c452e95ba..045dfbd7c231 100644 --- a/packages/twenty-server/src/engine/integrations/llm-tracing/llm-tracing.module.ts +++ b/packages/twenty-server/src/engine/core-modules/llm-tracing/llm-tracing.module.ts @@ -3,12 +3,12 @@ import { Global, DynamicModule } from '@nestjs/common'; import { LLMTracingModuleAsyncOptions, LLMTracingDriver, -} from 'src/engine/integrations/llm-tracing/interfaces/llm-tracing.interface'; +} from 'src/engine/core-modules/llm-tracing/interfaces/llm-tracing.interface'; -import { LangfuseDriver } from 'src/engine/integrations/llm-tracing/drivers/langfuse.driver'; -import { ConsoleDriver } from 'src/engine/integrations/llm-tracing/drivers/console.driver'; -import { LLMTracingService } from 'src/engine/integrations/llm-tracing/llm-tracing.service'; -import { LLM_TRACING_DRIVER } from 'src/engine/integrations/llm-tracing/llm-tracing.constants'; +import { LangfuseDriver } from 'src/engine/core-modules/llm-tracing/drivers/langfuse.driver'; +import { ConsoleDriver } from 'src/engine/core-modules/llm-tracing/drivers/console.driver'; +import { LLMTracingService } from 'src/engine/core-modules/llm-tracing/llm-tracing.service'; +import { LLM_TRACING_DRIVER } from 'src/engine/core-modules/llm-tracing/llm-tracing.constants'; @Global() export class LLMTracingModule { diff --git a/packages/twenty-server/src/engine/integrations/llm-tracing/llm-tracing.service.ts b/packages/twenty-server/src/engine/core-modules/llm-tracing/llm-tracing.service.ts similarity index 78% rename from packages/twenty-server/src/engine/integrations/llm-tracing/llm-tracing.service.ts rename to packages/twenty-server/src/engine/core-modules/llm-tracing/llm-tracing.service.ts index 6ff2023902d1..87d7624fb081 100644 --- a/packages/twenty-server/src/engine/integrations/llm-tracing/llm-tracing.service.ts +++ b/packages/twenty-server/src/engine/core-modules/llm-tracing/llm-tracing.service.ts @@ -2,9 +2,9 @@ import { Injectable, Inject } from '@nestjs/common'; import { BaseCallbackHandler } from '@langchain/core/callbacks/base'; -import { LLMTracingDriver } from 'src/engine/integrations/llm-tracing/drivers/interfaces/llm-tracing-driver.interface'; +import { LLMTracingDriver } from 'src/engine/core-modules/llm-tracing/drivers/interfaces/llm-tracing-driver.interface'; -import { LLM_TRACING_DRIVER } from 'src/engine/integrations/llm-tracing/llm-tracing.constants'; +import { LLM_TRACING_DRIVER } from 'src/engine/core-modules/llm-tracing/llm-tracing.constants'; @Injectable() export class LLMTracingService { diff --git a/packages/twenty-server/src/engine/integrations/logger/__tests__/logger.service.spec.ts b/packages/twenty-server/src/engine/core-modules/logger/__tests__/logger.service.spec.ts similarity index 80% rename from packages/twenty-server/src/engine/integrations/logger/__tests__/logger.service.spec.ts rename to packages/twenty-server/src/engine/core-modules/logger/__tests__/logger.service.spec.ts index b5d6f94c897e..0475f386c386 100644 --- a/packages/twenty-server/src/engine/integrations/logger/__tests__/logger.service.spec.ts +++ b/packages/twenty-server/src/engine/core-modules/logger/__tests__/logger.service.spec.ts @@ -1,7 +1,7 @@ import { Test, TestingModule } from '@nestjs/testing'; -import { LOGGER_DRIVER } from 'src/engine/integrations/logger/logger.constants'; -import { LoggerService } from 'src/engine/integrations/logger/logger.service'; +import { LOGGER_DRIVER } from 'src/engine/core-modules/logger/logger.constants'; +import { LoggerService } from 'src/engine/core-modules/logger/logger.service'; describe('LoggerService', () => { let service: LoggerService; diff --git a/packages/twenty-server/src/engine/core-modules/logger/interfaces/index.ts b/packages/twenty-server/src/engine/core-modules/logger/interfaces/index.ts new file mode 100644 index 000000000000..42dc74685571 --- /dev/null +++ b/packages/twenty-server/src/engine/core-modules/logger/interfaces/index.ts @@ -0,0 +1 @@ +export * from 'packages/twenty-server/src/engine/core-modules/logger/interfaces/logger.interface'; diff --git a/packages/twenty-server/src/engine/integrations/logger/interfaces/logger.interface.ts b/packages/twenty-server/src/engine/core-modules/logger/interfaces/logger.interface.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/logger/interfaces/logger.interface.ts rename to packages/twenty-server/src/engine/core-modules/logger/interfaces/logger.interface.ts diff --git a/packages/twenty-server/src/engine/integrations/logger/logger.constants.ts b/packages/twenty-server/src/engine/core-modules/logger/logger.constants.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/logger/logger.constants.ts rename to packages/twenty-server/src/engine/core-modules/logger/logger.constants.ts diff --git a/packages/twenty-server/src/engine/integrations/logger/logger.module-definition.ts b/packages/twenty-server/src/engine/core-modules/logger/logger.module-definition.ts similarity index 74% rename from packages/twenty-server/src/engine/integrations/logger/logger.module-definition.ts rename to packages/twenty-server/src/engine/core-modules/logger/logger.module-definition.ts index d896bff74d56..3511bc65db37 100644 --- a/packages/twenty-server/src/engine/integrations/logger/logger.module-definition.ts +++ b/packages/twenty-server/src/engine/core-modules/logger/logger.module-definition.ts @@ -1,6 +1,6 @@ import { ConfigurableModuleBuilder } from '@nestjs/common'; -import { LoggerModuleOptions } from './interfaces'; +import { LoggerModuleOptions } from 'packages/twenty-server/src/engine/core-modules/logger/interfaces'; export const { ConfigurableModuleClass, diff --git a/packages/twenty-server/src/engine/integrations/logger/logger.module-factory.ts b/packages/twenty-server/src/engine/core-modules/logger/logger.module-factory.ts similarity index 85% rename from packages/twenty-server/src/engine/integrations/logger/logger.module-factory.ts rename to packages/twenty-server/src/engine/core-modules/logger/logger.module-factory.ts index aef0bcd62c82..94b490fdc37c 100644 --- a/packages/twenty-server/src/engine/integrations/logger/logger.module-factory.ts +++ b/packages/twenty-server/src/engine/core-modules/logger/logger.module-factory.ts @@ -1,8 +1,8 @@ -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; import { LoggerModuleOptions, LoggerDriverType, -} from 'src/engine/integrations/logger/interfaces'; +} from 'src/engine/core-modules/logger/interfaces'; /** * Logger Module factory diff --git a/packages/twenty-server/src/engine/integrations/logger/logger.module.ts b/packages/twenty-server/src/engine/core-modules/logger/logger.module.ts similarity index 80% rename from packages/twenty-server/src/engine/integrations/logger/logger.module.ts rename to packages/twenty-server/src/engine/core-modules/logger/logger.module.ts index 778dbbf54d1a..d7c1d6899068 100644 --- a/packages/twenty-server/src/engine/integrations/logger/logger.module.ts +++ b/packages/twenty-server/src/engine/core-modules/logger/logger.module.ts @@ -1,14 +1,14 @@ import { DynamicModule, Global, ConsoleLogger, Module } from '@nestjs/common'; -import { LoggerDriverType } from 'src/engine/integrations/logger/interfaces'; +import { LoggerDriverType } from 'src/engine/core-modules/logger/interfaces'; -import { LoggerService } from './logger.service'; -import { LOGGER_DRIVER } from './logger.constants'; +import { LoggerService } from 'packages/twenty-server/src/engine/core-modules/logger/logger.service'; +import { LOGGER_DRIVER } from 'packages/twenty-server/src/engine/core-modules/logger/logger.constants'; import { ASYNC_OPTIONS_TYPE, ConfigurableModuleClass, OPTIONS_TYPE, -} from './logger.module-definition'; +} from 'packages/twenty-server/src/engine/core-modules/logger/logger.module-definition'; @Global() @Module({ diff --git a/packages/twenty-server/src/engine/integrations/logger/logger.service.ts b/packages/twenty-server/src/engine/core-modules/logger/logger.service.ts similarity index 92% rename from packages/twenty-server/src/engine/integrations/logger/logger.service.ts rename to packages/twenty-server/src/engine/core-modules/logger/logger.service.ts index 882a53c17ccc..d06098df4f78 100644 --- a/packages/twenty-server/src/engine/integrations/logger/logger.service.ts +++ b/packages/twenty-server/src/engine/core-modules/logger/logger.service.ts @@ -5,7 +5,7 @@ import { LoggerService as LoggerServiceInterface, } from '@nestjs/common'; -import { LOGGER_DRIVER } from './logger.constants'; +import { LOGGER_DRIVER } from 'packages/twenty-server/src/engine/core-modules/logger/logger.constants'; @Injectable() export class LoggerService implements LoggerServiceInterface { diff --git a/packages/twenty-server/src/engine/integrations/message-queue/decorators/message-queue.decorator.ts b/packages/twenty-server/src/engine/core-modules/message-queue/decorators/message-queue.decorator.ts similarity index 63% rename from packages/twenty-server/src/engine/integrations/message-queue/decorators/message-queue.decorator.ts rename to packages/twenty-server/src/engine/core-modules/message-queue/decorators/message-queue.decorator.ts index 5a275d3d5b82..dd88f4cf6a63 100644 --- a/packages/twenty-server/src/engine/integrations/message-queue/decorators/message-queue.decorator.ts +++ b/packages/twenty-server/src/engine/core-modules/message-queue/decorators/message-queue.decorator.ts @@ -1,7 +1,7 @@ import { Inject } from '@nestjs/common'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { getQueueToken } from 'src/engine/integrations/message-queue/utils/get-queue-token.util'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { getQueueToken } from 'src/engine/core-modules/message-queue/utils/get-queue-token.util'; export const InjectMessageQueue = (queueName: MessageQueue) => { return Inject(getQueueToken(queueName)); diff --git a/packages/twenty-server/src/engine/integrations/message-queue/decorators/process.decorator.ts b/packages/twenty-server/src/engine/core-modules/message-queue/decorators/process.decorator.ts similarity index 90% rename from packages/twenty-server/src/engine/integrations/message-queue/decorators/process.decorator.ts rename to packages/twenty-server/src/engine/core-modules/message-queue/decorators/process.decorator.ts index 214742cb0af0..62ec636ade9a 100644 --- a/packages/twenty-server/src/engine/integrations/message-queue/decorators/process.decorator.ts +++ b/packages/twenty-server/src/engine/core-modules/message-queue/decorators/process.decorator.ts @@ -1,7 +1,7 @@ import { SetMetadata } from '@nestjs/common'; import { isString } from '@nestjs/common/utils/shared.utils'; -import { PROCESS_METADATA } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { PROCESS_METADATA } from 'src/engine/core-modules/message-queue/message-queue.constants'; export interface MessageQueueProcessOptions { jobName: string; diff --git a/packages/twenty-server/src/engine/integrations/message-queue/decorators/processor.decorator.ts b/packages/twenty-server/src/engine/core-modules/message-queue/decorators/processor.decorator.ts similarity index 91% rename from packages/twenty-server/src/engine/integrations/message-queue/decorators/processor.decorator.ts rename to packages/twenty-server/src/engine/core-modules/message-queue/decorators/processor.decorator.ts index a244dc4d14ce..07979b452d3a 100644 --- a/packages/twenty-server/src/engine/integrations/message-queue/decorators/processor.decorator.ts +++ b/packages/twenty-server/src/engine/core-modules/message-queue/decorators/processor.decorator.ts @@ -1,13 +1,13 @@ import { Scope, SetMetadata } from '@nestjs/common'; import { SCOPE_OPTIONS_METADATA } from '@nestjs/common/constants'; -import { MessageQueueWorkerOptions } from 'src/engine/integrations/message-queue/interfaces/message-queue-worker-options.interface'; +import { MessageQueueWorkerOptions } from 'src/engine/core-modules/message-queue/interfaces/message-queue-worker-options.interface'; import { MessageQueue, PROCESSOR_METADATA, WORKER_METADATA, -} from 'src/engine/integrations/message-queue/message-queue.constants'; +} from 'src/engine/core-modules/message-queue/message-queue.constants'; export interface MessageQueueProcessorOptions { /** diff --git a/packages/twenty-server/src/engine/integrations/message-queue/drivers/bullmq.driver.ts b/packages/twenty-server/src/engine/core-modules/message-queue/drivers/bullmq.driver.ts similarity index 86% rename from packages/twenty-server/src/engine/integrations/message-queue/drivers/bullmq.driver.ts rename to packages/twenty-server/src/engine/core-modules/message-queue/drivers/bullmq.driver.ts index c3324a500604..cf89d1f2d476 100644 --- a/packages/twenty-server/src/engine/integrations/message-queue/drivers/bullmq.driver.ts +++ b/packages/twenty-server/src/engine/core-modules/message-queue/drivers/bullmq.driver.ts @@ -6,13 +6,13 @@ import { JobsOptions, Queue, QueueOptions, Worker } from 'bullmq'; import { QueueCronJobOptions, QueueJobOptions, -} from 'src/engine/integrations/message-queue/drivers/interfaces/job-options.interface'; -import { MessageQueueJob } from 'src/engine/integrations/message-queue/interfaces/message-queue-job.interface'; -import { MessageQueueWorkerOptions } from 'src/engine/integrations/message-queue/interfaces/message-queue-worker-options.interface'; +} from 'src/engine/core-modules/message-queue/drivers/interfaces/job-options.interface'; +import { MessageQueueJob } from 'src/engine/core-modules/message-queue/interfaces/message-queue-job.interface'; +import { MessageQueueWorkerOptions } from 'src/engine/core-modules/message-queue/interfaces/message-queue-worker-options.interface'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; -import { MessageQueueDriver } from './interfaces/message-queue-driver.interface'; +import { MessageQueueDriver } from 'packages/twenty-server/src/engine/core-modules/message-queue/drivers/interfaces/message-queue-driver.interface'; export type BullMQDriverOptions = QueueOptions; diff --git a/packages/twenty-server/src/engine/integrations/message-queue/drivers/interfaces/job-options.interface.ts b/packages/twenty-server/src/engine/core-modules/message-queue/drivers/interfaces/job-options.interface.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/message-queue/drivers/interfaces/job-options.interface.ts rename to packages/twenty-server/src/engine/core-modules/message-queue/drivers/interfaces/job-options.interface.ts diff --git a/packages/twenty-server/src/engine/integrations/message-queue/drivers/interfaces/message-queue-driver.interface.ts b/packages/twenty-server/src/engine/core-modules/message-queue/drivers/interfaces/message-queue-driver.interface.ts similarity index 72% rename from packages/twenty-server/src/engine/integrations/message-queue/drivers/interfaces/message-queue-driver.interface.ts rename to packages/twenty-server/src/engine/core-modules/message-queue/drivers/interfaces/message-queue-driver.interface.ts index 1d53837d359a..49647c02141e 100644 --- a/packages/twenty-server/src/engine/integrations/message-queue/drivers/interfaces/message-queue-driver.interface.ts +++ b/packages/twenty-server/src/engine/core-modules/message-queue/drivers/interfaces/message-queue-driver.interface.ts @@ -1,11 +1,11 @@ import { QueueCronJobOptions, QueueJobOptions, -} from 'src/engine/integrations/message-queue/drivers/interfaces/job-options.interface'; -import { MessageQueueJobData } from 'src/engine/integrations/message-queue/interfaces/message-queue-job.interface'; -import { MessageQueueWorkerOptions } from 'src/engine/integrations/message-queue/interfaces/message-queue-worker-options.interface'; +} from 'src/engine/core-modules/message-queue/drivers/interfaces/job-options.interface'; +import { MessageQueueJobData } from 'src/engine/core-modules/message-queue/interfaces/message-queue-job.interface'; +import { MessageQueueWorkerOptions } from 'src/engine/core-modules/message-queue/interfaces/message-queue-worker-options.interface'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; export interface MessageQueueDriver { add<T extends MessageQueueJobData>( diff --git a/packages/twenty-server/src/engine/integrations/message-queue/drivers/pg-boss.driver.ts b/packages/twenty-server/src/engine/core-modules/message-queue/drivers/pg-boss.driver.ts similarity index 83% rename from packages/twenty-server/src/engine/integrations/message-queue/drivers/pg-boss.driver.ts rename to packages/twenty-server/src/engine/core-modules/message-queue/drivers/pg-boss.driver.ts index 98631bc88121..9664976af280 100644 --- a/packages/twenty-server/src/engine/integrations/message-queue/drivers/pg-boss.driver.ts +++ b/packages/twenty-server/src/engine/core-modules/message-queue/drivers/pg-boss.driver.ts @@ -5,13 +5,13 @@ import PgBoss from 'pg-boss'; import { QueueCronJobOptions, QueueJobOptions, -} from 'src/engine/integrations/message-queue/drivers/interfaces/job-options.interface'; -import { MessageQueueJob } from 'src/engine/integrations/message-queue/interfaces/message-queue-job.interface'; -import { MessageQueueWorkerOptions } from 'src/engine/integrations/message-queue/interfaces/message-queue-worker-options.interface'; +} from 'src/engine/core-modules/message-queue/drivers/interfaces/job-options.interface'; +import { MessageQueueJob } from 'src/engine/core-modules/message-queue/interfaces/message-queue-job.interface'; +import { MessageQueueWorkerOptions } from 'src/engine/core-modules/message-queue/interfaces/message-queue-worker-options.interface'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; -import { MessageQueueDriver } from './interfaces/message-queue-driver.interface'; +import { MessageQueueDriver } from 'packages/twenty-server/src/engine/core-modules/message-queue/drivers/interfaces/message-queue-driver.interface'; export type PgBossDriverOptions = PgBoss.ConstructorOptions; diff --git a/packages/twenty-server/src/engine/integrations/message-queue/drivers/sync.driver.ts b/packages/twenty-server/src/engine/core-modules/message-queue/drivers/sync.driver.ts similarity index 85% rename from packages/twenty-server/src/engine/integrations/message-queue/drivers/sync.driver.ts rename to packages/twenty-server/src/engine/core-modules/message-queue/drivers/sync.driver.ts index b65460687c30..293047f7825a 100644 --- a/packages/twenty-server/src/engine/integrations/message-queue/drivers/sync.driver.ts +++ b/packages/twenty-server/src/engine/core-modules/message-queue/drivers/sync.driver.ts @@ -3,11 +3,11 @@ import { Logger } from '@nestjs/common'; import { MessageQueueJobData, MessageQueueJob, -} from 'src/engine/integrations/message-queue/interfaces/message-queue-job.interface'; +} from 'src/engine/core-modules/message-queue/interfaces/message-queue-job.interface'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; -import { MessageQueueDriver } from './interfaces/message-queue-driver.interface'; +import { MessageQueueDriver } from 'packages/twenty-server/src/engine/core-modules/message-queue/drivers/interfaces/message-queue-driver.interface'; export class SyncDriver implements MessageQueueDriver { private readonly logger = new Logger(SyncDriver.name); diff --git a/packages/twenty-server/src/engine/core-modules/message-queue/interfaces/index.ts b/packages/twenty-server/src/engine/core-modules/message-queue/interfaces/index.ts new file mode 100644 index 000000000000..e3e8ece28e9c --- /dev/null +++ b/packages/twenty-server/src/engine/core-modules/message-queue/interfaces/index.ts @@ -0,0 +1 @@ +export * from 'packages/twenty-server/src/engine/core-modules/message-queue/interfaces/message-queue-module-options.interface'; diff --git a/packages/twenty-server/src/engine/integrations/message-queue/interfaces/message-queue-job.interface.ts b/packages/twenty-server/src/engine/core-modules/message-queue/interfaces/message-queue-job.interface.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/message-queue/interfaces/message-queue-job.interface.ts rename to packages/twenty-server/src/engine/core-modules/message-queue/interfaces/message-queue-job.interface.ts diff --git a/packages/twenty-server/src/engine/integrations/message-queue/interfaces/message-queue-module-options.interface.ts b/packages/twenty-server/src/engine/core-modules/message-queue/interfaces/message-queue-module-options.interface.ts similarity index 83% rename from packages/twenty-server/src/engine/integrations/message-queue/interfaces/message-queue-module-options.interface.ts rename to packages/twenty-server/src/engine/core-modules/message-queue/interfaces/message-queue-module-options.interface.ts index b98990385204..55027987a998 100644 --- a/packages/twenty-server/src/engine/integrations/message-queue/interfaces/message-queue-module-options.interface.ts +++ b/packages/twenty-server/src/engine/core-modules/message-queue/interfaces/message-queue-module-options.interface.ts @@ -1,5 +1,5 @@ -import { BullMQDriverOptions } from 'src/engine/integrations/message-queue/drivers/bullmq.driver'; -import { PgBossDriverOptions } from 'src/engine/integrations/message-queue/drivers/pg-boss.driver'; +import { BullMQDriverOptions } from 'src/engine/core-modules/message-queue/drivers/bullmq.driver'; +import { PgBossDriverOptions } from 'src/engine/core-modules/message-queue/drivers/pg-boss.driver'; export enum MessageQueueDriverType { PgBoss = 'pg-boss', diff --git a/packages/twenty-server/src/engine/integrations/message-queue/interfaces/message-queue-worker-options.interface.ts b/packages/twenty-server/src/engine/core-modules/message-queue/interfaces/message-queue-worker-options.interface.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/message-queue/interfaces/message-queue-worker-options.interface.ts rename to packages/twenty-server/src/engine/core-modules/message-queue/interfaces/message-queue-worker-options.interface.ts diff --git a/packages/twenty-server/src/engine/integrations/message-queue/jobs.module.ts b/packages/twenty-server/src/engine/core-modules/message-queue/jobs.module.ts similarity index 96% rename from packages/twenty-server/src/engine/integrations/message-queue/jobs.module.ts rename to packages/twenty-server/src/engine/core-modules/message-queue/jobs.module.ts index 6516455d55b9..7c78a1fd9940 100644 --- a/packages/twenty-server/src/engine/integrations/message-queue/jobs.module.ts +++ b/packages/twenty-server/src/engine/core-modules/message-queue/jobs.module.ts @@ -14,8 +14,8 @@ import { UserModule } from 'src/engine/core-modules/user/user.module'; import { HandleWorkspaceMemberDeletedJob } from 'src/engine/core-modules/workspace/handle-workspace-member-deleted.job'; import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; import { WorkspaceModule } from 'src/engine/core-modules/workspace/workspace.module'; -import { EmailSenderJob } from 'src/engine/integrations/email/email-sender.job'; -import { EmailModule } from 'src/engine/integrations/email/email.module'; +import { EmailSenderJob } from 'src/engine/core-modules/email/email-sender.job'; +import { EmailModule } from 'src/engine/core-modules/email/email.module'; import { DataSourceModule } from 'src/engine/metadata-modules/data-source/data-source.module'; import { ObjectMetadataModule } from 'src/engine/metadata-modules/object-metadata/object-metadata.module'; import { CleanInactiveWorkspaceJob } from 'src/engine/workspace-manager/workspace-cleaner/crons/clean-inactive-workspace.job'; diff --git a/packages/twenty-server/src/engine/integrations/message-queue/message-queue-core.module.ts b/packages/twenty-server/src/engine/core-modules/message-queue/message-queue-core.module.ts similarity index 84% rename from packages/twenty-server/src/engine/integrations/message-queue/message-queue-core.module.ts rename to packages/twenty-server/src/engine/core-modules/message-queue/message-queue-core.module.ts index 6c785e23529d..fb4b7dd6ccce 100644 --- a/packages/twenty-server/src/engine/integrations/message-queue/message-queue-core.module.ts +++ b/packages/twenty-server/src/engine/core-modules/message-queue/message-queue-core.module.ts @@ -6,23 +6,23 @@ import { Provider, } from '@nestjs/common'; -import { MessageQueueDriver } from 'src/engine/integrations/message-queue/drivers/interfaces/message-queue-driver.interface'; +import { MessageQueueDriver } from 'src/engine/core-modules/message-queue/drivers/interfaces/message-queue-driver.interface'; -import { MessageQueueDriverType } from 'src/engine/integrations/message-queue/interfaces'; +import { MessageQueueDriverType } from 'src/engine/core-modules/message-queue/interfaces'; import { MessageQueue, QUEUE_DRIVER, -} from 'src/engine/integrations/message-queue/message-queue.constants'; -import { PgBossDriver } from 'src/engine/integrations/message-queue/drivers/pg-boss.driver'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; -import { BullMQDriver } from 'src/engine/integrations/message-queue/drivers/bullmq.driver'; -import { SyncDriver } from 'src/engine/integrations/message-queue/drivers/sync.driver'; -import { getQueueToken } from 'src/engine/integrations/message-queue/utils/get-queue-token.util'; +} from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { PgBossDriver } from 'src/engine/core-modules/message-queue/drivers/pg-boss.driver'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; +import { BullMQDriver } from 'src/engine/core-modules/message-queue/drivers/bullmq.driver'; +import { SyncDriver } from 'src/engine/core-modules/message-queue/drivers/sync.driver'; +import { getQueueToken } from 'src/engine/core-modules/message-queue/utils/get-queue-token.util'; import { ASYNC_OPTIONS_TYPE, ConfigurableModuleClass, OPTIONS_TYPE, -} from 'src/engine/integrations/message-queue/message-queue.module-definition'; +} from 'src/engine/core-modules/message-queue/message-queue.module-definition'; @Global() @Module({}) diff --git a/packages/twenty-server/src/engine/integrations/message-queue/message-queue-metadata.accessor.ts b/packages/twenty-server/src/engine/core-modules/message-queue/message-queue-metadata.accessor.ts similarity index 77% rename from packages/twenty-server/src/engine/integrations/message-queue/message-queue-metadata.accessor.ts rename to packages/twenty-server/src/engine/core-modules/message-queue/message-queue-metadata.accessor.ts index a63c3f16e567..2dce32e825f2 100644 --- a/packages/twenty-server/src/engine/integrations/message-queue/message-queue-metadata.accessor.ts +++ b/packages/twenty-server/src/engine/core-modules/message-queue/message-queue-metadata.accessor.ts @@ -2,12 +2,12 @@ import { Injectable, Type } from '@nestjs/common'; import { Reflector } from '@nestjs/core'; -import { MessageQueueProcessOptions } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { MessageQueueProcessorOptions } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; +import { MessageQueueProcessOptions } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { MessageQueueProcessorOptions } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; import { PROCESSOR_METADATA, PROCESS_METADATA, -} from 'src/engine/integrations/message-queue/message-queue.constants'; +} from 'src/engine/core-modules/message-queue/message-queue.constants'; @Injectable() export class MessageQueueMetadataAccessor { diff --git a/packages/twenty-server/src/engine/integrations/message-queue/message-queue.constants.ts b/packages/twenty-server/src/engine/core-modules/message-queue/message-queue.constants.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/message-queue/message-queue.constants.ts rename to packages/twenty-server/src/engine/core-modules/message-queue/message-queue.constants.ts diff --git a/packages/twenty-server/src/engine/integrations/message-queue/message-queue.explorer.ts b/packages/twenty-server/src/engine/core-modules/message-queue/message-queue.explorer.ts similarity index 91% rename from packages/twenty-server/src/engine/integrations/message-queue/message-queue.explorer.ts rename to packages/twenty-server/src/engine/core-modules/message-queue/message-queue.explorer.ts index 30e73f6bbc7b..87108b6fd3ea 100644 --- a/packages/twenty-server/src/engine/integrations/message-queue/message-queue.explorer.ts +++ b/packages/twenty-server/src/engine/core-modules/message-queue/message-queue.explorer.ts @@ -9,18 +9,18 @@ import { Module } from '@nestjs/core/injector/module'; import { Injector } from '@nestjs/core/injector/injector'; import { InstanceWrapper } from '@nestjs/core/injector/instance-wrapper'; -import { MessageQueueWorkerOptions } from 'src/engine/integrations/message-queue/interfaces/message-queue-worker-options.interface'; +import { MessageQueueWorkerOptions } from 'src/engine/core-modules/message-queue/interfaces/message-queue-worker-options.interface'; import { MessageQueueJob, MessageQueueJobData, -} from 'src/engine/integrations/message-queue/interfaces/message-queue-job.interface'; +} from 'src/engine/core-modules/message-queue/interfaces/message-queue-job.interface'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; -import { getQueueToken } from 'src/engine/integrations/message-queue/utils/get-queue-token.util'; -import { ExceptionHandlerService } from 'src/engine/integrations/exception-handler/exception-handler.service'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; +import { getQueueToken } from 'src/engine/core-modules/message-queue/utils/get-queue-token.util'; +import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service'; import { shouldFilterException } from 'src/engine/utils/global-exception-handler.util'; -import { MessageQueueMetadataAccessor } from './message-queue-metadata.accessor'; +import { MessageQueueMetadataAccessor } from 'packages/twenty-server/src/engine/core-modules/message-queue/message-queue-metadata.accessor'; interface ProcessorGroup { instance: object; diff --git a/packages/twenty-server/src/engine/integrations/message-queue/message-queue.module-definition.ts b/packages/twenty-server/src/engine/core-modules/message-queue/message-queue.module-definition.ts similarity index 80% rename from packages/twenty-server/src/engine/integrations/message-queue/message-queue.module-definition.ts rename to packages/twenty-server/src/engine/core-modules/message-queue/message-queue.module-definition.ts index b7a437032f3e..ed24da3171d2 100644 --- a/packages/twenty-server/src/engine/integrations/message-queue/message-queue.module-definition.ts +++ b/packages/twenty-server/src/engine/core-modules/message-queue/message-queue.module-definition.ts @@ -1,6 +1,6 @@ import { ConfigurableModuleBuilder } from '@nestjs/common'; -import { MessageQueueModuleOptions } from 'src/engine/integrations/message-queue/interfaces'; +import { MessageQueueModuleOptions } from 'src/engine/core-modules/message-queue/interfaces'; export const { ConfigurableModuleClass, diff --git a/packages/twenty-server/src/engine/integrations/message-queue/message-queue.module-factory.ts b/packages/twenty-server/src/engine/core-modules/message-queue/message-queue.module-factory.ts similarity index 92% rename from packages/twenty-server/src/engine/integrations/message-queue/message-queue.module-factory.ts rename to packages/twenty-server/src/engine/core-modules/message-queue/message-queue.module-factory.ts index 4aad6714ba97..ad18f6cd8224 100644 --- a/packages/twenty-server/src/engine/integrations/message-queue/message-queue.module-factory.ts +++ b/packages/twenty-server/src/engine/core-modules/message-queue/message-queue.module-factory.ts @@ -1,8 +1,8 @@ -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; import { MessageQueueDriverType, MessageQueueModuleOptions, -} from 'src/engine/integrations/message-queue/interfaces'; +} from 'src/engine/core-modules/message-queue/interfaces'; /** * MessageQueue Module factory diff --git a/packages/twenty-server/src/engine/integrations/message-queue/message-queue.module.ts b/packages/twenty-server/src/engine/core-modules/message-queue/message-queue.module.ts similarity index 74% rename from packages/twenty-server/src/engine/integrations/message-queue/message-queue.module.ts rename to packages/twenty-server/src/engine/core-modules/message-queue/message-queue.module.ts index ee7fb385b1fb..428be7caab0b 100644 --- a/packages/twenty-server/src/engine/integrations/message-queue/message-queue.module.ts +++ b/packages/twenty-server/src/engine/core-modules/message-queue/message-queue.module.ts @@ -1,13 +1,13 @@ import { DynamicModule, Global, Module } from '@nestjs/common'; import { DiscoveryModule } from '@nestjs/core'; -import { MessageQueueCoreModule } from 'src/engine/integrations/message-queue/message-queue-core.module'; -import { MessageQueueMetadataAccessor } from 'src/engine/integrations/message-queue/message-queue-metadata.accessor'; -import { MessageQueueExplorer } from 'src/engine/integrations/message-queue/message-queue.explorer'; +import { MessageQueueCoreModule } from 'src/engine/core-modules/message-queue/message-queue-core.module'; +import { MessageQueueMetadataAccessor } from 'src/engine/core-modules/message-queue/message-queue-metadata.accessor'; +import { MessageQueueExplorer } from 'src/engine/core-modules/message-queue/message-queue.explorer'; import { ASYNC_OPTIONS_TYPE, OPTIONS_TYPE, -} from 'src/engine/integrations/message-queue/message-queue.module-definition'; +} from 'src/engine/core-modules/message-queue/message-queue.module-definition'; @Global() @Module({}) diff --git a/packages/twenty-server/src/engine/integrations/message-queue/services/__tests__/message-queue-task-assigned.service.spec.ts b/packages/twenty-server/src/engine/core-modules/message-queue/services/__tests__/message-queue-task-assigned.service.spec.ts similarity index 85% rename from packages/twenty-server/src/engine/integrations/message-queue/services/__tests__/message-queue-task-assigned.service.spec.ts rename to packages/twenty-server/src/engine/core-modules/message-queue/services/__tests__/message-queue-task-assigned.service.spec.ts index 31e2b66ae978..f579767a0546 100644 --- a/packages/twenty-server/src/engine/integrations/message-queue/services/__tests__/message-queue-task-assigned.service.spec.ts +++ b/packages/twenty-server/src/engine/core-modules/message-queue/services/__tests__/message-queue-task-assigned.service.spec.ts @@ -1,12 +1,12 @@ import { Test, TestingModule } from '@nestjs/testing'; -import { MessageQueueDriver } from 'src/engine/integrations/message-queue/drivers/interfaces/message-queue-driver.interface'; +import { MessageQueueDriver } from 'src/engine/core-modules/message-queue/drivers/interfaces/message-queue-driver.interface'; import { QUEUE_DRIVER, MessageQueue, -} from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +} from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; describe('MessageQueueTaskAssigned queue', () => { let service: MessageQueueService; diff --git a/packages/twenty-server/src/engine/integrations/message-queue/services/message-queue.service.ts b/packages/twenty-server/src/engine/core-modules/message-queue/services/message-queue.service.ts similarity index 78% rename from packages/twenty-server/src/engine/integrations/message-queue/services/message-queue.service.ts rename to packages/twenty-server/src/engine/core-modules/message-queue/services/message-queue.service.ts index 6460e112d974..2030ca8dd75d 100644 --- a/packages/twenty-server/src/engine/integrations/message-queue/services/message-queue.service.ts +++ b/packages/twenty-server/src/engine/core-modules/message-queue/services/message-queue.service.ts @@ -3,18 +3,18 @@ import { Inject, Injectable } from '@nestjs/common'; import { QueueCronJobOptions, QueueJobOptions, -} from 'src/engine/integrations/message-queue/drivers/interfaces/job-options.interface'; -import { MessageQueueDriver } from 'src/engine/integrations/message-queue/drivers/interfaces/message-queue-driver.interface'; +} from 'src/engine/core-modules/message-queue/drivers/interfaces/job-options.interface'; +import { MessageQueueDriver } from 'src/engine/core-modules/message-queue/drivers/interfaces/message-queue-driver.interface'; import { MessageQueueJobData, MessageQueueJob, -} from 'src/engine/integrations/message-queue/interfaces/message-queue-job.interface'; -import { MessageQueueWorkerOptions } from 'src/engine/integrations/message-queue/interfaces/message-queue-worker-options.interface'; +} from 'src/engine/core-modules/message-queue/interfaces/message-queue-job.interface'; +import { MessageQueueWorkerOptions } from 'src/engine/core-modules/message-queue/interfaces/message-queue-worker-options.interface'; import { MessageQueue, QUEUE_DRIVER, -} from 'src/engine/integrations/message-queue/message-queue.constants'; +} from 'src/engine/core-modules/message-queue/message-queue.constants'; @Injectable() export class MessageQueueService { diff --git a/packages/twenty-server/src/engine/integrations/message-queue/utils/get-queue-token.util.ts b/packages/twenty-server/src/engine/core-modules/message-queue/utils/get-queue-token.util.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/message-queue/utils/get-queue-token.util.ts rename to packages/twenty-server/src/engine/core-modules/message-queue/utils/get-queue-token.util.ts diff --git a/packages/twenty-server/src/engine/core-modules/open-api/open-api.service.spec.ts b/packages/twenty-server/src/engine/core-modules/open-api/open-api.service.spec.ts index b2252b0c6810..7e6f2d26e5ff 100644 --- a/packages/twenty-server/src/engine/core-modules/open-api/open-api.service.spec.ts +++ b/packages/twenty-server/src/engine/core-modules/open-api/open-api.service.spec.ts @@ -3,7 +3,7 @@ import { Test, TestingModule } from '@nestjs/testing'; import { OpenApiService } from 'src/engine/core-modules/open-api/open-api.service'; import { ObjectMetadataService } from 'src/engine/metadata-modules/object-metadata/object-metadata.service'; import { TokenService } from 'src/engine/core-modules/auth/services/token.service'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; describe('OpenApiService', () => { let service: OpenApiService; diff --git a/packages/twenty-server/src/engine/core-modules/open-api/open-api.service.ts b/packages/twenty-server/src/engine/core-modules/open-api/open-api.service.ts index bdcd710fa4bf..49e7ed9ac146 100644 --- a/packages/twenty-server/src/engine/core-modules/open-api/open-api.service.ts +++ b/packages/twenty-server/src/engine/core-modules/open-api/open-api.service.ts @@ -33,7 +33,7 @@ import { getFindOneResponse200, getUpdateOneResponse200, } from 'src/engine/core-modules/open-api/utils/responses.utils'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; import { ObjectMetadataService } from 'src/engine/metadata-modules/object-metadata/object-metadata.service'; import { capitalize } from 'src/utils/capitalize'; import { getServerUrl } from 'src/utils/get-server-url'; diff --git a/packages/twenty-server/src/engine/core-modules/postgres-credentials/postgres-credentials.module.ts b/packages/twenty-server/src/engine/core-modules/postgres-credentials/postgres-credentials.module.ts index fcb2bbdd4606..9034a9a1bfb3 100644 --- a/packages/twenty-server/src/engine/core-modules/postgres-credentials/postgres-credentials.module.ts +++ b/packages/twenty-server/src/engine/core-modules/postgres-credentials/postgres-credentials.module.ts @@ -4,7 +4,7 @@ import { TypeOrmModule } from '@nestjs/typeorm'; import { PostgresCredentials } from 'src/engine/core-modules/postgres-credentials/postgres-credentials.entity'; import { PostgresCredentialsResolver } from 'src/engine/core-modules/postgres-credentials/postgres-credentials.resolver'; import { PostgresCredentialsService } from 'src/engine/core-modules/postgres-credentials/postgres-credentials.service'; -import { EnvironmentModule } from 'src/engine/integrations/environment/environment.module'; +import { EnvironmentModule } from 'src/engine/core-modules/environment/environment.module'; @Module({ imports: [ diff --git a/packages/twenty-server/src/engine/core-modules/postgres-credentials/postgres-credentials.service.ts b/packages/twenty-server/src/engine/core-modules/postgres-credentials/postgres-credentials.service.ts index 790c36ab266e..de8e78244d37 100644 --- a/packages/twenty-server/src/engine/core-modules/postgres-credentials/postgres-credentials.service.ts +++ b/packages/twenty-server/src/engine/core-modules/postgres-credentials/postgres-credentials.service.ts @@ -12,7 +12,7 @@ import { import { NotFoundError } from 'src/engine/core-modules/graphql/utils/graphql-errors.util'; import { PostgresCredentialsDTO } from 'src/engine/core-modules/postgres-credentials/dtos/postgres-credentials.dto'; import { PostgresCredentials } from 'src/engine/core-modules/postgres-credentials/postgres-credentials.entity'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; export class PostgresCredentialsService { constructor( diff --git a/packages/twenty-server/src/engine/integrations/serverless/drivers/base-serverless.driver.ts b/packages/twenty-server/src/engine/core-modules/serverless/drivers/base-serverless.driver.ts similarity index 71% rename from packages/twenty-server/src/engine/integrations/serverless/drivers/base-serverless.driver.ts rename to packages/twenty-server/src/engine/core-modules/serverless/drivers/base-serverless.driver.ts index bce3c8e42d13..e7abc6743302 100644 --- a/packages/twenty-server/src/engine/integrations/serverless/drivers/base-serverless.driver.ts +++ b/packages/twenty-server/src/engine/core-modules/serverless/drivers/base-serverless.driver.ts @@ -1,9 +1,9 @@ -import { FileStorageService } from 'src/engine/integrations/file-storage/file-storage.service'; -import { readFileContent } from 'src/engine/integrations/file-storage/utils/read-file-content'; -import { SOURCE_FILE_NAME } from 'src/engine/integrations/serverless/drivers/constants/source-file-name'; -import { compileTypescript } from 'src/engine/integrations/serverless/drivers/utils/compile-typescript'; +import { FileStorageService } from 'src/engine/core-modules/file-storage/file-storage.service'; +import { readFileContent } from 'src/engine/core-modules/file-storage/utils/read-file-content'; +import { SOURCE_FILE_NAME } from 'src/engine/core-modules/serverless/drivers/constants/source-file-name'; +import { compileTypescript } from 'src/engine/core-modules/serverless/drivers/utils/compile-typescript'; import { ServerlessFunctionEntity } from 'src/engine/metadata-modules/serverless-function/serverless-function.entity'; -import { getServerlessFolder } from 'src/engine/integrations/serverless/utils/serverless-get-folder.utils'; +import { getServerlessFolder } from 'src/engine/core-modules/serverless/utils/serverless-get-folder.utils'; export class BaseServerlessDriver { async getCompiledCode( diff --git a/packages/twenty-server/src/engine/integrations/serverless/drivers/constants/build-file-name.ts b/packages/twenty-server/src/engine/core-modules/serverless/drivers/constants/build-file-name.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/serverless/drivers/constants/build-file-name.ts rename to packages/twenty-server/src/engine/core-modules/serverless/drivers/constants/build-file-name.ts diff --git a/packages/twenty-server/src/engine/integrations/serverless/drivers/constants/common-layer-name.ts b/packages/twenty-server/src/engine/core-modules/serverless/drivers/constants/common-layer-name.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/serverless/drivers/constants/common-layer-name.ts rename to packages/twenty-server/src/engine/core-modules/serverless/drivers/constants/common-layer-name.ts diff --git a/packages/twenty-server/src/engine/integrations/serverless/drivers/constants/serverless-tmpdir-folder.ts b/packages/twenty-server/src/engine/core-modules/serverless/drivers/constants/serverless-tmpdir-folder.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/serverless/drivers/constants/serverless-tmpdir-folder.ts rename to packages/twenty-server/src/engine/core-modules/serverless/drivers/constants/serverless-tmpdir-folder.ts diff --git a/packages/twenty-server/src/engine/integrations/serverless/drivers/constants/source-file-name.ts b/packages/twenty-server/src/engine/core-modules/serverless/drivers/constants/source-file-name.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/serverless/drivers/constants/source-file-name.ts rename to packages/twenty-server/src/engine/core-modules/serverless/drivers/constants/source-file-name.ts diff --git a/packages/twenty-server/src/engine/integrations/serverless/drivers/interfaces/serverless-driver.interface.ts b/packages/twenty-server/src/engine/core-modules/serverless/drivers/interfaces/serverless-driver.interface.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/serverless/drivers/interfaces/serverless-driver.interface.ts rename to packages/twenty-server/src/engine/core-modules/serverless/drivers/interfaces/serverless-driver.interface.ts diff --git a/packages/twenty-server/src/engine/integrations/serverless/drivers/lambda.driver.ts b/packages/twenty-server/src/engine/core-modules/serverless/drivers/lambda.driver.ts similarity index 95% rename from packages/twenty-server/src/engine/integrations/serverless/drivers/lambda.driver.ts rename to packages/twenty-server/src/engine/core-modules/serverless/drivers/lambda.driver.ts index b61101b74f23..747a0763dff3 100644 --- a/packages/twenty-server/src/engine/integrations/serverless/drivers/lambda.driver.ts +++ b/packages/twenty-server/src/engine/core-modules/serverless/drivers/lambda.driver.ts @@ -25,7 +25,7 @@ import { UpdateFunctionCodeCommandInput } from '@aws-sdk/client-lambda/dist-type import { ServerlessDriver, ServerlessExecuteResult, -} from 'src/engine/integrations/serverless/drivers/interfaces/serverless-driver.interface'; +} from 'src/engine/core-modules/serverless/drivers/interfaces/serverless-driver.interface'; import { ServerlessFunctionEntity, @@ -34,18 +34,18 @@ import { import { LambdaBuildDirectoryManager, NODE_LAYER_SUBFOLDER, -} from 'src/engine/integrations/serverless/drivers/utils/lambda-build-directory-manager'; -import { FileStorageService } from 'src/engine/integrations/file-storage/file-storage.service'; -import { BaseServerlessDriver } from 'src/engine/integrations/serverless/drivers/base-serverless.driver'; -import { createZipFile } from 'src/engine/integrations/serverless/drivers/utils/create-zip-file'; +} from 'src/engine/core-modules/serverless/drivers/utils/lambda-build-directory-manager'; +import { FileStorageService } from 'src/engine/core-modules/file-storage/file-storage.service'; +import { BaseServerlessDriver } from 'src/engine/core-modules/serverless/drivers/base-serverless.driver'; +import { createZipFile } from 'src/engine/core-modules/serverless/drivers/utils/create-zip-file'; import { ServerlessFunctionExecutionStatus } from 'src/engine/metadata-modules/serverless-function/dtos/serverless-function-execution-result.dto'; import { ServerlessFunctionException, ServerlessFunctionExceptionCode, } from 'src/engine/metadata-modules/serverless-function/serverless-function.exception'; import { isDefined } from 'src/utils/is-defined'; -import { COMMON_LAYER_NAME } from 'src/engine/integrations/serverless/drivers/constants/common-layer-name'; -import { copyAndBuildDependencies } from 'src/engine/integrations/serverless/drivers/utils/copy-and-build-dependencies'; +import { COMMON_LAYER_NAME } from 'src/engine/core-modules/serverless/drivers/constants/common-layer-name'; +import { copyAndBuildDependencies } from 'src/engine/core-modules/serverless/drivers/utils/copy-and-build-dependencies'; export interface LambdaDriverOptions extends LambdaClientConfig { fileStorageService: FileStorageService; diff --git a/packages/twenty-server/src/engine/integrations/serverless/drivers/layers/1/package.json b/packages/twenty-server/src/engine/core-modules/serverless/drivers/layers/1/package.json similarity index 100% rename from packages/twenty-server/src/engine/integrations/serverless/drivers/layers/1/package.json rename to packages/twenty-server/src/engine/core-modules/serverless/drivers/layers/1/package.json diff --git a/packages/twenty-server/src/engine/integrations/serverless/drivers/layers/1/yarn.lock b/packages/twenty-server/src/engine/core-modules/serverless/drivers/layers/1/yarn.lock similarity index 100% rename from packages/twenty-server/src/engine/integrations/serverless/drivers/layers/1/yarn.lock rename to packages/twenty-server/src/engine/core-modules/serverless/drivers/layers/1/yarn.lock diff --git a/packages/twenty-server/src/engine/integrations/serverless/drivers/layers/engine/.yarn/releases/yarn-4.4.0.cjs b/packages/twenty-server/src/engine/core-modules/serverless/drivers/layers/engine/.yarn/releases/yarn-4.4.0.cjs similarity index 100% rename from packages/twenty-server/src/engine/integrations/serverless/drivers/layers/engine/.yarn/releases/yarn-4.4.0.cjs rename to packages/twenty-server/src/engine/core-modules/serverless/drivers/layers/engine/.yarn/releases/yarn-4.4.0.cjs diff --git a/packages/twenty-server/src/engine/integrations/serverless/drivers/layers/engine/.yarnrc.yml b/packages/twenty-server/src/engine/core-modules/serverless/drivers/layers/engine/.yarnrc.yml similarity index 100% rename from packages/twenty-server/src/engine/integrations/serverless/drivers/layers/engine/.yarnrc.yml rename to packages/twenty-server/src/engine/core-modules/serverless/drivers/layers/engine/.yarnrc.yml diff --git a/packages/twenty-server/src/engine/integrations/serverless/drivers/layers/last-layer-version.ts b/packages/twenty-server/src/engine/core-modules/serverless/drivers/layers/last-layer-version.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/serverless/drivers/layers/last-layer-version.ts rename to packages/twenty-server/src/engine/core-modules/serverless/drivers/layers/last-layer-version.ts diff --git a/packages/twenty-server/src/engine/integrations/serverless/drivers/local.driver.ts b/packages/twenty-server/src/engine/core-modules/serverless/drivers/local.driver.ts similarity index 90% rename from packages/twenty-server/src/engine/integrations/serverless/drivers/local.driver.ts rename to packages/twenty-server/src/engine/core-modules/serverless/drivers/local.driver.ts index 194e45f222bf..00772cfd24a9 100644 --- a/packages/twenty-server/src/engine/integrations/serverless/drivers/local.driver.ts +++ b/packages/twenty-server/src/engine/core-modules/serverless/drivers/local.driver.ts @@ -4,27 +4,27 @@ import { join } from 'path'; import { v4 } from 'uuid'; -import { FileStorageExceptionCode } from 'src/engine/integrations/file-storage/interfaces/file-storage-exception'; +import { FileStorageExceptionCode } from 'src/engine/core-modules/file-storage/interfaces/file-storage-exception'; import { ServerlessDriver, ServerlessExecuteError, ServerlessExecuteResult, -} from 'src/engine/integrations/serverless/drivers/interfaces/serverless-driver.interface'; +} from 'src/engine/core-modules/serverless/drivers/interfaces/serverless-driver.interface'; -import { FileStorageService } from 'src/engine/integrations/file-storage/file-storage.service'; -import { readFileContent } from 'src/engine/integrations/file-storage/utils/read-file-content'; -import { BaseServerlessDriver } from 'src/engine/integrations/serverless/drivers/base-serverless.driver'; -import { BUILD_FILE_NAME } from 'src/engine/integrations/serverless/drivers/constants/build-file-name'; -import { getServerlessFolder } from 'src/engine/integrations/serverless/utils/serverless-get-folder.utils'; +import { FileStorageService } from 'src/engine/core-modules/file-storage/file-storage.service'; +import { readFileContent } from 'src/engine/core-modules/file-storage/utils/read-file-content'; +import { BaseServerlessDriver } from 'src/engine/core-modules/serverless/drivers/base-serverless.driver'; +import { BUILD_FILE_NAME } from 'src/engine/core-modules/serverless/drivers/constants/build-file-name'; +import { getServerlessFolder } from 'src/engine/core-modules/serverless/utils/serverless-get-folder.utils'; import { ServerlessFunctionExecutionStatus } from 'src/engine/metadata-modules/serverless-function/dtos/serverless-function-execution-result.dto'; import { ServerlessFunctionEntity } from 'src/engine/metadata-modules/serverless-function/serverless-function.entity'; import { ServerlessFunctionException, ServerlessFunctionExceptionCode, } from 'src/engine/metadata-modules/serverless-function/serverless-function.exception'; -import { COMMON_LAYER_NAME } from 'src/engine/integrations/serverless/drivers/constants/common-layer-name'; -import { copyAndBuildDependencies } from 'src/engine/integrations/serverless/drivers/utils/copy-and-build-dependencies'; -import { SERVERLESS_TMPDIR_FOLDER } from 'src/engine/integrations/serverless/drivers/constants/serverless-tmpdir-folder'; +import { COMMON_LAYER_NAME } from 'src/engine/core-modules/serverless/drivers/constants/common-layer-name'; +import { copyAndBuildDependencies } from 'src/engine/core-modules/serverless/drivers/utils/copy-and-build-dependencies'; +import { SERVERLESS_TMPDIR_FOLDER } from 'src/engine/core-modules/serverless/drivers/constants/serverless-tmpdir-folder'; export interface LocalDriverOptions { fileStorageService: FileStorageService; diff --git a/packages/twenty-server/src/engine/integrations/serverless/drivers/utils/compile-typescript.ts b/packages/twenty-server/src/engine/core-modules/serverless/drivers/utils/compile-typescript.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/serverless/drivers/utils/compile-typescript.ts rename to packages/twenty-server/src/engine/core-modules/serverless/drivers/utils/compile-typescript.ts diff --git a/packages/twenty-server/src/engine/integrations/serverless/drivers/utils/copy-and-build-dependencies.ts b/packages/twenty-server/src/engine/core-modules/serverless/drivers/utils/copy-and-build-dependencies.ts similarity index 88% rename from packages/twenty-server/src/engine/integrations/serverless/drivers/utils/copy-and-build-dependencies.ts rename to packages/twenty-server/src/engine/core-modules/serverless/drivers/utils/copy-and-build-dependencies.ts index ab50e6a8acf3..0a7581bb8711 100644 --- a/packages/twenty-server/src/engine/integrations/serverless/drivers/utils/copy-and-build-dependencies.ts +++ b/packages/twenty-server/src/engine/core-modules/serverless/drivers/utils/copy-and-build-dependencies.ts @@ -3,7 +3,7 @@ import { promisify } from 'util'; import { exec } from 'child_process'; import { join } from 'path'; -import { getLayerDependenciesDirName } from 'src/engine/integrations/serverless/drivers/utils/get-layer-dependencies-dir-name'; +import { getLayerDependenciesDirName } from 'src/engine/core-modules/serverless/drivers/utils/get-layer-dependencies-dir-name'; const execPromise = promisify(exec); diff --git a/packages/twenty-server/src/engine/integrations/serverless/drivers/utils/create-zip-file.ts b/packages/twenty-server/src/engine/core-modules/serverless/drivers/utils/create-zip-file.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/serverless/drivers/utils/create-zip-file.ts rename to packages/twenty-server/src/engine/core-modules/serverless/drivers/utils/create-zip-file.ts diff --git a/packages/twenty-server/src/engine/integrations/serverless/drivers/utils/get-last-layer-dependencies.ts b/packages/twenty-server/src/engine/core-modules/serverless/drivers/utils/get-last-layer-dependencies.ts similarity index 82% rename from packages/twenty-server/src/engine/integrations/serverless/drivers/utils/get-last-layer-dependencies.ts rename to packages/twenty-server/src/engine/core-modules/serverless/drivers/utils/get-last-layer-dependencies.ts index a7c484d092cc..75eba8888a71 100644 --- a/packages/twenty-server/src/engine/integrations/serverless/drivers/utils/get-last-layer-dependencies.ts +++ b/packages/twenty-server/src/engine/core-modules/serverless/drivers/utils/get-last-layer-dependencies.ts @@ -1,7 +1,7 @@ import fs from 'fs/promises'; import { join } from 'path'; -import { getLayerDependenciesDirName } from 'src/engine/integrations/serverless/drivers/utils/get-layer-dependencies-dir-name'; +import { getLayerDependenciesDirName } from 'src/engine/core-modules/serverless/drivers/utils/get-layer-dependencies-dir-name'; export type LayerDependencies = { packageJson: { dependencies: object }; diff --git a/packages/twenty-server/src/engine/integrations/serverless/drivers/utils/get-layer-dependencies-dir-name.ts b/packages/twenty-server/src/engine/core-modules/serverless/drivers/utils/get-layer-dependencies-dir-name.ts similarity index 86% rename from packages/twenty-server/src/engine/integrations/serverless/drivers/utils/get-layer-dependencies-dir-name.ts rename to packages/twenty-server/src/engine/core-modules/serverless/drivers/utils/get-layer-dependencies-dir-name.ts index ce29b7e43718..3c6ee4e8b26e 100644 --- a/packages/twenty-server/src/engine/integrations/serverless/drivers/utils/get-layer-dependencies-dir-name.ts +++ b/packages/twenty-server/src/engine/core-modules/serverless/drivers/utils/get-layer-dependencies-dir-name.ts @@ -1,6 +1,6 @@ import path from 'path'; -import { LAST_LAYER_VERSION } from 'src/engine/integrations/serverless/drivers/layers/last-layer-version'; +import { LAST_LAYER_VERSION } from 'src/engine/core-modules/serverless/drivers/layers/last-layer-version'; // Can only be used in src/engine/integrations/serverless/drivers/utils folder export const getLayerDependenciesDirName = ( diff --git a/packages/twenty-server/src/engine/integrations/serverless/drivers/utils/lambda-build-directory-manager.ts b/packages/twenty-server/src/engine/core-modules/serverless/drivers/utils/lambda-build-directory-manager.ts similarity index 94% rename from packages/twenty-server/src/engine/integrations/serverless/drivers/utils/lambda-build-directory-manager.ts rename to packages/twenty-server/src/engine/core-modules/serverless/drivers/utils/lambda-build-directory-manager.ts index 00b150b5d0b6..b67811f9742f 100644 --- a/packages/twenty-server/src/engine/integrations/serverless/drivers/utils/lambda-build-directory-manager.ts +++ b/packages/twenty-server/src/engine/core-modules/serverless/drivers/utils/lambda-build-directory-manager.ts @@ -3,7 +3,7 @@ import * as fs from 'fs/promises'; import { v4 } from 'uuid'; -import { SERVERLESS_TMPDIR_FOLDER } from 'src/engine/integrations/serverless/drivers/constants/serverless-tmpdir-folder'; +import { SERVERLESS_TMPDIR_FOLDER } from 'src/engine/core-modules/serverless/drivers/constants/serverless-tmpdir-folder'; export const NODE_LAYER_SUBFOLDER = 'nodejs'; diff --git a/packages/twenty-server/src/engine/integrations/serverless/serverless-module.factory.ts b/packages/twenty-server/src/engine/core-modules/serverless/serverless-module.factory.ts similarity index 89% rename from packages/twenty-server/src/engine/integrations/serverless/serverless-module.factory.ts rename to packages/twenty-server/src/engine/core-modules/serverless/serverless-module.factory.ts index 12bec8fe02f1..e8c2d7baaf06 100644 --- a/packages/twenty-server/src/engine/integrations/serverless/serverless-module.factory.ts +++ b/packages/twenty-server/src/engine/core-modules/serverless/serverless-module.factory.ts @@ -1,11 +1,11 @@ import { fromNodeProviderChain } from '@aws-sdk/credential-providers'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; -import { FileStorageService } from 'src/engine/integrations/file-storage/file-storage.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; +import { FileStorageService } from 'src/engine/core-modules/file-storage/file-storage.service'; import { ServerlessDriverType, ServerlessModuleOptions, -} from 'src/engine/integrations/serverless/serverless.interface'; +} from 'src/engine/core-modules/serverless/serverless.interface'; export const serverlessModuleFactory = async ( environmentService: EnvironmentService, diff --git a/packages/twenty-server/src/engine/integrations/serverless/serverless.constants.ts b/packages/twenty-server/src/engine/core-modules/serverless/serverless.constants.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/serverless/serverless.constants.ts rename to packages/twenty-server/src/engine/core-modules/serverless/serverless.constants.ts diff --git a/packages/twenty-server/src/engine/integrations/serverless/serverless.interface.ts b/packages/twenty-server/src/engine/core-modules/serverless/serverless.interface.ts similarity index 85% rename from packages/twenty-server/src/engine/integrations/serverless/serverless.interface.ts rename to packages/twenty-server/src/engine/core-modules/serverless/serverless.interface.ts index c1c4fb661723..be2cbb694b2f 100644 --- a/packages/twenty-server/src/engine/integrations/serverless/serverless.interface.ts +++ b/packages/twenty-server/src/engine/core-modules/serverless/serverless.interface.ts @@ -1,7 +1,7 @@ import { FactoryProvider, ModuleMetadata } from '@nestjs/common'; -import { LocalDriverOptions } from 'src/engine/integrations/serverless/drivers/local.driver'; -import { LambdaDriverOptions } from 'src/engine/integrations/serverless/drivers/lambda.driver'; +import { LocalDriverOptions } from 'src/engine/core-modules/serverless/drivers/local.driver'; +import { LambdaDriverOptions } from 'src/engine/core-modules/serverless/drivers/lambda.driver'; export enum ServerlessDriverType { Lambda = 'lambda', diff --git a/packages/twenty-server/src/engine/integrations/serverless/serverless.module.ts b/packages/twenty-server/src/engine/core-modules/serverless/serverless.module.ts similarity index 73% rename from packages/twenty-server/src/engine/integrations/serverless/serverless.module.ts rename to packages/twenty-server/src/engine/core-modules/serverless/serverless.module.ts index f65034f3d216..de63788079f3 100644 --- a/packages/twenty-server/src/engine/integrations/serverless/serverless.module.ts +++ b/packages/twenty-server/src/engine/core-modules/serverless/serverless.module.ts @@ -1,13 +1,13 @@ import { DynamicModule, Global } from '@nestjs/common'; -import { LambdaDriver } from 'src/engine/integrations/serverless/drivers/lambda.driver'; -import { LocalDriver } from 'src/engine/integrations/serverless/drivers/local.driver'; -import { SERVERLESS_DRIVER } from 'src/engine/integrations/serverless/serverless.constants'; +import { LambdaDriver } from 'src/engine/core-modules/serverless/drivers/lambda.driver'; +import { LocalDriver } from 'src/engine/core-modules/serverless/drivers/local.driver'; +import { SERVERLESS_DRIVER } from 'src/engine/core-modules/serverless/serverless.constants'; import { ServerlessDriverType, ServerlessModuleAsyncOptions, -} from 'src/engine/integrations/serverless/serverless.interface'; -import { ServerlessService } from 'src/engine/integrations/serverless/serverless.service'; +} from 'src/engine/core-modules/serverless/serverless.interface'; +import { ServerlessService } from 'src/engine/core-modules/serverless/serverless.service'; @Global() export class ServerlessModule { diff --git a/packages/twenty-server/src/engine/integrations/serverless/serverless.service.ts b/packages/twenty-server/src/engine/core-modules/serverless/serverless.service.ts similarity index 89% rename from packages/twenty-server/src/engine/integrations/serverless/serverless.service.ts rename to packages/twenty-server/src/engine/core-modules/serverless/serverless.service.ts index b83c44060699..ee8fc93b4833 100644 --- a/packages/twenty-server/src/engine/integrations/serverless/serverless.service.ts +++ b/packages/twenty-server/src/engine/core-modules/serverless/serverless.service.ts @@ -3,9 +3,9 @@ import { Inject, Injectable } from '@nestjs/common'; import { ServerlessDriver, ServerlessExecuteResult, -} from 'src/engine/integrations/serverless/drivers/interfaces/serverless-driver.interface'; +} from 'src/engine/core-modules/serverless/drivers/interfaces/serverless-driver.interface'; -import { SERVERLESS_DRIVER } from 'src/engine/integrations/serverless/serverless.constants'; +import { SERVERLESS_DRIVER } from 'src/engine/core-modules/serverless/serverless.constants'; import { ServerlessFunctionEntity } from 'src/engine/metadata-modules/serverless-function/serverless-function.entity'; @Injectable() diff --git a/packages/twenty-server/src/engine/integrations/serverless/utils/serverless-get-folder.utils.ts b/packages/twenty-server/src/engine/core-modules/serverless/utils/serverless-get-folder.utils.ts similarity index 100% rename from packages/twenty-server/src/engine/integrations/serverless/utils/serverless-get-folder.utils.ts rename to packages/twenty-server/src/engine/core-modules/serverless/utils/serverless-get-folder.utils.ts diff --git a/packages/twenty-server/src/engine/core-modules/throttler/throttler.service.ts b/packages/twenty-server/src/engine/core-modules/throttler/throttler.service.ts index 5805db89aec6..55dac4c381a0 100644 --- a/packages/twenty-server/src/engine/core-modules/throttler/throttler.service.ts +++ b/packages/twenty-server/src/engine/core-modules/throttler/throttler.service.ts @@ -4,9 +4,9 @@ import { ThrottlerException, ThrottlerExceptionCode, } from 'src/engine/core-modules/throttler/throttler.exception'; -import { CacheStorageService } from 'src/engine/integrations/cache-storage/cache-storage.service'; -import { InjectCacheStorage } from 'src/engine/integrations/cache-storage/decorators/cache-storage.decorator'; -import { CacheStorageNamespace } from 'src/engine/integrations/cache-storage/types/cache-storage-namespace.enum'; +import { CacheStorageService } from 'src/engine/core-modules/cache-storage/cache-storage.service'; +import { InjectCacheStorage } from 'src/engine/core-modules/cache-storage/decorators/cache-storage.decorator'; +import { CacheStorageNamespace } from 'src/engine/core-modules/cache-storage/types/cache-storage-namespace.enum'; @Injectable() export class ThrottlerService { diff --git a/packages/twenty-server/src/engine/core-modules/user-workspace/user-workspace.service.ts b/packages/twenty-server/src/engine/core-modules/user-workspace/user-workspace.service.ts index cc2727b3a118..69972542b157 100644 --- a/packages/twenty-server/src/engine/core-modules/user-workspace/user-workspace.service.ts +++ b/packages/twenty-server/src/engine/core-modules/user-workspace/user-workspace.service.ts @@ -8,7 +8,7 @@ import { TypeORMService } from 'src/database/typeorm/typeorm.service'; import { UserWorkspace } from 'src/engine/core-modules/user-workspace/user-workspace.entity'; import { User } from 'src/engine/core-modules/user/user.entity'; import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; -import { ObjectRecordCreateEvent } from 'src/engine/integrations/event-emitter/types/object-record-create.event'; +import { ObjectRecordCreateEvent } from 'src/engine/core-modules/event-emitter/types/object-record-create.event'; import { DataSourceService } from 'src/engine/metadata-modules/data-source/data-source.service'; import { WorkspaceEventEmitter } from 'src/engine/workspace-event-emitter/workspace-event-emitter'; import { WorkspaceMemberWorkspaceEntity } from 'src/modules/workspace-member/standard-objects/workspace-member.workspace-entity'; diff --git a/packages/twenty-server/src/engine/core-modules/user/services/user.service.ts b/packages/twenty-server/src/engine/core-modules/user/services/user.service.ts index aec142d2655a..9dc75ed16652 100644 --- a/packages/twenty-server/src/engine/core-modules/user/services/user.service.ts +++ b/packages/twenty-server/src/engine/core-modules/user/services/user.service.ts @@ -12,7 +12,7 @@ import { Workspace, WorkspaceActivationStatus, } from 'src/engine/core-modules/workspace/workspace.entity'; -import { ObjectRecordDeleteEvent } from 'src/engine/integrations/event-emitter/types/object-record-delete.event'; +import { ObjectRecordDeleteEvent } from 'src/engine/core-modules/event-emitter/types/object-record-delete.event'; import { DataSourceService } from 'src/engine/metadata-modules/data-source/data-source.service'; import { TwentyORMGlobalManager } from 'src/engine/twenty-orm/twenty-orm-global.manager'; import { WorkspaceEventEmitter } from 'src/engine/workspace-event-emitter/workspace-event-emitter'; diff --git a/packages/twenty-server/src/engine/core-modules/user/user.resolver.ts b/packages/twenty-server/src/engine/core-modules/user/user.resolver.ts index c77bb690baf7..872ab7321bf3 100644 --- a/packages/twenty-server/src/engine/core-modules/user/user.resolver.ts +++ b/packages/twenty-server/src/engine/core-modules/user/user.resolver.ts @@ -17,7 +17,7 @@ import { FileUpload, GraphQLUpload } from 'graphql-upload'; import { Repository } from 'typeorm'; import { FileFolder } from 'src/engine/core-modules/file/interfaces/file-folder.interface'; -import { SupportDriver } from 'src/engine/integrations/environment/interfaces/support.interface'; +import { SupportDriver } from 'src/engine/core-modules/environment/interfaces/support.interface'; import { FileUploadService } from 'src/engine/core-modules/file/file-upload/services/file-upload.service'; import { FileService } from 'src/engine/core-modules/file/services/file.service'; @@ -32,7 +32,7 @@ import { AuthUser } from 'src/engine/decorators/auth/auth-user.decorator'; import { AuthWorkspace } from 'src/engine/decorators/auth/auth-workspace.decorator'; import { DemoEnvGuard } from 'src/engine/guards/demo.env.guard'; import { JwtAuthGuard } from 'src/engine/guards/jwt.auth.guard'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; import { streamToBuffer } from 'src/utils/stream-to-buffer'; const getHMACKey = (email?: string, key?: string | null) => { diff --git a/packages/twenty-server/src/engine/core-modules/workspace/handle-workspace-member-deleted.job.ts b/packages/twenty-server/src/engine/core-modules/workspace/handle-workspace-member-deleted.job.ts index 7e3bce067751..8d1193073c5d 100644 --- a/packages/twenty-server/src/engine/core-modules/workspace/handle-workspace-member-deleted.job.ts +++ b/packages/twenty-server/src/engine/core-modules/workspace/handle-workspace-member-deleted.job.ts @@ -1,7 +1,7 @@ import { WorkspaceService } from 'src/engine/core-modules/workspace/services/workspace.service'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; export type HandleWorkspaceMemberDeletedJobData = { workspaceId: string; diff --git a/packages/twenty-server/src/engine/core-modules/workspace/services/workspace.service.spec.ts b/packages/twenty-server/src/engine/core-modules/workspace/services/workspace.service.spec.ts index 4f3bd8008108..2b1c4c171e0e 100644 --- a/packages/twenty-server/src/engine/core-modules/workspace/services/workspace.service.spec.ts +++ b/packages/twenty-server/src/engine/core-modules/workspace/services/workspace.service.spec.ts @@ -8,8 +8,8 @@ import { UserWorkspaceService } from 'src/engine/core-modules/user-workspace/use import { UserService } from 'src/engine/core-modules/user/services/user.service'; import { User } from 'src/engine/core-modules/user/user.entity'; import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; -import { EmailService } from 'src/engine/integrations/email/email.service'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EmailService } from 'src/engine/core-modules/email/email.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; import { WorkspaceManagerService } from 'src/engine/workspace-manager/workspace-manager.service'; import { WorkspaceService } from './workspace.service'; diff --git a/packages/twenty-server/src/engine/core-modules/workspace/services/workspace.service.ts b/packages/twenty-server/src/engine/core-modules/workspace/services/workspace.service.ts index 57344c77ce20..70dbdf5769dd 100644 --- a/packages/twenty-server/src/engine/core-modules/workspace/services/workspace.service.ts +++ b/packages/twenty-server/src/engine/core-modules/workspace/services/workspace.service.ts @@ -19,8 +19,8 @@ import { Workspace, WorkspaceActivationStatus, } from 'src/engine/core-modules/workspace/workspace.entity'; -import { EmailService } from 'src/engine/integrations/email/email.service'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EmailService } from 'src/engine/core-modules/email/email.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; import { WorkspaceManagerService } from 'src/engine/workspace-manager/workspace-manager.service'; // eslint-disable-next-line @nx/workspace-inject-workspace-repository diff --git a/packages/twenty-server/src/engine/core-modules/workspace/workspace-workspace-member.listener.ts b/packages/twenty-server/src/engine/core-modules/workspace/workspace-workspace-member.listener.ts index fbc01935d467..ad3c2b7eec2f 100644 --- a/packages/twenty-server/src/engine/core-modules/workspace/workspace-workspace-member.listener.ts +++ b/packages/twenty-server/src/engine/core-modules/workspace/workspace-workspace-member.listener.ts @@ -6,11 +6,11 @@ import { HandleWorkspaceMemberDeletedJob, HandleWorkspaceMemberDeletedJobData, } from 'src/engine/core-modules/workspace/handle-workspace-member-deleted.job'; -import { ObjectRecordDeleteEvent } from 'src/engine/integrations/event-emitter/types/object-record-delete.event'; -import { ObjectRecordUpdateEvent } from 'src/engine/integrations/event-emitter/types/object-record-update.event'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { ObjectRecordDeleteEvent } from 'src/engine/core-modules/event-emitter/types/object-record-delete.event'; +import { ObjectRecordUpdateEvent } from 'src/engine/core-modules/event-emitter/types/object-record-update.event'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { WorkspaceEventBatch } from 'src/engine/workspace-event-emitter/workspace-event.type'; import { WorkspaceMemberWorkspaceEntity } from 'src/modules/workspace-member/standard-objects/workspace-member.workspace-entity'; diff --git a/packages/twenty-server/src/engine/guards/demo.env.guard.ts b/packages/twenty-server/src/engine/guards/demo.env.guard.ts index 49fe9ae479dc..5a64ff235ecc 100644 --- a/packages/twenty-server/src/engine/guards/demo.env.guard.ts +++ b/packages/twenty-server/src/engine/guards/demo.env.guard.ts @@ -5,7 +5,7 @@ import { } from '@nestjs/common'; import { AuthGuard } from '@nestjs/passport'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; import { getRequest } from 'src/utils/extract-request'; @Injectable() diff --git a/packages/twenty-server/src/engine/integrations/captcha/interfaces/index.ts b/packages/twenty-server/src/engine/integrations/captcha/interfaces/index.ts deleted file mode 100644 index bd85706d79c7..000000000000 --- a/packages/twenty-server/src/engine/integrations/captcha/interfaces/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './captcha.interface'; diff --git a/packages/twenty-server/src/engine/integrations/exception-handler/interfaces/exception-handler-driver.interface.ts b/packages/twenty-server/src/engine/integrations/exception-handler/interfaces/exception-handler-driver.interface.ts deleted file mode 100644 index 4c8af5c208e2..000000000000 --- a/packages/twenty-server/src/engine/integrations/exception-handler/interfaces/exception-handler-driver.interface.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { ExceptionHandlerOptions } from './exception-handler-options.interface'; -import { ExceptionHandlerUser } from './exception-handler-user.interface'; - -export interface ExceptionHandlerDriverInterface { - captureExceptions( - exceptions: ReadonlyArray<any>, - options?: ExceptionHandlerOptions, - ): string[]; - captureMessage(message: string, user?: ExceptionHandlerUser): void; -} diff --git a/packages/twenty-server/src/engine/integrations/exception-handler/interfaces/index.ts b/packages/twenty-server/src/engine/integrations/exception-handler/interfaces/index.ts deleted file mode 100644 index f3c1acc403be..000000000000 --- a/packages/twenty-server/src/engine/integrations/exception-handler/interfaces/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './exception-handler.interface'; -export * from './exception-handler-driver.interface'; diff --git a/packages/twenty-server/src/engine/integrations/file-storage/interfaces/index.ts b/packages/twenty-server/src/engine/integrations/file-storage/interfaces/index.ts deleted file mode 100644 index 6abeadb10050..000000000000 --- a/packages/twenty-server/src/engine/integrations/file-storage/interfaces/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './file-storage.interface'; diff --git a/packages/twenty-server/src/engine/integrations/integrations.module.ts b/packages/twenty-server/src/engine/integrations/integrations.module.ts deleted file mode 100644 index e0a02b92acc1..000000000000 --- a/packages/twenty-server/src/engine/integrations/integrations.module.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { Module } from '@nestjs/common'; -import { HttpAdapterHost } from '@nestjs/core'; -import { EventEmitterModule } from '@nestjs/event-emitter'; - -import { CacheStorageModule } from 'src/engine/integrations/cache-storage/cache-storage.module'; -import { CaptchaModule } from 'src/engine/integrations/captcha/captcha.module'; -import { captchaModuleFactory } from 'src/engine/integrations/captcha/captcha.module-factory'; -import { EmailModule } from 'src/engine/integrations/email/email.module'; -import { emailModuleFactory } from 'src/engine/integrations/email/email.module-factory'; -import { ExceptionHandlerModule } from 'src/engine/integrations/exception-handler/exception-handler.module'; -import { exceptionHandlerModuleFactory } from 'src/engine/integrations/exception-handler/exception-handler.module-factory'; -import { fileStorageModuleFactory } from 'src/engine/integrations/file-storage/file-storage.module-factory'; -import { FileStorageService } from 'src/engine/integrations/file-storage/file-storage.service'; -import { LLMChatModelModule } from 'src/engine/integrations/llm-chat-model/llm-chat-model.module'; -import { llmChatModelModuleFactory } from 'src/engine/integrations/llm-chat-model/llm-chat-model.module-factory'; -import { LLMTracingModule } from 'src/engine/integrations/llm-tracing/llm-tracing.module'; -import { llmTracingModuleFactory } from 'src/engine/integrations/llm-tracing/llm-tracing.module-factory'; -import { loggerModuleFactory } from 'src/engine/integrations/logger/logger.module-factory'; -import { messageQueueModuleFactory } from 'src/engine/integrations/message-queue/message-queue.module-factory'; -import { serverlessModuleFactory } from 'src/engine/integrations/serverless/serverless-module.factory'; -import { ServerlessModule } from 'src/engine/integrations/serverless/serverless.module'; - -import { EnvironmentModule } from './environment/environment.module'; -import { EnvironmentService } from './environment/environment.service'; -import { FileStorageModule } from './file-storage/file-storage.module'; -import { LoggerModule } from './logger/logger.module'; -import { MessageQueueModule } from './message-queue/message-queue.module'; - -@Module({ - imports: [ - EnvironmentModule.forRoot({}), - FileStorageModule.forRootAsync({ - useFactory: fileStorageModuleFactory, - inject: [EnvironmentService], - }), - LoggerModule.forRootAsync({ - useFactory: loggerModuleFactory, - inject: [EnvironmentService], - }), - MessageQueueModule.registerAsync({ - useFactory: messageQueueModuleFactory, - inject: [EnvironmentService], - }), - ExceptionHandlerModule.forRootAsync({ - useFactory: exceptionHandlerModuleFactory, - inject: [EnvironmentService, HttpAdapterHost], - }), - EmailModule.forRoot({ - useFactory: emailModuleFactory, - inject: [EnvironmentService], - }), - CaptchaModule.forRoot({ - useFactory: captchaModuleFactory, - inject: [EnvironmentService], - }), - EventEmitterModule.forRoot({ - wildcard: true, - }), - CacheStorageModule, - LLMChatModelModule.forRoot({ - useFactory: llmChatModelModuleFactory, - inject: [EnvironmentService], - }), - LLMTracingModule.forRoot({ - useFactory: llmTracingModuleFactory, - inject: [EnvironmentService], - }), - ServerlessModule.forRootAsync({ - useFactory: serverlessModuleFactory, - inject: [EnvironmentService, FileStorageService], - }), - ], - exports: [], - providers: [], -}) -export class IntegrationsModule {} diff --git a/packages/twenty-server/src/engine/integrations/logger/interfaces/index.ts b/packages/twenty-server/src/engine/integrations/logger/interfaces/index.ts deleted file mode 100644 index 2e75a7e002ab..000000000000 --- a/packages/twenty-server/src/engine/integrations/logger/interfaces/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './logger.interface'; diff --git a/packages/twenty-server/src/engine/integrations/message-queue/interfaces/index.ts b/packages/twenty-server/src/engine/integrations/message-queue/interfaces/index.ts deleted file mode 100644 index 4fdb52388cd2..000000000000 --- a/packages/twenty-server/src/engine/integrations/message-queue/interfaces/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './message-queue-module-options.interface'; diff --git a/packages/twenty-server/src/engine/metadata-modules/field-metadata/validators/is-field-metadata-default-value.validator.ts b/packages/twenty-server/src/engine/metadata-modules/field-metadata/validators/is-field-metadata-default-value.validator.ts index f68aea19e253..977358788c60 100644 --- a/packages/twenty-server/src/engine/metadata-modules/field-metadata/validators/is-field-metadata-default-value.validator.ts +++ b/packages/twenty-server/src/engine/metadata-modules/field-metadata/validators/is-field-metadata-default-value.validator.ts @@ -14,7 +14,7 @@ import { FieldMetadataType, } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity'; import { validateDefaultValueForType } from 'src/engine/metadata-modules/field-metadata/utils/validate-default-value-for-type.util'; -import { LoggerService } from 'src/engine/integrations/logger/logger.service'; +import { LoggerService } from 'src/engine/core-modules/logger/logger.service'; @Injectable() @ValidatorConstraint({ name: 'isFieldMetadataDefaultValue', async: true }) diff --git a/packages/twenty-server/src/engine/metadata-modules/remote-server/remote-server.service.ts b/packages/twenty-server/src/engine/metadata-modules/remote-server/remote-server.service.ts index d1c241827882..8538eabcb41d 100644 --- a/packages/twenty-server/src/engine/metadata-modules/remote-server/remote-server.service.ts +++ b/packages/twenty-server/src/engine/metadata-modules/remote-server/remote-server.service.ts @@ -10,7 +10,7 @@ import { RemoteServerEntity, RemoteServerType, } from 'src/engine/metadata-modules/remote-server/remote-server.entity'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; import { encryptText } from 'src/engine/core-modules/auth/auth.util'; import { validateObjectAgainstInjections, diff --git a/packages/twenty-server/src/engine/metadata-modules/serverless-function/serverless-function.module.ts b/packages/twenty-server/src/engine/metadata-modules/serverless-function/serverless-function.module.ts index 02c76f596a25..f1b700d3d23c 100644 --- a/packages/twenty-server/src/engine/metadata-modules/serverless-function/serverless-function.module.ts +++ b/packages/twenty-server/src/engine/metadata-modules/serverless-function/serverless-function.module.ts @@ -13,7 +13,7 @@ import { FileUploadModule } from 'src/engine/core-modules/file/file-upload/file- import { FileModule } from 'src/engine/core-modules/file/file.module'; import { ThrottlerModule } from 'src/engine/core-modules/throttler/throttler.module'; import { JwtAuthGuard } from 'src/engine/guards/jwt.auth.guard'; -import { ServerlessModule } from 'src/engine/integrations/serverless/serverless.module'; +import { ServerlessModule } from 'src/engine/core-modules/serverless/serverless.module'; import { ServerlessFunctionDTO } from 'src/engine/metadata-modules/serverless-function/dtos/serverless-function.dto'; import { ServerlessFunctionEntity } from 'src/engine/metadata-modules/serverless-function/serverless-function.entity'; import { ServerlessFunctionResolver } from 'src/engine/metadata-modules/serverless-function/serverless-function.resolver'; diff --git a/packages/twenty-server/src/engine/metadata-modules/serverless-function/serverless-function.service.ts b/packages/twenty-server/src/engine/metadata-modules/serverless-function/serverless-function.service.ts index 340754047d43..d7c591eb0c8c 100644 --- a/packages/twenty-server/src/engine/metadata-modules/serverless-function/serverless-function.service.ts +++ b/packages/twenty-server/src/engine/metadata-modules/serverless-function/serverless-function.service.ts @@ -5,16 +5,16 @@ import { TypeOrmQueryService } from '@ptc-org/nestjs-query-typeorm'; import { FileUpload } from 'graphql-upload'; import { Repository } from 'typeorm'; -import { FileStorageExceptionCode } from 'src/engine/integrations/file-storage/interfaces/file-storage-exception'; -import { ServerlessExecuteResult } from 'src/engine/integrations/serverless/drivers/interfaces/serverless-driver.interface'; +import { FileStorageExceptionCode } from 'src/engine/core-modules/file-storage/interfaces/file-storage-exception'; +import { ServerlessExecuteResult } from 'src/engine/core-modules/serverless/drivers/interfaces/serverless-driver.interface'; import { ThrottlerService } from 'src/engine/core-modules/throttler/throttler.service'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; -import { FileStorageService } from 'src/engine/integrations/file-storage/file-storage.service'; -import { readFileContent } from 'src/engine/integrations/file-storage/utils/read-file-content'; -import { SOURCE_FILE_NAME } from 'src/engine/integrations/serverless/drivers/constants/source-file-name'; -import { ServerlessService } from 'src/engine/integrations/serverless/serverless.service'; -import { getServerlessFolder } from 'src/engine/integrations/serverless/utils/serverless-get-folder.utils'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; +import { FileStorageService } from 'src/engine/core-modules/file-storage/file-storage.service'; +import { readFileContent } from 'src/engine/core-modules/file-storage/utils/read-file-content'; +import { SOURCE_FILE_NAME } from 'src/engine/core-modules/serverless/drivers/constants/source-file-name'; +import { ServerlessService } from 'src/engine/core-modules/serverless/serverless.service'; +import { getServerlessFolder } from 'src/engine/core-modules/serverless/utils/serverless-get-folder.utils'; import { CreateServerlessFunctionFromFileInput } from 'src/engine/metadata-modules/serverless-function/dtos/create-serverless-function-from-file.input'; import { UpdateServerlessFunctionInput } from 'src/engine/metadata-modules/serverless-function/dtos/update-serverless-function.input'; import { @@ -27,8 +27,8 @@ import { } from 'src/engine/metadata-modules/serverless-function/serverless-function.exception'; import { serverlessFunctionCreateHash } from 'src/engine/metadata-modules/serverless-function/utils/serverless-function-create-hash.utils'; import { isDefined } from 'src/utils/is-defined'; -import { getLastLayerDependencies } from 'src/engine/integrations/serverless/drivers/utils/get-last-layer-dependencies'; -import { LAST_LAYER_VERSION } from 'src/engine/integrations/serverless/drivers/layers/last-layer-version'; +import { getLastLayerDependencies } from 'src/engine/core-modules/serverless/drivers/utils/get-last-layer-dependencies'; +import { LAST_LAYER_VERSION } from 'src/engine/core-modules/serverless/drivers/layers/last-layer-version'; @Injectable() export class ServerlessFunctionService extends TypeOrmQueryService<ServerlessFunctionEntity> { diff --git a/packages/twenty-server/src/engine/middlewares/graphql-hydrate-request-from-token.middleware.ts b/packages/twenty-server/src/engine/middlewares/graphql-hydrate-request-from-token.middleware.ts index c510f3e4a3b7..8da811992775 100644 --- a/packages/twenty-server/src/engine/middlewares/graphql-hydrate-request-from-token.middleware.ts +++ b/packages/twenty-server/src/engine/middlewares/graphql-hydrate-request-from-token.middleware.ts @@ -5,7 +5,7 @@ import { NextFunction, Request, Response } from 'express'; import { AuthGraphqlApiExceptionFilter } from 'src/engine/core-modules/auth/filters/auth-graphql-api-exception.filter'; import { TokenService } from 'src/engine/core-modules/auth/services/token.service'; import { AuthContext } from 'src/engine/core-modules/auth/types/auth-context.type'; -import { ExceptionHandlerService } from 'src/engine/integrations/exception-handler/exception-handler.service'; +import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service'; import { WorkspaceMetadataVersionService } from 'src/engine/metadata-modules/workspace-metadata-version/workspace-metadata-version.service'; import { handleExceptionAndConvertToGraphQLError } from 'src/engine/utils/global-exception-handler.util'; diff --git a/packages/twenty-server/src/engine/twenty-orm/factories/workspace-datasource.factory.ts b/packages/twenty-server/src/engine/twenty-orm/factories/workspace-datasource.factory.ts index 5bf31109605a..32065b91e944 100644 --- a/packages/twenty-server/src/engine/twenty-orm/factories/workspace-datasource.factory.ts +++ b/packages/twenty-server/src/engine/twenty-orm/factories/workspace-datasource.factory.ts @@ -3,7 +3,7 @@ import { InjectRepository } from '@nestjs/typeorm'; import { EntitySchema, Repository } from 'typeorm'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; import { DataSourceService } from 'src/engine/metadata-modules/data-source/data-source.service'; import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity'; import { WorkspaceMetadataVersionService } from 'src/engine/metadata-modules/workspace-metadata-version/workspace-metadata-version.service'; diff --git a/packages/twenty-server/src/engine/utils/global-exception-handler.util.ts b/packages/twenty-server/src/engine/utils/global-exception-handler.util.ts index 7bb281278a9b..3a938d4ce7ba 100644 --- a/packages/twenty-server/src/engine/utils/global-exception-handler.util.ts +++ b/packages/twenty-server/src/engine/utils/global-exception-handler.util.ts @@ -2,7 +2,7 @@ import { HttpException } from '@nestjs/common'; import { GraphQLError } from 'graphql'; -import { ExceptionHandlerUser } from 'src/engine/integrations/exception-handler/interfaces/exception-handler-user.interface'; +import { ExceptionHandlerUser } from 'src/engine/core-modules/exception-handler/interfaces/exception-handler-user.interface'; import { AuthenticationError, @@ -15,7 +15,7 @@ import { TimeoutError, ValidationError, } from 'src/engine/core-modules/graphql/utils/graphql-errors.util'; -import { ExceptionHandlerService } from 'src/engine/integrations/exception-handler/exception-handler.service'; +import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service'; const graphQLPredefinedExceptions = { 400: ValidationError, diff --git a/packages/twenty-server/src/engine/workspace-cache-storage/workspace-cache-storage.service.ts b/packages/twenty-server/src/engine/workspace-cache-storage/workspace-cache-storage.service.ts index c15991fe681b..b20f880e4d6e 100644 --- a/packages/twenty-server/src/engine/workspace-cache-storage/workspace-cache-storage.service.ts +++ b/packages/twenty-server/src/engine/workspace-cache-storage/workspace-cache-storage.service.ts @@ -2,9 +2,9 @@ import { Injectable } from '@nestjs/common'; import { EntitySchemaOptions } from 'typeorm'; -import { CacheStorageService } from 'src/engine/integrations/cache-storage/cache-storage.service'; -import { InjectCacheStorage } from 'src/engine/integrations/cache-storage/decorators/cache-storage.decorator'; -import { CacheStorageNamespace } from 'src/engine/integrations/cache-storage/types/cache-storage-namespace.enum'; +import { CacheStorageService } from 'src/engine/core-modules/cache-storage/cache-storage.service'; +import { InjectCacheStorage } from 'src/engine/core-modules/cache-storage/decorators/cache-storage.decorator'; +import { CacheStorageNamespace } from 'src/engine/core-modules/cache-storage/types/cache-storage-namespace.enum'; import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity'; enum WorkspaceCacheKeys { diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-cleaner/commands/clean-inactive-workspaces.command.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-cleaner/commands/clean-inactive-workspaces.command.ts index 79b805c607cf..744f37bfbce3 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-cleaner/commands/clean-inactive-workspaces.command.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-cleaner/commands/clean-inactive-workspaces.command.ts @@ -1,8 +1,8 @@ import { Command, CommandRunner, Option } from 'nest-commander'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { CleanInactiveWorkspaceJob } from 'src/engine/workspace-manager/workspace-cleaner/crons/clean-inactive-workspace.job'; export type CleanInactiveWorkspacesCommandOptions = { diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-cleaner/commands/start-clean-inactive-workspaces.cron.command.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-cleaner/commands/start-clean-inactive-workspaces.cron.command.ts index daee64136210..d93cbf6b3c9a 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-cleaner/commands/start-clean-inactive-workspaces.cron.command.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-cleaner/commands/start-clean-inactive-workspaces.cron.command.ts @@ -1,8 +1,8 @@ import { Command, CommandRunner } from 'nest-commander'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { cleanInactiveWorkspaceCronPattern } from 'src/engine/workspace-manager/workspace-cleaner/crons/clean-inactive-workspace.cron.pattern'; import { CleanInactiveWorkspaceJob } from 'src/engine/workspace-manager/workspace-cleaner/crons/clean-inactive-workspace.job'; diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-cleaner/commands/stop-clean-inactive-workspaces.cron.command.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-cleaner/commands/stop-clean-inactive-workspaces.cron.command.ts index 0fa47c6fb59c..fa0fd6668ce2 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-cleaner/commands/stop-clean-inactive-workspaces.cron.command.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-cleaner/commands/stop-clean-inactive-workspaces.cron.command.ts @@ -1,8 +1,8 @@ import { Command, CommandRunner } from 'nest-commander'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { cleanInactiveWorkspaceCronPattern } from 'src/engine/workspace-manager/workspace-cleaner/crons/clean-inactive-workspace.cron.pattern'; import { CleanInactiveWorkspaceJob } from 'src/engine/workspace-manager/workspace-cleaner/crons/clean-inactive-workspace.job'; diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-cleaner/crons/clean-inactive-workspace.job.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-cleaner/crons/clean-inactive-workspace.job.ts index ea492334a38e..0ebd5a207cc6 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-cleaner/crons/clean-inactive-workspace.job.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-cleaner/crons/clean-inactive-workspace.job.ts @@ -11,11 +11,11 @@ import { In, Repository } from 'typeorm'; import { TypeORMService } from 'src/database/typeorm/typeorm.service'; import { UserService } from 'src/engine/core-modules/user/services/user.service'; import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; -import { EmailService } from 'src/engine/integrations/email/email.service'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { EmailService } from 'src/engine/core-modules/email/email.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; import { DataSourceEntity } from 'src/engine/metadata-modules/data-source/data-source.entity'; import { DataSourceService } from 'src/engine/metadata-modules/data-source/data-source.service'; import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity'; diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-status/services/workspace-status.service.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-status/services/workspace-status.service.ts index 28b4d035ae03..c60a27244afe 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-status/services/workspace-status.service.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-status/services/workspace-status.service.ts @@ -10,7 +10,7 @@ import { import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum'; import { FeatureFlagEntity } from 'src/engine/core-modules/feature-flag/feature-flag.entity'; import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; @Injectable() export class WorkspaceStatusService { diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-status/workspace-manager.module.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-status/workspace-manager.module.ts index ac39a9e0c322..62999eccea4f 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-status/workspace-manager.module.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-status/workspace-manager.module.ts @@ -4,7 +4,7 @@ import { TypeOrmModule } from '@nestjs/typeorm'; import { BillingSubscription } from 'src/engine/core-modules/billing/entities/billing-subscription.entity'; import { FeatureFlagEntity } from 'src/engine/core-modules/feature-flag/feature-flag.entity'; import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; -import { EnvironmentModule } from 'src/engine/integrations/environment/environment.module'; +import { EnvironmentModule } from 'src/engine/core-modules/environment/environment.module'; import { WorkspaceStatusService } from 'src/engine/workspace-manager/workspace-status/services/workspace-status.service'; @Module({ diff --git a/packages/twenty-server/src/main.ts b/packages/twenty-server/src/main.ts index 47df9c69a4ff..b2f24c0e7412 100644 --- a/packages/twenty-server/src/main.ts +++ b/packages/twenty-server/src/main.ts @@ -13,7 +13,7 @@ import { ApplyCorsToExceptions } from 'src/utils/apply-cors-to-exceptions'; import { AppModule } from './app.module'; import { settings } from './engine/constants/settings'; -import { LoggerService } from './engine/integrations/logger/logger.service'; +import { LoggerService } from 'src/engine/core-modules/logger/logger.service'; import { generateFrontConfig } from './utils/generate-front-config'; const bootstrap = async () => { diff --git a/packages/twenty-server/src/modules/calendar/blocklist-manager/jobs/blocklist-item-delete-calendar-events.job.ts b/packages/twenty-server/src/modules/calendar/blocklist-manager/jobs/blocklist-item-delete-calendar-events.job.ts index be172d0b1376..f21e87d76b8b 100644 --- a/packages/twenty-server/src/modules/calendar/blocklist-manager/jobs/blocklist-item-delete-calendar-events.job.ts +++ b/packages/twenty-server/src/modules/calendar/blocklist-manager/jobs/blocklist-item-delete-calendar-events.job.ts @@ -2,10 +2,10 @@ import { Logger, Scope } from '@nestjs/common'; import { And, Any, ILike, In, Not, Or } from 'typeorm'; -import { ObjectRecordCreateEvent } from 'src/engine/integrations/event-emitter/types/object-record-create.event'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { ObjectRecordCreateEvent } from 'src/engine/core-modules/event-emitter/types/object-record-create.event'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager'; import { WorkspaceEventBatch } from 'src/engine/workspace-event-emitter/workspace-event.type'; import { BlocklistWorkspaceEntity } from 'src/modules/blocklist/standard-objects/blocklist.workspace-entity'; diff --git a/packages/twenty-server/src/modules/calendar/blocklist-manager/jobs/blocklist-reimport-calendar-events.job.ts b/packages/twenty-server/src/modules/calendar/blocklist-manager/jobs/blocklist-reimport-calendar-events.job.ts index 494136ab29bb..434a6aa5332b 100644 --- a/packages/twenty-server/src/modules/calendar/blocklist-manager/jobs/blocklist-reimport-calendar-events.job.ts +++ b/packages/twenty-server/src/modules/calendar/blocklist-manager/jobs/blocklist-reimport-calendar-events.job.ts @@ -2,10 +2,10 @@ import { Scope } from '@nestjs/common'; import { Not } from 'typeorm'; -import { ObjectRecordDeleteEvent } from 'src/engine/integrations/event-emitter/types/object-record-delete.event'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { ObjectRecordDeleteEvent } from 'src/engine/core-modules/event-emitter/types/object-record-delete.event'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager'; import { WorkspaceEventBatch } from 'src/engine/workspace-event-emitter/workspace-event.type'; import { BlocklistWorkspaceEntity } from 'src/modules/blocklist/standard-objects/blocklist.workspace-entity'; diff --git a/packages/twenty-server/src/modules/calendar/blocklist-manager/listeners/calendar-blocklist.listener.ts b/packages/twenty-server/src/modules/calendar/blocklist-manager/listeners/calendar-blocklist.listener.ts index 9010dc185a19..886321725912 100644 --- a/packages/twenty-server/src/modules/calendar/blocklist-manager/listeners/calendar-blocklist.listener.ts +++ b/packages/twenty-server/src/modules/calendar/blocklist-manager/listeners/calendar-blocklist.listener.ts @@ -1,12 +1,12 @@ import { Injectable } from '@nestjs/common'; import { OnEvent } from '@nestjs/event-emitter'; -import { ObjectRecordCreateEvent } from 'src/engine/integrations/event-emitter/types/object-record-create.event'; -import { ObjectRecordDeleteEvent } from 'src/engine/integrations/event-emitter/types/object-record-delete.event'; -import { ObjectRecordUpdateEvent } from 'src/engine/integrations/event-emitter/types/object-record-update.event'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { ObjectRecordCreateEvent } from 'src/engine/core-modules/event-emitter/types/object-record-create.event'; +import { ObjectRecordDeleteEvent } from 'src/engine/core-modules/event-emitter/types/object-record-delete.event'; +import { ObjectRecordUpdateEvent } from 'src/engine/core-modules/event-emitter/types/object-record-update.event'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { WorkspaceEventBatch } from 'src/engine/workspace-event-emitter/workspace-event.type'; import { BlocklistWorkspaceEntity } from 'src/modules/blocklist/standard-objects/blocklist.workspace-entity'; import { diff --git a/packages/twenty-server/src/modules/calendar/calendar-event-cleaner/jobs/delete-connected-account-associated-calendar-data.job.ts b/packages/twenty-server/src/modules/calendar/calendar-event-cleaner/jobs/delete-connected-account-associated-calendar-data.job.ts index 481814595542..cd8409ea8fe9 100644 --- a/packages/twenty-server/src/modules/calendar/calendar-event-cleaner/jobs/delete-connected-account-associated-calendar-data.job.ts +++ b/packages/twenty-server/src/modules/calendar/calendar-event-cleaner/jobs/delete-connected-account-associated-calendar-data.job.ts @@ -1,8 +1,8 @@ import { Logger } from '@nestjs/common'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; import { CalendarEventCleanerService } from 'src/modules/calendar/calendar-event-cleaner/services/calendar-event-cleaner.service'; export type DeleteConnectedAccountAssociatedCalendarDataJobData = { diff --git a/packages/twenty-server/src/modules/calendar/calendar-event-cleaner/listeners/calendar-event-cleaner-connected-account.listener.ts b/packages/twenty-server/src/modules/calendar/calendar-event-cleaner/listeners/calendar-event-cleaner-connected-account.listener.ts index 0c14b6b60655..387dc0743c68 100644 --- a/packages/twenty-server/src/modules/calendar/calendar-event-cleaner/listeners/calendar-event-cleaner-connected-account.listener.ts +++ b/packages/twenty-server/src/modules/calendar/calendar-event-cleaner/listeners/calendar-event-cleaner-connected-account.listener.ts @@ -1,10 +1,10 @@ import { Injectable } from '@nestjs/common'; import { OnEvent } from '@nestjs/event-emitter'; -import { ObjectRecordDeleteEvent } from 'src/engine/integrations/event-emitter/types/object-record-delete.event'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { ObjectRecordDeleteEvent } from 'src/engine/core-modules/event-emitter/types/object-record-delete.event'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { WorkspaceEventBatch } from 'src/engine/workspace-event-emitter/workspace-event.type'; import { DeleteConnectedAccountAssociatedCalendarDataJob, diff --git a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/crons/commands/calendar-event-list-fetch.cron.command.ts b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/crons/commands/calendar-event-list-fetch.cron.command.ts index 87d139aa48d9..3fd865ad6e44 100644 --- a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/crons/commands/calendar-event-list-fetch.cron.command.ts +++ b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/crons/commands/calendar-event-list-fetch.cron.command.ts @@ -1,8 +1,8 @@ import { Command, CommandRunner } from 'nest-commander'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { CalendarEventListFetchCronJob } from 'src/modules/calendar/calendar-event-import-manager/crons/jobs/calendar-event-list-fetch.cron.job'; const CALENDAR_EVENTS_IMPORT_CRON_PATTERN = '*/5 * * * *'; diff --git a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/crons/commands/calendar-ongoing-stale.cron.command.ts b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/crons/commands/calendar-ongoing-stale.cron.command.ts index 3164e0a760dc..bc903f877ee1 100644 --- a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/crons/commands/calendar-ongoing-stale.cron.command.ts +++ b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/crons/commands/calendar-ongoing-stale.cron.command.ts @@ -1,8 +1,8 @@ import { Command, CommandRunner } from 'nest-commander'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { CalendarOngoingStaleCronJob } from 'src/modules/calendar/calendar-event-import-manager/crons/jobs/calendar-ongoing-stale.cron.job'; const CALENDAR_ONGOING_STALE_CRON_PATTERN = '0 * * * *'; diff --git a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/crons/jobs/calendar-event-list-fetch.cron.job.ts b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/crons/jobs/calendar-event-list-fetch.cron.job.ts index 9d5f88f421f0..89836b514114 100644 --- a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/crons/jobs/calendar-event-list-fetch.cron.job.ts +++ b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/crons/jobs/calendar-event-list-fetch.cron.job.ts @@ -6,12 +6,12 @@ import { Workspace, WorkspaceActivationStatus, } from 'src/engine/core-modules/workspace/workspace.entity'; -import { ExceptionHandlerService } from 'src/engine/integrations/exception-handler/exception-handler.service'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { TwentyORMGlobalManager } from 'src/engine/twenty-orm/twenty-orm-global.manager'; import { CalendarEventListFetchJob, diff --git a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/crons/jobs/calendar-ongoing-stale.cron.job.ts b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/crons/jobs/calendar-ongoing-stale.cron.job.ts index d3e5370b52d6..d163c782dad6 100644 --- a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/crons/jobs/calendar-ongoing-stale.cron.job.ts +++ b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/crons/jobs/calendar-ongoing-stale.cron.job.ts @@ -6,12 +6,12 @@ import { Workspace, WorkspaceActivationStatus, } from 'src/engine/core-modules/workspace/workspace.entity'; -import { ExceptionHandlerService } from 'src/engine/integrations/exception-handler/exception-handler.service'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { CalendarOngoingStaleJob, CalendarOngoingStaleJobData, diff --git a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/drivers/google-calendar/google-calendar-driver.module.ts b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/drivers/google-calendar/google-calendar-driver.module.ts index 46b209ef9af4..d76a6642df6a 100644 --- a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/drivers/google-calendar/google-calendar-driver.module.ts +++ b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/drivers/google-calendar/google-calendar-driver.module.ts @@ -1,6 +1,6 @@ import { Module } from '@nestjs/common'; -import { EnvironmentModule } from 'src/engine/integrations/environment/environment.module'; +import { EnvironmentModule } from 'src/engine/core-modules/environment/environment.module'; import { GoogleCalendarClientProvider } from 'src/modules/calendar/calendar-event-import-manager/drivers/google-calendar/providers/google-calendar.provider'; import { GoogleCalendarGetEventsService } from 'src/modules/calendar/calendar-event-import-manager/drivers/google-calendar/services/google-calendar-get-events.service'; import { OAuth2ClientManagerModule } from 'src/modules/connected-account/oauth2-client-manager/oauth2-client-manager.module'; diff --git a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/jobs/calendar-event-list-fetch.job.ts b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/jobs/calendar-event-list-fetch.job.ts index 402661b93981..406e717021ac 100644 --- a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/jobs/calendar-event-list-fetch.job.ts +++ b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/jobs/calendar-event-list-fetch.job.ts @@ -1,8 +1,8 @@ import { Scope } from '@nestjs/common'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; import { InjectObjectMetadataRepository } from 'src/engine/object-metadata-repository/object-metadata-repository.decorator'; import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager'; import { CalendarEventsImportService } from 'src/modules/calendar/calendar-event-import-manager/services/calendar-events-import.service'; diff --git a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/jobs/calendar-ongoing-stale.job.ts b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/jobs/calendar-ongoing-stale.job.ts index ee579d44f480..0ddd02960861 100644 --- a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/jobs/calendar-ongoing-stale.job.ts +++ b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/jobs/calendar-ongoing-stale.job.ts @@ -2,9 +2,9 @@ import { Logger, Scope } from '@nestjs/common'; import { In } from 'typeorm'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager'; import { isSyncStale } from 'src/modules/calendar/calendar-event-import-manager/utils/is-sync-stale.util'; import { CalendarChannelSyncStatusService } from 'src/modules/calendar/common/services/calendar-channel-sync-status.service'; diff --git a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/services/calendar-save-events.service.ts b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/services/calendar-save-events.service.ts index 3f22e0c781ac..8c71c73f1fc8 100644 --- a/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/services/calendar-save-events.service.ts +++ b/packages/twenty-server/src/modules/calendar/calendar-event-import-manager/services/calendar-save-events.service.ts @@ -2,9 +2,9 @@ import { Injectable } from '@nestjs/common'; import { Any } from 'typeorm'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { FieldActorSource } from 'src/engine/metadata-modules/field-metadata/composite-types/actor.composite-type'; import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager'; import { WorkspaceEventEmitter } from 'src/engine/workspace-event-emitter/workspace-event-emitter'; diff --git a/packages/twenty-server/src/modules/calendar/calendar-event-participant-manager/jobs/calendar-create-company-and-contact-after-sync.job.ts b/packages/twenty-server/src/modules/calendar/calendar-event-participant-manager/jobs/calendar-create-company-and-contact-after-sync.job.ts index 877fa0f457b7..1aadb2088f8f 100644 --- a/packages/twenty-server/src/modules/calendar/calendar-event-participant-manager/jobs/calendar-create-company-and-contact-after-sync.job.ts +++ b/packages/twenty-server/src/modules/calendar/calendar-event-participant-manager/jobs/calendar-create-company-and-contact-after-sync.job.ts @@ -2,9 +2,9 @@ import { Logger, Scope } from '@nestjs/common'; import { IsNull } from 'typeorm'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager'; import { CalendarChannelWorkspaceEntity } from 'src/modules/calendar/common/standard-objects/calendar-channel.workspace-entity'; import { CalendarEventParticipantWorkspaceEntity } from 'src/modules/calendar/common/standard-objects/calendar-event-participant.workspace-entity'; diff --git a/packages/twenty-server/src/modules/calendar/calendar-event-participant-manager/jobs/calendar-event-participant-match-participant.job.ts b/packages/twenty-server/src/modules/calendar/calendar-event-participant-manager/jobs/calendar-event-participant-match-participant.job.ts index be60d5e650bc..1342448145f5 100644 --- a/packages/twenty-server/src/modules/calendar/calendar-event-participant-manager/jobs/calendar-event-participant-match-participant.job.ts +++ b/packages/twenty-server/src/modules/calendar/calendar-event-participant-manager/jobs/calendar-event-participant-match-participant.job.ts @@ -4,9 +4,9 @@ import { InjectRepository } from '@nestjs/typeorm'; import { Repository } from 'typeorm'; import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; import { CalendarEventParticipantWorkspaceEntity } from 'src/modules/calendar/common/standard-objects/calendar-event-participant.workspace-entity'; import { MatchParticipantService } from 'src/modules/match-participant/match-participant.service'; diff --git a/packages/twenty-server/src/modules/calendar/calendar-event-participant-manager/jobs/calendar-event-participant-unmatch-participant.job.ts b/packages/twenty-server/src/modules/calendar/calendar-event-participant-manager/jobs/calendar-event-participant-unmatch-participant.job.ts index 3c41ab2a1062..9d3af14865a1 100644 --- a/packages/twenty-server/src/modules/calendar/calendar-event-participant-manager/jobs/calendar-event-participant-unmatch-participant.job.ts +++ b/packages/twenty-server/src/modules/calendar/calendar-event-participant-manager/jobs/calendar-event-participant-unmatch-participant.job.ts @@ -1,8 +1,8 @@ import { Scope } from '@nestjs/common'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; import { CalendarEventParticipantWorkspaceEntity } from 'src/modules/calendar/common/standard-objects/calendar-event-participant.workspace-entity'; import { MatchParticipantService } from 'src/modules/match-participant/match-participant.service'; diff --git a/packages/twenty-server/src/modules/calendar/calendar-event-participant-manager/listeners/calendar-event-participant-person.listener.ts b/packages/twenty-server/src/modules/calendar/calendar-event-participant-manager/listeners/calendar-event-participant-person.listener.ts index 49389974f04f..47f0d16e8a9a 100644 --- a/packages/twenty-server/src/modules/calendar/calendar-event-participant-manager/listeners/calendar-event-participant-person.listener.ts +++ b/packages/twenty-server/src/modules/calendar/calendar-event-participant-manager/listeners/calendar-event-participant-person.listener.ts @@ -1,12 +1,12 @@ import { Injectable } from '@nestjs/common'; import { OnEvent } from '@nestjs/event-emitter'; -import { ObjectRecordCreateEvent } from 'src/engine/integrations/event-emitter/types/object-record-create.event'; -import { ObjectRecordUpdateEvent } from 'src/engine/integrations/event-emitter/types/object-record-update.event'; -import { objectRecordChangedProperties as objectRecordUpdateEventChangedProperties } from 'src/engine/integrations/event-emitter/utils/object-record-changed-properties.util'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { ObjectRecordCreateEvent } from 'src/engine/core-modules/event-emitter/types/object-record-create.event'; +import { ObjectRecordUpdateEvent } from 'src/engine/core-modules/event-emitter/types/object-record-update.event'; +import { objectRecordChangedProperties as objectRecordUpdateEventChangedProperties } from 'src/engine/core-modules/event-emitter/utils/object-record-changed-properties.util'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { WorkspaceEventBatch } from 'src/engine/workspace-event-emitter/workspace-event.type'; import { CalendarEventParticipantMatchParticipantJob, diff --git a/packages/twenty-server/src/modules/calendar/calendar-event-participant-manager/listeners/calendar-event-participant-workspace-member.listener.ts b/packages/twenty-server/src/modules/calendar/calendar-event-participant-manager/listeners/calendar-event-participant-workspace-member.listener.ts index 6016c78c9673..31d292124df9 100644 --- a/packages/twenty-server/src/modules/calendar/calendar-event-participant-manager/listeners/calendar-event-participant-workspace-member.listener.ts +++ b/packages/twenty-server/src/modules/calendar/calendar-event-participant-manager/listeners/calendar-event-participant-workspace-member.listener.ts @@ -1,12 +1,12 @@ import { Injectable } from '@nestjs/common'; import { OnEvent } from '@nestjs/event-emitter'; -import { ObjectRecordCreateEvent } from 'src/engine/integrations/event-emitter/types/object-record-create.event'; -import { ObjectRecordUpdateEvent } from 'src/engine/integrations/event-emitter/types/object-record-update.event'; -import { objectRecordChangedProperties as objectRecordUpdateEventChangedProperties } from 'src/engine/integrations/event-emitter/utils/object-record-changed-properties.util'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { ObjectRecordCreateEvent } from 'src/engine/core-modules/event-emitter/types/object-record-create.event'; +import { ObjectRecordUpdateEvent } from 'src/engine/core-modules/event-emitter/types/object-record-update.event'; +import { objectRecordChangedProperties as objectRecordUpdateEventChangedProperties } from 'src/engine/core-modules/event-emitter/utils/object-record-changed-properties.util'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { WorkspaceEventBatch } from 'src/engine/workspace-event-emitter/workspace-event.type'; import { CalendarEventParticipantMatchParticipantJob, diff --git a/packages/twenty-server/src/modules/calendar/common/services/calendar-channel-sync-status.service.ts b/packages/twenty-server/src/modules/calendar/common/services/calendar-channel-sync-status.service.ts index dfa8ac2797bb..b7149b4bac12 100644 --- a/packages/twenty-server/src/modules/calendar/common/services/calendar-channel-sync-status.service.ts +++ b/packages/twenty-server/src/modules/calendar/common/services/calendar-channel-sync-status.service.ts @@ -2,9 +2,9 @@ import { Injectable } from '@nestjs/common'; import { Any } from 'typeorm'; -import { CacheStorageService } from 'src/engine/integrations/cache-storage/cache-storage.service'; -import { InjectCacheStorage } from 'src/engine/integrations/cache-storage/decorators/cache-storage.decorator'; -import { CacheStorageNamespace } from 'src/engine/integrations/cache-storage/types/cache-storage-namespace.enum'; +import { CacheStorageService } from 'src/engine/core-modules/cache-storage/cache-storage.service'; +import { InjectCacheStorage } from 'src/engine/core-modules/cache-storage/decorators/cache-storage.decorator'; +import { CacheStorageNamespace } from 'src/engine/core-modules/cache-storage/types/cache-storage-namespace.enum'; import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager'; import { CalendarChannelSyncStage, diff --git a/packages/twenty-server/src/modules/connected-account/listeners/connected-account.listener.ts b/packages/twenty-server/src/modules/connected-account/listeners/connected-account.listener.ts index 455721d817f6..da8bededdb03 100644 --- a/packages/twenty-server/src/modules/connected-account/listeners/connected-account.listener.ts +++ b/packages/twenty-server/src/modules/connected-account/listeners/connected-account.listener.ts @@ -1,7 +1,7 @@ import { Injectable } from '@nestjs/common'; import { OnEvent } from '@nestjs/event-emitter'; -import { ObjectRecordDeleteEvent } from 'src/engine/integrations/event-emitter/types/object-record-delete.event'; +import { ObjectRecordDeleteEvent } from 'src/engine/core-modules/event-emitter/types/object-record-delete.event'; import { TwentyORMGlobalManager } from 'src/engine/twenty-orm/twenty-orm-global.manager'; import { WorkspaceEventBatch } from 'src/engine/workspace-event-emitter/workspace-event.type'; import { AccountsToReconnectService } from 'src/modules/connected-account/services/accounts-to-reconnect.service'; diff --git a/packages/twenty-server/src/modules/connected-account/oauth2-client-manager/drivers/google/google-oauth2-client-manager.service.ts b/packages/twenty-server/src/modules/connected-account/oauth2-client-manager/drivers/google/google-oauth2-client-manager.service.ts index ef577eafc702..e5020f25427b 100644 --- a/packages/twenty-server/src/modules/connected-account/oauth2-client-manager/drivers/google/google-oauth2-client-manager.service.ts +++ b/packages/twenty-server/src/modules/connected-account/oauth2-client-manager/drivers/google/google-oauth2-client-manager.service.ts @@ -3,7 +3,7 @@ import { Injectable } from '@nestjs/common'; import { OAuth2Client } from 'google-auth-library'; import { google } from 'googleapis'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; @Injectable() export class GoogleOAuth2ClientManagerService { diff --git a/packages/twenty-server/src/modules/connected-account/query-hooks/connected-account-delete-one.pre-query.hook.ts b/packages/twenty-server/src/modules/connected-account/query-hooks/connected-account-delete-one.pre-query.hook.ts index 0812c0e33ea0..c04999bea385 100644 --- a/packages/twenty-server/src/modules/connected-account/query-hooks/connected-account-delete-one.pre-query.hook.ts +++ b/packages/twenty-server/src/modules/connected-account/query-hooks/connected-account-delete-one.pre-query.hook.ts @@ -3,7 +3,7 @@ import { DeleteOneResolverArgs } from 'src/engine/api/graphql/workspace-resolver import { WorkspaceQueryHook } from 'src/engine/api/graphql/workspace-query-runner/workspace-query-hook/decorators/workspace-query-hook.decorator'; import { AuthContext } from 'src/engine/core-modules/auth/types/auth-context.type'; -import { ObjectRecordDeleteEvent } from 'src/engine/integrations/event-emitter/types/object-record-delete.event'; +import { ObjectRecordDeleteEvent } from 'src/engine/core-modules/event-emitter/types/object-record-delete.event'; import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager'; import { WorkspaceEventEmitter } from 'src/engine/workspace-event-emitter/workspace-event-emitter'; import { MessageChannelWorkspaceEntity } from 'src/modules/messaging/common/standard-objects/message-channel.workspace-entity'; diff --git a/packages/twenty-server/src/modules/connected-account/refresh-access-token-manager/drivers/google/services/google-api-refresh-access-token.service.ts b/packages/twenty-server/src/modules/connected-account/refresh-access-token-manager/drivers/google/services/google-api-refresh-access-token.service.ts index 3a5d015be990..0afb78d719e8 100644 --- a/packages/twenty-server/src/modules/connected-account/refresh-access-token-manager/drivers/google/services/google-api-refresh-access-token.service.ts +++ b/packages/twenty-server/src/modules/connected-account/refresh-access-token-manager/drivers/google/services/google-api-refresh-access-token.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common'; import axios from 'axios'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; @Injectable() export class GoogleAPIRefreshAccessTokenService { diff --git a/packages/twenty-server/src/modules/contact-creation-manager/jobs/create-company-and-contact.job.ts b/packages/twenty-server/src/modules/contact-creation-manager/jobs/create-company-and-contact.job.ts index 0a00c1ec9af3..a9024bb5b569 100644 --- a/packages/twenty-server/src/modules/contact-creation-manager/jobs/create-company-and-contact.job.ts +++ b/packages/twenty-server/src/modules/contact-creation-manager/jobs/create-company-and-contact.job.ts @@ -1,6 +1,6 @@ -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; import { FieldActorSource } from 'src/engine/metadata-modules/field-metadata/composite-types/actor.composite-type'; import { ConnectedAccountWorkspaceEntity } from 'src/modules/connected-account/standard-objects/connected-account.workspace-entity'; import { CreateCompanyAndContactService } from 'src/modules/contact-creation-manager/services/create-company-and-contact.service'; diff --git a/packages/twenty-server/src/modules/contact-creation-manager/listeners/auto-companies-and-contacts-creation-calendar-channel.listener.ts b/packages/twenty-server/src/modules/contact-creation-manager/listeners/auto-companies-and-contacts-creation-calendar-channel.listener.ts index 5dd7497d009b..50a24f1d1f64 100644 --- a/packages/twenty-server/src/modules/contact-creation-manager/listeners/auto-companies-and-contacts-creation-calendar-channel.listener.ts +++ b/packages/twenty-server/src/modules/contact-creation-manager/listeners/auto-companies-and-contacts-creation-calendar-channel.listener.ts @@ -1,11 +1,11 @@ import { Injectable } from '@nestjs/common'; import { OnEvent } from '@nestjs/event-emitter'; -import { ObjectRecordUpdateEvent } from 'src/engine/integrations/event-emitter/types/object-record-update.event'; -import { objectRecordChangedProperties } from 'src/engine/integrations/event-emitter/utils/object-record-changed-properties.util'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { ObjectRecordUpdateEvent } from 'src/engine/core-modules/event-emitter/types/object-record-update.event'; +import { objectRecordChangedProperties } from 'src/engine/core-modules/event-emitter/utils/object-record-changed-properties.util'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { WorkspaceEventBatch } from 'src/engine/workspace-event-emitter/workspace-event.type'; import { CalendarCreateCompanyAndContactAfterSyncJob, diff --git a/packages/twenty-server/src/modules/contact-creation-manager/listeners/auto-companies-and-contacts-creation-message-channel.listener.ts b/packages/twenty-server/src/modules/contact-creation-manager/listeners/auto-companies-and-contacts-creation-message-channel.listener.ts index ac2511f745c0..6ed36b4be2ee 100644 --- a/packages/twenty-server/src/modules/contact-creation-manager/listeners/auto-companies-and-contacts-creation-message-channel.listener.ts +++ b/packages/twenty-server/src/modules/contact-creation-manager/listeners/auto-companies-and-contacts-creation-message-channel.listener.ts @@ -1,11 +1,11 @@ import { Injectable } from '@nestjs/common'; import { OnEvent } from '@nestjs/event-emitter'; -import { ObjectRecordUpdateEvent } from 'src/engine/integrations/event-emitter/types/object-record-update.event'; -import { objectRecordChangedProperties } from 'src/engine/integrations/event-emitter/utils/object-record-changed-properties.util'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { ObjectRecordUpdateEvent } from 'src/engine/core-modules/event-emitter/types/object-record-update.event'; +import { objectRecordChangedProperties } from 'src/engine/core-modules/event-emitter/utils/object-record-changed-properties.util'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { WorkspaceEventBatch } from 'src/engine/workspace-event-emitter/workspace-event.type'; import { MessageChannelWorkspaceEntity } from 'src/modules/messaging/common/standard-objects/message-channel.workspace-entity'; import { diff --git a/packages/twenty-server/src/modules/contact-creation-manager/services/create-company-and-contact.service.ts b/packages/twenty-server/src/modules/contact-creation-manager/services/create-company-and-contact.service.ts index db6a6328bb29..62ca1e4b4a47 100644 --- a/packages/twenty-server/src/modules/contact-creation-manager/services/create-company-and-contact.service.ts +++ b/packages/twenty-server/src/modules/contact-creation-manager/services/create-company-and-contact.service.ts @@ -5,7 +5,7 @@ import chunk from 'lodash.chunk'; import compact from 'lodash.compact'; import { Any, EntityManager, Repository } from 'typeorm'; -import { ObjectRecordCreateEvent } from 'src/engine/integrations/event-emitter/types/object-record-create.event'; +import { ObjectRecordCreateEvent } from 'src/engine/core-modules/event-emitter/types/object-record-create.event'; import { FieldActorSource } from 'src/engine/metadata-modules/field-metadata/composite-types/actor.composite-type'; import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity'; import { InjectObjectMetadataRepository } from 'src/engine/object-metadata-repository/object-metadata-repository.decorator'; diff --git a/packages/twenty-server/src/modules/messaging/blocklist-manager/jobs/messaging-blocklist-item-delete-messages.job.ts b/packages/twenty-server/src/modules/messaging/blocklist-manager/jobs/messaging-blocklist-item-delete-messages.job.ts index b9396eb8324e..8fedb4c73cb9 100644 --- a/packages/twenty-server/src/modules/messaging/blocklist-manager/jobs/messaging-blocklist-item-delete-messages.job.ts +++ b/packages/twenty-server/src/modules/messaging/blocklist-manager/jobs/messaging-blocklist-item-delete-messages.job.ts @@ -2,10 +2,10 @@ import { Logger, Scope } from '@nestjs/common'; import { And, Any, ILike, In, Not, Or } from 'typeorm'; -import { ObjectRecordCreateEvent } from 'src/engine/integrations/event-emitter/types/object-record-create.event'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { ObjectRecordCreateEvent } from 'src/engine/core-modules/event-emitter/types/object-record-create.event'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager'; import { WorkspaceEventBatch } from 'src/engine/workspace-event-emitter/workspace-event.type'; import { BlocklistWorkspaceEntity } from 'src/modules/blocklist/standard-objects/blocklist.workspace-entity'; diff --git a/packages/twenty-server/src/modules/messaging/blocklist-manager/jobs/messaging-blocklist-reimport-messages.job.ts b/packages/twenty-server/src/modules/messaging/blocklist-manager/jobs/messaging-blocklist-reimport-messages.job.ts index 0d2a767946ff..0b84b473c97b 100644 --- a/packages/twenty-server/src/modules/messaging/blocklist-manager/jobs/messaging-blocklist-reimport-messages.job.ts +++ b/packages/twenty-server/src/modules/messaging/blocklist-manager/jobs/messaging-blocklist-reimport-messages.job.ts @@ -2,10 +2,10 @@ import { Scope } from '@nestjs/common'; import { Not } from 'typeorm'; -import { ObjectRecordDeleteEvent } from 'src/engine/integrations/event-emitter/types/object-record-delete.event'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { ObjectRecordDeleteEvent } from 'src/engine/core-modules/event-emitter/types/object-record-delete.event'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager'; import { WorkspaceEventBatch } from 'src/engine/workspace-event-emitter/workspace-event.type'; import { BlocklistWorkspaceEntity } from 'src/modules/blocklist/standard-objects/blocklist.workspace-entity'; diff --git a/packages/twenty-server/src/modules/messaging/blocklist-manager/listeners/messaging-blocklist.listener.ts b/packages/twenty-server/src/modules/messaging/blocklist-manager/listeners/messaging-blocklist.listener.ts index db2ded2d4332..d232e9040b83 100644 --- a/packages/twenty-server/src/modules/messaging/blocklist-manager/listeners/messaging-blocklist.listener.ts +++ b/packages/twenty-server/src/modules/messaging/blocklist-manager/listeners/messaging-blocklist.listener.ts @@ -1,12 +1,12 @@ import { Injectable, Scope } from '@nestjs/common'; import { OnEvent } from '@nestjs/event-emitter'; -import { ObjectRecordCreateEvent } from 'src/engine/integrations/event-emitter/types/object-record-create.event'; -import { ObjectRecordDeleteEvent } from 'src/engine/integrations/event-emitter/types/object-record-delete.event'; -import { ObjectRecordUpdateEvent } from 'src/engine/integrations/event-emitter/types/object-record-update.event'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { ObjectRecordCreateEvent } from 'src/engine/core-modules/event-emitter/types/object-record-create.event'; +import { ObjectRecordDeleteEvent } from 'src/engine/core-modules/event-emitter/types/object-record-delete.event'; +import { ObjectRecordUpdateEvent } from 'src/engine/core-modules/event-emitter/types/object-record-update.event'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { WorkspaceEventBatch } from 'src/engine/workspace-event-emitter/workspace-event.type'; import { BlocklistWorkspaceEntity } from 'src/modules/blocklist/standard-objects/blocklist.workspace-entity'; import { diff --git a/packages/twenty-server/src/modules/messaging/common/services/message-channel-sync-status.service.ts b/packages/twenty-server/src/modules/messaging/common/services/message-channel-sync-status.service.ts index bc29575c522d..d21b73fb0bc2 100644 --- a/packages/twenty-server/src/modules/messaging/common/services/message-channel-sync-status.service.ts +++ b/packages/twenty-server/src/modules/messaging/common/services/message-channel-sync-status.service.ts @@ -2,9 +2,9 @@ import { Injectable } from '@nestjs/common'; import { Any } from 'typeorm'; -import { CacheStorageService } from 'src/engine/integrations/cache-storage/cache-storage.service'; -import { InjectCacheStorage } from 'src/engine/integrations/cache-storage/decorators/cache-storage.decorator'; -import { CacheStorageNamespace } from 'src/engine/integrations/cache-storage/types/cache-storage-namespace.enum'; +import { CacheStorageService } from 'src/engine/core-modules/cache-storage/cache-storage.service'; +import { InjectCacheStorage } from 'src/engine/core-modules/cache-storage/decorators/cache-storage.decorator'; +import { CacheStorageNamespace } from 'src/engine/core-modules/cache-storage/types/cache-storage-namespace.enum'; import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager'; import { AccountsToReconnectService } from 'src/modules/connected-account/services/accounts-to-reconnect.service'; import { ConnectedAccountWorkspaceEntity } from 'src/modules/connected-account/standard-objects/connected-account.workspace-entity'; diff --git a/packages/twenty-server/src/modules/messaging/message-cleaner/jobs/messaging-connected-account-deletion-cleanup.job.ts b/packages/twenty-server/src/modules/messaging/message-cleaner/jobs/messaging-connected-account-deletion-cleanup.job.ts index c9cc4e9e993e..2523c180485c 100644 --- a/packages/twenty-server/src/modules/messaging/message-cleaner/jobs/messaging-connected-account-deletion-cleanup.job.ts +++ b/packages/twenty-server/src/modules/messaging/message-cleaner/jobs/messaging-connected-account-deletion-cleanup.job.ts @@ -1,9 +1,9 @@ import { Logger, Scope } from '@nestjs/common'; import { MessagingMessageCleanerService } from 'src/modules/messaging/message-cleaner/services/messaging-message-cleaner.service'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; export type MessagingConnectedAccountDeletionCleanupJobData = { workspaceId: string; diff --git a/packages/twenty-server/src/modules/messaging/message-cleaner/listeners/messaging-message-cleaner-connected-account.listener.ts b/packages/twenty-server/src/modules/messaging/message-cleaner/listeners/messaging-message-cleaner-connected-account.listener.ts index 8caf65c58857..8e837cce6a59 100644 --- a/packages/twenty-server/src/modules/messaging/message-cleaner/listeners/messaging-message-cleaner-connected-account.listener.ts +++ b/packages/twenty-server/src/modules/messaging/message-cleaner/listeners/messaging-message-cleaner-connected-account.listener.ts @@ -1,10 +1,10 @@ import { Injectable } from '@nestjs/common'; import { OnEvent } from '@nestjs/event-emitter'; -import { ObjectRecordDeleteEvent } from 'src/engine/integrations/event-emitter/types/object-record-delete.event'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { ObjectRecordDeleteEvent } from 'src/engine/core-modules/event-emitter/types/object-record-delete.event'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { WorkspaceEventBatch } from 'src/engine/workspace-event-emitter/workspace-event.type'; import { ConnectedAccountWorkspaceEntity } from 'src/modules/connected-account/standard-objects/connected-account.workspace-entity'; import { diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/commands/messaging-single-message-import.command.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/commands/messaging-single-message-import.command.ts index c55465f7dedc..77e4f776fe4a 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/commands/messaging-single-message-import.command.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/commands/messaging-single-message-import.command.ts @@ -1,8 +1,8 @@ import { Command, CommandRunner, Option } from 'nest-commander'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { MessagingAddSingleMessageToCacheForImportJob, MessagingAddSingleMessageToCacheForImportJobData, diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/crons/commands/messaging-message-list-fetch.cron.command.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/crons/commands/messaging-message-list-fetch.cron.command.ts index d8e2253bd1d1..a6dc37e7bd52 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/crons/commands/messaging-message-list-fetch.cron.command.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/crons/commands/messaging-message-list-fetch.cron.command.ts @@ -1,8 +1,8 @@ import { Command, CommandRunner } from 'nest-commander'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { MessagingMessageListFetchCronJob } from 'src/modules/messaging/message-import-manager/crons/jobs/messaging-message-list-fetch.cron.job'; const MESSAGING_MESSAGE_LIST_FETCH_CRON_PATTERN = '*/5 * * * *'; diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/crons/commands/messaging-messages-import.cron.command.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/crons/commands/messaging-messages-import.cron.command.ts index 11ef7211d76a..03196cd83296 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/crons/commands/messaging-messages-import.cron.command.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/crons/commands/messaging-messages-import.cron.command.ts @@ -1,8 +1,8 @@ import { Command, CommandRunner } from 'nest-commander'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { MessagingMessagesImportCronJob } from 'src/modules/messaging/message-import-manager/crons/jobs/messaging-messages-import.cron.job'; const MESSAGING_MESSAGES_IMPORT_CRON_PATTERN = '*/1 * * * *'; diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/crons/commands/messaging-ongoing-stale.cron.command.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/crons/commands/messaging-ongoing-stale.cron.command.ts index ed77d79555b8..5986a33ce34b 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/crons/commands/messaging-ongoing-stale.cron.command.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/crons/commands/messaging-ongoing-stale.cron.command.ts @@ -1,8 +1,8 @@ import { Command, CommandRunner } from 'nest-commander'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { MessagingOngoingStaleCronJob } from 'src/modules/messaging/message-import-manager/crons/jobs/messaging-ongoing-stale.cron.job'; const MESSAGING_ONGOING_STALE_CRON_PATTERN = '0 * * * *'; diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/crons/jobs/messaging-message-list-fetch.cron.job.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/crons/jobs/messaging-message-list-fetch.cron.job.ts index 43ca1ae757a0..b3f433fee36f 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/crons/jobs/messaging-message-list-fetch.cron.job.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/crons/jobs/messaging-message-list-fetch.cron.job.ts @@ -6,12 +6,12 @@ import { Workspace, WorkspaceActivationStatus, } from 'src/engine/core-modules/workspace/workspace.entity'; -import { ExceptionHandlerService } from 'src/engine/integrations/exception-handler/exception-handler.service'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { TwentyORMGlobalManager } from 'src/engine/twenty-orm/twenty-orm-global.manager'; import { MessageChannelSyncStage, diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/crons/jobs/messaging-messages-import.cron.job.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/crons/jobs/messaging-messages-import.cron.job.ts index f22783294595..efcbc54cafa4 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/crons/jobs/messaging-messages-import.cron.job.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/crons/jobs/messaging-messages-import.cron.job.ts @@ -6,12 +6,12 @@ import { Workspace, WorkspaceActivationStatus, } from 'src/engine/core-modules/workspace/workspace.entity'; -import { ExceptionHandlerService } from 'src/engine/integrations/exception-handler/exception-handler.service'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { TwentyORMGlobalManager } from 'src/engine/twenty-orm/twenty-orm-global.manager'; import { MessageChannelSyncStage, diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/crons/jobs/messaging-ongoing-stale.cron.job.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/crons/jobs/messaging-ongoing-stale.cron.job.ts index 08ca244cc202..f3b6b96fcaf4 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/crons/jobs/messaging-ongoing-stale.cron.job.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/crons/jobs/messaging-ongoing-stale.cron.job.ts @@ -6,12 +6,12 @@ import { Workspace, WorkspaceActivationStatus, } from 'src/engine/core-modules/workspace/workspace.entity'; -import { ExceptionHandlerService } from 'src/engine/integrations/exception-handler/exception-handler.service'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { MessagingOngoingStaleJob, MessagingOngoingStaleJobData, diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/gmail/messaging-gmail-driver.module.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/gmail/messaging-gmail-driver.module.ts index 8229618a2354..3fc555a87c96 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/gmail/messaging-gmail-driver.module.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/drivers/gmail/messaging-gmail-driver.module.ts @@ -4,7 +4,7 @@ import { TypeOrmModule } from '@nestjs/typeorm'; import { FeatureFlagEntity } from 'src/engine/core-modules/feature-flag/feature-flag.entity'; import { FeatureFlagModule } from 'src/engine/core-modules/feature-flag/feature-flag.module'; -import { EnvironmentModule } from 'src/engine/integrations/environment/environment.module'; +import { EnvironmentModule } from 'src/engine/core-modules/environment/environment.module'; import { ObjectMetadataRepositoryModule } from 'src/engine/object-metadata-repository/object-metadata-repository.module'; import { WorkspaceDataSourceModule } from 'src/engine/workspace-datasource/workspace-datasource.module'; import { BlocklistWorkspaceEntity } from 'src/modules/blocklist/standard-objects/blocklist.workspace-entity'; diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/jobs/messaging-add-single-message-to-cache-for-import.job.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/jobs/messaging-add-single-message-to-cache-for-import.job.ts index 3f2c2a537901..a37c383718c8 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/jobs/messaging-add-single-message-to-cache-for-import.job.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/jobs/messaging-add-single-message-to-cache-for-import.job.ts @@ -1,9 +1,9 @@ -import { CacheStorageService } from 'src/engine/integrations/cache-storage/cache-storage.service'; -import { InjectCacheStorage } from 'src/engine/integrations/cache-storage/decorators/cache-storage.decorator'; -import { CacheStorageNamespace } from 'src/engine/integrations/cache-storage/types/cache-storage-namespace.enum'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { CacheStorageService } from 'src/engine/core-modules/cache-storage/cache-storage.service'; +import { InjectCacheStorage } from 'src/engine/core-modules/cache-storage/decorators/cache-storage.decorator'; +import { CacheStorageNamespace } from 'src/engine/core-modules/cache-storage/types/cache-storage-namespace.enum'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; export type MessagingAddSingleMessageToCacheForImportJobData = { messageExternalId: string; diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/jobs/messaging-clean-cache.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/jobs/messaging-clean-cache.ts index 24e048ce01b3..38e3ec8cff27 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/jobs/messaging-clean-cache.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/jobs/messaging-clean-cache.ts @@ -1,11 +1,11 @@ import { Logger } from '@nestjs/common'; -import { CacheStorageService } from 'src/engine/integrations/cache-storage/cache-storage.service'; -import { InjectCacheStorage } from 'src/engine/integrations/cache-storage/decorators/cache-storage.decorator'; -import { CacheStorageNamespace } from 'src/engine/integrations/cache-storage/types/cache-storage-namespace.enum'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { CacheStorageService } from 'src/engine/core-modules/cache-storage/cache-storage.service'; +import { InjectCacheStorage } from 'src/engine/core-modules/cache-storage/decorators/cache-storage.decorator'; +import { CacheStorageNamespace } from 'src/engine/core-modules/cache-storage/types/cache-storage-namespace.enum'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; export type MessagingCleanCacheJobData = { workspaceId: string; diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/jobs/messaging-message-list-fetch.job.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/jobs/messaging-message-list-fetch.job.ts index a51bd35a085b..cc66a1ff5dbc 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/jobs/messaging-message-list-fetch.job.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/jobs/messaging-message-list-fetch.job.ts @@ -1,8 +1,8 @@ import { Logger, Scope } from '@nestjs/common'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; import { InjectObjectMetadataRepository } from 'src/engine/object-metadata-repository/object-metadata-repository.decorator'; import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager'; import { ConnectedAccountRepository } from 'src/modules/connected-account/repositories/connected-account.repository'; diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/jobs/messaging-messages-import.job.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/jobs/messaging-messages-import.job.ts index f62dc3a1b0cd..a22e1b26a769 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/jobs/messaging-messages-import.job.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/jobs/messaging-messages-import.job.ts @@ -1,8 +1,8 @@ import { Scope } from '@nestjs/common'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; import { InjectObjectMetadataRepository } from 'src/engine/object-metadata-repository/object-metadata-repository.decorator'; import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager'; import { ConnectedAccountRepository } from 'src/modules/connected-account/repositories/connected-account.repository'; diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/jobs/messaging-ongoing-stale.job.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/jobs/messaging-ongoing-stale.job.ts index 6f5166d26ae1..f8ec658d39c8 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/jobs/messaging-ongoing-stale.job.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/jobs/messaging-ongoing-stale.job.ts @@ -2,9 +2,9 @@ import { Logger, Scope } from '@nestjs/common'; import { In } from 'typeorm'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager'; import { MessageChannelSyncStatusService } from 'src/modules/messaging/common/services/message-channel-sync-status.service'; import { diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/listeners/messaging-import-manager-message-channel.listener.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/listeners/messaging-import-manager-message-channel.listener.ts index b81118d3a20f..513e2672adf4 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/listeners/messaging-import-manager-message-channel.listener.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/listeners/messaging-import-manager-message-channel.listener.ts @@ -1,10 +1,10 @@ import { Injectable } from '@nestjs/common'; import { OnEvent } from '@nestjs/event-emitter'; -import { ObjectRecordDeleteEvent } from 'src/engine/integrations/event-emitter/types/object-record-delete.event'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { ObjectRecordDeleteEvent } from 'src/engine/core-modules/event-emitter/types/object-record-delete.event'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { WorkspaceEventBatch } from 'src/engine/workspace-event-emitter/workspace-event.type'; import { MessageChannelWorkspaceEntity } from 'src/modules/messaging/common/standard-objects/message-channel.workspace-entity'; import { diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-full-message-list-fetch.service.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-full-message-list-fetch.service.ts index 549e90ad067f..c4652b5e6a12 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-full-message-list-fetch.service.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-full-message-list-fetch.service.ts @@ -2,9 +2,9 @@ import { Injectable } from '@nestjs/common'; import { Any } from 'typeorm'; -import { CacheStorageService } from 'src/engine/integrations/cache-storage/cache-storage.service'; -import { InjectCacheStorage } from 'src/engine/integrations/cache-storage/decorators/cache-storage.decorator'; -import { CacheStorageNamespace } from 'src/engine/integrations/cache-storage/types/cache-storage-namespace.enum'; +import { CacheStorageService } from 'src/engine/core-modules/cache-storage/cache-storage.service'; +import { InjectCacheStorage } from 'src/engine/core-modules/cache-storage/decorators/cache-storage.decorator'; +import { CacheStorageNamespace } from 'src/engine/core-modules/cache-storage/types/cache-storage-namespace.enum'; import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager'; import { ConnectedAccountWorkspaceEntity } from 'src/modules/connected-account/standard-objects/connected-account.workspace-entity'; import { MessageChannelSyncStatusService } from 'src/modules/messaging/common/services/message-channel-sync-status.service'; diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-messages-import.service.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-messages-import.service.ts index d13e80f03df1..fec045528d88 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-messages-import.service.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-messages-import.service.ts @@ -1,8 +1,8 @@ import { Injectable, Logger } from '@nestjs/common'; -import { CacheStorageService } from 'src/engine/integrations/cache-storage/cache-storage.service'; -import { InjectCacheStorage } from 'src/engine/integrations/cache-storage/decorators/cache-storage.decorator'; -import { CacheStorageNamespace } from 'src/engine/integrations/cache-storage/types/cache-storage-namespace.enum'; +import { CacheStorageService } from 'src/engine/core-modules/cache-storage/cache-storage.service'; +import { InjectCacheStorage } from 'src/engine/core-modules/cache-storage/decorators/cache-storage.decorator'; +import { CacheStorageNamespace } from 'src/engine/core-modules/cache-storage/types/cache-storage-namespace.enum'; import { InjectObjectMetadataRepository } from 'src/engine/object-metadata-repository/object-metadata-repository.decorator'; import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager'; import { BlocklistRepository } from 'src/modules/blocklist/repositories/blocklist.repository'; diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-partial-message-list-fetch.service.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-partial-message-list-fetch.service.ts index d7bded11059a..14fc98a63714 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-partial-message-list-fetch.service.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-partial-message-list-fetch.service.ts @@ -2,9 +2,9 @@ import { Injectable, Logger } from '@nestjs/common'; import { Any } from 'typeorm'; -import { CacheStorageService } from 'src/engine/integrations/cache-storage/cache-storage.service'; -import { InjectCacheStorage } from 'src/engine/integrations/cache-storage/decorators/cache-storage.decorator'; -import { CacheStorageNamespace } from 'src/engine/integrations/cache-storage/types/cache-storage-namespace.enum'; +import { CacheStorageService } from 'src/engine/core-modules/cache-storage/cache-storage.service'; +import { InjectCacheStorage } from 'src/engine/core-modules/cache-storage/decorators/cache-storage.decorator'; +import { CacheStorageNamespace } from 'src/engine/core-modules/cache-storage/types/cache-storage-namespace.enum'; import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager'; import { ConnectedAccountWorkspaceEntity } from 'src/modules/connected-account/standard-objects/connected-account.workspace-entity'; import { MessageChannelSyncStatusService } from 'src/modules/messaging/common/services/message-channel-sync-status.service'; diff --git a/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-save-messages-and-enqueue-contact-creation.service.ts b/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-save-messages-and-enqueue-contact-creation.service.ts index 79f93b3e0b51..4080dc08f71f 100644 --- a/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-save-messages-and-enqueue-contact-creation.service.ts +++ b/packages/twenty-server/src/modules/messaging/message-import-manager/services/messaging-save-messages-and-enqueue-contact-creation.service.ts @@ -2,9 +2,9 @@ import { Injectable } from '@nestjs/common'; import { EntityManager } from 'typeorm'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { FieldActorSource } from 'src/engine/metadata-modules/field-metadata/composite-types/actor.composite-type'; import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager'; import { ConnectedAccountWorkspaceEntity } from 'src/modules/connected-account/standard-objects/connected-account.workspace-entity'; diff --git a/packages/twenty-server/src/modules/messaging/message-participant-manager/jobs/message-participant-match-participant.job.ts b/packages/twenty-server/src/modules/messaging/message-participant-manager/jobs/message-participant-match-participant.job.ts index 9b3f4b6bfe9f..a72f4671b6ef 100644 --- a/packages/twenty-server/src/modules/messaging/message-participant-manager/jobs/message-participant-match-participant.job.ts +++ b/packages/twenty-server/src/modules/messaging/message-participant-manager/jobs/message-participant-match-participant.job.ts @@ -1,8 +1,8 @@ import { Scope } from '@nestjs/common'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; import { MatchParticipantService } from 'src/modules/match-participant/match-participant.service'; import { MessageParticipantWorkspaceEntity } from 'src/modules/messaging/common/standard-objects/message-participant.workspace-entity'; diff --git a/packages/twenty-server/src/modules/messaging/message-participant-manager/jobs/message-participant-unmatch-participant.job.ts b/packages/twenty-server/src/modules/messaging/message-participant-manager/jobs/message-participant-unmatch-participant.job.ts index 78f2b80d8937..8d7cc46b2049 100644 --- a/packages/twenty-server/src/modules/messaging/message-participant-manager/jobs/message-participant-unmatch-participant.job.ts +++ b/packages/twenty-server/src/modules/messaging/message-participant-manager/jobs/message-participant-unmatch-participant.job.ts @@ -1,8 +1,8 @@ import { Scope } from '@nestjs/common'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; import { MatchParticipantService } from 'src/modules/match-participant/match-participant.service'; import { MessageParticipantWorkspaceEntity } from 'src/modules/messaging/common/standard-objects/message-participant.workspace-entity'; diff --git a/packages/twenty-server/src/modules/messaging/message-participant-manager/jobs/messaging-create-company-and-contact-after-sync.job.ts b/packages/twenty-server/src/modules/messaging/message-participant-manager/jobs/messaging-create-company-and-contact-after-sync.job.ts index e6b7c59f21c4..8529ebaef6f4 100644 --- a/packages/twenty-server/src/modules/messaging/message-participant-manager/jobs/messaging-create-company-and-contact-after-sync.job.ts +++ b/packages/twenty-server/src/modules/messaging/message-participant-manager/jobs/messaging-create-company-and-contact-after-sync.job.ts @@ -2,9 +2,9 @@ import { Logger } from '@nestjs/common'; import { Any, IsNull } from 'typeorm'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; import { FieldActorSource } from 'src/engine/metadata-modules/field-metadata/composite-types/actor.composite-type'; import { InjectObjectMetadataRepository } from 'src/engine/object-metadata-repository/object-metadata-repository.decorator'; import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager'; diff --git a/packages/twenty-server/src/modules/messaging/message-participant-manager/listeners/message-participant-person.listener.ts b/packages/twenty-server/src/modules/messaging/message-participant-manager/listeners/message-participant-person.listener.ts index 8e42990c90c5..86b3a0289ca9 100644 --- a/packages/twenty-server/src/modules/messaging/message-participant-manager/listeners/message-participant-person.listener.ts +++ b/packages/twenty-server/src/modules/messaging/message-participant-manager/listeners/message-participant-person.listener.ts @@ -1,12 +1,12 @@ import { Injectable } from '@nestjs/common'; import { OnEvent } from '@nestjs/event-emitter'; -import { ObjectRecordCreateEvent } from 'src/engine/integrations/event-emitter/types/object-record-create.event'; -import { ObjectRecordUpdateEvent } from 'src/engine/integrations/event-emitter/types/object-record-update.event'; -import { objectRecordChangedProperties as objectRecordUpdateEventChangedProperties } from 'src/engine/integrations/event-emitter/utils/object-record-changed-properties.util'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { ObjectRecordCreateEvent } from 'src/engine/core-modules/event-emitter/types/object-record-create.event'; +import { ObjectRecordUpdateEvent } from 'src/engine/core-modules/event-emitter/types/object-record-update.event'; +import { objectRecordChangedProperties as objectRecordUpdateEventChangedProperties } from 'src/engine/core-modules/event-emitter/utils/object-record-changed-properties.util'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { WorkspaceEventBatch } from 'src/engine/workspace-event-emitter/workspace-event.type'; import { MessageParticipantMatchParticipantJob, diff --git a/packages/twenty-server/src/modules/messaging/message-participant-manager/listeners/message-participant-workspace-member.listener.ts b/packages/twenty-server/src/modules/messaging/message-participant-manager/listeners/message-participant-workspace-member.listener.ts index aeec32548adb..6d093a1cc0a8 100644 --- a/packages/twenty-server/src/modules/messaging/message-participant-manager/listeners/message-participant-workspace-member.listener.ts +++ b/packages/twenty-server/src/modules/messaging/message-participant-manager/listeners/message-participant-workspace-member.listener.ts @@ -8,12 +8,12 @@ import { Workspace, WorkspaceActivationStatus, } from 'src/engine/core-modules/workspace/workspace.entity'; -import { ObjectRecordCreateEvent } from 'src/engine/integrations/event-emitter/types/object-record-create.event'; -import { ObjectRecordUpdateEvent } from 'src/engine/integrations/event-emitter/types/object-record-update.event'; -import { objectRecordChangedProperties as objectRecordUpdateEventChangedProperties } from 'src/engine/integrations/event-emitter/utils/object-record-changed-properties.util'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { ObjectRecordCreateEvent } from 'src/engine/core-modules/event-emitter/types/object-record-create.event'; +import { ObjectRecordUpdateEvent } from 'src/engine/core-modules/event-emitter/types/object-record-update.event'; +import { objectRecordChangedProperties as objectRecordUpdateEventChangedProperties } from 'src/engine/core-modules/event-emitter/utils/object-record-changed-properties.util'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { WorkspaceEventBatch } from 'src/engine/workspace-event-emitter/workspace-event.type'; import { MessageParticipantMatchParticipantJob, diff --git a/packages/twenty-server/src/modules/messaging/monitoring/crons/commands/messaging-message-channel-sync-status-monitoring.cron.command.ts b/packages/twenty-server/src/modules/messaging/monitoring/crons/commands/messaging-message-channel-sync-status-monitoring.cron.command.ts index d90fd0b5be45..cf2c654840c9 100644 --- a/packages/twenty-server/src/modules/messaging/monitoring/crons/commands/messaging-message-channel-sync-status-monitoring.cron.command.ts +++ b/packages/twenty-server/src/modules/messaging/monitoring/crons/commands/messaging-message-channel-sync-status-monitoring.cron.command.ts @@ -1,8 +1,8 @@ import { Command, CommandRunner } from 'nest-commander'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { MessagingMessageChannelSyncStatusMonitoringCronJob } from 'src/modules/messaging/monitoring/crons/jobs/messaging-message-channel-sync-status-monitoring.cron'; const MESSAGING_MESSAGE_CHANNEL_SYNC_STATUS_MONITORING_CRON_PATTERN = diff --git a/packages/twenty-server/src/modules/messaging/monitoring/crons/jobs/messaging-message-channel-sync-status-monitoring.cron.ts b/packages/twenty-server/src/modules/messaging/monitoring/crons/jobs/messaging-message-channel-sync-status-monitoring.cron.ts index 94ac094ffb24..83552b8568cf 100644 --- a/packages/twenty-server/src/modules/messaging/monitoring/crons/jobs/messaging-message-channel-sync-status-monitoring.cron.ts +++ b/packages/twenty-server/src/modules/messaging/monitoring/crons/jobs/messaging-message-channel-sync-status-monitoring.cron.ts @@ -8,9 +8,9 @@ import { Workspace, WorkspaceActivationStatus, } from 'src/engine/core-modules/workspace/workspace.entity'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; import { TwentyORMGlobalManager } from 'src/engine/twenty-orm/twenty-orm-global.manager'; import { MessageChannelWorkspaceEntity } from 'src/modules/messaging/common/standard-objects/message-channel.workspace-entity'; import { MessagingTelemetryService } from 'src/modules/messaging/monitoring/services/messaging-telemetry.service'; diff --git a/packages/twenty-server/src/modules/messaging/monitoring/services/messaging-telemetry.service.ts b/packages/twenty-server/src/modules/messaging/monitoring/services/messaging-telemetry.service.ts index 0234f7fbcb4e..efe5ae6b445e 100644 --- a/packages/twenty-server/src/modules/messaging/monitoring/services/messaging-telemetry.service.ts +++ b/packages/twenty-server/src/modules/messaging/monitoring/services/messaging-telemetry.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@nestjs/common'; import { AnalyticsService } from 'src/engine/core-modules/analytics/analytics.service'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; type MessagingTelemetryTrackInput = { eventName: string; diff --git a/packages/twenty-server/src/modules/timeline/jobs/create-audit-log-from-internal-event.ts b/packages/twenty-server/src/modules/timeline/jobs/create-audit-log-from-internal-event.ts index d820020d3efc..b831c0c3815d 100644 --- a/packages/twenty-server/src/modules/timeline/jobs/create-audit-log-from-internal-event.ts +++ b/packages/twenty-server/src/modules/timeline/jobs/create-audit-log-from-internal-event.ts @@ -1,7 +1,7 @@ -import { ObjectRecordBaseEvent } from 'src/engine/integrations/event-emitter/types/object-record.base.event'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { ObjectRecordBaseEvent } from 'src/engine/core-modules/event-emitter/types/object-record.base.event'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; import { InjectObjectMetadataRepository } from 'src/engine/object-metadata-repository/object-metadata-repository.decorator'; import { WorkspaceEventBatch } from 'src/engine/workspace-event-emitter/workspace-event.type'; import { AuditLogRepository } from 'src/modules/timeline/repositiories/audit-log.repository'; diff --git a/packages/twenty-server/src/modules/timeline/jobs/upsert-timeline-activity-from-internal-event.job.ts b/packages/twenty-server/src/modules/timeline/jobs/upsert-timeline-activity-from-internal-event.job.ts index c73479745c7c..89d3721632bb 100644 --- a/packages/twenty-server/src/modules/timeline/jobs/upsert-timeline-activity-from-internal-event.job.ts +++ b/packages/twenty-server/src/modules/timeline/jobs/upsert-timeline-activity-from-internal-event.job.ts @@ -1,7 +1,7 @@ -import { ObjectRecordBaseEvent } from 'src/engine/integrations/event-emitter/types/object-record.base.event'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { ObjectRecordBaseEvent } from 'src/engine/core-modules/event-emitter/types/object-record.base.event'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; import { InjectObjectMetadataRepository } from 'src/engine/object-metadata-repository/object-metadata-repository.decorator'; import { WorkspaceEventBatch } from 'src/engine/workspace-event-emitter/workspace-event.type'; import { TimelineActivityService } from 'src/modules/timeline/services/timeline-activity.service'; diff --git a/packages/twenty-server/src/modules/timeline/repositiories/timeline-activity.repository.ts b/packages/twenty-server/src/modules/timeline/repositiories/timeline-activity.repository.ts index 1ab962ea9cf1..ec858797e536 100644 --- a/packages/twenty-server/src/modules/timeline/repositiories/timeline-activity.repository.ts +++ b/packages/twenty-server/src/modules/timeline/repositiories/timeline-activity.repository.ts @@ -5,7 +5,7 @@ import { EntityManager } from 'typeorm'; import { Record } from 'src/engine/api/graphql/workspace-query-builder/interfaces/record.interface'; import { WorkspaceDataSourceService } from 'src/engine/workspace-datasource/workspace-datasource.service'; -import { objectRecordDiffMerge } from 'src/engine/integrations/event-emitter/utils/object-record-diff-merge'; +import { objectRecordDiffMerge } from 'src/engine/core-modules/event-emitter/utils/object-record-diff-merge'; @Injectable() export class TimelineActivityRepository { diff --git a/packages/twenty-server/src/modules/timeline/services/timeline-activity.service.ts b/packages/twenty-server/src/modules/timeline/services/timeline-activity.service.ts index 963a65d5f35f..12dfe5a52f17 100644 --- a/packages/twenty-server/src/modules/timeline/services/timeline-activity.service.ts +++ b/packages/twenty-server/src/modules/timeline/services/timeline-activity.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@nestjs/common'; -import { ObjectRecordBaseEventWithNameAndWorkspaceId } from 'src/engine/integrations/event-emitter/types/object-record.base.event'; +import { ObjectRecordBaseEventWithNameAndWorkspaceId } from 'src/engine/core-modules/event-emitter/types/object-record.base.event'; import { InjectObjectMetadataRepository } from 'src/engine/object-metadata-repository/object-metadata-repository.decorator'; import { WorkspaceDataSourceService } from 'src/engine/workspace-datasource/workspace-datasource.service'; import { TimelineActivityRepository } from 'src/modules/timeline/repositiories/timeline-activity.repository'; diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executors/send-email.workflow-step-executor.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executors/send-email.workflow-step-executor.ts index f5625011b909..60a6f3cfd7a9 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executors/send-email.workflow-step-executor.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executors/send-email.workflow-step-executor.ts @@ -9,8 +9,8 @@ import { render } from '@react-email/components'; import { WorkflowStepResult } from 'src/modules/workflow/workflow-executor/types/workflow-step-result.type'; import { WorkflowSendEmailStep } from 'src/modules/workflow/workflow-executor/types/workflow-step.type'; -import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; -import { EmailService } from 'src/engine/integrations/email/email.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; +import { EmailService } from 'src/engine/core-modules/email/email.service'; @Injectable() export class SendEmailWorkflowStepExecutor { diff --git a/packages/twenty-server/src/modules/workflow/workflow-runner/jobs/run-workflow.job.ts b/packages/twenty-server/src/modules/workflow/workflow-runner/jobs/run-workflow.job.ts index 0f8b66b55c71..0ca2a3107a6e 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-runner/jobs/run-workflow.job.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-runner/jobs/run-workflow.job.ts @@ -1,8 +1,8 @@ import { Scope } from '@nestjs/common'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; import { WorkflowCommonWorkspaceService } from 'src/modules/workflow/common/workspace-services/workflow-common.workspace-service'; import { WorkflowRunStatus } from 'src/modules/workflow/common/standard-objects/workflow-run.workspace-entity'; import { WorkflowExecutorWorkspaceService } from 'src/modules/workflow/workflow-executor/workspace-services/workflow-executor.workspace-service'; diff --git a/packages/twenty-server/src/modules/workflow/workflow-runner/workspace-services/workflow-runner.workspace-service.ts b/packages/twenty-server/src/modules/workflow/workflow-runner/workspace-services/workflow-runner.workspace-service.ts index d3faac5f900e..e0e0020b19d0 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-runner/workspace-services/workflow-runner.workspace-service.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-runner/workspace-services/workflow-runner.workspace-service.ts @@ -1,8 +1,8 @@ import { Injectable } from '@nestjs/common'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { ActorMetadata } from 'src/engine/metadata-modules/field-metadata/composite-types/actor.composite-type'; import { RunWorkflowJob, diff --git a/packages/twenty-server/src/modules/workflow/workflow-status/jobs/workflow-statuses-update.job.ts b/packages/twenty-server/src/modules/workflow/workflow-status/jobs/workflow-statuses-update.job.ts index 9cf1e7a39985..4f4ce5886d1e 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-status/jobs/workflow-statuses-update.job.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-status/jobs/workflow-statuses-update.job.ts @@ -1,8 +1,8 @@ import { Scope } from '@nestjs/common'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager'; import { WorkflowVersionStatus } from 'src/modules/workflow/common/standard-objects/workflow-version.workspace-entity'; import { WorkflowWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow.workspace-entity'; diff --git a/packages/twenty-server/src/modules/workflow/workflow-status/listeners/workflow-version-status.listener.ts b/packages/twenty-server/src/modules/workflow/workflow-status/listeners/workflow-version-status.listener.ts index f9fe6aa1b5c2..b8e3c9619556 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-status/listeners/workflow-version-status.listener.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-status/listeners/workflow-version-status.listener.ts @@ -1,11 +1,11 @@ import { Injectable } from '@nestjs/common'; import { OnEvent } from '@nestjs/event-emitter'; -import { ObjectRecordCreateEvent } from 'src/engine/integrations/event-emitter/types/object-record-create.event'; -import { ObjectRecordDeleteEvent } from 'src/engine/integrations/event-emitter/types/object-record-delete.event'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { ObjectRecordCreateEvent } from 'src/engine/core-modules/event-emitter/types/object-record-create.event'; +import { ObjectRecordDeleteEvent } from 'src/engine/core-modules/event-emitter/types/object-record-delete.event'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { WorkspaceEventBatch } from 'src/engine/workspace-event-emitter/workspace-event.type'; import { WorkflowVersionStatus, diff --git a/packages/twenty-server/src/modules/workflow/workflow-trigger/database-event-trigger/listeners/database-event-trigger.listener.ts b/packages/twenty-server/src/modules/workflow/workflow-trigger/database-event-trigger/listeners/database-event-trigger.listener.ts index a19a990980b1..e5b62d59afc6 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-trigger/database-event-trigger/listeners/database-event-trigger.listener.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-trigger/database-event-trigger/listeners/database-event-trigger.listener.ts @@ -3,12 +3,12 @@ import { OnEvent } from '@nestjs/event-emitter'; import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum'; import { FeatureFlagService } from 'src/engine/core-modules/feature-flag/services/feature-flag.service'; -import { ObjectRecordCreateEvent } from 'src/engine/integrations/event-emitter/types/object-record-create.event'; -import { ObjectRecordDeleteEvent } from 'src/engine/integrations/event-emitter/types/object-record-delete.event'; -import { ObjectRecordUpdateEvent } from 'src/engine/integrations/event-emitter/types/object-record-update.event'; -import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; -import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service'; +import { ObjectRecordCreateEvent } from 'src/engine/core-modules/event-emitter/types/object-record-create.event'; +import { ObjectRecordDeleteEvent } from 'src/engine/core-modules/event-emitter/types/object-record-delete.event'; +import { ObjectRecordUpdateEvent } from 'src/engine/core-modules/event-emitter/types/object-record-update.event'; +import { InjectMessageQueue } from 'src/engine/core-modules/message-queue/decorators/message-queue.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; +import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { TwentyORMGlobalManager } from 'src/engine/twenty-orm/twenty-orm-global.manager'; import { WorkspaceEventBatch } from 'src/engine/workspace-event-emitter/workspace-event.type'; import { WorkflowEventListenerWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-event-listener.workspace-entity'; diff --git a/packages/twenty-server/src/modules/workflow/workflow-trigger/jobs/workflow-event-trigger.job.ts b/packages/twenty-server/src/modules/workflow/workflow-trigger/jobs/workflow-event-trigger.job.ts index 10fad4d00f12..12391290f877 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-trigger/jobs/workflow-event-trigger.job.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-trigger/jobs/workflow-event-trigger.job.ts @@ -1,8 +1,8 @@ import { Scope } from '@nestjs/common'; -import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator'; -import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator'; -import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants'; +import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator'; +import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator'; +import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; import { FieldActorSource } from 'src/engine/metadata-modules/field-metadata/composite-types/actor.composite-type'; import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager'; import { diff --git a/packages/twenty-server/src/queue-worker/queue-worker.module.ts b/packages/twenty-server/src/queue-worker/queue-worker.module.ts index bef26e3a94f4..3b8589080a12 100644 --- a/packages/twenty-server/src/queue-worker/queue-worker.module.ts +++ b/packages/twenty-server/src/queue-worker/queue-worker.module.ts @@ -1,14 +1,14 @@ import { Module } from '@nestjs/common'; -import { IntegrationsModule } from 'src/engine/integrations/integrations.module'; -import { JobsModule } from 'src/engine/integrations/message-queue/jobs.module'; -import { MessageQueueModule } from 'src/engine/integrations/message-queue/message-queue.module'; +import { JobsModule } from 'src/engine/core-modules/message-queue/jobs.module'; +import { MessageQueueModule } from 'src/engine/core-modules/message-queue/message-queue.module'; import { TwentyORMModule } from 'src/engine/twenty-orm/twenty-orm.module'; import { WorkspaceEventEmitterModule } from 'src/engine/workspace-event-emitter/workspace-event-emitter.module'; +import { CoreEngineModule } from 'src/engine/core-modules/core-engine.module'; @Module({ imports: [ - IntegrationsModule, + CoreEngineModule, MessageQueueModule.registerExplorer(), WorkspaceEventEmitterModule, JobsModule, diff --git a/packages/twenty-server/src/queue-worker/queue-worker.ts b/packages/twenty-server/src/queue-worker/queue-worker.ts index d38f49d306d5..71cc36ad720d 100644 --- a/packages/twenty-server/src/queue-worker/queue-worker.ts +++ b/packages/twenty-server/src/queue-worker/queue-worker.ts @@ -1,7 +1,7 @@ import { NestFactory } from '@nestjs/core'; -import { ExceptionHandlerService } from 'src/engine/integrations/exception-handler/exception-handler.service'; -import { LoggerService } from 'src/engine/integrations/logger/logger.service'; +import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service'; +import { LoggerService } from 'src/engine/core-modules/logger/logger.service'; import { shouldFilterException } from 'src/engine/utils/global-exception-handler.util'; import { QueueWorkerModule } from 'src/queue-worker/queue-worker.module'; From d0d9376f0d1589f4b83decae0e653a8a8846c30b Mon Sep 17 00:00:00 2001 From: martmull <martmull@hotmail.fr> Date: Wed, 11 Sep 2024 16:36:25 +0200 Subject: [PATCH 23/24] Fix lint --- .../core-modules/captcha/interfaces/index.ts | 2 +- .../environment/environment-variables.ts | 15 +++++++-------- .../environment/environment.module.ts | 6 +++--- .../environment/environment.service.spec.ts | 2 +- .../exception-handler.module-definition.ts | 2 +- .../exception-handler/exception-handler.module.ts | 14 +++++++------- .../exception-handler-driver.interface.ts | 4 ++-- .../exception-handler-options.interface.ts | 2 +- .../exception-handler/interfaces/index.ts | 4 ++-- .../file-storage/drivers/local.driver.ts | 3 +-- .../file-storage/drivers/s3.driver.ts | 3 +-- .../file-storage.module-definition.ts | 2 +- .../file-storage/file-storage.module.ts | 11 +++++------ .../file-storage/file-storage.service.ts | 4 ++-- .../core-modules/file-storage/interfaces/index.ts | 2 +- .../core-modules/logger/interfaces/index.ts | 2 +- .../logger/logger.module-definition.ts | 2 +- .../engine/core-modules/logger/logger.module.ts | 10 +++++----- .../engine/core-modules/logger/logger.service.ts | 2 +- .../message-queue/drivers/bullmq.driver.ts | 3 +-- .../message-queue/drivers/pg-boss.driver.ts | 3 +-- .../message-queue/drivers/sync.driver.ts | 3 +-- .../message-queue/interfaces/index.ts | 2 +- .../message-queue/message-queue.explorer.ts | 4 ++-- packages/twenty-server/src/main.ts | 2 +- 25 files changed, 51 insertions(+), 58 deletions(-) diff --git a/packages/twenty-server/src/engine/core-modules/captcha/interfaces/index.ts b/packages/twenty-server/src/engine/core-modules/captcha/interfaces/index.ts index 24484ea4bc81..27ebd3e56f6b 100644 --- a/packages/twenty-server/src/engine/core-modules/captcha/interfaces/index.ts +++ b/packages/twenty-server/src/engine/core-modules/captcha/interfaces/index.ts @@ -1 +1 @@ -export * from 'packages/twenty-server/src/engine/core-modules/captcha/interfaces/captcha.interface'; +export * from 'src/engine/core-modules/captcha/interfaces/captcha.interface'; diff --git a/packages/twenty-server/src/engine/core-modules/environment/environment-variables.ts b/packages/twenty-server/src/engine/core-modules/environment/environment-variables.ts index 04052f64fe4c..eb4c7f8b9fea 100644 --- a/packages/twenty-server/src/engine/core-modules/environment/environment-variables.ts +++ b/packages/twenty-server/src/engine/core-modules/environment/environment-variables.ts @@ -14,11 +14,18 @@ import { ValidateIf, validateSync, } from 'class-validator'; +import { CastToBoolean } from 'src/engine/core-modules/environment/decorators/cast-to-boolean.decorator'; +import { CastToLogLevelArray } from 'src/engine/core-modules/environment/decorators/cast-to-log-level-array.decorator'; +import { CastToPositiveNumber } from 'src/engine/core-modules/environment/decorators/cast-to-positive-number.decorator'; +import { IsAWSRegion } from 'src/engine/core-modules/environment/decorators/is-aws-region.decorator'; +import { IsDuration } from 'src/engine/core-modules/environment/decorators/is-duration.decorator'; import { EmailDriver } from 'src/engine/core-modules/email/interfaces/email.interface'; import { NodeEnvironment } from 'src/engine/core-modules/environment/interfaces/node-environment.interface'; import { LLMChatModelDriver } from 'src/engine/core-modules/llm-chat-model/interfaces/llm-chat-model.interface'; import { LLMTracingDriver } from 'src/engine/core-modules/llm-tracing/interfaces/llm-tracing.interface'; +import { AwsRegion } from 'src/engine/core-modules/environment/interfaces/aws-region.interface'; +import { SupportDriver } from 'src/engine/core-modules/environment/interfaces/support.interface'; import { CacheStorageType } from 'src/engine/core-modules/cache-storage/types/cache-storage-type.enum'; import { CaptchaDriverType } from 'src/engine/core-modules/captcha/interfaces'; @@ -31,14 +38,6 @@ import { MessageQueueDriverType } from 'src/engine/core-modules/message-queue/in import { ServerlessDriverType } from 'src/engine/core-modules/serverless/serverless.interface'; import { assert } from 'src/utils/assert'; -import { CastToBoolean } from 'packages/twenty-server/src/engine/core-modules/environment/decorators/cast-to-boolean.decorator'; -import { CastToLogLevelArray } from 'packages/twenty-server/src/engine/core-modules/environment/decorators/cast-to-log-level-array.decorator'; -import { CastToPositiveNumber } from 'packages/twenty-server/src/engine/core-modules/environment/decorators/cast-to-positive-number.decorator'; -import { IsAWSRegion } from 'packages/twenty-server/src/engine/core-modules/environment/decorators/is-aws-region.decorator'; -import { IsDuration } from 'packages/twenty-server/src/engine/core-modules/environment/decorators/is-duration.decorator'; -import { AwsRegion } from 'packages/twenty-server/src/engine/core-modules/environment/interfaces/aws-region.interface'; -import { SupportDriver } from 'packages/twenty-server/src/engine/core-modules/environment/interfaces/support.interface'; - export class EnvironmentVariables { // Misc @CastToBoolean() diff --git a/packages/twenty-server/src/engine/core-modules/environment/environment.module.ts b/packages/twenty-server/src/engine/core-modules/environment/environment.module.ts index a3d4d48888c0..a80214e7d55a 100644 --- a/packages/twenty-server/src/engine/core-modules/environment/environment.module.ts +++ b/packages/twenty-server/src/engine/core-modules/environment/environment.module.ts @@ -1,9 +1,9 @@ import { Global, Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; -import { EnvironmentService } from 'packages/twenty-server/src/engine/core-modules/environment/environment.service'; -import { ConfigurableModuleClass } from 'packages/twenty-server/src/engine/core-modules/environment/environment.module-definition'; -import { validate } from 'packages/twenty-server/src/engine/core-modules/environment/environment-variables'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; +import { ConfigurableModuleClass } from 'src/engine/core-modules/environment/environment.module-definition'; +import { validate } from 'src/engine/core-modules/environment/environment-variables'; @Global() @Module({ diff --git a/packages/twenty-server/src/engine/core-modules/environment/environment.service.spec.ts b/packages/twenty-server/src/engine/core-modules/environment/environment.service.spec.ts index 8424e196adbe..49b35947d769 100644 --- a/packages/twenty-server/src/engine/core-modules/environment/environment.service.spec.ts +++ b/packages/twenty-server/src/engine/core-modules/environment/environment.service.spec.ts @@ -1,7 +1,7 @@ import { Test, TestingModule } from '@nestjs/testing'; import { ConfigService } from '@nestjs/config'; -import { EnvironmentService } from 'packages/twenty-server/src/engine/core-modules/environment/environment.service'; +import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; describe('EnvironmentService', () => { let service: EnvironmentService; diff --git a/packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module-definition.ts b/packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module-definition.ts index f9965a0823e6..fd0d3a1ccf27 100644 --- a/packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module-definition.ts +++ b/packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module-definition.ts @@ -1,6 +1,6 @@ import { ConfigurableModuleBuilder } from '@nestjs/common'; -import { ExceptionHandlerModuleOptions } from 'packages/twenty-server/src/engine/core-modules/exception-handler/interfaces'; +import { ExceptionHandlerModuleOptions } from 'src/engine/core-modules/exception-handler/interfaces'; export const { ConfigurableModuleClass, diff --git a/packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module.ts b/packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module.ts index 760d8b925b92..fa145d413a2c 100644 --- a/packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module.ts +++ b/packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module.ts @@ -1,16 +1,16 @@ import { DynamicModule, Global, Module } from '@nestjs/common'; -import { ExceptionHandlerSentryDriver } from 'src/engine/core-modules/exception-handler/drivers/sentry.driver'; -import { ExceptionHandlerConsoleDriver } from 'src/engine/core-modules/exception-handler/drivers/console.driver'; - -import { ExceptionHandlerService } from 'packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.service'; -import { ExceptionHandlerDriver } from 'packages/twenty-server/src/engine/core-modules/exception-handler/interfaces'; -import { EXCEPTION_HANDLER_DRIVER } from 'packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.constants'; +import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service'; +import { ExceptionHandlerDriver } from 'src/engine/core-modules/exception-handler/interfaces'; +import { EXCEPTION_HANDLER_DRIVER } from 'src/engine/core-modules/exception-handler/exception-handler.constants'; import { ConfigurableModuleClass, OPTIONS_TYPE, ASYNC_OPTIONS_TYPE, -} from 'packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module-definition'; +} from 'src/engine/core-modules/exception-handler/exception-handler.module-definition'; + +import { ExceptionHandlerConsoleDriver } from 'src/engine/core-modules/exception-handler/drivers/console.driver'; +import { ExceptionHandlerSentryDriver } from 'src/engine/core-modules/exception-handler/drivers/sentry.driver'; @Global() @Module({ diff --git a/packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler-driver.interface.ts b/packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler-driver.interface.ts index 9c6ccb6ae118..361d867fff89 100644 --- a/packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler-driver.interface.ts +++ b/packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler-driver.interface.ts @@ -1,5 +1,5 @@ -import { ExceptionHandlerOptions } from 'packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler-options.interface'; -import { ExceptionHandlerUser } from 'packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler-user.interface'; +import { ExceptionHandlerOptions } from 'src/engine/core-modules/exception-handler/interfaces/exception-handler-options.interface'; +import { ExceptionHandlerUser } from 'src/engine/core-modules/exception-handler/interfaces/exception-handler-user.interface'; export interface ExceptionHandlerDriverInterface { captureExceptions( diff --git a/packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler-options.interface.ts b/packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler-options.interface.ts index c6842717d7a4..73dd468ac11e 100644 --- a/packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler-options.interface.ts +++ b/packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler-options.interface.ts @@ -1,6 +1,6 @@ import { OperationTypeNode } from 'graphql'; -import { ExceptionHandlerUser } from 'packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler-user.interface'; +import { ExceptionHandlerUser } from 'src/engine/core-modules/exception-handler/interfaces/exception-handler-user.interface'; export interface ExceptionHandlerOptions { operation?: { diff --git a/packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/index.ts b/packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/index.ts index d3f22e0f7278..7ebf9f6c72d8 100644 --- a/packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/index.ts +++ b/packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/index.ts @@ -1,2 +1,2 @@ -export * from 'packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler.interface'; -export * from 'packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler-driver.interface'; +export * from 'src/engine/core-modules/exception-handler/interfaces/exception-handler.interface'; +export * from 'src/engine/core-modules/exception-handler/interfaces/exception-handler-driver.interface'; diff --git a/packages/twenty-server/src/engine/core-modules/file-storage/drivers/local.driver.ts b/packages/twenty-server/src/engine/core-modules/file-storage/drivers/local.driver.ts index 6ecdf4e08e97..3bbcc5493646 100644 --- a/packages/twenty-server/src/engine/core-modules/file-storage/drivers/local.driver.ts +++ b/packages/twenty-server/src/engine/core-modules/file-storage/drivers/local.driver.ts @@ -7,8 +7,7 @@ import { FileStorageException, FileStorageExceptionCode, } from 'src/engine/core-modules/file-storage/interfaces/file-storage-exception'; - -import { StorageDriver } from 'packages/twenty-server/src/engine/core-modules/file-storage/drivers/interfaces/storage-driver.interface'; +import { StorageDriver } from 'src/engine/core-modules/file-storage/drivers/interfaces/storage-driver.interface'; export interface LocalDriverOptions { storagePath: string; diff --git a/packages/twenty-server/src/engine/core-modules/file-storage/drivers/s3.driver.ts b/packages/twenty-server/src/engine/core-modules/file-storage/drivers/s3.driver.ts index 11d857eb5705..765ded5b0068 100644 --- a/packages/twenty-server/src/engine/core-modules/file-storage/drivers/s3.driver.ts +++ b/packages/twenty-server/src/engine/core-modules/file-storage/drivers/s3.driver.ts @@ -19,11 +19,10 @@ import { FileStorageException, FileStorageExceptionCode, } from 'src/engine/core-modules/file-storage/interfaces/file-storage-exception'; +import { StorageDriver } from 'src/engine/core-modules/file-storage/drivers/interfaces/storage-driver.interface'; import { isDefined } from 'src/utils/is-defined'; -import { StorageDriver } from 'packages/twenty-server/src/engine/core-modules/file-storage/drivers/interfaces/storage-driver.interface'; - export interface S3DriverOptions extends S3ClientConfig { bucketName: string; endpoint?: string; diff --git a/packages/twenty-server/src/engine/core-modules/file-storage/file-storage.module-definition.ts b/packages/twenty-server/src/engine/core-modules/file-storage/file-storage.module-definition.ts index c9c10ba52d4b..4d453abf4631 100644 --- a/packages/twenty-server/src/engine/core-modules/file-storage/file-storage.module-definition.ts +++ b/packages/twenty-server/src/engine/core-modules/file-storage/file-storage.module-definition.ts @@ -1,6 +1,6 @@ import { ConfigurableModuleBuilder } from '@nestjs/common'; -import { FileStorageModuleOptions } from 'packages/twenty-server/src/engine/core-modules/file-storage/interfaces'; +import { FileStorageModuleOptions } from 'src/engine/core-modules/file-storage/interfaces'; export const { ConfigurableModuleClass, diff --git a/packages/twenty-server/src/engine/core-modules/file-storage/file-storage.module.ts b/packages/twenty-server/src/engine/core-modules/file-storage/file-storage.module.ts index bb58af96850c..7c8a5e683572 100644 --- a/packages/twenty-server/src/engine/core-modules/file-storage/file-storage.module.ts +++ b/packages/twenty-server/src/engine/core-modules/file-storage/file-storage.module.ts @@ -1,14 +1,13 @@ import { DynamicModule, Global } from '@nestjs/common'; -import { FileStorageService } from 'packages/twenty-server/src/engine/core-modules/file-storage/file-storage.service'; +import { FileStorageService } from 'src/engine/core-modules/file-storage/file-storage.service'; import { FileStorageModuleAsyncOptions, FileStorageModuleOptions, -} from 'packages/twenty-server/src/engine/core-modules/file-storage/interfaces'; -import { STORAGE_DRIVER } from 'packages/twenty-server/src/engine/core-modules/file-storage/file-storage.constants'; - -import { LocalDriver } from 'packages/twenty-server/src/engine/core-modules/file-storage/drivers/local.driver'; -import { S3Driver } from 'packages/twenty-server/src/engine/core-modules/file-storage/drivers/s3.driver'; +} from 'src/engine/core-modules/file-storage/interfaces'; +import { STORAGE_DRIVER } from 'src/engine/core-modules/file-storage/file-storage.constants'; +import { LocalDriver } from 'src/engine/core-modules/file-storage/drivers/local.driver'; +import { S3Driver } from 'src/engine/core-modules/file-storage/drivers/s3.driver'; @Global() export class FileStorageModule { diff --git a/packages/twenty-server/src/engine/core-modules/file-storage/file-storage.service.ts b/packages/twenty-server/src/engine/core-modules/file-storage/file-storage.service.ts index d530493598e5..df491f3a46a5 100644 --- a/packages/twenty-server/src/engine/core-modules/file-storage/file-storage.service.ts +++ b/packages/twenty-server/src/engine/core-modules/file-storage/file-storage.service.ts @@ -2,9 +2,9 @@ import { Inject, Injectable } from '@nestjs/common'; import { Readable } from 'stream'; -import { STORAGE_DRIVER } from 'packages/twenty-server/src/engine/core-modules/file-storage/file-storage.constants'; +import { STORAGE_DRIVER } from 'src/engine/core-modules/file-storage/file-storage.constants'; -import { StorageDriver } from 'packages/twenty-server/src/engine/core-modules/file-storage/drivers/interfaces/storage-driver.interface'; +import { StorageDriver } from 'src/engine/core-modules/file-storage/drivers/interfaces/storage-driver.interface'; @Injectable() export class FileStorageService implements StorageDriver { diff --git a/packages/twenty-server/src/engine/core-modules/file-storage/interfaces/index.ts b/packages/twenty-server/src/engine/core-modules/file-storage/interfaces/index.ts index abfccbe34b10..4ab4d7061882 100644 --- a/packages/twenty-server/src/engine/core-modules/file-storage/interfaces/index.ts +++ b/packages/twenty-server/src/engine/core-modules/file-storage/interfaces/index.ts @@ -1 +1 @@ -export * from 'packages/twenty-server/src/engine/core-modules/file-storage/interfaces/file-storage.interface'; +export * from 'src/engine/core-modules/file-storage/interfaces/file-storage.interface'; diff --git a/packages/twenty-server/src/engine/core-modules/logger/interfaces/index.ts b/packages/twenty-server/src/engine/core-modules/logger/interfaces/index.ts index 42dc74685571..b9de22413558 100644 --- a/packages/twenty-server/src/engine/core-modules/logger/interfaces/index.ts +++ b/packages/twenty-server/src/engine/core-modules/logger/interfaces/index.ts @@ -1 +1 @@ -export * from 'packages/twenty-server/src/engine/core-modules/logger/interfaces/logger.interface'; +export * from 'src/engine/core-modules/logger/interfaces/logger.interface'; diff --git a/packages/twenty-server/src/engine/core-modules/logger/logger.module-definition.ts b/packages/twenty-server/src/engine/core-modules/logger/logger.module-definition.ts index 3511bc65db37..40af6dfdd131 100644 --- a/packages/twenty-server/src/engine/core-modules/logger/logger.module-definition.ts +++ b/packages/twenty-server/src/engine/core-modules/logger/logger.module-definition.ts @@ -1,6 +1,6 @@ import { ConfigurableModuleBuilder } from '@nestjs/common'; -import { LoggerModuleOptions } from 'packages/twenty-server/src/engine/core-modules/logger/interfaces'; +import { LoggerModuleOptions } from 'src/engine/core-modules/logger/interfaces'; export const { ConfigurableModuleClass, diff --git a/packages/twenty-server/src/engine/core-modules/logger/logger.module.ts b/packages/twenty-server/src/engine/core-modules/logger/logger.module.ts index d7c1d6899068..bc290b066dcd 100644 --- a/packages/twenty-server/src/engine/core-modules/logger/logger.module.ts +++ b/packages/twenty-server/src/engine/core-modules/logger/logger.module.ts @@ -1,14 +1,14 @@ import { DynamicModule, Global, ConsoleLogger, Module } from '@nestjs/common'; -import { LoggerDriverType } from 'src/engine/core-modules/logger/interfaces'; - -import { LoggerService } from 'packages/twenty-server/src/engine/core-modules/logger/logger.service'; -import { LOGGER_DRIVER } from 'packages/twenty-server/src/engine/core-modules/logger/logger.constants'; +import { LoggerService } from 'src/engine/core-modules/logger/logger.service'; +import { LOGGER_DRIVER } from 'src/engine/core-modules/logger/logger.constants'; import { ASYNC_OPTIONS_TYPE, ConfigurableModuleClass, OPTIONS_TYPE, -} from 'packages/twenty-server/src/engine/core-modules/logger/logger.module-definition'; +} from 'src/engine/core-modules/logger/logger.module-definition'; + +import { LoggerDriverType } from 'src/engine/core-modules/logger/interfaces'; @Global() @Module({ diff --git a/packages/twenty-server/src/engine/core-modules/logger/logger.service.ts b/packages/twenty-server/src/engine/core-modules/logger/logger.service.ts index d06098df4f78..8d363bb325ab 100644 --- a/packages/twenty-server/src/engine/core-modules/logger/logger.service.ts +++ b/packages/twenty-server/src/engine/core-modules/logger/logger.service.ts @@ -5,7 +5,7 @@ import { LoggerService as LoggerServiceInterface, } from '@nestjs/common'; -import { LOGGER_DRIVER } from 'packages/twenty-server/src/engine/core-modules/logger/logger.constants'; +import { LOGGER_DRIVER } from 'src/engine/core-modules/logger/logger.constants'; @Injectable() export class LoggerService implements LoggerServiceInterface { diff --git a/packages/twenty-server/src/engine/core-modules/message-queue/drivers/bullmq.driver.ts b/packages/twenty-server/src/engine/core-modules/message-queue/drivers/bullmq.driver.ts index cf89d1f2d476..cf4c414c8902 100644 --- a/packages/twenty-server/src/engine/core-modules/message-queue/drivers/bullmq.driver.ts +++ b/packages/twenty-server/src/engine/core-modules/message-queue/drivers/bullmq.driver.ts @@ -9,11 +9,10 @@ import { } from 'src/engine/core-modules/message-queue/drivers/interfaces/job-options.interface'; import { MessageQueueJob } from 'src/engine/core-modules/message-queue/interfaces/message-queue-job.interface'; import { MessageQueueWorkerOptions } from 'src/engine/core-modules/message-queue/interfaces/message-queue-worker-options.interface'; +import { MessageQueueDriver } from 'src/engine/core-modules/message-queue/drivers/interfaces/message-queue-driver.interface'; import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; -import { MessageQueueDriver } from 'packages/twenty-server/src/engine/core-modules/message-queue/drivers/interfaces/message-queue-driver.interface'; - export type BullMQDriverOptions = QueueOptions; export class BullMQDriver implements MessageQueueDriver, OnModuleDestroy { diff --git a/packages/twenty-server/src/engine/core-modules/message-queue/drivers/pg-boss.driver.ts b/packages/twenty-server/src/engine/core-modules/message-queue/drivers/pg-boss.driver.ts index 9664976af280..341fbc34802b 100644 --- a/packages/twenty-server/src/engine/core-modules/message-queue/drivers/pg-boss.driver.ts +++ b/packages/twenty-server/src/engine/core-modules/message-queue/drivers/pg-boss.driver.ts @@ -8,11 +8,10 @@ import { } from 'src/engine/core-modules/message-queue/drivers/interfaces/job-options.interface'; import { MessageQueueJob } from 'src/engine/core-modules/message-queue/interfaces/message-queue-job.interface'; import { MessageQueueWorkerOptions } from 'src/engine/core-modules/message-queue/interfaces/message-queue-worker-options.interface'; +import { MessageQueueDriver } from 'src/engine/core-modules/message-queue/drivers/interfaces/message-queue-driver.interface'; import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; -import { MessageQueueDriver } from 'packages/twenty-server/src/engine/core-modules/message-queue/drivers/interfaces/message-queue-driver.interface'; - export type PgBossDriverOptions = PgBoss.ConstructorOptions; const DEFAULT_PG_BOSS_CRON_PATTERN_WHEN_NOT_PROVIDED = '*/1 * * * *'; diff --git a/packages/twenty-server/src/engine/core-modules/message-queue/drivers/sync.driver.ts b/packages/twenty-server/src/engine/core-modules/message-queue/drivers/sync.driver.ts index 293047f7825a..1d7db2953aa6 100644 --- a/packages/twenty-server/src/engine/core-modules/message-queue/drivers/sync.driver.ts +++ b/packages/twenty-server/src/engine/core-modules/message-queue/drivers/sync.driver.ts @@ -4,11 +4,10 @@ import { MessageQueueJobData, MessageQueueJob, } from 'src/engine/core-modules/message-queue/interfaces/message-queue-job.interface'; +import { MessageQueueDriver } from 'src/engine/core-modules/message-queue/drivers/interfaces/message-queue-driver.interface'; import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queue.constants'; -import { MessageQueueDriver } from 'packages/twenty-server/src/engine/core-modules/message-queue/drivers/interfaces/message-queue-driver.interface'; - export class SyncDriver implements MessageQueueDriver { private readonly logger = new Logger(SyncDriver.name); private workersMap: { diff --git a/packages/twenty-server/src/engine/core-modules/message-queue/interfaces/index.ts b/packages/twenty-server/src/engine/core-modules/message-queue/interfaces/index.ts index e3e8ece28e9c..dfeb67000668 100644 --- a/packages/twenty-server/src/engine/core-modules/message-queue/interfaces/index.ts +++ b/packages/twenty-server/src/engine/core-modules/message-queue/interfaces/index.ts @@ -1 +1 @@ -export * from 'packages/twenty-server/src/engine/core-modules/message-queue/interfaces/message-queue-module-options.interface'; +export * from 'src/engine/core-modules/message-queue/interfaces/message-queue-module-options.interface'; diff --git a/packages/twenty-server/src/engine/core-modules/message-queue/message-queue.explorer.ts b/packages/twenty-server/src/engine/core-modules/message-queue/message-queue.explorer.ts index 87108b6fd3ea..813afcfb6d3d 100644 --- a/packages/twenty-server/src/engine/core-modules/message-queue/message-queue.explorer.ts +++ b/packages/twenty-server/src/engine/core-modules/message-queue/message-queue.explorer.ts @@ -9,6 +9,8 @@ import { Module } from '@nestjs/core/injector/module'; import { Injector } from '@nestjs/core/injector/injector'; import { InstanceWrapper } from '@nestjs/core/injector/instance-wrapper'; +import { MessageQueueMetadataAccessor } from 'src/engine/core-modules/message-queue/message-queue-metadata.accessor'; + import { MessageQueueWorkerOptions } from 'src/engine/core-modules/message-queue/interfaces/message-queue-worker-options.interface'; import { MessageQueueJob, @@ -20,8 +22,6 @@ import { getQueueToken } from 'src/engine/core-modules/message-queue/utils/get-q import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service'; import { shouldFilterException } from 'src/engine/utils/global-exception-handler.util'; -import { MessageQueueMetadataAccessor } from 'packages/twenty-server/src/engine/core-modules/message-queue/message-queue-metadata.accessor'; - interface ProcessorGroup { instance: object; host: Module; diff --git a/packages/twenty-server/src/main.ts b/packages/twenty-server/src/main.ts index b2f24c0e7412..af97bdb34497 100644 --- a/packages/twenty-server/src/main.ts +++ b/packages/twenty-server/src/main.ts @@ -9,11 +9,11 @@ import { useContainer } from 'class-validator'; import { graphqlUploadExpress } from 'graphql-upload'; import { ApplyCorsToExceptions } from 'src/utils/apply-cors-to-exceptions'; +import { LoggerService } from 'src/engine/core-modules/logger/logger.service'; import { AppModule } from './app.module'; import { settings } from './engine/constants/settings'; -import { LoggerService } from 'src/engine/core-modules/logger/logger.service'; import { generateFrontConfig } from './utils/generate-front-config'; const bootstrap = async () => { From 7afe454d8f61af716f4efd0f24f836bf27ee6439 Mon Sep 17 00:00:00 2001 From: martmull <martmull@hotmail.fr> Date: Wed, 11 Sep 2024 17:57:17 +0200 Subject: [PATCH 24/24] WIP: move workflow actions to dedicated modules --- .../src/modules/workflow/constants/Actions.ts | 2 +- .../src/modules/workflow/types/Workflow.ts | 4 +-- .../__tests__/addCreateStepNodes.test.ts | 4 +-- .../__tests__/generateWorkflowDiagram.test.ts | 8 ++--- .../getWorkflowVersionDiagram.test.ts | 2 +- .../utils/__tests__/insertStep.test.ts | 16 ++++----- .../utils/__tests__/replaceStep.test.ts | 8 ++--- .../utils/getStepDefaultDefinition.ts | 4 +-- .../environment/environment-variables.ts | 10 +++--- .../exception-handler.module.ts | 1 - .../file-storage/file-storage.service.ts | 4 +-- .../core-modules/logger/logger.module.ts | 1 - .../message-queue/message-queue.explorer.ts | 3 +- .../send-email.workflow-action.ts} | 10 +++--- .../workflow-actions/code.workflow-action.ts} | 8 ++--- .../workflow-version.workspace-entity.ts | 2 +- .../factories/workflow-action.factory.ts | 33 +++++++++++++++++++ .../workflow-step-executor.factory.ts | 33 ------------------- .../interfaces/workflow-action.interface.ts | 12 +++++++ .../workflow-step-executor.interface.ts | 12 ------- .../types/workflow-action-result.type.ts | 10 ++++++ ...w-step.type.ts => workflow-action.type.ts} | 10 +++--- .../types/workflow-step-result.type.ts | 10 ------ .../workflow-executor.module.ts | 12 +++---- .../workflow-executor.workspace-service.ts | 14 +++----- 25 files changed, 113 insertions(+), 120 deletions(-) rename packages/twenty-server/src/modules/{workflow/workflow-executor/factories/workflow-step-executors/send-email.workflow-step-executor.ts => mail-sender/workflow-actions/send-email.workflow-action.ts} (86%) rename packages/twenty-server/src/modules/{workflow/workflow-executor/factories/workflow-step-executors/code.workflow-step-executor.ts => serverless/workflow-actions/code.workflow-action.ts} (86%) create mode 100644 packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-action.factory.ts delete mode 100644 packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor.factory.ts create mode 100644 packages/twenty-server/src/modules/workflow/workflow-executor/interfaces/workflow-action.interface.ts delete mode 100644 packages/twenty-server/src/modules/workflow/workflow-executor/interfaces/workflow-step-executor.interface.ts create mode 100644 packages/twenty-server/src/modules/workflow/workflow-executor/types/workflow-action-result.type.ts rename packages/twenty-server/src/modules/workflow/workflow-executor/types/{workflow-step.type.ts => workflow-action.type.ts} (72%) delete mode 100644 packages/twenty-server/src/modules/workflow/workflow-executor/types/workflow-step-result.type.ts diff --git a/packages/twenty-front/src/modules/workflow/constants/Actions.ts b/packages/twenty-front/src/modules/workflow/constants/Actions.ts index 9c094c2d6a8b..53c988420e59 100644 --- a/packages/twenty-front/src/modules/workflow/constants/Actions.ts +++ b/packages/twenty-front/src/modules/workflow/constants/Actions.ts @@ -8,7 +8,7 @@ export const ACTIONS: Array<{ }> = [ { label: 'Serverless Function', - type: 'CODE_ACTION', + type: 'CODE', icon: IconSettingsAutomation, }, ]; diff --git a/packages/twenty-front/src/modules/workflow/types/Workflow.ts b/packages/twenty-front/src/modules/workflow/types/Workflow.ts index c863135886f2..08f24047374f 100644 --- a/packages/twenty-front/src/modules/workflow/types/Workflow.ts +++ b/packages/twenty-front/src/modules/workflow/types/Workflow.ts @@ -13,7 +13,7 @@ export type WorkflowCodeSettingsType = WorkflowBaseSettingsType & { serverlessFunctionId: string; }; -export type WorkflowActionType = 'CODE_ACTION'; +export type WorkflowActionType = 'CODE'; type CommonWorkflowAction = { id: string; @@ -22,7 +22,7 @@ type CommonWorkflowAction = { }; type WorkflowCodeAction = CommonWorkflowAction & { - type: 'CODE_ACTION'; + type: 'CODE'; settings: WorkflowCodeSettingsType; }; diff --git a/packages/twenty-front/src/modules/workflow/utils/__tests__/addCreateStepNodes.test.ts b/packages/twenty-front/src/modules/workflow/utils/__tests__/addCreateStepNodes.test.ts index e3326c795be0..d0f46dde3576 100644 --- a/packages/twenty-front/src/modules/workflow/utils/__tests__/addCreateStepNodes.test.ts +++ b/packages/twenty-front/src/modules/workflow/utils/__tests__/addCreateStepNodes.test.ts @@ -14,7 +14,7 @@ describe('addCreateStepNodes', () => { { id: 'step1', name: 'Step 1', - type: 'CODE_ACTION', + type: 'CODE', valid: true, settings: { errorHandlingOptions: { @@ -27,7 +27,7 @@ describe('addCreateStepNodes', () => { { id: 'step2', name: 'Step 2', - type: 'CODE_ACTION', + type: 'CODE', valid: true, settings: { errorHandlingOptions: { diff --git a/packages/twenty-front/src/modules/workflow/utils/__tests__/generateWorkflowDiagram.test.ts b/packages/twenty-front/src/modules/workflow/utils/__tests__/generateWorkflowDiagram.test.ts index 675470915150..ee4643fcb20b 100644 --- a/packages/twenty-front/src/modules/workflow/utils/__tests__/generateWorkflowDiagram.test.ts +++ b/packages/twenty-front/src/modules/workflow/utils/__tests__/generateWorkflowDiagram.test.ts @@ -35,7 +35,7 @@ describe('generateWorkflowDiagram', () => { { id: 'step1', name: 'Step 1', - type: 'CODE_ACTION', + type: 'CODE', valid: true, settings: { errorHandlingOptions: { @@ -48,7 +48,7 @@ describe('generateWorkflowDiagram', () => { { id: 'step2', name: 'Step 2', - type: 'CODE_ACTION', + type: 'CODE', valid: true, settings: { errorHandlingOptions: { @@ -88,7 +88,7 @@ describe('generateWorkflowDiagram', () => { { id: 'step1', name: 'Step 1', - type: 'CODE_ACTION', + type: 'CODE', valid: true, settings: { errorHandlingOptions: { @@ -101,7 +101,7 @@ describe('generateWorkflowDiagram', () => { { id: 'step2', name: 'Step 2', - type: 'CODE_ACTION', + type: 'CODE', valid: true, settings: { errorHandlingOptions: { diff --git a/packages/twenty-front/src/modules/workflow/utils/__tests__/getWorkflowVersionDiagram.test.ts b/packages/twenty-front/src/modules/workflow/utils/__tests__/getWorkflowVersionDiagram.test.ts index e7fb4ca55e36..c730cba29b03 100644 --- a/packages/twenty-front/src/modules/workflow/utils/__tests__/getWorkflowVersionDiagram.test.ts +++ b/packages/twenty-front/src/modules/workflow/utils/__tests__/getWorkflowVersionDiagram.test.ts @@ -60,7 +60,7 @@ describe('getWorkflowVersionDiagram', () => { }, serverlessFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', }, - type: 'CODE_ACTION', + type: 'CODE', valid: true, }, ], diff --git a/packages/twenty-front/src/modules/workflow/utils/__tests__/insertStep.test.ts b/packages/twenty-front/src/modules/workflow/utils/__tests__/insertStep.test.ts index c9e7b3fb00bc..ba93aa6c341e 100644 --- a/packages/twenty-front/src/modules/workflow/utils/__tests__/insertStep.test.ts +++ b/packages/twenty-front/src/modules/workflow/utils/__tests__/insertStep.test.ts @@ -27,7 +27,7 @@ describe('insertStep', () => { }, serverlessFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', }, - type: 'CODE_ACTION', + type: 'CODE', valid: true, }; @@ -65,7 +65,7 @@ describe('insertStep', () => { }, serverlessFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', }, - type: 'CODE_ACTION', + type: 'CODE', valid: true, }; @@ -97,7 +97,7 @@ describe('insertStep', () => { }, serverlessFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', }, - type: 'CODE_ACTION', + type: 'CODE', valid: true, }, { @@ -110,7 +110,7 @@ describe('insertStep', () => { }, serverlessFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', }, - type: 'CODE_ACTION', + type: 'CODE', valid: true, }, ], @@ -131,7 +131,7 @@ describe('insertStep', () => { }, serverlessFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', }, - type: 'CODE_ACTION', + type: 'CODE', valid: true, }; @@ -167,7 +167,7 @@ describe('insertStep', () => { }, serverlessFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', }, - type: 'CODE_ACTION', + type: 'CODE', valid: true, }, { @@ -180,7 +180,7 @@ describe('insertStep', () => { }, serverlessFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', }, - type: 'CODE_ACTION', + type: 'CODE', valid: true, }, ], @@ -201,7 +201,7 @@ describe('insertStep', () => { }, serverlessFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', }, - type: 'CODE_ACTION', + type: 'CODE', valid: true, }; diff --git a/packages/twenty-front/src/modules/workflow/utils/__tests__/replaceStep.test.ts b/packages/twenty-front/src/modules/workflow/utils/__tests__/replaceStep.test.ts index b40c8e8d1e21..93286c59013e 100644 --- a/packages/twenty-front/src/modules/workflow/utils/__tests__/replaceStep.test.ts +++ b/packages/twenty-front/src/modules/workflow/utils/__tests__/replaceStep.test.ts @@ -13,7 +13,7 @@ describe('replaceStep', () => { }, serverlessFunctionId: 'first', }, - type: 'CODE_ACTION', + type: 'CODE', valid: true, } satisfies WorkflowStep; const workflowVersionInitial = { @@ -59,7 +59,7 @@ describe('replaceStep', () => { }, serverlessFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', }, - type: 'CODE_ACTION', + type: 'CODE', valid: true, }; const workflowVersionInitial = { @@ -79,7 +79,7 @@ describe('replaceStep', () => { }, serverlessFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', }, - type: 'CODE_ACTION', + type: 'CODE', valid: true, }, stepToBeReplaced, @@ -93,7 +93,7 @@ describe('replaceStep', () => { }, serverlessFunctionId: 'a5434be2-c10b-465c-acec-46492782a997', }, - type: 'CODE_ACTION', + type: 'CODE', valid: true, }, ], diff --git a/packages/twenty-front/src/modules/workflow/utils/getStepDefaultDefinition.ts b/packages/twenty-front/src/modules/workflow/utils/getStepDefaultDefinition.ts index 4c831c904613..9cb8b27e86ff 100644 --- a/packages/twenty-front/src/modules/workflow/utils/getStepDefaultDefinition.ts +++ b/packages/twenty-front/src/modules/workflow/utils/getStepDefaultDefinition.ts @@ -7,11 +7,11 @@ export const getStepDefaultDefinition = ( const newStepId = v4(); switch (type) { - case 'CODE_ACTION': { + case 'CODE': { return { id: newStepId, name: 'Code', - type: 'CODE_ACTION', + type: 'CODE', valid: false, settings: { serverlessFunctionId: '', diff --git a/packages/twenty-server/src/engine/core-modules/environment/environment-variables.ts b/packages/twenty-server/src/engine/core-modules/environment/environment-variables.ts index eb4c7f8b9fea..c676f15392f3 100644 --- a/packages/twenty-server/src/engine/core-modules/environment/environment-variables.ts +++ b/packages/twenty-server/src/engine/core-modules/environment/environment-variables.ts @@ -14,11 +14,6 @@ import { ValidateIf, validateSync, } from 'class-validator'; -import { CastToBoolean } from 'src/engine/core-modules/environment/decorators/cast-to-boolean.decorator'; -import { CastToLogLevelArray } from 'src/engine/core-modules/environment/decorators/cast-to-log-level-array.decorator'; -import { CastToPositiveNumber } from 'src/engine/core-modules/environment/decorators/cast-to-positive-number.decorator'; -import { IsAWSRegion } from 'src/engine/core-modules/environment/decorators/is-aws-region.decorator'; -import { IsDuration } from 'src/engine/core-modules/environment/decorators/is-duration.decorator'; import { EmailDriver } from 'src/engine/core-modules/email/interfaces/email.interface'; import { NodeEnvironment } from 'src/engine/core-modules/environment/interfaces/node-environment.interface'; @@ -27,6 +22,11 @@ import { LLMTracingDriver } from 'src/engine/core-modules/llm-tracing/interfaces import { AwsRegion } from 'src/engine/core-modules/environment/interfaces/aws-region.interface'; import { SupportDriver } from 'src/engine/core-modules/environment/interfaces/support.interface'; +import { IsDuration } from 'src/engine/core-modules/environment/decorators/is-duration.decorator'; +import { IsAWSRegion } from 'src/engine/core-modules/environment/decorators/is-aws-region.decorator'; +import { CastToPositiveNumber } from 'src/engine/core-modules/environment/decorators/cast-to-positive-number.decorator'; +import { CastToLogLevelArray } from 'src/engine/core-modules/environment/decorators/cast-to-log-level-array.decorator'; +import { CastToBoolean } from 'src/engine/core-modules/environment/decorators/cast-to-boolean.decorator'; import { CacheStorageType } from 'src/engine/core-modules/cache-storage/types/cache-storage-type.enum'; import { CaptchaDriverType } from 'src/engine/core-modules/captcha/interfaces'; import { CastToStringArray } from 'src/engine/core-modules/environment/decorators/cast-to-string-array.decorator'; diff --git a/packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module.ts b/packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module.ts index fa145d413a2c..6760018bffcd 100644 --- a/packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module.ts +++ b/packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module.ts @@ -8,7 +8,6 @@ import { OPTIONS_TYPE, ASYNC_OPTIONS_TYPE, } from 'src/engine/core-modules/exception-handler/exception-handler.module-definition'; - import { ExceptionHandlerConsoleDriver } from 'src/engine/core-modules/exception-handler/drivers/console.driver'; import { ExceptionHandlerSentryDriver } from 'src/engine/core-modules/exception-handler/drivers/sentry.driver'; diff --git a/packages/twenty-server/src/engine/core-modules/file-storage/file-storage.service.ts b/packages/twenty-server/src/engine/core-modules/file-storage/file-storage.service.ts index df491f3a46a5..f23822b8a374 100644 --- a/packages/twenty-server/src/engine/core-modules/file-storage/file-storage.service.ts +++ b/packages/twenty-server/src/engine/core-modules/file-storage/file-storage.service.ts @@ -2,10 +2,10 @@ import { Inject, Injectable } from '@nestjs/common'; import { Readable } from 'stream'; -import { STORAGE_DRIVER } from 'src/engine/core-modules/file-storage/file-storage.constants'; - import { StorageDriver } from 'src/engine/core-modules/file-storage/drivers/interfaces/storage-driver.interface'; +import { STORAGE_DRIVER } from 'src/engine/core-modules/file-storage/file-storage.constants'; + @Injectable() export class FileStorageService implements StorageDriver { constructor(@Inject(STORAGE_DRIVER) private driver: StorageDriver) {} diff --git a/packages/twenty-server/src/engine/core-modules/logger/logger.module.ts b/packages/twenty-server/src/engine/core-modules/logger/logger.module.ts index bc290b066dcd..4822a780b1c4 100644 --- a/packages/twenty-server/src/engine/core-modules/logger/logger.module.ts +++ b/packages/twenty-server/src/engine/core-modules/logger/logger.module.ts @@ -7,7 +7,6 @@ import { ConfigurableModuleClass, OPTIONS_TYPE, } from 'src/engine/core-modules/logger/logger.module-definition'; - import { LoggerDriverType } from 'src/engine/core-modules/logger/interfaces'; @Global() diff --git a/packages/twenty-server/src/engine/core-modules/message-queue/message-queue.explorer.ts b/packages/twenty-server/src/engine/core-modules/message-queue/message-queue.explorer.ts index 813afcfb6d3d..6e20445ebb64 100644 --- a/packages/twenty-server/src/engine/core-modules/message-queue/message-queue.explorer.ts +++ b/packages/twenty-server/src/engine/core-modules/message-queue/message-queue.explorer.ts @@ -9,14 +9,13 @@ import { Module } from '@nestjs/core/injector/module'; import { Injector } from '@nestjs/core/injector/injector'; import { InstanceWrapper } from '@nestjs/core/injector/instance-wrapper'; -import { MessageQueueMetadataAccessor } from 'src/engine/core-modules/message-queue/message-queue-metadata.accessor'; - import { MessageQueueWorkerOptions } from 'src/engine/core-modules/message-queue/interfaces/message-queue-worker-options.interface'; import { MessageQueueJob, MessageQueueJobData, } from 'src/engine/core-modules/message-queue/interfaces/message-queue-job.interface'; +import { MessageQueueMetadataAccessor } from 'src/engine/core-modules/message-queue/message-queue-metadata.accessor'; import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service'; import { getQueueToken } from 'src/engine/core-modules/message-queue/utils/get-queue-token.util'; import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service'; diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executors/send-email.workflow-step-executor.ts b/packages/twenty-server/src/modules/mail-sender/workflow-actions/send-email.workflow-action.ts similarity index 86% rename from packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executors/send-email.workflow-step-executor.ts rename to packages/twenty-server/src/modules/mail-sender/workflow-actions/send-email.workflow-action.ts index 60a6f3cfd7a9..3a17c77cf92d 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executors/send-email.workflow-step-executor.ts +++ b/packages/twenty-server/src/modules/mail-sender/workflow-actions/send-email.workflow-action.ts @@ -7,14 +7,14 @@ import DOMPurify from 'dompurify'; import { WorkflowActionEmail } from 'twenty-emails'; import { render } from '@react-email/components'; -import { WorkflowStepResult } from 'src/modules/workflow/workflow-executor/types/workflow-step-result.type'; -import { WorkflowSendEmailStep } from 'src/modules/workflow/workflow-executor/types/workflow-step.type'; +import { WorkflowActionResult } from 'src/modules/workflow/workflow-executor/types/workflow-action-result.type'; +import { WorkflowSendEmailStep } from 'src/modules/workflow/workflow-executor/types/workflow-action.type'; import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service'; import { EmailService } from 'src/engine/core-modules/email/email.service'; @Injectable() -export class SendEmailWorkflowStepExecutor { - private readonly logger = new Logger(SendEmailWorkflowStepExecutor.name); +export class SendEmailWorkflowAction { + private readonly logger = new Logger(SendEmailWorkflowAction.name); constructor( private readonly environmentService: EnvironmentService, private readonly emailService: EmailService, @@ -29,7 +29,7 @@ export class SendEmailWorkflowStepExecutor { email: string; [key: string]: string; }; - }): Promise<WorkflowStepResult> { + }): Promise<WorkflowActionResult> { try { const emailSchema = z.string().trim().email('Invalid email'); diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executors/code.workflow-step-executor.ts b/packages/twenty-server/src/modules/serverless/workflow-actions/code.workflow-action.ts similarity index 86% rename from packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executors/code.workflow-step-executor.ts rename to packages/twenty-server/src/modules/serverless/workflow-actions/code.workflow-action.ts index bdbba548e780..1e42dcf81eb0 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executors/code.workflow-step-executor.ts +++ b/packages/twenty-server/src/modules/serverless/workflow-actions/code.workflow-action.ts @@ -2,15 +2,15 @@ import { Injectable } from '@nestjs/common'; import { ServerlessFunctionService } from 'src/engine/metadata-modules/serverless-function/serverless-function.service'; import { ScopedWorkspaceContextFactory } from 'src/engine/twenty-orm/factories/scoped-workspace-context.factory'; -import { WorkflowStepResult } from 'src/modules/workflow/workflow-executor/types/workflow-step-result.type'; -import { WorkflowCodeStep } from 'src/modules/workflow/workflow-executor/types/workflow-step.type'; +import { WorkflowActionResult } from 'src/modules/workflow/workflow-executor/types/workflow-action-result.type'; +import { WorkflowCodeStep } from 'src/modules/workflow/workflow-executor/types/workflow-action.type'; import { WorkflowStepExecutorException, WorkflowStepExecutorExceptionCode, } from 'src/modules/workflow/workflow-executor/exceptions/workflow-step-executor.exception'; @Injectable() -export class CodeWorkflowStepExecutor { +export class CodeWorkflowAction { constructor( private readonly serverlessFunctionService: ServerlessFunctionService, private readonly scopedWorkspaceContextFactory: ScopedWorkspaceContextFactory, @@ -22,7 +22,7 @@ export class CodeWorkflowStepExecutor { }: { step: WorkflowCodeStep; payload?: object; - }): Promise<WorkflowStepResult> { + }): Promise<WorkflowActionResult> { const { workspaceId } = this.scopedWorkspaceContextFactory.create(); if (!workspaceId) { diff --git a/packages/twenty-server/src/modules/workflow/common/standard-objects/workflow-version.workspace-entity.ts b/packages/twenty-server/src/modules/workflow/common/standard-objects/workflow-version.workspace-entity.ts index da9b56e9b75f..80545fe7897d 100644 --- a/packages/twenty-server/src/modules/workflow/common/standard-objects/workflow-version.workspace-entity.ts +++ b/packages/twenty-server/src/modules/workflow/common/standard-objects/workflow-version.workspace-entity.ts @@ -21,7 +21,7 @@ import { import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids'; import { WorkflowRunWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-run.workspace-entity'; import { WorkflowWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow.workspace-entity'; -import { WorkflowStep } from 'src/modules/workflow/workflow-executor/types/workflow-step.type'; +import { WorkflowStep } from 'src/modules/workflow/workflow-executor/types/workflow-action.type'; import { WorkflowTrigger } from 'src/modules/workflow/workflow-trigger/types/workflow-trigger.type'; export enum WorkflowVersionStatus { diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-action.factory.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-action.factory.ts new file mode 100644 index 000000000000..5c23d81d31f4 --- /dev/null +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-action.factory.ts @@ -0,0 +1,33 @@ +import { Injectable } from '@nestjs/common'; + +import { WorkflowAction } from 'src/modules/workflow/workflow-executor/interfaces/workflow-action.interface'; + +import { WorkflowActionType } from 'src/modules/workflow/workflow-executor/types/workflow-action.type'; +import { + WorkflowStepExecutorException, + WorkflowStepExecutorExceptionCode, +} from 'src/modules/workflow/workflow-executor/exceptions/workflow-step-executor.exception'; +import { CodeWorkflowAction } from 'src/modules/serverless/workflow-actions/code.workflow-action'; +import { SendEmailWorkflowAction } from 'src/modules/mail-sender/workflow-actions/send-email.workflow-action'; + +@Injectable() +export class WorkflowActionFactory { + constructor( + private readonly codeWorkflowAction: CodeWorkflowAction, + private readonly sendEmailWorkflowAction: SendEmailWorkflowAction, + ) {} + + get(stepType: WorkflowActionType): WorkflowAction { + switch (stepType) { + case WorkflowActionType.CODE: + return this.codeWorkflowAction; + case WorkflowActionType.SEND_EMAIL: + return this.sendEmailWorkflowAction; + default: + throw new WorkflowStepExecutorException( + `Workflow step executor not found for step type '${stepType}'`, + WorkflowStepExecutorExceptionCode.INVALID_STEP_TYPE, + ); + } + } +} diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor.factory.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor.factory.ts deleted file mode 100644 index 12f660a77e19..000000000000 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/factories/workflow-step-executor.factory.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Injectable } from '@nestjs/common'; - -import { WorkflowStepExecutor } from 'src/modules/workflow/workflow-executor/interfaces/workflow-step-executor.interface'; - -import { WorkflowStepType } from 'src/modules/workflow/workflow-executor/types/workflow-step.type'; -import { - WorkflowStepExecutorException, - WorkflowStepExecutorExceptionCode, -} from 'src/modules/workflow/workflow-executor/exceptions/workflow-step-executor.exception'; -import { CodeWorkflowStepExecutor } from 'src/modules/workflow/workflow-executor/factories/workflow-step-executors/code.workflow-step-executor'; -import { SendEmailWorkflowStepExecutor } from 'src/modules/workflow/workflow-executor/factories/workflow-step-executors/send-email.workflow-step-executor'; - -@Injectable() -export class WorkflowStepExecutorFactory { - constructor( - private readonly codeWorkflowStepExecutor: CodeWorkflowStepExecutor, - private readonly sendEmailWorkflowStepExecutor: SendEmailWorkflowStepExecutor, - ) {} - - get(stepType: WorkflowStepType): WorkflowStepExecutor { - switch (stepType) { - case WorkflowStepType.CODE_ACTION: - return this.codeWorkflowStepExecutor; - case WorkflowStepType.SEND_EMAIL_ACTION: - return this.sendEmailWorkflowStepExecutor; - default: - throw new WorkflowStepExecutorException( - `Workflow step executor not found for step type '${stepType}'`, - WorkflowStepExecutorExceptionCode.INVALID_STEP_TYPE, - ); - } - } -} diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/interfaces/workflow-action.interface.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/interfaces/workflow-action.interface.ts new file mode 100644 index 000000000000..47b481949a76 --- /dev/null +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/interfaces/workflow-action.interface.ts @@ -0,0 +1,12 @@ +import { WorkflowActionResult } from 'src/modules/workflow/workflow-executor/types/workflow-action-result.type'; +import { WorkflowStep } from 'src/modules/workflow/workflow-executor/types/workflow-action.type'; + +export interface WorkflowAction { + execute({ + step, + payload, + }: { + step: WorkflowStep; + payload?: object; + }): Promise<WorkflowActionResult>; +} diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/interfaces/workflow-step-executor.interface.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/interfaces/workflow-step-executor.interface.ts deleted file mode 100644 index 9d23fc8802a0..000000000000 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/interfaces/workflow-step-executor.interface.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { WorkflowStepResult } from 'src/modules/workflow/workflow-executor/types/workflow-step-result.type'; -import { WorkflowStep } from 'src/modules/workflow/workflow-executor/types/workflow-step.type'; - -export interface WorkflowStepExecutor { - execute({ - step, - payload, - }: { - step: WorkflowStep; - payload?: object; - }): Promise<WorkflowStepResult>; -} diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/types/workflow-action-result.type.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/types/workflow-action-result.type.ts new file mode 100644 index 000000000000..b856dfb75311 --- /dev/null +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/types/workflow-action-result.type.ts @@ -0,0 +1,10 @@ +type WorkflowActionError = { + errorType: string; + errorMessage: string; + stackTrace: string; +}; + +export type WorkflowActionResult = { + result?: object; + error?: WorkflowActionError; +}; diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/types/workflow-step.type.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/types/workflow-action.type.ts similarity index 72% rename from packages/twenty-server/src/modules/workflow/workflow-executor/types/workflow-step.type.ts rename to packages/twenty-server/src/modules/workflow/workflow-executor/types/workflow-action.type.ts index 291c28dc9880..aeacb337704a 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/types/workflow-step.type.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/types/workflow-action.type.ts @@ -3,9 +3,9 @@ import { WorkflowSendEmailStepSettings, } from 'src/modules/workflow/workflow-executor/types/workflow-step-settings.type'; -export enum WorkflowStepType { - CODE_ACTION = 'CODE_ACTION', - SEND_EMAIL_ACTION = 'SEND_EMAIL_ACTION', +export enum WorkflowActionType { + CODE = 'CODE', + SEND_EMAIL = 'SEND_EMAIL', } type BaseWorkflowStep = { @@ -15,12 +15,12 @@ type BaseWorkflowStep = { }; export type WorkflowCodeStep = BaseWorkflowStep & { - type: WorkflowStepType.CODE_ACTION; + type: WorkflowActionType.CODE; settings: WorkflowCodeStepSettings; }; export type WorkflowSendEmailStep = BaseWorkflowStep & { - type: WorkflowStepType.SEND_EMAIL_ACTION; + type: WorkflowActionType.SEND_EMAIL; settings: WorkflowSendEmailStepSettings; }; diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/types/workflow-step-result.type.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/types/workflow-step-result.type.ts deleted file mode 100644 index 3b6c765284f4..000000000000 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/types/workflow-step-result.type.ts +++ /dev/null @@ -1,10 +0,0 @@ -type WorkflowError = { - errorType: string; - errorMessage: string; - stackTrace: string; -}; - -export type WorkflowStepResult = { - result?: object; - error?: WorkflowError; -}; diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.module.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.module.ts index c0a41111691a..0f68b2917c89 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.module.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/workflow-executor.module.ts @@ -2,9 +2,9 @@ import { Module } from '@nestjs/common'; import { WorkflowCommonModule } from 'src/modules/workflow/common/workflow-common.module'; import { WorkflowExecutorWorkspaceService } from 'src/modules/workflow/workflow-executor/workspace-services/workflow-executor.workspace-service'; -import { WorkflowStepExecutorFactory } from 'src/modules/workflow/workflow-executor/factories/workflow-step-executor.factory'; -import { CodeWorkflowStepExecutor } from 'src/modules/workflow/workflow-executor/factories/workflow-step-executors/code.workflow-step-executor'; -import { SendEmailWorkflowStepExecutor } from 'src/modules/workflow/workflow-executor/factories/workflow-step-executors/send-email.workflow-step-executor'; +import { WorkflowActionFactory } from 'src/modules/workflow/workflow-executor/factories/workflow-action.factory'; +import { CodeWorkflowAction } from 'src/modules/serverless/workflow-actions/code.workflow-action'; +import { SendEmailWorkflowAction } from 'src/modules/mail-sender/workflow-actions/send-email.workflow-action'; import { ServerlessFunctionModule } from 'src/engine/metadata-modules/serverless-function/serverless-function.module'; import { ScopedWorkspaceContextFactory } from 'src/engine/twenty-orm/factories/scoped-workspace-context.factory'; @@ -13,9 +13,9 @@ import { ScopedWorkspaceContextFactory } from 'src/engine/twenty-orm/factories/s providers: [ WorkflowExecutorWorkspaceService, ScopedWorkspaceContextFactory, - WorkflowStepExecutorFactory, - CodeWorkflowStepExecutor, - SendEmailWorkflowStepExecutor, + WorkflowActionFactory, + CodeWorkflowAction, + SendEmailWorkflowAction, ], exports: [WorkflowExecutorWorkspaceService], }) diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/workspace-services/workflow-executor.workspace-service.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/workspace-services/workflow-executor.workspace-service.ts index 1b9bffb4e671..593543047e06 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/workspace-services/workflow-executor.workspace-service.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/workspace-services/workflow-executor.workspace-service.ts @@ -1,11 +1,11 @@ import { Injectable } from '@nestjs/common'; -import { WorkflowStep } from 'src/modules/workflow/workflow-executor/types/workflow-step.type'; +import { WorkflowStep } from 'src/modules/workflow/workflow-executor/types/workflow-action.type'; import { WorkflowExecutorException, WorkflowExecutorExceptionCode, } from 'src/modules/workflow/workflow-executor/exceptions/workflow-executor.exception'; -import { WorkflowStepExecutorFactory } from 'src/modules/workflow/workflow-executor/factories/workflow-step-executor.factory'; +import { WorkflowActionFactory } from 'src/modules/workflow/workflow-executor/factories/workflow-action.factory'; const MAX_RETRIES_ON_FAILURE = 3; @@ -16,9 +16,7 @@ export type WorkflowExecutionOutput = { @Injectable() export class WorkflowExecutorWorkspaceService { - constructor( - private readonly workflowStepExecutorFactory: WorkflowStepExecutorFactory, - ) {} + constructor(private readonly workflowActionFactory: WorkflowActionFactory) {} async execute({ currentStepIndex, @@ -39,11 +37,9 @@ export class WorkflowExecutorWorkspaceService { const step = steps[currentStepIndex]; - const workflowStepExecutor = this.workflowStepExecutorFactory.get( - step.type, - ); + const workflowAction = this.workflowActionFactory.get(step.type); - const result = await workflowStepExecutor.execute({ + const result = await workflowAction.execute({ step, payload, });