@futdevpro/fsm-dynamo 1.0.21 → 1.0.22

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 (37) hide show
  1. package/lib/_collections/dynamo-shared.service.d.ts +86 -0
  2. package/lib/_collections/dynamo-shared.service.d.ts.map +1 -0
  3. package/lib/_collections/dynamo-shared.service.js +252 -0
  4. package/lib/_collections/dynamo-shared.service.js.map +1 -0
  5. package/lib/_collections/index.d.ts +2 -0
  6. package/lib/_collections/index.d.ts.map +1 -0
  7. package/lib/_collections/index.js +6 -0
  8. package/lib/_collections/index.js.map +1 -0
  9. package/lib/_enums/index.d.ts +2 -0
  10. package/lib/_enums/index.d.ts.map +1 -0
  11. package/lib/_enums/index.js +6 -0
  12. package/lib/_enums/index.js.map +1 -0
  13. package/lib/_enums/log-style.enum.d.ts +26 -0
  14. package/lib/_enums/log-style.enum.d.ts.map +1 -0
  15. package/lib/_enums/log-style.enum.js +30 -0
  16. package/lib/_enums/log-style.enum.js.map +1 -0
  17. package/lib/_modules/data-modules.index.d.ts +5 -0
  18. package/lib/_modules/data-modules.index.d.ts.map +1 -0
  19. package/lib/_modules/data-modules.index.js +9 -0
  20. package/lib/_modules/data-modules.index.js.map +1 -0
  21. package/lib/_modules/shared-service.index.d.ts +7 -0
  22. package/lib/_modules/shared-service.index.d.ts.map +1 -0
  23. package/lib/_modules/shared-service.index.js +11 -0
  24. package/lib/_modules/shared-service.index.js.map +1 -0
  25. package/lib/index.d.ts +2 -0
  26. package/lib/index.d.ts.map +1 -1
  27. package/lib/index.js +4 -0
  28. package/lib/index.js.map +1 -1
  29. package/lib/tsconfig.tsbuildinfo +121 -17
  30. package/package.json +10 -1
  31. package/src/_collections/dynamo-shared.service.ts +267 -0
  32. package/src/_collections/index.ts +6 -0
  33. package/src/_enums/index.ts +5 -0
  34. package/src/_enums/log-style.enum.ts +30 -0
  35. package/src/_modules/shared-service.index.ts +8 -0
  36. package/src/index.ts +5 -0
  37. /package/src/_modules/{data-module.index.ts → data-modules.index.ts} +0 -0
