@futdevpro/nts-dynamo 1.9.43 → 1.9.45
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/_collections/global-settings.const.d.ts.map +1 -1
- package/build/_collections/global-settings.const.js +1 -0
- package/build/_collections/global-settings.const.js.map +1 -1
- package/build/_models/interfaces/global-settings.interface.d.ts +4 -0
- package/build/_models/interfaces/global-settings.interface.d.ts.map +1 -1
- package/build/_services/base/archive-data.service.d.ts +1 -1
- package/build/_services/base/archive-data.service.d.ts.map +1 -1
- package/build/_services/base/archive-data.service.js +1 -1
- package/build/_services/base/archive-data.service.js.map +1 -1
- package/build/_services/base/data.service.d.ts +5 -5
- package/build/_services/base/data.service.d.ts.map +1 -1
- package/build/_services/base/data.service.js +59 -11
- package/build/_services/base/data.service.js.map +1 -1
- package/build/_services/base/db.service.d.ts +7 -8
- package/build/_services/base/db.service.d.ts.map +1 -1
- package/build/_services/base/db.service.js +26 -9
- package/build/_services/base/db.service.js.map +1 -1
- package/build/index.d.ts +3 -5
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -5
- package/build/index.js.map +1 -1
- package/package.json +3 -3
- package/src/_collections/global-settings.const.ts +2 -1
- package/src/_models/interfaces/global-settings.interface.ts +5 -0
- package/src/_services/base/archive-data.service.ts +7 -5
- package/src/_services/base/data.service.ts +119 -48
- package/src/_services/base/db.service.ts +69 -34
- package/src/index.ts +3 -5
- package/build/_models/types/db-filter.type.d.ts +0 -97
- package/build/_models/types/db-filter.type.d.ts.map +0 -1
- package/build/_models/types/db-filter.type.js +0 -3
- package/build/_models/types/db-filter.type.js.map +0 -1
- package/src/_models/types/db-filter.type.ts +0 -108
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
import * as mongoose from 'mongoose';
|
|
3
3
|
import { Schema } from 'mongoose';
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import {
|
|
6
|
+
DyFM_AnyError,
|
|
7
|
+
DyFM_DataModel_Params, DyFM_DataProperty_Params,
|
|
8
|
+
DyFM_DBFilter, DyFM_DBFilterSimple, DyFM_DBSort,
|
|
9
|
+
DyFM_Error,
|
|
10
|
+
DyFM_Error_Settings, DyFM_ErrorLevel,
|
|
11
|
+
DyFM_Log,
|
|
12
|
+
DyFM_Metadata
|
|
8
13
|
} from '@futdevpro/fsm-dynamo';
|
|
9
|
-
import { DyNTS_DBFilter, DyNTS_DBFilterNOR, DyNTS_DBFilterOR, DyNTS_DBFilterSimple } from '../../_models/types/db-filter.type';
|
|
10
|
-
import { DyNTS_DBUpdate } from '../../_models/types/db-update.type';
|
|
11
14
|
import { DyNTS_archiveSuffix } from '../../_collections/archive.util';
|
|
15
|
+
import { DyNTS_DBUpdate } from '../../_models/types/db-update.type';
|
|
12
16
|
|
|
13
17
|
/**
|
|
14
18
|
* DB Service for MongoDB
|
|
@@ -339,22 +343,34 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
339
343
|
}
|
|
340
344
|
|
|
341
345
|
async markDeletedById(id: string, issuer: string): Promise<void> {
|
|
342
|
-
await this.dataModel.findByIdAndUpdate(
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
346
|
+
await this.dataModel.findByIdAndUpdate(
|
|
347
|
+
id,
|
|
348
|
+
{
|
|
349
|
+
_deleted: new Date(),
|
|
350
|
+
_deletedBy: issuer,
|
|
351
|
+
},
|
|
352
|
+
issuer
|
|
353
|
+
).catch(
|
|
354
|
+
(error): void => {
|
|
355
|
+
throw new DyFM_Error({
|
|
356
|
+
...this._getDefaultErrorSettings('markDeletedById', error, issuer),
|
|
357
|
+
|
|
358
|
+
errorCode: 'NTS-DBS-MD0',
|
|
359
|
+
additionalContent: { id },
|
|
360
|
+
message: `mark deleted "${this.dataParams.dbName}" was unsuccessful (NTS DB)`,
|
|
361
|
+
issuer,
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
);
|
|
352
365
|
}
|
|
353
366
|
|
|
354
367
|
async markDeletedByDependencyId(dependencyId: string, issuer: string): Promise<void> {
|
|
355
368
|
await this.dataModel.updateMany(
|
|
356
369
|
{ [this.depDataName]: dependencyId },
|
|
357
|
-
{
|
|
370
|
+
{
|
|
371
|
+
_deleted: new Date(),
|
|
372
|
+
_deletedBy: issuer,
|
|
373
|
+
}
|
|
358
374
|
).catch((error): void => {
|
|
359
375
|
throw new DyFM_Error({
|
|
360
376
|
...this._getDefaultErrorSettings('markDeletedByDependencyId', error, issuer),
|
|
@@ -411,7 +427,7 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
411
427
|
|
|
412
428
|
async getDeletedDataList(): Promise<T[]> {
|
|
413
429
|
const dataList: T[] = await this.dataModel
|
|
414
|
-
.
|
|
430
|
+
.getAll()
|
|
415
431
|
.then((res): T[] => res as T[] ?? [])
|
|
416
432
|
.catch((error): void => {
|
|
417
433
|
throw new DyFM_Error({
|
|
@@ -421,7 +437,9 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
421
437
|
});
|
|
422
438
|
});
|
|
423
439
|
|
|
424
|
-
return dataList.
|
|
440
|
+
return dataList.filter(
|
|
441
|
+
(data: T): boolean => Boolean(data._deleted)
|
|
442
|
+
).map((data: T): T => this.stringifyDataId(data, 'getDeletedData'));
|
|
425
443
|
}
|
|
426
444
|
|
|
427
445
|
/**
|
|
@@ -491,7 +509,7 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
491
509
|
* @returns dataList
|
|
492
510
|
*/
|
|
493
511
|
async searchData(
|
|
494
|
-
filterBy:
|
|
512
|
+
filterBy: DyFM_DBFilter<T>,
|
|
495
513
|
narrowByDependencyIds?: string[]
|
|
496
514
|
): Promise<T[]> {
|
|
497
515
|
const filter = {};
|
|
@@ -529,7 +547,7 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
529
547
|
) {
|
|
530
548
|
filter[modelParam.key] = {
|
|
531
549
|
from: { $lte: filterBy[searchParamKeyWithoutRange] },
|
|
532
|
-
to: { $gte: filterBy[searchParamKeyWithoutRange] }
|
|
550
|
+
to: { $gte: filterBy[searchParamKeyWithoutRange] },
|
|
533
551
|
};
|
|
534
552
|
}
|
|
535
553
|
} else {
|
|
@@ -575,7 +593,7 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
575
593
|
});
|
|
576
594
|
});
|
|
577
595
|
|
|
578
|
-
if ((filterBy as
|
|
596
|
+
if ((filterBy as DyFM_DBFilterSimple<T>)._deleted === undefined) {
|
|
579
597
|
dataList = dataList.filter((data: T): boolean => !data._deleted);
|
|
580
598
|
}
|
|
581
599
|
|
|
@@ -613,7 +631,7 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
613
631
|
* //
|
|
614
632
|
* @returns {T} data: T
|
|
615
633
|
*/
|
|
616
|
-
async findOne(filterBy:
|
|
634
|
+
async findOne(filterBy: DyFM_DBFilter<T>): Promise<T> {
|
|
617
635
|
const data: T = await this.dataModel
|
|
618
636
|
.findOne(filterBy)
|
|
619
637
|
.then((res): T => res as T ?? null)
|
|
@@ -656,8 +674,7 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
656
674
|
* //
|
|
657
675
|
* @returns {T[]} dataList: T[]
|
|
658
676
|
*/
|
|
659
|
-
async find(filterBy:
|
|
660
|
-
|
|
677
|
+
async find(filterBy: DyFM_DBFilter<T>): Promise<T[]> {
|
|
661
678
|
let dataList: T[] = await this.dataModel
|
|
662
679
|
.find(filterBy)
|
|
663
680
|
.then((res): T[] => res as T[] ?? [])
|
|
@@ -670,9 +687,7 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
670
687
|
});
|
|
671
688
|
});
|
|
672
689
|
|
|
673
|
-
if (
|
|
674
|
-
(filterBy as DyNTS_DBFilterSimple<T>)._deleted === undefined
|
|
675
|
-
) {
|
|
690
|
+
if ((filterBy as DyFM_DBFilterSimple<T>)._deleted === undefined) {
|
|
676
691
|
dataList = dataList.filter((data: T): boolean => !data._deleted);
|
|
677
692
|
}
|
|
678
693
|
|
|
@@ -713,12 +728,16 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
713
728
|
* @returns {T[]} dataList: T[]
|
|
714
729
|
*/
|
|
715
730
|
async findWithPaging(
|
|
716
|
-
filterBy:
|
|
731
|
+
filterBy: DyFM_DBFilter<T>,
|
|
717
732
|
page: number,
|
|
718
733
|
pageSize: number,
|
|
719
|
-
sort?:
|
|
734
|
+
sort?: DyFM_DBSort<T>
|
|
720
735
|
): Promise<T[]> {
|
|
721
|
-
|
|
736
|
+
if (filterBy['_deleted'] === undefined) {
|
|
737
|
+
filterBy['_deleted'] = null;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
const dataList: T[] = await this.dataModel
|
|
722
741
|
.find(filterBy)
|
|
723
742
|
.sort(sort)
|
|
724
743
|
.skip(page * pageSize)
|
|
@@ -733,9 +752,9 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
733
752
|
});
|
|
734
753
|
});
|
|
735
754
|
|
|
736
|
-
if ((filterBy as
|
|
755
|
+
/* if ((filterBy as DyFM_DBFilterSimple<T>)._deleted === undefined) {
|
|
737
756
|
dataList = dataList.filter((data: T): boolean => !data._deleted);
|
|
738
|
-
}
|
|
757
|
+
} */
|
|
739
758
|
|
|
740
759
|
return dataList.map((data: T): T => this.stringifyDataId(data, 'find'));
|
|
741
760
|
}
|
|
@@ -828,7 +847,7 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
828
847
|
* //
|
|
829
848
|
*/
|
|
830
849
|
async updateOne(
|
|
831
|
-
filterBy:
|
|
850
|
+
filterBy: DyFM_DBFilter<T>,
|
|
832
851
|
update: DyNTS_DBUpdate<T>,
|
|
833
852
|
issuer: string,
|
|
834
853
|
dontUpdateModified?: boolean
|
|
@@ -903,7 +922,7 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
903
922
|
* //
|
|
904
923
|
*/
|
|
905
924
|
async updateMany(
|
|
906
|
-
filterBy:
|
|
925
|
+
filterBy: DyFM_DBFilter<T>,
|
|
907
926
|
update: DyNTS_DBUpdate<T>,
|
|
908
927
|
issuer: string,
|
|
909
928
|
dontUpdateModified?: boolean
|
|
@@ -1108,6 +1127,22 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
1108
1127
|
(modelParams: DyFM_DataProperty_Params): boolean => modelParams.isDependencyHook
|
|
1109
1128
|
);
|
|
1110
1129
|
|
|
1130
|
+
if (this.dataParams.properties.filter(
|
|
1131
|
+
(modelParams: DyFM_DataProperty_Params): boolean => modelParams.isDependencyHook).length > 1
|
|
1132
|
+
) {
|
|
1133
|
+
throw new DyFM_Error({
|
|
1134
|
+
...this._getDefaultErrorSettings(
|
|
1135
|
+
'lookForDependencyDataSettings',
|
|
1136
|
+
new Error(
|
|
1137
|
+
`Multiple "isDependencyHook" found for this dataModel (${this.dataParams.dbName}) ` +
|
|
1138
|
+
`(NTS DB)` +
|
|
1139
|
+
`\nSorry, but this is not supported yet! (Donate to Dynamo to get this feature!)`
|
|
1140
|
+
)
|
|
1141
|
+
),
|
|
1142
|
+
errorCode: 'NTS-DBS-LFDD0',
|
|
1143
|
+
});
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1111
1146
|
if (dependencyParam) {
|
|
1112
1147
|
this.depDataName = dependencyParam.key;
|
|
1113
1148
|
}
|
package/src/index.ts
CHANGED
|
@@ -6,8 +6,8 @@ export * from './_collections/global-settings.const';
|
|
|
6
6
|
// ENUMS
|
|
7
7
|
export * from './_enums/data-model-type.enum';
|
|
8
8
|
export * from './_enums/data-service-function.enum';
|
|
9
|
-
export * from './_enums/route-security.enum';
|
|
10
9
|
export * from './_enums/predefined-data-types.enum';
|
|
10
|
+
export * from './_enums/route-security.enum';
|
|
11
11
|
|
|
12
12
|
// enums/HTTP
|
|
13
13
|
export * from './_enums/http/http-call-type.enum';
|
|
@@ -16,19 +16,18 @@ export * from './_enums/http/http-response-type.enum';
|
|
|
16
16
|
|
|
17
17
|
// MODELS (CONTROL-MODELS, INTERFACES, TYPES)
|
|
18
18
|
// models/INTERFACES
|
|
19
|
-
export * from './_models/interfaces/global-service-settings.interface';
|
|
20
19
|
export * from './_models/interfaces/certification-settings.interface';
|
|
20
|
+
export * from './_models/interfaces/global-service-settings.interface';
|
|
21
21
|
export * from './_models/interfaces/global-settings.interface';
|
|
22
22
|
export * from './_models/interfaces/routing-module-settings.interface';
|
|
23
23
|
|
|
24
24
|
// models/CONTROL MODELS
|
|
25
25
|
export * from './_models/control-models/api-call-params.control-model';
|
|
26
26
|
export * from './_models/control-models/app-params.control-model';
|
|
27
|
-
export * from './_models/control-models/http-settings.control-model';
|
|
28
27
|
export * from './_models/control-models/endpoint-params.control-model';
|
|
28
|
+
export * from './_models/control-models/http-settings.control-model';
|
|
29
29
|
|
|
30
30
|
// models/TYPES
|
|
31
|
-
export * from './_models/types/db-filter.type';
|
|
32
31
|
export * from './_models/types/db-update.type';
|
|
33
32
|
|
|
34
33
|
|
|
@@ -51,7 +50,6 @@ export * from './_services/server/app.server';
|
|
|
51
50
|
|
|
52
51
|
// services/ROUTE
|
|
53
52
|
export * from './_services/route/controller.service';
|
|
54
|
-
export * from './_services/route/controller.service';
|
|
55
53
|
export * from './_services/route/routing-module.service';
|
|
56
54
|
|
|
57
55
|
// services/SHARED
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @example
|
|
3
|
-
* // by email:
|
|
4
|
-
* { email: email }
|
|
5
|
-
* //
|
|
6
|
-
* @example
|
|
7
|
-
* // or by id that is in list:
|
|
8
|
-
* { userIds: { $in: this.userId } }
|
|
9
|
-
* //
|
|
10
|
-
* @example
|
|
11
|
-
* // or by number or Date that is Greater Than AND Less Than:
|
|
12
|
-
* { points: { $gt: 2, $lt: 14 } }
|
|
13
|
-
* // further tools (syntax matches with $gt):
|
|
14
|
-
* $eq: // Matches values that are EQual to a specified value.
|
|
15
|
-
* $gte: // Matches values that are Greater Than OR Equal to a specified value.
|
|
16
|
-
* $lte: // Matches values that are Less Than or Equal to a specified value.
|
|
17
|
-
* $ne: // Matches all values that are Not Equal to a specified value.
|
|
18
|
-
* $nin: // Matches None of the values specified IN an array.
|
|
19
|
-
* //
|
|
20
|
-
* @returns {T} data: T
|
|
21
|
-
*/
|
|
22
|
-
export type DyNTS_DBFilter<T> = DyNTS_DBFilterSimple<T> | DyNTS_DBFilterOR<T> | DyNTS_DBFilterNOR<T>;
|
|
23
|
-
/**
|
|
24
|
-
* A simple filter for a DynamoDB query.
|
|
25
|
-
*/
|
|
26
|
-
export type DyNTS_DBFilterSimple<T> = {
|
|
27
|
-
[K in keyof T]?: T[K] | DyNTS_DBFilterExpressions<T[K] | boolean>;
|
|
28
|
-
} & {
|
|
29
|
-
[path: string]: any;
|
|
30
|
-
};
|
|
31
|
-
export type DyNTS_DBFilterExpressions<T> = {
|
|
32
|
-
/**
|
|
33
|
-
* Matches values that are includes the value; This works only when T[K] is an array!
|
|
34
|
-
*/
|
|
35
|
-
$in?: any;
|
|
36
|
-
/**
|
|
37
|
-
* Matches values that are EQual to a specified value.
|
|
38
|
-
*/
|
|
39
|
-
$eq?: T;
|
|
40
|
-
/**
|
|
41
|
-
* Matches values that are Greater Than a specified value.
|
|
42
|
-
*/
|
|
43
|
-
$gt?: number | Date;
|
|
44
|
-
/**
|
|
45
|
-
* Matches values that are Greater Than OR Equal to a specified value.
|
|
46
|
-
*/
|
|
47
|
-
$gte?: number | Date;
|
|
48
|
-
/**
|
|
49
|
-
* Matches values that are Less Than a specified value.
|
|
50
|
-
*/
|
|
51
|
-
$lt?: number | Date;
|
|
52
|
-
/**
|
|
53
|
-
* Matches values that are Less Than or Equal to a specified value.
|
|
54
|
-
*/
|
|
55
|
-
$lte?: number | Date;
|
|
56
|
-
/**
|
|
57
|
-
* Matches all values that are Not Equal to a specified value.
|
|
58
|
-
*/
|
|
59
|
-
$ne?: T;
|
|
60
|
-
/**
|
|
61
|
-
* Matches None of the values specified IN an array.
|
|
62
|
-
*/
|
|
63
|
-
$nin?: T;
|
|
64
|
-
/**
|
|
65
|
-
* Inverts the effect of a query expression and returns documents that do not match the query expression.
|
|
66
|
-
*/
|
|
67
|
-
$not?: T | {
|
|
68
|
-
$regex?: RegExp | string;
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* Performs a regular expression on the field's value, and selects documents that match the regular expression.
|
|
72
|
-
*/
|
|
73
|
-
$exists?: boolean;
|
|
74
|
-
/**
|
|
75
|
-
* Selects documents if a field is of the specified type.
|
|
76
|
-
*/
|
|
77
|
-
$type?: string;
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* Joins query clauses with a logical AND returns all documents that match the conditions of both clauses.
|
|
81
|
-
*/
|
|
82
|
-
export type DyNTS_DBFilterNOR<T> = {
|
|
83
|
-
/**
|
|
84
|
-
* Joins query clauses with a logical NOR returns all documents that fail to match both clauses.
|
|
85
|
-
*/
|
|
86
|
-
$nor: DyNTS_DBFilterSimple<T>[];
|
|
87
|
-
};
|
|
88
|
-
/**
|
|
89
|
-
* Joins query clauses with a logical AND returns all documents that match the conditions of both clauses.
|
|
90
|
-
*/
|
|
91
|
-
export type DyNTS_DBFilterOR<T> = {
|
|
92
|
-
/**
|
|
93
|
-
* Joins query clauses with a logical OR returns all documents that match the conditions of either clause.
|
|
94
|
-
*/
|
|
95
|
-
$or: DyNTS_DBFilterSimple<T>[];
|
|
96
|
-
};
|
|
97
|
-
//# sourceMappingURL=db-filter.type.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"db-filter.type.d.ts","sourceRoot":"","sources":["../../../src/_models/types/db-filter.type.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAC1B,oBAAoB,CAAC,CAAC,CAAC,GACvB,gBAAgB,CAAC,CAAC,CAAC,GACnB,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAEvB;;GAEG;AACH,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI;KACnC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,yBAAyB,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;CAClE,GAAG;IACF,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,yBAAyB,CAAC,CAAC,IAAI;IACzC;;OAEG;IACH,GAAG,CAAC,EAAE,GAAG,CAAC;IACV;;OAEG;IACH,GAAG,CAAC,EAAE,CAAC,CAAC;IACR;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB;;OAEG;IACH,GAAG,CAAC,EAAE,CAAC,CAAC;IACR;;OAEG;IACH,IAAI,CAAC,EAAE,CAAC,CAAC;IACT;;OAEG;IACH,IAAI,CAAC,EAAE,CAAC,GAAG;QACT,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;KAC1B,CAAC;IACF;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAGF;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI;IACjC;;OAEG;IACH,IAAI,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC;CACjC,CAAA;AAGD;;GAEG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;IAChC;;OAEG;IACH,GAAG,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC;CAChC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"db-filter.type.js","sourceRoot":"","sources":["../../../src/_models/types/db-filter.type.ts"],"names":[],"mappings":""}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* @example
|
|
4
|
-
* // by email:
|
|
5
|
-
* { email: email }
|
|
6
|
-
* //
|
|
7
|
-
* @example
|
|
8
|
-
* // or by id that is in list:
|
|
9
|
-
* { userIds: { $in: this.userId } }
|
|
10
|
-
* //
|
|
11
|
-
* @example
|
|
12
|
-
* // or by number or Date that is Greater Than AND Less Than:
|
|
13
|
-
* { points: { $gt: 2, $lt: 14 } }
|
|
14
|
-
* // further tools (syntax matches with $gt):
|
|
15
|
-
* $eq: // Matches values that are EQual to a specified value.
|
|
16
|
-
* $gte: // Matches values that are Greater Than OR Equal to a specified value.
|
|
17
|
-
* $lte: // Matches values that are Less Than or Equal to a specified value.
|
|
18
|
-
* $ne: // Matches all values that are Not Equal to a specified value.
|
|
19
|
-
* $nin: // Matches None of the values specified IN an array.
|
|
20
|
-
* //
|
|
21
|
-
* @returns {T} data: T
|
|
22
|
-
*/
|
|
23
|
-
export type DyNTS_DBFilter<T> =
|
|
24
|
-
DyNTS_DBFilterSimple<T> |
|
|
25
|
-
DyNTS_DBFilterOR<T> |
|
|
26
|
-
DyNTS_DBFilterNOR<T>;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* A simple filter for a DynamoDB query.
|
|
30
|
-
*/
|
|
31
|
-
export type DyNTS_DBFilterSimple<T> = {
|
|
32
|
-
[K in keyof T]?: T[K] | DyNTS_DBFilterExpressions<T[K] | boolean>;
|
|
33
|
-
} & {
|
|
34
|
-
[path: string]: any;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export type DyNTS_DBFilterExpressions<T> = {
|
|
38
|
-
/**
|
|
39
|
-
* Matches values that are includes the value; This works only when T[K] is an array!
|
|
40
|
-
*/
|
|
41
|
-
$in?: any,
|
|
42
|
-
/**
|
|
43
|
-
* Matches values that are EQual to a specified value.
|
|
44
|
-
*/
|
|
45
|
-
$eq?: T,
|
|
46
|
-
/**
|
|
47
|
-
* Matches values that are Greater Than a specified value.
|
|
48
|
-
*/
|
|
49
|
-
$gt?: number | Date,
|
|
50
|
-
/**
|
|
51
|
-
* Matches values that are Greater Than OR Equal to a specified value.
|
|
52
|
-
*/
|
|
53
|
-
$gte?: number | Date,
|
|
54
|
-
/**
|
|
55
|
-
* Matches values that are Less Than a specified value.
|
|
56
|
-
*/
|
|
57
|
-
$lt?: number | Date,
|
|
58
|
-
/**
|
|
59
|
-
* Matches values that are Less Than or Equal to a specified value.
|
|
60
|
-
*/
|
|
61
|
-
$lte?: number | Date,
|
|
62
|
-
/**
|
|
63
|
-
* Matches all values that are Not Equal to a specified value.
|
|
64
|
-
*/
|
|
65
|
-
$ne?: T,
|
|
66
|
-
/**
|
|
67
|
-
* Matches None of the values specified IN an array.
|
|
68
|
-
*/
|
|
69
|
-
$nin?: T,
|
|
70
|
-
/**
|
|
71
|
-
* Inverts the effect of a query expression and returns documents that do not match the query expression.
|
|
72
|
-
*/
|
|
73
|
-
$not?: T | {
|
|
74
|
-
$regex?: RegExp | string,
|
|
75
|
-
},
|
|
76
|
-
/**
|
|
77
|
-
* Performs a regular expression on the field's value, and selects documents that match the regular expression.
|
|
78
|
-
*/
|
|
79
|
-
$exists?: boolean,
|
|
80
|
-
/**
|
|
81
|
-
* Selects documents if a field is of the specified type.
|
|
82
|
-
*/
|
|
83
|
-
$type?: string,
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Joins query clauses with a logical AND returns all documents that match the conditions of both clauses.
|
|
89
|
-
*/
|
|
90
|
-
export type DyNTS_DBFilterNOR<T> = {
|
|
91
|
-
/**
|
|
92
|
-
* Joins query clauses with a logical NOR returns all documents that fail to match both clauses.
|
|
93
|
-
*/
|
|
94
|
-
$nor: DyNTS_DBFilterSimple<T>[];
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Joins query clauses with a logical AND returns all documents that match the conditions of both clauses.
|
|
100
|
-
*/
|
|
101
|
-
export type DyNTS_DBFilterOR<T> = {
|
|
102
|
-
/**
|
|
103
|
-
* Joins query clauses with a logical OR returns all documents that match the conditions of either clause.
|
|
104
|
-
*/
|
|
105
|
-
$or: DyNTS_DBFilterSimple<T>[];
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|