From d50cb5449a19027747d5adb76e99a6abe3fdadf4 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Thu, 21 Nov 2019 14:01:41 +0000 Subject: [PATCH] fix(core): update --- package-lock.json | 66 +++++++++++------------------- package.json | 9 ++-- ts/letterxpress.classes.account.ts | 33 ++++++++++++++- ts/letterxpress.plugins.ts | 4 +- 4 files changed, 63 insertions(+), 49 deletions(-) diff --git a/package-lock.json b/package-lock.json index 79eda75..2aa78d8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -99,7 +99,6 @@ "version": "3.0.11", "resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-3.0.11.tgz", "integrity": "sha512-SDKRPj9+xBTqozlDPcA7O6BcccM1Tw/sXPVP+OnhNxCubDZ/L2kGNpPpqm43NJUoNxSSo5wdBw4N7MAFYCGdVg==", - "dev": true, "requires": { "@pushrocks/smartdelay": "^2.0.3", "@pushrocks/smartpromise": "^3.0.2", @@ -160,20 +159,12 @@ "@pushrocks/smartpromise": "^3.0.6", "@types/node": "^12.12.7", "is-wsl": "^2.1.1" - }, - "dependencies": { - "@types/node": { - "version": "12.12.8", - "resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-12.12.8.tgz", - "integrity": "sha512-XLla8N+iyfjvsa0KKV+BP/iGSoTmwxsu5Ci5sM33z9TjohF72DEz95iNvD6pPmemvbQgxAv/909G73gUn8QR7w==" - } } }, "@pushrocks/smartevent": { "version": "2.0.3", "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartevent/-/smartevent-2.0.3.tgz", "integrity": "sha512-x4B1mzzE6LrMATXsRLNuZpMTlB2JodL44MA4bF4FucU3SBBiWhFv3CFJRlO9B23SKZ1fwdJQrk2lT7YTUHXXJQ==", - "dev": true, "requires": { "@pushrocks/smartpromise": "^2.0.5" }, @@ -181,8 +172,7 @@ "@pushrocks/smartpromise": { "version": "2.0.5", "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpromise/-/smartpromise-2.0.5.tgz", - "integrity": "sha512-9j/chLtIiNkR0MDw7Mpxg9slxAVvAQwUZuiaPYX5KpHdKxQaHLI1VZ8IN0vPhwlfgNO4i4vGXV0wB8BvSDj03g==", - "dev": true + "integrity": "sha512-9j/chLtIiNkR0MDw7Mpxg9slxAVvAQwUZuiaPYX5KpHdKxQaHLI1VZ8IN0vPhwlfgNO4i4vGXV0wB8BvSDj03g==" } } }, @@ -234,13 +224,13 @@ } }, "@pushrocks/smartletter": { - "version": "1.0.10", - "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartletter/-/smartletter-1.0.10.tgz", - "integrity": "sha512-ya2IBEAmH1YfZ+DYsrGBksFShUJkyjpJDgd+pB3uA87tUCkvVDoskAFYFthnMk/RWm7IG1Tml0v1Vj/9QSiz3Q==", + "version": "1.0.15", + "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartletter/-/smartletter-1.0.15.tgz", + "integrity": "sha512-ErW0VoRqJtFKIaIG+VlPfmfBtdTmd3dTnlW6SF2zxRaZf0cIq43P2h+wdKYpJO8lKESl3kidItVSXZ7WB9pLpg==", "requires": { "@pushrocks/smartdelay": "^2.0.6", "@pushrocks/smartmarkdown": "^2.0.2", - "@pushrocks/smartpdf": "^1.0.29", + "@pushrocks/smartpdf": "^2.0.2", "@tsclass/tsclass": "^2.0.13", "lit-ntml": "^2.10.0" } @@ -323,9 +313,9 @@ "integrity": "sha512-MaI0+uLQPCr2V3WGnbdgb0pWa9xkWyrP4qYcbsHIjeismGLbn9s3jmP/HIXU8LkgzRgaVb+BJxmZJHOwl32DyA==" }, "@pushrocks/smartpdf": { - "version": "1.0.29", - "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpdf/-/smartpdf-1.0.29.tgz", - "integrity": "sha512-McJ9EVEzPs9F6nNT+6okJMwLlJ8kerzevyVjgQPCgjnxk3atdcbc91ojoBerQp3Cjf3c0Dh3xeC4CFDqx2ACKQ==", + "version": "2.0.2", + "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpdf/-/smartpdf-2.0.2.tgz", + "integrity": "sha512-fzKFWCBbmx76h/rStJckx3dGHOgWRuMalBBCLKLtY+KZk4/fT/kL88Bax4dZ3cCGKDaBfSiJNL9CJX7gsHl70w==", "requires": { "@pushrocks/smartfile": "^7.0.6", "@pushrocks/smartnetwork": "^1.1.14", @@ -367,7 +357,6 @@ "version": "2.0.5", "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrx/-/smartrx-2.0.5.tgz", "integrity": "sha512-BOlIJmnCO8pxqu9f18D9UV5rIsyrmKeK/mWNMiAe/NH2OTeRPNLpgmhZBkXSKNVD8tSsD8aazs4BcACgYOg1FQ==", - "dev": true, "requires": { "@pushrocks/lik": "^3.0.11", "@pushrocks/smartevent": "^2.0.3", @@ -404,7 +393,6 @@ "version": "3.0.12", "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmarttime/-/smarttime-3.0.12.tgz", "integrity": "sha512-NoMt1NUhNqcF5y7fCTHoC3d/+MobzgNUg6yHbSGxFRaentQzCrMPNahQIVLbrAStf03LUUBePUjSRdPYucP1gw==", - "dev": true, "requires": { "@pushrocks/smartpromise": "^3.0.2", "@types/cron": "^1.7.1", @@ -425,12 +413,13 @@ } }, "@pushrocks/tapbundle": { - "version": "3.0.13", - "resolved": "https://verdaccio.lossless.one/@pushrocks%2ftapbundle/-/tapbundle-3.0.13.tgz", - "integrity": "sha512-23O4UMBafCuD+RnUlXNvtT9DGbL1HMD+xZE1Zcr7Ll7WvgxUgRQQfk9kq6qbLLbjaRe1J2Ijsgh1HuZbBaucLQ==", + "version": "3.2.0", + "resolved": "https://verdaccio.lossless.one/@pushrocks%2ftapbundle/-/tapbundle-3.2.0.tgz", + "integrity": "sha512-xnKIGe7NJqxWBaFeKIEXShDjV2wap1XJqmlp3m1MKqmIF62vRpZnkzpyE1ZAoNwiYQmIsXIpvP/PDv+iPevPfw==", "requires": { "@pushrocks/early": "^3.0.3", "@pushrocks/smartdelay": "^2.0.3", + "@pushrocks/smartfile": "^7.0.6", "@pushrocks/smartpromise": "^3.0.2", "smartchai": "^2.0.1" } @@ -485,7 +474,6 @@ "version": "1.7.1", "resolved": "https://verdaccio.lossless.one/@types%2fcron/-/cron-1.7.1.tgz", "integrity": "sha512-48brwgU18DqA0mQX1As5OcJEo1yNjaXMM6Mk4r8K1dOzLJRQ37FE/kCivKx7ClKEHfhX2FdcxKzJ1B744a+V3A==", - "dev": true, "requires": { "@types/node": "*", "moment": ">=2.14.0" @@ -548,8 +536,7 @@ "@types/luxon": { "version": "1.15.2", "resolved": "https://verdaccio.lossless.one/@types%2fluxon/-/luxon-1.15.2.tgz", - "integrity": "sha512-zHPoyVrLvNaiMRYdhmh88Rn489ZgAgbc6iLxR5Yi0VCNfeNYHcszbhJV2vDHLNrVGy35BPtWBRn4OP2F9BBvFw==", - "dev": true + "integrity": "sha512-zHPoyVrLvNaiMRYdhmh88Rn489ZgAgbc6iLxR5Yi0VCNfeNYHcszbhJV2vDHLNrVGy35BPtWBRn4OP2F9BBvFw==" }, "@types/marked": { "version": "0.6.5", @@ -564,13 +551,12 @@ "@types/minimatch": { "version": "3.0.3", "resolved": "https://verdaccio.lossless.one/@types%2fminimatch/-/minimatch-3.0.3.tgz", - "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", - "dev": true + "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==" }, "@types/node": { - "version": "10.17.5", - "resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-10.17.5.tgz", - "integrity": "sha512-RElZIr/7JreF1eY6oD5RF3kpmdcreuQPjg5ri4oQ5g9sq7YWU8HkfB3eH8GwAwxf5OaCh0VPi7r4N/yoTGelrA==" + "version": "12.12.11", + "resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-12.12.11.tgz", + "integrity": "sha512-O+x6uIpa6oMNTkPuHDa9MhMMehlxLAd5QcOvKRjAFsBVpeFWTOPnXbDvILvFgFFZfQ1xh1EZi1FbXxUix+zpsQ==" }, "@types/portscanner": { "version": "2.1.0", @@ -1076,7 +1062,6 @@ "version": "1.7.2", "resolved": "https://verdaccio.lossless.one/cron/-/cron-1.7.2.tgz", "integrity": "sha512-+SaJ2OfeRvfQqwXQ2kgr0Y5pzBR/lijf5OpnnaruwWnmI799JfWr2jN2ItOV9s3A/+TFOt6mxvKzQq5F0Jp6VQ==", - "dev": true, "requires": { "moment-timezone": "^0.5.x" } @@ -1260,9 +1245,9 @@ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" }, "which": { - "version": "2.0.1", - "resolved": "https://verdaccio.lossless.one/which/-/which-2.0.1.tgz", - "integrity": "sha512-N7GBZOTswtB9lkQBZA4+zAXrjEIWAUOB93AvzUiudRzRxhUdLURQ7D/gAIMY1gatT/LTbmbcv8SiYazy3eYB7w==", + "version": "2.0.2", + "resolved": "https://verdaccio.lossless.one/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "requires": { "isexe": "^2.0.0" } @@ -2126,8 +2111,7 @@ "luxon": { "version": "1.21.1", "resolved": "https://verdaccio.lossless.one/luxon/-/luxon-1.21.1.tgz", - "integrity": "sha512-3zxaKX7mj7eA80TU0sm4CfNEtiUZ2QXGjMc80rfG4d1dOnnOOWz63U9j4nYR7+1w716DYtWfdOeVhDXYlH+D4w==", - "dev": true + "integrity": "sha512-3zxaKX7mj7eA80TU0sm4CfNEtiUZ2QXGjMc80rfG4d1dOnnOOWz63U9j4nYR7+1w716DYtWfdOeVhDXYlH+D4w==" }, "make-error": { "version": "1.3.5", @@ -2237,14 +2221,12 @@ "moment": { "version": "2.24.0", "resolved": "https://verdaccio.lossless.one/moment/-/moment-2.24.0.tgz", - "integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==", - "dev": true + "integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==" }, "moment-timezone": { "version": "0.5.27", "resolved": "https://verdaccio.lossless.one/moment-timezone/-/moment-timezone-0.5.27.tgz", "integrity": "sha512-EIKQs7h5sAsjhPCqN6ggx6cEbs94GK050254TIJySD1bzoM5JTYDwAU1IoVOeTOL6Gm27kYJ51/uuvq1kIlrbw==", - "dev": true, "requires": { "moment": ">= 2.9.0" } @@ -2744,7 +2726,6 @@ "version": "6.5.3", "resolved": "https://verdaccio.lossless.one/rxjs/-/rxjs-6.5.3.tgz", "integrity": "sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA==", - "dev": true, "requires": { "tslib": "^1.9.0" } @@ -3066,8 +3047,7 @@ "tslib": { "version": "1.10.0", "resolved": "https://verdaccio.lossless.one/tslib/-/tslib-1.10.0.tgz", - "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", - "dev": true + "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==" }, "tslint": { "version": "5.20.1", diff --git a/package.json b/package.json index df244a4..739171c 100644 --- a/package.json +++ b/package.json @@ -16,14 +16,15 @@ "@gitzone/tsbuild": "^2.0.22", "@gitzone/tstest": "^1.0.15", "@pushrocks/qenv": "^4.0.6", - "@pushrocks/tapbundle": "^3.0.7", - "@types/node": "^10.11.7", + "@pushrocks/tapbundle": "^3.2.0", + "@types/node": "^12.12.11", "tslint": "^5.11.0", "tslint-config-prettier": "^1.15.0" }, "dependencies": { - "@pushrocks/smartletter": "^1.0.10", - "@pushrocks/smartrequest": "^1.1.42" + "@pushrocks/smartletter": "^1.0.15", + "@pushrocks/smartrequest": "^1.1.42", + "@pushrocks/smartrx": "^2.0.5" }, "files": [ "ts/**/*", diff --git a/ts/letterxpress.classes.account.ts b/ts/letterxpress.classes.account.ts index 9a2f586..aba27a1 100644 --- a/ts/letterxpress.classes.account.ts +++ b/ts/letterxpress.classes.account.ts @@ -6,11 +6,42 @@ export interface ILetterXpressConstructorOptions { } export class LetterXpressAccount { + public baseApiUrl = 'https://api.letterxpress.de/v1/'; public options: ILetterXpressConstructorOptions; + public letterSentObservable = new plugins.smartrx.rxjs.Subject(); + constructor(optionsArg: ILetterXpressConstructorOptions) { this.options = optionsArg; } - public request() {} + /** + * sends a letter + * @param letterArg + */ + public async sendLetter(letterArg: plugins.smartletter.Letter) { + const letterPdfResult = await letterArg.getPdfResult(); + const response = await this.request('/setJob', 'POST', {}); + } + + /** + * fires the request + */ + private async request(routeArg: string, methodArg: 'GET' | 'POST', payload?: any) { + const requestUrl = `${this.baseApiUrl}`; + const requestData = { + auth: { + username: this.options.email, + apikey: this.options.apiKey + }, + ...payload + }; + const response = await plugins.smartrequest.request(routeArg, { + method: methodArg, + headers: { + 'Content-Type': 'application/json' + }, + requestBody: JSON.stringify(requestData) + }); + } } diff --git a/ts/letterxpress.plugins.ts b/ts/letterxpress.plugins.ts index 53ecff4..327acef 100644 --- a/ts/letterxpress.plugins.ts +++ b/ts/letterxpress.plugins.ts @@ -1,3 +1,5 @@ +import * as smartletter from '@pushrocks/smartletter'; import * as smartrequest from '@pushrocks/smartrequest'; +import * as smartrx from '@pushrocks/smartrx'; -export { smartrequest }; +export { smartletter, smartrequest, smartrx };