@@ -0,0 +1,86 @@
1
+ import { LogStyle } from '../_enums/log-style.enum';
2
+ import { LocationCoordinates } from '../_models/control-models/location-coordinates';
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=dynamo-shared.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamo-shared.service.d.ts","sourceRoot":"","sources":["../../src/_collections/dynamo-shared.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AAErF,qBAAa,UAAU;IAErB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,MAAM,CAAC,U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AAQ,CAAC,EAAE,MAAM,GAAG,MAAM;IAYxH,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAIrC,MAAM,CAAC,mBAAmB,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG;IAQ5C,MAAM,CAAC,UAAU,IAAI,IAAI;IAGzB,MAAM,CAAC,SAAS,IAAI,IAAI;IAGxB,MAAM,CAAC,UAAU,IAAI,IAAI;IAGzB,MAAM,CAAC,WAAW,IAAI,IAAI;IAG1B,MAAM,CAAC,UAAU,IAAI,IAAI;IAIzB,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI;IAO5C,MAAM,CAAC,aAAa,IAAI,IAAI;IAI5B,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM;IAY/E,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,GAAG,IAAI;IAQlE,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,GAAG,IAAI;IAQhE,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,GAAG,IAAI;CAOnE"}
@@ -0,0 +1,252 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DBE_Shared = void 0;
4
+ const times_1 = require("../_constants/times");
5
+ const log_style_enum_1 = require("../_enums/log-style.enum");
6
+ const dynamobe_error_1 = require("../_models/control-models/dynamobe-error");
7
+ class DBE_Shared {
8
+ /**
9
+ * returns remapped object list by path list
10
+ * @param objList object list to map
11
+ * @param paths string list of path etc.:
12
+ * [ [ 'first', 'sub', 'label' ], [ 'first', 'dif', 'name' ]] will be...
13
+ * from
14
+ * {
15
+ * first: {
16
+ * sub: {
17
+ * label: 'vlmi'
18
+ * },
19
+ * dif: {
20
+ * name: 'asd'
21
+ * }
22
+ * }
23
+ * }[]
24
+ * to
25
+ * { label: 'vlmi', name: 'asd' }[]
26
+ * @returns remapped object list (the final obj will use the deepest keys)
27
+ */
28
+ static mapObjList(objList, paths) {
29
+ let newObjList = [...objList];
30
+ newObjList = newObjList.map(obj => {
31
+ const newObj = {};
32
+ paths.forEach((path) => {
33
+ newObj[path[path.length - 1]] = this.getNestedData(obj, path);
34
+ });
35
+ return newObj;
36
+ });
37
+ return newObjList;
38
+ }
39
+ /**
40
+ * returns nested value from object
41
+ * @param parentObj data source object
42
+ * @param nestedDataKeys path of value as string list
43
+ * etc.: ['nestLvl1', 'nestLvl2', 'nestLvl3'] as parentObj.nestLvl1.nestLvl2.nestLvl3
44
+ * @returns data from object by path
45
+ */
46
+ static getNestedData(parentObj, nestedDataKeys) {
47
+ let newData = Object.assign({}, parentObj);
48
+ nestedDataKeys.forEach((dk) => {
49
+ if (newData) {
50
+ newData = newData[dk];
51
+ }
52
+ });
53
+ return newData;
54
+ }
55
+ /**
56
+ * recursive function that nests data
57
+ * @param newData the object that that is needed to be updated
58
+ * @param nestKeys the path where the data should be updated
59
+ * @param dataToSet the actual value that will be setted
60
+ * @returns modified data
61
+ */
62
+ static nestData(parentObj, nestKeys, dataToSet) {
63
+ const newData = Object.assign({}, parentObj);
64
+ if (nestKeys.length > 1) {
65
+ const keys = [...nestKeys];
66
+ const nextNestKey = keys.shift();
67
+ newData[nextNestKey] = this.nestData(newData[nextNestKey], keys, dataToSet);
68
+ }
69
+ else {
70
+ newData[nestKeys[0]] = dataToSet;
71
+ }
72
+ return newData;
73
+ }
74
+ /**
75
+ * recursive function that adds to nested data
76
+ * @param newData the object that that is needed to be updated
77
+ * @param nestKeys the path where the data should be updated
78
+ * @param dataToAdd the actual value that will be setted
79
+ * @returns modified data
80
+ */
81
+ static addToNestedData(parentObj, nestKeys, dataToAdd) {
82
+ const newData = Object.assign({}, parentObj);
83
+ if (nestKeys.length > 1) {
84
+ const keys = [...nestKeys];
85
+ const nextNestKey = keys.shift();
86
+ newData[nextNestKey] = this.addToNestedData(newData[nextNestKey], keys, dataToAdd);
87
+ }
88
+ else {
89
+ newData[nestKeys[0]] += dataToAdd;
90
+ }
91
+ return newData;
92
+ }
93
+ /**
94
+ * recursive function that pushes to nested data
95
+ * @param newData the object that that is needed to be updated
96
+ * @param nestKeys the path where the data should be updated
97
+ * @param dataToPush the actual value that will be setted
98
+ * @returns modified data
99
+ */
100
+ static pushToNestedData(parentObj, nestKeys, dataToPush) {
101
+ const newData = Object.assign({}, parentObj);
102
+ if (nestKeys.length > 1) {
103
+ const keys = [...nestKeys];
104
+ const nextNestKey = keys.shift();
105
+ newData[nextNestKey] = this.pushToNestedData(newData[nextNestKey], keys, dataToPush);
106
+ }
107
+ else {
108
+ if (Array.isArray(newData[nestKeys[0]])) {
109
+ newData[nestKeys[0]].push(dataToPush);
110
+ }
111
+ else {
112
+ newData[nestKeys[0]] = [dataToPush];
113
+ }
114
+ }
115
+ return newData;
116
+ }
117
+ /**
118
+ * recursive function that nests data on recursive data structure etc.: xData: { ..., 'nestedListKey': xData[] }
119
+ * @param newData the object that that is needed to be updated
120
+ * @param nestedListKey the location of nested dataList
121
+ * @param nestIndexes path to the subject ect.: xData.listKey[1].listKey[4].listKey[0] will be [1, 4, 0]
122
+ * @param dataToSet the actual value that will be setted on location
123
+ * @returns modified data
124
+ */
125
+ static nestRecursiveListedData(parentObj, nestedListKey, nestIndexes, dataToSet) {
126
+ const newData = Object.assign({}, parentObj);
127
+ if (nestIndexes.length > 1) {
128
+ const indexes = [...nestIndexes];
129
+ const nextLevelKey = indexes.shift();
130
+ newData[nestedListKey][nextLevelKey] = this.nestRecursiveListedData(newData[nestedListKey][nextLevelKey], nestedListKey, indexes, dataToSet);
131
+ }
132
+ else {
133
+ newData[nestedListKey][nestIndexes[0]] = dataToSet;
134
+ }
135
+ return newData;
136
+ }
137
+ static getAge(birthDate) {
138
+ return this.getYear(+new Date() - +new Date(birthDate));
139
+ }
140
+ static getYear(date) {
141
+ if (typeof date === 'string') {
142
+ date = new Date(date);
143
+ }
144
+ return (+date / times_1.year);
145
+ }
146
+ static getHour(date) {
147
+ if (typeof date === 'string') {
148
+ date = new Date(date);
149
+ }
150
+ return (+date / times_1.hour);
151
+ }
152
+ static getDateByAge(age) {
153
+ return new Date(+new Date() - (times_1.year * age));
154
+ }
155
+ static getDistanceInKilometres(from, to) {
156
+ const R = 6371; // kilometres
157
+ const φ1 = this.toRadians(from.latitude);
158
+ const φ2 = this.toRadians(to.latitude);
159
+ const Δφ = this.toRadians(to.latitude - from.latitude);
160
+ const Δλ = this.toRadians(to.longitude - from.longitude);
161
+ const a = Math.sin(Δφ / 2) * Math.sin(Δφ / 2) +
162
+ Math.cos(φ1) * Math.cos(φ2) *
163
+ Math.sin(Δλ / 2) * Math.sin(Δλ / 2);
164
+ const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
165
+ return R * c;
166
+ }
167
+ static getLocationDegByKilometers(latiOrLong, distanceInKm, latitude) {
168
+ if (latiOrLong === 'latitude') {
169
+ return distanceInKm / 110.574;
170
+ }
171
+ else {
172
+ if (latitude) {
173
+ return distanceInKm / (Math.cos(this.toRadians(latitude)) * 111.320);
174
+ }
175
+ else {
176
+ throw new dynamobe_error_1.DynamoBEError({ status: 417, message: 'When using getLocationDegByKilometers for longitude, you need to give latitude!' });
177
+ }
178
+ }
179
+ }
180
+ static toRadians(deg) {
181
+ return deg * (Math.PI / 180);
182
+ }
183
+ static addMetadataToSchema(schema) {
184
+ schema.__created = { type: Date };
185
+ schema.__createdBy = { type: String };
186
+ schema.__lastModified = { type: Date };
187
+ schema.__lastModifiedBy = { type: String };
188
+ return schema;
189
+ }
190
+ static oneHourAgo() {
191
+ return new Date(+new Date() - times_1.hour);
192
+ }
193
+ static oneDayAgo() {
194
+ return new Date(+new Date() - times_1.day);
195
+ }
196
+ static oneWeekAgo() {
197
+ return new Date(+new Date() - times_1.week);
198
+ }
199
+ static oneMonthAgo() {
200
+ return new Date(+new Date() - times_1.month);
201
+ }
202
+ static oneYearAgo() {
203
+ return new Date(+new Date() - times_1.year);
204
+ }
205
+ static setLogStyle(styles) {
206
+ let styleSets = '';
207
+ styles.forEach((style) => {
208
+ styleSets += style;
209
+ });
210
+ console.log(styleSets);
211
+ }
212
+ static resetLogStyle() {
213
+ console.log(log_style_enum_1.LogStyle.reset);
214
+ }
215
+ static logStyle(input, styles, dontReset) {
216
+ let result = '';
217
+ styles.forEach((style) => {
218
+ result += style;
219
+ });
220
+ result += input;
221
+ if (!dontReset) {
222
+ result += log_style_enum_1.LogStyle.reset;
223
+ }
224
+ return result;
225
+ }
226
+ static logSuccess(message, ...optionalParams) {
227
+ if (0 < optionalParams.length) {
228
+ console.error(`${log_style_enum_1.LogStyle.green}${log_style_enum_1.LogStyle.bright}${message}`, ...optionalParams, log_style_enum_1.LogStyle.reset);
229
+ }
230
+ else {
231
+ console.error(`${log_style_enum_1.LogStyle.green}${log_style_enum_1.LogStyle.bright}${message}${log_style_enum_1.LogStyle.reset}`);
232
+ }
233
+ }
234
+ static logError(message, ...optionalParams) {
235
+ if (0 < optionalParams.length) {
236
+ console.error(`${log_style_enum_1.LogStyle.red}${log_style_enum_1.LogStyle.bright}${message}`, ...optionalParams, log_style_enum_1.LogStyle.reset);
237
+ }
238
+ else {
239
+ console.error(`${log_style_enum_1.LogStyle.red}${log_style_enum_1.LogStyle.bright}${message}${log_style_enum_1.LogStyle.reset}`);
240
+ }
241
+ }
242
+ static logWarning(message, ...optionalParams) {
243
+ if (0 < optionalParams.length) {
244
+ console.warn(`${log_style_enum_1.LogStyle.yellow}${log_style_enum_1.LogStyle.bright}${message}`, ...optionalParams, log_style_enum_1.LogStyle.reset);
245
+ }
246
+ else {
247
+ console.warn(`${log_style_enum_1.LogStyle.yellow}${log_style_enum_1.LogStyle.bright}${message}${log_style_enum_1.LogStyle.reset}`);
248
+ }
249
+ }
250
+ }
251
+ exports.DBE_Shared = DBE_Shared;
252
+ //# sourceMappingURL=dynamo-shared.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamo-shared.service.js","sourceRoot":"","sources":["../../src/_collections/dynamo-shared.service.ts"],"names":[],"mappings":";;;AACA,+CAAmE;AACnE,6DAAoD;AACpD,6EAAyE;AAGzE,MAAa,UAAU;IAErB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,MAAM,CAAC,UAAU,CAAC,OAAiB,EAAE,KAAiB;QACpD,IAAI,UAAU,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC;QAC9B,UAAU,GAAG,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;YAChC,MAAM,MAAM,GAAG,EAAE,CAAC;YAClB,KAAK,CAAC,OAAO,CAAC,CAAC,IAAc,EAAE,EAAE;gBAC/B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YAChE,CAAC,CAAC,CAAC;YACH,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,CAAC;QACH,OAAO,UAAU,CAAC;IACpB,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,aAAa,CAAC,SAAiB,EAAE,cAAwB;QAC9D,IAAI,OAAO,qBAAO,SAAS,CAAC,CAAC;QAC7B,cAAc,CAAC,OAAO,CAAC,CAAC,EAAU,EAAE,EAAE;YACpC,IAAI,OAAO,EAAE;gBACX,OAAO,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC;aACvB;QACH,CAAC,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,SAAiB,EAAE,QAAkB,EAAE,SAAc;QACnE,MAAM,OAAO,qBAAO,SAAS,CAAC,CAAC;QAC/B,IAAI,QAAQ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E,CAAC,CAAC;SACjF;IACH,CAAC;CACF;AApQD,gCAoQC"}
@@ -0,0 +1,2 @@
1
+ export * from './dynamo-shared.service';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/_collections/index.ts"],"names":[],"mappings":"AAEA,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ // COLLECTIONS
5
+ tslib_1.__exportStar(require("./dynamo-shared.service"), exports);
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/_collections/index.ts"],"names":[],"mappings":";;;AACA,cAAc;AACd,kEAAwC"}
@@ -0,0 +1,2 @@
1
+ export * from './log-style.enum';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/_enums/index.ts"],"names":[],"mappings":"AAEA,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ // ENUMS
5
+ tslib_1.__exportStar(require("./log-style.enum"), exports);
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/_enums/index.ts"],"names":[],"mappings":";;;AACA,QAAQ;AACR,2DAAiC"}
@@ -0,0 +1,26 @@
1
+ export declare enum LogStyle {
2
+ reset = "\u001B[0m",
3
+ bright = "\u001B[1m",
4
+ dim = "\u001B[2m",
5
+ underline = "\u001B[4m",
6
+ blink = "\u001B[5m",
7
+ reverse = "\u001B[7m",
8
+ hidden = "\u001B[8m",
9
+ black = "\u001B[30m",
10
+ red = "\u001B[31m",
11
+ green = "\u001B[32m",
12
+ yellow = "\u001B[33m",
13
+ blue = "\u001B[34m",
14
+ magenta = "\u001B[35m",
15
+ cyan = "\u001B[36m",
16
+ white = "\u001B[37m",
17
+ BgBlack = "\u001B[40m",
18
+ BgRed = "\u001B[41m",
19
+ BgGreen = "\u001B[42m",
20
+ BgYellow = "\u001B[43m",
21
+ BgBlue = "\u001B[44m",
22
+ BgMagenta = "\u001B[45m",
23
+ BgCyan = "\u001B[46m",
24
+ BgWhite = "\u001B[47m"
25
+ }
26
+ //# sourceMappingURL=log-style.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-style.enum.d.ts","sourceRoot":"","sources":["../../src/_enums/log-style.enum.ts"],"names":[],"mappings":"AAEA,oBAAY,QAAQ;IAClB,KAAK,cAAY;IAEjB,MAAM,cAAY;IAClB,GAAG,cAAY;IACf,SAAS,cAAY;IACrB,KAAK,cAAY;IACjB,OAAO,cAAY;IACnB,MAAM,cAAY;IAElB,KAAK,eAAa;IAClB,GAAG,eAAa;IAChB,KAAK,eAAa;IAClB,MAAM,eAAa;IACnB,IAAI,eAAa;IACjB,OAAO,eAAa;IACpB,IAAI,eAAa;IACjB,KAAK,eAAa;IAElB,OAAO,eAAa;IACpB,KAAK,eAAa;IAClB,OAAO,eAAa;IACpB,QAAQ,eAAa;IACrB,MAAM,eAAa;IACnB,SAAS,eAAa;IACtB,MAAM,eAAa;IACnB,OAAO,eAAa;CACrB"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LogStyle = void 0;
4
+ var LogStyle;
5
+ (function (LogStyle) {
6
+ LogStyle["reset"] = "\u001B[0m";
7
+ LogStyle["bright"] = "\u001B[1m";
8
+ LogStyle["dim"] = "\u001B[2m";
9
+ LogStyle["underline"] = "\u001B[4m";
10
+ LogStyle["blink"] = "\u001B[5m";
11
+ LogStyle["reverse"] = "\u001B[7m";
12
+ LogStyle["hidden"] = "\u001B[8m";
13
+ LogStyle["black"] = "\u001B[30m";
14
+ LogStyle["red"] = "\u001B[31m";
15
+ LogStyle["green"] = "\u001B[32m";
16
+ LogStyle["yellow"] = "\u001B[33m";
17
+ LogStyle["blue"] = "\u001B[34m";
18
+ LogStyle["magenta"] = "\u001B[35m";
19
+ LogStyle["cyan"] = "\u001B[36m";
20
+ LogStyle["white"] = "\u001B[37m";
21
+ LogStyle["BgBlack"] = "\u001B[40m";
22
+ LogStyle["BgRed"] = "\u001B[41m";
23
+ LogStyle["BgGreen"] = "\u001B[42m";
24
+ LogStyle["BgYellow"] = "\u001B[43m";
25
+ LogStyle["BgBlue"] = "\u001B[44m";
26
+ LogStyle["BgMagenta"] = "\u001B[45m";
27
+ LogStyle["BgCyan"] = "\u001B[46m";
28
+ LogStyle["BgWhite"] = "\u001B[47m";
29
+ })(LogStyle = exports.LogStyle || (exports.LogStyle = {}));
30
+ //# sourceMappingURL=log-style.enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-style.enum.js","sourceRoot":"","sources":["../../src/_enums/log-style.enum.ts"],"names":[],"mappings":";;;AAEA,IAAY,QA2BX;AA3BD,WAAY,QAAQ;IAClB,+BAAiB,CAAA;IAEjB,gCAAkB,CAAA;IAClB,6BAAe,CAAA;IACf,mCAAqB,CAAA;IACrB,+BAAiB,CAAA;IACjB,iCAAmB,CAAA;IACnB,gCAAkB,CAAA;IAElB,gCAAkB,CAAA;IAClB,8BAAgB,CAAA;IAChB,gCAAkB,CAAA;IAClB,iCAAmB,CAAA;IACnB,+BAAiB,CAAA;IACjB,kCAAoB,CAAA;IACpB,+BAAiB,CAAA;IACjB,gCAAkB,CAAA;IAElB,kCAAoB,CAAA;IACpB,gCAAkB,CAAA;IAClB,kCAAoB,CAAA;IACpB,mCAAqB,CAAA;IACrB,iCAAmB,CAAA;IACnB,oCAAsB,CAAA;IACtB,iCAAmB,CAAA;IACnB,kCAAoB,CAAA;AACtB,CAAC,EA3BW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QA2BnB"}
@@ -0,0 +1,5 @@
1
+ export * from '../_models/data-models/metadata';
2
+ export * from '../_models/control-models/dynamobe-data-params';
3
+ export * from '../_models/control-models/dynamobe-data-property-params';
4
+ export * from '../_models/control-models/dynamobe-error';
5
+ //# sourceMappingURL=data-modules.index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-modules.index.d.ts","sourceRoot":"","sources":["../../src/_modules/data-modules.index.ts"],"names":[],"mappings":"AAEA,cAAc,iCAAiC,CAAC;AAChD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,yDAAyD,CAAC;AACxE,cAAc,0CAA0C,CAAC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ // DATA MODULE
5
+ tslib_1.__exportStar(require("../_models/data-models/metadata"), exports);
6
+ tslib_1.__exportStar(require("../_models/control-models/dynamobe-data-params"), exports);
7
+ tslib_1.__exportStar(require("../_models/control-models/dynamobe-data-property-params"), exports);
8
+ tslib_1.__exportStar(require("../_models/control-models/dynamobe-error"), exports);
9
+ //# sourceMappingURL=data-modules.index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-modules.index.js","sourceRoot":"","sources":["../../src/_modules/data-modules.index.ts"],"names":[],"mappings":";;;AACA,cAAc;AACd,0EAAgD;AAChD,yFAA+D;AAC/D,kGAAwE;AACxE,mFAAyD"}
@@ -0,0 +1,7 @@
1
+ export * from '../_collections/dynamo-shared.service';
2
+ export * from '../_constants/times';
3
+ export * from '../_enums/log-style.enum';
4
+ export * from '../_models/control-models/dynamobe-error';
5
+ export * from '../_models/control-models/location-coordinates';
6
+ export * from '../_models/control-models/geo-ip-location';
7
+ //# sourceMappingURL=shared-service.index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-service.index.d.ts","sourceRoot":"","sources":["../../src/_modules/shared-service.index.ts"],"names":[],"mappings":"AAEA,cAAc,uCAAuC,CAAC;AACtD,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0CAA0C,CAAC;AACzD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,2CAA2C,CAAC"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ // SHARED SERVICE MODULE
5
+ tslib_1.__exportStar(require("../_collections/dynamo-shared.service"), exports);
6
+ tslib_1.__exportStar(require("../_constants/times"), exports);
7
+ tslib_1.__exportStar(require("../_enums/log-style.enum"), exports);
8
+ tslib_1.__exportStar(require("../_models/control-models/dynamobe-error"), exports);
9
+ tslib_1.__exportStar(require("../_models/control-models/location-coordinates"), exports);
10
+ tslib_1.__exportStar(require("../_models/control-models/geo-ip-location"), exports);
11
+ //# sourceMappingURL=shared-service.index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-service.index.js","sourceRoot":"","sources":["../../src/_modules/shared-service.index.ts"],"names":[],"mappings":";;;AACA,wBAAwB;AACxB,gFAAsD;AACtD,8DAAoC;AACpC,mEAAyC;AACzC,mFAAyD;AACzD,yFAA+D;AAC/D,oFAA0D"}
package/lib/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export * from './_collections';
1
2
  export * from './_constants';
