fix(core): update
This commit is contained in:
parent
2b8aadc816
commit
0212d476c2
57
package-lock.json
generated
57
package-lock.json
generated
@ -294,9 +294,9 @@
|
|||||||
"integrity": "sha512-vlQlBGNVIjfClgnsfgQBU6GIKcskYSFzEcKLt18ngPzPEcjKklXcxaqzLXpnoxR+KBh30QPE8255ncYHXuPPOg=="
|
"integrity": "sha512-vlQlBGNVIjfClgnsfgQBU6GIKcskYSFzEcKLt18ngPzPEcjKklXcxaqzLXpnoxR+KBh30QPE8255ncYHXuPPOg=="
|
||||||
},
|
},
|
||||||
"@pushrocks/smartrequest": {
|
"@pushrocks/smartrequest": {
|
||||||
"version": "1.1.41",
|
"version": "1.1.43",
|
||||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrequest/-/smartrequest-1.1.41.tgz",
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrequest/-/smartrequest-1.1.43.tgz",
|
||||||
"integrity": "sha512-Kv2HXydJ3epFDEgfXm1RMLMQC6ix3sin8Gb3MioBWStqH3Aik6XvwNqPnBX5MBcVcbFOWQooJjjBRHM5k/hRXA==",
|
"integrity": "sha512-bgzzKN9SxJaYhh+BN3tuLSgdphWsxAOHgNjWWay3o/ib8/c2RwRlmjoxzxXrIhKFEwJjGIo7w04045VgkoWkMQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@pushrocks/smartpromise": "^3.0.5",
|
"@pushrocks/smartpromise": "^3.0.5",
|
||||||
"@types/form-data": "^2.5.0",
|
"@types/form-data": "^2.5.0",
|
||||||
@ -330,9 +330,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@pushrocks/smartstring": {
|
"@pushrocks/smartstring": {
|
||||||
"version": "3.0.14",
|
"version": "3.0.17",
|
||||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartstring/-/smartstring-3.0.14.tgz",
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartstring/-/smartstring-3.0.17.tgz",
|
||||||
"integrity": "sha512-hN3IwTb5VBUis8Z5U5U6dDCnap6zBmkc9/IVx8lxAbsxl5TYQ4RiYlJ2JM4tih7EdE80ZeSdpprzChYrWmSwDg==",
|
"integrity": "sha512-60JQptpgw+PjxoC5Gx+Y9m3/dtMstHC5ElpdJhIlbJ7dQV7LkCGSonLAG+NZhPbvrhow2KZ3fob8stW0Iuy3JQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"crypto-random-string": "^3.0.1",
|
"crypto-random-string": "^3.0.1",
|
||||||
"js-base64": "^2.5.1",
|
"js-base64": "^2.5.1",
|
||||||
@ -355,21 +355,22 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@pushrocks/tapbundle": {
|
"@pushrocks/tapbundle": {
|
||||||
"version": "3.0.13",
|
"version": "3.2.0",
|
||||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2ftapbundle/-/tapbundle-3.0.13.tgz",
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2ftapbundle/-/tapbundle-3.2.0.tgz",
|
||||||
"integrity": "sha512-23O4UMBafCuD+RnUlXNvtT9DGbL1HMD+xZE1Zcr7Ll7WvgxUgRQQfk9kq6qbLLbjaRe1J2Ijsgh1HuZbBaucLQ==",
|
"integrity": "sha512-xnKIGe7NJqxWBaFeKIEXShDjV2wap1XJqmlp3m1MKqmIF62vRpZnkzpyE1ZAoNwiYQmIsXIpvP/PDv+iPevPfw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@pushrocks/early": "^3.0.3",
|
"@pushrocks/early": "^3.0.3",
|
||||||
"@pushrocks/smartdelay": "^2.0.3",
|
"@pushrocks/smartdelay": "^2.0.3",
|
||||||
|
"@pushrocks/smartfile": "^7.0.6",
|
||||||
"@pushrocks/smartpromise": "^3.0.2",
|
"@pushrocks/smartpromise": "^3.0.2",
|
||||||
"smartchai": "^2.0.1"
|
"smartchai": "^2.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@types/chai": {
|
"@types/chai": {
|
||||||
"version": "4.2.4",
|
"version": "4.2.7",
|
||||||
"resolved": "https://verdaccio.lossless.one/@types%2fchai/-/chai-4.2.4.tgz",
|
"resolved": "https://verdaccio.lossless.one/@types%2fchai/-/chai-4.2.7.tgz",
|
||||||
"integrity": "sha512-7qvf9F9tMTzo0akeswHPGqgUx/gIaJqrOEET/FCD8CFRkSUHlygQiM5yB6OvjrtdxBVLSyw7COJubsFYs0683g==",
|
"integrity": "sha512-luq8meHGYwvky0O7u0eQZdA7B4Wd9owUCqvbw2m3XCrCU8mplYOujMBbvyS547AxJkC+pGnd0Cm15eNxEUNU8g==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/chai-as-promised": {
|
"@types/chai-as-promised": {
|
||||||
@ -443,9 +444,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "12.11.7",
|
"version": "13.1.6",
|
||||||
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-12.11.7.tgz",
|
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-13.1.6.tgz",
|
||||||
"integrity": "sha512-JNbGaHFCLwgHn/iCckiGSOZ1XYHsKFwREtzPwSGCVld1SGhOlmZw2D4ZI94HQCrBHbADzW9m4LER/8olJTRGHA=="
|
"integrity": "sha512-Jg1F+bmxcpENHP23sVKkNuU3uaxPnsBMW0cLjleiikFKomJQbsn0Cqk2yDvQArqzZN6ABfBkZ0To7pQ8sLdWDg=="
|
||||||
},
|
},
|
||||||
"@types/through2": {
|
"@types/through2": {
|
||||||
"version": "2.0.34",
|
"version": "2.0.34",
|
||||||
@ -1056,16 +1057,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"mime-db": {
|
"mime-db": {
|
||||||
"version": "1.40.0",
|
"version": "1.43.0",
|
||||||
"resolved": "https://verdaccio.lossless.one/mime-db/-/mime-db-1.40.0.tgz",
|
"resolved": "https://verdaccio.lossless.one/mime-db/-/mime-db-1.43.0.tgz",
|
||||||
"integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA=="
|
"integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ=="
|
||||||
},
|
},
|
||||||
"mime-types": {
|
"mime-types": {
|
||||||
"version": "2.1.24",
|
"version": "2.1.26",
|
||||||
"resolved": "https://verdaccio.lossless.one/mime-types/-/mime-types-2.1.24.tgz",
|
"resolved": "https://verdaccio.lossless.one/mime-types/-/mime-types-2.1.26.tgz",
|
||||||
"integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==",
|
"integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"mime-db": "1.40.0"
|
"mime-db": "1.43.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"mimic-fn": {
|
"mimic-fn": {
|
||||||
@ -1342,9 +1343,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"resolve": {
|
"resolve": {
|
||||||
"version": "1.12.0",
|
"version": "1.14.2",
|
||||||
"resolved": "https://verdaccio.lossless.one/resolve/-/resolve-1.12.0.tgz",
|
"resolved": "https://verdaccio.lossless.one/resolve/-/resolve-1.14.2.tgz",
|
||||||
"integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==",
|
"integrity": "sha512-EjlOBLBO1kxsUxsKjLt7TAECyKW6fOh1VRkykQkKGzcBbjjPIxBqGh0jf7GJ3k/f5mxMqW3htMD3WdTUVtW8HQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"path-parse": "^1.0.6"
|
"path-parse": "^1.0.6"
|
||||||
@ -1525,9 +1526,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"tslint": {
|
"tslint": {
|
||||||
"version": "5.20.0",
|
"version": "5.20.1",
|
||||||
"resolved": "https://verdaccio.lossless.one/tslint/-/tslint-5.20.0.tgz",
|
"resolved": "https://verdaccio.lossless.one/tslint/-/tslint-5.20.1.tgz",
|
||||||
"integrity": "sha512-2vqIvkMHbnx8acMogAERQ/IuINOq6DFqgF8/VDvhEkBqQh/x6SP0Y+OHnKth9/ZcHQSroOZwUQSN18v8KKF0/g==",
|
"integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/code-frame": "^7.0.0",
|
"@babel/code-frame": "^7.0.0",
|
||||||
|
10
package.json
10
package.json
@ -16,15 +16,15 @@
|
|||||||
"@gitzone/tsbuild": "^2.0.22",
|
"@gitzone/tsbuild": "^2.0.22",
|
||||||
"@gitzone/tstest": "^1.0.15",
|
"@gitzone/tstest": "^1.0.15",
|
||||||
"@pushrocks/qenv": "^4.0.6",
|
"@pushrocks/qenv": "^4.0.6",
|
||||||
"@pushrocks/tapbundle": "^3.0.7",
|
"@pushrocks/tapbundle": "^3.2.0",
|
||||||
"@types/node": "^12.11.7",
|
"@types/node": "^13.1.6",
|
||||||
"tslint": "^5.11.0",
|
"tslint": "^5.20.1",
|
||||||
"tslint-config-prettier": "^1.15.0"
|
"tslint-config-prettier": "^1.15.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartmail": "^1.0.6",
|
"@pushrocks/smartmail": "^1.0.6",
|
||||||
"@pushrocks/smartrequest": "^1.1.41",
|
"@pushrocks/smartrequest": "^1.1.43",
|
||||||
"@pushrocks/smartstring": "^3.0.14"
|
"@pushrocks/smartstring": "^3.0.17"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"ts/**/*",
|
"ts/**/*",
|
||||||
|
@ -2,6 +2,7 @@ import * as plugins from './mailgun.plugins';
|
|||||||
|
|
||||||
export class MailgunAccount {
|
export class MailgunAccount {
|
||||||
public baseUrl = 'https://api.mailgun.net/v3';
|
public baseUrl = 'https://api.mailgun.net/v3';
|
||||||
|
public baseUrlSe = 'https://se.api.mailgun.net/v3';
|
||||||
public apiToken: string;
|
public apiToken: string;
|
||||||
|
|
||||||
constructor(apiTokenArg: string) {
|
constructor(apiTokenArg: string) {
|
||||||
@ -9,8 +10,10 @@ export class MailgunAccount {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getRequest(routeArg: string) {
|
public getRequest(routeArg: string) {
|
||||||
const requestUrl = `${this.baseUrl}${routeArg}`; // TODO;
|
let requestUrl = routeArg;
|
||||||
const response = plugins.smartrequest.request(routeArg, {
|
const needsBaseUrlPrefix = (routeArg.startsWith(this.baseUrl)) || routeArg.startsWith(this.baseUrlSe);
|
||||||
|
needsBaseUrlPrefix ? requestUrl = `${this.baseUrl}${routeArg}` : null;
|
||||||
|
const response = plugins.smartrequest.request(requestUrl, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Basic ${plugins.smartstring.base64.encode(
|
Authorization: `Basic ${plugins.smartstring.base64.encode(
|
||||||
@ -19,6 +22,7 @@ export class MailgunAccount {
|
|||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async postFormData(routeArg: string, formFields: plugins.smartrequest.IFormField[]) {
|
public async postFormData(routeArg: string, formFields: plugins.smartrequest.IFormField[]) {
|
||||||
@ -78,7 +82,17 @@ export class MailgunAccount {
|
|||||||
if (response.statusCode === 200) {
|
if (response.statusCode === 200) {
|
||||||
return response.body;
|
return response.body;
|
||||||
} else {
|
} else {
|
||||||
|
console.log(response.body);
|
||||||
throw new Error('could not send email');
|
throw new Error('could not send email');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async retrieveSmartMailFromMessageUrl(messageUrlArg: string) {
|
||||||
|
const response = await this.getRequest(messageUrlArg);
|
||||||
|
return response.body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async retrieveSmartMailFromNotifyPayload(notifyPayloadArg: any) {
|
||||||
|
return await this.retrieveSmartMailFromMessageUrl(notifyPayloadArg['message-url']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user