@rws-framework/db 2.3.2 → 2.4.0

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 (92) hide show
  1. package/.bin/add-v.sh +9 -9
  2. package/.bin/emerge.sh +10 -10
  3. package/.eslintrc.json +53 -53
  4. package/README.md +404 -367
  5. package/dist/decorators/InverseRelation.d.ts +12 -12
  6. package/dist/decorators/InverseRelation.js +24 -24
  7. package/dist/decorators/InverseTimeSeries.d.ts +8 -8
  8. package/dist/decorators/InverseTimeSeries.js +13 -13
  9. package/dist/decorators/RWSCollection.d.ts +12 -12
  10. package/dist/decorators/RWSCollection.js +16 -16
  11. package/dist/decorators/Relation.d.ts +19 -19
  12. package/dist/decorators/Relation.js +26 -26
  13. package/dist/decorators/TrackType.d.ts +20 -20
  14. package/dist/decorators/TrackType.js +41 -41
  15. package/dist/decorators/index.d.ts +5 -5
  16. package/dist/decorators/index.js +14 -14
  17. package/dist/helper/DbHelper.d.ts +8 -8
  18. package/dist/helper/DbHelper.js +141 -141
  19. package/dist/helper/FieldsHelper.d.ts +4 -4
  20. package/dist/helper/FieldsHelper.js +35 -35
  21. package/dist/index.d.ts +12 -12
  22. package/dist/index.js +19 -19
  23. package/dist/models/TimeSeriesModel.d.ts +7 -7
  24. package/dist/models/TimeSeriesModel.js +33 -33
  25. package/dist/models/_model.d.ts +6 -6
  26. package/dist/models/_model.js +9 -9
  27. package/dist/models/core/RWSModel.d.ts +66 -66
  28. package/dist/models/core/RWSModel.js +400 -400
  29. package/dist/models/core/TimeSeriesModel.d.ts +1 -1
  30. package/dist/models/core/TimeSeriesModel.js +14 -14
  31. package/dist/models/index.d.ts +7 -7
  32. package/dist/models/index.js +8 -8
  33. package/dist/models/interfaces/IModel.d.ts +11 -11
  34. package/dist/models/interfaces/IModel.js +2 -2
  35. package/dist/models/interfaces/IRWSModelServices.d.ts +6 -6
  36. package/dist/models/interfaces/IRWSModelServices.js +2 -2
  37. package/dist/models/interfaces/OpModelType.d.ts +31 -31
  38. package/dist/models/interfaces/OpModelType.js +2 -2
  39. package/dist/models/types/RelationTypes.d.ts +24 -24
  40. package/dist/models/types/RelationTypes.js +2 -2
  41. package/dist/models/utils/ModelUtils.d.ts +10 -10
  42. package/dist/models/utils/ModelUtils.js +56 -56
  43. package/dist/models/utils/PaginationUtils.d.ts +5 -5
  44. package/dist/models/utils/PaginationUtils.js +32 -32
  45. package/dist/models/utils/RelationUtils.d.ts +14 -14
  46. package/dist/models/utils/RelationUtils.js +65 -65
  47. package/dist/models/utils/TimeSeriesUtils.d.ts +11 -11
  48. package/dist/models/utils/TimeSeriesUtils.js +35 -35
  49. package/dist/services/DBService.d.ts +37 -37
  50. package/dist/services/DBService.js +198 -198
  51. package/dist/types/DbConfigHandler.d.ts +9 -9
  52. package/dist/types/DbConfigHandler.js +2 -2
  53. package/dist/types/FindParams.d.ts +14 -14
  54. package/dist/types/FindParams.js +2 -2
  55. package/dist/types/IRWSModel.d.ts +3 -3
  56. package/dist/types/IRWSModel.js +2 -2
  57. package/dist/types/ITimeSeries.d.ts +6 -6
  58. package/dist/types/ITimeSeries.js +2 -2
  59. package/exec/console.js +110 -110
  60. package/exec/db.rws.webpack.config.js +168 -168
  61. package/exec/src/cli.ts +74 -73
  62. package/exec/tsconfig.json +32 -32
  63. package/exec/webpackFilters.js +17 -17
  64. package/package.json +36 -36
  65. package/src/decorators/InverseRelation.ts +36 -36
  66. package/src/decorators/InverseTimeSeries.ts +21 -21
  67. package/src/decorators/RWSCollection.ts +27 -27
  68. package/src/decorators/Relation.ts +47 -47
  69. package/src/decorators/TrackType.ts +69 -69
  70. package/src/decorators/index.ts +7 -7
  71. package/src/empty.js +0 -0
  72. package/src/helper/DbHelper.ts +177 -177
  73. package/src/helper/FieldsHelper.ts +34 -34
  74. package/src/index.ts +36 -36
  75. package/src/models/_model.ts +29 -29
  76. package/src/models/core/RWSModel.ts +520 -520
  77. package/src/models/core/TimeSeriesModel.ts +19 -19
  78. package/src/models/index.ts +20 -20
  79. package/src/models/interfaces/IModel.ts +12 -12
  80. package/src/models/interfaces/IRWSModelServices.ts +7 -7
  81. package/src/models/interfaces/OpModelType.ts +49 -49
  82. package/src/models/types/RelationTypes.ts +25 -25
  83. package/src/models/utils/ModelUtils.ts +65 -65
  84. package/src/models/utils/PaginationUtils.ts +42 -42
  85. package/src/models/utils/RelationUtils.ts +76 -76
  86. package/src/models/utils/TimeSeriesUtils.ts +38 -38
  87. package/src/services/DBService.ts +277 -277
  88. package/src/types/DbConfigHandler.ts +12 -11
  89. package/src/types/FindParams.ts +13 -13
  90. package/src/types/IRWSModel.ts +2 -2
  91. package/src/types/ITimeSeries.ts +5 -5
  92. package/tsconfig.json +22 -22
