@futdevpro/nts-dynamo 1.14.76 → 1.14.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/_modules/ai/_modules/open-ai/_services/data-services/oai-vector-data.service.d.ts +1 -0
- package/build/_modules/ai/_modules/open-ai/_services/data-services/oai-vector-data.service.d.ts.map +1 -1
- package/build/_modules/ai/_modules/open-ai/_services/data-services/oai-vector-data.service.js +6 -0
- package/build/_modules/ai/_modules/open-ai/_services/data-services/oai-vector-data.service.js.map +1 -1
- package/build/_modules/defaults/_collections/default-endpoints.util.d.ts +237 -0
- package/build/_modules/defaults/_collections/default-endpoints.util.d.ts.map +1 -0
- package/build/_modules/defaults/_collections/default-endpoints.util.js +299 -0
- package/build/_modules/defaults/_collections/default-endpoints.util.js.map +1 -0
- package/build/_modules/defaults/index.d.ts +1 -0
- package/build/_modules/defaults/index.d.ts.map +1 -1
- package/build/_modules/defaults/index.js +2 -0
- package/build/_modules/defaults/index.js.map +1 -1
- package/build/_services/base/data.service.d.ts +4 -0
- package/build/_services/base/data.service.d.ts.map +1 -1
- package/build/_services/base/data.service.js +119 -11
- package/build/_services/base/data.service.js.map +1 -1
- package/build/_services/route/controller.service.d.ts +18 -0
- package/build/_services/route/controller.service.d.ts.map +1 -1
- package/build/_services/route/controller.service.js +18 -0
- package/build/_services/route/controller.service.js.map +1 -1
- package/build/_services/server/app.server.d.ts.map +1 -1
- package/build/_services/server/app.server.js +1 -0
- package/build/_services/server/app.server.js.map +1 -1
- package/build/_services/shared.static-service.spec.js +1 -7
- package/build/_services/shared.static-service.spec.js.map +1 -1
- package/package.json +4 -4
- package/src/_modules/ai/_modules/open-ai/_services/data-services/oai-vector-data.service.ts +8 -0
- package/src/_modules/defaults/_collections/default-endpoints.util.ts +372 -0
- package/src/_modules/defaults/index.ts +3 -0
- package/src/_services/base/data.service.ts +124 -12
- package/src/_services/route/controller.service.ts +18 -0
- package/src/_services/server/app.server.ts +1 -0
- package/src/_services/shared.static-service.spec.ts +1 -10
|
@@ -22,7 +22,9 @@ import {
|
|
|
22
22
|
DyFM_SearchQuery,
|
|
23
23
|
DyFM_SearchResult,
|
|
24
24
|
DyFM_SpecialSearch,
|
|
25
|
-
DyFM_String
|
|
25
|
+
DyFM_String,
|
|
26
|
+
DyFM_ValidationError,
|
|
27
|
+
DyFM_ValidationErrors
|
|
26
28
|
} from '@futdevpro/fsm-dynamo';
|
|
27
29
|
|
|
28
30
|
import { DyNTS_getArchivedDBName } from '../../_collections/archive.util';
|
|
@@ -64,6 +66,7 @@ export class DyNTS_DataService<T extends DyFM_Metadata> {
|
|
|
64
66
|
haveArchiveDataService: boolean;
|
|
65
67
|
|
|
66
68
|
/* data: T; */
|
|
69
|
+
/** @deprecated */
|
|
67
70
|
dataList: T[] = [];
|
|
68
71
|
/* issuer: string; */
|
|
69
72
|
|
|
@@ -91,6 +94,7 @@ export class DyNTS_DataService<T extends DyFM_Metadata> {
|
|
|
91
94
|
constructor(
|
|
92
95
|
/**
|
|
93
96
|
* Initial data, this will be used by functions on default
|
|
97
|
+
* @deprecated
|
|
94
98
|
*/
|
|
95
99
|
public data: T,
|
|
96
100
|
/**
|
|
@@ -1296,32 +1300,40 @@ export class DyNTS_DataService<T extends DyFM_Metadata> {
|
|
|
1296
1300
|
});
|
|
1297
1301
|
}
|
|
1298
1302
|
|
|
1299
|
-
const
|
|
1303
|
+
const validationErrors: DyFM_Error[] = [];
|
|
1300
1304
|
|
|
1301
1305
|
Object.values(properties).forEach(
|
|
1302
1306
|
(propertyParams: DyFM_DataProperty_Params<any, T>) => {
|
|
1303
1307
|
try {
|
|
1304
1308
|
this.validateProperty(data, data[propertyParams.key], propertyParams, isSubObjectOf);
|
|
1305
1309
|
} catch (error) {
|
|
1306
|
-
|
|
1310
|
+
validationErrors.push(error);
|
|
1307
1311
|
}
|
|
1308
1312
|
}
|
|
1309
1313
|
);
|
|
1310
1314
|
|
|
1311
|
-
if (
|
|
1312
|
-
if (
|
|
1313
|
-
throw
|
|
1315
|
+
if (validationErrors.length > 0) {
|
|
1316
|
+
if (validationErrors.length === 1) {
|
|
1317
|
+
throw validationErrors[0];
|
|
1314
1318
|
} else {
|
|
1319
|
+
const validationErrorsSet: DyFM_ValidationErrors = {};
|
|
1320
|
+
validationErrors.forEach((error: DyFM_Error) => {
|
|
1321
|
+
Object.keys(error.validationErrors).forEach((key: string) => {
|
|
1322
|
+
validationErrors[key] = error.validationErrors[key];
|
|
1323
|
+
});
|
|
1324
|
+
});
|
|
1325
|
+
|
|
1315
1326
|
throw new DyFM_Error({
|
|
1316
1327
|
...this._getDefaultErrorSettings(
|
|
1317
1328
|
'validateByPropertyParams',
|
|
1318
1329
|
new Error(
|
|
1319
1330
|
'Validation failed! (multiple validation errors)' +
|
|
1320
|
-
|
|
1331
|
+
validationErrors.map((error: DyFM_Error) => `\n ${DyFM_Error.getAnyMessage(error)}`).join('')
|
|
1321
1332
|
)
|
|
1322
1333
|
),
|
|
1323
1334
|
errorCode: `${this.ecBase}DyNTS-DS0-VDP3`,
|
|
1324
|
-
errors:
|
|
1335
|
+
errors: validationErrors,
|
|
1336
|
+
validationErrors: validationErrorsSet,
|
|
1325
1337
|
});
|
|
1326
1338
|
}
|
|
1327
1339
|
}
|
|
@@ -1376,6 +1388,15 @@ export class DyNTS_DataService<T extends DyFM_Metadata> {
|
|
|
1376
1388
|
status: 522,
|
|
1377
1389
|
errorCode: `${this.ecBase}DyNTS-DS0-VP1`,
|
|
1378
1390
|
userMessage: this.defaultValidationErrorUserMsg,
|
|
1391
|
+
validationErrors: {
|
|
1392
|
+
[propertyParams.key]: {
|
|
1393
|
+
message: `validateProperty failed, "${this.getPropertyKey(propertyParams, isSubObjectOf)}" is missing! ` +
|
|
1394
|
+
`(index or required in "${this.dataParams.dataName}" dataParams) ` +
|
|
1395
|
+
((data as any)?.name ? `\n The failed data's name: ${(data as any).name}` : ''),
|
|
1396
|
+
code: `${this.ecBase}DyNTS-DS0-VP1`,
|
|
1397
|
+
userMessage: 'The property is required and must be a valid value!',
|
|
1398
|
+
},
|
|
1399
|
+
},
|
|
1379
1400
|
__localStack: this.dataParams.stackLocation,
|
|
1380
1401
|
additionalContent: {
|
|
1381
1402
|
data: data,
|
|
@@ -1398,6 +1419,15 @@ export class DyNTS_DataService<T extends DyFM_Metadata> {
|
|
|
1398
1419
|
status: 522,
|
|
1399
1420
|
errorCode: `${this.ecBase}DyNTS-DS0-VP2`,
|
|
1400
1421
|
userMessage: this.defaultValidationErrorUserMsg,
|
|
1422
|
+
validationErrors: {
|
|
1423
|
+
[propertyParams.key]: {
|
|
1424
|
+
message: `validateProperty failed, "${this.getPropertyKey(propertyParams, isSubObjectOf)}" is forbidden! ` +
|
|
1425
|
+
`(${this.dataParams.dataName}) ` +
|
|
1426
|
+
((data as any)?.name ? `\n The failed data's name: ${(data as any).name}` : ''),
|
|
1427
|
+
code: `${this.ecBase}DyNTS-DS0-VP2`,
|
|
1428
|
+
userMessage: 'The property modification is forbidden!',
|
|
1429
|
+
},
|
|
1430
|
+
},
|
|
1401
1431
|
__localStack: this.dataParams.stackLocation,
|
|
1402
1432
|
additionalContent: {
|
|
1403
1433
|
data: data,
|
|
@@ -1430,6 +1460,15 @@ export class DyNTS_DataService<T extends DyFM_Metadata> {
|
|
|
1430
1460
|
status: 522,
|
|
1431
1461
|
errorCode: `${this.ecBase}DyNTS-DS0-VP3`,
|
|
1432
1462
|
userMessage: this.defaultValidationErrorUserMsg,
|
|
1463
|
+
validationErrors: {
|
|
1464
|
+
[propertyParams.key]: {
|
|
1465
|
+
message: `validateProperty failed, "${this.getPropertyKey(propertyParams, isSubObjectOf)}" is not a valid date! ` +
|
|
1466
|
+
`(${this.dataParams.dataName})` +
|
|
1467
|
+
((data as any)?.name ? `\n The failed data's name: ${(data as any).name}` : ''),
|
|
1468
|
+
code: `${this.ecBase}DyNTS-DS0-VP3`,
|
|
1469
|
+
userMessage: 'The property is required and must be a valid date!',
|
|
1470
|
+
},
|
|
1471
|
+
},
|
|
1433
1472
|
__localStack: this.dataParams.stackLocation,
|
|
1434
1473
|
additionalContent: {
|
|
1435
1474
|
data: data,
|
|
@@ -1453,6 +1492,15 @@ export class DyNTS_DataService<T extends DyFM_Metadata> {
|
|
|
1453
1492
|
status: 522,
|
|
1454
1493
|
errorCode: `${this.ecBase}DyNTS-DS0-VP4`,
|
|
1455
1494
|
userMessage: this.defaultValidationErrorUserMsg,
|
|
1495
|
+
validationErrors: {
|
|
1496
|
+
[propertyParams.key]: {
|
|
1497
|
+
message: `validateProperty failed, "${this.getPropertyKey(propertyParams, isSubObjectOf)}" is not a valid number! ` +
|
|
1498
|
+
`(${this.dataParams.dataName})` +
|
|
1499
|
+
((data as any)?.name ? `\n The failed data's name: ${(data as any).name}` : ''),
|
|
1500
|
+
code: `${this.ecBase}DyNTS-DS0-VP4`,
|
|
1501
|
+
userMessage: 'The property is required and must be a valid number!',
|
|
1502
|
+
},
|
|
1503
|
+
},
|
|
1456
1504
|
__localStack: this.dataParams.stackLocation,
|
|
1457
1505
|
additionalContent: {
|
|
1458
1506
|
data: data,
|
|
@@ -1475,8 +1523,18 @@ export class DyNTS_DataService<T extends DyFM_Metadata> {
|
|
|
1475
1523
|
),
|
|
1476
1524
|
|
|
1477
1525
|
status: 522,
|
|
1478
|
-
errorCode: `${this.ecBase}VP5`,
|
|
1526
|
+
errorCode: `${this.ecBase}DyNTS-DS0-VP5`,
|
|
1479
1527
|
userMessage: this.defaultValidationErrorUserMsg,
|
|
1528
|
+
validationErrors: {
|
|
1529
|
+
[propertyParams.key]: {
|
|
1530
|
+
message: `validateProperty failed, "${this.getPropertyKey(propertyParams, isSubObjectOf)}" is not a valid string! ` +
|
|
1531
|
+
`(type: ${typeof propertyValue}, value: "${propertyValue}") ` +
|
|
1532
|
+
`(${this.dataParams.dataName})` +
|
|
1533
|
+
((data as any)?.name ? `\n The failed data's name: ${(data as any).name}` : ''),
|
|
1534
|
+
code: `${this.ecBase}DyNTS-DS0-VP5`,
|
|
1535
|
+
userMessage: 'The property is required and must be a valid string!',
|
|
1536
|
+
},
|
|
1537
|
+
},
|
|
1480
1538
|
__localStack: this.dataParams.stackLocation,
|
|
1481
1539
|
additionalContent: {
|
|
1482
1540
|
data: data,
|
|
@@ -1499,8 +1557,18 @@ export class DyNTS_DataService<T extends DyFM_Metadata> {
|
|
|
1499
1557
|
),
|
|
1500
1558
|
|
|
1501
1559
|
status: 522,
|
|
1502
|
-
errorCode: `${this.ecBase}VP6`,
|
|
1560
|
+
errorCode: `${this.ecBase}DyNTS-DS0-VP6`,
|
|
1503
1561
|
userMessage: this.defaultValidationErrorUserMsg,
|
|
1562
|
+
validationErrors: {
|
|
1563
|
+
[propertyParams.key]: {
|
|
1564
|
+
message: `validateProperty failed, "${this.getPropertyKey(propertyParams, isSubObjectOf)}" is not a valid boolean! ` +
|
|
1565
|
+
`(type: ${typeof propertyValue}, value: "${propertyValue}") ` +
|
|
1566
|
+
`(${this.dataParams.dataName})` +
|
|
1567
|
+
((data as any)?.name ? `\n The failed data's name: ${(data as any).name}` : ''),
|
|
1568
|
+
code: `${this.ecBase}DyNTS-DS0-VP6`,
|
|
1569
|
+
userMessage: 'The property is required and must be a valid boolean!',
|
|
1570
|
+
},
|
|
1571
|
+
},
|
|
1504
1572
|
__localStack: this.dataParams.stackLocation,
|
|
1505
1573
|
});
|
|
1506
1574
|
}
|
|
@@ -1520,8 +1588,18 @@ export class DyNTS_DataService<T extends DyFM_Metadata> {
|
|
|
1520
1588
|
),
|
|
1521
1589
|
|
|
1522
1590
|
status: 522,
|
|
1523
|
-
errorCode: `${this.ecBase}VP7`,
|
|
1591
|
+
errorCode: `${this.ecBase}DyNTS-DS0-VP7`,
|
|
1524
1592
|
userMessage: this.defaultValidationErrorUserMsg,
|
|
1593
|
+
validationErrors: {
|
|
1594
|
+
[propertyParams.key]: {
|
|
1595
|
+
message: `validateProperty failed, "${this.getPropertyKey(propertyParams, isSubObjectOf)}" is not a valid object! ` +
|
|
1596
|
+
`(type: ${typeof propertyValue}, value: "${propertyValue}") ` +
|
|
1597
|
+
`(${this.dataParams.dataName})` +
|
|
1598
|
+
(data as any)?.name ? `\n That failed data's name: ${(data as any).name}` : '',
|
|
1599
|
+
code: `${this.ecBase}DyNTS-DS0-VP7`,
|
|
1600
|
+
userMessage: 'The property is required and must be an object!',
|
|
1601
|
+
},
|
|
1602
|
+
},
|
|
1525
1603
|
__localStack: this.dataParams.stackLocation,
|
|
1526
1604
|
});
|
|
1527
1605
|
}
|
|
@@ -1545,8 +1623,18 @@ export class DyNTS_DataService<T extends DyFM_Metadata> {
|
|
|
1545
1623
|
),
|
|
1546
1624
|
|
|
1547
1625
|
status: 522,
|
|
1548
|
-
errorCode: `${this.ecBase}VP8`,
|
|
1626
|
+
errorCode: `${this.ecBase}DyNTS-DS0-VP8`,
|
|
1549
1627
|
userMessage: this.defaultValidationErrorUserMsg,
|
|
1628
|
+
validationErrors: {
|
|
1629
|
+
[propertyParams.key]: {
|
|
1630
|
+
message: `validateProperty failed, "${this.getPropertyKey(propertyParams, isSubObjectOf)}" is not a valid array! ` +
|
|
1631
|
+
`(type: ${typeof propertyValue}, value: "${propertyValue}") ` +
|
|
1632
|
+
`(${this.dataParams.dataName})` +
|
|
1633
|
+
((data as any)?.name ? `\n The failed data's name: ${(data as any).name}` : ''),
|
|
1634
|
+
code: `${this.ecBase}DyNTS-DS0-VP8`,
|
|
1635
|
+
userMessage: 'The property is required and must be a valid array!',
|
|
1636
|
+
},
|
|
1637
|
+
},
|
|
1550
1638
|
__localStack: this.dataParams.stackLocation,
|
|
1551
1639
|
});
|
|
1552
1640
|
}
|
|
@@ -1577,6 +1665,15 @@ export class DyNTS_DataService<T extends DyFM_Metadata> {
|
|
|
1577
1665
|
status: 522,
|
|
1578
1666
|
errorCode: `${this.ecBase}VP9`,
|
|
1579
1667
|
userMessage: this.defaultValidationErrorUserMsg,
|
|
1668
|
+
validationErrors: {
|
|
1669
|
+
[propertyParams.key]: {
|
|
1670
|
+
message: `validateProperty failed, "${this.getPropertyKey(propertyParams, isSubObjectOf)}" is not a valid function! ` +
|
|
1671
|
+
`(${this.dataParams.dataName})` +
|
|
1672
|
+
((data as any)?.name ? `\n The failed data's name: ${(data as any).name}` : ''),
|
|
1673
|
+
code: `${this.ecBase}DyNTS-DS0-VP9`,
|
|
1674
|
+
userMessage: 'The property is required and must be a valid function!',
|
|
1675
|
+
},
|
|
1676
|
+
},
|
|
1580
1677
|
__localStack: this.dataParams.stackLocation,
|
|
1581
1678
|
});
|
|
1582
1679
|
} */
|
|
@@ -1598,6 +1695,17 @@ export class DyNTS_DataService<T extends DyFM_Metadata> {
|
|
|
1598
1695
|
status: 522,
|
|
1599
1696
|
errorCode: `${this.ecBase}DyNTS-DS0-VP10`,
|
|
1600
1697
|
userMessage: this.defaultValidationErrorUserMsg,
|
|
1698
|
+
validationErrors: {
|
|
1699
|
+
[propertyParams.key]: {
|
|
1700
|
+
message: `validateProperty failed, "${this.getPropertyKey(propertyParams, isSubObjectOf)}" is not a valid property type! ` +
|
|
1701
|
+
`(type: ${propertyParams.type}, nonBasicType: ${propertyParams.nonBasicType}) ` +
|
|
1702
|
+
`(value type: ${typeof propertyValue}, value: "${propertyValue}") ` +
|
|
1703
|
+
`(${this.dataParams.dataName})` +
|
|
1704
|
+
((data as any)?.name ? `\n The failed data's name: ${(data as any).name}` : ''),
|
|
1705
|
+
code: `${this.ecBase}DyNTS-DS0-VP10`,
|
|
1706
|
+
userMessage: 'The property is required and must be a valid property type!',
|
|
1707
|
+
},
|
|
1708
|
+
},
|
|
1601
1709
|
__localStack: this.dataParams.stackLocation,
|
|
1602
1710
|
});
|
|
1603
1711
|
}
|
|
@@ -2347,6 +2455,10 @@ export class DyNTS_DataService<T extends DyFM_Metadata> {
|
|
|
2347
2455
|
return this.depDataDBService;
|
|
2348
2456
|
}
|
|
2349
2457
|
}
|
|
2458
|
+
|
|
2459
|
+
getProvidedData(data: T): T {
|
|
2460
|
+
return data;
|
|
2461
|
+
}
|
|
2350
2462
|
|
|
2351
2463
|
private _getDefaultErrorSettings(
|
|
2352
2464
|
fnName: string,
|
|
@@ -11,6 +11,24 @@ import { DyNTS_SingletonService } from '../base/singleton.service';
|
|
|
11
11
|
*
|
|
12
12
|
* (You'll need to add them to a {@link DyNTS_RoutingModule} through it's constructor)
|
|
13
13
|
*
|
|
14
|
+
* You can add default endpoints to the controller by using the {@link DyNTS_DefaultEndpoints_Util} utility class
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* this.endpoints = [
|
|
18
|
+
* ...DyNTS_DefaultEndpoints_Util.getAllDefaultEndpoints({
|
|
19
|
+
* entityName: 'UserMatchStatistics',
|
|
20
|
+
* dataServiceClass: UserMatchStatistics_DataService,
|
|
21
|
+
* endpoints: {
|
|
22
|
+
* get: '/get/user-match-statistics/:userId',
|
|
23
|
+
* search: '/search/user-match-statistics',
|
|
24
|
+
* modify: '/modify/user-match-statistics',
|
|
25
|
+
* patch: '/patch/user-match-statistics/:userId',
|
|
26
|
+
* delete: '/delete/user-match-statistics/:userId',
|
|
27
|
+
* },
|
|
28
|
+
* authService: this.authService,
|
|
29
|
+
* }),
|
|
30
|
+
* ];
|
|
31
|
+
*
|
|
14
32
|
* @example
|
|
15
33
|
* export class UserMatchStatisticsController extends DyNTS_Controller {
|
|
16
34
|
*
|
|
@@ -1221,6 +1221,7 @@ export abstract class DyNTS_App extends DyNTS_SingletonService {
|
|
|
1221
1221
|
|
|
1222
1222
|
await DyNTS_GlobalService.globalErrorHandler?.(d_error, req, res);
|
|
1223
1223
|
|
|
1224
|
+
res.send(error)
|
|
1224
1225
|
} else {
|
|
1225
1226
|
DyFM_Log.H_error(
|
|
1226
1227
|
'WTF??? express error; without error?...' +
|
|
@@ -3,17 +3,8 @@ import { DyNTS_Shared } from './shared.static-service';
|
|
|
3
3
|
describe('| DyNTS_Shared', () => {
|
|
4
4
|
it('| getIpFromRequest should be accessible', () => {
|
|
5
5
|
expect(DyNTS_Shared.getIpFromRequest).toBeTruthy();
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
it('| getIpFromRequest should be accessible', () => {
|
|
9
|
-
expect(DyNTS_Shared.getLocationDataByRequest).toBeTruthy();
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
it('| getIpFromRequest should be accessible', () => {
|
|
13
6
|
expect(DyNTS_Shared.getLocationByIp).toBeTruthy();
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
it('| getIpFromRequest should be accessible', () => {
|
|
7
|
+
expect(DyNTS_Shared.getLocationDataByRequest).toBeTruthy();
|
|
17
8
|
expect(DyNTS_Shared.prompt).toBeTruthy();
|
|
18
9
|
});
|
|
19
10
|
});
|