easywork-common-lib 1.0.245 → 1.0.248

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.
@@ -0,0 +1,5 @@
1
+ export declare const LEAD_STAGE_INITIAL = "a233b765-d97b-43b8-8b6a-46727d97c844";
2
+ export declare const DRIVE_CONTACT_DOCUMENTS_PARTENT_FOLDER = "29168645-1bc0-40a1-9879-69fbbc62c04e";
3
+ export declare const DRIVE_TEMP_FOLDER = "6cc775ef-3616-4ffe-bfc9-755c453a4775";
4
+ export declare const DRIVE_CONTACT_PROFILES_IMAGES_PARTENT_FOLDER = "b88bdb51-806b-4dbf-a9f9-bcfba52be9fe";
5
+ export declare const CONTACTS_DOCUMENTS_FOLDERS: string[];
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CONTACTS_DOCUMENTS_FOLDERS = exports.DRIVE_CONTACT_PROFILES_IMAGES_PARTENT_FOLDER = exports.DRIVE_TEMP_FOLDER = exports.DRIVE_CONTACT_DOCUMENTS_PARTENT_FOLDER = exports.LEAD_STAGE_INITIAL = void 0;
4
+ exports.LEAD_STAGE_INITIAL = "a233b765-d97b-43b8-8b6a-46727d97c844";
5
+ exports.DRIVE_CONTACT_DOCUMENTS_PARTENT_FOLDER = "29168645-1bc0-40a1-9879-69fbbc62c04e";
6
+ exports.DRIVE_TEMP_FOLDER = "6cc775ef-3616-4ffe-bfc9-755c453a4775";
7
+ exports.DRIVE_CONTACT_PROFILES_IMAGES_PARTENT_FOLDER = "b88bdb51-806b-4dbf-a9f9-bcfba52be9fe";
8
+ exports.CONTACTS_DOCUMENTS_FOLDERS = [
9
+ "Cotización Generada",
10
+ "Cotización Aprobada por el contratante",
11
+ "Presentación o Propuesta Comercial",
12
+ "Anotaciones Varias - Documentos adicionales",
13
+ "Documentos o textos explicativos",
14
+ "Documentos del cliente: RFC, IFE, Comp de domicilio",
15
+ "Solicitud",
16
+ "Póliza emitida",
17
+ "Recibos y Facturas",
18
+ "Reembolsos",
19
+ "Siniestros",
20
+ "Programaciones",
21
+ "Rescate",
22
+ "Finiquito de Reclamaciones de Accidente o Enfermedad",
23
+ "Documentos Reembolso Subsecuente",
24
+ "Documentos Explicativos",
25
+ "Documentos del Reembolso Inicial",
26
+ "Documentos del Beneficiario",
27
+ "Muerte",
28
+ "Invalidez",
29
+ "Documentos (Medicamentos - Cirugías y Servicios Auxiliares)",
30
+ "Carta de Autorización",
31
+ ];
32
+ //# sourceMappingURL=app.contants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.contants.js","sourceRoot":"","sources":["../../../src/common/constants/app.contants.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG,sCAAsC,CAAC;AAC5D,QAAA,sCAAsC,GAAG,sCAAsC,CAAC;AAChF,QAAA,iBAAiB,GAAG,sCAAsC,CAAC;AAC3D,QAAA,4CAA4C,GAAG,sCAAsC,CAAC;AACtF,QAAA,0BAA0B,GAAG;IACxC,qBAAqB;IACrB,wCAAwC;IACxC,oCAAoC;IACpC,6CAA6C;IAC7C,kCAAkC;IAClC,qDAAqD;IACrD,WAAW;IACX,gBAAgB;IAChB,oBAAoB;IACpB,YAAY;IACZ,YAAY;IACZ,gBAAgB;IAChB,SAAS;IACT,sDAAsD;IACtD,kCAAkC;IAClC,yBAAyB;IACzB,kCAAkC;IAClC,6BAA6B;IAC7B,QAAQ;IACR,WAAW;IACX,6DAA6D;IAC7D,uBAAuB;CACxB,CAAC"}
@@ -1 +1,2 @@
1
1
  export * from "./regex.constant";
