@futdevpro/nts-dynamo 1.4.4 → 1.4.6

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.
Files changed (225) hide show
  1. package/lib/_constants/dynamobe-global.settings.d.ts +3 -0
  2. package/lib/_constants/dynamobe-global.settings.d.ts.map +1 -0
  3. package/lib/_constants/dynamobe-global.settings.js +13 -0
  4. package/lib/_constants/dynamobe-global.settings.js.map +1 -0
  5. package/lib/_constants/index.d.ts +2 -0
  6. package/lib/_constants/index.d.ts.map +1 -0
  7. package/lib/_constants/index.js +5 -0
  8. package/lib/_constants/index.js.map +1 -0
  9. package/lib/_enums/data-model-type.enum.d.ts +6 -0
  10. package/lib/_enums/data-model-type.enum.d.ts.map +1 -0
  11. package/lib/_enums/data-model-type.enum.js +10 -0
  12. package/lib/_enums/data-model-type.enum.js.map +1 -0
  13. package/lib/_enums/dynamobe-data-service-function.enum.d.ts +8 -0
  14. package/lib/_enums/dynamobe-data-service-function.enum.d.ts.map +1 -0
  15. package/lib/_enums/dynamobe-data-service-function.enum.js +15 -0
  16. package/lib/_enums/dynamobe-data-service-function.enum.js.map +1 -0
  17. package/lib/_enums/dynamobe-route-security.enum.d.ts +6 -0
  18. package/lib/_enums/dynamobe-route-security.enum.d.ts.map +1 -0
  19. package/lib/_enums/dynamobe-route-security.enum.js +10 -0
  20. package/lib/_enums/dynamobe-route-security.enum.js.map +1 -0
  21. package/lib/_enums/http/http-call-type.enum.d.ts +8 -0
  22. package/lib/_enums/http/http-call-type.enum.d.ts.map +1 -0
  23. package/lib/_enums/http/http-call-type.enum.js +12 -0
  24. package/lib/_enums/http/http-call-type.enum.js.map +1 -0
  25. package/lib/_enums/http/http-response-type.enum.d.ts +7 -0
  26. package/lib/_enums/http/http-response-type.enum.d.ts.map +1 -0
  27. package/lib/_enums/http/http-response-type.enum.js +11 -0
  28. package/lib/_enums/http/http-response-type.enum.js.map +1 -0
  29. package/lib/_enums/index.d.ts +8 -0
  30. package/lib/_enums/index.d.ts.map +1 -0
  31. package/lib/_enums/index.js +39 -0
  32. package/lib/_enums/index.js.map +1 -0
  33. package/lib/_enums/log-style.enum.d.ts +26 -0
  34. package/lib/_enums/log-style.enum.d.ts.map +1 -0
  35. package/lib/_enums/log-style.enum.js +30 -0
  36. package/lib/_enums/log-style.enum.js.map +1 -0
  37. package/lib/_enums/predefined-data-types.enum.d.ts +8 -0
  38. package/lib/_enums/predefined-data-types.enum.d.ts.map +1 -0
  39. package/lib/_enums/predefined-data-types.enum.js +12 -0
  40. package/lib/_enums/predefined-data-types.enum.js.map +1 -0
  41. package/lib/_models/dynamo-module-settings.d.ts +7 -0
  42. package/lib/_models/dynamo-module-settings.d.ts.map +1 -0
  43. package/lib/_models/dynamo-module-settings.js +3 -0
  44. package/lib/_models/dynamo-module-settings.js.map +1 -0
  45. package/lib/_models/dynamobe-api-call-params.d.ts +35 -0
  46. package/lib/_models/dynamobe-api-call-params.d.ts.map +1 -0
  47. package/lib/_models/dynamobe-api-call-params.js +24 -0
  48. package/lib/_models/dynamobe-api-call-params.js.map +1 -0
  49. package/lib/_models/dynamobe-app-params.d.ts +15 -0
  50. package/lib/_models/dynamobe-app-params.d.ts.map +1 -0
  51. package/lib/_models/dynamobe-app-params.js +14 -0
  52. package/lib/_models/dynamobe-app-params.js.map +1 -0
  53. package/lib/_models/dynamobe-data-model-params.d.ts +13 -0
  54. package/lib/_models/dynamobe-data-model-params.d.ts.map +1 -0
  55. package/lib/_models/dynamobe-data-model-params.js +15 -0
  56. package/lib/_models/dynamobe-data-model-params.js.map +1 -0
  57. package/lib/_models/dynamobe-endpoint-params.d.ts +30 -0
  58. package/lib/_models/dynamobe-endpoint-params.d.ts.map +1 -0
  59. package/lib/_models/dynamobe-endpoint-params.js +101 -0
  60. package/lib/_models/dynamobe-endpoint-params.js.map +1 -0
  61. package/lib/_models/dynamobe-global-settings.d.ts +10 -0
  62. package/lib/_models/dynamobe-global-settings.d.ts.map +1 -0
  63. package/lib/_models/dynamobe-global-settings.js +3 -0
  64. package/lib/_models/dynamobe-global-settings.js.map +1 -0
  65. package/lib/_models/index.d.ts +6 -0
  66. package/lib/_models/index.d.ts.map +1 -0
  67. package/lib/_models/index.js +10 -0
  68. package/lib/_models/index.js.map +1 -0
  69. package/lib/_modules/api-service.index.d.ts +5 -0
  70. package/lib/_modules/api-service.index.d.ts.map +1 -0
  71. package/lib/_modules/api-service.index.js +11 -0
  72. package/lib/_modules/api-service.index.js.map +1 -0
  73. package/lib/_modules/app.index.d.ts +10 -0
  74. package/lib/_modules/app.index.d.ts.map +1 -0
  75. package/lib/_modules/app.index.js +17 -0
  76. package/lib/_modules/app.index.js.map +1 -0
  77. package/lib/_modules/auth.index.d.ts +3 -0
  78. package/lib/_modules/auth.index.d.ts.map +1 -0
  79. package/lib/_modules/auth.index.js +7 -0
  80. package/lib/_modules/auth.index.js.map +1 -0
  81. package/lib/_modules/controller.index.d.ts +5 -0
  82. package/lib/_modules/controller.index.d.ts.map +1 -0
  83. package/lib/_modules/controller.index.js +11 -0
  84. package/lib/_modules/controller.index.js.map +1 -0
  85. package/lib/_modules/data-service.index.d.ts +5 -0
  86. package/lib/_modules/data-service.index.d.ts.map +1 -0
  87. package/lib/_modules/data-service.index.js +9 -0
  88. package/lib/_modules/data-service.index.js.map +1 -0
  89. package/lib/_modules/test/custom-data.service.d.ts +6 -0
  90. package/lib/_modules/test/custom-data.service.d.ts.map +1 -0
  91. package/lib/_modules/test/custom-data.service.js +12 -0
  92. package/lib/_modules/test/custom-data.service.js.map +1 -0
  93. package/lib/_modules/test/get-test-routing-module.d.ts +4 -0
  94. package/lib/_modules/test/get-test-routing-module.d.ts.map +1 -0
  95. package/lib/_modules/test/get-test-routing-module.js +18 -0
  96. package/lib/_modules/test/get-test-routing-module.js.map +1 -0
  97. package/lib/_modules/test/index.d.ts +4 -0
  98. package/lib/_modules/test/index.d.ts.map +1 -0
  99. package/lib/_modules/test/index.js +8 -0
  100. package/lib/_modules/test/index.js.map +1 -0
  101. package/lib/_modules/test/test-controller.d.ts +6 -0
  102. package/lib/_modules/test/test-controller.d.ts.map +1 -0
  103. package/lib/_modules/test/test-controller.js +127 -0
  104. package/lib/_modules/test/test-controller.js.map +1 -0
  105. package/lib/_modules/usage/get-usage-routing-module.d.ts +4 -0
  106. package/lib/_modules/usage/get-usage-routing-module.d.ts.map +1 -0
  107. package/lib/_modules/usage/get-usage-routing-module.js +18 -0
  108. package/lib/_modules/usage/get-usage-routing-module.js.map +1 -0
  109. package/lib/_modules/usage/index.d.ts +4 -0
  110. package/lib/_modules/usage/index.d.ts.map +1 -0
  111. package/lib/_modules/usage/index.js +8 -0
  112. package/lib/_modules/usage/index.js.map +1 -0
  113. package/lib/_modules/usage/usage-controller.d.ts +7 -0
  114. package/lib/_modules/usage/usage-controller.d.ts.map +1 -0
  115. package/lib/_modules/usage/usage-controller.js +89 -0
  116. package/lib/_modules/usage/usage-controller.js.map +1 -0
  117. package/lib/_modules/usage/usage.service.d.ts +17 -0
  118. package/lib/_modules/usage/usage.service.d.ts.map +1 -0
  119. package/lib/_modules/usage/usage.service.js +108 -0
  120. package/lib/_modules/usage/usage.service.js.map +1 -0
  121. package/lib/_services/dynamobe-api.service.d.ts +10 -0
  122. package/lib/_services/dynamobe-api.service.d.ts.map +1 -0
  123. package/lib/_services/dynamobe-api.service.js +131 -0
  124. package/lib/_services/dynamobe-api.service.js.map +1 -0
  125. package/lib/_services/dynamobe-app.d.ts +105 -0
  126. package/lib/_services/dynamobe-app.d.ts.map +1 -0
  127. package/lib/_services/dynamobe-app.js +212 -0
  128. package/lib/_services/dynamobe-app.js.map +1 -0
  129. package/lib/_services/dynamobe-auth.service.d.ts +41 -0
  130. package/lib/_services/dynamobe-auth.service.d.ts.map +1 -0
  131. package/lib/_services/dynamobe-auth.service.js +40 -0
  132. package/lib/_services/dynamobe-auth.service.js.map +1 -0
  133. package/lib/_services/dynamobe-controller.service.d.ts +11 -0
  134. package/lib/_services/dynamobe-controller.service.d.ts.map +1 -0
  135. package/lib/_services/dynamobe-controller.service.js +18 -0
  136. package/lib/_services/dynamobe-controller.service.js.map +1 -0
  137. package/lib/_services/dynamobe-data.service.d.ts +50 -0
  138. package/lib/_services/dynamobe-data.service.d.ts.map +1 -0
  139. package/lib/_services/dynamobe-data.service.js +222 -0
  140. package/lib/_services/dynamobe-data.service.js.map +1 -0
  141. package/lib/_services/dynamobe-db-service-collection.service.d.ts +6 -0
  142. package/lib/_services/dynamobe-db-service-collection.service.d.ts.map +1 -0
  143. package/lib/_services/dynamobe-db-service-collection.service.js +8 -0
  144. package/lib/_services/dynamobe-db-service-collection.service.js.map +1 -0
  145. package/lib/_services/dynamobe-db.service.d.ts +149 -0
  146. package/lib/_services/dynamobe-db.service.d.ts.map +1 -0
  147. package/lib/_services/dynamobe-db.service.js +577 -0
  148. package/lib/_services/dynamobe-db.service.js.map +1 -0
  149. package/lib/_services/dynamobe-email-service-collection.service.d.ts +19 -0
  150. package/lib/_services/dynamobe-email-service-collection.service.d.ts.map +1 -0
  151. package/lib/_services/dynamobe-email-service-collection.service.js +21 -0
  152. package/lib/_services/dynamobe-email-service-collection.service.js.map +1 -0
  153. package/lib/_services/dynamobe-email.service.d.ts +34 -0
  154. package/lib/_services/dynamobe-email.service.d.ts.map +1 -0
  155. package/lib/_services/dynamobe-email.service.js +144 -0
  156. package/lib/_services/dynamobe-email.service.js.map +1 -0
  157. package/lib/_services/dynamobe-global.service.d.ts +40 -0
  158. package/lib/_services/dynamobe-global.service.d.ts.map +1 -0
  159. package/lib/_services/dynamobe-global.service.js +74 -0
  160. package/lib/_services/dynamobe-global.service.js.map +1 -0
  161. package/lib/_services/dynamobe-routing-module.service.d.ts +27 -0
  162. package/lib/_services/dynamobe-routing-module.service.d.ts.map +1 -0
  163. package/lib/_services/dynamobe-routing-module.service.js +119 -0
  164. package/lib/_services/dynamobe-routing-module.service.js.map +1 -0
  165. package/lib/_services/dynamobe-shared-be.service.d.ts +9 -0
  166. package/lib/_services/dynamobe-shared-be.service.d.ts.map +1 -0
  167. package/lib/_services/dynamobe-shared-be.service.js +45 -0
  168. package/lib/_services/dynamobe-shared-be.service.js.map +1 -0
  169. package/lib/_services/dynamobe-shared.service.d.ts +86 -0
  170. package/lib/_services/dynamobe-shared.service.d.ts.map +1 -0
  171. package/lib/_services/dynamobe-shared.service.js +251 -0
  172. package/lib/_services/dynamobe-shared.service.js.map +1 -0
  173. package/lib/_services/dynamobe-singleton.service.d.ts +6 -0
  174. package/lib/_services/dynamobe-singleton.service.d.ts.map +1 -0
  175. package/lib/_services/dynamobe-singleton.service.js +16 -0
  176. package/lib/_services/dynamobe-singleton.service.js.map +1 -0
  177. package/lib/_services/index.d.ts +15 -0
  178. package/lib/_services/index.d.ts.map +1 -0
  179. package/lib/_services/index.js +19 -0
  180. package/lib/_services/index.js.map +1 -0
  181. package/lib/index.d.ts +7 -0
  182. package/lib/index.d.ts.map +1 -0
  183. package/lib/index.js +15 -0
  184. package/lib/index.js.map +1 -0
  185. package/lib/tsconfig.tsbuildinfo +4257 -0
  186. package/package.json +4 -15
  187. package/src/_constants/index.ts +0 -3
  188. package/src/_models/dynamobe-data-model-params.ts +2 -1
  189. package/src/_models/index.ts +0 -13
  190. package/src/_modules/api-service.index.ts +0 -1
  191. package/src/_modules/auth.index.ts +0 -3
  192. package/src/_modules/data-service.index.ts +0 -3
  193. package/src/_modules/test/custom-data.service.ts +2 -1
  194. package/src/_modules/test/get-test-routing-module.ts +2 -1
  195. package/src/_modules/test/index.ts +0 -2
  196. package/src/_modules/test/test-controller.ts +2 -1
  197. package/src/_modules/usage/get-usage-routing-module.ts +2 -1
  198. package/src/_modules/usage/index.ts +0 -2
  199. package/src/_modules/usage/usage-controller.ts +2 -2
  200. package/src/_modules/usage/usage.service.ts +4 -5
  201. package/src/_services/dynamobe-api.service.ts +2 -1
  202. package/src/_services/dynamobe-auth.service.ts +2 -1
  203. package/src/_services/dynamobe-data.service.ts +3 -4
  204. package/src/_services/dynamobe-db.service.ts +2 -4
  205. package/src/_services/dynamobe-email.service.ts +2 -1
  206. package/src/_services/dynamobe-global.service.ts +2 -2
  207. package/src/_services/dynamobe-routing-module.service.ts +2 -1
  208. package/src/_services/dynamobe-shared-be.service.ts +2 -1
  209. package/src/_services/dynamobe-shared.service.ts +2 -3
  210. package/src/index.ts +0 -6
  211. package/src/_constants/fullstack/module-settings/test-module-settings.ts +0 -14
  212. package/src/_constants/fullstack/module-settings/usage-module-settings.ts +0 -12
  213. package/src/_constants/fullstack/times.ts +0 -8
  214. package/src/_models/fullstack/control-models/daily-usage-data.ts +0 -34
  215. package/src/_models/fullstack/control-models/dynamobe-data-params.ts +0 -19
  216. package/src/_models/fullstack/control-models/dynamobe-data-property-params.ts +0 -98
  217. package/src/_models/fullstack/control-models/dynamobe-error.ts +0 -199
  218. package/src/_models/fullstack/control-models/geo-ip-location.ts +0 -26
  219. package/src/_models/fullstack/control-models/location-coordinates.ts +0 -5
  220. package/src/_models/fullstack/control-models/usage-action.ts +0 -18
  221. package/src/_models/fullstack/control-models/usage-data.ts +0 -26
  222. package/src/_models/fullstack/data-models/custom-data.ts +0 -41
  223. package/src/_models/fullstack/data-models/metadata.ts +0 -30
  224. package/src/_models/fullstack/data-models/usage-session.ts +0 -85
  225. package/src/_modules/data-models.index.ts +0 -3
