easywork-common-lib 1.0.1368 → 1.0.1369

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 (29) hide show
  1. package/dist/entities/thirdparty/wati/index.d.ts +7 -0
  2. package/dist/entities/thirdparty/wati/index.js +24 -0
  3. package/dist/entities/thirdparty/wati/index.js.map +1 -0
  4. package/dist/entities/thirdparty/wati/wati-chat.entity.d.ts +27 -0
  5. package/dist/entities/thirdparty/wati/wati-chat.entity.js +207 -0
  6. package/dist/entities/thirdparty/wati/wati-chat.entity.js.map +1 -0
  7. package/dist/entities/thirdparty/wati/wati-configuration.entity.d.ts +22 -0
  8. package/dist/entities/thirdparty/wati/wati-configuration.entity.js +149 -0
  9. package/dist/entities/thirdparty/wati/wati-configuration.entity.js.map +1 -0
  10. package/dist/entities/thirdparty/wati/wati-events.entity.d.ts +9 -0
  11. package/dist/entities/thirdparty/wati/wati-events.entity.js +63 -0
  12. package/dist/entities/thirdparty/wati/wati-events.entity.js.map +1 -0
  13. package/dist/entities/thirdparty/wati/wati-message.entity.d.ts +30 -0
  14. package/dist/entities/thirdparty/wati/wati-message.entity.js +280 -0
  15. package/dist/entities/thirdparty/wati/wati-message.entity.js.map +1 -0
  16. package/dist/entities/thirdparty/wati/wati-user-access-log.entity.d.ts +71 -0
  17. package/dist/entities/thirdparty/wati/wati-user-access-log.entity.js +216 -0
  18. package/dist/entities/thirdparty/wati/wati-user-access-log.entity.js.map +1 -0
  19. package/dist/entities/thirdparty/wati/wati-user-access.entity.d.ts +31 -0
  20. package/dist/entities/thirdparty/wati/wati-user-access.entity.js +193 -0
  21. package/dist/entities/thirdparty/wati/wati-user-access.entity.js.map +1 -0
  22. package/dist/entities/thirdparty/wati/wati.enum.d.ts +69 -0
  23. package/dist/entities/thirdparty/wati/wati.enum.js +83 -0
  24. package/dist/entities/thirdparty/wati/wati.enum.js.map +1 -0
  25. package/dist/grpc/drive/drive.proto +339 -339
  26. package/dist/grpc/drive/leads.proto +114 -114
  27. package/dist/modules/authorization/authorization.module.d.ts +2 -2
  28. package/dist/modules/authorization/services/resource-access-filter.service.js +21 -21
  29. package/package.json +55 -55
