@aldb2b/common 1.0.183 → 1.0.185

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 (35) hide show
  1. package/build/decorators/get-user-decorator.js +2 -2
  2. package/build/decorators/get-user-decorator.js.map +1 -1
  3. package/build/events/subjects.d.ts +1 -0
  4. package/build/events/subjects.js +1 -0
  5. package/build/events/subjects.js.map +1 -1
  6. package/build/events/subtract-subscription-limit.interface.d.ts +13 -0
  7. package/build/events/subtract-subscription-limit.interface.js +3 -0
  8. package/build/events/subtract-subscription-limit.interface.js.map +1 -0
  9. package/build/events/subtract-subscription-point.interface.d.ts +1 -1
  10. package/build/index.d.ts +6 -0
  11. package/build/index.js +6 -0
  12. package/build/index.js.map +1 -1
  13. package/build/middlewares/authorizer.middleware.js +1 -0
  14. package/build/middlewares/authorizer.middleware.js.map +1 -1
  15. package/build/middlewares/subscription-subtractor.middleware.d.ts +12 -0
  16. package/build/middlewares/subscription-subtractor.middleware.js +112 -0
  17. package/build/middlewares/subscription-subtractor.middleware.js.map +1 -0
  18. package/build/middlewares/{subscription.middleware.d.ts → subscription-validator.middleware.d.ts} +1 -1
  19. package/build/middlewares/{subscription.middleware.js → subscription-validator.middleware.js} +24 -22
  20. package/build/middlewares/subscription-validator.middleware.js.map +1 -0
  21. package/build/tsconfig.tsbuildinfo +98 -28
  22. package/build/types/enddpoint.interface.d.ts +5 -0
  23. package/build/types/endpoint-type.enum.d.ts +5 -0
  24. package/build/types/endpoint-type.enum.js +10 -0
  25. package/build/types/endpoint-type.enum.js.map +1 -0
  26. package/build/types/feature.interface.d.ts +1 -0
  27. package/build/types/header-user.interface.d.ts +1 -0
  28. package/build/types/subscription-model.enum.d.ts +4 -0
  29. package/build/types/subscription-model.enum.js +9 -0
  30. package/build/types/subscription-model.enum.js.map +1 -0
  31. package/build/types/user-language.enum.d.ts +5 -0
  32. package/build/types/user-language.enum.js +10 -0
  33. package/build/types/user-language.enum.js.map +1 -0
  34. package/package.json +1 -1
  35. package/build/middlewares/subscription.middleware.js.map +0 -1
@@ -4,10 +4,10 @@ exports.GetUser = void 0;
4
4
  const common_1 = require("@nestjs/common");
5
5
  exports.GetUser = common_1.createParamDecorator((data, ctx) => {
6
6
  const req = ctx.switchToHttp().getRequest();
7
- const { id, email, role, type, company, contactId } = req.headers;
7
+ const { id, email, role, type, company, contactId, language } = req.headers;
8
8
  if (!id || !email || !role || !type) {
9
9
  throw new common_1.BadRequestException('Invalid header');
10
10
  }
11
- return { id, email, role, type, company, contactId };
11
+ return { id, email, role, type, company, contactId, language };
12
12
  });
13
13
  //# sourceMappingURL=get-user-decorator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-user-decorator.js","sourceRoot":"","sources":["../../src/decorators/get-user-decorator.ts"],"names":[],"mappings":";;;AAAA,2CAIuB;AAGV,QAAA,OAAO,GAAG,6BAAoB,CACzC,CAAC,IAAI,EAAE,GAAqB,EAAc,EAAE;IAC1C,MAAM,GAAG,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAA;IAC3C,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC,OAAO,CAAA;IACjE,IAAI,CAAC,EAAE,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE;QACnC,MAAM,IAAI,4BAAmB,CAAC,gBAAgB,CAAC,CAAA;KAChD;IACD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,CAAA;AACtD,CAAC,CACF,CAAA"}
1
+ {"version":3,"file":"get-user-decorator.js","sourceRoot":"","sources":["../../src/decorators/get-user-decorator.ts"],"names":[],"mappings":";;;AAAA,2CAIuB;AAGV,QAAA,OAAO,GAAG,6BAAoB,CACzC,CAAC,IAAI,EAAE,GAAqB,EAAc,EAAE;IAC1C,MAAM,GAAG,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAA;IAC3C,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAC,OAAO,CAAA;IAC3E,IAAI,CAAC,EAAE,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE;QACnC,MAAM,IAAI,4BAAmB,CAAC,gBAAgB,CAAC,CAAA;KAChD;IACD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAA;AAChE,CAAC,CACF,CAAA"}
@@ -71,5 +71,6 @@ export declare enum Subjects {
71
71
  CreateMeetingEvent = "createMeetingEvent",
72
72
  HasSubscription = "hasSubscription",
73
73
  SubtractSubscriptionPoint = "subscription:substractPoint",
74
+ SubtractSubscriptionLimit = "subscription:substractLimit",
74
75
  UpdateCompanyMeetingStats = "updateCompanyMeetingStats"
75
76
  }
@@ -75,6 +75,7 @@ var Subjects;
75
75
  Subjects["CreateMeetingEvent"] = "createMeetingEvent";
76
76
  Subjects["HasSubscription"] = "hasSubscription";
77
77
  Subjects["SubtractSubscriptionPoint"] = "subscription:substractPoint";
78
+ Subjects["SubtractSubscriptionLimit"] = "subscription:substractLimit";
78
79
  Subjects["UpdateCompanyMeetingStats"] = "updateCompanyMeetingStats";
79
80
  })(Subjects = exports.Subjects || (exports.Subjects = {}));
80
81
  //# sourceMappingURL=subjects.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"subjects.js","sourceRoot":"","sources":["../../src/events/subjects.ts"],"names":[],"mappings":";;;AAAA,IAAY,QA0EX;AA1ED,WAAY,QAAQ;IAClB,yCAA6B,CAAA;IAC7B,mCAAuB,CAAA;IACvB,4CAAgC,CAAA;IAChC,iCAAqB,CAAA;IACrB,uCAA2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C,kDAAsC,CAAA;IACtC,4CAAgC,CAAA;IAChC,4CAAgC,CAAA;IAChC,uDAA2C,CAAA;IAC3C,qDAAyC,CAAA;IACzC,2CAA+B,CAAA;IAC/B,8CAAkC,CAAA;IAClC,8CAAkC,CAAA;IAClC,8CAAkC,CAAA;IAClC,8CAAkC,CAAA;IAClC,8CAAkC,CAAA;IAClC,8CAAkC,CAAA;IAClC,8CAAkC,CAAA;IAClC,8CAAkC,CAAA;IAClC,0CAA8B,CAAA;IAC9B,oDAAwC,CAAA;IACxC,oEAAwD,CAAA;IACxD,0CAA8B,CAAA;IAC9B,sCAA0B,CAAA;IAC1B,sCAA0B,CAAA;IAC1B,kDAAsC,CAAA;IACtC,kDAAsC,CAAA;IACtC,8CAAkC,CAAA;IAClC,8CAAkC,CAAA;IAClC,4DAAgD,CAAA;IAChD,4DAAgD,CAAA;IAChD,qDAAyC,CAAA;IACzC,iDAAqC,CAAA;IACrC,qDAAyC,CAAA;IACzC,+CAAmC,CAAA;IACnC,qEAAyD,CAAA;IACzD,qEAAyD,CAAA;IACzD,mEAAuD,CAAA;AACzD,CAAC,EA3EW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QA2EnB"}
