@comasoft/nestjs 0.1.3 → 0.1.7

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 (171) hide show
  1. package/README.md +2 -0
  2. package/dist/aws/aws-s3.service.js +1 -158
  3. package/dist/aws/aws.module.js +1 -25
  4. package/dist/aws/aws.service.js +1 -21
  5. package/dist/aws/constants/storage.constant.js +1 -25
  6. package/dist/aws/dto/create-s3-presigned.dto.js +1 -78
  7. package/dist/aws/dto/index.js +1 -18
  8. package/dist/aws/dto/response-s3-presigned.dto.js +1 -110
  9. package/dist/aws/index.js +1 -20
  10. package/dist/aws/types/s3.interface.js +1 -2
  11. package/dist/aws/types/storage.interface.js +1 -2
  12. package/dist/category/category.module.js +1 -23
  13. package/dist/category/category.service.d.ts +20 -8
  14. package/dist/category/category.service.js +1 -124
  15. package/dist/category/dto/create-category.dto.js +1 -34
  16. package/dist/category/dto/delete-category.dto.js +1 -6
  17. package/dist/category/dto/index.js +1 -21
  18. package/dist/category/dto/response-categories.dto.js +1 -52
  19. package/dist/category/dto/update-category-sort.dto.js +1 -33
  20. package/dist/category/dto/update-category.dto.js +1 -9
  21. package/dist/category/index.js +1 -19
  22. package/dist/comment/comment.module.js +1 -23
  23. package/dist/comment/comment.service.d.ts +12 -3
  24. package/dist/comment/comment.service.js +1 -240
  25. package/dist/comment/dto/create-comment.dto.d.ts +1 -0
  26. package/dist/comment/dto/create-comment.dto.js +1 -41
  27. package/dist/comment/dto/index.js +1 -19
  28. package/dist/comment/dto/response-comment.dto.d.ts +5 -2
  29. package/dist/comment/dto/response-comment.dto.js +1 -97
  30. package/dist/comment/dto/update-comment.dto.js +1 -22
  31. package/dist/comment/index.js +1 -19
  32. package/dist/database/entities/category.entity.js +1 -70
  33. package/dist/database/entities/comment.entity.d.ts +2 -0
  34. package/dist/database/entities/comment.entity.js +1 -77
  35. package/dist/database/entities/config.entity.js +1 -44
  36. package/dist/database/entities/file.entity.js +1 -91
  37. package/dist/database/entities/index.js +1 -26
  38. package/dist/database/entities/like.entity.d.ts +1 -0
  39. package/dist/database/entities/like.entity.js +1 -49
  40. package/dist/database/entities/logs-audit.entity.d.ts +3 -0
  41. package/dist/database/entities/logs-audit.entity.js +1 -72
  42. package/dist/database/entities/logs-event.entity.d.ts +2 -0
  43. package/dist/database/entities/logs-event.entity.js +1 -72
  44. package/dist/database/entities/notification-recipient.entity.d.ts +4 -0
  45. package/dist/database/entities/notification-recipient.entity.js +1 -74
  46. package/dist/database/entities/notification.entity.d.ts +4 -0
  47. package/dist/database/entities/notification.entity.js +1 -69
  48. package/dist/database/entities/role.entity.js +1 -54
  49. package/dist/decorators/api-custom-params.decorator.js +1 -35
  50. package/dist/decorators/auth.decorator.factory.js +1 -33
  51. package/dist/decorators/cookies.decorator.js +1 -9
  52. package/dist/decorators/custom-params.decorator.js +1 -16
  53. package/dist/decorators/index.d.ts +0 -2
  54. package/dist/decorators/index.js +1 -24
  55. package/dist/decorators/patch-body.decorator.js +1 -38
  56. package/dist/decorators/soft-delete.decorator.js +1 -10
  57. package/dist/decorators/timestamps.decorator.js +1 -23
  58. package/dist/decorators/user.decorator.js +1 -8
  59. package/dist/dto/auth-user-local.dto.js +1 -26
  60. package/dist/dto/auth-user-sso.dto.js +1 -21
  61. package/dist/dto/custom-params.dto.js +1 -46
  62. package/dist/dto/file.dto.js +1 -70
  63. package/dist/dto/index.js +1 -26
  64. package/dist/dto/jwt-user.dto.js +1 -6
  65. package/dist/dto/pagination.dto.js +1 -36
  66. package/dist/dto/remove-ids.dto.js +1 -23
  67. package/dist/dto/response-access-token.dto.js +1 -24
  68. package/dist/dto/response-id.dto.js +1 -35
  69. package/dist/dto/response-uid.dto.js +1 -35
  70. package/dist/dto/update-ids.dto.js +1 -45
  71. package/dist/dto/update-sort.dto.js +1 -50
  72. package/dist/enums.common.d.ts +2 -1
  73. package/dist/enums.common.js +1 -62
  74. package/dist/events/event-bus.module.js +1 -44
  75. package/dist/events/index.js +1 -20
  76. package/dist/events/listeners/audit-event.listener.js +1 -58
  77. package/dist/events/listeners/index.d.ts +1 -0
  78. package/dist/events/listeners/index.js +1 -17
  79. package/dist/events/listeners/notification-event.listener.d.ts +7 -0
  80. package/dist/events/listeners/notification-event.listener.js +1 -0
  81. package/dist/events/listeners/system-event.listener.js +1 -58
  82. package/dist/events/services/event-logger.service.js +1 -34
  83. package/dist/events/services/event-notification.service.js +1 -104
  84. package/dist/events/services/event-storage.service.js +1 -79
  85. package/dist/events/services/index.js +1 -20
  86. package/dist/events/services/token.service.d.ts +2 -4
  87. package/dist/events/services/token.service.js +1 -88
  88. package/dist/events/types/audit-events.type.d.ts +4 -1
  89. package/dist/events/types/audit-events.type.js +1 -2
  90. package/dist/events/types/index.js +1 -17
  91. package/dist/filters/http-exception.filter.d.ts +2 -2
  92. package/dist/filters/http-exception.filter.js +1 -78
  93. package/dist/filters/index.js +1 -17
  94. package/dist/guards/auth.guard.js +1 -60
  95. package/dist/guards/index.d.ts +3 -0
  96. package/dist/guards/index.js +1 -0
  97. package/dist/guards/jwt.guard.js +1 -17
  98. package/dist/guards/permission.guard.d.ts +10 -0
  99. package/dist/guards/permission.guard.js +1 -0
  100. package/dist/guards/role.guard.d.ts +8 -0
  101. package/dist/guards/role.guard.js +1 -0
  102. package/dist/index.d.ts +1 -0
  103. package/dist/index.js +1 -36
  104. package/dist/interceptors/error.interceptor.js +1 -26
  105. package/dist/interceptors/index.js +1 -18
  106. package/dist/interceptors/success.interceptor.d.ts +1 -1
  107. package/dist/interceptors/success.interceptor.js +1 -30
  108. package/dist/library.module.js +1 -20
  109. package/dist/like/dto/create-like.dto.js +1 -47
  110. package/dist/like/dto/index.js +1 -18
  111. package/dist/like/dto/response-like.dto.js +1 -79
  112. package/dist/like/index.js +1 -19
  113. package/dist/like/like.module.js +1 -23
  114. package/dist/like/like.service.d.ts +2 -2
  115. package/dist/like/like.service.js +1 -155
  116. package/dist/logger/index.js +1 -18
  117. package/dist/logger/pino-options.js +1 -77
  118. package/dist/logger/pino-pretty-transport.js +1 -155
  119. package/dist/notifications/index.d.ts +27 -4
  120. package/dist/notifications/index.js +1 -18
  121. package/dist/notifications/notification.module.js +1 -32
  122. package/dist/notifications/services/email.service.d.ts +5 -4
  123. package/dist/notifications/services/email.service.js +1 -69
  124. package/dist/notifications/services/index.d.ts +1 -0
  125. package/dist/notifications/services/index.js +1 -23
  126. package/dist/notifications/services/kakao.service.d.ts +17 -17
  127. package/dist/notifications/services/kakao.service.js +1 -94
  128. package/dist/notifications/services/message-template.service.d.ts +6 -2
  129. package/dist/notifications/services/message-template.service.js +1 -74
  130. package/dist/notifications/services/notification-send.service.d.ts +8 -12
  131. package/dist/notifications/services/notification-send.service.js +1 -146
  132. package/dist/notifications/services/notification.service.d.ts +3 -1
  133. package/dist/notifications/services/notification.service.js +1 -125
  134. package/dist/notifications/services/slack.service.d.ts +6 -1
  135. package/dist/notifications/services/slack.service.js +1 -53
  136. package/dist/notifications/services/sms.service.js +1 -62
  137. package/dist/notifications/services/web.service.d.ts +15 -0
  138. package/dist/notifications/services/web.service.js +1 -0
  139. package/dist/passport/google.strategy.js +1 -43
  140. package/dist/passport/index.js +1 -20
  141. package/dist/passport/jwt.strategy.js +1 -55
  142. package/dist/passport/kakao.strategy.js +1 -43
  143. package/dist/passport/local.strategy.js +1 -41
  144. package/dist/redis/index.js +1 -18
  145. package/dist/redis/redis-constraint.js +1 -4
  146. package/dist/redis/redis.module.js +1 -62
  147. package/dist/redis/redis.service.js +1 -76
  148. package/dist/role/dto/create-role.dto.js +1 -41
  149. package/dist/role/dto/index.js +1 -19
  150. package/dist/role/dto/response-roles.dto.js +1 -62
  151. package/dist/role/dto/update-role.dto.js +1 -9
  152. package/dist/role/index.js +1 -19
  153. package/dist/role/role.module.js +1 -23
  154. package/dist/role/role.service.d.ts +20 -6
  155. package/dist/role/role.service.js +1 -144
  156. package/dist/services/file.service.d.ts +4 -4
  157. package/dist/services/file.service.js +1 -82
  158. package/dist/services/index.js +1 -18
  159. package/dist/services/permission-checker.service.js +1 -65
  160. package/dist/setup-swagger.js +1 -32
  161. package/dist/shared/error-codes.js +1 -9
  162. package/dist/utils/common.utils.js +1 -42
  163. package/dist/utils/enum.utils.js +1 -8
  164. package/dist/utils/file.utils.d.ts +6 -0
  165. package/dist/utils/file.utils.js +1 -0
  166. package/dist/utils/index.d.ts +1 -0
  167. package/dist/utils/index.js +1 -21
  168. package/dist/utils/object-diff.js +1 -33
  169. package/dist/utils/pagination-qb.utils.js +1 -154
  170. package/dist/utils/pagination.utils.js +1 -32
  171. package/package.json +2 -2
