"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseCliWorkerUtils = void 0;
//#region imports
const lib_1 = require("tnp-core/lib");
const base_cli_worker_config_1 = require("./base-cli-worker-config");
//#endregion
var BaseCliWorkerUtils;
(function (BaseCliWorkerUtils) {
    BaseCliWorkerUtils.getPathToProcessLocalInfoJson = (serviceID) => {
        //#region @backendFunc
        // console.log('os.userInfo()', os.userInfo());
        return (0, lib_1.crossPlatformPath)([
            lib_1.UtilsOs.getRealHomeDir(),
            lib_1.dotTaonFolder,
            '__workers-service-process-info__',
            `${serviceID}.json`,
        ]);
        //#endregion
    };
    BaseCliWorkerUtils.getAllServicesFromOS = () => {
        //#region @backendFunc
        const dir = (0, lib_1.crossPlatformPath)(lib_1.path.dirname(BaseCliWorkerUtils.getPathToProcessLocalInfoJson('dummy')));
        return lib_1.Helpers.filesFrom(dir)
            .filter(f => f.endsWith('.json'))
            .map(f => base_cli_worker_config_1.BaseCliWorkerConfig.from(lib_1.UtilsJson.readJsonWithComments(f)));
        //#endregion
    };
})(BaseCliWorkerUtils || (exports.BaseCliWorkerUtils = BaseCliWorkerUtils = {}));
//# sourceMappingURL=base-cli-worker.utils.js.map