@aldb2b/common 1.0.175 → 1.0.178

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.
@@ -40,5 +40,6 @@ export declare enum Queues {
40
40
  NOTIFICATION_GET_MEETING_REQUESTS_QUEUE = "notification_get_meeting_requests_queue",
41
41
  GET_CITY_COUNTRY_BY_ID = "get_city_country_by_id",
42
42
  TABLE_DETAILS_BY_GROUP_QUEUE = "tables_details_by_group_queue",
43
- MANAGE_MEETING_EVENTS_QUEUE = "manage_meeting_events_queue"
43
+ MANAGE_MEETING_EVENTS_QUEUE = "manage_meeting_events_queue",
44
+ SUBSCRIPTION_QUEUE = "subscription_queue"
44
45
  }
@@ -45,5 +45,6 @@ var Queues;
45
45
  Queues["GET_CITY_COUNTRY_BY_ID"] = "get_city_country_by_id";
46
46
  Queues["TABLE_DETAILS_BY_GROUP_QUEUE"] = "tables_details_by_group_queue";
47
47
  Queues["MANAGE_MEETING_EVENTS_QUEUE"] = "manage_meeting_events_queue";
48
+ Queues["SUBSCRIPTION_QUEUE"] = "subscription_queue";
48
49
  })(Queues = exports.Queues || (exports.Queues = {}));
49
50
  //# sourceMappingURL=queues.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"queues.js","sourceRoot":"","sources":["../../src/events/queues.ts"],"names":[],"mappings":";;;AAAA,IAAY,MA4CX;AA5CD,WAAY,MAAM;IAChB,mCAAyB,CAAA;IACzB,yDAA+C,CAAA;IAC/C,iDAAuC,CAAA;IACvC,+CAAqC,CAAA;IACrC,qCAA2B,CAAA;IAC3B,+DAAqD,CAAA;IACrD,qDAA2C,CAAA;IAC3C,qEAA2D,CAAA;IAC3D,qEAA2D,CAAA;IAC3D,6EAAmE,CAAA;IACnE,yDAA+C,CAAA;IAC/C,iDAAuC,CAAA;IACvC,mDAAyC,CAAA;IACzC,qDAA2C,CAAA;IAC3C,yDAA+C,CAAA;IAC/C,uDAA6C,CAAA;IAC7C,+DAAqD,CAAA;IACrD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;IAChE,6EAAmE,CAAA;IACnE,uDAA6C,CAAA;IAC7C,iEAAuD,CAAA;IACvD,iEAAuD,CAAA;IACvD,6CAAmC,CAAA;IACnC,yEAA+D,CAAA;IAC/D,uEAA6D,CAAA;IAC7D,iEAAuD,CAAA;IACvD,iEAAuD,CAAA;IACvD,yDAA+C,CAAA;IAC/C,qEAA2D,CAAA;IAC3D,6DAAmD,CAAA;IACnD,6FAAmF,CAAA;IACnF,2DAAiD,CAAA;IACjD,wEAA8D,CAAA;IAC9D,qEAA2D,CAAA;IAC3D,mDAAyC,CAAA;AAC3C,CAAC,EA5CW,MAAM,GAAN,cAAM,KAAN,cAAM,QA4CjB"}
@@ -1,3 +1,4 @@
1
+ import { RecordType } from 'src/types/record-type.enum';
1
2
  import { NotificationEvent } from '../types/notification-event.enum';
2
3
  import { NotificationType } from '../types/notification-type.enum';
3
4
  import { Subjects } from './subjects';
@@ -21,5 +22,7 @@ export declare namespace SendNotifications {
21
22
  receiver: string;
22
23
  attachments?: string[];
23
24
  links?: any;
25
+ relatedRecordType?: RecordType;
26
+ relatedRecordId?: string;
24
27
  }
25
28
  }
package/build/index.d.ts CHANGED
@@ -118,6 +118,7 @@ export * from './types/group-visibility.interface';
118
118
  export * from './types/notification-event.enum';
