@fluxhub/fluxhub-lib 21.0.3 → 21.0.4

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.
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, InjectionToken, inject, forwardRef, EventEmitter, Input, Output, ViewChild, Component, Inject, Pipe, HostListener, Directive, ChangeDetectionStrategy, ViewEncapsulation, ViewContainerRef, Optional, HostBinding } from '@angular/core';
2
+ import { InjectionToken, Injectable, inject, forwardRef, EventEmitter, Input, Output, ViewChild, Component, Inject, Pipe, HostListener, Directive, ChangeDetectionStrategy, ViewEncapsulation, ViewContainerRef, Optional, HostBinding } from '@angular/core';
3
3
  import * as i1$1 from '@angular/common/http';
4
- import { HttpHeaders, HttpErrorResponse, HttpEventType } from '@angular/common/http';
4
+ import { HttpErrorResponse, HttpHeaders, HttpEventType } from '@angular/common/http';
5
5
  import { map, catchError, flatMap, debounceTime, switchMap, filter, take, tap } from 'rxjs/operators';
6
6
  import * as i3 from 'ngx-toastr';
7
7
  import * as i3$1 from '@angular/router';
@@ -88,6 +88,89 @@ class QParam {
88
88
  names = new Array();
89
89
  }
90
90
 
91
+ /** Fornito dal portale: `{ provide: FH_ERROR_REPORTER, useValue: (r) => ... }` */
92
+ const FH_ERROR_REPORTER = new InjectionToken('FH_ERROR_REPORTER');
93
+ /** Header con cui il server dichiara di aver gia' registrato l'errore. */
94
+ const FH_EVENT_ID_HEADER = 'X-FH-Event-Id';
95
+ /** Header con la pagina del portale, letto dal server per arricchire i suoi eventi. */
96
+ const FH_ROUTE_HEADER = 'X-FH-Route';
97
+ /** Pagina corrente: i portali usano l'hash routing (/#/home), altrimenti il path. */
98
+ function fhCurrentRoute() {
99
+ try {
100
+ const h = window.location.hash || '';
101
+ const r = h.startsWith('#') ? h.substring(1) : window.location.pathname;
102
+ // Va in un header HTTP: solo ASCII stampabile, il resto codificato.
103
+ return (r.split('?')[0] || '/')
104
+ .substring(0, 200)
105
+ .replace(/[^\x20-\x7E]/g, (c) => encodeURIComponent(c));
106
+ }
107
+ catch {
108
+ return '';
109
+ }
110
+ }
111
+ function fhEndpointOf(url) {
112
+ if (!url)
113
+ return '';
114
+ try {
115
+ // Solo l'ultimo segmento (/doquery, /dogridn): il prefisso del reverse proxy
116
+ // (/fh3/...) cambia da portale a portale e il backend non lo vede.
117
+ const segs = new URL(url, window.location.href).pathname.split('/').filter((x) => x);
118
+ return '/' + (segs[segs.length - 1] || '');
119
+ }
120
+ catch {
121
+ return url;
122
+ }
123
+ }
124
+ /** Invoca il reporter senza mai far fallire la chiamata dati per colpa sua. */
125
+ function fhReport(reporter, r) {
126
+ if (!reporter || !r)
127
+ return;
128
+ try {
129
+ reporter(r);
130
+ }
131
+ catch {
132
+ // il monitoraggio non deve mai rompere il portale
133
+ }
134
+ }
135
+ /** Report per un errore di trasporto, o null se non va segnalato. */
136
+ function fhHttpErrorReport(err, base) {
137
+ if (!(err instanceof HttpErrorResponse))
138
+ return null;
139
+ // 401 lo gestisce l'interceptor (refresh token); 0 e' rete assente o richiesta
140
+ // interrotta dal cambio pagina: rumore. Si segnalano gli errori del server.
141
+ if (err.status < 500)
142
+ return null;
143
+ return {
144
+ ...base,
145
+ kind: 'http',
146
+ status: err.status,
147
+ message: `${err.status} ${err.statusText || ''}`.trim(),
148
+ serverEventId: fhEventId(err.headers),
149
+ };
150
+ }
151
+ function fhEventId(h) {
152
+ try {
153
+ return h?.get(FH_EVENT_ID_HEADER) || null;
154
+ }
155
+ catch {
156
+ return null;
157
+ }
158
+ }
159
+ /**
160
+ * Errore rilanciato dai servizi dati dopo un KO gia' mostrato a video (toast) e, per
161
+ * query e griglie, gia' segnalato: serve solo a interrompere la catena del chiamante.
162
+ * Se il chiamante non lo gestisce arriverebbe a Rustrak come "Error: No error message",
163
+ * doppione del KO: il portale lo riconosce con fhIsHandled() e lo scarta.
164
+ */
165
+ function fhHandledError() {
166
+ const e = new Error();
167
+ e.fhHandled = true;
168
+ return e;
169
+ }
170
+ function fhIsHandled(err) {
171
+ return !!err?.fhHandled;
172
+ }
173
+
91
174
  class QGResult {
92
175
  result_msg = '';
93
176
  msg = '';
@@ -1219,7 +1302,7 @@ class AuthenticationService {
1219
1302
  if (displayError) {
1220
1303
  this.toastr.error(err.message);
1221
1304
  }
1222
- throw new Error();
1305
+ throw fhHandledError();
1223
1306
  }
1224
1307
  return res || new QGResult();
1225
1308
  }), catchError((err) => {
@@ -1264,7 +1347,7 @@ class AuthenticationService {
1264
1347
  if (displayError) {
1265
1348
  this.toastr.error(err.message);
1266
1349
  }
1267
- throw new Error();
1350
+ throw fhHandledError();
1268
1351
  }
1269
1352
  return res || new QGResult();
1270
1353
  }), catchError((err) => {
@@ -1308,7 +1391,7 @@ class AuthenticationService {
1308
1391
  if (displayError) {
1309
1392
  this.toastr.error(err.message);
1310
1393
  }
1311
- throw new Error();
1394
+ throw fhHandledError();
1312
1395
  }
1313
1396
  return res || new QGResult();
1314
1397
  }), catchError((err) => {
@@ -1343,7 +1426,7 @@ class AuthenticationService {
1343
1426
  if (displayError) {
1344
1427
  this.toastr.error(err.message);
1345
1428
  }
1346
- throw new Error();
1429
+ throw fhHandledError();
1347
1430
  }
1348
1431
  return res || new QGResult();
1349
1432
  }), catchError((err) => {
@@ -1378,7 +1461,7 @@ class AuthenticationService {
1378
1461
  if (displayError) {
1379
1462
  this.toastr.error(err.message);
1380
1463
  }
1381
- throw new Error();
1464
+ throw fhHandledError();
1382
1465
  }
1383
1466
  return res || new QGResult();
1384
1467
  }), catchError((err) => {
@@ -1417,7 +1500,7 @@ class AuthenticationService {
1417
1500
  if (displayError) {
1418
1501
  this.toastr.error(err.message);
1419
1502
  }
1420
- throw new Error();
1503
+ throw fhHandledError();
1421
1504
  }
1422
1505
  return res || new QGResult();
1423
1506
  }), catchError((err) => {
@@ -1451,7 +1534,7 @@ class AuthenticationService {
1451
1534
  if (displayError) {
1452
1535
  this.toastr.error(err.message);
1453
1536
  }
1454
- throw new Error();
1537
+ throw fhHandledError();
1455
1538
  }
1456
1539
  return res || new QGResult();
1457
1540
  }), catchError((err) => {
@@ -1489,7 +1572,7 @@ class AuthenticationService {
1489
1572
  if (displayError) {
1490
1573
  this.toastr.error(err.message);
1491
1574
  }
1492
- throw new Error();
1575
+ throw fhHandledError();
1493
1576
  }
1494
1577
  return res || new QGResult();
1495
1578
  }), catchError((err) => {
@@ -1533,75 +1616,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
1533
1616
  }]
1534
1617
  }], ctorParameters: () => [{ type: i3.ToastrService }, { type: i1$1.HttpClient }, { type: i3$1.Router }, { type: AppService }, { type: UtilityService }] });
1535
1618
 
1536
- /** Fornito dal portale: `{ provide: FH_ERROR_REPORTER, useValue: (r) => ... }` */
1537
- const FH_ERROR_REPORTER = new InjectionToken('FH_ERROR_REPORTER');
1538
- /** Header con cui il server dichiara di aver gia' registrato l'errore. */
1539
- const FH_EVENT_ID_HEADER = 'X-FH-Event-Id';
1540
- /** Header con la pagina del portale, letto dal server per arricchire i suoi eventi. */
1541
- const FH_ROUTE_HEADER = 'X-FH-Route';
1542
- /** Pagina corrente: i portali usano l'hash routing (/#/home), altrimenti il path. */
1543
- function fhCurrentRoute() {
1544
- try {
1545
- const h = window.location.hash || '';
1546
- const r = h.startsWith('#') ? h.substring(1) : window.location.pathname;
1547
- // Va in un header HTTP: solo ASCII stampabile, il resto codificato.
1548
- return (r.split('?')[0] || '/')
1549
- .substring(0, 200)
1550
- .replace(/[^\x20-\x7E]/g, (c) => encodeURIComponent(c));
1551
- }
1552
- catch {
1553
- return '';
1554
- }
1555
- }
1556
- function fhEndpointOf(url) {
1557
- if (!url)
1558
- return '';
1559
- try {
1560
- // Solo l'ultimo segmento (/doquery, /dogridn): il prefisso del reverse proxy
1561
- // (/fh3/...) cambia da portale a portale e il backend non lo vede.
1562
- const segs = new URL(url, window.location.href).pathname.split('/').filter((x) => x);
1563
- return '/' + (segs[segs.length - 1] || '');
1564
- }
1565
- catch {
1566
- return url;
1567
- }
1568
- }
1569
- /** Invoca il reporter senza mai far fallire la chiamata dati per colpa sua. */
1570
- function fhReport(reporter, r) {
1571
- if (!reporter || !r)
1572
- return;
1573
- try {
1574
- reporter(r);
1575
- }
1576
- catch {
1577
- // il monitoraggio non deve mai rompere il portale
1578
- }
1579
- }
1580
- /** Report per un errore di trasporto, o null se non va segnalato. */
1581
- function fhHttpErrorReport(err, base) {
1582
- if (!(err instanceof HttpErrorResponse))
1583
- return null;
1584
- // 401 lo gestisce l'interceptor (refresh token); 0 e' rete assente o richiesta
1585
- // interrotta dal cambio pagina: rumore. Si segnalano gli errori del server.
1586
- if (err.status < 500)
1587
- return null;
1588
- return {
1589
- ...base,
1590
- kind: 'http',
1591
- status: err.status,
1592
- message: `${err.status} ${err.statusText || ''}`.trim(),
1593
- serverEventId: fhEventId(err.headers),
1594
- };
1595
- }
1596
- function fhEventId(h) {
1597
- try {
1598
- return h?.get(FH_EVENT_ID_HEADER) || null;
1599
- }
1600
- catch {
1601
- return null;
1602
- }
1603
- }
1604
-
1605
1619
  class QueryService {
1606
1620
  http;
1607
1621
  toastr;
@@ -1723,7 +1737,7 @@ class QueryService {
1723
1737
  if (err.message.indexOf('ORA-50012') == -1)
1724
1738
  this.toastr.error(queryp.sql + ' ' + err.message);
1725
1739
  }
1726
- throw new Error();
1740
+ throw fhHandledError();
1727
1741
  }
1728
1742
  if (this.app_s.COMPANY_KEY == 'COCIF_')
1729
1743
  if (!!res)
@@ -1932,7 +1946,7 @@ class OdbcService {
1932
1946
  if (displayError) {
1933
1947
  this.toastr.error(queryp.sql + ' ' + err.message);
1934
1948
  }
1935
- throw new Error();
1949
+ throw fhHandledError();
1936
1950
  }
1937
1951
  return res || new QGResult();
1938
1952
  }), catchError((err) => {
@@ -8898,7 +8912,7 @@ class GridService {
8898
8912
  if (displayError) {
8899
8913
  this.toastr.error(err.message);
8900
8914
  }
8901
- throw new Error();
8915
+ throw fhHandledError();
8902
8916
  }
8903
8917
  if (this.app_s.COMPANY_KEY == 'COCIF_')
8904
8918
  if (!!res)
@@ -8971,7 +8985,7 @@ class FileService {
8971
8985
  if (displayError) {
8972
8986
  this.toastr.error(err.message);
8973
8987
  }
8974
- throw new Error();
8988
+ throw fhHandledError();
8975
8989
  }
8976
8990
  return res || new QGResult();
8977
8991
  }), catchError((err) => {
@@ -14988,7 +15002,7 @@ class WkfService {
14988
15002
  if (displayError) {
14989
15003
  this.toastr.error(err.message);
14990
15004
  }
14991
- throw new Error();
15005
+ throw fhHandledError();
14992
15006
  }
14993
15007
  if (this.app_s.COMPANY_KEY == 'COCIF_')
14994
15008
  if (!!res)
@@ -15149,7 +15163,10 @@ class FHNotesPanelComponent {
15149
15163
  this.App +
15150
15164
  '|' +
15151
15165
  this.K;
15152
- this.m_file.doQuery(p, false).subscribe();
15166
+ this.m_file.doQuery(p, false).subscribe({
15167
+ // hook facoltativo: il portale puo' non avere l'utility, il commento e' gia' salvato
15168
+ error: () => { },
15169
+ });
15153
15170
  ok_op = true;
15154
15171
  this.b_edit = false;
15155
15172
  this.refresh_list();
@@ -15182,7 +15199,10 @@ class FHNotesPanelComponent {
15182
15199
  this.K +
15183
15200
  '|' +
15184
15201
  this.edit_id;
15185
- this.m_file.doQuery(p, false).subscribe();
15202
+ this.m_file.doQuery(p, false).subscribe({
15203
+ // hook facoltativo: il portale puo' non avere l'utility, il commento e' gia' salvato
15204
+ error: () => { },
15205
+ });
15186
15206
  ok_op = true;
15187
15207
  this.b_edit = false;
15188
15208
  this.refresh_list();
@@ -26509,7 +26529,7 @@ class AppMakerService {
26509
26529
  if (displayError) {
26510
26530
  this.toastr.error(err.message);
26511
26531
  }
26512
- throw new Error();
26532
+ throw fhHandledError();
26513
26533
  }
26514
26534
  return r || new QGResult();
26515
26535
  }), catchError((err) => {
@@ -27306,7 +27326,7 @@ class FHGridInternalComponent {
27306
27326
  if (obj_filtro.dateTo != null && obj_filtro.dateFrom != null) {
27307
27327
  if (obj_filtro.dateFrom >= obj_filtro.dateTo) {
27308
27328
  this._toast.error('Data inizio range deve essere maggiore di data fine range');
27309
- return;
27329
+ return filter_v; // filtro invariato: undefined finirebbe concatenato nel WHERE
27310
27330
  }
27311
27331
  b_filter = true;
27312
27332
  if (add_end)
@@ -31278,7 +31298,10 @@ class win_commenti_v2 {
31278
31298
  this.m_appService.getState().wkf_doc_info.uiid_app +
31279
31299
  '|' +
31280
31300
  this.m_appService.getState().wkf_doc_info.uiid_doc;
31281
- this.m_file.doQuery(p, false).subscribe();
31301
+ this.m_file.doQuery(p, false).subscribe({
31302
+ // hook facoltativo: il portale puo' non avere l'utility, il commento e' gia' salvato
31303
+ error: () => { },
31304
+ });
31282
31305
  ok_op = true;
31283
31306
  this.b_edit = false;
31284
31307
  if (sdest != '')
@@ -31318,7 +31341,10 @@ class win_commenti_v2 {
31318
31341
  this.m_appService.getState().wkf_doc_info.uiid_doc +
31319
31342
  '|' +
31320
31343
  this.edit_id;
31321
- this.m_file.doQuery(p, false).subscribe();
31344
+ this.m_file.doQuery(p, false).subscribe({
31345
+ // hook facoltativo: il portale puo' non avere l'utility, il commento e' gia' salvato
31346
+ error: () => { },
31347
+ });
31322
31348
  ok_op = true;
31323
31349
  this.b_edit = false;
31324
31350
  if (sdest != '')
@@ -32320,7 +32346,10 @@ class win_log_v2 {
32320
32346
  this.m_appService.getState().wkf_doc_info.uiid_app +
32321
32347
  '|' +
32322
32348
  this.m_appService.getState().wkf_doc_info.uiid_doc;
32323
- this.m_file.doQuery(px, false).subscribe();
32349
+ this.m_file.doQuery(px, false).subscribe({
32350
+ // hook facoltativo: il portale puo' non avere l'utility, il commento e' gia' salvato
32351
+ error: () => { },
32352
+ });
32324
32353
  this.b_edit = false;
32325
32354
  if (sdest != '')
32326
32355
  this.sendEMail_ex(this.m_appService.getState().wkf_doc_info.curr_user, sdest, this.subject
@@ -32353,7 +32382,10 @@ class win_log_v2 {
32353
32382
  this.m_appService.getState().wkf_doc_info.uiid_app +
32354
32383
  '|' +
32355
32384
  this.m_appService.getState().wkf_doc_info.uiid_doc;
32356
- this.m_file.doQuery(px, false).subscribe();
32385
+ this.m_file.doQuery(px, false).subscribe({
32386
+ // hook facoltativo: il portale puo' non avere l'utility, il commento e' gia' salvato
32387
+ error: () => { },
32388
+ });
32357
32389
  this.b_edit = false;
32358
32390
  if (sdest != '')
32359
32391
  this.sendEMail_ex(this.m_appService.getState().wkf_doc_info.curr_user, sdest, this.subject
@@ -36255,7 +36287,7 @@ class RegistrationService {
36255
36287
  if (displayError) {
36256
36288
  this.toastr.error(err.message);
36257
36289
  }
36258
- throw new Error();
36290
+ throw fhHandledError();
36259
36291
  }
36260
36292
  return res || new QGResult();
36261
36293
  }), catchError((err) => {
@@ -36377,7 +36409,7 @@ class QueryOpenService {
36377
36409
  if (err.message.indexOf('ORA-50012') == -1)
36378
36410
  this.toastr.error(queryp.sql + ' ' + err.message);
36379
36411
  }
36380
- throw new Error();
36412
+ throw fhHandledError();
36381
36413
  }
36382
36414
  if (this.app_s.COMPANY_KEY == 'COCIF_')
36383
36415
  if (!!res)
@@ -36412,5 +36444,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
36412
36444
  * Generated bundle index. Do not edit.
36413
36445
  */
36414
36446
 
36415
- export { AppMakerService, AppService, ApprovaGridComponent, AuthHttpRequestInterceptor, AuthenticationService, CheckboxEditorComponent, ComboBoxEditorComponent, CurrencyComponent, FHAutoCompleteComponent, FHCheckBoxComponent, FHColorPickerComponent, FHComboboxComponent, FHConfirmValues, FHCurrencyFormatterDirective, FHCurrencyPipe, FHDatePickerComponent, FHDateRangePickerComponent, FHFieldPickListComponent, FHFilterComboboxComponent, FHFormBuilderComponent, FHFormExecuterComponent, FHFormToolBarComponent, FHGridComponent, FHGridJSONComponent, FHGridToolBarComponent, FHGuard, FHHelpButtonComponent, FHImageViewerComponent, FHListComponent, FHLogPanelComponent, FHMultiComboboxComponent, FHNotesPanelComponent, FHNumericFieldComponent, FHPickFieldComponent, FHPickUsersComponent, FHRichTextComponent, FHRoleManagerComponent, FHTableManagerComponent, FHTextAreaComponent, FHTextInputComponent, FHTimePickerComponent, FHUploadComponent, FHUploadPanelComponent, FHUploadPanelS3Component, FHUploadS3Component, FHUserFieldComponent, FHWinAppLogsComponent, FHWinAskBigTextComponent, FHWinAskButtonsComponent, FHWinAskNumberComponent, FHWinAskRichTextComponent, FHWinAskTextComponent, FHWinAutoComplete, FHWinComboComponent, FHWinConfirmComponent, FHWinErrorComponent, FHWinGridSelection, FHWinInfoComponent, FHWinListComponent, FHWinMappaComponent, FHWinOutputComponent, FHWinPicklistComponent, FHWinSalvaAnnulla, FHWinSelectByGridComponent, FHWinShowEmail, FHWinShowEmailS3, FHWinShowImage, FHWinShowLog, FHWinShowLogDett, FHWinTimeSlider, FHWinUploadComponent, FHWinUserInfo, FHWinUserPickerComponent, FHWinWaitComponent, FHWorkflowForm, FHWorkflowHeaderBar, FHWorkflowView, FH_ERROR_REPORTER, FH_EVENT_ID_HEADER, FH_ROUTE_HEADER, FSInput, FSResult, FileService, GridService, LocalDBService, MonthYearPickerComponent, NumericEditorComponent, OdbcService, OfficeAutomatorService, OfficeOperation, OfficeResult, QGParam, QGResult, QParam, QResult, QueryOpenService, QueryService, RegistrationService, ReplaceLineBreaks, SafePipe, TextAreaEditorComponent, UtilityService, WkfService, YearPickerComponent };
36447
+ export { AppMakerService, AppService, ApprovaGridComponent, AuthHttpRequestInterceptor, AuthenticationService, CheckboxEditorComponent, ComboBoxEditorComponent, CurrencyComponent, FHAutoCompleteComponent, FHCheckBoxComponent, FHColorPickerComponent, FHComboboxComponent, FHConfirmValues, FHCurrencyFormatterDirective, FHCurrencyPipe, FHDatePickerComponent, FHDateRangePickerComponent, FHFieldPickListComponent, FHFilterComboboxComponent, FHFormBuilderComponent, FHFormExecuterComponent, FHFormToolBarComponent, FHGridComponent, FHGridJSONComponent, FHGridToolBarComponent, FHGuard, FHHelpButtonComponent, FHImageViewerComponent, FHListComponent, FHLogPanelComponent, FHMultiComboboxComponent, FHNotesPanelComponent, FHNumericFieldComponent, FHPickFieldComponent, FHPickUsersComponent, FHRichTextComponent, FHRoleManagerComponent, FHTableManagerComponent, FHTextAreaComponent, FHTextInputComponent, FHTimePickerComponent, FHUploadComponent, FHUploadPanelComponent, FHUploadPanelS3Component, FHUploadS3Component, FHUserFieldComponent, FHWinAppLogsComponent, FHWinAskBigTextComponent, FHWinAskButtonsComponent, FHWinAskNumberComponent, FHWinAskRichTextComponent, FHWinAskTextComponent, FHWinAutoComplete, FHWinComboComponent, FHWinConfirmComponent, FHWinErrorComponent, FHWinGridSelection, FHWinInfoComponent, FHWinListComponent, FHWinMappaComponent, FHWinOutputComponent, FHWinPicklistComponent, FHWinSalvaAnnulla, FHWinSelectByGridComponent, FHWinShowEmail, FHWinShowEmailS3, FHWinShowImage, FHWinShowLog, FHWinShowLogDett, FHWinTimeSlider, FHWinUploadComponent, FHWinUserInfo, FHWinUserPickerComponent, FHWinWaitComponent, FHWorkflowForm, FHWorkflowHeaderBar, FHWorkflowView, FH_ERROR_REPORTER, FH_EVENT_ID_HEADER, FH_ROUTE_HEADER, FSInput, FSResult, FileService, GridService, LocalDBService, MonthYearPickerComponent, NumericEditorComponent, OdbcService, OfficeAutomatorService, OfficeOperation, OfficeResult, QGParam, QGResult, QParam, QResult, QueryOpenService, QueryService, RegistrationService, ReplaceLineBreaks, SafePipe, TextAreaEditorComponent, UtilityService, WkfService, YearPickerComponent, fhHandledError, fhIsHandled };
36416
36448
  //# sourceMappingURL=fluxhub-fluxhub-lib.mjs.map