@futdevpro/nts-dynamo 1.3.47 → 1.3.49

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 (48) hide show
  1. package/lib/_constants/dynamobe-global.settings.js +6 -4
  2. package/lib/_enums/data-model-type.enum.js +5 -3
  3. package/lib/_enums/dynamobe-data-service-function.enum.js +5 -3
  4. package/lib/_enums/dynamobe-route-security.enum.js +5 -3
  5. package/lib/_enums/http/http-call-type.enum.js +5 -3
  6. package/lib/_enums/http/http-response-type.enum.js +5 -3
  7. package/lib/_enums/index.js +10 -8
  8. package/lib/_enums/log-style.enum.js +5 -3
  9. package/lib/_enums/predefined-data-types.enum.js +5 -3
  10. package/lib/_models/dynamobe-api-call-params.js +7 -3
  11. package/lib/_models/dynamobe-app-params.js +5 -2
  12. package/lib/_models/dynamobe-data-model-params.js +5 -2
  13. package/lib/_models/dynamobe-endpoint-control.js +23 -20
  14. package/lib/_models/dynamobe-global-settings.js +2 -1
  15. package/lib/_models/fullstack-models/control-models/daily-usage-data.js +5 -2
  16. package/lib/_models/fullstack-models/control-models/dynamobe-data-property-params.js +7 -4
  17. package/lib/_models/fullstack-models/control-models/dynamobe-error.js +5 -2
  18. package/lib/_models/fullstack-models/control-models/geo-ip-location.js +2 -1
  19. package/lib/_models/fullstack-models/control-models/usage-action.js +5 -2
  20. package/lib/_models/fullstack-models/control-models/usage-data.js +5 -2
  21. package/lib/_models/fullstack-models/data-models/custom-data.js +7 -4
  22. package/lib/_models/fullstack-models/data-models/metadata.js +5 -2
  23. package/lib/_models/fullstack-models/data-models/usage-session.js +7 -4
  24. package/lib/_models/index.js +17 -15
  25. package/lib/_modules/index.js +7 -5
  26. package/lib/_modules/test-route/custom-data.service.js +9 -6
  27. package/lib/_modules/test-route/test-controller.js +33 -30
  28. package/lib/_modules/usage-route/usage-controller.js +31 -28
  29. package/lib/_modules/usage-route/usage.service.js +24 -21
  30. package/lib/_services/dynamobe-api.service.js +29 -26
  31. package/lib/_services/dynamobe-app.js +12 -8
  32. package/lib/_services/dynamobe-auth.service.js +9 -6
  33. package/lib/_services/dynamobe-controller.service.js +6 -3
  34. package/lib/_services/dynamobe-data.service.js +32 -29
  35. package/lib/_services/dynamobe-db-service-collection.service.js +6 -3
  36. package/lib/_services/dynamobe-db.service.js +52 -49
  37. package/lib/_services/dynamobe-email-service-collection.service.js +6 -3
  38. package/lib/_services/dynamobe-email.service.js +18 -15
  39. package/lib/_services/dynamobe-global.service.js +8 -5
  40. package/lib/_services/dynamobe-routing-module.service.js +29 -26
  41. package/lib/_services/dynamobe-server.js +37 -34
  42. package/lib/_services/dynamobe-shared.service.js +34 -30
  43. package/lib/_services/dynamobe-singleton.service.js +5 -2
  44. package/lib/_services/index.js +17 -15
  45. package/lib/index.js +7 -5
  46. package/lib/tsconfig.tsbuildinfo +2 -12
  47. package/package.json +1 -1
  48. package/tsconfig.json +8 -8
