Skip to content

Commit

Permalink
Merge branch 'main' into feature/add-scheduled-digest
Browse files Browse the repository at this point in the history
  • Loading branch information
unicodeveloper authored Jul 25, 2023
2 parents 7ca1aee + da3ddc0 commit 8ea5e09
Show file tree
Hide file tree
Showing 793 changed files with 19,343 additions and 5,808 deletions.
26 changes: 25 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,30 @@
"bitnamicharts",
"bitnami",
"portname",
"externalredis"
"externalredis",
"autorun",
"webp",
"nocheck",
"webp",
"devs",
"flowwer",
"Grossman",
"Dima",
"orcid",
"Barnea",
"Tomer",
"codesandbox",
"GROUPBY",
"stefanprodan",
"Sendchamp",
"sendchamp",
"Quickstarts",
"quickstarts",
"quickstartslogo",
"reactjs",
"nextjs",
"vanillajs",
"quckstart"
],
"flagWords": [],
"patterns": [
Expand Down Expand Up @@ -547,6 +570,7 @@
"novu.code-workspace",
"packages/application-generic/src/.env.test",
"packages/notification-center/src/i18n/languages/**",
"packages/notification-center/rollup.config.mjs",
"apps/widget/public/iframeResizer.contentWindow.js",
".eslintrc.js",
".vscode/settings.json",
Expand Down
4 changes: 1 addition & 3 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ body:
label: "📜 Description"
description: "A clear and concise description of what the bug is."
placeholder: "It bugs out when ..."
validations:
required: true
- type: textarea
id: steps-to-reproduce
validations:
Expand Down Expand Up @@ -64,7 +62,7 @@ body:
label: "🏢 Have you read the Contributing Guidelines?"
options:
- label: "I have read the [Contributing Guidelines](https://github.com/novuhq/novu/blob/main/CONTRIBUTING.md)"
required: true
required: true
- type: dropdown
attributes:
label: Are you willing to submit PR?
Expand Down
7 changes: 7 additions & 0 deletions .github/actions/run-worker/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ name: Run Worker

description: Sets up a Redis Cluster instance needed to run the tests

inputs:
launch_darkly_sdk_key:
description: 'The Launch Darkly SDK key to use'
required: false
default: ''

runs:
using: composite

Expand All @@ -19,6 +25,7 @@ runs:
shell: bash
env:
IN_MEMORY_CLUSTER_MODE_ENABLED: true
LAUNCH_DARKLY_SDK_KEY: ${{ inputs.launch_darkly_sdk_key }}
run: cd apps/worker && pnpm start:test &

- name: Wait on worker
Expand Down
12 changes: 12 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
- apps/web/**/*
'@novu/ws':
- apps/ws/**/*
'@novu/inbound-mail':
- apps/inbound-mail/**/*
'documentation':
- docs/**/*
'@novu/webhook':
Expand All @@ -22,3 +24,13 @@
- packages/notification-center-angular/**/*
'providers':
- providers/**/*
'CI/CD':
- .github/**/*
'helm':
- docker/kubernetes/helm/**/*
'kustomize':
- docker/kubernetes/kustomize/**/*
'docker':
- docker/**/*
'scripts':
- scripts/**/*
10 changes: 10 additions & 0 deletions .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,13 @@ jobs:
- uses: actions/labeler@v4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"

- uses: microsoft/[email protected]
name: PR Metrics
env:
PR_METRICS_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
base-size: 200
growth-rate: 2.0
test-factor: 0.5
continue-on-error: true
21 changes: 21 additions & 0 deletions .github/workflows/pr-manager.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: "Pull Request Manager"
on:
schedule:
- cron: '0 * * * *'

jobs:
stale:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Process stale PRs
uses: Sonia-corporation/[email protected]
with:
issue-processing: false
pull-request-days-before-stale: 14
pull-request-days-before-close: 180
pull-request-ignore-draft: true
pull-request-ignore-all-milestones: true
pull-request-stale-label: 'stale'
18 changes: 18 additions & 0 deletions .github/workflows/release-helm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Release Helm Chart

on:
workflow_dispatch:

jobs:
release:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: stefanprodan/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
charts_dir: "docker/kubernetes"
branch: charts
6 changes: 6 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,11 @@ jobs:
- uses: ./.github/actions/setup-project
with:
slim: 'true'
- uses: ./.github/actions/setup-redis-cluster
- uses: mansagroup/nrwl-nx-action@v3
env:
IN_MEMORY_CLUSTER_MODE_ENABLED: true
LOGGING_LEVEL: 'info'
with:
targets: lint,build,test
projects: ${{join(fromJson(needs.get-affected.outputs.test-packages), ',')}}
Expand Down Expand Up @@ -207,6 +211,8 @@ jobs:

- uses: ./.github/actions/run-worker
if: ${{matrix.projectName == '@novu/api' }}
with:
launch_darkly_sdk_key: ${{ secrets.LAUNCH_DARKLY_SDK_KEY }}

- uses: mansagroup/nrwl-nx-action@v3
env:
Expand Down
3 changes: 2 additions & 1 deletion .idea/jsLibraryMappings.xml

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

1 change: 1 addition & 0 deletions .idea/novu.iml

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

3 changes: 3 additions & 0 deletions .markdownlint.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"siblings_only": true
},

