@futdevpro/nts-dynamo 1.5.30 → 1.5.31
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/lib/_constants/dynamo-nts-global.settings.d.ts +3 -0
- package/lib/_constants/dynamo-nts-global.settings.d.ts.map +1 -0
- package/lib/_constants/dynamo-nts-global.settings.js +13 -0
- package/lib/_constants/dynamo-nts-global.settings.js.map +1 -0
- package/lib/_constants/index.d.ts +1 -1
- package/lib/_constants/index.d.ts.map +1 -1
- package/lib/_constants/index.js +1 -1
- package/lib/_constants/index.js.map +1 -1
- package/lib/_enums/dynamo-nts-data-service-function.enum.d.ts +8 -0
- package/lib/_enums/dynamo-nts-data-service-function.enum.d.ts.map +1 -0
- package/lib/_enums/dynamo-nts-data-service-function.enum.js +15 -0
- package/lib/_enums/dynamo-nts-data-service-function.enum.js.map +1 -0
- package/lib/_enums/dynamo-nts-route-security.enum.d.ts +6 -0
- package/lib/_enums/dynamo-nts-route-security.enum.d.ts.map +1 -0
- package/lib/_enums/dynamo-nts-route-security.enum.js +10 -0
- package/lib/_enums/dynamo-nts-route-security.enum.js.map +1 -0
- package/lib/_enums/index.d.ts +2 -2
- package/lib/_enums/index.d.ts.map +1 -1
- package/lib/_enums/index.js +2 -2
- package/lib/_enums/index.js.map +1 -1
- package/lib/_models/dynamo-module-settings.d.ts +0 -6
- package/lib/_models/dynamo-module-settings.d.ts.map +1 -1
- package/lib/_models/dynamo-module-settings.js +9 -2
- package/lib/_models/dynamo-module-settings.js.map +1 -1
- package/lib/_models/dynamo-nts-api-call-params.d.ts +37 -0
- package/lib/_models/dynamo-nts-api-call-params.d.ts.map +1 -0
- package/lib/_models/dynamo-nts-api-call-params.js +29 -0
- package/lib/_models/dynamo-nts-api-call-params.js.map +1 -0
- package/lib/_models/dynamo-nts-app-params.d.ts +18 -0
- package/lib/_models/dynamo-nts-app-params.d.ts.map +1 -0
- package/lib/_models/dynamo-nts-app-params.js +17 -0
- package/lib/_models/dynamo-nts-app-params.js.map +1 -0
- package/lib/_models/dynamo-nts-endpoint-params.d.ts +46 -0
- package/lib/_models/dynamo-nts-endpoint-params.d.ts.map +1 -0
- package/lib/_models/dynamo-nts-endpoint-params.js +117 -0
- package/lib/_models/dynamo-nts-endpoint-params.js.map +1 -0
- package/lib/_models/dynamo-nts-global-settings.d.ts +13 -0
- package/lib/_models/dynamo-nts-global-settings.d.ts.map +1 -0
- package/lib/_models/dynamo-nts-global-settings.js +3 -0
- package/lib/_models/dynamo-nts-global-settings.js.map +1 -0
- package/lib/_models/index.d.ts +4 -4
- package/lib/_models/index.d.ts.map +1 -1
- package/lib/_models/index.js +4 -5
- package/lib/_models/index.js.map +1 -1
- package/lib/_modules/api-service.index.d.ts +3 -3
- package/lib/_modules/api-service.index.d.ts.map +1 -1
- package/lib/_modules/api-service.index.js +3 -3
- package/lib/_modules/api-service.index.js.map +1 -1
- package/lib/_modules/app.index.d.ts +9 -9
- package/lib/_modules/app.index.d.ts.map +1 -1
- package/lib/_modules/app.index.js +9 -9
- package/lib/_modules/app.index.js.map +1 -1
- package/lib/_modules/auth.index.d.ts +2 -2
- package/lib/_modules/auth.index.d.ts.map +1 -1
- package/lib/_modules/auth.index.js +2 -2
- package/lib/_modules/auth.index.js.map +1 -1
- package/lib/_modules/controller.index.d.ts +3 -3
- package/lib/_modules/controller.index.d.ts.map +1 -1
- package/lib/_modules/controller.index.js +3 -3
- package/lib/_modules/controller.index.js.map +1 -1
- package/lib/_modules/data-service.index.d.ts +4 -4
- package/lib/_modules/data-service.index.d.ts.map +1 -1
- package/lib/_modules/data-service.index.js +4 -4
- package/lib/_modules/data-service.index.js.map +1 -1
- package/lib/_modules/email.index.d.ts +2 -2
- package/lib/_modules/email.index.d.ts.map +1 -1
- package/lib/_modules/email.index.js +2 -2
- package/lib/_modules/email.index.js.map +1 -1
- package/lib/_modules/test/custom-data.service.d.ts +2 -2
- package/lib/_modules/test/custom-data.service.d.ts.map +1 -1
- package/lib/_modules/test/custom-data.service.js +2 -2
- package/lib/_modules/test/custom-data.service.js.map +1 -1
- package/lib/_modules/test/get-test-routing-module.d.ts +3 -3
- package/lib/_modules/test/get-test-routing-module.d.ts.map +1 -1
- package/lib/_modules/test/get-test-routing-module.js +2 -2
- package/lib/_modules/test/get-test-routing-module.js.map +1 -1
- package/lib/_modules/test/test-controller.d.ts +2 -2
- package/lib/_modules/test/test-controller.d.ts.map +1 -1
- package/lib/_modules/test/test-controller.js +10 -10
- package/lib/_modules/test/test-controller.js.map +1 -1
- package/lib/_modules/usage/get-usage-routing-module.d.ts +3 -3
- package/lib/_modules/usage/get-usage-routing-module.d.ts.map +1 -1
- package/lib/_modules/usage/get-usage-routing-module.js +2 -2
- package/lib/_modules/usage/get-usage-routing-module.js.map +1 -1
- package/lib/_modules/usage/usage-controller.d.ts +2 -2
- package/lib/_modules/usage/usage-controller.d.ts.map +1 -1
- package/lib/_modules/usage/usage-controller.js +10 -10
- package/lib/_modules/usage/usage-controller.js.map +1 -1
- package/lib/_modules/usage/usage.service.d.ts +2 -2
- package/lib/_modules/usage/usage.service.d.ts.map +1 -1
- package/lib/_modules/usage/usage.service.js +6 -6
- package/lib/_modules/usage/usage.service.js.map +1 -1
- package/lib/_services/dynamo-nts-api.service.d.ts +19 -0
- package/lib/_services/dynamo-nts-api.service.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-api.service.js +167 -0
- package/lib/_services/dynamo-nts-api.service.js.map +1 -0
- package/lib/_services/dynamo-nts-app-extended.d.ts +23 -0
- package/lib/_services/dynamo-nts-app-extended.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-app-extended.js +92 -0
- package/lib/_services/dynamo-nts-app-extended.js.map +1 -0
- package/lib/_services/dynamo-nts-app.d.ts +130 -0
- package/lib/_services/dynamo-nts-app.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-app.js +238 -0
- package/lib/_services/dynamo-nts-app.js.map +1 -0
- package/lib/_services/dynamo-nts-auth.service.d.ts +54 -0
- package/lib/_services/dynamo-nts-auth.service.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-auth.service.js +46 -0
- package/lib/_services/dynamo-nts-auth.service.js.map +1 -0
- package/lib/_services/dynamo-nts-controller.service.d.ts +14 -0
- package/lib/_services/dynamo-nts-controller.service.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-controller.service.js +21 -0
- package/lib/_services/dynamo-nts-controller.service.js.map +1 -0
- package/lib/_services/dynamo-nts-data.service.d.ts +54 -0
- package/lib/_services/dynamo-nts-data.service.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-data.service.js +301 -0
- package/lib/_services/dynamo-nts-data.service.js.map +1 -0
- package/lib/_services/dynamo-nts-db-service-collection.service.d.ts +9 -0
- package/lib/_services/dynamo-nts-db-service-collection.service.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-db-service-collection.service.js +11 -0
- package/lib/_services/dynamo-nts-db-service-collection.service.js.map +1 -0
- package/lib/_services/dynamo-nts-db.service.d.ts +244 -0
- package/lib/_services/dynamo-nts-db.service.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-db.service.js +759 -0
- package/lib/_services/dynamo-nts-db.service.js.map +1 -0
- package/lib/_services/dynamo-nts-email-service-collection.service.d.ts +19 -0
- package/lib/_services/dynamo-nts-email-service-collection.service.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-email-service-collection.service.js +21 -0
- package/lib/_services/dynamo-nts-email-service-collection.service.js.map +1 -0
- package/lib/_services/dynamo-nts-email.service.d.ts +56 -0
- package/lib/_services/dynamo-nts-email.service.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-email.service.js +194 -0
- package/lib/_services/dynamo-nts-email.service.js.map +1 -0
- package/lib/_services/dynamo-nts-global.service.d.ts +62 -0
- package/lib/_services/dynamo-nts-global.service.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-global.service.js +107 -0
- package/lib/_services/dynamo-nts-global.service.js.map +1 -0
- package/lib/_services/dynamo-nts-routing-module.service.d.ts +42 -0
- package/lib/_services/dynamo-nts-routing-module.service.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-routing-module.service.js +146 -0
- package/lib/_services/dynamo-nts-routing-module.service.js.map +1 -0
- package/lib/_services/dynamo-nts-shared.service.d.ts +26 -0
- package/lib/_services/dynamo-nts-shared.service.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-shared.service.js +63 -0
- package/lib/_services/dynamo-nts-shared.service.js.map +1 -0
- package/lib/_services/dynamo-nts-singleton.service.d.ts +9 -0
- package/lib/_services/dynamo-nts-singleton.service.d.ts.map +1 -0
- package/lib/_services/dynamo-nts-singleton.service.js +19 -0
- package/lib/_services/dynamo-nts-singleton.service.js.map +1 -0
- package/lib/_services/dynamobe-email.service.js +1 -1
- package/lib/_services/index.d.ts +13 -13
- package/lib/_services/index.d.ts.map +1 -1
- package/lib/_services/index.js +13 -13
- package/lib/_services/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +995 -319
- package/package.json +2 -6
- package/src/_constants/dynamo-nts-global.settings.ts +12 -0
- package/src/_constants/index.ts +1 -1
- package/src/_enums/{dynamobe-data-service-function.enum.ts → dynamo-nts-data-service-function.enum.ts} +1 -1
- package/src/_enums/{dynamobe-route-security.enum.ts → dynamo-nts-route-security.enum.ts} +1 -1
- package/src/_enums/index.ts +2 -2
- package/src/_models/dynamo-module-settings.ts +2 -2
- package/src/_models/{dynamobe-api-call-params.ts → dynamo-nts-api-call-params.ts} +1 -1
- package/src/_models/{dynamobe-app-params.ts → dynamo-nts-app-params.ts} +1 -1
- package/src/_models/{dynamobe-endpoint-params.ts → dynamo-nts-endpoint-params.ts} +20 -20
- package/src/_models/dynamo-nts-global-settings.ts +13 -0
- package/src/_models/index.ts +4 -5
- package/src/_modules/api-service.index.ts +3 -3
- package/src/_modules/app.index.ts +9 -9
- package/src/_modules/auth.index.ts +2 -2
- package/src/_modules/controller.index.ts +3 -3
- package/src/_modules/data-service.index.ts +4 -4
- package/src/_modules/email.index.ts +2 -2
- package/src/_modules/test/custom-data.service.ts +2 -2
- package/src/_modules/test/get-test-routing-module.ts +5 -5
- package/src/_modules/test/test-controller.ts +10 -10
- package/src/_modules/usage/get-usage-routing-module.ts +5 -5
- package/src/_modules/usage/usage-controller.ts +12 -12
- package/src/_modules/usage/usage.service.ts +6 -6
- package/src/_services/{dynamobe-api.service.ts → dynamo-nts-api.service.ts} +12 -12
- package/src/_services/dynamo-nts-app-extended.ts +124 -0
- package/src/_services/{dynamobe-app.ts → dynamo-nts-app.ts} +49 -49
- package/src/_services/{dynamobe-auth.service.ts → dynamo-nts-auth.service.ts} +2 -2
- package/src/_services/dynamo-nts-controller.service.ts +28 -0
- package/src/_services/{dynamobe-data.service.ts → dynamo-nts-data.service.ts} +7 -7
- package/src/_services/dynamo-nts-db-service-collection.service.ts +12 -0
- package/src/_services/{dynamobe-db.service.ts → dynamo-nts-db.service.ts} +1 -1
- package/src/_services/{dynamobe-email-service-collection.service.ts → dynamo-nts-email-service-collection.service.ts} +4 -4
- package/src/_services/{dynamobe-email.service.ts → dynamo-nts-email.service.ts} +11 -11
- package/src/_services/{dynamobe-global.service.ts → dynamo-nts-global.service.ts} +24 -24
- package/src/_services/{dynamobe-routing-module.service.ts → dynamo-nts-routing-module.service.ts} +26 -26
- package/src/_services/{dynamobe-shared.service.ts → dynamo-nts-shared.service.ts} +1 -1
- package/src/_services/{dynamobe-singleton.service.ts → dynamo-nts-singleton.service.ts} +1 -1
- package/src/_services/index.ts +13 -13
- package/src/_constants/dynamobe-global.settings.ts +0 -12
- package/src/_models/dynamobe-global-settings.ts +0 -13
- package/src/_services/dynamobe-controller.service.ts +0 -28
- package/src/_services/dynamobe-db-service-collection.service.ts +0 -12
|
@@ -5,12 +5,12 @@ import * as NodeMailer from 'nodemailer';
|
|
|
5
5
|
import { Options as MailOptions, Attachment } from 'nodemailer/lib/mailer';
|
|
6
6
|
import { DynamoBEError } from '@futdevpro/fsm-dynamo';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { DynamoNTS_Shared } from './dynamo-nts-shared.service';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
13
|
-
export class
|
|
13
|
+
export class DynamoNTS_EmailService {
|
|
14
14
|
private nmTransporter: NodeMailer.Transporter;
|
|
15
15
|
private senderName: string;
|
|
16
16
|
private senderNEmail: string;
|
|
@@ -55,7 +55,7 @@ export class DynamoBEEmailService {
|
|
|
55
55
|
this.constructionFinished();
|
|
56
56
|
}
|
|
57
57
|
} catch (error) {
|
|
58
|
-
|
|
58
|
+
DynamoNTS_Shared.logError(`\nDynamoBEEmailService ERROR, The emailService construction failed for ${set.email}.`, new Error());
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -63,7 +63,7 @@ export class DynamoBEEmailService {
|
|
|
63
63
|
*
|
|
64
64
|
*/
|
|
65
65
|
private constructionFinished(): void {
|
|
66
|
-
|
|
66
|
+
DynamoNTS_Shared.logSuccess(`\nEmailService construction (${this.senderName}) Finished!\n`)
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
/**
|
|
@@ -101,7 +101,7 @@ export class DynamoBEEmailService {
|
|
|
101
101
|
this.templatePropertyKeys[set.useTemplate].forEach((key: string, index: number) => {
|
|
102
102
|
props += `${key}${index != this.templatePropertyKeys[set.useTemplate].length - 1 ? ', ' : ''}`;
|
|
103
103
|
});
|
|
104
|
-
|
|
104
|
+
DynamoNTS_Shared.logError('\nDynamoBEEmailService ERROR: INVALID sendEmail settings', set);
|
|
105
105
|
throw new DynamoBEError({
|
|
106
106
|
message: `templateProperties missing! properties needed: ${props}`,
|
|
107
107
|
userMessage: `We encountered an uncought BackEnd Email Service Error, please contact the responsible development team. errorcode: 701-114-102`,
|
|
@@ -110,7 +110,7 @@ export class DynamoBEEmailService {
|
|
|
110
110
|
}
|
|
111
111
|
this.templatePropertyKeys[set.useTemplate].forEach((propertyKey: string) => {
|
|
112
112
|
if (!set.templateProperties[propertyKey]) {
|
|
113
|
-
|
|
113
|
+
DynamoNTS_Shared.logError(`templateProperty missing! (${propertyKey})`);
|
|
114
114
|
}
|
|
115
115
|
const reg = new RegExp(`{{${propertyKey}}}`, 'g')
|
|
116
116
|
content = content.replace(reg, set.templateProperties[propertyKey]);
|
|
@@ -143,7 +143,7 @@ export class DynamoBEEmailService {
|
|
|
143
143
|
});
|
|
144
144
|
});
|
|
145
145
|
} catch (error) {
|
|
146
|
-
|
|
146
|
+
DynamoNTS_Shared.logError('\nDynamoBEEmailService ERROR: email sending error', error);
|
|
147
147
|
throw error;
|
|
148
148
|
}
|
|
149
149
|
}
|
|
@@ -162,7 +162,7 @@ export class DynamoBEEmailService {
|
|
|
162
162
|
templatePath = Path.join(rootPath, templatePath);
|
|
163
163
|
FileSystem.readFile(templatePath, 'utf8' , (err, template) => {
|
|
164
164
|
if (err) {
|
|
165
|
-
|
|
165
|
+
DynamoNTS_Shared.logError(`\nDynamoBEEmailService readFile ERROR (0), Couldn't load email template; ${templateName} from ${templatePath}\nerror:\n`, err, '\n');
|
|
166
166
|
reject(err);
|
|
167
167
|
return;
|
|
168
168
|
} else {
|
|
@@ -178,7 +178,7 @@ export class DynamoBEEmailService {
|
|
|
178
178
|
});
|
|
179
179
|
});
|
|
180
180
|
} catch (error) {
|
|
181
|
-
|
|
181
|
+
DynamoNTS_Shared.logError(`\nDynamoBEEmailService ERROR (1), Couldn't load email template; ${templateName} from ${templatePath}`, new Error());
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
|
|
@@ -194,7 +194,7 @@ export class DynamoBEEmailService {
|
|
|
194
194
|
let propertyCloseTagIndex = template.indexOf('}}', propertyOpenTagIndex + 2);
|
|
195
195
|
while (propertyOpenTagIndex >= 0) {
|
|
196
196
|
if (propertyCloseTagIndex === -1) {
|
|
197
|
-
|
|
197
|
+
DynamoNTS_Shared.logError(`\nDynamoBEEmailService ERROR, missing closing tag from email template! (${propertyOpenTagIndex} -)`, propertyKeys);
|
|
198
198
|
throw new DynamoBEError({
|
|
199
199
|
message: `ERROR, missing closing tag from email template! (${propertyOpenTagIndex} -)`,
|
|
200
200
|
userMessage: `We encountered an uncought BackEnd Email Service Error, please contact the responsible development team. errorcode: 701-114-200`,
|
|
@@ -211,7 +211,7 @@ export class DynamoBEEmailService {
|
|
|
211
211
|
// console.log('\n\n\nTEST propertyKeys: ', propertyKeys);
|
|
212
212
|
return propertyKeys;
|
|
213
213
|
} catch (error) {
|
|
214
|
-
|
|
214
|
+
DynamoNTS_Shared.logError(`\nDynamoBEEmailService ERROR, getTemplatePropertyKeys ERROR`, new Error(), '\ntemplate:\n', template);
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
}
|
|
@@ -2,27 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
import { Metadata, DynamoBEDataParams } from '@futdevpro/fsm-dynamo';
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
5
|
+
import { DynamoNTS_AuthService } from './dynamo-nts-auth.service';
|
|
6
|
+
import { DynamoNTS_DBServiceCollection } from './dynamo-nts-db-service-collection.service';
|
|
7
|
+
import { DynamoNTS_DBService } from './dynamo-nts-db.service';
|
|
8
|
+
import { DynamoNTS_EmailServiceCollection } from './dynamo-nts-email-service-collection.service';
|
|
9
|
+
import { DynamoNTS_Shared } from './dynamo-nts-shared.service';
|
|
10
|
+
import { DynamoNTS_SingletonService } from './dynamo-nts-singleton.service';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* This is the main Global/Core Service Collection used by DynamoBE,
|
|
14
14
|
* you also can use this to access main services as
|
|
15
15
|
* dbServices, emailServices, or authService
|
|
16
16
|
*/
|
|
17
|
-
export class
|
|
17
|
+
export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
18
18
|
|
|
19
|
-
static getInstance():
|
|
20
|
-
return
|
|
19
|
+
static getInstance(): DynamoNTS_GlobalService {
|
|
20
|
+
return DynamoNTS_GlobalService.getSingletonInstance();
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
authService:
|
|
24
|
-
dbServiceCollection:
|
|
25
|
-
emailServiceCollection:
|
|
23
|
+
authService: DynamoNTS_AuthService;
|
|
24
|
+
dbServiceCollection: DynamoNTS_DBServiceCollection;
|
|
25
|
+
emailServiceCollection: DynamoNTS_EmailServiceCollection;
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* You need to setup global Services through this function
|
|
@@ -32,12 +32,12 @@ export class DBE_Global_S extends DynamoBESingletonService {
|
|
|
32
32
|
/**
|
|
33
33
|
* You need to setup your Own Auth Service extending the DynamoBEAuthService class
|
|
34
34
|
*/
|
|
35
|
-
authService:
|
|
35
|
+
authService: DynamoNTS_AuthService,
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* You can setup your Own Email Service extending the DynamoBEEmailServiceCollection class
|
|
39
39
|
*/
|
|
40
|
-
emailServiceCollection?:
|
|
40
|
+
emailServiceCollection?: DynamoNTS_EmailServiceCollection,
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* you can setup data tables by passing a DynamoBEDataParams list at this point
|
|
@@ -48,19 +48,19 @@ export class DBE_Global_S extends DynamoBESingletonService {
|
|
|
48
48
|
this.getInstance();
|
|
49
49
|
|
|
50
50
|
try {
|
|
51
|
-
this.instance.dbServiceCollection = new
|
|
51
|
+
this.instance.dbServiceCollection = new DynamoNTS_DBServiceCollection();
|
|
52
52
|
set.dbModels.forEach((dbModel: DynamoBEDataParams) => {
|
|
53
53
|
try {
|
|
54
|
-
this.instance.dbServiceCollection[dbModel.dataName] = new
|
|
54
|
+
this.instance.dbServiceCollection[dbModel.dataName] = new DynamoNTS_DBService(dbModel);
|
|
55
55
|
} catch (error) {
|
|
56
|
-
|
|
56
|
+
DynamoNTS_Shared.logError(`\nFailed to create DynamoBEDBService (${dbModel.dataName}).\n`, dbModel, `\n`, error);
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
this.instance.authService = set.authService;
|
|
61
61
|
this.instance.emailServiceCollection = set.emailServiceCollection;
|
|
62
62
|
} catch (error) {
|
|
63
|
-
|
|
63
|
+
DynamoNTS_Shared.logError('\nsetServices failed on DBE_Global_S.\n', error);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -68,7 +68,7 @@ export class DBE_Global_S extends DynamoBESingletonService {
|
|
|
68
68
|
*
|
|
69
69
|
* @returns
|
|
70
70
|
*/
|
|
71
|
-
static getAuthService():
|
|
71
|
+
static getAuthService(): DynamoNTS_AuthService {
|
|
72
72
|
if (!this.instance?.authService?.authenticateToken) {
|
|
73
73
|
throw new Error(
|
|
74
74
|
`\nUnique Authentication Service missing!` +
|
|
@@ -82,7 +82,7 @@ export class DBE_Global_S extends DynamoBESingletonService {
|
|
|
82
82
|
*
|
|
83
83
|
* @returns
|
|
84
84
|
*/
|
|
85
|
-
static getDBServiceCollection():
|
|
85
|
+
static getDBServiceCollection(): DynamoNTS_DBServiceCollection {
|
|
86
86
|
if (!this.instance?.dbServiceCollection) {
|
|
87
87
|
throw new Error(
|
|
88
88
|
`\nUnique DataBase Service Collection missing!` +
|
|
@@ -97,7 +97,7 @@ export class DBE_Global_S extends DynamoBESingletonService {
|
|
|
97
97
|
* @param dataParams
|
|
98
98
|
* @returns
|
|
99
99
|
*/
|
|
100
|
-
static getDBService<T extends Metadata>(dataParams: DynamoBEDataParams):
|
|
100
|
+
static getDBService<T extends Metadata>(dataParams: DynamoBEDataParams): DynamoNTS_DBService<T> {
|
|
101
101
|
return this.getDBServiceByKey<T>(dataParams.dataName);
|
|
102
102
|
}
|
|
103
103
|
|
|
@@ -106,10 +106,10 @@ export class DBE_Global_S extends DynamoBESingletonService {
|
|
|
106
106
|
* @param key
|
|
107
107
|
* @returns
|
|
108
108
|
*/
|
|
109
|
-
static getDBServiceByKey<T extends Metadata>(key: string):
|
|
109
|
+
static getDBServiceByKey<T extends Metadata>(key: string): DynamoNTS_DBService<T> {
|
|
110
110
|
const collection = this.getDBServiceCollection();
|
|
111
111
|
if (collection[key]) {
|
|
112
|
-
return collection[key] as
|
|
112
|
+
return collection[key] as DynamoNTS_DBService<T>;
|
|
113
113
|
} else {
|
|
114
114
|
let keys: string = `${Object.keys(collection)}`;
|
|
115
115
|
keys = keys.replace(/,/g, '\n ');
|
|
@@ -125,7 +125,7 @@ export class DBE_Global_S extends DynamoBESingletonService {
|
|
|
125
125
|
*
|
|
126
126
|
* @returns
|
|
127
127
|
*/
|
|
128
|
-
static getEmailServiceCollection():
|
|
128
|
+
static getEmailServiceCollection(): DynamoNTS_EmailServiceCollection {
|
|
129
129
|
if (!this.instance?.emailServiceCollection) {
|
|
130
130
|
throw new Error(
|
|
131
131
|
`Unique Email Service Collection missing!` +
|
package/src/_services/{dynamobe-routing-module.service.ts → dynamo-nts-routing-module.service.ts}
RENAMED
|
@@ -2,47 +2,47 @@
|
|
|
2
2
|
import { Router } from 'express';
|
|
3
3
|
import { DynamoBEError } from '@futdevpro/fsm-dynamo';
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { dynamoNTS_GlobalSettings } from '../_constants/dynamo-nts-global.settings';
|
|
6
|
+
import { DynamoNTS_RouteSecurity } from '../_enums/dynamo-nts-route-security.enum';
|
|
7
7
|
import { HttpCallType } from '../_enums/http/http-call-type.enum';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { DynamoNTS_EndpointParams } from '../_models/dynamo-nts-endpoint-params';
|
|
9
|
+
import { DynamoNTS_Controller } from './dynamo-nts-controller.service';
|
|
10
|
+
import { DynamoNTS_Shared } from './dynamo-nts-shared.service';
|
|
11
11
|
|
|
12
|
-
export interface
|
|
12
|
+
export interface DynamoNTS_RoutingModuleSettings {
|
|
13
13
|
route: string;
|
|
14
|
-
controllers:
|
|
15
|
-
securityOverride?:
|
|
14
|
+
controllers: DynamoNTS_Controller[];
|
|
15
|
+
securityOverride?: DynamoNTS_RouteSecurity;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
21
|
-
export class
|
|
21
|
+
export class DynamoNTS_RoutingModule {
|
|
22
22
|
|
|
23
|
-
security:
|
|
23
|
+
security: DynamoNTS_RouteSecurity;
|
|
24
24
|
route: string;
|
|
25
25
|
|
|
26
|
-
private controllers:
|
|
27
|
-
endpoints:
|
|
26
|
+
private controllers: DynamoNTS_Controller[];
|
|
27
|
+
endpoints: DynamoNTS_EndpointParams[] = [];
|
|
28
28
|
|
|
29
29
|
openRouter: Router = Router();
|
|
30
30
|
secureRouter: Router = Router();
|
|
31
31
|
|
|
32
|
-
protected log: boolean =
|
|
32
|
+
protected log: boolean = dynamoNTS_GlobalSettings.logSetup;
|
|
33
33
|
|
|
34
34
|
constructor(
|
|
35
|
-
set:
|
|
35
|
+
set: DynamoNTS_RoutingModuleSettings
|
|
36
36
|
){
|
|
37
37
|
try {
|
|
38
|
-
this.route =
|
|
38
|
+
this.route = dynamoNTS_GlobalSettings.baseUrl + set.route;
|
|
39
39
|
this.controllers = set.controllers;
|
|
40
40
|
this.setupRoutes();
|
|
41
41
|
this.mountRoutes(set.securityOverride);
|
|
42
42
|
|
|
43
43
|
if (this.log) console.log(`routing module setup done: ${this.route} serurity: ${this.security}\n`);
|
|
44
44
|
} catch (error) {
|
|
45
|
-
|
|
45
|
+
DynamoNTS_Shared.logError(`Routing module setup failed (${this.route})`, error);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -50,7 +50,7 @@ export class DynamoBERoutingModule {
|
|
|
50
50
|
* You must setup endpoints and required services in this function
|
|
51
51
|
*/
|
|
52
52
|
private setupRoutes(): void {
|
|
53
|
-
this.controllers.forEach((controller:
|
|
53
|
+
this.controllers.forEach((controller: DynamoNTS_Controller) => {
|
|
54
54
|
this.endpoints.push(...controller.endpoints);
|
|
55
55
|
});
|
|
56
56
|
}
|
|
@@ -59,24 +59,24 @@ export class DynamoBERoutingModule {
|
|
|
59
59
|
*
|
|
60
60
|
* @param securityOverride
|
|
61
61
|
*/
|
|
62
|
-
private mountRoutes(securityOverride?:
|
|
62
|
+
private mountRoutes(securityOverride?: DynamoNTS_RouteSecurity): void {
|
|
63
63
|
if (securityOverride) {
|
|
64
64
|
this.security = securityOverride;
|
|
65
65
|
}
|
|
66
|
-
this.endpoints.forEach((endpoint:
|
|
66
|
+
this.endpoints.forEach((endpoint: DynamoNTS_EndpointParams) => {
|
|
67
67
|
if (securityOverride) {
|
|
68
68
|
endpoint.security = securityOverride;
|
|
69
69
|
} else {
|
|
70
70
|
if (!this.security) {
|
|
71
71
|
this.security = endpoint.security;
|
|
72
72
|
} else if (this.security !== endpoint.security) {
|
|
73
|
-
this.security =
|
|
73
|
+
this.security = DynamoNTS_RouteSecurity.both;
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
if (this.log) console.log(`endpoint mount (${endpoint.security}): ${this.route}${endpoint.endpoint}`);
|
|
78
|
-
const existingEndPoints:
|
|
79
|
-
(ep:
|
|
78
|
+
const existingEndPoints: DynamoNTS_EndpointParams[] = this.endpoints.filter(
|
|
79
|
+
(ep: DynamoNTS_EndpointParams) => ep.endpoint === endpoint.endpoint);
|
|
80
80
|
if (1 < existingEndPoints.length) {
|
|
81
81
|
let error = new Error(`ENDPOINT DUPLICATION: ${endpoint.endpoint}`);
|
|
82
82
|
let errorStack: string[] = error.stack.split('\n');
|
|
@@ -87,10 +87,10 @@ export class DynamoBERoutingModule {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
try {
|
|
90
|
-
if (endpoint.security !==
|
|
90
|
+
if (endpoint.security !== DynamoNTS_RouteSecurity.secure) {
|
|
91
91
|
this.mountOpenRoute(endpoint);
|
|
92
92
|
}
|
|
93
|
-
if (endpoint.security !==
|
|
93
|
+
if (endpoint.security !== DynamoNTS_RouteSecurity.open) {
|
|
94
94
|
this.mountSecureRoute(endpoint);
|
|
95
95
|
}
|
|
96
96
|
} catch (error) {
|
|
@@ -107,7 +107,7 @@ export class DynamoBERoutingModule {
|
|
|
107
107
|
*
|
|
108
108
|
* @param endpointParams
|
|
109
109
|
*/
|
|
110
|
-
private mountOpenRoute(endpointParams:
|
|
110
|
+
private mountOpenRoute(endpointParams: DynamoNTS_EndpointParams): void {
|
|
111
111
|
switch(endpointParams.type) {
|
|
112
112
|
case HttpCallType.get:
|
|
113
113
|
this.openRouter.get(endpointParams.endpoint,
|
|
@@ -142,7 +142,7 @@ export class DynamoBERoutingModule {
|
|
|
142
142
|
*
|
|
143
143
|
* @param endpointParams
|
|
144
144
|
*/
|
|
145
|
-
private mountSecureRoute(endpointParams:
|
|
145
|
+
private mountSecureRoute(endpointParams: DynamoNTS_EndpointParams): void {
|
|
146
146
|
switch(endpointParams.type) {
|
|
147
147
|
case HttpCallType.get:
|
|
148
148
|
this.secureRouter.get(endpointParams.endpoint,
|
package/src/_services/index.ts
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
// SERVICES
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './
|
|
11
|
-
export * from './
|
|
12
|
-
export * from './
|
|
13
|
-
export * from './
|
|
14
|
-
export * from './
|
|
15
|
-
export * from './
|
|
16
|
-
export * from './
|
|
17
|
-
export * from './
|
|
5
|
+
export * from './dynamo-nts-api.service';
|
|
6
|
+
export * from './dynamo-nts-app';
|
|
7
|
+
export * from './dynamo-nts-auth.service';
|
|
8
|
+
export * from './dynamo-nts-controller.service';
|
|
9
|
+
export * from './dynamo-nts-data.service';
|
|
10
|
+
export * from './dynamo-nts-db-service-collection.service';
|
|
11
|
+
export * from './dynamo-nts-db.service';
|
|
12
|
+
export * from './dynamo-nts-email-service-collection.service';
|
|
13
|
+
export * from './dynamo-nts-email.service';
|
|
14
|
+
export * from './dynamo-nts-global.service';
|
|
15
|
+
export * from './dynamo-nts-routing-module.service';
|
|
16
|
+
export * from './dynamo-nts-shared.service';
|
|
17
|
+
export * from './dynamo-nts-singleton.service';
|
|
18
18
|
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { DynamoBERouteSecurity } from '../_enums/dynamobe-route-security.enum';
|
|
3
|
-
import { DynamoBEGlobalSettings } from '../_models/dynamobe-global-settings';
|
|
4
|
-
|
|
5
|
-
export const dynamoBEGlobalSettings: DynamoBEGlobalSettings = {
|
|
6
|
-
baseUrl: '/api',
|
|
7
|
-
defaultRouteSecurity: DynamoBERouteSecurity.open,
|
|
8
|
-
logSetup: false,
|
|
9
|
-
logRequests: true,
|
|
10
|
-
logRequestsContent: true,
|
|
11
|
-
logResponseContent: false,
|
|
12
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { DynamoBERouteSecurity } from '../_enums/dynamobe-route-security.enum';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
export interface DynamoBEGlobalSettings {
|
|
7
|
-
baseUrl: string;
|
|
8
|
-
defaultRouteSecurity: DynamoBERouteSecurity;
|
|
9
|
-
logSetup?: boolean;
|
|
10
|
-
logRequests?: boolean;
|
|
11
|
-
logRequestsContent?: boolean;
|
|
12
|
-
logResponseContent?: boolean;
|
|
13
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { DynamoBEEndpointParams } from '../_models/dynamobe-endpoint-params';
|
|
4
|
-
import { DBE_Shared } from './dynamobe-shared.service';
|
|
5
|
-
import { DynamoBESingletonService } from './dynamobe-singleton.service';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
export abstract class DynamoBEController extends DynamoBESingletonService {
|
|
11
|
-
|
|
12
|
-
endpoints: DynamoBEEndpointParams[];
|
|
13
|
-
|
|
14
|
-
protected constructor(){
|
|
15
|
-
super();
|
|
16
|
-
|
|
17
|
-
try {
|
|
18
|
-
this.setupEndpoints();
|
|
19
|
-
} catch (error) {
|
|
20
|
-
DBE_Shared.logError(`DynamoBEController ERROR setup failed:`, error);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* You must setup endpoints and required services in this function
|
|
26
|
-
*/
|
|
27
|
-
abstract setupEndpoints(): void
|
|
28
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { DynamoBEDBService } from './dynamobe-db.service';
|
|
3
|
-
import { DynamoBESingletonService } from './dynamobe-singleton.service';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
export class DynamoBEDBServiceCollection extends DynamoBESingletonService {
|
|
9
|
-
|
|
10
|
-
[service: string]: DynamoBEDBService<any>;
|
|
11
|
-
|
|
12
|
-
}
|