@@ -1,7 +1,10 @@
1
- import { __awaiter } from "tslib";
2
- import { DynamoBEError } from '../_models/fullstack-models/control-models/dynamobe-error';
3
- import { DBE_Global_S } from './dynamobe-global.service';
4
- export class DynamoBEDataService {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DynamoBEDataService = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const dynamobe_error_1 = require("../_models/fullstack-models/control-models/dynamobe-error");
6
+ const dynamobe_global_service_1 = require("./dynamobe-global.service");
7
+ class DynamoBEDataService {
5
8
  constructor(dataDBService, data, dataModelParams, // this will be used for dependency dataHook
6
9
  issuer) {
7
10
  this.dataList = [];
@@ -18,14 +21,14 @@ export class DynamoBEDataService {
18
21
  * returns all data from database to service dataList
19
22
  */
20
23
  getAll() {
21
- return __awaiter(this, void 0, void 0, function* () {
24
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
22
25
  try {
23
26
  yield this.dataDBService.getAll().then((dataList) => {
24
27
  this.dataList = dataList;
25
28
  });
26
29
  }
27
30
  catch (error) {
28
- throw new DynamoBEError({ status: 417, message: 'getAll was unsuccessful', error: error });
31
+ throw new dynamobe_error_1.DynamoBEError({ status: 417, message: 'getAll was unsuccessful', error: error });
29
32
  }
30
33
  });
31
34
  }
@@ -33,7 +36,7 @@ export class DynamoBEDataService {
33
36
  * returns data from database by id
34
37
  */
35
38
  getDataById(dontSetToService) {
36
- return __awaiter(this, void 0, void 0, function* () {
39
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
37
40
  try {
38
41
  if (this.data._id) {
39
42
  let dataExists;
@@ -46,11 +49,11 @@ export class DynamoBEDataService {
46
49
  return dataExists;
47
50
  }
48
51
  else {
49
- throw new DynamoBEError({ status: 417, message: 'ID is missing!' });
52
+ throw new dynamobe_error_1.DynamoBEError({ status: 417, message: 'ID is missing!' });
50
53
  }
51
54
  }
52
55
  catch (error) {
53
- throw new DynamoBEError({ status: 417, message: 'getDataById was unsuccessful', error: error });
56
+ throw new dynamobe_error_1.DynamoBEError({ status: 417, message: 'getDataById was unsuccessful', error: error });
54
57
  }
55
58
  });
56
59
  }
@@ -59,7 +62,7 @@ export class DynamoBEDataService {
59
62
  * @param dependencyId
60
63
  */
61
64
  getDataByDependencyId(dependencyId) {
62
- return __awaiter(this, void 0, void 0, function* () {
65
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
63
66
  try {
64
67
  if (this.depKey) {
65
68
  if (dependencyId || this.data[this.depKey]) {
@@ -68,15 +71,15 @@ export class DynamoBEDataService {
68
71
  });
69
72
  }
70
73
  else {
71
- throw new DynamoBEError({ status: 417, message: `${this.depKey} is missing!` });
74
+ throw new dynamobe_error_1.DynamoBEError({ status: 417, message: `${this.depKey} is missing!` });
72
75
  }
73
76
  }
74
77
  else {
75
- throw new DynamoBEError({ status: 417, message: 'dependencyDataIdKey is missing from service!' });
78
+ throw new dynamobe_error_1.DynamoBEError({ status: 417, message: 'dependencyDataIdKey is missing from service!' });
76
79
  }
77
80
  }
78
81
  catch (error) {
79
- throw new DynamoBEError({ status: 417, message: 'getDataByDependencyId was unsuccessful', error: error });
82
+ throw new dynamobe_error_1.DynamoBEError({ status: 417, message: 'getDataByDependencyId was unsuccessful', error: error });
80
83
  }
81
84
  });
82
85
  }
@@ -85,7 +88,7 @@ export class DynamoBEDataService {
85
88
  * @param dependencyId
86
89
  */
87
90
  getDataListByDependencyId(dependencyId) {
88
- return __awaiter(this, void 0, void 0, function* () {
91
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
89
92
  try {
90
93
  if (this.depKey) {
91
94
  if (dependencyId || this.data[this.depKey]) {
@@ -94,15 +97,15 @@ export class DynamoBEDataService {
94
97
  });
95
98
  }
96
99
  else {
97
- throw new DynamoBEError({ status: 417, message: `${this.depKey} is missing!` });
100
+ throw new dynamobe_error_1.DynamoBEError({ status: 417, message: `${this.depKey} is missing!` });
98
101
  }
99
102
  }
100
103
  else {
101
- throw new DynamoBEError({ status: 417, message: 'dependencyDataIdKey is missing from service!' });
104
+ throw new dynamobe_error_1.DynamoBEError({ status: 417, message: 'dependencyDataIdKey is missing from service!' });
102
105
  }
103
106
  }
104
107
  catch (error) {
105
- throw new DynamoBEError({ status: 417, message: 'getDataListByDependencyId was unsuccessful', error: error });
108
+ throw new dynamobe_error_1.DynamoBEError({ status: 417, message: 'getDataListByDependencyId was unsuccessful', error: error });
106
109
  }
107
110
  });
108
111
  }
@@ -112,7 +115,7 @@ export class DynamoBEDataService {
112
115
  * and if dependency data setted up, will check before creation
113
116
  */
114
117
  saveData() {
115
- return __awaiter(this, void 0, void 0, function* () {
118
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
116
119
  try {
117
120
  if (this.data._id) {
118
121
  // check if already exists
@@ -146,7 +149,7 @@ export class DynamoBEDataService {
146
149
  }
147
150
  }
148
151
  catch (error) {
149
- throw new DynamoBEError({ status: 417, message: 'modifyData was unsuccessful', error: error });
152
+ throw new dynamobe_error_1.DynamoBEError({ status: 417, message: 'modifyData was unsuccessful', error: error });
150
153
  }
151
154
  });
152
155
  }
@@ -154,17 +157,17 @@ export class DynamoBEDataService {
154
157
  * permanently deletes data from database by data._id
155
158
  */
156
159
  deleteData() {
157
- return __awaiter(this, void 0, void 0, function* () {
160
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
158
161
  try {
159
162
  if (this.data._id) {
160
163
  yield this.dataDBService.deleteDataById(this.data._id);
161
164
  }
162
165
  else {
163
- throw new DynamoBEError({ status: 417, message: 'ID is missing!' });
166
+ throw new dynamobe_error_1.DynamoBEError({ status: 417, message: 'ID is missing!' });
164
167
  }
165
168
  }
166
169
  catch (error) {
167
- throw new DynamoBEError({ status: 417, message: 'deleteData was unsuccessful', error: error });
170
+ throw new dynamobe_error_1.DynamoBEError({ status: 417, message: 'deleteData was unsuccessful', error: error });
168
171
  }
169
172
  });
170
173
  }
@@ -172,17 +175,17 @@ export class DynamoBEDataService {
172
175
  * validation of data, for modify and create, by the ModelParams
173
176
  */
174
177
  validateForSave() {
175
- return __awaiter(this, void 0, void 0, function* () {
178
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
176
179
  try {
177
180
  for (let i = 0; i < this.dataModelParams.length; i++) {
178
181
  // basic required validations
179
182
  if ((this.dataModelParams[i].required && (this.data[this.dataModelParams[i].key] === null || this.data[this.dataModelParams[i].key] === undefined)) ||
180
183
  (this.dataModelParams[i].index && (this.data[this.dataModelParams[i].key] === null || this.data[this.dataModelParams[i].key] === undefined))) {
181
- throw new DynamoBEError({ status: 422, message: `${this.dataModelParams[i].key} is missing! (${this.dataModelParams[i].required ? 'required' : 'index'})` });
184
+ throw new dynamobe_error_1.DynamoBEError({ status: 422, message: `${this.dataModelParams[i].key} is missing! (${this.dataModelParams[i].required ? 'required' : 'index'})` });
182
185
  }
183
186
  // specific Date validation
184
187
  if (this.dataModelParams[i].type === 'Date' && !(new Date(this.data[this.dataModelParams[i].key]) instanceof Date)) {
185
- throw new DynamoBEError({ status: 422, message: `${this.dataModelParams[i].key} is not a date!` });
188
+ throw new dynamobe_error_1.DynamoBEError({ status: 422, message: `${this.dataModelParams[i].key} is not a date!` });
186
189
  }
187
190
  // call additional validators
188
191
  if (this.dataModelParams[i].additionalValidators) {
@@ -193,7 +196,7 @@ export class DynamoBEDataService {
193
196
  }
194
197
  }
195
198
  catch (error) {
196
- throw new DynamoBEError({ status: 422, message: 'validateForSave was unsuccessful', error: error });
199
+ throw new dynamobe_error_1.DynamoBEError({ status: 422, message: 'validateForSave was unsuccessful', error: error });
197
200
  }
198
201
  });
199
202
  }
@@ -211,11 +214,11 @@ export class DynamoBEDataService {
211
214
  }
212
215
  getDependencyDataDBService() {
213
216
  if (this.depDBServiceKey) {
214
- return DBE_Global_S.getDBServiceCollection()[this.depDBServiceKey];
217
+ return dynamobe_global_service_1.DBE_Global_S.getDBServiceCollection()[this.depDBServiceKey];
215
218
  }
216
219
  else {
217
- throw new DynamoBEError({ status: 501, message: 'getDependencyDataDBService was unsuccessful, service key not setted up!' });
220
+ throw new dynamobe_error_1.DynamoBEError({ status: 501, message: 'getDependencyDataDBService was unsuccessful, service key not setted up!' });
218
221
  }
219
222
  }
220
223
  }
221
- //# sourceMappingURL=dynamobe-data.service.js.map
224
+ exports.DynamoBEDataService = DynamoBEDataService;
@@ -1,4 +1,7 @@
1
- import { DynamoBESingletonService } from './dynamobe-singleton.service';
2
- export class DynamoBEDBServiceCollection extends DynamoBESingletonService {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DynamoBEDBServiceCollection = void 0;
4
+ const dynamobe_singleton_service_1 = require("./dynamobe-singleton.service");
5
+ class DynamoBEDBServiceCollection extends dynamobe_singleton_service_1.DynamoBESingletonService {
3
6
  }
4
- //# sourceMappingURL=dynamobe-db-service-collection.service.js.map
7
+ exports.DynamoBEDBServiceCollection = DynamoBEDBServiceCollection;
@@ -1,8 +1,11 @@
1
- import { __awaiter } from "tslib";
2
- import * as mongoose from 'mongoose';
3
- import { Schema } from 'mongoose';
4
- import { DynamoBEError } from '../_models/fullstack-models/control-models/dynamobe-error';
5
- export class DynamoBEDBService {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DynamoBEDBService = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const mongoose = tslib_1.__importStar(require("mongoose"));
6
+ const mongoose_1 = require("mongoose");
7
+ const dynamobe_error_1 = require("../_models/fullstack-models/control-models/dynamobe-error");
8
+ class DynamoBEDBService {
6
9
  /**
7
10
  * @param dataName name the model
8
11
  * @param typeSample sample data for scheme creation (dont include Metadata!)
@@ -21,7 +24,7 @@ export class DynamoBEDBService {
21
24
  * @returns data
22
25
  */
23
26
  createData(data, creator) {
24
- return __awaiter(this, void 0, void 0, function* () {
27
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
25
28
  data.__created = new Date();
26
29
  data.__lastModified = new Date();
27
30
  data.__createdBy = creator;
@@ -33,10 +36,10 @@ export class DynamoBEDBService {
33
36
  newData = res.toObject();
34
37
  }
35
38
  else {
36
- throw new DynamoBEError({ status: 204, message: `${this.dataName} not found! (BD)` });
39
+ throw new dynamobe_error_1.DynamoBEError({ status: 204, message: `${this.dataName} not found! (BD)` });
37
40
  }
38
41
  }).catch(error => {
39
- throw new DynamoBEError({ status: 422, message: `Create new ${this.dataName} was unsuccessful (BD)`, error });
42
+ throw new dynamobe_error_1.DynamoBEError({ status: 422, message: `Create new ${this.dataName} was unsuccessful (BD)`, error });
40
43
  });
41
44
  if (typeof newData._id === 'object') {
42
45
  newData._id = `${newData._id}`;
@@ -52,7 +55,7 @@ export class DynamoBEDBService {
52
55
  * @returns data
53
56
  */
54
57
  modifyData(data, modifier) {
55
- return __awaiter(this, void 0, void 0, function* () {
58
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
56
59
  data.__lastModified = new Date();
57
60
  data.__lastModifiedBy = modifier;
58
61
  const dataModel = new this.dataModel(data);
@@ -62,10 +65,10 @@ export class DynamoBEDBService {
62
65
  newData = res.toObject();
63
66
  }
64
67
  else {
65
- throw new DynamoBEError({ status: 204, message: `${this.dataName} not found! (BD)` });
68
+ throw new dynamobe_error_1.DynamoBEError({ status: 204, message: `${this.dataName} not found! (BD)` });
66
69
  }
67
70
  }).catch(error => {
68
- throw new DynamoBEError({ status: 417, message: `modify ${this.dataName} was unsuccessful (DB)`, error });
71
+ throw new dynamobe_error_1.DynamoBEError({ status: 417, message: `modify ${this.dataName} was unsuccessful (DB)`, error });
69
72
  });
70
73
  data.__v = newData.__v;
71
74
  return data;
@@ -77,7 +80,7 @@ export class DynamoBEDBService {
77
80
  * @returns data
78
81
  */
79
82
  getDataById(id) {
80
- return __awaiter(this, void 0, void 0, function* () {
83
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
81
84
  let data;
82
85
  yield this.dataModel.findById(id).then(res => {
83
86
  if (res) {
@@ -87,7 +90,7 @@ export class DynamoBEDBService {
87
90
  data = null;
88
91
  }
89
92
  }).catch(error => {
90
- throw new DynamoBEError({ status: 417, message: `get ${this.dataName} by ID was unsuccessful (DB)`, error });
93
+ throw new dynamobe_error_1.DynamoBEError({ status: 417, message: `get ${this.dataName} by ID was unsuccessful (DB)`, error });
91
94
  });
92
95
  if (data && typeof data._id === 'object') {
93
96
  data._id = `${data._id}`;
@@ -101,7 +104,7 @@ export class DynamoBEDBService {
101
104
  * @returns data
102
105
  */
103
106
  getDataByDependencyId(dependencyId) {
104
- return __awaiter(this, void 0, void 0, function* () {
107
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
105
108
  if (this.depDataKey) {
106
109
  let data;
107
110
  yield this.dataModel.findOne({ [this.depDataKey]: dependencyId }).then(res => {
@@ -112,7 +115,7 @@ export class DynamoBEDBService {
112
115
  data = null;
113
116
  }
114
117
  }).catch(error => {
115
- throw new DynamoBEError({ status: 417, message: `get ${this.dataName} by ${this.depDataKey} was unsuccessful (DB)`, error });
118
+ throw new dynamobe_error_1.DynamoBEError({ status: 417, message: `get ${this.dataName} by ${this.depDataKey} was unsuccessful (DB)`, error });
116
119
  });
117
120
  if (data && typeof data._id === 'object') {
118
121
  data._id = `${data._id}`;
@@ -120,7 +123,7 @@ export class DynamoBEDBService {
120
123
  return data;
121
124
  }
122
125
  else {
123
- throw new DynamoBEError({ status: 501, message: `dependencyDataIdKey not setted up for this db-service (${this.dataName}) (BD)` });
126
+ throw new dynamobe_error_1.DynamoBEError({ status: 501, message: `dependencyDataIdKey not setted up for this db-service (${this.dataName}) (BD)` });
124
127
  }
125
128
  });
126
129
  }
@@ -130,7 +133,7 @@ export class DynamoBEDBService {
130
133
  * @returns dataList
131
134
  */
132
135
  getDataListByDependencyId(dependencyId) {
133
- return __awaiter(this, void 0, void 0, function* () {
136
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
134
137
  if (this.depDataKey) {
135
138
  let dataList = [];
136
139
  yield this.dataModel.find({ [this.depDataKey]: dependencyId }).then(res => {
@@ -138,7 +141,7 @@ export class DynamoBEDBService {
138
141
  dataList = res;
139
142
  }
140
143
  }).catch(error => {
141
- throw new DynamoBEError({ status: 417, message: `get ${this.dataName} by ${this.depDataKey} was unsuccessful (DB)`, error });
144
+ throw new dynamobe_error_1.DynamoBEError({ status: 417, message: `get ${this.dataName} by ${this.depDataKey} was unsuccessful (DB)`, error });
142
145
  });
143
146
  if (0 < dataList.length && typeof dataList[0]._id === 'object') {
144
147
  dataList.forEach((data) => {
@@ -148,7 +151,7 @@ export class DynamoBEDBService {
148
151
  return dataList;
149
152
  }
150
153
  else {
151
- throw new DynamoBEError({ status: 501, message: `dependencyDataIdKey not setted up for this db-service (${this.dataName}) (BD)` });
154
+ throw new dynamobe_error_1.DynamoBEError({ status: 501, message: `dependencyDataIdKey not setted up for this db-service (${this.dataName}) (BD)` });
152
155
  }
153
156
  });
154
157
  }
@@ -158,7 +161,7 @@ export class DynamoBEDBService {
158
161
  * @returns dataList
159
162
  */
160
163
  getDataListByDependencyIds(ids) {
161
- return __awaiter(this, void 0, void 0, function* () {
164
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
162
165
  if (this.depDataKey) {
163
166
  let dataList = [];
164
167
  yield this.dataModel.find({ [this.depDataKey]: { $in: ids } }).then(res => {
@@ -166,12 +169,12 @@ export class DynamoBEDBService {
166
169
  dataList = res;
167
170
  }
168
171
  }).catch(error => {
169
- throw new DynamoBEError({ status: 417, message: `get ${this.dataName}s by ${this.depDataKey}s was unsuccessful (DB)`, error });
172
+ throw new dynamobe_error_1.DynamoBEError({ status: 417, message: `get ${this.dataName}s by ${this.depDataKey}s was unsuccessful (DB)`, error });
170
173
  });
171
174
  return dataList;
172
175
  }
173
176
  else {
174
- throw new DynamoBEError({ status: 501, message: `dependencyDataIdKey not setted up for this db-service (${this.dataName}) (BD)` });
177
+ throw new dynamobe_error_1.DynamoBEError({ status: 501, message: `dependencyDataIdKey not setted up for this db-service (${this.dataName}) (BD)` });
175
178
  }
176
179
  });
177
180
  }
@@ -183,14 +186,14 @@ export class DynamoBEDBService {
183
186
  * @returns dataList
184
187
  */
185
188
  searchData(searchBy, narrowByDependencyIds) {
186
- return __awaiter(this, void 0, void 0, function* () {
189
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
187
190
  const filter = {};
188
191
  if (narrowByDependencyIds.length > 0) {
189
192
  if (this.depDataKey) {
190
193
  filter[this.depDataKey] = { $in: narrowByDependencyIds };
191
194
  }
192
195
  else {
193
- throw new DynamoBEError({ status: 501, message: `dependencyDataIdKey not setted up for this db-service (${this.dataName}) (BD)` });
196
+ throw new dynamobe_error_1.DynamoBEError({ status: 501, message: `dependencyDataIdKey not setted up for this db-service (${this.dataName}) (BD)` });
194
197
  }
195
198
  }
196
199
  yield this.dataModelParams.forEach((modelParam) => {
@@ -239,7 +242,7 @@ export class DynamoBEDBService {
239
242
  dataList = res;
240
243
  }
241
244
  }).catch(error => {
242
- throw new DynamoBEError({ status: 417, message: `search ${this.dataName} was unsuccessful (DB)`, error });
245
+ throw new dynamobe_error_1.DynamoBEError({ status: 417, message: `search ${this.dataName} was unsuccessful (DB)`, error });
243
246
  });
244
247
  if (0 < dataList.length && typeof dataList[0]._id === 'object') {
245
248
  dataList.forEach((data) => {
@@ -256,7 +259,7 @@ export class DynamoBEDBService {
256
259
  * @returns data
257
260
  */
258
261
  findData(data) {
259
- return __awaiter(this, void 0, void 0, function* () {
262
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
260
263
  yield this.dataModel.findOne(data).then(res => {
261
264
  if (res) {
262
265
  data = res.toObject();
@@ -265,7 +268,7 @@ export class DynamoBEDBService {
265
268
  data = null;
266
269
  }
267
270
  }).catch(error => {
268
- throw new DynamoBEError({ status: 417, message: `find ${this.dataName} was unsuccessful (DB)`, error });
271
+ throw new dynamobe_error_1.DynamoBEError({ status: 417, message: `find ${this.dataName} was unsuccessful (DB)`, error });
269
272
  });
270
273
  if (data && typeof data._id === 'object') {
271
274
  data._id = `${data._id}`;
@@ -278,14 +281,14 @@ export class DynamoBEDBService {
278
281
  * @returns dataList
279
282
  */
280
283
  getAll() {
281
- return __awaiter(this, void 0, void 0, function* () {
284
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
282
285
  let dataList = [];
283
286
  yield this.dataModel.find({}).then(res => {
284
287
  if (res) {
285
288
  dataList = res;
286
289
  }
287
290
  }).catch(error => {
288
- throw new DynamoBEError({ status: 417, message: `get all ${this.dataName} was unsuccessful (DB)`, error });
291
+ throw new dynamobe_error_1.DynamoBEError({ status: 417, message: `get all ${this.dataName} was unsuccessful (DB)`, error });
289
292
  });
290
293
  if (0 < dataList.length && typeof dataList[0]._id === 'object') {
291
294
  dataList.forEach((data) => {
@@ -313,9 +316,9 @@ export class DynamoBEDBService {
313
316
  * @param id id
314
317
  */
315
318
  deleteDataById(id) {
316
- return __awaiter(this, void 0, void 0, function* () {
319
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
317
320
  yield this.dataModel.findByIdAndDelete(id).catch(error => {
318
- throw new DynamoBEError({ status: 417, message: `delete ${this.dataName} was unsuccessful (DB)`, error });
321
+ throw new dynamobe_error_1.DynamoBEError({ status: 417, message: `delete ${this.dataName} was unsuccessful (DB)`, error });
319
322
  });
320
323
  });
321
324
  }
@@ -324,14 +327,14 @@ export class DynamoBEDBService {
324
327
  * @param dependencyId id
325
328
  */
326
329
  deleteDataByDependencyId(dependencyId) {
327
- return __awaiter(this, void 0, void 0, function* () {
330
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
328
331
  if (this.depDataKey) {
329
332
  yield this.dataModel.deleteMany({ [this.depDataKey]: dependencyId }).catch(error => {
330
- throw new DynamoBEError({ status: 417, message: `delete ${this.dataName} by ${this.depDataKey} was unsuccessful (DB)`, error });
333
+ throw new dynamobe_error_1.DynamoBEError({ status: 417, message: `delete ${this.dataName} by ${this.depDataKey} was unsuccessful (DB)`, error });
331
334
  });
332
335
  }
333
336
  else {
334
- throw new DynamoBEError({ status: 501, message: `dependencyDataIdKey not setted up for this db-service (${this.dataName}) (BD)` });
337
+ throw new dynamobe_error_1.DynamoBEError({ status: 501, message: `dependencyDataIdKey not setted up for this db-service (${this.dataName}) (BD)` });
335
338
  }
336
339
  });
337
340
  }
@@ -345,7 +348,7 @@ export class DynamoBEDBService {
345
348
  * @returns data
346
349
  */
347
350
  findOne(filter) {
348
- return __awaiter(this, void 0, void 0, function* () {
351
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
349
352
  let data;
350
353
  yield this.dataModel.findOne(filter).then(res => {
351
354
  if (res) {
@@ -355,7 +358,7 @@ export class DynamoBEDBService {
355
358
  data = null;
356
359
  }
357
360
  }).catch(error => {
358
- throw new DynamoBEError({ status: 417, message: `findOne ${this.dataName} was unsuccessful (DB)`, error });
361
+ throw new dynamobe_error_1.DynamoBEError({ status: 417, message: `findOne ${this.dataName} was unsuccessful (DB)`, error });
359
362
  });
360
363
  if (data && typeof data._id === 'object') {
361
364
  data._id = `${data._id}`;
@@ -369,14 +372,14 @@ export class DynamoBEDBService {
369
372
  * @returns dataList
370
373
  */
371
374
  find(filter) {
372
- return __awaiter(this, void 0, void 0, function* () {
375
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
373
376
  let dataList = [];
374
377
  yield this.dataModel.find(filter).then(res => {
375
378
  if (res) {
376
379
  dataList = res;
377
380
  }
378
381
  }).catch(error => {
379
- throw new DynamoBEError({ status: 417, message: `find ${this.dataName} was unsuccessful (DB)`, error });
382
+ throw new dynamobe_error_1.DynamoBEError({ status: 417, message: `find ${this.dataName} was unsuccessful (DB)`, error });
380
383
  });
381
384
  if (0 < dataList.length && typeof dataList[0]._id === 'object') {
382
385
  dataList.forEach((data) => {
@@ -395,7 +398,7 @@ export class DynamoBEDBService {
395
398
  * @returns dataList
396
399
  */
397
400
  findWithPaging(filter, page, pageSize, sort) {
398
- return __awaiter(this, void 0, void 0, function* () {
401
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
399
402
  let dataList = [];
400
403
  yield this.dataModel.find(filter)
401
404
  .sort(sort)
@@ -406,7 +409,7 @@ export class DynamoBEDBService {
406
409
  dataList = res;
407
410
  }
408
411
  }).catch(error => {
409
- throw new DynamoBEError({ status: 417, message: `findWithPaging ${this.dataName} was unsuccessful (DB)`, error });
412
+ throw new dynamobe_error_1.DynamoBEError({ status: 417, message: `findWithPaging ${this.dataName} was unsuccessful (DB)`, error });
410
413
  });
411
414
  if (0 < dataList.length && typeof dataList[0]._id === 'object') {
412
415
  dataList.forEach((data) => {
@@ -423,7 +426,7 @@ export class DynamoBEDBService {
423
426
  * @returns data
424
427
  */
425
428
  findByIdAndUpdate(id, update, modifier) {
426
- return __awaiter(this, void 0, void 0, function* () {
429
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
427
430
  let data;
428
431
  update.__lastModified = new Date();
429
432
  update.__lastModifiedBy = modifier;
@@ -432,10 +435,10 @@ export class DynamoBEDBService {
432
435
  data = res.toObject();
433
436
  }
434
437
  else {
435
- throw new DynamoBEError({ status: 204, message: `${this.dataName} not found! (BD)` });
438
+ throw new dynamobe_error_1.DynamoBEError({ status: 204, message: `${this.dataName} not found! (BD)` });
436
439
  }
437
440
  }).catch(error => {
438
- throw new DynamoBEError({ status: 417, message: `findByIdAndUpdate ${this.dataName} was unsuccessful (DB)`, error });
441
+ throw new dynamobe_error_1.DynamoBEError({ status: 417, message: `findByIdAndUpdate ${this.dataName} was unsuccessful (DB)`, error });
439
442
  });
440
443
  update.__v = data.__v;
441
444
  return update;
@@ -447,11 +450,11 @@ export class DynamoBEDBService {
447
450
  * @param update etc.: { $inc: { popularity: this.newVote.amount }, emailVerified: true }
448
451
  */
449
452
  updateOne(updateBy, update, modifier) {
450
- return __awaiter(this, void 0, void 0, function* () {
453
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
451
454
  update.__lastModified = new Date();
452
455
  update.__lastModifiedBy = modifier;
453
456
  yield this.dataModel.updateOne(updateBy, update).catch(error => {
454
- throw new DynamoBEError({ status: 417, message: `updateOne ${this.dataName} was unsuccessful (DB)`, error });
457
+ throw new dynamobe_error_1.DynamoBEError({ status: 417, message: `updateOne ${this.dataName} was unsuccessful (DB)`, error });
455
458
  });
456
459
  });
457
460
  }
@@ -461,11 +464,11 @@ export class DynamoBEDBService {
461
464
  * @param update etc.: { $inc: { popularity: this.newVote.amount }, emailVerified: true, reactions: { $push: this.newReaction } }
462
465
  */
463
466
  updateMany(updateBy, update, modifier) {
464
- return __awaiter(this, void 0, void 0, function* () {
467
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
465
468
  update.__lastModified = new Date();
466
469
  update.__lastModifiedBy = modifier;
467
470
  yield this.dataModel.updateMany(updateBy, update).catch(error => {
468
- throw new DynamoBEError({ status: 417, message: `updateMany ${this.dataName} was unsuccessful (DB)`, error });
471
+ throw new dynamobe_error_1.DynamoBEError({ status: 417, message: `updateMany ${this.dataName} was unsuccessful (DB)`, error });
469
472
  });
470
473
  });
471
474
  }
@@ -485,7 +488,7 @@ export class DynamoBEDBService {
485
488
  // tslint:disable-next-line: no-string-literal
486
489
  delete schema['_id'];
487
490
  }
488
- return new Schema(schema);
491
+ return new mongoose_1.Schema(schema);
489
492
  }
490
493
  /**
491
494
  * builds mongoose schema building settings object by dynamoDataModelParamsList
@@ -571,4 +574,4 @@ export class DynamoBEDBService {
571
574
  }
572
575
  }
573
576
  }
574
- //# sourceMappingURL=dynamobe-db.service.js.map
577
+ exports.DynamoBEDBService = DynamoBEDBService;
@@ -1,4 +1,7 @@
1
- import { DynamoBESingletonService } from './dynamobe-singleton.service';
2
- export class DynamoBEEmailServiceCollection extends DynamoBESingletonService {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DynamoBEEmailServiceCollection = void 0;
4
+ const dynamobe_singleton_service_1 = require("./dynamobe-singleton.service");
5
+ class DynamoBEEmailServiceCollection extends dynamobe_singleton_service_1.DynamoBESingletonService {
3
6
  }
4
- //# sourceMappingURL=dynamobe-email-service-collection.service.js.map
7
+ exports.DynamoBEEmailServiceCollection = DynamoBEEmailServiceCollection;
@@ -1,10 +1,13 @@
1
- import { __awaiter } from "tslib";
2
- import * as FileSystem from 'fs';
3
- import * as Path from 'path';
4
- import * as NodeMailer from 'nodemailer';
5
- import { DynamoBEError } from '../_models/fullstack-models/control-models/dynamobe-error';
6
- import { DBE_Shared } from './dynamobe-shared.service';
7
- export class DynamoBEEmailService {
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 dynamobe_error_1 = require("../_models/fullstack-models/control-models/dynamobe-error");
9
+ const dynamobe_shared_service_1 = require("./dynamobe-shared.service");
10
+ class DynamoBEEmailService {
8
11
  constructor(set) {
9
12
  this.templates = {};
10
13
  this.templatePropertyKeys = {};
@@ -36,10 +39,10 @@ export class DynamoBEEmailService {
36
39
  }
37
40
  }
38
41
  constructionFinished() {
39
- DBE_Shared.logSuccess(`\n${this.senderName} EmailService construction finished\n`);
42
+ dynamobe_shared_service_1.DBE_Shared.logSuccess(`\n${this.senderName} EmailService construction finished\n`);
40
43
  }
41
44
  sendEmail(set) {
42
- return __awaiter(this, void 0, void 0, function* () {
45
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
43
46
  try {
44
47
  let content;
45
48
  if (set.content) {
@@ -47,12 +50,12 @@ export class DynamoBEEmailService {
47
50
  }
48
51
  else if (set.useTemplate) {
49
52
  if (!this.templates[set.useTemplate]) {
50
- throw new DynamoBEError({ message: `no template found with this parameter! (${set.useTemplate})` });
53
+ throw new dynamobe_error_1.DynamoBEError({ message: `no template found with this parameter! (${set.useTemplate})` });
51
54
  }
52
55
  content = this.templates[set.useTemplate];
53
56
  if (this.templatePropertyKeys[set.useTemplate].length > 0) {
54
57
  if (!set.templateProperties) {
55
- throw new DynamoBEError({ message: `templateProperties missing!` });
58
+ throw new dynamobe_error_1.DynamoBEError({ message: `templateProperties missing!` });
56
59
  }
57
60
  this.templatePropertyKeys[set.useTemplate].forEach((propertyKey) => {
58
61
  if (!set.templateProperties[propertyKey]) {
@@ -64,7 +67,7 @@ export class DynamoBEEmailService {
64
67
  }
65
68
  }
66
69
  else {
67
- throw new DynamoBEError({ message: 'no content setting passsed to emailSending!' });
70
+ throw new dynamobe_error_1.DynamoBEError({ message: 'no content setting passsed to emailSending!' });
68
71
  }
69
72
  let mailOptions = {
70
73
  from: this.senderNEmail,
@@ -85,7 +88,7 @@ export class DynamoBEEmailService {
85
88
  });
86
89
  }
87
90
  loadTemplate(templateName, rootPath, templatePath) {
88
- return __awaiter(this, void 0, void 0, function* () {
91
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
89
92
  try {
90
93
  this.templateLoadingInProgressCounter++;
91
94
  return new Promise((resolve, reject) => {
@@ -121,7 +124,7 @@ export class DynamoBEEmailService {
121
124
  while (propertyOpenTagIndex >= 0) {
122
125
  if (propertyCloseTagIndex === -1) {
123
126
  console.log(`\nDynamoBEEmailService ERROR, missing closing tag from email template! (${propertyOpenTagIndex} -)`, propertyKeys);
124
- throw new DynamoBEError({ message: `ERROR, missing closing tag from email template! (${propertyOpenTagIndex} -)` });
127
+ throw new dynamobe_error_1.DynamoBEError({ message: `ERROR, missing closing tag from email template! (${propertyOpenTagIndex} -)` });
125
128
  }
126
129
  const newKey = template.substring(propertyOpenTagIndex + 2, propertyCloseTagIndex);
127
130
  if (!propertyKeys.includes(newKey)) {
@@ -138,4 +141,4 @@ export class DynamoBEEmailService {
138
141
  }
139
142
  }
140
143
  }
141
- //# sourceMappingURL=dynamobe-email.service.js.map
144
+ exports.DynamoBEEmailService = DynamoBEEmailService;