3
+ export * from './_enums';
2
4
  export * from './_models';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,cAAc,cAAc,CAAC;AAG7B,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,gBAAgB,CAAC;AAG/B,cAAc,cAAc,CAAC;AAG7B,cAAc,UAAU,CAAC;AAGzB,cAAc,WAAW,CAAC"}
package/lib/index.js CHANGED
@@ -1,8 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
+ // COLLECTIONS
5
+ tslib_1.__exportStar(require("./_collections"), exports);
4
6
  // CONSTANTS
5
7
  tslib_1.__exportStar(require("./_constants"), exports);
8
+ // ENUMS
9
+ tslib_1.__exportStar(require("./_enums"), exports);
6
10
  // MODELS
7
11
  tslib_1.__exportStar(require("./_models"), exports);
8
12
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAEA,YAAY;AACZ,uDAA6B;AAE7B,SAAS;AACT,oDAA0B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,cAAc;AACd,yDAA+B;AAE/B,YAAY;AACZ,uDAA6B;AAE7B,QAAQ;AACR,mDAAyB;AAEzB,SAAS;AACT,oDAA0B"}
@@ -196,6 +196,31 @@
196
196
  "signature": "23550ca7aef25dfa8dc22d24e60c391af2c6a5ae53ae76524f42ec3cb69e7f04",