@@ -1,66 +1,66 @@
1
- import { IModel } from '../interfaces/IModel';
2
- import { IRWSModelServices } from '../interfaces/IRWSModelServices';
3
- import { OpModelType } from '../interfaces/OpModelType';
4
- import { FindByType, IPaginationParams } from '../../types/FindParams';
5
- import { DBService } from '../../services/DBService';
6
- declare class RWSModel<T> implements IModel {
7
- static services: IRWSModelServices;
8
- [key: string]: any;
9
- id: string;
10
- static _collection: string;
11
- static _RELATIONS: {};
12
- static _BANNED_KEYS: string[];
13
- static allModels: OpModelType<any>[];
14
- static _CUT_KEYS: string[];
15
- constructor(data: any);
16
- checkForInclusionWithThrow(): void;
17
- static checkForInclusionWithThrow(this: OpModelType<any>, checkModelType: string): void;
18
- checkForInclusion(): boolean;
19
- static checkForInclusion(this: OpModelType<any>, checkModelType: string): boolean;
20
- protected _fill(data: any): RWSModel<T>;
21
- protected hasRelation(key: string): boolean;
22
- protected bindRelation(key: string, relatedModel: RWSModel<any>): {
23
- connect: {
24
- id: string;
25
- };
26
- };
27
- _asyncFill(data: any, fullDataMode?: boolean, allowRelations?: boolean): Promise<T>;
28
- private getModelScalarFields;
29
- private getRelationOneMeta;
30
- static getRelationOneMeta(model: any, classFields: string[]): Promise<import("..").RelOneMetaType<import("../..").IRWSModel>>;
31
- private getRelationManyMeta;
32
- static getRelationManyMeta(model: any, classFields: string[]): Promise<import("..").RelManyMetaType<import("../..").IRWSModel>>;
33
- static paginate<T extends RWSModel<T>>(this: OpModelType<T>, paginateParams: IPaginationParams, findParams?: FindByType): Promise<T[]>;
34
- toMongo(): Promise<any>;
35
- getCollection(): string | null;
36
- static getCollection(): string | null;
37
- save(): Promise<this>;
38
- static getModelAnnotations<T extends unknown>(constructor: new () => T): Promise<Record<string, {
39
- annotationType: string;
40
- metadata: any;
41
- }>>;
42
- preUpdate(): void;
43
- postUpdate(): void;
44
- preCreate(): void;
45
- postCreate(): void;
46
- static isSubclass<T extends RWSModel<T>, C extends new () => T>(constructor: C, baseClass: new () => T): boolean;
47
- hasTimeSeries(): boolean;
48
- static checkTimeSeries(constructor: any): boolean;
49
- isDbVariable(variable: string): Promise<boolean>;
50
- static checkDbVariable(constructor: any, variable: string): Promise<boolean>;
51
- sanitizeDBData(data: any): any;
52
- static watchCollection<T extends RWSModel<T>>(this: OpModelType<T>, preRun: () => void): Promise<any>;
53
- static findOneBy<T extends RWSModel<T>>(this: OpModelType<T>, findParams?: FindByType): Promise<T | null>;
54
- static find<T extends RWSModel<T>>(this: OpModelType<T>, id: string, findParams?: Omit<FindByType, 'conditions'>): Promise<T | null>;
55
- static findBy<T extends RWSModel<T>>(this: OpModelType<T>, findParams?: FindByType): Promise<T[]>;
56
- static delete<T extends RWSModel<T>>(this: OpModelType<T>, conditions: any): Promise<void>;
57
- delete<T extends RWSModel<T>>(): Promise<void>;
58
- static create<T extends RWSModel<T>>(this: new () => T, data: any): Promise<T>;
59
- static loadModels(): OpModelType<any>[];
60
- loadModels(): OpModelType<any>[];
61
- private checkRelEnabled;
62
- static setServices(services: IRWSModelServices): void;
63
- getDb(): DBService;
64
- static getDb(): DBService;
65
- }
66
- export { RWSModel };
1
+ import { IModel } from '../interfaces/IModel';
2
+ import { IRWSModelServices } from '../interfaces/IRWSModelServices';
3
+ import { OpModelType } from '../interfaces/OpModelType';
4
+ import { FindByType, IPaginationParams } from '../../types/FindParams';
5
+ import { DBService } from '../../services/DBService';
6
+ declare class RWSModel<T> implements IModel {
7
+ static services: IRWSModelServices;
8
+ [key: string]: any;
9
+ id: string;
10
+ static _collection: string;
11
+ static _RELATIONS: {};
12
+ static _BANNED_KEYS: string[];
13
+ static allModels: OpModelType<any>[];
14
+ static _CUT_KEYS: string[];
15
+ constructor(data: any);
16
+ checkForInclusionWithThrow(): void;
17
+ static checkForInclusionWithThrow(this: OpModelType<any>, checkModelType: string): void;
18
+ checkForInclusion(): boolean;
19
+ static checkForInclusion(this: OpModelType<any>, checkModelType: string): boolean;
20
+ protected _fill(data: any): RWSModel<T>;
21
+ protected hasRelation(key: string): boolean;
22
+ protected bindRelation(key: string, relatedModel: RWSModel<any>): {
23
+ connect: {
24
+ id: string;
25
+ };
26
+ };
27
+ _asyncFill(data: any, fullDataMode?: boolean, allowRelations?: boolean): Promise<T>;
28
+ private getModelScalarFields;
29
+ private getRelationOneMeta;
30
+ static getRelationOneMeta(model: any, classFields: string[]): Promise<import("..").RelOneMetaType<import("../..").IRWSModel>>;
31
+ private getRelationManyMeta;
32
+ static getRelationManyMeta(model: any, classFields: string[]): Promise<import("..").RelManyMetaType<import("../..").IRWSModel>>;
33
+ static paginate<T extends RWSModel<T>>(this: OpModelType<T>, paginateParams: IPaginationParams, findParams?: FindByType): Promise<T[]>;
34
+ toMongo(): Promise<any>;
35
+ getCollection(): string | null;
36
+ static getCollection(): string | null;
37
+ save(): Promise<this>;
38
+ static getModelAnnotations<T extends unknown>(constructor: new () => T): Promise<Record<string, {
39
+ annotationType: string;
40
+ metadata: any;
41
+ }>>;
42
+ preUpdate(): void;
43
+ postUpdate(): void;
44
+ preCreate(): void;
45
+ postCreate(): void;
46
+ static isSubclass<T extends RWSModel<T>, C extends new () => T>(constructor: C, baseClass: new () => T): boolean;
47
+ hasTimeSeries(): boolean;
48
+ static checkTimeSeries(constructor: any): boolean;
49
+ isDbVariable(variable: string): Promise<boolean>;
50
+ static checkDbVariable(constructor: any, variable: string): Promise<boolean>;
51
+ sanitizeDBData(data: any): any;
52
+ static watchCollection<T extends RWSModel<T>>(this: OpModelType<T>, preRun: () => void): Promise<any>;
53
+ static findOneBy<T extends RWSModel<T>>(this: OpModelType<T>, findParams?: FindByType): Promise<T | null>;
54
+ static find<T extends RWSModel<T>>(this: OpModelType<T>, id: string, findParams?: Omit<FindByType, 'conditions'>): Promise<T | null>;
55
+ static findBy<T extends RWSModel<T>>(this: OpModelType<T>, findParams?: FindByType): Promise<T[]>;
56
+ static delete<T extends RWSModel<T>>(this: OpModelType<T>, conditions: any): Promise<void>;
57
+ delete<T extends RWSModel<T>>(): Promise<void>;
58
+ static create<T extends RWSModel<T>>(this: new () => T, data: any): Promise<T>;
59
+ static loadModels(): OpModelType<any>[];
60
+ loadModels(): OpModelType<any>[];
61
+ private checkRelEnabled;
62
+ static setServices(services: IRWSModelServices): void;
63
+ getDb(): DBService;
64
+ static getDb(): DBService;
65
+ }
66
+ export { RWSModel };