intelica-library-components 1.1.43 → 1.1.45
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.
|
@@ -10725,13 +10725,13 @@ class NotificationOrchestratorService {
|
|
|
10725
10725
|
notificationService;
|
|
10726
10726
|
signalR;
|
|
10727
10727
|
// Config actual (feature/origin) del “scope”
|
|
10728
|
-
featureCode;
|
|
10729
10728
|
origin;
|
|
10729
|
+
featureCode;
|
|
10730
10730
|
currentJobId;
|
|
10731
10731
|
subscribedJobId;
|
|
10732
10732
|
// --- streams públicos (feature/origin job state)
|
|
10733
10733
|
jobStateSubject = new BehaviorSubject({
|
|
10734
|
-
status: "
|
|
10734
|
+
status: "pending",
|
|
10735
10735
|
processedCount: 0,
|
|
10736
10736
|
totalCount: 0,
|
|
10737
10737
|
processedNotificationsCount: 0,
|
|
@@ -10857,7 +10857,7 @@ class NotificationOrchestratorService {
|
|
|
10857
10857
|
getJobStateSnapshot() {
|
|
10858
10858
|
return this.jobStateSubject.value;
|
|
10859
10859
|
}
|
|
10860
|
-
async ensureActiveOrCreateJobNotifications(
|
|
10860
|
+
async ensureActiveOrCreateJobNotifications(notificationDraft) {
|
|
10861
10861
|
if (!this.origin || !this.featureCode)
|
|
10862
10862
|
throw new Error("Scope not initialized. Call rehydrateScope(featureCode, origin) first.");
|
|
10863
10863
|
if (this.currentJobId) {
|
|
@@ -10866,8 +10866,8 @@ class NotificationOrchestratorService {
|
|
|
10866
10866
|
const jobPayload = {
|
|
10867
10867
|
featureCode: this.featureCode,
|
|
10868
10868
|
origin: this.origin,
|
|
10869
|
-
totalCount,
|
|
10870
|
-
totalNotificationsCount,
|
|
10869
|
+
totalCount: notificationDraft?.length ?? 0,
|
|
10870
|
+
totalNotificationsCount: notificationDraft?.filter(n => n.recipients?.some(r => r.isRequiredForProcessed)).length ?? 0,
|
|
10871
10871
|
};
|
|
10872
10872
|
const job = await firstValueFrom(this.jobService.createJob(jobPayload));
|
|
10873
10873
|
this.currentJobId = job.jobId;
|
|
@@ -10875,9 +10875,9 @@ class NotificationOrchestratorService {
|
|
|
10875
10875
|
jobId: this.currentJobId,
|
|
10876
10876
|
status: "pending",
|
|
10877
10877
|
processedCount: 0,
|
|
10878
|
-
totalCount,
|
|
10878
|
+
totalCount: jobPayload.totalCount,
|
|
10879
10879
|
processedNotificationsCount: 0,
|
|
10880
|
-
totalNotificationsCount,
|
|
10880
|
+
totalNotificationsCount: jobPayload.totalNotificationsCount,
|
|
10881
10881
|
});
|
|
10882
10882
|
await this.subscribeToJob(this.currentJobId);
|
|
10883
10883
|
const notifications = notificationDraft.map(draft => ({
|
|
@@ -10894,19 +10894,20 @@ class NotificationOrchestratorService {
|
|
|
10894
10894
|
metaData: draft.metaData,
|
|
10895
10895
|
recipients: draft.recipients,
|
|
10896
10896
|
actions: draft.actions,
|
|
10897
|
+
attachments: draft.attachments,
|
|
10897
10898
|
callbacks: draft.callbacks,
|
|
10898
10899
|
}));
|
|
10899
10900
|
await firstValueFrom(this.jobService.createNotifications(job.jobId, notifications));
|
|
10900
10901
|
return { jobId: this.currentJobId, mode: "created" };
|
|
10901
10902
|
}
|
|
10902
|
-
async ensureCreateJobNotifications(origin, featureCode,
|
|
10903
|
-
if (!origin || featureCode)
|
|
10903
|
+
async ensureCreateJobNotifications(origin, featureCode, notificationDraft) {
|
|
10904
|
+
if (!origin || !featureCode)
|
|
10904
10905
|
throw new Error("Scope not initialized.");
|
|
10905
10906
|
const jobPayload = {
|
|
10906
10907
|
featureCode: featureCode,
|
|
10907
10908
|
origin: origin,
|
|
10908
|
-
totalCount,
|
|
10909
|
-
totalNotificationsCount,
|
|
10909
|
+
totalCount: 1,
|
|
10910
|
+
totalNotificationsCount: 1,
|
|
10910
10911
|
notifications: notificationDraft.map(draft => ({
|
|
10911
10912
|
originReference: draft.originReference,
|
|
10912
10913
|
notificationTypeCode: draft.notificationTypeCode,
|
|
@@ -10921,6 +10922,8 @@ class NotificationOrchestratorService {
|
|
|
10921
10922
|
metaData: draft.metaData,
|
|
10922
10923
|
recipients: draft.recipients,
|
|
10923
10924
|
actions: draft.actions,
|
|
10925
|
+
attachments: draft.attachments,
|
|
10926
|
+
callbacks: draft.callbacks,
|
|
10924
10927
|
})),
|
|
10925
10928
|
};
|
|
10926
10929
|
await firstValueFrom(this.jobService.createJobNotifications(jobPayload));
|
|
@@ -10939,7 +10942,7 @@ class NotificationOrchestratorService {
|
|
|
10939
10942
|
}
|
|
10940
10943
|
resetLocal() {
|
|
10941
10944
|
this.currentJobId = undefined;
|
|
10942
|
-
this.setJobState({ status: "
|
|
10945
|
+
this.setJobState({ status: "pending", processedCount: 0, totalCount: 0, processedNotificationsCount: 0, totalNotificationsCount: 0 });
|
|
10943
10946
|
this.dispatchErrorsMapSubject.next(new Map());
|
|
10944
10947
|
}
|
|
10945
10948
|
async rehydrateActiveJobInternal() {
|
|
@@ -10948,7 +10951,7 @@ class NotificationOrchestratorService {
|
|
|
10948
10951
|
const active = await firstValueFrom(this.jobService.getActiveJob(this.featureCode, this.origin));
|
|
10949
10952
|
if (!active) {
|
|
10950
10953
|
this.currentJobId = undefined;
|
|
10951
|
-
this.setJobState({ status: "
|
|
10954
|
+
this.setJobState({ status: "pending", processedCount: 0, totalCount: 0, processedNotificationsCount: 0, totalNotificationsCount: 0 });
|
|
10952
10955
|
this.dispatchErrorsMapSubject.next(new Map());
|
|
10953
10956
|
return;
|
|
10954
10957
|
}
|