@esfaenza/signalr-notifications 11.2.1 → 11.2.5
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 +1 -2
- 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/signalr-notifications.service.js +3 -4
- package/fesm2015/esfaenza-signalr-notifications.js +2 -3
- package/fesm2015/esfaenza-signalr-notifications.js.map +1 -1
- package/lib/signalr-notifications.service.d.ts +0 -1
- package/package.json +3 -3
|
@@ -112,7 +112,6 @@
|
|
|
112
112
|
this.msgpack = msgpack;
|
|
113
113
|
this.enabled = enabled;
|
|
114
114
|
this.debug = debug;
|
|
115
|
-
this.autoreconnect = autoreconnect;
|
|
116
115
|
this.locale = locale;
|
|
117
116
|
/**
|
|
118
117
|
* Cache degli Observable generati in base agli Endpoint disponibili
|
|
@@ -268,7 +267,7 @@
|
|
|
268
267
|
this.log(this.loc("Disconnection request ignored because SignalR is not active by configuration"));
|
|
269
268
|
return rxjs.EMPTY;
|
|
270
269
|
}
|
|
271
|
-
return rxjs.from(this.connection.stop()).pipe(operators.tap(function () {
|
|
270
|
+
return rxjs.from(this.connection.stop()).pipe(operators.catchError(function (err, caught) { console.log(err); return rxjs.of(null); }), operators.tap(function () {
|
|
272
271
|
_this.log(_this.loc("Disconnection request honored"));
|
|
273
272
|
}));
|
|
274
273
|
};
|
|
@@ -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 { 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) private 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 {\r\n this.log(this.loc(\"Building SignalR Hub with Automatic Reconnection\"));\r\n builder = builder.withAutomaticReconnect();\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;\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;\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 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 return from(this.connection.stop()).pipe(\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","of","delay","concatMap","from","tap","EMPTY","Inject","NgModule"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;IAAA;IAMA;;;;QAIA;;QAKI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AA;KAAA;;IC7CD;;;;ICAA;;;;;;;;;;;;;;;;;;;;;;"}
|
|
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 {\r\n this.log(this.loc(\"Building SignalR Hub with Automatic Reconnection\"));\r\n builder = builder.withAutomaticReconnect();\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;\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;\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 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","of","delay","concatMap","from","tap","EMPTY","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,CAAU,cAAc,EAAE;IAEjG;;;QAGa,cAAc,GAA4B,IAAIA,mBAAc,CAAU,gBAAgB;;IC9BnG;;;IAGO,IAAM,GAAG,GAAE;QACd,kDAAkD,EAAE,EAAE,OAAO,EAAE,kDAAkD,EAAE,OAAO,EAAE,uDAAuD,GAAG;QACtL,gDAAgD,EAAE,EAAE,OAAO,EAAE,gDAAgD,EAAE,OAAO,EAAE,iEAAiE,GAAG;QAC5L,0FAA0F,EAAE,EAAE,OAAO,EAAE,0FAA0F,EAAE,OAAO,EAAE,4GAA4G,GAAG;QAC3T,4FAA4F,EAAE,EAAE,OAAO,EAAE,4FAA4F,EAAE,OAAO,EAAE,8GAA8G,GAAG;QACjU,6CAA6C,EAAG,EAAE,OAAO,EAAE,6CAA6C,EAAE,OAAO,EAAE,gDAAgD,GAAG;QACtK,+CAA+C,EAAE,EAAE,OAAO,EA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,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;iBACvG;aACF,CAAC;SACH;;;;gBAhBFC,aAAQ;;;ICPT;;;;;;;;;;;QAYI,qBAAmB,QAAgB,EAAS,aAAkB,EAAS,cAAoB;YAAxE,aAAQ,GAAR,QAAQ,CAAQ;YAAS,kBAAa,GAAb,aAAa,CAAK;YAAS,mBAAc,GAAd,cAAc,CAAM;SAAK;0BACnG;KAAA;;ICPD;;;;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.autoreconnect=a,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()),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 o=this;this.enabled?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(){o.send(e,n)}),1e3)):this.connection.state==t.HubConnectionState.Disconnected?this.ensureConnected().then((function(t){"KO"==t?o.log(o.loc("ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST")):o.send(e,n)})):this.connection.send(e.endpoint,n).then((function(t){o.debug&&console.info(o.loc("Request sent to server")+" - "+e.endpoint+": "+o.substringLog(JSON.stringify(n)))})):this.log(this.loc("Send request ignored because SignalR is not active by configuration"))},e.prototype.invoke=function(e,n){var s=this;if(this.enabled)return 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){if("KO"!=t)return s.invoke(e,n);s.log(s.loc("ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST"))}))):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"))},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.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(){}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()),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 o=this;this.enabled?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(){o.send(e,n)}),1e3)):this.connection.state==t.HubConnectionState.Disconnected?this.ensureConnected().then((function(t){"KO"==t?o.log(o.loc("ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST")):o.send(e,n)})):this.connection.send(e.endpoint,n).then((function(t){o.debug&&console.info(o.loc("Request sent to server")+" - "+e.endpoint+": "+o.substringLog(JSON.stringify(n)))})):this.log(this.loc("Send request ignored because SignalR is not active by configuration"))},e.prototype.invoke=function(e,n){var s=this;if(this.enabled)return 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){if("KO"!=t)return s.invoke(e,n);s.log(s.loc("ERRORS on reconnecting before retrying a send command. Sent message WILL BE LOST"))}))):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"))},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})}));
|
|
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","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","Connecting","Reconnecting","Disconnecting","setTimeout","t","info","invoke","of","pipe","delay","concatMap","from","res","tap","observe","EMPTY","disconnect","stop","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,QAAS,gCAAiCC,QAAS,oCACtFS,0CAA2C,CAAEV,QAAS,0CAA2CC,QAAS,2CAC1GU,sEAAuE,CAAEX,QAAS,sEAAuEC,QAAS,4EAClKW,yBAA0B,CAAEZ,QAAS,yBAA0BC,QAAS,+BACxEY,wEAAyE,CAAEb,QAAS,wEAAyEC,QAAS,8EACtKa,4BAA6B,CAAEd,QAAS,4BAA6BC,QAAS,sCAC9Ec,yEAA0E,CAAEf,QAAS,yEAA0EC,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H,UAAUN,MAAAA,OAAM,EAANA,EAAQpF,SAAU,SAC/C,CAAEuF,QAASzH,EAAiB4H,SAA6B,OAAnBN,MAAAA,OAAM,EAANA,EAAQvF,WAAkBuF,MAAAA,OAAM,EAANA,EAAQvF,UACxE,CAAE0F,QAASxH,EAAY2H,SAA+B,OAArBN,MAAAA,OAAM,EAANA,EAAQQ,aAAoBR,MAAAA,OAAM,EAANA,EAAQQ,YACrE,CAAEL,QAAStH,EAAcyH,SAAmC,OAAzBN,MAAAA,OAAM,EAANA,EAAQS,iBAAwBT,MAAAA,OAAM,EAANA,EAAQS,gBAC3E,CAAEN,QAASrH,EAAgBwH,SAAoC,OAA1BN,MAAAA,OAAM,EAANA,EAAQU,kBAAyBV,MAAAA,OAAM,EAANA,EAAQU,6CAbrFC,EAAAA,iBCKG,SAAmBxF,EAAyB8B,EAA2BC,GAApDpC,KAAAK,SAAAA,EAAyBL,KAAAmC,cAAAA,EAA2BnC,KAAAoC,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 { 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) private 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 {\r\n this.log(this.loc(\"Building SignalR Hub with Automatic Reconnection\"));\r\n builder = builder.withAutomaticReconnect();\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;\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;\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 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 return from(this.connection.stop()).pipe(\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","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","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","Connecting","Reconnecting","Disconnecting","setTimeout","t","info","invoke","of","pipe","delay","concatMap","from","res","tap","observe","EMPTY","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,QAAS,gCAAiCC,QAAS,oCACtFS,0CAA2C,CAAEV,QAAS,0CAA2CC,QAAS,2CAC1GU,sEAAuE,CAAEX,QAAS,sEAAuEC,QAAS,4EAClKW,yBAA0B,CAAEZ,QAAS,yBAA0BC,QAAS,+BACxEY,wEAAyE,CAAEb,QAAS,wEAAyEC,QAAS,8EACtKa,4BAA6B,CAAEd,QAAS,4BAA6BC,QAAS,sCAC9Ec,yEAA0E,CAAEf,QAAS,yEAA0EC,QAAS,0EACxKe,6CAA8C,CAAEhB,QAAS,6CAA8CC,QAAS,qDAChHgB,+EAAgF,CAAEjB,QAAS,+EAAgFC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ANA,EAAQtF,SAAU,SAC/C,CAAEyF,QAAS3H,EAAiB8H,SAA6B,OAAnBN,MAAAA,OAAM,EAANA,EAAQzF,WAAkByF,MAAAA,OAAM,EAANA,EAAQzF,UACxE,CAAE4F,QAAS1H,EAAY6H,SAA+B,OAArBN,MAAAA,OAAM,EAANA,EAAQQ,aAAoBR,MAAAA,OAAM,EAANA,EAAQQ,YACrE,CAAEL,QAASxH,EAAc2H,SAAmC,OAAzBN,MAAAA,OAAM,EAANA,EAAQS,iBAAwBT,MAAAA,OAAM,EAANA,EAAQS,gBAC3E,CAAEN,QAASvH,EAAgB0H,SAAoC,OAA1BN,MAAAA,OAAM,EAANA,EAAQU,kBAAyBV,MAAAA,OAAM,EAANA,EAAQU,6CAbrFC,EAAAA,iBCKG,SAAmB1F,EAAyB8B,EAA2BC,GAApDpC,KAAAK,SAAAA,EAAyBL,KAAAmC,cAAAA,EAA2BnC,KAAAoC,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 {\r\n this.log(this.loc(\"Building SignalR Hub with Automatic Reconnection\"));\r\n builder = builder.withAutomaticReconnect();\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;\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;\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 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 +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":
|
|
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"}
|
|
@@ -4,7 +4,7 @@ import { Injectable, Inject } from "@angular/core";
|
|
|
4
4
|
import * as signalR from '@microsoft/signalr';
|
|
5
5
|
import { HubConnectionState } from "@microsoft/signalr";
|
|
6
6
|
import { Subject, EMPTY, from, of } from "rxjs";
|
|
7
|
-
import { concatMap, delay, tap } from "rxjs/operators";
|
|
7
|
+
import { catchError, concatMap, delay, tap } from "rxjs/operators";
|
|
8
8
|
// Modelli
|
|
9
9
|
import { BaseMessageService } from './models/BaseMessageService';
|
|
10
10
|
import { DEBUG_MODE, HUB_URL, LOCALE, MESSAGE_PACK, SIGNALR_ENABLED, AUTO_RECONNECT } from "./tokens";
|
|
@@ -25,7 +25,6 @@ export class NotificationsService {
|
|
|
25
25
|
this.msgpack = msgpack;
|
|
26
26
|
this.enabled = enabled;
|
|
27
27
|
this.debug = debug;
|
|
28
|
-
this.autoreconnect = autoreconnect;
|
|
29
28
|
this.locale = locale;
|
|
30
29
|
/**
|
|
31
30
|
* Cache degli Observable generati in base agli Endpoint disponibili
|
|
@@ -176,7 +175,7 @@ export class NotificationsService {
|
|
|
176
175
|
this.log(this.loc("Disconnection request ignored because SignalR is not active by configuration"));
|
|
177
176
|
return EMPTY;
|
|
178
177
|
}
|
|
179
|
-
return from(this.connection.stop()).pipe(tap(() => {
|
|
178
|
+
return from(this.connection.stop()).pipe(catchError((err, caught) => { console.log(err); return of(null); }), tap(() => {
|
|
180
179
|
this.log(this.loc("Disconnection request honored"));
|
|
181
180
|
}));
|
|
182
181
|
}
|
|
@@ -227,4 +226,4 @@ NotificationsService.ctorParameters = () => [
|
|
|
227
226
|
{ type: Boolean, decorators: [{ type: Inject, args: [AUTO_RECONNECT,] }] },
|
|
228
227
|
{ type: String, decorators: [{ type: Inject, args: [LOCALE,] }] }
|
|
229
228
|
];
|
|
230
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2lnbmFsci1ub3RpZmljYXRpb25zLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9zaWduYWxyLW5vdGlmaWNhdGlvbnMvc3JjL2xpYi9zaWduYWxyLW5vdGlmaWNhdGlvbnMuc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxVQUFVO0FBQ1YsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFFbkQsa0NBQWtDO0FBQ2xDLE9BQU8sS0FBSyxPQUFPLE1BQU0sb0JBQW9CLEN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ICAgICByZXR1cm4gdGV4dC5sZW5ndGggPiBtYXhjaGFycyA/IHRleHQuc3Vic3RyKDAsIG1heGNoYXJzKSArIFwiWy4uLl1cIiAgOiB0ZXh0O1xyXG4gICAgfVxyXG5cclxuICAgIC8qKlxyXG4gICAgICogU3RhbXBhIHVuIGxvZyBhIGNvbnNvbGVcclxuICAgICAqIFxyXG4gICAgICogQHBhcmFtIHtzdHJpbmd9IG1lc3NhZ2UgTWVzc2FnZ2lvIGRhIHN0YW1wYXJlXHJcbiAgICAgKi9cclxuICAgIHByaXZhdGUgbG9nKG1lc3NhZ2U6IHN0cmluZykge1xyXG4gICAgICAgIGlmICh0aGlzLmRlYnVnKVxyXG4gICAgICAgICAgICBjb25zb2xlLmxvZyhcIkBzaWduYWxyLW5vdGlmaWNhdGlvbnM6IFwiICsgbWVzc2FnZSlcclxuICAgIH1cclxuXHJcbiAgICAvKipcclxuICAgICAqIEhlbHBlciBkaSBsb2NhbGl6emF6aW9uZVxyXG4gICAgICogXHJcbiAgICAgKiBAcGFyYW0ge3N0cmluZ30gbWVzc2FnZSBNZXNzYWdnaW8gZGEgdHJhZHVycmVcclxuICAgICAqIFxyXG4gICAgICogQHJldHVybnMge3N0cmluZ30gTWVzc2FnZ2lvIHRyYWRvdHRvXHJcbiAgICAgKi9cclxuICAgIHByaXZhdGUgbG9jKG1lc3NhZ2U6IHN0cmluZykgOiBzdHJpbmd7XHJcbiAgICAgICAgaWYoIUxvY1ttZXNzYWdlXSlcclxuICAgICAgICB7XHJcbiAgICAgICAgICAgIGNvbnNvbGUud2FybihcIlVudHJhbnNsYXRlZCBtZXNzYWdlOiBcIiArIG1lc3NhZ2UpXHJcbiAgICAgICAgICAgIHJldHVybiBcIlwiO1xyXG4gICAgICAgIH1cclxuICAgICAgICByZXR1cm4gTG9jW21lc3NhZ2VdW3RoaXMubG9jYWxlXTtcclxuICAgIH1cclxufSJdfQ==
|
|
@@ -2,7 +2,7 @@ import { Injectable, InjectionToken, Inject, NgModule } from '@angular/core';
|
|
|
2
2
|
import * as signalR from '@microsoft/signalr';
|
|
3
3
|
import { HubConnectionState } from '@microsoft/signalr';
|
|
4
4
|
import { Subject, of, from, EMPTY } from 'rxjs';
|
|
5
|
-
import { delay, concatMap, tap } from 'rxjs/operators';
|
|
5
|
+
import { delay, concatMap, tap, catchError } from 'rxjs/operators';
|
|
6
6
|
|
|
7
7
|
// Angular
|
|
8
8
|
/**
|
|
@@ -84,7 +84,6 @@ class NotificationsService {
|
|
|
84
84
|
this.msgpack = msgpack;
|
|
85
85
|
this.enabled = enabled;
|
|
86
86
|
this.debug = debug;
|
|
87
|
-
this.autoreconnect = autoreconnect;
|
|
88
87
|
this.locale = locale;
|
|
89
88
|
/**
|
|
90
89
|
* Cache degli Observable generati in base agli Endpoint disponibili
|
|
@@ -235,7 +234,7 @@ class NotificationsService {
|
|
|
235
234
|
this.log(this.loc("Disconnection request ignored because SignalR is not active by configuration"));
|
|
236
235
|
return EMPTY;
|
|
237
236
|
}
|
|
238
|
-
return from(this.connection.stop()).pipe(tap(() => {
|
|
237
|
+
return from(this.connection.stop()).pipe(catchError((err, caught) => { console.log(err); return of(null); }), tap(() => {
|
|
239
238
|
this.log(this.loc("Disconnection request honored"));
|
|
240
239
|
}));
|
|
241
240
|
}
|
|
@@ -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 { 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) private 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 {\r\n this.log(this.loc(\"Building SignalR Hub with Automatic Reconnection\"));\r\n builder = builder.withAutomaticReconnect();\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;\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;\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 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 return from(this.connection.stop()).pipe(\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;AAE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A,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,aAAa,KAAI,IAAI,GAAG,MAAM,aAAN,MAAM,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 /**\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 {\r\n this.log(this.loc(\"Building SignalR Hub with Automatic Reconnection\"));\r\n builder = builder.withAutomaticReconnect();\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;\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;\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 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,kDAA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MAAM,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;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@esfaenza/signalr-notifications",
|
|
3
|
-
"version": "11.2.
|
|
3
|
+
"version": "11.2.5",
|
|
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": "
|
|
11
|
-
"@microsoft/signalr-protocol-msgpack": "
|
|
10
|
+
"@microsoft/signalr": "5.0.11",
|
|
11
|
+
"@microsoft/signalr-protocol-msgpack": "5.0.11"
|
|
12
12
|
},
|
|
13
13
|
"main": "bundles/esfaenza-signalr-notifications.umd.js",
|
|
14
14
|
"module": "fesm2015/esfaenza-signalr-notifications.js",
|