-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add NotificationsBroker to dispatch notification via arbitrary channels * add nodemailer * clena up mail package * refine interface * await send * add NotificationBroker to incomingMessage * read notificationChannels from config * add formats to ajv * add persistance for Notifications * add endpoints to set user config * fix build * add docs * fix typo in NotificationChannel * move NotificationBroker to a dedicated file * release new versions of shared and delivery * release react v2.10 * fix imports * fix imports #2 * fix: backend logging issue --------- Co-authored-by: Heiko Burkhardt <[email protected]>
- Loading branch information
Showing
41 changed files
with
968 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import { getDeliveryServiceProperties } from './getDeliveryServiceProperties'; | ||
import { writeFileSync, unlinkSync, existsSync } from 'fs'; | ||
import { stringify } from 'yaml'; | ||
import { existsSync, unlinkSync, writeFileSync } from 'fs'; | ||
import { resolve } from 'path'; | ||
import { stringify } from 'yaml'; | ||
import { getDeliveryServiceProperties } from './getDeliveryServiceProperties'; | ||
import { NotificationChannelType } from 'dm3-lib-delivery'; | ||
|
||
describe('ReadDeliveryServiceProperties', () => { | ||
let path: string; | ||
|
@@ -19,9 +20,14 @@ describe('ReadDeliveryServiceProperties', () => { | |
const config = getDeliveryServiceProperties('/unknown-path', { | ||
messageTTL: 12345, | ||
sizeLimit: 456, | ||
notificationChannel: [], | ||
}); | ||
|
||
expect(config).toStrictEqual({ messageTTL: 12345, sizeLimit: 456 }); | ||
expect(config).toStrictEqual({ | ||
messageTTL: 12345, | ||
sizeLimit: 456, | ||
notificationChannel: [], | ||
}); | ||
}); | ||
|
||
it('Returns Config from path', () => { | ||
|
@@ -30,6 +36,21 @@ describe('ReadDeliveryServiceProperties', () => { | |
stringify({ | ||
messageTTL: 12345, | ||
sizeLimit: 456, | ||
notificationChannel: [ | ||
{ | ||
type: NotificationChannelType.EMAIL, | ||
config: { | ||
host: 'mail.alice.com', | ||
port: 465, | ||
secure: true, | ||
auth: { | ||
user: 'foo', | ||
pass: 'bar', | ||
}, | ||
senderAddress: '[email protected]', | ||
}, | ||
}, | ||
], | ||
}), | ||
{ encoding: 'utf-8' }, | ||
); | ||
|
@@ -38,6 +59,21 @@ describe('ReadDeliveryServiceProperties', () => { | |
expect(config).toStrictEqual({ | ||
messageTTL: 12345, | ||
sizeLimit: 456, | ||
notificationChannel: [ | ||
{ | ||
type: NotificationChannelType.EMAIL, | ||
config: { | ||
host: 'mail.alice.com', | ||
port: 465, | ||
secure: true, | ||
auth: { | ||
user: 'foo', | ||
pass: 'bar', | ||
}, | ||
senderAddress: '[email protected]', | ||
}, | ||
}, | ||
], | ||
}); | ||
}); | ||
it('Adds default properties if config.yml is not fully specified', () => { | ||
|
@@ -53,6 +89,7 @@ describe('ReadDeliveryServiceProperties', () => { | |
expect(config).toStrictEqual({ | ||
messageTTL: 12345, | ||
sizeLimit: 100000, | ||
notificationChannel: [], | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.