119
119
  export * from './types/calendar-source-type.enum';
120
120
  export * from './types/notification-type.enum';
121
+ export * from './types/record-type.enum';
121
122
  export * from './middlewares/app.middleware';
122
123
  export * from './middlewares/authorizer.middleware';
123
124
  export * from './utils/create-default-directories';
package/build/index.js CHANGED
@@ -130,6 +130,7 @@ __exportStar(require("./types/group-visibility.interface"), exports);
130
130
  __exportStar(require("./types/notification-event.enum"), exports);
131
131
  __exportStar(require("./types/calendar-source-type.enum"), exports);
132
132
  __exportStar(require("./types/notification-type.enum"), exports);
133
+ __exportStar(require("./types/record-type.enum"), exports);
133
134
  __exportStar(require("./middlewares/app.middleware"), exports);
134
135
  __exportStar(require("./middlewares/authorizer.middleware"), exports);
135
136
  __exportStar(require("./utils/create-default-directories"), 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,qEAAkD;AAClD,qEAAkD;AAClD,mEAAgD;AAChD,mEAAgD;AAChD,qEAAkD;AAClD,6EAA0D;AAC1D,qEAAkD;AAClD,qEAAkD;AAClD,qEAAkD;AAClD,uEAAoD;AACpD,uEAAoD;AACpD,iEAA8C;AAC9C,iEAA8C;AAC9C,qEAAkD;AAClD,qEAAkD;AAClD,4EAAyD;AACzD,4EAAyD;AACzD,0EAAuD;AACvD,qDAAkC;AAClC,yEAAsD;AACtD,iFAA8D;AAC9D,sFAAmE;AACnE,sEAAmD;AACnD,iFAA8D;AAE9D,oEAAiD;AACjD,8DAA2C;AAC3C,+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;AAE9C,+DAA4C;AAC5C,sEAAmD;AAEnD,qEAAkD;AAClD,6DAA0C;AAC1C,uDAAoC;AACpC,sDAAmC;AACnC,qDAAkC;AAClC,mDAAgC;AAChC,4DAAyC;AACzC,2DAAwC;AACxC,oDAAiC;AACjC,uDAAoC"}
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,2E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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;AAExC,+DAA4C;AAC5C,sEAAmD;AAEnD,qEAAkD;AAClD,6DAA0C;AAC1C,uDAAoC;AACpC,sDAAmC;AACnC,qDAAkC;AAClC,mDAAgC;AAChC,4DAAyC;AACzC,2DAAwC;AACxC,oDAAiC;AACjC,uDAAoC"}
@@ -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 SubscriptionMiddleware 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 isPermitted;
11
+ private getEndpoint;
12
+ }
@@ -0,0 +1,89 @@
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.SubscriptionMiddleware = 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 redis_client_1 = require("src/utils/redis-client");
21
+ let SubscriptionMiddleware = class SubscriptionMiddleware {
22
+ constructor(client) {
23
+ this.client = client;
24
+ this.cachManager = new redis_client_1.RedisClient();
25
+ }
26
+ async use(request, response, next) {
27
+ const user = {
28
+ subject: subjects_1.Subjects.HasSubscription,
29
+ data: {
30
+ company: this.getHeaderParam(request.headers, 'company'),
31
+ eventId: this.getHeaderParam(request.headers, 'event-id'),
32
+ },
33
+ };
34
+ const redisKey = JSON.stringify(user.data);
35
+ const redisResponse = await this.cachManager.getData(redisKey);
36
+ let resp;
37
+ if (redisResponse) {
38
+ resp = JSON.parse(redisResponse);
39
+ console.log('FROM REDIS--------------------', redisResponse);
40
+ await this.isPermitted(resp, request.method, request.route.path, redisKey);
41
+ }
42
+ else {
43
+ resp = await rxjs_1.firstValueFrom(this.client.send(user.subject, user.data));
44
+ console.log('FROM MESSAGE BROKER--------------------', resp);
45
+ if (!resp.hasSubscription) {
46
+ throw new common_1.UnauthorizedException('Subscription is required');
47
+ }
48
+ else {
49
+ await this.cachManager.setData(redisKey, JSON.stringify(resp), 60);
50
+ await this.isPermitted(resp, request.method, request.route.path, redisKey);
51
+ }
52
+ }
53
+ next();
54
+ }
55
+ getHeaderParam(headers, param) {
56
+ return Array.isArray(headers[param]) ? headers[param][0] : headers[param];
57
+ }
58
+ async isPermitted(subscription, method, path, key) {
59
+ const { features, remainingPoints } = subscription;
60
+ 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
+ }
73
+ }
74
+ }
75
+ getEndpoint(features, method, path) {
76
+ const feature = features.find(feature => feature.endpoints.find(endpoint => endpoint.method === method && endpoint.endpoint === path));
77
+ if (!feature) {
78
+ throw new common_1.UnauthorizedException('Invalid feature for this subscription');
79
+ }
80
+ return feature.endpoints.find(endpoint => endpoint.method === method && endpoint.endpoint === path);
81
+ }
82
+ };
83
+ SubscriptionMiddleware = __decorate([
84
+ common_1.Injectable(),
85
+ __param(0, common_1.Inject('SUBSCRIPTION_SERVICE')),
86
+ __metadata("design:paramtypes", [microservices_1.ClientProxy])
87
+ ], SubscriptionMiddleware);
88
+ exports.SubscriptionMiddleware = SubscriptionMiddleware;
89
+ //# sourceMappingURL=subscription.middleware.js.map
@@ -0,0 +1 @@
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,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,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC;gBACxD,OAAO,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO,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OAAO,EAAE;YACZ,MAAM,IAAI,8BAAqB,CAAC,uCAAuC,CAAC,CAAA;SACzE;QACD,OAAO,OAAO,CAAC,SAAS,CAAC,IAAI,CAC3B,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,MAAM,KAAK,MAAM,IAAI,QAAQ,CAAC,QAAQ,KAAK,IAAI,CACrE,CAAA;IACH,CAAC;CACF,CAAA;AA9FY,sBAAsB;IADlC,mBAAU,EAAE;IAIR,WAAA,eAAM,CAAC,sBAAsB,CAAC,CAAA;qCAA0B,2BAAW;GAH3D,sBAAsB,CA8FlC;AA9FY,wDAAsB"}
@@ -346,6 +346,11 @@
346
346
  "signature": "b858b34c2be10c11a81cf34ef8870897869f9355a8099995695ceea1e1bdf8c4",
