HEX
Server: nginx/1.24.0
System: Linux nowruzgan 6.8.0-57-generic #59-Ubuntu SMP PREEMPT_DYNAMIC Sat Mar 15 17:40:59 UTC 2025 x86_64
User: babak (1000)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/dev/shahnamag/back-end/node_modules/@nestjs/core/helpers/http-adapter-host.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HttpAdapterHost = void 0;
const rxjs_1 = require("rxjs");
/**
 * Defines the `HttpAdapterHost` object.
 *
 * `HttpAdapterHost` wraps the underlying
 * platform-specific `HttpAdapter`.  The `HttpAdapter` is a wrapper around the underlying
 * native HTTP server library (e.g., Express).  The `HttpAdapterHost` object
 * provides methods to `get` and `set` the underlying HttpAdapter.
 *
 * @see [Http adapter](https://docs.nestjs.com/faq/http-adapter)
 *
 * @publicApi
 */
class HttpAdapterHost {
    constructor() {
        this._listen$ = new rxjs_1.Subject();
        this.isListening = false;
    }
    /**
     * Accessor for the underlying `HttpAdapter`
     *
     * @param httpAdapter reference to the `HttpAdapter` to be set
     */
    set httpAdapter(httpAdapter) {
        this._httpAdapter = httpAdapter;
    }
    /**
     * Accessor for the underlying `HttpAdapter`
     *
     * @example
     * `const httpAdapter = adapterHost.httpAdapter;`
     */
    get httpAdapter() {
        return this._httpAdapter;
    }
    /**
     * Observable that allows to subscribe to the `listen` event.
     * This event is emitted when the HTTP application is listening for incoming requests.
     */
    get listen$() {
        return this._listen$.asObservable();
    }
    /**
     * Sets the listening state of the application.
     */
    set listening(listening) {
        this.isListening = listening;
        if (listening) {
            this._listen$.next();
            this._listen$.complete();
        }
    }
    /**
     * Returns a boolean indicating whether the application is listening for incoming requests.
     */
    get listening() {
        return this.isListening;
    }
}
exports.HttpAdapterHost = HttpAdapterHost;