@futdevpro/nts-dynamo 1.5.76 → 1.5.81
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.
- package/LICENSE +2 -2
- package/lib/_constants/dynamo-nts-global-settings.d.ts +2 -2
- package/lib/_constants/dynamo-nts-global-settings.js +17 -17
- package/lib/_constants/index.d.ts +1 -1
- package/lib/_constants/index.js +4 -4
- package/lib/_enums/data-model-type.enum.d.ts +12 -12
- package/lib/_enums/data-model-type.enum.js +16 -16
- package/lib/_enums/data-model-type.enum.js.map +1 -1
- package/lib/_enums/dynamo-nts-data-service-function.enum.d.ts +12 -12
- package/lib/_enums/dynamo-nts-data-service-function.enum.js +18 -18
- package/lib/_enums/dynamo-nts-data-service-function.enum.js.map +1 -1
- package/lib/_enums/dynamo-nts-route-security.enum.d.ts +11 -11
- package/lib/_enums/dynamo-nts-route-security.enum.js +15 -15
- package/lib/_enums/dynamo-nts-route-security.enum.js.map +1 -1
- package/lib/_enums/dynamo-nts-socket-security.enum.d.ts +10 -10
- package/lib/_enums/dynamo-nts-socket-security.enum.js +14 -14
- package/lib/_enums/dynamo-nts-socket-security.enum.js.map +1 -1
- package/lib/_enums/http/http-call-type.enum.d.ts +11 -11
- package/lib/_enums/http/http-call-type.enum.js +15 -15
- package/lib/_enums/http/http-call-type.enum.js.map +1 -1
- package/lib/_enums/http/http-response-type.enum.d.ts +6 -6
- package/lib/_enums/http/http-response-type.enum.js +10 -10
- package/lib/_enums/http/http-response-type.enum.js.map +1 -1
- package/lib/_enums/http/socket-event.enum.d.ts +9 -8
- package/lib/_enums/http/socket-event.enum.d.ts.map +1 -1
- package/lib/_enums/http/socket-event.enum.js +13 -12
- package/lib/_enums/http/socket-event.enum.js.map +1 -1
- package/lib/_enums/index.d.ts +8 -8
- package/lib/_enums/index.js +13 -13
- package/lib/_enums/predefined-data-types.enum.d.ts +10 -10
- package/lib/_enums/predefined-data-types.enum.js +14 -14
- package/lib/_enums/predefined-data-types.enum.js.map +1 -1
- package/lib/_interfaces/certification-settings.interface.d.ts +7 -0
- package/lib/_interfaces/certification-settings.interface.d.ts.map +1 -0
- package/lib/_interfaces/certification-settings.interface.js +3 -0
- package/lib/_interfaces/certification-settings.interface.js.map +1 -0
- package/lib/_interfaces/global-service-settings.interface.d.ts +18 -0
- package/lib/_interfaces/global-service-settings.interface.d.ts.map +1 -0
- package/lib/_interfaces/global-service-settings.interface.js +3 -0
- package/lib/_interfaces/global-service-settings.interface.js.map +1 -0
- package/lib/_interfaces/index.d.ts +1 -0
- package/lib/_interfaces/index.d.ts.map +1 -0
- package/lib/_interfaces/index.js +4 -0
- package/lib/_interfaces/index.js.map +1 -0
- package/lib/_interfaces/port-settings.interface.d.ts +5 -0
- package/lib/_interfaces/port-settings.interface.d.ts.map +1 -0
- package/lib/_interfaces/port-settings.interface.js +3 -0
- package/lib/_interfaces/port-settings.interface.js.map +1 -0
- package/lib/_models/dynamo-nts-api-call-params.d.ts +95 -95
- package/lib/_models/dynamo-nts-api-call-params.js +47 -47
- package/lib/_models/dynamo-nts-app-params.d.ts +49 -49
- package/lib/_models/dynamo-nts-app-params.js +17 -17
- package/lib/_models/dynamo-nts-endpoint-params.d.ts +80 -80
- package/lib/_models/dynamo-nts-endpoint-params.js +139 -139
- package/lib/_models/dynamo-nts-global-settings.d.ts +53 -53
- package/lib/_models/dynamo-nts-global-settings.js +2 -2
- package/lib/_models/dynamo-nts-routing-module-settings.d.ts +19 -19
- package/lib/_models/dynamo-nts-routing-module-settings.js +2 -2
- package/lib/_models/dynamo-nts-socket-event-params.d.ts +32 -30
- package/lib/_models/dynamo-nts-socket-event-params.d.ts.map +1 -1
- package/lib/_models/dynamo-nts-socket-event-params.js +80 -79
- package/lib/_models/dynamo-nts-socket-event-params.js.map +1 -1
- package/lib/_models/dynamo-nts-socket-presence.d.ts +21 -0
- package/lib/_models/dynamo-nts-socket-presence.d.ts.map +1 -0
- package/lib/_models/dynamo-nts-socket-presence.js +45 -0
- package/lib/_models/dynamo-nts-socket-presence.js.map +1 -0
- package/lib/_models/dynamo-nts-socket-service-params.d.ts +18 -18
- package/lib/_models/dynamo-nts-socket-service-params.d.ts.map +1 -1
- package/lib/_models/dynamo-nts-socket-service-params.js +26 -26
- package/lib/_models/dynamo-nts-socket-service-params.js.map +1 -1
- package/lib/_models/index.d.ts +7 -8
- package/lib/_models/index.d.ts.map +1 -1
- package/lib/_models/index.js +12 -12
- package/lib/_models/index.js.map +1 -1
- package/lib/_modules/api-service.index.d.ts +5 -5
- package/lib/_modules/api-service.index.js +11 -11
- package/lib/_modules/app-extended.index.d.ts +15 -12
- package/lib/_modules/app-extended.index.d.ts.map +1 -1
- package/lib/_modules/app-extended.index.js +23 -19
- package/lib/_modules/app-extended.index.js.map +1 -1
- package/lib/_modules/app.index.d.ts +13 -10
- package/lib/_modules/app.index.d.ts.map +1 -1
- package/lib/_modules/app.index.js +21 -17
- package/lib/_modules/app.index.js.map +1 -1
- package/lib/_modules/auth.index.d.ts +3 -3
- package/lib/_modules/auth.index.js +8 -8
- package/lib/_modules/constants.index.d.ts +1 -1
- package/lib/_modules/constants.index.js +4 -4
- package/lib/_modules/controller.index.d.ts +4 -4
- package/lib/_modules/controller.index.js +10 -10
- package/lib/_modules/custom-data/custom-data.controller.d.ts +5 -5
- package/lib/_modules/custom-data/custom-data.controller.js +55 -55
- package/lib/_modules/custom-data/custom-data.service.d.ts +5 -5
- package/lib/_modules/custom-data/custom-data.service.js +11 -11
- package/lib/_modules/custom-data/get-custom-data-routing-module.d.ts +3 -3
- package/lib/_modules/custom-data/get-custom-data-routing-module.js +17 -17
- package/lib/_modules/custom-data/index.d.ts +4 -4
- package/lib/_modules/custom-data/index.js +8 -8
- package/lib/_modules/custom-data-module.index.d.ts +1 -1
- package/lib/_modules/custom-data-module.index.js +4 -4
- package/lib/_modules/data-service.index.d.ts +5 -5
- package/lib/_modules/data-service.index.js +10 -10
- package/lib/_modules/email.index.d.ts +3 -3
- package/lib/_modules/email.index.js +8 -8
- package/lib/_modules/enums.index.d.ts +1 -1
- package/lib/_modules/enums.index.js +4 -4
- package/lib/_modules/models.index.d.ts +1 -1
- package/lib/_modules/models.index.js +4 -4
- package/lib/_modules/services.index.d.ts +1 -1
- package/lib/_modules/services.index.js +4 -4
- package/lib/_modules/test/get-test-routing-module.d.ts +3 -3
- package/lib/_modules/test/get-test-routing-module.js +17 -17
- package/lib/_modules/test/index.d.ts +3 -3
- package/lib/_modules/test/index.js +7 -7
- package/lib/_modules/test/test.controller.d.ts +5 -5
- package/lib/_modules/test/test.controller.js +104 -104
- package/lib/_modules/test-module.index.d.ts +1 -1
- package/lib/_modules/test-module.index.js +4 -4
- package/lib/_modules/usage/get-usage-routing-module.d.ts +3 -3
- package/lib/_modules/usage/get-usage-routing-module.js +17 -17
- package/lib/_modules/usage/index.d.ts +4 -4
- package/lib/_modules/usage/index.js +8 -8
- package/lib/_modules/usage/usage-controller.d.ts +6 -6
- package/lib/_modules/usage/usage-controller.js +88 -88
- package/lib/_modules/usage/usage.service.d.ts +16 -16
- package/lib/_modules/usage/usage.service.js +132 -132
- package/lib/_modules/usage-module.index.d.ts +1 -1
- package/lib/_modules/usage-module.index.js +4 -4
- package/lib/_services/dynamo-nts-api.service.d.ts +34 -34
- package/lib/_services/dynamo-nts-api.service.js +188 -188
- package/lib/_services/dynamo-nts-app-extended.d.ts +128 -128
- package/lib/_services/dynamo-nts-app-extended.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-app-extended.js +212 -212
- package/lib/_services/dynamo-nts-app-extended.js.map +1 -1
- package/lib/_services/dynamo-nts-app.d.ts +270 -278
- package/lib/_services/dynamo-nts-app.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-app.js +371 -371
- package/lib/_services/dynamo-nts-app.js.map +1 -1
- package/lib/_services/dynamo-nts-app.spec.d.ts +1 -0
- package/lib/_services/dynamo-nts-app.spec.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-app.spec.js +10 -0
- package/lib/_services/dynamo-nts-app.spec.js.map +1 -0
- package/lib/_services/dynamo-nts-auth.service.d.ts +127 -127
- package/lib/_services/dynamo-nts-auth.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-auth.service.js +53 -53
- package/lib/_services/dynamo-nts-auth.service.js.map +1 -1
- package/lib/_services/dynamo-nts-controller.service.d.ts +105 -105
- package/lib/_services/dynamo-nts-controller.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-controller.service.js +57 -57
- package/lib/_services/dynamo-nts-controller.service.js.map +1 -1
- package/lib/_services/dynamo-nts-data.service.d.ts +230 -229
- package/lib/_services/dynamo-nts-data.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-data.service.js +689 -686
- package/lib/_services/dynamo-nts-data.service.js.map +1 -1
- package/lib/_services/dynamo-nts-db-service-collection.service.d.ts +8 -8
- package/lib/_services/dynamo-nts-db-service-collection.service.js +10 -10
- package/lib/_services/dynamo-nts-db.service.d.ts +312 -312
- package/lib/_services/dynamo-nts-db.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-db.service.js +856 -856
- package/lib/_services/dynamo-nts-db.service.js.map +1 -1
- package/lib/_services/dynamo-nts-email-service-collection.service.d.ts +18 -18
- package/lib/_services/dynamo-nts-email-service-collection.service.js +20 -20
- package/lib/_services/dynamo-nts-email.service.d.ts +56 -56
- package/lib/_services/dynamo-nts-email.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-email.service.js +203 -203
- package/lib/_services/dynamo-nts-email.service.js.map +1 -1
- package/lib/_services/dynamo-nts-global.service.d.ts +71 -84
- package/lib/_services/dynamo-nts-global.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-global.service.js +156 -156
- package/lib/_services/dynamo-nts-global.service.js.map +1 -1
- package/lib/_services/dynamo-nts-routing-module.service.d.ts +76 -76
- package/lib/_services/dynamo-nts-routing-module.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-routing-module.service.js +191 -191
- package/lib/_services/dynamo-nts-routing-module.service.js.map +1 -1
- package/lib/_services/dynamo-nts-shared.service.d.ts +31 -31
- package/lib/_services/dynamo-nts-shared.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-shared.service.js +70 -70
- package/lib/_services/dynamo-nts-shared.service.js.map +1 -1
- package/lib/_services/dynamo-nts-shared.service.spec.d.ts +2 -0
- package/lib/_services/dynamo-nts-shared.service.spec.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-shared.service.spec.js +12 -0
- package/lib/_services/dynamo-nts-shared.service.spec.js.map +1 -0
- package/lib/_services/dynamo-nts-singleton.service.d.ts +8 -8
- package/lib/_services/dynamo-nts-singleton.service.js +18 -18
- package/lib/_services/dynamo-nts-singleton.service.js.map +1 -1
- package/lib/_services/dynamo-nts-socket-service-collection.service.d.ts +9 -9
- package/lib/_services/dynamo-nts-socket-service-collection.service.js +13 -13
- package/lib/_services/dynamo-nts-socket.service.d.ts +57 -45
- package/lib/_services/dynamo-nts-socket.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-socket.service.js +188 -165
- package/lib/_services/dynamo-nts-socket.service.js.map +1 -1
- package/lib/_services/index.d.ts +14 -16
- package/lib/_services/index.d.ts.map +1 -1
- package/lib/_services/index.js +20 -20
- package/lib/_services/index.js.map +1 -1
- package/lib/index.d.ts +6 -6
- package/lib/index.js +14 -14
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package SAVE.json +216 -0
- package/package-NEW with test but not working.json +228 -0
- package/package.json +15 -8
- package/spec/support/jasmine.json +14 -0
- package/src/_enums/http/socket-event.enum.ts +2 -1
- package/src/_interfaces/certification-settings.interface.ts +7 -0
- package/src/_interfaces/global-service-settings.interface.ts +23 -0
- package/src/_interfaces/index.ts +5 -0
- package/src/_interfaces/port-settings.interface.ts +5 -0
- package/src/_models/dynamo-nts-socket-event-params.ts +23 -21
- package/src/_models/{dynamo-nts-socket-dictionary.ts → dynamo-nts-socket-presence.ts} +21 -5
- package/src/_models/dynamo-nts-socket-service-params.ts +1 -0
- package/src/_models/index.ts +2 -2
- package/src/_modules/app-extended.index.ts +7 -2
- package/src/_modules/app.index.ts +5 -0
- package/src/_services/dynamo-nts-app-extended.ts +6 -2
- package/src/_services/dynamo-nts-app.spec.ts +14 -0
- package/src/_services/dynamo-nts-app.ts +8 -14
- package/src/_services/dynamo-nts-auth.service.ts +1 -0
- package/src/_services/dynamo-nts-controller.service.ts +2 -1
- package/src/_services/dynamo-nts-data.service.ts +16 -10
- package/src/_services/dynamo-nts-db.service.ts +8 -5
- package/src/_services/dynamo-nts-email.service.ts +1 -0
- package/src/_services/dynamo-nts-global.service.ts +3 -18
- package/src/_services/dynamo-nts-routing-module.service.ts +1 -0
- package/src/_services/dynamo-nts-shared.service.spec.ts +10 -0
- package/src/_services/dynamo-nts-shared.service.ts +2 -1
- package/src/_services/dynamo-nts-socket.service.ts +80 -41
- package/src/_services/index.ts +2 -2
|
@@ -1,204 +1,204 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DynamoNTS_EmailService = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const FileSystem = tslib_1.__importStar(require("fs"));
|
|
6
|
-
const Path = tslib_1.__importStar(require("path"));
|
|
7
|
-
const NodeMailer = tslib_1.__importStar(require("nodemailer"));
|
|
8
|
-
const fsm_dynamo_1 = require("@futdevpro/fsm-dynamo");
|
|
9
|
-
/**
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
class DynamoNTS_EmailService {
|
|
13
|
-
constructor(set) {
|
|
14
|
-
this.templates = {};
|
|
15
|
-
this.templatePropertyKeys = {};
|
|
16
|
-
this.templateLoadingInProgressCounter = 0;
|
|
17
|
-
this.defaultErrorUserMsg = `We encountered an uncought Email Service Error, ` +
|
|
18
|
-
`\nplease contact the responsible development team.`;
|
|
19
|
-
try {
|
|
20
|
-
// console.log('\n\n\n\n\nNEW CONSTRUCT STARTED', set.email);
|
|
21
|
-
this.senderName = set.senderName;
|
|
22
|
-
this.senderNEmail = `${set.senderName} <${set.email}>`;
|
|
23
|
-
this.nmTransporter = NodeMailer.createTransport({
|
|
24
|
-
host: set.host,
|
|
25
|
-
port: set.port,
|
|
26
|
-
auth: {
|
|
27
|
-
user: set.email,
|
|
28
|
-
pass: set.pass
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
if (set.templatePaths) {
|
|
32
|
-
for (let key in set.templatePaths) {
|
|
33
|
-
this.loadTemplate(key, set.rootPath, set.templatePaths[key]);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
this.constructionFinished();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
fsm_dynamo_1.Dynamo_Log.error(`\nDynamoBEEmailService ERROR, The emailService construction failed for ${set.email}.`, new Error());
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
*
|
|
46
|
-
*/
|
|
47
|
-
constructionFinished() {
|
|
48
|
-
fsm_dynamo_1.Dynamo_Log.success(`\nEmailService construction (${this.senderName}) Finished!\n`);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
*
|
|
52
|
-
* @param set
|
|
53
|
-
*/
|
|
54
|
-
sendEmail(set) {
|
|
55
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
try {
|
|
57
|
-
let content;
|
|
58
|
-
if (set.content) {
|
|
59
|
-
content = set.content;
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
if (!set.useTemplate) {
|
|
63
|
-
throw new fsm_dynamo_1.Dynamo_Error({
|
|
64
|
-
errorCode: 'NTS-ES4-101',
|
|
65
|
-
addECToUserMsg: true,
|
|
66
|
-
message: 'No content setting passsed to emailSending!',
|
|
67
|
-
userMessage: this.defaultErrorUserMsg,
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
if (!this.templates[set.useTemplate]) {
|
|
71
|
-
throw new fsm_dynamo_1.Dynamo_Error({
|
|
72
|
-
errorCode: 'NTS-ES4-102',
|
|
73
|
-
addECToUserMsg: true,
|
|
74
|
-
message: `No email template found with this parameter! (${set.useTemplate})`,
|
|
75
|
-
userMessage: this.defaultErrorUserMsg
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
content = this.templates[set.useTemplate];
|
|
79
|
-
if (0 < this.templatePropertyKeys[set.useTemplate].length) {
|
|
80
|
-
if (!set.templateProperties) {
|
|
81
|
-
let props = '';
|
|
82
|
-
this.templatePropertyKeys[set.useTemplate].forEach((key, index) => {
|
|
83
|
-
props += `${key}${index != this.templatePropertyKeys[set.useTemplate].length - 1 ? ', ' : ''}`;
|
|
84
|
-
});
|
|
85
|
-
fsm_dynamo_1.Dynamo_Log.error('\nDynamoBEEmailService ERROR: INVALID sendEmail settings', set);
|
|
86
|
-
throw new fsm_dynamo_1.Dynamo_Error({
|
|
87
|
-
errorCode: 'NTS-ES4-103',
|
|
88
|
-
addECToUserMsg: true,
|
|
89
|
-
message: `TemplateProperties missing! properties needed: ${props}`,
|
|
90
|
-
userMessage: this.defaultErrorUserMsg
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
this.templatePropertyKeys[set.useTemplate].forEach((propertyKey) => {
|
|
94
|
-
if (!set.templateProperties[propertyKey]) {
|
|
95
|
-
fsm_dynamo_1.Dynamo_Log.error(`TemplateProperty missing! (${propertyKey})`);
|
|
96
|
-
}
|
|
97
|
-
const reg = new RegExp(`{{${propertyKey}}}`, 'g');
|
|
98
|
-
content = content.replace(reg, set.templateProperties[propertyKey]);
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
let mailOptions = {
|
|
103
|
-
from: this.senderNEmail,
|
|
104
|
-
to: set.to,
|
|
105
|
-
subject: set.subject,
|
|
106
|
-
html: content,
|
|
107
|
-
attachments: set.attachments,
|
|
108
|
-
};
|
|
109
|
-
yield new Promise((resolve, reject) => {
|
|
110
|
-
this.nmTransporter.sendMail(mailOptions, (error, info) => {
|
|
111
|
-
/* err = error; */
|
|
112
|
-
if (error) {
|
|
113
|
-
reject(error);
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
resolve();
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
catch (error) {
|
|
122
|
-
throw new fsm_dynamo_1.Dynamo_Error({
|
|
123
|
-
errorCode: 'NTS-ES4-100',
|
|
124
|
-
addECToUserMsg: true,
|
|
125
|
-
message: `SendEmail failed!`,
|
|
126
|
-
userMessage: this.defaultErrorUserMsg,
|
|
127
|
-
error
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
*
|
|
134
|
-
* @param templateName
|
|
135
|
-
* @param rootPath
|
|
136
|
-
* @param templatePath
|
|
137
|
-
* @returns
|
|
138
|
-
*/
|
|
139
|
-
loadTemplate(templateName, rootPath, templatePath) {
|
|
140
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
141
|
-
try {
|
|
142
|
-
this.templateLoadingInProgressCounter++;
|
|
143
|
-
return new Promise((resolve, reject) => {
|
|
144
|
-
templatePath = Path.join(rootPath, templatePath);
|
|
145
|
-
FileSystem.readFile(templatePath, 'utf8', (err, template) => {
|
|
146
|
-
if (err) {
|
|
147
|
-
fsm_dynamo_1.Dynamo_Log.error(`\nDynamoBEEmailService readFile ERROR (0), Couldn't load email template; ${templateName} from ${templatePath}\nerror:\n`, err, '\n');
|
|
148
|
-
reject(err);
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
this.templates[templateName] = template;
|
|
153
|
-
this.templatePropertyKeys[templateName] = this.getTemplatePropertyKeys(template);
|
|
154
|
-
this.templateLoadingInProgressCounter--;
|
|
155
|
-
if (this.templateLoadingInProgressCounter == 0) {
|
|
156
|
-
this.constructionFinished();
|
|
157
|
-
}
|
|
158
|
-
resolve();
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
catch (error) {
|
|
164
|
-
fsm_dynamo_1.Dynamo_Log.error(`\nDynamoBEEmailService ERROR (1), Couldn't load email template; ${templateName} from ${templatePath}`, new Error());
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
*
|
|
170
|
-
* @param template
|
|
171
|
-
* @returns
|
|
172
|
-
*/
|
|
173
|
-
getTemplatePropertyKeys(template) {
|
|
174
|
-
try {
|
|
175
|
-
const propertyKeys = [];
|
|
176
|
-
let propertyOpenTagIndex = template.indexOf('{{');
|
|
177
|
-
let propertyCloseTagIndex = template.indexOf('}}', propertyOpenTagIndex + 2);
|
|
178
|
-
while (propertyOpenTagIndex >= 0) {
|
|
179
|
-
if (propertyCloseTagIndex === -1) {
|
|
180
|
-
fsm_dynamo_1.Dynamo_Log.error(`\nDynamoBEEmailService ERROR, missing closing tag from email template! (${propertyOpenTagIndex} -)`, propertyKeys);
|
|
181
|
-
throw new fsm_dynamo_1.Dynamo_Error({
|
|
182
|
-
errorCode: 'NTS-ES4-200',
|
|
183
|
-
addECToUserMsg: true,
|
|
184
|
-
message: `ERROR, missing closing tag from email template! (${propertyOpenTagIndex} -)`,
|
|
185
|
-
userMessage: this.defaultErrorUserMsg
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
const newKey = template.substring(propertyOpenTagIndex + 2, propertyCloseTagIndex);
|
|
189
|
-
if (!propertyKeys.includes(newKey)) {
|
|
190
|
-
propertyKeys.push(newKey);
|
|
191
|
-
}
|
|
192
|
-
propertyOpenTagIndex = template.indexOf('{{', propertyOpenTagIndex + 2);
|
|
193
|
-
propertyCloseTagIndex = template.indexOf('}}', propertyOpenTagIndex + 2);
|
|
194
|
-
}
|
|
195
|
-
// console.log('\n\n\nTEST propertyKeys: ', propertyKeys);
|
|
196
|
-
return propertyKeys;
|
|
197
|
-
}
|
|
198
|
-
catch (error) {
|
|
199
|
-
fsm_dynamo_1.Dynamo_Log.error(`\nDynamoBEEmailService ERROR, getTemplatePropertyKeys ERROR`, new Error(), '\ntemplate:\n', template);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
exports.DynamoNTS_EmailService = DynamoNTS_EmailService;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DynamoNTS_EmailService = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const FileSystem = tslib_1.__importStar(require("fs"));
|
|
6
|
+
const Path = tslib_1.__importStar(require("path"));
|
|
7
|
+
const NodeMailer = tslib_1.__importStar(require("nodemailer"));
|
|
8
|
+
const fsm_dynamo_1 = require("@futdevpro/fsm-dynamo");
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
class DynamoNTS_EmailService {
|
|
13
|
+
constructor(set) {
|
|
14
|
+
this.templates = {};
|
|
15
|
+
this.templatePropertyKeys = {};
|
|
16
|
+
this.templateLoadingInProgressCounter = 0;
|
|
17
|
+
this.defaultErrorUserMsg = `We encountered an uncought Email Service Error, ` +
|
|
18
|
+
`\nplease contact the responsible development team.`;
|
|
19
|
+
try {
|
|
20
|
+
// console.log('\n\n\n\n\nNEW CONSTRUCT STARTED', set.email);
|
|
21
|
+
this.senderName = set.senderName;
|
|
22
|
+
this.senderNEmail = `${set.senderName} <${set.email}>`;
|
|
23
|
+
this.nmTransporter = NodeMailer.createTransport({
|
|
24
|
+
host: set.host,
|
|
25
|
+
port: set.port,
|
|
26
|
+
auth: {
|
|
27
|
+
user: set.email,
|
|
28
|
+
pass: set.pass
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
if (set.templatePaths) {
|
|
32
|
+
for (let key in set.templatePaths) {
|
|
33
|
+
this.loadTemplate(key, set.rootPath, set.templatePaths[key]);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
this.constructionFinished();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
fsm_dynamo_1.Dynamo_Log.error(`\nDynamoBEEmailService ERROR, The emailService construction failed for ${set.email}.`, new Error());
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
*/
|
|
47
|
+
constructionFinished() {
|
|
48
|
+
fsm_dynamo_1.Dynamo_Log.success(`\nEmailService construction (${this.senderName}) Finished!\n`);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
*
|
|
52
|
+
* @param set
|
|
53
|
+
*/
|
|
54
|
+
sendEmail(set) {
|
|
55
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
try {
|
|
57
|
+
let content;
|
|
58
|
+
if (set.content) {
|
|
59
|
+
content = set.content;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
if (!set.useTemplate) {
|
|
63
|
+
throw new fsm_dynamo_1.Dynamo_Error({
|
|
64
|
+
errorCode: 'NTS-ES4-101',
|
|
65
|
+
addECToUserMsg: true,
|
|
66
|
+
message: 'No content setting passsed to emailSending!',
|
|
67
|
+
userMessage: this.defaultErrorUserMsg,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
if (!this.templates[set.useTemplate]) {
|
|
71
|
+
throw new fsm_dynamo_1.Dynamo_Error({
|
|
72
|
+
errorCode: 'NTS-ES4-102',
|
|
73
|
+
addECToUserMsg: true,
|
|
74
|
+
message: `No email template found with this parameter! (${set.useTemplate})`,
|
|
75
|
+
userMessage: this.defaultErrorUserMsg
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
content = this.templates[set.useTemplate];
|
|
79
|
+
if (0 < this.templatePropertyKeys[set.useTemplate].length) {
|
|
80
|
+
if (!set.templateProperties) {
|
|
81
|
+
let props = '';
|
|
82
|
+
this.templatePropertyKeys[set.useTemplate].forEach((key, index) => {
|
|
83
|
+
props += `${key}${index != this.templatePropertyKeys[set.useTemplate].length - 1 ? ', ' : ''}`;
|
|
84
|
+
});
|
|
85
|
+
fsm_dynamo_1.Dynamo_Log.error('\nDynamoBEEmailService ERROR: INVALID sendEmail settings', set);
|
|
86
|
+
throw new fsm_dynamo_1.Dynamo_Error({
|
|
87
|
+
errorCode: 'NTS-ES4-103',
|
|
88
|
+
addECToUserMsg: true,
|
|
89
|
+
message: `TemplateProperties missing! properties needed: ${props}`,
|
|
90
|
+
userMessage: this.defaultErrorUserMsg
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
this.templatePropertyKeys[set.useTemplate].forEach((propertyKey) => {
|
|
94
|
+
if (!set.templateProperties[propertyKey]) {
|
|
95
|
+
fsm_dynamo_1.Dynamo_Log.error(`TemplateProperty missing! (${propertyKey})`);
|
|
96
|
+
}
|
|
97
|
+
const reg = new RegExp(`{{${propertyKey}}}`, 'g');
|
|
98
|
+
content = content.replace(reg, set.templateProperties[propertyKey]);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
let mailOptions = {
|
|
103
|
+
from: this.senderNEmail,
|
|
104
|
+
to: set.to,
|
|
105
|
+
subject: set.subject,
|
|
106
|
+
html: content,
|
|
107
|
+
attachments: set.attachments,
|
|
108
|
+
};
|
|
109
|
+
yield new Promise((resolve, reject) => {
|
|
110
|
+
this.nmTransporter.sendMail(mailOptions, (error, info) => {
|
|
111
|
+
/* err = error; */
|
|
112
|
+
if (error) {
|
|
113
|
+
reject(error);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
resolve();
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
throw new fsm_dynamo_1.Dynamo_Error({
|
|
123
|
+
errorCode: 'NTS-ES4-100',
|
|
124
|
+
addECToUserMsg: true,
|
|
125
|
+
message: `SendEmail failed!`,
|
|
126
|
+
userMessage: this.defaultErrorUserMsg,
|
|
127
|
+
error
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
*
|
|
134
|
+
* @param templateName
|
|
135
|
+
* @param rootPath
|
|
136
|
+
* @param templatePath
|
|
137
|
+
* @returns
|
|
138
|
+
*/
|
|
139
|
+
loadTemplate(templateName, rootPath, templatePath) {
|
|
140
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
141
|
+
try {
|
|
142
|
+
this.templateLoadingInProgressCounter++;
|
|
143
|
+
return new Promise((resolve, reject) => {
|
|
144
|
+
templatePath = Path.join(rootPath, templatePath);
|
|
145
|
+
FileSystem.readFile(templatePath, 'utf8', (err, template) => {
|
|
146
|
+
if (err) {
|
|
147
|
+
fsm_dynamo_1.Dynamo_Log.error(`\nDynamoBEEmailService readFile ERROR (0), Couldn't load email template; ${templateName} from ${templatePath}\nerror:\n`, err, '\n');
|
|
148
|
+
reject(err);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
this.templates[templateName] = template;
|
|
153
|
+
this.templatePropertyKeys[templateName] = this.getTemplatePropertyKeys(template);
|
|
154
|
+
this.templateLoadingInProgressCounter--;
|
|
155
|
+
if (this.templateLoadingInProgressCounter == 0) {
|
|
156
|
+
this.constructionFinished();
|
|
157
|
+
}
|
|
158
|
+
resolve();
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
fsm_dynamo_1.Dynamo_Log.error(`\nDynamoBEEmailService ERROR (1), Couldn't load email template; ${templateName} from ${templatePath}`, new Error());
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
*
|
|
170
|
+
* @param template
|
|
171
|
+
* @returns
|
|
172
|
+
*/
|
|
173
|
+
getTemplatePropertyKeys(template) {
|
|
174
|
+
try {
|
|
175
|
+
const propertyKeys = [];
|
|
176
|
+
let propertyOpenTagIndex = template.indexOf('{{');
|
|
177
|
+
let propertyCloseTagIndex = template.indexOf('}}', propertyOpenTagIndex + 2);
|
|
178
|
+
while (propertyOpenTagIndex >= 0) {
|
|
179
|
+
if (propertyCloseTagIndex === -1) {
|
|
180
|
+
fsm_dynamo_1.Dynamo_Log.error(`\nDynamoBEEmailService ERROR, missing closing tag from email template! (${propertyOpenTagIndex} -)`, propertyKeys);
|
|
181
|
+
throw new fsm_dynamo_1.Dynamo_Error({
|
|
182
|
+
errorCode: 'NTS-ES4-200',
|
|
183
|
+
addECToUserMsg: true,
|
|
184
|
+
message: `ERROR, missing closing tag from email template! (${propertyOpenTagIndex} -)`,
|
|
185
|
+
userMessage: this.defaultErrorUserMsg
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
const newKey = template.substring(propertyOpenTagIndex + 2, propertyCloseTagIndex);
|
|
189
|
+
if (!propertyKeys.includes(newKey)) {
|
|
190
|
+
propertyKeys.push(newKey);
|
|
191
|
+
}
|
|
192
|
+
propertyOpenTagIndex = template.indexOf('{{', propertyOpenTagIndex + 2);
|
|
193
|
+
propertyCloseTagIndex = template.indexOf('}}', propertyOpenTagIndex + 2);
|
|
194
|
+
}
|
|
195
|
+
// console.log('\n\n\nTEST propertyKeys: ', propertyKeys);
|
|
196
|
+
return propertyKeys;
|
|
197
|
+
}
|
|
198
|
+
catch (error) {
|
|
199
|
+
fsm_dynamo_1.Dynamo_Log.error(`\nDynamoBEEmailService ERROR, getTemplatePropertyKeys ERROR`, new Error(), '\ntemplate:\n', template);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
exports.DynamoNTS_EmailService = DynamoNTS_EmailService;
|
|
204
204
|
//# sourceMappingURL=dynamo-nts-email.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamo-nts-email.service.js","sourceRoot":"","sources":["../../src/_services/dynamo-nts-email.service.ts"],"names":[],"mappings":";;;;AACA,uDAAiC;AACjC,mDAA6B;AAC7B,+DAAyC;
|
|
1
|
+
{"version":3,"file":"dynamo-nts-email.service.js","sourceRoot":"","sources":["../../src/_services/dynamo-nts-email.service.ts"],"names":[],"mappings":";;;;AACA,uDAAiC;AACjC,mDAA6B;AAC7B,+DAAyC;AAGzC,sDAAiE;AAEjE;;GAEG;AACH,MAAa,sBAAsB;IAgBjC,YACE,GAUC;QAvBK,cAAS,GAEb,EAAE,CAAC;QACC,yBAAoB,GAExB,EAAE,CAAC;QACC,qCAAgC,GAAG,CAAC,CAAC;QAE7C,wBAAmB,GACjB,kDAAkD;YAClD,oDAAoD,CAAC;QAerD,IAAI;YACF,6DAA6D;YAC7D,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC;YACjC,IAAI,CAAC,YAAY,GAAG,GAAG,GAAG,CAAC,UAAU,KAAK,GAAG,CAAC,KAAK,GAAG,CAAC;YACvD,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC,eAAe,CAAC;gBAC9C,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,IAAI,EAAE;oBACJ,IAAI,EAAE,GAAG,CAAC,KAAK;oBACf,IAAI,EAAE,GAAG,CAAC,IAAI;iBACf;aACF,CAAC,CAAC;YACH,IAAI,GAAG,CAAC,aAAa,EAAE;gBACrB,KAAK,IAAI,GAAG,IAAI,GAAG,CAAC,aAAa,EAAE;oBACjC,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;iBAC9D;aACF;iBAAM;gBACL,IAAI,CAAC,oBAAoB,EAAE,CAAC;aAC7B;SACF;QAAC,OAAO,KAAK,EAAE;YACd,uBAAU,CAAC,KAAK,CAAC,0EAA0E,GAAG,CAAC,KAAK,GAAG,EAAE,IAAI,KAA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,EAAE,oBAAoB,GAAG,CAAC,CAAC,CAAC;aAC1E;YACD,0DAA0D;YAC1D,OAAO,YAAY,CAAC;SACrB;QAAC,OAAO,KAAK,EAAE;YACd,uBAAU,CAAC,KAAK,CAAC,6DAA6D,EAAE,IAAI,KAAK,EAAE,EAAE,eAAe,EAAE,QAAQ,CAAC,CAAC;SACzH;IACH,CAAC;CACF;AAhOD,wDAgOC"}
|
|
@@ -1,85 +1,72 @@
|
|
|
1
|
-
import { Dynamo_Metadata, Dynamo_DataParams } from '@futdevpro/fsm-dynamo';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
static
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
*
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
*
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
*
|
|
74
|
-
* @returns
|
|
75
|
-
*/
|
|
76
|
-
static getSocketServiceCollection(): DynamoNTS_SocketServiceCollection;
|
|
77
|
-
/**
|
|
78
|
-
*
|
|
79
|
-
* @param name
|
|
80
|
-
* @returns
|
|
81
|
-
*/
|
|
82
|
-
static getSocketServiceByName(name: string): DynamoNTS_SocketService<any>;
|
|
83
|
-
static attachNewSocketService(service: DynamoNTS_SocketService<any>): void;
|
|
84
|
-
}
|
|
1
|
+
import { Dynamo_Metadata, Dynamo_DataParams } from '@futdevpro/fsm-dynamo';
|
|
2
|
+
import { DynamoNTS_GlobalServiceSettings } from '../_interfaces/global-service-settings.interface';
|
|
3
|
+
import { DynamoNTS_AppParams } from '../_models/dynamo-nts-app-params';
|
|
4
|
+
import { DynamoNTS_AuthService } from './dynamo-nts-auth.service';
|
|
5
|
+
import { DynamoNTS_DBServiceCollection } from './dynamo-nts-db-service-collection.service';
|
|
6
|
+
import { DynamoNTS_DBService } from './dynamo-nts-db.service';
|
|
7
|
+
import { DynamoNTS_EmailServiceCollection } from './dynamo-nts-email-service-collection.service';
|
|
8
|
+
import { DynamoNTS_SingletonService } from './dynamo-nts-singleton.service';
|
|
9
|
+
import { DynamoNTS_SocketServiceCollection } from './dynamo-nts-socket-service-collection.service';
|
|
10
|
+
import { DynamoNTS_SocketService } from './dynamo-nts-socket.service';
|
|
11
|
+
/**
|
|
12
|
+
* This is the main Global/Core Service Collection used by DynamoBE,
|
|
13
|
+
* you also can use this to access main services as
|
|
14
|
+
* dbServices, emailServices, or authService
|
|
15
|
+
*/
|
|
16
|
+
export declare class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
17
|
+
static getInstance(): DynamoNTS_GlobalService;
|
|
18
|
+
private static _params;
|
|
19
|
+
static get params(): DynamoNTS_AppParams;
|
|
20
|
+
private static readonly _upSince;
|
|
21
|
+
static get upSince(): Date;
|
|
22
|
+
static get upTime(): number;
|
|
23
|
+
authService: DynamoNTS_AuthService;
|
|
24
|
+
dbServiceCollection: DynamoNTS_DBServiceCollection;
|
|
25
|
+
emailServiceCollection: DynamoNTS_EmailServiceCollection;
|
|
26
|
+
socketServiceCollection: DynamoNTS_SocketServiceCollection;
|
|
27
|
+
/**
|
|
28
|
+
* You need to setup global Services through this function
|
|
29
|
+
*/
|
|
30
|
+
static setServices(set: DynamoNTS_GlobalServiceSettings): void;
|
|
31
|
+
static setParams(params: DynamoNTS_AppParams): void;
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
static getAuthService(): DynamoNTS_AuthService;
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
* @returns
|
|
40
|
+
*/
|
|
41
|
+
static getDBServiceCollection(): DynamoNTS_DBServiceCollection;
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* @param dataParams
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
47
|
+
static getDBService<T extends Dynamo_Metadata>(dataParams: Dynamo_DataParams): DynamoNTS_DBService<T>;
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
* @param key
|
|
51
|
+
* @returns
|
|
52
|
+
*/
|
|
53
|
+
static getDBServiceByKey<T extends Dynamo_Metadata>(key: string): DynamoNTS_DBService<T>;
|
|
54
|
+
/**
|
|
55
|
+
*
|
|
56
|
+
* @returns
|
|
57
|
+
*/
|
|
58
|
+
static getEmailServiceCollection(): DynamoNTS_EmailServiceCollection;
|
|
59
|
+
/**
|
|
60
|
+
*
|
|
61
|
+
* @returns
|
|
62
|
+
*/
|
|
63
|
+
static getSocketServiceCollection(): DynamoNTS_SocketServiceCollection;
|
|
64
|
+
/**
|
|
65
|
+
*
|
|
66
|
+
* @param name
|
|
67
|
+
* @returns
|
|
68
|
+
*/
|
|
69
|
+
static getSocketServiceByName(name: string): DynamoNTS_SocketService<any>;
|
|
70
|
+
static attachNewSocketService(service: DynamoNTS_SocketService<any>): void;
|
|
71
|
+
}
|
|
85
72
|
//# sourceMappingURL=dynamo-nts-global.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamo-nts-global.service.d.ts","sourceRoot":"","sources":["../../src/_services/dynamo-nts-global.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAc,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"dynamo-nts-global.service.d.ts","sourceRoot":"","sources":["../../src/_services/dynamo-nts-global.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAc,MAAM,uBAAuB,CAAC;AAEvF,OAAO,EAAE,+BAA+B,EAAE,MAAM,kDAAkD,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,6BAA6B,EAAE,MAAM,4CAA4C,CAAC;AAC3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,gCAAgC,EAAE,MAAM,+CAA+C,CAAC;AACjG,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,iCAAiC,EAAE,MAAM,gDAAgD,CAAC;AACnG,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,0BAA0B;IAErE,MAAM,CAAC,WAAW,IAAI,uBAAuB;IAI7C,OAAO,CAAC,MAAM,CAAC,OAAO,CAAsB;IAC5C,MAAM,KAAK,MAAM,IAAI,mBAAmB,CAAyB;IAEjE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAoB;IACpD,MAAM,KAAK,OAAO,IAAI,IAAI,CAA0B;IACpD,MAAM,KAAK,MAAM,IAAI,MAAM,CAAyC;IAEpE,WAA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