HEX
HEX
Server: Apache/2.4.29 (Ubuntu)
System: Linux 2amigos-php74 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
User: squarehillcompany.com (1002)
PHP: 7.4.25
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/vhosts/textpony-prod.2amigos.us/docroot/node_modules/nestjs-console/dist/scanner.js
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConsoleScanner = void 0;
const constants_1 = require("./constants");
class ConsoleScanner {
    getModules(modulesContainer, include = []) {
        const allModules = [...modulesContainer.values()];
        if (!include.length) {
            return allModules;
        }
        return allModules.filter(({ metatype }) => include.some((item) => item === metatype));
    }
    getInstanceMethods(instance) {
        return Object.getOwnPropertyNames(instance)
            .concat(Object.getOwnPropertyNames(instance.__proto__))
            .filter((m) => Reflect.hasMetadata(constants_1.COMMAND_METADATA_NAME, instance, m));
    }
    scan(app, includedModules) {
        return __awaiter(this, void 0, void 0, function* () {
            const set = new Set();
            const container = app.container;
            const modules = this.getModules(container.getModules(), includedModules);
            yield Promise.all(modules.map((m) => {
                return Promise.all(Array.from(m.providers.values()).map((p) => __awaiter(this, void 0, void 0, function* () {
                    const { metatype, token } = p;
                    if (typeof metatype !== 'function') {
                        return;
                    }
                    if (!p.instance) {
                        return;
                    }
                    const consoleMetadata = Reflect.getMetadata(constants_1.CONSOLE_METADATA_NAME, p.instance.constructor);
                    if (!consoleMetadata) {
                        return;
                    }
                    const instance = yield app.resolve(token, undefined, {
                        strict: false
                    });
                    const methods = this.getInstanceMethods(instance);
                    const methodsMetadata = methods.map((methodMetadata) => ({
                        name: methodMetadata,
                        metadata: Reflect.getMetadata(constants_1.COMMAND_METADATA_NAME, instance, methodMetadata)
                    }));
                    set.add({
                        instance,
                        metadata: consoleMetadata,
                        methods: methodsMetadata
                    });
                })));
            }));
            return set;
        });
    }
}
exports.ConsoleScanner = ConsoleScanner;
//# sourceMappingURL=scanner.js.map