From 108f48382390ddb7ce4e44a324b7e59f0b4d77ec Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Thu, 13 Aug 2020 01:37:26 +0000 Subject: [PATCH] fix(core): update --- .gitlab-ci.yml | 26 ++-- .vscode/settings.json | 2 +- package-lock.json | 229 +++++++++++++++------------------- package.json | 5 +- test/test.ts | 9 +- ts/mailgun.classes.account.ts | 22 +++- 6 files changed, 143 insertions(+), 150 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8ebc8b5..9a4467e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,23 +19,35 @@ mirror: stage: security script: - npmci git mirror + only: + - tags tags: - lossless - docker - notpriv -audit: +auditProductionDependencies: + image: registry.gitlab.com/hosttoday/ht-docker-node:npmci + stage: security + script: + - npmci npm prepare + - npmci command npm install --production --ignore-scripts + - npmci command npm config set registry https://registry.npmjs.org + - npmci command npm audit --audit-level=high --only=prod --production + tags: + - docker + +auditDevDependencies: image: registry.gitlab.com/hosttoday/ht-docker-node:npmci stage: security script: - npmci npm prepare - npmci command npm install --ignore-scripts - npmci command npm config set registry https://registry.npmjs.org - - npmci command npm audit --audit-level=high + - npmci command npm audit --audit-level=high --only=dev tags: - - lossless - docker - - notpriv + allow_failure: true # ==================== # test stage @@ -50,9 +62,7 @@ testStable: - npmci npm test coverage: /\d+.?\d+?\%\s*coverage/ tags: - - lossless - docker - - priv testBuild: stage: test @@ -63,9 +73,7 @@ testBuild: - npmci command npm run build coverage: /\d+.?\d+?\%\s*coverage/ tags: - - lossless - docker - - notpriv release: stage: release @@ -85,6 +93,8 @@ release: codequality: stage: metadata allow_failure: true + only: + - tags script: - npmci command npm install -g tslint typescript - npmci npm prepare diff --git a/.vscode/settings.json b/.vscode/settings.json index 01d2b8d..3648eaa 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -15,7 +15,7 @@ "properties": { "projectType": { "type": "string", - "enum": ["website", "element", "service", "npm"] + "enum": ["website", "element", "service", "npm", "wcc"] } } } diff --git a/package-lock.json b/package-lock.json index f98b1ca..6258d6b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1160,9 +1160,9 @@ } }, "@gitzone/tsbundle": { - "version": "1.0.73", - "resolved": "https://verdaccio.lossless.one/@gitzone%2ftsbundle/-/tsbundle-1.0.73.tgz", - "integrity": "sha512-mGdjsG9QhUvwcGArNqF2bqT67bWVhl7MyrJyxD0a7quGtKWt4MxHHBmPW/rBnBtlhlhEYvxuhdpTDrJh+Rdllg==", + "version": "1.0.78", + "resolved": "https://verdaccio.lossless.one/@gitzone%2ftsbundle/-/tsbundle-1.0.78.tgz", + "integrity": "sha512-QcjzUPYfp7w2uaNom2eOFiBBPabVOqmaI7Cun1P+BBB+a8JwNlpyNOwDY6cPr2MEW2t9Picbiz9yyqkG1qYrtw==", "dev": true, "requires": { "@babel/core": "^7.11.1", @@ -1171,24 +1171,23 @@ "@babel/plugin-transform-runtime": "^7.11.0", "@babel/preset-env": "^7.11.0", "@babel/runtime": "^7.11.2", - "@pushrocks/early": "^3.0.3", + "@pushrocks/early": "^3.0.6", "@pushrocks/smartcli": "^3.0.12", "@pushrocks/smartfile": "^8.0.0", "@pushrocks/smartlog": "^2.0.36", "@pushrocks/smartlog-destination-local": "^8.0.8", "@pushrocks/smartparcel": "^1.0.5", - "@rollup/plugin-commonjs": "^12.0.0", + "@rollup/plugin-commonjs": "^14.0.0", "@rollup/plugin-json": "^4.1.0", "@rollup/plugin-node-resolve": "^8.4.0", - "@rollup/plugin-typescript": "^4.1.2", - "@types/html-minifier": "^3.5.3", + "@rollup/plugin-typescript": "^5.0.2", + "@types/html-minifier": "^4.0.0", "@types/node": "^14.0.27", "html-minifier": "^4.0.0", "rollup": "^2.23.1", "rollup-plugin-babel": "^4.4.0", "rollup-plugin-sourcemaps": "^0.6.2", - "rollup-plugin-terser": "^5.3.0", - "terser": "^4.7.0", + "rollup-plugin-terser": "^6.1.0", "typescript": "^3.9.7" } }, @@ -1258,78 +1257,24 @@ } }, "@gitzone/tstest": { - "version": "1.0.43", - "resolved": "https://verdaccio.lossless.one/@gitzone%2ftstest/-/tstest-1.0.43.tgz", - "integrity": "sha512-wuNBhBDUHHb1TOLQ+QAtUUAhR9Y3uXFR9J0L/KW9DIhh4LPxFdje1tPUGqUbXCWCJ3bt4AWtVBd39K5Z8lSEXQ==", + "version": "1.0.44", + "resolved": "https://verdaccio.lossless.one/@gitzone%2ftstest/-/tstest-1.0.44.tgz", + "integrity": "sha512-IzQ9mEboN17Vgm/ecW2GtJa8FsnxDawD0PTeWfvtFbS4KNcqOxVM/gkkO7H4f1eJuzDaMvKWlsjBt2DBRhKqSg==", "dev": true, "requires": { - "@gitzone/tsbundle": "^1.0.72", + "@gitzone/tsbundle": "^1.0.78", "@gitzone/tsrun": "^1.2.12", "@pushrocks/consolecolor": "^2.0.1", "@pushrocks/smartbrowser": "^1.0.17", - "@pushrocks/smartdelay": "^2.0.9", - "@pushrocks/smartexpress": "^3.0.73", - "@pushrocks/smartfile": "^7.0.6", - "@pushrocks/smartlog": "^2.0.19", + "@pushrocks/smartdelay": "^2.0.10", + "@pushrocks/smartexpress": "^3.0.76", + "@pushrocks/smartfile": "^8.0.0", + "@pushrocks/smartlog": "^2.0.36", "@pushrocks/smartpromise": "^3.0.6", "@pushrocks/smartshell": "^2.0.25", "@pushrocks/tapbundle": "^3.2.9", "@types/figures": "^3.0.1", "figures": "^3.0.0" - }, - "dependencies": { - "@pushrocks/smartfile": { - "version": "7.0.12", - "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartfile/-/smartfile-7.0.12.tgz", - "integrity": "sha512-/4T4K07WqOXGvQQ/VFyRMUd8kN1RdqQgmrqHjZE/vMDLz7RYsqU9FlEN6OGX1G1E6pR9IdHnT4ClXPlvzClHYg==", - "dev": true, - "requires": { - "@pushrocks/smarthash": "^2.1.6", - "@pushrocks/smartmime": "^1.0.3", - "@pushrocks/smartpath": "^4.0.1", - "@pushrocks/smartpromise": "^3.0.6", - "@pushrocks/smartrequest": "^1.1.47", - "@types/fs-extra": "^8.1.0", - "fs-extra": "^8.1.0", - "glob": "^7.1.6", - "js-yaml": "^3.13.1" - } - }, - "@types/fs-extra": { - "version": "8.1.1", - "resolved": "https://verdaccio.lossless.one/@types%2ffs-extra/-/fs-extra-8.1.1.tgz", - "integrity": "sha512-TcUlBem321DFQzBNuz8p0CLLKp0VvF/XH9E4KHNmgwyp4E3AfgI5cjiIVZWlbfThBop2qxFIh4+LeY6hVWWZ2w==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "fs-extra": { - "version": "8.1.0", - "resolved": "https://verdaccio.lossless.one/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", - "dev": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "jsonfile": { - "version": "4.0.0", - "resolved": "https://verdaccio.lossless.one/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "universalify": { - "version": "0.1.2", - "resolved": "https://verdaccio.lossless.one/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true - } } }, "@iarna/toml": { @@ -2234,9 +2179,9 @@ } }, "@rollup/plugin-commonjs": { - "version": "12.0.0", - "resolved": "https://verdaccio.lossless.one/@rollup%2fplugin-commonjs/-/plugin-commonjs-12.0.0.tgz", - "integrity": "sha512-8+mDQt1QUmN+4Y9D3yCG8AJNewuTSLYPJVzKKUZ+lGeQrI+bV12Tc5HCyt2WdlnG6ihIL/DPbKRJlB40DX40mw==", + "version": "14.0.0", + "resolved": "https://verdaccio.lossless.one/@rollup%2fplugin-commonjs/-/plugin-commonjs-14.0.0.tgz", + "integrity": "sha512-+PSmD9ePwTAeU106i9FRdc+Zb3XUWyW26mo5Atr2mk82hor8+nPwkztEjFo8/B1fJKfaQDg9aM2bzQkjhi7zOw==", "dev": true, "requires": { "@rollup/pluginutils": "^3.0.8", @@ -2284,9 +2229,9 @@ } }, "@rollup/plugin-typescript": { - "version": "4.1.2", - "resolved": "https://verdaccio.lossless.one/@rollup%2fplugin-typescript/-/plugin-typescript-4.1.2.tgz", - "integrity": "sha512-+7UlGat/99e2JbmGNnIauxwEhYLwrL7adO/tSJxUN57xrrS3Ps+ZzYpLCDGPZJ57j+ZJTZLLN89KXW9JMEB+jg==", + "version": "5.0.2", + "resolved": "https://verdaccio.lossless.one/@rollup%2fplugin-typescript/-/plugin-typescript-5.0.2.tgz", + "integrity": "sha512-CkS028Itwjqm1uLbFVfpJgtVtnNvZ+og/m6UlNRR5wOOnNTWPcVQzOu5xGdEX+WWJxdvWIqUq2uR/RBt2ZipWg==", "dev": true, "requires": { "@rollup/pluginutils": "^3.0.1", @@ -2542,9 +2487,9 @@ } }, "@types/html-minifier": { - "version": "3.5.3", - "resolved": "https://verdaccio.lossless.one/@types%2fhtml-minifier/-/html-minifier-3.5.3.tgz", - "integrity": "sha512-j1P/4PcWVVCPEy5lofcHnQ6BtXz9tHGiFPWzqm7TtGuWZEfCHEP446HlkSNc9fQgNJaJZ6ewPtp2aaFla/Uerg==", + "version": "4.0.0", + "resolved": "https://verdaccio.lossless.one/@types%2fhtml-minifier/-/html-minifier-4.0.0.tgz", + "integrity": "sha512-eFnGhrKmjWBlnSGNtunetE3UU2Tc/LUl92htFslSSTmpp9EKHQVcYQadCyYfnzUEFB5G/3wLWo/USQS/mEPKrA==", "dev": true, "requires": { "@types/clean-css": "*", @@ -2902,14 +2847,15 @@ } }, "asn1.js": { - "version": "4.10.1", - "resolved": "https://verdaccio.lossless.one/asn1.js/-/asn1.js-4.10.1.tgz", - "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", + "version": "5.4.1", + "resolved": "https://verdaccio.lossless.one/asn1.js/-/asn1.js-5.4.1.tgz", + "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", "dev": true, "requires": { "bn.js": "^4.0.0", "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0" + "minimalistic-assert": "^1.0.0", + "safer-buffer": "^2.1.0" }, "dependencies": { "bn.js": { @@ -3008,9 +2954,9 @@ "dev": true }, "aws4": { - "version": "1.10.0", - "resolved": "https://verdaccio.lossless.one/aws4/-/aws4-1.10.0.tgz", - "integrity": "sha512-3YDiu347mtVtjpyV3u5kVqQLP242c06zwDOgpeRnybmXlYYsLbtTrUBUm8i8srONt+FWobl5aibnU1030PeeuA==", + "version": "1.10.1", + "resolved": "https://verdaccio.lossless.one/aws4/-/aws4-1.10.1.tgz", + "integrity": "sha512-zg7Hz2k5lI8kb7U32998pRRFin7zJlkfezGJjUc2heaD4Pw2wObakCDVzkKztTm/Ln7eiVvYsjqak0Ed4LkMDA==", "dev": true }, "babel-plugin-dynamic-import-node": { @@ -4844,9 +4790,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.3.529", - "resolved": "https://verdaccio.lossless.one/electron-to-chromium/-/electron-to-chromium-1.3.529.tgz", - "integrity": "sha512-n3sriLldqNyjBlosbnPftjCY+m1dVOY307I1Y0HaHAqDGe3hRvK7ksJwWd+qs599ybR4jobCo1+7zXM9GyNMSA==", + "version": "1.3.532", + "resolved": "https://verdaccio.lossless.one/electron-to-chromium/-/electron-to-chromium-1.3.532.tgz", + "integrity": "sha512-6PYzSCIa/Q2PImAHYLrvKPxuwFqDcvCzRT9w26Szd9psPa9et/t4TzgjaoX7wkBIfkhhgRQWwHWeUHOM4cJdRw==", "dev": true }, "elliptic": { @@ -6625,6 +6571,17 @@ "posthtml-parser": "^0.4.2", "posthtml-render": "^1.2.2" } + }, + "terser": { + "version": "4.8.0", + "resolved": "https://verdaccio.lossless.one/terser/-/terser-4.8.0.tgz", + "integrity": "sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw==", + "dev": true, + "requires": { + "commander": "^2.20.0", + "source-map": "~0.6.1", + "source-map-support": "~0.5.12" + } } } }, @@ -7132,22 +7089,29 @@ "dev": true }, "jest-worker": { - "version": "24.9.0", - "resolved": "https://verdaccio.lossless.one/jest-worker/-/jest-worker-24.9.0.tgz", - "integrity": "sha512-51PE4haMSXcHohnSMdM42anbvZANYTqMrr52tVKPqqsPJMzoP6FYYDVqahX/HrAoKEKz3uUPzSvKs9A3qR4iVw==", + "version": "26.3.0", + "resolved": "https://verdaccio.lossless.one/jest-worker/-/jest-worker-26.3.0.tgz", + "integrity": "sha512-Vmpn2F6IASefL+DVBhPzI2J9/GJUsqzomdeN+P+dK8/jKxbh8R3BtFnx3FIta7wYlPU62cpJMJQo4kuOowcMnw==", "dev": true, "requires": { + "@types/node": "*", "merge-stream": "^2.0.0", - "supports-color": "^6.1.0" + "supports-color": "^7.0.0" }, "dependencies": { + "has-flag": { + "version": "4.0.0", + "resolved": "https://verdaccio.lossless.one/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, "supports-color": { - "version": "6.1.0", - "resolved": "https://verdaccio.lossless.one/supports-color/-/supports-color-6.1.0.tgz", - "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "version": "7.1.0", + "resolved": "https://verdaccio.lossless.one/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", "dev": true, "requires": { - "has-flag": "^3.0.0" + "has-flag": "^4.0.0" } } } @@ -8305,29 +8269,17 @@ "requires": { "minimist": "^1.2.0" } - }, - "terser": { - "version": "3.17.0", - "resolved": "https://verdaccio.lossless.one/terser/-/terser-3.17.0.tgz", - "integrity": "sha512-/FQzzPJmCpjAH9Xvk2paiWrFq+5M6aVOf+2KRbwhByISDX/EujxsK+BAvrhb6H+2rtrLCHK9N01wO014vrIwVQ==", - "dev": true, - "requires": { - "commander": "^2.19.0", - "source-map": "~0.6.1", - "source-map-support": "~0.5.10" - } } } }, "parse-asn1": { - "version": "5.1.5", - "resolved": "https://verdaccio.lossless.one/parse-asn1/-/parse-asn1-5.1.5.tgz", - "integrity": "sha512-jkMYn1dcJqF6d5CpU689bq7w/b5ALS9ROVSpQDPrZsqqesUJii9qutvoT5ltGedNXMO2e16YUWIghG9KxaViTQ==", + "version": "5.1.6", + "resolved": "https://verdaccio.lossless.one/parse-asn1/-/parse-asn1-5.1.6.tgz", + "integrity": "sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==", "dev": true, "requires": { - "asn1.js": "^4.0.0", + "asn1.js": "^5.2.0", "browserify-aes": "^1.0.0", - "create-hash": "^1.1.0", "evp_bytestokey": "^1.0.0", "pbkdf2": "^3.0.3", "safe-buffer": "^5.1.1" @@ -9634,16 +9586,28 @@ } }, "rollup-plugin-terser": { - "version": "5.3.0", - "resolved": "https://verdaccio.lossless.one/rollup-plugin-terser/-/rollup-plugin-terser-5.3.0.tgz", - "integrity": "sha512-XGMJihTIO3eIBsVGq7jiNYOdDMb3pVxuzY0uhOE/FM4x/u9nQgr3+McsjzqBn3QfHIpNSZmFnpoKAwHBEcsT7g==", + "version": "6.1.0", + "resolved": "https://verdaccio.lossless.one/rollup-plugin-terser/-/rollup-plugin-terser-6.1.0.tgz", + "integrity": "sha512-4fB3M9nuoWxrwm39habpd4hvrbrde2W2GG4zEGPQg1YITNkM3Tqur5jSuXlWNzbv/2aMLJ+dZJaySc3GCD8oDw==", "dev": true, "requires": { - "@babel/code-frame": "^7.5.5", - "jest-worker": "^24.9.0", - "rollup-pluginutils": "^2.8.2", - "serialize-javascript": "^2.1.2", - "terser": "^4.6.2" + "@babel/code-frame": "^7.8.3", + "jest-worker": "^26.0.0", + "serialize-javascript": "^3.0.0", + "terser": "^4.7.0" + }, + "dependencies": { + "terser": { + "version": "4.8.0", + "resolved": "https://verdaccio.lossless.one/terser/-/terser-4.8.0.tgz", + "integrity": "sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw==", + "dev": true, + "requires": { + "commander": "^2.20.0", + "source-map": "~0.6.1", + "source-map-support": "~0.5.12" + } + } } }, "rollup-pluginutils": { @@ -9760,10 +9724,13 @@ } }, "serialize-javascript": { - "version": "2.1.2", - "resolved": "https://verdaccio.lossless.one/serialize-javascript/-/serialize-javascript-2.1.2.tgz", - "integrity": "sha512-rs9OggEUF0V4jUSecXazOYsLfu7OGK2qIn3c7IPBiffz32XniEp/TX9Xmc9LQfK2nQ2QKHvZ2oygKUGU0lG4jQ==", - "dev": true + "version": "3.1.0", + "resolved": "https://verdaccio.lossless.one/serialize-javascript/-/serialize-javascript-3.1.0.tgz", + "integrity": "sha512-JIJT1DGiWmIKhzRsG91aS6Ze4sFUrYbltlkg2onR5OrnNM02Kl/hnY/T4FN2omvyeBbQmMJv+K4cPOpGzOTFBg==", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } }, "serialize-to-js": { "version": "3.1.1", @@ -10466,14 +10433,14 @@ "dev": true }, "terser": { - "version": "4.8.0", - "resolved": "https://verdaccio.lossless.one/terser/-/terser-4.8.0.tgz", - "integrity": "sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw==", + "version": "3.17.0", + "resolved": "https://verdaccio.lossless.one/terser/-/terser-3.17.0.tgz", + "integrity": "sha512-/FQzzPJmCpjAH9Xvk2paiWrFq+5M6aVOf+2KRbwhByISDX/EujxsK+BAvrhb6H+2rtrLCHK9N01wO014vrIwVQ==", "dev": true, "requires": { - "commander": "^2.20.0", + "commander": "^2.19.0", "source-map": "~0.6.1", - "source-map-support": "~0.5.12" + "source-map-support": "~0.5.10" } }, "through2": { diff --git a/package.json b/package.json index 2828d28..637c42e 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ }, "devDependencies": { "@gitzone/tsbuild": "^2.1.25", - "@gitzone/tstest": "^1.0.43", + "@gitzone/tstest": "^1.0.44", "@pushrocks/qenv": "^4.0.10", "@pushrocks/tapbundle": "^3.2.9", "@types/node": "^14.0.27", @@ -39,5 +39,8 @@ "cli.js", "npmextra.json", "readme.md" + ], + "browserslist": [ + "last 1 chrome versions" ] } diff --git a/test/test.ts b/test/test.ts index b7d7d3c..c19b534 100644 --- a/test/test.ts +++ b/test/test.ts @@ -20,7 +20,7 @@ tap.test('should create a smartmail', async () => { testSmartmail = new smartmail.Smartmail({ body: 'hi there. This is the body.', from: 'Lossless GmbH ', - subject: 'TestMessage from @mojoio/mailgun test' + subject: 'TestMessage from @mojoio/mailgun test', }); expect(testSmartmail).to.be.instanceOf(smartmail.Smartmail); }); @@ -33,9 +33,12 @@ tap.test('should send a smartmail with empty body', async () => { const emptyBodySmartmail = new smartmail.Smartmail({ body: '', from: 'Lossless GmbH ', - subject: 'A message with no body from @mojoio/mailgun test' + subject: 'A message with no body from @mojoio/mailgun test', }); - await testMailgunAccount.sendSmartMail(emptyBodySmartmail, 'Sandbox Team '); + await testMailgunAccount.sendSmartMail( + emptyBodySmartmail, + 'Sandbox Team ' + ); }); tap.test('should retrieve a mail using a retrieval url', async () => { diff --git a/ts/mailgun.classes.account.ts b/ts/mailgun.classes.account.ts index bc2593f..fbb4f2a 100644 --- a/ts/mailgun.classes.account.ts +++ b/ts/mailgun.classes.account.ts @@ -5,7 +5,7 @@ export class MailgunAccount { public baseUrl = 'https://api.mailgun.net/v3'; public apiToken: string; - public smartSmtps: {[domain: string]: plugins.smartsmtp.Smartsmtp} = {}; + public smartSmtps: { [domain: string]: plugins.smartsmtp.Smartsmtp } = {}; constructor(apiTokenArg: string) { this.apiToken = apiTokenArg; @@ -15,7 +15,7 @@ export class MailgunAccount { * allows adding smtp credentials * Format: [domain]|[username]|[password] */ - public addSmtpCredentials (credentials: string) { + public addSmtpCredentials(credentials: string) { const credentialArray = credentials.split('|'); if (credentialArray.length !== 3) { throw new Error('credentials are in the wrong format'); @@ -23,7 +23,7 @@ export class MailgunAccount { this.smartSmtps[credentialArray[0]] = new plugins.smartsmtp.Smartsmtp({ smtpServer: 'smtp.mailgun.org', smtpUser: credentialArray[1], - smtpPassword: credentialArray[2] + smtpPassword: credentialArray[2], }); } @@ -111,21 +111,31 @@ export class MailgunAccount { console.log('All requirements for API met'); const response = await this.postFormData(`/${domain}/messages`, formFields); if (response.statusCode === 200) { - console.log(`Sent mail with subject ${smartmailArg.getSubject(dataArg)} to ${toArg} using the mailgun API`); + console.log( + `Sent mail with subject ${smartmailArg.getSubject( + dataArg + )} to ${toArg} using the mailgun API` + ); return response.body; } else { console.log(response.body); throw new Error('could not send email'); } } else { - console.log('An empty body was provided. This does not work via the API, but using SMTP instead.'); + console.log( + 'An empty body was provided. This does not work via the API, but using SMTP instead.' + ); const wantedSmartsmtp = this.smartSmtps[domain]; if (!wantedSmartsmtp) { console.log('did not find appropriate smtp credentials'); return; } wantedSmartsmtp.sendSmartMail(smartmailArg, toArg); - console.log(`Sent mail with subject ${smartmailArg.getSubject(dataArg)} to ${toArg} using an smtp transport over Mailgun`); + console.log( + `Sent mail with subject ${smartmailArg.getSubject( + dataArg + )} to ${toArg} using an smtp transport over Mailgun` + ); } }