// no-multiple-blanks
"MD012": false,

// MD032/blanks-around-lists - Lists should be surrounded by blank lines
"MD032": false,

Expand Down
13 changes: 13 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cff-version: 1.2.0
message: "If you use this software in your academic work, please use the citation below."
- family-names: "Grossman"
given-names: "Dima"
orcid: "https://github.com/scopsy"
- family-names: "Barnea"
given-names: "Tomer"
orcid: "https://github.com/ComBarnea"
title: "Novu"
version: <your version>
date-released: 2021-08-25
url: "https://github.com/novuhq/novu"

Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
import { expect } from 'chai';
import { UserSession } from '@novu/testing';

import { IntegrationRepository, EnvironmentRepository } from '@novu/dal';
import { ChannelTypeEnum, EmailProviderIdEnum, InAppProviderIdEnum, SmsProviderIdEnum } from '@novu/shared';

import {
addIntegrationIdentifierMigration,
addIntegrationIdentifierMigrationBatched,
genIntegrationIdentificationDetails,
} from './add-integration-identifier-migration';

describe('Add default identifier and name to integration entity', function () {
let session: UserSession;
const integrationRepository = new IntegrationRepository();
const environmentRepository = new EnvironmentRepository();

beforeEach(async () => {
session = new UserSession();
await session.initialize();
await pruneIntegration(integrationRepository);
});

it('should identifier and name to integration entity', async function () {
await integrationRepository.create({
_environmentId: session.environment._id,
_organizationId: session.organization._id,
channel: ChannelTypeEnum.EMAIL,
providerId: EmailProviderIdEnum.SendGrid,
active: true,
});

await integrationRepository.create({
_environmentId: session.environment._id,
_organizationId: session.organization._id,
channel: ChannelTypeEnum.SMS,
providerId: SmsProviderIdEnum.SNS,
active: true,
});

await integrationRepository.create({
_environmentId: session.environment._id,
_organizationId: session.organization._id,
channel: ChannelTypeEnum.IN_APP,
providerId: InAppProviderIdEnum.Novu,
active: true,
});

const createdIntegrations = await integrationRepository.find({
_environmentId: session.environment._id,
_organizationId: session.organization._id,
} as any);

expect(createdIntegrations.length).to.equal(3);

for (const integration of createdIntegrations) {
expect(integration.name).to.not.exist;
expect(integration.identifier).to.not.exist;
}

await addIntegrationIdentifierMigration();

const updatedIntegration = await integrationRepository.find({
_environmentId: session.environment._id,
_organizationId: session.organization._id,
} as any);

for (const integration of updatedIntegration) {
const { name, identifier } = genIntegrationIdentificationDetails({ providerId: integration.providerId });

expect(integration.name).to.equal(name);
expect(integration.identifier).to.contain(identifier.split('-')[0]);
}
});

it('should identifier and name to integration entity (batched)', async function () {
await integrationRepository.create({
_environmentId: session.environment._id,
_organizationId: session.organization._id,
channel: ChannelTypeEnum.EMAIL,
providerId: EmailProviderIdEnum.SendGrid,
active: true,
});

await integrationRepository.create({
_environmentId: session.environment._id,
_organizationId: session.organization._id,
channel: ChannelTypeEnum.SMS,
providerId: SmsProviderIdEnum.SNS,
active: true,
});

await integrationRepository.create({
_environmentId: session.environment._id,
_organizationId: session.organization._id,
channel: ChannelTypeEnum.IN_APP,
providerId: InAppProviderIdEnum.Novu,
active: true,
});

const createdIntegrations = await integrationRepository.find({
_environmentId: session.environment._id,
_organizationId: session.organization._id,
} as any);

expect(createdIntegrations.length).to.equal(3);

for (const integration of createdIntegrations) {
expect(integration.name).to.not.exist;
expect(integration.identifier).to.not.exist;
}

await addIntegrationIdentifierMigrationBatched();

const updatedIntegration = await integrationRepository.find({
_environmentId: session.environment._id,
_organizationId: session.organization._id,
} as any);

for (const integration of updatedIntegration) {
const { name, identifier } = genIntegrationIdentificationDetails({ providerId: integration.providerId });

expect(integration.name).to.equal(name);
expect(integration.identifier).to.contain(identifier.split('-')[0]);
}
});
});

async function pruneIntegration(integrationRepository) {
const old = await integrationRepository.find({});

for (const integration of old) {
await integrationRepository.delete({ _id: integration._id, _environmentId: integration._environmentId });
}
}
Loading

0 comments on commit 8ea5e09

Please sign in to comment.