@esfaenza/signalr-notifications 11.2.8 → 11.2.10
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/bundles/esfaenza-signalr-notifications.umd.js +18 -4
- package/bundles/esfaenza-signalr-notifications.umd.js.map +1 -1
- package/bundles/esfaenza-signalr-notifications.umd.min.js +1 -1
- package/bundles/esfaenza-signalr-notifications.umd.min.js.map +1 -1
- package/esfaenza-signalr-notifications.metadata.json +1 -1
- package/esm2015/lib/models/BaseMessageService.js +9 -5
- package/esm2015/lib/models/EndpointDef.js +13 -1
- package/fesm2015/esfaenza-signalr-notifications.js +20 -4
- package/fesm2015/esfaenza-signalr-notifications.js.map +1 -1
- package/lib/models/BaseMessageService.d.ts +3 -3
- package/lib/models/EndpointDef.d.ts +6 -0
- package/package.json +3 -3
|
@@ -30,15 +30,17 @@
|
|
|
30
30
|
*/
|
|
31
31
|
var BaseMessageService = /** @class */ (function () {
|
|
32
32
|
function BaseMessageService() {
|
|
33
|
+
this.definitions = [];
|
|
33
34
|
}
|
|
34
35
|
Object.defineProperty(BaseMessageService.prototype, "AllDefinitions", {
|
|
35
|
-
/**
|
|
36
|
-
|
|
37
|
-
*/
|
|
38
|
-
get: function () { return []; },
|
|
36
|
+
/** Entrypoint che restituisce tutti gli Endpoint dell'applicazione. Da overridare qualora non venga utilizzato il metodo **add** */
|
|
37
|
+
get: function () { return this.definitions; },
|
|
39
38
|
enumerable: false,
|
|
40
39
|
configurable: true
|
|
41
40
|
});
|
|
41
|
+
BaseMessageService.prototype.add = function (endpoint) {
|
|
42
|
+
this.definitions.push(endpoint);
|
|
43
|
+
};
|
|
42
44
|
return BaseMessageService;
|
|
43
45
|
}());
|
|
44
46
|
BaseMessageService.decorators = [
|
|
@@ -364,6 +366,18 @@
|
|
|
364
366
|
this.inTypeDefault = inTypeDefault;
|
|
365
367
|
this.outTypeDefault = outTypeDefault;
|
|
366
368
|
}
|
|
369
|
+
/** Helper per la creazione rapida di un Endpoint di solo INPUT */
|
|
370
|
+
EndpointDef.In = function (name, inTypeDefault) {
|
|
371
|
+
return new EndpointDef(name, inTypeDefault, undefined);
|
|
372
|
+
};
|
|
373
|
+
/** Helper per la creazione rapida di un Endpoint di solo OUTPUT */
|
|
374
|
+
EndpointDef.Out = function (name, outTypeDefault) {
|
|
375
|
+
return new EndpointDef(name, undefined, outTypeDefault);
|
|
376
|
+
};
|
|
377
|
+
/** Helper per la creazione rapida di un Endpoint di INPUT e OUTPUT (BIDIREZIONALE) */
|
|
378
|
+
EndpointDef.Bi = function (name, inTypeDefault, outTypeDefault) {
|
|
379
|
+
return new EndpointDef(name, inTypeDefault, outTypeDefault);
|
|
380
|
+
};
|
|
367
381
|
return EndpointDef;
|
|
368
382
|
}());
|
|
369
383
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esfaenza-signalr-notifications.umd.js","sources":["../../../projects/signalr-notifications/src/lib/models/BaseMessageService.ts","../../../projects/signalr-notifications/src/lib/tokens.ts","../../../projects/signalr-notifications/src/lib/signalr-notifications.service.loc.ts","../../../projects/signalr-notifications/src/lib/signalr-notifications.service.ts","../../../projects/signalr-notifications/src/lib/signalr-notifications.module.ts","../../../projects/signalr-notifications/src/lib/models/EndpointDef.ts","../../../projects/signalr-notifications/src/lib/config/SignalrNotificationsModuleConfig.ts","../../../projects/signalr-notifications/src/public-api.ts","../../../projects/signalr-notifications/src/esfaenza-signalr-notifications.ts"],"sourcesContent":["// Angular\r\nimport { Injectable } from '@angular/core';\r\n\r\n// Modelli\r\nimport { EndpointDef } from './EndpointDef';\r\n\r\n/**\r\n * Classe base da estendere con la definizione degli Endpoint supportati dall'applicazione\r\n */\r\n@Injectable()\r\nexport class BaseMessageService {\r\n\r\n /**\r\n * Entrypoint che restituisce tutti gli Endpoint dell'applicazione\r\n */\r\n public get AllDefinitions(): EndpointDef<any, any>[] { return []; }\r\n}","import { InjectionToken } from '@angular/core';\r\n\r\n/**\r\n * Hub a cui collegarsi\r\n */\r\nexport const HUB_URL: InjectionToken<string> = new InjectionToken<string>('HUB_URL');\r\n\r\n/**\r\n * Indica se la libreria dev'essere attiva o no\r\n */\r\nexport const SIGNALR_ENABLED: InjectionToken<string> = new InjectionToken<boolean>('SIGNALR_ENABLED');\r\n\r\n/**\r\n * Indica se stampare messaggi di debug in console\r\n */\r\nexport const DEBUG_MODE: InjectionToken<string> = new InjectionToken<boolean>('DEBUG_MODE');\r\n\r\n/**\r\n * Indica il locale utilizzato dalla libreria per i messaggi. Sono supportati \"it-IT\" ed \"en-US\"\r\n */\r\nexport const LOCALE: InjectionToken<string> = new InjectionToken<string>('LOCALE');\r\n\r\n/**\r\n * Indica se utilizzare il protocollo di trasferimento \"MessagePack\"\r\n */\r\nexport const MESSAGE_PACK: InjectionToken<boolean> = new InjectionToken<boolean>('MESSAGE_PACK');\r\n\r\n/**\r\n * Indica se tentare in automatico la riconnessione\r\n */\r\nexport const AUTO_RECONNECT: InjectionToken<boolean> = new InjectionToken<boolean>('AUTO_RECONNECT');","/**\r\n * Oggetto statico di localizzazione per i messaggi scritti dal servizio\r\n */\r\nexport const Loc ={\r\n \"Building SignalR Hub with Automatic Reconnection\": { \"en-US\": \"Building SignalR Hub with Automatic Reconnection\", \"it-IT\": \"Compilo l'Hub di SignalR con riconnessione automatica\", },\r\n \"Cannot reconnect SignalR, frontend HUB offline\": { \"en-US\": \"Cannot reconnect SignalR, frontend HUB offline\", \"it-IT\": \"Impossibile riconnettere SignalR, l'Hub del Frontend e' Offline\", },\r\n \"Send request sent before a connection was in stable State, waiting 1 second and retrying\": { \"en-US\": \"Send request sent before a connection was in stable State, waiting 1 second and retrying\", \"it-IT\": \"Richiesta 'Send' ricevuta prima che la connessione fosse in uno stato stabile, attendo 1 secondo e riprovo\", },\r\n \"Invoke request sent before a connection was in stable State, waiting 1 second and retrying\": { \"en-US\": \"Invoke request sent before a connection was in stable State, waiting 1 second and retrying\", \"it-IT\": \"Richiesta 'Invoke' ricevuta prima che la connessione fosse in uno stato stabile, attendo 1 secondo e riprovo\", },\r\n \"Connection lost or missing, reconnecting...\" : { \"en-US\": \"Connection lost or missing, reconnecting...\", \"it-IT\": \"Connessione persa o mancante, mi riconnetto...\", },\r\n \"SignalR won't be enabled as per configuration\": { \"en-US\": \"SignalR won't be enabled as per configuration\", \"it-IT\": \"SignalR non verrà attivato come da configurazione\", },\r\n \"Building SignalR Hub with MessagePack protocol\": { \"en-US\": \"Building SignalR Hub with MessagePack protocol\", \"it-IT\": \"Compilo l'Hub di SignalR con protocollo MessagePack\", },\r\n \"Request received from the server for endpoint\": { \"en-US\": \"Request received from the server for endpoint\", \"it-IT\": \"Richiesta ricevuta dal server per endpoint\", },\r\n \"Refusing to register endpoint\": { \"en-US\": \"Refusing to register endpoint\", \"it-IT\": \"Rifiuto di registrare l'endpoint\", },\r\n \"because it is not declared as IN - ONLY\": { \"en-US\": \"because it is not declared as IN - ONLY\", \"it-IT\": \"in quanto non è registrato solo come IN\", },\r\n \"Send request ignored because SignalR is not active by configuration\": { \"en-US\": \"Send request ignored because SignalR is not active by configuration\", \"it-IT\": \"Richiesta send ignorata in quanto SignalR non è attivo da configurazione\", },\r\n \"Request sent to server\": { \"en-US\": \"Request sent to server\", \"it-IT\": \"Richiesta inviata al server\", },\r\n \"Invoke request ignored because SignalR is not active by configuration\": { \"en-US\": \"Invoke request ignored because SignalR is not active by configuration\", \"it-IT\": \"Richiesta invoke ignorata in quanto SignalR non è attivo da configurazione\", },\r\n \"Request invoked to server\": { \"en-US\": \"Request invoked to server\", \"it-IT\": \"Richiesta invoke inviata al server\", },\r\n \"Observe request ignored because SignalR is not active by configuration\": { \"en-US\": \"Observe request ignored because SignalR is not active by configuration\", \"it-IT\": \"Osservazione ignorata in quanto SignalR non è attivo da configurazione\", },\r\n \"Returning observable for required endpoint\": { \"en-US\": \"Returning observable for required endpoint\", \"it-IT\": \"Restituisco l'observable per l'endpoint richiesto\", },\r\n \"Disconnection request ignored because SignalR is not active by configuration\": { \"en-US\": \"Disconnection request ignored because SignalR is not active by configuration\", \"it-IT\": \"Richiesta di disconnesione ignorata in quanto SignalR non è attivo da configurazione\", },\r\n \"Disconnection request honored\": { \"en-US\": \"Returning observable for required endpoint\", \"it-IT\": \"Restituito observable per l'endpoint richiesto\", },\r\n \"ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST\": { \"en-US\": \"ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST\", \"it-IT\": \"ERRORE nella riconnessione precedente a un nuovo tentativo di 'Send'. Il messaggio in questione SARA' PERSO\"}\r\n}","// Angular\r\nimport { Injectable, Inject } from \"@angular/core\";\r\n\r\n// Direttive, Componenti, Librerie\r\nimport * as signalR from '@microsoft/signalr';\r\nimport { HubConnectionState } from \"@microsoft/signalr\";\r\nimport { Observable, Subject, EMPTY, from, of } from \"rxjs\";\r\nimport { catchError, concatMap, delay, tap } from \"rxjs/operators\";\r\n\r\n// Modelli\r\nimport { BaseMessageService } from './models/BaseMessageService';\r\nimport { EndpointDef } from './models/EndpointDef';\r\nimport { DEBUG_MODE, HUB_URL, LOCALE, MESSAGE_PACK, SIGNALR_ENABLED, AUTO_RECONNECT } from \"./tokens\";\r\n\r\n// Localizzazione\r\nimport { Loc } from './signalr-notifications.service.loc';\r\n\r\n/**\r\n * Servizio che gestisce la comunicazione con un Hub SignalR in base alle configurazioni fornite dall'applicazione\r\n */\r\n@Injectable()\r\nexport class NotificationsService {\r\n\r\n /**\r\n * Cache degli Observable generati in base agli Endpoint disponibili\r\n */\r\n private notifications$: { [index: string]: Subject<any> } = {};\r\n\r\n /**\r\n * Connessione Signalr\r\n */\r\n private connection: signalR.HubConnection;\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @ignore\r\n */\r\n constructor(private MessageDef: BaseMessageService, @Inject(HUB_URL) private hub_url: string, @Inject(MESSAGE_PACK) private msgpack: boolean, @Inject(SIGNALR_ENABLED) private enabled: boolean, @Inject(DEBUG_MODE) private debug: boolean, @Inject(AUTO_RECONNECT) autoreconnect: boolean, @Inject(LOCALE) private locale : string) {\r\n if (!this.enabled) {\r\n this.log(this.loc(\"SignalR won't be enabled as per configuration\"));\r\n return;\r\n }\r\n\r\n this.MessageDef.AllDefinitions.forEach(def => { this.notifications$[def.endpoint] = new Subject<typeof def.inTypeDefault>(); });\r\n\r\n let pars: signalR.IHttpConnectionOptions = { skipNegotiation: true, transport: signalR.HttpTransportType.WebSockets, logger: debug ? signalR.LogLevel.Debug : signalR.LogLevel.None };\r\n var builder = new signalR.HubConnectionBuilder().withUrl(this.hub_url, pars);\r\n\r\n if (autoreconnect) {\r\n this.log(this.loc(\"Building SignalR Hub with Automatic Reconnection\"));\r\n // 100 tentativi di riconnessione, 1 ogni 5 secondi\r\n builder = builder.withAutomaticReconnect(new Array(100).fill(5 * 1000));\r\n }\r\n\r\n if (this.msgpack) {\r\n this.log(this.loc(\"Building SignalR Hub with MessagePack protocol\"));\r\n var mphpModule = require(\"@microsoft/signalr-protocol-msgpack\");\r\n builder = builder.withHubProtocol(new mphpModule.MessagePackHubProtocol())\r\n }\r\n\r\n this.connection = builder.build();\r\n this.connect();\r\n }\r\n\r\n /**\r\n * Effettua la connessione all'Hub Signalr e registra tutti gli Endpoint per cui il Backend comunica con il Frontend sulla **connection**\r\n */\r\n private connect() {\r\n this.connection.start().catch(err => console.log(err));\r\n this.MessageDef.AllDefinitions.forEach(d => {\r\n //Registro solo le cose di IN, quelle di out sono chiamate che faccio io al BE quindi non servono\r\n if (d.inTypeDefault !== null && d.outTypeDefault === null)\r\n this.connection.on(d.endpoint, (message) => {\r\n this.log(this.loc(\"Request received from the server for endpoint\") + \" '\" + d.endpoint + \"': \" + this.substringLog(JSON.stringify(message)));\r\n this.notifications$[d.endpoint].next(message);\r\n });\r\n else\r\n this.log(this.loc(\"Refusing to register endpoint\") + \" \" + d.endpoint + \" \" + this.loc(\"because it is not declared as IN - ONLY\"));\r\n });\r\n }\r\n\r\n /**\r\n * Effettua verifiche sulla connessione e, in caso non fosse collegata, tenta di riconnetterla\r\n * \r\n * @returns {Promise<'OK' | 'KO' | 'NO-OP'>} 'OK' Se la connessione è già connessa o è stata riconnessa con successo, 'KO' Se non è stato possibile riconnettere \r\n * una connessione disconnessa, 'NO-OP' se la connesisone è in uno stato intermedio che non può essere modificato\r\n */\r\n public ensureConnected(): Promise<'OK' | 'KO' | 'NO-OP'> {\r\n if (this.connection.state == HubConnectionState.Disconnected) {\r\n this.log(this.loc(\"Connection lost or missing, reconnecting...\"));\r\n\r\n return this.connection.start()\r\n .then(_ => {\r\n return Promise.resolve(\"OK\");\r\n }, _ => {\r\n this.log(this.loc(\"Cannot reconnect SignalR, frontend HUB offline\"));\r\n return Promise.resolve(\"KO\");\r\n });\r\n }\r\n else if (this.connection.state == HubConnectionState.Connected)\r\n return Promise.resolve(\"OK\");\r\n else\r\n return Promise.resolve(\"NO-OP\");\r\n }\r\n\r\n /**\r\n * Invia un messaggio all'Hub del Backend\r\n * \r\n * @param {EndpointDef<TOut, any>} item Endpoint da contattare\r\n * @param {TOut} dto Dto da inviare all'Endpoint\r\n */\r\n public send<TOut>(item: EndpointDef<TOut, any>, dto: TOut) {\r\n if (!this.enabled) {\r\n this.log(this.loc(\"Send request ignored because SignalR is not active by configuration\"));\r\n return EMPTY;\r\n }\r\n\r\n if (this.connection.state == HubConnectionState.Connecting || this.connection.state == HubConnectionState.Reconnecting || this.connection.state == HubConnectionState.Disconnecting) {\r\n this.log(this.loc(\"Send request sent before a connection was in stable State, waiting 1 second and retrying\"));\r\n setTimeout(() => { this.send(item, dto); }, 1000);\r\n }\r\n else if (this.connection.state == HubConnectionState.Disconnected) {\r\n this.ensureConnected().then(t => {\r\n if (t == \"KO\") this.log(this.loc(\"ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST\"));\r\n else this.send(item, dto);\r\n })\r\n }\r\n else {\r\n this.connection.send(item.endpoint, dto).then(_ => {\r\n if (this.debug)\r\n console.info(this.loc(\"Request sent to server\") + \" - \" + item.endpoint + \": \" + this.substringLog(JSON.stringify(dto)));\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Invia un messaggio all'Hub del Backend, aspettandosi una risposta\r\n * \r\n * @param {EndpointDef<TOut, TIn>} item Endpoint da contattare\r\n * @param {TOut} dto Dto da inviare all'Endpoint\r\n * \r\n * @returns {Observable<TIn>} Observable su cui ci si può registrare per ricevere il risultato della chiamata\r\n */\r\n public invoke<TOut, TIn>(item: EndpointDef<TOut, TIn>, dto: TOut): Observable<TIn> {\r\n if (!this.enabled) {\r\n this.log(this.loc(\"Invoke request ignored because SignalR is not active by configuration\"));\r\n return EMPTY;\r\n }\r\n\r\n if (this.connection.state == HubConnectionState.Connecting || this.connection.state == HubConnectionState.Reconnecting || this.connection.state == HubConnectionState.Disconnecting) {\r\n this.log(this.loc(\"Invoke request sent before a connection was in stable State, waiting 1 second and retrying\"));\r\n return of().pipe(delay(1000), concatMap(() => this.invoke(item, dto)));\r\n }\r\n else if (this.connection.state == HubConnectionState.Disconnected) {\r\n return from(this.ensureConnected()).pipe(concatMap((res) => {\r\n if (res == \"KO\") {\r\n this.log(this.loc(\"ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST\"));\r\n return EMPTY;\r\n }\r\n else return this.invoke(item, dto);\r\n }))\r\n }\r\n else {\r\n return from(this.connection.invoke<TIn>(item.endpoint, dto)).pipe(\r\n tap(() => {\r\n if (this.debug) console.log(this.loc(\"Request invoked to server\") + \" - \" + item.endpoint + \": \" + this.substringLog(JSON.stringify(dto)));\r\n })\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Hook per osservare i dati spediti ad un Endpoint dal Backend\r\n * \r\n * @param {EndpointDef<TIn, any>} item Endpoint su cui ascoltare\r\n * \r\n * @returns {Observable<TIn>} Observable su cui ci si può registrare per ricevere l'oggetto generato ad ogni chiamata dal Backend al Frontend\r\n */\r\n public observe<TIn>(item: EndpointDef<TIn, any>): Observable<TIn> {\r\n if (!this.enabled)\r\n {\r\n this.log(this.loc(\"Observe request ignored because SignalR is not active by configuration\"));\r\n return EMPTY;\r\n }\r\n\r\n this.log(this.loc(\"Returning observable for required endpoint\") + \": \" + item.endpoint);\r\n return <Observable<TIn>>this.notifications$[item.endpoint];\r\n }\r\n\r\n /**\r\n * Disconnessione del sistema di SignalR\r\n * \r\n * @returns {Observable<void>} Observable a cui registrarsi che viene chiamato quando la disconnessione è terminata\r\n */\r\n public disconnect(): Observable<void> {\r\n //NO-OP se non attivo\r\n if (!this.enabled)\r\n {\r\n this.log(this.loc(\"Disconnection request ignored because SignalR is not active by configuration\"));\r\n return EMPTY;\r\n }\r\n\r\n return from(this.connection.stop()).pipe(\r\n catchError((err, caught) => { console.log(err); return of(null); }),\r\n tap(() => {\r\n this.log(this.loc(\"Disconnection request honored\"));\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Taglia un log troppo lungo\r\n * \r\n * @param {string} text Log da tagliare\r\n * @param {number} maxchars Numero massimo di caratteri da tenere\r\n * \r\n * @returns {string} Log tagliato\r\n */\r\n private substringLog(text: string, maxchars: number = 120) : string {\r\n return text.length > maxchars ? text.substr(0, maxchars) + \"[...]\" : text;\r\n }\r\n\r\n /**\r\n * Stampa un log a console\r\n * \r\n * @param {string} message Messaggio da stampare\r\n */\r\n private log(message: string) {\r\n if (this.debug)\r\n console.log(\"@signalr-notifications: \" + message)\r\n }\r\n\r\n /**\r\n * Helper di localizzazione\r\n * \r\n * @param {string} message Messaggio da tradurre\r\n * \r\n * @returns {string} Messaggio tradotto\r\n */\r\n private loc(message: string) : string{\r\n if(!Loc[message])\r\n {\r\n console.warn(\"Untranslated message: \" + message)\r\n return \"\";\r\n }\r\n return Loc[message][this.locale];\r\n }\r\n}","\r\nimport { NgModule, ModuleWithProviders } from '@angular/core';\r\nimport { SignalrNotificationsModuleConfig } from './config/SignalrNotificationsModuleConfig';\r\nimport { BaseMessageService } from './models/BaseMessageService';\r\nimport { NotificationsService } from './signalr-notifications.service';\r\nimport { HUB_URL, SIGNALR_ENABLED, DEBUG_MODE, LOCALE, MESSAGE_PACK, AUTO_RECONNECT } from './tokens';\r\n\r\n@NgModule()\r\nexport class SignalrNotificationsModule {\r\n static forRoot(config?: SignalrNotificationsModuleConfig): ModuleWithProviders<SignalrNotificationsModule> {\r\n return {\r\n ngModule: SignalrNotificationsModule,\r\n providers: [\r\n NotificationsService,\r\n { provide: BaseMessageService, useClass: config?.messageService || BaseMessageService },\r\n { provide: HUB_URL, useValue: config?.hubUrl },\r\n { provide: LOCALE, useValue: config?.locale || 'it-IT' },\r\n { provide: SIGNALR_ENABLED, useValue: config?.enabled != null ? config?.enabled : true },\r\n { provide: DEBUG_MODE, useValue: config?.debugMode != null ? config?.debugMode : false },\r\n { provide: MESSAGE_PACK, useValue: config?.autoReconnect != null ? config?.autoReconnect : false },\r\n { provide: AUTO_RECONNECT, useValue: config?.useMessagePack != null ? config?.useMessagePack : false },\r\n ]\r\n };\r\n }\r\n}","/**\r\n * Definisce un Endpoint che spedisce un'informazione di tipo TIn e restituisce un'informazione di tipo TOut\r\n */\r\nexport class EndpointDef<TIn, TOut> {\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @param {string} endpoint Nome del metodo da chiamare nell'Hub del Backend contattato\r\n * @param {TIn} inTypeDefault Default per il tipo TIn. Utilizzato per fare Typecheck sulle chiamate da Backend a Frontend\r\n * @param {TOut} outTypeDefault Default per il tipo TOut. Utilizzato per fare Typecheck sulle chiamate da Frontend a Backend\r\n */\r\n constructor(public endpoint: string, public inTypeDefault: TIn, public outTypeDefault: TOut) { }\r\n}","// Angular\r\nimport { Type } from '@angular/core';\r\n\r\n// Modelli\r\nimport { BaseMessageService } from '../models/BaseMessageService';\r\n\r\n/**\r\n * Classe di configurazione per la libreria\r\n */\r\nexport class SignalrNotificationsModuleConfig {\r\n\r\n /**\r\n * Url nei confronti del quale aprire la connessione SignalR\r\n */\r\n hubUrl : string;\r\n\r\n /**\r\n * Servizio che definisce i messaggi di IN e OUT coi loro default\r\n */\r\n messageService? : Type<BaseMessageService>;\r\n\r\n /**\r\n * Indica se abilitare o meno la connessione SignalR nei confronti dell'URL **hubUrl**\r\n */\r\n enabled? : boolean;\r\n\r\n /**\r\n * Indica se utilizzare message pack come protocollo di trasmissione\r\n */\r\n useMessagePack? : boolean;\r\n\r\n /**\r\n * Indica se tentare di riconnettersi automaticamente quando la connessione cade\r\n */\r\n autoReconnect? : boolean;\r\n\r\n /**\r\n * Indica se scrivere o meno i messaggi di debug\r\n */\r\n debugMode? : boolean;\r\n\r\n /**\r\n * Lingua dei feedback a console, sono supportati 'it-IT' ed 'en-US'\r\n */\r\n locale? : string\r\n}","/*\n * Public API Surface of signalr-notifications\n */\n\nexport * from './lib/signalr-notifications.service';\nexport * from './lib/signalr-notifications.module';\nexport * from './lib/models/BaseMessageService';\nexport * from './lib/models/EndpointDef';\nexport * from './lib/config/SignalrNotificationsModuleConfig';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n\nexport {AUTO_RECONNECT as ɵf,DEBUG_MODE as ɵc,HUB_URL as ɵa,LOCALE as ɵd,MESSAGE_PACK as ɵe,SIGNALR_ENABLED as ɵb} from './lib/tokens';"],"names":["Injectable","InjectionToken","Subject","signalR","HubConnectionState","EMPTY","of","delay","concatMap","from","tap","catchError","Inject","NgModule"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;IAAA;IAMA;;;;QAIA;;QAKI,sBAAW,8CAAc;;;;iBAAzB,cAAuD,OAAO,EAAE,CAAC,EAAE;;;WAAA;;;;gBANtEA,eAAU;;;ICPX;;;QAGa,OAAO,GAA2B,IAAIC,mBAAc,CAAS,SAAS,EAAE;IAErF;;;QAGa,eAAe,GAA2B,IAAIA,mBAAc,CAAU,iBAAiB,EAAE;IAEtG;;;QAGa,UAAU,GAA2B,IAAIA,mBAAc,CAAU,YAAY,EAAE;IAE5F;;;QAGa,MAAM,GAA2B,IAAIA,mBAAc,CAAS,QAAQ,EAAE;IAEnF;;;QAGa,YAAY,GAA4B,IAAIA,mBAAc,C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alr-notifications/src/lib/models/BaseMessageService.ts","../../../projects/signalr-notifications/src/lib/tokens.ts","../../../projects/signalr-notifications/src/lib/signalr-notifications.service.loc.ts","../../../projects/signalr-notifications/src/lib/signalr-notifications.service.ts","../../../projects/signalr-notifications/src/lib/signalr-notifications.module.ts","../../../projects/signalr-notifications/src/lib/models/EndpointDef.ts","../../../projects/signalr-notifications/src/lib/config/SignalrNotificationsModuleConfig.ts","../../../projects/signalr-notifications/src/public-api.ts","../../../projects/signalr-notifications/src/esfaenza-signalr-notifications.ts"],"sourcesContent":["// Angular\r\nimport { Injectable } from '@angular/core';\r\n\r\n// Modelli\r\nimport { EndpointDef } from './EndpointDef';\r\n\r\n/**\r\n * Classe base da estendere con la definizione degli Endpoint supportati dall'applicazione\r\n */\r\n@Injectable()\r\nexport class BaseMessageService {\r\n\r\n private definitions: EndpointDef<any, any>[] = [];\r\n\r\n /** Entrypoint che restituisce tutti gli Endpoint dell'applicazione. Da overridare qualora non venga utilizzato il metodo **add** */\r\n public get AllDefinitions(): EndpointDef<any, any>[] { return this.definitions; }\r\n\r\n public add(endpoint: EndpointDef<any, any>) {\r\n this.definitions.push(endpoint);\r\n }\r\n}","import { InjectionToken } from '@angular/core';\r\n\r\n/**\r\n * Hub a cui collegarsi\r\n */\r\nexport const HUB_URL: InjectionToken<string> = new InjectionToken<string>('HUB_URL');\r\n\r\n/**\r\n * Indica se la libreria dev'essere attiva o no\r\n */\r\nexport const SIGNALR_ENABLED: InjectionToken<string> = new InjectionToken<boolean>('SIGNALR_ENABLED');\r\n\r\n/**\r\n * Indica se stampare messaggi di debug in console\r\n */\r\nexport const DEBUG_MODE: InjectionToken<string> = new InjectionToken<boolean>('DEBUG_MODE');\r\n\r\n/**\r\n * Indica il locale utilizzato dalla libreria per i messaggi. Sono supportati \"it-IT\" ed \"en-US\"\r\n */\r\nexport const LOCALE: InjectionToken<string> = new InjectionToken<string>('LOCALE');\r\n\r\n/**\r\n * Indica se utilizzare il protocollo di trasferimento \"MessagePack\"\r\n */\r\nexport const MESSAGE_PACK: InjectionToken<boolean> = new InjectionToken<boolean>('MESSAGE_PACK');\r\n\r\n/**\r\n * Indica se tentare in automatico la riconnessione\r\n */\r\nexport const AUTO_RECONNECT: InjectionToken<boolean> = new InjectionToken<boolean>('AUTO_RECONNECT');","/**\r\n * Oggetto statico di localizzazione per i messaggi scritti dal servizio\r\n */\r\nexport const Loc ={\r\n \"Building SignalR Hub with Automatic Reconnection\": { \"en-US\": \"Building SignalR Hub with Automatic Reconnection\", \"it-IT\": \"Compilo l'Hub di SignalR con riconnessione automatica\", },\r\n \"Cannot reconnect SignalR, frontend HUB offline\": { \"en-US\": \"Cannot reconnect SignalR, frontend HUB offline\", \"it-IT\": \"Impossibile riconnettere SignalR, l'Hub del Frontend e' Offline\", },\r\n \"Send request sent before a connection was in stable State, waiting 1 second and retrying\": { \"en-US\": \"Send request sent before a connection was in stable State, waiting 1 second and retrying\", \"it-IT\": \"Richiesta 'Send' ricevuta prima che la connessione fosse in uno stato stabile, attendo 1 secondo e riprovo\", },\r\n \"Invoke request sent before a connection was in stable State, waiting 1 second and retrying\": { \"en-US\": \"Invoke request sent before a connection was in stable State, waiting 1 second and retrying\", \"it-IT\": \"Richiesta 'Invoke' ricevuta prima che la connessione fosse in uno stato stabile, attendo 1 secondo e riprovo\", },\r\n \"Connection lost or missing, reconnecting...\" : { \"en-US\": \"Connection lost or missing, reconnecting...\", \"it-IT\": \"Connessione persa o mancante, mi riconnetto...\", },\r\n \"SignalR won't be enabled as per configuration\": { \"en-US\": \"SignalR won't be enabled as per configuration\", \"it-IT\": \"SignalR non verrà attivato come da configurazione\", },\r\n \"Building SignalR Hub with MessagePack protocol\": { \"en-US\": \"Building SignalR Hub with MessagePack protocol\", \"it-IT\": \"Compilo l'Hub di SignalR con protocollo MessagePack\", },\r\n \"Request received from the server for endpoint\": { \"en-US\": \"Request received from the server for endpoint\", \"it-IT\": \"Richiesta ricevuta dal server per endpoint\", },\r\n \"Refusing to register endpoint\": { \"en-US\": \"Refusing to register endpoint\", \"it-IT\": \"Rifiuto di registrare l'endpoint\", },\r\n \"because it is not declared as IN - ONLY\": { \"en-US\": \"because it is not declared as IN - ONLY\", \"it-IT\": \"in quanto non è registrato solo come IN\", },\r\n \"Send request ignored because SignalR is not active by configuration\": { \"en-US\": \"Send request ignored because SignalR is not active by configuration\", \"it-IT\": \"Richiesta send ignorata in quanto SignalR non è attivo da configurazione\", },\r\n \"Request sent to server\": { \"en-US\": \"Request sent to server\", \"it-IT\": \"Richiesta inviata al server\", },\r\n \"Invoke request ignored because SignalR is not active by configuration\": { \"en-US\": \"Invoke request ignored because SignalR is not active by configuration\", \"it-IT\": \"Richiesta invoke ignorata in quanto SignalR non è attivo da configurazione\", },\r\n \"Request invoked to server\": { \"en-US\": \"Request invoked to server\", \"it-IT\": \"Richiesta invoke inviata al server\", },\r\n \"Observe request ignored because SignalR is not active by configuration\": { \"en-US\": \"Observe request ignored because SignalR is not active by configuration\", \"it-IT\": \"Osservazione ignorata in quanto SignalR non è attivo da configurazione\", },\r\n \"Returning observable for required endpoint\": { \"en-US\": \"Returning observable for required endpoint\", \"it-IT\": \"Restituisco l'observable per l'endpoint richiesto\", },\r\n \"Disconnection request ignored because SignalR is not active by configuration\": { \"en-US\": \"Disconnection request ignored because SignalR is not active by configuration\", \"it-IT\": \"Richiesta di disconnesione ignorata in quanto SignalR non è attivo da configurazione\", },\r\n \"Disconnection request honored\": { \"en-US\": \"Returning observable for required endpoint\", \"it-IT\": \"Restituito observable per l'endpoint richiesto\", },\r\n \"ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST\": { \"en-US\": \"ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST\", \"it-IT\": \"ERRORE nella riconnessione precedente a un nuovo tentativo di 'Send'. Il messaggio in questione SARA' PERSO\"}\r\n}","// Angular\r\nimport { Injectable, Inject } from \"@angular/core\";\r\n\r\n// Direttive, Componenti, Librerie\r\nimport * as signalR from '@microsoft/signalr';\r\nimport { HubConnectionState } from \"@microsoft/signalr\";\r\nimport { Observable, Subject, EMPTY, from, of } from \"rxjs\";\r\nimport { catchError, concatMap, delay, tap } from \"rxjs/operators\";\r\n\r\n// Modelli\r\nimport { BaseMessageService } from './models/BaseMessageService';\r\nimport { EndpointDef } from './models/EndpointDef';\r\nimport { DEBUG_MODE, HUB_URL, LOCALE, MESSAGE_PACK, SIGNALR_ENABLED, AUTO_RECONNECT } from \"./tokens\";\r\n\r\n// Localizzazione\r\nimport { Loc } from './signalr-notifications.service.loc';\r\n\r\n/**\r\n * Servizio che gestisce la comunicazione con un Hub SignalR in base alle configurazioni fornite dall'applicazione\r\n */\r\n@Injectable()\r\nexport class NotificationsService {\r\n\r\n /**\r\n * Cache degli Observable generati in base agli Endpoint disponibili\r\n */\r\n private notifications$: { [index: string]: Subject<any> } = {};\r\n\r\n /**\r\n * Connessione Signalr\r\n */\r\n private connection: signalR.HubConnection;\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @ignore\r\n */\r\n constructor(private MessageDef: BaseMessageService, @Inject(HUB_URL) private hub_url: string, @Inject(MESSAGE_PACK) private msgpack: boolean, @Inject(SIGNALR_ENABLED) private enabled: boolean, @Inject(DEBUG_MODE) private debug: boolean, @Inject(AUTO_RECONNECT) autoreconnect: boolean, @Inject(LOCALE) private locale : string) {\r\n if (!this.enabled) {\r\n this.log(this.loc(\"SignalR won't be enabled as per configuration\"));\r\n return;\r\n }\r\n\r\n this.MessageDef.AllDefinitions.forEach(def => { this.notifications$[def.endpoint] = new Subject<typeof def.inTypeDefault>(); });\r\n\r\n let pars: signalR.IHttpConnectionOptions = { skipNegotiation: true, transport: signalR.HttpTransportType.WebSockets, logger: debug ? signalR.LogLevel.Debug : signalR.LogLevel.None };\r\n var builder = new signalR.HubConnectionBuilder().withUrl(this.hub_url, pars);\r\n\r\n if (autoreconnect) {\r\n this.log(this.loc(\"Building SignalR Hub with Automatic Reconnection\"));\r\n // 100 tentativi di riconnessione, 1 ogni 5 secondi\r\n builder = builder.withAutomaticReconnect(new Array(100).fill(5 * 1000));\r\n }\r\n\r\n if (this.msgpack) {\r\n this.log(this.loc(\"Building SignalR Hub with MessagePack protocol\"));\r\n var mphpModule = require(\"@microsoft/signalr-protocol-msgpack\");\r\n builder = builder.withHubProtocol(new mphpModule.MessagePackHubProtocol())\r\n }\r\n\r\n this.connection = builder.build();\r\n this.connect();\r\n }\r\n\r\n /**\r\n * Effettua la connessione all'Hub Signalr e registra tutti gli Endpoint per cui il Backend comunica con il Frontend sulla **connection**\r\n */\r\n private connect() {\r\n this.connection.start().catch(err => console.log(err));\r\n this.MessageDef.AllDefinitions.forEach(d => {\r\n //Registro solo le cose di IN, quelle di out sono chiamate che faccio io al BE quindi non servono\r\n if (d.inTypeDefault !== null && d.outTypeDefault === null)\r\n this.connection.on(d.endpoint, (message) => {\r\n this.log(this.loc(\"Request received from the server for endpoint\") + \" '\" + d.endpoint + \"': \" + this.substringLog(JSON.stringify(message)));\r\n this.notifications$[d.endpoint].next(message);\r\n });\r\n else\r\n this.log(this.loc(\"Refusing to register endpoint\") + \" \" + d.endpoint + \" \" + this.loc(\"because it is not declared as IN - ONLY\"));\r\n });\r\n }\r\n\r\n /**\r\n * Effettua verifiche sulla connessione e, in caso non fosse collegata, tenta di riconnetterla\r\n * \r\n * @returns {Promise<'OK' | 'KO' | 'NO-OP'>} 'OK' Se la connessione è già connessa o è stata riconnessa con successo, 'KO' Se non è stato possibile riconnettere \r\n * una connessione disconnessa, 'NO-OP' se la connesisone è in uno stato intermedio che non può essere modificato\r\n */\r\n public ensureConnected(): Promise<'OK' | 'KO' | 'NO-OP'> {\r\n if (this.connection.state == HubConnectionState.Disconnected) {\r\n this.log(this.loc(\"Connection lost or missing, reconnecting...\"));\r\n\r\n return this.connection.start()\r\n .then(_ => {\r\n return Promise.resolve(\"OK\");\r\n }, _ => {\r\n this.log(this.loc(\"Cannot reconnect SignalR, frontend HUB offline\"));\r\n return Promise.resolve(\"KO\");\r\n });\r\n }\r\n else if (this.connection.state == HubConnectionState.Connected)\r\n return Promise.resolve(\"OK\");\r\n else\r\n return Promise.resolve(\"NO-OP\");\r\n }\r\n\r\n /**\r\n * Invia un messaggio all'Hub del Backend\r\n * \r\n * @param {EndpointDef<TOut, any>} item Endpoint da contattare\r\n * @param {TOut} dto Dto da inviare all'Endpoint\r\n */\r\n public send<TOut>(item: EndpointDef<TOut, any>, dto: TOut) {\r\n if (!this.enabled) {\r\n this.log(this.loc(\"Send request ignored because SignalR is not active by configuration\"));\r\n return EMPTY;\r\n }\r\n\r\n if (this.connection.state == HubConnectionState.Connecting || this.connection.state == HubConnectionState.Reconnecting || this.connection.state == HubConnectionState.Disconnecting) {\r\n this.log(this.loc(\"Send request sent before a connection was in stable State, waiting 1 second and retrying\"));\r\n setTimeout(() => { this.send(item, dto); }, 1000);\r\n }\r\n else if (this.connection.state == HubConnectionState.Disconnected) {\r\n this.ensureConnected().then(t => {\r\n if (t == \"KO\") this.log(this.loc(\"ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST\"));\r\n else this.send(item, dto);\r\n })\r\n }\r\n else {\r\n this.connection.send(item.endpoint, dto).then(_ => {\r\n if (this.debug)\r\n console.info(this.loc(\"Request sent to server\") + \" - \" + item.endpoint + \": \" + this.substringLog(JSON.stringify(dto)));\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Invia un messaggio all'Hub del Backend, aspettandosi una risposta\r\n * \r\n * @param {EndpointDef<TOut, TIn>} item Endpoint da contattare\r\n * @param {TOut} dto Dto da inviare all'Endpoint\r\n * \r\n * @returns {Observable<TIn>} Observable su cui ci si può registrare per ricevere il risultato della chiamata\r\n */\r\n public invoke<TOut, TIn>(item: EndpointDef<TOut, TIn>, dto: TOut): Observable<TIn> {\r\n if (!this.enabled) {\r\n this.log(this.loc(\"Invoke request ignored because SignalR is not active by configuration\"));\r\n return EMPTY;\r\n }\r\n\r\n if (this.connection.state == HubConnectionState.Connecting || this.connection.state == HubConnectionState.Reconnecting || this.connection.state == HubConnectionState.Disconnecting) {\r\n this.log(this.loc(\"Invoke request sent before a connection was in stable State, waiting 1 second and retrying\"));\r\n return of().pipe(delay(1000), concatMap(() => this.invoke(item, dto)));\r\n }\r\n else if (this.connection.state == HubConnectionState.Disconnected) {\r\n return from(this.ensureConnected()).pipe(concatMap((res) => {\r\n if (res == \"KO\") {\r\n this.log(this.loc(\"ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST\"));\r\n return EMPTY;\r\n }\r\n else return this.invoke(item, dto);\r\n }))\r\n }\r\n else {\r\n return from(this.connection.invoke<TIn>(item.endpoint, dto)).pipe(\r\n tap(() => {\r\n if (this.debug) console.log(this.loc(\"Request invoked to server\") + \" - \" + item.endpoint + \": \" + this.substringLog(JSON.stringify(dto)));\r\n })\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Hook per osservare i dati spediti ad un Endpoint dal Backend\r\n * \r\n * @param {EndpointDef<TIn, any>} item Endpoint su cui ascoltare\r\n * \r\n * @returns {Observable<TIn>} Observable su cui ci si può registrare per ricevere l'oggetto generato ad ogni chiamata dal Backend al Frontend\r\n */\r\n public observe<TIn>(item: EndpointDef<TIn, any>): Observable<TIn> {\r\n if (!this.enabled)\r\n {\r\n this.log(this.loc(\"Observe request ignored because SignalR is not active by configuration\"));\r\n return EMPTY;\r\n }\r\n\r\n this.log(this.loc(\"Returning observable for required endpoint\") + \": \" + item.endpoint);\r\n return <Observable<TIn>>this.notifications$[item.endpoint];\r\n }\r\n\r\n /**\r\n * Disconnessione del sistema di SignalR\r\n * \r\n * @returns {Observable<void>} Observable a cui registrarsi che viene chiamato quando la disconnessione è terminata\r\n */\r\n public disconnect(): Observable<void> {\r\n //NO-OP se non attivo\r\n if (!this.enabled)\r\n {\r\n this.log(this.loc(\"Disconnection request ignored because SignalR is not active by configuration\"));\r\n return EMPTY;\r\n }\r\n\r\n return from(this.connection.stop()).pipe(\r\n catchError((err, caught) => { console.log(err); return of(null); }),\r\n tap(() => {\r\n this.log(this.loc(\"Disconnection request honored\"));\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Taglia un log troppo lungo\r\n * \r\n * @param {string} text Log da tagliare\r\n * @param {number} maxchars Numero massimo di caratteri da tenere\r\n * \r\n * @returns {string} Log tagliato\r\n */\r\n private substringLog(text: string, maxchars: number = 120) : string {\r\n return text.length > maxchars ? text.substr(0, maxchars) + \"[...]\" : text;\r\n }\r\n\r\n /**\r\n * Stampa un log a console\r\n * \r\n * @param {string} message Messaggio da stampare\r\n */\r\n private log(message: string) {\r\n if (this.debug)\r\n console.log(\"@signalr-notifications: \" + message)\r\n }\r\n\r\n /**\r\n * Helper di localizzazione\r\n * \r\n * @param {string} message Messaggio da tradurre\r\n * \r\n * @returns {string} Messaggio tradotto\r\n */\r\n private loc(message: string) : string{\r\n if(!Loc[message])\r\n {\r\n console.warn(\"Untranslated message: \" + message)\r\n return \"\";\r\n }\r\n return Loc[message][this.locale];\r\n }\r\n}","\r\nimport { NgModule, ModuleWithProviders } from '@angular/core';\r\nimport { SignalrNotificationsModuleConfig } from './config/SignalrNotificationsModuleConfig';\r\nimport { BaseMessageService } from './models/BaseMessageService';\r\nimport { NotificationsService } from './signalr-notifications.service';\r\nimport { HUB_URL, SIGNALR_ENABLED, DEBUG_MODE, LOCALE, MESSAGE_PACK, AUTO_RECONNECT } from './tokens';\r\n\r\n@NgModule()\r\nexport class SignalrNotificationsModule {\r\n static forRoot(config?: SignalrNotificationsModuleConfig): ModuleWithProviders<SignalrNotificationsModule> {\r\n return {\r\n ngModule: SignalrNotificationsModule,\r\n providers: [\r\n NotificationsService,\r\n { provide: BaseMessageService, useClass: config?.messageService || BaseMessageService },\r\n { provide: HUB_URL, useValue: config?.hubUrl },\r\n { provide: LOCALE, useValue: config?.locale || 'it-IT' },\r\n { provide: SIGNALR_ENABLED, useValue: config?.enabled != null ? config?.enabled : true },\r\n { provide: DEBUG_MODE, useValue: config?.debugMode != null ? config?.debugMode : false },\r\n { provide: MESSAGE_PACK, useValue: config?.autoReconnect != null ? config?.autoReconnect : false },\r\n { provide: AUTO_RECONNECT, useValue: config?.useMessagePack != null ? config?.useMessagePack : false },\r\n ]\r\n };\r\n }\r\n}","/**\r\n * Definisce un Endpoint che spedisce un'informazione di tipo TIn e restituisce un'informazione di tipo TOut\r\n */\r\nexport class EndpointDef<TIn, TOut> {\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @param {string} endpoint Nome del metodo da chiamare nell'Hub del Backend contattato\r\n * @param {TIn} inTypeDefault Default per il tipo TIn. Utilizzato per fare Typecheck sulle chiamate da Backend a Frontend\r\n * @param {TOut} outTypeDefault Default per il tipo TOut. Utilizzato per fare Typecheck sulle chiamate da Frontend a Backend\r\n */\r\n constructor(public endpoint: string, public inTypeDefault: TIn, public outTypeDefault: TOut) { }\r\n\r\n\r\n /** Helper per la creazione rapida di un Endpoint di solo INPUT */\r\n public static In<TIn>(name: string, inTypeDefault: TIn): EndpointDef<TIn, void> {\r\n return new EndpointDef<TIn, void>(name, inTypeDefault, undefined);\r\n }\r\n\r\n /** Helper per la creazione rapida di un Endpoint di solo OUTPUT */\r\n public static Out<TOut>(name: string, outTypeDefault: TOut): EndpointDef<void, TOut> {\r\n return new EndpointDef<void, TOut>(name, undefined, outTypeDefault);\r\n }\r\n\r\n /** Helper per la creazione rapida di un Endpoint di INPUT e OUTPUT (BIDIREZIONALE) */\r\n public static Bi<TIn, TOut>(name: string, inTypeDefault: TIn, outTypeDefault: TOut): EndpointDef<TIn, TOut> {\r\n return new EndpointDef<TIn, TOut>(name, inTypeDefault, outTypeDefault);\r\n }\r\n}","// Angular\r\nimport { Type } from '@angular/core';\r\n\r\n// Modelli\r\nimport { BaseMessageService } from '../models/BaseMessageService';\r\n\r\n/**\r\n * Classe di configurazione per la libreria\r\n */\r\nexport class SignalrNotificationsModuleConfig {\r\n\r\n /**\r\n * Url nei confronti del quale aprire la connessione SignalR\r\n */\r\n hubUrl : string;\r\n\r\n /**\r\n * Servizio che definisce i messaggi di IN e OUT coi loro default\r\n */\r\n messageService? : Type<BaseMessageService>;\r\n\r\n /**\r\n * Indica se abilitare o meno la connessione SignalR nei confronti dell'URL **hubUrl**\r\n */\r\n enabled? : boolean;\r\n\r\n /**\r\n * Indica se utilizzare message pack come protocollo di trasmissione\r\n */\r\n useMessagePack? : boolean;\r\n\r\n /**\r\n * Indica se tentare di riconnettersi automaticamente quando la connessione cade\r\n */\r\n autoReconnect? : boolean;\r\n\r\n /**\r\n * Indica se scrivere o meno i messaggi di debug\r\n */\r\n debugMode? : boolean;\r\n\r\n /**\r\n * Lingua dei feedback a console, sono supportati 'it-IT' ed 'en-US'\r\n */\r\n locale? : string\r\n}","/*\n * Public API Surface of signalr-notifications\n */\n\nexport * from './lib/signalr-notifications.service';\nexport * from './lib/signalr-notifications.module';\nexport * from './lib/models/BaseMessageService';\nexport * from './lib/models/EndpointDef';\nexport * from './lib/config/SignalrNotificationsModuleConfig';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n\nexport {AUTO_RECONNECT as ɵf,DEBUG_MODE as ɵc,HUB_URL as ɵa,LOCALE as ɵd,MESSAGE_PACK as ɵe,SIGNALR_ENABLED as ɵb} from './lib/tokens';"],"names":["Injectable","InjectionToken","Subject","signalR","HubConnectionState","EMPTY","of","delay","concatMap","from","tap","catchError","Inject","NgModule"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;IAAA;IAMA;;;;QAGA;YAGY,gBAAW,GAA4B,EAAE,CAAC;SAQrD;QALG,sBAAW,8CAAc;;iBAAzB,cAAuD,OAAO,IAAI,CAAC,WAAW,CAAC,EAAE;;;WAAA;QAE1E,gCAAG,GAAH,UAAI,QAA+B;YACtC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACnC;;;;gBAVJA,eAAU;;;ICPX;;;QAGa,OAAO,GAA2B,IAAIC,mBAAc,CAAS,SAAS,EAAE;IAErF;;;QAGa,eAAe,GAA2B,IAAIA,mBAAc,CAAU,iBAAi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,cAAc,CAAM;SAAK;;QAIlF,cAAE,GAAT,UAAe,IAAY,EAAE,aAAkB;YAClD,OAAO,IAAI,WAAW,CAAY,IAAI,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;SACrE;;QAGa,eAAG,GAAV,UAAiB,IAAY,EAAE,cAAoB;YACtD,OAAO,IAAI,WAAW,CAAa,IAAI,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;SACvE;;QAGa,cAAE,GAAT,UAAqB,IAAY,EAAE,aAAkB,EAAE,cAAoB;YAC9E,OAAO,IAAI,WAAW,CAAY,IAAI,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC;SAC1E;0BACJ;KAAA;;ICvBD;;;;QAGA;SAoCC;+CAAA;KAAA;;IC7CD;;;;ICAA;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@angular/core"),require("@microsoft/signalr"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@esfaenza/signalr-notifications",["exports","@angular/core","@microsoft/signalr","rxjs","rxjs/operators"],n):n(((e="undefined"!=typeof globalThis?globalThis:e||self).esfaenza=e.esfaenza||{},e.esfaenza["signalr-notifications"]={}),e.ng.core,e.signalR,e.rxjs,e.rxjs.operators)}(this,(function(e,n,t,o,i){"use strict";function s(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:function(){return e[t]}})}})),n.default=e,Object.freeze(n)}var r=s(t),a=function(){function e(){}return Object.defineProperty(e.prototype,"AllDefinitions",{get:function(){return[]},enumerable:!1,configurable:!0}),e}();a.decorators=[{type:n.Injectable}];var c=new n.InjectionToken("HUB_URL"),u=new n.InjectionToken("SIGNALR_ENABLED"),l=new n.InjectionToken("DEBUG_MODE"),g=new n.InjectionToken("LOCALE"),d=new n.InjectionToken("MESSAGE_PACK"),f=new n.InjectionToken("AUTO_RECONNECT"),b={"Building SignalR Hub with Automatic Reconnection":{"en-US":"Building SignalR Hub with Automatic Reconnection","it-IT":"Compilo l'Hub di SignalR con riconnessione automatica"},"Cannot reconnect SignalR, frontend HUB offline":{"en-US":"Cannot reconnect SignalR, frontend HUB offline","it-IT":"Impossibile riconnettere SignalR, l'Hub del Frontend e' Offline"},"Send request sent before a connection was in stable State, waiting 1 second and retrying":{"en-US":"Send request sent before a connection was in stable State, waiting 1 second and retrying","it-IT":"Richiesta 'Send' ricevuta prima che la connessione fosse in uno stato stabile, attendo 1 secondo e riprovo"},"Invoke request sent before a connection was in stable State, waiting 1 second and retrying":{"en-US":"Invoke request sent before a connection was in stable State, waiting 1 second and retrying","it-IT":"Richiesta 'Invoke' ricevuta prima che la connessione fosse in uno stato stabile, attendo 1 secondo e riprovo"},"Connection lost or missing, reconnecting...":{"en-US":"Connection lost or missing, reconnecting...","it-IT":"Connessione persa o mancante, mi riconnetto..."},"SignalR won't be enabled as per configuration":{"en-US":"SignalR won't be enabled as per configuration","it-IT":"SignalR non verrà attivato come da configurazione"},"Building SignalR Hub with MessagePack protocol":{"en-US":"Building SignalR Hub with MessagePack protocol","it-IT":"Compilo l'Hub di SignalR con protocollo MessagePack"},"Request received from the server for endpoint":{"en-US":"Request received from the server for endpoint","it-IT":"Richiesta ricevuta dal server per endpoint"},"Refusing to register endpoint":{"en-US":"Refusing to register endpoint","it-IT":"Rifiuto di registrare l'endpoint"},"because it is not declared as IN - ONLY":{"en-US":"because it is not declared as IN - ONLY","it-IT":"in quanto non è registrato solo come IN"},"Send request ignored because SignalR is not active by configuration":{"en-US":"Send request ignored because SignalR is not active by configuration","it-IT":"Richiesta send ignorata in quanto SignalR non è attivo da configurazione"},"Request sent to server":{"en-US":"Request sent to server","it-IT":"Richiesta inviata al server"},"Invoke request ignored because SignalR is not active by configuration":{"en-US":"Invoke request ignored because SignalR is not active by configuration","it-IT":"Richiesta invoke ignorata in quanto SignalR non è attivo da configurazione"},"Request invoked to server":{"en-US":"Request invoked to server","it-IT":"Richiesta invoke inviata al server"},"Observe request ignored because SignalR is not active by configuration":{"en-US":"Observe request ignored because SignalR is not active by configuration","it-IT":"Osservazione ignorata in quanto SignalR non è attivo da configurazione"},"Returning observable for required endpoint":{"en-US":"Returning observable for required endpoint","it-IT":"Restituisco l'observable per l'endpoint richiesto"},"Disconnection request ignored because SignalR is not active by configuration":{"en-US":"Disconnection request ignored because SignalR is not active by configuration","it-IT":"Richiesta di disconnesione ignorata in quanto SignalR non è attivo da configurazione"},"Disconnection request honored":{"en-US":"Returning observable for required endpoint","it-IT":"Restituito observable per l'endpoint richiesto"},"ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST":{"en-US":"ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST","it-IT":"ERRORE nella riconnessione precedente a un nuovo tentativo di 'Send'. Il messaggio in questione SARA' PERSO"}},p=function(){function e(e,n,t,i,s,a,c){var u=this;if(this.MessageDef=e,this.hub_url=n,this.msgpack=t,this.enabled=i,this.debug=s,this.locale=c,this.notifications$={},this.enabled){this.MessageDef.AllDefinitions.forEach((function(e){u.notifications$[e.endpoint]=new o.Subject}));var l={skipNegotiation:!0,transport:r.HttpTransportType.WebSockets,logger:s?r.LogLevel.Debug:r.LogLevel.None},g=(new r.HubConnectionBuilder).withUrl(this.hub_url,l);if(a&&(this.log(this.loc("Building SignalR Hub with Automatic Reconnection")),g=g.withAutomaticReconnect(new Array(100).fill(5e3))),this.msgpack){this.log(this.loc("Building SignalR Hub with MessagePack protocol"));var d=require("@microsoft/signalr-protocol-msgpack");g=g.withHubProtocol(new d.MessagePackHubProtocol)}this.connection=g.build(),this.connect()}else this.log(this.loc("SignalR won't be enabled as per configuration"))}return e.prototype.connect=function(){var e=this;this.connection.start().catch((function(e){return console.log(e)})),this.MessageDef.AllDefinitions.forEach((function(n){null!==n.inTypeDefault&&null===n.outTypeDefault?e.connection.on(n.endpoint,(function(t){e.log(e.loc("Request received from the server for endpoint")+" '"+n.endpoint+"': "+e.substringLog(JSON.stringify(t))),e.notifications$[n.endpoint].next(t)})):e.log(e.loc("Refusing to register endpoint")+" "+n.endpoint+" "+e.loc("because it is not declared as IN - ONLY"))}))},e.prototype.ensureConnected=function(){var e=this;return this.connection.state==t.HubConnectionState.Disconnected?(this.log(this.loc("Connection lost or missing, reconnecting...")),this.connection.start().then((function(e){return Promise.resolve("OK")}),(function(n){return e.log(e.loc("Cannot reconnect SignalR, frontend HUB offline")),Promise.resolve("KO")}))):this.connection.state==t.HubConnectionState.Connected?Promise.resolve("OK"):Promise.resolve("NO-OP")},e.prototype.send=function(e,n){var i=this;if(!this.enabled)return this.log(this.loc("Send request ignored because SignalR is not active by configuration")),o.EMPTY;this.connection.state==t.HubConnectionState.Connecting||this.connection.state==t.HubConnectionState.Reconnecting||this.connection.state==t.HubConnectionState.Disconnecting?(this.log(this.loc("Send request sent before a connection was in stable State, waiting 1 second and retrying")),setTimeout((function(){i.send(e,n)}),1e3)):this.connection.state==t.HubConnectionState.Disconnected?this.ensureConnected().then((function(t){"KO"==t?i.log(i.loc("ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST")):i.send(e,n)})):this.connection.send(e.endpoint,n).then((function(t){i.debug&&console.info(i.loc("Request sent to server")+" - "+e.endpoint+": "+i.substringLog(JSON.stringify(n)))}))},e.prototype.invoke=function(e,n){var s=this;return this.enabled?this.connection.state==t.HubConnectionState.Connecting||this.connection.state==t.HubConnectionState.Reconnecting||this.connection.state==t.HubConnectionState.Disconnecting?(this.log(this.loc("Invoke request sent before a connection was in stable State, waiting 1 second and retrying")),o.of().pipe(i.delay(1e3),i.concatMap((function(){return s.invoke(e,n)})))):this.connection.state==t.HubConnectionState.Disconnected?o.from(this.ensureConnected()).pipe(i.concatMap((function(t){return"KO"==t?(s.log(s.loc("ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST")),o.EMPTY):s.invoke(e,n)}))):o.from(this.connection.invoke(e.endpoint,n)).pipe(i.tap((function(){s.debug&&console.log(s.loc("Request invoked to server")+" - "+e.endpoint+": "+s.substringLog(JSON.stringify(n)))}))):(this.log(this.loc("Invoke request ignored because SignalR is not active by configuration")),o.EMPTY)},e.prototype.observe=function(e){return this.enabled?(this.log(this.loc("Returning observable for required endpoint")+": "+e.endpoint),this.notifications$[e.endpoint]):(this.log(this.loc("Observe request ignored because SignalR is not active by configuration")),o.EMPTY)},e.prototype.disconnect=function(){var e=this;return this.enabled?o.from(this.connection.stop()).pipe(i.catchError((function(e,n){return console.log(e),o.of(null)})),i.tap((function(){e.log(e.loc("Disconnection request honored"))}))):(this.log(this.loc("Disconnection request ignored because SignalR is not active by configuration")),o.EMPTY)},e.prototype.substringLog=function(e,n){return void 0===n&&(n=120),e.length>n?e.substr(0,n)+"[...]":e},e.prototype.log=function(e){this.debug&&console.log("@signalr-notifications: "+e)},e.prototype.loc=function(e){return b[e]?b[e][this.locale]:(console.warn("Untranslated message: "+e),"")},e}();p.decorators=[{type:n.Injectable}],p.ctorParameters=function(){return[{type:a},{type:String,decorators:[{type:n.Inject,args:[c]}]},{type:Boolean,decorators:[{type:n.Inject,args:[d]}]},{type:Boolean,decorators:[{type:n.Inject,args:[u]}]},{type:Boolean,decorators:[{type:n.Inject,args:[l]}]},{type:Boolean,decorators:[{type:n.Inject,args:[f]}]},{type:String,decorators:[{type:n.Inject,args:[g]}]}]};var v=function(){function e(){}return e.forRoot=function(n){return{ngModule:e,providers:[p,{provide:a,useClass:(null==n?void 0:n.messageService)||a},{provide:c,useValue:null==n?void 0:n.hubUrl},{provide:g,useValue:(null==n?void 0:n.locale)||"it-IT"},{provide:u,useValue:null==(null==n?void 0:n.enabled)||(null==n?void 0:n.enabled)},{provide:l,useValue:null!=(null==n?void 0:n.debugMode)&&(null==n?void 0:n.debugMode)},{provide:d,useValue:null!=(null==n?void 0:n.autoReconnect)&&(null==n?void 0:n.autoReconnect)},{provide:f,useValue:null!=(null==n?void 0:n.useMessagePack)&&(null==n?void 0:n.useMessagePack)}]}},e}();v.decorators=[{type:n.NgModule}];var h=function(e,n,t){this.endpoint=e,this.inTypeDefault=n,this.outTypeDefault=t},S=function(){};e.BaseMessageService=a,e.EndpointDef=h,e.NotificationsService=p,e.SignalrNotificationsModule=v,e.SignalrNotificationsModuleConfig=S,e["ɵa"]=c,e["ɵb"]=u,e["ɵc"]=l,e["ɵd"]=g,e["ɵe"]=d,e["ɵf"]=f,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@angular/core"),require("@microsoft/signalr"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@esfaenza/signalr-notifications",["exports","@angular/core","@microsoft/signalr","rxjs","rxjs/operators"],n):n(((e="undefined"!=typeof globalThis?globalThis:e||self).esfaenza=e.esfaenza||{},e.esfaenza["signalr-notifications"]={}),e.ng.core,e.signalR,e.rxjs,e.rxjs.operators)}(this,(function(e,n,t,o,i){"use strict";function s(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:function(){return e[t]}})}})),n.default=e,Object.freeze(n)}var r=s(t),a=function(){function e(){this.definitions=[]}return Object.defineProperty(e.prototype,"AllDefinitions",{get:function(){return this.definitions},enumerable:!1,configurable:!0}),e.prototype.add=function(e){this.definitions.push(e)},e}();a.decorators=[{type:n.Injectable}];var c=new n.InjectionToken("HUB_URL"),u=new n.InjectionToken("SIGNALR_ENABLED"),l=new n.InjectionToken("DEBUG_MODE"),g=new n.InjectionToken("LOCALE"),d=new n.InjectionToken("MESSAGE_PACK"),f=new n.InjectionToken("AUTO_RECONNECT"),p={"Building SignalR Hub with Automatic Reconnection":{"en-US":"Building SignalR Hub with Automatic Reconnection","it-IT":"Compilo l'Hub di SignalR con riconnessione automatica"},"Cannot reconnect SignalR, frontend HUB offline":{"en-US":"Cannot reconnect SignalR, frontend HUB offline","it-IT":"Impossibile riconnettere SignalR, l'Hub del Frontend e' Offline"},"Send request sent before a connection was in stable State, waiting 1 second and retrying":{"en-US":"Send request sent before a connection was in stable State, waiting 1 second and retrying","it-IT":"Richiesta 'Send' ricevuta prima che la connessione fosse in uno stato stabile, attendo 1 secondo e riprovo"},"Invoke request sent before a connection was in stable State, waiting 1 second and retrying":{"en-US":"Invoke request sent before a connection was in stable State, waiting 1 second and retrying","it-IT":"Richiesta 'Invoke' ricevuta prima che la connessione fosse in uno stato stabile, attendo 1 secondo e riprovo"},"Connection lost or missing, reconnecting...":{"en-US":"Connection lost or missing, reconnecting...","it-IT":"Connessione persa o mancante, mi riconnetto..."},"SignalR won't be enabled as per configuration":{"en-US":"SignalR won't be enabled as per configuration","it-IT":"SignalR non verrà attivato come da configurazione"},"Building SignalR Hub with MessagePack protocol":{"en-US":"Building SignalR Hub with MessagePack protocol","it-IT":"Compilo l'Hub di SignalR con protocollo MessagePack"},"Request received from the server for endpoint":{"en-US":"Request received from the server for endpoint","it-IT":"Richiesta ricevuta dal server per endpoint"},"Refusing to register endpoint":{"en-US":"Refusing to register endpoint","it-IT":"Rifiuto di registrare l'endpoint"},"because it is not declared as IN - ONLY":{"en-US":"because it is not declared as IN - ONLY","it-IT":"in quanto non è registrato solo come IN"},"Send request ignored because SignalR is not active by configuration":{"en-US":"Send request ignored because SignalR is not active by configuration","it-IT":"Richiesta send ignorata in quanto SignalR non è attivo da configurazione"},"Request sent to server":{"en-US":"Request sent to server","it-IT":"Richiesta inviata al server"},"Invoke request ignored because SignalR is not active by configuration":{"en-US":"Invoke request ignored because SignalR is not active by configuration","it-IT":"Richiesta invoke ignorata in quanto SignalR non è attivo da configurazione"},"Request invoked to server":{"en-US":"Request invoked to server","it-IT":"Richiesta invoke inviata al server"},"Observe request ignored because SignalR is not active by configuration":{"en-US":"Observe request ignored because SignalR is not active by configuration","it-IT":"Osservazione ignorata in quanto SignalR non è attivo da configurazione"},"Returning observable for required endpoint":{"en-US":"Returning observable for required endpoint","it-IT":"Restituisco l'observable per l'endpoint richiesto"},"Disconnection request ignored because SignalR is not active by configuration":{"en-US":"Disconnection request ignored because SignalR is not active by configuration","it-IT":"Richiesta di disconnesione ignorata in quanto SignalR non è attivo da configurazione"},"Disconnection request honored":{"en-US":"Returning observable for required endpoint","it-IT":"Restituito observable per l'endpoint richiesto"},"ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST":{"en-US":"ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST","it-IT":"ERRORE nella riconnessione precedente a un nuovo tentativo di 'Send'. Il messaggio in questione SARA' PERSO"}},b=function(){function e(e,n,t,i,s,a,c){var u=this;if(this.MessageDef=e,this.hub_url=n,this.msgpack=t,this.enabled=i,this.debug=s,this.locale=c,this.notifications$={},this.enabled){this.MessageDef.AllDefinitions.forEach((function(e){u.notifications$[e.endpoint]=new o.Subject}));var l={skipNegotiation:!0,transport:r.HttpTransportType.WebSockets,logger:s?r.LogLevel.Debug:r.LogLevel.None},g=(new r.HubConnectionBuilder).withUrl(this.hub_url,l);if(a&&(this.log(this.loc("Building SignalR Hub with Automatic Reconnection")),g=g.withAutomaticReconnect(new Array(100).fill(5e3))),this.msgpack){this.log(this.loc("Building SignalR Hub with MessagePack protocol"));var d=require("@microsoft/signalr-protocol-msgpack");g=g.withHubProtocol(new d.MessagePackHubProtocol)}this.connection=g.build(),this.connect()}else this.log(this.loc("SignalR won't be enabled as per configuration"))}return e.prototype.connect=function(){var e=this;this.connection.start().catch((function(e){return console.log(e)})),this.MessageDef.AllDefinitions.forEach((function(n){null!==n.inTypeDefault&&null===n.outTypeDefault?e.connection.on(n.endpoint,(function(t){e.log(e.loc("Request received from the server for endpoint")+" '"+n.endpoint+"': "+e.substringLog(JSON.stringify(t))),e.notifications$[n.endpoint].next(t)})):e.log(e.loc("Refusing to register endpoint")+" "+n.endpoint+" "+e.loc("because it is not declared as IN - ONLY"))}))},e.prototype.ensureConnected=function(){var e=this;return this.connection.state==t.HubConnectionState.Disconnected?(this.log(this.loc("Connection lost or missing, reconnecting...")),this.connection.start().then((function(e){return Promise.resolve("OK")}),(function(n){return e.log(e.loc("Cannot reconnect SignalR, frontend HUB offline")),Promise.resolve("KO")}))):this.connection.state==t.HubConnectionState.Connected?Promise.resolve("OK"):Promise.resolve("NO-OP")},e.prototype.send=function(e,n){var i=this;if(!this.enabled)return this.log(this.loc("Send request ignored because SignalR is not active by configuration")),o.EMPTY;this.connection.state==t.HubConnectionState.Connecting||this.connection.state==t.HubConnectionState.Reconnecting||this.connection.state==t.HubConnectionState.Disconnecting?(this.log(this.loc("Send request sent before a connection was in stable State, waiting 1 second and retrying")),setTimeout((function(){i.send(e,n)}),1e3)):this.connection.state==t.HubConnectionState.Disconnected?this.ensureConnected().then((function(t){"KO"==t?i.log(i.loc("ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST")):i.send(e,n)})):this.connection.send(e.endpoint,n).then((function(t){i.debug&&console.info(i.loc("Request sent to server")+" - "+e.endpoint+": "+i.substringLog(JSON.stringify(n)))}))},e.prototype.invoke=function(e,n){var s=this;return this.enabled?this.connection.state==t.HubConnectionState.Connecting||this.connection.state==t.HubConnectionState.Reconnecting||this.connection.state==t.HubConnectionState.Disconnecting?(this.log(this.loc("Invoke request sent before a connection was in stable State, waiting 1 second and retrying")),o.of().pipe(i.delay(1e3),i.concatMap((function(){return s.invoke(e,n)})))):this.connection.state==t.HubConnectionState.Disconnected?o.from(this.ensureConnected()).pipe(i.concatMap((function(t){return"KO"==t?(s.log(s.loc("ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST")),o.EMPTY):s.invoke(e,n)}))):o.from(this.connection.invoke(e.endpoint,n)).pipe(i.tap((function(){s.debug&&console.log(s.loc("Request invoked to server")+" - "+e.endpoint+": "+s.substringLog(JSON.stringify(n)))}))):(this.log(this.loc("Invoke request ignored because SignalR is not active by configuration")),o.EMPTY)},e.prototype.observe=function(e){return this.enabled?(this.log(this.loc("Returning observable for required endpoint")+": "+e.endpoint),this.notifications$[e.endpoint]):(this.log(this.loc("Observe request ignored because SignalR is not active by configuration")),o.EMPTY)},e.prototype.disconnect=function(){var e=this;return this.enabled?o.from(this.connection.stop()).pipe(i.catchError((function(e,n){return console.log(e),o.of(null)})),i.tap((function(){e.log(e.loc("Disconnection request honored"))}))):(this.log(this.loc("Disconnection request ignored because SignalR is not active by configuration")),o.EMPTY)},e.prototype.substringLog=function(e,n){return void 0===n&&(n=120),e.length>n?e.substr(0,n)+"[...]":e},e.prototype.log=function(e){this.debug&&console.log("@signalr-notifications: "+e)},e.prototype.loc=function(e){return p[e]?p[e][this.locale]:(console.warn("Untranslated message: "+e),"")},e}();b.decorators=[{type:n.Injectable}],b.ctorParameters=function(){return[{type:a},{type:String,decorators:[{type:n.Inject,args:[c]}]},{type:Boolean,decorators:[{type:n.Inject,args:[d]}]},{type:Boolean,decorators:[{type:n.Inject,args:[u]}]},{type:Boolean,decorators:[{type:n.Inject,args:[l]}]},{type:Boolean,decorators:[{type:n.Inject,args:[f]}]},{type:String,decorators:[{type:n.Inject,args:[g]}]}]};var v=function(){function e(){}return e.forRoot=function(n){return{ngModule:e,providers:[b,{provide:a,useClass:(null==n?void 0:n.messageService)||a},{provide:c,useValue:null==n?void 0:n.hubUrl},{provide:g,useValue:(null==n?void 0:n.locale)||"it-IT"},{provide:u,useValue:null==(null==n?void 0:n.enabled)||(null==n?void 0:n.enabled)},{provide:l,useValue:null!=(null==n?void 0:n.debugMode)&&(null==n?void 0:n.debugMode)},{provide:d,useValue:null!=(null==n?void 0:n.autoReconnect)&&(null==n?void 0:n.autoReconnect)},{provide:f,useValue:null!=(null==n?void 0:n.useMessagePack)&&(null==n?void 0:n.useMessagePack)}]}},e}();v.decorators=[{type:n.NgModule}];var h=function(){function e(e,n,t){this.endpoint=e,this.inTypeDefault=n,this.outTypeDefault=t}return e.In=function(n,t){return new e(n,t,void 0)},e.Out=function(n,t){return new e(n,void 0,t)},e.Bi=function(n,t,o){return new e(n,t,o)},e}(),S=function(){};e.BaseMessageService=a,e.EndpointDef=h,e.NotificationsService=b,e.SignalrNotificationsModule=v,e.SignalrNotificationsModuleConfig=S,e["ɵa"]=c,e["ɵb"]=u,e["ɵc"]=l,e["ɵd"]=g,e["ɵe"]=d,e["ɵf"]=f,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
2
2
|
//# sourceMappingURL=esfaenza-signalr-notifications.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../projects/signalr-notifications/src/lib/models/BaseMessageService.ts","../../../projects/signalr-notifications/src/lib/tokens.ts","../../../projects/signalr-notifications/src/lib/signalr-notifications.service.loc.ts","../../../projects/signalr-notifications/src/lib/signalr-notifications.service.ts","../../../projects/signalr-notifications/src/lib/signalr-notifications.module.ts","../../../projects/signalr-notifications/src/lib/models/EndpointDef.ts","../../../projects/signalr-notifications/src/lib/config/SignalrNotificationsModuleConfig.ts"],"names":["BaseMessageService","Object","defineProperty","prototype","Injectable","HUB_URL","InjectionToken","SIGNALR_ENABLED","DEBUG_MODE","LOCALE","MESSAGE_PACK","AUTO_RECONNECT","Loc","Building SignalR Hub with Automatic Reconnection","en-US","it-IT","Cannot reconnect SignalR, frontend HUB offline","Send request sent before a connection was in stable State, waiting 1 second and retrying","Invoke request sent before a connection was in stable State, waiting 1 second and retrying","Connection lost or missing, reconnecting...","SignalR won't be enabled as per configuration","Building SignalR Hub with MessagePack protocol","Request received from the server for endpoint","Refusing to register endpoint","because it is not declared as IN - ONLY","Send request ignored because SignalR is not active by configuration","Request sent to server","Invoke request ignored because SignalR is not active by configuration","Request invoked to server","Observe request ignored because SignalR is not active by configuration","Returning observable for required endpoint","Disconnection request ignored because SignalR is not active by configuration","Disconnection request honored","ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST","NotificationsService","MessageDef","hub_url","msgpack","enabled","debug","autoreconnect","locale","_this","this","notifications$","AllDefinitions","forEach","def","endpoint","Subject","pars","skipNegotiation","transport","signalR","HttpTransportType","WebSockets","logger","LogLevel","Debug","None","builder","HubConnectionBuilder","withUrl","log","loc","withAutomaticReconnect","Array","fill","mphpModule","require","withHubProtocol","MessagePackHubProtocol","connection","build","connect","start","catch","err","console","d","inTypeDefault","outTypeDefault","on","message","substringLog","JSON","stringify","next","ensureConnected","state","HubConnectionState","Disconnected","then","_","Promise","resolve","Connected","send","item","dto","EMPTY","Connecting","Reconnecting","Disconnecting","setTimeout","t","info","invoke","of","pipe","delay","concatMap","from","res","tap","observe","disconnect","stop","catchError","caught","text","maxchars","length","substr","warn","Inject","args","SignalrNotificationsModule","forRoot","config","ngModule","providers","provide","useClass","messageService","useValue","hubUrl","debugMode","autoReconnect","useMessagePack","NgModule"],"mappings":"g1BAUA,SAAAA,YAKIC,OAAAC,eAAWF,EAAAG,UAAA,iBAAc,KAAzB,WAAuD,MAAO,6DANjEC,EAAAA,iBCJYC,EAAkC,IAAIC,EAAAA,eAAuB,WAK7DC,EAA0C,IAAID,EAAAA,eAAwB,mBAKtEE,EAAqC,IAAIF,EAAAA,eAAwB,cAKjEG,EAAiC,IAAIH,EAAAA,eAAuB,UAK5DI,EAAwC,IAAIJ,EAAAA,eAAwB,gBAKpEK,EAA0C,IAAIL,EAAAA,eAAwB,kBC3BtEM,EAAK,CACdC,mDAAoD,CAAEC,QAAS,mDAAoDC,QAAS,yDAC5HC,iDAAkD,CAAEF,QAAS,iDAAkDC,QAAS,mEACxHE,2FAA4F,CAAEH,QAAS,2FAA4FC,QAAS,8GAC5MG,6FAA8F,CAAEJ,QAAS,6FAA8FC,QAAS,gHAChNI,8CAAgD,CAAEL,QAAS,8CAA+CC,QAAS,kDACnHK,gDAAiD,CAAEN,QAAS,gDAAiDC,QAAS,qDACtHM,iDAAkD,CAAEP,QAAS,iDAAkDC,QAAS,uDACxHO,gDAAiD,CAAER,QAAS,gDAAiDC,QAAS,8CACtHQ,gCAAiC,CAAET,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C,KAAA,CAACpH,sCAAyCmH,EAAAA,OAAMC,KAAA,CAACvH,sCAA4CsH,EAAAA,OAAMC,KAAA,CAACtH,sCAAqCqH,EAAAA,OAAMC,KAAA,CAACnH,qCAAyCkH,EAAAA,OAAMC,KAAA,CAACrH,yBC9BzS,SAAAsH,YACSA,EAAAC,QAAP,SAAeC,GACb,MAAO,CACLC,SAAUH,EACVI,UAAW,CACTjG,EACA,CAAEkG,QAASpI,EAAoBqI,UAAUJ,MAAAA,OAAM,EAANA,EAAQK,iBAAkBtI,GACnE,CAAEoI,QAAS/H,EAASkI,SAAUN,MAAAA,OAAM,EAANA,EAAQO,QACtC,CAAEJ,QAAS3H,EAAQ8H,UAAUN,MAAAA,OAAM,EAANA,EAAQxF,SAAU,SAC/C,CAAE2F,QAAS7H,EAAiBgI,SAA6B,OAAnBN,MAAAA,OAAM,EAANA,EAAQ3F,WAAkB2F,MAAAA,OAAM,EAANA,EAAQ3F,UACxE,CAAE8F,QAAS5H,EAAY+H,SAA+B,OAArBN,MAAAA,OAAM,EAANA,EAAQQ,aAAoBR,MAAAA,OAAM,EAANA,EAAQQ,YACrE,CAAEL,QAAS1H,EAAc6H,SAAmC,OAAzBN,MAAAA,OAAM,EAANA,EAAQS,iBAAwBT,MAAAA,OAAM,EAANA,EAAQS,gBAC3E,CAAEN,QAASzH,EAAgB4H,SAAoC,OAA1BN,MAAAA,OAAM,EAANA,EAAQU,kBAAyBV,MAAAA,OAAM,EAANA,EAAQU,6CAbrFC,EAAAA,iBCKG,SAAmB5F,EAAyBgC,EAA2BC,GAApDtC,KAAAK,SAAAA,EAAyBL,KAAAqC,cAAAA,EAA2BrC,KAAAsC,eAAAA,KCH3E","sourcesContent":["// Angular\r\nimport { Injectable } from '@angular/core';\r\n\r\n// Modelli\r\nimport { EndpointDef } from './EndpointDef';\r\n\r\n/**\r\n * Classe base da estendere con la definizione degli Endpoint supportati dall'applicazione\r\n */\r\n@Injectable()\r\nexport class BaseMessageService {\r\n\r\n /**\r\n * Entrypoint che restituisce tutti gli Endpoint dell'applicazione\r\n */\r\n public get AllDefinitions(): EndpointDef<any, any>[] { return []; }\r\n}","import { InjectionToken } from '@angular/core';\r\n\r\n/**\r\n * Hub a cui collegarsi\r\n */\r\nexport const HUB_URL: InjectionToken<string> = new InjectionToken<string>('HUB_URL');\r\n\r\n/**\r\n * Indica se la libreria dev'essere attiva o no\r\n */\r\nexport const SIGNALR_ENABLED: InjectionToken<string> = new InjectionToken<boolean>('SIGNALR_ENABLED');\r\n\r\n/**\r\n * Indica se stampare messaggi di debug in console\r\n */\r\nexport const DEBUG_MODE: InjectionToken<string> = new InjectionToken<boolean>('DEBUG_MODE');\r\n\r\n/**\r\n * Indica il locale utilizzato dalla libreria per i messaggi. Sono supportati \"it-IT\" ed \"en-US\"\r\n */\r\nexport const LOCALE: InjectionToken<string> = new InjectionToken<string>('LOCALE');\r\n\r\n/**\r\n * Indica se utilizzare il protocollo di trasferimento \"MessagePack\"\r\n */\r\nexport const MESSAGE_PACK: InjectionToken<boolean> = new InjectionToken<boolean>('MESSAGE_PACK');\r\n\r\n/**\r\n * Indica se tentare in automatico la riconnessione\r\n */\r\nexport const AUTO_RECONNECT: InjectionToken<boolean> = new InjectionToken<boolean>('AUTO_RECONNECT');","/**\r\n * Oggetto statico di localizzazione per i messaggi scritti dal servizio\r\n */\r\nexport const Loc ={\r\n \"Building SignalR Hub with Automatic Reconnection\": { \"en-US\": \"Building SignalR Hub with Automatic Reconnection\", \"it-IT\": \"Compilo l'Hub di SignalR con riconnessione automatica\", },\r\n \"Cannot reconnect SignalR, frontend HUB offline\": { \"en-US\": \"Cannot reconnect SignalR, frontend HUB offline\", \"it-IT\": \"Impossibile riconnettere SignalR, l'Hub del Frontend e' Offline\", },\r\n \"Send request sent before a connection was in stable State, waiting 1 second and retrying\": { \"en-US\": \"Send request sent before a connection was in stable State, waiting 1 second and retrying\", \"it-IT\": \"Richiesta 'Send' ricevuta prima che la connessione fosse in uno stato stabile, attendo 1 secondo e riprovo\", },\r\n \"Invoke request sent before a connection was in stable State, waiting 1 second and retrying\": { \"en-US\": \"Invoke request sent before a connection was in stable State, waiting 1 second and retrying\", \"it-IT\": \"Richiesta 'Invoke' ricevuta prima che la connessione fosse in uno stato stabile, attendo 1 secondo e riprovo\", },\r\n \"Connection lost or missing, reconnecting...\" : { \"en-US\": \"Connection lost or missing, reconnecting...\", \"it-IT\": \"Connessione persa o mancante, mi riconnetto...\", },\r\n \"SignalR won't be enabled as per configuration\": { \"en-US\": \"SignalR won't be enabled as per configuration\", \"it-IT\": \"SignalR non verrà attivato come da configurazione\", },\r\n \"Building SignalR Hub with MessagePack protocol\": { \"en-US\": \"Building SignalR Hub with MessagePack protocol\", \"it-IT\": \"Compilo l'Hub di SignalR con protocollo MessagePack\", },\r\n \"Request received from the server for endpoint\": { \"en-US\": \"Request received from the server for endpoint\", \"it-IT\": \"Richiesta ricevuta dal server per endpoint\", },\r\n \"Refusing to register endpoint\": { \"en-US\": \"Refusing to register endpoint\", \"it-IT\": \"Rifiuto di registrare l'endpoint\", },\r\n \"because it is not declared as IN - ONLY\": { \"en-US\": \"because it is not declared as IN - ONLY\", \"it-IT\": \"in quanto non è registrato solo come IN\", },\r\n \"Send request ignored because SignalR is not active by configuration\": { \"en-US\": \"Send request ignored because SignalR is not active by configuration\", \"it-IT\": \"Richiesta send ignorata in quanto SignalR non è attivo da configurazione\", },\r\n \"Request sent to server\": { \"en-US\": \"Request sent to server\", \"it-IT\": \"Richiesta inviata al server\", },\r\n \"Invoke request ignored because SignalR is not active by configuration\": { \"en-US\": \"Invoke request ignored because SignalR is not active by configuration\", \"it-IT\": \"Richiesta invoke ignorata in quanto SignalR non è attivo da configurazione\", },\r\n \"Request invoked to server\": { \"en-US\": \"Request invoked to server\", \"it-IT\": \"Richiesta invoke inviata al server\", },\r\n \"Observe request ignored because SignalR is not active by configuration\": { \"en-US\": \"Observe request ignored because SignalR is not active by configuration\", \"it-IT\": \"Osservazione ignorata in quanto SignalR non è attivo da configurazione\", },\r\n \"Returning observable for required endpoint\": { \"en-US\": \"Returning observable for required endpoint\", \"it-IT\": \"Restituisco l'observable per l'endpoint richiesto\", },\r\n \"Disconnection request ignored because SignalR is not active by configuration\": { \"en-US\": \"Disconnection request ignored because SignalR is not active by configuration\", \"it-IT\": \"Richiesta di disconnesione ignorata in quanto SignalR non è attivo da configurazione\", },\r\n \"Disconnection request honored\": { \"en-US\": \"Returning observable for required endpoint\", \"it-IT\": \"Restituito observable per l'endpoint richiesto\", },\r\n \"ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST\": { \"en-US\": \"ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST\", \"it-IT\": \"ERRORE nella riconnessione precedente a un nuovo tentativo di 'Send'. Il messaggio in questione SARA' PERSO\"}\r\n}","// Angular\r\nimport { Injectable, Inject } from \"@angular/core\";\r\n\r\n// Direttive, Componenti, Librerie\r\nimport * as signalR from '@microsoft/signalr';\r\nimport { HubConnectionState } from \"@microsoft/signalr\";\r\nimport { Observable, Subject, EMPTY, from, of } from \"rxjs\";\r\nimport { catchError, concatMap, delay, tap } from \"rxjs/operators\";\r\n\r\n// Modelli\r\nimport { BaseMessageService } from './models/BaseMessageService';\r\nimport { EndpointDef } from './models/EndpointDef';\r\nimport { DEBUG_MODE, HUB_URL, LOCALE, MESSAGE_PACK, SIGNALR_ENABLED, AUTO_RECONNECT } from \"./tokens\";\r\n\r\n// Localizzazione\r\nimport { Loc } from './signalr-notifications.service.loc';\r\n\r\n/**\r\n * Servizio che gestisce la comunicazione con un Hub SignalR in base alle configurazioni fornite dall'applicazione\r\n */\r\n@Injectable()\r\nexport class NotificationsService {\r\n\r\n /**\r\n * Cache degli Observable generati in base agli Endpoint disponibili\r\n */\r\n private notifications$: { [index: string]: Subject<any> } = {};\r\n\r\n /**\r\n * Connessione Signalr\r\n */\r\n private connection: signalR.HubConnection;\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @ignore\r\n */\r\n constructor(private MessageDef: BaseMessageService, @Inject(HUB_URL) private hub_url: string, @Inject(MESSAGE_PACK) private msgpack: boolean, @Inject(SIGNALR_ENABLED) private enabled: boolean, @Inject(DEBUG_MODE) private debug: boolean, @Inject(AUTO_RECONNECT) autoreconnect: boolean, @Inject(LOCALE) private locale : string) {\r\n if (!this.enabled) {\r\n this.log(this.loc(\"SignalR won't be enabled as per configuration\"));\r\n return;\r\n }\r\n\r\n this.MessageDef.AllDefinitions.forEach(def => { this.notifications$[def.endpoint] = new Subject<typeof def.inTypeDefault>(); });\r\n\r\n let pars: signalR.IHttpConnectionOptions = { skipNegotiation: true, transport: signalR.HttpTransportType.WebSockets, logger: debug ? signalR.LogLevel.Debug : signalR.LogLevel.None };\r\n var builder = new signalR.HubConnectionBuilder().withUrl(this.hub_url, pars);\r\n\r\n if (autoreconnect) {\r\n this.log(this.loc(\"Building SignalR Hub with Automatic Reconnection\"));\r\n // 100 tentativi di riconnessione, 1 ogni 5 secondi\r\n builder = builder.withAutomaticReconnect(new Array(100).fill(5 * 1000));\r\n }\r\n\r\n if (this.msgpack) {\r\n this.log(this.loc(\"Building SignalR Hub with MessagePack protocol\"));\r\n var mphpModule = require(\"@microsoft/signalr-protocol-msgpack\");\r\n builder = builder.withHubProtocol(new mphpModule.MessagePackHubProtocol())\r\n }\r\n\r\n this.connection = builder.build();\r\n this.connect();\r\n }\r\n\r\n /**\r\n * Effettua la connessione all'Hub Signalr e registra tutti gli Endpoint per cui il Backend comunica con il Frontend sulla **connection**\r\n */\r\n private connect() {\r\n this.connection.start().catch(err => console.log(err));\r\n this.MessageDef.AllDefinitions.forEach(d => {\r\n //Registro solo le cose di IN, quelle di out sono chiamate che faccio io al BE quindi non servono\r\n if (d.inTypeDefault !== null && d.outTypeDefault === null)\r\n this.connection.on(d.endpoint, (message) => {\r\n this.log(this.loc(\"Request received from the server for endpoint\") + \" '\" + d.endpoint + \"': \" + this.substringLog(JSON.stringify(message)));\r\n this.notifications$[d.endpoint].next(message);\r\n });\r\n else\r\n this.log(this.loc(\"Refusing to register endpoint\") + \" \" + d.endpoint + \" \" + this.loc(\"because it is not declared as IN - ONLY\"));\r\n });\r\n }\r\n\r\n /**\r\n * Effettua verifiche sulla connessione e, in caso non fosse collegata, tenta di riconnetterla\r\n * \r\n * @returns {Promise<'OK' | 'KO' | 'NO-OP'>} 'OK' Se la connessione è già connessa o è stata riconnessa con successo, 'KO' Se non è stato possibile riconnettere \r\n * una connessione disconnessa, 'NO-OP' se la connesisone è in uno stato intermedio che non può essere modificato\r\n */\r\n public ensureConnected(): Promise<'OK' | 'KO' | 'NO-OP'> {\r\n if (this.connection.state == HubConnectionState.Disconnected) {\r\n this.log(this.loc(\"Connection lost or missing, reconnecting...\"));\r\n\r\n return this.connection.start()\r\n .then(_ => {\r\n return Promise.resolve(\"OK\");\r\n }, _ => {\r\n this.log(this.loc(\"Cannot reconnect SignalR, frontend HUB offline\"));\r\n return Promise.resolve(\"KO\");\r\n });\r\n }\r\n else if (this.connection.state == HubConnectionState.Connected)\r\n return Promise.resolve(\"OK\");\r\n else\r\n return Promise.resolve(\"NO-OP\");\r\n }\r\n\r\n /**\r\n * Invia un messaggio all'Hub del Backend\r\n * \r\n * @param {EndpointDef<TOut, any>} item Endpoint da contattare\r\n * @param {TOut} dto Dto da inviare all'Endpoint\r\n */\r\n public send<TOut>(item: EndpointDef<TOut, any>, dto: TOut) {\r\n if (!this.enabled) {\r\n this.log(this.loc(\"Send request ignored because SignalR is not active by configuration\"));\r\n return EMPTY;\r\n }\r\n\r\n if (this.connection.state == HubConnectionState.Connecting || this.connection.state == HubConnectionState.Reconnecting || this.connection.state == HubConnectionState.Disconnecting) {\r\n this.log(this.loc(\"Send request sent before a connection was in stable State, waiting 1 second and retrying\"));\r\n setTimeout(() => { this.send(item, dto); }, 1000);\r\n }\r\n else if (this.connection.state == HubConnectionState.Disconnected) {\r\n this.ensureConnected().then(t => {\r\n if (t == \"KO\") this.log(this.loc(\"ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST\"));\r\n else this.send(item, dto);\r\n })\r\n }\r\n else {\r\n this.connection.send(item.endpoint, dto).then(_ => {\r\n if (this.debug)\r\n console.info(this.loc(\"Request sent to server\") + \" - \" + item.endpoint + \": \" + this.substringLog(JSON.stringify(dto)));\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Invia un messaggio all'Hub del Backend, aspettandosi una risposta\r\n * \r\n * @param {EndpointDef<TOut, TIn>} item Endpoint da contattare\r\n * @param {TOut} dto Dto da inviare all'Endpoint\r\n * \r\n * @returns {Observable<TIn>} Observable su cui ci si può registrare per ricevere il risultato della chiamata\r\n */\r\n public invoke<TOut, TIn>(item: EndpointDef<TOut, TIn>, dto: TOut): Observable<TIn> {\r\n if (!this.enabled) {\r\n this.log(this.loc(\"Invoke request ignored because SignalR is not active by configuration\"));\r\n return EMPTY;\r\n }\r\n\r\n if (this.connection.state == HubConnectionState.Connecting || this.connection.state == HubConnectionState.Reconnecting || this.connection.state == HubConnectionState.Disconnecting) {\r\n this.log(this.loc(\"Invoke request sent before a connection was in stable State, waiting 1 second and retrying\"));\r\n return of().pipe(delay(1000), concatMap(() => this.invoke(item, dto)));\r\n }\r\n else if (this.connection.state == HubConnectionState.Disconnected) {\r\n return from(this.ensureConnected()).pipe(concatMap((res) => {\r\n if (res == \"KO\") {\r\n this.log(this.loc(\"ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST\"));\r\n return EMPTY;\r\n }\r\n else return this.invoke(item, dto);\r\n }))\r\n }\r\n else {\r\n return from(this.connection.invoke<TIn>(item.endpoint, dto)).pipe(\r\n tap(() => {\r\n if (this.debug) console.log(this.loc(\"Request invoked to server\") + \" - \" + item.endpoint + \": \" + this.substringLog(JSON.stringify(dto)));\r\n })\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Hook per osservare i dati spediti ad un Endpoint dal Backend\r\n * \r\n * @param {EndpointDef<TIn, any>} item Endpoint su cui ascoltare\r\n * \r\n * @returns {Observable<TIn>} Observable su cui ci si può registrare per ricevere l'oggetto generato ad ogni chiamata dal Backend al Frontend\r\n */\r\n public observe<TIn>(item: EndpointDef<TIn, any>): Observable<TIn> {\r\n if (!this.enabled)\r\n {\r\n this.log(this.loc(\"Observe request ignored because SignalR is not active by configuration\"));\r\n return EMPTY;\r\n }\r\n\r\n this.log(this.loc(\"Returning observable for required endpoint\") + \": \" + item.endpoint);\r\n return <Observable<TIn>>this.notifications$[item.endpoint];\r\n }\r\n\r\n /**\r\n * Disconnessione del sistema di SignalR\r\n * \r\n * @returns {Observable<void>} Observable a cui registrarsi che viene chiamato quando la disconnessione è terminata\r\n */\r\n public disconnect(): Observable<void> {\r\n //NO-OP se non attivo\r\n if (!this.enabled)\r\n {\r\n this.log(this.loc(\"Disconnection request ignored because SignalR is not active by configuration\"));\r\n return EMPTY;\r\n }\r\n\r\n return from(this.connection.stop()).pipe(\r\n catchError((err, caught) => { console.log(err); return of(null); }),\r\n tap(() => {\r\n this.log(this.loc(\"Disconnection request honored\"));\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Taglia un log troppo lungo\r\n * \r\n * @param {string} text Log da tagliare\r\n * @param {number} maxchars Numero massimo di caratteri da tenere\r\n * \r\n * @returns {string} Log tagliato\r\n */\r\n private substringLog(text: string, maxchars: number = 120) : string {\r\n return text.length > maxchars ? text.substr(0, maxchars) + \"[...]\" : text;\r\n }\r\n\r\n /**\r\n * Stampa un log a console\r\n * \r\n * @param {string} message Messaggio da stampare\r\n */\r\n private log(message: string) {\r\n if (this.debug)\r\n console.log(\"@signalr-notifications: \" + message)\r\n }\r\n\r\n /**\r\n * Helper di localizzazione\r\n * \r\n * @param {string} message Messaggio da tradurre\r\n * \r\n * @returns {string} Messaggio tradotto\r\n */\r\n private loc(message: string) : string{\r\n if(!Loc[message])\r\n {\r\n console.warn(\"Untranslated message: \" + message)\r\n return \"\";\r\n }\r\n return Loc[message][this.locale];\r\n }\r\n}","\r\nimport { NgModule, ModuleWithProviders } from '@angular/core';\r\nimport { SignalrNotificationsModuleConfig } from './config/SignalrNotificationsModuleConfig';\r\nimport { BaseMessageService } from './models/BaseMessageService';\r\nimport { NotificationsService } from './signalr-notifications.service';\r\nimport { HUB_URL, SIGNALR_ENABLED, DEBUG_MODE, LOCALE, MESSAGE_PACK, AUTO_RECONNECT } from './tokens';\r\n\r\n@NgModule()\r\nexport class SignalrNotificationsModule {\r\n static forRoot(config?: SignalrNotificationsModuleConfig): ModuleWithProviders<SignalrNotificationsModule> {\r\n return {\r\n ngModule: SignalrNotificationsModule,\r\n providers: [\r\n NotificationsService,\r\n { provide: BaseMessageService, useClass: config?.messageService || BaseMessageService },\r\n { provide: HUB_URL, useValue: config?.hubUrl },\r\n { provide: LOCALE, useValue: config?.locale || 'it-IT' },\r\n { provide: SIGNALR_ENABLED, useValue: config?.enabled != null ? config?.enabled : true },\r\n { provide: DEBUG_MODE, useValue: config?.debugMode != null ? config?.debugMode : false },\r\n { provide: MESSAGE_PACK, useValue: config?.autoReconnect != null ? config?.autoReconnect : false },\r\n { provide: AUTO_RECONNECT, useValue: config?.useMessagePack != null ? config?.useMessagePack : false },\r\n ]\r\n };\r\n }\r\n}","/**\r\n * Definisce un Endpoint che spedisce un'informazione di tipo TIn e restituisce un'informazione di tipo TOut\r\n */\r\nexport class EndpointDef<TIn, TOut> {\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @param {string} endpoint Nome del metodo da chiamare nell'Hub del Backend contattato\r\n * @param {TIn} inTypeDefault Default per il tipo TIn. Utilizzato per fare Typecheck sulle chiamate da Backend a Frontend\r\n * @param {TOut} outTypeDefault Default per il tipo TOut. Utilizzato per fare Typecheck sulle chiamate da Frontend a Backend\r\n */\r\n constructor(public endpoint: string, public inTypeDefault: TIn, public outTypeDefault: TOut) { }\r\n}","// Angular\r\nimport { Type } from '@angular/core';\r\n\r\n// Modelli\r\nimport { BaseMessageService } from '../models/BaseMessageService';\r\n\r\n/**\r\n * Classe di configurazione per la libreria\r\n */\r\nexport class SignalrNotificationsModuleConfig {\r\n\r\n /**\r\n * Url nei confronti del quale aprire la connessione SignalR\r\n */\r\n hubUrl : string;\r\n\r\n /**\r\n * Servizio che definisce i messaggi di IN e OUT coi loro default\r\n */\r\n messageService? : Type<BaseMessageService>;\r\n\r\n /**\r\n * Indica se abilitare o meno la connessione SignalR nei confronti dell'URL **hubUrl**\r\n */\r\n enabled? : boolean;\r\n\r\n /**\r\n * Indica se utilizzare message pack come protocollo di trasmissione\r\n */\r\n useMessagePack? : boolean;\r\n\r\n /**\r\n * Indica se tentare di riconnettersi automaticamente quando la connessione cade\r\n */\r\n autoReconnect? : boolean;\r\n\r\n /**\r\n * Indica se scrivere o meno i messaggi di debug\r\n */\r\n debugMode? : boolean;\r\n\r\n /**\r\n * Lingua dei feedback a console, sono supportati 'it-IT' ed 'en-US'\r\n */\r\n locale? : string\r\n}"]}
|
|
1
|
+
{"version":3,"sources":["../../../projects/signalr-notifications/src/lib/models/BaseMessageService.ts","../../../projects/signalr-notifications/src/lib/tokens.ts","../../../projects/signalr-notifications/src/lib/signalr-notifications.service.loc.ts","../../../projects/signalr-notifications/src/lib/signalr-notifications.service.ts","../../../projects/signalr-notifications/src/lib/signalr-notifications.module.ts","../../../projects/signalr-notifications/src/lib/models/EndpointDef.ts","../../../projects/signalr-notifications/src/lib/config/SignalrNotificationsModuleConfig.ts"],"names":["BaseMessageService","this","definitions","Object","defineProperty","prototype","add","endpoint","push","Injectable","HUB_URL","InjectionToken","SIGNALR_ENABLED","DEBUG_MODE","LOCALE","MESSAGE_PACK","AUTO_RECONNECT","Loc","Building SignalR Hub with Automatic Reconnection","en-US","it-IT","Cannot reconnect SignalR, frontend HUB offline","Send request sent before a connection was in stable State, waiting 1 second and retrying","Invoke request sent before a connection was in stable State, waiting 1 second and retrying","Connection lost or missing, reconnecting...","SignalR won't be enabled as per configuration","Building SignalR Hub with MessagePack protocol","Request received from the server for endpoint","Refusing to register endpoint","because it is not declared as IN - ONLY","Send request ignored because SignalR is not active by configuration","Request sent to server","Invoke request ignored because SignalR is not active by configuration","Request invoked to server","Observe request ignored because SignalR is not active by configuration","Returning observable for required endpoint","Disconnection request ignored because SignalR is not active by configuration","Disconnection request honored","ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST","NotificationsService","MessageDef","hub_url","msgpack","enabled","debug","autoreconnect","locale","_this","notifications$","AllDefinitions","forEach","def","Subject","pars","skipNegotiation","transport","signalR","HttpTransportType","WebSockets","logger","LogLevel","Debug","None","builder","HubConnectionBuilder","withUrl","log","loc","withAutomaticReconnect","Array","fill","mphpModule","require","withHubProtocol","MessagePackHubProtocol","connection","build","connect","start","catch","err","console","d","inTypeDefault","outTypeDefault","on","message","substringLog","JSON","stringify","next","ensureConnected","state","HubConnectionState","Disconnected","then","_","Promise","resolve","Connected","send","item","dto","EMPTY","Connecting","Reconnecting","Disconnecting","setTimeout","t","info","invoke","of","pipe","delay","concatMap","from","res","tap","observe","disconnect","stop","catchError","caught","text","maxchars","length","substr","warn","Inject","args","SignalrNotificationsModule","forRoot","config","ngModule","providers","provide","useClass","messageService","useValue","hubUrl","debugMode","autoReconnect","useMessagePack","NgModule","EndpointDef","In","name","undefined","Out","Bi"],"mappings":"g1BASA,SAAAA,IAGYC,KAAAC,YAAuC,UAG/CC,OAAAC,eAAWJ,EAAAK,UAAA,iBAAc,KAAzB,WAAuD,OAAOJ,KAAKC,6CAE5DF,EAAAK,UAAAC,IAAA,SAAIC,GACPN,KAAKC,YAAYM,KAAKD,6BAT7BE,EAAAA,iBCJYC,EAAkC,IAAIC,EAAAA,eAAuB,WAK7DC,EAA0C,IAAID,EAAAA,eAAwB,mBAKtEE,EAAqC,IAAIF,EAAAA,eAAwB,cAKjEG,EAAiC,IAAIH,EAAAA,eAAuB,UAK5DI,EAAwC,IAAIJ,EAAAA,eAAwB,gBAKpEK,EAA0C,IAAIL,EAAAA,eAAwB,kBC3BtEM,EAAK,CACdC,mDAAoD,CAAEC,QAAS,mDAAoDC,QAAS,yDAC5HC,iDAAkD,CAAEF,QAAS,iD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AyBV,MAAAA,OAAM,EAANA,EAAQU,6CAbrFC,EAAAA,4BCKG,SAAAC,EAAmBzI,EAAyB4E,EAA2BC,GAApDnF,KAAAM,SAAAA,EAAyBN,KAAAkF,cAAAA,EAA2BlF,KAAAmF,eAAAA,SAIzD4D,EAAAC,GAAP,SAAeC,EAAc/D,GAChC,OAAO,IAAI6D,EAAuBE,EAAM/D,OAAegE,IAI7CH,EAAAI,IAAP,SAAiBF,EAAc9D,GAClC,OAAO,IAAI4D,EAAwBE,OAAMC,EAAW/D,IAI1C4D,EAAAK,GAAP,SAAqBH,EAAc/D,EAAoBC,GAC1D,OAAO,IAAI4D,EAAuBE,EAAM/D,EAAeC,WClB/D","sourcesContent":["// Angular\r\nimport { Injectable } from '@angular/core';\r\n\r\n// Modelli\r\nimport { EndpointDef } from './EndpointDef';\r\n\r\n/**\r\n * Classe base da estendere con la definizione degli Endpoint supportati dall'applicazione\r\n */\r\n@Injectable()\r\nexport class BaseMessageService {\r\n\r\n private definitions: EndpointDef<any, any>[] = [];\r\n\r\n /** Entrypoint che restituisce tutti gli Endpoint dell'applicazione. Da overridare qualora non venga utilizzato il metodo **add** */\r\n public get AllDefinitions(): EndpointDef<any, any>[] { return this.definitions; }\r\n\r\n public add(endpoint: EndpointDef<any, any>) {\r\n this.definitions.push(endpoint);\r\n }\r\n}","import { InjectionToken } from '@angular/core';\r\n\r\n/**\r\n * Hub a cui collegarsi\r\n */\r\nexport const HUB_URL: InjectionToken<string> = new InjectionToken<string>('HUB_URL');\r\n\r\n/**\r\n * Indica se la libreria dev'essere attiva o no\r\n */\r\nexport const SIGNALR_ENABLED: InjectionToken<string> = new InjectionToken<boolean>('SIGNALR_ENABLED');\r\n\r\n/**\r\n * Indica se stampare messaggi di debug in console\r\n */\r\nexport const DEBUG_MODE: InjectionToken<string> = new InjectionToken<boolean>('DEBUG_MODE');\r\n\r\n/**\r\n * Indica il locale utilizzato dalla libreria per i messaggi. Sono supportati \"it-IT\" ed \"en-US\"\r\n */\r\nexport const LOCALE: InjectionToken<string> = new InjectionToken<string>('LOCALE');\r\n\r\n/**\r\n * Indica se utilizzare il protocollo di trasferimento \"MessagePack\"\r\n */\r\nexport const MESSAGE_PACK: InjectionToken<boolean> = new InjectionToken<boolean>('MESSAGE_PACK');\r\n\r\n/**\r\n * Indica se tentare in automatico la riconnessione\r\n */\r\nexport const AUTO_RECONNECT: InjectionToken<boolean> = new InjectionToken<boolean>('AUTO_RECONNECT');","/**\r\n * Oggetto statico di localizzazione per i messaggi scritti dal servizio\r\n */\r\nexport const Loc ={\r\n \"Building SignalR Hub with Automatic Reconnection\": { \"en-US\": \"Building SignalR Hub with Automatic Reconnection\", \"it-IT\": \"Compilo l'Hub di SignalR con riconnessione automatica\", },\r\n \"Cannot reconnect SignalR, frontend HUB offline\": { \"en-US\": \"Cannot reconnect SignalR, frontend HUB offline\", \"it-IT\": \"Impossibile riconnettere SignalR, l'Hub del Frontend e' Offline\", },\r\n \"Send request sent before a connection was in stable State, waiting 1 second and retrying\": { \"en-US\": \"Send request sent before a connection was in stable State, waiting 1 second and retrying\", \"it-IT\": \"Richiesta 'Send' ricevuta prima che la connessione fosse in uno stato stabile, attendo 1 secondo e riprovo\", },\r\n \"Invoke request sent before a connection was in stable State, waiting 1 second and retrying\": { \"en-US\": \"Invoke request sent before a connection was in stable State, waiting 1 second and retrying\", \"it-IT\": \"Richiesta 'Invoke' ricevuta prima che la connessione fosse in uno stato stabile, attendo 1 secondo e riprovo\", },\r\n \"Connection lost or missing, reconnecting...\" : { \"en-US\": \"Connection lost or missing, reconnecting...\", \"it-IT\": \"Connessione persa o mancante, mi riconnetto...\", },\r\n \"SignalR won't be enabled as per configuration\": { \"en-US\": \"SignalR won't be enabled as per configuration\", \"it-IT\": \"SignalR non verrà attivato come da configurazione\", },\r\n \"Building SignalR Hub with MessagePack protocol\": { \"en-US\": \"Building SignalR Hub with MessagePack protocol\", \"it-IT\": \"Compilo l'Hub di SignalR con protocollo MessagePack\", },\r\n \"Request received from the server for endpoint\": { \"en-US\": \"Request received from the server for endpoint\", \"it-IT\": \"Richiesta ricevuta dal server per endpoint\", },\r\n \"Refusing to register endpoint\": { \"en-US\": \"Refusing to register endpoint\", \"it-IT\": \"Rifiuto di registrare l'endpoint\", },\r\n \"because it is not declared as IN - ONLY\": { \"en-US\": \"because it is not declared as IN - ONLY\", \"it-IT\": \"in quanto non è registrato solo come IN\", },\r\n \"Send request ignored because SignalR is not active by configuration\": { \"en-US\": \"Send request ignored because SignalR is not active by configuration\", \"it-IT\": \"Richiesta send ignorata in quanto SignalR non è attivo da configurazione\", },\r\n \"Request sent to server\": { \"en-US\": \"Request sent to server\", \"it-IT\": \"Richiesta inviata al server\", },\r\n \"Invoke request ignored because SignalR is not active by configuration\": { \"en-US\": \"Invoke request ignored because SignalR is not active by configuration\", \"it-IT\": \"Richiesta invoke ignorata in quanto SignalR non è attivo da configurazione\", },\r\n \"Request invoked to server\": { \"en-US\": \"Request invoked to server\", \"it-IT\": \"Richiesta invoke inviata al server\", },\r\n \"Observe request ignored because SignalR is not active by configuration\": { \"en-US\": \"Observe request ignored because SignalR is not active by configuration\", \"it-IT\": \"Osservazione ignorata in quanto SignalR non è attivo da configurazione\", },\r\n \"Returning observable for required endpoint\": { \"en-US\": \"Returning observable for required endpoint\", \"it-IT\": \"Restituisco l'observable per l'endpoint richiesto\", },\r\n \"Disconnection request ignored because SignalR is not active by configuration\": { \"en-US\": \"Disconnection request ignored because SignalR is not active by configuration\", \"it-IT\": \"Richiesta di disconnesione ignorata in quanto SignalR non è attivo da configurazione\", },\r\n \"Disconnection request honored\": { \"en-US\": \"Returning observable for required endpoint\", \"it-IT\": \"Restituito observable per l'endpoint richiesto\", },\r\n \"ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST\": { \"en-US\": \"ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST\", \"it-IT\": \"ERRORE nella riconnessione precedente a un nuovo tentativo di 'Send'. Il messaggio in questione SARA' PERSO\"}\r\n}","// Angular\r\nimport { Injectable, Inject } from \"@angular/core\";\r\n\r\n// Direttive, Componenti, Librerie\r\nimport * as signalR from '@microsoft/signalr';\r\nimport { HubConnectionState } from \"@microsoft/signalr\";\r\nimport { Observable, Subject, EMPTY, from, of } from \"rxjs\";\r\nimport { catchError, concatMap, delay, tap } from \"rxjs/operators\";\r\n\r\n// Modelli\r\nimport { BaseMessageService } from './models/BaseMessageService';\r\nimport { EndpointDef } from './models/EndpointDef';\r\nimport { DEBUG_MODE, HUB_URL, LOCALE, MESSAGE_PACK, SIGNALR_ENABLED, AUTO_RECONNECT } from \"./tokens\";\r\n\r\n// Localizzazione\r\nimport { Loc } from './signalr-notifications.service.loc';\r\n\r\n/**\r\n * Servizio che gestisce la comunicazione con un Hub SignalR in base alle configurazioni fornite dall'applicazione\r\n */\r\n@Injectable()\r\nexport class NotificationsService {\r\n\r\n /**\r\n * Cache degli Observable generati in base agli Endpoint disponibili\r\n */\r\n private notifications$: { [index: string]: Subject<any> } = {};\r\n\r\n /**\r\n * Connessione Signalr\r\n */\r\n private connection: signalR.HubConnection;\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @ignore\r\n */\r\n constructor(private MessageDef: BaseMessageService, @Inject(HUB_URL) private hub_url: string, @Inject(MESSAGE_PACK) private msgpack: boolean, @Inject(SIGNALR_ENABLED) private enabled: boolean, @Inject(DEBUG_MODE) private debug: boolean, @Inject(AUTO_RECONNECT) autoreconnect: boolean, @Inject(LOCALE) private locale : string) {\r\n if (!this.enabled) {\r\n this.log(this.loc(\"SignalR won't be enabled as per configuration\"));\r\n return;\r\n }\r\n\r\n this.MessageDef.AllDefinitions.forEach(def => { this.notifications$[def.endpoint] = new Subject<typeof def.inTypeDefault>(); });\r\n\r\n let pars: signalR.IHttpConnectionOptions = { skipNegotiation: true, transport: signalR.HttpTransportType.WebSockets, logger: debug ? signalR.LogLevel.Debug : signalR.LogLevel.None };\r\n var builder = new signalR.HubConnectionBuilder().withUrl(this.hub_url, pars);\r\n\r\n if (autoreconnect) {\r\n this.log(this.loc(\"Building SignalR Hub with Automatic Reconnection\"));\r\n // 100 tentativi di riconnessione, 1 ogni 5 secondi\r\n builder = builder.withAutomaticReconnect(new Array(100).fill(5 * 1000));\r\n }\r\n\r\n if (this.msgpack) {\r\n this.log(this.loc(\"Building SignalR Hub with MessagePack protocol\"));\r\n var mphpModule = require(\"@microsoft/signalr-protocol-msgpack\");\r\n builder = builder.withHubProtocol(new mphpModule.MessagePackHubProtocol())\r\n }\r\n\r\n this.connection = builder.build();\r\n this.connect();\r\n }\r\n\r\n /**\r\n * Effettua la connessione all'Hub Signalr e registra tutti gli Endpoint per cui il Backend comunica con il Frontend sulla **connection**\r\n */\r\n private connect() {\r\n this.connection.start().catch(err => console.log(err));\r\n this.MessageDef.AllDefinitions.forEach(d => {\r\n //Registro solo le cose di IN, quelle di out sono chiamate che faccio io al BE quindi non servono\r\n if (d.inTypeDefault !== null && d.outTypeDefault === null)\r\n this.connection.on(d.endpoint, (message) => {\r\n this.log(this.loc(\"Request received from the server for endpoint\") + \" '\" + d.endpoint + \"': \" + this.substringLog(JSON.stringify(message)));\r\n this.notifications$[d.endpoint].next(message);\r\n });\r\n else\r\n this.log(this.loc(\"Refusing to register endpoint\") + \" \" + d.endpoint + \" \" + this.loc(\"because it is not declared as IN - ONLY\"));\r\n });\r\n }\r\n\r\n /**\r\n * Effettua verifiche sulla connessione e, in caso non fosse collegata, tenta di riconnetterla\r\n * \r\n * @returns {Promise<'OK' | 'KO' | 'NO-OP'>} 'OK' Se la connessione è già connessa o è stata riconnessa con successo, 'KO' Se non è stato possibile riconnettere \r\n * una connessione disconnessa, 'NO-OP' se la connesisone è in uno stato intermedio che non può essere modificato\r\n */\r\n public ensureConnected(): Promise<'OK' | 'KO' | 'NO-OP'> {\r\n if (this.connection.state == HubConnectionState.Disconnected) {\r\n this.log(this.loc(\"Connection lost or missing, reconnecting...\"));\r\n\r\n return this.connection.start()\r\n .then(_ => {\r\n return Promise.resolve(\"OK\");\r\n }, _ => {\r\n this.log(this.loc(\"Cannot reconnect SignalR, frontend HUB offline\"));\r\n return Promise.resolve(\"KO\");\r\n });\r\n }\r\n else if (this.connection.state == HubConnectionState.Connected)\r\n return Promise.resolve(\"OK\");\r\n else\r\n return Promise.resolve(\"NO-OP\");\r\n }\r\n\r\n /**\r\n * Invia un messaggio all'Hub del Backend\r\n * \r\n * @param {EndpointDef<TOut, any>} item Endpoint da contattare\r\n * @param {TOut} dto Dto da inviare all'Endpoint\r\n */\r\n public send<TOut>(item: EndpointDef<TOut, any>, dto: TOut) {\r\n if (!this.enabled) {\r\n this.log(this.loc(\"Send request ignored because SignalR is not active by configuration\"));\r\n return EMPTY;\r\n }\r\n\r\n if (this.connection.state == HubConnectionState.Connecting || this.connection.state == HubConnectionState.Reconnecting || this.connection.state == HubConnectionState.Disconnecting) {\r\n this.log(this.loc(\"Send request sent before a connection was in stable State, waiting 1 second and retrying\"));\r\n setTimeout(() => { this.send(item, dto); }, 1000);\r\n }\r\n else if (this.connection.state == HubConnectionState.Disconnected) {\r\n this.ensureConnected().then(t => {\r\n if (t == \"KO\") this.log(this.loc(\"ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST\"));\r\n else this.send(item, dto);\r\n })\r\n }\r\n else {\r\n this.connection.send(item.endpoint, dto).then(_ => {\r\n if (this.debug)\r\n console.info(this.loc(\"Request sent to server\") + \" - \" + item.endpoint + \": \" + this.substringLog(JSON.stringify(dto)));\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Invia un messaggio all'Hub del Backend, aspettandosi una risposta\r\n * \r\n * @param {EndpointDef<TOut, TIn>} item Endpoint da contattare\r\n * @param {TOut} dto Dto da inviare all'Endpoint\r\n * \r\n * @returns {Observable<TIn>} Observable su cui ci si può registrare per ricevere il risultato della chiamata\r\n */\r\n public invoke<TOut, TIn>(item: EndpointDef<TOut, TIn>, dto: TOut): Observable<TIn> {\r\n if (!this.enabled) {\r\n this.log(this.loc(\"Invoke request ignored because SignalR is not active by configuration\"));\r\n return EMPTY;\r\n }\r\n\r\n if (this.connection.state == HubConnectionState.Connecting || this.connection.state == HubConnectionState.Reconnecting || this.connection.state == HubConnectionState.Disconnecting) {\r\n this.log(this.loc(\"Invoke request sent before a connection was in stable State, waiting 1 second and retrying\"));\r\n return of().pipe(delay(1000), concatMap(() => this.invoke(item, dto)));\r\n }\r\n else if (this.connection.state == HubConnectionState.Disconnected) {\r\n return from(this.ensureConnected()).pipe(concatMap((res) => {\r\n if (res == \"KO\") {\r\n this.log(this.loc(\"ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST\"));\r\n return EMPTY;\r\n }\r\n else return this.invoke(item, dto);\r\n }))\r\n }\r\n else {\r\n return from(this.connection.invoke<TIn>(item.endpoint, dto)).pipe(\r\n tap(() => {\r\n if (this.debug) console.log(this.loc(\"Request invoked to server\") + \" - \" + item.endpoint + \": \" + this.substringLog(JSON.stringify(dto)));\r\n })\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Hook per osservare i dati spediti ad un Endpoint dal Backend\r\n * \r\n * @param {EndpointDef<TIn, any>} item Endpoint su cui ascoltare\r\n * \r\n * @returns {Observable<TIn>} Observable su cui ci si può registrare per ricevere l'oggetto generato ad ogni chiamata dal Backend al Frontend\r\n */\r\n public observe<TIn>(item: EndpointDef<TIn, any>): Observable<TIn> {\r\n if (!this.enabled)\r\n {\r\n this.log(this.loc(\"Observe request ignored because SignalR is not active by configuration\"));\r\n return EMPTY;\r\n }\r\n\r\n this.log(this.loc(\"Returning observable for required endpoint\") + \": \" + item.endpoint);\r\n return <Observable<TIn>>this.notifications$[item.endpoint];\r\n }\r\n\r\n /**\r\n * Disconnessione del sistema di SignalR\r\n * \r\n * @returns {Observable<void>} Observable a cui registrarsi che viene chiamato quando la disconnessione è terminata\r\n */\r\n public disconnect(): Observable<void> {\r\n //NO-OP se non attivo\r\n if (!this.enabled)\r\n {\r\n this.log(this.loc(\"Disconnection request ignored because SignalR is not active by configuration\"));\r\n return EMPTY;\r\n }\r\n\r\n return from(this.connection.stop()).pipe(\r\n catchError((err, caught) => { console.log(err); return of(null); }),\r\n tap(() => {\r\n this.log(this.loc(\"Disconnection request honored\"));\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Taglia un log troppo lungo\r\n * \r\n * @param {string} text Log da tagliare\r\n * @param {number} maxchars Numero massimo di caratteri da tenere\r\n * \r\n * @returns {string} Log tagliato\r\n */\r\n private substringLog(text: string, maxchars: number = 120) : string {\r\n return text.length > maxchars ? text.substr(0, maxchars) + \"[...]\" : text;\r\n }\r\n\r\n /**\r\n * Stampa un log a console\r\n * \r\n * @param {string} message Messaggio da stampare\r\n */\r\n private log(message: string) {\r\n if (this.debug)\r\n console.log(\"@signalr-notifications: \" + message)\r\n }\r\n\r\n /**\r\n * Helper di localizzazione\r\n * \r\n * @param {string} message Messaggio da tradurre\r\n * \r\n * @returns {string} Messaggio tradotto\r\n */\r\n private loc(message: string) : string{\r\n if(!Loc[message])\r\n {\r\n console.warn(\"Untranslated message: \" + message)\r\n return \"\";\r\n }\r\n return Loc[message][this.locale];\r\n }\r\n}","\r\nimport { NgModule, ModuleWithProviders } from '@angular/core';\r\nimport { SignalrNotificationsModuleConfig } from './config/SignalrNotificationsModuleConfig';\r\nimport { BaseMessageService } from './models/BaseMessageService';\r\nimport { NotificationsService } from './signalr-notifications.service';\r\nimport { HUB_URL, SIGNALR_ENABLED, DEBUG_MODE, LOCALE, MESSAGE_PACK, AUTO_RECONNECT } from './tokens';\r\n\r\n@NgModule()\r\nexport class SignalrNotificationsModule {\r\n static forRoot(config?: SignalrNotificationsModuleConfig): ModuleWithProviders<SignalrNotificationsModule> {\r\n return {\r\n ngModule: SignalrNotificationsModule,\r\n providers: [\r\n NotificationsService,\r\n { provide: BaseMessageService, useClass: config?.messageService || BaseMessageService },\r\n { provide: HUB_URL, useValue: config?.hubUrl },\r\n { provide: LOCALE, useValue: config?.locale || 'it-IT' },\r\n { provide: SIGNALR_ENABLED, useValue: config?.enabled != null ? config?.enabled : true },\r\n { provide: DEBUG_MODE, useValue: config?.debugMode != null ? config?.debugMode : false },\r\n { provide: MESSAGE_PACK, useValue: config?.autoReconnect != null ? config?.autoReconnect : false },\r\n { provide: AUTO_RECONNECT, useValue: config?.useMessagePack != null ? config?.useMessagePack : false },\r\n ]\r\n };\r\n }\r\n}","/**\r\n * Definisce un Endpoint che spedisce un'informazione di tipo TIn e restituisce un'informazione di tipo TOut\r\n */\r\nexport class EndpointDef<TIn, TOut> {\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @param {string} endpoint Nome del metodo da chiamare nell'Hub del Backend contattato\r\n * @param {TIn} inTypeDefault Default per il tipo TIn. Utilizzato per fare Typecheck sulle chiamate da Backend a Frontend\r\n * @param {TOut} outTypeDefault Default per il tipo TOut. Utilizzato per fare Typecheck sulle chiamate da Frontend a Backend\r\n */\r\n constructor(public endpoint: string, public inTypeDefault: TIn, public outTypeDefault: TOut) { }\r\n\r\n\r\n /** Helper per la creazione rapida di un Endpoint di solo INPUT */\r\n public static In<TIn>(name: string, inTypeDefault: TIn): EndpointDef<TIn, void> {\r\n return new EndpointDef<TIn, void>(name, inTypeDefault, undefined);\r\n }\r\n\r\n /** Helper per la creazione rapida di un Endpoint di solo OUTPUT */\r\n public static Out<TOut>(name: string, outTypeDefault: TOut): EndpointDef<void, TOut> {\r\n return new EndpointDef<void, TOut>(name, undefined, outTypeDefault);\r\n }\r\n\r\n /** Helper per la creazione rapida di un Endpoint di INPUT e OUTPUT (BIDIREZIONALE) */\r\n public static Bi<TIn, TOut>(name: string, inTypeDefault: TIn, outTypeDefault: TOut): EndpointDef<TIn, TOut> {\r\n return new EndpointDef<TIn, TOut>(name, inTypeDefault, outTypeDefault);\r\n }\r\n}","// Angular\r\nimport { Type } from '@angular/core';\r\n\r\n// Modelli\r\nimport { BaseMessageService } from '../models/BaseMessageService';\r\n\r\n/**\r\n * Classe di configurazione per la libreria\r\n */\r\nexport class SignalrNotificationsModuleConfig {\r\n\r\n /**\r\n * Url nei confronti del quale aprire la connessione SignalR\r\n */\r\n hubUrl : string;\r\n\r\n /**\r\n * Servizio che definisce i messaggi di IN e OUT coi loro default\r\n */\r\n messageService? : Type<BaseMessageService>;\r\n\r\n /**\r\n * Indica se abilitare o meno la connessione SignalR nei confronti dell'URL **hubUrl**\r\n */\r\n enabled? : boolean;\r\n\r\n /**\r\n * Indica se utilizzare message pack come protocollo di trasmissione\r\n */\r\n useMessagePack? : boolean;\r\n\r\n /**\r\n * Indica se tentare di riconnettersi automaticamente quando la connessione cade\r\n */\r\n autoReconnect? : boolean;\r\n\r\n /**\r\n * Indica se scrivere o meno i messaggi di debug\r\n */\r\n debugMode? : boolean;\r\n\r\n /**\r\n * Lingua dei feedback a console, sono supportati 'it-IT' ed 'en-US'\r\n */\r\n locale? : string\r\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"__symbolic":"module","version":4,"metadata":{"NotificationsService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":20,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":38,"character":57},"arguments":[{"__symbolic":"reference","name":"ɵa"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":38,"character":99},"arguments":[{"__symbolic":"reference","name":"ɵe"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":38,"character":147},"arguments":[{"__symbolic":"reference","name":"ɵb"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":38,"character":198},"arguments":[{"__symbolic":"reference","name":"ɵc"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":38,"character":242},"arguments":[{"__symbolic":"reference","name":"ɵf"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":38,"character":290},"arguments":[{"__symbolic":"reference","name":"ɵd"}]}]],"parameters":[{"__symbolic":"reference","name":"BaseMessageService"},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"boolean"},{"__symbolic":"reference","name":"boolean"},{"__symbolic":"reference","name":"boolean"},{"__symbolic":"reference","name":"boolean"},{"__symbolic":"reference","name":"string"}]}],"connect":[{"__symbolic":"method"}],"ensureConnected":[{"__symbolic":"method"}],"send":[{"__symbolic":"method"}],"invoke":[{"__symbolic":"method"}],"observe":[{"__symbolic":"method"}],"disconnect":[{"__symbolic":"method"}],"substringLog":[{"__symbolic":"method"}],"log":[{"__symbolic":"method"}],"loc":[{"__symbolic":"method"}]}},"SignalrNotificationsModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":7,"character":1}}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":["config"],"value":{"ngModule":{"__symbolic":"reference","name":"SignalrNotificationsModule"},"providers":[{"__symbolic":"reference","name":"NotificationsService"},{"provide":{"__symbolic":"reference","name":"BaseMessageService"},"useClass":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"config"},"member":"messageService"},"right":{"__symbolic":"reference","name":"BaseMessageService"}}},{"provide":{"__symbolic":"reference","name":"ɵa"},"useValue":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"config"},"member":"hubUrl"}},{"provide":{"__symbolic":"reference","name":"ɵd"},"useValue":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"config"},"member":"locale"},"right":"it-IT"}},{"provide":{"__symbolic":"reference","name":"ɵb"},"useValue":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"!=","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"config"},"member":"enabled"},"right":null},"thenExpression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"config"},"member":"enabled"},"elseExpression":true}},{"provide":{"__symbolic":"reference","name":"ɵc"},"useValue":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"!=","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"config"},"member":"debugMode"},"right":null},"thenExpression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"config"},"member":"debugMode"},"elseExpression":false}},{"provide":{"__symbolic":"reference","name":"ɵe"},"useValue":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"!=","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"config"},"member":"autoReconnect"},"right":null},"thenExpression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"config"},"member":"autoReconnect"},"elseExpression":false}},{"provide":{"__symbolic":"reference","name":"ɵf"},"useValue":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"!=","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"config"},"member":"useMessagePack"},"right":null},"thenExpression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"config"},"member":"useMessagePack"},"elseExpression":false}}]}}}},"BaseMessageService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":9,"character":1}}],"members":{}},"EndpointDef":{"__symbolic":"class","arity":2,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"},{"__symbolic":"error","message":"Could not resolve type","line":12,"character":63,"context":{"typeName":"TIn"},"module":"./lib/models/EndpointDef"},{"__symbolic":"error","message":"Could not resolve type","line":12,"character":91,"context":{"typeName":"TOut"},"module":"./lib/models/EndpointDef"}]}]}},"SignalrNotificationsModuleConfig":{"__symbolic":"class","members":{}},"ɵa":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":5,"character":51},"arguments":["HUB_URL"]},"ɵb":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":10,"character":59},"arguments":["SIGNALR_ENABLED"]},"ɵc":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":15,"character":54},"arguments":["DEBUG_MODE"]},"ɵd":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":20,"character":50},"arguments":["LOCALE"]},"ɵe":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":25,"character":57},"arguments":["MESSAGE_PACK"]},"ɵf":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":30,"character":59},"arguments":["AUTO_RECONNECT"]}},"origins":{"NotificationsService":"./lib/signalr-notifications.service","SignalrNotificationsModule":"./lib/signalr-notifications.module","BaseMessageService":"./lib/models/BaseMessageService","EndpointDef":"./lib/models/EndpointDef","SignalrNotificationsModuleConfig":"./lib/config/SignalrNotificationsModuleConfig","ɵa":"./lib/tokens","ɵb":"./lib/tokens","ɵc":"./lib/tokens","ɵd":"./lib/tokens","ɵe":"./lib/tokens","ɵf":"./lib/tokens"},"importAs":"@esfaenza/signalr-notifications"}
|
|
1
|
+
{"__symbolic":"module","version":4,"metadata":{"NotificationsService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":20,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":38,"character":57},"arguments":[{"__symbolic":"reference","name":"ɵa"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":38,"character":99},"arguments":[{"__symbolic":"reference","name":"ɵe"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":38,"character":147},"arguments":[{"__symbolic":"reference","name":"ɵb"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":38,"character":198},"arguments":[{"__symbolic":"reference","name":"ɵc"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":38,"character":242},"arguments":[{"__symbolic":"reference","name":"ɵf"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":38,"character":290},"arguments":[{"__symbolic":"reference","name":"ɵd"}]}]],"parameters":[{"__symbolic":"reference","name":"BaseMessageService"},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"boolean"},{"__symbolic":"reference","name":"boolean"},{"__symbolic":"reference","name":"boolean"},{"__symbolic":"reference","name":"boolean"},{"__symbolic":"reference","name":"string"}]}],"connect":[{"__symbolic":"method"}],"ensureConnected":[{"__symbolic":"method"}],"send":[{"__symbolic":"method"}],"invoke":[{"__symbolic":"method"}],"observe":[{"__symbolic":"method"}],"disconnect":[{"__symbolic":"method"}],"substringLog":[{"__symbolic":"method"}],"log":[{"__symbolic":"method"}],"loc":[{"__symbolic":"method"}]}},"SignalrNotificationsModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":7,"character":1}}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":["config"],"value":{"ngModule":{"__symbolic":"reference","name":"SignalrNotificationsModule"},"providers":[{"__symbolic":"reference","name":"NotificationsService"},{"provide":{"__symbolic":"reference","name":"BaseMessageService"},"useClass":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"config"},"member":"messageService"},"right":{"__symbolic":"reference","name":"BaseMessageService"}}},{"provide":{"__symbolic":"reference","name":"ɵa"},"useValue":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"config"},"member":"hubUrl"}},{"provide":{"__symbolic":"reference","name":"ɵd"},"useValue":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"config"},"member":"locale"},"right":"it-IT"}},{"provide":{"__symbolic":"reference","name":"ɵb"},"useValue":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"!=","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"config"},"member":"enabled"},"right":null},"thenExpression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"config"},"member":"enabled"},"elseExpression":true}},{"provide":{"__symbolic":"reference","name":"ɵc"},"useValue":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"!=","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"config"},"member":"debugMode"},"right":null},"thenExpression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"config"},"member":"debugMode"},"elseExpression":false}},{"provide":{"__symbolic":"reference","name":"ɵe"},"useValue":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"!=","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"config"},"member":"autoReconnect"},"right":null},"thenExpression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"config"},"member":"autoReconnect"},"elseExpression":false}},{"provide":{"__symbolic":"reference","name":"ɵf"},"useValue":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"!=","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"config"},"member":"useMessagePack"},"right":null},"thenExpression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"config"},"member":"useMessagePack"},"elseExpression":false}}]}}}},"BaseMessageService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":9,"character":1}}],"members":{"add":[{"__symbolic":"method"}]}},"EndpointDef":{"__symbolic":"class","arity":2,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"},{"__symbolic":"error","message":"Could not resolve type","line":12,"character":63,"context":{"typeName":"TIn"},"module":"./lib/models/EndpointDef"},{"__symbolic":"error","message":"Could not resolve type","line":12,"character":91,"context":{"typeName":"TOut"},"module":"./lib/models/EndpointDef"}]}]},"statics":{"In":{"__symbolic":"function","parameters":["name","inTypeDefault"],"value":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"EndpointDef"},"arguments":[{"__symbolic":"reference","name":"name"},{"__symbolic":"reference","name":"inTypeDefault"},{"__symbolic":"reference","name":"undefined"}]}},"Out":{"__symbolic":"function","parameters":["name","outTypeDefault"],"value":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"EndpointDef"},"arguments":[{"__symbolic":"reference","name":"name"},{"__symbolic":"reference","name":"undefined"},{"__symbolic":"reference","name":"outTypeDefault"}]}},"Bi":{"__symbolic":"function","parameters":["name","inTypeDefault","outTypeDefault"],"value":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"EndpointDef"},"arguments":[{"__symbolic":"reference","name":"name"},{"__symbolic":"reference","name":"inTypeDefault"},{"__symbolic":"reference","name":"outTypeDefault"}]}}}},"SignalrNotificationsModuleConfig":{"__symbolic":"class","members":{}},"ɵa":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":5,"character":51},"arguments":["HUB_URL"]},"ɵb":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":10,"character":59},"arguments":["SIGNALR_ENABLED"]},"ɵc":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":15,"character":54},"arguments":["DEBUG_MODE"]},"ɵd":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":20,"character":50},"arguments":["LOCALE"]},"ɵe":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":25,"character":57},"arguments":["MESSAGE_PACK"]},"ɵf":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":30,"character":59},"arguments":["AUTO_RECONNECT"]}},"origins":{"NotificationsService":"./lib/signalr-notifications.service","SignalrNotificationsModule":"./lib/signalr-notifications.module","BaseMessageService":"./lib/models/BaseMessageService","EndpointDef":"./lib/models/EndpointDef","SignalrNotificationsModuleConfig":"./lib/config/SignalrNotificationsModuleConfig","ɵa":"./lib/tokens","ɵb":"./lib/tokens","ɵc":"./lib/tokens","ɵd":"./lib/tokens","ɵe":"./lib/tokens","ɵf":"./lib/tokens"},"importAs":"@esfaenza/signalr-notifications"}
|
|
@@ -4,12 +4,16 @@ import { Injectable } from '@angular/core';
|
|
|
4
4
|
* Classe base da estendere con la definizione degli Endpoint supportati dall'applicazione
|
|
5
5
|
*/
|
|
6
6
|
export class BaseMessageService {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
constructor() {
|
|
8
|
+
this.definitions = [];
|
|
9
|
+
}
|
|
10
|
+
/** Entrypoint che restituisce tutti gli Endpoint dell'applicazione. Da overridare qualora non venga utilizzato il metodo **add** */
|
|
11
|
+
get AllDefinitions() { return this.definitions; }
|
|
12
|
+
add(endpoint) {
|
|
13
|
+
this.definitions.push(endpoint);
|
|
14
|
+
}
|
|
11
15
|
}
|
|
12
16
|
BaseMessageService.decorators = [
|
|
13
17
|
{ type: Injectable }
|
|
14
18
|
];
|
|
15
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQmFzZU1lc3NhZ2VTZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvc2lnbmFsci1ub3RpZmljYXRpb25zL3NyYy9saWIvbW9kZWxzL0Jhc2VNZXNzYWdlU2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxVQUFVO0FBQ1YsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUszQzs7R0FFRztBQUVILE1BQU0sT0FBTyxrQkFBa0I7SUFEL0I7UUFHWSxnQkFBVyxHQUE0QixFQUFFLENBQUM7SUFRdEQsQ0FBQztJQU5HLG9JQUFvSTtJQUNwSSxJQUFXLGNBQWMsS0FBOEIsT0FBTyxJQUFJ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NoKGVuZHBvaW50KTtcclxuICAgIH1cclxufSJdfQ==
|
|
@@ -14,5 +14,17 @@ export class EndpointDef {
|
|
|
14
14
|
this.inTypeDefault = inTypeDefault;
|
|
15
15
|
this.outTypeDefault = outTypeDefault;
|
|
16
16
|
}
|
|
17
|
+
/** Helper per la creazione rapida di un Endpoint di solo INPUT */
|
|
18
|
+
static In(name, inTypeDefault) {
|
|
19
|
+
return new EndpointDef(name, inTypeDefault, undefined);
|
|
20
|
+
}
|
|
21
|
+
/** Helper per la creazione rapida di un Endpoint di solo OUTPUT */
|
|
22
|
+
static Out(name, outTypeDefault) {
|
|
23
|
+
return new EndpointDef(name, undefined, outTypeDefault);
|
|
24
|
+
}
|
|
25
|
+
/** Helper per la creazione rapida di un Endpoint di INPUT e OUTPUT (BIDIREZIONALE) */
|
|
26
|
+
static Bi(name, inTypeDefault, outTypeDefault) {
|
|
27
|
+
return new EndpointDef(name, inTypeDefault, outTypeDefault);
|
|
28
|
+
}
|
|
17
29
|
}
|
|
18
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
30
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRW5kcG9pbnREZWYuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9zaWduYWxyLW5vdGlmaWNhdGlvbnMvc3JjL2xpYi9tb2RlbHMvRW5kcG9pbnREZWYudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFDSCxNQUFNLE9BQU8sV0FBVztJQUVwQjs7Ozs7O09BTUc7SUFDSCxZQUFtQixRQUFnQixFQUFTLGFBQWtCLEVBQVMsY0FBb0I7UUFBeEUsYUFBUSxHQUFSLFFBQVEsQ0FBUTtRQUFTLGtCQUFhLEdBQWIsYUFBYSxDQUFLO1FBQVMsbUJBQWMsR0FBZCxjQUFjLENBQU07SUFBSSxDQUFDO0lBR2hHLG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IZWxwZXIgcGVyIGxhIGNyZWF6aW9uZSByYXBpZGEgZGkgdW4gRW5kcG9pbnQgZGkgSU5QVVQgZSBPVVRQVVQgKEJJRElSRVpJT05BTEUpICovXHJcbiAgICBwdWJsaWMgc3RhdGljIEJpPFRJbiwgVE91dD4obmFtZTogc3RyaW5nLCBpblR5cGVEZWZhdWx0OiBUSW4sIG91dFR5cGVEZWZhdWx0OiBUT3V0KTogRW5kcG9pbnREZWY8VEluLCBUT3V0PiB7XHJcbiAgICAgICAgcmV0dXJuIG5ldyBFbmRwb2ludERlZjxUSW4sIFRPdXQ+KG5hbWUsIGluVHlwZURlZmF1bHQsIG91dFR5cGVEZWZhdWx0KTtcclxuICAgIH1cclxufSJdfQ==
|
|
@@ -9,10 +9,14 @@ import { delay, concatMap, tap, catchError } from 'rxjs/operators';
|
|
|
9
9
|
* Classe base da estendere con la definizione degli Endpoint supportati dall'applicazione
|
|
10
10
|
*/
|
|
11
11
|
class BaseMessageService {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
constructor() {
|
|
13
|
+
this.definitions = [];
|
|
14
|
+
}
|
|
15
|
+
/** Entrypoint che restituisce tutti gli Endpoint dell'applicazione. Da overridare qualora non venga utilizzato il metodo **add** */
|
|
16
|
+
get AllDefinitions() { return this.definitions; }
|
|
17
|
+
add(endpoint) {
|
|
18
|
+
this.definitions.push(endpoint);
|
|
19
|
+
}
|
|
16
20
|
}
|
|
17
21
|
BaseMessageService.decorators = [
|
|
18
22
|
{ type: Injectable }
|
|
@@ -326,6 +330,18 @@ class EndpointDef {
|
|
|
326
330
|
this.inTypeDefault = inTypeDefault;
|
|
327
331
|
this.outTypeDefault = outTypeDefault;
|
|
328
332
|
}
|
|
333
|
+
/** Helper per la creazione rapida di un Endpoint di solo INPUT */
|
|
334
|
+
static In(name, inTypeDefault) {
|
|
335
|
+
return new EndpointDef(name, inTypeDefault, undefined);
|
|
336
|
+
}
|
|
337
|
+
/** Helper per la creazione rapida di un Endpoint di solo OUTPUT */
|
|
338
|
+
static Out(name, outTypeDefault) {
|
|
339
|
+
return new EndpointDef(name, undefined, outTypeDefault);
|
|
340
|
+
}
|
|
341
|
+
/** Helper per la creazione rapida di un Endpoint di INPUT e OUTPUT (BIDIREZIONALE) */
|
|
342
|
+
static Bi(name, inTypeDefault, outTypeDefault) {
|
|
343
|
+
return new EndpointDef(name, inTypeDefault, outTypeDefault);
|
|
344
|
+
}
|
|
329
345
|
}
|
|
330
346
|
|
|
331
347
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esfaenza-signalr-notifications.js","sources":["../../../projects/signalr-notifications/src/lib/models/BaseMessageService.ts","../../../projects/signalr-notifications/src/lib/tokens.ts","../../../projects/signalr-notifications/src/lib/signalr-notifications.service.loc.ts","../../../projects/signalr-notifications/src/lib/signalr-notifications.service.ts","../../../projects/signalr-notifications/src/lib/signalr-notifications.module.ts","../../../projects/signalr-notifications/src/lib/models/EndpointDef.ts","../../../projects/signalr-notifications/src/lib/config/SignalrNotificationsModuleConfig.ts","../../../projects/signalr-notifications/src/public-api.ts","../../../projects/signalr-notifications/src/esfaenza-signalr-notifications.ts"],"sourcesContent":["// Angular\r\nimport { Injectable } from '@angular/core';\r\n\r\n// Modelli\r\nimport { EndpointDef } from './EndpointDef';\r\n\r\n/**\r\n * Classe base da estendere con la definizione degli Endpoint supportati dall'applicazione\r\n */\r\n@Injectable()\r\nexport class BaseMessageService {\r\n\r\n /**\r\n * Entrypoint che restituisce tutti gli Endpoint dell'applicazione\r\n */\r\n public get AllDefinitions(): EndpointDef<any, any>[] { return []; }\r\n}","import { InjectionToken } from '@angular/core';\r\n\r\n/**\r\n * Hub a cui collegarsi\r\n */\r\nexport const HUB_URL: InjectionToken<string> = new InjectionToken<string>('HUB_URL');\r\n\r\n/**\r\n * Indica se la libreria dev'essere attiva o no\r\n */\r\nexport const SIGNALR_ENABLED: InjectionToken<string> = new InjectionToken<boolean>('SIGNALR_ENABLED');\r\n\r\n/**\r\n * Indica se stampare messaggi di debug in console\r\n */\r\nexport const DEBUG_MODE: InjectionToken<string> = new InjectionToken<boolean>('DEBUG_MODE');\r\n\r\n/**\r\n * Indica il locale utilizzato dalla libreria per i messaggi. Sono supportati \"it-IT\" ed \"en-US\"\r\n */\r\nexport const LOCALE: InjectionToken<string> = new InjectionToken<string>('LOCALE');\r\n\r\n/**\r\n * Indica se utilizzare il protocollo di trasferimento \"MessagePack\"\r\n */\r\nexport const MESSAGE_PACK: InjectionToken<boolean> = new InjectionToken<boolean>('MESSAGE_PACK');\r\n\r\n/**\r\n * Indica se tentare in automatico la riconnessione\r\n */\r\nexport const AUTO_RECONNECT: InjectionToken<boolean> = new InjectionToken<boolean>('AUTO_RECONNECT');","/**\r\n * Oggetto statico di localizzazione per i messaggi scritti dal servizio\r\n */\r\nexport const Loc ={\r\n \"Building SignalR Hub with Automatic Reconnection\": { \"en-US\": \"Building SignalR Hub with Automatic Reconnection\", \"it-IT\": \"Compilo l'Hub di SignalR con riconnessione automatica\", },\r\n \"Cannot reconnect SignalR, frontend HUB offline\": { \"en-US\": \"Cannot reconnect SignalR, frontend HUB offline\", \"it-IT\": \"Impossibile riconnettere SignalR, l'Hub del Frontend e' Offline\", },\r\n \"Send request sent before a connection was in stable State, waiting 1 second and retrying\": { \"en-US\": \"Send request sent before a connection was in stable State, waiting 1 second and retrying\", \"it-IT\": \"Richiesta 'Send' ricevuta prima che la connessione fosse in uno stato stabile, attendo 1 secondo e riprovo\", },\r\n \"Invoke request sent before a connection was in stable State, waiting 1 second and retrying\": { \"en-US\": \"Invoke request sent before a connection was in stable State, waiting 1 second and retrying\", \"it-IT\": \"Richiesta 'Invoke' ricevuta prima che la connessione fosse in uno stato stabile, attendo 1 secondo e riprovo\", },\r\n \"Connection lost or missing, reconnecting...\" : { \"en-US\": \"Connection lost or missing, reconnecting...\", \"it-IT\": \"Connessione persa o mancante, mi riconnetto...\", },\r\n \"SignalR won't be enabled as per configuration\": { \"en-US\": \"SignalR won't be enabled as per configuration\", \"it-IT\": \"SignalR non verrà attivato come da configurazione\", },\r\n \"Building SignalR Hub with MessagePack protocol\": { \"en-US\": \"Building SignalR Hub with MessagePack protocol\", \"it-IT\": \"Compilo l'Hub di SignalR con protocollo MessagePack\", },\r\n \"Request received from the server for endpoint\": { \"en-US\": \"Request received from the server for endpoint\", \"it-IT\": \"Richiesta ricevuta dal server per endpoint\", },\r\n \"Refusing to register endpoint\": { \"en-US\": \"Refusing to register endpoint\", \"it-IT\": \"Rifiuto di registrare l'endpoint\", },\r\n \"because it is not declared as IN - ONLY\": { \"en-US\": \"because it is not declared as IN - ONLY\", \"it-IT\": \"in quanto non è registrato solo come IN\", },\r\n \"Send request ignored because SignalR is not active by configuration\": { \"en-US\": \"Send request ignored because SignalR is not active by configuration\", \"it-IT\": \"Richiesta send ignorata in quanto SignalR non è attivo da configurazione\", },\r\n \"Request sent to server\": { \"en-US\": \"Request sent to server\", \"it-IT\": \"Richiesta inviata al server\", },\r\n \"Invoke request ignored because SignalR is not active by configuration\": { \"en-US\": \"Invoke request ignored because SignalR is not active by configuration\", \"it-IT\": \"Richiesta invoke ignorata in quanto SignalR non è attivo da configurazione\", },\r\n \"Request invoked to server\": { \"en-US\": \"Request invoked to server\", \"it-IT\": \"Richiesta invoke inviata al server\", },\r\n \"Observe request ignored because SignalR is not active by configuration\": { \"en-US\": \"Observe request ignored because SignalR is not active by configuration\", \"it-IT\": \"Osservazione ignorata in quanto SignalR non è attivo da configurazione\", },\r\n \"Returning observable for required endpoint\": { \"en-US\": \"Returning observable for required endpoint\", \"it-IT\": \"Restituisco l'observable per l'endpoint richiesto\", },\r\n \"Disconnection request ignored because SignalR is not active by configuration\": { \"en-US\": \"Disconnection request ignored because SignalR is not active by configuration\", \"it-IT\": \"Richiesta di disconnesione ignorata in quanto SignalR non è attivo da configurazione\", },\r\n \"Disconnection request honored\": { \"en-US\": \"Returning observable for required endpoint\", \"it-IT\": \"Restituito observable per l'endpoint richiesto\", },\r\n \"ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST\": { \"en-US\": \"ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST\", \"it-IT\": \"ERRORE nella riconnessione precedente a un nuovo tentativo di 'Send'. Il messaggio in questione SARA' PERSO\"}\r\n}","// Angular\r\nimport { Injectable, Inject } from \"@angular/core\";\r\n\r\n// Direttive, Componenti, Librerie\r\nimport * as signalR from '@microsoft/signalr';\r\nimport { HubConnectionState } from \"@microsoft/signalr\";\r\nimport { Observable, Subject, EMPTY, from, of } from \"rxjs\";\r\nimport { catchError, concatMap, delay, tap } from \"rxjs/operators\";\r\n\r\n// Modelli\r\nimport { BaseMessageService } from './models/BaseMessageService';\r\nimport { EndpointDef } from './models/EndpointDef';\r\nimport { DEBUG_MODE, HUB_URL, LOCALE, MESSAGE_PACK, SIGNALR_ENABLED, AUTO_RECONNECT } from \"./tokens\";\r\n\r\n// Localizzazione\r\nimport { Loc } from './signalr-notifications.service.loc';\r\n\r\n/**\r\n * Servizio che gestisce la comunicazione con un Hub SignalR in base alle configurazioni fornite dall'applicazione\r\n */\r\n@Injectable()\r\nexport class NotificationsService {\r\n\r\n /**\r\n * Cache degli Observable generati in base agli Endpoint disponibili\r\n */\r\n private notifications$: { [index: string]: Subject<any> } = {};\r\n\r\n /**\r\n * Connessione Signalr\r\n */\r\n private connection: signalR.HubConnection;\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @ignore\r\n */\r\n constructor(private MessageDef: BaseMessageService, @Inject(HUB_URL) private hub_url: string, @Inject(MESSAGE_PACK) private msgpack: boolean, @Inject(SIGNALR_ENABLED) private enabled: boolean, @Inject(DEBUG_MODE) private debug: boolean, @Inject(AUTO_RECONNECT) autoreconnect: boolean, @Inject(LOCALE) private locale : string) {\r\n if (!this.enabled) {\r\n this.log(this.loc(\"SignalR won't be enabled as per configuration\"));\r\n return;\r\n }\r\n\r\n this.MessageDef.AllDefinitions.forEach(def => { this.notifications$[def.endpoint] = new Subject<typeof def.inTypeDefault>(); });\r\n\r\n let pars: signalR.IHttpConnectionOptions = { skipNegotiation: true, transport: signalR.HttpTransportType.WebSockets, logger: debug ? signalR.LogLevel.Debug : signalR.LogLevel.None };\r\n var builder = new signalR.HubConnectionBuilder().withUrl(this.hub_url, pars);\r\n\r\n if (autoreconnect) {\r\n this.log(this.loc(\"Building SignalR Hub with Automatic Reconnection\"));\r\n // 100 tentativi di riconnessione, 1 ogni 5 secondi\r\n builder = builder.withAutomaticReconnect(new Array(100).fill(5 * 1000));\r\n }\r\n\r\n if (this.msgpack) {\r\n this.log(this.loc(\"Building SignalR Hub with MessagePack protocol\"));\r\n var mphpModule = require(\"@microsoft/signalr-protocol-msgpack\");\r\n builder = builder.withHubProtocol(new mphpModule.MessagePackHubProtocol())\r\n }\r\n\r\n this.connection = builder.build();\r\n this.connect();\r\n }\r\n\r\n /**\r\n * Effettua la connessione all'Hub Signalr e registra tutti gli Endpoint per cui il Backend comunica con il Frontend sulla **connection**\r\n */\r\n private connect() {\r\n this.connection.start().catch(err => console.log(err));\r\n this.MessageDef.AllDefinitions.forEach(d => {\r\n //Registro solo le cose di IN, quelle di out sono chiamate che faccio io al BE quindi non servono\r\n if (d.inTypeDefault !== null && d.outTypeDefault === null)\r\n this.connection.on(d.endpoint, (message) => {\r\n this.log(this.loc(\"Request received from the server for endpoint\") + \" '\" + d.endpoint + \"': \" + this.substringLog(JSON.stringify(message)));\r\n this.notifications$[d.endpoint].next(message);\r\n });\r\n else\r\n this.log(this.loc(\"Refusing to register endpoint\") + \" \" + d.endpoint + \" \" + this.loc(\"because it is not declared as IN - ONLY\"));\r\n });\r\n }\r\n\r\n /**\r\n * Effettua verifiche sulla connessione e, in caso non fosse collegata, tenta di riconnetterla\r\n * \r\n * @returns {Promise<'OK' | 'KO' | 'NO-OP'>} 'OK' Se la connessione è già connessa o è stata riconnessa con successo, 'KO' Se non è stato possibile riconnettere \r\n * una connessione disconnessa, 'NO-OP' se la connesisone è in uno stato intermedio che non può essere modificato\r\n */\r\n public ensureConnected(): Promise<'OK' | 'KO' | 'NO-OP'> {\r\n if (this.connection.state == HubConnectionState.Disconnected) {\r\n this.log(this.loc(\"Connection lost or missing, reconnecting...\"));\r\n\r\n return this.connection.start()\r\n .then(_ => {\r\n return Promise.resolve(\"OK\");\r\n }, _ => {\r\n this.log(this.loc(\"Cannot reconnect SignalR, frontend HUB offline\"));\r\n return Promise.resolve(\"KO\");\r\n });\r\n }\r\n else if (this.connection.state == HubConnectionState.Connected)\r\n return Promise.resolve(\"OK\");\r\n else\r\n return Promise.resolve(\"NO-OP\");\r\n }\r\n\r\n /**\r\n * Invia un messaggio all'Hub del Backend\r\n * \r\n * @param {EndpointDef<TOut, any>} item Endpoint da contattare\r\n * @param {TOut} dto Dto da inviare all'Endpoint\r\n */\r\n public send<TOut>(item: EndpointDef<TOut, any>, dto: TOut) {\r\n if (!this.enabled) {\r\n this.log(this.loc(\"Send request ignored because SignalR is not active by configuration\"));\r\n return EMPTY;\r\n }\r\n\r\n if (this.connection.state == HubConnectionState.Connecting || this.connection.state == HubConnectionState.Reconnecting || this.connection.state == HubConnectionState.Disconnecting) {\r\n this.log(this.loc(\"Send request sent before a connection was in stable State, waiting 1 second and retrying\"));\r\n setTimeout(() => { this.send(item, dto); }, 1000);\r\n }\r\n else if (this.connection.state == HubConnectionState.Disconnected) {\r\n this.ensureConnected().then(t => {\r\n if (t == \"KO\") this.log(this.loc(\"ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST\"));\r\n else this.send(item, dto);\r\n })\r\n }\r\n else {\r\n this.connection.send(item.endpoint, dto).then(_ => {\r\n if (this.debug)\r\n console.info(this.loc(\"Request sent to server\") + \" - \" + item.endpoint + \": \" + this.substringLog(JSON.stringify(dto)));\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Invia un messaggio all'Hub del Backend, aspettandosi una risposta\r\n * \r\n * @param {EndpointDef<TOut, TIn>} item Endpoint da contattare\r\n * @param {TOut} dto Dto da inviare all'Endpoint\r\n * \r\n * @returns {Observable<TIn>} Observable su cui ci si può registrare per ricevere il risultato della chiamata\r\n */\r\n public invoke<TOut, TIn>(item: EndpointDef<TOut, TIn>, dto: TOut): Observable<TIn> {\r\n if (!this.enabled) {\r\n this.log(this.loc(\"Invoke request ignored because SignalR is not active by configuration\"));\r\n return EMPTY;\r\n }\r\n\r\n if (this.connection.state == HubConnectionState.Connecting || this.connection.state == HubConnectionState.Reconnecting || this.connection.state == HubConnectionState.Disconnecting) {\r\n this.log(this.loc(\"Invoke request sent before a connection was in stable State, waiting 1 second and retrying\"));\r\n return of().pipe(delay(1000), concatMap(() => this.invoke(item, dto)));\r\n }\r\n else if (this.connection.state == HubConnectionState.Disconnected) {\r\n return from(this.ensureConnected()).pipe(concatMap((res) => {\r\n if (res == \"KO\") {\r\n this.log(this.loc(\"ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST\"));\r\n return EMPTY;\r\n }\r\n else return this.invoke(item, dto);\r\n }))\r\n }\r\n else {\r\n return from(this.connection.invoke<TIn>(item.endpoint, dto)).pipe(\r\n tap(() => {\r\n if (this.debug) console.log(this.loc(\"Request invoked to server\") + \" - \" + item.endpoint + \": \" + this.substringLog(JSON.stringify(dto)));\r\n })\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Hook per osservare i dati spediti ad un Endpoint dal Backend\r\n * \r\n * @param {EndpointDef<TIn, any>} item Endpoint su cui ascoltare\r\n * \r\n * @returns {Observable<TIn>} Observable su cui ci si può registrare per ricevere l'oggetto generato ad ogni chiamata dal Backend al Frontend\r\n */\r\n public observe<TIn>(item: EndpointDef<TIn, any>): Observable<TIn> {\r\n if (!this.enabled)\r\n {\r\n this.log(this.loc(\"Observe request ignored because SignalR is not active by configuration\"));\r\n return EMPTY;\r\n }\r\n\r\n this.log(this.loc(\"Returning observable for required endpoint\") + \": \" + item.endpoint);\r\n return <Observable<TIn>>this.notifications$[item.endpoint];\r\n }\r\n\r\n /**\r\n * Disconnessione del sistema di SignalR\r\n * \r\n * @returns {Observable<void>} Observable a cui registrarsi che viene chiamato quando la disconnessione è terminata\r\n */\r\n public disconnect(): Observable<void> {\r\n //NO-OP se non attivo\r\n if (!this.enabled)\r\n {\r\n this.log(this.loc(\"Disconnection request ignored because SignalR is not active by configuration\"));\r\n return EMPTY;\r\n }\r\n\r\n return from(this.connection.stop()).pipe(\r\n catchError((err, caught) => { console.log(err); return of(null); }),\r\n tap(() => {\r\n this.log(this.loc(\"Disconnection request honored\"));\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Taglia un log troppo lungo\r\n * \r\n * @param {string} text Log da tagliare\r\n * @param {number} maxchars Numero massimo di caratteri da tenere\r\n * \r\n * @returns {string} Log tagliato\r\n */\r\n private substringLog(text: string, maxchars: number = 120) : string {\r\n return text.length > maxchars ? text.substr(0, maxchars) + \"[...]\" : text;\r\n }\r\n\r\n /**\r\n * Stampa un log a console\r\n * \r\n * @param {string} message Messaggio da stampare\r\n */\r\n private log(message: string) {\r\n if (this.debug)\r\n console.log(\"@signalr-notifications: \" + message)\r\n }\r\n\r\n /**\r\n * Helper di localizzazione\r\n * \r\n * @param {string} message Messaggio da tradurre\r\n * \r\n * @returns {string} Messaggio tradotto\r\n */\r\n private loc(message: string) : string{\r\n if(!Loc[message])\r\n {\r\n console.warn(\"Untranslated message: \" + message)\r\n return \"\";\r\n }\r\n return Loc[message][this.locale];\r\n }\r\n}","\r\nimport { NgModule, ModuleWithProviders } from '@angular/core';\r\nimport { SignalrNotificationsModuleConfig } from './config/SignalrNotificationsModuleConfig';\r\nimport { BaseMessageService } from './models/BaseMessageService';\r\nimport { NotificationsService } from './signalr-notifications.service';\r\nimport { HUB_URL, SIGNALR_ENABLED, DEBUG_MODE, LOCALE, MESSAGE_PACK, AUTO_RECONNECT } from './tokens';\r\n\r\n@NgModule()\r\nexport class SignalrNotificationsModule {\r\n static forRoot(config?: SignalrNotificationsModuleConfig): ModuleWithProviders<SignalrNotificationsModule> {\r\n return {\r\n ngModule: SignalrNotificationsModule,\r\n providers: [\r\n NotificationsService,\r\n { provide: BaseMessageService, useClass: config?.messageService || BaseMessageService },\r\n { provide: HUB_URL, useValue: config?.hubUrl },\r\n { provide: LOCALE, useValue: config?.locale || 'it-IT' },\r\n { provide: SIGNALR_ENABLED, useValue: config?.enabled != null ? config?.enabled : true },\r\n { provide: DEBUG_MODE, useValue: config?.debugMode != null ? config?.debugMode : false },\r\n { provide: MESSAGE_PACK, useValue: config?.autoReconnect != null ? config?.autoReconnect : false },\r\n { provide: AUTO_RECONNECT, useValue: config?.useMessagePack != null ? config?.useMessagePack : false },\r\n ]\r\n };\r\n }\r\n}","/**\r\n * Definisce un Endpoint che spedisce un'informazione di tipo TIn e restituisce un'informazione di tipo TOut\r\n */\r\nexport class EndpointDef<TIn, TOut> {\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @param {string} endpoint Nome del metodo da chiamare nell'Hub del Backend contattato\r\n * @param {TIn} inTypeDefault Default per il tipo TIn. Utilizzato per fare Typecheck sulle chiamate da Backend a Frontend\r\n * @param {TOut} outTypeDefault Default per il tipo TOut. Utilizzato per fare Typecheck sulle chiamate da Frontend a Backend\r\n */\r\n constructor(public endpoint: string, public inTypeDefault: TIn, public outTypeDefault: TOut) { }\r\n}","// Angular\r\nimport { Type } from '@angular/core';\r\n\r\n// Modelli\r\nimport { BaseMessageService } from '../models/BaseMessageService';\r\n\r\n/**\r\n * Classe di configurazione per la libreria\r\n */\r\nexport class SignalrNotificationsModuleConfig {\r\n\r\n /**\r\n * Url nei confronti del quale aprire la connessione SignalR\r\n */\r\n hubUrl : string;\r\n\r\n /**\r\n * Servizio che definisce i messaggi di IN e OUT coi loro default\r\n */\r\n messageService? : Type<BaseMessageService>;\r\n\r\n /**\r\n * Indica se abilitare o meno la connessione SignalR nei confronti dell'URL **hubUrl**\r\n */\r\n enabled? : boolean;\r\n\r\n /**\r\n * Indica se utilizzare message pack come protocollo di trasmissione\r\n */\r\n useMessagePack? : boolean;\r\n\r\n /**\r\n * Indica se tentare di riconnettersi automaticamente quando la connessione cade\r\n */\r\n autoReconnect? : boolean;\r\n\r\n /**\r\n * Indica se scrivere o meno i messaggi di debug\r\n */\r\n debugMode? : boolean;\r\n\r\n /**\r\n * Lingua dei feedback a console, sono supportati 'it-IT' ed 'en-US'\r\n */\r\n locale? : string\r\n}","/*\n * Public API Surface of signalr-notifications\n */\n\nexport * from './lib/signalr-notifications.service';\nexport * from './lib/signalr-notifications.module';\nexport * from './lib/models/BaseMessageService';\nexport * from './lib/models/EndpointDef';\nexport * from './lib/config/SignalrNotificationsModuleConfig';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n\nexport {AUTO_RECONNECT as ɵf,DEBUG_MODE as ɵc,HUB_URL as ɵa,LOCALE as ɵd,MESSAGE_PACK as ɵe,SIGNALR_ENABLED as ɵb} from './lib/tokens';"],"names":[],"mappings":";;;;;;AAAA;AAMA;;;MAIa,kBAAkB;;;;IAK3B,IAAW,cAAc,KAA8B,OAAO,EAAE,CAAC,EAAE;;;YANtE,UAAU;;;ACPX;;;MAGa,OAAO,GAA2B,IAAI,cAAc,CAAS,SAAS,EAAE;AAErF;;;MAGa,eAAe,GAA2B,IAAI,cAAc,CAAU,iBAAiB,EAAE;AAEtG;;;MAGa,UAAU,GAA2B,IAAI,cAAc,CAAU,YAAY,EAAE;AAE5F;;;MAGa,MAAM,GAA2B,IAAI,cAAc,CAAS,QAAQ,EAAE;AAEnF;;;MAGa,YAAY,GAA4B,IAAI,cAAc,CAAU,cAAc,EAAE;AAEjG;;;MAGa,cAAc,GAA4B,IAAI,cAAc,CAAU,gBAAgB;;AC9BnG;;;AAGO,MAAM,GAAG,GAAE;IACd,kDAAkD,EAAE,EAAE,OAAO,EAAE,kDAAkD,EAAE,OAAO,EAAE,uDAAuD,GAAG;IACtL,gDAAgD,EAAE,EAAE,OAAO,EAAE,gDAAgD,EAAE,OAAO,EAAE,iEAAiE,GAAG;IAC5L,0FAA0F,EAAE,EAAE,OAA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AM,uBAAN,MAAM,CAAE,aAAa,GAAG,KAAK,EAAE;gBAClG,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,cAAc,KAAI,IAAI,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,cAAc,GAAG,KAAK,EAAE;aACvG;SACF,CAAC;KACH;;;YAhBF,QAAQ;;;ACPT;;;MAGa,WAAW;;;;;;;;IASpB,YAAmB,QAAgB,EAAS,aAAkB,EAAS,cAAoB;QAAxE,aAAQ,GAAR,QAAQ,CAAQ;QAAS,kBAAa,GAAb,aAAa,CAAK;QAAS,mBAAc,GAAd,cAAc,CAAM;KAAK;;;ACNpG;;;MAGa,gCAAgC;;;ACT7C;;;;ACAA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"esfaenza-signalr-notifications.js","sources":["../../../projects/signalr-notifications/src/lib/models/BaseMessageService.ts","../../../projects/signalr-notifications/src/lib/tokens.ts","../../../projects/signalr-notifications/src/lib/signalr-notifications.service.loc.ts","../../../projects/signalr-notifications/src/lib/signalr-notifications.service.ts","../../../projects/signalr-notifications/src/lib/signalr-notifications.module.ts","../../../projects/signalr-notifications/src/lib/models/EndpointDef.ts","../../../projects/signalr-notifications/src/lib/config/SignalrNotificationsModuleConfig.ts","../../../projects/signalr-notifications/src/public-api.ts","../../../projects/signalr-notifications/src/esfaenza-signalr-notifications.ts"],"sourcesContent":["// Angular\r\nimport { Injectable } from '@angular/core';\r\n\r\n// Modelli\r\nimport { EndpointDef } from './EndpointDef';\r\n\r\n/**\r\n * Classe base da estendere con la definizione degli Endpoint supportati dall'applicazione\r\n */\r\n@Injectable()\r\nexport class BaseMessageService {\r\n\r\n private definitions: EndpointDef<any, any>[] = [];\r\n\r\n /** Entrypoint che restituisce tutti gli Endpoint dell'applicazione. Da overridare qualora non venga utilizzato il metodo **add** */\r\n public get AllDefinitions(): EndpointDef<any, any>[] { return this.definitions; }\r\n\r\n public add(endpoint: EndpointDef<any, any>) {\r\n this.definitions.push(endpoint);\r\n }\r\n}","import { InjectionToken } from '@angular/core';\r\n\r\n/**\r\n * Hub a cui collegarsi\r\n */\r\nexport const HUB_URL: InjectionToken<string> = new InjectionToken<string>('HUB_URL');\r\n\r\n/**\r\n * Indica se la libreria dev'essere attiva o no\r\n */\r\nexport const SIGNALR_ENABLED: InjectionToken<string> = new InjectionToken<boolean>('SIGNALR_ENABLED');\r\n\r\n/**\r\n * Indica se stampare messaggi di debug in console\r\n */\r\nexport const DEBUG_MODE: InjectionToken<string> = new InjectionToken<boolean>('DEBUG_MODE');\r\n\r\n/**\r\n * Indica il locale utilizzato dalla libreria per i messaggi. Sono supportati \"it-IT\" ed \"en-US\"\r\n */\r\nexport const LOCALE: InjectionToken<string> = new InjectionToken<string>('LOCALE');\r\n\r\n/**\r\n * Indica se utilizzare il protocollo di trasferimento \"MessagePack\"\r\n */\r\nexport const MESSAGE_PACK: InjectionToken<boolean> = new InjectionToken<boolean>('MESSAGE_PACK');\r\n\r\n/**\r\n * Indica se tentare in automatico la riconnessione\r\n */\r\nexport const AUTO_RECONNECT: InjectionToken<boolean> = new InjectionToken<boolean>('AUTO_RECONNECT');","/**\r\n * Oggetto statico di localizzazione per i messaggi scritti dal servizio\r\n */\r\nexport const Loc ={\r\n \"Building SignalR Hub with Automatic Reconnection\": { \"en-US\": \"Building SignalR Hub with Automatic Reconnection\", \"it-IT\": \"Compilo l'Hub di SignalR con riconnessione automatica\", },\r\n \"Cannot reconnect SignalR, frontend HUB offline\": { \"en-US\": \"Cannot reconnect SignalR, frontend HUB offline\", \"it-IT\": \"Impossibile riconnettere SignalR, l'Hub del Frontend e' Offline\", },\r\n \"Send request sent before a connection was in stable State, waiting 1 second and retrying\": { \"en-US\": \"Send request sent before a connection was in stable State, waiting 1 second and retrying\", \"it-IT\": \"Richiesta 'Send' ricevuta prima che la connessione fosse in uno stato stabile, attendo 1 secondo e riprovo\", },\r\n \"Invoke request sent before a connection was in stable State, waiting 1 second and retrying\": { \"en-US\": \"Invoke request sent before a connection was in stable State, waiting 1 second and retrying\", \"it-IT\": \"Richiesta 'Invoke' ricevuta prima che la connessione fosse in uno stato stabile, attendo 1 secondo e riprovo\", },\r\n \"Connection lost or missing, reconnecting...\" : { \"en-US\": \"Connection lost or missing, reconnecting...\", \"it-IT\": \"Connessione persa o mancante, mi riconnetto...\", },\r\n \"SignalR won't be enabled as per configuration\": { \"en-US\": \"SignalR won't be enabled as per configuration\", \"it-IT\": \"SignalR non verrà attivato come da configurazione\", },\r\n \"Building SignalR Hub with MessagePack protocol\": { \"en-US\": \"Building SignalR Hub with MessagePack protocol\", \"it-IT\": \"Compilo l'Hub di SignalR con protocollo MessagePack\", },\r\n \"Request received from the server for endpoint\": { \"en-US\": \"Request received from the server for endpoint\", \"it-IT\": \"Richiesta ricevuta dal server per endpoint\", },\r\n \"Refusing to register endpoint\": { \"en-US\": \"Refusing to register endpoint\", \"it-IT\": \"Rifiuto di registrare l'endpoint\", },\r\n \"because it is not declared as IN - ONLY\": { \"en-US\": \"because it is not declared as IN - ONLY\", \"it-IT\": \"in quanto non è registrato solo come IN\", },\r\n \"Send request ignored because SignalR is not active by configuration\": { \"en-US\": \"Send request ignored because SignalR is not active by configuration\", \"it-IT\": \"Richiesta send ignorata in quanto SignalR non è attivo da configurazione\", },\r\n \"Request sent to server\": { \"en-US\": \"Request sent to server\", \"it-IT\": \"Richiesta inviata al server\", },\r\n \"Invoke request ignored because SignalR is not active by configuration\": { \"en-US\": \"Invoke request ignored because SignalR is not active by configuration\", \"it-IT\": \"Richiesta invoke ignorata in quanto SignalR non è attivo da configurazione\", },\r\n \"Request invoked to server\": { \"en-US\": \"Request invoked to server\", \"it-IT\": \"Richiesta invoke inviata al server\", },\r\n \"Observe request ignored because SignalR is not active by configuration\": { \"en-US\": \"Observe request ignored because SignalR is not active by configuration\", \"it-IT\": \"Osservazione ignorata in quanto SignalR non è attivo da configurazione\", },\r\n \"Returning observable for required endpoint\": { \"en-US\": \"Returning observable for required endpoint\", \"it-IT\": \"Restituisco l'observable per l'endpoint richiesto\", },\r\n \"Disconnection request ignored because SignalR is not active by configuration\": { \"en-US\": \"Disconnection request ignored because SignalR is not active by configuration\", \"it-IT\": \"Richiesta di disconnesione ignorata in quanto SignalR non è attivo da configurazione\", },\r\n \"Disconnection request honored\": { \"en-US\": \"Returning observable for required endpoint\", \"it-IT\": \"Restituito observable per l'endpoint richiesto\", },\r\n \"ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST\": { \"en-US\": \"ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST\", \"it-IT\": \"ERRORE nella riconnessione precedente a un nuovo tentativo di 'Send'. Il messaggio in questione SARA' PERSO\"}\r\n}","// Angular\r\nimport { Injectable, Inject } from \"@angular/core\";\r\n\r\n// Direttive, Componenti, Librerie\r\nimport * as signalR from '@microsoft/signalr';\r\nimport { HubConnectionState } from \"@microsoft/signalr\";\r\nimport { Observable, Subject, EMPTY, from, of } from \"rxjs\";\r\nimport { catchError, concatMap, delay, tap } from \"rxjs/operators\";\r\n\r\n// Modelli\r\nimport { BaseMessageService } from './models/BaseMessageService';\r\nimport { EndpointDef } from './models/EndpointDef';\r\nimport { DEBUG_MODE, HUB_URL, LOCALE, MESSAGE_PACK, SIGNALR_ENABLED, AUTO_RECONNECT } from \"./tokens\";\r\n\r\n// Localizzazione\r\nimport { Loc } from './signalr-notifications.service.loc';\r\n\r\n/**\r\n * Servizio che gestisce la comunicazione con un Hub SignalR in base alle configurazioni fornite dall'applicazione\r\n */\r\n@Injectable()\r\nexport class NotificationsService {\r\n\r\n /**\r\n * Cache degli Observable generati in base agli Endpoint disponibili\r\n */\r\n private notifications$: { [index: string]: Subject<any> } = {};\r\n\r\n /**\r\n * Connessione Signalr\r\n */\r\n private connection: signalR.HubConnection;\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @ignore\r\n */\r\n constructor(private MessageDef: BaseMessageService, @Inject(HUB_URL) private hub_url: string, @Inject(MESSAGE_PACK) private msgpack: boolean, @Inject(SIGNALR_ENABLED) private enabled: boolean, @Inject(DEBUG_MODE) private debug: boolean, @Inject(AUTO_RECONNECT) autoreconnect: boolean, @Inject(LOCALE) private locale : string) {\r\n if (!this.enabled) {\r\n this.log(this.loc(\"SignalR won't be enabled as per configuration\"));\r\n return;\r\n }\r\n\r\n this.MessageDef.AllDefinitions.forEach(def => { this.notifications$[def.endpoint] = new Subject<typeof def.inTypeDefault>(); });\r\n\r\n let pars: signalR.IHttpConnectionOptions = { skipNegotiation: true, transport: signalR.HttpTransportType.WebSockets, logger: debug ? signalR.LogLevel.Debug : signalR.LogLevel.None };\r\n var builder = new signalR.HubConnectionBuilder().withUrl(this.hub_url, pars);\r\n\r\n if (autoreconnect) {\r\n this.log(this.loc(\"Building SignalR Hub with Automatic Reconnection\"));\r\n // 100 tentativi di riconnessione, 1 ogni 5 secondi\r\n builder = builder.withAutomaticReconnect(new Array(100).fill(5 * 1000));\r\n }\r\n\r\n if (this.msgpack) {\r\n this.log(this.loc(\"Building SignalR Hub with MessagePack protocol\"));\r\n var mphpModule = require(\"@microsoft/signalr-protocol-msgpack\");\r\n builder = builder.withHubProtocol(new mphpModule.MessagePackHubProtocol())\r\n }\r\n\r\n this.connection = builder.build();\r\n this.connect();\r\n }\r\n\r\n /**\r\n * Effettua la connessione all'Hub Signalr e registra tutti gli Endpoint per cui il Backend comunica con il Frontend sulla **connection**\r\n */\r\n private connect() {\r\n this.connection.start().catch(err => console.log(err));\r\n this.MessageDef.AllDefinitions.forEach(d => {\r\n //Registro solo le cose di IN, quelle di out sono chiamate che faccio io al BE quindi non servono\r\n if (d.inTypeDefault !== null && d.outTypeDefault === null)\r\n this.connection.on(d.endpoint, (message) => {\r\n this.log(this.loc(\"Request received from the server for endpoint\") + \" '\" + d.endpoint + \"': \" + this.substringLog(JSON.stringify(message)));\r\n this.notifications$[d.endpoint].next(message);\r\n });\r\n else\r\n this.log(this.loc(\"Refusing to register endpoint\") + \" \" + d.endpoint + \" \" + this.loc(\"because it is not declared as IN - ONLY\"));\r\n });\r\n }\r\n\r\n /**\r\n * Effettua verifiche sulla connessione e, in caso non fosse collegata, tenta di riconnetterla\r\n * \r\n * @returns {Promise<'OK' | 'KO' | 'NO-OP'>} 'OK' Se la connessione è già connessa o è stata riconnessa con successo, 'KO' Se non è stato possibile riconnettere \r\n * una connessione disconnessa, 'NO-OP' se la connesisone è in uno stato intermedio che non può essere modificato\r\n */\r\n public ensureConnected(): Promise<'OK' | 'KO' | 'NO-OP'> {\r\n if (this.connection.state == HubConnectionState.Disconnected) {\r\n this.log(this.loc(\"Connection lost or missing, reconnecting...\"));\r\n\r\n return this.connection.start()\r\n .then(_ => {\r\n return Promise.resolve(\"OK\");\r\n }, _ => {\r\n this.log(this.loc(\"Cannot reconnect SignalR, frontend HUB offline\"));\r\n return Promise.resolve(\"KO\");\r\n });\r\n }\r\n else if (this.connection.state == HubConnectionState.Connected)\r\n return Promise.resolve(\"OK\");\r\n else\r\n return Promise.resolve(\"NO-OP\");\r\n }\r\n\r\n /**\r\n * Invia un messaggio all'Hub del Backend\r\n * \r\n * @param {EndpointDef<TOut, any>} item Endpoint da contattare\r\n * @param {TOut} dto Dto da inviare all'Endpoint\r\n */\r\n public send<TOut>(item: EndpointDef<TOut, any>, dto: TOut) {\r\n if (!this.enabled) {\r\n this.log(this.loc(\"Send request ignored because SignalR is not active by configuration\"));\r\n return EMPTY;\r\n }\r\n\r\n if (this.connection.state == HubConnectionState.Connecting || this.connection.state == HubConnectionState.Reconnecting || this.connection.state == HubConnectionState.Disconnecting) {\r\n this.log(this.loc(\"Send request sent before a connection was in stable State, waiting 1 second and retrying\"));\r\n setTimeout(() => { this.send(item, dto); }, 1000);\r\n }\r\n else if (this.connection.state == HubConnectionState.Disconnected) {\r\n this.ensureConnected().then(t => {\r\n if (t == \"KO\") this.log(this.loc(\"ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST\"));\r\n else this.send(item, dto);\r\n })\r\n }\r\n else {\r\n this.connection.send(item.endpoint, dto).then(_ => {\r\n if (this.debug)\r\n console.info(this.loc(\"Request sent to server\") + \" - \" + item.endpoint + \": \" + this.substringLog(JSON.stringify(dto)));\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Invia un messaggio all'Hub del Backend, aspettandosi una risposta\r\n * \r\n * @param {EndpointDef<TOut, TIn>} item Endpoint da contattare\r\n * @param {TOut} dto Dto da inviare all'Endpoint\r\n * \r\n * @returns {Observable<TIn>} Observable su cui ci si può registrare per ricevere il risultato della chiamata\r\n */\r\n public invoke<TOut, TIn>(item: EndpointDef<TOut, TIn>, dto: TOut): Observable<TIn> {\r\n if (!this.enabled) {\r\n this.log(this.loc(\"Invoke request ignored because SignalR is not active by configuration\"));\r\n return EMPTY;\r\n }\r\n\r\n if (this.connection.state == HubConnectionState.Connecting || this.connection.state == HubConnectionState.Reconnecting || this.connection.state == HubConnectionState.Disconnecting) {\r\n this.log(this.loc(\"Invoke request sent before a connection was in stable State, waiting 1 second and retrying\"));\r\n return of().pipe(delay(1000), concatMap(() => this.invoke(item, dto)));\r\n }\r\n else if (this.connection.state == HubConnectionState.Disconnected) {\r\n return from(this.ensureConnected()).pipe(concatMap((res) => {\r\n if (res == \"KO\") {\r\n this.log(this.loc(\"ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST\"));\r\n return EMPTY;\r\n }\r\n else return this.invoke(item, dto);\r\n }))\r\n }\r\n else {\r\n return from(this.connection.invoke<TIn>(item.endpoint, dto)).pipe(\r\n tap(() => {\r\n if (this.debug) console.log(this.loc(\"Request invoked to server\") + \" - \" + item.endpoint + \": \" + this.substringLog(JSON.stringify(dto)));\r\n })\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Hook per osservare i dati spediti ad un Endpoint dal Backend\r\n * \r\n * @param {EndpointDef<TIn, any>} item Endpoint su cui ascoltare\r\n * \r\n * @returns {Observable<TIn>} Observable su cui ci si può registrare per ricevere l'oggetto generato ad ogni chiamata dal Backend al Frontend\r\n */\r\n public observe<TIn>(item: EndpointDef<TIn, any>): Observable<TIn> {\r\n if (!this.enabled)\r\n {\r\n this.log(this.loc(\"Observe request ignored because SignalR is not active by configuration\"));\r\n return EMPTY;\r\n }\r\n\r\n this.log(this.loc(\"Returning observable for required endpoint\") + \": \" + item.endpoint);\r\n return <Observable<TIn>>this.notifications$[item.endpoint];\r\n }\r\n\r\n /**\r\n * Disconnessione del sistema di SignalR\r\n * \r\n * @returns {Observable<void>} Observable a cui registrarsi che viene chiamato quando la disconnessione è terminata\r\n */\r\n public disconnect(): Observable<void> {\r\n //NO-OP se non attivo\r\n if (!this.enabled)\r\n {\r\n this.log(this.loc(\"Disconnection request ignored because SignalR is not active by configuration\"));\r\n return EMPTY;\r\n }\r\n\r\n return from(this.connection.stop()).pipe(\r\n catchError((err, caught) => { console.log(err); return of(null); }),\r\n tap(() => {\r\n this.log(this.loc(\"Disconnection request honored\"));\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Taglia un log troppo lungo\r\n * \r\n * @param {string} text Log da tagliare\r\n * @param {number} maxchars Numero massimo di caratteri da tenere\r\n * \r\n * @returns {string} Log tagliato\r\n */\r\n private substringLog(text: string, maxchars: number = 120) : string {\r\n return text.length > maxchars ? text.substr(0, maxchars) + \"[...]\" : text;\r\n }\r\n\r\n /**\r\n * Stampa un log a console\r\n * \r\n * @param {string} message Messaggio da stampare\r\n */\r\n private log(message: string) {\r\n if (this.debug)\r\n console.log(\"@signalr-notifications: \" + message)\r\n }\r\n\r\n /**\r\n * Helper di localizzazione\r\n * \r\n * @param {string} message Messaggio da tradurre\r\n * \r\n * @returns {string} Messaggio tradotto\r\n */\r\n private loc(message: string) : string{\r\n if(!Loc[message])\r\n {\r\n console.warn(\"Untranslated message: \" + message)\r\n return \"\";\r\n }\r\n return Loc[message][this.locale];\r\n }\r\n}","\r\nimport { NgModule, ModuleWithProviders } from '@angular/core';\r\nimport { SignalrNotificationsModuleConfig } from './config/SignalrNotificationsModuleConfig';\r\nimport { BaseMessageService } from './models/BaseMessageService';\r\nimport { NotificationsService } from './signalr-notifications.service';\r\nimport { HUB_URL, SIGNALR_ENABLED, DEBUG_MODE, LOCALE, MESSAGE_PACK, AUTO_RECONNECT } from './tokens';\r\n\r\n@NgModule()\r\nexport class SignalrNotificationsModule {\r\n static forRoot(config?: SignalrNotificationsModuleConfig): ModuleWithProviders<SignalrNotificationsModule> {\r\n return {\r\n ngModule: SignalrNotificationsModule,\r\n providers: [\r\n NotificationsService,\r\n { provide: BaseMessageService, useClass: config?.messageService || BaseMessageService },\r\n { provide: HUB_URL, useValue: config?.hubUrl },\r\n { provide: LOCALE, useValue: config?.locale || 'it-IT' },\r\n { provide: SIGNALR_ENABLED, useValue: config?.enabled != null ? config?.enabled : true },\r\n { provide: DEBUG_MODE, useValue: config?.debugMode != null ? config?.debugMode : false },\r\n { provide: MESSAGE_PACK, useValue: config?.autoReconnect != null ? config?.autoReconnect : false },\r\n { provide: AUTO_RECONNECT, useValue: config?.useMessagePack != null ? config?.useMessagePack : false },\r\n ]\r\n };\r\n }\r\n}","/**\r\n * Definisce un Endpoint che spedisce un'informazione di tipo TIn e restituisce un'informazione di tipo TOut\r\n */\r\nexport class EndpointDef<TIn, TOut> {\r\n\r\n /**\r\n * Costruttore\r\n * \r\n * @param {string} endpoint Nome del metodo da chiamare nell'Hub del Backend contattato\r\n * @param {TIn} inTypeDefault Default per il tipo TIn. Utilizzato per fare Typecheck sulle chiamate da Backend a Frontend\r\n * @param {TOut} outTypeDefault Default per il tipo TOut. Utilizzato per fare Typecheck sulle chiamate da Frontend a Backend\r\n */\r\n constructor(public endpoint: string, public inTypeDefault: TIn, public outTypeDefault: TOut) { }\r\n\r\n\r\n /** Helper per la creazione rapida di un Endpoint di solo INPUT */\r\n public static In<TIn>(name: string, inTypeDefault: TIn): EndpointDef<TIn, void> {\r\n return new EndpointDef<TIn, void>(name, inTypeDefault, undefined);\r\n }\r\n\r\n /** Helper per la creazione rapida di un Endpoint di solo OUTPUT */\r\n public static Out<TOut>(name: string, outTypeDefault: TOut): EndpointDef<void, TOut> {\r\n return new EndpointDef<void, TOut>(name, undefined, outTypeDefault);\r\n }\r\n\r\n /** Helper per la creazione rapida di un Endpoint di INPUT e OUTPUT (BIDIREZIONALE) */\r\n public static Bi<TIn, TOut>(name: string, inTypeDefault: TIn, outTypeDefault: TOut): EndpointDef<TIn, TOut> {\r\n return new EndpointDef<TIn, TOut>(name, inTypeDefault, outTypeDefault);\r\n }\r\n}","// Angular\r\nimport { Type } from '@angular/core';\r\n\r\n// Modelli\r\nimport { BaseMessageService } from '../models/BaseMessageService';\r\n\r\n/**\r\n * Classe di configurazione per la libreria\r\n */\r\nexport class SignalrNotificationsModuleConfig {\r\n\r\n /**\r\n * Url nei confronti del quale aprire la connessione SignalR\r\n */\r\n hubUrl : string;\r\n\r\n /**\r\n * Servizio che definisce i messaggi di IN e OUT coi loro default\r\n */\r\n messageService? : Type<BaseMessageService>;\r\n\r\n /**\r\n * Indica se abilitare o meno la connessione SignalR nei confronti dell'URL **hubUrl**\r\n */\r\n enabled? : boolean;\r\n\r\n /**\r\n * Indica se utilizzare message pack come protocollo di trasmissione\r\n */\r\n useMessagePack? : boolean;\r\n\r\n /**\r\n * Indica se tentare di riconnettersi automaticamente quando la connessione cade\r\n */\r\n autoReconnect? : boolean;\r\n\r\n /**\r\n * Indica se scrivere o meno i messaggi di debug\r\n */\r\n debugMode? : boolean;\r\n\r\n /**\r\n * Lingua dei feedback a console, sono supportati 'it-IT' ed 'en-US'\r\n */\r\n locale? : string\r\n}","/*\n * Public API Surface of signalr-notifications\n */\n\nexport * from './lib/signalr-notifications.service';\nexport * from './lib/signalr-notifications.module';\nexport * from './lib/models/BaseMessageService';\nexport * from './lib/models/EndpointDef';\nexport * from './lib/config/SignalrNotificationsModuleConfig';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n\nexport {AUTO_RECONNECT as ɵf,DEBUG_MODE as ɵc,HUB_URL as ɵa,LOCAL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AkB,EAAS,cAAoB;QAAxE,aAAQ,GAAR,QAAQ,CAAQ;QAAS,kBAAa,GAAb,aAAa,CAAK;QAAS,mBAAc,GAAd,cAAc,CAAM;KAAK;;IAIzF,OAAO,EAAE,CAAM,IAAY,EAAE,aAAkB;QAClD,OAAO,IAAI,WAAW,CAAY,IAAI,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;KACrE;;IAGM,OAAO,GAAG,CAAO,IAAY,EAAE,cAAoB;QACtD,OAAO,IAAI,WAAW,CAAa,IAAI,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;KACvE;;IAGM,OAAO,EAAE,CAAY,IAAY,EAAE,aAAkB,EAAE,cAAoB;QAC9E,OAAO,IAAI,WAAW,CAAY,IAAI,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC;KAC1E;;;ACtBL;;;MAGa,gCAAgC;;;ACT7C;;;;ACAA;;;;;;"}
|
|
@@ -3,8 +3,8 @@ import { EndpointDef } from './EndpointDef';
|
|
|
3
3
|
* Classe base da estendere con la definizione degli Endpoint supportati dall'applicazione
|
|
4
4
|
*/
|
|
5
5
|
export declare class BaseMessageService {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*/
|
|
6
|
+
private definitions;
|
|
7
|
+
/** Entrypoint che restituisce tutti gli Endpoint dell'applicazione. Da overridare qualora non venga utilizzato il metodo **add** */
|
|
9
8
|
get AllDefinitions(): EndpointDef<any, any>[];
|
|
9
|
+
add(endpoint: EndpointDef<any, any>): void;
|
|
10
10
|
}
|
|
@@ -13,4 +13,10 @@ export declare class EndpointDef<TIn, TOut> {
|
|
|
13
13
|
* @param {TOut} outTypeDefault Default per il tipo TOut. Utilizzato per fare Typecheck sulle chiamate da Frontend a Backend
|
|
14
14
|
*/
|
|
15
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>;
|
|
16
22
|
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@esfaenza/signalr-notifications",
|
|
3
|
-
"version": "11.2.
|
|
3
|
+
"version": "11.2.10",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"tslib": "^2.0.0"
|
|
6
6
|
},
|
|
7
7
|
"peerDependencies": {
|
|
8
8
|
"@angular/common": "~11.2.14",
|
|
9
9
|
"@angular/core": "~11.2.14",
|
|
10
|
-
"@microsoft/signalr": "5.0.
|
|
11
|
-
"@microsoft/signalr-protocol-msgpack": "5.0.
|
|
10
|
+
"@microsoft/signalr": "5.0.17",
|
|
11
|
+
"@microsoft/signalr-protocol-msgpack": "5.0.17"
|
|
12
12
|
},
|
|
13
13
|
"main": "bundles/esfaenza-signalr-notifications.umd.js",
|
|
14
14
|
"module": "fesm2015/esfaenza-signalr-notifications.js",
|