Skip to content

Commit

Permalink
Merge pull request #3282 from novuhq/v0.14.x
Browse files Browse the repository at this point in the history
v0.14.0 Release
  • Loading branch information
scopsy authored Apr 25, 2023
2 parents a99aba6 + 52bc624 commit baba90d
Show file tree
Hide file tree
Showing 246 changed files with 4,550 additions and 5,076 deletions.
5 changes: 4 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,9 @@
"Millis",
"sscan",
"vishnudxb",
"autopipelining"
"autopipelining",
"maxtimeout",
"clsx"
],
"flagWords": [],
"patterns": [
Expand Down Expand Up @@ -502,6 +504,7 @@
"pnpm-lock.yaml",
"pnpm-workspace.yaml",
"novu.code-workspace",
"packages/application-generic/src/.env.test",
"packages/notification-center/src/i18n/languages/**",
"apps/widget/public/iframeResizer.contentWindow.js",
".eslintrc.js",
Expand Down
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ module.exports = {
'prettier',
'plugin:prettier/recommended',
'plugin:promise/recommended',
'plugin:@cspell/recommended',
],
ignorePatterns: ['.eslintrc.js', '*.json', 'jest.config.js'],
plugins: ['import', 'promise', '@typescript-eslint', 'prettier'],
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/reusable-web-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ jobs:
if: steps.setup-project.outputs.cypress_cache_hit != 'true'
working-directory: apps/web
run: pnpm cypress install


- uses: browser-actions/setup-chrome@latest
- run: |
echo "BROWSER_PATH=$(which chrome)" >> $GITHUB_ENV
- name: Cypress run e2e
uses: cypress-io/github-action@v4
Expand All @@ -103,7 +108,7 @@ jobs:
CYPRESS_IS_CI: true
with:
working-directory: apps/web
browser: chrome
browser: "${{ env.BROWSER_PATH }}"
record: true
parallel: true
install: false
Expand Down
77 changes: 77 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Testing

on:
# Execute it on pushing to next branches
push:
branches:
- next
- main
# Execute it on opening any pull request
pull_request:
jobs:
# Get branch info
branch-info:
runs-on: ubuntu-latest
steps:
# Get current branch name
- name: Get branch name
id: branch-name
uses: tj-actions/[email protected]
# Get base branch name to compare with. Base branch on a PR, "main" branch on pushing.
- name: Get base branch name
id: get-base-branch-name
run: |
if [[ "${{github.event.pull_request.base.ref}}" != "" ]]; then
echo "::set-output name=branch::${{github.event.pull_request.base.ref}}"
else
echo "::set-output name=branch::main"
fi
outputs:
# Export the branch names as output to be able to use it in other jobs
base-branch-name: ${{ steps.get-base-branch-name.outputs.branch }}
branch-name: ${{ steps.branch-name.outputs.current_branch }}
get-affected:
needs: [ branch-info ]
name: Nx Affected
runs-on: ubuntu-latest
outputs:
test-unit: ${{ steps.get-projects-arrays.outputs.test-unit }}
test-e2e: ${{ steps.get-projects-arrays.outputs.test-e2e }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: ./.github/actions/setup-project

# Configure Nx to be able to detect changes between branches when we are in a PR
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v2
with:
main-branch-name: ${{needs.branch-info.outputs.base-branch-name}}

- name: Get affected
id: get-projects-arrays
# When not in a PR and the current branch is main, pass --all flag. Otherwise pass the base branch
run: |
if [[ "${{github.event.pull_request.base.ref}}" == "" && "${{needs.branch-info.outputs.branch-name}}" == "main" ]]; then
echo "Running ALL"
echo "::set-output name=test-unit::$(node scripts/print-affected-array.js test:unit --all)"
echo "::set-output name=test-e2e::$(node scripts/print-affected-array.js test:e2e --all)"
else
echo "Running PR origin/${{needs.branch-info.outputs.base-branch-name}}"
echo "::set-output name=test-unit::$(node scripts/print-affected-array.js test:unit origin/${{needs.branch-info.outputs.base-branch-name}})"
echo "::set-output name=test-e2e::$(node scripts/print-affected-array.js test:e2e origin/${{needs.branch-info.outputs.base-branch-name}})"
fi
test:
runs-on: ubuntu-latest
needs: [get-affected]
if: ${{ fromJson(needs.get-affected.outputs.test-e2e)[0] }}
strategy:
# Run in parallel
max-parallel: 4
# One job for each different project and node version
matrix:
projectName: ${{ fromJson(needs.get-affected.outputs.test-e2e) }}
steps:
- run: echo ${{ fromJson(needs.get-affected.outputs.test-e2e) }}

1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
auto-install-peers=true
strict-peer-dependencies=false
fetch-retry-maxtimeout=30000
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,10 @@ Novu provides a single API to manage providers across multiple channels with a s
- [x] [Mandrill](https://github.com/novuhq/novu/tree/main/providers/mandrill)
- [x] [SendinBlue](https://github.com/novuhq/novu/tree/main/providers/sendinblue)
- [x] [MailerSend](https://github.com/novuhq/novu/tree/main/providers/mailersend)
- [x] [Infobip](https://github.com/novuhq/novu/tree/main/providers/infobip)
- [x] [Resend](https://github.com/novuhq/novu/tree/main/providers/resend)
- [ ] SparkPost
- [x] [SparkPost](https://github.com/novuhq/novu/tree/main/providers/sparkpost)
- [x] [Outlook 365](https://github.com/novuhq/novu/tree/main/providers/outlook365)

#### 📞 SMS

Expand All @@ -156,14 +158,23 @@ Novu provides a single API to manage providers across multiple channels with a s
- [x] [Telnyx](https://github.com/novuhq/novu/tree/main/providers/telnyx)
- [x] [Termii](https://github.com/novuhq/novu/tree/main/providers/termii)
- [x] [Gupshup](https://github.com/novuhq/novu/tree/main/providers/gupshup)
- [x] [SMS Central](https://github.com/novuhq/novu/tree/main/providers/sms-central)
- [x] [Maqsam](https://github.com/novuhq/novu/tree/main/providers/maqsam)
- [x] [46elks](https://github.com/novuhq/novu/tree/main/providers/forty-six-elks)
- [x] [Clickatell](https://github.com/novuhq/novu/tree/main/providers/clickatell)
- [x] [Burst SMS](https://github.com/novuhq/novu/tree/main/providers/burst-sms)
- [x] [Firetext](https://github.com/novuhq/novu/tree/main/providers/firetext)
- [x] [Infobip](https://github.com/novuhq/novu/tree/main/providers/infobip)
- [x] [SNS](https://github.com/novuhq/novu/tree/main/providers/sns)
- [ ] Bandwidth
- [ ] RingCentral

#### 📱 Push

- [x] [FCM](https://github.com/novuhq/novu/tree/main/providers/fcm)
- [x] [Expo](https://github.com/novuhq/novu/tree/main/providers/expo)
- [x] [SNS](https://github.com/novuhq/novu/tree/main/providers/sns)
- [x] [APNS](https://github.com/novuhq/novu/tree/main/providers/apns)
- [ ] OneSignal
- [ ] Pushwoosh

#### 👇 Chat
Expand Down
6 changes: 6 additions & 0 deletions apps/api/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,11 @@ module.exports = {
rules: {
'func-names': 'off',
},
parserOptions: {
project: './tsconfig.json',
ecmaVersion: 2020,
sourceType: 'module',
tsconfigRootDir: __dirname,
},
ignorePatterns: '*.spec.ts',
};
1 change: 1 addition & 0 deletions apps/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ RUN rm -rf node_modules && pnpm recursive exec -- rm -rf ./src ./node_modules

# ------- PRODUCTION BUILD ----------
FROM dev_base AS prod

ARG PACKAGE_PATH

ENV CI=true
Expand Down
8 changes: 4 additions & 4 deletions apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@nestjs/axios": "~2.0.0",
"@nestjs/common": "9.3.12",
"@nestjs/core": "9.3.12",
"@nestjs/graphql": "10.2.0",
"@nestjs/graphql": "10.2.1",
"@nestjs/jwt": "9.0.0",
"@nestjs/passport": "9.0.3",
"@nestjs/platform-express": "9.3.12",
Expand Down Expand Up @@ -63,7 +63,7 @@
"handlebars": "^4.7.7",
"hat": "^0.0.3",
"helmet": "^6.0.1",
"ioredis": "5.3.1",
"ioredis": "5.3.2",
"jsonwebtoken": "9.0.0",
"lodash": "^4.17.15",
"nanoid": "^3.1.20",
Expand All @@ -87,7 +87,7 @@
},
"devDependencies": {
"@faker-js/faker": "^6.0.0",
"@nestjs/cli": "9.3.0",
"@nestjs/cli": "9.4.0",
"@nestjs/schematics": "9.0.4",
"@nestjs/testing": "9.3.12",
"@types/bcrypt": "^3.0.0",
Expand All @@ -111,7 +111,7 @@
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
"eslint --fix"
"eslint"
]
}
}
1 change: 1 addition & 0 deletions apps/api/src/.env.development
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ REDIS_CACHE_CONNECTION_TIMEOUT=
REDIS_CACHE_KEEP_ALIVE=
REDIS_CACHE_FAMILY=
REDIS_CACHE_KEY_PREFIX=
REDIS_CACHE_ENABLE_AUTOPIPELINING=true

IN_MEMORY_CLUSTER_MODE_ENABLED=true
ELASTICACHE_CLUSTER_SERVICE_HOST=
Expand Down
1 change: 0 additions & 1 deletion apps/api/src/.env.production
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ REDIS_PORT=6379
REDIS_PREFIX=
REDIS_DB_INDEX=2


IN_MEMORY_CLUSTER_MODE_ENABLED=false
ELASTICACHE_CLUSTER_SERVICE_HOST=
ELASTICACHE_CLUSTER_SERVICE_PORT=
Expand Down
1 change: 1 addition & 0 deletions apps/api/src/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ REDIS_CACHE_CONNECTION_TIMEOUT=
REDIS_CACHE_KEEP_ALIVE=
REDIS_CACHE_FAMILY=
REDIS_CACHE_KEY_PREFIX=
REDIS_CACHE_ENABLE_AUTOPIPELINING=false

IN_MEMORY_CLUSTER_MODE_ENABLED=false
ELASTICACHE_CLUSTER_SERVICE_HOST=
Expand Down
1 change: 1 addition & 0 deletions apps/api/src/.example.env
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ REDIS_CACHE_CONNECTION_TIMEOUT=
REDIS_CACHE_KEEP_ALIVE=
REDIS_CACHE_FAMILY=
REDIS_CACHE_KEY_PREFIX=
REDIS_CACHE_ENABLE_AUTOPIPELINING=

IN_MEMORY_CLUSTER_MODE_ENABLED=false
REDIS_CLUSTER_SERVICE_HOST=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ export class PromoteNotificationTemplateChange {
return step;
};

const steps = newItem.steps ? newItem.steps.map(mapNewStepItem).filter((step) => step !== undefined) : [];
const steps = newItem.steps
? newItem.steps.map(mapNewStepItem).filter((step): step is NotificationStepEntity => step !== undefined)
: [];

if (missingMessages.length > 0 && steps.length > 0 && item) {
Logger.error(
Expand Down Expand Up @@ -108,7 +110,11 @@ export class PromoteNotificationTemplateChange {
}

if (!item) {
return this.notificationTemplateRepository.create({
if (newItem.deleted === true) {
return;
}

const newNotificationTemplate: Partial<NotificationTemplateEntity> = {
name: newItem.name,
active: newItem.active,
draft: newItem.draft,
Expand All @@ -125,7 +131,9 @@ export class PromoteNotificationTemplateChange {
_notificationGroupId: notificationGroup._id,
isBlueprint: command.organizationId === this.blueprintOrganizationId,
blueprintId: newItem.blueprintId,
});
};

return this.notificationTemplateRepository.create(newNotificationTemplate as NotificationTemplateEntity);
}

const count = await this.notificationTemplateRepository.count({
Expand Down
53 changes: 14 additions & 39 deletions apps/api/src/app/events/dtos/trigger-event-request.dto.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,17 @@
import {
ArrayMaxSize,
ArrayNotEmpty,
IsArray,
IsDefined,
IsObject,
IsOptional,
IsString,
MinLength,
} from 'class-validator';
import { ArrayMaxSize, ArrayNotEmpty, IsArray, IsDefined, IsObject, IsOptional, IsString } from 'class-validator';
import { ApiExtraModels, ApiProperty, ApiPropertyOptional, getSchemaPath } from '@nestjs/swagger';
import { TriggerRecipientSubscriber, TriggerRecipients } from '@novu/node';
import { TopicId, TopicKey, TriggerRecipientsTypeEnum } from '@novu/shared';
import { TopicKey, TriggerRecipientsTypeEnum } from '@novu/shared';
import { CreateSubscriberRequestDto } from '../../subscribers/dtos/create-subscriber-request.dto';

export class SubscriberPayloadDto {
@ApiProperty()
firstName?: string;
@ApiProperty()
lastName?: string;
@ApiProperty()
email?: string;
@ApiProperty()
phone?: string;
@ApiProperty()
avatar?: string;
@ApiProperty()
locale?: string;
}
export class SubscriberPayloadDto extends CreateSubscriberRequestDto {}

export class TopicPayloadDto {
@ApiProperty()
topicKey: TopicKey;
@ApiProperty()
type: TriggerRecipientsTypeEnum.TOPIC;

@ApiProperty({ example: 'Topic', enum: TriggerRecipientsTypeEnum })
type: TriggerRecipientsTypeEnum;
}

export class BulkTriggerEventDto {
Expand Down Expand Up @@ -72,7 +52,9 @@ export class TriggerEventRequestDto {
description: 'This could be used to override provider specific configurations',
example: {
fcm: {
color: '#fff',
data: {
key: 'value',
},
},
},
})
Expand All @@ -87,22 +69,15 @@ export class TriggerEventRequestDto {
$ref: getSchemaPath(SubscriberPayloadDto),
},
{
type: '[SubscriberPayloadDto]',
description: 'List of subscriber objects',
},
{ type: 'string', description: 'Unique identifier of a subscriber in your systems' },
{
type: '[string]',
description: 'List of subscriber identifiers',
type: 'string',
description: 'Unique identifier of a subscriber in your systems',
example: 'SUBSCRIBER_ID',
},
{
$ref: getSchemaPath(TopicPayloadDto),
},
{
type: '[TopicPayloadDto]',
description: 'List of topics',
},
],
isArray: true,
})
@IsDefined()
to: TriggerRecipients;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ export class TriggerEventToAllRequestDto {
description: 'This could be used to override provider specific configurations',
example: {
fcm: {
color: '#fff',
data: {
key: 'value',
},
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export class InviteMember {
if (process.env.NOVU_API_KEY && (process.env.NODE_ENV === 'dev' || process.env.NODE_ENV === 'production')) {
const novu = new Novu(process.env.NOVU_API_KEY);

// eslint-disable-next-line @cspell/spellchecker
// cspell:disable-next
await novu.trigger(process.env.NOVU_TEMPLATEID_INVITE_TO_ORGANISATION || 'invite-to-organization-wBnO8NpDn', {
to: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export class ResendInvite {
if (process.env.NODE_ENV === 'dev' || process.env.NODE_ENV === 'production') {
const novu = new Novu(process.env.NOVU_API_KEY ?? '');

// eslint-disable-next-line @cspell/spellchecker
// cspell:disable-next
await novu.trigger(process.env.NOVU_TEMPLATEID_INVITE_TO_ORGANISATION || 'invite-to-organization-wBnO8NpDn', {
to: {
Expand Down
Loading

2 comments on commit baba90d

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.