itlab-internal-services 2.4.4 → 2.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a MailToken
|
|
3
|
+
*/
|
|
4
|
+
export declare class MailToken {
|
|
5
|
+
/** The login token */
|
|
6
|
+
token: string;
|
|
7
|
+
}
|
|
1
8
|
/**
|
|
2
9
|
* Represents a MailWeeklyDagoBERTSummary
|
|
3
10
|
*/
|
|
@@ -26,3 +33,12 @@ export declare class MailDagoBERTDowntime {
|
|
|
26
33
|
/** The end time */
|
|
27
34
|
end: string;
|
|
28
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Represents a MailPasswordReset
|
|
38
|
+
*/
|
|
39
|
+
export declare class MailPasswordReset {
|
|
40
|
+
/** The name of the receiver */
|
|
41
|
+
name: string;
|
|
42
|
+
/** The URL from where to reset the password from */
|
|
43
|
+
url: string;
|
|
44
|
+
}
|
|
@@ -9,8 +9,14 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.MailDagoBERTDowntime = exports.MailWeeklyDagoBERTSummary = void 0;
|
|
12
|
+
exports.MailPasswordReset = exports.MailDagoBERTDowntime = exports.MailWeeklyDagoBERTSummary = exports.MailToken = void 0;
|
|
13
13
|
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
/**
|
|
15
|
+
* Represents a MailToken
|
|
16
|
+
*/
|
|
17
|
+
class MailToken {
|
|
18
|
+
}
|
|
19
|
+
exports.MailToken = MailToken;
|
|
14
20
|
/**
|
|
15
21
|
* Represents a MailWeeklyDagoBERTSummary
|
|
16
22
|
*/
|
|
@@ -59,3 +65,17 @@ __decorate([
|
|
|
59
65
|
__metadata("design:type", String)
|
|
60
66
|
], MailDagoBERTDowntime.prototype, "end", void 0);
|
|
61
67
|
exports.MailDagoBERTDowntime = MailDagoBERTDowntime;
|
|
68
|
+
/**
|
|
69
|
+
* Represents a MailPasswordReset
|
|
70
|
+
*/
|
|
71
|
+
class MailPasswordReset {
|
|
72
|
+
}
|
|
73
|
+
__decorate([
|
|
74
|
+
(0, swagger_1.ApiProperty)(),
|
|
75
|
+
__metadata("design:type", String)
|
|
76
|
+
], MailPasswordReset.prototype, "name", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
(0, swagger_1.ApiProperty)(),
|
|
79
|
+
__metadata("design:type", String)
|
|
80
|
+
], MailPasswordReset.prototype, "url", void 0);
|
|
81
|
+
exports.MailPasswordReset = MailPasswordReset;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { ConfigService } from '@nestjs/config';
|
|
2
|
-
import { MailDagoBERTDowntime, MailWeeklyDagoBERTSummary } from './mail.models';
|
|
2
|
+
import { MailDagoBERTDowntime, MailPasswordReset, MailToken, MailWeeklyDagoBERTSummary } from './mail.models';
|
|
3
|
+
declare type Data = MailToken | MailPasswordReset | MailWeeklyDagoBERTSummary | MailDagoBERTDowntime | Record<string, string>;
|
|
4
|
+
export declare enum Endpoint {
|
|
5
|
+
Token = "token",
|
|
6
|
+
PasswordReset = "password-reset",
|
|
7
|
+
WeeklyDagoBERTSummary = "weekly-dagobert-summary",
|
|
8
|
+
DagoBERTDowntime = "dagobert-downtime"
|
|
9
|
+
}
|
|
3
10
|
/**
|
|
4
11
|
* Mail service
|
|
5
12
|
* @class MailService
|
|
@@ -16,27 +23,12 @@ export declare class MailService {
|
|
|
16
23
|
/** The axios instance */
|
|
17
24
|
private axios;
|
|
18
25
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* @param {string} token - the token to be sent
|
|
22
|
-
* @param {string} address - the address where the token will be sent to
|
|
23
|
-
* @return {void}
|
|
24
|
-
*/
|
|
25
|
-
sendToken(token: string, address: string): void;
|
|
26
|
-
/**
|
|
27
|
-
* Sends the weekly DagoBERT summary via email.
|
|
28
|
-
*
|
|
29
|
-
* @param {MailWeeklyDagoBERTSummary} data - the data for the weekly summary
|
|
30
|
-
* @param {string} address - the email address to send the summary to
|
|
31
|
-
* @return {void}
|
|
32
|
-
*/
|
|
33
|
-
sendWeeklyDagoBERTSummary(data: MailWeeklyDagoBERTSummary, address: string): void;
|
|
34
|
-
/**
|
|
35
|
-
* Send DagoBERT downtime data to the specified address.
|
|
26
|
+
* Send data to a specified address.
|
|
36
27
|
*
|
|
37
|
-
* @param {
|
|
38
|
-
* @param {
|
|
39
|
-
* @
|
|
28
|
+
* @param {string} endpoint - the endpoint of the mail service
|
|
29
|
+
* @param {Data} data - the data to sent
|
|
30
|
+
* @param address - the addess where the data will be sent to
|
|
40
31
|
*/
|
|
41
|
-
|
|
32
|
+
send<T = Data>(endpoint: string, data: T, address: string): void;
|
|
42
33
|
}
|
|
34
|
+
export {};
|
|
@@ -10,11 +10,18 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
var MailService_1;
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.MailService = void 0;
|
|
13
|
+
exports.MailService = exports.Endpoint = void 0;
|
|
14
14
|
const common_1 = require("@nestjs/common");
|
|
15
15
|
const config_1 = require("@nestjs/config");
|
|
16
16
|
const axios_1 = require("../../axios");
|
|
17
17
|
const env_1 = require("../../env");
|
|
18
|
+
var Endpoint;
|
|
19
|
+
(function (Endpoint) {
|
|
20
|
+
Endpoint["Token"] = "token";
|
|
21
|
+
Endpoint["PasswordReset"] = "password-reset";
|
|
22
|
+
Endpoint["WeeklyDagoBERTSummary"] = "weekly-dagobert-summary";
|
|
23
|
+
Endpoint["DagoBERTDowntime"] = "dagobert-downtime";
|
|
24
|
+
})(Endpoint = exports.Endpoint || (exports.Endpoint = {}));
|
|
18
25
|
/**
|
|
19
26
|
* Mail service
|
|
20
27
|
* @class MailService
|
|
@@ -35,46 +42,18 @@ let MailService = MailService_1 = class MailService {
|
|
|
35
42
|
});
|
|
36
43
|
}
|
|
37
44
|
/**
|
|
38
|
-
*
|
|
45
|
+
* Send data to a specified address.
|
|
39
46
|
*
|
|
40
|
-
* @param {string}
|
|
41
|
-
* @param {
|
|
42
|
-
* @
|
|
47
|
+
* @param {string} endpoint - the endpoint of the mail service
|
|
48
|
+
* @param {Data} data - the data to sent
|
|
49
|
+
* @param address - the addess where the data will be sent to
|
|
43
50
|
*/
|
|
44
|
-
|
|
45
|
-
this.logger.log('Sending
|
|
51
|
+
send(endpoint, data, address) {
|
|
52
|
+
this.logger.log('Sending E-Mail');
|
|
46
53
|
this.axios
|
|
47
|
-
.post(
|
|
48
|
-
.then(() => this.logger.log('
|
|
49
|
-
.catch(({ response }) => this.logger.error("Couldn't send
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Sends the weekly DagoBERT summary via email.
|
|
53
|
-
*
|
|
54
|
-
* @param {MailWeeklyDagoBERTSummary} data - the data for the weekly summary
|
|
55
|
-
* @param {string} address - the email address to send the summary to
|
|
56
|
-
* @return {void}
|
|
57
|
-
*/
|
|
58
|
-
sendWeeklyDagoBERTSummary(data, address) {
|
|
59
|
-
this.logger.log('Sending weekly DagoBERT summary');
|
|
60
|
-
this.axios
|
|
61
|
-
.post(`weekly-dagobert-summary`, Object.assign(Object.assign({}, data), { address }))
|
|
62
|
-
.then(() => this.logger.log('Weekly DagoBERT summary sent'))
|
|
63
|
-
.catch(({ response }) => this.logger.error("Couldnt't send weekly DagoBERT summary...", response.data));
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Send DagoBERT downtime data to the specified address.
|
|
67
|
-
*
|
|
68
|
-
* @param {MailDagoBERTDowntime} data - the data to send
|
|
69
|
-
* @param {string} address - the address to send the data to
|
|
70
|
-
* @return {void}
|
|
71
|
-
*/
|
|
72
|
-
sendDagoBERTDowntime(data, address) {
|
|
73
|
-
this.logger.log('Sending DagoBERT downtime');
|
|
74
|
-
this.axios
|
|
75
|
-
.post(`dagobert-downtime`, Object.assign(Object.assign({}, data), { address }))
|
|
76
|
-
.then(() => this.logger.log('DagoBERT downtime sent'))
|
|
77
|
-
.catch(({ response }) => this.logger.error("Couldnt't send DagoBERT downtime...", response.data));
|
|
54
|
+
.post(endpoint, Object.assign(Object.assign({}, data), { address }))
|
|
55
|
+
.then(() => this.logger.log('E-Mail sent'))
|
|
56
|
+
.catch(({ response }) => this.logger.error("Couldn't send E-Mail...", response.data));
|
|
78
57
|
}
|
|
79
58
|
};
|
|
80
59
|
MailService = MailService_1 = __decorate([
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"email": "timo.scheuermann@sv-informatik.de",
|
|
6
6
|
"url": "https://timos.design"
|
|
7
7
|
},
|
|
8
|
-
"version": "2.4.
|
|
8
|
+
"version": "2.4.5",
|
|
9
9
|
"type": "commonjs",
|
|
10
10
|
"files": [
|
|
11
11
|
"dist"
|
|
@@ -70,5 +70,6 @@
|
|
|
70
70
|
},
|
|
71
71
|
"lint-staged": {
|
|
72
72
|
"**/*.{ts,json}": []
|
|
73
|
-
}
|
|
73
|
+
},
|
|
74
|
+
"packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
|
|
74
75
|
}
|