10 Commits

Author SHA1 Message Date
2117c2f5d9 1.0.12 2020-01-21 10:05:36 +00:00
ca0daf2454 fix(core): update 2020-01-21 10:05:35 +00:00
ad6d18d306 1.0.11 2020-01-13 15:52:28 +00:00
7ddcd88862 fix(core): update 2020-01-13 15:52:27 +00:00
9d6b7f3b29 1.0.10 2020-01-13 15:52:03 +00:00
8be9fc38b6 fix(core): update 2020-01-13 15:52:02 +00:00
6bb3bb7d9a 1.0.9 2020-01-13 15:19:48 +00:00
7fcbd39166 fix(core): update 2020-01-13 15:19:47 +00:00
1e38d6564d 1.0.8 2020-01-12 18:57:15 +00:00
9b3c0e88da fix(core): update 2020-01-12 18:57:15 +00:00
4 changed files with 40 additions and 31 deletions

48
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartmail", "name": "@pushrocks/smartmail",
"version": "1.0.7", "version": "1.0.12",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -146,7 +146,7 @@
}, },
"@pushrocks/early": { "@pushrocks/early": {
"version": "3.0.3", "version": "3.0.3",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fearly/-/early-3.0.3.tgz", "resolved": "https://registry.npmjs.org/@pushrocks/early/-/early-3.0.3.tgz",
"integrity": "sha512-71/nwxTpqdp1glmHz4YaGusNl/XOOcPelAxC9RA6rpS/6280QyY2u4yx+mRdMrCzn7ruLYF5awbkS8llNZ94Pg==", "integrity": "sha512-71/nwxTpqdp1glmHz4YaGusNl/XOOcPelAxC9RA6rpS/6280QyY2u4yx+mRdMrCzn7ruLYF5awbkS8llNZ94Pg==",
"dev": true, "dev": true,
"requires": { "requires": {
@ -334,11 +334,11 @@
} }
}, },
"@pushrocks/smartmustache": { "@pushrocks/smartmustache": {
"version": "2.0.8", "version": "2.0.9",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartmustache/-/smartmustache-2.0.8.tgz", "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartmustache/-/smartmustache-2.0.9.tgz",
"integrity": "sha512-bnOST5zKPKSpCUiYqSHRdJ4NpO3/xz3LLtNE+xfWLS9Eyor/dIapqOpqwmZXNYr8QZuZWC//dlTIiQcv02D8Rg==", "integrity": "sha512-Wumikw03se8/hpPDyBUt0o/JynkNLhuv667jUYyXmTbs4DLnlRAwTpLTYDUoaJpNWsCN3Jg9AgVSrteRozbFig==",
"requires": { "requires": {
"handlebars": "^4.4.5" "handlebars": "^4.7.1"
} }
}, },
"@pushrocks/smartparam": { "@pushrocks/smartparam": {
@ -621,7 +621,7 @@
}, },
"assertion-error": { "assertion-error": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://verdaccio.lossless.one/assertion-error/-/assertion-error-1.1.0.tgz", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz",
"integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==",
"dev": true "dev": true
}, },
@ -664,7 +664,7 @@
}, },
"chai": { "chai": {
"version": "4.2.0", "version": "4.2.0",
"resolved": "https://verdaccio.lossless.one/chai/-/chai-4.2.0.tgz", "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz",
"integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==", "integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==",
"dev": true, "dev": true,
"requires": { "requires": {
@ -678,7 +678,7 @@
}, },
"chai-as-promised": { "chai-as-promised": {
"version": "7.1.1", "version": "7.1.1",
"resolved": "https://verdaccio.lossless.one/chai-as-promised/-/chai-as-promised-7.1.1.tgz", "resolved": "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-7.1.1.tgz",
"integrity": "sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA==", "integrity": "sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA==",
"dev": true, "dev": true,
"requires": { "requires": {
@ -687,7 +687,7 @@
}, },
"chai-string": { "chai-string": {
"version": "1.5.0", "version": "1.5.0",
"resolved": "https://verdaccio.lossless.one/chai-string/-/chai-string-1.5.0.tgz", "resolved": "https://registry.npmjs.org/chai-string/-/chai-string-1.5.0.tgz",
"integrity": "sha512-sydDC3S3pNAQMYwJrs6dQX0oBQ6KfIPuOZ78n7rocW0eJJlsHPh2t3kwW7xfwYA/1Bf6/arGtSUo16rxR2JFlw==", "integrity": "sha512-sydDC3S3pNAQMYwJrs6dQX0oBQ6KfIPuOZ78n7rocW0eJJlsHPh2t3kwW7xfwYA/1Bf6/arGtSUo16rxR2JFlw==",
"dev": true "dev": true
}, },
@ -704,7 +704,7 @@
}, },
"check-error": { "check-error": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://verdaccio.lossless.one/check-error/-/check-error-1.0.2.tgz", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz",
"integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=",
"dev": true "dev": true
}, },
@ -811,7 +811,7 @@
}, },
"deep-eql": { "deep-eql": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://verdaccio.lossless.one/deep-eql/-/deep-eql-3.0.1.tgz", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz",
"integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==",
"dev": true, "dev": true,
"requires": { "requires": {
@ -948,7 +948,7 @@
}, },
"get-func-name": { "get-func-name": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://verdaccio.lossless.one/get-func-name/-/get-func-name-2.0.0.tgz", "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz",
"integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=",
"dev": true "dev": true
}, },
@ -980,9 +980,9 @@
"integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==" "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ=="
}, },
"handlebars": { "handlebars": {
"version": "4.4.5", "version": "4.7.1",
"resolved": "https://verdaccio.lossless.one/handlebars/-/handlebars-4.4.5.tgz", "resolved": "https://verdaccio.lossless.one/handlebars/-/handlebars-4.7.1.tgz",
"integrity": "sha512-0Ce31oWVB7YidkaTq33ZxEbN+UDxMMgThvCe8ptgQViymL5DPis9uLdTA13MiRPhgvqyxIegugrP97iK3JeBHg==", "integrity": "sha512-2dd6soo60cwKNJ90VewNLIzdZPR/E2YhszOTgHpN9V0YuwZk7x33/iZoIBnASwDFVHMY7iJ6NPL8d9f/DWYCTA==",
"requires": { "requires": {
"neo-async": "^2.6.0", "neo-async": "^2.6.0",
"optimist": "^0.6.1", "optimist": "^0.6.1",
@ -1170,7 +1170,7 @@
}, },
"mkdirp": { "mkdirp": {
"version": "0.5.1", "version": "0.5.1",
"resolved": "https://verdaccio.lossless.one/mkdirp/-/mkdirp-0.5.1.tgz", "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"dev": true, "dev": true,
"requires": { "requires": {
@ -1179,7 +1179,7 @@
"dependencies": { "dependencies": {
"minimist": { "minimist": {
"version": "0.0.8", "version": "0.0.8",
"resolved": "https://verdaccio.lossless.one/minimist/-/minimist-0.0.8.tgz", "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
"dev": true "dev": true
} }
@ -1374,7 +1374,7 @@
}, },
"pathval": { "pathval": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://verdaccio.lossless.one/pathval/-/pathval-1.1.0.tgz", "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz",
"integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=",
"dev": true "dev": true
}, },
@ -1478,7 +1478,7 @@
}, },
"smartchai": { "smartchai": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://verdaccio.lossless.one/smartchai/-/smartchai-2.0.1.tgz", "resolved": "https://registry.npmjs.org/smartchai/-/smartchai-2.0.1.tgz",
"integrity": "sha512-9M+R56OhAHXScxgr2vzQqxGx0XMS0QXriNZuP7hjlbVbo2FUT+l60iEzbwPt9Ga+5u2cEEjSSoZEQVqlROaddA==", "integrity": "sha512-9M+R56OhAHXScxgr2vzQqxGx0XMS0QXriNZuP7hjlbVbo2FUT+l60iEzbwPt9Ga+5u2cEEjSSoZEQVqlROaddA==",
"dev": true, "dev": true,
"requires": { "requires": {
@ -1623,7 +1623,7 @@
}, },
"type-detect": { "type-detect": {
"version": "4.0.8", "version": "4.0.8",
"resolved": "https://verdaccio.lossless.one/type-detect/-/type-detect-4.0.8.tgz", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
"integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==",
"dev": true "dev": true
}, },
@ -1634,9 +1634,9 @@
"dev": true "dev": true
}, },
"uglify-js": { "uglify-js": {
"version": "3.6.4", "version": "3.7.5",
"resolved": "https://verdaccio.lossless.one/uglify-js/-/uglify-js-3.6.4.tgz", "resolved": "https://verdaccio.lossless.one/uglify-js/-/uglify-js-3.7.5.tgz",
"integrity": "sha512-9Yc2i881pF4BPGhjteCXQNaXx1DCwm3dtOyBaG2hitHjLWOczw/ki8vD1bqyT3u6K0Ms/FpCShkmfg+FtlOfYA==", "integrity": "sha512-GFZ3EXRptKGvb/C1Sq6nO1iI7AGcjyqmIyOw0DrD0675e+NNbGO72xmMM2iEBdFbxaTLo70NbjM/Wy54uZIlsg==",
"optional": true, "optional": true,
"requires": { "requires": {
"commander": "~2.20.3", "commander": "~2.20.3",

View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartmail", "name": "@pushrocks/smartmail",
"version": "1.0.7", "version": "1.0.12",
"private": false, "private": false,
"description": "a unified format for representing and dealing with mails", "description": "a unified format for representing and dealing with mails",
"main": "dist/index.js", "main": "dist/index.js",
@ -23,7 +23,7 @@
}, },
"dependencies": { "dependencies": {
"@pushrocks/smartfile": "^7.0.6", "@pushrocks/smartfile": "^7.0.6",
"@pushrocks/smartmustache": "^2.0.8" "@pushrocks/smartmustache": "^2.0.9"
}, },
"files": [ "files": [
"ts/**/*", "ts/**/*",

View File

@ -8,7 +8,7 @@ a unified format for representing and dealing with mails
* [docs (typedoc)](https://pushrocks.gitlab.io/smartmail/) * [docs (typedoc)](https://pushrocks.gitlab.io/smartmail/)
## Status for master ## Status for master
[![build status](https://gitlab.com/pushrocks/smartmail/badges/master/build.svg)](https://gitlab.com/pushrocks/smartmail/commits/master) [![pipeline status](https://gitlab.com/pushrocks/smartmail/badges/master/pipeline.svg)](https://gitlab.com/pushrocks/smartmail/commits/master)
[![coverage report](https://gitlab.com/pushrocks/smartmail/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartmail/commits/master) [![coverage report](https://gitlab.com/pushrocks/smartmail/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartmail/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/smartmail.svg)](https://www.npmjs.com/package/@pushrocks/smartmail) [![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/smartmail.svg)](https://www.npmjs.com/package/@pushrocks/smartmail)
[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smartmail/badge.svg)](https://snyk.io/test/npm/@pushrocks/smartmail) [![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smartmail/badge.svg)](https://snyk.io/test/npm/@pushrocks/smartmail)
@ -18,6 +18,10 @@ a unified format for representing and dealing with mails
## Usage ## Usage
## Contribution
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
## Contribution ## Contribution

View File

@ -1,19 +1,20 @@
import * as plugins from './smartmail.plugins'; import * as plugins from './smartmail.plugins';
export interface ISmartmailOptions { export interface ISmartmailOptions<T> {
from: string; from: string;
subject: string; subject: string;
body: string; body: string;
creationObjectRef?: T;
} }
/** /**
* a standard representation for mails * a standard representation for mails
*/ */
export class Smartmail { export class Smartmail<T> {
public options: ISmartmailOptions; public options: ISmartmailOptions<T>;
public attachments: plugins.smartfile.Smartfile[] = []; public attachments: plugins.smartfile.Smartfile[] = [];
constructor(optionsArg: ISmartmailOptions) { constructor(optionsArg: ISmartmailOptions<T>) {
this.options = optionsArg; this.options = optionsArg;
} }
@ -21,6 +22,10 @@ export class Smartmail {
this.attachments.push(smartfileArg); this.attachments.push(smartfileArg);
} }
public getCreationObject(): T {
return this.options.creationObjectRef;
}
public getSubject(dataArg: any = {}) { public getSubject(dataArg: any = {}) {
const smartmustache = new plugins.smartmustache.SmartMustache(this.options.subject); const smartmustache = new plugins.smartmustache.SmartMustache(this.options.subject);
return smartmustache.applyData(dataArg); return smartmustache.applyData(dataArg);