@futdevpro/nts-dynamo 1.11.36 → 1.11.38

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/.github/workflows/main.yml +22 -20
  2. package/build/_modules/discord-assistant-voiced/index.js +15 -12
  3. package/build/_modules/discord-assistant-voiced/index.js.map +1 -1
  4. package/build/_modules/discord-bot/index.js +7 -6
  5. package/build/_modules/discord-bot/index.js.map +1 -1
  6. package/build/_modules/oauth2/index.js +7 -6
  7. package/build/_modules/oauth2/index.js.map +1 -1
  8. package/build/_modules/open-ai/_services/oai-llm-chat.service-base.d.ts +0 -15
  9. package/build/_modules/open-ai/_services/oai-llm-chat.service-base.d.ts.map +1 -1
  10. package/build/_modules/open-ai/_services/oai-llm-chat.service-base.js +32 -17
  11. package/build/_modules/open-ai/_services/oai-llm-chat.service-base.js.map +1 -1
  12. package/build/_modules/open-ai/_services/oai-llm.service-base.d.ts +0 -139
  13. package/build/_modules/open-ai/_services/oai-llm.service-base.d.ts.map +1 -1
  14. package/build/_modules/open-ai/_services/oai-llm.service-base.js +16 -16
  15. package/build/_modules/open-ai/_services/oai-llm.service-base.js.map +1 -1
  16. package/build/_modules/open-ai/_services/oai-vector-data.service.d.ts +2 -2
  17. package/build/_modules/open-ai/_services/oai-vector-data.service.d.ts.map +1 -1
  18. package/build/_modules/open-ai/_services/oai-vector-data.service.js.map +1 -1
  19. package/build/_modules/open-ai/index.js +7 -6
  20. package/build/_modules/open-ai/index.js.map +1 -1
  21. package/build/_modules/socket/index.js +15 -12
  22. package/build/_modules/socket/index.js.map +1 -1
  23. package/build/_services/base/data.service.d.ts +5 -3
  24. package/build/_services/base/data.service.d.ts.map +1 -1
  25. package/build/_services/base/data.service.js +162 -30
  26. package/build/_services/base/data.service.js.map +1 -1
  27. package/build/_services/base/db.service.d.ts.map +1 -1
  28. package/build/_services/base/db.service.js +68 -21
  29. package/build/_services/base/db.service.js.map +1 -1
  30. package/build/_services/route/routing-module.service.d.ts.map +1 -1
  31. package/build/_services/route/routing-module.service.js +2 -1
  32. package/build/_services/route/routing-module.service.js.map +1 -1
  33. package/build/_services/server/app.server.d.ts.map +1 -1
  34. package/build/_services/server/app.server.js +25 -15
  35. package/build/_services/server/app.server.js.map +1 -1
  36. package/package.json +3 -3
  37. package/src/_modules/discord-assistant-voiced/index.ts +2 -2
  38. package/src/_modules/discord-bot/index.ts +2 -2
  39. package/src/_modules/oauth2/index.ts +2 -2
  40. package/src/_modules/open-ai/_services/oai-llm-chat.service-base.ts +31 -17
  41. package/src/_modules/open-ai/_services/oai-llm.service-base.ts +16 -16
  42. package/src/_modules/open-ai/_services/oai-vector-data.service.ts +13 -13
  43. package/src/_modules/open-ai/index.ts +2 -2
  44. package/src/_modules/socket/index.ts +2 -2
  45. package/src/_services/base/data.service.ts +265 -70
  46. package/src/_services/base/db.service.ts +74 -16
  47. package/src/_services/route/routing-module.service.ts +2 -1
  48. package/src/_services/server/app.server.ts +6 -4