197
197
  "affectsGlobalScope": false
198
198
  },
199
+ "../src/_enums/log-style.enum.ts": {
200
+ "version": "27f6c4b16a83f0eb1cb5cfd59e0e525bc046a1c03b5e87655631fb4ab589a197",
201
+ "signature": "c26555c149dcd8b1647cce3f4bc4fbf2e14a0cdc63151dbb2cba5355c7409979",
202
+ "affectsGlobalScope": false
203
+ },
204
+ "../src/_models/control-models/dynamobe-error.ts": {
205
+ "version": "c00e2a11553aa7589bfba4b3ba33b9b812c542e726903f79fb8c356822c39da6",
206
+ "signature": "f28694141d3063a88c9fc291fc7f939c413ce8bcdb08f4414fd19383e885c2c8",
207
+ "affectsGlobalScope": false
208
+ },
209
+ "../src/_models/control-models/location-coordinates.ts": {
210
+ "version": "c67beb74dd95cd9d0b08e98e0fb3d7b0f94d04834069a0f9d585e8c1dc14d8e7",
211
+ "signature": "ce6d673d643e705c8fa8695de2d9ca91985a8826db38718b48ac4b27806fd10c",
212
+ "affectsGlobalScope": false
213
+ },
214
+ "../src/_collections/dynamo-shared.service.ts": {
215
+ "version": "c4b201037dcf38014806ab48399aebda834c13bd58cf2eccbeb77dcc6a9f1a52",
216
+ "signature": "9527f52277af4c6c5d4f2f45ac1e3a68a0e90662fc509f34d34be09c0c953775",
217
+ "affectsGlobalScope": false
218
+ },
219
+ "../src/_collections/index.ts": {
220
+ "version": "8150db0201736b4cc6d31c6269f118a6aa30810df6edabe87e10297ec8777513",
221
+ "signature": "fd5fe2d2432ba696d2ebea3dedcc23db4a4b6ccb1e7424a3a0ef83fabf3e1f0c",
222
+ "affectsGlobalScope": false
223
+ },
199
224
  "../src/_models/control-models/dynamo-module-settings.ts": {
200
225
  "version": "087910fea21e5dd14f24b3703a7f1f02d5990cb3251be69981339cbb19ea535e",
201
226
  "signature": "42ad9b0c32049a150a16417db052c7a31b3ec0d5a8f4007ff13f9200a11996ae",
@@ -216,6 +241,11 @@
216
241
  "signature": "d6e99be47f32f113288c380db1a9121e2108af49a9ccb2f88f8544ede80fa647",
217
242
  "affectsGlobalScope": false
218
243
  },
