{"version":3,"file":"solace-community-angular-solace-message-client.mjs","sources":["../../../../projects/solace-message-client/src/lib/logger.ts","../../../../projects/solace-message-client/src/lib/solace-session-provider.ts","../../../../projects/solace-message-client/src/lib/solace-message-client.config.ts","../../../../projects/solace-message-client/src/lib/topic-matcher.ts","../../../../projects/solace-message-client/src/lib/topic-subscription-counter.ts","../../../../projects/solace-message-client/src/lib/serial-executor.service.ts","../../../../projects/solace-message-client/src/lib/ɵdestroy-ref.ts","../../../../projects/solace-message-client/src/lib/ɵsolace-message-client.ts","../../../../projects/solace-message-client/src/lib/solace-message-client.ts","../../../../projects/solace-message-client/src/lib/solace-message-client.provider.ts","../../../../projects/solace-message-client/src/solace-community-angular-solace-message-client.ts"],"sourcesContent":["import {EnvironmentProviders, inject, Injectable, makeEnvironmentProviders, Type} from '@angular/core';\nimport {LogLevel} from 'solclientjs';\n\n/**\n * Logger used by the Angular Solace Message Client.\n *\n * The default log level can be changed as follows:\n * - Change the log level programmatically by providing it under the DI token {@link LogLevel}:\n *   `{provide: LogLevel, useValue: LogLevel.DEBUG}`\n * - Change the log level at runtime via session storage by adding the following entry and then reloading the application:\n *   key:   `angular-solace-message-client#loglevel`\n *   value: `debug` // supported values are: trace | debug | info | warn | error | fatal\n */\n@Injectable()\nexport class Logger {\n\n  public readonly logLevel = this.readLogLevelFromSessionStorage(inject(LogLevel as unknown as Type<LogLevel>));\n\n  public debug(...data: any[]): void {\n    if (this.logLevel >= LogLevel.DEBUG) {\n      console.debug(...this.addLogPrefix(data));\n    }\n  }\n\n  public info(...data: any[]): void {\n    if (this.logLevel >= LogLevel.INFO) {\n      console.info(...this.addLogPrefix(data));\n    }\n  }\n\n  public warn(...data: any[]): void {\n    if (this.logLevel >= LogLevel.WARN) {\n      console.warn(...this.addLogPrefix(data));\n    }\n  }\n\n  public error(...data: any[]): void {\n    if (this.logLevel >= LogLevel.ERROR) {\n      console.error(...this.addLogPrefix(data));\n    }\n  }\n\n  private addLogPrefix(args: unknown[]): unknown[] {\n    return [`[SolaceMessageClient] ${args[0]}`, ...args.slice(1)];\n  }\n\n  private readLogLevelFromSessionStorage(defaultLogLevel: LogLevel): LogLevel {\n    const level = sessionStorage.getItem('angular-solace-message-client#loglevel');\n    switch (level) {\n      case 'trace':\n        return LogLevel.TRACE;\n      case 'debug':\n        return LogLevel.DEBUG;\n      case 'info':\n        return LogLevel.INFO;\n      case 'warn':\n        return LogLevel.WARN;\n      case 'error':\n        return LogLevel.ERROR;\n      case 'fatal':\n        return LogLevel.FATAL;\n      default:\n        return defaultLogLevel;\n    }\n  }\n}\n\n/**\n * Registers a set of DI providers to enable logging in the Angular Solace Message Client.\n */\nexport function provideLogger(logLevel: LogLevel): EnvironmentProviders {\n  return makeEnvironmentProviders([\n    Logger,\n    // Provide inherited 'LogLevel' or provide default LogLevel otherwise.\n    {provide: LogLevel, useFactory: () => inject(LogLevel as unknown as Type<LogLevel>, {skipSelf: true, optional: true}) ?? logLevel},\n  ]);\n}\n","import {inject, Injectable} from '@angular/core';\nimport {Session, SessionProperties, SolclientFactory, SolclientFactoryProfiles, SolclientFactoryProperties} from 'solclientjs';\nimport {Logger} from './logger';\n\n/**\n * Creates a {@link Session} from a given config to connect to the Solace message broker.\n *\n * You may override the default session provider in order to customize session construction, e.g., in tests, as following:\n * `{provide: SolaceSessionProvider, useClass: YourSessionProvider}`\n *\n * The default provider does the following: `solace.SolclientFactory.createSession(sessionProperties)`.\n */\n@Injectable()\nexport abstract class SolaceSessionProvider {\n\n  /**\n   * Method invoked to create a {@link Session} from given properties.\n   */\n  public abstract provide(sessionProperties: SessionProperties): Session;\n}\n\n/**\n * @docs-private\n */\n@Injectable()\nexport class ɵSolaceSessionProvider implements SolaceSessionProvider {\n\n  constructor() {\n    const factoryProperties = new SolclientFactoryProperties();\n    factoryProperties.profile = SolclientFactoryProfiles.version10_5;\n    factoryProperties.logLevel = inject(Logger).logLevel;\n    SolclientFactory.init(factoryProperties);\n  }\n\n  public provide(sessionProperties: SessionProperties): Session {\n    return SolclientFactory.createSession(sessionProperties);\n  }\n}\n","import {SessionProperties} from 'solclientjs';\nimport {InjectionToken} from '@angular/core';\nimport {OAuthAccessTokenFn} from './oauth-access-token-provider';\nimport {Observable} from 'rxjs';\n\n/**\n * DI token to inject the config of Angular Solace Message Client.\n */\nexport const SOLACE_MESSAGE_CLIENT_CONFIG = new InjectionToken<SolaceMessageClientConfig | SolaceMessageClientConfigFn>('SOLACE_MESSAGE_CLIENT_CONFIG');\n\n/**\n * Configures the {@link SolaceMessageClient} to connect to the Solace message broker.\n */\nexport interface SolaceMessageClientConfig extends Omit<SessionProperties, 'accessToken'> {\n  /**\n   * Specifies the access token for OAuth 2.0 authentication.\n   *\n   * Property is ignored if not using OAuth 2.0 authentication scheme.\n   *\n   * @see {@link OAuthAccessTokenFn}\n   */\n  accessToken?: string | OAuthAccessTokenFn;\n}\n\n/**\n * Signature of a function to load the config of Angular Solace Message Client.\n *\n * The function can call `inject` to get any required dependencies.\n */\nexport type SolaceMessageClientConfigFn = () => SolaceMessageClientConfig | Promise<SolaceMessageClientConfig> | Observable<SolaceMessageClientConfig>;\n","/**\n * Matches exact topics as used when publishing messages against subscription topics.\n *\n * This class implements the rules for 'Wildcard Characters in SMF Topic Subscriptions',\n * as outlined here: https://docs.solace.com/Messaging/Wildcard-Charaters-Topic-Subs.htm.\n */\nexport class TopicMatcher {\n\n  private readonly _subscriptionTopic: string[];\n\n  constructor(subscriptionTopic: string) {\n    this._subscriptionTopic = parseSubscriptionTopic(subscriptionTopic);\n  }\n\n  public matches(topic: string | undefined): boolean {\n    if (!topic) {\n      return false;\n    }\n    const testeeSegments = topic.split('/');\n    const subscriptionSegments = this._subscriptionTopic;\n\n    for (let i = 0; i < subscriptionSegments.length; i++) {\n      const subscriptionTopicSegment = subscriptionSegments[i]!;\n      const testee = testeeSegments[i];\n      const isLastSubscriptionTopicSegment = (i === subscriptionSegments.length - 1);\n\n      if (testee === undefined) {\n        return false;\n      }\n\n      if (subscriptionTopicSegment === '>' && isLastSubscriptionTopicSegment) {\n        return true;\n      }\n\n      if (subscriptionTopicSegment === '*') {\n        continue;\n      }\n\n      if (subscriptionTopicSegment.endsWith('*') && testee.startsWith(subscriptionTopicSegment.slice(0, -1))) {\n        continue;\n      }\n\n      if (subscriptionTopicSegment !== testee) {\n        return false;\n      }\n    }\n    return testeeSegments.length === subscriptionSegments.length;\n  }\n}\n\n/**\n * Parses the subscription topic, removing #noexport and #share segments, if any.\n */\nfunction parseSubscriptionTopic(topic: string): string[] {\n  const segments = topic.split('/');\n\n  // Remove #noexport segment, if any. See https://docs.solace.com/Messaging/No-Export.htm\n  // Example: #noexport/#share/ShareName/topicFilter, #noexport/topicFilter\n  if (segments[0] === '#noexport') {\n    segments.shift();\n  }\n\n  // Remove #share segments, if any. See https://docs.solace.com/Messaging/Direct-Msg/Direct-Messages.htm\n  // Examples: #share/<ShareName>/<topicFilter>\n  if (segments[0] === '#share') {\n    segments.shift(); // removes #share segment\n    segments.shift(); // removes share name segment\n  }\n  return segments;\n}\n","import {Destination} from 'solclientjs';\n\n/**\n * Maintains the subscription count per topic.\n */\nexport class TopicSubscriptionCounter {\n\n  private _subscriptionCounts = new Map<string, number>();\n\n  public incrementAndGet(topic: string | Destination): number {\n    const topicName = coerceTopicName(topic);\n    const count = (this._subscriptionCounts.get(topicName) ?? 0) + 1;\n    this._subscriptionCounts.set(topicName, count);\n    return count;\n  }\n\n  public decrementAndGet(topic: string | Destination): number {\n    const topicName = coerceTopicName(topic);\n    const count = Math.max(0, (this._subscriptionCounts.get(topicName) ?? 0) - 1);\n    if (count === 0) {\n      this._subscriptionCounts.delete(topicName);\n    }\n    else {\n      this._subscriptionCounts.set(topicName, count);\n    }\n    return count;\n  }\n\n  public destroy(): void {\n    this._subscriptionCounts.clear();\n  }\n}\n\nfunction coerceTopicName(topic: string | Destination): string {\n  if (typeof topic === 'string') {\n    return topic;\n  }\n  return topic.getName();\n}\n","import {Subject} from 'rxjs';\nimport {catchError, mergeMap, takeUntil} from 'rxjs/operators';\nimport {Logger} from './logger';\n\nexport type Task<T> = () => Promise<T>;\n\n/**\n * Allows the mutual exclusive execution of tasks.\n *\n * Scheduled tasks are executed sequentially, one at a time, until all tasks have executed.\n * A task completed execution when its Promise resolved or rejected.\n */\nexport class SerialExecutor {\n\n  private _destroy$ = new Subject<void>();\n  private _tasks$ = new Subject<Task<any>>();\n\n  constructor(logger: Logger) {\n    this._tasks$\n      .pipe(\n        mergeMap(task => task(), 1), // serialize execution\n        catchError((error, caught) => {\n          logger.error('Unexpected: ', error);\n          return caught;\n        }),\n        takeUntil(this._destroy$),\n      )\n      .subscribe();\n  }\n\n  /**\n   * Schedules the given task for serial execution.\n   * The task will be executed after all previously scheduled tasks have finished execution.\n   *\n   * @return Promise that resolves to the task's return value when it finished execution, or\n   *         that rejects when the taks's Promise rejects.\n   */\n  public scheduleSerial<T>(task: Task<T>): Promise<T> {\n    return new Promise<T>((resolve, reject) => {\n      this._tasks$.next(() => task().then(resolve).catch(reject));\n    });\n  }\n\n  public destroy(): void {\n    this._destroy$.next();\n  }\n}\n","/*\n * Copyright (c) 2018-2023 Swiss Federal Railways\n *\n * This program and the accompanying materials are made\n * available under the terms of the Eclipse Public License 2.0\n * which is available at https://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier: EPL-2.0\n */\n\nimport {DestroyRef, inject} from '@angular/core';\nimport {noop} from 'rxjs';\n\n/**\n * Implementation of {@link DestroyRef} that can be manually disposed.\n *\n * Binds to the {@link DestroyRef} of the current injection context if constructed inside an injection context.\n */\nexport class ɵDestroyRef implements DestroyRef {\n\n  private _callbacks = new Set<() => void>();\n  private _destroyed = false;\n\n  constructor() {\n    inject(DestroyRef, {optional: true})?.onDestroy(() => this.destroy());\n  }\n\n  public onDestroy(callback: () => void): () => void {\n    if (this._destroyed) {\n      callback();\n      return noop;\n    }\n\n    this._callbacks.add(callback);\n    return () => this._callbacks.delete(callback);\n  }\n\n  public destroy(): void {\n    this._callbacks.forEach(callback => callback());\n    this._callbacks.clear();\n    this._destroyed = true;\n  }\n\n  public get destroyed(): boolean {\n    return this._destroyed;\n  }\n}\n","import {assertInInjectionContext, inject, Injectable, Injector, NgZone, runInInjectionContext} from '@angular/core';\nimport {EMPTY, EmptyError, firstValueFrom, merge, MonoTypeOperatorFunction, noop, Observable, Observer, of, OperatorFunction, ReplaySubject, share, shareReplay, skip, Subject, TeardownLogic, throwError} from 'rxjs';\nimport {distinctUntilChanged, filter, finalize, map, mergeMap, take, takeUntil, tap} from 'rxjs/operators';\nimport {UUID} from '@scion/toolkit/uuid';\nimport {ConsumeOptions, Data, MessageEnvelope, ObserveOptions, PublishOptions, RequestOptions, SolaceMessageClient} from './solace-message-client';\nimport {TopicMatcher} from './topic-matcher';\nimport {observeIn, subscribeIn} from '@scion/toolkit/operators';\nimport {SolaceSessionProvider} from './solace-session-provider';\nimport {SOLACE_MESSAGE_CLIENT_CONFIG, SolaceMessageClientConfig} from './solace-message-client.config';\nimport {AuthenticationScheme, Destination, Message, MessageConsumer, MessageConsumerEventName, MessageConsumerProperties, MessageDeliveryModeType, OperationError, QueueBrowser, QueueBrowserEventName, QueueBrowserProperties, QueueDescriptor, QueueType, RequestError, SDTField, SDTFieldType, SDTMapContainer, Session, SessionEvent, SessionEventCode, SessionProperties as SolaceSessionProperties, SolclientFactory} from 'solclientjs';\nimport {TopicSubscriptionCounter} from './topic-subscription-counter';\nimport {SerialExecutor} from './serial-executor.service';\nimport {Logger} from './logger';\nimport {takeUntilDestroyed} from '@angular/core/rxjs-interop';\nimport {Observables} from '@scion/toolkit/util';\nimport {ɵDestroyRef} from './ɵdestroy-ref';\n\n@Injectable()\nexport class ɵSolaceMessageClient implements SolaceMessageClient {\n\n  public readonly connected$: Observable<boolean>;\n\n  private readonly _sessionProvider = inject(SolaceSessionProvider);\n  private readonly _injector = inject(Injector);\n  private readonly _logger = inject(Logger);\n  private readonly _zone = inject(NgZone);\n  private readonly _destroyRef = new ɵDestroyRef();\n\n  private readonly _message$ = new Subject<Message>();\n  private readonly _event$ = new Subject<SessionEvent>();\n\n  private _session: Promise<Session> | null = null;\n  private _subscriptionExecutor: SerialExecutor | null = null;\n  private _subscriptionCounter: TopicSubscriptionCounter | null = null;\n\n  constructor() {\n    this.disposeWhenSolaceSessionDied();\n    this.logSolaceSessionEvents();\n    this.connected$ = this.monitorConnectionState$();\n\n    // Connect to the Solace Message Broker.\n    this._session = this.loadConfig()\n      .then(config => {\n        this._logger.debug('Connecting to Solace message broker:', obfuscateSecrets(config));\n        return this.createSession(config);\n      })\n      .catch((error: unknown) => {\n        this._logger.error('Failed to connect to the Solace message broker.', error);\n        return Promise.reject(error); // eslint-disable-line @typescript-eslint/prefer-promise-reject-errors\n      });\n    this._destroyRef.onDestroy(() => void this.dispose());\n  }\n\n  /**\n   * Creates a Solace session based on the passed configuration.\n   *\n   * @return Promise that resolves to the {@link Session} when connected to the broker, or that rejects if the connection attempt failed.\n   */\n  private createSession(config: SolaceMessageClientConfig): Promise<Session> {\n    return new Promise<Session>((resolve, reject) => void this._zone.runOutsideAngular(async () => {\n      this._subscriptionExecutor = new SerialExecutor(this._logger);\n      this._subscriptionCounter = new TopicSubscriptionCounter();\n\n      // If using OAUTH2 authentication scheme, create access token Observable to continuously inject a valid access token into the Solace session.\n      const oAuth2Scheme = config.authenticationScheme === AuthenticationScheme.OAUTH2;\n      const accessToken$: Observable<string> | null = oAuth2Scheme ? provideOAuthAccessToken$(config, {injector: this._injector}).pipe(shareReplay({bufferSize: 1, refCount: false})) : null;\n\n      // If using OAUTH2 authentication scheme, set the initial access token via session properties.\n      if (accessToken$) {\n        config.accessToken = await firstValueFrom(accessToken$.pipe(subscribeIn(fn => this._zone.run(fn)))).catch(mapEmptyError(() => Error('[EmptyAccessTokenError] Access token Observable has completed without emitted an access token.')));\n      }\n\n      // Create the Solace session.\n      const session: Session = this._sessionProvider.provide(new SolaceSessionProperties(config));\n\n      // Provide the session with a valid \"OAuth 2.0 Access Token\".\n      // The Observable is expected to never complete and continuously emit a renewed token short before expiration of the previously emitted token.\n      accessToken$?.pipe(\n        skip(1), // initial access token is set via session properties\n        takeUntilDestroyed(this._destroyRef),\n      ).subscribe({\n        next: accessToken => {\n          this._logger.debug('Injecting \"OAuth 2.0 Access Token\" into Solace session.', accessToken);\n          session.updateAuthenticationOnReconnect({accessToken});\n        },\n        complete: () => {\n          if (this._session) {\n            this._logger.warn('[AccessTokenProviderCompletedWarning] Observable providing access token(s) to the Solace session has completed. The Observable should NEVER complete and continuously emit the renewed token short before expiration of the previously emitted token. Otherwise, the connection to the broker would not be re-established in the event of a network interruption.');\n          }\n        },\n        error: error => {\n          this._logger.error(error);\n        },\n      });\n\n      // When the Session is ready to send/receive messages and perform control operations.\n      session.on(SessionEventCode.UP_NOTICE, (event: SessionEvent) => {\n        this._event$.next(event);\n        this._logger.debug('Connected to Solace message broker.', obfuscateSecrets(config));\n        resolve(session);\n      });\n\n      // When the session has gone down, and an automatic reconnection attempt is in progress.\n      session.on(SessionEventCode.RECONNECTED_NOTICE, (event: SessionEvent) => this._event$.next(event));\n\n      // Emits when the session was established and then went down.\n      session.on(SessionEventCode.DOWN_ERROR, (event: SessionEvent) => this._event$.next(event));\n\n      // Emits when the session attempted to connect but was unsuccessful.\n      session.on(SessionEventCode.CONNECT_FAILED_ERROR, (event: SessionEvent) => {\n        this._event$.next(event);\n        reject(event); // eslint-disable-line @typescript-eslint/prefer-promise-reject-errors\n      });\n\n      // When the session connect operation failed, or the session that was once up, is now disconnected.\n      session.on(SessionEventCode.DISCONNECTED, (event: SessionEvent) => this._event$.next(event));\n\n      // When the session has gone down, and an automatic reconnection attempt is in progress.\n      session.on(SessionEventCode.RECONNECTING_NOTICE, (event: SessionEvent) => this._event$.next(event));\n\n      // When a direct message was received on the session.\n      session.on(SessionEventCode.MESSAGE, (message: Message): void => this._message$.next(message));\n\n      // When a subscribe or unsubscribe operation succeeded.\n      session.on(SessionEventCode.SUBSCRIPTION_OK, (event: SessionEvent) => this._event$.next(event));\n\n      // When a subscribe or unsubscribe operation was rejected by the broker.\n      session.on(SessionEventCode.SUBSCRIPTION_ERROR, (event: SessionEvent) => this._event$.next(event));\n\n      // When a message published with a guaranteed message delivery strategy, that is {@link MessageDeliveryModeType.PERSISTENT} or {@link MessageDeliveryModeType.NON_PERSISTENT}, was acknowledged by the router.\n      session.on(SessionEventCode.ACKNOWLEDGED_MESSAGE, (event: SessionEvent) => this._event$.next(event));\n\n      // When a message published with a guaranteed message delivery strategy, that is {@link MessageDeliveryModeType.PERSISTENT} or {@link MessageDeliveryModeType.NON_PERSISTENT}, was rejected by the router.\n      session.on(SessionEventCode.REJECTED_MESSAGE_ERROR, (event: SessionEvent) => this._event$.next(event));\n\n      session.connect();\n    }).catch((error: unknown) => reject(error as Error)));\n  }\n\n  /**\n   * Disposes the Solace session, disconnecting this client from the Solace message broker. Has no effect if already disposed.\n   *\n   * Messages cannot be received or published after disposing the session.\n   *\n   * @param options - Controls disposal of the Solace session.\n   * @param options.force - Controls if to first disconnect from the broker before destroying the Solace session,\n   *                        enabling graceful shutdown of the connnection for the broker to clean up resources.\n   *                        Defaults to `false`.\n   * @return A Promise that resolves when disposed the session.\n   */\n  public async dispose(options?: {force?: true}): Promise<void> {\n    const session = await this._session?.catch(noop); // do not error on dispose\n    if (!session) {\n      return;\n    }\n\n    this._session = null;\n\n    // Disconnect from broker.\n    const force = options?.force ?? false;\n    if (!force) {\n      try {\n        const whenDisconnected = this.whenEvent(SessionEventCode.DISCONNECTED);\n        session.disconnect();\n        await whenDisconnected;\n      }\n      catch (error) {\n        this._logger.warn('Failed to gracefully disconnect from the Solace Message Broker. Disposing the Solace session.', error);\n      }\n    }\n\n    // Dispose session.\n    try {\n      session.dispose();\n    }\n    finally {\n      this._subscriptionExecutor?.destroy();\n      this._subscriptionExecutor = null;\n\n      this._subscriptionCounter?.destroy();\n      this._subscriptionCounter = null;\n\n      this._destroyRef.destroy();\n    }\n  }\n\n  public observe$(topic: string, options?: ObserveOptions): Observable<MessageEnvelope> {\n    return new Observable((observer: Observer<MessageEnvelope>): TeardownLogic => {\n      const unsubscribe$ = new Subject<void>();\n      const topicDestination = createSubscriptionTopicDestination(topic);\n      const topicMatcher = new TopicMatcher(topicDestination.getName());\n\n      // Wait until initialized the session so that 'subscriptionExecutor' and 'subscriptionCounter' are initialized.\n      this.session\n        .then(() => {\n          const subscribeError$ = new Subject<never>();\n          let subscriptionErrored = false;\n\n          // Filter messages sent to the given topic.\n          merge(this._message$, subscribeError$)\n            .pipe(\n              assertNotInAngularZone(),\n              filter(message => topicMatcher.matches(message.getDestination()?.getName())),\n              mapToMessageEnvelope(topic),\n              synchronizeNgZone(this._zone),\n              takeUntilDestroyed(this._destroyRef),\n              takeUntil(unsubscribe$),\n              finalize(() => {\n                // Unsubscribe from the topic on the Solace session, but only if being the last subscription on that topic and if successfully subscribed to the Solace broker.\n                if (this._subscriptionCounter?.decrementAndGet(topicDestination) === 0 && !subscriptionErrored) {\n                  void this.unsubscribeFromTopic(topicDestination);\n                }\n              }),\n            )\n            .subscribe(observer);\n\n          // Subscribe to the topic on the Solace session, but only if being the first subscription on that topic.\n          if (this._subscriptionCounter!.incrementAndGet(topicDestination) === 1) {\n            void this.subscribeToTopic(topicDestination, options).then(success => {\n              if (success) {\n                options?.onSubscribed?.();\n              }\n              else {\n                subscriptionErrored = true;\n                subscribeError$.error(`Failed to subscribe to topic ${topicDestination.getName()}.`);\n              }\n            });\n          }\n          else {\n            options?.onSubscribed?.();\n          }\n        })\n        .catch((error: unknown) => {\n          observer.error(error);\n        });\n\n      return (): void => unsubscribe$.next();\n    });\n  }\n\n  /**\n   * Subscribes to the given topic on the Solace session.\n   */\n  private subscribeToTopic(topic: Destination, observeOptions?: ObserveOptions): Promise<boolean> {\n    // Calls to `solace.Session.subscribe` and `solace.Session.unsubscribe` must be executed one after the other until the Solace Broker confirms\n    // the operation. Otherwise a previous unsubscribe may cancel a later subscribe on the same topic.\n    return this._subscriptionExecutor!.scheduleSerial(async () => {\n      try {\n        // IMPORTANT: Do not subscribe when the session is down, that is, after received a DOWN_ERROR. Otherwise, solclientjs would crash.\n        // When the session is down, the session Promise resolves to `null`.\n        const session = await this._session;\n        if (!session) {\n          return false;\n        }\n\n        const subscribeCorrelationKey = UUID.randomUUID();\n        const whenSubscribed = this.whenEvent(SessionEventCode.SUBSCRIPTION_OK, {rejectOnEvent: SessionEventCode.SUBSCRIPTION_ERROR, correlationKey: subscribeCorrelationKey})\n          .then(() => true)\n          .catch((event: unknown) => {\n            this._logger.warn(`Solace event broker rejected subscription on topic ${topic.getName()}.`, event);\n            return false;\n          });\n\n        session.subscribe(\n          topic,\n          true,\n          subscribeCorrelationKey,\n          observeOptions?.subscribeTimeout,\n        );\n        return await whenSubscribed;\n      }\n      catch {\n        return false;\n      }\n    });\n  }\n\n  /**\n   * Unsubscribes from the given topic on the Solace session.\n   */\n  private unsubscribeFromTopic(topic: Destination): Promise<boolean> {\n    // Calls to `solace.Session.subscribe` and `solace.Session.unsubscribe` must be executed one after the other until the Solace Broker confirms\n    // the operation. Otherwise a previous unsubscribe may cancel a later subscribe on the same topic.\n    return this._subscriptionExecutor!.scheduleSerial(async () => {\n      try {\n        // IMPORTANT: Do not unsubscribe when the session is down, that is, after received a DOWN_ERROR. Otherwise, solclientjs would crash.\n        // When the session is down, the session Promise resolves to `null`.\n        const session = await this._session;\n        if (!session) {\n          return false;\n        }\n\n        const unsubscribeCorrelationKey = UUID.randomUUID();\n        const whenUnsubscribed = this.whenEvent(SessionEventCode.SUBSCRIPTION_OK, {rejectOnEvent: SessionEventCode.SUBSCRIPTION_ERROR, correlationKey: unsubscribeCorrelationKey})\n          .then(() => true)\n          .catch((error: unknown) => {\n            this._logger.warn(`Solace event broker rejected unsubscription on topic ${topic.getName()}.`, error);\n            return false;\n          });\n\n        session.unsubscribe(\n          topic,\n          true,\n          unsubscribeCorrelationKey,\n          undefined,\n        );\n        return await whenUnsubscribed;\n      }\n      catch {\n        return false;\n      }\n    });\n  }\n\n  public consume$(topicOrDescriptor: string | (MessageConsumerProperties & ConsumeOptions)): Observable<MessageEnvelope> {\n    // If passed a `string` literal, subscribe to a non-durable topic endpoint.\n    if (typeof topicOrDescriptor === 'string') {\n      return this.createMessageConsumer$({\n        topicEndpointSubscription: SolclientFactory.createTopicDestination(topicOrDescriptor),\n        queueDescriptor: new QueueDescriptor({type: QueueType.TOPIC_ENDPOINT, durable: false}),\n      });\n    }\n\n    return this.createMessageConsumer$(topicOrDescriptor);\n  }\n\n  private createMessageConsumer$(consumerProperties: MessageConsumerProperties & ConsumeOptions): Observable<MessageEnvelope> {\n    const topicEndpointSubscription = consumerProperties.topicEndpointSubscription?.getName();\n    if (topicEndpointSubscription) {\n      consumerProperties.topicEndpointSubscription = createSubscriptionTopicDestination(consumerProperties.topicEndpointSubscription!.getName());\n    }\n\n    return new Observable((observer: Observer<Message>): TeardownLogic => {\n      let messageConsumer: MessageConsumer | undefined;\n      this.session\n        .then(session => {\n          messageConsumer = session.createMessageConsumer(consumerProperties);\n\n          // Define message consumer event listeners\n          messageConsumer.on(MessageConsumerEventName.UP, () => {\n            this._logger.debug(`MessageConsumerEvent: UP`);\n            consumerProperties.onSubscribed?.(messageConsumer!);\n          });\n          messageConsumer.on(MessageConsumerEventName.CONNECT_FAILED_ERROR, (error: OperationError) => {\n            this._logger.debug(`MessageConsumerEvent: CONNECT_FAILED_ERROR`, error);\n            observer.error(error);\n          });\n          messageConsumer.on(MessageConsumerEventName.DOWN_ERROR, (error: OperationError) => {\n            this._logger.debug(`MessageConsumerEvent: DOWN_ERROR`, error);\n            observer.error(error);\n          });\n          messageConsumer.on(MessageConsumerEventName.DOWN, () => { // event emitted after successful disconnect request\n            this._logger.debug(`MessageConsumerEvent: DOWN`);\n            messageConsumer?.dispose();\n            observer.complete();\n          });\n\n          // Define message event listener\n          messageConsumer.on(MessageConsumerEventName.MESSAGE, (message: Message) => {\n            this._logger.debug(`MessageConsumerEvent: MESSAGE`, message);\n            NgZone.assertNotInAngularZone();\n            observer.next(message);\n          });\n\n          // Connect the message consumer\n          messageConsumer.connect();\n        })\n        .catch((error: unknown) => {\n          observer.error(error);\n          messageConsumer?.dispose();\n        });\n\n      return (): void => {\n        // Initiate an orderly disconnection of the consumer. In turn, we will receive a `MessageConsumerEventName#DOWN` event and dispose the consumer.\n        if (messageConsumer && !messageConsumer.disposed) {\n          messageConsumer.disconnect();\n        }\n      };\n    })\n      .pipe(\n        mapToMessageEnvelope(topicEndpointSubscription),\n        synchronizeNgZone(this._zone),\n      );\n  }\n\n  public browse$(queueOrDescriptor: string | QueueBrowserProperties): Observable<MessageEnvelope> {\n    // If passed a `string` literal, connect to the given queue using default 'browsing' options.\n    if (typeof queueOrDescriptor === 'string') {\n      return this.createQueueBrowser$({\n        queueDescriptor: new QueueDescriptor({type: QueueType.QUEUE, name: queueOrDescriptor}),\n      });\n    }\n\n    return this.createQueueBrowser$(queueOrDescriptor);\n  }\n\n  private createQueueBrowser$(queueBrowserProperties: QueueBrowserProperties): Observable<MessageEnvelope> {\n    return new Observable((observer: Observer<Message>): TeardownLogic => {\n      let queueBrowser: QueueBrowser | undefined;\n      let disposed = false;\n      this.session\n        .then(session => {\n          queueBrowser = session.createQueueBrowser(queueBrowserProperties);\n\n          // Define browser event listeners\n          queueBrowser.on(QueueBrowserEventName.UP, () => {\n            this._logger.debug(`QueueBrowserEvent: UP`);\n            queueBrowser!.start();\n          });\n          queueBrowser.on(QueueBrowserEventName.CONNECT_FAILED_ERROR, (error: OperationError) => {\n            this._logger.debug(`QueueBrowserEvent: CONNECT_FAILED_ERROR`, error);\n            observer.error(error);\n          });\n          queueBrowser.on(QueueBrowserEventName.DOWN_ERROR, (error: OperationError) => {\n            this._logger.debug(`QueueBrowserEvent: DOWN_ERROR`, error);\n            observer.error(error);\n          });\n          queueBrowser.on(QueueBrowserEventName.DOWN, () => { // event emitted after successful disconnect request\n            this._logger.debug(`QueueBrowserEvent: DOWN`);\n            observer.complete();\n          });\n          queueBrowser.on(QueueBrowserEventName.DISPOSED, () => {\n            this._logger.debug(`QueueBrowserEvent: DOWN`);\n            disposed = true;\n            observer.complete();\n          });\n\n          // Define browser event listener\n          queueBrowser.on(QueueBrowserEventName.MESSAGE, (message: Message) => {\n            this._logger.debug(`QueueBrowserEvent: MESSAGE`, message);\n            NgZone.assertNotInAngularZone();\n            observer.next(message);\n          });\n\n          // Connect the browser\n          queueBrowser.connect();\n        })\n        .catch((error: unknown) => {\n          observer.error(error);\n        });\n\n      return (): void => {\n        // Initiate an orderly disconnection of the browser. In turn, we will receive a `QueueBrowserEventName#DOWN` event and dispose the consumer.\n        if (queueBrowser && !disposed) {\n          queueBrowser.stop();\n          queueBrowser.disconnect();\n        }\n      };\n    })\n      .pipe(\n        mapToMessageEnvelope(),\n        synchronizeNgZone(this._zone),\n      );\n  }\n\n  public publish(destination: string | Destination, data?: Data | Message, options?: PublishOptions): Promise<void> {\n    const solaceDestination = typeof destination === 'string' ? SolclientFactory.createTopicDestination(destination) : destination;\n    const send: Send = (session: Session, message: Message) => session.send(message);\n    return this.sendMessage(solaceDestination, data, options, send);\n  }\n\n  public request$(destination: string | Destination, data?: Data | Message, options?: RequestOptions): Observable<MessageEnvelope> {\n    const solaceDestination = typeof destination === 'string' ? SolclientFactory.createTopicDestination(destination) : destination;\n\n    return new Observable<MessageEnvelope>(observer => {\n      const unsubscribe$ = new Subject<void>();\n      const response$ = new Subject<Message>();\n      response$\n        .pipe(\n          assertNotInAngularZone(),\n          mapToMessageEnvelope(),\n          synchronizeNgZone(this._zone),\n          takeUntil(unsubscribe$),\n        )\n        .subscribe(observer);\n\n      const onResponse = (session: Session, message: Message): void => {\n        response$.next(message);\n        response$.complete();\n      };\n      const onError = (session: Session, error: RequestError): void => {\n        response$.error(error);\n      };\n\n      const send: Send = (session: Session, request: Message) => {\n        session.sendRequest(request, options?.requestTimeout, onResponse, onError);\n      };\n      this.sendMessage(solaceDestination, data, options, send).catch((error: unknown) => response$.error(error));\n\n      return () => unsubscribe$.next();\n    });\n  }\n\n  public reply(request: Message, data?: Data | Message, options?: PublishOptions): Promise<void> {\n    // \"solclientjs\" marks the message as 'reply' and copies 'replyTo' destination and 'correlationId' from the request.\n    const send: Send = (session: Session, message: Message) => session.sendReply(request, message);\n    return this.sendMessage(null, data, options, send);\n  }\n\n  private async sendMessage(destination: Destination | null, data: Data | Message | undefined, options: PublishOptions | undefined, send: Send): Promise<void> {\n    const message: Message = data instanceof Message ? data : SolclientFactory.createMessage();\n\n    // Set the destination. May not be set if replying to a request.\n    if (destination) {\n      message.setDestination(destination);\n    }\n\n    // Set data, either as unstructured byte data, or as structured container if passed a structured data type (SDT).\n    if (data !== undefined && !(data instanceof Message)) {\n      if (data instanceof SDTField) {\n        message.setSdtContainer(data);\n      }\n      else {\n        message.setBinaryAttachment(data);\n      }\n    }\n\n    // Apply publish options.\n    if (options) {\n      message.setDeliveryMode(options.deliveryMode ?? message.getDeliveryMode());\n      message.setCorrelationId(options.correlationId ?? message.getCorrelationId());\n      message.setPriority(options.priority ?? message.getPriority());\n      message.setTimeToLive(options.timeToLive ?? message.getTimeToLive());\n      message.setDMQEligible(options.dmqEligible ?? message.isDMQEligible());\n      message.setCorrelationKey(options.correlationKey ?? message.getCorrelationKey());\n      options.replyTo && message.setReplyTo(options.replyTo);\n      message.setAsReplyMessage(options.markAsReply ?? message.isReplyMessage());\n    }\n\n    // Add headers.\n    if (options?.headers?.size) {\n      const userPropertyMap = (message.getUserPropertyMap() ?? new SDTMapContainer());\n      options.headers.forEach((value, key) => {\n        if (value === undefined || value === null) { // eslint-disable-line @typescript-eslint/no-unnecessary-condition\n          return;\n        }\n        if (value instanceof SDTField) {\n          const sdtField = value;\n          userPropertyMap.addField(key, sdtField.getType(), sdtField.getValue());\n        }\n        else if (typeof value === 'string') {\n          userPropertyMap.addField(key, SDTFieldType.STRING, value);\n        }\n        else if (typeof value === 'boolean') {\n          userPropertyMap.addField(key, SDTFieldType.BOOL, value);\n        }\n        else if (typeof value === 'number') {\n          userPropertyMap.addField(key, SDTFieldType.INT32, value);\n        }\n        else {\n          userPropertyMap.addField(key, SDTFieldType.UNKNOWN, value);\n        }\n      });\n      message.setUserPropertyMap(userPropertyMap);\n    }\n\n    // Allow intercepting the message before sending it to the broker.\n    options?.intercept?.(message);\n\n    const session = await this.session;\n\n    // Publish the message.\n    if (message.getDeliveryMode() === MessageDeliveryModeType.DIRECT) {\n      send(session, message);\n    }\n    else {\n      const correlationKey = message.getCorrelationKey() ?? UUID.randomUUID();\n      const whenAcknowledged = this.whenEvent(SessionEventCode.ACKNOWLEDGED_MESSAGE, {rejectOnEvent: SessionEventCode.REJECTED_MESSAGE_ERROR, correlationKey: correlationKey});\n      message.setCorrelationKey(correlationKey);\n      send(session, message);\n      // Resolve the Promise when acknowledged by the broker, or reject it otherwise.\n      await whenAcknowledged;\n    }\n  }\n\n  public get session(): Promise<Session> {\n    return this._session ?? Promise.reject(Error('Not connected to the Solace message broker. Did you forget to provide the `SolaceMessageClient` via `provideSolaceMessageClient()` function or to invoke \\'connect\\'`?'));\n  }\n\n  /**\n   * Returns a Promise that resolves to the event when the expected event occurs, or that rejects when the specified `rejectOnEvent` event, if specified, occurs.\n   * If a \"correlation key\" is specified, only events with that correlation key will be evaluated.\n   *\n   * Note that:\n   * - the Promise resolves or rejects outside the Angular zone\n   * - the Promise is bound the current session, i.e., will ony be settled as long as the current session is not disposed.\n   */\n  private whenEvent(resolveOnEvent: SessionEventCode, options?: {rejectOnEvent?: SessionEventCode; correlationKey?: string | object}): Promise<SessionEvent> {\n    return new Promise((resolve, reject) => {\n      this._event$\n        .pipe(\n          assertNotInAngularZone(),\n          filter(event => !options?.correlationKey || event.correlationKey === options.correlationKey),\n          mergeMap(event => {\n            switch (event.sessionEventCode) {\n              case resolveOnEvent:\n                return of(event);\n              case options?.rejectOnEvent: {\n                return throwError(() => event);\n              }\n              default:\n                return EMPTY;\n            }\n          }),\n          take(1),\n        )\n        .subscribe({\n          next: (event: SessionEvent) => resolve(event),\n          error: error => reject(error as Error),\n          complete: noop, // do not resolve the Promise when the session is disposed\n        });\n    });\n  }\n\n  private disposeWhenSolaceSessionDied(): void {\n    this._event$\n      .pipe(\n        filter(event => SESSION_DIED_EVENTS.has(event.sessionEventCode)),\n        assertNotInAngularZone(),\n        takeUntilDestroyed(this._destroyRef),\n      )\n      .subscribe(() => {\n        void this.dispose({force: true}); // no graceful shutdown\n      });\n  }\n\n  private logSolaceSessionEvents(): void {\n    const sessionEventCodeMapping = Object.entries(SessionEventCode).reduce((acc, [key, value]) => acc.set(value as number, key), new Map<number, string>());\n    this._event$\n      .pipe(\n        assertNotInAngularZone(),\n        takeUntilDestroyed(this._destroyRef),\n      )\n      .subscribe((event: SessionEvent) => {\n        this._logger.debug(`SessionEvent: ${sessionEventCodeMapping.get(event.sessionEventCode)}`, event);\n      });\n  }\n\n  private monitorConnectionState$(): Observable<boolean> {\n    const connected$ = this._event$\n      .pipe(\n        assertNotInAngularZone(),\n        map(event => event.sessionEventCode),\n        filter(event => CONNECTION_ESTABLISHED_EVENTS.has(event) || CONNECTION_LOST_EVENTS.has(event)),\n        map(event => CONNECTION_ESTABLISHED_EVENTS.has(event)),\n        distinctUntilChanged(),\n        observeIn(continueFn => this._zone.run(continueFn)),\n        share({\n          connector: () => new ReplaySubject<boolean>(1),\n          resetOnRefCountZero: false,\n          resetOnError: false,\n          resetOnComplete: false,\n        }),\n      );\n    // Connect to the source, then unsubscribe immediately (resetOnRefCountZero: false)\n    connected$.subscribe().unsubscribe();\n    return connected$;\n  }\n\n  private async loadConfig(): Promise<SolaceMessageClientConfig> {\n    assertInInjectionContext(this.loadConfig); // config function must be called inside an injection context\n\n    const configLike = inject(SOLACE_MESSAGE_CLIENT_CONFIG);\n    const config = typeof configLike === 'function' ? await firstValueFrom(Observables.coerce(configLike())) : configLike;\n\n    // Apply Solace session defaults.\n    return {\n      reapplySubscriptions: true, // remember subscriptions after a network interruption (default value if not set)\n      reconnectRetries: -1, // Try to restore the connection automatically after a network interruption (default value if not set)\n      ...config,\n    };\n  }\n}\n\n/**\n * Maps each {@link Message} to a {@link MessageEnvelope}, and resolves substituted named wildcard segments.\n */\nfunction mapToMessageEnvelope(subscriptionTopic?: string): OperatorFunction<Message, MessageEnvelope> {\n  return map((message: Message): MessageEnvelope => {\n    return {\n      message,\n      params: collectNamedTopicSegmentValues(message, subscriptionTopic),\n      headers: collectHeaders(message),\n    };\n  });\n}\n\n/**\n * Collects message headers from given message.\n */\nfunction collectHeaders(message: Message): Map<string, unknown> {\n  const userPropertyMap = message.getUserPropertyMap();\n  return userPropertyMap?.getKeys().reduce((acc, key) => {\n    return acc.set(key, userPropertyMap.getField(key).getValue());\n  }, new Map<string, unknown>()) ?? new Map<string, unknown>();\n}\n\n/**\n * Parses the effective message destination for named path segments, if any.\n */\nfunction collectNamedTopicSegmentValues(message: Message, subscriptionTopic: string | undefined): Map<string, string> {\n  if (!subscriptionTopic?.length) {\n    return new Map<string, string>();\n  }\n\n  const subscriptionSegments = subscriptionTopic.split('/');\n  const effectiveDestinationSegments = message.getDestination()!.getName().split('/');\n  return subscriptionSegments.reduce((acc, subscriptionSegment, i) => {\n    if (isNamedWildcardSegment(subscriptionSegment)) {\n      return acc.set(subscriptionSegment.substring(1), effectiveDestinationSegments[i]!);\n    }\n    return acc;\n  }, new Map<string, string>());\n}\n\n/**\n * Tests whether given segment is a named path segment, i.e., a segment that acts as placeholer for any value, equivalent to the Solace single-level wildcard character (`*`).\n */\nfunction isNamedWildcardSegment(segment: string): boolean {\n  return segment.startsWith(':') && segment.length > 1;\n}\n\n/**\n * Creates a Solace subscription topic with named topic segments replaced by single-level wildcard characters (`*`), if any.\n */\nfunction createSubscriptionTopicDestination(topic: string): Destination {\n  const subscriptionTopic = topic.split('/')\n    .map(segment => isNamedWildcardSegment(segment) ? '*' : segment)\n    .join('/');\n  return SolclientFactory.createTopicDestination(subscriptionTopic);\n}\n\n/**\n * Set of events indicating final disconnection from the broker with no recovery possible.\n */\nconst SESSION_DIED_EVENTS = new Set<number>()\n  .add(SessionEventCode.DOWN_ERROR) // is emitted when reaching the limit of connection retries after a connection interruption\n  .add(SessionEventCode.DISCONNECTED); // is emitted when disconnected from the session\n/**\n * Set of events indicating a connection to be established.\n */\nconst CONNECTION_ESTABLISHED_EVENTS = new Set<number>()\n  .add(SessionEventCode.UP_NOTICE)\n  .add(SessionEventCode.RECONNECTED_NOTICE);\n\n/**\n * Set of events indicating a connection to be lost.\n */\nconst CONNECTION_LOST_EVENTS = new Set<number>()\n  .add(SessionEventCode.DOWN_ERROR)\n  .add(SessionEventCode.CONNECT_FAILED_ERROR)\n  .add(SessionEventCode.DISCONNECTED)\n  .add(SessionEventCode.RECONNECTING_NOTICE);\n\n/**\n * Throws if emitting inside the Angular zone.\n */\nfunction assertNotInAngularZone<T>(): MonoTypeOperatorFunction<T> {\n  return tap(() => NgZone.assertNotInAngularZone());\n}\n\n/**\n * Implements a strategy for sending a message.\n */\ntype Send = (session: Session, message: Message) => void;\n\nfunction obfuscateSecrets(sessionProperties: SolaceMessageClientConfig): SolaceMessageClientConfig {\n  const obfuscated = {...sessionProperties};\n  if (obfuscated.password) {\n    obfuscated.password = '***';\n  }\n  if (obfuscated.accessToken) {\n    obfuscated.accessToken = '***';\n  }\n  return obfuscated;\n}\n\n/**\n * Maps RxJS {@link EmptyError} to the given error. Other errors are re-thrown unchanged.\n */\nfunction mapEmptyError(errorFactory: () => Error): (error: unknown) => Promise<never> {\n  return (error: unknown): Promise<never> => {\n    if (error instanceof EmptyError) {\n      return Promise.reject(errorFactory());\n    }\n    else {\n      return Promise.reject(error); // eslint-disable-line @typescript-eslint/prefer-promise-reject-errors\n    }\n  };\n}\n\n/**\n * Emits in the zone in which subscribed to the Observable.\n */\nfunction synchronizeNgZone<T>(zone: NgZone): MonoTypeOperatorFunction<T> {\n  return (source$: Observable<T>) => {\n    return new Observable<T>(observer => {\n      const insideAngular = NgZone.isInAngularZone();\n      const subscription = source$\n        .pipe(observeIn(fn => insideAngular ? runInsideAngular(fn) : runOutsideAngular(fn)))\n        .subscribe(observer);\n      return () => subscription.unsubscribe();\n    });\n  };\n\n  function runInsideAngular(fn: () => void): void {\n    NgZone.isInAngularZone() ? fn() : zone.run(fn);\n  }\n\n  function runOutsideAngular(fn: () => void): void {\n    !NgZone.isInAngularZone() ? fn() : zone.runOutsideAngular(fn);\n  }\n}\n\n/**\n * Provides the OAuth 2.0 access token configured in {@link SolaceMessageClientConfig#accessToken} as Observable.\n * The Observable errors if not using OAUTH2 authentication scheme, or if no token/provider is configured.\n */\nfunction provideOAuthAccessToken$(config: SolaceMessageClientConfig, options: {injector: Injector}): Observable<string> {\n  if (config.authenticationScheme !== AuthenticationScheme.OAUTH2) {\n    return throwError(() => `Expected authentication scheme to be  ${AuthenticationScheme.OAUTH2}, but was ${config.authenticationScheme}.`);\n  }\n\n  return runInInjectionContext(options.injector, () => {\n    const zone = inject(NgZone);\n    const configuredAccessToken = config.accessToken;\n    const accessToken$ = zone.run(() => {\n      switch (typeof configuredAccessToken) {\n        case 'string': {\n          return of(configuredAccessToken);\n        }\n        case 'function': {\n          return Observables.coerce(configuredAccessToken());\n        }\n        default: {\n          return throwError(() => Error('[NullAccessTokenConfigError] No access token or provider function configured in \\'SolaceMessageClientConfig.accessToken\\'. An access token is required for OAUTH2 authentication. It is recommended to provide the token via `OAuthAccessTokenFn`.'));\n        }\n      }\n    });\n\n    return accessToken$.pipe(mergeMap(accessToken => accessToken ? of(accessToken) : throwError(() => Error('[NullAccessTokenError] Invalid \"OAuth 2.0 Access Token\". Token must not be `null` or `undefined`.'))));\n  });\n}\n","import {Injectable} from '@angular/core';\nimport {BehaviorSubject, NEVER, noop, Observable, OperatorFunction} from 'rxjs';\nimport {Destination, Message, MessageConsumer, MessageConsumerProperties, MessageDeliveryModeType, MessageType, QueueBrowserProperties, SDTField, Session} from 'solclientjs';\nimport {map} from 'rxjs/operators';\n\n/**\n * Allows clients to communicate with a Solace messaging broker for sending and receiving messages using the native SMF protocol (Solace Message Format).\n *\n * This message client establishes a single connection to the broker regardless of the number of subscriptions.\n *\n * See https://docs.solace.com/API-Developer-Online-Ref-Documentation/js/index.html for more information about the Solace Web API.\n */\n@Injectable()\nexport abstract class SolaceMessageClient {\n\n  /**\n   * An Observable that, when subscribed, emits the current connection state to the broker.\n   * Upon subscription, emits the current connection state, unless no connect attempt has been made yet. It never completes and\n   * emits continuously when the connection state changes.\n   */\n  public abstract readonly connected$: Observable<boolean>;\n\n  /**\n   * Promise that resolves to the {@link Session} when connected to the message broker, or that rejects if no connection\n   * could be established, or if no connect attempt has been made yet.\n   */\n  public abstract readonly session: Promise<Session>;\n\n  /**\n   * Receives messages published to the given topic. If running with zone change detection, messages are received in the zone in which subscribed to the Observable.\n   *\n   * The Observable never completes, unless invoking {@link disconnect}. If not connected to the broker yet, or if the connect attempt failed, the Observable errors.\n   *\n   * You can subscribe to multiple topics simultaneously by using wildcard segments in the topic. Topics are case-sensitive and consist of one or more segments, each\n   * separated by a forward slash.\n   *\n   * **Single-Level Wildcard Character (`*`)**:\n   * - if a segment contains the asterisk (`*`) character as its only character, this segment is required and acts as a placeholder for any segment value.\n   * - if a segment ends with the asterisk (`*`) character, this segment acts as a placeholder for segment values starting with the characters before the asterisk.\n   *   The segment to match can have additional characters, must does not have to.\n   *\n   * **Multi-Level Wildcard Character (`>`)**:\n   * -  when used as the last segment, it provides a \"one or more\" wildcard match for any topics with an identical prefix to the subscription.\n   *\n   * See https://docs.solace.com/Messaging/Wildcard-Charaters-Topic-Subs.htm for more information and examples.\n   *\n   * If a segment begins with a colon (`:`), it is called a named wildcard segment that acts as a placeholder for any value. The characters after the colon give the segment its name.\n   * Internally, named wildcard segments are translated to single-level wildcard segments. Named segments can be read from the received message\n   * For example, the topic 'myhome/:room/temperature' is translated to 'myhome/* /temperature', matching messages sent to topics like 'myhome/kitchen/temperature' or 'myhome/livingroom/temperature'.\n   * Substituted segment values are then available in {@link MessageEnvelope.params}, or as the second element of the tuple when using {@link mapToBinary} or {@link mapToText}\n   * RxJS operators.\n   *\n   * To map directly to the payload, you can use the following RxJS operators: {@link mapToBinary}, {@link mapToText}.\n   *\n   * @param topic - Specifies the topic which to observe.\n   *        Topics are case-sensitive and consist of one or more segments, each separated by a forward slash.\n   *        You can subscribe to the exact topic of a published message, or use wildcards (single-level or multi-level) to subscribe to multiple topics simultaneously.\n   *        As an alternative to the single-level wildcard `*`, named wildcard segments can be used. A named wildcard segment begins with a colon (`:`) followed by a name.\n   *        Substituted segments can be read from the received message.\n   *\n   * @param options - Controls how to observe the topic.\n   * @return Observable that emits when receiving a message published to the given topic. The Observable never completes. If not connected to the broker yet, or if the connect attempt failed, the Observable errors.\n   */\n  public abstract observe$(topic: string, options?: ObserveOptions): Observable<MessageEnvelope>;\n\n  /**\n   * Consumes messages from a given topic endpoint or queue endpoint. If running with zone change detection, messages are received in the zone in which subscribed to the Observable.\n   *\n   * Endpoint names are case-sensitive and consist of one or more segments, each separated by a forward slash.\n   *\n   * When passing a `string` topic literal (that is, not a {@link MessageConsumerProperties} object), creates a private, non-durable topic endpoint on the broker that subscribes\n   * to messages published to the given topic. From the consumer's point of view, this is similar to observe a topic using {@link SolaceMessageClient#observe$}, with the difference\n   * that messages are not lost in the event of short connection interruptions as messages are retained on the broker until transported to the consumer. The lifecycle of a non-durable\n   * topic endpoint is bound to the client that created it, with an additional 60s in case of unexpected disconnect.\n   *\n   * To subscribe to a queue, or to pass a more advanced endpoint configuration, pass a {@link MessageConsumerProperties} object instead.\n   *\n   * ## Passing a `string` topic literal is equivalent to passing the following config:\n   *\n   * ```ts\n   * solaceMessageClient.consume$({\n   *   topicEndpointSubscription: SolclientFactory.createTopicDestination('topic'),\n   *   queueDescriptor: new QueueDescriptor({\n   *     type: QueueType.TOPIC_ENDPOINT,\n   *     durable: false,\n   *   }),\n   * });\n   * ```\n   *\n   * ## To consume messages sent to a durable queue, pass the following config:\n   * ```ts\n   * solaceMessageClient.consume$({\n   *   queueDescriptor: new QueueDescriptor({\n   *     type: QueueType.QUEUE,\n   *     name: 'queue',\n   *   }),\n   * });\n   * ```\n   *\n   * ## Topic vs Topic Endpoint\n   * A topic is not the same thing as a topic endpoint. Messages cannot be published directly to topic endpoints, but only indirectly via topics.\n   * A topic is a message property the event broker uses to route a message to its destination. Topic endpoints, unlike topics, are objects that define the storage of messages\n   * for a consuming application. Topic endpoints are more closely related to queues than to topics.\n   * For more information, refer to https://solace.com/blog/queues-vs-topic-endpoints.\n   *\n   * For topic endpoints, you can subscribe to multiple topics simultaneously by using wildcard segments in the topic.\n   *\n   * **Single-Level Wildcard Character (`*`)**:\n   * - if a segment contains the asterisk (`*`) character as its only character, this segment is required and acts as a placeholder for any segment value.\n   * - if a segment ends with the asterisk (`*`) character, this segment acts as a placeholder for segment values starting with the characters before the asterisk.\n   *   The segment to match can have additional characters, must does not have to.\n   *\n   * **Multi-Level Wildcard Character (`>`)**:\n   * -  when used as the last segment, it provides a \"one or more\" wildcard match for any topics with an identical prefix to the subscription.\n   *\n   * See https://docs.solace.com/Messaging/Wildcard-Charaters-Topic-Subs.htm for more information and examples.\n   *\n   * If a segment begins with a colon (`:`), it is called a named wildcard segment that acts as a placeholder for any value. The characters after the colon give the segment its name.\n   * Internally, named wildcard segments are translated to single-level wildcard segments. Named segments can be read from the received message\n   * For example, the topic 'myhome/:room/temperature' is translated to 'myhome/* /temperature', matching messages sent to topics like 'myhome/kitchen/temperature' or 'myhome/livingroom/temperature'.\n   * Substituted segment values are then available in {@link MessageEnvelope.params}, or as the second element of the tuple when using {@link mapToBinary} or {@link mapToText} RxJS operators.\n   *\n   * To map directly to the payload, you can use the following RxJS operators: {@link mapToBinary}, {@link mapToText}.\n   *\n   * @param topicOrDescriptor - If specifying a `string` literal, then it is used as the subscription topic to create a topic endpoint for, allowing messages to be reliably received even if the\n   *        connection is unstable. If passing a descriptor object, it is used as the config to connect to a queue or topic endpoint.\n   *        A topic endpoint subscription allows using wildcards (single-level or multi-level) to subscribe to multiple topics simultaneously.\n   *        As an alternative to the single-level wildcard `*`, named wildcard segments can be used. A named wildcard segment begins with a colon (`:`) followed by a name. Substituted segments can be read from the received message.\n   * @return Observable that emits when receiving a message published to the given endpoint. The Observable never completes. If not connected to the broker yet, or if the connect attempt failed, the Observable errors.\n   */\n  public abstract consume$(topicOrDescriptor: string | (MessageConsumerProperties & ConsumeOptions)): Observable<MessageEnvelope>;\n\n  /**\n   * Browses messages in a queue, without removing/consuming the messages. If running with zone change detection, messages are received in the zone in which subscribed to the Observable.\n   *\n   * @param queueOrDescriptor - Specifies the queue to browse, or a descriptor object describing how to connect to the queue browser.\n   * @return Observable that emits spooled messages in the specified queue. The Observable never completes. If not connected to the broker yet, or if the connect attempt failed, the Observable errors.\n   */\n  public abstract browse$(queueOrDescriptor: string | QueueBrowserProperties): Observable<MessageEnvelope>;\n\n  /**\n   * Publishes a message to the given topic or queue destination.\n   *\n   * ## Topic Destination\n   * When sending the message to a topic destination, the broker will transport the message to all subscribers subscribed to the topic at the time of sending the message.\n   *\n   * ## Queue Destination\n   * A queue differs from the topic distribution mechanism that the message is transported to exactly a single consumer, i.e., the message is load balanced to a single consumer\n   * in round‑robin fashion, or for exclusive queues, it is always transported to the same subscription. When sending a message to a queue, the broker retains the message until\n   * it is consumed, or until it expires. Refer to the subsequent chapter 'Durability of Endpoints' for more information.\n   * A queue is typically used in a point-to-point (P2P) messaging environment.\n   *\n   * ## Topic vs Topic Endpoint\n   * A topic is not the same thing as a topic endpoint. Messages cannot be published directly to topic endpoints, but only indirectly via topics.\n   * A topic is a message property the event broker uses to route a message to its destination. Topic endpoints, unlike topics, are objects that define the storage of messages\n   * for a consuming application. Topic endpoints are more closely related to queues than to topics.\n   * For more information, refer to https://solace.com/blog/queues-vs-topic-endpoints.\n   *\n   * ## Destination Name\n   * Destinations case-sensitive and consist of one or more segments, each separated by a forward slash. The destination must be exact, thus not contain wildcards.\n   *\n   * ## Payload\n   * A message may contain unstructured byte data, or a structured container. See {@link Data} for further information.\n   *\n   * ## Delivery Mode\n   * Solace supports two delivery modes, also known as qualities of service (QoS):\n   *  - Direct Messaging (default if not specified)\n   *  - Guaranteed or Persistent Messaging\n   *\n   * You can change the message delivery mode via the {@link PublishOptions.deliveryMode} property.\n   * For more information, refer to the documentation of {@link PublishOptions.deliveryMode}.\n   *\n   * ## Durability of Queue Endpoints\n   * Solace distinguishes between durable und non-durable queues.\n   *\n   * When sending the message to a durable queue, the broker retains the message until it is consumed (and also acknowledged) by the consumer, or until\n   * it expires. In constract, a non-durable queue, also known as a temporary queue, has a shorter lifecycle than a durable queue. It has the lifespan\n   * of the client that created it, with an additional 60 seconds in case of unexpected disconnect. The 60 seconds provides the client with some time to\n   * reconnect to the endpoint before it and its contents are deleted from the Solace broker.\n   *\n   * Although the terms durable and persistent are related, keep in mind that the concept 'durability' applies to endpoints, whereas 'persistence'\n   * applies to event messages.\n   *\n   * For further information refer to:\n   * - https://docs.solace.com/PubSub-Basics/Endpoints.htm\n   * - https://solace.com/blog/solace-endpoints-durable-vs-non-durable\n   *\n   * @param  destination - Specifies the destination where to send the message to. If of the type `string`, sends it to a topic destination.\n   *         To send a message to a queue, pass a queue {@link Destination} which can be constructed using the {@link SolclientFactory}, as following:\n   *         `SolclientFactory.createDurableQueueDestination('queue')`\n   * @param  data - Specifies optional {@link Data transfer data} to be carried along with this message. A message may contain unstructured byte data,\n   *         or structured data in the form of a {@link SDTField}. Alternatively, to have full control over the message to be published, pass the\n   *         {@link Message} object instead, which you can construct using {@link SolclientFactory#createMessage}.\n   *         For more information, refer to the documentation of {@link Data}.\n   * @param  options - Controls how to publish the message.\n   * @return A Promise that resolves when the message could be successfully dispatched or that rejects otherwise.\n   *         The Promise resolves immediately if the published message has the delivery mode {@link MessageDeliveryModeType#DIRECT} (direct messaging).\n   *         If the published message has the delivery mode {@link MessageDeliveryModeType#PERSISTENT} (guaranteed or persistent messaging),\n   *         the Promise resolves once acknowledged, i,e., when one-third of the publish window size is reached or one second has elapsed.\n   *         Refer to https://docs.solace.com/API/API-Developer-Guide/Acknowledging-Published-.htm for more information.\n   */\n  public abstract publish(destination: string | Destination, data?: Data | Message, options?: PublishOptions): Promise<void>;\n\n  /**\n   * Sends a request to the specified destination and waits for the response to arrive. If running with zone change detection, replies are received in the zone in which subscribed to the Observable.\n   *\n   * - If sending the request to a topic, the request is transported to all subscribers subscribed to the topic at the time of sending the request.\n   * - If sending the request to a queue, the request is transported to a single subscriber. The request is retained if there was no subscriber\n   *   at the time of sending the request.\n   * - If not receiving a reply within the specified (or globally set) timeout, then the Observable will error.\n   * - If not passing a 'replyTo' destination via options object, the API will generate a 'replyTo' destination where to send the reply to.\n   *\n   * Note:\n   * The implementation is based on \"solclientjs\" {@link Session#sendRequest} which does not support receiving multiple responses\n   * and requires the replier to include the requestor's `correlationId` in the reply message.\n   *\n   * @param  destination - Specifies the destination where to send the message to. If of the type `string`, sends it to a topic destination.\n   * @param  data - Specifies optional {@link Data transfer data} to be carried along with this request. The request may contain unstructured byte data,\n   *         or structured data in the form of a {@link SDTField}. Alternatively, to have full control over the message to be published, pass the\n   *         {@link Message} object instead, which you can construct using {@link SolclientFactory#createMessage}.\n   *         For more information, refer to the documentation of {@link Data}.\n   * @param  options - Controls how to publish the request, e.g., to pass a custom 'replyTo' destination.\n   * @return Observable that emits the received reply and then completes, or that errors if the request could not be dispatched or no reply was received\n   *         within the specified timeout.\n   */\n  public abstract request$(destination: string | Destination, data?: Data | Message, options?: RequestOptions): Observable<MessageEnvelope>;\n\n  /**\n   * Replies to the passed request.\n   *\n   * @param  request - Specifies the request to send a reply for.\n   * @param  data - Specifies optional {@link Data transfer data} to be carried along with the reply. The reply may contain unstructured byte data,\n   *         or structured data in the form of a {@link SDTField}. Alternatively, to have full control over the message to be published, pass the\n   *         {@link Message} object instead, which you can construct using {@link SolclientFactory#createMessage}.\n   *         For more information, refer to the documentation of {@link Data}.\n   * @param  options - Controls how to publish the reply.\n   * @return A Promise that resolves when dispatched the reply, or that rejects if the reply could not be dispatched.\n   */\n  public abstract reply(request: Message, data?: Data | Message, options?: PublishOptions): Promise<void>;\n}\n\n/**\n * SolaceMessageClient which does nothing, i.e., can be used in tests.\n */\n@Injectable()\nexport class NullSolaceMessageClient implements SolaceMessageClient {\n\n  public readonly connected$ = new BehaviorSubject<boolean>(true);\n\n  public observe$(topic: string, options?: ObserveOptions): Observable<MessageEnvelope> {\n    return NEVER;\n  }\n\n  public consume$(topicOrDescriptor: string | (MessageConsumerProperties & ConsumeOptions)): Observable<MessageEnvelope> {\n    return NEVER;\n  }\n\n  public browse$(queueOrDescriptor: string | QueueBrowserProperties): Observable<MessageEnvelope> {\n    return NEVER;\n  }\n\n  public publish(destination: string | Destination, data?: ArrayBufferLike | DataView | string | SDTField | Message, options?: PublishOptions): Promise<void> {\n    return Promise.resolve();\n  }\n\n  public request$(destination: string | Destination, data?: Data | Message, options?: RequestOptions): Observable<MessageEnvelope> {\n    return NEVER;\n  }\n\n  public reply(request: Message, data?: ArrayBufferLike | DataView | string | SDTField | Message, options?: PublishOptions): Promise<void> {\n    return Promise.resolve();\n  }\n\n  public get session(): Promise<Session> {\n    return new Promise(noop);\n  }\n}\n\n/**\n * Control how to observe a topic.\n */\nexport interface ObserveOptions {\n  /**\n   * Specifies the maximum time (in milliseconds) to wait for the destination to be subscribed.\n   * If specified, overrides the global timeout as set via {@link SessionProperties#readTimeoutInMsecs}.\n   */\n  subscribeTimeout?: number;\n\n  /**\n   * A lifecycle hook that is called when subscribed to a destination.\n   *\n   * Use if you need to wait until the destination is actually subscribed, e.g, if implementing the request/response message exchange pattern,\n   * or for reading information about the endpoint if consuming messages via {@link SolaceMessageClient#consume$}.\n   */\n  onSubscribed?(): void;\n}\n\n/**\n * Control how to consume messages.\n */\nexport interface ConsumeOptions {\n\n  /**\n   * A lifecycle hook that is called when subscribed to a destination.\n   *\n   * Use if you need to wait until the destination is actually subscribed, e.g, if implementing the request/response message exchange pattern,\n   * or for reading information about the endpoint if consuming messages via {@link SolaceMessageClient#consume$}.\n   *\n   * @param messageConsumer - reference to the message consumer, useful to read generated endpoint names:\n   *        * For non-durable endpoints, if not passing an endpoint name, Solace API generates a name which can be queried by calling {@link MessageConsumer#getDestination};\n   *          The generated descriptor can be queried by calling {@link MessageConsumer#getProperties#queueDescriptor};\n   *        * For durable endpoints, endpoint properties can be retrieved as configured on the broker by calling {@link MessageConsumer#getProperties#queueProperties};\n   */\n  onSubscribed?(messageConsumer: MessageConsumer): void;\n}\n\n/**\n * Control how to publish a message.\n */\nexport interface PublishOptions {\n\n  /**\n   * Allows intercepting the raw message before it is sent over the network.\n   *\n   * Only basic properties can be set via {@link PublishOptions}. To set other properties or properties not yet supported by the API,\n   * the message can be intercepted and the properties set accordingly.\n   */\n  intercept?: (message: Message) => void;\n\n  /**\n   * Convenience API for setting headers to pass additional information along with the message.\n   *\n   * Headers are transported as structured data separate from the payload. To pass a header value\n   * different to `string`, `boolean` or `number`, pass it as Structured Data Type (SDT) in the\n   * form of a {@link SDTField}, as following: `SDTField.create(SDTFieldType.INT8, 2);`\n   *\n   * Header values are mapped as following to structured data types:\n   * `string` -> SDTFieldType.STRING\n   * `boolean` -> SDTFieldType.BOOL\n   * `number` -> SDTFieldType.INT32\n   *\n   * @see Message.setUserPropertyMap\n   */\n  headers?: Map<string, string | boolean | number | SDTField>;\n\n  /**\n   * Specifies the message priority (JMS Priority) for the message.\n   * Numerical values between 0 and 255 are accepted, use undefined to unset.\n   *\n   * If destination queues and topic endpoints for this message\n   * are configured to respect message priority,\n   * the values 0 through 9 can be used to affect the priority\n   * of delivery to consumers of those queues or topic endpoints.\n   * For the purposes of prioritized message delivery, values larger than 9\n   * are treated the same as 9.\n   */\n  priority?: number;\n  /**\n   * Specifies the guaranteed message TTL, in milliseconds.\n   *\n   * The time to live is the number of milliseconds the message may be stored on the\n   * Solace Message Router before the message is discarded or moved to a Dead Message\n   * Queue. See {@link Message.setDMQEligible}.\n   *\n   * Setting the Time To Live to zero disables TTL for the message.\n   *\n   * This property is only valid for Guaranteed messages (Persistent and Non-Persistent).\n   * It has no effect when used in conjunction with other message types unless the message\n   * is promoted by the appliance to a Guaranteed message.\n   *\n   * The maxium allowed time to live is 3.1536E11 (315360000000) which is\n   * approximately 10 years.\n   */\n  timeToLive?: number;\n\n  /**\n   * Specifies if to publish a Guaranteed Message DMQ (Dead Message Queue) eligible message.\n   * When this property is set, when the message expires in the network,\n   * the message is saved on a appliance dead message queue. Otherwise the expired message is\n   * discarded. See {@link PublishOptions.setTimeToLive}.\n   */\n  dmqEligible?: boolean;\n\n  /**\n   * Sets the delivery mode of the message.\n   *\n   * Solace supports two delivery modes, also known as qualities of service (QoS):\n   * - Direct Messaging (default if not specified)\n   * - Guaranteed or Persistent Messaging\n   *\n   * For a detailed comparison, refer to https://solace.com/blog/delivery-modes-direct-messaging-vs-persistent-messaging.\n   *\n   * ### Direct Messaging (default)\n   * Direct messaging is over TCP and provides a reliable, but not guaranteed, delivery of messages from the Solace event broker to consuming clients,\n   * and is the default message delivery system. The broker delivers a message one time at most. It is most appropriate for messaging applications\n   * that require very high-rate or very low-latency message transmission, i.e., to efficiently publish messages to a large number of clients with matching\n   * subscriptions.\n   *\n   * For more information, refer to https://docs.solace.com/PubSub-Basics/Direct-Messages.htm.\n   *\n   * ### Persistent or Guaranteed Messaging\n   * Persistent messaging is also over TCP but has an additional set of acknowledgments beyond those used by TCP itself. Solace event broker guarantees the message\n   * never to be lost and to be delivered at least once. Use persistent messaging when data must be received by the consuming application.\n   *\n   * Persistent messaging occurs between the publishing application and the broker, and between the broker and the consuming application. If the consuming application\n   * is not connected or cannot keep up with the publishing application, the messages are stored in endpoints on the broker.\n   *\n   * For more information, refer to  https://docs.solace.com/PubSub-Basics/Guaranteed-Messages.htm or https://docs.solace.com/PubSub-Basics/Basic-Guaranteed-Messsaging-Operation.htm.\n   *\n   * If you experience poor performance when sending guaranteed messages, consider adjusting the size of the publishing window via {@link Session#publisherProperties#windowSize},\n   * as described here: https://solace.com/blog/understanding-guaranteed-message-publish-window-sizes-and-acknowledgement\n   *\n   * @default MessageDeliveryModeType.DIRECT\n   */\n  deliveryMode?: MessageDeliveryModeType;\n\n  /**\n   * Sets the correlation ID which is carried in the message headers unmodified.\n   *\n   * A correlation ID is a unique identifier value that is attached to a message that allows referencing to a particular transaction or event chain.\n   *\n   * If replying to a request via {@link SolaceMessageClient#reply}, the API will copy the correlation id from the request, thus must not be set manually.\n   */\n  correlationId?: string;\n  /**\n   * Sets the correlation key to correlate events from the Solace event broker when sending the message to the broker.\n   *\n   * The correlation key is an object that is passed back to the client during the router acknowledgement or rejection.\n   * Note that the correlation key is not included in the transmitted message and is only used with the local API.\n   */\n  correlationKey?: string | object;\n  /**\n   * Sets the destination a replier can reply to in \"request-response\" communication.\n   *\n   * If not passed the API will generate a 'replyTo' destination where to send the reply to.\n   */\n  replyTo?: Destination;\n  /**\n   * Marks this message as a reply to a previous request in \"request-response\" communication.\n   *\n   * If replying to a request via {@link SolaceMessageClient#reply}, the API will mark the message as a reply, thus must not be set manually.\n   */\n  markAsReply?: boolean;\n}\n\n/**\n * Control how to publish a request.\n */\nexport interface RequestOptions extends PublishOptions {\n  /**\n   * Specifies the maximum time (in milliseconds) to wait for a response to be received. The minimum value is 100ms.\n   * If specified, overrides the global timeout as set via {@link SessionProperties#readTimeoutInMsecs}.\n   */\n  requestTimeout?: number;\n}\n\n/**\n * RxJS operator for mapping a structured text message into its textual representation.\n *\n * Each message is mapped to a tuple of three elements:\n * [<text>, Params, Message].\n *\n * Note: Messages must be published as {@link MessageType.TEXT} messages, otherwise an error is thrown.\n */\nexport function mapToText(): OperatorFunction<MessageEnvelope, [string, Params, Message]> {\n  return map((envelope: MessageEnvelope) => {\n    const message: Message = envelope.message;\n    if (message.getType() !== MessageType.TEXT) {\n      throw Error(`[IllegalMessageTypeError] Expected message type to be ${formatMessageType(MessageType.TEXT)}, but was ${formatMessageType(message.getType())}. Be sure to use a compatible map operator.`);\n    }\n    return [message.getSdtContainer()!.getValue() as string, envelope.params, message];\n  });\n}\n\n/**\n * RxJS operator for mapping a message into its binary representation.\n *\n * Each message is mapped to a tuple of three elements:\n * [<binary>, Params, Message].\n *\n * Backward compatibility note: Using the version10 factory profile or older, the binary attachment is returned as a 'latin1' String:\n * Each character has a code in the range * 0-255 representing the value of a single received byte at that position.\n *\n * Note: Messages must be published as {@link MessageType.BINARY} messages, otherwise an error is thrown.\n */\nexport function mapToBinary<T extends Uint8Array | string = Uint8Array>(): OperatorFunction<MessageEnvelope, [T, Params, Message]> {\n  return map((envelope: MessageEnvelope) => {\n    const message: Message = envelope.message;\n    if (message.getType() !== MessageType.BINARY) {\n      throw Error(`[IllegalMessageTypeError] Expected message type to be ${formatMessageType(MessageType.BINARY)}, but was ${formatMessageType(message.getType())}. Be sure to use a compatible map operator.`);\n    }\n    return [message.getBinaryAttachment() as T, envelope.params, message];\n  });\n}\n\n/**\n * Container for substitued values of named wildcard topic segments.\n */\nexport type Params = Map<string, string>;\n\nfunction formatMessageType(messageType: MessageType): string {\n  switch (messageType) {\n    case MessageType.TEXT:\n      return `TEXT (${messageType})`;\n    case MessageType.BINARY:\n      return `BINARY (${messageType})`;\n    case MessageType.MAP:\n      return `MAP (${messageType})`;\n    case MessageType.STREAM:\n      return `STREAM (${messageType})`;\n  }\n}\n\n/**\n * Envelope containing the {@link Message} and resolved values for named topic segments, if any.\n */\nexport interface MessageEnvelope {\n  /**\n   * Unmodified message as received by the Solace message broker.\n   */\n  message: Message;\n  /**\n   * Contains the resolved values of named single-level wildcard segments as specified in the topic.\n   * For example: If subscribed to the topic `person/:id` and a message is published to the topic `person/5`,\n   * the resolved id with the value `5` is contained in the segments map.\n   */\n  params: Params;\n  /**\n   * Convenience API for accessing headers attached to the message.\n   *\n   * @see Message.getUserPropertyMap\n   */\n  headers: Map<string, any>;\n}\n\n/**\n * Represents the payload of a message.\n *\n * A message may contain unstructured byte data, or a structured container.\n *\n * ## Binary Data Message\n * By default, data is transported as unstructured bytes in the binary attachment message part.\n *\n * Supported data types are:\n * - ArrayBufferLike\n * - Uint8Array\n * - DataView\n * - string (latin1-encoded; only supported for backwards compatibility; use `new TextEncoder.encode(...)` instead)\n *\n * ## Structured Data Message\n * Alternatively, you can exchange data using the structured data API by passing it as Structured Data Type (SDT) in the form of a {@link SDTField}\n * of the type {@link SDTFieldType#STRING}, {@link SDTFieldType#MAP} or {@link SDTFieldType#STREAM}. Transporting data as structured message is useful\n * in a heterogeneous network that has clients that use different hardware architectures and programming languages, allowing exchanging binary data in\n * a structured, language- and architecture-independent way.\n *\n * Example: `SDTField.create(SDTFieldType.STRING, 'payload')`\n *\n * https://solace.com/blog/inside-solace-message-introduction/\n */\nexport type Data = ArrayBufferLike | Uint8Array | DataView | string | SDTField;\n","import {EnvironmentProviders, inject, InjectionToken, makeEnvironmentProviders} from '@angular/core';\nimport {SOLACE_MESSAGE_CLIENT_CONFIG, SolaceMessageClientConfig, SolaceMessageClientConfigFn} from './solace-message-client.config';\nimport {provideLogger} from './logger';\nimport {ɵSolaceMessageClient} from './ɵsolace-message-client';\nimport {SolaceSessionProvider, ɵSolaceSessionProvider} from './solace-session-provider';\nimport {NullSolaceMessageClient, SolaceMessageClient} from './solace-message-client';\nimport {LogLevel} from 'solclientjs';\n\n/**\n * Enables and configures the Angular Solace Message Client, returning a set of dependency-injection providers to be registered in Angular.\n *\n * The Solace Message Client provides API to communicate with a Solace messaging broker for sending and receiving messages using the native SMF protocol (Solace Message Format).\n *\n * ### Setup\n *\n * ```ts\n * import {bootstrapApplication} from '@angular/platform-browser';\n * import {provideSolaceMessageClient} from '@solace-community/angular-solace-message-client';\n *\n * bootstrapApplication(AppComponent, {\n *   providers: [\n *     provideSolaceMessageClient({\n *       url: 'wss://YOUR-SOLACE-BROKER-URL:443',\n *       vpnName: 'YOUR VPN',\n *       userName: 'YOUR USERNAME',\n *       password: 'YOUR PASSWORD',\n *     })\n *   ],\n * });\n * ```\n *\n * Alternatively, a function can be passed to load the config asynchronously. The function can call `inject` to get any required dependencies.\n *\n * The connection to the broker will be established when `SolaceMessageClient` is injected for the first time.\n *\n * ### Usage\n *\n * **Publish a message to a topic**\n *\n * ```ts\n * import {SolaceMessageClient} from '@solace-community/angular-solace-message-client';\n * import {inject} from '@angular/core';\n *\n * inject(SolaceMessageClient).publish('myhome/kitchen/temperature', '20°C');\n * ```\n *\n * **Receive messages sent to a topic**\n *\n * ```ts\n * import {SolaceMessageClient} from '@solace-community/angular-solace-message-client';\n * import {inject} from '@angular/core';\n *\n * inject(SolaceMessageClient).observe$('myhome/livingroom/temperature').subscribe(envelope => {\n *   // ...\n * });\n * ```\n *\n * ### Connect to Multiple Solace Message Brokers\n *\n * An application is not limited to connecting to a single Solace Message Broker. Different injection environments can be used to connect to different brokers.\n *\n * Angular injection environments form a hierarchy, inheriting providers from parent environments. An environment can register new providers or replace inherited providers.\n * A child environment is created through routing or programmatically using `createEnvironmentInjector`.\n *\n * Example for connecting to two different brokers:\n *\n * ```ts\n * import {createEnvironmentInjector, EnvironmentInjector, inject} from '@angular/core';\n * import {provideSolaceMessageClient, SolaceMessageClient} from '@solace-community/angular-solace-message-client';\n *\n * // Create environment to provide message client for broker 1.\n * const environment1 = createEnvironmentInjector([provideSolaceMessageClient({url: 'broker-1'})], inject(EnvironmentInjector));\n * // Inject message client.\n * const messageClient1 = environment1.get(SolaceMessageClient);\n * // Publish message to broker 1.\n * messageClient1.publish('topic', 'message for broker 1');\n *\n * // Create environment to provide message client for broker 2.\n * const environment2 = createEnvironmentInjector([provideSolaceMessageClient({url: 'broker-2'})], inject(EnvironmentInjector));\n * // Inject message client.\n * const messageClient2 = environment2.get(SolaceMessageClient);\n * // Publish message to broker 2.\n * messageClient2.publish('topic', 'message for broker 2');\n *\n * // Destroy environments to destroy provided `SolaceMessageClient` instances.\n * environment1.destroy();\n * environment2.destroy();\n * ```\n *\n * ### Logging\n *\n * The default log level is set to `WARN` so that only warnings and errors are logged.\n *\n * The default log level can be changed as follows:\n *\n * ```ts\n * import {bootstrapApplication} from '@angular/platform-browser';\n * import {provideSolaceMessageClient} from '@solace-community/angular-solace-message-client';\n * import {LogLevel} from 'solclientjs';\n *\n * bootstrapApplication(AppComponent, {\n *   providers: [\n *     provideSolaceMessageClient(),\n *     {provide: LogLevel, useValue: LogLevel.INFO}, // Add this line\n *   ],\n * });\n * ```\n *\n * To change the log level at runtime, add the `angular-solace-message-client#loglevel` entry to session storage\n * and reload the application. Supported log levels are: `trace`, `debug`, `info`, `warn`, `error` and `fatal`.\n *\n * Storage Key: `angular-solace-message-client#loglevel`\n * Storage Value: `info`\n *\n * @param config - Configures {@link SolaceMessageClient}.\n *                 Can be an object or a function to provide the config asynchronously.\n *                 The function can call `inject` to get any required dependencies.\n */\nexport function provideSolaceMessageClient(config: SolaceMessageClientConfig | SolaceMessageClientConfigFn): EnvironmentProviders {\n  const SOLACE_SESSION_PROVIDER = new InjectionToken<SolaceSessionProvider>('SOLACE_SESSION_PROVIDER');\n\n  return makeEnvironmentProviders([\n    {provide: SOLACE_MESSAGE_CLIENT_CONFIG, useValue: config},\n    {provide: ɵSolaceMessageClient, useClass: ɵSolaceMessageClient},\n    {provide: SolaceMessageClient, useExisting: ɵSolaceMessageClient},\n    {provide: SOLACE_SESSION_PROVIDER, useClass: ɵSolaceSessionProvider},\n    // Provide inherited 'SolaceSessionProvider' or provide new instance otherwise.\n    {provide: SolaceSessionProvider, useFactory: () => inject(SolaceSessionProvider, {skipSelf: true, optional: true}) ?? inject(SOLACE_SESSION_PROVIDER)},\n    provideLogger(LogLevel.WARN),\n  ]);\n}\n\n/**\n * Provides {@link SolaceMessageClient} which does nothing, e.g, useful in tests.\n *\n * ---\n * Usage:\n *\n * ```ts\n * TestBed.configureTestingModule({\n *   providers: [\n *     provideNullSolaceMessageClient(),\n *   ],\n * });\n * ```\n */\nexport function provideNullSolaceMessageClient(): EnvironmentProviders {\n  return makeEnvironmentProviders([\n    {\n      provide: SolaceMessageClient,\n      useClass: NullSolaceMessageClient,\n    },\n  ]);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["SolaceSessionProperties"],"mappings":";;;;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