@edirect/rate-limit-module 11.0.59 → 11.0.61

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 (82) hide show
  1. package/package.json +6 -23
  2. package/dist/README.md +0 -584
  3. package/dist/package.json +0 -41
  4. package/dist/src/decorators/rate-limiting-rule.decorator.d.ts +0 -10
  5. package/dist/src/decorators/rate-limiting-rule.decorator.d.ts.map +0 -1
  6. package/dist/src/decorators/rate-limiting-rule.decorator.js +0 -7
  7. package/dist/src/guards/rate-limiting.guard.d.ts +0 -21
  8. package/dist/src/guards/rate-limiting.guard.d.ts.map +0 -1
  9. package/dist/src/guards/rate-limiting.guard.js +0 -248
  10. package/dist/src/index.d.ts +0 -11
  11. package/dist/src/index.d.ts.map +0 -1
  12. package/dist/src/index.js +0 -14
  13. package/dist/src/main.d.ts +0 -2
  14. package/dist/src/main.d.ts.map +0 -1
  15. package/dist/src/main.js +0 -9
  16. package/dist/src/object.utils.d.ts +0 -3
  17. package/dist/src/object.utils.d.ts.map +0 -1
  18. package/dist/src/object.utils.js +0 -38
  19. package/dist/src/rate-limiting.module.d.ts +0 -6
  20. package/dist/src/rate-limiting.module.d.ts.map +0 -1
  21. package/dist/src/rate-limiting.module.js +0 -26
  22. package/dist/src/rules/dto/pagination.dto.d.ts +0 -6
  23. package/dist/src/rules/dto/pagination.dto.d.ts.map +0 -1
  24. package/dist/src/rules/dto/pagination.dto.js +0 -42
  25. package/dist/src/rules/dto/rule.dto.d.ts +0 -24
  26. package/dist/src/rules/dto/rule.dto.d.ts.map +0 -1
  27. package/dist/src/rules/dto/rule.dto.js +0 -198
  28. package/dist/src/rules/interface/pagination.interface.d.ts +0 -7
  29. package/dist/src/rules/interface/pagination.interface.d.ts.map +0 -1
  30. package/dist/src/rules/interface/pagination.interface.js +0 -2
  31. package/dist/src/rules/interface/rule.interface.d.ts +0 -29
  32. package/dist/src/rules/interface/rule.interface.d.ts.map +0 -1
  33. package/dist/src/rules/interface/rule.interface.js +0 -2
  34. package/dist/src/rules/rule.controller.d.ts +0 -14
  35. package/dist/src/rules/rule.controller.d.ts.map +0 -1
  36. package/dist/src/rules/rule.controller.js +0 -87
  37. package/dist/src/rules/rule.module.d.ts +0 -5
  38. package/dist/src/rules/rule.module.d.ts.map +0 -1
  39. package/dist/src/rules/rule.module.js +0 -36
  40. package/dist/src/rules/rule.repository.d.ts +0 -15
  41. package/dist/src/rules/rule.repository.d.ts.map +0 -1
  42. package/dist/src/rules/rule.repository.js +0 -79
  43. package/dist/src/rules/rule.schema.d.ts +0 -166
  44. package/dist/src/rules/rule.schema.d.ts.map +0 -1
  45. package/dist/src/rules/rule.schema.js +0 -150
  46. package/dist/src/rules/rule.service.d.ts +0 -26
  47. package/dist/src/rules/rule.service.d.ts.map +0 -1
  48. package/dist/src/rules/rule.service.js +0 -204
  49. package/dist/src/shared/cache/cache.service.d.ts +0 -10
  50. package/dist/src/shared/cache/cache.service.d.ts.map +0 -1
  51. package/dist/src/shared/cache/cache.service.js +0 -29
  52. package/dist/src/shared/dsl/dsl.interface.d.ts +0 -43
  53. package/dist/src/shared/dsl/dsl.interface.d.ts.map +0 -1
  54. package/dist/src/shared/dsl/dsl.interface.js +0 -9
  55. package/dist/src/shared/dsl/dsl.service.d.ts +0 -8
  56. package/dist/src/shared/dsl/dsl.service.d.ts.map +0 -1
  57. package/dist/src/shared/dsl/dsl.service.js +0 -87
  58. package/dist/src/shared/redis/redis.module.d.ts +0 -3
  59. package/dist/src/shared/redis/redis.module.d.ts.map +0 -1
  60. package/dist/src/shared/redis/redis.module.js +0 -32
  61. package/dist/src/shared/redis/redis.service.d.ts +0 -13
  62. package/dist/src/shared/redis/redis.service.d.ts.map +0 -1
  63. package/dist/src/shared/redis/redis.service.js +0 -53
  64. package/dist/src/shared/rule-engine/interface/rule-engine.interface.d.ts +0 -14
  65. package/dist/src/shared/rule-engine/interface/rule-engine.interface.d.ts.map +0 -1
  66. package/dist/src/shared/rule-engine/interface/rule-engine.interface.js +0 -2
  67. package/dist/src/shared/rule-engine/rule-engine.module.d.ts +0 -11
  68. package/dist/src/shared/rule-engine/rule-engine.module.d.ts.map +0 -1
  69. package/dist/src/shared/rule-engine/rule-engine.module.js +0 -51
  70. package/dist/src/shared/rule-engine/rule-engine.service.d.ts +0 -18
  71. package/dist/src/shared/rule-engine/rule-engine.service.d.ts.map +0 -1
  72. package/dist/src/shared/rule-engine/rule-engine.service.js +0 -134
  73. package/dist/src/shared/shared.module.d.ts +0 -3
  74. package/dist/src/shared/shared.module.d.ts.map +0 -1
  75. package/dist/src/shared/shared.module.js +0 -29
  76. package/dist/src/validators/rule.constraint.d.ts +0 -10
  77. package/dist/src/validators/rule.constraint.d.ts.map +0 -1
  78. package/dist/src/validators/rule.constraint.js +0 -49
  79. package/dist/src/validators/rule.validator.d.ts +0 -3
  80. package/dist/src/validators/rule.validator.d.ts.map +0 -1
  81. package/dist/src/validators/rule.validator.js +0 -16
  82. package/dist/tsconfig.lib.tsbuildinfo +0 -1