@@ -0,0 +1,34 @@
1
+ import { Attachment } from 'nodemailer/lib/mailer';
2
+ export declare class DynamoBEEmailService {
3
+ private nmTransporter;
4
+ private senderName;
5
+ private senderNEmail;
6
+ private templates;
7
+ private templatePropertyKeys;
8
+ private templateLoadingInProgressCounter;
9
+ constructor(set: {
10
+ host: string;
11
+ port: number;
12
+ email: string;
13
+ pass: string;
14
+ senderName: string;
15
+ rootPath: string;
16
+ templatePaths: {
17
+ [templateName: string]: string;
18
+ };
19
+ });
20
+ private constructionFinished;
21
+ sendEmail(set: {
22
+ to: string;
23
+ subject: string;
24
+ content?: string;
25
+ useTemplate?: string;
26
+ templateProperties?: {
27
+ [propertyKey: string]: string;
28
+ };
29
+ attachments?: Attachment[];
30
+ }): Promise<void>;
31
+ private loadTemplate;
32
+ private getTemplatePropertyKeys;
33
+ }
34
+ //# sourceMappingURL=dynamobe-email.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamobe-email.service.d.ts","sourceRoot":"","sources":["../../src/_services/dynamobe-email.service.ts"],"names":[],"mappings":"AAIA,OAAO,EAA0B,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAK3E,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,aAAa,CAAyB;IAC9C,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,SAAS,CAEV;IACP,OAAO,CAAC,oBAAoB,CAErB;IACP,OAAO,CAAC,gCAAgC,CAAK;gBAG3C,GAAG,EAAE;QACH,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,aAAa,EAAE;YACb,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAA;SAC/B,CAAC;KACH;IA0BH,OAAO,CAAC,oBAAoB;IAIf,SAAS,CAAC,GAAG,EAAE;QAC1B,EAAE,EAAE,MAAM,CAAC;QACX,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,kBAAkB,CAAC,EAAE;YACnB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAA;SAC9B,CAAC;QACF,WAAW,CAAC,EAAE,UAAU,EAAE,CAAA;KAC3B,GAAG,OAAO,CAAC,IAAI,CAAC;YA+CH,YAAY;IA2B1B,OAAO,CAAC,uBAAuB;CAuBhC"}
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DynamoBEEmailService = 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
+ const dynamobe_shared_service_1 = require("./dynamobe-shared.service");
10
+ class DynamoBEEmailService {
11
+ constructor(set) {
12
+ this.templates = {};
13
+ this.templatePropertyKeys = {};
14
+ this.templateLoadingInProgressCounter = 0;
15
+ try {
16
+ // console.log('\n\n\n\n\nNEW CONSTRUCT STARTED', set.email);
17
+ this.senderName = set.senderName;
18
+ this.senderNEmail = `${set.senderName} <${set.email}>`;
19
+ this.nmTransporter = NodeMailer.createTransport({
20
+ host: set.host,
21
+ port: set.port,
22
+ auth: {
23
+ user: set.email,
24
+ pass: set.pass
25
+ }
26
+ });
27
+ if (set.templatePaths) {
28
+ for (let key in set.templatePaths) {
29
+ this.loadTemplate(key, set.rootPath, set.templatePaths[key]);
30
+ }
31
+ }
32
+ else {
33
+ this.constructionFinished();
34
+ }
35
+ }
36
+ catch (error) {
37
+ console.log(`\nDynamoBEEmailService ERROR, The emailService construction failed for ${set.email}.`, new Error());
38
+ }
39
+ }
40
+ constructionFinished() {
41
+ dynamobe_shared_service_1.DBE_Shared.logSuccess(`\nEmailService construction (${this.senderName}) Finished!\n`);
42
+ }
43
+ sendEmail(set) {
44
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
45
+ try {
46
+ let content;
47
+ if (set.content) {
48
+ content = set.content;
49
+ }
50
+ else if (set.useTemplate) {
51
+ if (!this.templates[set.useTemplate]) {
52
+ throw new fsm_dynamo_1.DynamoBEError({ message: `no template found with this parameter! (${set.useTemplate})` });
53
+ }
54
+ content = this.templates[set.useTemplate];
55
+ if (this.templatePropertyKeys[set.useTemplate].length > 0) {
56
+ if (!set.templateProperties) {
57
+ throw new fsm_dynamo_1.DynamoBEError({ message: `templateProperties missing!` });
58
+ }
59
+ this.templatePropertyKeys[set.useTemplate].forEach((propertyKey) => {
60
+ if (!set.templateProperties[propertyKey]) {
61
+ console.log(`templateProperty missing! (${propertyKey})`);
62
+ }
63
+ const reg = new RegExp(`{{${propertyKey}}}`, 'g');
64
+ content = content.replace(reg, set.templateProperties[propertyKey]);
65
+ });
66
+ }
67
+ }
68
+ else {
69
+ throw new fsm_dynamo_1.DynamoBEError({ message: 'no content setting passsed to emailSending!' });
70
+ }
71
+ let mailOptions = {
72
+ from: this.senderNEmail,
73
+ to: set.to,
74
+ subject: set.subject,
75
+ html: content,
76
+ attachments: set.attachments,
77
+ };
78
+ yield this.nmTransporter.sendMail(mailOptions, (error, info) => {
79
+ if (error) {
80
+ throw error;
81
+ }
82
+ });
83
+ }
84
+ catch (error) {
85
+ console.log('\nDynamoBEEmailService ERROR, email sending error', error);
86
+ }
87
+ });
88
+ }
89
+ loadTemplate(templateName, rootPath, templatePath) {
90
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
91
+ try {
92
+ this.templateLoadingInProgressCounter++;
93
+ return new Promise((resolve, reject) => {
94
+ templatePath = Path.join(rootPath, templatePath);
95
+ FileSystem.readFile(templatePath, 'utf8', (err, template) => {
96
+ if (err) {
97
+ console.log(`\nDynamoBEEmailService readFile ERROR (0), Couldn't load email template; ${templateName} from ${templatePath}\nerror:\n`, err, '\n');
98
+ reject(err);
99
+ return;
100
+ }
101
+ else {
102
+ this.templates[templateName] = template;
103
+ this.templatePropertyKeys[templateName] = this.getTemplatePropertyKeys(template);
104
+ this.templateLoadingInProgressCounter--;
105
+ if (this.templateLoadingInProgressCounter == 0) {
106
+ this.constructionFinished();
107
+ }
108
+ resolve();
109
+ }
110
+ });
111
+ });
112
+ }
113
+ catch (error) {
114
+ console.log(`\nDynamoBEEmailService ERROR (1), Couldn't load email template; ${templateName} from ${templatePath}`, new Error());
115
+ }
116
+ });
117
+ }
118
+ getTemplatePropertyKeys(template) {
119
+ try {
120
+ const propertyKeys = [];
121
+ let propertyOpenTagIndex = template.indexOf('{{');
122
+ let propertyCloseTagIndex = template.indexOf('}}', propertyOpenTagIndex + 2);
123
+ while (propertyOpenTagIndex >= 0) {
124
+ if (propertyCloseTagIndex === -1) {
125
+ console.log(`\nDynamoBEEmailService ERROR, missing closing tag from email template! (${propertyOpenTagIndex} -)`, propertyKeys);
126
+ throw new fsm_dynamo_1.DynamoBEError({ message: `ERROR, missing closing tag from email template! (${propertyOpenTagIndex} -)` });
127
+ }
128
+ const newKey = template.substring(propertyOpenTagIndex + 2, propertyCloseTagIndex);
129
+ if (!propertyKeys.includes(newKey)) {
130
+ propertyKeys.push(newKey);
131
+ }
132
+ propertyOpenTagIndex = template.indexOf('{{', propertyOpenTagIndex + 2);
133
+ propertyCloseTagIndex = template.indexOf('}}', propertyOpenTagIndex + 2);
134
+ }
135
+ // console.log('\n\n\nTEST propertyKeys: ', propertyKeys);
136
+ return propertyKeys;
137
+ }
138
+ catch (error) {
139
+ console.log(`\nDynamoBEEmailService ERROR, getTemplatePropertyKeys ERROR`, new Error(), '\ntemplate:\n', template);
140
+ }
141
+ }
142
+ }
143
+ exports.DynamoBEEmailService = DynamoBEEmailService;
144
+ //# sourceMappingURL=dynamobe-email.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamobe-email.service.js","sourceRoot":"","sources":["../../src/_services/dynamobe-email.service.ts"],"names":[],"mappings":";;;;AACA,uDAAiC;AACjC,mDAA6B;AAC7B,+DAAyC;AAEzC,sDAAsD;AAEtD,uEAAuD;AAEvD,MAAa,oBAAoB;IAY/B,YACE,GAUC;QAnBK,cAAS,GAEb,EAAE,CAAC;QACC,yBAAoB,GAExB,EAAE,CAAC;QACC,qCAAgC,GAAG,CAAC,CAAC;QAe3C,IAAI;YACF,6DAA6D;YAC7D,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC;YACjC,IAAI,CAAC,YAAY,GAAG,GAAG,GAAG,CAAC,U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AAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAClD,IAAI,qBAAqB,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,oBAAoB,GAAG,CAAC,CAAC,CAAC;YAC7E,OAAO,oBAAoB,IAAI,CAAC,EAAE;gBAChC,IAAI,qBAAqB,KAAK,CAAC,CAAC,EAAE;oBAChC,OAAO,CAAC,GAAG,CAAC,2EAA2E,oBAAoB,KAAK,EAAE,YAAY,CAAC,CAAC;oBAChI,MAAM,IAAI,0BAAa,CAAC,EAAE,OAAO,EAAE,oDAAoD,oBAAoB,KAAK,EAAE,CAAC,CAAC;iBACrH;gBACD,MAAM,MAAM,GAAW,QAAQ,CAAC,SAAS,CAAC,oBAAoB,GAAG,CAAC,EAAE,qBAAqB,CAAC,CAAC;gBAC3F,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;oBAClC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;iBAC3B;gBACD,oBAAoB,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,oBAAoB,GAAG,CAAC,CAAC,CAAC;gBACxE,qBAAqB,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,oBAAoB,GAAG,CAAC,CAAC,CAAC;aAC1E;YACD,0DAA0D;YAC1D,OAAO,YAAY,CAAC;SACrB;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,GAAG,CAAC,6DAA6D,EAAE,IAAI,KAAK,EAAE,EAAE,eAAe,EAAE,QAAQ,CAAC,CAAC;SACpH;IACH,CAAC;CACF;AA/JD,oDA+JC"}
@@ -0,0 +1,40 @@
1
+ import { DynamoBEDataParams, Metadata } from '@futdevpro/fsm-dynamo';
2
+ import { DynamoBEAuthService } from './dynamobe-auth.service';
3
+ import { DynamoBEDBServiceCollection } from './dynamobe-db-service-collection.service';
4
+ import { DynamoBEDBService } from './dynamobe-db.service';
5
+ import { DynamoBEEmailServiceCollection } from './dynamobe-email-service-collection.service';
6
+ import { DynamoBESingletonService } from './dynamobe-singleton.service';
7
+ /**
8
+ * This is the main Global/Core Service Collection used by DynamoBE,
9
+ * you also can use this to access main services as
10
+ * dbServices, emailServices, or authService
11
+ */
12
+ export declare class DBE_Global_S extends DynamoBESingletonService {
13
+ static getInstance(): DBE_Global_S;
14
+ authService: DynamoBEAuthService;
15
+ dbServiceCollection: DynamoBEDBServiceCollection;
16
+ emailServiceCollection: DynamoBEEmailServiceCollection;
17
+ /**
18
+ * You need to setup global Services through this function
19
+ */
20
+ static setServices(set: {
21
+ /**
22
+ * You need to setup your Own Auth Service extending the DynamoBEAuthService class
23
+ */
24
+ authService: DynamoBEAuthService;
25
+ /**
26
+ * You can setup your Own Email Service extending the DynamoBEEmailServiceCollection class
27
+ */
28
+ emailServiceCollection?: DynamoBEEmailServiceCollection;
29
+ /**
30
+ * you can setup data tables by passing a DynamoBEDataParams list at this point
31
+ */
32
+ dbModels: DynamoBEDataParams[];
33
+ }): void;
34
+ static getAuthService(): DynamoBEAuthService;
35
+ static getDBServiceCollection(): DynamoBEDBServiceCollection;
36
+ static getDBService<T extends Metadata>(dataParams: DynamoBEDataParams): DynamoBEDBService<T>;
37
+ static getDBServiceByKey<T extends Metadata>(key: string): DynamoBEDBService<T>;
38
+ static getEmailServiceCollection(): DynamoBEEmailServiceCollection;
39
+ }
40
+ //# sourceMappingURL=dynamobe-global.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamobe-global.service.d.ts","sourceRoot":"","sources":["../../src/_services/dynamobe-global.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,8BAA8B,EAAE,MAAM,6CAA6C,CAAC;AAC7F,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAExE;;;;GAIG;AACH,qBAAa,YAAa,SAAQ,wBAAwB;IAExD,MAAM,CAAC,WAAW,IAAI,YAAY;IAIlC,WAAW,EAAE,mBAAmB,CAAC;IACjC,mBAAmB,EAAE,2BAA2B,CAAC;IACjD,sBAAsB,EAAE,8BAA8B,CAAC;IAEvD;;OAEG;IACH,MAAM,CAAC,WAAW,CAChB,GAAG,EAAE;QACH;;WAEG;QACH,WAAW,EAAE,mBAAmB,CAAC;QAEjC;;WAEG;QACH,sBAAsB,CAAC,EAAE,8BAA8B,CAAC;QAExD;;WAEG;QACH,QAAQ,EAAE,kBAAkB,EAAE,CAAC;KAChC,GACA,IAAI;IAYP,MAAM,CAAC,cAAc,IAAI,mBAAmB;IAU5C,MAAM,CAAC,sBAAsB,IAAI,2BAA2B;IAU5D,MAAM,CAAC,YAAY,CAAC,CAAC,SAAS,QAAQ,EAAE,UAAU,EAAE,kBAAkB,GAAG,iBAAiB,CAAC,CAAC,CAAC;IAI7F,MAAM,CAAC,iBAAiB,CAAC,CAAC,SAAS,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAAC,CAAC,CAAC;IAe/E,MAAM,CAAC,yBAAyB,IAAI,8BAA8B;CASnE"}
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DBE_Global_S = void 0;
4
+ const dynamobe_db_service_collection_service_1 = require("./dynamobe-db-service-collection.service");
5
+ const dynamobe_db_service_1 = require("./dynamobe-db.service");
6
+ const dynamobe_singleton_service_1 = require("./dynamobe-singleton.service");
7
+ /**
8
+ * This is the main Global/Core Service Collection used by DynamoBE,
9
+ * you also can use this to access main services as
10
+ * dbServices, emailServices, or authService
11
+ */
12
+ class DBE_Global_S extends dynamobe_singleton_service_1.DynamoBESingletonService {
13
+ static getInstance() {
14
+ return DBE_Global_S.getSingletonInstance();
15
+ }
16
+ /**
17
+ * You need to setup global Services through this function
18
+ */
19
+ static setServices(set) {
20
+ this.getInstance();
21
+ this.instance.dbServiceCollection = new dynamobe_db_service_collection_service_1.DynamoBEDBServiceCollection();
22
+ set.dbModels.forEach((dbModel) => {
23
+ this.instance.dbServiceCollection[dbModel.dataName] = new dynamobe_db_service_1.DynamoBEDBService(dbModel);
24
+ });
25
+ this.instance.authService = set.authService;
26
+ this.instance.emailServiceCollection = set.emailServiceCollection;
27
+ }
28
+ static getAuthService() {
29
+ var _a, _b;
30
+ if (!((_b = (_a = this.instance) === null || _a === void 0 ? void 0 : _a.authService) === null || _b === void 0 ? void 0 : _b.authenticateToken)) {
31
+ throw new Error(`\nUnique Authentication Service missing!` +
32
+ `\nPlease create a Unique Authentication Service extending DynamoBEAuthService, ` +
33
+ `and Setup with "DBE_Global_SC.setServices(...)"`);
34
+ }
35
+ return this.instance.authService;
36
+ }
37
+ static getDBServiceCollection() {
38
+ var _a;
39
+ if (!((_a = this.instance) === null || _a === void 0 ? void 0 : _a.dbServiceCollection)) {
40
+ throw new Error(`\nUnique DataBase Service Collection missing!` +
41
+ `\nPlease create a Unique DataBase Service Collectio extending DynamoBEDBServiceCollection, ` +
42
+ `and Setup with "DBE_Global_SC.setServices(...)"`);
43
+ }
44
+ return this.instance.dbServiceCollection;
45
+ }
46
+ static getDBService(dataParams) {
47
+ return this.getDBServiceByKey(dataParams.dataName);
48
+ }
49
+ static getDBServiceByKey(key) {
50
+ const collection = this.getDBServiceCollection();
51
+ if (collection[key]) {
52
+ return collection[key];
53
+ }
54
+ else {
55
+ let keys = `${Object.keys(collection)}`;
56
+ keys = keys.replace(/,/g, '\n ');
57
+ throw new Error(`\nDBE_Global_S.getDBService failed ERROR:
58
+ no dbService on collection with this key: ${key}!
59
+ The available dbServices on collection:
60
+ ${keys}\n`);
61
+ }
62
+ }
63
+ static getEmailServiceCollection() {
64
+ var _a;
65
+ if (!((_a = this.instance) === null || _a === void 0 ? void 0 : _a.emailServiceCollection)) {
66
+ throw new Error(`Unique Email Service Collection missing!` +
67
+ `\nPlease create a Unique Email Service Collection extending DynamoBEEmailServiceCollection, ` +
68
+ `and Setup with "DBE_Global_SC.setServices(...)"`);
69
+ }
70
+ return this.instance.emailServiceCollection;
71
+ }
72
+ }
73
+ exports.DBE_Global_S = DBE_Global_S;
74
+ //# sourceMappingURL=dynamobe-global.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamobe-global.service.js","sourceRoot":"","sources":["../../src/_services/dynamobe-global.service.ts"],"names":[],"mappings":";;;AAKA,qGAAuF;AACvF,+DAA0D;AAE1D,6EAAwE;AAExE;;;;GAIG;AACH,MAAa,YAAa,SAAQ,qDAAwB;IAExD,MAAM,CAAC,WAAW;QAChB,OAAO,YAAY,CAAC,oBAAoB,EAAE,CAAC;IAC7C,CAAC;IAMD;;OAEG;IACH,MAAM,CAAC,WAAW,CAChB,GAeC;QAED,IAAI,CAAC,WAAW,EAAE,CAAC;QAEnB,IAAI,CAAC,QAAQ,CAAC,mBAAmB,GAAG,IAAI,oEAA2B,EAAE,CAAC;QACtE,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAA2B,EAAE,EAAE;YACnD,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,uCAAiB,CAAC,OAAO,CAAC,CAAC;QACvF,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,WAAW,GAAG,GAAG,CAAC,WAAW,CAAC;QAC5C,IAAI,CAAC,QAAQ,CAAC,sBAAsB,GAAG,GAAG,CAAC,sBAAsB,CAAC;IACpE,CAAC;IAED,MAAM,CAAC,cAAc;;QACnB,IAAI,cAAC,IAAI,CAAC,QAAQ,0CAAE,WAAW,0CAAE,iBAAiB,CAAA,EAAE;YAClD,MAAM,IAAI,KAAK,CACb,0CAA0C;gBAC1C,iFAAiF;gBAC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amobe-route-security.enum';
3
+ import { DynamoBEEndpointParams } from '../_models/dynamobe-endpoint-params';
4
+ import { DynamoBEController } from './dynamobe-controller.service';
5
+ export interface DynamoBERoutingModuleSettings {
6
+ route: string;
7
+ controllers: DynamoBEController[];
8
+ securityOverride?: DynamoBERouteSecurity;
9
+ }
10
+ export declare class DynamoBERoutingModule {
11
+ security: DynamoBERouteSecurity;
12
+ route: string;
13
+ private controllers;
14
+ endpoints: DynamoBEEndpointParams[];
15
+ openRouter: Router;
16
+ secureRouter: Router;
17
+ protected log: boolean;
18
+ constructor(set: DynamoBERoutingModuleSettings);
19
+ /**
20
+ * You must setup endpoints and required services in this function
21
+ */
22
+ private setupRoutes;
23
+ private mountRoutes;
24
+ private mountOpenRoute;
25
+ private mountSecureRoute;
26
+ }
27
+ //# sourceMappingURL=dynamobe-routing-module.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamobe-routing-module.service.d.ts","sourceRoot":"","sources":["../../src/_services/dynamobe-routing-module.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAIjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAE/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAGnE,MAAM,WAAW,6BAA6B;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,kBAAkB,EAAE,CAAC;IAClC,gBAAgB,CAAC,EAAE,qBAAqB,CAAC;CAC1C;AAED,qBAAa,qBAAqB;IAEhC,QAAQ,EAAE,qBAAqB,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IAEd,OAAO,CAAC,WAAW,CAAuB;IAC1C,SAAS,EAAE,sBAAsB,EAAE,CAAM;IAEzC,UAAU,EAAE,MAAM,CAAY;IAC9B,YAAY,EAAE,MAAM,CAAY;IAEhC,SAAS,CAAC,GAAG,EAAE,OAAO,CAAmC;gBAGvD,GAAG,EAAE,6BAA6B;IAcpC;;OAEG;IACH,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,WAAW;IAwCnB,OAAO,CAAC,cAAc;IA2BtB,OAAO,CAAC,gBAAgB;CA0BzB"}
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DynamoBERoutingModule = void 0;
4
+ const express_1 = require("express");
5
+ const fsm_dynamo_1 = require("@futdevpro/fsm-dynamo");
6
+ const dynamobe_global_settings_1 = require("../_constants/dynamobe-global.settings");
7
+ const dynamobe_route_security_enum_1 = require("../_enums/dynamobe-route-security.enum");
8
+ const http_call_type_enum_1 = require("../_enums/http/http-call-type.enum");
9
+ const dynamobe_shared_service_1 = require("./dynamobe-shared.service");
10
+ class DynamoBERoutingModule {
11
+ constructor(set) {
12
+ this.endpoints = [];
13
+ this.openRouter = express_1.Router();
14
+ this.secureRouter = express_1.Router();
15
+ this.log = dynamobe_global_settings_1.dynamoBEGlobalSettings.logSetup;
16
+ try {
17
+ this.route = dynamobe_global_settings_1.dynamoBEGlobalSettings.baseUrl + set.route;
18
+ this.controllers = set.controllers;
19
+ this.setupRoutes();
20
+ this.mountRoutes(set.securityOverride);
21
+ if (this.log)
22
+ console.log(`routing module setup done: ${this.route} serurity: ${this.security}\n`);
23
+ }
24
+ catch (error) {
25
+ dynamobe_shared_service_1.DBE_Shared.logError(`Routing module setup failed (${this.route})`, error);
26
+ }
27
+ }
28
+ /**
29
+ * You must setup endpoints and required services in this function
30
+ */
31
+ setupRoutes() {
32
+ this.controllers.forEach((controller) => {
33
+ this.endpoints.push(...controller.endpoints);
34
+ });
35
+ }
36
+ mountRoutes(securityOverride) {
37
+ if (securityOverride) {
38
+ this.security = securityOverride;
39
+ }
40
+ this.endpoints.forEach((endpoint) => {
41
+ if (securityOverride) {
42
+ endpoint.security = securityOverride;
43
+ }
44
+ else {
45
+ if (!this.security) {
46
+ this.security = endpoint.security;
47
+ }
48
+ else if (this.security !== endpoint.security) {
49
+ this.security = dynamobe_route_security_enum_1.DynamoBERouteSecurity.both;
50
+ }
51
+ }
52
+ if (this.log)
53
+ console.log(`endpoint mount (${endpoint.security}): ${this.route}${endpoint.endpoint}`);
54
+ const existingEndPoints = this.endpoints.filter((ep) => ep.endpoint === endpoint.endpoint);
55
+ if (1 < existingEndPoints.length) {
56
+ let error = new Error(`ENDPOINT DUPLICATION: ${endpoint.endpoint}`);
57
+ let errorStack = error.stack.split('\n');
58
+ errorStack.splice(1, 4);
59
+ error.stack = errorStack.join('\n');
60
+ throw error;
61
+ }
62
+ try {
63
+ if (endpoint.security !== dynamobe_route_security_enum_1.DynamoBERouteSecurity.secure) {
64
+ this.mountOpenRoute(endpoint);
65
+ }
66
+ if (endpoint.security !== dynamobe_route_security_enum_1.DynamoBERouteSecurity.open) {
67
+ this.mountSecureRoute(endpoint);
68
+ }
69
+ }
70
+ catch (error) {
71
+ throw new fsm_dynamo_1.DynamoBEError({ message: `DYNAMOBEERROR: Failed to mount routes.`, error });
72
+ }
73
+ });
74
+ }
75
+ mountOpenRoute(endpointParams) {
76
+ switch (endpointParams.type) {
77
+ case http_call_type_enum_1.HttpCallType.get:
78
+ this.openRouter.get(endpointParams.endpoint, endpointParams.preProcessess, endpointParams.getTasksExecution());
79
+ break;
80
+ case http_call_type_enum_1.HttpCallType.post:
81
+ this.openRouter.post(endpointParams.endpoint, endpointParams.preProcessess, endpointParams.getTasksExecution());
82
+ break;
83
+ case http_call_type_enum_1.HttpCallType.put:
84
+ this.openRouter.put(endpointParams.endpoint, endpointParams.preProcessess, endpointParams.getTasksExecution());
85
+ break;
86
+ case http_call_type_enum_1.HttpCallType.patch:
87
+ this.openRouter.patch(endpointParams.endpoint, endpointParams.preProcessess, endpointParams.getTasksExecution());
88
+ break;
89
+ case http_call_type_enum_1.HttpCallType.delete:
90
+ this.openRouter.delete(endpointParams.endpoint, endpointParams.preProcessess, endpointParams.getTasksExecution());
91
+ break;
92
+ default:
93
+ throw new fsm_dynamo_1.DynamoBEError({ message: `DYNAMOBEERROR: INVALID route type: ${endpointParams.type} - ${endpointParams.name}` });
94
+ }
95
+ }
96
+ mountSecureRoute(endpointParams) {
97
+ switch (endpointParams.type) {
98
+ case http_call_type_enum_1.HttpCallType.get:
99
+ this.secureRouter.get(endpointParams.endpoint, endpointParams.preProcessess, endpointParams.getTasksExecution());
100
+ break;
101
+ case http_call_type_enum_1.HttpCallType.post:
102
+ this.secureRouter.post(endpointParams.endpoint, endpointParams.preProcessess, endpointParams.getTasksExecution());
103
+ break;
104
+ case http_call_type_enum_1.HttpCallType.put:
105
+ this.secureRouter.put(endpointParams.endpoint, endpointParams.preProcessess, endpointParams.getTasksExecution());
106
+ break;
107
+ case http_call_type_enum_1.HttpCallType.patch:
108
+ this.secureRouter.patch(endpointParams.endpoint, endpointParams.preProcessess, endpointParams.getTasksExecution());
109
+ break;
110
+ case http_call_type_enum_1.HttpCallType.delete:
111
+ this.secureRouter.delete(endpointParams.endpoint, endpointParams.preProcessess, endpointParams.getTasksExecution());
112
+ break;
113
+ default:
114
+ throw new fsm_dynamo_1.DynamoBEError({ message: `DYNAMOBEERROR: INVALID route type: ${endpointParams.type} - ${endpointParams.name}` });
115
+ }
116
+ }
117
+ }
118
+ exports.DynamoBERoutingModule = DynamoBERoutingModule;
119
+ //# sourceMappingURL=dynamobe-routing-module.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamobe-routing-module.service.js","sourceRoot":"","sources":["../../src/_services/dynamobe-routing-module.service.ts"],"names":[],"mappings":";;;AACA,qCAAiC;AACjC,sDAAsD;AAEtD,qFAAgF;AAChF,yFAA+E;AAC/E,4EAAkE;AAGlE,uEAAuD;AAQvD,MAAa,qBAAqB;IAahC,YACE,GAAkC;QARpC,cAAS,GAA6B,EAAE,CAAC;QAEzC,eAAU,GAAW,gBAAM,EAAE,CAAC;QAC9B,iBAAY,GAAW,gBAAM,EAAE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AAE,CAAC,CAAC;gBACpE,MAAM;YACR,KAAK,kCAAY,CAAC,IAAI;gBACpB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,EAC5C,cAAc,CAAC,aAAa,EAAE,cAAc,CAAC,iBAAiB,EAAE,CAAC,CAAC;gBACpE,MAAM;YACR,KAAK,kCAAY,CAAC,GAAG;gBACnB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,cAAc,CAAC,QAAQ,EAC3C,cAAc,CAAC,aAAa,EAAE,cAAc,CAAC,iBAAiB,EAAE,CAAC,CAAC;gBACpE,MAAM;YACR,KAAK,kCAAY,CAAC,KAAK;gBACrB,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,EAC7C,cAAc,CAAC,aAAa,EAAE,cAAc,CAAC,iBAAiB,EAAE,CAAC,CAAC;gBACpE,MAAM;YACR,KAAK,kCAAY,CAAC,MAAM;gBACtB,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,cAAc,CAAC,QAAQ,EAC9C,cAAc,CAAC,aAAa,EAAE,cAAc,CAAC,iBAAiB,EAAE,CAAC,CAAC;gBACpE,MAAM;YACR;gBACE,MAAM,IAAI,0BAAa,CAAC,EAAE,OAAO,EAAE,sCAAsC,cAAc,CAAC,IAAI,MAAM,cAAc,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;SAC7H;IACH,CAAC;CACF;AAlID,sDAkIC"}
@@ -0,0 +1,9 @@
1
+ import { Request } from 'express';
2
+ import { GeoIpLocation } from '@futdevpro/fsm-dynamo';
3
+ import { DBE_Shared } from './dynamobe-shared.service';
4
+ export declare class DBE_Shared_BE extends DBE_Shared {
5
+ static getIpFromRequest(request: Request): string;
6
+ static getLocationDataByRequest(request: Request): GeoIpLocation;
7
+ static prompt(question: string): Promise<string>;
8
+ }
9
+ //# sourceMappingURL=dynamobe-shared-be.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamobe-shared-be.service.d.ts","sourceRoot":"","sources":["../../src/_services/dynamobe-shared-be.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvD,qBAAa,aAAc,SAAQ,UAAU;IAE3C,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM;IAYjD,MAAM,CAAC,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,aAAa;WAInD,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAiBvD"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DBE_Shared_BE = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const ReadLine = tslib_1.__importStar(require("readline"));
6
+ const GeoIp = tslib_1.__importStar(require("geoip-lite"));
7
+ const dynamobe_shared_service_1 = require("./dynamobe-shared.service");
8
+ class DBE_Shared_BE extends dynamobe_shared_service_1.DBE_Shared {
9
+ static getIpFromRequest(request) {
10
+ let ip;
11
+ if (request.headers['x-forwarded-for']) {
12
+ const route = request.headers['x-forwarded-for'].split(', ');
13
+ console.log('TESTTTT route:', route);
14
+ ip = route[route.length - 1];
15
+ }
16
+ else {
17
+ ip = request.socket.remoteAddress;
18
+ }
19
+ return ip;
20
+ }
21
+ static getLocationDataByRequest(request) {
22
+ return GeoIp.lookup(this.getIpFromRequest(request));
23
+ }
24
+ static prompt(question) {
25
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
26
+ const readLine = ReadLine.createInterface({
27
+ input: process.stdin,
28
+ output: process.stdout
29
+ });
30
+ return new Promise((resolve, reject) => {
31
+ try {
32
+ readLine.question(question, (result) => {
33
+ resolve(result);
34
+ readLine.close();
35
+ });
36
+ }
37
+ catch (error) {
38
+ reject(error);
39
+ }
40
+ });
41
+ });
42
+ }
43
+ }
44
+ exports.DBE_Shared_BE = DBE_Shared_BE;
45
+ //# sourceMappingURL=dynamobe-shared-be.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamobe-shared-be.service.js","sourceRoot":"","sources":["../../src/_services/dynamobe-shared-be.service.ts"],"names":[],"mappings":";;;;AACA,2DAAqC;AAErC,0DAAoC;AAGpC,uEAAuD;AAEvD,MAAa,aAAc,SAAQ,oCAAU;IAE3C,MAAM,CAAC,gBAAgB,CAAC,OAAgB;QACtC,IAAI,EAAU,CAAC;QACf,IAAI,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE;YACtC,MAAM,KAAK,GAAc,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACnF,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;YACrC,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;SAC9B;aAAM;YACL,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC;SACnC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,CAAC,wBAAwB,CAAC,OAAgB;QAC9C,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;IACtD,CAAC;IAED,MAAM,CAAO,MAAM,CAAC,QAAgB;;YAClC,MAAM,QAAQ,GAAG,QAAQ,CAAC,eAAe,CAAC;gBACxC,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,MAAM,EAAE,OAAO,CAAC,MAAM;aACvB,CAAC,CAAC;YAEH,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBACrC,IAAI;oBACF,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAc,EAAE,EAAE;wBAC7C,OAAO,CAAC,MAAM,CAAC,CAAC;wBAChB,QAAQ,CAAC,KAAK,EAAE,CAAC;oBACnB,CAAC,CAAC,CAAC;iBACJ;gBAAC,OAAO,KAAK,EAAE;oBACd,MAAM,CAAC,KAAK,CAAC,CAAC;iBACf;YACH,CAAC,CAAC,CAAC;QACL,CAAC;KAAA;CACF;AAnCD,sCAmCC"}
@@ -0,0 +1,86 @@
1
+ import { LocationCoordinates } from '@futdevpro/fsm-dynamo';
2
+ import { LogStyle } from '../_enums/log-style.enum';
3
+ export declare class DBE_Shared {
4
+ /**
5
+ * returns remapped object list by path list
6
+ * @param objList object list to map
7
+ * @param paths string list of path etc.:
8
+ * [ [ 'first', 'sub', 'label' ], [ 'first', 'dif', 'name' ]] will be...
9
+ * from
10
+ * {
11
+ * first: {
12
+ * sub: {
13
+ * label: 'vlmi'
14
+ * },
15
+ * dif: {
16
+ * name: 'asd'
17
+ * }
18
+ * }
19
+ * }[]
20
+ * to
21
+ * { label: 'vlmi', name: 'asd' }[]
22
+ * @returns remapped object list (the final obj will use the deepest keys)
23
+ */
24
+ static mapObjList(objList: object[], paths: string[][]): object[];
25
+ /**
26
+ * returns nested value from object
27
+ * @param parentObj data source object
28
+ * @param nestedDataKeys path of value as string list
29
+ * etc.: ['nestLvl1', 'nestLvl2', 'nestLvl3'] as parentObj.nestLvl1.nestLvl2.nestLvl3
30
+ * @returns data from object by path
31
+ */
32
+ static getNestedData(parentObj: object, nestedDataKeys: string[]): any;
33
+ /**
34
+ * recursive function that nests data
35
+ * @param newData the object that that is needed to be updated
36
+ * @param nestKeys the path where the data should be updated
37
+ * @param dataToSet the actual value that will be setted
38
+ * @returns modified data
39
+ */
40
+ static nestData(parentObj: object, nestKeys: string[], dataToSet: any): object;
41
+ /**
42
+ * recursive function that adds to nested data
43
+ * @param newData the object that that is needed to be updated
44
+ * @param nestKeys the path where the data should be updated
45
+ * @param dataToAdd the actual value that will be setted
46
+ * @returns modified data
47
+ */
48
+ static addToNestedData(parentObj: object, nestKeys: string[], dataToAdd: any): object;
49
+ /**
50
+ * recursive function that pushes to nested data
51
+ * @param newData the object that that is needed to be updated
52
+ * @param nestKeys the path where the data should be updated
53
+ * @param dataToPush the actual value that will be setted
54
+ * @returns modified data
55
+ */
56
+ static pushToNestedData(parentObj: object, nestKeys: string[], dataToPush: any): object;
57
+ /**
58
+ * recursive function that nests data on recursive data structure etc.: xData: { ..., 'nestedListKey': xData[] }
59
+ * @param newData the object that that is needed to be updated
60
+ * @param nestedListKey the location of nested dataList
61
+ * @param nestIndexes path to the subject ect.: xData.listKey[1].listKey[4].listKey[0] will be [1, 4, 0]
62
+ * @param dataToSet the actual value that will be setted on location
63
+ * @returns modified data
64
+ */
65
+ static nestRecursiveListedData<T>(parentObj: T, nestedListKey: string, nestIndexes: number[], dataToSet: any): T;
66
+ static getAge(birthDate: Date | number | string): number;
67
+ static getYear(date: Date | number | string): number;
68
+ static getHour(date: Date | number | string): number;
69
+ static getDateByAge(age: number): Date;
70
+ static getDistanceInKilometres(from: LocationCoordinates, to: LocationCoordinates): number;
71
+ static getLocationDegByKilometers(latiOrLong: 'latitude' | 'longitude', distanceInKm: number, latitude?: number): number;
72
+ static toRadians(deg: number): number;
73
+ static addMetadataToSchema(schema: any): any;
74
+ static oneHourAgo(): Date;
75
+ static oneDayAgo(): Date;
76
+ static oneWeekAgo(): Date;
77
+ static oneMonthAgo(): Date;
78
+ static oneYearAgo(): Date;
79
+ static setLogStyle(styles: LogStyle[]): void;
80
+ static resetLogStyle(): void;
81
+ static logStyle(input: string, styles: LogStyle[], dontReset?: boolean): string;
82
+ static logSuccess(message: string, ...optionalParams: any[]): void;
83
+ static logError(message: string, ...optionalParams: any[]): void;
84
+ static logWarning(message: string, ...optionalParams: any[]): void;
85
+ }
86
+ //# sourceMappingURL=dynamobe-shared.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamobe-shared.service.d.ts","sourceRoot":"","sources":["../../src/_services/dynamobe-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