{"version":3,"file":"adaskothebeast-ngxs-signalr-plugin.mjs","sources":["../../../../libs/ngxs-signalr-plugin/src/lib/actions/connect-signalr.ts","../../../../libs/ngxs-signalr-plugin/src/lib/actions/disconnect-signalr.ts","../../../../libs/ngxs-signalr-plugin/src/lib/actions/invoke-signalr-message.ts","../../../../libs/ngxs-signalr-plugin/src/lib/actions/send-signalr-message.ts","../../../../libs/ngxs-signalr-plugin/src/lib/actions/signalr-connected.ts","../../../../libs/ngxs-signalr-plugin/src/lib/actions/signalr-connection-updated.ts","../../../../libs/ngxs-signalr-plugin/src/lib/actions/signalr-disconnected.ts","../../../../libs/ngxs-signalr-plugin/src/lib/actions/signalr-message-error.ts","../../../../libs/ngxs-signalr-plugin/src/lib/actions/signalr-reconnected.ts","../../../../libs/ngxs-signalr-plugin/src/lib/actions/signalr-reconnecting.ts","../../../../libs/ngxs-signalr-plugin/src/lib/actions/signalr-stream-completed.ts","../../../../libs/ngxs-signalr-plugin/src/lib/actions/signalr-stream-error.ts","../../../../libs/ngxs-signalr-plugin/src/lib/actions/stream-signalr-message.ts","../../../../libs/ngxs-signalr-plugin/src/lib/signalr-options.ts","../../../../libs/ngxs-signalr-plugin/src/lib/type-key-property-missing-error.ts","../../../../libs/ngxs-signalr-plugin/src/lib/signalr-handler.ts","../../../../libs/ngxs-signalr-plugin/src/lib/ngxs-signalr-plugin.module.ts","../../../../libs/ngxs-signalr-plugin/src/adaskothebeast-ngxs-signalr-plugin.ts"],"sourcesContent":["import { SignalROptions } from '../signalr-options';\r\n/**\r\n * Action to connect to the websocket. Optionally pass a URL.\r\n */\r\nexport class ConnectSignalR {\r\n  static readonly type = '[SignalR] Connect';\r\n  constructor(public payload?: SignalROptions) {}\r\n}\r\n","/**\r\n * Action to disconnect the SignalR.\r\n */\r\nexport class DisconnectSignalR {\r\n  static type = '[SignalR] Disconnect';\r\n}\r\n","/**\r\n * Action to invoke to the server.\r\n */\r\nexport class InvokeSignalRMessage {\r\n  static type = '[SignalR] Invoke Message';\r\n\r\n  constructor(public name: string, public payload: unknown) {}\r\n}\r\n","/**\r\n * Action to send to the server.\r\n */\r\nexport class SendSignalRMessage {\r\n  static type = '[SignalR] Send Message';\r\n\r\n  constructor(public name: string, public payload: unknown) {}\r\n}\r\n","/**\r\n * Action triggered when SignalR is connected\r\n */\r\nexport class SignalRConnected {\r\n  static type = '[SignalR] Connected';\r\n}\r\n","/**\r\n * Action dispatched when the user tries to connect if the connection already exists.\r\n */\r\nexport class SignalRConnectionUpdated {\r\n  static type = '[SignalR] Connection Updated';\r\n}\r\n","/**\r\n * Action triggered when SignalR is disconnected\r\n */\r\nexport class SignalRDisconnected {\r\n  static type = '[SignalR] Disconnected';\r\n  constructor(public payload?: Error | undefined) {}\r\n}\r\n","/**\r\n * Action triggered when a error ocurrs\r\n */\r\nexport class SignalRMessageError {\r\n  static type = '[SignalR] Message Error';\r\n  constructor(public payload?: unknown) {}\r\n}\r\n","/**\r\n * Action triggered when SignalR is connected\r\n */\r\nexport class SignalRReconnected {\r\n  static type = '[SignalR] Reconnected';\r\n  constructor(public connectionId?: string | undefined) {}\r\n}\r\n","/**\r\n * Action triggered when SignalR is connected\r\n */\r\nexport class SignalRReconnecting {\r\n  static type = '[SignalR] Reconnecting';\r\n  constructor(public payload?: Error | undefined) {}\r\n}\r\n","/**\r\n * Action triggered when SignalR is connected\r\n */\r\nexport class SignalRStreamCompleted {\r\n  static type = '[SignalR] Stream Completed';\r\n}\r\n","/**\r\n * Action triggered when a error ocurrs\r\n */\r\nexport class SignalRStreamError {\r\n  static type = '[SignalR] Stream Error';\r\n  constructor(public payload?: Error | undefined) {}\r\n}\r\n","/**\r\n * Action to stream from the server.\r\n */\r\nexport class StreamSignalRMessage {\r\n  static type = '[SignalR] Stream Message';\r\n\r\n  constructor(public name: string, public payload: unknown) {}\r\n}\r\n","import { InjectionToken } from '@angular/core';\r\nimport {\r\n  HttpTransportType,\r\n  IHttpConnectionOptions,\r\n  IHubProtocol,\r\n  ILogger,\r\n  IRetryPolicy,\r\n  LogLevel,\r\n} from '@microsoft/signalr';\r\n\r\nexport const NGXS_SIGNALR_OPTIONS = new InjectionToken('NGXS_SIGNALR_OPTIONS');\r\n\r\nexport interface SignalROptions {\r\n  /**\r\n   * URL of the SignalR endpoint.\r\n   */\r\n  baseUrl?: string;\r\n\r\n  /**\r\n   * URL of the SignalR endpoint.\r\n   */\r\n  url?: string;\r\n\r\n  /**\r\n   * Specifies a specific HTTP transport type.\r\n   */\r\n  transportType?: HttpTransportType;\r\n\r\n  /**\r\n   * Http connection options.\r\n   */\r\n  httpConnectionOptions?: IHttpConnectionOptions;\r\n\r\n  /**\r\n   * Retry policy implementation\r\n   */\r\n  reconnectPolicy?: IRetryPolicy;\r\n\r\n  /**\r\n   * Retry delays\r\n   */\r\n  retryDelays?: number[];\r\n\r\n  /**\r\n   * Automatic reconnect\r\n   */\r\n  automaticReconnect?: boolean;\r\n\r\n  /**\r\n   * Hub protocol options.\r\n   */\r\n  protocol?: IHubProtocol;\r\n\r\n  /**\r\n   * The property name to distinguish this type for the store.\r\n   * Default: 'type'\r\n   */\r\n  typeKey?: string;\r\n\r\n  /**\r\n   * Logging options\r\n   */\r\n  logging?: string | LogLevel | ILogger;\r\n\r\n  /**\r\n   * Keep alive interval in milliseconds.\r\n   */\r\n  keepAliveIntervalInMilliseconds?: number;\r\n\r\n  /**\r\n   * Server timeout in milliseconds.\r\n   */\r\n  serverTimeoutInMilliseconds?: number;\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\r\nexport function noop(..._args: unknown[]) {\r\n  return function () {\r\n    // noop\r\n  };\r\n}\r\n","/**\r\n * This error is thrown where there is no `type` (or custom `typeKey`) property\r\n * on the message that came from the server side socket\r\n */\r\nexport class TypeKeyPropertyMissingError extends Error {\r\n  constructor(typeKey: string) {\r\n    super(`Property ${typeKey} is missing on the socket message`);\r\n  }\r\n}\r\n","import { Inject, Injectable, OnDestroy } from '@angular/core';\r\nimport {\r\n  HubConnection,\r\n  HubConnectionBuilder,\r\n  HubConnectionState,\r\n  IStreamResult,\r\n  ISubscription,\r\n} from '@microsoft/signalr';\r\nimport { Actions, Store, ofActionDispatched } from '@ngxs/store';\r\nimport { Subscription } from 'rxjs/internal/Subscription';\r\n\r\nimport { ConnectSignalR } from './actions/connect-signalr';\r\nimport { DisconnectSignalR } from './actions/disconnect-signalr';\r\nimport { InvokeSignalRMessage } from './actions/invoke-signalr-message';\r\nimport { SendSignalRMessage } from './actions/send-signalr-message';\r\nimport { SignalRConnected } from './actions/signalr-connected';\r\nimport { SignalRConnectionUpdated } from './actions/signalr-connection-updated';\r\nimport { SignalRDisconnected } from './actions/signalr-disconnected';\r\nimport { SignalRMessageError } from './actions/signalr-message-error';\r\nimport { SignalRReconnected } from './actions/signalr-reconnected';\r\nimport { SignalRReconnecting } from './actions/signalr-reconnecting';\r\nimport { SignalRStreamCompleted } from './actions/signalr-stream-completed';\r\nimport { SignalRStreamError } from './actions/signalr-stream-error';\r\nimport { StreamSignalRMessage } from './actions/stream-signalr-message';\r\nimport { NGXS_SIGNALR_OPTIONS, SignalROptions } from './signalr-options';\r\nimport { TypeKeyPropertyMissingError } from './type-key-property-missing-error';\r\n\r\n@Injectable()\r\nexport class SignalRHandler implements OnDestroy {\r\n  private connection: HubConnection | null = null;\r\n  private subscription = new Subscription();\r\n  private streamSubscriptions: ISubscription<unknown>[] = [];\r\n  private typeKey = 'type';\r\n  constructor(\r\n    private store: Store,\r\n    private actions$: Actions,\r\n    @Inject(NGXS_SIGNALR_OPTIONS)\r\n    private options: SignalROptions\r\n  ) {\r\n    this.setupActionsListeners();\r\n    if (this.options.typeKey) {\r\n      this.typeKey = this.options.typeKey;\r\n    }\r\n  }\r\n\r\n  ngOnDestroy(): void {\r\n    this.closeConnection();\r\n    this.subscription.unsubscribe();\r\n  }\r\n\r\n  private setupActionsListeners(): void {\r\n    this.subscription.add(\r\n      this.actions$\r\n        .pipe(ofActionDispatched(ConnectSignalR))\r\n        .subscribe(async ({ payload }: ConnectSignalR) => {\r\n          await this.connect(payload);\r\n        })\r\n    );\r\n\r\n    this.subscription.add(\r\n      this.actions$\r\n        .pipe(ofActionDispatched(DisconnectSignalR))\r\n        .subscribe(() => {\r\n          this.disconnect();\r\n        })\r\n    );\r\n\r\n    this.subscription.add(\r\n      this.actions$\r\n        .pipe(ofActionDispatched(SendSignalRMessage))\r\n        .subscribe(async ({ name, payload }: SendSignalRMessage) => {\r\n          await this.send(name, payload);\r\n        })\r\n    );\r\n\r\n    this.subscription.add(\r\n      this.actions$\r\n        .pipe(ofActionDispatched(InvokeSignalRMessage))\r\n        .subscribe(async ({ name, payload }: InvokeSignalRMessage) => {\r\n          await this.invoke(name, payload);\r\n        })\r\n    );\r\n\r\n    this.subscription.add(\r\n      this.actions$\r\n        .pipe(ofActionDispatched(StreamSignalRMessage))\r\n        .subscribe(async ({ name, payload }: StreamSignalRMessage) => {\r\n          const resultStream = await this.stream(name, payload);\r\n          this.streamSubscriptions.push(\r\n            resultStream.subscribe({\r\n              next: (item) => {\r\n                const type = item[this.typeKey];\r\n                if (!type) {\r\n                  throw new TypeKeyPropertyMissingError(this.typeKey);\r\n                }\r\n                this.store.dispatch({ ...item, type });\r\n              },\r\n              complete: () => {\r\n                this.store.dispatch(new SignalRStreamCompleted());\r\n              },\r\n              error: (err) => {\r\n                this.store.dispatch(new SignalRStreamError(err));\r\n              },\r\n            })\r\n          );\r\n        })\r\n    );\r\n  }\r\n\r\n  private setupConnection(): void {\r\n    let builder = new HubConnectionBuilder();\r\n    if (this.options.url) {\r\n      if (this.options.httpConnectionOptions) {\r\n        builder = builder.withUrl(\r\n          this.options.url,\r\n          this.options.httpConnectionOptions\r\n        );\r\n      } else if (this.options.transportType) {\r\n        builder = builder.withUrl(this.options.url, this.options.transportType);\r\n      } else {\r\n        builder = builder.withUrl(this.options.url);\r\n      }\r\n    }\r\n\r\n    if (this.options.reconnectPolicy) {\r\n      builder = builder.withAutomaticReconnect(this.options.reconnectPolicy);\r\n    } else if (this.options.retryDelays) {\r\n      builder = builder.withAutomaticReconnect(this.options.retryDelays);\r\n    } else if (this.options.automaticReconnect) {\r\n      builder = builder.withAutomaticReconnect();\r\n    }\r\n\r\n    if (this.options.protocol) {\r\n      builder = builder.withHubProtocol(this.options.protocol);\r\n    }\r\n\r\n    if (this.options.logging) {\r\n      builder = builder.configureLogging(this.options.logging);\r\n    }\r\n\r\n    this.connection = builder.build();\r\n    if (this.options.baseUrl) {\r\n      this.connection.baseUrl = this.options.baseUrl;\r\n    }\r\n\r\n    if (this.options.keepAliveIntervalInMilliseconds) {\r\n      this.connection.keepAliveIntervalInMilliseconds =\r\n        this.options.keepAliveIntervalInMilliseconds;\r\n    }\r\n\r\n    if (this.options.serverTimeoutInMilliseconds) {\r\n      this.connection.serverTimeoutInMilliseconds =\r\n        this.options.serverTimeoutInMilliseconds;\r\n    }\r\n\r\n    this.connection.onclose((error?: Error | undefined) => {\r\n      this.store.dispatch(new SignalRDisconnected(error));\r\n    });\r\n    this.connection.onreconnecting((error?: Error | undefined) => {\r\n      this.store.dispatch(new SignalRReconnecting(error));\r\n    });\r\n    this.connection.onreconnected((connectionId?: string | undefined) => {\r\n      this.store.dispatch(new SignalRReconnected(connectionId));\r\n    });\r\n  }\r\n\r\n  private setupHandlers(): void {\r\n    this.connection?.on('send', (message: Record<string, unknown>) => {\r\n      const type = message[this.typeKey];\r\n      if (!type) {\r\n        throw new TypeKeyPropertyMissingError(this.typeKey);\r\n      }\r\n      this.store.dispatch({ ...message, type });\r\n    });\r\n  }\r\n\r\n  private async connect(options?: SignalROptions): Promise<void> {\r\n    this.updateConnection();\r\n\r\n    // Users can pass the options in the connect method so\r\n    // if options aren't available at DI bootstrap they have access\r\n    // to pass them here\r\n    if (options) {\r\n      this.options = { ...this.options, ...options };\r\n    }\r\n\r\n    this.setupConnection();\r\n    this.setupHandlers();\r\n\r\n    try {\r\n      await this.connection?.start();\r\n      this.store.dispatch(new SignalRConnected());\r\n    } catch (err) {\r\n      this.store.dispatch(new SignalRMessageError(err));\r\n    }\r\n  }\r\n\r\n  private disconnect(): void {\r\n    if (this.connection) {\r\n      this.closeConnection();\r\n    }\r\n  }\r\n\r\n  private async send(name: string, data: unknown): Promise<void> {\r\n    if (this.connection?.state !== HubConnectionState.Connected) {\r\n      throw new Error(\r\n        'You must connect to the SignalR before sending any data'\r\n      );\r\n    }\r\n\r\n    await this.connection.send(name, data);\r\n  }\r\n\r\n  private async invoke(name: string, data: unknown): Promise<void> {\r\n    if (this.connection?.state !== HubConnectionState.Connected) {\r\n      throw new Error(\r\n        'You must connect to the SignalR before sending any data'\r\n      );\r\n    }\r\n\r\n    await this.connection.invoke(name, data);\r\n  }\r\n\r\n  private async stream(\r\n    name: string,\r\n    data: unknown\r\n  ): Promise<IStreamResult<Record<string, unknown>>> {\r\n    if (this.connection?.state !== HubConnectionState.Connected) {\r\n      throw new Error(\r\n        'You must connect to the SignalR before sending any data'\r\n      );\r\n    }\r\n\r\n    return this.connection.stream<Record<string, unknown>>(name, data);\r\n  }\r\n\r\n  /**\r\n   * To ensure we don't have any memory leaks\r\n   * e.g. if the user occasionally dispatched `ConnectWebSocket` twice\r\n   * then the previous subscription will still live in the memory\r\n   * to prevent such behavior - we close the previous connection if it exists\r\n   */\r\n  private updateConnection(): void {\r\n    if (this.connection) {\r\n      this.closeConnection();\r\n      this.store.dispatch(new SignalRConnectionUpdated());\r\n    }\r\n  }\r\n\r\n  private async closeConnection(): Promise<void> {\r\n    this.streamSubscriptions.forEach((s) => {\r\n      s.dispose();\r\n    });\r\n    this.streamSubscriptions = [];\r\n    if (this.connection !== null) {\r\n      await this.connection.stop();\r\n      this.connection = null;\r\n    }\r\n  }\r\n}\r\n","import { CommonModule } from '@angular/common';\r\nimport { InjectionToken, ModuleWithProviders, NgModule, inject, provideAppInitializer } from '@angular/core';\r\nimport { HttpTransportType, JsonHubProtocol } from '@microsoft/signalr';\r\n\r\nimport { SignalRHandler } from './signalr-handler';\r\nimport { NGXS_SIGNALR_OPTIONS, SignalROptions, noop } from './signalr-options';\r\n\r\nexport function signalrOptionsFactory(options: SignalROptions): SignalROptions {\r\n  return {\r\n    keepAliveIntervalInMilliseconds: 15000,\r\n    serverTimeoutInMilliseconds: 30000,\r\n    typeKey: 'type',\r\n    automaticReconnect: true,\r\n    transportType: HttpTransportType.WebSockets,\r\n    protocol: new JsonHubProtocol(),\r\n    ...options,\r\n  };\r\n}\r\n\r\nexport const NGXS_SIGNALR_USER_OPTIONS = new InjectionToken(\r\n  'NGXS_SIGNALR_USER_OPTIONS'\r\n);\r\n\r\n@NgModule({\r\n  imports: [CommonModule],\r\n})\r\nexport class NgxsSignalrPluginModule {\r\n  static forRoot(\r\n    options?: SignalROptions\r\n  ): ModuleWithProviders<NgxsSignalrPluginModule> {\r\n    return {\r\n      ngModule: NgxsSignalrPluginModule,\r\n      providers: [\r\n        SignalRHandler,\r\n        {\r\n          provide: NGXS_SIGNALR_USER_OPTIONS,\r\n          useValue: options,\r\n        },\r\n        {\r\n          provide: NGXS_SIGNALR_OPTIONS,\r\n          useFactory: signalrOptionsFactory,\r\n          deps: [NGXS_SIGNALR_USER_OPTIONS],\r\n        },\r\n        provideAppInitializer(() => {\n        const initializerFn = (noop)(inject(SignalRHandler));\n        return initializerFn();\n      }),\r\n      ],\r\n    };\r\n  }\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AACA;;AAEG;MACU,cAAc,CAAA;aACT,IAAI,CAAA,IAAA,GAAG,mBAAmB,CAAC;AAC3C,IAAA,WAAA,CAAmB,OAAwB,EAAA;QAAxB,IAAO,CAAA,OAAA,GAAP,OAAO;;;;ACN5B;;AAEG;MACU,iBAAiB,CAAA;aACrB,IAAI,CAAA,IAAA,GAAG,sBAAsB,CAAC;;;ACJvC;;AAEG;MACU,oBAAoB,CAAA;aACxB,IAAI,CAAA,IAAA,GAAG,0BAA0B,CAAC;IAEzC,WAAmB,CAAA,IAAY,EAAS,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