@@ -0,0 +1,280 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.WatiMessage = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const swagger_1 = require("@nestjs/swagger");
15
+ const class_validator_1 = require("class-validator");
16
+ const wati_chat_entity_1 = require("./wati-chat.entity");
17
+ const user_entity_1 = require("../../user.entity");
18
+ const wati_enum_1 = require("./wati.enum");
19
+ const common_1 = require("../../../common");
20
+ let WatiMessage = class WatiMessage extends common_1.BaseEntitySimple {
21
+ watiChatId;
22
+ watiChat;
23
+ watiMessageId;
24
+ watiTicketId;
25
+ whatsappMessageId;
26
+ watiConversationId;
27
+ watiTemplateId;
28
+ waId;
29
+ senderName;
30
+ content;
31
+ messageType;
32
+ direction;
33
+ channelMessageTimestamp;
34
+ watiTimestamp;
35
+ watiEventType;
36
+ watiMessageTemplateName;
37
+ templateParametersUsed;
38
+ messageData;
39
+ sourceType;
40
+ status;
41
+ deliveredAt;
42
+ readAt;
43
+ sentByCrmUserId;
44
+ sentByCrmUser;
45
+ };
46
+ exports.WatiMessage = WatiMessage;
47
+ __decorate([
48
+ (0, swagger_1.ApiProperty)({ description: "ID del WatiChat al que pertenece este mensaje" }),
49
+ (0, class_validator_1.IsString)(),
50
+ (0, typeorm_1.Index)(),
51
+ (0, typeorm_1.Column)({ type: "uuid" }),
52
+ __metadata("design:type", String)
53
+ ], WatiMessage.prototype, "watiChatId", void 0);
54
+ __decorate([
55
+ (0, typeorm_1.ManyToOne)(() => wati_chat_entity_1.WatiChat, (chat) => chat.messages, { onDelete: "CASCADE" }),
56
+ (0, typeorm_1.JoinColumn)({ name: "watiChatId" }),
57
+ __metadata("design:type", wati_chat_entity_1.WatiChat)
58
+ ], WatiMessage.prototype, "watiChat", void 0);
59
+ __decorate([
60
+ (0, swagger_1.ApiProperty)({
61
+ description: "ID único del mensaje proporcionado por Wati (puede ser el mismo que whatsappMessageId)",
62
+ required: false,
63
+ }),
64
+ (0, class_validator_1.IsString)(),
65
+ (0, class_validator_1.IsOptional)(),
66
+ (0, class_validator_1.MaxLength)(255),
67
+ (0, typeorm_1.Index)(),
68
+ (0, typeorm_1.Column)({ type: "varchar", length: 255, nullable: true }),
69
+ __metadata("design:type", String)
70
+ ], WatiMessage.prototype, "watiMessageId", void 0);
71
+ __decorate([
72
+ (0, swagger_1.ApiProperty)({
73
+ description: "ID del ticket en Wati, si aplica",
74
+ required: false,
75
+ }),
76
+ (0, class_validator_1.IsString)(),
77
+ (0, class_validator_1.IsOptional)(),
78
+ (0, class_validator_1.MaxLength)(100),
79
+ (0, typeorm_1.Column)({ type: "varchar", length: 100, nullable: true }),
80
+ __metadata("design:type", String)
81
+ ], WatiMessage.prototype, "watiTicketId", void 0);
82
+ __decorate([
83
+ (0, swagger_1.ApiProperty)({
84
+ description: "ID único del mensaje proporcionado por WhatsApp (WA_MSG_ID)",
85
+ required: false,
86
+ }),
87
+ (0, class_validator_1.IsString)(),
88
+ (0, class_validator_1.IsOptional)(),
89
+ (0, class_validator_1.MaxLength)(255),
90
+ (0, typeorm_1.Index)(),
91
+ (0, typeorm_1.Column)({ type: "varchar", length: 255, nullable: true }),
92
+ __metadata("design:type", String)
93
+ ], WatiMessage.prototype, "whatsappMessageId", void 0);
94
+ __decorate([
95
+ (0, swagger_1.ApiProperty)({
96
+ description: "ID de la conversación en Wati",
97
+ required: false,
98
+ }),
99
+ (0, class_validator_1.IsString)(),
100
+ (0, class_validator_1.IsOptional)(),
101
+ (0, class_validator_1.MaxLength)(255),
102
+ (0, typeorm_1.Column)({ type: "varchar", length: 255, nullable: true }),
103
+ __metadata("design:type", String)
104
+ ], WatiMessage.prototype, "watiConversationId", void 0);
105
+ __decorate([
106
+ (0, swagger_1.ApiProperty)({
107
+ description: "ID de la plantilla de Wati utilizada, si aplica",
108
+ required: false,
109
+ }),
110
+ (0, class_validator_1.IsString)(),
111
+ (0, class_validator_1.IsOptional)(),
112
+ (0, class_validator_1.MaxLength)(255),
113
+ (0, typeorm_1.Column)({ type: "varchar", length: 255, nullable: true }),
114
+ __metadata("design:type", String)
115
+ ], WatiMessage.prototype, "watiTemplateId", void 0);
116
+ __decorate([
117
+ (0, swagger_1.ApiProperty)({
118
+ description: "WhatsApp ID del remitente",
119
+ required: false,
120
+ }),
121
+ (0, class_validator_1.IsString)(),
122
+ (0, class_validator_1.IsOptional)(),
123
+ (0, class_validator_1.MaxLength)(50),
124
+ (0, typeorm_1.Column)({ type: "varchar", length: 50, nullable: true }),
125
+ __metadata("design:type", String)
126
+ ], WatiMessage.prototype, "waId", void 0);
127
+ __decorate([
128
+ (0, swagger_1.ApiProperty)({
129
+ description: "Nombre del remitente tal como aparece en Wati",
130
+ required: false,
131
+ }),
132
+ (0, class_validator_1.IsString)(),
133
+ (0, class_validator_1.IsOptional)(),
134
+ (0, class_validator_1.MaxLength)(255),
135
+ (0, typeorm_1.Column)({ type: "varchar", length: 255, nullable: true }),
136
+ __metadata("design:type", String)
137
+ ], WatiMessage.prototype, "senderName", void 0);
138
+ __decorate([
139
+ (0, swagger_1.ApiProperty)({
140
+ description: "Contenido del mensaje (texto, URL de media para tipos no textuales)",
141
+ }),
142
+ (0, class_validator_1.IsString)(),
143
+ (0, typeorm_1.Column)({ type: "text" }),
144
+ __metadata("design:type", String)
145
+ ], WatiMessage.prototype, "content", void 0);
146
+ __decorate([
147
+ (0, swagger_1.ApiProperty)({ enum: wati_enum_1.WatiMessageType, description: "Tipo de mensaje" }),
148
+ (0, class_validator_1.IsEnum)(wati_enum_1.WatiMessageType),
149
+ (0, typeorm_1.Column)({ type: "enum", enum: wati_enum_1.WatiMessageType }),
150
+ __metadata("design:type", String)
151
+ ], WatiMessage.prototype, "messageType", void 0);
152
+ __decorate([
153
+ (0, swagger_1.ApiProperty)({
154
+ enum: wati_enum_1.WatiMessageDirection,
155
+ description: "Dirección del mensaje",
156
+ }),
157
+ (0, class_validator_1.IsEnum)(wati_enum_1.WatiMessageDirection),
158
+ (0, typeorm_1.Column)({ type: "enum", enum: wati_enum_1.WatiMessageDirection }),
159
+ __metadata("design:type", String)
160
+ ], WatiMessage.prototype, "direction", void 0);
161
+ __decorate([
162
+ (0, swagger_1.ApiProperty)({
163
+ description: "Timestamp original del mensaje en WhatsApp/Wati (del webhook)",
164
+ }),
165
+ (0, class_validator_1.IsDate)(),
166
+ (0, typeorm_1.Column)({ type: "timestamp with time zone" }),
167
+ __metadata("design:type", Date)
168
+ ], WatiMessage.prototype, "channelMessageTimestamp", void 0);
169
+ __decorate([
170
+ (0, swagger_1.ApiProperty)({
171
+ description: "Timestamp del mensaje en Wati (timestamp numérico)",
172
+ required: false,
173
+ }),
174
+ (0, class_validator_1.IsNumber)(),
175
+ (0, class_validator_1.IsOptional)(),
176
+ (0, typeorm_1.Column)({ type: "bigint", nullable: true }),
177
+ __metadata("design:type", Number)
178
+ ], WatiMessage.prototype, "watiTimestamp", void 0);
179
+ __decorate([
180
+ (0, swagger_1.ApiProperty)({
181
+ enum: wati_enum_1.WatiEventType,
182
+ description: "Tipo de evento de Wati que generó/actualizó este mensaje",
183
+ required: false,
184
+ }),
185
+ (0, class_validator_1.IsEnum)(wati_enum_1.WatiEventType),
186
+ (0, class_validator_1.IsOptional)(),
187
+ (0, typeorm_1.Column)({ type: "enum", enum: wati_enum_1.WatiEventType, nullable: true }),
188
+ __metadata("design:type", String)
189
+ ], WatiMessage.prototype, "watiEventType", void 0);
190
+ __decorate([
191
+ (0, swagger_1.ApiProperty)({
192
+ description: "Nombre de la plantilla de Wati usada, si aplica",
193
+ required: false,
194
+ }),
195
+ (0, class_validator_1.IsString)(),
196
+ (0, class_validator_1.IsOptional)(),
197
+ (0, class_validator_1.MaxLength)(255),
198
+ (0, typeorm_1.Column)({ type: "varchar", length: 255, nullable: true }),
199
+ __metadata("design:type", String)
200
+ ], WatiMessage.prototype, "watiMessageTemplateName", void 0);
201
+ __decorate([
202
+ (0, swagger_1.ApiProperty)({
203
+ description: "Parámetros JSON usados en la plantilla de mensaje, si aplica",
204
+ type: "object",
205
+ required: false,
206
+ }),
207
+ (0, class_validator_1.IsJSON)(),
208
+ (0, class_validator_1.IsOptional)(),
209
+ (0, typeorm_1.Column)({ type: "jsonb", nullable: true }),
210
+ __metadata("design:type", Object)
211
+ ], WatiMessage.prototype, "templateParametersUsed", void 0);
212
+ __decorate([
213
+ (0, swagger_1.ApiProperty)({
214
+ description: "Datos multimedia del mensaje, si aplica",
215
+ type: "object",
216
+ required: false,
217
+ }),
218
+ (0, class_validator_1.IsJSON)(),
219
+ (0, class_validator_1.IsOptional)(),
220
+ (0, typeorm_1.Column)({ type: "jsonb", nullable: true }),
221
+ __metadata("design:type", Object)
222
+ ], WatiMessage.prototype, "messageData", void 0);
223
+ __decorate([
224
+ (0, swagger_1.ApiProperty)({
225
+ description: "Tipo de fuente del mensaje (API, session, template, etc.)",
226
+ required: false,
227
+ }),
228
+ (0, class_validator_1.IsString)(),
229
+ (0, class_validator_1.IsOptional)(),
230
+ (0, class_validator_1.MaxLength)(50),
231
+ (0, typeorm_1.Column)({ type: "varchar", length: 50, nullable: true }),
232
+ __metadata("design:type", String)
233
+ ], WatiMessage.prototype, "sourceType", void 0);
234
+ __decorate([
235
+ (0, swagger_1.ApiProperty)({ enum: wati_enum_1.WatiMessageStatus, description: "Estado del mensaje" }),
236
+ (0, class_validator_1.IsEnum)(wati_enum_1.WatiMessageStatus),
237
+ (0, typeorm_1.Index)(),
238
+ (0, typeorm_1.Column)({ type: "enum", enum: wati_enum_1.WatiMessageStatus }),
239
+ __metadata("design:type", String)
240
+ ], WatiMessage.prototype, "status", void 0);
241
+ __decorate([
242
+ (0, swagger_1.ApiProperty)({
243
+ description: "Fecha cuando el mensaje fue entregado",
244
+ required: false,
245
+ }),
246
+ (0, class_validator_1.IsDate)(),
247
+ (0, class_validator_1.IsOptional)(),
248
+ (0, typeorm_1.Column)({ type: "timestamp with time zone", nullable: true }),
249
+ __metadata("design:type", Date)
250
+ ], WatiMessage.prototype, "deliveredAt", void 0);
251
+ __decorate([
252
+ (0, swagger_1.ApiProperty)({
253
+ description: "Fecha cuando el mensaje fue leído",
254
+ required: false,
255
+ }),
256
+ (0, class_validator_1.IsDate)(),
257
+ (0, class_validator_1.IsOptional)(),
258
+ (0, typeorm_1.Column)({ type: "timestamp with time zone", nullable: true }),
259
+ __metadata("design:type", Date)
260
+ ], WatiMessage.prototype, "readAt", void 0);
261
+ __decorate([
262
+ (0, swagger_1.ApiProperty)({
263
+ description: "ID del User del CRM que envió el mensaje (si es outbound)",
264
+ required: false,
265
+ }),
266
+ (0, class_validator_1.IsString)(),
267
+ (0, class_validator_1.IsOptional)(),
268
+ (0, typeorm_1.Index)(),
269
+ (0, typeorm_1.Column)({ type: "uuid", nullable: true }),
270
+ __metadata("design:type", String)
271
+ ], WatiMessage.prototype, "sentByCrmUserId", void 0);
272
+ __decorate([
273
+ (0, typeorm_1.ManyToOne)(() => user_entity_1.User, { onDelete: "SET NULL", nullable: true }),
274
+ (0, typeorm_1.JoinColumn)({ name: "sentByCrmUserId" }),
275
+ __metadata("design:type", user_entity_1.User)
276
+ ], WatiMessage.prototype, "sentByCrmUser", void 0);
277
+ exports.WatiMessage = WatiMessage = __decorate([
278
+ (0, typeorm_1.Entity)("wati_messages")
279
+ ], WatiMessage);
280
+ //# sourceMappingURL=wati-message.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wati-message.entity.js","sourceRoot":"","sources":["../../../../src/entities/thirdparty/wati/wati-message.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAuE;AACvE,6CAA8C;AAC9C,qDAAoG;AACpG,yDAA8C;AAC9C,mDAAyC;AACzC,2CAAsG;AACtG,4CAAmD;AAG5C,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,yBAAgB;IAK/C,UAAU,CAAS;IAInB,QAAQ,CAAW;IAWnB,aAAa,CAAU;IAUvB,YAAY,CAAU;IAWtB,iBAAiB,CAAU;IAU3B,kBAAkB,CAAU;IAU5B,cAAc,CAAU;IAUxB,IAAI,CAAU;IAUd,UAAU,CAAU;IAOpB,OAAO,CAAS;IAKhB,WAAW,CAAkB;IAQ7B,SAAS,CAAuB;IAOhC,uBAAuB,CAAO;IAS9B,aAAa,CAAU;IAUvB,aAAa,CAAiB;IAU9B,uBAAuB,CAAU;IAUjC,sBAAsB,CAAU;IAUhC,WAAW,CAAU;IAUrB,UAAU,CAAU;IAMpB,MAAM,CAAoB;IAS1B,WAAW,CAAQ;IASnB,MAAM,CAAQ;IAUd,eAAe,CAAU;IAIzB,aAAa,CAAQ;CACtB,CAAA;AA9MY,kCAAW;AAKtB;IAJC,IAAA,qBAAW,EAAC,EAAE,WAAW,EAAE,+CAA+C,EAAE,CAAC;IAC7E,IAAA,0BAAQ,GAAE;IACV,IAAA,eAAK,GAAE;IACP,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CACN;AAInB;IAFC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,2BAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,SAAS,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AAE,6BAAiB,EAAE,CAAC;;2CACxB;AAS1B;IAPC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,uCAAuC;QACpD,QAAQ,EAAE,KAAK;KAChB,CAAC;IACD,IAAA,wBAAM,GAAE;IACR,IAAA,4BAAU,GAAE;IACZ,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,0BAA0B,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BAC/C,IAAI;gDAAC;AASnB;IAPC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,mCAAmC;QAChD,QAAQ,EAAE,KAAK;KAChB,CAAC;IACD,IAAA,wBAAM,GAAE;IACR,IAAA,4BAAU,GAAE;IACZ,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,0BAA0B,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACpD,IAAI;2CAAC;AAUd;IARC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,2DAA2D;QACxE,QAAQ,EAAE,KAAK;KAChB,CAAC;IACD,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,eAAK,GAAE;IACP,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oDAChB;AAIzB;IAFC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,kBAAI,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC/D,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC;8BACxB,kBAAI;kDAAC;sBA7MV,WAAW;IADvB,IAAA,gBAAM,EAAC,eAAe,CAAC;GACX,WAAW,CA8MvB"}
@@ -0,0 +1,71 @@
1
+ import { EntityBase } from "../../../common";
2
+ import { WatiUserType, WatiUserAccessStatus } from "./wati.enum";
3
+ import { WatiConfiguration } from "./wati-configuration.entity";
4
+ import { User } from "../../user.entity";
5
+ import { Group } from "../../group.entity";
6
+ export declare class WatiUserAccessLog extends EntityBase {
7
+ groupId: string;
8
+ group: Group;
9
+ watiUserAccessId: string;
10
+ watiConfigurationId: string;
11
+ watiConfiguration: WatiConfiguration;
12
+ targetUserId: string;
13
+ targetUser: User;
14
+ actionByUserId?: string;
15
+ actionByUser?: User;
16
+ action: WatiUserAccessLogAction;
17
+ previousData?: {
18
+ userType?: WatiUserType;
19
+ status?: WatiUserAccessStatus;
20
+ watiUserId?: string;
21
+ watiUserEmail?: string;
22
+ [key: string]: any;
23
+ };
24
+ newData?: {
25
+ userType?: WatiUserType;
26
+ status?: WatiUserAccessStatus;
27
+ watiUserId?: string;
28
+ watiUserEmail?: string;
29
+ [key: string]: any;
30
+ };
31
+ metadata?: {
32
+ messageId?: string;
33
+ messageType?: "session" | "template";
34
+ messageCount?: number;
35
+ costAmount?: number;
36
+ ipAddress?: string;
37
+ userAgent?: string;
38
+ reason?: string;
39
+ [key: string]: any;
40
+ };
41
+ description?: string;
42
+ result: "SUCCESS" | "FAILED" | "PARTIAL";
43
+ errorMessage?: string;
44
+ static createAccessCreatedLog(groupId: string, watiUserAccessId: string, watiConfigurationId: string, targetUserId: string, actionByUserId: string, newData: any): Partial<WatiUserAccessLog>;
45
+ static createUserTypeChangedLog(groupId: string, watiUserAccessId: string, watiConfigurationId: string, targetUserId: string, actionByUserId: string, previousUserType: WatiUserType, newUserType: WatiUserType): Partial<WatiUserAccessLog>;
46
+ static createMessageSentLog(groupId: string, watiUserAccessId: string, watiConfigurationId: string, targetUserId: string, messageType: "session" | "template", messageCount?: number): Partial<WatiUserAccessLog>;
47
+ static createLimitExceededLog(groupId: string, watiUserAccessId: string, watiConfigurationId: string, targetUserId: string, limitType: "session" | "template" | "user_count", currentUsage: number, limit: number): Partial<WatiUserAccessLog>;
48
+ }
49
+ export declare enum WatiUserAccessLogAction {
50
+ ACCESS_CREATED = "ACCESS_CREATED",
51
+ ACCESS_UPDATED = "ACCESS_UPDATED",
52
+ ACCESS_DELETED = "ACCESS_DELETED",
53
+ ACCESS_SUSPENDED = "ACCESS_SUSPENDED",
54
+ ACCESS_REACTIVATED = "ACCESS_REACTIVATED",
55
+ ROLE_CHANGED = "ROLE_CHANGED",
56
+ PERMISSIONS_UPDATED = "PERMISSIONS_UPDATED",
57
+ LIMITS_UPDATED = "LIMITS_UPDATED",
58
+ MESSAGE_SENT = "MESSAGE_SENT",
59
+ MESSAGE_FAILED = "MESSAGE_FAILED",
60
+ SESSION_STARTED = "SESSION_STARTED",
61
+ SESSION_ENDED = "SESSION_ENDED",
62
+ LIMIT_EXCEEDED = "LIMIT_EXCEEDED",
63
+ LIMIT_WARNING = "LIMIT_WARNING",
64
+ USAGE_RESET = "USAGE_RESET",
65
+ CONFIGURATION_ACCESSED = "CONFIGURATION_ACCESSED",
66
+ REPORT_GENERATED = "REPORT_GENERATED",
67
+ BULK_ACTION_PERFORMED = "BULK_ACTION_PERFORMED",
68
+ UNAUTHORIZED_ACCESS_ATTEMPT = "UNAUTHORIZED_ACCESS_ATTEMPT",
69
+ LOGIN_SUCCESS = "LOGIN_SUCCESS",
70
+ LOGIN_FAILED = "LOGIN_FAILED"
71
+ }
@@ -0,0 +1,216 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.WatiUserAccessLogAction = exports.WatiUserAccessLog = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const common_1 = require("../../../common");
15
+ const wati_configuration_entity_1 = require("./wati-configuration.entity");
16
+ const user_entity_1 = require("../../user.entity");
17
+ const group_entity_1 = require("../../group.entity");
18
+ let WatiUserAccessLog = class WatiUserAccessLog extends common_1.EntityBase {
19
+ groupId;
20
+ group;
21
+ watiUserAccessId;
22
+ watiConfigurationId;
23
+ watiConfiguration;
24
+ targetUserId;
25
+ targetUser;
26
+ actionByUserId;
27
+ actionByUser;
28
+ action;
29
+ previousData;
30
+ newData;
31
+ metadata;
32
+ description;
33
+ result;
34
+ errorMessage;
35
+ static createAccessCreatedLog(groupId, watiUserAccessId, watiConfigurationId, targetUserId, actionByUserId, newData) {
36
+ return {
37
+ groupId,
38
+ watiUserAccessId,
39
+ watiConfigurationId,
40
+ targetUserId,
41
+ actionByUserId,
42
+ action: WatiUserAccessLogAction.ACCESS_CREATED,
43
+ newData,
44
+ description: `Acceso WATI creado para usuario ${targetUserId}`,
45
+ result: "SUCCESS",
46
+ };
47
+ }
48
+ static createUserTypeChangedLog(groupId, watiUserAccessId, watiConfigurationId, targetUserId, actionByUserId, previousUserType, newUserType) {
49
+ return {
50
+ groupId,
51
+ watiUserAccessId,
52
+ watiConfigurationId,
53
+ targetUserId,
54
+ actionByUserId,
55
+ action: WatiUserAccessLogAction.ROLE_CHANGED,
56
+ previousData: { userType: previousUserType },
57
+ newData: { userType: newUserType },
58
+ description: `Tipo de usuario cambiado de ${previousUserType} a ${newUserType}`,
59
+ result: "SUCCESS",
60
+ };
61
+ }
62
+ static createMessageSentLog(groupId, watiUserAccessId, watiConfigurationId, targetUserId, messageType, messageCount = 1) {
63
+ return {
64
+ groupId,
65
+ watiUserAccessId,
66
+ watiConfigurationId,
67
+ targetUserId,
68
+ action: WatiUserAccessLogAction.MESSAGE_SENT,
69
+ metadata: { messageType, messageCount },
70
+ description: `Mensaje ${messageType} enviado`,
71
+ result: "SUCCESS",
72
+ };
73
+ }
74
+ static createLimitExceededLog(groupId, watiUserAccessId, watiConfigurationId, targetUserId, limitType, currentUsage, limit) {
75
+ return {
76
+ groupId,
77
+ watiUserAccessId,
78
+ watiConfigurationId,
79
+ targetUserId,
80
+ action: WatiUserAccessLogAction.LIMIT_EXCEEDED,
81
+ metadata: { limitType, currentUsage, limit },
82
+ description: `Límite excedido: ${limitType} (${currentUsage}/${limit})`,
83
+ result: "FAILED",
84
+ };
85
+ }
86
+ };
87
+ exports.WatiUserAccessLog = WatiUserAccessLog;
88
+ __decorate([
89
+ (0, typeorm_1.Column)({ type: "uuid", comment: "ID del grupo (tenant) - CRÍTICO para multitenancy" }),
90
+ (0, typeorm_1.Index)(),
91
+ __metadata("design:type", String)
92
+ ], WatiUserAccessLog.prototype, "groupId", void 0);
93
+ __decorate([
94
+ (0, typeorm_1.ManyToOne)(() => group_entity_1.Group, { onDelete: "CASCADE" }),
95
+ (0, typeorm_1.JoinColumn)({ name: "groupId" }),
96
+ __metadata("design:type", group_entity_1.Group)
97
+ ], WatiUserAccessLog.prototype, "group", void 0);
98
+ __decorate([
99
+ (0, typeorm_1.Column)({ type: "uuid", comment: "ID del registro de acceso de usuario afectado" }),
100
+ __metadata("design:type", String)
101
+ ], WatiUserAccessLog.prototype, "watiUserAccessId", void 0);
102
+ __decorate([
103
+ (0, typeorm_1.Column)({ type: "uuid", comment: "ID de la configuración WATI" }),
104
+ (0, typeorm_1.Index)(),
105
+ __metadata("design:type", String)
106
+ ], WatiUserAccessLog.prototype, "watiConfigurationId", void 0);
107
+ __decorate([
108
+ (0, typeorm_1.ManyToOne)(() => wati_configuration_entity_1.WatiConfiguration, { onDelete: "CASCADE" }),
109
+ (0, typeorm_1.JoinColumn)({ name: "watiConfigurationId" }),
110
+ __metadata("design:type", wati_configuration_entity_1.WatiConfiguration)
111
+ ], WatiUserAccessLog.prototype, "watiConfiguration", void 0);
112
+ __decorate([
113
+ (0, typeorm_1.Column)({ type: "uuid", comment: "ID del usuario objetivo (sobre quien se hace la acción)" }),
114
+ (0, typeorm_1.Index)(),
115
+ __metadata("design:type", String)
116
+ ], WatiUserAccessLog.prototype, "targetUserId", void 0);
117
+ __decorate([
118
+ (0, typeorm_1.ManyToOne)(() => user_entity_1.User, { onDelete: "CASCADE" }),
119
+ (0, typeorm_1.JoinColumn)({ name: "targetUserId" }),
120
+ __metadata("design:type", user_entity_1.User)
121
+ ], WatiUserAccessLog.prototype, "targetUser", void 0);
122
+ __decorate([
123
+ (0, typeorm_1.Column)({ type: "uuid", nullable: true, comment: "ID del usuario que ejecuta la acción" }),
124
+ __metadata("design:type", String)
125
+ ], WatiUserAccessLog.prototype, "actionByUserId", void 0);
126
+ __decorate([
127
+ (0, typeorm_1.ManyToOne)(() => user_entity_1.User, { onDelete: "SET NULL", nullable: true }),
128
+ (0, typeorm_1.JoinColumn)({ name: "actionByUserId" }),
129
+ __metadata("design:type", user_entity_1.User)
130
+ ], WatiUserAccessLog.prototype, "actionByUser", void 0);
131
+ __decorate([
132
+ (0, typeorm_1.Column)({
133
+ type: "varchar",
134
+ length: 100,
135
+ comment: "Tipo de acción realizada",
136
+ }),
137
+ __metadata("design:type", String)
138
+ ], WatiUserAccessLog.prototype, "action", void 0);
139
+ __decorate([
140
+ (0, typeorm_1.Column)({
141
+ type: "jsonb",
142
+ nullable: true,
143
+ comment: "Datos anteriores (para cambios de configuración)",
144
+ }),
145
+ __metadata("design:type", Object)
146
+ ], WatiUserAccessLog.prototype, "previousData", void 0);
147
+ __decorate([
148
+ (0, typeorm_1.Column)({
149
+ type: "jsonb",
150
+ nullable: true,
151
+ comment: "Datos nuevos (para cambios de configuración)",
152
+ }),
153
+ __metadata("design:type", Object)
154
+ ], WatiUserAccessLog.prototype, "newData", void 0);
155
+ __decorate([
156
+ (0, typeorm_1.Column)({
157
+ type: "jsonb",
158
+ nullable: true,
159
+ comment: "Metadatos adicionales de la acción",
160
+ }),
161
+ __metadata("design:type", Object)
162
+ ], WatiUserAccessLog.prototype, "metadata", void 0);
163
+ __decorate([
164
+ (0, typeorm_1.Column)({
165
+ type: "text",
166
+ nullable: true,
167
+ comment: "Descripción detallada de la acción",
168
+ }),
169
+ __metadata("design:type", String)
170
+ ], WatiUserAccessLog.prototype, "description", void 0);
171
+ __decorate([
172
+ (0, typeorm_1.Column)({
173
+ type: "varchar",
174
+ length: 50,
175
+ default: "SUCCESS",
176
+ comment: "Resultado de la acción",
177
+ }),
178
+ __metadata("design:type", String)
179
+ ], WatiUserAccessLog.prototype, "result", void 0);
180
+ __decorate([
181
+ (0, typeorm_1.Column)({
182
+ type: "text",
183
+ nullable: true,
184
+ comment: "Mensaje de error si la acción falló",
185
+ }),
186
+ __metadata("design:type", String)
187
+ ], WatiUserAccessLog.prototype, "errorMessage", void 0);
188
+ exports.WatiUserAccessLog = WatiUserAccessLog = __decorate([
189
+ (0, typeorm_1.Entity)("wati_user_access_logs"),
190
+ (0, typeorm_1.Index)(["groupId", "watiConfigurationId"])
191
+ ], WatiUserAccessLog);
192
+ var WatiUserAccessLogAction;
193
+ (function (WatiUserAccessLogAction) {
194
+ WatiUserAccessLogAction["ACCESS_CREATED"] = "ACCESS_CREATED";
195
+ WatiUserAccessLogAction["ACCESS_UPDATED"] = "ACCESS_UPDATED";
196
+ WatiUserAccessLogAction["ACCESS_DELETED"] = "ACCESS_DELETED";
197
+ WatiUserAccessLogAction["ACCESS_SUSPENDED"] = "ACCESS_SUSPENDED";
198
+ WatiUserAccessLogAction["ACCESS_REACTIVATED"] = "ACCESS_REACTIVATED";
199
+ WatiUserAccessLogAction["ROLE_CHANGED"] = "ROLE_CHANGED";
200
+ WatiUserAccessLogAction["PERMISSIONS_UPDATED"] = "PERMISSIONS_UPDATED";
201
+ WatiUserAccessLogAction["LIMITS_UPDATED"] = "LIMITS_UPDATED";
202
+ WatiUserAccessLogAction["MESSAGE_SENT"] = "MESSAGE_SENT";
203
+ WatiUserAccessLogAction["MESSAGE_FAILED"] = "MESSAGE_FAILED";
204
+ WatiUserAccessLogAction["SESSION_STARTED"] = "SESSION_STARTED";
205
+ WatiUserAccessLogAction["SESSION_ENDED"] = "SESSION_ENDED";
206
+ WatiUserAccessLogAction["LIMIT_EXCEEDED"] = "LIMIT_EXCEEDED";
207
+ WatiUserAccessLogAction["LIMIT_WARNING"] = "LIMIT_WARNING";
208
+ WatiUserAccessLogAction["USAGE_RESET"] = "USAGE_RESET";
209
+ WatiUserAccessLogAction["CONFIGURATION_ACCESSED"] = "CONFIGURATION_ACCESSED";
210
+ WatiUserAccessLogAction["REPORT_GENERATED"] = "REPORT_GENERATED";
211
+ WatiUserAccessLogAction["BULK_ACTION_PERFORMED"] = "BULK_ACTION_PERFORMED";
212
+ WatiUserAccessLogAction["UNAUTHORIZED_ACCESS_ATTEMPT"] = "UNAUTHORIZED_ACCESS_ATTEMPT";
213
+ WatiUserAccessLogAction["LOGIN_SUCCESS"] = "LOGIN_SUCCESS";
214
+ WatiUserAccessLogAction["LOGIN_FAILED"] = "LOGIN_FAILED";
215
+ })(WatiUserAccessLogAction || (exports.WatiUserAccessLogAction = WatiUserAccessLogAction = {}));
216
+ //# sourceMappingURL=wati-user-access-log.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wati-user-access-log.entity.js","sourceRoot":"","sources":["../../../../src/entities/thirdparty/wati/wati-user-access-log.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAuE;AACvE,4CAA6C;AAE7C,2EAAgE;AAChE,mDAAyC;AACzC,qDAA2C;AASpC,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,mBAAU;IAG/C,OAAO,CAAS;IAIhB,KAAK,CAAQ;IAGb,gBAAgB,CAAS;IAIzB,mBAAmB,CAAS;IAI5B,iBAAiB,CAAoB;IAIrC,YAAY,CAAS;IAIrB,UAAU,CAAO;IAGjB,cAAc,CAAU;IAIxB,YAAY,CAAQ;IAOpB,MAAM,CAA0B;IAOhC,YAAY,CAMV;IAOF,OAAO,CAML;IAOF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,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE,wBAAwB;KAClC,CAAC;;iDACuC;AAOzC;IALC,IAAA,gBAAM,EAAC;QACN,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,qCAAqC;KAC/C,CAAC;;uDACoB;4BAxGX,iBAAiB;IAF7B,IAAA,gBAAM,EAAC,uBAAuB,CAAC;IAC/B,IAAA,eAAK,EAAC,CAAC,SAAS,EAAE,qBAAqB,CAAC,CAAC;GAC7B,iBAAiB,CA4M7B;AAKD,IAAY,uBAiCX;AAjCD,WAAY,uBAAuB;IAEjC,4DAAiC,CAAA;IACjC,4DAAiC,CAAA;IACjC,4DAAiC,CAAA;IACjC,gEAAqC,CAAA;IACrC,oEAAyC,CAAA;IAGzC,wDAA6B,CAAA;IAC7B,sEAA2C,CAAA;IAC3C,4DAAiC,CAAA;IAGjC,wDAA6B,CAAA;IAC7B,4DAAiC,CAAA;IACjC,8DAAmC,CAAA;IACnC,0DAA+B,CAAA;IAG/B,4DAAiC,CAAA;IACjC,0DAA+B,CAAA;IAC/B,sDAA2B,CAAA;IAG3B,4EAAiD,CAAA;IACjD,gEAAqC,CAAA;IACrC,0EAA+C,CAAA;IAG/C,sFAA2D,CAAA;IAC3D,0DAA+B,CAAA;IAC/B,wDAA6B,CAAA;AAC/B,CAAC,EAjCW,uBAAuB,uCAAvB,uBAAuB,QAiClC"}
@@ -0,0 +1,31 @@
1
+ import { EntityBase } from "../../../common";
2
+ import { WatiUserType, WatiUserAccessStatus } from "./wati.enum";
3
+ import { WatiConfiguration } from "./wati-configuration.entity";
4
+ import { User } from "../../user.entity";
5
+ import { Group } from "../../group.entity";
6
+ export declare class WatiUserAccess extends EntityBase {
7
+ groupId: string;
8
+ group: Group;
9
+ watiConfigurationId: string;
10
+ watiConfiguration: WatiConfiguration;
11
+ userId: string;
12
+ user: User;
13
+ userType: WatiUserType;
14
+ status: WatiUserAccessStatus;
15
+ watiUserId?: string;
16
+ watiUserEmail?: string;
17
+ currentMonthSessionMessages: number;
18
+ currentMonthTemplateMessages: number;
19
+ lastAccessAt?: Date;
20
+ lastMessageSentAt?: Date;
21
+ receiveNotifications: boolean;
22
+ createdByUserId?: string;
23
+ notes?: string;
24
+ countsAgainstWatiLimit(): boolean;
25
+ canSendMessages(): boolean;
26
+ canViewConversations(): boolean;
27
+ canBeAssigned(): boolean;
28
+ incrementMessageCounter(type: "session" | "template"): void;
29
+ updateLastAccess(): void;
30
+ resetMonthlyCounters(): void;
31
+ }