@@ -3,8 +3,8 @@ import {
3
3
  DyFM_AnyError,
4
4
  DyFM_Array,
5
5
  DyFM_BasicProperty_Type,
6
- DyFM_Data_Params,
7
6
  DyFM_DataModel_Params,
7
+ DyFM_DataProperties,
8
8
  DyFM_DataProperty_Params,
9
9
  DyFM_DBFilter,
10
10
  DyFM_DBĐNestedPropertySort,
@@ -91,7 +91,7 @@ export class DyNTS_DataService<T extends DyFM_Metadata> {
91
91
  * DB data prams will be used to connect to usable dbService on GlobalService
92
92
  */
93
93
  /* dataParams: DyFM_DataModel_Params, */
94
- public dataParams: DyFM_Data_Params<T>,
94
+ public dataParams: DyFM_DataModel_Params<T>,
95
95
  /**
96
96
  * Initial set for issuer to be able to follow the issuer's activity
97
97
  */
@@ -291,6 +291,12 @@ export class DyNTS_DataService<T extends DyFM_Metadata> {
291
291
  dependencyIds?: string | { [key: string]: string }
292
292
  ): { [key: string]: string } {
293
293
  if (!this.depSettings.length) {
294
+ DyFM_Log.warn(
295
+ `❌ getDataByDependencyId failed, dependencyKey is missing from service! ` +
296
+ `(${this.dataParams.dataName})` +
297
+ `\n 📍 ${this.dataParams.stackLocation}`
298
+ );
299
+
294
300
  throw new DyFM_Error({
295
301
  ...this._getDefaultErrorSettings(
296
302
  'getDataByDependencyId',
@@ -1174,87 +1180,276 @@ export class DyNTS_DataService<T extends DyFM_Metadata> {
1174
1180
  try {
1175
1181
  data = this.ensureData(data);
1176
1182
 
1177
- Object.values(this.dataParams.properties).forEach(
1178
- (element: DyFM_DataProperty_Params<any>) => {
1179
- // basic required validations
1180
- if (
1181
- (
1182
- element.required ||
1183
- element.index
1184
- ) && (
1185
- data[element.key] === null ||
1186
- data[element.key] === undefined
1187
- )
1188
- ) {
1189
- throw new DyFM_Error({
1190
- ...this._getDefaultErrorSettings(
1191
- 'validateForSave',
1192
- new Error(
1193
- `validateForSave failed, "${element.key}" is missing! ` +
1194
- `(index or required in "${this.dataParams.dataName}" dataParams) `
1195
- )
1196
- ),
1197
-
1198
- status: 522,
1199
- errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DS0-VD1`,
1200
- userMessage: this.defaultValidationErrorUserMsg,
1201
- __localStack: this.dataParams.stackLocation,
1202
- additionalContent: {
1203
- data: data,
1204
- },
1205
- });
1206
- }
1207
-
1208
- // specific Date validation
1209
- if (element.type === 'Date' &&
1210
- !(new Date(data[element.key]) instanceof Date)
1211
- ) {
1212
- throw new DyFM_Error({
1213
- ...this._getDefaultErrorSettings(
1214
- 'validateForSave',
1215
- new Error(
1216
- `validateForSave failed, "${element.key}" is not a date! ` +
1217
- `(${this.dataParams.dataName})`
1218
- )
1219
- ),
1183
+ await this.validateDataByPropertyParams(data, this.dataParams.properties);
1184
+ } catch (error) {
1185
+ if (error?.errorCode?.includes?.('DyNTS-DS0-VBP') || error?.errorCode?.includes?.('DyNTS-DS0-VP')) {
1186
+ throw error;
1187
+ } else {
1188
+ throw new DyFM_Error({
1189
+ ...this._getDefaultErrorSettings('validateForSave', error),
1220
1190
 
1221
- status: 522,
1222
- errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DS0-VD2`,
1223
- userMessage: this.defaultValidationErrorUserMsg,
1224
- __localStack: this.dataParams.stackLocation,
1225
- additionalContent: {
1226
- data: data,
1227
- },
1228
- });
1229
- }
1191
+ status: 522,
1192
+ errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DS0-VD0`,
1193
+ });
1194
+ }
1195
+ }
1196
+ }
1230
1197
 
1231
- // call additional validators
1232
- if (element.additionalValidators) {
1233
- for (let j = 0; j < element.additionalValidators.length; j++) {
1234
- element.additionalValidators[j](
1235
- data[element.key]
1236
- );
1237
- }
1238
- }
1198
+ private validateDataByPropertyParams(
1199
+ data: T,
1200
+ properties: DyFM_DataProperties<T>,
1201
+ isSubObjectOf?: DyFM_DataProperty_Params<any, T>
1202
+ ): void {
1203
+ try {
1204
+ Object.values(properties).forEach(
1205
+ (propertyParams: DyFM_DataProperty_Params<any, T>) => {
1206
+ this.validateProperty(data, data[propertyParams.key], propertyParams, isSubObjectOf);
1239
1207
  }
1240
1208
  );
1241
1209
  } catch (error) {
1242
- if ([
1243
- `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DS0-VD1`,
1244
- `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DS0-VD2`
1245
- ].includes(error?.errorCode)) {
1210
+ if (error?.errorCode?.includes?.('DyNTS-DS0-VP')) {
1246
1211
  throw error;
1247
1212
  } else {
1248
1213
  throw new DyFM_Error({
1249
- ...this._getDefaultErrorSettings('validateForSave', error),
1214
+ ...this._getDefaultErrorSettings('validateByPropertyParams', error),
1250
1215
 
1251
1216
  status: 522,
1252
- errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DS0-VD0`,
1217
+ errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DS0-VP0`,
1253
1218
  });
1254
1219
  }
1255
1220
  }
1256
1221
  }
1257
1222
 
1223
+ private validateProperty(
1224
+ data: T,
1225
+ propertyValue: any,
1226
+ propertyParams: DyFM_DataProperty_Params<any, T>,
1227
+ isSubObjectOf?: DyFM_DataProperty_Params<any, T>
1228
+ ): void {
1229
+
1230
+ // basic required validations
1231
+ if (
1232
+ (
1233
+ propertyParams.required ||
1234
+ propertyParams.index
1235
+ ) && (
1236
+ propertyValue === null ||
1237
+ propertyValue === undefined
1238
+ )
1239
+ ) {
1240
+ throw new DyFM_Error({
1241
+ ...this._getDefaultErrorSettings(
1242
+ 'validateProperty',
1243
+ new Error(
1244
+ `validateProperty failed, "${propertyParams.key}" is missing! ` +
1245
+ `(index or required in "${this.dataParams.dataName}" dataParams) `
1246
+ )
1247
+ ),
1248
+
1249
+ status: 522,
1250
+ errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DS0-VP1`,
1251
+ userMessage: this.defaultValidationErrorUserMsg,
1252
+ __localStack: this.dataParams.stackLocation,
1253
+ additionalContent: {
1254
+ data: data,
1255
+ },
1256
+ });
1257
+ }
1258
+
1259
+ // specific Date validation
1260
+ switch (propertyParams.type) {
1261
+ case DyFM_BasicProperty_Type.date:
1262
+ const date = new Date(propertyValue);
1263
+ if (
1264
+ !(date instanceof Date) ||
1265
+ date.toString() === 'Invalid Date' ||
1266
+ (propertyParams.required &&
1267
+ (isNaN(date.getTime()) ||
1268
+ date.toString() === new Date(0).toString()))
1269
+ ) {
1270
+ throw new DyFM_Error({
1271
+ ...this._getDefaultErrorSettings(
1272
+ 'validateProperty',
1273
+ new Error(
1274
+ `validateProperty failed, "${propertyParams.key}" is not a valid date! ` +
1275
+ `(${this.dataParams.dataName})`
1276
+ )
1277
+ ),
1278
+
1279
+ status: 522,
1280
+ errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DS0-VP2`,
1281
+ userMessage: this.defaultValidationErrorUserMsg,
1282
+ __localStack: this.dataParams.stackLocation,
1283
+ additionalContent: {
1284
+ data: data,
1285
+ },
1286
+ });
1287
+ }
1288
+ break;
1289
+
1290
+ case DyFM_BasicProperty_Type.number:
1291
+ if (propertyParams.required && isNaN(propertyValue)) {
1292
+ throw new DyFM_Error({
1293
+ ...this._getDefaultErrorSettings(
1294
+ 'validateProperty',
1295
+ new Error(
1296
+ `validateProperty failed, "${propertyParams.key}" is not a valid number! ` +
1297
+ `(${this.dataParams.dataName})`
1298
+ )
1299
+ ),
1300
+
1301
+ status: 522,
1302
+ errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DS0-VP3`,
1303
+ userMessage: this.defaultValidationErrorUserMsg,
1304
+ __localStack: this.dataParams.stackLocation,
1305
+ additionalContent: {
1306
+ data: data,
1307
+ },
1308
+ });
1309
+ }
1310
+ break;
1311
+
1312
+ case DyFM_BasicProperty_Type.string:
1313
+ if (propertyParams.required && typeof propertyValue !== 'string') {
1314
+ throw new DyFM_Error({
1315
+ ...this._getDefaultErrorSettings(
1316
+ 'validateProperty',
1317
+ new Error(
1318
+ `validateProperty failed, "${propertyParams.key}" is not a valid string! ` +
1319
+ `(${this.dataParams.dataName})`
1320
+ )
1321
+ ),
1322
+
1323
+ status: 522,
1324
+ errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DS0-VP4`,
1325
+ userMessage: this.defaultValidationErrorUserMsg,
1326
+ __localStack: this.dataParams.stackLocation,
1327
+ additionalContent: {
1328
+ data: data,
1329
+ },
1330
+ });
1331
+ }
1332
+ break;
1333
+
1334
+ case DyFM_BasicProperty_Type.boolean:
1335
+ if (propertyParams.required && typeof propertyValue !== 'boolean') {
1336
+ throw new DyFM_Error({
1337
+ ...this._getDefaultErrorSettings(
1338
+ 'validateProperty',
1339
+ new Error(
1340
+ `validateProperty failed, "${propertyParams.key}" is not a valid boolean! ` +
1341
+ `(${this.dataParams.dataName})`
1342
+ )
1343
+ ),
1344
+
1345
+ status: 522,
1346
+ errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DS0-VP5`,
1347
+ userMessage: this.defaultValidationErrorUserMsg,
1348
+ __localStack: this.dataParams.stackLocation,
1349
+ });
1350
+ }
1351
+ break;
1352
+
1353
+ case DyFM_BasicProperty_Type.object:
1354
+ if (propertyParams.required && typeof propertyValue !== 'object') {
1355
+ throw new DyFM_Error({
1356
+ ...this._getDefaultErrorSettings(
1357
+ 'validateProperty',
1358
+ new Error(
1359
+ `validateProperty failed, "${propertyParams.key}" is not a valid object! ` +
1360
+ `(${this.dataParams.dataName})`
1361
+ )
1362
+ ),
1363
+
1364
+ status: 522,
1365
+ errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DS0-VD6`,
1366
+ userMessage: this.defaultValidationErrorUserMsg,
1367
+ __localStack: this.dataParams.stackLocation,
1368
+ });
1369
+ }
1370
+
1371
+ if (propertyParams.subObjectParams) {
1372
+ this.validateDataByPropertyParams(propertyValue, propertyParams.subObjectParams, propertyParams);
1373
+ }
1374
+ break;
1375
+
1376
+ case DyFM_BasicProperty_Type.array:
1377
+ if (propertyParams.required && !Array.isArray(propertyValue)) {
1378
+ throw new DyFM_Error({
1379
+ ...this._getDefaultErrorSettings(
1380
+ 'validateProperty',
1381
+ new Error(
1382
+ `validateProperty failed, "${propertyParams.key}" is not a valid array! ` +
1383
+ `(${this.dataParams.dataName})`
1384
+ )
1385
+ ),
1386
+
1387
+ status: 522,
1388
+ errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DS0-VP6`,
1389
+ userMessage: this.defaultValidationErrorUserMsg,
1390
+ __localStack: this.dataParams.stackLocation,
1391
+ });
1392
+ }
1393
+
1394
+ if (propertyParams.subObjectParams) {
1395
+ propertyValue.forEach((item: any): void => {
1396
+ this.validateDataByPropertyParams(item, propertyParams.subObjectParams, propertyParams);
1397
+ });
1398
+ }
1399
+ break;
1400
+
1401
+ case DyFM_BasicProperty_Type.function:
1402
+ DyFM_Log.warn(
1403
+ 'validateProperty: function type is not supported yet! ' +
1404
+ '(it will be skipped, but you still can use it in additionalValidators)'
1405
+ );
1406
+ /* if (propertyParams.required && typeof propertyValue !== 'function') {
1407
+ throw new DyFM_Error({
1408
+ ...this._getDefaultErrorSettings(
1409
+ 'validateProperty',
1410
+ new Error(
1411
+ `validateProperty failed, "${propertyParams.key}" is not a valid function! ` +
1412
+ `(${this.dataParams.dataName})`
1413
+ )
1414
+ ),
1415
+
1416
+ status: 522,
1417
+ errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DS0-VP7`,
1418
+ userMessage: this.defaultValidationErrorUserMsg,
1419
+ __localStack: this.dataParams.stackLocation,
1420
+ });
1421
+ } */
1422
+ break;
1423
+
1424
+ default:
1425
+ throw new DyFM_Error({
1426
+ ...this._getDefaultErrorSettings(
1427
+ 'validateProperty',
1428
+ new Error(
1429
+ `validateProperty failed, "${propertyParams.key}" is not a valid property type! ` +
1430
+ `(type: ${propertyParams.type}, nonBasicType: ${propertyParams.nonBasicType}) ` +
1431
+ `(${this.dataParams.dataName})`
1432
+ )
1433
+ ),
1434
+
1435
+ status: 522,
1436
+ errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DS0-VP8`,
1437
+ userMessage: this.defaultValidationErrorUserMsg,
1438
+ __localStack: this.dataParams.stackLocation,
1439
+ });
1440
+ }
1441
+
1442
+ // call additional validators
1443
+ if (propertyParams.additionalValidators) {
1444
+ for (let j = 0; j < propertyParams.additionalValidators.length; j++) {
1445
+ propertyParams.additionalValidators[j](
1446
+ propertyValue,
1447
+ data
1448
+ );
1449
+ }
1450
+ }
1451
+ }
1452
+
1258
1453
  async searchData(query?: DyFM_SearchQuery<T>, dataList?: T[]): Promise<DyFM_SearchResult<T>> {
1259
1454
  try {
1260
1455
  const searchResult = await this.sortAndFilterDataList(query, dataList);
@@ -1900,9 +2095,9 @@ export class DyNTS_DataService<T extends DyFM_Metadata> {
1900
2095
  * setting up dependency dataHook by DynamoBEDataModelParams
1901
2096
  */
1902
2097
  private lookForDependencyDataSettings(): void {
1903
- const dependencyParams: DyFM_DataProperty_Params<any>[] =
2098
+ const dependencyParams: DyFM_DataProperty_Params<any, T>[] =
1904
2099
  Object.values(this.dataParams.properties).filter(
1905
- (modelParams: DyFM_DataProperty_Params<any>): boolean =>
2100
+ (modelParams: DyFM_DataProperty_Params<any, T>): boolean =>
1906
2101
  Boolean(modelParams.dependencyDataName)
1907
2102
  );
1908
2103
 
@@ -4,6 +4,7 @@ import { Schema } from 'mongoose';
4
4
 
5
5
  import {
6
6
  DyFM_AnyError,
7
+ DyFM_BasicProperty_Type,
7
8
  DyFM_DataModel_Params,
8
9
  DyFM_DataProperties,
9
10
  DyFM_DataProperty_Params,
@@ -11,7 +12,8 @@ import {
11
12
  DyFM_Error,
12
13
  DyFM_Error_Settings, DyFM_ErrorLevel,
13
14
  DyFM_Log,
14
- DyFM_Metadata
15
+ DyFM_Metadata,
16
+ DyFM_Object
15
17
  } from '@futdevpro/fsm-dynamo';
16
18
  import { DyNTS_archiveSuffix } from '../../_collections/archive.util';
17
19
  import { DyNTS_DBUpdate } from '../../_models/types/db-update.type';
@@ -51,6 +53,18 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
51
53
  );
52
54
  }
53
55
 
56
+ if (!this.dataParams.constructed?.()) {
57
+ throw new DyFM_Error({
58
+ error: new Error(
59
+ `DataModelParams is not constructed properly! (${this.dataParams.dataName}) ` +
60
+ `Use the DyFM_DataModel_Params.constructor to construct it properly! (NTS DB)`
61
+ ),
62
+ errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DBS-C01`,
63
+ additionalContent: { dataParams: this.dataParams },
64
+ __localStack: this.dataParams.stackLocation,
65
+ });
66
+ }
67
+
54
68
  try {
55
69
  this.dataModel = mongoose.model(this.dataParams.dataName, this.getSchema());
56
70
  } catch (error) {
@@ -644,7 +658,7 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
644
658
  }
645
659
 
646
660
  Object.values(this.dataParams.properties).forEach(
647
- (modelParam: DyFM_DataProperty_Params<any>): void => {
661
+ (modelParam: DyFM_DataProperty_Params<any, T>): void => {
648
662
  if (
649
663
  (filterBy[modelParam.key] !== null && filterBy[modelParam.key] !== undefined) ||
650
664
  filterBy[modelParam.key + 'Range']
@@ -1215,7 +1229,7 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
1215
1229
  properties = this.dataParams.properties;
1216
1230
  } */
1217
1231
 
1218
- Object.values(properties).forEach((property: DyFM_DataProperty_Params<any>): void => {
1232
+ Object.values(properties).forEach((property: DyFM_DataProperty_Params<any, T>): void => {
1219
1233
  if (!property) {
1220
1234
  DyFM_Log.warn(`property is undefined on ${this.dataParams.dataName} (NTS DB)`);
1221
1235
 
@@ -1239,7 +1253,7 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
1239
1253
  });
1240
1254
  }
1241
1255
 
1242
- const beType = this.getBEType(property.type);
1256
+ const beType = this.getBEType(property.type as DyFM_BasicProperty_Type);
1243
1257
 
1244
1258
  /* TODO if (beType === Array && property.archiveable && !property.archiveListAfter) {
1245
1259
  property.archiveListAfter = DyNTS_global_settings.archiveListAfter;
@@ -1285,24 +1299,68 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
1285
1299
  }
1286
1300
 
1287
1301
  private getBEType(
1288
- type: string
1302
+ type: DyFM_BasicProperty_Type
1289
1303
  ): string | number | boolean | object | Function | Array<any> | Date {
1290
- switch (type.toLocaleLowerCase()) {
1304
+ switch (type) {
1305
+ case DyFM_BasicProperty_Type.string:
1306
+ return String;
1291
1307
 
1308
+ case DyFM_BasicProperty_Type.number:
1309
+ return Number;
1310
+
1311
+ case DyFM_BasicProperty_Type.boolean:
1312
+ return Boolean;
1313
+
1314
+ case DyFM_BasicProperty_Type.date:
1315
+ return Date;
1316
+
1317
+ case DyFM_BasicProperty_Type.object:
1318
+ return Object;
1319
+
1320
+ case DyFM_BasicProperty_Type.array:
1321
+ return Array;
1322
+
1323
+ case DyFM_BasicProperty_Type.function:
1324
+ return Function;
1325
+
1326
+ default:
1327
+ DyFM_Log.H_info('wtf', DyFM_Object.cleanObject(this.dataParams));
1328
+
1329
+ throw new DyFM_Error({
1330
+ error: new Error(
1331
+ `Invalid property type: ${type} (${this.dataParams.dataName})` +
1332
+ (this.dataParams.constructed?.() ? '' : ('\nThe dataParams is not constructed properly! \n' +
1333
+ 'Use the DyFM_DataModel_Params.constructor to construct it properly!'))
1334
+ ),
1335
+ errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DBS-GTP0`,
1336
+ additionalContent: { type: type, dataParams: this.dataParams },
1337
+ __localStack: this.dataParams.stackLocation,
1338
+ });
1339
+ }
1340
+ /* switch (type.toLocaleLowerCase()) {
1341
+ case DyFM_BasicProperty_Type.string:
1292
1342
  case 'string':
1293
1343
  return String;
1294
1344
 
1345
+ case DyFM_BasicProperty_Type.number:
1295
1346
  case 'number':
1296
1347
  return Number;
1297
1348
 
1349
+ case DyFM_BasicProperty_Type.boolean:
1298
1350
  case 'boolean':
1299
1351
  return Boolean;
1300
1352
 
1353
+ case DyFM_BasicProperty_Type.date:
1301
1354
  case 'date':
1302
1355
  return Date;
1303
1356
 
1357
+ case DyFM_BasicProperty_Type.object:
1304
1358
  case 'object':
1305
1359
  return Object;
1360
+
1361
+ case DyFM_BasicProperty_Type.array:
1362
+ case 'array':
1363
+ return Array;
1306
1364
 
1307
1365
  default:
1308
1366
  if (type.includes('[]') || type.includes('array')) {
@@ -1312,7 +1370,7 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
1312
1370
  } else {
1313
1371
  return Object;
1314
1372
  }
1315
- }
1373
+ } */
1316
1374
  }
1317
1375
 
1318
1376
  /**
@@ -1341,27 +1399,27 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
1341
1399
  // TOD: ezek a kikommentelt "required: true"-k kellenek, csak félő, hogy gondokat okoznak a
1342
1400
  // jelenlegi rendszerekben, ezért akkor kell majd visszarakni, ha lesz tesztelői ÉS fejlesztői kapacitás rá
1343
1401
  if (!properties.__created) {
1344
- properties.__created = { key: '__created', type: 'Date'/* , required: true */ };
1402
+ properties.__created = { key: '__created', type: DyFM_BasicProperty_Type.date/* , required: true */ };
1345
1403
  }
1346
1404
 
1347
1405
  if (!properties.__createdBy) {
1348
- properties.__createdBy = { key: '__createdBy', type: 'string'/* , required: true */ };
1406
+ properties.__createdBy = { key: '__createdBy', type: DyFM_BasicProperty_Type.string/* , required: true */ };
1349
1407
  }
1350
1408
 
1351
1409
  if (!properties.__lastModified) {
1352
- properties.__lastModified = { key: '__lastModified', type: 'Date'/* , required: true */ };
1410
+ properties.__lastModified = { key: '__lastModified', type: DyFM_BasicProperty_Type.date/* , required: true */ };
1353
1411
  }
1354
1412
 
1355
1413
  if (!properties.__lastModifiedBy) {
1356
- properties.__lastModifiedBy = { key: '__lastModifiedBy', type: 'string'/* , required: true */ };
1414
+ properties.__lastModifiedBy = { key: '__lastModifiedBy', type: DyFM_BasicProperty_Type.string/* , required: true */ };
1357
1415
  }
1358
1416
 
1359
1417
  if (!properties._deleted) {
1360
- properties._deleted = { key: '_deleted', type: 'Date' };
1418
+ properties._deleted = { key: '_deleted', type: DyFM_BasicProperty_Type.date };
1361
1419
  }
1362
1420
 
1363
1421
  if (!properties._deletedBy) {
1364
- properties._deletedBy = { key: '_deletedBy', type: 'string' };
1422
+ properties._deletedBy = { key: '_deletedBy', type: DyFM_BasicProperty_Type.string };
1365
1423
  }
1366
1424
 
1367
1425
  return properties;
@@ -1397,15 +1455,15 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
1397
1455
  * sets depDataKey
1398
1456
  */
1399
1457
  private lookForDependencyDataSettings(): void {
1400
- const dependencyParams: DyFM_DataProperty_Params<any>[] =
1458
+ const dependencyParams: DyFM_DataProperty_Params<any, T>[] =
1401
1459
  Object.values(this.dataParams.properties).filter(
1402
- (modelParams: DyFM_DataProperty_Params<any>): boolean =>
1460
+ (modelParams: DyFM_DataProperty_Params<any, T>): boolean =>
1403
1461
  Boolean(modelParams.dependencyDataName)
1404
1462
  );
1405
1463
 
1406
1464
  if (dependencyParams) {
1407
1465
  this.depKeys.push(...dependencyParams.map(
1408
- (dependencyParam: DyFM_DataProperty_Params<any>): string => dependencyParam.key
1466
+ (dependencyParam: DyFM_DataProperty_Params<any, T>): string => dependencyParam.key
1409
1467
  ));
1410
1468
  }
1411
1469
  }
@@ -93,9 +93,9 @@ export class DyNTS_RoutingModule {
93
93
  /* this.serviceName = set.route.replace('/', '') + 'RoutingModule'; */
94
94
  this.route = DyNTS_global_settings.baseUrl + set.route;
95
95
  this.controllers = set.controllers ?? [];
96
+ this.stackLocation = DyFM_getConstructionStackLocation();
96
97
  this.setupRoutes();
97
98
  this.mountRoutes(set.securityOverride);
98
- this.stackLocation = DyFM_getConstructionStackLocation();
99
99
 
100
100
  if (this.logSetup) console.log(
101
101
  `routing module setup done: ${this.route} security: ${this.security}\n`
@@ -125,6 +125,7 @@ export class DyNTS_RoutingModule {
125
125
 
126
126
  message: `Routing module setup failed (${this.route}).`,
127
127
  errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-RMS-000`,
128
+ __localStack: this.stackLocation,
128
129
  additionalContent: set,
129
130
  });
130
131
  }
@@ -336,14 +336,15 @@ export abstract class DyNTS_App extends DyNTS_SingletonService {
336
336
  if (error instanceof DyFM_Error) {
337
337
  if (error.additionalContent?.constructErrors?.length) {
338
338
  error.additionalContent.constructErrors.forEach((errorItem: DyFM_Error): void => {
339
- if (errorItem instanceof DyFM_Error) {
339
+ DyFM_Error.logSimple('(constructor asyncConstruct.catch) error:', errorItem);
340
+ /* if (errorItem instanceof DyFM_Error) {
340
341
  errorItem.logSimple(`(constructor asyncConstruct.catch) error:\n`);
341
342
  } else {
342
343
  DyFM_Log.H_warn(
343
344
  '(constructor asyncConstruct.catch) additional error content:\n',
344
345
  errorItem
345
346
  );
346
- }
347
+ } */
347
348
  });
348
349
  } else {
349
350
  DyFM_Log.H_warn(
@@ -353,7 +354,8 @@ export abstract class DyNTS_App extends DyNTS_SingletonService {
353
354
  }
354
355
  }
355
356
 
356
- if (
357
+ DyFM_Error.logSimple('(constructor asyncConstruct.catch) error:', error);
358
+ /* if (
357
359
  !DyNTS_global_settings.log_settings.highDetailedLogs &&
358
360
  (error instanceof DyFM_Error)
359
361
  ) {
@@ -367,7 +369,7 @@ export abstract class DyNTS_App extends DyNTS_SingletonService {
367
369
  `Application: "${this.params?.name}" start failed. (constructor asyncConstruct.catch)`,
368
370
  `\n ERROR:`, error
369
371
  );
370
- }
372
+ } */
371
373
 
372
374
  const message: string =
373
375
  (error as DyFM_Error)?.additionalContent?.constructErrors?.flatMap(