intelica-library-notification 20.0.1
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,535 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, Injectable } from '@angular/core';
|
|
3
|
+
import { ConfigService } from 'intelica-library-base';
|
|
4
|
+
import * as i1 from '@angular/common/http';
|
|
5
|
+
import { map, catchError, of, Subject, BehaviorSubject, firstValueFrom } from 'rxjs';
|
|
6
|
+
import * as signalR from '@microsoft/signalr';
|
|
7
|
+
|
|
8
|
+
class NotificationService {
|
|
9
|
+
http;
|
|
10
|
+
configService = inject(ConfigService);
|
|
11
|
+
path = `${this.configService.environment?.notificationsPath}/Notifications`;
|
|
12
|
+
constructor(http) {
|
|
13
|
+
this.http = http;
|
|
14
|
+
}
|
|
15
|
+
getUserNotificacions() {
|
|
16
|
+
return this.http.get(`${this.path}/users/notifications`);
|
|
17
|
+
}
|
|
18
|
+
markAsRead(recipientId) {
|
|
19
|
+
return this.http.put(`${this.path}/users/recipients/${recipientId}/read`, {});
|
|
20
|
+
}
|
|
21
|
+
markAllAsRead() {
|
|
22
|
+
return this.http.put(`${this.path}/users/recipients/read/all`, {});
|
|
23
|
+
}
|
|
24
|
+
markAsHidden(recipientId) {
|
|
25
|
+
return this.http.put(`${this.path}/users/recipients/${recipientId}/hidden`, {});
|
|
26
|
+
}
|
|
27
|
+
htmlPreview(request) {
|
|
28
|
+
return this.http.post(`${this.path}/html/preview`, request, { responseType: "text" });
|
|
29
|
+
}
|
|
30
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: NotificationService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
31
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: NotificationService, providedIn: "root" });
|
|
32
|
+
}
|
|
33
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: NotificationService, decorators: [{
|
|
34
|
+
type: Injectable,
|
|
35
|
+
args: [{ providedIn: "root" }]
|
|
36
|
+
}], ctorParameters: () => [{ type: i1.HttpClient }] });
|
|
37
|
+
|
|
38
|
+
class NotificationJobService {
|
|
39
|
+
http;
|
|
40
|
+
configService = inject(ConfigService);
|
|
41
|
+
path = `${this.configService.environment?.notificationsPath}/NotificationJobs`;
|
|
42
|
+
constructor(http) {
|
|
43
|
+
this.http = http;
|
|
44
|
+
}
|
|
45
|
+
createJobNotifications(payload) {
|
|
46
|
+
return this.http.post(`${this.path}/notifications`, payload, {});
|
|
47
|
+
}
|
|
48
|
+
createJob(payload) {
|
|
49
|
+
return this.http.post(`${this.path}`, payload, {});
|
|
50
|
+
}
|
|
51
|
+
getJob(jobId) {
|
|
52
|
+
return this.http.get(`${this.path}/${jobId}`);
|
|
53
|
+
}
|
|
54
|
+
createNotifications(jobId, payload) {
|
|
55
|
+
return this.http.post(`${this.path}/${jobId}/notifications`, payload, {});
|
|
56
|
+
}
|
|
57
|
+
getActiveJob(featureCode, origin) {
|
|
58
|
+
let url = `${this.path}/active?featureCode=${encodeURIComponent(featureCode)}`;
|
|
59
|
+
if (origin) {
|
|
60
|
+
url += `&origin=${encodeURIComponent(origin)}`;
|
|
61
|
+
}
|
|
62
|
+
return this.http.get(url, {}).pipe(map(list => (Array.isArray(list) && list.length > 0 ? list[0] : null)), catchError(err => {
|
|
63
|
+
console.error("Error obteniendo active jobs", err);
|
|
64
|
+
return of(null);
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
getRecipients(jobId) {
|
|
68
|
+
return this.http.get(`${this.path}/${jobId}/recipients`, {});
|
|
69
|
+
}
|
|
70
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: NotificationJobService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
71
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: NotificationJobService, providedIn: "root" });
|
|
72
|
+
}
|
|
73
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: NotificationJobService, decorators: [{
|
|
74
|
+
type: Injectable,
|
|
75
|
+
args: [{ providedIn: "root" }]
|
|
76
|
+
}], ctorParameters: () => [{ type: i1.HttpClient }] });
|
|
77
|
+
|
|
78
|
+
class NotificationSignalRService {
|
|
79
|
+
zone;
|
|
80
|
+
configService = inject(ConfigService);
|
|
81
|
+
path = `${this.configService.environment?.signalPath}/websocket`;
|
|
82
|
+
hubConnection;
|
|
83
|
+
startPromise;
|
|
84
|
+
joinedGroups = new Set();
|
|
85
|
+
notificationSendSubject = new Subject();
|
|
86
|
+
notificationSend$ = this.notificationSendSubject.asObservable();
|
|
87
|
+
jobProgressSubject = new Subject();
|
|
88
|
+
jobProgress$ = this.jobProgressSubject.asObservable();
|
|
89
|
+
callbackResultSubject = new Subject();
|
|
90
|
+
callbackResult$ = this.callbackResultSubject.asObservable();
|
|
91
|
+
constructor(zone) {
|
|
92
|
+
this.zone = zone;
|
|
93
|
+
}
|
|
94
|
+
startConnection() {
|
|
95
|
+
if (this.startPromise)
|
|
96
|
+
return this.startPromise;
|
|
97
|
+
this.hubConnection = new signalR.HubConnectionBuilder().withUrl(this.path).withAutomaticReconnect().build();
|
|
98
|
+
this.hubConnection.keepAliveIntervalInMilliseconds = 15_000;
|
|
99
|
+
this.hubConnection.serverTimeoutInMilliseconds = 120_000;
|
|
100
|
+
this.registerListeners();
|
|
101
|
+
this.registerReconnectHandlers();
|
|
102
|
+
this.startPromise = this.hubConnection.start().catch(err => {
|
|
103
|
+
console.error("Error starting SignalR connection", err);
|
|
104
|
+
this.startPromise = undefined;
|
|
105
|
+
throw err;
|
|
106
|
+
});
|
|
107
|
+
return this.startPromise;
|
|
108
|
+
}
|
|
109
|
+
async joinScope(scopeType, scopeId) {
|
|
110
|
+
await this.startConnection();
|
|
111
|
+
if (!this.hubConnection)
|
|
112
|
+
return;
|
|
113
|
+
const groupName = `${scopeType}-${scopeId}`;
|
|
114
|
+
if (this.joinedGroups.has(groupName))
|
|
115
|
+
return;
|
|
116
|
+
await this.hubConnection.invoke("Connect", groupName);
|
|
117
|
+
this.joinedGroups.add(groupName);
|
|
118
|
+
}
|
|
119
|
+
async leaveScope(scopeType, scopeId) {
|
|
120
|
+
if (!this.hubConnection)
|
|
121
|
+
return;
|
|
122
|
+
const groupName = `${scopeType}-${scopeId}`;
|
|
123
|
+
if (!this.joinedGroups.has(groupName))
|
|
124
|
+
return;
|
|
125
|
+
await this.hubConnection.invoke("Disconnect", groupName);
|
|
126
|
+
this.joinedGroups.delete(groupName);
|
|
127
|
+
}
|
|
128
|
+
async stopConnection() {
|
|
129
|
+
if (!this.hubConnection)
|
|
130
|
+
return;
|
|
131
|
+
try {
|
|
132
|
+
await this.hubConnection.stop();
|
|
133
|
+
}
|
|
134
|
+
finally {
|
|
135
|
+
this.joinedGroups.clear();
|
|
136
|
+
this.hubConnection = undefined;
|
|
137
|
+
this.startPromise = undefined;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
registerListeners() {
|
|
141
|
+
if (!this.hubConnection)
|
|
142
|
+
return;
|
|
143
|
+
this.hubConnection.on("NotificationSend", (raw) => {
|
|
144
|
+
this.zone.run(() => {
|
|
145
|
+
const data = JSON.parse(raw);
|
|
146
|
+
this.notificationSendSubject.next(data);
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
this.hubConnection.on("JobProgress", (raw) => {
|
|
150
|
+
this.zone.run(() => {
|
|
151
|
+
const data = JSON.parse(raw);
|
|
152
|
+
this.jobProgressSubject.next(data);
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
this.hubConnection.on("CallbackResult", (raw) => {
|
|
156
|
+
this.zone.run(() => {
|
|
157
|
+
const data = JSON.parse(raw);
|
|
158
|
+
this.callbackResultSubject.next(data);
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
this.hubConnection.on("Connect", (_msg) => { });
|
|
162
|
+
}
|
|
163
|
+
registerReconnectHandlers() {
|
|
164
|
+
if (!this.hubConnection)
|
|
165
|
+
return;
|
|
166
|
+
this.hubConnection.onreconnected(async () => {
|
|
167
|
+
try {
|
|
168
|
+
for (const groupName of this.joinedGroups) {
|
|
169
|
+
await this.hubConnection.invoke("Connect", groupName);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
catch (e) {
|
|
173
|
+
console.error("Error rejoining groups after reconnection", e);
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
this.hubConnection.onclose(() => {
|
|
177
|
+
this.startPromise = undefined;
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: NotificationSignalRService, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
181
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: NotificationSignalRService, providedIn: "root" });
|
|
182
|
+
}
|
|
183
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: NotificationSignalRService, decorators: [{
|
|
184
|
+
type: Injectable,
|
|
185
|
+
args: [{ providedIn: "root" }]
|
|
186
|
+
}], ctorParameters: () => [{ type: i0.NgZone }] });
|
|
187
|
+
|
|
188
|
+
class NotificationOrchestratorService {
|
|
189
|
+
jobService;
|
|
190
|
+
notificationService;
|
|
191
|
+
signalR;
|
|
192
|
+
origin;
|
|
193
|
+
featureCode;
|
|
194
|
+
currentJobId;
|
|
195
|
+
subscribedJobId;
|
|
196
|
+
jobStateSubject = new BehaviorSubject({
|
|
197
|
+
status: "pending",
|
|
198
|
+
processedCount: 0,
|
|
199
|
+
totalCount: 0,
|
|
200
|
+
processedNotificationsCount: 0,
|
|
201
|
+
totalNotificationsCount: 0,
|
|
202
|
+
});
|
|
203
|
+
jobState$ = this.jobStateSubject.asObservable();
|
|
204
|
+
dispatchErrorsMapSubject = new BehaviorSubject(new Map());
|
|
205
|
+
dispatchErrors$ = this.dispatchErrorsMapSubject.asObservable();
|
|
206
|
+
callbackRawSubject = new Subject();
|
|
207
|
+
callbackRaw$ = this.callbackRawSubject.asObservable();
|
|
208
|
+
jobProgressSubjects = new Map();
|
|
209
|
+
jobWatchRefCount = new Map();
|
|
210
|
+
userInboxSubjects = new Map();
|
|
211
|
+
userWatchRefCount = new Map();
|
|
212
|
+
initInFlight;
|
|
213
|
+
constructor(jobService, notificationService, signalR) {
|
|
214
|
+
this.jobService = jobService;
|
|
215
|
+
this.notificationService = notificationService;
|
|
216
|
+
this.signalR = signalR;
|
|
217
|
+
this.signalR.jobProgress$.subscribe(update => this.onJobProgress(update));
|
|
218
|
+
this.signalR.callbackResult$.subscribe(update => this.onCallbackResult(update));
|
|
219
|
+
this.signalR.notificationSend$.subscribe(update => this.onNotificationSend(update));
|
|
220
|
+
}
|
|
221
|
+
async watchUserInbox(userId) {
|
|
222
|
+
if (!userId)
|
|
223
|
+
throw new Error("userId is required");
|
|
224
|
+
const current = this.userWatchRefCount.get(userId) ?? 0;
|
|
225
|
+
this.userWatchRefCount.set(userId, current + 1);
|
|
226
|
+
await this.signalR.joinScope("user", userId);
|
|
227
|
+
return this.userInbox$(userId);
|
|
228
|
+
}
|
|
229
|
+
async unwatchUserInbox(userId) {
|
|
230
|
+
if (!userId)
|
|
231
|
+
return;
|
|
232
|
+
const current = this.userWatchRefCount.get(userId) ?? 0;
|
|
233
|
+
if (current <= 1) {
|
|
234
|
+
this.userWatchRefCount.delete(userId);
|
|
235
|
+
await this.signalR.leaveScope("user", userId);
|
|
236
|
+
const subj = this.userInboxSubjects.get(userId);
|
|
237
|
+
if (subj) {
|
|
238
|
+
subj.complete();
|
|
239
|
+
this.userInboxSubjects.delete(userId);
|
|
240
|
+
}
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
this.userWatchRefCount.set(userId, current - 1);
|
|
244
|
+
}
|
|
245
|
+
userInbox$(userId) {
|
|
246
|
+
let subj = this.userInboxSubjects.get(userId);
|
|
247
|
+
if (!subj) {
|
|
248
|
+
subj = new Subject();
|
|
249
|
+
this.userInboxSubjects.set(userId, subj);
|
|
250
|
+
}
|
|
251
|
+
return subj.asObservable();
|
|
252
|
+
}
|
|
253
|
+
async watchJobProgress(jobId) {
|
|
254
|
+
if (!jobId)
|
|
255
|
+
throw new Error("jobId is required");
|
|
256
|
+
const current = this.jobWatchRefCount.get(jobId) ?? 0;
|
|
257
|
+
this.jobWatchRefCount.set(jobId, current + 1);
|
|
258
|
+
await this.signalR.joinScope("job", jobId);
|
|
259
|
+
return this.jobProgress$(jobId);
|
|
260
|
+
}
|
|
261
|
+
async unwatchJobProgress(jobId) {
|
|
262
|
+
if (!jobId)
|
|
263
|
+
return;
|
|
264
|
+
const current = this.jobWatchRefCount.get(jobId) ?? 0;
|
|
265
|
+
if (current <= 1) {
|
|
266
|
+
this.jobWatchRefCount.delete(jobId);
|
|
267
|
+
await this.signalR.leaveScope("job", jobId);
|
|
268
|
+
const subj = this.jobProgressSubjects.get(jobId);
|
|
269
|
+
if (subj) {
|
|
270
|
+
subj.complete();
|
|
271
|
+
this.jobProgressSubjects.delete(jobId);
|
|
272
|
+
}
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
this.jobWatchRefCount.set(jobId, current - 1);
|
|
276
|
+
}
|
|
277
|
+
jobProgress$(jobId) {
|
|
278
|
+
let subj = this.jobProgressSubjects.get(jobId);
|
|
279
|
+
if (!subj) {
|
|
280
|
+
subj = new Subject();
|
|
281
|
+
this.jobProgressSubjects.set(jobId, subj);
|
|
282
|
+
}
|
|
283
|
+
return subj.asObservable();
|
|
284
|
+
}
|
|
285
|
+
rehydrateScope(origin, featureCode) {
|
|
286
|
+
this.origin = origin;
|
|
287
|
+
this.featureCode = featureCode;
|
|
288
|
+
if (this.initInFlight)
|
|
289
|
+
return this.initInFlight;
|
|
290
|
+
this.initInFlight = (async () => {
|
|
291
|
+
try {
|
|
292
|
+
await this.rehydrateActiveJobInternal();
|
|
293
|
+
}
|
|
294
|
+
finally {
|
|
295
|
+
this.initInFlight = undefined;
|
|
296
|
+
}
|
|
297
|
+
})();
|
|
298
|
+
return this.initInFlight;
|
|
299
|
+
}
|
|
300
|
+
getCurrentJobId() {
|
|
301
|
+
return this.currentJobId;
|
|
302
|
+
}
|
|
303
|
+
getJobStateSnapshot() {
|
|
304
|
+
return this.jobStateSubject.value;
|
|
305
|
+
}
|
|
306
|
+
async ensureActiveOrCreateJobNotifications(notificationDraft) {
|
|
307
|
+
if (!this.origin || !this.featureCode)
|
|
308
|
+
throw new Error("Scope not initialized. Call rehydrateScope(featureCode, origin) first.");
|
|
309
|
+
if (this.currentJobId) {
|
|
310
|
+
return { jobId: this.currentJobId, mode: "active" };
|
|
311
|
+
}
|
|
312
|
+
const jobPayload = {
|
|
313
|
+
featureCode: this.featureCode,
|
|
314
|
+
origin: this.origin,
|
|
315
|
+
totalCount: notificationDraft?.length ?? 0,
|
|
316
|
+
totalNotificationsCount: notificationDraft?.filter(n => n.recipients?.some(r => r.isRequiredForProcessed)).length ?? 0,
|
|
317
|
+
};
|
|
318
|
+
const job = await firstValueFrom(this.jobService.createJob(jobPayload));
|
|
319
|
+
this.currentJobId = job.jobId;
|
|
320
|
+
this.setJobState({
|
|
321
|
+
jobId: this.currentJobId,
|
|
322
|
+
status: "pending",
|
|
323
|
+
processedCount: 0,
|
|
324
|
+
totalCount: jobPayload.totalCount,
|
|
325
|
+
processedNotificationsCount: 0,
|
|
326
|
+
totalNotificationsCount: jobPayload.totalNotificationsCount,
|
|
327
|
+
});
|
|
328
|
+
await this.subscribeToJob(this.currentJobId);
|
|
329
|
+
const notifications = notificationDraft.map(draft => ({
|
|
330
|
+
originReference: `${draft.originReference}-${job.jobId}`,
|
|
331
|
+
notificationTypeCode: draft.notificationTypeCode,
|
|
332
|
+
destination: draft.destination,
|
|
333
|
+
destinationLabel: draft.destinationLabel,
|
|
334
|
+
bucketName: draft.bucketName,
|
|
335
|
+
templateName: draft.templateName,
|
|
336
|
+
templateData: draft.templateData,
|
|
337
|
+
priorityCode: draft.priorityCode,
|
|
338
|
+
title: draft.title,
|
|
339
|
+
body: draft.body,
|
|
340
|
+
metaData: draft.metaData,
|
|
341
|
+
recipients: draft.recipients,
|
|
342
|
+
actions: draft.actions,
|
|
343
|
+
attachments: draft.attachments,
|
|
344
|
+
callbacks: draft.callbacks,
|
|
345
|
+
}));
|
|
346
|
+
await firstValueFrom(this.jobService.createNotifications(job.jobId, notifications));
|
|
347
|
+
return { jobId: this.currentJobId, mode: "created" };
|
|
348
|
+
}
|
|
349
|
+
async ensureCreateJobNotifications(origin, featureCode, notificationDraft) {
|
|
350
|
+
if (!origin || !featureCode)
|
|
351
|
+
throw new Error("Scope not initialized.");
|
|
352
|
+
const jobPayload = {
|
|
353
|
+
featureCode: featureCode,
|
|
354
|
+
origin: origin,
|
|
355
|
+
totalCount: 1,
|
|
356
|
+
totalNotificationsCount: 1,
|
|
357
|
+
notifications: notificationDraft.map(draft => ({
|
|
358
|
+
originReference: draft.originReference,
|
|
359
|
+
notificationTypeCode: draft.notificationTypeCode,
|
|
360
|
+
destination: draft.destination,
|
|
361
|
+
destinationLabel: draft.destinationLabel,
|
|
362
|
+
bucketName: draft.bucketName,
|
|
363
|
+
templateName: draft.templateName,
|
|
364
|
+
templateData: draft.templateData,
|
|
365
|
+
priorityCode: draft.priorityCode,
|
|
366
|
+
title: draft.title,
|
|
367
|
+
body: draft.body,
|
|
368
|
+
metaData: draft.metaData,
|
|
369
|
+
recipients: draft.recipients,
|
|
370
|
+
actions: draft.actions,
|
|
371
|
+
attachments: draft.attachments,
|
|
372
|
+
callbacks: draft.callbacks,
|
|
373
|
+
})),
|
|
374
|
+
};
|
|
375
|
+
await firstValueFrom(this.jobService.createJobNotifications(jobPayload));
|
|
376
|
+
}
|
|
377
|
+
async markAsRead(recipientId) {
|
|
378
|
+
return firstValueFrom(this.notificationService.markAsRead(recipientId));
|
|
379
|
+
}
|
|
380
|
+
async markAllAsRead() {
|
|
381
|
+
return firstValueFrom(this.notificationService.markAllAsRead());
|
|
382
|
+
}
|
|
383
|
+
async markAsHidden(recipientId) {
|
|
384
|
+
return firstValueFrom(this.notificationService.markAsHidden(recipientId));
|
|
385
|
+
}
|
|
386
|
+
async htmlPreview(request) {
|
|
387
|
+
return firstValueFrom(this.notificationService.htmlPreview(request));
|
|
388
|
+
}
|
|
389
|
+
async getUserNotificacions() {
|
|
390
|
+
return firstValueFrom(this.notificationService.getUserNotificacions());
|
|
391
|
+
}
|
|
392
|
+
resetLocal() {
|
|
393
|
+
this.currentJobId = undefined;
|
|
394
|
+
this.setJobState({ status: "pending", processedCount: 0, totalCount: 0, processedNotificationsCount: 0, totalNotificationsCount: 0 });
|
|
395
|
+
this.dispatchErrorsMapSubject.next(new Map());
|
|
396
|
+
}
|
|
397
|
+
async rehydrateActiveJobInternal() {
|
|
398
|
+
if (!this.featureCode || !this.origin)
|
|
399
|
+
return;
|
|
400
|
+
const active = await firstValueFrom(this.jobService.getActiveJob(this.featureCode, this.origin));
|
|
401
|
+
if (!active) {
|
|
402
|
+
this.currentJobId = undefined;
|
|
403
|
+
this.setJobState({ status: "idle", processedCount: 0, totalCount: 0, processedNotificationsCount: 0, totalNotificationsCount: 0 });
|
|
404
|
+
this.dispatchErrorsMapSubject.next(new Map());
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
this.currentJobId = active.jobId;
|
|
408
|
+
this.setJobState({
|
|
409
|
+
jobId: active.jobId,
|
|
410
|
+
status: active.statusCode?.toLowerCase() || "running",
|
|
411
|
+
processedCount: active.processedCount ?? 0,
|
|
412
|
+
totalCount: active.totalCount ?? 0,
|
|
413
|
+
processedNotificationsCount: active.processedNotificationsCount ?? 0,
|
|
414
|
+
totalNotificationsCount: active.totalNotificationsCount ?? 0,
|
|
415
|
+
});
|
|
416
|
+
const recipients = await firstValueFrom(this.jobService.getRecipients(active.jobId));
|
|
417
|
+
const map = new Map();
|
|
418
|
+
for (const r of recipients) {
|
|
419
|
+
if (r.recipientId && r.statusCode === "failed") {
|
|
420
|
+
map.set(r.recipientId, {
|
|
421
|
+
recipientId: r.recipientId,
|
|
422
|
+
lastErrorMessage: r.lastErrorMessage ?? null,
|
|
423
|
+
channelCode: r.channelCode || undefined,
|
|
424
|
+
statusCode: r.statusCode,
|
|
425
|
+
attempts: r.attempts,
|
|
426
|
+
lastAttemptAt: r.lastAttemptAt ?? null,
|
|
427
|
+
userId: r.userId ?? null,
|
|
428
|
+
clientId: r.clientId ?? null,
|
|
429
|
+
groupId: r.groupId ?? null,
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
this.dispatchErrorsMapSubject.next(map);
|
|
434
|
+
await this.subscribeToJob(active.jobId);
|
|
435
|
+
}
|
|
436
|
+
async subscribeToJob(jobId) {
|
|
437
|
+
if (this.subscribedJobId && this.subscribedJobId !== jobId) {
|
|
438
|
+
await this.signalR.leaveScope("job", this.subscribedJobId);
|
|
439
|
+
await this.signalR.leaveScope("callBack", this.subscribedJobId);
|
|
440
|
+
}
|
|
441
|
+
this.subscribedJobId = jobId;
|
|
442
|
+
await this.signalR.joinScope("job", jobId);
|
|
443
|
+
await this.signalR.joinScope("callBack", jobId);
|
|
444
|
+
}
|
|
445
|
+
onNotificationSend(update) {
|
|
446
|
+
if (update.userId) {
|
|
447
|
+
this.userInboxSubjects.get(update.userId)?.next(update);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
onJobProgress(update) {
|
|
451
|
+
if (update.jobId) {
|
|
452
|
+
this.jobProgressSubjects.get(update.jobId)?.next(update);
|
|
453
|
+
}
|
|
454
|
+
if (!this.currentJobId || update.jobId !== this.currentJobId)
|
|
455
|
+
return;
|
|
456
|
+
if (update.recipientId) {
|
|
457
|
+
const current = this.dispatchErrorsMapSubject.value;
|
|
458
|
+
const next = new Map(current);
|
|
459
|
+
if ((update.jobStatusCode ?? "").toLowerCase() === "failed") {
|
|
460
|
+
next.set(update.recipientId, {
|
|
461
|
+
recipientId: update.recipientId,
|
|
462
|
+
lastErrorMessage: update.lastErrorMessage ?? null,
|
|
463
|
+
notificationId: update.notificationId,
|
|
464
|
+
jobId: update.jobId ?? null,
|
|
465
|
+
channelCode: update.channelCode,
|
|
466
|
+
statusCode: update.jobStatusCode,
|
|
467
|
+
attempts: update.attempts,
|
|
468
|
+
lastAttemptAt: update.lastAttemptAt ?? null,
|
|
469
|
+
userId: update.userId ?? null,
|
|
470
|
+
clientId: update.clientId ?? null,
|
|
471
|
+
groupId: update.groupId ?? null,
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
else {
|
|
475
|
+
next.delete(update.recipientId);
|
|
476
|
+
}
|
|
477
|
+
this.dispatchErrorsMapSubject.next(next);
|
|
478
|
+
}
|
|
479
|
+
if (typeof update.jobProcessedCount === "number" && typeof update.jobTotalCount === "number") {
|
|
480
|
+
this.setJobState({
|
|
481
|
+
jobId: update.jobId,
|
|
482
|
+
status: update.jobStatusCode?.toLowerCase(),
|
|
483
|
+
processedCount: update.jobProcessedCount,
|
|
484
|
+
totalCount: update.jobTotalCount,
|
|
485
|
+
processedNotificationsCount: update.jobProcessedNotificationsCount,
|
|
486
|
+
totalNotificationsCount: update.jobTotalNotificationsCount,
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
if (update.jobStatusCode?.toLowerCase() === "completed") {
|
|
490
|
+
this.setJobState({
|
|
491
|
+
jobId: this.jobStateSubject.value.jobId,
|
|
492
|
+
status: this.jobStateSubject.value.status,
|
|
493
|
+
processedCount: this.jobStateSubject.value.processedCount,
|
|
494
|
+
totalCount: this.jobStateSubject.value.totalCount,
|
|
495
|
+
processedNotificationsCount: this.jobStateSubject.value.processedNotificationsCount,
|
|
496
|
+
totalNotificationsCount: this.jobStateSubject.value.totalNotificationsCount,
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
else if (this.jobStateSubject.value.status === "pending") {
|
|
500
|
+
this.setJobState({ ...this.jobStateSubject.value, status: "pending" });
|
|
501
|
+
}
|
|
502
|
+
else if (this.jobStateSubject.value.status === "running") {
|
|
503
|
+
this.setJobState({ ...this.jobStateSubject.value, status: "running" });
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
onCallbackResult(update) {
|
|
507
|
+
this.callbackRawSubject.next(update);
|
|
508
|
+
}
|
|
509
|
+
setJobState(state) {
|
|
510
|
+
this.jobStateSubject.next({
|
|
511
|
+
jobId: state.jobId,
|
|
512
|
+
status: state.status,
|
|
513
|
+
processedCount: state.processedCount,
|
|
514
|
+
totalCount: state.totalCount,
|
|
515
|
+
processedNotificationsCount: state.processedNotificationsCount,
|
|
516
|
+
totalNotificationsCount: state.totalNotificationsCount,
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: NotificationOrchestratorService, deps: [{ token: NotificationJobService }, { token: NotificationService }, { token: NotificationSignalRService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
520
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: NotificationOrchestratorService, providedIn: "root" });
|
|
521
|
+
}
|
|
522
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: NotificationOrchestratorService, decorators: [{
|
|
523
|
+
type: Injectable,
|
|
524
|
+
args: [{ providedIn: "root" }]
|
|
525
|
+
}], ctorParameters: () => [{ type: NotificationJobService }, { type: NotificationService }, { type: NotificationSignalRService }] });
|
|
526
|
+
|
|
527
|
+
// Public API Surface of intelica-library-notification
|
|
528
|
+
//DTOs
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* Generated bundle index. Do not edit.
|
|
532
|
+
*/
|
|
533
|
+
|
|
534
|
+
export { NotificationJobService, NotificationOrchestratorService, NotificationService, NotificationSignalRService };
|
|
535
|
+
//# sourceMappingURL=intelica-library-notification.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intelica-library-notification.mjs","sources":["../../../projects/intelica-library-notification/src/lib/notification.service.ts","../../../projects/intelica-library-notification/src/lib/notification-job.service.ts","../../../projects/intelica-library-notification/src/lib/notification-signalr.service.ts","../../../projects/intelica-library-notification/src/lib/notificacion-orchestrator.service.ts","../../../projects/intelica-library-notification/src/public-api.ts","../../../projects/intelica-library-notification/src/intelica-library-notification.ts"],"sourcesContent":["import { inject, Injectable } from \"@angular/core\";\nimport { HttpClient } from \"@angular/common/http\";\nimport { Observable } from \"rxjs\";\nimport { ConfigService } from \"intelica-library-base\";\nimport { NotificationRecipientSummaryResponse } from \"./dto/notification-response.dto\";\nimport { UserNotificationInboxItem } from \"./dto/notification-inbox-response.dto\";\nimport { HtmlPreviewBucket } from \"./dto/notification-request.dto\";\n\n@Injectable({ providedIn: \"root\" })\nexport class NotificationService {\n\tprivate readonly configService = inject(ConfigService);\n\tprivate readonly path = `${this.configService.environment?.notificationsPath}/Notifications`;\n\n\tconstructor(private http: HttpClient) {}\n\n\tgetUserNotificacions(): Observable<UserNotificationInboxItem[]> {\n\t\treturn this.http.get<UserNotificationInboxItem[]>(`${this.path}/users/notifications`);\n\t}\n\n\tmarkAsRead(recipientId: string): Observable<NotificationRecipientSummaryResponse> {\n\t\treturn this.http.put<NotificationRecipientSummaryResponse>(`${this.path}/users/recipients/${recipientId}/read`, {});\n\t}\n\n\tmarkAllAsRead(): Observable<NotificationRecipientSummaryResponse[]> {\n\t\treturn this.http.put<NotificationRecipientSummaryResponse[]>(`${this.path}/users/recipients/read/all`, {});\n\t}\n\n\tmarkAsHidden(recipientId: string): Observable<NotificationRecipientSummaryResponse> {\n\t\treturn this.http.put<NotificationRecipientSummaryResponse>(`${this.path}/users/recipients/${recipientId}/hidden`, {});\n\t}\n\n\thtmlPreview(request: HtmlPreviewBucket): Observable<string> {\n\t\treturn this.http.post(`${this.path}/html/preview`, request, { responseType: \"text\" });\n\t}\n}\n","import { inject, Injectable } from \"@angular/core\";\nimport { HttpClient } from \"@angular/common/http\";\nimport { ConfigService } from \"intelica-library-base\";\nimport { catchError, map, Observable, of } from \"rxjs\";\nimport { NotificationJobResponse, NotificationRecipientSummaryResponse, NotificationResponse } from \"./dto/notification-response.dto\";\nimport { CreateNotificationJobRequest, CreateNotificationsForJobRequest } from \"./dto/notification-request.dto\";\n\n@Injectable({ providedIn: \"root\" })\nexport class NotificationJobService {\n\tprivate readonly configService = inject(ConfigService);\n\tprivate readonly path = `${this.configService.environment?.notificationsPath}/NotificationJobs`;\n\n\tconstructor(private http: HttpClient) {}\n\n\tcreateJobNotifications(payload: CreateNotificationJobRequest): Observable<NotificationJobResponse> {\n\t\treturn this.http.post<NotificationJobResponse>(`${this.path}/notifications`, payload, {});\n\t}\n\n\tcreateJob(payload: CreateNotificationJobRequest): Observable<NotificationJobResponse> {\n\t\treturn this.http.post<NotificationJobResponse>(`${this.path}`, payload, {});\n\t}\n\n\tgetJob(jobId: string): Observable<NotificationJobResponse> {\n\t\treturn this.http.get<NotificationJobResponse>(`${this.path}/${jobId}`);\n\t}\n\n\tcreateNotifications(jobId: string, payload: CreateNotificationsForJobRequest[]): Observable<NotificationResponse> {\n\t\treturn this.http.post<NotificationResponse>(`${this.path}/${jobId}/notifications`, payload, {});\n\t}\n\n\tgetActiveJob(featureCode: string, origin?: string): Observable<NotificationJobResponse | null> {\n\t\tlet url = `${this.path}/active?featureCode=${encodeURIComponent(featureCode)}`;\n\t\tif (origin) {\n\t\t\turl += `&origin=${encodeURIComponent(origin)}`;\n\t\t}\n\n\t\treturn this.http.get<NotificationJobResponse[]>(url, {}).pipe(\n\t\t\tmap(list => (Array.isArray(list) && list.length > 0 ? list[0] : null)),\n\t\t\tcatchError(err => {\n\t\t\t\tconsole.error(\"Error obteniendo active jobs\", err);\n\t\t\t\treturn of(null);\n\t\t\t})\n\t\t);\n\t}\n\n\tgetRecipients(jobId: string): Observable<NotificationRecipientSummaryResponse[]> {\n\t\treturn this.http.get<NotificationRecipientSummaryResponse[]>(`${this.path}/${jobId}/recipients`, {});\n\t}\n}\n","import { inject, Injectable, NgZone } from \"@angular/core\";\nimport * as signalR from \"@microsoft/signalr\";\nimport { Subject } from \"rxjs\";\nimport { ConfigService } from \"intelica-library-base\";\nimport { RecipientNotification } from \"./dto/notification-message-response.dto\";\nimport { RecipientProgressNotification } from \"./dto/notification-progress-message-response.dto\";\nimport { CallbackExecutionResult } from \"./dto/notification-callback-message-response.dto\";\n\n@Injectable({ providedIn: \"root\" })\nexport class NotificationSignalRService {\n\tprivate readonly configService = inject(ConfigService);\n\tprivate readonly path = `${this.configService.environment?.signalPath}/websocket`;\n\n\tprivate hubConnection?: signalR.HubConnection;\n\tprivate startPromise?: Promise<void>;\n\n\tprivate joinedGroups = new Set<string>();\n\n\tprivate notificationSendSubject = new Subject<RecipientNotification>();\n\tnotificationSend$ = this.notificationSendSubject.asObservable();\n\n\tprivate jobProgressSubject = new Subject<RecipientProgressNotification>();\n\tjobProgress$ = this.jobProgressSubject.asObservable();\n\n\tprivate callbackResultSubject = new Subject<CallbackExecutionResult>();\n\tcallbackResult$ = this.callbackResultSubject.asObservable();\n\n\tconstructor(private zone: NgZone) {}\n\n\tstartConnection(): Promise<void> {\n\t\tif (this.startPromise) return this.startPromise;\n\n\t\tthis.hubConnection = new signalR.HubConnectionBuilder().withUrl(this.path).withAutomaticReconnect().build();\n\t\tthis.hubConnection.keepAliveIntervalInMilliseconds = 15_000;\n\t\tthis.hubConnection.serverTimeoutInMilliseconds = 120_000;\n\n\t\tthis.registerListeners();\n\t\tthis.registerReconnectHandlers();\n\n\t\tthis.startPromise = this.hubConnection.start().catch(err => {\n\t\t\tconsole.error(\"Error starting SignalR connection\", err);\n\t\t\tthis.startPromise = undefined;\n\t\t\tthrow err;\n\t\t});\n\n\t\treturn this.startPromise;\n\t}\n\n\tasync joinScope(scopeType: string, scopeId: string): Promise<void> {\n\t\tawait this.startConnection();\n\t\tif (!this.hubConnection) return;\n\n\t\tconst groupName = `${scopeType}-${scopeId}`;\n\n\t\tif (this.joinedGroups.has(groupName)) return;\n\n\t\tawait this.hubConnection.invoke(\"Connect\", groupName);\n\t\tthis.joinedGroups.add(groupName);\n\t}\n\n\tasync leaveScope(scopeType: string, scopeId: string): Promise<void> {\n\t\tif (!this.hubConnection) return;\n\n\t\tconst groupName = `${scopeType}-${scopeId}`;\n\n\t\tif (!this.joinedGroups.has(groupName)) return;\n\n\t\tawait this.hubConnection.invoke(\"Disconnect\", groupName);\n\t\tthis.joinedGroups.delete(groupName);\n\t}\n\n\tasync stopConnection(): Promise<void> {\n\t\tif (!this.hubConnection) return;\n\n\t\ttry {\n\t\t\tawait this.hubConnection.stop();\n\t\t} finally {\n\t\t\tthis.joinedGroups.clear();\n\t\t\tthis.hubConnection = undefined;\n\t\t\tthis.startPromise = undefined;\n\t\t}\n\t}\n\n\tprivate registerListeners(): void {\n\t\tif (!this.hubConnection) return;\n\n\t\tthis.hubConnection.on(\"NotificationSend\", (raw: string) => {\n\t\t\tthis.zone.run(() => {\n\t\t\t\tconst data = JSON.parse(raw) as RecipientNotification;\n\t\t\t\tthis.notificationSendSubject.next(data);\n\t\t\t});\n\t\t});\n\n\t\tthis.hubConnection.on(\"JobProgress\", (raw: string) => {\n\t\t\tthis.zone.run(() => {\n\t\t\t\tconst data = JSON.parse(raw) as RecipientProgressNotification;\n\t\t\t\tthis.jobProgressSubject.next(data);\n\t\t\t});\n\t\t});\n\n\t\tthis.hubConnection.on(\"CallbackResult\", (raw: string) => {\n\t\t\tthis.zone.run(() => {\n\t\t\t\tconst data = JSON.parse(raw) as CallbackExecutionResult;\n\t\t\t\tthis.callbackResultSubject.next(data);\n\t\t\t});\n\t\t});\n\n\t\tthis.hubConnection.on(\"Connect\", (_msg: string) => {});\n\t}\n\n\tprivate registerReconnectHandlers(): void {\n\t\tif (!this.hubConnection) return;\n\n\t\tthis.hubConnection.onreconnected(async () => {\n\t\t\ttry {\n\t\t\t\tfor (const groupName of this.joinedGroups) {\n\t\t\t\t\tawait this.hubConnection!.invoke(\"Connect\", groupName);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error(\"Error rejoining groups after reconnection\", e);\n\t\t\t}\n\t\t});\n\n\t\tthis.hubConnection.onclose(() => {\n\t\t\tthis.startPromise = undefined;\n\t\t});\n\t}\n}\n","import { Injectable } from \"@angular/core\";\nimport { BehaviorSubject, Subject, firstValueFrom, Observable } from \"rxjs\";\nimport { NotificationJobService } from \"./notification-job.service\";\nimport { NotificationSignalRService } from \"./notification-signalr.service\";\nimport { JobState } from \"./dto/job-state.dto\";\nimport { NotificationDraft } from \"./dto/notification-draft.dto\";\nimport { RecipientNotification } from \"./dto/notification-message-response.dto\";\nimport { NotificationRecipientSummaryResponse } from \"./dto/notification-response.dto\";\nimport { CreateNotificationJobRequest, CreateNotificationsForJobRequest, HtmlPreviewBucket } from \"./dto/notification-request.dto\";\nimport { RecipientDispatchError } from \"./dto/recipient-dispatch-error.dto\";\nimport { NotificationService } from \"./notification.service\";\nimport { UserNotificationInboxItem } from \"./dto/notification-inbox-response.dto\";\nimport { RecipientProgressNotification } from \"./dto/notification-progress-message-response.dto\";\nimport { CallbackExecutionResult } from \"./dto/notification-callback-message-response.dto\";\nimport { JobStatusCatalog, OriginCatalog } from \"./dto/notification-catalog.dto\";\n\n@Injectable({ providedIn: \"root\" })\nexport class NotificationOrchestratorService {\n\tprivate origin?: OriginCatalog;\n\tprivate featureCode?: string;\n\n\tprivate currentJobId?: string;\n\tprivate subscribedJobId?: string;\n\n\tprivate readonly jobStateSubject = new BehaviorSubject<JobState>({\n\t\tstatus: \"pending\",\n\t\tprocessedCount: 0,\n\t\ttotalCount: 0,\n\t\tprocessedNotificationsCount: 0,\n\t\ttotalNotificationsCount: 0,\n\t});\n\treadonly jobState$ = this.jobStateSubject.asObservable();\n\n\tprivate readonly dispatchErrorsMapSubject = new BehaviorSubject<Map<string, RecipientDispatchError>>(new Map());\n\treadonly dispatchErrors$ = this.dispatchErrorsMapSubject.asObservable();\n\n\tprivate readonly callbackRawSubject = new Subject<CallbackExecutionResult>();\n\treadonly callbackRaw$ = this.callbackRawSubject.asObservable();\n\n\tprivate readonly jobProgressSubjects = new Map<string, Subject<RecipientProgressNotification>>();\n\tprivate readonly jobWatchRefCount = new Map<string, number>();\n\n\tprivate readonly userInboxSubjects = new Map<string, Subject<RecipientNotification>>();\n\tprivate readonly userWatchRefCount = new Map<string, number>();\n\n\tprivate initInFlight?: Promise<void>;\n\n\tconstructor(\n\t\tprivate jobService: NotificationJobService,\n\t\tprivate notificationService: NotificationService,\n\t\tprivate signalR: NotificationSignalRService\n\t) {\n\t\tthis.signalR.jobProgress$.subscribe(update => this.onJobProgress(update));\n\t\tthis.signalR.callbackResult$.subscribe(update => this.onCallbackResult(update));\n\t\tthis.signalR.notificationSend$.subscribe(update => this.onNotificationSend(update));\n\t}\n\n\tasync watchUserInbox(userId: string): Promise<Observable<RecipientNotification>> {\n\t\tif (!userId) throw new Error(\"userId is required\");\n\n\t\tconst current = this.userWatchRefCount.get(userId) ?? 0;\n\t\tthis.userWatchRefCount.set(userId, current + 1);\n\n\t\tawait this.signalR.joinScope(\"user\", userId);\n\n\t\treturn this.userInbox$(userId);\n\t}\n\n\tasync unwatchUserInbox(userId: string): Promise<void> {\n\t\tif (!userId) return;\n\n\t\tconst current = this.userWatchRefCount.get(userId) ?? 0;\n\n\t\tif (current <= 1) {\n\t\t\tthis.userWatchRefCount.delete(userId);\n\n\t\t\tawait this.signalR.leaveScope(\"user\", userId);\n\n\t\t\tconst subj = this.userInboxSubjects.get(userId);\n\t\t\tif (subj) {\n\t\t\t\tsubj.complete();\n\t\t\t\tthis.userInboxSubjects.delete(userId);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tthis.userWatchRefCount.set(userId, current - 1);\n\t}\n\n\tuserInbox$(userId: string): Observable<RecipientNotification> {\n\t\tlet subj = this.userInboxSubjects.get(userId);\n\t\tif (!subj) {\n\t\t\tsubj = new Subject<RecipientNotification>();\n\t\t\tthis.userInboxSubjects.set(userId, subj);\n\t\t}\n\t\treturn subj.asObservable();\n\t}\n\n\tasync watchJobProgress(jobId: string): Promise<Observable<RecipientProgressNotification>> {\n\t\tif (!jobId) throw new Error(\"jobId is required\");\n\n\t\tconst current = this.jobWatchRefCount.get(jobId) ?? 0;\n\t\tthis.jobWatchRefCount.set(jobId, current + 1);\n\n\t\tawait this.signalR.joinScope(\"job\", jobId);\n\n\t\treturn this.jobProgress$(jobId);\n\t}\n\n\tasync unwatchJobProgress(jobId: string): Promise<void> {\n\t\tif (!jobId) return;\n\n\t\tconst current = this.jobWatchRefCount.get(jobId) ?? 0;\n\n\t\tif (current <= 1) {\n\t\t\tthis.jobWatchRefCount.delete(jobId);\n\n\t\t\tawait this.signalR.leaveScope(\"job\", jobId);\n\n\t\t\tconst subj = this.jobProgressSubjects.get(jobId);\n\t\t\tif (subj) {\n\t\t\t\tsubj.complete();\n\t\t\t\tthis.jobProgressSubjects.delete(jobId);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tthis.jobWatchRefCount.set(jobId, current - 1);\n\t}\n\n\tjobProgress$(jobId: string): Observable<RecipientProgressNotification> {\n\t\tlet subj = this.jobProgressSubjects.get(jobId);\n\t\tif (!subj) {\n\t\t\tsubj = new Subject<RecipientProgressNotification>();\n\t\t\tthis.jobProgressSubjects.set(jobId, subj);\n\t\t}\n\t\treturn subj.asObservable();\n\t}\n\n\trehydrateScope(origin: OriginCatalog, featureCode: string): Promise<void> {\n\t\tthis.origin = origin;\n\t\tthis.featureCode = featureCode;\n\n\t\tif (this.initInFlight) return this.initInFlight;\n\n\t\tthis.initInFlight = (async () => {\n\t\t\ttry {\n\t\t\t\tawait this.rehydrateActiveJobInternal();\n\t\t\t} finally {\n\t\t\t\tthis.initInFlight = undefined;\n\t\t\t}\n\t\t})();\n\n\t\treturn this.initInFlight;\n\t}\n\n\tgetCurrentJobId(): string | undefined {\n\t\treturn this.currentJobId;\n\t}\n\n\tgetJobStateSnapshot(): JobState {\n\t\treturn this.jobStateSubject.value;\n\t}\n\n\tasync ensureActiveOrCreateJobNotifications(notificationDraft: NotificationDraft[]): Promise<{ jobId: string; mode: \"active\" | \"created\" }> {\n\t\tif (!this.origin || !this.featureCode) throw new Error(\"Scope not initialized. Call rehydrateScope(featureCode, origin) first.\");\n\n\t\tif (this.currentJobId) {\n\t\t\treturn { jobId: this.currentJobId, mode: \"active\" };\n\t\t}\n\n\t\tconst jobPayload: CreateNotificationJobRequest = {\n\t\t\tfeatureCode: this.featureCode,\n\t\t\torigin: this.origin,\n\t\t\ttotalCount: notificationDraft?.length ?? 0,\n\t\t\ttotalNotificationsCount: notificationDraft?.filter(n => n.recipients?.some(r => r.isRequiredForProcessed)).length ?? 0,\n\t\t};\n\n\t\tconst job = await firstValueFrom(this.jobService.createJob(jobPayload));\n\t\tthis.currentJobId = job.jobId;\n\n\t\tthis.setJobState({\n\t\t\tjobId: this.currentJobId,\n\t\t\tstatus: \"pending\",\n\t\t\tprocessedCount: 0,\n\t\t\ttotalCount: jobPayload.totalCount,\n\t\t\tprocessedNotificationsCount: 0,\n\t\t\ttotalNotificationsCount: jobPayload.totalNotificationsCount,\n\t\t});\n\n\t\tawait this.subscribeToJob(this.currentJobId);\n\n\t\tconst notifications: CreateNotificationsForJobRequest[] = notificationDraft.map(draft => ({\n\t\t\toriginReference: `${draft.originReference}-${job.jobId}`,\n\t\t\tnotificationTypeCode: draft.notificationTypeCode,\n\t\t\tdestination: draft.destination,\n\t\t\tdestinationLabel: draft.destinationLabel,\n\t\t\tbucketName: draft.bucketName,\n\t\t\ttemplateName: draft.templateName,\n\t\t\ttemplateData: draft.templateData,\n\t\t\tpriorityCode: draft.priorityCode,\n\t\t\ttitle: draft.title,\n\t\t\tbody: draft.body,\n\t\t\tmetaData: draft.metaData,\n\t\t\trecipients: draft.recipients,\n\t\t\tactions: draft.actions,\n\t\t\tattachments: draft.attachments,\n\t\t\tcallbacks: draft.callbacks,\n\t\t}));\n\n\t\tawait firstValueFrom(this.jobService.createNotifications(job.jobId, notifications));\n\n\t\treturn { jobId: this.currentJobId, mode: \"created\" };\n\t}\n\n\tasync ensureCreateJobNotifications(origin: OriginCatalog, featureCode: string, notificationDraft: NotificationDraft[]): Promise<void> {\n\t\tif (!origin || !featureCode) throw new Error(\"Scope not initialized.\");\n\n\t\tconst jobPayload: CreateNotificationJobRequest = {\n\t\t\tfeatureCode: featureCode,\n\t\t\torigin: origin,\n\t\t\ttotalCount: 1,\n\t\t\ttotalNotificationsCount: 1,\n\t\t\tnotifications: notificationDraft.map(draft => ({\n\t\t\t\toriginReference: draft.originReference,\n\t\t\t\tnotificationTypeCode: draft.notificationTypeCode,\n\t\t\t\tdestination: draft.destination,\n\t\t\t\tdestinationLabel: draft.destinationLabel,\n\t\t\t\tbucketName: draft.bucketName,\n\t\t\t\ttemplateName: draft.templateName,\n\t\t\t\ttemplateData: draft.templateData,\n\t\t\t\tpriorityCode: draft.priorityCode,\n\t\t\t\ttitle: draft.title,\n\t\t\t\tbody: draft.body,\n\t\t\t\tmetaData: draft.metaData,\n\t\t\t\trecipients: draft.recipients,\n\t\t\t\tactions: draft.actions,\n\t\t\t\tattachments: draft.attachments,\n\t\t\t\tcallbacks: draft.callbacks,\n\t\t\t})),\n\t\t};\n\n\t\tawait firstValueFrom(this.jobService.createJobNotifications(jobPayload));\n\t}\n\n\tasync markAsRead(recipientId: string): Promise<NotificationRecipientSummaryResponse> {\n\t\treturn firstValueFrom(this.notificationService.markAsRead(recipientId));\n\t}\n\n\tasync markAllAsRead(): Promise<NotificationRecipientSummaryResponse[]> {\n\t\treturn firstValueFrom(this.notificationService.markAllAsRead());\n\t}\n\n\tasync markAsHidden(recipientId: string): Promise<NotificationRecipientSummaryResponse> {\n\t\treturn firstValueFrom(this.notificationService.markAsHidden(recipientId));\n\t}\n\n\tasync htmlPreview(request: HtmlPreviewBucket): Promise<string> {\n\t\treturn firstValueFrom(this.notificationService.htmlPreview(request));\n\t}\n\n\tasync getUserNotificacions(): Promise<UserNotificationInboxItem[]> {\n\t\treturn firstValueFrom(this.notificationService.getUserNotificacions());\n\t}\n\n\tresetLocal(): void {\n\t\tthis.currentJobId = undefined;\n\t\tthis.setJobState({ status: \"pending\", processedCount: 0, totalCount: 0, processedNotificationsCount: 0, totalNotificationsCount: 0 });\n\t\tthis.dispatchErrorsMapSubject.next(new Map());\n\t}\n\n\tprivate async rehydrateActiveJobInternal(): Promise<void> {\n\t\tif (!this.featureCode || !this.origin) return;\n\n\t\tconst active = await firstValueFrom(this.jobService.getActiveJob(this.featureCode, this.origin));\n\n\t\tif (!active) {\n\t\t\tthis.currentJobId = undefined;\n\t\t\tthis.setJobState({ status: \"idle\", processedCount: 0, totalCount: 0, processedNotificationsCount: 0, totalNotificationsCount: 0 });\n\t\t\tthis.dispatchErrorsMapSubject.next(new Map());\n\t\t\treturn;\n\t\t}\n\n\t\tthis.currentJobId = active.jobId;\n\n\t\tthis.setJobState({\n\t\t\tjobId: active.jobId,\n\t\t\tstatus: (active.statusCode?.toLowerCase() as JobStatusCatalog) || \"running\",\n\t\t\tprocessedCount: active.processedCount ?? 0,\n\t\t\ttotalCount: active.totalCount ?? 0,\n\t\t\tprocessedNotificationsCount: active.processedNotificationsCount ?? 0,\n\t\t\ttotalNotificationsCount: active.totalNotificationsCount ?? 0,\n\t\t});\n\n\t\tconst recipients: NotificationRecipientSummaryResponse[] = await firstValueFrom(this.jobService.getRecipients(active.jobId));\n\t\tconst map = new Map<string, RecipientDispatchError>();\n\n\t\tfor (const r of recipients) {\n\t\t\tif (r.recipientId && r.statusCode === \"failed\") {\n\t\t\t\tmap.set(r.recipientId, {\n\t\t\t\t\trecipientId: r.recipientId,\n\t\t\t\t\tlastErrorMessage: r.lastErrorMessage ?? null,\n\t\t\t\t\tchannelCode: r.channelCode || undefined,\n\t\t\t\t\tstatusCode: r.statusCode,\n\t\t\t\t\tattempts: r.attempts,\n\t\t\t\t\tlastAttemptAt: r.lastAttemptAt ?? null,\n\t\t\t\t\tuserId: r.userId ?? null,\n\t\t\t\t\tclientId: r.clientId ?? null,\n\t\t\t\t\tgroupId: r.groupId ?? null,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tthis.dispatchErrorsMapSubject.next(map);\n\n\t\tawait this.subscribeToJob(active.jobId);\n\t}\n\n\tprivate async subscribeToJob(jobId: string): Promise<void> {\n\t\tif (this.subscribedJobId && this.subscribedJobId !== jobId) {\n\t\t\tawait this.signalR.leaveScope(\"job\", this.subscribedJobId);\n\t\t\tawait this.signalR.leaveScope(\"callBack\", this.subscribedJobId);\n\t\t}\n\n\t\tthis.subscribedJobId = jobId;\n\n\t\tawait this.signalR.joinScope(\"job\", jobId);\n\t\tawait this.signalR.joinScope(\"callBack\", jobId);\n\t}\n\n\tprivate onNotificationSend(update: RecipientNotification): void {\n\t\tif (update.userId) {\n\t\t\tthis.userInboxSubjects.get(update.userId)?.next(update);\n\t\t}\n\t}\n\n\tprivate onJobProgress(update: RecipientProgressNotification): void {\n\t\tif (update.jobId) {\n\t\t\tthis.jobProgressSubjects.get(update.jobId)?.next(update);\n\t\t}\n\n\t\tif (!this.currentJobId || update.jobId !== this.currentJobId) return;\n\n\t\tif (update.recipientId) {\n\t\t\tconst current = this.dispatchErrorsMapSubject.value;\n\t\t\tconst next = new Map(current);\n\n\t\t\tif ((update.jobStatusCode ?? \"\").toLowerCase() === \"failed\") {\n\t\t\t\tnext.set(update.recipientId, {\n\t\t\t\t\trecipientId: update.recipientId,\n\t\t\t\t\tlastErrorMessage: update.lastErrorMessage ?? null,\n\n\t\t\t\t\tnotificationId: update.notificationId,\n\t\t\t\t\tjobId: update.jobId ?? null,\n\n\t\t\t\t\tchannelCode: update.channelCode,\n\t\t\t\t\tstatusCode: update.jobStatusCode,\n\n\t\t\t\t\tattempts: update.attempts,\n\t\t\t\t\tlastAttemptAt: update.lastAttemptAt ?? null,\n\n\t\t\t\t\tuserId: update.userId ?? null,\n\t\t\t\t\tclientId: update.clientId ?? null,\n\t\t\t\t\tgroupId: update.groupId ?? null,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tnext.delete(update.recipientId);\n\t\t\t}\n\n\t\t\tthis.dispatchErrorsMapSubject.next(next);\n\t\t}\n\n\t\tif (typeof update.jobProcessedCount === \"number\" && typeof update.jobTotalCount === \"number\") {\n\t\t\tthis.setJobState({\n\t\t\t\tjobId: update.jobId,\n\t\t\t\tstatus: update.jobStatusCode?.toLowerCase() as JobStatusCatalog,\n\t\t\t\tprocessedCount: update.jobProcessedCount,\n\t\t\t\ttotalCount: update.jobTotalCount,\n\t\t\t\tprocessedNotificationsCount: update.jobProcessedNotificationsCount,\n\t\t\t\ttotalNotificationsCount: update.jobTotalNotificationsCount,\n\t\t\t});\n\t\t}\n\n\t\tif (update.jobStatusCode?.toLowerCase() === \"completed\") {\n\t\t\tthis.setJobState({\n\t\t\t\tjobId: this.jobStateSubject.value.jobId,\n\t\t\t\tstatus: this.jobStateSubject.value.status,\n\t\t\t\tprocessedCount: this.jobStateSubject.value.processedCount,\n\t\t\t\ttotalCount: this.jobStateSubject.value.totalCount,\n\t\t\t\tprocessedNotificationsCount: this.jobStateSubject.value.processedNotificationsCount,\n\t\t\t\ttotalNotificationsCount: this.jobStateSubject.value.totalNotificationsCount,\n\t\t\t});\n\t\t} else if (this.jobStateSubject.value.status === \"pending\") {\n\t\t\tthis.setJobState({ ...this.jobStateSubject.value, status: \"pending\" });\n\t\t} else if (this.jobStateSubject.value.status === \"running\") {\n\t\t\tthis.setJobState({ ...this.jobStateSubject.value, status: \"running\" });\n\t\t}\n\t}\n\n\tprivate onCallbackResult(update: CallbackExecutionResult): void {\n\t\tthis.callbackRawSubject.next(update);\n\t}\n\n\tprivate setJobState(state: JobState): void {\n\t\tthis.jobStateSubject.next({\n\t\t\tjobId: state.jobId,\n\t\t\tstatus: state.status,\n\t\t\tprocessedCount: state.processedCount,\n\t\t\ttotalCount: state.totalCount,\n\t\t\tprocessedNotificationsCount: state.processedNotificationsCount,\n\t\t\ttotalNotificationsCount: state.totalNotificationsCount,\n\t\t});\n\t}\n}\n","// Public API Surface of intelica-library-notification\n\n//DTOs\nexport * from \"./lib/dto/job-state.dto\";\nexport * from \"./lib/dto/notification-catalog.dto\";\nexport * from \"./lib/dto/notification-draft.dto\";\nexport * from \"./lib/dto/notification-inbox-response.dto\";\nexport * from \"./lib/dto/notification-message-response.dto\";\nexport * from \"./lib/dto/notification-progress-message-response.dto\";\nexport * from \"./lib/dto/notification-callback-message-response.dto\";\nexport * from \"./lib/dto/notification-request.dto\";\nexport * from \"./lib/dto/notification-response.dto\";\nexport * from \"./lib/dto/recipient-dispatch-error.dto\";\n\n//Services\nexport * from \"./lib/notification.service\";\nexport * from \"./lib/notification-job.service\";\nexport * from \"./lib/notification-signalr.service\";\nexport * from \"./lib/notificacion-orchestrator.service\";\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.NotificationJobService","i2.NotificationService","i3.NotificationSignalRService"],"mappings":";;;;;;;MASa,mBAAmB,CAAA;AAIX,IAAA,IAAA;AAHH,IAAA,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC;IACrC,IAAI,GAAG,CAAA,EAAG,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,iBAAiB,CAAA,cAAA,CAAgB;AAE5F,IAAA,WAAA,CAAoB,IAAgB,EAAA;QAAhB,IAAA,CAAA,IAAI,GAAJ,IAAI;IAAe;IAEvC,oBAAoB,GAAA;AACnB,QAAA,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAA8B,CAAA,EAAG,IAAI,CAAC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Ac,EAAE,KAAK,CAAC,cAAc;YACpC,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,2BAA2B,EAAE,KAAK,CAAC,2BAA2B;YAC9D,uBAAuB,EAAE,KAAK,CAAC,uBAAuB;AACtD,SAAA,CAAC;IACH;wGA3YY,+BAA+B,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAAA,sBAAA,EAAA,EAAA,EAAA,KAAA,EAAAC,mBAAA,EAAA,EAAA,EAAA,KAAA,EAAAC,0BAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAA/B,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,+BAA+B,cADlB,MAAM,EAAA,CAAA;;4FACnB,+BAA+B,EAAA,UAAA,EAAA,CAAA;kBAD3C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;AChBlC;AAEA;;ACFA;;AAEG;;;;"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
import { HttpClient } from '@angular/common/http';
|
|
2
|
+
import * as rxjs from 'rxjs';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import * as i0 from '@angular/core';
|
|
5
|
+
import { NgZone } from '@angular/core';
|
|
6
|
+
|
|
7
|
+
type JobStatusCatalog = "idle" | "pending" | "running" | "completed" | "failed" | "cancelled";
|
|
8
|
+
type OriginCatalog = "default" | "testing" | "security" | "alerts" | "filesharing";
|
|
9
|
+
type BucketCatalog = "general" | "fee" | "security" | "alerts" | "filesharing";
|
|
10
|
+
type NotificationTypeCatalog = "NTF" | "PRG" | "BRD" | "TEM" | "OPT";
|
|
11
|
+
type PriorityCatalog = "low" | "normal" | "high" | "critical";
|
|
12
|
+
type RecipientTypeCatalog = "user" | "contact" | "phone" | "device" | "topic";
|
|
13
|
+
type ChannelCatalog = "email" | "sms" | "push" | "whatsapp" | "inapp";
|
|
14
|
+
type DestinationTypeCatalog = "URL" | "NAV" | "GET" | "PUT" | "POST" | "PATCH" | "DELETE";
|
|
15
|
+
type MethodTypeCatalog = "GET" | "PUT" | "POST" | "PATCH" | "DELETE";
|
|
16
|
+
type ActionTypeCatalog = "nav" | "url" | "file" | "search" | "approve" | "reject";
|
|
17
|
+
|
|
18
|
+
interface JobState {
|
|
19
|
+
jobId?: string;
|
|
20
|
+
status: JobStatusCatalog;
|
|
21
|
+
processedCount: number;
|
|
22
|
+
totalCount: number;
|
|
23
|
+
processedNotificationsCount: number;
|
|
24
|
+
totalNotificationsCount: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface NotificationDraft {
|
|
28
|
+
origin?: string;
|
|
29
|
+
originReference: string;
|
|
30
|
+
notificationTypeCode: NotificationTypeCatalog;
|
|
31
|
+
destination?: string | null;
|
|
32
|
+
destinationLabel?: string | null;
|
|
33
|
+
bucketName?: BucketCatalog;
|
|
34
|
+
templateName?: string;
|
|
35
|
+
templateData?: string;
|
|
36
|
+
priorityCode: PriorityCatalog;
|
|
37
|
+
title?: string;
|
|
38
|
+
body?: string;
|
|
39
|
+
metaData?: string;
|
|
40
|
+
recipients: Array<{
|
|
41
|
+
recipientTypeCode: RecipientTypeCatalog;
|
|
42
|
+
channelCode?: ChannelCatalog;
|
|
43
|
+
userId?: string | null;
|
|
44
|
+
clientId?: string | null;
|
|
45
|
+
groupId?: string | null;
|
|
46
|
+
address?: string | null;
|
|
47
|
+
ccAddress?: string | null;
|
|
48
|
+
bccAddress?: string | null;
|
|
49
|
+
fromAddress?: string | null;
|
|
50
|
+
fromName?: string | null;
|
|
51
|
+
isRequiredForProcessed?: boolean | false;
|
|
52
|
+
isRequiredForCallback?: boolean | false;
|
|
53
|
+
isRequiredAsUnread?: boolean | true;
|
|
54
|
+
}>;
|
|
55
|
+
actions?: Array<{
|
|
56
|
+
sortOrder: number;
|
|
57
|
+
code: ActionTypeCatalog;
|
|
58
|
+
label: string;
|
|
59
|
+
metaData?: string;
|
|
60
|
+
destinationType: DestinationTypeCatalog;
|
|
61
|
+
destination: string;
|
|
62
|
+
destinationData?: string;
|
|
63
|
+
markAsRead?: boolean | true;
|
|
64
|
+
markAsHidden?: boolean | false;
|
|
65
|
+
}>;
|
|
66
|
+
attachments?: Array<{
|
|
67
|
+
method: MethodTypeCatalog;
|
|
68
|
+
url: string;
|
|
69
|
+
headers?: Record<string, string> | null;
|
|
70
|
+
payload?: string | null;
|
|
71
|
+
fileName?: string | null;
|
|
72
|
+
contentType?: string | null;
|
|
73
|
+
}>;
|
|
74
|
+
callbacks?: Array<{
|
|
75
|
+
code: string;
|
|
76
|
+
method: MethodTypeCatalog;
|
|
77
|
+
url: string;
|
|
78
|
+
headers?: Record<string, string> | null;
|
|
79
|
+
payload?: any;
|
|
80
|
+
triggerOnSent: boolean | false;
|
|
81
|
+
triggerOnFailed: boolean | false;
|
|
82
|
+
triggerOnPartial: boolean | false;
|
|
83
|
+
timeoutSeconds?: number;
|
|
84
|
+
maxRetries?: number;
|
|
85
|
+
}>;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
interface UserNotificationAction {
|
|
89
|
+
sortOrder: string;
|
|
90
|
+
actionId: number;
|
|
91
|
+
code: ActionTypeCatalog;
|
|
92
|
+
label: string;
|
|
93
|
+
metaData?: string | null;
|
|
94
|
+
destinationType: string;
|
|
95
|
+
destination: string;
|
|
96
|
+
destinationData?: string | null;
|
|
97
|
+
markAsRead: boolean;
|
|
98
|
+
markAsHidden: boolean;
|
|
99
|
+
}
|
|
100
|
+
interface UserNotificationInboxItem {
|
|
101
|
+
recipientId: string;
|
|
102
|
+
notificationId: string;
|
|
103
|
+
jobId?: string | null;
|
|
104
|
+
notificationTypeCode: string | null;
|
|
105
|
+
channelCode: string;
|
|
106
|
+
destination: string | null;
|
|
107
|
+
destinationLabel: string | null;
|
|
108
|
+
title: string;
|
|
109
|
+
body: string | null;
|
|
110
|
+
metaData: string | null;
|
|
111
|
+
address: string | null;
|
|
112
|
+
statusCode: string;
|
|
113
|
+
isRequiredAsUnread: boolean;
|
|
114
|
+
isRead: boolean;
|
|
115
|
+
readAt?: string | null;
|
|
116
|
+
isHidden: boolean;
|
|
117
|
+
hiddenAt?: string | null;
|
|
118
|
+
createdAt: string;
|
|
119
|
+
attempts: number;
|
|
120
|
+
lastAttemptAt: string;
|
|
121
|
+
lastErrorMessage: string | null;
|
|
122
|
+
userId?: string | null;
|
|
123
|
+
clientId?: string | null;
|
|
124
|
+
groupId?: string | null;
|
|
125
|
+
jobStatusCode?: string | null;
|
|
126
|
+
jobProcessedCount?: number | 0;
|
|
127
|
+
jobTotalCount?: number | 0;
|
|
128
|
+
jobProcessedNotificationsCount: number | 0;
|
|
129
|
+
jobTotalNotificationsCount: number | 0;
|
|
130
|
+
actions?: UserNotificationAction[] | null;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
interface RecipientNotificationAction {
|
|
134
|
+
sortOrder: string;
|
|
135
|
+
actionId: number;
|
|
136
|
+
code: ActionTypeCatalog;
|
|
137
|
+
label: string;
|
|
138
|
+
metaData?: string | null;
|
|
139
|
+
destinationType: string;
|
|
140
|
+
destination: string;
|
|
141
|
+
destinationData?: string | null;
|
|
142
|
+
markAsRead: boolean;
|
|
143
|
+
markAsHidden: boolean;
|
|
144
|
+
}
|
|
145
|
+
interface RecipientNotification {
|
|
146
|
+
recipientId: string;
|
|
147
|
+
notificationId: string;
|
|
148
|
+
jobId?: string | null;
|
|
149
|
+
notificationTypeCode: string | null;
|
|
150
|
+
channelCode: string;
|
|
151
|
+
destination: string | null;
|
|
152
|
+
destinationLabel: string | null;
|
|
153
|
+
title: string;
|
|
154
|
+
body: string | null;
|
|
155
|
+
metaData?: string | null;
|
|
156
|
+
address: string | null;
|
|
157
|
+
statusCode: string;
|
|
158
|
+
isRequiredAsUnread: boolean;
|
|
159
|
+
isRead: boolean;
|
|
160
|
+
readAt?: string | null;
|
|
161
|
+
isHidden: boolean;
|
|
162
|
+
hiddenAt?: string | null;
|
|
163
|
+
createdAt: string;
|
|
164
|
+
attempts: number;
|
|
165
|
+
lastAttemptAt: string;
|
|
166
|
+
lastErrorMessage: string | null;
|
|
167
|
+
userId?: string | null;
|
|
168
|
+
clientId?: string | null;
|
|
169
|
+
groupId?: string | null;
|
|
170
|
+
jobStatusCode?: string;
|
|
171
|
+
jobProcessedCount?: number;
|
|
172
|
+
jobTotalCount?: number;
|
|
173
|
+
jobProcessedNotificationsCount: number;
|
|
174
|
+
jobTotalNotificationsCount: number;
|
|
175
|
+
actions?: RecipientNotificationAction[] | null;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
interface RecipientProgressNotificationAction {
|
|
179
|
+
sortOrder: string;
|
|
180
|
+
actionId: number;
|
|
181
|
+
code: ActionTypeCatalog;
|
|
182
|
+
label: string;
|
|
183
|
+
metaData?: string | null;
|
|
184
|
+
destinationType: string;
|
|
185
|
+
destination: string;
|
|
186
|
+
destinationData?: string | null;
|
|
187
|
+
markAsRead: boolean;
|
|
188
|
+
markAsHidden: boolean;
|
|
189
|
+
}
|
|
190
|
+
interface RecipientProgressNotification {
|
|
191
|
+
recipientId: string;
|
|
192
|
+
notificationId: string;
|
|
193
|
+
jobId?: string | null;
|
|
194
|
+
notificationTypeCode: string | null;
|
|
195
|
+
channelCode: string;
|
|
196
|
+
destination: string | null;
|
|
197
|
+
destinationLabel: string | null;
|
|
198
|
+
title: string;
|
|
199
|
+
body: string | null;
|
|
200
|
+
metaData?: string | null;
|
|
201
|
+
address: string | null;
|
|
202
|
+
statusCode: string;
|
|
203
|
+
isRequiredAsUnread: boolean;
|
|
204
|
+
isRead: boolean;
|
|
205
|
+
readAt?: string | null;
|
|
206
|
+
isHidden: boolean;
|
|
207
|
+
hiddenAt?: string | null;
|
|
208
|
+
createdAt: string;
|
|
209
|
+
attempts: number;
|
|
210
|
+
lastAttemptAt: string;
|
|
211
|
+
lastErrorMessage: string | null;
|
|
212
|
+
userId?: string | null;
|
|
213
|
+
clientId?: string | null;
|
|
214
|
+
groupId?: string | null;
|
|
215
|
+
jobStatusCode?: string;
|
|
216
|
+
jobProcessedCount?: number;
|
|
217
|
+
jobTotalCount?: number;
|
|
218
|
+
jobProcessedNotificationsCount: number;
|
|
219
|
+
jobTotalNotificationsCount: number;
|
|
220
|
+
actions?: RecipientProgressNotificationAction[] | null;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
interface CallbackExecutionResult {
|
|
224
|
+
correlationId: string;
|
|
225
|
+
notificationId: string;
|
|
226
|
+
recipientId: string;
|
|
227
|
+
jobId?: string | null;
|
|
228
|
+
callbackCode: string;
|
|
229
|
+
triggerOnSent: boolean;
|
|
230
|
+
triggerOnFailed: boolean;
|
|
231
|
+
triggerOnPartial: boolean;
|
|
232
|
+
success: boolean;
|
|
233
|
+
httpStatus?: number | null;
|
|
234
|
+
payload?: any | null;
|
|
235
|
+
responseBody?: string | null;
|
|
236
|
+
error?: string | null;
|
|
237
|
+
finishedAt: string;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
interface CreateNotificationJobRequest {
|
|
241
|
+
featureCode: string;
|
|
242
|
+
origin: OriginCatalog;
|
|
243
|
+
totalCount: number;
|
|
244
|
+
totalNotificationsCount: number;
|
|
245
|
+
notifications?: CreateNotificationsForJobRequest[] | null;
|
|
246
|
+
}
|
|
247
|
+
interface CreateNotificationsForJobRequest {
|
|
248
|
+
originReference: string;
|
|
249
|
+
notificationTypeCode: NotificationTypeCatalog;
|
|
250
|
+
destination?: string | null;
|
|
251
|
+
destinationLabel?: string | null;
|
|
252
|
+
bucketName?: BucketCatalog;
|
|
253
|
+
templateName?: string;
|
|
254
|
+
templateData?: string;
|
|
255
|
+
priorityCode: PriorityCatalog;
|
|
256
|
+
title?: string;
|
|
257
|
+
body?: string;
|
|
258
|
+
metaData?: string;
|
|
259
|
+
recipients: Array<{
|
|
260
|
+
recipientTypeCode: RecipientTypeCatalog;
|
|
261
|
+
channelCode?: ChannelCatalog;
|
|
262
|
+
userId?: string | null;
|
|
263
|
+
clientId?: string | null;
|
|
264
|
+
groupId?: string | null;
|
|
265
|
+
address?: string | null;
|
|
266
|
+
ccAddress?: string | null;
|
|
267
|
+
bccAddress?: string | null;
|
|
268
|
+
fromAddress?: string | null;
|
|
269
|
+
fromName?: string | null;
|
|
270
|
+
isRequiredForProcessed?: boolean | false;
|
|
271
|
+
isRequiredForCallback?: boolean | false;
|
|
272
|
+
isRequiredAsUnread?: boolean | true;
|
|
273
|
+
}>;
|
|
274
|
+
actions?: Array<{
|
|
275
|
+
sortOrder: number;
|
|
276
|
+
code: ActionTypeCatalog;
|
|
277
|
+
label: string;
|
|
278
|
+
metaData?: string;
|
|
279
|
+
destinationType: DestinationTypeCatalog;
|
|
280
|
+
destination: string;
|
|
281
|
+
destinationData?: string;
|
|
282
|
+
markAsRead?: boolean | true;
|
|
283
|
+
markAsHidden?: boolean | false;
|
|
284
|
+
}>;
|
|
285
|
+
attachments?: Array<{
|
|
286
|
+
method: MethodTypeCatalog;
|
|
287
|
+
url: string;
|
|
288
|
+
headers?: Record<string, string> | null;
|
|
289
|
+
payload?: string | null;
|
|
290
|
+
fileName?: string | null;
|
|
291
|
+
contentType?: string | null;
|
|
292
|
+
}>;
|
|
293
|
+
callbacks?: Array<{
|
|
294
|
+
code: string;
|
|
295
|
+
method: MethodTypeCatalog;
|
|
296
|
+
url: string;
|
|
297
|
+
headers?: Record<string, string> | null;
|
|
298
|
+
payload?: any;
|
|
299
|
+
triggerOnSent: boolean | false;
|
|
300
|
+
triggerOnFailed: boolean | false;
|
|
301
|
+
triggerOnPartial: boolean | false;
|
|
302
|
+
timeoutSeconds?: number;
|
|
303
|
+
maxRetries?: number;
|
|
304
|
+
}>;
|
|
305
|
+
}
|
|
306
|
+
interface HtmlPreviewBucket {
|
|
307
|
+
bucketName: BucketCatalog;
|
|
308
|
+
templateName: string;
|
|
309
|
+
dataJson: any;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
interface NotificationResponse {
|
|
313
|
+
jobId: string;
|
|
314
|
+
featureCode: string;
|
|
315
|
+
origin: string;
|
|
316
|
+
createdBy: string;
|
|
317
|
+
createdAt: string;
|
|
318
|
+
}
|
|
319
|
+
interface NotificationJobResponse {
|
|
320
|
+
jobId: string;
|
|
321
|
+
featureCode: string;
|
|
322
|
+
origin: string;
|
|
323
|
+
createdBy: string;
|
|
324
|
+
createdAt: string;
|
|
325
|
+
statusCode: string;
|
|
326
|
+
totalCount: number;
|
|
327
|
+
processedCount: number;
|
|
328
|
+
processedNotificationsCount: number;
|
|
329
|
+
totalNotificationsCount: number;
|
|
330
|
+
successCount: number;
|
|
331
|
+
failCount: number;
|
|
332
|
+
finishedAt?: string | null;
|
|
333
|
+
}
|
|
334
|
+
interface NotificationByJobItemResponse {
|
|
335
|
+
notificationId: string;
|
|
336
|
+
jobId: string;
|
|
337
|
+
originReference?: string | null;
|
|
338
|
+
clientId?: string | null;
|
|
339
|
+
groupId?: string | null;
|
|
340
|
+
statusId: string;
|
|
341
|
+
createdAt?: string | null;
|
|
342
|
+
}
|
|
343
|
+
interface NotificationJobProgressResponse {
|
|
344
|
+
jobId: string;
|
|
345
|
+
featureCode: string;
|
|
346
|
+
origin: string;
|
|
347
|
+
createdBy: string;
|
|
348
|
+
createdAt: string;
|
|
349
|
+
statusId: number;
|
|
350
|
+
statusCode?: string | null;
|
|
351
|
+
totalCount: number;
|
|
352
|
+
processedCount: number;
|
|
353
|
+
successCount: number;
|
|
354
|
+
failCount: number;
|
|
355
|
+
finishedAt?: string | null;
|
|
356
|
+
percent: number;
|
|
357
|
+
}
|
|
358
|
+
interface NotificationRecipientSummaryResponse {
|
|
359
|
+
recipientId: string;
|
|
360
|
+
channelCode: string | "";
|
|
361
|
+
recipientTypeCode: string | "";
|
|
362
|
+
userId?: string | null;
|
|
363
|
+
clientId?: string | null;
|
|
364
|
+
groupId?: string | null;
|
|
365
|
+
address: string;
|
|
366
|
+
statusCode: string;
|
|
367
|
+
attempts: number;
|
|
368
|
+
lastAttemptAt?: string | null;
|
|
369
|
+
lastErrorMessage?: string | null;
|
|
370
|
+
isRequiredAsUnread: boolean;
|
|
371
|
+
isRead: boolean;
|
|
372
|
+
readAt?: string | null;
|
|
373
|
+
isHidden: boolean;
|
|
374
|
+
hiddenAt?: string | null;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
interface RecipientDispatchError {
|
|
378
|
+
recipientId: string;
|
|
379
|
+
lastErrorMessage: string | null;
|
|
380
|
+
notificationId?: string;
|
|
381
|
+
jobId?: string | null;
|
|
382
|
+
channelCode?: string;
|
|
383
|
+
statusCode?: string;
|
|
384
|
+
attempts?: number;
|
|
385
|
+
lastAttemptAt?: string | null;
|
|
386
|
+
userId?: string | null;
|
|
387
|
+
clientId?: string | null;
|
|
388
|
+
groupId?: string | null;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
declare class NotificationService {
|
|
392
|
+
private http;
|
|
393
|
+
private readonly configService;
|
|
394
|
+
private readonly path;
|
|
395
|
+
constructor(http: HttpClient);
|
|
396
|
+
getUserNotificacions(): Observable<UserNotificationInboxItem[]>;
|
|
397
|
+
markAsRead(recipientId: string): Observable<NotificationRecipientSummaryResponse>;
|
|
398
|
+
markAllAsRead(): Observable<NotificationRecipientSummaryResponse[]>;
|
|
399
|
+
markAsHidden(recipientId: string): Observable<NotificationRecipientSummaryResponse>;
|
|
400
|
+
htmlPreview(request: HtmlPreviewBucket): Observable<string>;
|
|
401
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NotificationService, never>;
|
|
402
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NotificationService>;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
declare class NotificationJobService {
|
|
406
|
+
private http;
|
|
407
|
+
private readonly configService;
|
|
408
|
+
private readonly path;
|
|
409
|
+
constructor(http: HttpClient);
|
|
410
|
+
createJobNotifications(payload: CreateNotificationJobRequest): Observable<NotificationJobResponse>;
|
|
411
|
+
createJob(payload: CreateNotificationJobRequest): Observable<NotificationJobResponse>;
|
|
412
|
+
getJob(jobId: string): Observable<NotificationJobResponse>;
|
|
413
|
+
createNotifications(jobId: string, payload: CreateNotificationsForJobRequest[]): Observable<NotificationResponse>;
|
|
414
|
+
getActiveJob(featureCode: string, origin?: string): Observable<NotificationJobResponse | null>;
|
|
415
|
+
getRecipients(jobId: string): Observable<NotificationRecipientSummaryResponse[]>;
|
|
416
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NotificationJobService, never>;
|
|
417
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NotificationJobService>;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
declare class NotificationSignalRService {
|
|
421
|
+
private zone;
|
|
422
|
+
private readonly configService;
|
|
423
|
+
private readonly path;
|
|
424
|
+
private hubConnection?;
|
|
425
|
+
private startPromise?;
|
|
426
|
+
private joinedGroups;
|
|
427
|
+
private notificationSendSubject;
|
|
428
|
+
notificationSend$: rxjs.Observable<RecipientNotification>;
|
|
429
|
+
private jobProgressSubject;
|
|
430
|
+
jobProgress$: rxjs.Observable<RecipientProgressNotification>;
|
|
431
|
+
private callbackResultSubject;
|
|
432
|
+
callbackResult$: rxjs.Observable<CallbackExecutionResult>;
|
|
433
|
+
constructor(zone: NgZone);
|
|
434
|
+
startConnection(): Promise<void>;
|
|
435
|
+
joinScope(scopeType: string, scopeId: string): Promise<void>;
|
|
436
|
+
leaveScope(scopeType: string, scopeId: string): Promise<void>;
|
|
437
|
+
stopConnection(): Promise<void>;
|
|
438
|
+
private registerListeners;
|
|
439
|
+
private registerReconnectHandlers;
|
|
440
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NotificationSignalRService, never>;
|
|
441
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NotificationSignalRService>;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
declare class NotificationOrchestratorService {
|
|
445
|
+
private jobService;
|
|
446
|
+
private notificationService;
|
|
447
|
+
private signalR;
|
|
448
|
+
private origin?;
|
|
449
|
+
private featureCode?;
|
|
450
|
+
private currentJobId?;
|
|
451
|
+
private subscribedJobId?;
|
|
452
|
+
private readonly jobStateSubject;
|
|
453
|
+
readonly jobState$: Observable<JobState>;
|
|
454
|
+
private readonly dispatchErrorsMapSubject;
|
|
455
|
+
readonly dispatchErrors$: Observable<Map<string, RecipientDispatchError>>;
|
|
456
|
+
private readonly callbackRawSubject;
|
|
457
|
+
readonly callbackRaw$: Observable<CallbackExecutionResult>;
|
|
458
|
+
private readonly jobProgressSubjects;
|
|
459
|
+
private readonly jobWatchRefCount;
|
|
460
|
+
private readonly userInboxSubjects;
|
|
461
|
+
private readonly userWatchRefCount;
|
|
462
|
+
private initInFlight?;
|
|
463
|
+
constructor(jobService: NotificationJobService, notificationService: NotificationService, signalR: NotificationSignalRService);
|
|
464
|
+
watchUserInbox(userId: string): Promise<Observable<RecipientNotification>>;
|
|
465
|
+
unwatchUserInbox(userId: string): Promise<void>;
|
|
466
|
+
userInbox$(userId: string): Observable<RecipientNotification>;
|
|
467
|
+
watchJobProgress(jobId: string): Promise<Observable<RecipientProgressNotification>>;
|
|
468
|
+
unwatchJobProgress(jobId: string): Promise<void>;
|
|
469
|
+
jobProgress$(jobId: string): Observable<RecipientProgressNotification>;
|
|
470
|
+
rehydrateScope(origin: OriginCatalog, featureCode: string): Promise<void>;
|
|
471
|
+
getCurrentJobId(): string | undefined;
|
|
472
|
+
getJobStateSnapshot(): JobState;
|
|
473
|
+
ensureActiveOrCreateJobNotifications(notificationDraft: NotificationDraft[]): Promise<{
|
|
474
|
+
jobId: string;
|
|
475
|
+
mode: "active" | "created";
|
|
476
|
+
}>;
|
|
477
|
+
ensureCreateJobNotifications(origin: OriginCatalog, featureCode: string, notificationDraft: NotificationDraft[]): Promise<void>;
|
|
478
|
+
markAsRead(recipientId: string): Promise<NotificationRecipientSummaryResponse>;
|
|
479
|
+
markAllAsRead(): Promise<NotificationRecipientSummaryResponse[]>;
|
|
480
|
+
markAsHidden(recipientId: string): Promise<NotificationRecipientSummaryResponse>;
|
|
481
|
+
htmlPreview(request: HtmlPreviewBucket): Promise<string>;
|
|
482
|
+
getUserNotificacions(): Promise<UserNotificationInboxItem[]>;
|
|
483
|
+
resetLocal(): void;
|
|
484
|
+
private rehydrateActiveJobInternal;
|
|
485
|
+
private subscribeToJob;
|
|
486
|
+
private onNotificationSend;
|
|
487
|
+
private onJobProgress;
|
|
488
|
+
private onCallbackResult;
|
|
489
|
+
private setJobState;
|
|
490
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NotificationOrchestratorService, never>;
|
|
491
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NotificationOrchestratorService>;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
export { NotificationJobService, NotificationOrchestratorService, NotificationService, NotificationSignalRService };
|
|
495
|
+
export type { ActionTypeCatalog, BucketCatalog, CallbackExecutionResult, ChannelCatalog, CreateNotificationJobRequest, CreateNotificationsForJobRequest, DestinationTypeCatalog, HtmlPreviewBucket, JobState, JobStatusCatalog, MethodTypeCatalog, NotificationByJobItemResponse, NotificationDraft, NotificationJobProgressResponse, NotificationJobResponse, NotificationRecipientSummaryResponse, NotificationResponse, NotificationTypeCatalog, OriginCatalog, PriorityCatalog, RecipientDispatchError, RecipientNotification, RecipientNotificationAction, RecipientProgressNotification, RecipientProgressNotificationAction, RecipientTypeCatalog, UserNotificationAction, UserNotificationInboxItem };
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "intelica-library-notification",
|
|
3
|
+
"version": "20.0.1",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^20.3.0",
|
|
6
|
+
"@angular/core": "^20.3.0",
|
|
7
|
+
"@microsoft/signalr": "^10.0.0",
|
|
8
|
+
"intelica-library-base": "*",
|
|
9
|
+
"rxjs": "~7.8.0"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"tslib": "^2.3.0"
|
|
13
|
+
},
|
|
14
|
+
"sideEffects": false,
|
|
15
|
+
"module": "fesm2022/intelica-library-notification.mjs",
|
|
16
|
+
"typings": "index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
"./package.json": {
|
|
19
|
+
"default": "./package.json"
|
|
20
|
+
},
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./index.d.ts",
|
|
23
|
+
"default": "./fesm2022/intelica-library-notification.mjs"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|