347
347
  "affectsGlobalScope": false
348
348
  },
349
+ "../src/types/record-type.enum.ts": {
350
+ "version": "24ae6ec51b7f6d32720b4361fbd2976b7940dc3156fababf2c202bbaf2a36c8f",
351
+ "signature": "86ced70cac74c24452bc233bb8f054f8918276c228eccb1b8e1de21b44f602bf",
352
+ "affectsGlobalScope": false
353
+ },
349
354
  "../src/types/notification-event.enum.ts": {
350
355
  "version": "d857cd78bca1efc847646f652eb4d7238f70cf74b3020360632a47c814e51bd4",
351
356
  "signature": "31410ca280de02a8895b6476f3c60f176e39391021ac7ceb4cfae54292aaaf60",
@@ -357,8 +362,8 @@
357
362
  "affectsGlobalScope": false
358
363
  },
359
364
  "../src/events/send-notifications.interface.ts": {
360
- "version": "17bd4b147b206f0a9b3e8a4f6d65f268edd504db883c1e137285bc40c4b36179",
361
- "signature": "b837bf5cbfb932e307f402ec9d5b832603dc3392617ca51fee8fa9614dd36d11",
365
+ "version": "5228f0899a57968c2ecfb39c9bcedebfdaf99213d47659ea3c9d37225faff702",
366
+ "signature": "9b1aed21580451e09223f934638c2876e3c71dbfd36b83cb36d7cd1337bd611c",
362
367
  "affectsGlobalScope": false
363
368
  },