@@ -1,62 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LIKE_TYPE = exports.NOTIFICATION_STATUS = exports.FILE_STATUS = exports.AUDIT_ACTION = exports.DEVICE_TYPE = exports.MIME_TYPE = exports.FILE_TYPE = void 0;
4
- var FILE_TYPE;
5
- (function (FILE_TYPE) {
6
- FILE_TYPE["IMAGE"] = "IMAGE";
7
- FILE_TYPE["VIDEO"] = "VIDEO";
8
- FILE_TYPE["DOCUMENT"] = "DOCUMENT";
9
- FILE_TYPE["AUDIO"] = "AUDIO";
10
- FILE_TYPE["OTHER"] = "OTHER";
11
- })(FILE_TYPE || (exports.FILE_TYPE = FILE_TYPE = {}));
12
- var MIME_TYPE;
13
- (function (MIME_TYPE) {
14
- MIME_TYPE["JPEG"] = "image/jpeg";
15
- MIME_TYPE["PNG"] = "image/png";
16
- MIME_TYPE["GIF"] = "image/gif";
17
- MIME_TYPE["PDF"] = "application/pdf";
18
- MIME_TYPE["DOC"] = "application/msword";
19
- MIME_TYPE["DOCX"] = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
20
- MIME_TYPE["XLS"] = "application/vnd.ms-excel";
21
- MIME_TYPE["XLSX"] = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
22
- MIME_TYPE["PPT"] = "application/vnd.ms-powerpoint";
23
- MIME_TYPE["PPTX"] = "application/vnd.openxmlformats-officedocument.presentationml.presentation";
24
- MIME_TYPE["TXT"] = "text/plain";
25
- MIME_TYPE["HTML"] = "text/html";
26
- MIME_TYPE["CSV"] = "text/csv";
27
- })(MIME_TYPE || (exports.MIME_TYPE = MIME_TYPE = {}));
28
- var DEVICE_TYPE;
29
- (function (DEVICE_TYPE) {
30
- DEVICE_TYPE["ANDROID"] = "android";
31
- DEVICE_TYPE["IOS"] = "ios";
32
- DEVICE_TYPE["PC"] = "pc";
33
- DEVICE_TYPE["MAC"] = "mac";
34
- DEVICE_TYPE["OTHER"] = "other";
35
- })(DEVICE_TYPE || (exports.DEVICE_TYPE = DEVICE_TYPE = {}));
36
- var AUDIT_ACTION;
37
- (function (AUDIT_ACTION) {
38
- AUDIT_ACTION["CREATE"] = "create";
39
- AUDIT_ACTION["READ"] = "read";
40
- AUDIT_ACTION["UPDATE"] = "update";
41
- AUDIT_ACTION["DELETE"] = "delete";
42
- })(AUDIT_ACTION || (exports.AUDIT_ACTION = AUDIT_ACTION = {}));
43
- var FILE_STATUS;
44
- (function (FILE_STATUS) {
45
- FILE_STATUS["PENDING"] = "pending";
46
- FILE_STATUS["COMPLETED"] = "completed";
47
- FILE_STATUS["FAILED"] = "failed";
48
- FILE_STATUS["DELETED"] = "deleted";
49
- })(FILE_STATUS || (exports.FILE_STATUS = FILE_STATUS = {}));
50
- var NOTIFICATION_STATUS;
51
- (function (NOTIFICATION_STATUS) {
52
- NOTIFICATION_STATUS["PENDING"] = "pending";
53
- NOTIFICATION_STATUS["SENT"] = "sent";
54
- NOTIFICATION_STATUS["READ"] = "read";
55
- NOTIFICATION_STATUS["FAILED"] = "failed";
56
- })(NOTIFICATION_STATUS || (exports.NOTIFICATION_STATUS = NOTIFICATION_STATUS = {}));
57
- var LIKE_TYPE;
58
- (function (LIKE_TYPE) {
59
- LIKE_TYPE["LIKE"] = "like";
60
- LIKE_TYPE["DISLIKE"] = "dislike";
61
- LIKE_TYPE["NONE"] = "none";
62
- })(LIKE_TYPE || (exports.LIKE_TYPE = LIKE_TYPE = {}));
1
+ var e,o,t,n,E,p,i;Object.defineProperty(exports,"__esModule",{value:!0}),exports.LIKE_TYPE=exports.NOTIFICATION_STATUS=exports.FILE_STATUS=exports.AUDIT_ACTION=exports.DEVICE_TYPE=exports.MIME_TYPE=exports.FILE_TYPE=void 0,function(e){e.IMAGE="IMAGE",e.VIDEO="VIDEO",e.DOCUMENT="DOCUMENT",e.AUDIO="AUDIO",e.OTHER="OTHER"}(e||(exports.FILE_TYPE=e={})),function(e){e.JPEG="image/jpeg",e.PNG="image/png",e.GIF="image/gif",e.PDF="application/pdf",e.DOC="application/msword",e.DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",e.XLS="application/vnd.ms-excel",e.XLSX="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",e.PPT="application/vnd.ms-powerpoint",e.PPTX="application/vnd.openxmlformats-officedocument.presentationml.presentation",e.TXT="text/plain",e.HTML="text/html",e.CSV="text/csv"}(o||(exports.MIME_TYPE=o={})),function(e){e.ANDROID="android",e.IOS="ios",e.PC="pc",e.MAC="mac",e.OTHER="other"}(t||(exports.DEVICE_TYPE=t={})),function(e){e.CREATE="create",e.READ="read",e.UPDATE="update",e.DELETE="delete",e.DOWNLOAD="download"}(n||(exports.AUDIT_ACTION=n={})),function(e){e.PENDING="pending",e.COMPLETED="completed",e.FAILED="failed",e.DELETED="deleted"}(E||(exports.FILE_STATUS=E={})),function(e){e.PENDING="pending",e.SENT="sent",e.READ="read",e.FAILED="failed"}(p||(exports.NOTIFICATION_STATUS=p={})),function(e){e.LIKE="like",e.DISLIKE="dislike",e.NONE="none"}(i||(exports.LIKE_TYPE=i={}));
@@ -1,44 +1 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.EventBusModule = void 0;
10
- const common_1 = require("@nestjs/common");
11
- const event_emitter_1 = require("@nestjs/event-emitter");
12
- const typeorm_1 = require("@nestjs/typeorm");
13
- const entities_1 = require("../database/entities");
14
- const notification_module_1 = require("../notifications/notification.module");
15
- const listeners_1 = require("./listeners");
16
- const services_1 = require("./services");
17
- let EventBusModule = class EventBusModule {
18
- };
19
- exports.EventBusModule = EventBusModule;
20
- exports.EventBusModule = EventBusModule = __decorate([
21
- (0, common_1.Global)(),
22
- (0, common_1.Module)({
23
- imports: [
24
- typeorm_1.TypeOrmModule.forFeature([entities_1.LogsAudit, entities_1.LogsEvent]),
25
- event_emitter_1.EventEmitterModule.forRoot({
26
- wildcard: true,
27
- delimiter: '.',
28
- newListener: false,
29
- removeListener: false,
30
- maxListeners: 20,
31
- verboseMemoryLeak: false,
32
- ignoreErrors: false,
33
- }),
34
- notification_module_1.NotificationModule,
35
- ],
36
- providers: [
37
- services_1.EventLoggerService,
38
- services_1.EventStorageService,
39
- services_1.EventNotificationService,
40
- listeners_1.AuditEventListener,
41
- ],
42
- exports: [services_1.EventLoggerService, services_1.EventStorageService, services_1.EventNotificationService],
43
- })
44
- ], EventBusModule);
1
+ var e=this&&this.__decorate||function(e,t,r,o){var i,n=arguments.length,s=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,o);else for(var c=e.length-1;c>=0;c--)(i=e[c])&&(s=(n<3?i(s):n>3?i(t,r,s):i(t,r))||s);return n>3&&s&&Object.defineProperty(t,r,s),s};Object.defineProperty(exports,"__esModule",{value:!0}),exports.EventBusModule=void 0;const t=require("@nestjs/common"),r=require("@nestjs/event-emitter"),o=require("@nestjs/typeorm"),i=require("../database/entities"),n=require("../notifications/notification.module"),s=require("./listeners"),c=require("./services");let v=class EventBusModule{};exports.EventBusModule=v,exports.EventBusModule=v=e([(0,t.Global)(),(0,t.Module)({imports:[o.TypeOrmModule.forFeature([i.LogsAudit,i.LogsEvent]),r.EventEmitterModule.forRoot({wildcard:!0,delimiter:".",newListener:!1,removeListener:!1,maxListeners:20,verboseMemoryLeak:!1,ignoreErrors:!1}),n.NotificationModule],providers:[c.EventLoggerService,c.EventStorageService,c.EventNotificationService,s.AuditEventListener,s.NotificationEventListener],exports:[c.EventLoggerService,c.EventStorageService,c.EventNotificationService]})],v);
@@ -1,20 +1 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./types"), exports);
18
- __exportStar(require("./services"), exports);
19
- __exportStar(require("./listeners"), exports);
20
- __exportStar(require("./event-bus.module"), exports);
1
+ var e=this&&this.__createBinding||(Object.create?function(e,r,t,i){void 0===i&&(i=t);var o=Object.getOwnPropertyDescriptor(r,t);o&&!("get"in o?!r.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,i,o)}:function(e,r,t,i){void 0===i&&(i=t),e[i]=r[t]}),r=this&&this.__exportStar||function(r,t){for(var i in r)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||e(t,r,i)};Object.defineProperty(exports,"__esModule",{value:!0}),r(require("./types"),exports),r(require("./services"),exports),r(require("./listeners"),exports),r(require("./event-bus.module"),exports);
@@ -1,58 +1 @@
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13
- return new (P || (P = Promise))(function (resolve, reject) {
14
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
- step((generator = generator.apply(thisArg, _arguments || [])).next());
18
- });
19
- };
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.AuditEventListener = void 0;
22
- const common_1 = require("@nestjs/common");
23
- const event_emitter_1 = require("@nestjs/event-emitter");
24
- const services_1 = require("../services");
25
- let AuditEventListener = class AuditEventListener {
26
- constructor(eventStorage, eventLogger, eventNotificationService) {
27
- this.eventStorage = eventStorage;
28
- this.eventLogger = eventLogger;
29
- this.eventNotificationService = eventNotificationService;
30
- }
31
- handleAuditEvent(event) {
32
- return __awaiter(this, void 0, void 0, function* () {
33
- const { db = true, log = true } = event;
34
- if (db) {
35
- yield this.eventStorage.storeAuditEvent(event);
36
- }
37
- if (log) {
38
- yield this.eventLogger.log(event);
39
- }
40
- if (event.notification) {
41
- yield this.eventNotificationService.send(event.notification);
42
- }
43
- });
44
- }
45
- };
46
- exports.AuditEventListener = AuditEventListener;
47
- __decorate([
48
- (0, event_emitter_1.OnEvent)('audit.**', { async: true }),
49
- __metadata("design:type", Function),
50
- __metadata("design:paramtypes", [Object]),
51
- __metadata("design:returntype", Promise)
52
- ], AuditEventListener.prototype, "handleAuditEvent", null);
53
- exports.AuditEventListener = AuditEventListener = __decorate([
54
- (0, common_1.Injectable)(),
55
- __metadata("design:paramtypes", [services_1.EventStorageService,
56
- services_1.EventLoggerService,
57
- services_1.EventNotificationService])
58
- ], AuditEventListener);
1
+ var e=this&&this.__decorate||function(e,t,n,i){var o,r=arguments.length,c=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(c=(r<3?o(c):r>3?o(t,n,c):o(t,n))||c);return r>3&&c&&Object.defineProperty(t,n,c),c},t=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},n=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(o,r){function fulfilled(e){try{step(i.next(e))}catch(e){r(e)}}function rejected(e){try{step(i.throw(e))}catch(e){r(e)}}function step(e){e.done?o(e.value):function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(fulfilled,rejected)}step((i=i.apply(e,t||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.AuditEventListener=void 0;const i=require("@nestjs/common"),o=require("@nestjs/event-emitter"),r=require("../services");let c=class AuditEventListener{constructor(e,t,n){this.eventStorage=e,this.eventLogger=t,this.eventNotificationService=n}handleAuditEvent(e){return n(this,void 0,void 0,function*(){const{db:t=!0,log:n=!0}=e;t&&(yield this.eventStorage.storeAuditEvent(e)),n&&(yield this.eventLogger.log(e)),e.notification&&(yield this.eventNotificationService.send(e.notification))})}};exports.AuditEventListener=c,e([(0,o.OnEvent)("audit.**",{async:!0}),t("design:type",Function),t("design:paramtypes",[Object]),t("design:returntype",Promise)],c.prototype,"handleAuditEvent",null),exports.AuditEventListener=c=e([(0,i.Injectable)(),t("design:paramtypes",[r.EventStorageService,r.EventLoggerService,r.EventNotificationService])],c);
@@ -1 +1,2 @@
1
1
  export * from './audit-event.listener';
2
+ export * from './notification-event.listener';
@@ -1,17 +1 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./audit-event.listener"), exports);
1
+ var e=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),t=this&&this.__exportStar||function(t,r){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(r,i)||e(r,t,i)};Object.defineProperty(exports,"__esModule",{value:!0}),t(require("./audit-event.listener"),exports),t(require("./notification-event.listener"),exports);
@@ -0,0 +1,7 @@
1
+ import { NotificationOptions } from '../../notifications';
2
+ import { EventNotificationService } from '../services';
3
+ export declare class NotificationEventListener {
4
+ private readonly eventNotificationService;
5
+ constructor(eventNotificationService: EventNotificationService);
6
+ handleNotificationEvent(event: NotificationOptions): Promise<void>;
7
+ }
@@ -0,0 +1 @@
1
+ var e=this&&this.__decorate||function(e,t,n,i){var o,r=arguments.length,c=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(c=(r<3?o(c):r>3?o(t,n,c):o(t,n))||c);return r>3&&c&&Object.defineProperty(t,n,c),c},t=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},n=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(o,r){function fulfilled(e){try{step(i.next(e))}catch(e){r(e)}}function rejected(e){try{step(i.throw(e))}catch(e){r(e)}}function step(e){e.done?o(e.value):function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(fulfilled,rejected)}step((i=i.apply(e,t||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.NotificationEventListener=void 0;const i=require("@nestjs/common"),o=require("@nestjs/event-emitter"),r=require("../services");let c=class NotificationEventListener{constructor(e){this.eventNotificationService=e}handleNotificationEvent(e){return n(this,void 0,void 0,function*(){yield this.eventNotificationService.send(e)})}};exports.NotificationEventListener=c,e([(0,o.OnEvent)("notification.**",{async:!0}),t("design:type",Function),t("design:paramtypes",[Object]),t("design:returntype",Promise)],c.prototype,"handleNotificationEvent",null),exports.NotificationEventListener=c=e([(0,i.Injectable)(),t("design:paramtypes",[r.EventNotificationService])],c);
@@ -1,58 +1 @@
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13
- return new (P || (P = Promise))(function (resolve, reject) {
14
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
- step((generator = generator.apply(thisArg, _arguments || [])).next());
18
- });
19
- };
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.AuditEventListener = void 0;
22
- const common_1 = require("@nestjs/common");
23
- const event_emitter_1 = require("@nestjs/event-emitter");
24
- const services_1 = require("../services");
25
- let AuditEventListener = class AuditEventListener {
26
- constructor(eventStorage, eventLogger, eventNotificationService) {
27
- this.eventStorage = eventStorage;
28
- this.eventLogger = eventLogger;
29
- this.eventNotificationService = eventNotificationService;
30
- }
31
- handleAuditEvent(event) {
32
- return __awaiter(this, void 0, void 0, function* () {
33
- const { db = true, log = true } = event;
34
- if (db) {
35
- yield this.eventStorage.storeAuditEvent(event);
36
- }
37
- if (log) {
38
- yield this.eventLogger.log(event);
39
- }
40
- if (event.notification) {
41
- yield this.eventNotificationService.send(event.notification);
42
- }
43
- });
44
- }
45
- };
46
- exports.AuditEventListener = AuditEventListener;
47
- __decorate([
48
- (0, event_emitter_1.OnEvent)('audit.**', { async: true }),
49
- __metadata("design:type", Function),
50
- __metadata("design:paramtypes", [Object]),
51
- __metadata("design:returntype", Promise)
52
- ], AuditEventListener.prototype, "handleAuditEvent", null);
53
- exports.AuditEventListener = AuditEventListener = __decorate([
54
- (0, common_1.Injectable)(),
55
- __metadata("design:paramtypes", [services_1.EventStorageService,
56
- services_1.EventLoggerService,
57
- services_1.EventNotificationService])
58
- ], AuditEventListener);
1
+ var e=this&&this.__decorate||function(e,t,n,i){var o,r=arguments.length,c=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(c=(r<3?o(c):r>3?o(t,n,c):o(t,n))||c);return r>3&&c&&Object.defineProperty(t,n,c),c},t=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},n=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(o,r){function fulfilled(e){try{step(i.next(e))}catch(e){r(e)}}function rejected(e){try{step(i.throw(e))}catch(e){r(e)}}function step(e){e.done?o(e.value):function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(fulfilled,rejected)}step((i=i.apply(e,t||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.AuditEventListener=void 0;const i=require("@nestjs/common"),o=require("@nestjs/event-emitter"),r=require("../services");let c=class AuditEventListener{constructor(e,t,n){this.eventStorage=e,this.eventLogger=t,this.eventNotificationService=n}handleAuditEvent(e){return n(this,void 0,void 0,function*(){const{db:t=!0,log:n=!0}=e;t&&(yield this.eventStorage.storeAuditEvent(e)),n&&(yield this.eventLogger.log(e)),e.notification&&(yield this.eventNotificationService.send(e.notification))})}};exports.AuditEventListener=c,e([(0,o.OnEvent)("audit.**",{async:!0}),t("design:type",Function),t("design:paramtypes",[Object]),t("design:returntype",Promise)],c.prototype,"handleAuditEvent",null),exports.AuditEventListener=c=e([(0,i.Injectable)(),t("design:paramtypes",[r.EventStorageService,r.EventLoggerService,r.EventNotificationService])],c);
@@ -1,34 +1 @@
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
9
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
10
- return new (P || (P = Promise))(function (resolve, reject) {
11
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
12
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
13
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
14
- step((generator = generator.apply(thisArg, _arguments || [])).next());
15
- });
16
- };
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.EventLoggerService = void 0;
19
- const common_1 = require("@nestjs/common");
20
- let EventLoggerService = class EventLoggerService {
21
- log(event) {
22
- return __awaiter(this, void 0, void 0, function* () {
23
- console.log(event);
24
- });
25
- }
26
- logWithStructure(event, structure) {
27
- return __awaiter(this, void 0, void 0, function* () {
28
- });
29
- }
30
- };
31
- exports.EventLoggerService = EventLoggerService;
32
- exports.EventLoggerService = EventLoggerService = __decorate([
33
- (0, common_1.Injectable)()
34
- ], EventLoggerService);
1
+ var e=this&&this.__decorate||function(e,t,n,r){var o,c=arguments.length,i=c<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var u=e.length-1;u>=0;u--)(o=e[u])&&(i=(c<3?o(i):c>3?o(t,n,i):o(t,n))||i);return c>3&&i&&Object.defineProperty(t,n,i),i},t=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,c){function fulfilled(e){try{step(r.next(e))}catch(e){c(e)}}function rejected(e){try{step(r.throw(e))}catch(e){c(e)}}function step(e){e.done?o(e.value):function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.EventLoggerService=void 0;const n=require("@nestjs/common");let r=class EventLoggerService{log(e){return t(this,void 0,void 0,function*(){})}logWithStructure(e,n){return t(this,void 0,void 0,function*(){})}};exports.EventLoggerService=r,exports.EventLoggerService=r=e([(0,n.Injectable)()],r);
@@ -1,104 +1 @@
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13
- return new (P || (P = Promise))(function (resolve, reject) {
14
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
- step((generator = generator.apply(thisArg, _arguments || [])).next());
18
- });
19
- };
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.EventNotificationService = void 0;
22
- const common_1 = require("@nestjs/common");
23
- const notifications_1 = require("../../notifications");
24
- let EventNotificationService = class EventNotificationService {
25
- constructor(notificationService, notificationSendService) {
26
- this.notificationService = notificationService;
27
- this.notificationSendService = notificationSendService;
28
- }
29
- send(notification) {
30
- return __awaiter(this, void 0, void 0, function* () {
31
- console.log('notification', notification);
32
- if (notification === null || notification === void 0 ? void 0 : notification.email) {
33
- yield this.notificationService.create({
34
- type: 'email',
35
- template_key: notification.email.template_key,
36
- recipients: notification.email.recipients,
37
- variables: notification.email.variables,
38
- });
39
- const result = yield this.notificationSendService.send({
40
- type: 'email',
41
- recipients: notification.email.recipients,
42
- subject: notification.email.subject,
43
- body: notification.email.body,
44
- template_key: notification.email.template_key,
45
- variables: notification.email.variables,
46
- });
47
- console.log('📧 [EVENT-NOTIFICATION] Email 발송 결과:', result);
48
- }
49
- if (notification === null || notification === void 0 ? void 0 : notification.kakao) {
50
- yield this.notificationService.create({
51
- type: 'kakao',
52
- template_key: notification.kakao.template_key,
53
- recipients: notification.kakao.recipients,
54
- variables: notification.kakao.variables,
55
- });
56
- const result = yield this.notificationSendService.send({
57
- type: 'kakao',
58
- recipients: notification.kakao.recipients,
59
- template_key: notification.kakao.template_key,
60
- variables: notification.kakao.variables,
61
- });
62
- console.log('📱 [EVENT-NOTIFICATION] Kakao 발송 결과:', result);
63
- }
64
- if (notification === null || notification === void 0 ? void 0 : notification.sms) {
65
- yield this.notificationService.create({
66
- type: 'sms',
67
- template_key: notification.sms.template_key,
68
- recipients: notification.sms.recipients,
69
- variables: notification.sms.variables,
70
- });
71
- const result = yield this.notificationSendService.send({
72
- type: 'sms',
73
- recipients: notification.sms.recipients,
74
- message: notification.sms.message,
75
- template_key: notification.sms.template_key,
76
- variables: notification.sms.variables,
77
- });
78
- console.log('📱 [EVENT-NOTIFICATION] SMS 발송 결과:', result);
79
- }
80
- if (notification === null || notification === void 0 ? void 0 : notification.slack) {
81
- yield this.notificationService.create({
82
- type: 'slack',
83
- template_key: notification.slack.template_key,
84
- recipients: [{ user_id: 0, recipient: notification.slack.channel }],
85
- variables: notification.slack.variables,
86
- });
87
- const result = yield this.notificationSendService.send({
88
- type: 'slack',
89
- channel: notification.slack.channel,
90
- message: notification.slack.message,
91
- template_key: notification.slack.template_key,
92
- variables: notification.slack.variables,
93
- });
94
- console.log('📢 [EVENT-NOTIFICATION] Slack 발송 결과:', result);
95
- }
96
- });
97
- }
98
- };
99
- exports.EventNotificationService = EventNotificationService;
100
- exports.EventNotificationService = EventNotificationService = __decorate([
101
- (0, common_1.Injectable)(),
102
- __metadata("design:paramtypes", [notifications_1.NotificationService,
103
- notifications_1.NotificationSendService])
104
- ], EventNotificationService);
1
+ var e=this&&this.__decorate||function(e,t,i,a){var n,c=arguments.length,s=c<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(s=(c<3?n(s):c>3?n(t,i,s):n(t,i))||s);return c>3&&s&&Object.defineProperty(t,i,s),s},t=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},i=this&&this.__awaiter||function(e,t,i,a){return new(i||(i=Promise))(function(n,c){function fulfilled(e){try{step(a.next(e))}catch(e){c(e)}}function rejected(e){try{step(a.throw(e))}catch(e){c(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof i?e:new i(function(t){t(e)})}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.EventNotificationService=void 0;const a=require("@nestjs/common"),n=require("../../notifications");let c=class EventNotificationService{constructor(e,t){this.notificationService=e,this.notificationSendService=t}send(e){return i(this,void 0,void 0,function*(){if(null==e?void 0:e.web){const t=yield this.notificationSendService.send({type:"web",recipients:e.web.recipients,template_key:e.web.template_key,variables:e.web.variables,meta:e.web.meta});console.log("📧 [EVENT-NOTIFICATION] Web 발송 결과:",t)}if(null==e?void 0:e.email){yield this.notificationService.create({type:"email",template_key:e.email.template_key,recipients:e.email.recipients,variables:e.email.variables});const t=yield this.notificationSendService.send({type:"email",recipients:e.email.recipients,subject:e.email.subject,body:e.email.body,template_key:e.email.template_key,variables:e.email.variables});console.log("📧 [EVENT-NOTIFICATION] Email 발송 결과:",t)}if(null==e?void 0:e.kakao){yield this.notificationService.create({type:"kakao",template_key:e.kakao.template_key,recipients:e.kakao.recipients,variables:e.kakao.variables});const t=yield this.notificationSendService.send({type:"kakao",recipients:e.kakao.recipients,template_key:e.kakao.template_key,variables:e.kakao.variables});console.log("📱 [EVENT-NOTIFICATION] Kakao 발송 결과:",t)}if(null==e?void 0:e.sms){yield this.notificationService.create({type:"sms",template_key:e.sms.template_key,recipients:e.sms.recipients,variables:e.sms.variables});const t=yield this.notificationSendService.send({type:"sms",recipients:e.sms.recipients,content:e.sms.content,template_key:e.sms.template_key,variables:e.sms.variables});console.log("📱 [EVENT-NOTIFICATION] SMS 발송 결과:",t)}if(null==e?void 0:e.slack){yield this.notificationService.create({type:"slack",template_key:e.slack.template_key,recipients:[{user_id:0,recipient:e.slack.channel}],variables:e.slack.variables});const t=yield this.notificationSendService.send({type:"slack",channel:e.slack.channel,content:e.slack.content,template_key:e.slack.template_key,variables:e.slack.variables});console.log("📢 [EVENT-NOTIFICATION] Slack 발송 결과:",t)}})}};exports.EventNotificationService=c,exports.EventNotificationService=c=e([(0,a.Injectable)(),t("design:paramtypes",[n.NotificationService,n.NotificationSendService])],c);
@@ -1,79 +1 @@
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
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
- return new (P || (P = Promise))(function (resolve, reject) {
17
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
- step((generator = generator.apply(thisArg, _arguments || [])).next());
21
- });
22
- };
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.EventStorageService = void 0;
25
- const common_1 = require("@nestjs/common");
26
- const typeorm_1 = require("@nestjs/typeorm");
27
- const nanoid_1 = require("nanoid");
28
- const typeorm_2 = require("typeorm");
29
- const entities_1 = require("../../database/entities");
30
- let EventStorageService = class EventStorageService {
31
- constructor(eventLogRepository, auditLogRepository, dataSource) {
32
- this.eventLogRepository = eventLogRepository;
33
- this.auditLogRepository = auditLogRepository;
34
- this.dataSource = dataSource;
35
- }
36
- store(event) {
37
- return __awaiter(this, void 0, void 0, function* () {
38
- var _a, _b, _c;
39
- const eventLog = this.eventLogRepository.create({
40
- uid: event.uid || (0, nanoid_1.nanoid)(),
41
- name: event.name,
42
- user_id: ((_a = event.user) === null || _a === void 0 ? void 0 : _a.user_id) || 0,
43
- ip_address: (_b = event.user) === null || _b === void 0 ? void 0 : _b.ip_address,
44
- user_agent: (_c = event.user) === null || _c === void 0 ? void 0 : _c.user_agent,
45
- occurred_at: event.timestamp || new Date(),
46
- });
47
- yield this.eventLogRepository.save(eventLog);
48
- });
49
- }
50
- storeAuditEvent(event) {
51
- return __awaiter(this, void 0, void 0, function* () {
52
- yield this.dataSource.transaction((manager) => __awaiter(this, void 0, void 0, function* () {
53
- var _a, _b, _c;
54
- const eventLog = manager.create(entities_1.LogsAudit, {
55
- uid: event.uid || (0, nanoid_1.nanoid)(),
56
- name: event.name,
57
- user_id: ((_a = event.user) === null || _a === void 0 ? void 0 : _a.user_id) || 0,
58
- entity: event.entity,
59
- entity_id: event.entity_id,
60
- action: event.action,
61
- changes: event.changes,
62
- ip_address: (_b = event.user) === null || _b === void 0 ? void 0 : _b.ip_address,
63
- user_agent: (_c = event.user) === null || _c === void 0 ? void 0 : _c.user_agent,
64
- occurred_at: event.timestamp || new Date(),
65
- });
66
- yield manager.save(eventLog);
67
- }));
68
- });
69
- }
70
- };
71
- exports.EventStorageService = EventStorageService;
72
- exports.EventStorageService = EventStorageService = __decorate([
73
- (0, common_1.Injectable)(),
74
- __param(0, (0, typeorm_1.InjectRepository)(entities_1.LogsEvent)),
75
- __param(1, (0, typeorm_1.InjectRepository)(entities_1.LogsAudit)),
76
- __metadata("design:paramtypes", [typeorm_2.Repository,
77
- typeorm_2.Repository,
78
- typeorm_2.DataSource])
79
- ], EventStorageService);
1
+ var e=this&&this.__decorate||function(e,t,i,r){var n,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,i,s):n(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},t=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},i=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}},r=this&&this.__awaiter||function(e,t,i,r){return new(i||(i=Promise))(function(n,o){function fulfilled(e){try{step(r.next(e))}catch(e){o(e)}}function rejected(e){try{step(r.throw(e))}catch(e){o(e)}}function step(e){e.done?n(e.value):function adopt(e){return e instanceof i?e:new i(function(t){t(e)})}(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.EventStorageService=void 0;const n=require("@nestjs/common"),o=require("@nestjs/typeorm"),s=require("nanoid"),a=require("typeorm"),d=require("../../database/entities");let u=class EventStorageService{constructor(e,t,i){this.eventLogRepository=e,this.auditLogRepository=t,this.dataSource=i}store(e){return r(this,void 0,void 0,function*(){var t,i,r;const n=(null===(t=e.user)||void 0===t?void 0:t.user_id)||0,o=e.name,d=new Date,u=new Date(d.getTime()-3e4);if(yield this.eventLogRepository.findOne({where:{user_id:n,name:o,occurred_at:(0,a.MoreThanOrEqual)(u)},order:{occurred_at:"DESC"}}))return;const c=this.eventLogRepository.create({uid:e.uid||(0,s.nanoid)(),name:e.name,user_id:n,ip_address:null===(i=e.user)||void 0===i?void 0:i.ip_address,user_agent:null===(r=e.user)||void 0===r?void 0:r.user_agent,occurred_at:e.timestamp||new Date});yield this.eventLogRepository.save(c)})}storeAuditEvent(e){return r(this,void 0,void 0,function*(){yield this.dataSource.transaction(t=>r(this,void 0,void 0,function*(){var i,r,n;const o=t.create(d.LogsAudit,{uid:e.uid||(0,s.nanoid)(),name:e.name,user_id:(null===(i=e.user)||void 0===i?void 0:i.user_id)||0,target_user_id:e.target_user_id,entity:e.entity,entity_id:e.entity_id,entity_ids:e.entity_ids,action:e.action,changes:e.changes,ip_address:null===(r=e.user)||void 0===r?void 0:r.ip_address,user_agent:null===(n=e.user)||void 0===n?void 0:n.user_agent,occurred_at:e.timestamp||new Date,meta:e.meta});yield t.save(o)}))})}};exports.EventStorageService=u,exports.EventStorageService=u=e([(0,n.Injectable)(),i(0,(0,o.InjectRepository)(d.LogsEvent)),i(1,(0,o.InjectRepository)(d.LogsAudit)),t("design:paramtypes",[a.Repository,a.Repository,a.DataSource])],u);
@@ -1,20 +1 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./event-logger.service"), exports);
18
- __exportStar(require("./event-storage.service"), exports);
19
- __exportStar(require("./event-notification.service"), exports);
20
- __exportStar(require("./token.service"), exports);
1
+ var e=this&&this.__createBinding||(Object.create?function(e,r,t,i){void 0===i&&(i=t);var o=Object.getOwnPropertyDescriptor(r,t);o&&!("get"in o?!r.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,i,o)}:function(e,r,t,i){void 0===i&&(i=t),e[i]=r[t]}),r=this&&this.__exportStar||function(r,t){for(var i in r)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||e(t,r,i)};Object.defineProperty(exports,"__esModule",{value:!0}),r(require("./event-logger.service"),exports),r(require("./event-storage.service"),exports),r(require("./event-notification.service"),exports),r(require("./token.service"),exports);
@@ -1,14 +1,12 @@
1
- import { ConfigService } from '@nestjs/config';
2
1
  import { JwtService } from '@nestjs/jwt';
3
2
  import { RedisService } from '../../redis';
4
3
  export declare class TokenService {
5
4
  private readonly redis;
6
5
  private jwtService;
7
- private configService;
8
- constructor(redis: RedisService, jwtService: JwtService, configService: ConfigService);
6
+ constructor(redis: RedisService, jwtService: JwtService);
9
7
  private generateOpaqueToken;
10
8
  private storeRefreshToken;
11
- generateTokens(payload: any, user_uid: string, user_agent: string): Promise<{
9
+ generateTokens(payload: any, user_uid: string, user_agent: string, refresh_token_expiration: string): Promise<{
12
10
  access_token: string;
13
11
  refresh_token: string;
14
12
  expires_in: number;