@@ -0,0 +1,13 @@
1
+ import { Subjects } from './subjects';
2
+ export declare namespace SubtractSubscriptionLimit {
3
+ interface Context {
4
+ subject: Subjects.SubtractSubscriptionLimit;
5
+ data: Data;
6
+ }
7
+ interface Data {
8
+ limit: number;
9
+ id: string;
10
+ featureId: string;
11
+ endpointId: string;
12
+ }
13
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=subtract-subscription-limit.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subtract-subscription-limit.interface.js","sourceRoot":"","sources":["../../src/events/subtract-subscription-limit.interface.ts"],"names":[],"mappings":""}
@@ -1,7 +1,7 @@
1
1
  import { Subjects } from './subjects';
2
2
  export declare namespace SubtractSubscriptionPoint {
3
3
  interface Context {
4
- subject: Subjects.AddCompanyCRM;
4
+ subject: Subjects.SubtractSubscriptionPoint;
5
5
  data: Data;
6
6
  }
7
7
  interface Data {
package/build/index.d.ts CHANGED
@@ -74,6 +74,7 @@ export * from './events/sync-accessibility-creation.interface';
74
74
  export * from './events/campaign-meeting-request-created.interface';
75
75
  export * from './events/has-subscription.interface';
76
76
  export * from './events/subtract-subscription-point.interface';
77
+ export * from './events/subtract-subscription-limit.interface';
77
78
  export * from './events/update-company-meeting-stats.interface';
78
79
  export * from './validators/conditional-required';
79
80
  export * from './validators/date-validator';
@@ -120,8 +121,13 @@ export * from './types/notification-event.enum';
120
121
  export * from './types/calendar-source-type.enum';
121
122
  export * from './types/notification-type.enum';
122
123
  export * from './types/record-type.enum';
124
+ export * from './types/enddpoint.interface';
125
+ export * from './types/subscription-model.enum';
126
+ export * from './types/user-language.enum';
123
127
  export * from './middlewares/app.middleware';
124
128
  export * from './middlewares/authorizer.middleware';
129
+ export * from './middlewares/subscription-subtractor.middleware';
130
+ export * from './middlewares/subscription-validator.middleware';
125
131
  export * from './utils/create-default-directories';
126
132
  export * from './utils/equal-array-object';
127
133
  export * from './utils/equal-object';
package/build/index.js CHANGED
@@ -86,6 +86,7 @@ __exportStar(require("./events/sync-accessibility-creation.interface"), exports)
86
86
  __exportStar(require("./events/campaign-meeting-request-created.interface"), exports);
87
87
  __exportStar(require("./events/has-subscription.interface"), exports);
88
88
  __exportStar(require("./events/subtract-subscription-point.interface"), exports);
89
+ __exportStar(require("./events/subtract-subscription-limit.interface"), exports);
89
90
  __exportStar(require("./events/update-company-meeting-stats.interface"), exports);
90
91
  __exportStar(require("./validators/conditional-required"), exports);
91
92
  __exportStar(require("./validators/date-validator"), exports);
@@ -132,8 +133,13 @@ __exportStar(require("./types/notification-event.enum"), exports);
132
133
  __exportStar(require("./types/calendar-source-type.enum"), exports);
133
134
  __exportStar(require("./types/notification-type.enum"), exports);
134
135
  __exportStar(require("./types/record-type.enum"), exports);
136
+ __exportStar(require("./types/enddpoint.interface"), exports);
137
+ __exportStar(require("./types/subscription-model.enum"), exports);
138
+ __exportStar(require("./types/user-language.enum"), exports);
135
139
  __exportStar(require("./middlewares/app.middleware"), exports);
136
140
  __exportStar(require("./middlewares/authorizer.middleware"), exports);
141
+ __exportStar(require("./middlewares/subscription-subtractor.middleware"), exports);
142
+ __exportStar(require("./middlewares/subscription-validator.middleware"), exports);
137
143
  __exportStar(require("./utils/create-default-directories"), exports);
138
144
  __exportStar(require("./utils/equal-array-object"), exports);
139
145
  __exportStar(require("./utils/equal-object"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiC;AACjC,iEAA8C;AAC9C,mEAAgD;AAChD,+DAA4C;AAC5C,oEAAiD;AACjD,qEAAkD;AAClD,oEAAiD;AACjD,sEAAmD;AACnD,6EAA0D;AAC1D,uEAAoD;AACpD,sEAAmD;AACnD,6EAA0D;AAC1D,2EAAwD;AACxD,4EAAyD;AACzD,iEAA8C;AAC9C,4EAAyD;AACzD,4EAAyD;AACzD,wEAAqD;AACrD,yEAAsD;AACtD,yEAAsD;AACtD,oEAAiD;AACjD,6EAA0D;AAC1D,2EAAwD;AACxD,8EAA2D;AAC3D,mEAAgD;AAChD,oEAAiD;AACjD,oEAAiD;AACjD,oEAAiD;AACjD,wEAAqD;AACrD,2EAAwD;AACxD,0EAAuD;AACvD,mEAAgD;AAChD,kDAA+B;AAC/B,oEAAiD;AACjD,2EAAwD;AACxD,oEAAiD;AACjD,qEAAkD;AAClD,qEAAkD;AAClD,wEAAqD;AACrD,sEAAmD;AACnD,0EAAuD;AACvD,wEAAqD;AACrD,4EAAyD;AACzD,oEAAiD;AACjD,oEAAiD;AACjD,wEAAqD;AACrD,0EAAuD;AACvD,2EAAwD;AACxD,yEAAsD;AACtD,kFAA+D;AAC/D,qEAAkD;AAClD,qEAAkD;AAClD,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AC3C,+DAA4C;AAC5C,kEAA+C;AAC/C,wEAAqD;AACrD,kEAA+C;AAC/C,gFAA6D;AAC7D,+DAA4C;AAC5C,yEAAsD;AACtD,mFAAgE;AAChE,iFAA8D;AAC9D,iEAA8C;AAC9C,2EAAwD;AAExD,kEAA+C;AAC/C,sEAAmD;AAEnD,sEAAmD;AACnD,uEAAoD;AAEpD,mDAAgC;AAChC,oDAAiC;AACjC,6DAA0C;AAC1C,oEAAiD;AACjD,yEAAsD;AAEtD,gEAA6C;AAC7C,sEAAmD;AACnD,yDAAsC;AACtC,yDAAsC;AACtC,gEAA6C;AAC7C,yEAAsD;AACtD,2EAAwD;AACxD,4DAAyC;AACzC,0EAAuD;AACvD,0DAAuC;AACvC,gEAA6C;AAC7C,0DAAuC;AACvC,qEAAkD;AAClD,qEAAkD;AAClD,uEAAoD;AACpD,mEAAgD;AAChD,+DAA4C;AAC5C,uEAAoD;AACpD,qEAAkD;AAClD,kEAA+C;AAC/C,oEAAiD;AACjD,iEAA8C;AAC9C,2DAAwC;AACxC,8DAA2C;AAC3C,kEAA+C;AAC/C,6DAA0C;AAE1C,+DAA4C;AAC5C,sEAAmD;AACnD,mFAAgE;AAChE,kFAA+D;AAE/D,qEAAkD;AAClD,6DAA0C;AAC1C,uDAAoC;AACpC,sDAAmC;AACnC,qDAAkC;AAClC,mDAAgC;AAChC,4DAAyC;AACzC,2DAAwC;AACxC,oDAAiC;AACjC,uDAAoC"}
@@ -54,6 +54,7 @@ let AuthorizerMiddleware = class AuthorizerMiddleware {
54
54
  request.headers.email = resp.email;
55
55
  request.headers.company = resp.company;
56
56
  request.headers.contactId = resp.contactId;
57
+ request.headers.language = resp.language;
57
58
  next();
58
59
  }
59
60
  getHeaderParam(headers, param) {
@@ -1 +1 @@
1
- {"version":3,"file":"authorizer.middleware.js","sourceRoot":"","sources":["../../src/middlewares/authorizer.middleware.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAKuB;AACvB,yDAAmD;AAEnD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CAAA;QAExC,IAAI,EAAE,CAAA;IACR,CAAC;IAEO,cAAc,CAAC,OAAO,EAAE,KAAK;QACnC,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAC3E,CAAC;IAEO,KAAK,CAAC,WAAW,CACvB,IAAc,EACd,IAAc,EACd,MAAc,EACd,IAAY;QAEZ,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QAC7D,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CACjC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,CACpD,CAAA;QACD,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE;YACxC,MAAM,IAAI,8BAAqB,EAAE,CAAA;SAClC;IACH,CAAC;IAEO,KAAK,CAAC,kBAAkB,CAC9B,IAAc,EACd,IAAc;QAEd,IAAI,iBAAiB,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC,CAAA;QACzE,OAAO,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAA;IACtC,CAAC;CACF,CAAA;AAlFY,oBAAoB;IADhC,mBAAU,EAAE;IAGE,WAAA,eAAM,CAAC,cAAc,CAAC,CAAA;qCAA0B,2BAAW;GAF7D,oBAAoB,CAkFhC;AAlFY,oDAAoB"}
@@ -0,0 +1,12 @@
1
+ import { NestMiddleware } from '@nestjs/common';
2
+ import { ClientProxy } from '@nestjs/microservices';
3
+ import { Request, Response, NextFunction } from 'express';
4
+ export declare class SubscriptionSubtractorMiddleware implements NestMiddleware {
5
+ private readonly client;
6
+ private cachManager;
7
+ constructor(client: ClientProxy);
8
+ use(request: Request, response: Response, next: NextFunction): Promise<void>;
9
+ private getHeaderParam;
10
+ private subtractSubscription;
11
+ private getEndpoint;
12
+ }
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.SubscriptionSubtractorMiddleware = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const microservices_1 = require("@nestjs/microservices");
18
+ const rxjs_1 = require("rxjs");
19
+ const subjects_1 = require("src/events/subjects");
20
+ const endpoint_type_enum_1 = require("src/types/endpoint-type.enum");
21
+ const redis_client_1 = require("src/utils/redis-client");
22
+ let SubscriptionSubtractorMiddleware = class SubscriptionSubtractorMiddleware {
23
+ constructor(client) {
24
+ this.client = client;
25
+ this.cachManager = new redis_client_1.RedisClient();
26
+ }
27
+ async use(request, response, next) {
28
+ response.on('close', async () => {
29
+ const { statusCode } = response;
30
+ if (statusCode < 200 && statusCode > 300) {
31
+ return;
32
+ }
33
+ const user = {
34
+ subject: subjects_1.Subjects.HasSubscription,
35
+ data: {
36
+ company: this.getHeaderParam(request.headers, 'company'),
37
+ eventId: this.getHeaderParam(request.headers, 'event-id'),
38
+ },
39
+ };
40
+ const redisKey = JSON.stringify(user.data);
41
+ const redisResponse = await this.cachManager.getData(redisKey);
42
+ let resp;
43
+ if (redisResponse) {
44
+ resp = JSON.parse(redisResponse);
45
+ console.log('FROM REDIS--------------------', redisResponse);
46
+ await this.subtractSubscription(resp, request.method, request.route.path, redisKey);
47
+ }
48
+ else {
49
+ resp = await rxjs_1.firstValueFrom(this.client.send(user.subject, user.data));
50
+ console.log('FROM MESSAGE BROKER--------------------', resp);
51
+ await this.cachManager.setData(redisKey, JSON.stringify(resp), 60);
52
+ await this.subtractSubscription(resp, request.method, request.route.path, redisKey);
53
+ }
54
+ });
55
+ next();
56
+ }
57
+ getHeaderParam(headers, param) {
58
+ return Array.isArray(headers[param]) ? headers[param][0] : headers[param];
59
+ }
60
+ async subtractSubscription(subscription, method, path, key) {
61
+ const { features, remainingPoints, model } = subscription;
62
+ const { endpoint, featureId } = this.getEndpoint(features, method, path);
63
+ if (endpoint.type === endpoint_type_enum_1.EndpointType.BINARY) {
64
+ return;
65
+ }
66
+ else if (endpoint.type === endpoint_type_enum_1.EndpointType.LIMIT) {
67
+ const modifiedSubscription = subscription.features.map(feature => {
68
+ if (feature._id === featureId) {
69
+ feature.endpoints = feature.endpoints.map(endpoint => {
70
+ if (endpoint._id === endpoint._id) {
71
+ endpoint.limit -= 1;
72
+ }
73
+ console.log('MODIFIED ENDPOINT---------------', endpoint);
74
+ return endpoint;
75
+ });
76
+ console.log('MODIFIED FEATURE---------------', feature);
77
+ }
78
+ return feature;
79
+ });
80
+ await this.cachManager.setData(key, JSON.stringify(modifiedSubscription), 60);
81
+ this.client.send(subjects_1.Subjects.SubtractSubscriptionLimit, {
82
+ limit: endpoint.limit,
83
+ id: subscription._id,
84
+ featureId,
85
+ endpointId: endpoint._id,
86
+ });
87
+ }
88
+ else if (endpoint.type === endpoint_type_enum_1.EndpointType.POINT) {
89
+ const modifiedSubscription = Object.assign(Object.assign({}, subscription), { remainingPoints: remainingPoints - endpoint.point });
90
+ await this.cachManager.setData(key, JSON.stringify(modifiedSubscription), 60);
91
+ this.client.send(subjects_1.Subjects.SubtractSubscriptionPoint, {
92
+ point: endpoint.point,
93
+ id: subscription._id,
94
+ });
95
+ }
96
+ }
97
+ getEndpoint(features, method, path) {
98
+ const feature = features.find(feature => feature.endpoints.find(endpoint => endpoint.method === method && endpoint.endpoint === path));
99
+ if (!feature) {
100
+ throw new common_1.UnauthorizedException('Invalid feature for this subscription');
101
+ }
102
+ const endpoint = feature.endpoints.find(endpoint => endpoint.method === method && endpoint.endpoint === path);
103
+ return { endpoint, featureId: feature._id };
104
+ }
105
+ };
106
+ SubscriptionSubtractorMiddleware = __decorate([
107
+ common_1.Injectable(),
108
+ __param(0, common_1.Inject('SUBSCRIPTION_SERVICE')),
109
+ __metadata("design:paramtypes", [microservices_1.ClientProxy])
110
+ ], SubscriptionSubtractorMiddleware);
111
+ exports.SubscriptionSubtractorMiddleware = SubscriptionSubtractorMiddleware;
112
+ //# sourceMappingURL=subscription-subtractor.middleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscription-subtractor.middleware.js","sourceRoot":"","sources":["../../src/middlewares/subscription-subtractor.middleware.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAKuB;AACvB,yDAAmD;AAEnD,+BAAqC;AACrC,kDAA8C;AAC9C,qEAA2D;AAE3D,yDAAoD;AAGpD,IAAa,gCAAgC,GAA7C,MAAa,gCAAgC;IAE3C,YACmD,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;QAEpE,IAAI,CAAC,WAAW,GAAG,IAAI,0BAAW,EAAE,CAAA;IACtC,CAAC;IAED,KAAK,CAAC,GAAG,CACP,OAAgB,EAChB,QAAkB,EAClB,IAAkB;QAElB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,IAAI,EAAE;YAC9B,MAAM,EAAE,UAAU,EAAE,GAAG,QAAQ,CAAA;YAC/B,IAAI,UAAU,GAAG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AAC,SAAS,CAAC,IAAI,CACrC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,MAAM,KAAK,MAAM,IAAI,QAAQ,CAAC,QAAQ,KAAK,IAAI,CACrE,CAAA;QACD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,GAAG,EAAE,CAAA;IAC7C,CAAC;CACF,CAAA;AAhIY,gCAAgC;IAD5C,mBAAU,EAAE;IAIR,WAAA,eAAM,CAAC,sBAAsB,CAAC,CAAA;qCAA0B,2BAAW;GAH3D,gCAAgC,CAgI5C;AAhIY,4EAAgC"}
@@ -1,7 +1,7 @@
1
1
  import { NestMiddleware } from '@nestjs/common';
2
2
  import { ClientProxy } from '@nestjs/microservices';
3
3
  import { Request, Response, NextFunction } from 'express';
4
- export declare class SubscriptionMiddleware implements NestMiddleware {
4
+ export declare class SubscriptionValidatorMiddleware implements NestMiddleware {
5
5
  private readonly client;
6
6
  private cachManager;
7
7
  constructor(client: ClientProxy);
@@ -12,13 +12,14 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.SubscriptionMiddleware = void 0;
15
+ exports.SubscriptionValidatorMiddleware = void 0;
16
16
  const common_1 = require("@nestjs/common");
17
17
  const microservices_1 = require("@nestjs/microservices");
18
18
  const rxjs_1 = require("rxjs");
19
19
  const subjects_1 = require("src/events/subjects");
20
+ const endpoint_type_enum_1 = require("src/types/endpoint-type.enum");
20
21
  const redis_client_1 = require("src/utils/redis-client");
21
- let SubscriptionMiddleware = class SubscriptionMiddleware {
22
+ let SubscriptionValidatorMiddleware = class SubscriptionValidatorMiddleware {
22
23
  constructor(client) {
23
24
  this.client = client;
24
25
  this.cachManager = new redis_client_1.RedisClient();
@@ -37,7 +38,7 @@ let SubscriptionMiddleware = class SubscriptionMiddleware {
37
38
  if (redisResponse) {
38
39
  resp = JSON.parse(redisResponse);
39
40
  console.log('FROM REDIS--------------------', redisResponse);
40
- await this.isPermitted(resp, request.method, request.route.path, redisKey);
41
+ await this.isPermitted(resp, request.method, request.route.path);
41
42
  }
42
43
  else {
43
44
  resp = await rxjs_1.firstValueFrom(this.client.send(user.subject, user.data));
@@ -47,7 +48,7 @@ let SubscriptionMiddleware = class SubscriptionMiddleware {
47
48
  }
48
49
  else {
49
50
  await this.cachManager.setData(redisKey, JSON.stringify(resp), 60);
50
- await this.isPermitted(resp, request.method, request.route.path, redisKey);
51
+ await this.isPermitted(resp, request.method, request.route.path);
51
52
  }
52
53
  }
53
54
  next();
@@ -55,21 +56,21 @@ let SubscriptionMiddleware = class SubscriptionMiddleware {
55
56
  getHeaderParam(headers, param) {
56
57
  return Array.isArray(headers[param]) ? headers[param][0] : headers[param];
57
58
  }
58
- async isPermitted(subscription, method, path, key) {
59
+ async isPermitted(subscription, method, path) {
59
60
  const { features, remainingPoints } = subscription;
60
61
  const endpoint = this.getEndpoint(features, method, path);
61
- if ((remainingPoints || remainingPoints === 0) && endpoint.point) {
62
- if (remainingPoints < endpoint.point) {
63
- throw new common_1.UnauthorizedException('Insufficient credit');
64
- }
65
- else {
66
- const modifiedSubscription = Object.assign(Object.assign({}, subscription), { remainingPoints: remainingPoints - endpoint.point });
67
- await this.cachManager.setData(key, JSON.stringify(modifiedSubscription), 60);
68
- this.client.send(subjects_1.Subjects.SubtractSubscriptionPoint, {
69
- point: endpoint.point,
70
- id: subscription._id,
71
- });
72
- }
62
+ if (endpoint.isFree) {
63
+ return true;
64
+ }
65
+ if (endpoint.type === endpoint_type_enum_1.EndpointType.BINARY && !endpoint.isFree) {
66
+ throw new common_1.UnauthorizedException('Please upgrade your subscription');
67
+ }
68
+ else if (endpoint.type === endpoint_type_enum_1.EndpointType.LIMIT && endpoint.limit === 0) {
69
+ throw new common_1.UnauthorizedException('Limits exceeded');
70
+ }
71
+ else if (endpoint.type === endpoint_type_enum_1.EndpointType.POINT &&
72
+ remainingPoints < endpoint.point) {
73
+ throw new common_1.UnauthorizedException('Insufficient credit');
73
74
  }
74
75
  }
75
76
  getEndpoint(features, method, path) {
@@ -77,13 +78,14 @@ let SubscriptionMiddleware = class SubscriptionMiddleware {
77
78
  if (!feature) {
78
79
  throw new common_1.UnauthorizedException('Invalid feature for this subscription');
79
80
  }
80
- return feature.endpoints.find(endpoint => endpoint.method === method && endpoint.endpoint === path);
81
+ const endpoint = feature.endpoints.find(endpoint => endpoint.method === method && endpoint.endpoint === path);
82
+ return endpoint;
81
83
  }
82
84
  };
83
- SubscriptionMiddleware = __decorate([
85
+ SubscriptionValidatorMiddleware = __decorate([
84
86
  common_1.Injectable(),
85
87
  __param(0, common_1.Inject('SUBSCRIPTION_SERVICE')),
86
88
  __metadata("design:paramtypes", [microservices_1.ClientProxy])
87
- ], SubscriptionMiddleware);
88
- exports.SubscriptionMiddleware = SubscriptionMiddleware;
89
- //# sourceMappingURL=subscription.middleware.js.map
89
+ ], SubscriptionValidatorMiddleware);
90
+ exports.SubscriptionValidatorMiddleware = SubscriptionValidatorMiddleware;
91
+ //# sourceMappingURL=subscription-validator.middleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscription-validator.middleware.js","sourceRoot":"","sources":["../../src/middlewares/subscription-validator.middleware.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAKuB;AACvB,yDAAmD;AAEnD,+BAAqC;AACrC,kDAA8C;AAC9C,qEAA2D;AAE3D,yDAAoD;AAGpD,IAAa,+BAA+B,GAA5C,MAAa,+BAA+B;IAE1C,YACmD,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;QAEpE,IAAI,CAAC,WAAW,GAAG,IAAI,0BAAW,EAAE,CAAA;IACtC,CAAC;IAED,KAAK,CAAC,GAAG,CACP,OAAgB,EAChB,QAAkB,EAClB,IAAkB;QAElB,MAAM,IAAI,GAAG;YACX,OAAO,EAAE,mBAAQ,CAAC,eAAe;YACjC,IAAI,EAAE;gBACJ,OAAO,EAAE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A;QAED,IAAI,CAAC,OAAO,EAAE;YACZ,MAAM,IAAI,8BAAqB,CAAC,uCAAuC,CAAC,CAAA;SACzE;QACD,MAAM,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,CACrC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,MAAM,KAAK,MAAM,IAAI,QAAQ,CAAC,QAAQ,KAAK,IAAI,CACrE,CAAA;QACD,OAAO,QAAQ,CAAA;IACjB,CAAC;CACF,CAAA;AAjFY,+BAA+B;IAD3C,mBAAU,EAAE;IAIR,WAAA,eAAM,CAAC,sBAAsB,CAAC,CAAA;qCAA0B,2BAAW;GAH3D,+BAA+B,CAiF3C;AAjFY,0EAA+B"}
@@ -162,8 +162,8 @@
162
162
  "affectsGlobalScope": false
163
163
  },
164
164
  "../src/events/subjects.ts": {
165
- "version": "daa59bb934650613df3f921a2fe7483bfcf990c7642a5989852c6ef5fe954138",
166
- "signature": "1a73629bd7c884c46a4d0eb2736888511fc6cd1a927b093994c8f75c840dad9e",
165
+ "version": "b82762c9f4ea66754e08a7233171c4c5ce611eb9c71d85f80cc55639a7f001bb",
166
+ "signature": "d2f0522e5046f0942eb5e40650a91d916ee4d3f0b38566583c28705015047e4b",
167
167
  "affectsGlobalScope": false
168
168
  },
169
169
  "../src/events/email-specs.interface.ts": {
@@ -592,8 +592,13 @@
592
592
  "affectsGlobalScope": false
593
593
  },
594
594
  "../src/events/subtract-subscription-point.interface.ts": {
595
- "version": "c7195a6074d1e185b66cc9b392ef0cad11553e46470e5715194ab20c08846b37",
596
- "signature": "14611e6258d18e8e0e5fb8a86e3927c7fa5afe23f6ec0e55bdc0a121447c7f60",
595
+ "version": "91bae8ce9d35a9817175693e4ff940390c2093091b94ac45e8c43d03b2b2591c",
596
+ "signature": "f029e919a912bfdcd62058ca7d1233ee1fdf964e4193ab1d9e20ef30ce0f8ad8",
597
+ "affectsGlobalScope": false
598
+ },
599
+ "../src/events/subtract-subscription-limit.interface.ts": {
600
+ "version": "183ccaf3444bc9ac9cbf46960dad76a513d6d4b016a389530815da269f4c6eef",
601
+ "signature": "190be0b8b23a15875f3698b817d5901a45aa3702eed28e69b593d08d2395898d",
597
602
  "affectsGlobalScope": false
598
603
  },
599
604
  "../src/events/update-company-meeting-stats.interface.ts": {
@@ -3232,12 +3237,12 @@
3232
3237
  "affectsGlobalScope": false
3233
3238
  },
3234
3239
  "../src/types/header-user.interface.ts": {
3235
- "version": "d9fa7144f4764c6f56e026c670dd9b2978401c100eee58cebb4fc57f75a153a4",
3236
- "signature": "f1f67561bb9a41fd721ede5bca7b5f95a3f02e9fa3dd0bf518f5e50b4ca0a98e",
3240
+ "version": "34a275a17b8af6f7c0aa0bc6cf761b8bb4b8d709cff189dafb447931b5139d3e",
3241
+ "signature": "aab4bca2879b94c59f03978878c6fde5e4a213782cfa09902fa793c69c6c4418",
3237
3242
  "affectsGlobalScope": false
3238
3243
  },
3239
3244
  "../src/decorators/get-user-decorator.ts": {
3240
- "version": "5c9ce10488a2962c9321ab4cc2b52d0602d91950777cc814360b9ff51baed40d",
3245
+ "version": "2e0d8a3d43b87858d13dd49bf966d6c6d68bc89aa4f3798ffd2534d3b2921e7e",
3241
3246
  "signature": "2edbd67ef5c8b5f94d7abaea90ab48657ff66e5277a1409c425ff253daa65751",
3242
3247
  "affectsGlobalScope": false
3243
3248
  },
@@ -3686,6 +3691,26 @@
3686
3691
  "signature": "734993bc270bebab85c84551c3f782db9357b6d1a9f347b48e88b0a9c716b46b",
3687
3692
  "affectsGlobalScope": false
3688
3693
  },
3694
+ "../src/types/endpoint-type.enum.ts": {
3695
+ "version": "a2ab3c1f8d8a6558d6184b75c1f620b7a6b577f0eeee90302ff55553b6af5a9a",
3696
+ "signature": "558086566f584ef7221be248125dd23834a2214c0692e944a430ebeb34fd8c6b",
3697
+ "affectsGlobalScope": false
3698
+ },
3699
+ "../src/types/enddpoint.interface.ts": {
3700
+ "version": "57eb45fcd217572e0b58ecaffbca490cbbffaf731e8ed4c15b0342823b2a50f8",
3701
+ "signature": "1f317414b7bb00770c49394166bd294dd7b501dfc662d574d683e3178e48c9ec",
3702
+ "affectsGlobalScope": false
3703
+ },
3704
+ "../src/types/subscription-model.enum.ts": {
3705
+ "version": "1c116c9554af984dadd267c3b79f2ed0e6436753eb13885bb9687f3054f60b78",
3706
+ "signature": "9a59cc82f5bdd91001918d7fb7bf9ccb2b0555fc90d8fbcf09d0fd63ecd71305",
3707
+ "affectsGlobalScope": false
3708
+ },
3709
+ "../src/types/user-language.enum.ts": {
3710
+ "version": "a6422e58e4d17b07b3fdf16e95d4503957ac121cbc82805b54d016eac413c69c",
3711
+ "signature": "169486f80f01c160128e615296f4d173af1c7aa4cc54307f26d5b82dea9f8efa",
3712
+ "affectsGlobalScope": false
3713
+ },
3689
3714
  "../node_modules/@types/range-parser/index.d.ts": {
3690
3715
  "version": "16d51f964ec125ad2024cf03f0af444b3bc3ec3614d9345cc54d09bab45c9a4c",
3691
3716
  "signature": "16d51f964ec125ad2024cf03f0af444b3bc3ec3614d9345cc54d09bab45c9a4c",
@@ -6282,10 +6307,25 @@
6282
6307
  "affectsGlobalScope": false
6283
6308
  },
6284
6309
  "../src/middlewares/authorizer.middleware.ts": {
6285
- "version": "10bb3d24a760b4bbaca0556f5c03cceabf0f0957fd7aa2739a710e6a369f4c46",
6310
+ "version": "9128dd88211c0acd501c14466da852e34ca95e495e202e5bee637260ef71aa50",
6286
6311
  "signature": "1c5d65c5ec5568c3946d80a9e2b43427afdbddcbbf889ec56985b5209cdaab7c",
6287
6312
  "affectsGlobalScope": false
6288
6313
  },
6314
+ "../src/types/feature.interface.ts": {
6315
+ "version": "2d48a02eca9863547f753dc87a3bdb55fa57b6b31dbd30d7e3ff5de8ce5ade82",
6316
+ "signature": "1979e4caad8391072949a1981fcd5f0ab425fbf834768f71cf38f1b4ec98b183",
6317
+ "affectsGlobalScope": false
6318
+ },
6319
+ "../src/middlewares/subscription-subtractor.middleware.ts": {
6320
+ "version": "e26ef7e91158c776e6ddae3ac0d5a586bcb096ec2824a6ef29a64fd069b30147",
6321
+ "signature": "9d3841fa3534d661414a9839b851d44a78a1cce67f32119ada02e84ef6247818",
6322
+ "affectsGlobalScope": false
6323
+ },
6324
+ "../src/middlewares/subscription-validator.middleware.ts": {
6325
+ "version": "ea5a6f6ce9176dd7edd6b68fe9615378ea9e5fcb65e2b5c48ef9b47fd12e1fe0",
6326
+ "signature": "424cb27dfefd3454c2ac9f4036c1906bdb1a960fcc70b70d8c018e8d0e76adb8",
6327
+ "affectsGlobalScope": false
6328
+ },
6289
6329
  "../src/utils/create-default-directories.ts": {
6290
6330
  "version": "7d1a651a9236eaeab047279fd180358440ff0d28ef338fb289bff0ccc3edbb85",
6291
6331
  "signature": "5ed0a70747aafee6c622077e7755d30cdf0b7e6da2089afcbeead36be12f3330",
@@ -6382,8 +6422,8 @@
6382
6422
  "affectsGlobalScope": false
6383
6423
  },
6384
6424
  "../src/index.ts": {
6385
- "version": "b79adc82431a53f565e0d6518a56baaa6ca0785cfd0f4e5ffa184d75866eb1e1",
6386
- "signature": "77dfb5ff8fca3af20b5b5383f8e05b19c0938bb1a78a0944dd0fc0a212979c1d",
6425
+ "version": "b8359e6acfb1221a82f972e909968a6ac638027684cec44ebda81e90093d1057",
6426
+ "signature": "72984b42f3a0e67a671430ccfd1f763ad45a572e12a175b0bbe2db01f6259d66",
6387
6427
  "affectsGlobalScope": false
6388
6428
  },
6389
6429
  "../src/events/meeting-request-updated.interface.ts": {
@@ -6391,21 +6431,6 @@
6391
6431
  "signature": "2388b17bfe1f2e511b4960ec098cf5db020cec29e4f50f8676f8aa64da10c581",
6392
6432
  "affectsGlobalScope": false
6393
6433
  },
6394
- "../src/types/enddpoint.interface.ts": {
6395
- "version": "607660b65fbe13d1447abe69648c2201555641ff7c1b9ab6f6a3d0edfc144bbf",
6396
- "signature": "4f008ce1a0a399608dc1641c0455559891f2b1d3d123694eb110294e6cb09782",
6397
- "affectsGlobalScope": false
6398
- },
6399
- "../src/types/feature.interface.ts": {
6400
- "version": "3b39f9270e9b9cbea5e8548f66e7c56982bdd04241c726bcf06e8891935d02b2",
6401
- "signature": "8e1ccdc6ce1e15771f99674f949c1bd02ae24a4fb0b0b77b26216e28ec23762a",
6402
- "affectsGlobalScope": false
6403
- },
6404
- "../src/middlewares/subscription.middleware.ts": {
6405
- "version": "4a90f2179525e5d63a0145903d63cb8945e4966cff50e1837b16d37ef6d6f624",
6406
- "signature": "63084574038bac4eb353074b166d479996890194abc48475e9e741e349a16cf6",
6407
- "affectsGlobalScope": false
6408
- },
6409
6434
  "../node_modules/@types/minimatch/index.d.ts": {
6410
6435
  "version": "95c22bc19835e28e2e524a4bb8898eb5f2107b640d7279a6d3aade261916bbf2",
6411
6436
  "signature": "95c22bc19835e28e2e524a4bb8898eb5f2107b640d7279a6d3aade261916bbf2",
@@ -11336,6 +11361,9 @@
11336
11361
  "../src/events/service-updated.interface.ts": [
11337
11362
  "../src/events/subjects.ts"
11338
11363
  ],
11364
+ "../src/events/subtract-subscription-limit.interface.ts": [
11365
+ "../src/events/subjects.ts"
11366
+ ],
11339
11367
  "../src/events/subtract-subscription-point.interface.ts": [
11340
11368
  "../src/events/subjects.ts"
11341
11369
  ],
@@ -11441,6 +11469,7 @@
11441
11469
  "../src/events/service-created.interface.ts",
11442
11470
  "../src/events/service-updated.interface.ts",
11443
11471
  "../src/events/subjects.ts",
11472
+ "../src/events/subtract-subscription-limit.interface.ts",
11444
11473
  "../src/events/subtract-subscription-point.interface.ts",
11445
11474
  "../src/events/sync-accessibility-creation.interface.ts",
11446
11475
  "../src/events/sync-event-creation.interface.ts",
@@ -11453,11 +11482,14 @@
11453
11482
  "../src/interceptors/serialize.interceptor.ts",
11454
11483
  "../src/middlewares/app.middleware.ts",
11455
11484
  "../src/middlewares/authorizer.middleware.ts",
11485
+ "../src/middlewares/subscription-subtractor.middleware.ts",
11486
+ "../src/middlewares/subscription-validator.middleware.ts",
11456
11487
  "../src/types/analytic-group.interface.ts",
11457
11488
  "../src/types/calendar-source-type.enum.ts",
11458
11489
  "../src/types/chat-group.interface.ts",
11459
11490
  "../src/types/default-visibility.interface.ts",
11460
11491
  "../src/types/download-presigned-url.interface.ts",
11492
+ "../src/types/enddpoint.interface.ts",
11461
11493
  "../src/types/group-visibility.interface.ts",
11462
11494
  "../src/types/header-user.interface.ts",
11463
11495
  "../src/types/match-group.interface.ts",
@@ -11469,9 +11501,11 @@
11469
11501
  "../src/types/operation-types.ts",
11470
11502
  "../src/types/read-result.interface.ts",
11471
11503
  "../src/types/record-type.enum.ts",
11504
+ "../src/types/subscription-model.enum.ts",
11472
11505
  "../src/types/update-input-data.interface.ts",
11473
11506
  "../src/types/upload-presigned-url.interface.ts",
11474
11507
  "../src/types/user-invitations.interface.ts",
11508
+ "../src/types/user-language.enum.ts",
11475
11509
  "../src/types/user-role.enum.ts",
11476
11510
  "../src/types/user-type.enum.ts",
11477
11511
  "../src/types/visibility-group.interface.ts",
@@ -11526,12 +11560,23 @@
11526
11560
  "../src/types/user-type.enum.ts",
11527
11561
  "../src/utils/redis-client.ts"
11528
11562
  ],
11529
- "../src/middlewares/subscription.middleware.ts": [
11563
+ "../src/middlewares/subscription-subtractor.middleware.ts": [
11564
+ "../node_modules/@nestjs/common/index.d.ts",
11565
+ "../node_modules/@nestjs/microservices/index.d.ts",
11566
+ "../node_modules/@types/express/index.d.ts",
11567
+ "../node_modules/rxjs/dist/types/index.d.ts",
11568
+ "../src/events/subjects.ts",
11569
+ "../src/types/endpoint-type.enum.ts",
11570
+ "../src/types/feature.interface.ts",
11571
+ "../src/utils/redis-client.ts"
11572
+ ],
11573
+ "../src/middlewares/subscription-validator.middleware.ts": [
11530
11574
  "../node_modules/@nestjs/common/index.d.ts",
11531
11575
  "../node_modules/@nestjs/microservices/index.d.ts",
11532
11576
  "../node_modules/@types/express/index.d.ts",
11533
11577
  "../node_modules/rxjs/dist/types/index.d.ts",
11534
11578
  "../src/events/subjects.ts",
11579
+ "../src/types/endpoint-type.enum.ts",
11535
11580
  "../src/types/feature.interface.ts",
11536
11581
  "../src/utils/redis-client.ts"
11537
11582
  ],
@@ -11539,6 +11584,9 @@
11539
11584
  "../src/types/analytic-group.interface.ts",
11540
11585
  "../src/types/visibility-group.interface.ts"
11541
11586
  ],
11587
+ "../src/types/enddpoint.interface.ts": [
11588
+ "../src/types/endpoint-type.enum.ts"
11589
+ ],
11542
11590
  "../src/types/feature.interface.ts": [
11543
11591
  "../src/types/enddpoint.interface.ts"
11544
11592
  ],
@@ -16474,6 +16522,9 @@
16474
16522
  "../src/events/service-updated.interface.ts": [
16475
16523
  "../src/events/subjects.ts"
16476
16524
  ],
16525
+ "../src/events/subtract-subscription-limit.interface.ts": [
16526
+ "../src/events/subjects.ts"
16527
+ ],
16477
16528
  "../src/events/subtract-subscription-point.interface.ts": [
16478
16529
  "../src/events/subjects.ts"
16479
16530
  ],
@@ -16579,6 +16630,7 @@
16579
16630
  "../src/events/service-created.interface.ts",
16580
16631
  "../src/events/service-updated.interface.ts",
16581
16632
  "../src/events/subjects.ts",
16633
+ "../src/events/subtract-subscription-limit.interface.ts",
16582
16634
  "../src/events/subtract-subscription-point.interface.ts",
16583
16635
  "../src/events/sync-accessibility-creation.interface.ts",
16584
16636
  "../src/events/sync-event-creation.interface.ts",
@@ -16591,11 +16643,14 @@
16591
16643
  "../src/interceptors/serialize.interceptor.ts",
16592
16644
  "../src/middlewares/app.middleware.ts",
16593
16645
  "../src/middlewares/authorizer.middleware.ts",
16646
+ "../src/middlewares/subscription-subtractor.middleware.ts",
16647
+ "../src/middlewares/subscription-validator.middleware.ts",
16594
16648
  "../src/types/analytic-group.interface.ts",
16595
16649
  "../src/types/calendar-source-type.enum.ts",
16596
16650
  "../src/types/chat-group.interface.ts",
16597
16651
  "../src/types/default-visibility.interface.ts",
16598
16652
  "../src/types/download-presigned-url.interface.ts",
16653
+ "../src/types/enddpoint.interface.ts",
16599
16654
  "../src/types/group-visibility.interface.ts",
16600
16655
  "../src/types/header-user.interface.ts",
16601
16656
  "../src/types/match-group.interface.ts",
@@ -16607,9 +16662,11 @@
16607
16662
  "../src/types/operation-types.ts",
16608
16663
  "../src/types/read-result.interface.ts",
16609
16664
  "../src/types/record-type.enum.ts",
16665
+ "../src/types/subscription-model.enum.ts",
16610
16666
  "../src/types/update-input-data.interface.ts",
16611
16667
  "../src/types/upload-presigned-url.interface.ts",
16612
16668
  "../src/types/user-invitations.interface.ts",
16669
+ "../src/types/user-language.enum.ts",
16613
16670
  "../src/types/user-role.enum.ts",
16614
16671
  "../src/types/user-type.enum.ts",
16615
16672
  "../src/types/visibility-group.interface.ts",
@@ -16654,7 +16711,12 @@
16654
16711
  "../node_modules/@nestjs/microservices/index.d.ts",
16655
16712
  "../node_modules/@types/express/index.d.ts"
16656
16713
  ],
16657
- "../src/middlewares/subscription.middleware.ts": [
16714
+ "../src/middlewares/subscription-subtractor.middleware.ts": [
16715
+ "../node_modules/@nestjs/common/index.d.ts",
16716
+ "../node_modules/@nestjs/microservices/index.d.ts",
16717
+ "../node_modules/@types/express/index.d.ts"
16718
+ ],
16719
+ "../src/middlewares/subscription-validator.middleware.ts": [
16658
16720
  "../node_modules/@nestjs/common/index.d.ts",
16659
16721
  "../node_modules/@nestjs/microservices/index.d.ts",
16660
16722
  "../node_modules/@types/express/index.d.ts"
@@ -16663,6 +16725,9 @@
16663
16725
  "../src/types/analytic-group.interface.ts",
16664
16726
  "../src/types/visibility-group.interface.ts"
16665
16727
  ],
16728
+ "../src/types/enddpoint.interface.ts": [
16729
+ "../src/types/endpoint-type.enum.ts"
16730
+ ],
16666
16731
  "../src/types/feature.interface.ts": [
16667
16732
  "../src/types/enddpoint.interface.ts"
16668
16733
  ],
@@ -17939,6 +18004,7 @@
17939
18004
  "../src/events/service-created.interface.ts",
17940
18005
  "../src/events/service-updated.interface.ts",
17941
18006
  "../src/events/subjects.ts",
18007
+ "../src/events/subtract-subscription-limit.interface.ts",
17942
18008
  "../src/events/subtract-subscription-point.interface.ts",
17943
18009
  "../src/events/sync-accessibility-creation.interface.ts",
17944
18010
  "../src/events/sync-event-creation.interface.ts",
@@ -17952,13 +18018,15 @@
17952
18018
  "../src/interceptors/serialize.interceptor.ts",
17953
18019
  "../src/middlewares/app.middleware.ts",
17954
18020
  "../src/middlewares/authorizer.middleware.ts",
17955
- "../src/middlewares/subscription.middleware.ts",
18021
+ "../src/middlewares/subscription-subtractor.middleware.ts",
18022
+ "../src/middlewares/subscription-validator.middleware.ts",
17956
18023
  "../src/types/analytic-group.interface.ts",
17957
18024
  "../src/types/calendar-source-type.enum.ts",
17958
18025
  "../src/types/chat-group.interface.ts",
17959
18026
  "../src/types/default-visibility.interface.ts",
17960
18027
  "../src/types/download-presigned-url.interface.ts",
17961
18028
  "../src/types/enddpoint.interface.ts",
18029
+ "../src/types/endpoint-type.enum.ts",
17962
18030
  "../src/types/feature.interface.ts",
17963
18031
  "../src/types/group-visibility.interface.ts",
17964
18032
  "../src/types/header-user.interface.ts",
@@ -17971,9 +18039,11 @@
17971
18039
  "../src/types/operation-types.ts",
17972
18040
  "../src/types/read-result.interface.ts",
17973
18041
  "../src/types/record-type.enum.ts",
18042
+ "../src/types/subscription-model.enum.ts",
17974
18043
  "../src/types/update-input-data.interface.ts",
17975
18044
  "../src/types/upload-presigned-url.interface.ts",
17976
18045
  "../src/types/user-invitations.interface.ts",
18046
+ "../src/types/user-language.enum.ts",
17977
18047
  "../src/types/user-role.enum.ts",
17978
18048
  "../src/types/user-type.enum.ts",
17979
18049
  "../src/types/visibility-group.interface.ts",
@@ -1,5 +1,10 @@
1
+ import { EndpointType } from './endpoint-type.enum';
1
2
  export interface Endpoint {
3
+ _id: string;
2
4
  endpoint: string;
3
5
  method: string;
4
6
  point?: number;
7
+ limit?: number;
8
+ isFree?: boolean;
9
+ type?: EndpointType;
5
10
  }
@@ -0,0 +1,5 @@
1
+ export declare enum EndpointType {
2
+ POINT = "Point",
3
+ LIMIT = "Limit",
4
+ BINARY = "Binary"
5
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EndpointType = void 0;
4
+ var EndpointType;
5
+ (function (EndpointType) {
6
+ EndpointType["POINT"] = "Point";
7
+ EndpointType["LIMIT"] = "Limit";
8
+ EndpointType["BINARY"] = "Binary";
9
+ })(EndpointType = exports.EndpointType || (exports.EndpointType = {}));
10
+ //# sourceMappingURL=endpoint-type.enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoint-type.enum.js","sourceRoot":"","sources":["../../src/types/endpoint-type.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,+BAAe,CAAA;IACf,+BAAe,CAAA;IACf,iCAAiB,CAAA;AACnB,CAAC,EAJW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAIvB"}
@@ -1,5 +1,6 @@
1
1
  import { Endpoint } from './enddpoint.interface';
2
2
  export interface Feature {
3
+ _id: string;
3
4
  name: string;
4
5
  endpoints: Endpoint[];
5
6
  }
@@ -5,4 +5,5 @@ export interface HeaderUser {
5
5
  type: string;
6
6
  company?: string;
7
7
  contactId?: string;
8
+ language?: string;
8
9
  }
@@ -0,0 +1,4 @@
1
+ export declare enum SubscriptionModel {
2
+ EVENT = "Event",
3
+ COMPANY = "Company"
4
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SubscriptionModel = void 0;
4
+ var SubscriptionModel;
5
+ (function (SubscriptionModel) {
6
+ SubscriptionModel["EVENT"] = "Event";
7
+ SubscriptionModel["COMPANY"] = "Company";
8
+ })(SubscriptionModel = exports.SubscriptionModel || (exports.SubscriptionModel = {}));
9
+ //# sourceMappingURL=subscription-model.enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscription-model.enum.js","sourceRoot":"","sources":["../../src/types/subscription-model.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,oCAAe,CAAA;IACf,wCAAmB,CAAA;AACrB,CAAC,EAHW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAG5B"}
@@ -0,0 +1,5 @@
1
+ export declare enum UserLanguage {
2
+ ENGLISH = "english",
3
+ ARABIC = "arabic",
4
+ FRENCH = "french"
5
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserLanguage = void 0;
4
+ var UserLanguage;
5
+ (function (UserLanguage) {
6
+ UserLanguage["ENGLISH"] = "english";
7
+ UserLanguage["ARABIC"] = "arabic";
8
+ UserLanguage["FRENCH"] = "french";
9
+ })(UserLanguage = exports.UserLanguage || (exports.UserLanguage = {}));
10
+ //# sourceMappingURL=user-language.enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-language.enum.js","sourceRoot":"","sources":["../../src/types/user-language.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,mCAAmB,CAAA;IACnB,iCAAiB,CAAA;IACjB,iCAAiB,CAAA;AACnB,CAAC,EAJW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAIvB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aldb2b/common",
3
- "version": "1.0.183",
3
+ "version": "1.0.185",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -1 +0,0 @@
1
- {"version":3,"file":"subscription.middleware.js","sourceRoot":"","sources":["../../src/middlewares/subscription.middleware.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAKuB;AACvB,yDAAmD;AAEnD,+BAAqC;AACrC,kDAA8C;AAE9C,yDAAoD;AAGpD,IAAa,sBAAsB,GAAnC,MAAa,sBAAsB;IAEjC,YACmD,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;QAEpE,IAAI,CAAC,WAAW,GAAG,IAAI,0B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