364
369
  "../src/events/get-contacts-by-query.interface.ts": {
@@ -377,8 +382,8 @@
377
382
  "affectsGlobalScope": false
378
383
  },
379
384
  "../src/events/queues.ts": {
380
- "version": "25ee1471aa2f23a4b3b7846462f35c71fd46a3fa6e49852762b1087e5bfbfc4c",
381
- "signature": "5ac9697b9fba95cf7fee44fe2f59f349bc1e915ebfb7868fe952906ef97aea7f",
385
+ "version": "927cad98ace301753d5ed1ee46ba9533d9b8940dd38c38770c1d9d8dbfa6dd16",
386
+ "signature": "d9b03d0bf10a0a298666cc38574c927cb0ae309f54dc4cd98110f4e382e37c2e",
382
387
  "affectsGlobalScope": false
383
388
  },
384
389
  "../src/events/create-default-templates.ts": {
@@ -6372,8 +6377,8 @@
6372
6377
  "affectsGlobalScope": false
6373
6378
  },
6374
6379
  "../src/index.ts": {
6375
- "version": "d0e7287af52722e557b4071abf2d96f64fd95fd5341829e7e1667bb5f5aa5423",
6376
- "signature": "be641257902382456322af4cdfe276c365fb97b199c084983c78fcab9f355ee9",
6380
+ "version": "00f2cea03175c410406bf0cf31fc81702064c77e869811a103573ee6452ff4e2",
6381
+ "signature": "83eadbd81783af90770b7da097211f38bc072b56cf33ddb53267ebe38fc356d3",
6377
6382
  "affectsGlobalScope": false
6378
6383
  },
6379
6384
  "../src/events/meeting-request-updated.interface.ts": {
@@ -6381,6 +6386,21 @@
6381
6386
  "signature": "2388b17bfe1f2e511b4960ec098cf5db020cec29e4f50f8676f8aa64da10c581",
6382
6387
  "affectsGlobalScope": false
6383
6388
  },