244
+ "../src/_enums/index.ts": {
245
+ "version": "6bfdd0f4ccd692c2045548aa236ccbf149a70a5ffe34c2a14fdfe38d39d2cca7",
246
+ "signature": "2e73127fd07e6148f0cca18c8b33a164a043f325179cf7662e633841ee681397",
247
+ "affectsGlobalScope": false
248
+ },
219
249
  "../src/_models/control-models/geo-ip-location.ts": {
220
250
  "version": "b8d36b7c50887f1a2bcd802c388d89983be5eb85f88e67e69d7febe849e63ee9",
221
251
  "signature": "634f58c42bbb700eeb2c5741eb0ab67b21452cf98bfdfa733d61d087c1c75db4",
@@ -236,11 +266,6 @@
236
266
  "signature": "aeff79d75f92b9be69e35cc640830b27ed8323789b13839e7f80bb503ac45f32",
237
267
  "affectsGlobalScope": false
238
268
  },
239
- "../src/_models/control-models/dynamobe-error.ts": {
240
- "version": "c00e2a11553aa7589bfba4b3ba33b9b812c542e726903f79fb8c356822c39da6",
241
- "signature": "f28694141d3063a88c9fc291fc7f939c413ce8bcdb08f4414fd19383e885c2c8",
242
- "affectsGlobalScope": false
243
- },
244
269
  "../src/_models/control-models/dynamobe-data-property-params.ts": {
245
270
  "version": "3f6fd09b7022558e926cbd4eb8e2e1b47f10ba8e4276c880e55f8b61504e7644",
246
271
  "signature": "df9c1f50654e34f0e4255c8f880dfde3af6531db086c70755382840a0011b8d4",
@@ -261,11 +286,6 @@
261
286
  "signature": "8381932a1179a1144130d5b8ddfd7c4e430c53397b451baad85a5edf58109855",
262
287
  "affectsGlobalScope": false
263
288
  },
264
- "../src/_models/control-models/location-coordinates.ts": {
265
- "version": "c67beb74dd95cd9d0b08e98e0fb3d7b0f94d04834069a0f9d585e8c1dc14d8e7",
266
- "signature": "ce6d673d643e705c8fa8695de2d9ca91985a8826db38718b48ac4b27806fd10c",
267
- "affectsGlobalScope": false
268
- },
269
289
  "../src/_models/data-models/custom-data.ts": {
270
290
  "version": "a9c7842a3b4b85d98aec9690e2fe6eb76e7614513fef85cbf0a83908628fd917",
271
291
  "signature": "71f8fa5a038bec8bc0890a45542391059a73b0020522d443081e3f188bc88880",
@@ -277,13 +297,13 @@
277
297
  "affectsGlobalScope": false
278
298
  },
279
299
  "../src/index.ts": {
280
- "version": "89ccac244ae3d41c873fc70b95d5fb818496700a2535819e53d40494fede47d8",
281
- "signature": "3ae1408f360ab063390f92b26437346282cac16061f9ff1e66b488b93de546d9",
300
+ "version": "ba8b7bbed12ecc2d8dc0e55cbdc2227c84ee47b88839f427b963c2319da74df9",
301
+ "signature": "6f1ffe5cb4ccf3b72dcece8806aab32bd9a0c3280c131cc61a663b8b851d4c1a",
282
302
  "affectsGlobalScope": false
283
303
  },
284
- "../src/_modules/data-module.index.ts": {
304
+ "../src/_modules/data-modules.index.ts": {
285
305
  "version": "3a958c8076529d0930be71a3b95fb83a9e2f1ab0c93d9a6b6bd42af630f72f47",
286
- "signature": "6b0e3e468c9c22296e431dc7274c6e555ac477cb150347eeb50916d146de6a10",
306
+ "signature": "99e0cc3361623605bbe8e5cf47516f082aa8c0b1c795da68064313cdcf6a6cb1",
287
307
  "affectsGlobalScope": false
288
308
  },
289
309
  "../src/_modules/error-module.index.ts": {
@@ -291,6 +311,11 @@
291
311
  "signature": "876fb39cb6baca43743217e0e7f3ee8327de8b659b4b28cab982afaa40b25768",
292
312
  "affectsGlobalScope": false
293
313
  },
314
+ "../src/_modules/shared-service.index.ts": {
315
+ "version": "e92eb068c6e1944013a903ec8d3aab3777a65ae7581b330da34063334884f500",
316
+ "signature": "784c93b9ebee5cd60b29f3e91c18d22d60834485db930422c8a2e8751be35b4b",
317
+ "affectsGlobalScope": false
318
+ },
294
319
  "../src/_modules/test-module.index.ts": {
295
320
  "version": "820d3bdd6437ed43472c1cada045e36c38c51c535997546cd632b4a32100d4ab",
296
321
  "signature": "4486b159d16dd624e5b9ce99afacb66b5c6defa2a8783c8e459438cea66ebc46",
@@ -1400,6 +1425,27 @@
1400
1425
  "../node_modules/@types/node/ts3.2/util.d.ts",
1401
1426
  "../node_modules/@types/node/util.d.ts"
1402
1427
  ],
1428
+ "../src/_collections/dynamo-shared.service.ts": [
1429
+ "../node_modules/@types/node/fs.d.ts",
1430
+ "../node_modules/@types/node/process.d.ts",
1431
+ "../node_modules/@types/node/ts3.2/fs.d.ts",
1432
+ "../node_modules/@types/node/ts3.2/process.d.ts",
1433
+ "../node_modules/@types/node/ts3.2/util.d.ts",
1434
+ "../node_modules/@types/node/util.d.ts",
1435
+ "../src/_constants/times.ts",
1436
+ "../src/_enums/log-style.enum.ts",
1437
+ "../src/_models/control-models/dynamobe-error.ts",
1438
+ "../src/_models/control-models/location-coordinates.ts"
1439
+ ],
1440
+ "../src/_collections/index.ts": [
1441
+ "../node_modules/@types/node/fs.d.ts",
1442
+ "../node_modules/@types/node/process.d.ts",
1443
+ "../node_modules/@types/node/ts3.2/fs.d.ts",
1444
+ "../node_modules/@types/node/ts3.2/process.d.ts",
1445
+ "../node_modules/@types/node/ts3.2/util.d.ts",
1446
+ "../node_modules/@types/node/util.d.ts",
1447
+ "../src/_collections/dynamo-shared.service.ts"
1448
+ ],
1403
1449
  "../src/_constants/index.ts": [
1404
1450
  "../node_modules/@types/node/fs.d.ts",
1405
1451
  "../node_modules/@types/node/process.d.ts",
@@ -1437,6 +1483,23 @@
1437
1483
  "../node_modules/@types/node/ts3.2/util.d.ts",
1438
1484
  "../node_modules/@types/node/util.d.ts"
1439
1485
  ],
1486
+ "../src/_enums/index.ts": [
1487
+ "../node_modules/@types/node/fs.d.ts",
1488
+ "../node_modules/@types/node/process.d.ts",
1489
+ "../node_modules/@types/node/ts3.2/fs.d.ts",
1490
+ "../node_modules/@types/node/ts3.2/process.d.ts",
1491
+ "../node_modules/@types/node/ts3.2/util.d.ts",
1492
+ "../node_modules/@types/node/util.d.ts",
1493
+ "../src/_enums/log-style.enum.ts"
1494
+ ],
1495
+ "../src/_enums/log-style.enum.ts": [
1496
+ "../node_modules/@types/node/fs.d.ts",
1497
+ "../node_modules/@types/node/process.d.ts",
1498
+ "../node_modules/@types/node/ts3.2/fs.d.ts",
1499
+ "../node_modules/@types/node/ts3.2/process.d.ts",
1500
+ "../node_modules/@types/node/ts3.2/util.d.ts",
1501
+ "../node_modules/@types/node/util.d.ts"
1502
+ ],
1440
1503
  "../src/_models/control-models/daily-usage-data.ts": [
1441
1504
  "../node_modules/@types/node/fs.d.ts",
1442
1505
  "../node_modules/@types/node/process.d.ts",
@@ -1562,7 +1625,7 @@
1562
1625
  "../src/_models/data-models/metadata.ts",
1563
1626
  "../src/_models/data-models/usage-session.ts"
1564
1627
  ],
1565
- "../src/_modules/data-module.index.ts": [
1628
+ "../src/_modules/data-modules.index.ts": [
1566
1629
  "../node_modules/@types/node/fs.d.ts",
1567
1630
  "../node_modules/@types/node/process.d.ts",
1568
1631
  "../node_modules/@types/node/ts3.2/fs.d.ts",
@@ -1583,6 +1646,20 @@
1583
1646
  "../node_modules/@types/node/util.d.ts",
1584
1647
  "../src/_models/control-models/dynamobe-error.ts"
1585
1648
  ],
1649
+ "../src/_modules/shared-service.index.ts": [
1650
+ "../node_modules/@types/node/fs.d.ts",
1651
+ "../node_modules/@types/node/process.d.ts",
1652
+ "../node_modules/@types/node/ts3.2/fs.d.ts",
1653
+ "../node_modules/@types/node/ts3.2/process.d.ts",
1654
+ "../node_modules/@types/node/ts3.2/util.d.ts",
1655
+ "../node_modules/@types/node/util.d.ts",
1656
+ "../src/_collections/dynamo-shared.service.ts",
1657
+ "../src/_constants/times.ts",
1658
+ "../src/_enums/log-style.enum.ts",
1659
+ "../src/_models/control-models/dynamobe-error.ts",
1660
+ "../src/_models/control-models/geo-ip-location.ts",
1661
+ "../src/_models/control-models/location-coordinates.ts"
1662
+ ],
1586
1663
  "../src/_modules/test-module.index.ts": [
1587
1664
  "../node_modules/@types/node/fs.d.ts",
1588
1665
  "../node_modules/@types/node/process.d.ts",
@@ -1613,7 +1690,9 @@
1613
1690
  "../node_modules/@types/node/ts3.2/process.d.ts",
1614
1691
  "../node_modules/@types/node/ts3.2/util.d.ts",
1615
1692
  "../node_modules/@types/node/util.d.ts",
1693
+ "../src/_collections/index.ts",
1616
1694
  "../src/_constants/index.ts",
1695
+ "../src/_enums/index.ts",
1617
1696
  "../src/_models/index.ts"
1618
1697
  ]
1619
1698
  },
@@ -2432,6 +2511,13 @@
2432
2511
  "../node_modules/@types/node/ts3.2/util.d.ts",
2433
2512
  "../node_modules/@types/node/util.d.ts"
2434
2513
  ],
