Skip to content

Commit

Permalink
Merge branch 'next' into inf-376-instant-rollback-process
Browse files Browse the repository at this point in the history
  • Loading branch information
AliaksandrRyzhou authored May 2, 2024
2 parents b45421e + 85040b8 commit 7533afa
Show file tree
Hide file tree
Showing 212 changed files with 3,101 additions and 1,630 deletions.
6 changes: 5 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.2",
"language": "en",
"words": [
"websockets",
"cacheable",
"mrkdwn",
"Springboot",
Expand Down Expand Up @@ -634,7 +635,10 @@
"Maizzle",
"MJML",
"localstorage",
"elif"
"elif",
"websockets",
"whatsapp",
"whatsappbusiness"
],
"flagWords": [],
"patterns": [
Expand Down
15 changes: 15 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Reference: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#codeowners-syntax

# By default we assume that the novu-devs should review most changes
# Removed for now until consensus is made by the team
# @novuhq/novu-devs

# Except for the following exceptions
# Novu infra team ownership
.github @novuhq/novu-infra
.husky @novuhq/novu-infra
docker @novuhq/novu-infra
**/Dockerfile @novuhq/novu-infra

# Novu community team ownership
apps/web @novuhq/novu-web
6 changes: 0 additions & 6 deletions .github/workflows/reusable-api-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,6 @@ jobs:
- uses: ./.github/actions/setup-redis-cluster
name: Setup redis cluster

- uses: mansagroup/nrwl-nx-action@v3
name: Run Lint
with:
targets: lint
projects: '@novu/api'

- uses: ./.github/actions/start-localstack
name: Start localstack

Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/reusable-inbound-mail-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ jobs:
if: steps.setup.outputs.has_token != 'true'
- uses: ./.github/actions/setup-project
- uses: ./.github/actions/setup-redis-cluster
- uses: mansagroup/nrwl-nx-action@v3
with:
targets: lint
projects: "@novu/inbound-mail"

# Runs a single command using the runners shell
- name: Build Inbound Mail
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable-web-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
echo REACT_APP_LAUNCH_DARKLY_CLIENT_SIDE_ID=${{ secrets.LAUNCH_DARKLY_CLIENT_SIDE_ID }} >> .env
echo REACT_APP_HUBSPOT_EMBED=${{ inputs.react_app_hubspot_embed }} >> .env
echo REACT_APP_STRIPE_CLIENT_KEY=${{ secrets.STRIPE_CLIENT_KEY }} >> .env
echo REACT_APP_NOVU_GTM_ID=${{ secrets.REACT_APP_NOVU_GTM_ID }} >> .env
- name: Envsetup
working-directory: apps/web
run: npm run envsetup
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/reusable-web-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ name: Test WEB

# Controls when the action will run. Triggers the workflow on push or pull request
on:
workflow_dispatch:
inputs:
ee:
description: 'use the ee version of worker'
required: false
default: true
type: boolean
workflow_call:
inputs:
ee:
Expand Down Expand Up @@ -66,7 +73,7 @@ jobs:

- uses: mansagroup/nrwl-nx-action@v3
with:
targets: lint,build
targets: build
projects: '@novu/web,@novu/api,@novu/worker'
args: --skip-nx-cache

Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/reusable-webhook-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ jobs:

- uses: ./.github/actions/setup-project

- uses: mansagroup/nrwl-nx-action@v3
with:
targets: lint
projects: '@novu/webhook'

- uses: ./.github/actions/start-localstack

# Runs a single command using the runners shell
Expand All @@ -31,6 +26,6 @@ jobs:

# Runs a set of commands using the runners shell
- name: Run a test
run: |
run: |
cd apps/webhook && pnpm test:e2e
pnpm test
5 changes: 0 additions & 5 deletions .github/workflows/reusable-widget-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ jobs:

- uses: ./.github/actions/setup-redis-cluster

- uses: mansagroup/nrwl-nx-action@v3
with:
targets: lint
projects: '@novu/widget'

- uses: mansagroup/nrwl-nx-action@v3
with:
targets: build
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/reusable-worker-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ jobs:
- uses: ./.github/actions/setup-project

- uses: ./.github/actions/setup-redis-cluster
- uses: mansagroup/nrwl-nx-action@v3
with:
targets: lint
projects: '@novu/worker'

- uses: ./.github/actions/start-localstack

Expand All @@ -59,6 +55,6 @@ jobs:

# Runs a set of commands using the runners shell
- name: Run a test
run: |
run: |
cd apps/worker && pnpm test:e2e
pnpm test
4 changes: 0 additions & 4 deletions .github/workflows/reusable-ws-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ jobs:
- uses: actions/checkout@v3
if: steps.setup.outputs.has_token != 'true'
- uses: ./.github/actions/setup-project
- uses: mansagroup/nrwl-nx-action@v3
with:
targets: lint
projects: "@novu/ws"

# Runs a single command using the runners shell
- name: Build WS
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Test Scheduler
name: Scheduled E2E tests

on:
workflow_dispatch:
schedule:
- cron: '0 12-19/2 * * 1-5'
- cron: '0 7-19/4 * * 1-5'
permissions:
contents: read
packages: write
Expand Down Expand Up @@ -56,10 +56,10 @@ jobs:
echo "Workflow $filename status: $status"
if [[ "$status" == "failure" ]]; then
echo "Disabling workflow $filename because some of the tests failed."
echo "Disabling workflow $filename. The E2E test has failed."
gh workflow disable "$filename"
elif [[ "$status" == "success" ]]; then
echo "Enabling workflow $filename because the tests look good."
echo "Enabling workflow $filename. The E2E tests have passed."
gh workflow enable "$filename"
else
echo "Unknown status for workflow $filename: $status"
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ concurrency:

on:
pull_request:
workflow_dispatch:

jobs:
dependency-review:
Expand Down Expand Up @@ -93,7 +94,8 @@ jobs:
test_web:
name: Test Web Cypress
needs: [get-affected]
if: ${{ contains(fromJson(needs.get-affected.outputs.test-cypress), '@novu/web') }}
# if: ${{ contains(fromJson(needs.get-affected.outputs.test-cypress), '@novu/web') }}
if: false
uses: ./.github/workflows/reusable-web-e2e.yml
secrets: inherit
with:
Expand All @@ -105,7 +107,8 @@ jobs:
uses: ./.github/workflows/reusable-widget-e2e.yml
with:
ee: true
if: ${{ contains(fromJson(needs.get-affected.outputs.test-cypress), '@novu/widget') || contains(fromJson(needs.get-affected.outputs.test-unit), '@novu/notification-center') || contains(fromJson(needs.get-affected.outputs.test-unit), '@novu/ws') }}
if: false
# if: ${{ contains(fromJson(needs.get-affected.outputs.test-cypress), '@novu/widget') || contains(fromJson(needs.get-affected.outputs.test-unit), '@novu/notification-center') || contains(fromJson(needs.get-affected.outputs.test-unit), '@novu/ws') }}
secrets: inherit

test_providers:
Expand Down Expand Up @@ -175,9 +178,10 @@ jobs:
targets: lint,build,test
projects: ${{join(fromJson(needs.get-affected.outputs.test-libs), ',')}}

test_api:
test_unit_api:
name: Test API
needs: [get-affected]
if: false
strategy:
# The order is important for ee to be first, otherwise outputs not work correctly
matrix:
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions .prettierrc

This file was deleted.

2 changes: 1 addition & 1 deletion .source
5 changes: 3 additions & 2 deletions apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,11 @@
"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"
"@novu/ee-translation": "^0.24.1",
"@novu/ee-shared-services": "^0.24.1"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
Expand Down
28 changes: 12 additions & 16 deletions apps/api/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,19 @@ import { ResourceThrottlerInterceptor } from './app/resource-limiting/guards';

const enterpriseImports = (): Array<Type | DynamicModule | Promise<DynamicModule> | ForwardReference> => {
const modules: Array<Type | DynamicModule | Promise<DynamicModule> | ForwardReference> = [];
try {
if (process.env.NOVU_ENTERPRISE === 'true' || process.env.CI_EE_TEST === 'true') {
if (require('@novu/ee-auth')?.EEAuthModule) {
modules.push(require('@novu/ee-auth')?.EEAuthModule);
}
if (require('@novu/ee-chimera')?.ChimeraModule) {
modules.push(require('@novu/ee-chimera')?.ChimeraModule);
}
if (require('@novu/ee-translation')?.EnterpriseTranslationModule) {
modules.push(require('@novu/ee-translation')?.EnterpriseTranslationModule);
}
if (require('@novu/ee-billing')?.BillingModule) {
modules.push(require('@novu/ee-billing')?.BillingModule.forRoot());
}
if (process.env.NOVU_ENTERPRISE === 'true' || process.env.CI_EE_TEST === 'true') {
if (require('@novu/ee-auth')?.EEAuthModule) {
modules.push(require('@novu/ee-auth')?.EEAuthModule);
}
if (require('@novu/ee-echo-api')?.EchoModule) {
modules.push(require('@novu/ee-echo-api')?.EchoModule);
}
if (require('@novu/ee-translation')?.EnterpriseTranslationModule) {
modules.push(require('@novu/ee-translation')?.EnterpriseTranslationModule);
}
if (require('@novu/ee-billing')?.BillingModule) {
modules.push(require('@novu/ee-billing')?.BillingModule.forRoot());
}
} catch (e) {
Logger.error(e, `Unexpected error while importing enterprise modules`, 'EnterpriseImport');
}

return modules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@ export class GetChanges {
): Promise<IViewEntity | Record<string, unknown>> {
try {
if (process.env.NOVU_ENTERPRISE === 'true' || process.env.CI_EE_TEST === 'true') {
if (!require('@novu/ee-translation')?.TranslationsService) {
if (!require('@novu/ee-shared-services')?.TranslationsService) {
throw new ApiException('Translation module is not loaded');
}
const service = this.moduleRef.get(require('@novu/ee-translation')?.TranslationsService, { strict: false });
const service = this.moduleRef.get(require('@novu/ee-shared-services')?.TranslationsService, { strict: false });
const { name, identifier } = await service.getTranslationGroupData(environmentId, entityId);

return {
Expand All @@ -172,10 +172,10 @@ export class GetChanges {
): Promise<IViewEntity | Record<string, unknown>> {
try {
if (process.env.NOVU_ENTERPRISE === 'true' || process.env.CI_EE_TEST === 'true') {
if (!require('@novu/ee-translation')?.TranslationsService) {
if (!require('@novu/ee-shared-services')?.TranslationsService) {
throw new ApiException('Translation module is not loaded');
}
const service = this.moduleRef.get(require('@novu/ee-translation')?.TranslationsService, { strict: false });
const service = this.moduleRef.get(require('@novu/ee-shared-services')?.TranslationsService, { strict: false });
const { name, group } = await service.getTranslationData(environmentId, entityId);

return {
Expand Down
4 changes: 2 additions & 2 deletions apps/api/src/app/change/usecases/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { CreateChange, UpdateChange } from '@novu/application-generic';

import { PromoteMessageTemplateChange } from './promote-message-template-change/promote-message-template-change';
import { PromoteNotificationTemplateChange } from './promote-notification-template-change/promote-notification-template-change.usecase';
import { PromoteChangeToEnvironment } from './promote-change-to-environment/promote-change-to-environment.usecase';
Expand All @@ -6,10 +8,8 @@ import { GetChanges } from './get-changes/get-changes.usecase';
import { BulkApplyChange } from './bulk-apply-change/bulk-apply-change.usecase';
import { CountChanges } from './count-changes/count-changes.usecase';
import { PromoteNotificationGroupChange } from './promote-notification-group-change/promote-notification-group-change';
import { UpdateChange } from './update-change/update-change';
import { PromoteFeedChange } from './promote-feed-change/promote-feed-change';
import { PromoteLayoutChange } from './promote-layout-change/promote-layout-change.use-case';
import { CreateChange } from '@novu/application-generic';
import { PromoteTranslationChange } from './promote-translation-change';
import { PromoteTranslationGroupChange } from './promote-translation-group-change';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ export class ContentTemplatesController {
protected async initiateTranslations(environmentId: string, organizationId: string, locale: string | undefined) {
try {
if (process.env.NOVU_ENTERPRISE === 'true' || process.env.CI_EE_TEST === 'true') {
if (!require('@novu/ee-translation')?.TranslationsService) {
if (!require('@novu/ee-shared-services')?.TranslationsService) {
throw new ApiException('Translation module is not loaded');
}
const service = this.moduleRef.get(require('@novu/ee-translation')?.TranslationsService, { strict: false });
const service = this.moduleRef.get(require('@novu/ee-shared-services')?.TranslationsService, { strict: false });
const { namespaces, resources, defaultLocale } = await service.getTranslationsList(
environmentId,
organizationId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ export class SendTestEmail {

if (command.chimera) {
if (process.env.NOVU_ENTERPRISE === 'true' || process.env.CI_EE_TEST === 'true') {
if (!require('@novu/ee-chimera')?.PreviewStep) {
if (!require('@novu/ee-echo-api')?.PreviewStep) {
throw new ApiException('Chimera module is not loaded');
}
const service = this.moduleRef.get(require('@novu/ee-chimera')?.PreviewStep, { strict: false });
const service = this.moduleRef.get(require('@novu/ee-echo-api')?.PreviewStep, { strict: false });
const data = await service.execute({
workflowId: command.workflowId,
stepId: command.stepId,
Expand Down
5 changes: 5 additions & 0 deletions apps/api/src/app/integrations/dtos/credentials.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,9 @@ export class CredentialsDto implements ICredentials {
@IsString()
@IsOptional()
channelId?: string;

@ApiPropertyOptional()
@IsString()
@IsOptional()
phoneNumberIdentification?: string;
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { IsArray, IsDefined, IsEnum, IsOptional, IsString, ValidateNested } from 'class-validator';
import { ChannelTypeEnum, ICredentialsDto } from '@novu/shared';
import { MessageFilter } from '@novu/application-generic';

import { EnvironmentCommand } from '../../../shared/commands/project.command';
import { MessageFilter } from '../../../workflows/usecases/create-notification-template';

export class CreateIntegrationCommand extends EnvironmentCommand {
@IsOptional()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { IsArray, IsDefined, IsMongoId, IsOptional, IsString, ValidateNested } from 'class-validator';
import { ICredentialsDto } from '@novu/shared';
import { MessageFilter } from '@novu/application-generic';

import { OrganizationCommand } from '../../../shared/commands/organization.command';
import { StepFilter } from '../../../shared/dtos/step-filter';
import { MessageFilter } from '../../../workflows/usecases/create-notification-template';

export class UpdateIntegrationCommand extends OrganizationCommand {
@IsOptional()
Expand Down
Loading

0 comments on commit 7533afa

Please sign in to comment.