From 518e9f6fcb27499d9b08b86169deaa7f7dc7cdb4 Mon Sep 17 00:00:00 2001 From: Gosha Date: Wed, 17 Apr 2024 00:31:22 +0300 Subject: [PATCH] refactor(echo): rename chimera to echo --- .source | 2 +- apps/api/package.json | 2 +- apps/api/src/app.module.ts | 4 +- .../send-test-email.usecase.ts | 4 +- apps/worker/package.json | 2 +- .../send-message/send-message.usecase.ts | 10 +- .../src/app/workflow/workflow.module.ts | 4 +- enterprise/packages/chimera-connect/src | 1 - enterprise/packages/chimera/src | 1 - .../echo-api}/.gitignore | 0 .../echo-api}/check-ee.mjs | 0 .../{chimera => echo/echo-api}/package.json | 2 +- enterprise/packages/echo/echo-api/src | 1 + .../{chimera => echo/echo-api}/tsconfig.json | 2 +- .../echo-api}/tsconfig.spec.json | 0 .../{web/echo => echo/echo-web}/.eslintrc.js | 0 .../{web/echo => echo/echo-web}/.gitignore | 0 .../{web/echo => echo/echo-web}/check-ee.mjs | 0 .../{web/echo => echo/echo-web}/package.json | 0 enterprise/packages/echo/echo-web/src | 1 + .../echo => echo/echo-web}/tsconfig.esm.json | 0 .../{web/echo => echo/echo-web}/tsconfig.json | 0 .../{chimera => echo/echo-worker}/.gitignore | 0 .../echo-worker}/check-ee.mjs | 0 .../echo-worker}/package.json | 2 +- enterprise/packages/echo/echo-worker/src | 1 + .../echo-worker}/tsconfig.json | 2 +- .../echo-worker}/tsconfig.spec.json | 0 enterprise/packages/web/echo/src | 1 - packages/application-generic/package.json | 2 +- .../src/usecases/add-job/add-job.usecase.ts | 14 +- .../src/utils/require-inject.ts | 23 +-- pnpm-lock.yaml | 180 +++++++++--------- pnpm-workspace.yaml | 2 +- 34 files changed, 130 insertions(+), 133 deletions(-) delete mode 120000 enterprise/packages/chimera-connect/src delete mode 120000 enterprise/packages/chimera/src rename enterprise/packages/{chimera-connect => echo/echo-api}/.gitignore (100%) rename enterprise/packages/{chimera-connect => echo/echo-api}/check-ee.mjs (100%) rename enterprise/packages/{chimera => echo/echo-api}/package.json (98%) create mode 120000 enterprise/packages/echo/echo-api/src rename enterprise/packages/{chimera => echo/echo-api}/tsconfig.json (90%) rename enterprise/packages/{chimera-connect => echo/echo-api}/tsconfig.spec.json (100%) rename enterprise/packages/{web/echo => echo/echo-web}/.eslintrc.js (100%) rename enterprise/packages/{web/echo => echo/echo-web}/.gitignore (100%) rename enterprise/packages/{web/echo => echo/echo-web}/check-ee.mjs (100%) rename enterprise/packages/{web/echo => echo/echo-web}/package.json (100%) create mode 120000 enterprise/packages/echo/echo-web/src rename enterprise/packages/{web/echo => echo/echo-web}/tsconfig.esm.json (100%) rename enterprise/packages/{web/echo => echo/echo-web}/tsconfig.json (100%) rename enterprise/packages/{chimera => echo/echo-worker}/.gitignore (100%) rename enterprise/packages/{chimera => echo/echo-worker}/check-ee.mjs (100%) rename enterprise/packages/{chimera-connect => echo/echo-worker}/package.json (97%) create mode 120000 enterprise/packages/echo/echo-worker/src rename enterprise/packages/{chimera-connect => echo/echo-worker}/tsconfig.json (90%) rename enterprise/packages/{chimera => echo/echo-worker}/tsconfig.spec.json (100%) delete mode 120000 enterprise/packages/web/echo/src diff --git a/.source b/.source index c00dce9fe03..cdb34baa78a 160000 --- a/.source +++ b/.source @@ -1 +1 @@ -Subproject commit c00dce9fe03d15b45aaea84fd4da4a748439bd45 +Subproject commit cdb34baa78ac9c43bf091f221023b59ddabfd822 diff --git a/apps/api/package.json b/apps/api/package.json index 5d5f995a608..2399315c510 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -117,7 +117,7 @@ "typescript": "4.9.5" }, "optionalDependencies": { - "@novu/ee-chimera": "^0.24.1", + "@novu/ee-echo-api": "^0.24.1", "@novu/ee-auth": "^0.24.1", "@novu/ee-billing": "^0.24.1", "@novu/ee-translation": "^0.24.1" diff --git a/apps/api/src/app.module.ts b/apps/api/src/app.module.ts index 3646376d3e4..d2ffd7fc5ba 100644 --- a/apps/api/src/app.module.ts +++ b/apps/api/src/app.module.ts @@ -44,8 +44,8 @@ const enterpriseImports = (): Array | null >({ @@ -121,7 +121,7 @@ export class SendMessage { * This is intentional, so that mixpanel can automatically reshard it. */ this.analyticsService.mixpanelTrack('Process Workflow Step - [Triggers]', '', { - workflowType: chimeraResponse?.outputs ? 'ECHO' : 'REGULAR', + workflowType: resonateResponse?.outputs ? 'ECHO' : 'REGULAR', _template: command.job._templateId, _organization: command.organizationId, _environment: command.environmentId, @@ -164,7 +164,7 @@ export class SendMessage { const sendMessageCommand = SendMessageCommand.create({ ...command, compileContext: payload, - chimeraData: chimeraResponse, + chimeraData: resonateResponse, }); switch (stepType) { diff --git a/apps/worker/src/app/workflow/workflow.module.ts b/apps/worker/src/app/workflow/workflow.module.ts index 96dba0a51ce..c2943c64d0c 100644 --- a/apps/worker/src/app/workflow/workflow.module.ts +++ b/apps/worker/src/app/workflow/workflow.module.ts @@ -76,10 +76,10 @@ const enterpriseImports = (): Array >(command); @@ -119,7 +119,7 @@ export class AddJob { stepMetadata: job.digest, payload: job.payload, overrides: job.overrides, - chimeraResponse: chimeraResponse?.outputs, + chimeraResponse: resonateResponse?.outputs, }); Logger.debug(`Digest step amount is: ${digestAmount}`, LOG_CONTEXT); @@ -128,7 +128,7 @@ export class AddJob { MergeOrCreateDigestCommand.create({ job, filtered, - chimeraData: chimeraResponse?.outputs, + chimeraData: resonateResponse?.outputs, }) ); @@ -163,12 +163,12 @@ export class AddJob { let delayAmount: number | undefined = undefined; if (job.type === StepTypeEnum.DELAY) { - const chimeraResponse = await this.chimeraConnector.execute< + const resonateResponse = await this.resonateUsecase.execute< AddJobCommand, ExecuteOutput >(command); - command.chimeraResponse = chimeraResponse; + command.chimeraResponse = resonateResponse; delayAmount = await this.addDelayJob.execute(command); Logger.debug(`Delay step Amount is: ${delayAmount}`, LOG_CONTEXT); diff --git a/packages/application-generic/src/utils/require-inject.ts b/packages/application-generic/src/utils/require-inject.ts index 5b89d802fe3..8128af85a53 100644 --- a/packages/application-generic/src/utils/require-inject.ts +++ b/packages/application-generic/src/utils/require-inject.ts @@ -4,27 +4,24 @@ import { ModuleRef } from '@nestjs/core'; import { ChatProviderIdEnum } from '@novu/shared'; export const requireInject = (inject: RequireInject, moduleRef?: ModuleRef) => { - if (inject === RequireInjectEnum.CHIMERA_CONNECT) { - return initiateChimeraConnector(moduleRef); + if (inject === RequireInjectEnum.RESONATE) { + return initiateResonateProvider(moduleRef); } }; -const initiateChimeraConnector = (moduleRef: ModuleRef) => { +const initiateResonateProvider = (moduleRef: ModuleRef) => { try { if ( process.env.NOVU_ENTERPRISE === 'true' || process.env.CI_EE_TEST === 'true' ) { - if (!require('@novu/ee-chimera-connect')?.ChimeraConnector) { - throw new PlatformException('ChimeraConnector module is not loaded'); + if (!require('@novu/ee-echo-worker')?.Resonate) { + throw new PlatformException('Resonate provider is not loaded'); } - return moduleRef.get( - require('@novu/ee-chimera-connect')?.ChimeraConnector, - { - strict: false, - } - ); + return moduleRef.get(require('@novu/ee-echo-worker')?.Resonate, { + strict: false, + }); } else { return { execute: () => { @@ -36,7 +33,7 @@ const initiateChimeraConnector = (moduleRef: ModuleRef) => { Logger.error( e, `Unexpected error while importing enterprise modules`, - 'ChimeraConnector' + 'Resonate' ); throw e; } @@ -45,7 +42,7 @@ const initiateChimeraConnector = (moduleRef: ModuleRef) => { type RequireInject = `${RequireInjectEnum}`; enum RequireInjectEnum { - CHIMERA_CONNECT = 'chimera_connector', + RESONATE = 'resonate', } export interface IChimeraDigestResponse { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2678d43f023..6712feddb41 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -433,9 +433,9 @@ importers: '@novu/ee-billing': specifier: ^0.24.1 version: link:../../enterprise/packages/billing - '@novu/ee-chimera': + '@novu/ee-echo-api': specifier: ^0.24.1 - version: link:../../enterprise/packages/chimera + version: link:../../enterprise/packages/echo/echo-api '@novu/ee-translation': specifier: ^0.24.1 version: link:../../enterprise/packages/translation @@ -918,7 +918,7 @@ importers: version: link:../../enterprise/packages/billing-web '@novu/ee-echo-web': specifier: ^0.24.1 - version: link:../../enterprise/packages/web/echo + version: link:../../enterprise/packages/echo/echo-web '@novu/ee-translation-web': specifier: ^0.24.1 version: link:../../enterprise/packages/translation-web @@ -1463,9 +1463,9 @@ importers: '@novu/ee-billing': specifier: ^0.24.1 version: link:../../enterprise/packages/billing - '@novu/ee-chimera-connect': + '@novu/ee-echo-worker': specifier: ^0.24.1 - version: link:../../enterprise/packages/chimera-connect + version: link:../../enterprise/packages/echo/echo-worker '@novu/ee-translation': specifier: ^0.24.1 version: link:../../enterprise/packages/translation @@ -1940,7 +1940,7 @@ importers: specifier: 4.9.5 version: 4.9.5 - enterprise/packages/chimera: + enterprise/packages/echo/echo-api: dependencies: '@nestjs/common': specifier: 10.2.2 @@ -1953,22 +1953,22 @@ importers: version: 9.0.3(@nestjs/common@10.2.2)(passport@0.6.0) '@novu/application-generic': specifier: ^0.24.1 - version: link:../../../packages/application-generic + version: link:../../../../packages/application-generic '@novu/dal': specifier: ^0.24.1 - version: link:../../../libs/dal + version: link:../../../../libs/dal '@novu/ee-dal': specifier: ^0.24.1 - version: link:../libs/dal + version: link:../../libs/dal '@novu/shared': specifier: ^0.24.1 - version: link:../../../libs/shared + version: link:../../../../libs/shared '@novu/stateless': specifier: ^0.24.1 - version: link:../../../packages/stateless + version: link:../../../../packages/stateless '@novu/testing': specifier: ^0.24.1 - version: link:../../../libs/testing + version: link:../../../../libs/testing axios: specifier: ^1.6.2 version: 1.6.7 @@ -2037,7 +2037,68 @@ importers: specifier: 4.9.5 version: 4.9.5 - enterprise/packages/chimera-connect: + enterprise/packages/echo/echo-web: + dependencies: + '@mantine/core': + specifier: ^5.7.1 + version: 5.10.5(@emotion/react@11.10.6)(@mantine/hooks@5.10.5)(@types/react@17.0.62)(react-dom@17.0.2)(react@17.0.2) + '@mantine/hooks': + specifier: ^5.7.1 + version: 5.10.5(react@17.0.2) + '@novu/design-system': + specifier: ^0.24.1 + version: link:../../../../libs/design-system + '@novu/shared-web': + specifier: ^0.24.1 + version: link:../../../../libs/shared-web + '@rjsf/core': + specifier: ^5.17.1 + version: 5.17.1(@rjsf/utils@5.17.1)(react@17.0.2) + '@rjsf/validator-ajv8': + specifier: ^5.17.1 + version: 5.17.1(@rjsf/utils@5.17.1) + '@tanstack/react-query': + specifier: ^4.20.4 + version: 4.29.1(react-dom@17.0.2)(react@17.0.2) + react-router-dom: + specifier: 6.2.2 + version: 6.2.2(react-dom@17.0.2)(react@17.0.2) + tslib: + specifier: ^2.3.1 + version: 2.6.2 + devDependencies: + '@types/node': + specifier: ^18.11.12 + version: 18.18.5 + '@types/react': + specifier: ^17.0.0 + version: 17.0.62 + '@types/react-dom': + specifier: ^17.0.0 + version: 17.0.20 + eslint: + specifier: ^8.33.0 + version: 8.51.0 + eslint-plugin-react-hooks: + specifier: ^4.4.0 + version: 4.6.0(eslint@8.51.0) + react: + specifier: ^17.0.1 + version: 17.0.2 + react-dom: + specifier: ^17.0.1 + version: 17.0.2(react@17.0.2) + rimraf: + specifier: ^3.0.2 + version: 3.0.2 + ts-loader: + specifier: ~9.4.0 + version: 9.4.2(typescript@4.9.5)(webpack@5.78.0) + typescript: + specifier: 4.9.5 + version: 4.9.5 + + enterprise/packages/echo/echo-worker: dependencies: '@nestjs/common': specifier: 10.2.2 @@ -2050,19 +2111,19 @@ importers: version: 9.0.3(@nestjs/common@10.2.2)(passport@0.6.0) '@novu/dal': specifier: ^0.24.1 - version: link:../../../libs/dal + version: link:../../../../libs/dal '@novu/ee-dal': specifier: ^0.24.1 - version: link:../libs/dal + version: link:../../libs/dal '@novu/shared': specifier: ^0.24.1 - version: link:../../../libs/shared + version: link:../../../../libs/shared '@novu/stateless': specifier: ^0.24.1 - version: link:../../../packages/stateless + version: link:../../../../packages/stateless '@novu/testing': specifier: ^0.24.1 - version: link:../../../libs/testing + version: link:../../../../libs/testing axios: specifier: ^1.6.2 version: 1.6.7 @@ -2390,67 +2451,6 @@ importers: specifier: 4.9.5 version: 4.9.5 - enterprise/packages/web/echo: - dependencies: - '@mantine/core': - specifier: ^5.7.1 - version: 5.10.5(@emotion/react@11.10.6)(@mantine/hooks@5.10.5)(@types/react@17.0.62)(react-dom@17.0.2)(react@17.0.2) - '@mantine/hooks': - specifier: ^5.7.1 - version: 5.10.5(react@17.0.2) - '@novu/design-system': - specifier: ^0.24.1 - version: link:../../../../libs/design-system - '@novu/shared-web': - specifier: ^0.24.1 - version: link:../../../../libs/shared-web - '@rjsf/core': - specifier: ^5.17.1 - version: 5.17.1(@rjsf/utils@5.17.1)(react@17.0.2) - '@rjsf/validator-ajv8': - specifier: ^5.17.1 - version: 5.17.1(@rjsf/utils@5.17.1) - '@tanstack/react-query': - specifier: ^4.20.4 - version: 4.29.1(react-dom@17.0.2)(react@17.0.2) - react-router-dom: - specifier: 6.2.2 - version: 6.2.2(react-dom@17.0.2)(react@17.0.2) - tslib: - specifier: ^2.3.1 - version: 2.6.2 - devDependencies: - '@types/node': - specifier: ^18.11.12 - version: 18.18.5 - '@types/react': - specifier: ^17.0.0 - version: 17.0.62 - '@types/react-dom': - specifier: ^17.0.0 - version: 17.0.20 - eslint: - specifier: ^8.33.0 - version: 8.51.0 - eslint-plugin-react-hooks: - specifier: ^4.4.0 - version: 4.6.0(eslint@8.51.0) - react: - specifier: ^17.0.1 - version: 17.0.2 - react-dom: - specifier: ^17.0.1 - version: 17.0.2(react@17.0.2) - rimraf: - specifier: ^3.0.2 - version: 3.0.2 - ts-loader: - specifier: ~9.4.0 - version: 9.4.2(typescript@4.9.5)(webpack@5.78.0) - typescript: - specifier: 4.9.5 - version: 4.9.5 - libs/dal: dependencies: '@aws-sdk/client-s3': @@ -3381,9 +3381,9 @@ importers: specifier: ^1.4.6 version: 1.6.6 optionalDependencies: - '@novu/ee-chimera-connect': + '@novu/ee-echo-worker': specifier: ^0.24.1 - version: link:../../enterprise/packages/chimera-connect + version: link:../../enterprise/packages/echo/echo-worker '@novu/ee-shared-services': specifier: ^0.24.1 version: link:../../enterprise/packages/shared-services @@ -40596,7 +40596,7 @@ packages: eslint: 8.51.0 eslint-import-resolver-node: 0.3.7 eslint-module-utils: 2.8.0(@typescript-eslint/parser@5.58.0)(eslint-import-resolver-node@0.3.7)(eslint-import-resolver-webpack@0.13.7)(eslint@8.51.0) - has: 1.0.4 + has: 1.0.3 is-core-module: 2.13.0 is-glob: 4.0.3 minimatch: 3.1.2 @@ -52004,7 +52004,7 @@ packages: dev: false /pause@0.0.1: - resolution: {integrity: sha512-KG8UEiEVkR3wGEb4m5yZkVCzigAD+cVEJck2CzYZO37ZGJfctvVptVO192MwrtPhzONn6go8ylnOdMhKqi4nfg==} + resolution: {integrity: sha1-HUCLP9t2kjuVQ9lvtMnf1TXZy10=} dev: false /peberminta@0.9.0: @@ -58900,7 +58900,7 @@ packages: resolution: {integrity: sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==} engines: {node: '>=12'} dependencies: - punycode: 2.3.0 + punycode: 2.3.1 /tr46@5.0.0: resolution: {integrity: sha512-tk2G5R2KRwBd+ZN0zaEXpmzdKyOYksXwywulIX95MBODjSzMIuQnQ3m8JxgbhnL1LeVo7lqQKsYa1O3Htl7K5g==} @@ -59284,8 +59284,8 @@ packages: '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.3 '@types/node': 16.11.7 - acorn: 8.10.0 - acorn-walk: 8.2.0 + acorn: 8.11.3 + acorn-walk: 8.3.2 arg: 4.1.3 create-require: 1.1.1 diff: 4.0.2 @@ -59315,8 +59315,8 @@ packages: '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.3 '@types/node': 16.11.7 - acorn: 8.10.0 - acorn-walk: 8.2.0 + acorn: 8.11.3 + acorn-walk: 8.3.2 arg: 4.1.3 create-require: 1.1.1 diff: 4.0.2 @@ -59346,8 +59346,8 @@ packages: '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.3 '@types/node': 20.5.1 - acorn: 8.10.0 - acorn-walk: 8.2.0 + acorn: 8.11.3 + acorn-walk: 8.3.2 arg: 4.1.3 create-require: 1.1.1 diff: 4.0.2 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index ed81fa8c04c..eb7c8fdca63 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -11,4 +11,4 @@ packages: # all packages in enterprise modules - 'enterprise/packages/*' - 'enterprise/packages/libs/*' - - 'enterprise/packages/web/*' + - 'enterprise/packages/echo/*'