nesthub 1.0.0
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.
- package/README.md +108 -0
- package/dist/cache/README.md +91 -0
- package/dist/cache/index.d.ts +10 -0
- package/dist/cache/index.js +75 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/index.spec.d.ts +1 -0
- package/dist/cache/index.spec.js +61 -0
- package/dist/cache/index.spec.js.map +1 -0
- package/dist/excel/README.md +132 -0
- package/dist/excel/excel.module.d.ts +2 -0
- package/dist/excel/excel.module.js +21 -0
- package/dist/excel/excel.module.js.map +1 -0
- package/dist/excel/excel.service.d.ts +23 -0
- package/dist/excel/excel.service.js +124 -0
- package/dist/excel/excel.service.js.map +1 -0
- package/dist/excel/index.d.ts +2 -0
- package/dist/excel/index.js +8 -0
- package/dist/excel/index.js.map +1 -0
- package/dist/excel/interfaces.d.ts +19 -0
- package/dist/excel/interfaces.js +3 -0
- package/dist/excel/interfaces.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/index.spec.d.ts +1 -0
- package/dist/index.spec.js +11 -0
- package/dist/index.spec.js.map +1 -0
- package/dist/notification/README.md +237 -0
- package/dist/notification/channels/channel.interface.d.ts +10 -0
- package/dist/notification/channels/channel.interface.js +3 -0
- package/dist/notification/channels/channel.interface.js.map +1 -0
- package/dist/notification/channels/email.channel.d.ts +11 -0
- package/dist/notification/channels/email.channel.js +58 -0
- package/dist/notification/channels/email.channel.js.map +1 -0
- package/dist/notification/channels/firebase.channel.d.ts +11 -0
- package/dist/notification/channels/firebase.channel.js +69 -0
- package/dist/notification/channels/firebase.channel.js.map +1 -0
- package/dist/notification/channels/index.d.ts +5 -0
- package/dist/notification/channels/index.js +12 -0
- package/dist/notification/channels/index.js.map +1 -0
- package/dist/notification/channels/sms.channel.d.ts +8 -0
- package/dist/notification/channels/sms.channel.js +90 -0
- package/dist/notification/channels/sms.channel.js.map +1 -0
- package/dist/notification/channels/telegram.channel.d.ts +10 -0
- package/dist/notification/channels/telegram.channel.js +59 -0
- package/dist/notification/channels/telegram.channel.js.map +1 -0
- package/dist/notification/email/index.d.ts +62 -0
- package/dist/notification/email/index.js +253 -0
- package/dist/notification/email/index.js.map +1 -0
- package/dist/notification/email/index.spec.d.ts +1 -0
- package/dist/notification/email/index.spec.js +121 -0
- package/dist/notification/email/index.spec.js.map +1 -0
- package/dist/notification/entities/notification-log.entity.d.ts +15 -0
- package/dist/notification/entities/notification-log.entity.js +82 -0
- package/dist/notification/entities/notification-log.entity.js.map +1 -0
- package/dist/notification/firebase/index.d.ts +52 -0
- package/dist/notification/firebase/index.js +261 -0
- package/dist/notification/firebase/index.js.map +1 -0
- package/dist/notification/firebase/index.spec.d.ts +1 -0
- package/dist/notification/firebase/index.spec.js +114 -0
- package/dist/notification/firebase/index.spec.js.map +1 -0
- package/dist/notification/index.d.ts +12 -0
- package/dist/notification/index.js +26 -0
- package/dist/notification/index.js.map +1 -0
- package/dist/notification/index.spec.d.ts +1 -0
- package/dist/notification/index.spec.js +336 -0
- package/dist/notification/index.spec.js.map +1 -0
- package/dist/notification/interfaces.d.ts +98 -0
- package/dist/notification/interfaces.js +3 -0
- package/dist/notification/interfaces.js.map +1 -0
- package/dist/notification/notification.constants.d.ts +4 -0
- package/dist/notification/notification.constants.js +8 -0
- package/dist/notification/notification.constants.js.map +1 -0
- package/dist/notification/notification.module.d.ts +10 -0
- package/dist/notification/notification.module.js +160 -0
- package/dist/notification/notification.module.js.map +1 -0
- package/dist/notification/notification.service.d.ts +14 -0
- package/dist/notification/notification.service.js +184 -0
- package/dist/notification/notification.service.js.map +1 -0
- package/dist/notification/queue/index.d.ts +2 -0
- package/dist/notification/queue/index.js +6 -0
- package/dist/notification/queue/index.js.map +1 -0
- package/dist/notification/queue/notification-queue.service.d.ts +31 -0
- package/dist/notification/queue/notification-queue.service.js +134 -0
- package/dist/notification/queue/notification-queue.service.js.map +1 -0
- package/dist/notification/services/index.d.ts +1 -0
- package/dist/notification/services/index.js +6 -0
- package/dist/notification/services/index.js.map +1 -0
- package/dist/notification/services/template.service.d.ts +13 -0
- package/dist/notification/services/template.service.js +75 -0
- package/dist/notification/services/template.service.js.map +1 -0
- package/dist/notification/shared.d.ts +48 -0
- package/dist/notification/shared.js +95 -0
- package/dist/notification/shared.js.map +1 -0
- package/dist/notification/sms/index.d.ts +52 -0
- package/dist/notification/sms/index.js +234 -0
- package/dist/notification/sms/index.js.map +1 -0
- package/dist/notification/sms/index.spec.d.ts +1 -0
- package/dist/notification/sms/index.spec.js +123 -0
- package/dist/notification/sms/index.spec.js.map +1 -0
- package/dist/notification/telegram/index.d.ts +50 -0
- package/dist/notification/telegram/index.js +248 -0
- package/dist/notification/telegram/index.js.map +1 -0
- package/dist/notification/telegram/index.spec.d.ts +1 -0
- package/dist/notification/telegram/index.spec.js +108 -0
- package/dist/notification/telegram/index.spec.js.map +1 -0
- package/dist/notification/typeorm-storage.d.ts +28 -0
- package/dist/notification/typeorm-storage.js +56 -0
- package/dist/notification/typeorm-storage.js.map +1 -0
- package/dist/notification/unified.d.ts +47 -0
- package/dist/notification/unified.js +207 -0
- package/dist/notification/unified.js.map +1 -0
- package/dist/queue/README.md +82 -0
- package/dist/queue/index.d.ts +14 -0
- package/dist/queue/index.js +17 -0
- package/dist/queue/index.js.map +1 -0
- package/dist/queue/index.spec.d.ts +1 -0
- package/dist/queue/index.spec.js +76 -0
- package/dist/queue/index.spec.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/typeorm/README.md +197 -0
- package/dist/typeorm/crud-controller.d.ts +4 -0
- package/dist/typeorm/crud-controller.js +81 -0
- package/dist/typeorm/crud-controller.js.map +1 -0
- package/dist/typeorm/crud-service.d.ts +6 -0
- package/dist/typeorm/crud-service.js +53 -0
- package/dist/typeorm/crud-service.js.map +1 -0
- package/dist/typeorm/crud.interface.d.ts +9 -0
- package/dist/typeorm/crud.interface.js +3 -0
- package/dist/typeorm/crud.interface.js.map +1 -0
- package/dist/typeorm/index.d.ts +23 -0
- package/dist/typeorm/index.js +66 -0
- package/dist/typeorm/index.js.map +1 -0
- package/dist/typeorm/index.spec.d.ts +1 -0
- package/dist/typeorm/index.spec.js +109 -0
- package/dist/typeorm/index.spec.js.map +1 -0
- package/package.json +229 -0
- package/src/cache/README.md +91 -0
- package/src/excel/README.md +132 -0
- package/src/notification/README.md +237 -0
- package/src/queue/README.md +82 -0
- package/src/typeorm/README.md +197 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SendNotificationInput, SendResult } from './interfaces';
|
|
2
|
+
import type { NotificationChannel } from './channels';
|
|
3
|
+
import { TemplateService } from './services';
|
|
4
|
+
import { NotificationQueueService } from './queue';
|
|
5
|
+
export declare class NotificationService {
|
|
6
|
+
private readonly channels;
|
|
7
|
+
private readonly repository;
|
|
8
|
+
private readonly templateService?;
|
|
9
|
+
private readonly queueService?;
|
|
10
|
+
private readonly logger;
|
|
11
|
+
constructor(channels: Map<string, NotificationChannel[]>, repository: any, templateService?: TemplateService | undefined, queueService?: NotificationQueueService | undefined);
|
|
12
|
+
send(input: SendNotificationInput): Promise<SendResult>;
|
|
13
|
+
enqueue(input: SendNotificationInput): Promise<SendResult>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
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 NotificationService_1;
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.NotificationService = void 0;
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
const node_crypto_1 = require("node:crypto");
|
|
19
|
+
const notification_constants_1 = require("./notification.constants");
|
|
20
|
+
const services_1 = require("./services");
|
|
21
|
+
const queue_1 = require("./queue");
|
|
22
|
+
let NotificationService = NotificationService_1 = class NotificationService {
|
|
23
|
+
channels;
|
|
24
|
+
repository;
|
|
25
|
+
templateService;
|
|
26
|
+
queueService;
|
|
27
|
+
logger = new common_1.Logger(NotificationService_1.name);
|
|
28
|
+
constructor(channels, repository, templateService, queueService) {
|
|
29
|
+
this.channels = channels;
|
|
30
|
+
this.repository = repository;
|
|
31
|
+
this.templateService = templateService;
|
|
32
|
+
this.queueService = queueService;
|
|
33
|
+
}
|
|
34
|
+
async send(input) {
|
|
35
|
+
const providers = this.channels.get(input.channel);
|
|
36
|
+
if (!providers?.length) {
|
|
37
|
+
return {
|
|
38
|
+
id: '',
|
|
39
|
+
channel: input.channel,
|
|
40
|
+
to: input.to,
|
|
41
|
+
success: false,
|
|
42
|
+
error: `Channel "${input.channel}" not configured. Available: ${[...this.channels.keys()].join(', ')}`,
|
|
43
|
+
sentAt: new Date(),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
let content = input.content;
|
|
47
|
+
const id = (0, node_crypto_1.randomUUID)();
|
|
48
|
+
if (input.template && this.templateService) {
|
|
49
|
+
try {
|
|
50
|
+
content = await this.templateService.render(input.template, input.context ?? {});
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
54
|
+
return {
|
|
55
|
+
id: '',
|
|
56
|
+
channel: input.channel,
|
|
57
|
+
to: input.to,
|
|
58
|
+
success: false,
|
|
59
|
+
error: `Template render failed: ${message}`,
|
|
60
|
+
sentAt: new Date(),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (this.repository) {
|
|
65
|
+
await this.repository.insert({
|
|
66
|
+
id,
|
|
67
|
+
channel: input.channel,
|
|
68
|
+
to: input.to,
|
|
69
|
+
subject: input.subject,
|
|
70
|
+
status: 'sending',
|
|
71
|
+
content,
|
|
72
|
+
metadata: input.metadata,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
let lastError;
|
|
76
|
+
for (const provider of providers) {
|
|
77
|
+
const result = await provider.send({ ...input, content });
|
|
78
|
+
if (result.success) {
|
|
79
|
+
if (this.repository) {
|
|
80
|
+
await this.repository.update(id, {
|
|
81
|
+
status: 'sent',
|
|
82
|
+
messageId: result.messageId ?? null,
|
|
83
|
+
error: null,
|
|
84
|
+
sentAt: new Date(),
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
id,
|
|
89
|
+
channel: input.channel,
|
|
90
|
+
to: input.to,
|
|
91
|
+
success: true,
|
|
92
|
+
messageId: result.messageId,
|
|
93
|
+
sentAt: new Date(),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
lastError = result.error;
|
|
97
|
+
}
|
|
98
|
+
if (this.repository) {
|
|
99
|
+
await this.repository.update(id, {
|
|
100
|
+
status: 'failed',
|
|
101
|
+
error: lastError ?? null,
|
|
102
|
+
sentAt: null,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
id,
|
|
107
|
+
channel: input.channel,
|
|
108
|
+
to: input.to,
|
|
109
|
+
success: false,
|
|
110
|
+
error: lastError,
|
|
111
|
+
sentAt: new Date(),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
async enqueue(input) {
|
|
115
|
+
if (!this.queueService) {
|
|
116
|
+
this.logger.warn('Queue not configured, sending immediately');
|
|
117
|
+
return this.send(input);
|
|
118
|
+
}
|
|
119
|
+
const id = (0, node_crypto_1.randomUUID)();
|
|
120
|
+
const providers = this.channels.get(input.channel);
|
|
121
|
+
if (!providers?.length) {
|
|
122
|
+
return {
|
|
123
|
+
id: '',
|
|
124
|
+
channel: input.channel,
|
|
125
|
+
to: input.to,
|
|
126
|
+
success: false,
|
|
127
|
+
error: `Channel "${input.channel}" not configured`,
|
|
128
|
+
sentAt: new Date(),
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
let content = input.content;
|
|
132
|
+
if (input.template && this.templateService) {
|
|
133
|
+
try {
|
|
134
|
+
content = await this.templateService.render(input.template, input.context ?? {});
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
138
|
+
return {
|
|
139
|
+
id: '',
|
|
140
|
+
channel: input.channel,
|
|
141
|
+
to: input.to,
|
|
142
|
+
success: false,
|
|
143
|
+
error: `Template render failed: ${message}`,
|
|
144
|
+
sentAt: new Date(),
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (this.repository) {
|
|
149
|
+
await this.repository.insert({
|
|
150
|
+
id,
|
|
151
|
+
channel: input.channel,
|
|
152
|
+
to: input.to,
|
|
153
|
+
subject: input.subject,
|
|
154
|
+
status: 'pending',
|
|
155
|
+
content,
|
|
156
|
+
metadata: input.metadata,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
await this.queueService.enqueue({
|
|
160
|
+
notification: { ...input, content },
|
|
161
|
+
id,
|
|
162
|
+
createdAt: new Date().toISOString(),
|
|
163
|
+
});
|
|
164
|
+
return {
|
|
165
|
+
id,
|
|
166
|
+
channel: input.channel,
|
|
167
|
+
to: input.to,
|
|
168
|
+
success: true,
|
|
169
|
+
sentAt: new Date(),
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
exports.NotificationService = NotificationService;
|
|
174
|
+
exports.NotificationService = NotificationService = NotificationService_1 = __decorate([
|
|
175
|
+
(0, common_1.Injectable)(),
|
|
176
|
+
__param(0, (0, common_1.Inject)(notification_constants_1.NOTIFICATION_CHANNELS)),
|
|
177
|
+
__param(1, (0, common_1.Optional)()),
|
|
178
|
+
__param(1, (0, common_1.Inject)(notification_constants_1.NOTIFICATION_LOG_REPOSITORY)),
|
|
179
|
+
__param(2, (0, common_1.Optional)()),
|
|
180
|
+
__param(3, (0, common_1.Optional)()),
|
|
181
|
+
__metadata("design:paramtypes", [Map, Object, services_1.TemplateService,
|
|
182
|
+
queue_1.NotificationQueueService])
|
|
183
|
+
], NotificationService);
|
|
184
|
+
//# sourceMappingURL=notification.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.service.js","sourceRoot":"","sources":["../../src/notification/notification.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,2CAAsE;AACtE,6CAAyC;AAGzC,qEAGkC;AAClC,yCAA6C;AAC7C,mCAAmD;AAG5C,IAAM,mBAAmB,2BAAzB,MAAM,mBAAmB;IAKX;IAGA;IAEA;IAEA;IAXF,MAAM,GAAG,IAAI,eAAM,CAAC,qBAAmB,CAAC,IAAI,CAAC,CAAC;IAE/D,YAEmB,QAA4C,EAG5C,UAAe,EAEf,eAAiC,EAEjC,YAAuC;QAPvC,aAAQ,GAAR,QAAQ,CAAoC;QAG5C,eAAU,GAAV,UAAU,CAAK;QAEf,oBAAe,GAAf,eAAe,CAAkB;QAEjC,iBAAY,GAAZ,YAAY,CAA2B;IACvD,CAAC;IAEJ,KAAK,CAAC,IAAI,CAAC,KAA4B;QACrC,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,OAA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E,CAAA;qCANgB,GAAG,UAKK,0BAAe;QAElB,gCAAwB;GAZ/C,mBAAmB,CA0K/B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotificationQueueService = void 0;
|
|
4
|
+
var notification_queue_service_1 = require("./notification-queue.service");
|
|
5
|
+
Object.defineProperty(exports, "NotificationQueueService", { enumerable: true, get: function () { return notification_queue_service_1.NotificationQueueService; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/notification/queue/index.ts"],"names":[],"mappings":";;;AAAA,2EAAwE;AAA/D,sIAAA,wBAAwB,OAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { OnModuleInit, OnModuleDestroy } from '@nestjs/common';
|
|
2
|
+
import type { SendNotificationInput } from '../interfaces';
|
|
3
|
+
import type { NotificationChannel } from '../channels';
|
|
4
|
+
import { TemplateService } from '../services';
|
|
5
|
+
export interface QueueConfig {
|
|
6
|
+
name: string;
|
|
7
|
+
connection: {
|
|
8
|
+
url: string;
|
|
9
|
+
};
|
|
10
|
+
defaultJobOptions?: Record<string, unknown>;
|
|
11
|
+
}
|
|
12
|
+
export interface QueueJobData {
|
|
13
|
+
notification: SendNotificationInput;
|
|
14
|
+
id: string;
|
|
15
|
+
createdAt: string;
|
|
16
|
+
}
|
|
17
|
+
export declare class NotificationQueueService implements OnModuleInit, OnModuleDestroy {
|
|
18
|
+
private readonly channels;
|
|
19
|
+
private readonly queueConfig;
|
|
20
|
+
private readonly repository;
|
|
21
|
+
private readonly templateService?;
|
|
22
|
+
private readonly logger;
|
|
23
|
+
private queue;
|
|
24
|
+
private worker;
|
|
25
|
+
private initialized;
|
|
26
|
+
constructor(channels: Map<string, NotificationChannel[]>, queueConfig: QueueConfig, repository: any, templateService?: TemplateService | undefined);
|
|
27
|
+
onModuleInit(): Promise<void>;
|
|
28
|
+
enqueue(data: QueueJobData): Promise<void>;
|
|
29
|
+
private processJob;
|
|
30
|
+
onModuleDestroy(): Promise<void>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
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 NotificationQueueService_1;
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.NotificationQueueService = void 0;
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
const notification_constants_1 = require("../notification.constants");
|
|
19
|
+
const services_1 = require("../services");
|
|
20
|
+
let NotificationQueueService = NotificationQueueService_1 = class NotificationQueueService {
|
|
21
|
+
channels;
|
|
22
|
+
queueConfig;
|
|
23
|
+
repository;
|
|
24
|
+
templateService;
|
|
25
|
+
logger = new common_1.Logger(NotificationQueueService_1.name);
|
|
26
|
+
queue = null;
|
|
27
|
+
worker = null;
|
|
28
|
+
initialized = false;
|
|
29
|
+
constructor(channels, queueConfig, repository, templateService) {
|
|
30
|
+
this.channels = channels;
|
|
31
|
+
this.queueConfig = queueConfig;
|
|
32
|
+
this.repository = repository;
|
|
33
|
+
this.templateService = templateService;
|
|
34
|
+
}
|
|
35
|
+
async onModuleInit() {
|
|
36
|
+
const { Queue, Worker } = await import('bullmq');
|
|
37
|
+
const { connection, name, defaultJobOptions } = this.queueConfig;
|
|
38
|
+
this.queue = new Queue(name, {
|
|
39
|
+
connection,
|
|
40
|
+
defaultJobOptions,
|
|
41
|
+
});
|
|
42
|
+
this.worker = new Worker(name, async (job) => {
|
|
43
|
+
await this.processJob(job.data);
|
|
44
|
+
}, { connection });
|
|
45
|
+
this.worker.on('failed', (job, err) => {
|
|
46
|
+
this.logger.error(`Queue job ${job?.id} failed: ${err.message}`);
|
|
47
|
+
});
|
|
48
|
+
this.initialized = true;
|
|
49
|
+
this.logger.log(`Queue worker initialized: ${name}`);
|
|
50
|
+
}
|
|
51
|
+
async enqueue(data) {
|
|
52
|
+
if (!this.initialized || !this.queue) {
|
|
53
|
+
throw new Error('Queue not initialized. Ensure queue is enabled in NotificationModule.forRoot().');
|
|
54
|
+
}
|
|
55
|
+
await this.queue.add(data.notification.channel, data, {
|
|
56
|
+
jobId: data.id,
|
|
57
|
+
...this.queueConfig.defaultJobOptions,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
async processJob(data) {
|
|
61
|
+
const { notification, id } = data;
|
|
62
|
+
if (notification.expiresAt) {
|
|
63
|
+
const expiresAt = typeof notification.expiresAt === 'string'
|
|
64
|
+
? new Date(notification.expiresAt)
|
|
65
|
+
: notification.expiresAt;
|
|
66
|
+
if (expiresAt <= new Date()) {
|
|
67
|
+
this.logger.warn(`Notification ${id} expired, skipping`);
|
|
68
|
+
if (this.repository) {
|
|
69
|
+
await this.repository.update(id, { status: 'expired' });
|
|
70
|
+
}
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const providers = this.channels.get(notification.channel);
|
|
75
|
+
if (!providers?.length) {
|
|
76
|
+
this.logger.error(`Channel "${notification.channel}" not configured`);
|
|
77
|
+
if (this.repository) {
|
|
78
|
+
await this.repository.update(id, {
|
|
79
|
+
status: 'failed',
|
|
80
|
+
error: `Channel "${notification.channel}" not configured`,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
let content = notification.content;
|
|
86
|
+
if (notification.template && this.templateService) {
|
|
87
|
+
content = await this.templateService.render(notification.template, notification.context ?? {});
|
|
88
|
+
}
|
|
89
|
+
if (this.repository) {
|
|
90
|
+
await this.repository.update(id, { status: 'sending', content });
|
|
91
|
+
}
|
|
92
|
+
let lastError;
|
|
93
|
+
for (const provider of providers) {
|
|
94
|
+
const result = await provider.send({ ...notification, content });
|
|
95
|
+
if (result.success) {
|
|
96
|
+
if (this.repository) {
|
|
97
|
+
await this.repository.update(id, {
|
|
98
|
+
status: 'sent',
|
|
99
|
+
messageId: result.messageId ?? null,
|
|
100
|
+
error: null,
|
|
101
|
+
sentAt: new Date(),
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
lastError = result.error;
|
|
107
|
+
}
|
|
108
|
+
if (this.repository) {
|
|
109
|
+
await this.repository.update(id, {
|
|
110
|
+
status: 'failed',
|
|
111
|
+
error: lastError ?? null,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
async onModuleDestroy() {
|
|
116
|
+
if (this.worker) {
|
|
117
|
+
await this.worker.close();
|
|
118
|
+
}
|
|
119
|
+
if (this.queue) {
|
|
120
|
+
await this.queue.close();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
exports.NotificationQueueService = NotificationQueueService;
|
|
125
|
+
exports.NotificationQueueService = NotificationQueueService = NotificationQueueService_1 = __decorate([
|
|
126
|
+
(0, common_1.Injectable)(),
|
|
127
|
+
__param(0, (0, common_1.Inject)(notification_constants_1.NOTIFICATION_CHANNELS)),
|
|
128
|
+
__param(1, (0, common_1.Inject)(notification_constants_1.NOTIFICATION_QUEUE_OPTIONS)),
|
|
129
|
+
__param(2, (0, common_1.Optional)()),
|
|
130
|
+
__param(2, (0, common_1.Inject)(notification_constants_1.NOTIFICATION_LOG_REPOSITORY)),
|
|
131
|
+
__param(3, (0, common_1.Optional)()),
|
|
132
|
+
__metadata("design:paramtypes", [Map, Object, Object, services_1.TemplateService])
|
|
133
|
+
], NotificationQueueService);
|
|
134
|
+
//# sourceMappingURL=notification-queue.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-queue.service.js","sourceRoot":"","sources":["../../../src/notification/queue/notification-queue.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,2CAOwB;AAGxB,sEAImC;AACnC,0CAA8C;AAevC,IAAM,wBAAwB,gCAA9B,MAAM,wBAAwB;IAQhB;IAEA;IAGA;IAEA;IAdF,MAAM,GAAG,IAAI,eAAM,CAAC,0BAAwB,CAAC,IAAI,CAAC,CAAC;IAC5D,KAAK,GAAQ,IAAI,CAAC;IAClB,MAAM,GAAQ,IAAI,CAAC;IACnB,WAAW,GAAG,KAAK,CAAC;IAE5B,YAEmB,QAA4C,EAE5C,WAAwB,EAGxB,UAAe,EAEf,eAAiC;QAPjC,aAAQ,GAAR,QAAQ,CAAoC;QAE5C,gBAAW,GAAX,WAAW,CAAa;QAGxB,eAAU,GAAV,UAAU,CAAK;QAEf,oBAAe,GAAf,eAAe,CAAkB;IACjD,CAAC;IAEJ,KAAK,CAAC,YAAY;QAChB,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC;QACjD,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC;QAEjE,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,IAAI,EAAE;YAC3B,UAAU;Y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AAA,iBAAQ,GAAE,CAAA;IACV,WAAA,IAAA,eAAM,EAAC,oDAA2B,CAAC,CAAA;IAEnC,WAAA,IAAA,iBAAQ,GAAE,CAAA;qCANgB,GAAG,kBAOK,0BAAe;GAfzC,wBAAwB,CAmIpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TemplateService } from './template.service';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TemplateService = void 0;
|
|
4
|
+
var template_service_1 = require("./template.service");
|
|
5
|
+
Object.defineProperty(exports, "TemplateService", { enumerable: true, get: function () { return template_service_1.TemplateService; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/notification/services/index.ts"],"names":[],"mappings":";;;AAAA,uDAAqD;AAA5C,mHAAA,eAAe,OAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface TemplateSource {
|
|
2
|
+
type: 'file' | 'string';
|
|
3
|
+
content: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class TemplateService {
|
|
6
|
+
private templatesDir?;
|
|
7
|
+
private handlebars;
|
|
8
|
+
private initPromise;
|
|
9
|
+
constructor(templatesDir?: string | undefined);
|
|
10
|
+
private ensureHandlebars;
|
|
11
|
+
render(templateName: string, context: Record<string, unknown>): Promise<string>;
|
|
12
|
+
private resolveTemplate;
|
|
13
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.TemplateService = void 0;
|
|
37
|
+
const fs = __importStar(require("node:fs"));
|
|
38
|
+
const path = __importStar(require("node:path"));
|
|
39
|
+
class TemplateService {
|
|
40
|
+
templatesDir;
|
|
41
|
+
handlebars = null;
|
|
42
|
+
initPromise = null;
|
|
43
|
+
constructor(templatesDir) {
|
|
44
|
+
this.templatesDir = templatesDir;
|
|
45
|
+
}
|
|
46
|
+
async ensureHandlebars() {
|
|
47
|
+
if (this.handlebars)
|
|
48
|
+
return;
|
|
49
|
+
if (this.initPromise)
|
|
50
|
+
return this.initPromise;
|
|
51
|
+
this.initPromise = (async () => {
|
|
52
|
+
const hbs = await import('handlebars');
|
|
53
|
+
this.handlebars = hbs.default;
|
|
54
|
+
})();
|
|
55
|
+
return this.initPromise;
|
|
56
|
+
}
|
|
57
|
+
async render(templateName, context) {
|
|
58
|
+
await this.ensureHandlebars();
|
|
59
|
+
const source = this.resolveTemplate(templateName);
|
|
60
|
+
const template = this.handlebars.compile(source.content);
|
|
61
|
+
return template(context);
|
|
62
|
+
}
|
|
63
|
+
resolveTemplate(templateName) {
|
|
64
|
+
if (this.templatesDir) {
|
|
65
|
+
const filePath = path.resolve(this.templatesDir, `${templateName}.hbs`);
|
|
66
|
+
if (fs.existsSync(filePath)) {
|
|
67
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
68
|
+
return { type: 'file', content };
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
throw new Error(`Template "${templateName}" not found${this.templatesDir ? ` in ${this.templatesDir}` : ''}`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.TemplateService = TemplateService;
|
|
75
|
+
//# sourceMappingURL=template.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.service.js","sourceRoot":"","sources":["../../../src/notification/services/template.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,4CAA8B;AAC9B,gDAAkC;AAOlC,MAAa,eAAe;IAIN;IAHZ,UAAU,GAAQ,IAAI,CAAC;IACvB,WAAW,GAAyB,IAAI,CAAC;IAEjD,YAAoB,YAAqB;QAArB,iBAAY,GAAZ,YAAY,CAAS;IAAG,CAAC;IAErC,KAAK,CAAC,gBAAgB;QAC5B,IAAI,IAAI,CAAC,UAAU;YAAE,OAAO;QAC5B,IAAI,IAAI,CAAC,WAAW;YAAE,OAAO,IAAI,CAAC,WAAW,CAAC;QAE9C,IAAI,CAAC,WAAW,GAAG,CAAC,KAAK,IAAI,EAAE;YAC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|
|
4
|
+
id: string;
|
|
5
|
+
to: string;
|
|
6
|
+
subject?: string;
|
|
7
|
+
body?: string;
|
|
8
|
+
template?: string;
|
|
9
|
+
channel?: string;
|
|
10
|
+
status: 'pending' | 'sent' | 'failed' | 'cancelled' | 'expired';
|
|
11
|
+
messageId?: string;
|
|
12
|
+
error?: string;
|
|
13
|
+
expiresAt?: string;
|
|
14
|
+
dedupId?: string;
|
|
15
|
+
createdAt: string;
|
|
16
|
+
sentAt?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface NotificationStorage {
|
|
19
|
+
save(record: NotificationRecord): Promise<void>;
|
|
20
|
+
update(recordId: string, updates: Partial<NotificationRecord>): Promise<void>;
|
|
21
|
+
findByDedupId(dedupId: string): Promise<NotificationRecord | null>;
|
|
22
|
+
}
|
|
23
|
+
export interface SendResult {
|
|
24
|
+
success: boolean;
|
|
25
|
+
messageId?: string;
|
|
26
|
+
error?: string;
|
|
27
|
+
jobId?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface NotificationTemplate {
|
|
30
|
+
subject?: string;
|
|
31
|
+
html?: string;
|
|
32
|
+
text?: string;
|
|
33
|
+
body?: string;
|
|
34
|
+
}
|
|
35
|
+
export declare function dynamicImport(name: string): Promise<Record<string, unknown>>;
|
|
36
|
+
export declare class TemplateService {
|
|
37
|
+
private templates;
|
|
38
|
+
loadFromDir(dir: string): Promise<void>;
|
|
39
|
+
loadFromRecord(templates: Record<string, NotificationTemplate>): void;
|
|
40
|
+
resolveName(name: string, locale: string): string;
|
|
41
|
+
hasTemplate(name: string): boolean;
|
|
42
|
+
render(name: string, context: Record<string, unknown>): string;
|
|
43
|
+
}
|
|
44
|
+
export declare class ConsoleNotificationStorage implements NotificationStorage {
|
|
45
|
+
save(record: NotificationRecord): Promise<void>;
|
|
46
|
+
update(recordId: string, updates: Partial<NotificationRecord>): Promise<void>;
|
|
47
|
+
findByDedupId(dedupId: string): Promise<NotificationRecord | null>;
|
|
48
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ConsoleNotificationStorage = exports.TemplateService = exports.NOTIFICATION_STORAGE = void 0;
|
|
7
|
+
exports.dynamicImport = dynamicImport;
|
|
8
|
+
const handlebars_1 = __importDefault(require("handlebars"));
|
|
9
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
10
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
11
|
+
exports.NOTIFICATION_STORAGE = 'NOTIFICATION_STORAGE';
|
|
12
|
+
async function dynamicImport(name) {
|
|
13
|
+
try {
|
|
14
|
+
return (await import(name));
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
const _require = eval('require');
|
|
18
|
+
return _require(name);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
async function walkDir(dir) {
|
|
22
|
+
const entries = await promises_1.default.readdir(dir, { withFileTypes: true });
|
|
23
|
+
const files = [];
|
|
24
|
+
for (const entry of entries) {
|
|
25
|
+
const fullPath = node_path_1.default.join(dir, entry.name);
|
|
26
|
+
if (entry.isDirectory()) {
|
|
27
|
+
files.push(...(await walkDir(fullPath)));
|
|
28
|
+
}
|
|
29
|
+
else if (entry.isFile() && entry.name.endsWith('.hbs')) {
|
|
30
|
+
files.push(fullPath);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return files;
|
|
34
|
+
}
|
|
35
|
+
class TemplateService {
|
|
36
|
+
templates = new Map();
|
|
37
|
+
async loadFromDir(dir) {
|
|
38
|
+
const files = await walkDir(dir);
|
|
39
|
+
for (const fullPath of files) {
|
|
40
|
+
const relativePath = node_path_1.default.relative(dir, fullPath);
|
|
41
|
+
const name = relativePath.replace(/\.hbs$/, '').replace(/\\/g, '/');
|
|
42
|
+
const content = await promises_1.default.readFile(fullPath, 'utf-8');
|
|
43
|
+
this.templates.set(name, handlebars_1.default.compile(content));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
loadFromRecord(templates) {
|
|
47
|
+
for (const [name, tmpl] of Object.entries(templates)) {
|
|
48
|
+
if (tmpl.subject)
|
|
49
|
+
this.templates.set(`subject:${name}`, handlebars_1.default.compile(tmpl.subject));
|
|
50
|
+
if (tmpl.html)
|
|
51
|
+
this.templates.set(`html:${name}`, handlebars_1.default.compile(tmpl.html));
|
|
52
|
+
if (tmpl.text)
|
|
53
|
+
this.templates.set(`text:${name}`, handlebars_1.default.compile(tmpl.text));
|
|
54
|
+
if (tmpl.body)
|
|
55
|
+
this.templates.set(`body:${name}`, handlebars_1.default.compile(tmpl.body));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
resolveName(name, locale) {
|
|
59
|
+
const localeKey = `${name}.${locale}`;
|
|
60
|
+
if (this.templates.has(`html:${localeKey}`) ||
|
|
61
|
+
this.templates.has(`body:${localeKey}`))
|
|
62
|
+
return localeKey;
|
|
63
|
+
const dirKey = `${locale}/${name}`;
|
|
64
|
+
if (this.templates.has(`html:${dirKey}`) ||
|
|
65
|
+
this.templates.has(`body:${dirKey}`))
|
|
66
|
+
return dirKey;
|
|
67
|
+
return name;
|
|
68
|
+
}
|
|
69
|
+
hasTemplate(name) {
|
|
70
|
+
return this.templates.has(name);
|
|
71
|
+
}
|
|
72
|
+
render(name, context) {
|
|
73
|
+
const tmpl = this.templates.get(name);
|
|
74
|
+
if (!tmpl)
|
|
75
|
+
return '';
|
|
76
|
+
return tmpl(context);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.TemplateService = TemplateService;
|
|
80
|
+
class ConsoleNotificationStorage {
|
|
81
|
+
save(record) {
|
|
82
|
+
console.log('[NotificationStorage] Save:', JSON.stringify(record));
|
|
83
|
+
return Promise.resolve();
|
|
84
|
+
}
|
|
85
|
+
update(recordId, updates) {
|
|
86
|
+
console.log(`[NotificationStorage] Update ${recordId}:`, JSON.stringify(updates));
|
|
87
|
+
return Promise.resolve();
|
|
88
|
+
}
|
|
89
|
+
findByDedupId(dedupId) {
|
|
90
|
+
void dedupId;
|
|
91
|
+
return Promise.resolve(null);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.ConsoleNotificationStorage = ConsoleNotificationStorage;
|
|
95
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/notification/shared.ts"],"names":[],"mappings":";;;;;;AA4CA,sCASC;AArDD,4DAAoC;AACpC,gEAAkC;AAClC,0DAA6B;AAEhB,QAAA,oBAAoB,GAAG,sBAAsB,CAAC;AAwCpD,KAAK,UAAU,aAAa,CACjC,IAAY;IAEZ,IAAI,CAAC;QACH,OAAO,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,CAA4B,CAAC;IACzD,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAA4C,CAAC;QAC5E,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;AACH,CAAC;AAED,KAAK,UAAU,OAAO,CAAC,GAAW;IAChC,MAAM,OAAO,GAAG,MAAM,kBAAE,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/D,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,QAAQ,GAAG,mBAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC3C,CAAC;a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