2514
+ "../src/_collections/dynamo-shared.service.ts": [
2515
+ "../src/_enums/log-style.enum.ts",
2516
+ "../src/_models/control-models/location-coordinates.ts"
2517
+ ],
2518
+ "../src/_collections/index.ts": [
2519
+ "../src/_collections/dynamo-shared.service.ts"
2520
+ ],
2435
2521
  "../src/_constants/index.ts": [
2436
2522
  "../src/_constants/module-settings/test-module-settings.ts",
2437
2523
  "../src/_constants/module-settings/usage-module-settings.ts",
@@ -2443,6 +2529,9 @@
2443
2529
  "../src/_constants/module-settings/usage-module-settings.ts": [
2444
2530
  "../src/_models/control-models/dynamo-module-settings.ts"
2445
2531
  ],
2532
+ "../src/_enums/index.ts": [
2533
+ "../src/_enums/log-style.enum.ts"
2534
+ ],
2446
2535
  "../src/_models/control-models/daily-usage-data.ts": [
2447
2536
  "../src/_models/data-models/usage-session.ts"
2448
2537
  ],
@@ -2475,7 +2564,7 @@
2475
2564
  "../src/_models/data-models/metadata.ts",
2476
2565
  "../src/_models/data-models/usage-session.ts"
2477
2566
  ],
2478
- "../src/_modules/data-module.index.ts": [
2567
+ "../src/_modules/data-modules.index.ts": [
2479
2568
  "../src/_models/control-models/dynamobe-data-params.ts",
2480
2569
  "../src/_models/control-models/dynamobe-data-property-params.ts",
2481
2570
  "../src/_models/control-models/dynamobe-error.ts",
@@ -2484,6 +2573,14 @@
2484
2573
  "../src/_modules/error-module.index.ts": [
2485
2574
  "../src/_models/control-models/dynamobe-error.ts"
2486
2575
  ],
2576
+ "../src/_modules/shared-service.index.ts": [
2577
+ "../src/_collections/dynamo-shared.service.ts",
2578
+ "../src/_constants/times.ts",
2579
+ "../src/_enums/log-style.enum.ts",
2580
+ "../src/_models/control-models/dynamobe-error.ts",
2581
+ "../src/_models/control-models/geo-ip-location.ts",
2582
+ "../src/_models/control-models/location-coordinates.ts"
2583
+ ],
2487
2584
  "../src/_modules/test-module.index.ts": [
2488
2585
  "../src/_constants/module-settings/test-module-settings.ts",
2489
2586
  "../src/_models/data-models/custom-data.ts"
@@ -2496,7 +2593,9 @@
2496
2593
  "../src/_models/data-models/usage-session.ts"
2497
2594
  ],
2498
2595
  "../src/index.ts": [
2596
+ "../src/_collections/index.ts",
2499
2597
  "../src/_constants/index.ts",
2598
+ "../src/_enums/index.ts",
2500
2599
  "../src/_models/index.ts"
2501
2600
  ]
2502
2601
  },
@@ -2591,10 +2690,14 @@
2591
2690
  "../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts",
2592
2691
  "../node_modules/typescript/lib/lib.es5.d.ts",
2593
2692
  "../node_modules/typescript/lib/lib.esnext.intl.d.ts",
2693
+ "../src/_collections/dynamo-shared.service.ts",
2694
+ "../src/_collections/index.ts",
2594
2695
  "../src/_constants/index.ts",
2595
2696
  "../src/_constants/module-settings/test-module-settings.ts",
2596
2697
  "../src/_constants/module-settings/usage-module-settings.ts",
2597
2698
  "../src/_constants/times.ts",
2699
+ "../src/_enums/index.ts",
2700
+ "../src/_enums/log-style.enum.ts",
2598
2701
  "../src/_models/control-models/daily-usage-data.ts",
2599
2702
  "../src/_models/control-models/dynamo-module-settings.ts",
2600
2703
  "../src/_models/control-models/dynamobe-data-params.ts",
@@ -2608,8 +2711,9 @@
2608
2711
  "../src/_models/data-models/metadata.ts",
2609
2712
  "../src/_models/data-models/usage-session.ts",
2610
2713
  "../src/_models/index.ts",
2611
- "../src/_modules/data-module.index.ts",
2714
+ "../src/_modules/data-modules.index.ts",
2612
2715
  "../src/_modules/error-module.index.ts",
2716
+ "../src/_modules/shared-service.index.ts",
2613
2717
  "../src/_modules/test-module.index.ts",
2614
2718
  "../src/_modules/usage-module.index.ts",
2615
2719
  "../src/index.ts"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@futdevpro/fsm-dynamo",
3
- "version": "01.00.21",
3
+ "version": "01.00.22",
4
4
  "description": "Dynamic NodeTS (NodeJS-Typescript), MongoDB Backend System Framework by Future Development Ltd.",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -54,6 +54,12 @@
54
54
  "module": "./lib/_modules/error-module.index.js",
55
55
  "types": "./lib/_modules/error-module.index.d.ts",
56
56
  "typings": "./lib/_modules/error-module.index.d.ts"
57
+ },
58
+ "./shared-service": {
59
+ "default": "./lib/_modules/shared-service.index.js",
60
+ "module": "./lib/_modules/shared-service.index.js",
61
+ "types": "./lib/_modules/shared-service.index.d.ts",
62
+ "typings": "./lib/_modules/shared-service.index.d.ts"
57
63
  }