@@ -1,198 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FindRuleDTO = exports.CreateRuleDTO = void 0;
4
- const tslib_1 = require("tslib");
5
- const swagger_1 = require("@nestjs/swagger");
6
- const class_validator_1 = require("class-validator");
7
- const rule_validator_1 = require("../../validators/rule.validator");
8
- const pagination_dto_1 = require("./pagination.dto");
9
- class CreateRuleDTO {
10
- name;
11
- expression;
12
- targetAction;
13
- errorMessage;
14
- variables;
15
- variablesRequired;
16
- productType;
17
- partner;
18
- market;
19
- provider;
20
- }
21
- exports.CreateRuleDTO = CreateRuleDTO;
22
- tslib_1.__decorate([
23
- (0, swagger_1.ApiProperty)({
24
- type: String,
25
- required: true,
26
- }),
27
- (0, class_validator_1.IsNotEmpty)(),
28
- (0, class_validator_1.IsString)(),
29
- tslib_1.__metadata("design:type", String)
30
- ], CreateRuleDTO.prototype, "name", void 0);
31
- tslib_1.__decorate([
32
- (0, swagger_1.ApiProperty)({
33
- type: String,
34
- required: true,
35
- }),
36
- (0, class_validator_1.IsNotEmpty)(),
37
- (0, class_validator_1.IsString)(),
38
- (0, rule_validator_1.IsValidExpression)(),
39
- tslib_1.__metadata("design:type", String)
40
- ], CreateRuleDTO.prototype, "expression", void 0);
41
- tslib_1.__decorate([
42
- (0, swagger_1.ApiProperty)({
43
- type: String,
44
- required: true,
45
- }),
46
- (0, class_validator_1.IsNotEmpty)(),
47
- (0, class_validator_1.IsString)(),
48
- tslib_1.__metadata("design:type", String)
49
- ], CreateRuleDTO.prototype, "targetAction", void 0);
50
- tslib_1.__decorate([
51
- (0, swagger_1.ApiProperty)({
52
- type: String,
53
- required: false,
54
- }),
55
- (0, class_validator_1.IsNotEmpty)(),
56
- (0, class_validator_1.IsString)(),
57
- (0, class_validator_1.IsOptional)(),
58
- tslib_1.__metadata("design:type", String)
59
- ], CreateRuleDTO.prototype, "errorMessage", void 0);
60
- tslib_1.__decorate([
61
- (0, swagger_1.ApiProperty)({
62
- type: Object,
63
- required: false,
64
- }),
65
- (0, class_validator_1.IsNotEmpty)(),
66
- (0, class_validator_1.IsObject)(),
67
- (0, class_validator_1.IsOptional)(),
68
- tslib_1.__metadata("design:type", Object)
69
- ], CreateRuleDTO.prototype, "variables", void 0);
70
- tslib_1.__decorate([
71
- (0, swagger_1.ApiProperty)({
72
- type: Boolean,
73
- required: false,
74
- }),
75
- (0, class_validator_1.IsNotEmpty)(),
76
- (0, class_validator_1.IsBoolean)(),
77
- (0, class_validator_1.IsOptional)(),
78
- tslib_1.__metadata("design:type", Boolean)
79
- ], CreateRuleDTO.prototype, "variablesRequired", void 0);
80
- tslib_1.__decorate([
81
- (0, swagger_1.ApiProperty)({
82
- type: String,
83
- required: false,
84
- }),
85
- (0, class_validator_1.IsNotEmpty)(),
86
- (0, class_validator_1.IsString)(),
87
- (0, class_validator_1.IsOptional)(),
88
- tslib_1.__metadata("design:type", String)
89
- ], CreateRuleDTO.prototype, "productType", void 0);
90
- tslib_1.__decorate([
91
- (0, swagger_1.ApiProperty)({
92
- type: String,
93
- required: true,
94
- }),
95
- (0, class_validator_1.IsNotEmpty)(),
96
- (0, class_validator_1.IsString)(),
97
- tslib_1.__metadata("design:type", String)
98
- ], CreateRuleDTO.prototype, "partner", void 0);
99
- tslib_1.__decorate([
100
- (0, swagger_1.ApiProperty)({
101
- type: String,
102
- required: true,
103
- }),
104
- (0, class_validator_1.IsNotEmpty)(),
105
- (0, class_validator_1.IsString)(),
106
- (0, class_validator_1.IsOptional)(),
107
- tslib_1.__metadata("design:type", String)
108
- ], CreateRuleDTO.prototype, "market", void 0);
109
- tslib_1.__decorate([
110
- (0, swagger_1.ApiProperty)({
111
- type: String,
112
- required: false,
113
- }),
114
- (0, class_validator_1.IsNotEmpty)(),
115
- (0, class_validator_1.IsString)(),
116
- (0, class_validator_1.IsOptional)(),
117
- tslib_1.__metadata("design:type", String)
118
- ], CreateRuleDTO.prototype, "provider", void 0);
119
- class FindRuleDTO extends pagination_dto_1.PaginationDTO {
120
- name;
121
- targetAction;
122
- partner;
123
- productType;
124
- isEnabled;
125
- provider;
126
- market;
127
- }
128
- exports.FindRuleDTO = FindRuleDTO;
129
- tslib_1.__decorate([
130
- (0, swagger_1.ApiProperty)({
131
- type: String,
132
- required: false,
133
- }),
134
- (0, class_validator_1.IsNotEmpty)(),
135
- (0, class_validator_1.IsString)(),
136
- (0, class_validator_1.IsOptional)(),
137
- tslib_1.__metadata("design:type", String)
138
- ], FindRuleDTO.prototype, "name", void 0);
139
- tslib_1.__decorate([
140
- (0, swagger_1.ApiProperty)({
141
- type: String,
142
- required: false,
143
- }),
144
- (0, class_validator_1.IsNotEmpty)(),
145
- (0, class_validator_1.IsString)(),
146
- (0, class_validator_1.IsOptional)(),
147
- tslib_1.__metadata("design:type", String)
148
- ], FindRuleDTO.prototype, "targetAction", void 0);
149
- tslib_1.__decorate([
150
- (0, swagger_1.ApiProperty)({
151
- type: String,
152
- required: true,
153
- }),
154
- (0, class_validator_1.IsNotEmpty)(),
155
- (0, class_validator_1.IsString)(),
156
- (0, class_validator_1.IsOptional)(),
157
- tslib_1.__metadata("design:type", String)
158
- ], FindRuleDTO.prototype, "partner", void 0);
159
- tslib_1.__decorate([
160
- (0, swagger_1.ApiProperty)({
161
- type: String,
162
- required: true,
163
- }),
164
- (0, class_validator_1.IsNotEmpty)(),
165
- (0, class_validator_1.IsString)(),
166
- (0, class_validator_1.IsOptional)(),
167
- tslib_1.__metadata("design:type", String)
168
- ], FindRuleDTO.prototype, "productType", void 0);
169
- tslib_1.__decorate([
170
- (0, swagger_1.ApiProperty)({
171
- type: String,
172
- required: false,
173
- }),
174
- (0, class_validator_1.IsNotEmpty)(),
175
- (0, class_validator_1.IsBoolean)(),
176
- (0, class_validator_1.IsOptional)(),
177
- tslib_1.__metadata("design:type", Boolean)
178
- ], FindRuleDTO.prototype, "isEnabled", void 0);
179
- tslib_1.__decorate([
180
- (0, swagger_1.ApiProperty)({
181
- type: String,
182
- required: false,
183
- }),
184
- (0, class_validator_1.IsNotEmpty)(),
185
- (0, class_validator_1.IsString)(),
186
- (0, class_validator_1.IsOptional)(),
187
- tslib_1.__metadata("design:type", String)
188
- ], FindRuleDTO.prototype, "provider", void 0);
189
- tslib_1.__decorate([
190
- (0, swagger_1.ApiProperty)({
191
- type: String,
192
- required: false,
193
- }),
194
- (0, class_validator_1.IsNotEmpty)(),
195
- (0, class_validator_1.IsString)(),
196
- (0, class_validator_1.IsOptional)(),
197
- tslib_1.__metadata("design:type", String)
198
- ], FindRuleDTO.prototype, "market", void 0);
@@ -1,7 +0,0 @@
1
- export interface IPagination<T> {
2
- currentPage: number;
3
- data: T;
4
- total: number;
5
- totalPages: number;
6
- }
7
- //# sourceMappingURL=pagination.interface.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pagination.interface.d.ts","sourceRoot":"","sources":["../../../../src/rules/interface/pagination.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,CAAC,CAAC;IACR,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,29 +0,0 @@
1
- export interface IRule {
2
- ruleId?: string;
3
- name: string;
4
- targetAction?: string;
5
- expression: string;
6
- enabled?: boolean;
7
- errorMessage?: string;
8
- partner?: string;
9
- provider?: string;
10
- market?: string;
11
- productType?: string;
12
- variables?: Record<string, unknown>;
13
- variablesRequired?: boolean;
14
- deletedAt?: Date;
15
- createdAt?: Date;
16
- updatedAt?: Date;
17
- }
18
- export interface IFindRule {
19
- name?: string;
20
- targetAction?: string;
21
- enabled?: string;
22
- partner?: string | undefined;
23
- provider?: string | undefined;
24
- market?: string | undefined;
25
- productType?: string | undefined;
26
- page: number;
27
- limit: number;
28
- }
29
- //# sourceMappingURL=rule.interface.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rule.interface.d.ts","sourceRoot":"","sources":["../../../../src/rules/interface/rule.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,14 +0,0 @@
1
- import { CreateRuleDTO, FindRuleDTO } from './dto/rule.dto';
2
- import { IPagination } from './interface/pagination.interface';
3
- import { IRule } from './interface/rule.interface';
4
- import { RuleService } from './rule.service';
5
- export declare class RuleController {
6
- private readonly ruleService;
7
- constructor(ruleService: RuleService);
8
- create(dto: CreateRuleDTO): Promise<IRule>;
9
- findAll(query: FindRuleDTO): Promise<IPagination<IRule[]>>;
10
- findOne(id: string): Promise<IRule>;
11
- updateSale(id: string, patchData: Partial<IRule>): Promise<IRule | null>;
12
- delete(id: string): Promise<void>;
13
- }
14
- //# sourceMappingURL=rule.controller.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rule.controller.d.ts","sourceRoot":"","sources":["../../../src/rules/rule.controller.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAM7C,qBAEa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,EAAE,WAAW;IAMrD,MAAM,CAAS,GAAG,EAAE,aAAa;IAOjC,OAAO,CAAU,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC;IAOnE,OAAO,CAAc,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAOhD,UAAU,CAAc,EAAE,EAAE,MAAM,EAAU,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC;IAOrE,MAAM,CAAc,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG/C"}
@@ -1,87 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RuleController = void 0;
4
- const tslib_1 = require("tslib");
5
- const common_1 = require("@nestjs/common");
6
- const swagger_1 = require("@nestjs/swagger");
7
- const auth_1 = require("@edirect/auth");
8
- const rule_dto_1 = require("./dto/rule.dto");
9
- const rule_service_1 = require("./rule.service");
10
- var ResourceServiceEnum;
11
- (function (ResourceServiceEnum) {
12
- ResourceServiceEnum["DEFAULT"] = "Default Resource";
13
- })(ResourceServiceEnum || (ResourceServiceEnum = {}));
14
- let RuleController = class RuleController {
15
- ruleService;
16
- constructor(ruleService) {
17
- this.ruleService = ruleService;
18
- }
19
- create(dto) {
20
- return this.ruleService.create(dto);
21
- }
22
- findAll(query) {
23
- return this.ruleService.findAll(query);
24
- }
25
- findOne(id) {
26
- return this.ruleService.findById(id);
27
- }
28
- updateSale(id, patchData) {
29
- return this.ruleService.updateOne(id, patchData);
30
- }
31
- delete(id) {
32
- return this.ruleService.delete(id);
33
- }
34
- };
35
- exports.RuleController = RuleController;
36
- tslib_1.__decorate([
37
- (0, common_1.Post)(),
38
- (0, swagger_1.ApiResponse)({ status: 201 }),
39
- (0, auth_1.Resources)(ResourceServiceEnum.DEFAULT),
40
- (0, common_1.UsePipes)(new common_1.ValidationPipe({ transform: true })),
41
- tslib_1.__param(0, (0, common_1.Body)()),
42
- tslib_1.__metadata("design:type", Function),
43
- tslib_1.__metadata("design:paramtypes", [rule_dto_1.CreateRuleDTO]),
44
- tslib_1.__metadata("design:returntype", void 0)
45
- ], RuleController.prototype, "create", null);
46
- tslib_1.__decorate([
47
- (0, common_1.Get)(),
48
- (0, auth_1.Resources)(ResourceServiceEnum.DEFAULT),
49
- (0, common_1.UsePipes)(new common_1.ValidationPipe({ transform: true })),
50
- tslib_1.__param(0, (0, common_1.Query)()),
51
- tslib_1.__metadata("design:type", Function),
52
- tslib_1.__metadata("design:paramtypes", [rule_dto_1.FindRuleDTO]),
53
- tslib_1.__metadata("design:returntype", Promise)
54
- ], RuleController.prototype, "findAll", null);
55
- tslib_1.__decorate([
56
- (0, common_1.Get)(':id'),
57
- (0, auth_1.Resources)(ResourceServiceEnum.DEFAULT),
58
- (0, common_1.UsePipes)(new common_1.ValidationPipe({ transform: true })),
59
- tslib_1.__param(0, (0, common_1.Param)('id')),
60
- tslib_1.__metadata("design:type", Function),
61
- tslib_1.__metadata("design:paramtypes", [String]),
62
- tslib_1.__metadata("design:returntype", Promise)
63
- ], RuleController.prototype, "findOne", null);
64
- tslib_1.__decorate([
65
- (0, common_1.Patch)(':id'),
66
- (0, auth_1.Resources)(ResourceServiceEnum.DEFAULT),
67
- (0, common_1.UsePipes)(new common_1.ValidationPipe({ transform: true })),
68
- tslib_1.__param(0, (0, common_1.Param)('id')),
69
- tslib_1.__param(1, (0, common_1.Body)()),
70
- tslib_1.__metadata("design:type", Function),
71
- tslib_1.__metadata("design:paramtypes", [String, Object]),
72
- tslib_1.__metadata("design:returntype", void 0)
73
- ], RuleController.prototype, "updateSale", null);
74
- tslib_1.__decorate([
75
- (0, common_1.Delete)(':id'),
76
- (0, auth_1.Resources)(ResourceServiceEnum.DEFAULT),
77
- (0, common_1.UsePipes)(new common_1.ValidationPipe({ transform: true })),
78
- tslib_1.__param(0, (0, common_1.Param)('id')),
79
- tslib_1.__metadata("design:type", Function),
80
- tslib_1.__metadata("design:paramtypes", [String]),
81
- tslib_1.__metadata("design:returntype", Promise)
82
- ], RuleController.prototype, "delete", null);
83
- exports.RuleController = RuleController = tslib_1.__decorate([
84
- (0, swagger_1.ApiTags)('rate-limiting-rule'),
85
- (0, common_1.Controller)('/rule'),
86
- tslib_1.__metadata("design:paramtypes", [rule_service_1.RuleService])
87
- ], RuleController);
@@ -1,5 +0,0 @@
1
- import { DynamicModule } from '@nestjs/common';
2
- export declare class RuleModule {
3
- static register(connectionToken: string): DynamicModule;
4
- }
5
- //# sourceMappingURL=rule.module.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rule.module.d.ts","sourceRoot":"","sources":["../../../src/rules/rule.module.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAU,MAAM,gBAAgB,CAAC;AASvD,qBACa,UAAU;IACrB,MAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,aAAa;CAoBxD"}
@@ -1,36 +0,0 @@
1
- "use strict";
2
- var RuleModule_1;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.RuleModule = void 0;
5
- const tslib_1 = require("tslib");
6
- const logger_1 = require("@edirect/logger");
7
- const common_1 = require("@nestjs/common");
8
- const mongoose_1 = require("@nestjs/mongoose");
9
- const shared_module_1 = require("../shared/shared.module");
10
- const rule_controller_1 = require("./rule.controller");
11
- const rule_repository_1 = require("./rule.repository");
12
- const rule_schema_1 = require("./rule.schema");
13
- const rule_service_1 = require("./rule.service");
14
- let RuleModule = RuleModule_1 = class RuleModule {
15
- static register(connectionToken) {
16
- const enableController = process.env.ENABLE_RATE_LIMITING_RULE_CONTROLLER === 'true';
17
- const modelProvider = {
18
- provide: (0, mongoose_1.getModelToken)(rule_schema_1.RateLimitingRule.name),
19
- useFactory: (connection) => {
20
- return connection.model(rule_schema_1.RateLimitingRule.name, rule_schema_1.RateLimitingRuleSchema);
21
- },
22
- inject: [connectionToken],
23
- };
24
- return {
25
- module: RuleModule_1,
26
- imports: [logger_1.LoggerModule, shared_module_1.SharedModule],
27
- controllers: enableController ? [rule_controller_1.RuleController] : [],
28
- providers: [modelProvider, rule_service_1.RuleService, rule_repository_1.RuleRepository],
29
- exports: [rule_service_1.RuleService, rule_repository_1.RuleRepository],
30
- };
31
- }
32
- };
33
- exports.RuleModule = RuleModule;
34
- exports.RuleModule = RuleModule = RuleModule_1 = tslib_1.__decorate([
35
- (0, common_1.Module)({})
36
- ], RuleModule);
@@ -1,15 +0,0 @@
1
- import { Model } from 'mongoose';
2
- import { IPagination } from './interface/pagination.interface';
3
- import { IFindRule, IRule } from './interface/rule.interface';
4
- import { RuleDocument } from './rule.schema';
5
- export declare class RuleRepository {
6
- private readonly model;
7
- private readonly MAX_LIMIT;
8
- constructor(model: Model<RuleDocument>);
9
- save(data: IRule): Promise<IRule>;
10
- update(ruleRateId: string, data: Partial<IRule>): Promise<IRule | null>;
11
- findOneByRateId(rateRuleId: string): Promise<IRule | null>;
12
- findAll(query: IFindRule): Promise<IPagination<IRule[]>>;
13
- private buildQuery;
14
- }
15
- //# sourceMappingURL=rule.repository.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rule.repository.d.ts","sourceRoot":"","sources":["../../../src/rules/rule.repository.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAoB,YAAY,EAAE,MAAM,eAAe,CAAC;AAE/D,qBACa,cAAc;IAKvB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAJxB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAe;gBAItB,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC;IAGvC,IAAI,CAAC,IAAI,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAIjC,MAAM,CACV,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,GACnB,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IAMlB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IAShE,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC;IA2CxD,OAAO,CAAC,UAAU;CASnB"}
@@ -1,79 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RuleRepository = void 0;
4
- const tslib_1 = require("tslib");
5
- const common_1 = require("@nestjs/common");
6
- const mongoose_1 = require("@nestjs/mongoose");
7
- const mongoose_2 = require("mongoose");
8
- const rule_schema_1 = require("./rule.schema");
9
- let RuleRepository = class RuleRepository {
10
- model;
11
- MAX_LIMIT = 100;
12
- constructor(model) {
13
- this.model = model;
14
- }
15
- async save(data) {
16
- return new this.model(data).save();
17
- }
18
- async update(ruleRateId, data) {
19
- return this.model.findOneAndUpdate({ ruleId: ruleRateId }, data, {
20
- new: true,
21
- });
22
- }
23
- async findOneByRateId(rateRuleId) {
24
- return this.model
25
- .findOne({ ruleId: rateRuleId })
26
- .select('-__v')
27
- .select('-_id')
28
- .lean()
29
- .exec();
30
- }
31
- findAll(query) {
32
- const { page, limit } = query;
33
- const LIMIT = limit && limit < this.MAX_LIMIT ? limit : this.MAX_LIMIT;
34
- let limitCount = 500;
35
- while (limitCount < page * LIMIT) {
36
- limitCount += 500;
37
- }
38
- const queryBuilt = this.buildQuery(query);
39
- const count = this.model
40
- .countDocuments(queryBuilt)
41
- .limit(limitCount)
42
- .exec();
43
- const rules = this.model
44
- .find(queryBuilt)
45
- .limit(LIMIT)
46
- .skip((page - 1) * LIMIT)
47
- .select('-__v')
48
- .exec();
49
- return Promise.all([count, rules]).then(values => {
50
- const [count, result] = values;
51
- const mapped = result.map(e => e.toJSON());
52
- let currentCount = count;
53
- if (count > limitCount) {
54
- currentCount = limitCount;
55
- }
56
- const totalPages = Math.ceil(count / LIMIT);
57
- return {
58
- total: currentCount,
59
- currentPage: +page || 1,
60
- totalPages,
61
- data: mapped,
62
- };
63
- });
64
- }
65
- buildQuery(queryParameters) {
66
- return Object.entries(queryParameters).reduce((acc, [key, value]) => {
67
- if (key === 'page' || key === 'limit')
68
- return acc;
69
- acc[key] = value || '';
70
- return acc;
71
- }, {});
72
- }
73
- };
74
- exports.RuleRepository = RuleRepository;
75
- exports.RuleRepository = RuleRepository = tslib_1.__decorate([
76
- (0, common_1.Injectable)(),
77
- tslib_1.__param(0, (0, mongoose_1.InjectModel)(rule_schema_1.RateLimitingRule.name)),
78
- tslib_1.__metadata("design:paramtypes", [mongoose_2.Model])
79
- ], RuleRepository);
@@ -1,166 +0,0 @@
1
- import { Document } from 'mongoose';
2
- import { IRule } from './interface/rule.interface';
3
- export type RuleDocument = RateLimitingRule & Document;
4
- export declare class RateLimitingRule implements IRule {
5
- ruleId: string;
6
- name: string;
7
- targetAction?: string;
8
- expression: string;
9
- enabled: boolean;
10
- market: string;
11
- errorMessage?: string;
12
- partner: string;
13
- provider?: string;
14
- productType?: string;
15
- variables?: Record<string, string>;
16
- variablesRequired?: boolean;
17
- deletedAt?: Date;
18
- createdAt?: Date;
19
- updatedAt?: Date;
20
- }
21
- export declare const RateLimitingRuleSchema: import("mongoose").Schema<RateLimitingRule, import("mongoose").Model<RateLimitingRule, any, any, any, any, any, RateLimitingRule>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, RateLimitingRule, Document<unknown, {}, RateLimitingRule, {
22
- id: string;
23
- }, import("mongoose").DefaultSchemaOptions> & Omit<RateLimitingRule & {
24
- _id: import("mongoose").Types.ObjectId;
25
- } & {
26
- __v: number;
27
- }, "id"> & {
28
- id: string;
29
- }, {
30
- ruleId?: import("mongoose").SchemaDefinitionProperty<string, RateLimitingRule, Document<unknown, {}, RateLimitingRule, {
31
- id: string;
32
- }, import("mongoose").DefaultSchemaOptions> & Omit<RateLimitingRule & {
33
- _id: import("mongoose").Types.ObjectId;
34
- } & {
35
- __v: number;
36
- }, "id"> & {
37
- id: string;
38
- }> | undefined;
39
- name?: import("mongoose").SchemaDefinitionProperty<string, RateLimitingRule, Document<unknown, {}, RateLimitingRule, {
40
- id: string;
41
- }, import("mongoose").DefaultSchemaOptions> & Omit<RateLimitingRule & {
42
- _id: import("mongoose").Types.ObjectId;
43
- } & {
44
- __v: number;
45
- }, "id"> & {
46
- id: string;
47
- }> | undefined;
48
- targetAction?: import("mongoose").SchemaDefinitionProperty<string | undefined, RateLimitingRule, Document<unknown, {}, RateLimitingRule, {
49
- id: string;
50
- }, import("mongoose").DefaultSchemaOptions> & Omit<RateLimitingRule & {
51
- _id: import("mongoose").Types.ObjectId;
52
- } & {
53
- __v: number;
54
- }, "id"> & {
55
- id: string;
56
- }> | undefined;
57
- expression?: import("mongoose").SchemaDefinitionProperty<string, RateLimitingRule, Document<unknown, {}, RateLimitingRule, {
58
- id: string;
59
- }, import("mongoose").DefaultSchemaOptions> & Omit<RateLimitingRule & {
60
- _id: import("mongoose").Types.ObjectId;
61
- } & {
62
- __v: number;
63
- }, "id"> & {
64
- id: string;
65
- }> | undefined;
66
- enabled?: import("mongoose").SchemaDefinitionProperty<boolean, RateLimitingRule, Document<unknown, {}, RateLimitingRule, {
67
- id: string;
68
- }, import("mongoose").DefaultSchemaOptions> & Omit<RateLimitingRule & {
69
- _id: import("mongoose").Types.ObjectId;
70
- } & {
71
- __v: number;
72
- }, "id"> & {
73
- id: string;
74
- }> | undefined;
75
- market?: import("mongoose").SchemaDefinitionProperty<string, RateLimitingRule, Document<unknown, {}, RateLimitingRule, {
76
- id: string;
77
- }, import("mongoose").DefaultSchemaOptions> & Omit<RateLimitingRule & {
78
- _id: import("mongoose").Types.ObjectId;
79
- } & {
80
- __v: number;
81
- }, "id"> & {
82
- id: string;
83
- }> | undefined;
84
- errorMessage?: import("mongoose").SchemaDefinitionProperty<string | undefined, RateLimitingRule, Document<unknown, {}, RateLimitingRule, {
85
- id: string;
86
- }, import("mongoose").DefaultSchemaOptions> & Omit<RateLimitingRule & {
87
- _id: import("mongoose").Types.ObjectId;
88
- } & {
89
- __v: number;
90
- }, "id"> & {
91
- id: string;
92
- }> | undefined;
93
- partner?: import("mongoose").SchemaDefinitionProperty<string, RateLimitingRule, Document<unknown, {}, RateLimitingRule, {
94
- id: string;
95
- }, import("mongoose").DefaultSchemaOptions> & Omit<RateLimitingRule & {
96
- _id: import("mongoose").Types.ObjectId;
97
- } & {
98
- __v: number;
99
- }, "id"> & {
100
- id: string;
101
- }> | undefined;
102
- provider?: import("mongoose").SchemaDefinitionProperty<string | undefined, RateLimitingRule, Document<unknown, {}, RateLimitingRule, {
103
- id: string;
104
- }, import("mongoose").DefaultSchemaOptions> & Omit<RateLimitingRule & {
105
- _id: import("mongoose").Types.ObjectId;
106
- } & {
107
- __v: number;
108
- }, "id"> & {
109
- id: string;
110
- }> | undefined;
111
- productType?: import("mongoose").SchemaDefinitionProperty<string | undefined, RateLimitingRule, Document<unknown, {}, RateLimitingRule, {
112
- id: string;
113
- }, import("mongoose").DefaultSchemaOptions> & Omit<RateLimitingRule & {
114
- _id: import("mongoose").Types.ObjectId;
115
- } & {
116
- __v: number;
117
- }, "id"> & {
118
- id: string;
119
- }> | undefined;
120
- variables?: import("mongoose").SchemaDefinitionProperty<Record<string, string> | undefined, RateLimitingRule, Document<unknown, {}, RateLimitingRule, {
121
- id: string;
122
- }, import("mongoose").DefaultSchemaOptions> & Omit<RateLimitingRule & {
123
- _id: import("mongoose").Types.ObjectId;
124
- } & {
125
- __v: number;
126
- }, "id"> & {
127
- id: string;
128
- }> | undefined;
129
- variablesRequired?: import("mongoose").SchemaDefinitionProperty<boolean | undefined, RateLimitingRule, Document<unknown, {}, RateLimitingRule, {
130
- id: string;
131
- }, import("mongoose").DefaultSchemaOptions> & Omit<RateLimitingRule & {
132
- _id: import("mongoose").Types.ObjectId;
133
- } & {
134
- __v: number;
135
- }, "id"> & {
136
- id: string;
137
- }> | undefined;
138
- deletedAt?: import("mongoose").SchemaDefinitionProperty<Date | undefined, RateLimitingRule, Document<unknown, {}, RateLimitingRule, {
139
- id: string;
140
- }, import("mongoose").DefaultSchemaOptions> & Omit<RateLimitingRule & {
141
- _id: import("mongoose").Types.ObjectId;
142
- } & {
143
- __v: number;
144
- }, "id"> & {
145
- id: string;
146
- }> | undefined;
147
- createdAt?: import("mongoose").SchemaDefinitionProperty<Date | undefined, RateLimitingRule, Document<unknown, {}, RateLimitingRule, {
148
- id: string;
149
- }, import("mongoose").DefaultSchemaOptions> & Omit<RateLimitingRule & {
150
- _id: import("mongoose").Types.ObjectId;
151
- } & {
152
- __v: number;
153
- }, "id"> & {
154
- id: string;
155
- }> | undefined;
156
- updatedAt?: import("mongoose").SchemaDefinitionProperty<Date | undefined, RateLimitingRule, Document<unknown, {}, RateLimitingRule, {
157
- id: string;
158
- }, import("mongoose").DefaultSchemaOptions> & Omit<RateLimitingRule & {
159
- _id: import("mongoose").Types.ObjectId;
160
- } & {
161
- __v: number;
162
- }, "id"> & {
163
- id: string;
164
- }> | undefined;
165
- }, RateLimitingRule>;
166
- //# sourceMappingURL=rule.schema.d.ts.map