2
+ export * from "./app.contants";
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./regex.constant"), exports);
18
+ __exportStar(require("./app.contants"), exports);
18
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/constants/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/constants/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,iDAA+B"}
@@ -1,3 +1,3 @@
1
- export * from "./notifier/notifier.service";
2
- export * from "./notifier/scheduler.service";
3
- export * from "./notifier/notifier.module";
1
+ export * from "./queue/notifier.service";
2
+ export * from "./queue/scheduler.service";
3
+ export * from "./queue/queue.module";
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./notifier/notifier.service"), exports);
18
- __exportStar(require("./notifier/scheduler.service"), exports);
19
- __exportStar(require("./notifier/notifier.module"), exports);
17
+ __exportStar(require("./queue/notifier.service"), exports);
18
+ __exportStar(require("./queue/scheduler.service"), exports);
19
+ __exportStar(require("./queue/queue.module"), exports);
20
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA4C;AAC5C,+DAA6C;AAC7C,6DAA2C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC;AACzC,4DAA0C;AAC1C,uDAAqC"}
@@ -0,0 +1,19 @@
1
+ import { AmqpConnection } from "@golevelup/nestjs-rabbitmq";
2
+ import { SendNotificationDto } from "../../common";
3
+ import { Contact, ContactComment, Task, TaskComment } from "../../entities";
4
+ export declare class EasyNotifierService {
5
+ private readonly amqpConnection;
6
+ private readonly exchangeName;
7
+ private readonly routingKey;
8
+ constructor(amqpConnection: AmqpConnection, exchangeName: string, routingKey: string);
9
+ sendNotification(data: SendNotificationDto): Promise<void>;
10
+ notifyTaskCompletion(task: Task, recipientsId: string[]): Promise<void>;
11
+ notifyTaskOverdue(task: Task, recipientsId: string[]): Promise<void>;
12
+ notifyTaskContinue(task: Task, recipientsId: string[]): Promise<void>;
13
+ notifyNewTask(task: Task, recipientsId: string[]): Promise<void>;
14
+ notifyTaskUpdate(task: Task, recipientsId: string[], changedFields: string[]): Promise<void>;
15
+ notifyNewComment(task: Task, comment: TaskComment, recipientsId: string[]): Promise<void>;
16
+ notifyNewCommentContact(contact: Contact, comment: ContactComment, recipientsId: string[]): Promise<void>;
17
+ sendOTPPhone(code: string, recipientsId: string[]): Promise<void>;
18
+ sendOTPEmail(code: string, recipientsId: string[]): Promise<void>;
19
+ }
@@ -0,0 +1,231 @@
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.EasyNotifierService = void 0;
16
+ const nestjs_rabbitmq_1 = require("@golevelup/nestjs-rabbitmq");
17
+ const common_1 = require("@nestjs/common");
18
+ const common_2 = require("../../common");
19
+ const logger = new common_1.Logger("EasyNotifierService");
20
+ let EasyNotifierService = class EasyNotifierService {
21
+ amqpConnection;
22
+ exchangeName;
23
+ routingKey;
24
+ constructor(amqpConnection, exchangeName, routingKey) {
25
+ this.amqpConnection = amqpConnection;
26
+ this.exchangeName = exchangeName;
27
+ this.routingKey = routingKey;
28
+ }
29
+ async sendNotification(data) {
30
+ logger.debug(`Sending notification: ${JSON.stringify(data)}`);
31
+ await this.amqpConnection.publish(this.exchangeName, this.routingKey, data);
32
+ }
33
+ async notifyTaskCompletion(task, recipientsId) {
34
+ const metadata = {
35
+ taskId: task.id,
36
+ taskOwnerId: task.createdBy.id,
37
+ taskResponsibleId: task.responsible[0].id,
38
+ };
39
+ const notificationDto = {
40
+ title: "Task Completed",
41
+ content: `The task ${task.name} has been completed`,
42
+ recipientsId,
43
+ entityId: task.id,
44
+ channels: [common_2.NotificationChannel.APP],
45
+ category: common_2.NotificationCategory.TASK,
46
+ subCategory: common_2.NotificationSubcategory.TASK_COMPLETED,
47
+ metadata,
48
+ };
49
+ await this.sendNotification(notificationDto);
50
+ }
51
+ async notifyTaskOverdue(task, recipientsId) {
52
+ const metadata = {
53
+ taskId: task.id,
54
+ taskOwnerId: task.createdBy.id,
55
+ taskResponsibleId: task.responsible[0].id,
56
+ };
57
+ const notificationDto = {
58
+ title: "Task Overdue",
59
+ content: `La tarea [#${task.number}] - ${task.name} está atrasada`,
60
+ recipientsId,
61
+ entityId: task.id,
62
+ channels: [common_2.NotificationChannel.APP, common_2.NotificationChannel.SMS, common_2.NotificationChannel.PUSH],
63
+ category: common_2.NotificationCategory.TASK,
64
+ subCategory: common_2.NotificationSubcategory.TASK_OVERDUE,
65
+ metadata,
66
+ };
67
+ await this.sendNotification(notificationDto);
68
+ }
69
+ async notifyTaskContinue(task, recipientsId) {
70
+ const metadata = {
71
+ taskId: task.id,
72
+ taskOwnerId: task.createdBy.id,
73
+ taskResponsibleId: task.responsible[0].id,
74
+ };
75
+ const notificationDto = {
76
+ title: "Task Continue",
77
+ content: `La tarea #${task.number} - ${task.name}, ha sido reanudada`,
78
+ recipientsId,
79
+ entityId: task.id,
80
+ channels: [common_2.NotificationChannel.APP],
81
+ category: common_2.NotificationCategory.TASK,
82
+ subCategory: common_2.NotificationSubcategory.TASK_UPDATED,
83
+ metadata,
84
+ };
85
+ await this.sendNotification(notificationDto);
86
+ }
87
+ async notifyNewTask(task, recipientsId) {
88
+ const fechaLimite = task.deadline ? `<br/>Fecha Limite:${new Date(task.deadline)}` : ``;
89
+ const observadores = task.observers.length > 0 ? `<br/>Observadores: ${task.observers.map(observer => observer.username).join(", ")}` : ``;
90
+ const responsible = task.responsible.length > 0 ? `<br/>Persona Responsable: ${task.responsible.map(responsible => responsible.username).join(", ")}` : ``;
91
+ const participants = task.participants.length > 0 ? `<br/>Participantes: ${task.participants.map(participant => participant.username).join(", ")}` : ``;
92
+ const content = `Nueva Tarea agregada: <a href="/tools/tasks/task/${task.id}?show=true" style="color:blue">[${task.name}]</a>${responsible}${observadores}${participants}${fechaLimite}`;
93
+ const metadata = {
94
+ taskId: task.id,
95
+ taskOwnerId: task.createdBy.id,
96
+ taskResponsibleId: task.responsible[0].id,
97
+ };
98
+ const notificationDto = {
99
+ title: "New Task",
100
+ content,
101
+ recipientsId,
102
+ entityId: task.id,
103
+ channels: [common_2.NotificationChannel.APP, common_2.NotificationChannel.SMS, common_2.NotificationChannel.PUSH],
104
+ category: common_2.NotificationCategory.TASK,
105
+ subCategory: common_2.NotificationSubcategory.NEW_TASK,
106
+ metadata,
107
+ };
108
+ await this.sendNotification(notificationDto);
109
+ }
110
+ async notifyTaskUpdate(task, recipientsId, changedFields) {
111
+ const metadata = {
112
+ taskId: task.id,
113
+ taskOwnerId: task.createdBy.id,
114
+ taskResponsibleId: task.responsible[0].id,
115
+ };
116
+ const createNotificationDto = (content, recipients) => ({
117
+ title: "Task Update",
118
+ content,
119
+ recipientsId: recipients,
120
+ entityId: task.id,
121
+ channels: [common_2.NotificationChannel.APP, common_2.NotificationChannel.SMS, common_2.NotificationChannel.PUSH],
122
+ category: common_2.NotificationCategory.TASK,
123
+ subCategory: common_2.NotificationSubcategory.TASK_UPDATED,
124
+ metadata,
125
+ });
126
+ const taskLink = `<a href="/tools/tasks/task/${task.id}?show=true" style="color:blue">[${task.name}]</a>`;
127
+ let content = `Tarea #${task.number} - ${taskLink}`;
128
+ if (changedFields.length === 0) {
129
+ content += " - ha sido actualizada";
130
+ await this.sendNotification(createNotificationDto(content, recipientsId));
131
+ return;
132
+ }
133
+ content += " - se actualizó:";
134
+ if (changedFields.includes("deadline")) {
135
+ if (task.deadline) {
136
+ const deadLine = new Date(task.deadline);
137
+ content += `<br/>Fecha Limite cambiada: ${deadLine.getDate()}/${deadLine.getMonth() + 1}/${deadLine.getFullYear()}`;
138
+ }
139
+ else {
140
+ content += `<br/>Fecha Limite cambiada: Ninguna`;
141
+ }
142
+ }
143
+ if (changedFields.includes("responsible")) {
144
+ content = `Se le asignó la tarea #${task.number} - ${taskLink}`;
145
+ await this.sendNotification(createNotificationDto(content, [task.responsible[0].id]));
146
+ }
147
+ else {
148
+ if (changedFields.includes("name"))
149
+ content += `<br/>Nombre: ${task.name}`;
150
+ if (changedFields.includes("description"))
151
+ content += `<br/>Descripción: ${task.description}`;
152
+ if (changedFields.includes("status"))
153
+ content += `<br/>Estado: ${task.status}`;
154
+ await this.sendNotification(createNotificationDto(content, recipientsId));
155
+ }
156
+ }
157
+ async notifyNewComment(task, comment, recipientsId) {
158
+ const commentText = comment.comment.slice(0, 20);
159
+ const content = `${comment.createdBy.name} comentó en la tarea: <a href="/tools/tasks/task/${task.id}?show=true" style="color:#170f6b">[${task.name}]</a>. Texto del comentario: ${commentText}`;
160
+ const metadata = {
161
+ taskId: task.id,
162
+ commentId: comment.id,
163
+ taskOwnerId: task.createdBy.id,
164
+ commentOwnerId: comment.createdBy.id,
165
+ taskResponsibleId: task.responsible[0].id,
166
+ };
167
+ const notificationDto = {
168
+ title: "New Comment",
169
+ content,
170
+ recipientsId,
171
+ entityId: task.id,
172
+ channels: [common_2.NotificationChannel.APP, common_2.NotificationChannel.SMS, common_2.NotificationChannel.PUSH],
173
+ category: common_2.NotificationCategory.TASK,
174
+ subCategory: common_2.NotificationSubcategory.TASK_NEW_COMMNET,
175
+ metadata,
176
+ };
177
+ await this.sendNotification(notificationDto);
178
+ }
179
+ async notifyNewCommentContact(contact, comment, recipientsId) {
180
+ const commentText = comment.comment.slice(0, 20);
181
+ const content = `${comment.createdBy.name} comentó en el contacto: <a href="/sales/contacts/contact/${contact.id}?show=true" style="color:#170f6b">[${contact.name}]</a>. Texto del comentario: ${commentText}`;
182
+ const metadata = {
183
+ contactId: contact.id,
184
+ commentId: comment.id,
185
+ contactOwnerId: contact.createdBy?.id,
186
+ commentOwnerId: comment.createdBy?.id,
187
+ contactAssignedId: contact?.assignedBy?.id,
188
+ };
189
+ const notificationDto = {
190
+ title: "New Comment",
191
+ content,
192
+ recipientsId,
193
+ entityId: contact.id,
194
+ channels: [common_2.NotificationChannel.APP, common_2.NotificationChannel.SMS, common_2.NotificationChannel.PUSH],
195
+ category: common_2.NotificationCategory.CRM,
196
+ subCategory: common_2.NotificationSubcategory.CONTACT_NEW_COMMENT,
197
+ metadata,
198
+ };
199
+ await this.sendNotification(notificationDto);
200
+ }
201
+ async sendOTPPhone(code, recipientsId) {
202
+ const notificationDto = {
203
+ title: "OTP Code",
204
+ content: `Easywork: Your OTP code is ${code}`,
205
+ recipientsId,
206
+ channels: [common_2.NotificationChannel.SMS],
207
+ category: common_2.NotificationCategory.OTP,
208
+ subCategory: common_2.NotificationSubcategory.OTP,
209
+ };
210
+ await this.sendNotification(notificationDto);
211
+ }
212
+ async sendOTPEmail(code, recipientsId) {
213
+ const notificationDto = {
214
+ title: "OTP Code",
215
+ content: code,
216
+ recipientsId,
217
+ channels: [common_2.NotificationChannel.EMAIL],
218
+ category: common_2.NotificationCategory.OTP,
219
+ subCategory: common_2.NotificationSubcategory.OTP,
220
+ };
221
+ await this.sendNotification(notificationDto);
222
+ }
223
+ };
224
+ exports.EasyNotifierService = EasyNotifierService;
225
+ exports.EasyNotifierService = EasyNotifierService = __decorate([
226
+ (0, common_1.Injectable)(),
227
+ __param(1, (0, common_1.Inject)('EXCHANGE_NAME')),
228
+ __param(2, (0, common_1.Inject)('NOTIFIER_ROUTING_KEY')),
229
+ __metadata("design:paramtypes", [nestjs_rabbitmq_1.AmqpConnection, String, String])
230
+ ], EasyNotifierService);
231
+ //# sourceMappingURL=notifier.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notifier.service.js","sourceRoot":"","sources":["../../../src/modules/queue/notifier.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gEAA4D;AAC5D,2CAA4D;AAC5D,yCAAuH;AAGvH,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,qBAAqB,CAAC,CAAC;AAG1C,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAEP;IACyB;IACO;IAHrD,YACqB,cAA8B,EACL,YAAoB,EACb,UAAkB;QAFlD,mBAAc,GAAd,cAAc,CAAgB;QACL,iBAAY,GAAZ,YAAY,CAAQ;QACb,eAAU,GAAV,UAAU,CAAQ;IACpE,CAAC;IAEJ,KAAK,CAAC,gBAAgB,CAAC,IAAyB;QAC5C,MAAM,CAAC,KAAK,CAAC,yBAAyB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC9D,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAChF,CAAC;IAED,KAAK,CAAC,oBAAoB,CAAC,IAAU,EAAE,YAAsB;QACzD,MAAM,QAAQ,GAAG;YACb,MAAM,EAAE,IAAI,CAAC,EAAE;YACf,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE;YAC9B,iBAAiB,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE;SAC5C,CAAC;QACF,MAA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,CAAC,CAAC;IACjD,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,IAAY,EAAE,YAAsB;QACnD,MAAM,eAAe,GAAwB;YACzC,KAAK,EAAE,UAAU;YACjB,OAAO,EAAE,8BAA8B,IAAI,EAAE;YAC7C,YAAY;YACZ,QAAQ,EAAE,CAAC,4BAAmB,CAAC,GAAG,CAAC;YACnC,QAAQ,EAAE,6BAAoB,CAAC,GAAG;YAClC,WAAW,EAAE,gCAAuB,CAAC,GAAG;SAC3C,CAAC;QAEF,MAAM,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;IACjD,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,IAAY,EAAE,YAAsB;QACnD,MAAM,eAAe,GAAwB;YACzC,KAAK,EAAE,UAAU;YACjB,OAAO,EAAE,IAAI;YACb,YAAY;YACZ,QAAQ,EAAE,CAAC,4BAAmB,CAAC,KAAK,CAAC;YACrC,QAAQ,EAAE,6BAAoB,CAAC,GAAG;YAClC,WAAW,EAAE,gCAAuB,CAAC,GAAG;SAC3C,CAAC;QAEF,MAAM,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;IACjD,CAAC;CACJ,CAAA;AAzOY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;IAIJ,WAAA,IAAA,eAAM,EAAC,eAAe,CAAC,CAAA;IACvB,WAAA,IAAA,eAAM,EAAC,sBAAsB,CAAC,CAAA;qCAFE,gCAAc;GAF1C,mBAAmB,CAyO/B"}
@@ -0,0 +1,4 @@
1
+ import { DynamicModule } from '@nestjs/common';
2
+ export declare class EasyQueueModule {
3
+ static register(exchangeName: string, rabbitMQUri: string, notificationRoutingKey: string, schedulerRoutingKey: string): DynamicModule;
4
+ }
@@ -0,0 +1,55 @@
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 EasyQueueModule_1;
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.EasyQueueModule = void 0;
11
+ const common_1 = require("@nestjs/common");
12
+ const notifier_service_1 = require("./notifier.service");
13
+ const nestjs_rabbitmq_1 = require("@golevelup/nestjs-rabbitmq");
14
+ const scheduler_service_1 = require("./scheduler.service");
15
+ let EasyQueueModule = EasyQueueModule_1 = class EasyQueueModule {
16
+ static register(exchangeName, rabbitMQUri, notificationRoutingKey, schedulerRoutingKey) {
17
+ return {
18
+ module: EasyQueueModule_1,
19
+ imports: [
20
+ nestjs_rabbitmq_1.RabbitMQModule.forRoot(nestjs_rabbitmq_1.RabbitMQModule, {
21
+ exchanges: [
22
+ {
23
+ name: exchangeName,
24
+ type: 'topic',
25
+ },
26
+ ],
27
+ uri: rabbitMQUri,
28
+ }),
29
+ ],
30
+ providers: [
31
+ {
32
+ provide: 'EXCHANGE_NAME',
33
+ useValue: exchangeName,
34
+ },
35
+ {
36
+ provide: 'NOTIFIER_ROUTING_KEY',
37
+ useValue: notificationRoutingKey,
38
+ },
39
+ {
40
+ provide: 'SCHEDULER_ROUTING_KEY',
41
+ useValue: schedulerRoutingKey,
42
+ },
43
+ notifier_service_1.EasyNotifierService,
44
+ scheduler_service_1.EasySchedulerService,
45
+ ],
46
+ exports: [notifier_service_1.EasyNotifierService, scheduler_service_1.EasySchedulerService],
47
+ };
48
+ }
49
+ };
50
+ exports.EasyQueueModule = EasyQueueModule;
51
+ exports.EasyQueueModule = EasyQueueModule = EasyQueueModule_1 = __decorate([
52
+ (0, common_1.Global)(),
53
+ (0, common_1.Module)({})
54
+ ], EasyQueueModule);
55
+ //# sourceMappingURL=queue.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.module.js","sourceRoot":"","sources":["../../../src/modules/queue/queue.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAA+D;AAC/D,yDAAyD;AACzD,gEAA4D;AAC5D,2DAA2D;AAIpD,IAAM,eAAe,uBAArB,MAAM,eAAe;IAC1B,MAAM,CAAC,QAAQ,CAAC,YAAoB,EAAE,WAAmB,EAAE,sBAA8B,EAAE,mBAA2B;QACpH,OAAO;YACL,MAAM,EAAE,iBAAe;YACvB,OAAO,EAAE;gBACP,gCAAc,CAAC,OAAO,CAAC,gCAAc,EAAE;oBACrC,SAAS,EAAE;wBACT;4BACE,IAAI,EAAE,YAAY;4BAClB,IAAI,EAAE,OAAO;yBACd;qBACF;oBACD,GAAG,EAAE,WAAW;iBACjB,CAAC;aACH;YACD,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,eAAe;oBACxB,QAAQ,EAAE,YAAY;iBACvB;gBACD;oBACE,OAAO,EAAE,sBAAsB;oBAC/B,QAAQ,EAAE,sBAAsB;iBACjC;gBACD;oBACE,OAAO,EAAE,uBAAuB;oBAChC,QAAQ,EAAE,mBAAmB;iBAC9B;gBACD,sCAAmB;gBACnB,wCAAoB;aACrB;YACD,OAAO,EAAE,CAAC,sCAAmB,EAAE,wCAAoB,CAAC;SACrD,CAAC;IACJ,CAAC;CACF,CAAA;AAlCY,0CAAe;0BAAf,eAAe;IAF3B,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,eAAe,CAkC3B"}
@@ -0,0 +1,9 @@
1
+ import { AmqpConnection } from "@golevelup/nestjs-rabbitmq";
2
+ import { Task } from "../../entities";
3
+ export declare class EasySchedulerService {
4
+ private readonly amqpConnection;
5
+ private readonly exchangeName;
6
+ private readonly routingKey;
7
+ constructor(amqpConnection: AmqpConnection, exchangeName: string, routingKey: string);
8
+ scheduleTaskAlerts(task: Task): Promise<void>;
9
+ }
@@ -0,0 +1,40 @@
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.EasySchedulerService = void 0;
16
+ const nestjs_rabbitmq_1 = require("@golevelup/nestjs-rabbitmq");
17
+ const common_1 = require("@nestjs/common");
18
+ const logger = new common_1.Logger("EasySchedulerService");
19
+ let EasySchedulerService = class EasySchedulerService {
20
+ amqpConnection;
21
+ exchangeName;
22
+ routingKey;
23
+ constructor(amqpConnection, exchangeName, routingKey) {
24
+ this.amqpConnection = amqpConnection;
25
+ this.exchangeName = exchangeName;
26
+ this.routingKey = routingKey;
27
+ }
28
+ async scheduleTaskAlerts(task) {
29
+ logger.debug(`Add Task schedule Service...`);
30
+ await this.amqpConnection.publish(this.exchangeName, this.routingKey, task);
31
+ }
32
+ };
33
+ exports.EasySchedulerService = EasySchedulerService;
34
+ exports.EasySchedulerService = EasySchedulerService = __decorate([
35
+ (0, common_1.Injectable)(),
36
+ __param(1, (0, common_1.Inject)('EXCHANGE_NAME')),
37
+ __param(2, (0, common_1.Inject)('SCHEDULER_ROUTING_KEY')),
38
+ __metadata("design:paramtypes", [nestjs_rabbitmq_1.AmqpConnection, String, String])
39
+ ], EasySchedulerService);
40
+ //# sourceMappingURL=scheduler.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scheduler.service.js","sourceRoot":"","sources":["../../../src/modules/queue/scheduler.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gEAA4D;AAC5D,2CAA4D;AAG5D,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,sBAAsB,CAAC,CAAC;AAG3C,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAER;IACyB;IACQ;IAHtD,YACqB,cAA8B,EACL,YAAoB,EACZ,UAAkB;QAFnD,mBAAc,GAAd,cAAc,CAAgB;QACL,iBAAY,GAAZ,YAAY,CAAQ;QACZ,eAAU,GAAV,UAAU,CAAQ;IACpE,CAAC;IAEL,KAAK,CAAC,kBAAkB,CAAC,IAAU;QACjC,MAAM,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAC7C,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAC9E,CAAC;CAEJ,CAAA;AAZY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,GAAE;IAIJ,WAAA,IAAA,eAAM,EAAC,eAAe,CAAC,CAAA;IACvB,WAAA,IAAA,eAAM,EAAC,uBAAuB,CAAC,CAAA;qCAFC,gCAAc;GAF1C,oBAAoB,CAYhC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easywork-common-lib",
3
- "version": "1.0.245",
3
+ "version": "1.0.248",
4
4
  "description": "Librería común de Easywork",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {