@esfaenza/signalr-notifications 19.2.21 → 20.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/esfaenza-signalr-notifications.mjs +10 -10
- package/index.d.ts +252 -3
- package/package.json +3 -3
- package/lib/config/SignalrNotificationsModuleConfig.d.ts +0 -35
- package/lib/models/BaseMessageService.d.ts +0 -20
- package/lib/models/EndpointDef.d.ts +0 -22
- package/lib/models/JobProgressDto.d.ts +0 -55
- package/lib/signalr-notifications.module.d.ts +0 -9
- package/lib/signalr-notifications.service.d.ts +0 -89
- package/lib/tokens.d.ts +0 -25
- package/public-api.d.ts +0 -7
|
@@ -86,10 +86,10 @@ class BaseMessageService {
|
|
|
86
86
|
add(endpoint) {
|
|
87
87
|
this.definitions.push(endpoint);
|
|
88
88
|
}
|
|
89
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
90
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
89
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: BaseMessageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
90
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: BaseMessageService }); }
|
|
91
91
|
}
|
|
92
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
92
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: BaseMessageService, decorators: [{
|
|
93
93
|
type: Injectable
|
|
94
94
|
}], ctorParameters: () => [] });
|
|
95
95
|
|
|
@@ -307,10 +307,10 @@ class NotificationsService {
|
|
|
307
307
|
loc(message) {
|
|
308
308
|
return message;
|
|
309
309
|
}
|
|
310
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
311
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
310
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: NotificationsService, deps: [{ token: BaseMessageService }, { token: ENDPOINT_URL }, { token: MESSAGE_PACK }, { token: AVOID_WS }, { token: SIGNALR_ENABLED }, { token: SGR_DEBUG_MODE }, { token: AUTO_RECONNECT }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
311
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: NotificationsService }); }
|
|
312
312
|
}
|
|
313
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
313
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: NotificationsService, decorators: [{
|
|
314
314
|
type: Injectable
|
|
315
315
|
}], ctorParameters: () => [{ type: BaseMessageService }, { type: undefined, decorators: [{
|
|
316
316
|
type: Inject,
|
|
@@ -348,11 +348,11 @@ class SignalrNotificationsModule {
|
|
|
348
348
|
]
|
|
349
349
|
};
|
|
350
350
|
}
|
|
351
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
352
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
353
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
351
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: SignalrNotificationsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
352
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.24", ngImport: i0, type: SignalrNotificationsModule }); }
|
|
353
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: SignalrNotificationsModule }); }
|
|
354
354
|
}
|
|
355
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
355
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.24", ngImport: i0, type: SignalrNotificationsModule, decorators: [{
|
|
356
356
|
type: NgModule
|
|
357
357
|
}] });
|
|
358
358
|
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,254 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, Type, ModuleWithProviders } from '@angular/core';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
|
|
1
5
|
/**
|
|
2
|
-
*
|
|
6
|
+
* Hub a cui collegarsi
|
|
3
7
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
8
|
+
declare const ENDPOINT_URL: InjectionToken<string>;
|
|
9
|
+
/**
|
|
10
|
+
* Indica se la libreria dev'essere attiva o no
|
|
11
|
+
*/
|
|
12
|
+
declare const SIGNALR_ENABLED: InjectionToken<string>;
|
|
13
|
+
/**
|
|
14
|
+
* Indica se stampare messaggi di debug in console
|
|
15
|
+
*/
|
|
16
|
+
declare const SGR_DEBUG_MODE: InjectionToken<string>;
|
|
17
|
+
/**
|
|
18
|
+
* Indica se utilizzare il protocollo di trasferimento "MessagePack"
|
|
19
|
+
*/
|
|
20
|
+
declare const MESSAGE_PACK: InjectionToken<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* Indica se tentare in automatico la riconnessione
|
|
23
|
+
*/
|
|
24
|
+
declare const AUTO_RECONNECT: InjectionToken<boolean>;
|
|
25
|
+
/**
|
|
26
|
+
* Indica se evitare i WebSocket, imposta il trasporto a LongPolling
|
|
27
|
+
*/
|
|
28
|
+
declare const AVOID_WS: InjectionToken<boolean>;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Definisce un Endpoint che spedisce un'informazione di tipo TIn e restituisce un'informazione di tipo TOut
|
|
32
|
+
*/
|
|
33
|
+
declare class EndpointDef<TIn, TOut> {
|
|
34
|
+
endpoint: string;
|
|
35
|
+
inTypeDefault: TIn;
|
|
36
|
+
outTypeDefault: TOut;
|
|
37
|
+
/**
|
|
38
|
+
* Costruttore
|
|
39
|
+
*
|
|
40
|
+
* @param {string} endpoint Nome del metodo da chiamare nell'Hub del Backend contattato
|
|
41
|
+
* @param {TIn} inTypeDefault Default per il tipo TIn. Utilizzato per fare Typecheck sulle chiamate da Backend a Frontend
|
|
42
|
+
* @param {TOut} outTypeDefault Default per il tipo TOut. Utilizzato per fare Typecheck sulle chiamate da Frontend a Backend
|
|
43
|
+
*/
|
|
44
|
+
constructor(endpoint: string, inTypeDefault: TIn, outTypeDefault: TOut);
|
|
45
|
+
/** Helper per la creazione rapida di un Endpoint di solo INPUT */
|
|
46
|
+
static In<TIn>(name: string, inTypeDefault: TIn): EndpointDef<TIn, void>;
|
|
47
|
+
/** Helper per la creazione rapida di un Endpoint di solo OUTPUT */
|
|
48
|
+
static Out<TOut>(name: string, outTypeDefault: TOut): EndpointDef<void, TOut>;
|
|
49
|
+
/** Helper per la creazione rapida di un Endpoint di INPUT e OUTPUT (BIDIREZIONALE) */
|
|
50
|
+
static Bi<TIn, TOut>(name: string, inTypeDefault: TIn, outTypeDefault: TOut): EndpointDef<TIn, TOut>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
declare class JobProgressDto {
|
|
54
|
+
instance: string;
|
|
55
|
+
name: string;
|
|
56
|
+
group: string;
|
|
57
|
+
progress: number;
|
|
58
|
+
type: string;
|
|
59
|
+
description: string;
|
|
60
|
+
user: string;
|
|
61
|
+
etams: number;
|
|
62
|
+
durationms: number;
|
|
63
|
+
resultfile: string;
|
|
64
|
+
resultreport: string;
|
|
65
|
+
resultcomplexreport: string;
|
|
66
|
+
actionid: string;
|
|
67
|
+
logchunk: string;
|
|
68
|
+
resultreportparams: {
|
|
69
|
+
/** Codice del parametro */
|
|
70
|
+
id: string;
|
|
71
|
+
/** Descrizione del parametro */
|
|
72
|
+
description: string;
|
|
73
|
+
/** Sequenza del parametro per ordinarlo logicamente rispetto agli altri */
|
|
74
|
+
seq: number;
|
|
75
|
+
/** Typecode C# della tipologia di parametro */
|
|
76
|
+
typecode: number;
|
|
77
|
+
/** Indica se i parametro è richiesto o meno */
|
|
78
|
+
required: boolean;
|
|
79
|
+
/** Valore del parametro, offerto sia come valore di default o in alternativa riempito lato UI */
|
|
80
|
+
value?: any;
|
|
81
|
+
/** Indica se questo parametro si basa su un enum. Se questa proprietà è true mi aspetto che almeno **enumtype** sia valorizzato */
|
|
82
|
+
isenum: boolean;
|
|
83
|
+
/** Indica se questo parametro si basa su un dizionario. Se questa proprietà è true mi aspetto che almeno **dictype** sia valorizzato */
|
|
84
|
+
isdictionary: boolean;
|
|
85
|
+
/** Indica se il parametro è di tipo data */
|
|
86
|
+
isdate: boolean;
|
|
87
|
+
/** Indica se il parametro è di tipo boolean */
|
|
88
|
+
isboolean: boolean;
|
|
89
|
+
/** Valori disponibili per questo parametro, da valorizzare in caso **enumtype** o **dictype** fossero valorizzati */
|
|
90
|
+
availablevalues?: {
|
|
91
|
+
id: string;
|
|
92
|
+
description: string;
|
|
93
|
+
}[];
|
|
94
|
+
/** Tipo enumerabile del parametro (qualora fosse un dizionario di valori) */
|
|
95
|
+
enumtype?: string;
|
|
96
|
+
/** Colonna relativa e questo parametro */
|
|
97
|
+
column?: string;
|
|
98
|
+
/** Tipo del dizionario */
|
|
99
|
+
dictype?: string;
|
|
100
|
+
/** Indica un filtro da applicare nei confronti del Backend qualora si vogliano caricare solo le possibilità logicamente accettabili per questo parametro */
|
|
101
|
+
dictionaryfilter?: string;
|
|
102
|
+
/** Tipologia lato "typescript" di questo parametro, dev'essere sempre logicamente congruente al **typecode** */
|
|
103
|
+
type?: "string" | "number" | "date" | "boolean";
|
|
104
|
+
/** Eventuale pattern di validazione per questo parametro */
|
|
105
|
+
pattern?: string;
|
|
106
|
+
}[];
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Classe base da estendere con la definizione degli Endpoint supportati dall'applicazione
|
|
111
|
+
*/
|
|
112
|
+
declare class BaseMessageService {
|
|
113
|
+
private definitions;
|
|
114
|
+
IN_JobProgressNotification: EndpointDef<JobProgressDto, void>;
|
|
115
|
+
IN_SendVersion: EndpointDef<string, void>;
|
|
116
|
+
IN_ClearCache: EndpointDef<string, void>;
|
|
117
|
+
IN_ClearPreferecnes: EndpointDef<string, void>;
|
|
118
|
+
OUT_QueryJobStatus: EndpointDef<void, any>;
|
|
119
|
+
/** Entrypoint che restituisce tutti gli Endpoint dell'applicazione. Da overridare qualora non venga utilizzato il metodo **add** */
|
|
120
|
+
get AllDefinitions(): EndpointDef<any, any>[];
|
|
121
|
+
constructor();
|
|
122
|
+
add(endpoint: EndpointDef<any, any>): void;
|
|
123
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseMessageService, never>;
|
|
124
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<BaseMessageService>;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** Servizio che gestisce la comunicazione con un Hub SignalR in base alle configurazioni fornite dall'applicazione */
|
|
128
|
+
declare class NotificationsService {
|
|
129
|
+
private MessageDef;
|
|
130
|
+
private endpoint_url;
|
|
131
|
+
private msgpack;
|
|
132
|
+
private avoidWs;
|
|
133
|
+
private enabled;
|
|
134
|
+
private debug;
|
|
135
|
+
private autoreconnect;
|
|
136
|
+
/** Cache degli Observable generati in base agli Endpoint disponibili */
|
|
137
|
+
private notifications$;
|
|
138
|
+
/** Connessione Signalr */
|
|
139
|
+
private connection;
|
|
140
|
+
/** Coda di chiamate da recuperare quando la connessione viene finalmente aperta */
|
|
141
|
+
private RequestsToRecover;
|
|
142
|
+
/** @ignore Costruttore */
|
|
143
|
+
constructor(MessageDef: BaseMessageService, endpoint_url: string, msgpack: boolean, avoidWs: boolean, enabled: boolean, debug: boolean, autoreconnect: boolean);
|
|
144
|
+
private init;
|
|
145
|
+
/**
|
|
146
|
+
* Effettua la connessione all'Hub Signalr e registra tutti gli Endpoint per cui il Backend comunica con il Frontend sulla **connection**
|
|
147
|
+
*/
|
|
148
|
+
private connect;
|
|
149
|
+
/**
|
|
150
|
+
* Effettua verifiche sulla connessione e, in caso non fosse collegata, tenta di riconnetterla
|
|
151
|
+
*
|
|
152
|
+
* @returns {Promise<'OK' | 'KO' | 'NO-OP'>} 'OK' Se la connessione è già connessa o è stata riconnessa con successo, 'KO' Se non è stato possibile riconnettere
|
|
153
|
+
* una connessione disconnessa, 'NO-OP' se la connesisone è in uno stato intermedio che non può essere modificato
|
|
154
|
+
*/
|
|
155
|
+
ensureConnected(): Promise<'OK' | 'KO' | 'NO-OP'>;
|
|
156
|
+
/**
|
|
157
|
+
* Invia un messaggio all'Hub del Backend
|
|
158
|
+
*
|
|
159
|
+
* @param {EndpointDef<any, TOut>} item Endpoint da contattare
|
|
160
|
+
* @param {TOut} dto Dto da inviare all'Endpoint
|
|
161
|
+
*/
|
|
162
|
+
send<TOut>(item: EndpointDef<any, TOut>, dto: TOut): Observable<never>;
|
|
163
|
+
/**
|
|
164
|
+
* Invia un messaggio all'Hub del Backend, aspettandosi una risposta
|
|
165
|
+
*
|
|
166
|
+
* @param {EndpointDef<TOut, TIn>} item Endpoint da contattare
|
|
167
|
+
* @param {TOut} dto Dto da inviare all'Endpoint
|
|
168
|
+
*
|
|
169
|
+
* @returns {Observable<TIn>} Observable su cui ci si può registrare per ricevere il risultato della chiamata
|
|
170
|
+
*/
|
|
171
|
+
invoke<TOut, TIn>(item: EndpointDef<TOut, TIn>, dto: TOut): Observable<TIn>;
|
|
172
|
+
/**
|
|
173
|
+
* Hook per osservare i dati spediti ad un Endpoint dal Backend
|
|
174
|
+
*
|
|
175
|
+
* @param {EndpointDef<TIn, any>} item Endpoint su cui ascoltare
|
|
176
|
+
*
|
|
177
|
+
* @returns {Observable<TIn>} Observable su cui ci si può registrare per ricevere l'oggetto generato ad ogni chiamata dal Backend al Frontend
|
|
178
|
+
*/
|
|
179
|
+
observe<TIn>(item: EndpointDef<TIn, any>): Observable<TIn>;
|
|
180
|
+
/**
|
|
181
|
+
* Disconnessione del sistema di SignalR
|
|
182
|
+
*
|
|
183
|
+
* @returns {Observable<void>} Observable a cui registrarsi che viene chiamato quando la disconnessione è terminata
|
|
184
|
+
*/
|
|
185
|
+
disconnect(): Observable<void>;
|
|
186
|
+
/**
|
|
187
|
+
* Taglia un log troppo lungo
|
|
188
|
+
*
|
|
189
|
+
* @param {string} text Log da tagliare
|
|
190
|
+
* @param {number} maxchars Numero massimo di caratteri da tenere
|
|
191
|
+
*
|
|
192
|
+
* @returns {string} Log tagliato
|
|
193
|
+
*/
|
|
194
|
+
private substringLog;
|
|
195
|
+
/**
|
|
196
|
+
* Stampa un log a console
|
|
197
|
+
*
|
|
198
|
+
* @param {string} message Messaggio da stampare
|
|
199
|
+
*/
|
|
200
|
+
private log;
|
|
201
|
+
/**
|
|
202
|
+
* Helper di localizzazione
|
|
203
|
+
*
|
|
204
|
+
* @param {string} message Messaggio da tradurre
|
|
205
|
+
*
|
|
206
|
+
* @returns {string} Messaggio tradotto
|
|
207
|
+
*/
|
|
208
|
+
private loc;
|
|
209
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NotificationsService, never>;
|
|
210
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NotificationsService>;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Classe di configurazione per la libreria
|
|
215
|
+
*/
|
|
216
|
+
declare class SignalrNotificationsModuleConfig {
|
|
217
|
+
/**
|
|
218
|
+
* Url nei confronti del quale aprire la connessione SignalR
|
|
219
|
+
*/
|
|
220
|
+
endpointUrl: string;
|
|
221
|
+
/**
|
|
222
|
+
* Servizio che definisce i messaggi di IN e OUT coi loro default
|
|
223
|
+
*/
|
|
224
|
+
messageService?: Type<BaseMessageService>;
|
|
225
|
+
/**
|
|
226
|
+
* Indica se abilitare o meno la connessione SignalR nei confronti dell'URL **hubUrl**
|
|
227
|
+
*/
|
|
228
|
+
enabled?: boolean;
|
|
229
|
+
/**
|
|
230
|
+
* Indica se utilizzare message pack come protocollo di trasmissione
|
|
231
|
+
*/
|
|
232
|
+
useMessagePack?: boolean;
|
|
233
|
+
/**
|
|
234
|
+
* Indica se tentare di riconnettersi automaticamente quando la connessione cade
|
|
235
|
+
*/
|
|
236
|
+
autoReconnect?: boolean;
|
|
237
|
+
/**
|
|
238
|
+
* Indica se scrivere o meno i messaggi di debug
|
|
239
|
+
*/
|
|
240
|
+
debugMode?: boolean;
|
|
241
|
+
/**
|
|
242
|
+
* Indica se evitare di utilizzare i Websocket
|
|
243
|
+
*/
|
|
244
|
+
avoidWs?: boolean;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
declare class SignalrNotificationsModule {
|
|
248
|
+
static forRoot(config?: SignalrNotificationsModuleConfig): ModuleWithProviders<SignalrNotificationsModule>;
|
|
249
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SignalrNotificationsModule, never>;
|
|
250
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<SignalrNotificationsModule, never, never, never>;
|
|
251
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<SignalrNotificationsModule>;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export { AUTO_RECONNECT, AVOID_WS, BaseMessageService, ENDPOINT_URL, EndpointDef, JobProgressDto, MESSAGE_PACK, NotificationsService, SGR_DEBUG_MODE, SIGNALR_ENABLED, SignalrNotificationsModule, SignalrNotificationsModuleConfig };
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@esfaenza/signalr-notifications",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "20.3.0",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"tslib": "^2.0.0"
|
|
6
6
|
},
|
|
7
7
|
"peerDependencies": {
|
|
8
|
-
"@angular/common": "^
|
|
9
|
-
"@angular/core": "^
|
|
8
|
+
"@angular/common": "^20.3.24",
|
|
9
|
+
"@angular/core": "^20.3.24",
|
|
10
10
|
"@microsoft/signalr": "8.0.7",
|
|
11
11
|
"@microsoft/signalr-protocol-msgpack": "8.0.7"
|
|
12
12
|
},
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Type } from '@angular/core';
|
|
2
|
-
import { BaseMessageService } from '../models/BaseMessageService';
|
|
3
|
-
/**
|
|
4
|
-
* Classe di configurazione per la libreria
|
|
5
|
-
*/
|
|
6
|
-
export declare class SignalrNotificationsModuleConfig {
|
|
7
|
-
/**
|
|
8
|
-
* Url nei confronti del quale aprire la connessione SignalR
|
|
9
|
-
*/
|
|
10
|
-
endpointUrl: string;
|
|
11
|
-
/**
|
|
12
|
-
* Servizio che definisce i messaggi di IN e OUT coi loro default
|
|
13
|
-
*/
|
|
14
|
-
messageService?: Type<BaseMessageService>;
|
|
15
|
-
/**
|
|
16
|
-
* Indica se abilitare o meno la connessione SignalR nei confronti dell'URL **hubUrl**
|
|
17
|
-
*/
|
|
18
|
-
enabled?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Indica se utilizzare message pack come protocollo di trasmissione
|
|
21
|
-
*/
|
|
22
|
-
useMessagePack?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Indica se tentare di riconnettersi automaticamente quando la connessione cade
|
|
25
|
-
*/
|
|
26
|
-
autoReconnect?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Indica se scrivere o meno i messaggi di debug
|
|
29
|
-
*/
|
|
30
|
-
debugMode?: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Indica se evitare di utilizzare i Websocket
|
|
33
|
-
*/
|
|
34
|
-
avoidWs?: boolean;
|
|
35
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { EndpointDef } from './EndpointDef';
|
|
2
|
-
import { JobProgressDto } from './JobProgressDto';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
/**
|
|
5
|
-
* Classe base da estendere con la definizione degli Endpoint supportati dall'applicazione
|
|
6
|
-
*/
|
|
7
|
-
export declare class BaseMessageService {
|
|
8
|
-
private definitions;
|
|
9
|
-
IN_JobProgressNotification: EndpointDef<JobProgressDto, void>;
|
|
10
|
-
IN_SendVersion: EndpointDef<string, void>;
|
|
11
|
-
IN_ClearCache: EndpointDef<string, void>;
|
|
12
|
-
IN_ClearPreferecnes: EndpointDef<string, void>;
|
|
13
|
-
OUT_QueryJobStatus: EndpointDef<void, any>;
|
|
14
|
-
/** Entrypoint che restituisce tutti gli Endpoint dell'applicazione. Da overridare qualora non venga utilizzato il metodo **add** */
|
|
15
|
-
get AllDefinitions(): EndpointDef<any, any>[];
|
|
16
|
-
constructor();
|
|
17
|
-
add(endpoint: EndpointDef<any, any>): void;
|
|
18
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<BaseMessageService, never>;
|
|
19
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<BaseMessageService>;
|
|
20
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Definisce un Endpoint che spedisce un'informazione di tipo TIn e restituisce un'informazione di tipo TOut
|
|
3
|
-
*/
|
|
4
|
-
export declare class EndpointDef<TIn, TOut> {
|
|
5
|
-
endpoint: string;
|
|
6
|
-
inTypeDefault: TIn;
|
|
7
|
-
outTypeDefault: TOut;
|
|
8
|
-
/**
|
|
9
|
-
* Costruttore
|
|
10
|
-
*
|
|
11
|
-
* @param {string} endpoint Nome del metodo da chiamare nell'Hub del Backend contattato
|
|
12
|
-
* @param {TIn} inTypeDefault Default per il tipo TIn. Utilizzato per fare Typecheck sulle chiamate da Backend a Frontend
|
|
13
|
-
* @param {TOut} outTypeDefault Default per il tipo TOut. Utilizzato per fare Typecheck sulle chiamate da Frontend a Backend
|
|
14
|
-
*/
|
|
15
|
-
constructor(endpoint: string, inTypeDefault: TIn, outTypeDefault: TOut);
|
|
16
|
-
/** Helper per la creazione rapida di un Endpoint di solo INPUT */
|
|
17
|
-
static In<TIn>(name: string, inTypeDefault: TIn): EndpointDef<TIn, void>;
|
|
18
|
-
/** Helper per la creazione rapida di un Endpoint di solo OUTPUT */
|
|
19
|
-
static Out<TOut>(name: string, outTypeDefault: TOut): EndpointDef<void, TOut>;
|
|
20
|
-
/** Helper per la creazione rapida di un Endpoint di INPUT e OUTPUT (BIDIREZIONALE) */
|
|
21
|
-
static Bi<TIn, TOut>(name: string, inTypeDefault: TIn, outTypeDefault: TOut): EndpointDef<TIn, TOut>;
|
|
22
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
export declare class JobProgressDto {
|
|
2
|
-
instance: string;
|
|
3
|
-
name: string;
|
|
4
|
-
group: string;
|
|
5
|
-
progress: number;
|
|
6
|
-
type: string;
|
|
7
|
-
description: string;
|
|
8
|
-
user: string;
|
|
9
|
-
etams: number;
|
|
10
|
-
durationms: number;
|
|
11
|
-
resultfile: string;
|
|
12
|
-
resultreport: string;
|
|
13
|
-
resultcomplexreport: string;
|
|
14
|
-
actionid: string;
|
|
15
|
-
logchunk: string;
|
|
16
|
-
resultreportparams: {
|
|
17
|
-
/** Codice del parametro */
|
|
18
|
-
id: string;
|
|
19
|
-
/** Descrizione del parametro */
|
|
20
|
-
description: string;
|
|
21
|
-
/** Sequenza del parametro per ordinarlo logicamente rispetto agli altri */
|
|
22
|
-
seq: number;
|
|
23
|
-
/** Typecode C# della tipologia di parametro */
|
|
24
|
-
typecode: number;
|
|
25
|
-
/** Indica se i parametro è richiesto o meno */
|
|
26
|
-
required: boolean;
|
|
27
|
-
/** Valore del parametro, offerto sia come valore di default o in alternativa riempito lato UI */
|
|
28
|
-
value?: any;
|
|
29
|
-
/** Indica se questo parametro si basa su un enum. Se questa proprietà è true mi aspetto che almeno **enumtype** sia valorizzato */
|
|
30
|
-
isenum: boolean;
|
|
31
|
-
/** Indica se questo parametro si basa su un dizionario. Se questa proprietà è true mi aspetto che almeno **dictype** sia valorizzato */
|
|
32
|
-
isdictionary: boolean;
|
|
33
|
-
/** Indica se il parametro è di tipo data */
|
|
34
|
-
isdate: boolean;
|
|
35
|
-
/** Indica se il parametro è di tipo boolean */
|
|
36
|
-
isboolean: boolean;
|
|
37
|
-
/** Valori disponibili per questo parametro, da valorizzare in caso **enumtype** o **dictype** fossero valorizzati */
|
|
38
|
-
availablevalues?: {
|
|
39
|
-
id: string;
|
|
40
|
-
description: string;
|
|
41
|
-
}[];
|
|
42
|
-
/** Tipo enumerabile del parametro (qualora fosse un dizionario di valori) */
|
|
43
|
-
enumtype?: string;
|
|
44
|
-
/** Colonna relativa e questo parametro */
|
|
45
|
-
column?: string;
|
|
46
|
-
/** Tipo del dizionario */
|
|
47
|
-
dictype?: string;
|
|
48
|
-
/** Indica un filtro da applicare nei confronti del Backend qualora si vogliano caricare solo le possibilità logicamente accettabili per questo parametro */
|
|
49
|
-
dictionaryfilter?: string;
|
|
50
|
-
/** Tipologia lato "typescript" di questo parametro, dev'essere sempre logicamente congruente al **typecode** */
|
|
51
|
-
type?: "string" | "number" | "date" | "boolean";
|
|
52
|
-
/** Eventuale pattern di validazione per questo parametro */
|
|
53
|
-
pattern?: string;
|
|
54
|
-
}[];
|
|
55
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ModuleWithProviders } from '@angular/core';
|
|
2
|
-
import { SignalrNotificationsModuleConfig } from './config/SignalrNotificationsModuleConfig';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
export declare class SignalrNotificationsModule {
|
|
5
|
-
static forRoot(config?: SignalrNotificationsModuleConfig): ModuleWithProviders<SignalrNotificationsModule>;
|
|
6
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<SignalrNotificationsModule, never>;
|
|
7
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<SignalrNotificationsModule, never, never, never>;
|
|
8
|
-
static ɵinj: i0.ɵɵInjectorDeclaration<SignalrNotificationsModule>;
|
|
9
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { Observable } from "rxjs";
|
|
2
|
-
import { BaseMessageService } from './models/BaseMessageService';
|
|
3
|
-
import { EndpointDef } from './models/EndpointDef';
|
|
4
|
-
import * as i0 from "@angular/core";
|
|
5
|
-
/** Servizio che gestisce la comunicazione con un Hub SignalR in base alle configurazioni fornite dall'applicazione */
|
|
6
|
-
export declare class NotificationsService {
|
|
7
|
-
private MessageDef;
|
|
8
|
-
private endpoint_url;
|
|
9
|
-
private msgpack;
|
|
10
|
-
private avoidWs;
|
|
11
|
-
private enabled;
|
|
12
|
-
private debug;
|
|
13
|
-
private autoreconnect;
|
|
14
|
-
/** Cache degli Observable generati in base agli Endpoint disponibili */
|
|
15
|
-
private notifications$;
|
|
16
|
-
/** Connessione Signalr */
|
|
17
|
-
private connection;
|
|
18
|
-
/** Coda di chiamate da recuperare quando la connessione viene finalmente aperta */
|
|
19
|
-
private RequestsToRecover;
|
|
20
|
-
/** @ignore Costruttore */
|
|
21
|
-
constructor(MessageDef: BaseMessageService, endpoint_url: string, msgpack: boolean, avoidWs: boolean, enabled: boolean, debug: boolean, autoreconnect: boolean);
|
|
22
|
-
private init;
|
|
23
|
-
/**
|
|
24
|
-
* Effettua la connessione all'Hub Signalr e registra tutti gli Endpoint per cui il Backend comunica con il Frontend sulla **connection**
|
|
25
|
-
*/
|
|
26
|
-
private connect;
|
|
27
|
-
/**
|
|
28
|
-
* Effettua verifiche sulla connessione e, in caso non fosse collegata, tenta di riconnetterla
|
|
29
|
-
*
|
|
30
|
-
* @returns {Promise<'OK' | 'KO' | 'NO-OP'>} 'OK' Se la connessione è già connessa o è stata riconnessa con successo, 'KO' Se non è stato possibile riconnettere
|
|
31
|
-
* una connessione disconnessa, 'NO-OP' se la connesisone è in uno stato intermedio che non può essere modificato
|
|
32
|
-
*/
|
|
33
|
-
ensureConnected(): Promise<'OK' | 'KO' | 'NO-OP'>;
|
|
34
|
-
/**
|
|
35
|
-
* Invia un messaggio all'Hub del Backend
|
|
36
|
-
*
|
|
37
|
-
* @param {EndpointDef<any, TOut>} item Endpoint da contattare
|
|
38
|
-
* @param {TOut} dto Dto da inviare all'Endpoint
|
|
39
|
-
*/
|
|
40
|
-
send<TOut>(item: EndpointDef<any, TOut>, dto: TOut): Observable<never>;
|
|
41
|
-
/**
|
|
42
|
-
* Invia un messaggio all'Hub del Backend, aspettandosi una risposta
|
|
43
|
-
*
|
|
44
|
-
* @param {EndpointDef<TOut, TIn>} item Endpoint da contattare
|
|
45
|
-
* @param {TOut} dto Dto da inviare all'Endpoint
|
|
46
|
-
*
|
|
47
|
-
* @returns {Observable<TIn>} Observable su cui ci si può registrare per ricevere il risultato della chiamata
|
|
48
|
-
*/
|
|
49
|
-
invoke<TOut, TIn>(item: EndpointDef<TOut, TIn>, dto: TOut): Observable<TIn>;
|
|
50
|
-
/**
|
|
51
|
-
* Hook per osservare i dati spediti ad un Endpoint dal Backend
|
|
52
|
-
*
|
|
53
|
-
* @param {EndpointDef<TIn, any>} item Endpoint su cui ascoltare
|
|
54
|
-
*
|
|
55
|
-
* @returns {Observable<TIn>} Observable su cui ci si può registrare per ricevere l'oggetto generato ad ogni chiamata dal Backend al Frontend
|
|
56
|
-
*/
|
|
57
|
-
observe<TIn>(item: EndpointDef<TIn, any>): Observable<TIn>;
|
|
58
|
-
/**
|
|
59
|
-
* Disconnessione del sistema di SignalR
|
|
60
|
-
*
|
|
61
|
-
* @returns {Observable<void>} Observable a cui registrarsi che viene chiamato quando la disconnessione è terminata
|
|
62
|
-
*/
|
|
63
|
-
disconnect(): Observable<void>;
|
|
64
|
-
/**
|
|
65
|
-
* Taglia un log troppo lungo
|
|
66
|
-
*
|
|
67
|
-
* @param {string} text Log da tagliare
|
|
68
|
-
* @param {number} maxchars Numero massimo di caratteri da tenere
|
|
69
|
-
*
|
|
70
|
-
* @returns {string} Log tagliato
|
|
71
|
-
*/
|
|
72
|
-
private substringLog;
|
|
73
|
-
/**
|
|
74
|
-
* Stampa un log a console
|
|
75
|
-
*
|
|
76
|
-
* @param {string} message Messaggio da stampare
|
|
77
|
-
*/
|
|
78
|
-
private log;
|
|
79
|
-
/**
|
|
80
|
-
* Helper di localizzazione
|
|
81
|
-
*
|
|
82
|
-
* @param {string} message Messaggio da tradurre
|
|
83
|
-
*
|
|
84
|
-
* @returns {string} Messaggio tradotto
|
|
85
|
-
*/
|
|
86
|
-
private loc;
|
|
87
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<NotificationsService, never>;
|
|
88
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<NotificationsService>;
|
|
89
|
-
}
|
package/lib/tokens.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { InjectionToken } from '@angular/core';
|
|
2
|
-
/**
|
|
3
|
-
* Hub a cui collegarsi
|
|
4
|
-
*/
|
|
5
|
-
export declare const ENDPOINT_URL: InjectionToken<string>;
|
|
6
|
-
/**
|
|
7
|
-
* Indica se la libreria dev'essere attiva o no
|
|
8
|
-
*/
|
|
9
|
-
export declare const SIGNALR_ENABLED: InjectionToken<string>;
|
|
10
|
-
/**
|
|
11
|
-
* Indica se stampare messaggi di debug in console
|
|
12
|
-
*/
|
|
13
|
-
export declare const SGR_DEBUG_MODE: InjectionToken<string>;
|
|
14
|
-
/**
|
|
15
|
-
* Indica se utilizzare il protocollo di trasferimento "MessagePack"
|
|
16
|
-
*/
|
|
17
|
-
export declare const MESSAGE_PACK: InjectionToken<boolean>;
|
|
18
|
-
/**
|
|
19
|
-
* Indica se tentare in automatico la riconnessione
|
|
20
|
-
*/
|
|
21
|
-
export declare const AUTO_RECONNECT: InjectionToken<boolean>;
|
|
22
|
-
/**
|
|
23
|
-
* Indica se evitare i WebSocket, imposta il trasporto a LongPolling
|
|
24
|
-
*/
|
|
25
|
-
export declare const AVOID_WS: InjectionToken<boolean>;
|
package/public-api.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from './lib/tokens';
|
|
2
|
-
export * from './lib/signalr-notifications.service';
|
|
3
|
-
export * from './lib/signalr-notifications.module';
|
|
4
|
-
export * from './lib/models/BaseMessageService';
|
|
5
|
-
export * from './lib/models/EndpointDef';
|
|
6
|
-
export * from './lib/models/JobProgressDto';
|
|
7
|
-
export * from './lib/config/SignalrNotificationsModuleConfig';
|