58
64
  },
59
65
  "typesVersions": {
@@ -76,6 +82,9 @@
76
82
  ],
77
83
  "error-module": [
78
84
  "lib/_modules/error-module.index.d.ts"
85
+ ],
86
+ "shared-service": [
87
+ "lib/_modules/shared-service.index.d.ts"
79
88
  ]
80
89
  }
81
90
  },
@@ -0,0 +1,267 @@
1
+
2
+ import { day, hour, month, week, year } from '../_constants/times';
3
+ import { LogStyle } from '../_enums/log-style.enum';
4
+ import { DynamoBEError } from '../_models/control-models/dynamobe-error';
5
+ import { LocationCoordinates } from '../_models/control-models/location-coordinates';
6
+
7
+ export class DBE_Shared {
8
+
9
+ /**
10
+ * returns remapped object list by path list
11
+ * @param objList object list to map
12
+ * @param paths string list of path etc.:
13
+ * [ [ 'first', 'sub', 'label' ], [ 'first', 'dif', 'name' ]] will be...
14
+ * from
15
+ * {
16
+ * first: {
17
+ * sub: {
18
+ * label: 'vlmi'
19
+ * },
20
+ * dif: {
21
+ * name: 'asd'
22
+ * }
23
+ * }
24
+ * }[]
25
+ * to
26
+ * { label: 'vlmi', name: 'asd' }[]
27
+ * @returns remapped object list (the final obj will use the deepest keys)
28
+ */
29
+ static mapObjList(objList: object[], paths: string[][]): object[] {
30
+ let newObjList = [...objList];
31
+ newObjList = newObjList.map(obj => {
32
+ const newObj = {};
33
+ paths.forEach((path: string[]) => {
34
+ newObj[path[path.length - 1]] = this.getNestedData(obj, path);
35
+ });
36
+ return newObj;
37
+ });
38
+ return newObjList;
39
+ }
40
+
41
+ /**
42
+ * returns nested value from object
43
+ * @param parentObj data source object
44
+ * @param nestedDataKeys path of value as string list
45
+ * etc.: ['nestLvl1', 'nestLvl2', 'nestLvl3'] as parentObj.nestLvl1.nestLvl2.nestLvl3
46
+ * @returns data from object by path
47
+ */
48
+ static getNestedData(parentObj: object, nestedDataKeys: string[]): any {
49
+ let newData = {...parentObj};
50
+ nestedDataKeys.forEach((dk: string) => {
51
+ if (newData) {
52
+ newData = newData[dk];
53
+ }
54
+ });
55
+ return newData;
56
+ }
57
+
58
+ /**
59
+ * recursive function that nests data
60
+ * @param newData the object that that is needed to be updated
61
+ * @param nestKeys the path where the data should be updated
62
+ * @param dataToSet the actual value that will be setted
63
+ * @returns modified data
64
+ */
65
+ static nestData(parentObj: object, nestKeys: string[], dataToSet: any): object {
66
+ const newData = {...parentObj};
67
+ if (nestKeys.length > 1) {
68
+ const keys = [...nestKeys];
69
+ const nextNestKey = keys.shift();
70
+ newData[nextNestKey] = this.nestData(newData[nextNestKey], keys, dataToSet);
71
+ } else {
72
+ newData[nestKeys[0]] = dataToSet;
73
+ }
74
+ return newData;
75
+ }
76
+
77
+ /**
78
+ * recursive function that adds to nested data
79
+ * @param newData the object that that is needed to be updated
80
+ * @param nestKeys the path where the data should be updated
81
+ * @param dataToAdd the actual value that will be setted
82
+ * @returns modified data
83
+ */
84
+ static addToNestedData(parentObj: object, nestKeys: string[], dataToAdd: any): object {
85
+ const newData = {...parentObj};
86
+ if (nestKeys.length > 1) {
87
+ const keys = [...nestKeys];
88
+ const nextNestKey = keys.shift();
89
+ newData[nextNestKey] = this.addToNestedData(newData[nextNestKey], keys, dataToAdd);
90
+ } else {
91
+ newData[nestKeys[0]] += dataToAdd;
92
+ }
93
+ return newData;
94
+ }
95
+
96
+ /**
97
+ * recursive function that pushes to nested data
98
+ * @param newData the object that that is needed to be updated
99
+ * @param nestKeys the path where the data should be updated
100
+ * @param dataToPush the actual value that will be setted
101
+ * @returns modified data
102
+ */
103
+ static pushToNestedData(parentObj: object, nestKeys: string[], dataToPush: any): object {
104
+ const newData = {...parentObj};
105
+ if (nestKeys.length > 1) {
106
+ const keys = [...nestKeys];
107
+ const nextNestKey = keys.shift();
108
+ newData[nextNestKey] = this.pushToNestedData(newData[nextNestKey], keys, dataToPush);
109
+ } else {
110
+ if (Array.isArray(newData[nestKeys[0]])) {
111
+ newData[nestKeys[0]].push(dataToPush);
112
+ } else {
113
+ newData[nestKeys[0]] = [dataToPush];
114
+ }
115
+ }
116
+ return newData;
117
+ }
118
+
119
+ /**
120
+ * recursive function that nests data on recursive data structure etc.: xData: { ..., 'nestedListKey': xData[] }
121
+ * @param newData the object that that is needed to be updated
122
+ * @param nestedListKey the location of nested dataList
123
+ * @param nestIndexes path to the subject ect.: xData.listKey[1].listKey[4].listKey[0] will be [1, 4, 0]
124
+ * @param dataToSet the actual value that will be setted on location
125
+ * @returns modified data
126
+ */
127
+ static nestRecursiveListedData<T>(parentObj: T, nestedListKey: string, nestIndexes: number[], dataToSet: any): T {
128
+ const newData = {...parentObj};
129
+ if (nestIndexes.length > 1) {
130
+ const indexes = [...nestIndexes];
131
+ const nextLevelKey = indexes.shift();
132
+ newData[nestedListKey][nextLevelKey] = this.nestRecursiveListedData(
133
+ newData[nestedListKey][nextLevelKey], nestedListKey, indexes, dataToSet);
134
+ } else {
135
+ newData[nestedListKey][nestIndexes[0]] = dataToSet;
136
+ }
137
+ return newData;
138
+ }
139
+
140
+ static getAge(birthDate: Date | number | string) {
141
+ return this.getYear(+new Date() - +new Date(birthDate));
142
+ }
143
+
144
+ static getYear(date: Date | number | string) {
145
+ if (typeof date === 'string') {
146
+ date = new Date(date);
147
+ }
148
+ return (+date / year);
149
+ }
150
+
151
+ static getHour(date: Date | number | string) {
152
+ if (typeof date === 'string') {
153
+ date = new Date(date);
154
+ }
155
+ return (+date / hour);
156
+ }
157
+
158
+ static getDateByAge(age: number) {
159
+ return new Date(+new Date() - (year * age));
160
+ }
161
+
162
+ static getDistanceInKilometres(
163
+ from: LocationCoordinates,
164
+ to: LocationCoordinates
165
+ ): number {
166
+
167
+ const R = 6371; // kilometres
168
+ const φ1 = this.toRadians(from.latitude);
169
+ const φ2 = this.toRadians(to.latitude);
170
+ const Δφ = this.toRadians(to.latitude - from.latitude);
171
+ const Δλ = this.toRadians(to.longitude - from.longitude);
172
+
173
+ const a = Math.sin(Δφ / 2) * Math.sin(Δφ / 2) +
174
+ Math.cos(φ1) * Math.cos(φ2) *
175
+ Math.sin(Δλ / 2) * Math.sin(Δλ / 2);
176
+ const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
177
+
178
+ return R * c;
179
+ }
180
+
181
+ static getLocationDegByKilometers(latiOrLong: 'latitude' | 'longitude', distanceInKm: number, latitude?: number): number {
182
+ if (latiOrLong === 'latitude') {
183
+ return distanceInKm / 110.574;
184
+ } else {
185
+ if (latitude) {
186
+ return distanceInKm / (Math.cos(this.toRadians(latitude)) * 111.320);
187
+ } else {
188
+ throw new DynamoBEError({ status: 417, message: 'When using getLocationDegByKilometers for longitude, you need to give latitude!' });
189
+ }
190
+ }
191
+ }
192
+
193
+ static toRadians(deg: number): number {
194
+ return deg * (Math.PI / 180);
195
+ }
196
+
197
+ static addMetadataToSchema(schema: any): any {
198
+ schema.__created = { type: Date };
199
+ schema.__createdBy = { type: String };
200
+ schema.__lastModified = { type: Date };
201
+ schema.__lastModifiedBy = { type: String };
202
+ return schema;
203
+ }
204
+
205
+ static oneHourAgo(): Date {
206
+ return new Date(+new Date() - hour);
207
+ }
208
+ static oneDayAgo(): Date {
209
+ return new Date(+new Date() - day);
210
+ }
211
+ static oneWeekAgo(): Date {
212
+ return new Date(+new Date() - week);
213
+ }
214
+ static oneMonthAgo(): Date {
215
+ return new Date(+new Date() - month);
216
+ }
217
+ static oneYearAgo(): Date {
218
+ return new Date(+new Date() - year);
219
+ }
220
+
221
+ static setLogStyle(styles: LogStyle[]): void {
222
+ let styleSets = '';
223
+ styles.forEach((style: LogStyle) => {
224
+ styleSets += style;
225
+ });
226
+ console.log(styleSets);
227
+ }
228
+ static resetLogStyle(): void {
229
+ console.log(LogStyle.reset);
230
+ }
231
+
232
+ static logStyle(input: string, styles: LogStyle[], dontReset?: boolean): string {
233
+ let result = '';
234
+ styles.forEach((style: LogStyle) => {
235
+ result += style;
236
+ });
237
+ result += input;
238
+ if (!dontReset) {
239
+ result += LogStyle.reset;
240
+ }
241
+ return result;
242
+ }
243
+
244
+ static logSuccess(message: string, ...optionalParams: any[]): void {
245
+ if (0 < optionalParams.length) {
246
+ console.error(`${LogStyle.green}${LogStyle.bright}${message}`, ...optionalParams, LogStyle.reset);
247
+ } else {
248
+ console.error(`${LogStyle.green}${LogStyle.bright}${message}${LogStyle.reset}`);
249
+ }
250
+ }
251
+
252
+ static logError(message: string, ...optionalParams: any[]): void {
253
+ if (0 < optionalParams.length) {
254
+ console.error(`${LogStyle.red}${LogStyle.bright}${message}`, ...optionalParams, LogStyle.reset);
255
+ } else {
256
+ console.error(`${LogStyle.red}${LogStyle.bright}${message}${LogStyle.reset}`);
257
+ }
258
+ }
259
+
260
+ static logWarning(message: string, ...optionalParams: any[]): void {
261
+ if (0 < optionalParams.length) {
262
+ console.warn(`${LogStyle.yellow}${LogStyle.bright}${message}`, ...optionalParams, LogStyle.reset);
263
+ } else {
264
+ console.warn(`${LogStyle.yellow}${LogStyle.bright}${message}${LogStyle.reset}`);
265
+ }
266
+ }
267
+ }
@@ -0,0 +1,6 @@
1
+
2
+ // COLLECTIONS
3
+ export * from './dynamo-shared.service';
4
+
5
+
6
+
@@ -0,0 +1,5 @@
1
+
2
+ // ENUMS
3
+ export * from './log-style.enum';
4
+
5
+
@@ -0,0 +1,30 @@
1
+
2
+
3
+ export enum LogStyle {
4
+ reset = '\x1b[0m',
5
+
6
+ bright = '\x1b[1m',
7
+ dim = '\x1b[2m',
8
+ underline = '\x1b[4m',
9
+ blink = '\x1b[5m',
10
+ reverse = '\x1b[7m',
11
+ hidden = '\x1b[8m',
12
+
13
+ black = '\x1b[30m',
14
+ red = '\x1b[31m',
15
+ green = '\x1b[32m',
16
+ yellow = '\x1b[33m',
17
+ blue = '\x1b[34m',
18
+ magenta = '\x1b[35m',
19
+ cyan = '\x1b[36m',
20
+ white = '\x1b[37m',
21
+
22
+ BgBlack = '\x1b[40m',
23
+ BgRed = '\x1b[41m',
24
+ BgGreen = '\x1b[42m',
25
+ BgYellow = '\x1b[43m',
26
+ BgBlue = '\x1b[44m',
27
+ BgMagenta = '\x1b[45m',
28
+ BgCyan = '\x1b[46m',
29
+ BgWhite = '\x1b[47m',
30
+ }
@@ -0,0 +1,8 @@
1
+
2
+ // SHARED SERVICE MODULE
3
+ export * from '../_collections/dynamo-shared.service';
4
+ export * from '../_constants/times';
5
+ export * from '../_enums/log-style.enum';
6
+ export * from '../_models/control-models/dynamobe-error';
7
+ export * from '../_models/control-models/location-coordinates';
8
+ export * from '../_models/control-models/geo-ip-location';
package/src/index.ts CHANGED
@@ -1,8 +1,13 @@
1
1
 
2
+ // COLLECTIONS
3
+ export * from './_collections';
2
4
 
3
5
  // CONSTANTS
4
6
  export * from './_constants';
5
7
 
8
+ // ENUMS
9
+ export * from './_enums';
10
+
6
11
  // MODELS
7
12
  export * from './_models';
8
13