6389
+ "../src/types/enddpoint.interface.ts": {
6390
+ "version": "607660b65fbe13d1447abe69648c2201555641ff7c1b9ab6f6a3d0edfc144bbf",
6391
+ "signature": "4f008ce1a0a399608dc1641c0455559891f2b1d3d123694eb110294e6cb09782",
6392
+ "affectsGlobalScope": false
6393
+ },
6394
+ "../src/types/feature.interface.ts": {
6395
+ "version": "3b39f9270e9b9cbea5e8548f66e7c56982bdd04241c726bcf06e8891935d02b2",
6396
+ "signature": "8e1ccdc6ce1e15771f99674f949c1bd02ae24a4fb0b0b77b26216e28ec23762a",
6397
+ "affectsGlobalScope": false
6398
+ },
6399
+ "../src/middlewares/subscription.middleware.ts": {
6400
+ "version": "4a90f2179525e5d63a0145903d63cb8945e4966cff50e1837b16d37ef6d6f624",
6401
+ "signature": "63084574038bac4eb353074b166d479996890194abc48475e9e741e349a16cf6",
6402
+ "affectsGlobalScope": false
6403
+ },
6384
6404
  "../node_modules/@types/minimatch/index.d.ts": {
6385
6405
  "version": "95c22bc19835e28e2e524a4bb8898eb5f2107b640d7279a6d3aade261916bbf2",
6386
6406
  "signature": "95c22bc19835e28e2e524a4bb8898eb5f2107b640d7279a6d3aade261916bbf2",
@@ -11302,7 +11322,8 @@
11302
11322
  "../src/events/send-notifications.interface.ts": [
11303
11323
  "../src/events/subjects.ts",
11304
11324
  "../src/types/notification-event.enum.ts",
11305
- "../src/types/notification-type.enum.ts"
11325
+ "../src/types/notification-type.enum.ts",
11326
+ "../src/types/record-type.enum.ts"
11306
11327
  ],
11307
11328
  "../src/events/service-created.interface.ts": [
11308
11329
  "../src/events/subjects.ts"
@@ -11438,6 +11459,7 @@
11438
11459
  "../src/types/notification-type.enum.ts",
11439
11460
  "../src/types/operation-types.ts",
11440
11461
  "../src/types/read-result.interface.ts",
11462
+ "../src/types/record-type.enum.ts",
11441
11463
  "../src/types/update-input-data.interface.ts",
11442
11464
  "../src/types/upload-presigned-url.interface.ts",
11443
11465
  "../src/types/user-invitations.interface.ts",
@@ -11495,10 +11517,22 @@
11495
11517
  "../src/types/user-type.enum.ts",
11496
11518
  "../src/utils/redis-client.ts"
11497
11519
  ],
11520
+ "../src/middlewares/subscription.middleware.ts": [
11521
+ "../node_modules/@nestjs/common/index.d.ts",
11522
+ "../node_modules/@nestjs/microservices/index.d.ts",
11523
+ "../node_modules/@types/express/index.d.ts",
11524
+ "../node_modules/rxjs/dist/types/index.d.ts",
11525
+ "../src/events/subjects.ts",
11526
+ "../src/types/feature.interface.ts",
11527
+ "../src/utils/redis-client.ts"
11528
+ ],
11498
11529
  "../src/types/default-visibility.interface.ts": [
11499
11530
  "../src/types/analytic-group.interface.ts",
11500
11531
  "../src/types/visibility-group.interface.ts"
11501
11532
  ],
11533
+ "../src/types/feature.interface.ts": [
11534
+ "../src/types/enddpoint.interface.ts"
11535
+ ],
11502
11536
  "../src/types/group-visibility.interface.ts": [
11503
11537
  "../src/types/analytic-group.interface.ts",
11504
11538
  "../src/types/chat-group.interface.ts",
@@ -16422,7 +16456,8 @@
16422
16456
  "../src/events/send-notifications.interface.ts": [
16423
16457
  "../src/events/subjects.ts",
16424
16458
  "../src/types/notification-event.enum.ts",
16425
- "../src/types/notification-type.enum.ts"
16459
+ "../src/types/notification-type.enum.ts",
16460
+ "../src/types/record-type.enum.ts"
16426
16461
  ],
16427
16462
  "../src/events/service-created.interface.ts": [
16428
16463
  "../src/events/subjects.ts"
@@ -16558,6 +16593,7 @@
16558
16593
  "../src/types/notification-type.enum.ts",
16559
16594
  "../src/types/operation-types.ts",
16560
16595
  "../src/types/read-result.interface.ts",
16596
+ "../src/types/record-type.enum.ts",
16561
16597
  "../src/types/update-input-data.interface.ts",
16562
16598
  "../src/types/upload-presigned-url.interface.ts",
16563
16599
  "../src/types/user-invitations.interface.ts",
@@ -16605,10 +16641,18 @@
16605
16641
  "../node_modules/@nestjs/microservices/index.d.ts",
16606
16642
  "../node_modules/@types/express/index.d.ts"
16607
16643
  ],
16644
+ "../src/middlewares/subscription.middleware.ts": [
16645
+ "../node_modules/@nestjs/common/index.d.ts",
16646
+ "../node_modules/@nestjs/microservices/index.d.ts",
16647
+ "../node_modules/@types/express/index.d.ts"
16648
+ ],
16608
16649
  "../src/types/default-visibility.interface.ts": [
16609
16650
  "../src/types/analytic-group.interface.ts",
16610
16651
  "../src/types/visibility-group.interface.ts"
16611
16652
  ],
16653
+ "../src/types/feature.interface.ts": [
16654
+ "../src/types/enddpoint.interface.ts"
16655
+ ],
16612
16656
  "../src/types/group-visibility.interface.ts": [
16613
16657
  "../src/types/analytic-group.interface.ts",
16614
16658
  "../src/types/chat-group.interface.ts",
@@ -17894,11 +17938,14 @@
17894
17938
  "../src/interceptors/serialize.interceptor.ts",
17895
17939
  "../src/middlewares/app.middleware.ts",
17896
17940
  "../src/middlewares/authorizer.middleware.ts",
17941
+ "../src/middlewares/subscription.middleware.ts",
17897
17942
  "../src/types/analytic-group.interface.ts",
17898
17943
  "../src/types/calendar-source-type.enum.ts",
17899
17944
  "../src/types/chat-group.interface.ts",
17900
17945
  "../src/types/default-visibility.interface.ts",
17901
17946
  "../src/types/download-presigned-url.interface.ts",
17947
+ "../src/types/enddpoint.interface.ts",
17948
+ "../src/types/feature.interface.ts",
17902
17949
  "../src/types/group-visibility.interface.ts",
17903
17950
  "../src/types/header-user.interface.ts",
17904
17951
  "../src/types/match-group.interface.ts",
@@ -17909,6 +17956,7 @@
17909
17956
  "../src/types/notification-type.enum.ts",
17910
17957
  "../src/types/operation-types.ts",
17911
17958
  "../src/types/read-result.interface.ts",
17959
+ "../src/types/record-type.enum.ts",
17912
17960
  "../src/types/update-input-data.interface.ts",
17913
17961
  "../src/types/upload-presigned-url.interface.ts",
17914
17962
  "../src/types/user-invitations.interface.ts",
@@ -0,0 +1,5 @@
1
+ export interface Endpoint {
2
+ endpoint: string;
3
+ method: string;
4
+ point?: number;
5
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=enddpoint.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enddpoint.interface.js","sourceRoot":"","sources":["../../src/types/enddpoint.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { Endpoint } from './enddpoint.interface';
2
+ export interface Feature {
3
+ name: string;
4
+ endpoints: Endpoint[];
5
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=feature.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature.interface.js","sourceRoot":"","sources":["../../src/types/feature.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ export declare enum RecordType {
2
+ COMPANY = "Company",
3
+ CONTACT = "Contact",
4
+ MEETING = "Meeting",
5
+ MEETING_REQUEST = "MeetingRequest",
6
+ PRODUCT = "Product",
7
+ SERVICE = "Service",
8
+ RFQ = "RFQ",
9
+ QUOTATION = "Quotation"
10
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RecordType = void 0;
4
+ var RecordType;
5
+ (function (RecordType) {
6
+ RecordType["COMPANY"] = "Company";
7
+ RecordType["CONTACT"] = "Contact";
8
+ RecordType["MEETING"] = "Meeting";
9
+ RecordType["MEETING_REQUEST"] = "MeetingRequest";
10
+ RecordType["PRODUCT"] = "Product";
11
+ RecordType["SERVICE"] = "Service";
12
+ RecordType["RFQ"] = "RFQ";
13
+ RecordType["QUOTATION"] = "Quotation";
14
+ })(RecordType = exports.RecordType || (exports.RecordType = {}));
15
+ //# sourceMappingURL=record-type.enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"record-type.enum.js","sourceRoot":"","sources":["../../src/types/record-type.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,UASX;AATD,WAAY,UAAU;IACpB,iCAAmB,CAAA;IACnB,iCAAmB,CAAA;IACnB,iCAAmB,CAAA;IACnB,gDAAkC,CAAA;IAClC,iCAAmB,CAAA;IACnB,iCAAmB,CAAA;IACnB,yBAAW,CAAA;IACX,qCAAuB,CAAA;AACzB,CAAC,EATW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QASrB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aldb2b/common",
3
- "version": "1.0.175",
3
+ "version": "1.0.178",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",