fix(core): update

This commit is contained in:
Philipp Kunz 2020-08-11 14:47:25 +00:00
parent 13e064207f
commit b08b9abb38
4 changed files with 10029 additions and 409 deletions

10417
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -13,17 +13,17 @@
"format": "(gitzone format)" "format": "(gitzone format)"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.22", "@gitzone/tsbuild": "^2.1.25",
"@gitzone/tstest": "^1.0.15", "@gitzone/tstest": "^1.0.43",
"@pushrocks/qenv": "^4.0.6", "@pushrocks/qenv": "^4.0.10",
"@pushrocks/tapbundle": "^3.2.1", "@pushrocks/tapbundle": "^3.2.9",
"@types/node": "^13.13.4", "@types/node": "^14.0.27",
"tslint": "^6.1.1", "tslint": "^6.1.3",
"tslint-config-prettier": "^1.15.0" "tslint-config-prettier": "^1.15.0"
}, },
"dependencies": { "dependencies": {
"@pushrocks/smartfile": "^7.0.12", "@pushrocks/smartfile": "^8.0.0",
"@pushrocks/smartmail": "^1.0.11", "@pushrocks/smartmail": "^1.0.18",
"@pushrocks/smartrequest": "^1.1.47", "@pushrocks/smartrequest": "^1.1.47",
"@pushrocks/smartstring": "^3.0.18" "@pushrocks/smartstring": "^3.0.18"
}, },

View File

@ -28,6 +28,17 @@ tap.test('should send a smartmail', async () => {
await testMailgunAccount.sendSmartMail(testSmartmail, 'Sandbox Team <sandbox@mail.git.zone>'); await testMailgunAccount.sendSmartMail(testSmartmail, 'Sandbox Team <sandbox@mail.git.zone>');
}); });
tap.test('should send a smartmail with empty body', async () => {
const emptyBodySmartmail = new smartmail.Smartmail<IMailgunMessage>({
body: '',
from: 'Lossless GmbH <noreply@mail.lossless.com>',
subject: 'A message with no body from @mojoio/mailgun test'
});
console.log('ok');
await testMailgunAccount.sendSmartMail(emptyBodySmartmail, 'Sandbox Team <sandbox@mail.git.zone>');
console.log('hey');
});
tap.test('should retrieve a mail using a retrieval url', async () => { tap.test('should retrieve a mail using a retrieval url', async () => {
const result = await testMailgunAccount.retrieveSmartMailFromMessageUrl( const result = await testMailgunAccount.retrieveSmartMailFromMessageUrl(
'https://sw.api.mailgun.net/v3/domains/mail.lossless.one/messages/AgMFnnnAKC8xp_dDa79LyoxhloxtaVmnRA==' 'https://sw.api.mailgun.net/v3/domains/mail.lossless.one/messages/AgMFnnnAKC8xp_dDa79LyoxhloxtaVmnRA=='

View File

@ -19,7 +19,8 @@ export class MailgunAccount {
headers: { headers: {
Authorization: `Basic ${plugins.smartstring.base64.encode(`api:${this.apiToken}`)}`, Authorization: `Basic ${plugins.smartstring.base64.encode(`api:${this.apiToken}`)}`,
'Content-Type': 'application/json' 'Content-Type': 'application/json'
} },
keepAlive: false
}; };
let response: plugins.smartrequest.IExtendedIncomingMessage; let response: plugins.smartrequest.IExtendedIncomingMessage;
if (!binaryArg) { if (!binaryArg) {
@ -37,7 +38,8 @@ export class MailgunAccount {
{ {
headers: { headers: {
Authorization: `Basic ${plugins.smartstring.base64.encode(`api:${this.apiToken}`)}` Authorization: `Basic ${plugins.smartstring.base64.encode(`api:${this.apiToken}`)}`
} },
keepAlive: false
}, },
formFields formFields
); );
@ -68,13 +70,23 @@ export class MailgunAccount {
name: 'subject', name: 'subject',
type: 'string', type: 'string',
payload: smartmailArg.getSubject(dataArg) payload: smartmailArg.getSubject(dataArg)
}, }
{ ];
if (smartmailArg.getBody(dataArg)) {
formFields.push({
name: 'html', name: 'html',
type: 'string', type: 'string',
payload: smartmailArg.getBody(dataArg) payload: smartmailArg.getBody(dataArg)
});
} else {
console.log('message has no body');
formFields.push({
name: 'html',
type: 'string',
payload: 'The sender did not provide a bodytext.'
});
} }
];
console.log(smartmailArg.attachments); console.log(smartmailArg.attachments);