UNPKG

@toebean/npc-vortex-api

Version:
70 lines 3.97 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getMods = exports.getCurrentGame = exports.getActiveProfile = exports.ensureLoggedIn = exports.schemas = void 0; const path_1 = require("path"); const npc_1 = require("@toebean/npc"); const zod_1 = require("zod"); const schemas_1 = require("./schemas"); const namespace = 'vortex'; exports.schemas = __importStar(require("./schemas")); /** * Ensures the Vortex user is logged in to their Nexus account. * @returns A {@link !Promise Promise} which when resolved, indicates the user is logged into their Nexus account. * @see {@link https://toebeann.github.io/npc-vortex-api/stable/?page=vortex.Function.ensureLoggedIn} */ const ensureLoggedIn = (options) => ((0, npc_1.call)({ endpoint: (0, path_1.join)(namespace, 'ensureLoggedIn'), ...options })); exports.ensureLoggedIn = ensureLoggedIn; /** * Retrieves details about the currently active Vortex profile. * @returns A {@link !Promise Promise} which when resolved, passes the currently active Vortex profile to its {@link !Promise.then then} handler(s), * or `undefined` if not found. * @see {@link https://toebeann.github.io/npc-vortex-api/stable/?page=vortex.Function.getActiveProfile} */ const getActiveProfile = async (options) => schemas_1.iProfileSchema.parse(await (0, npc_1.call)({ endpoint: (0, path_1.join)(namespace, 'getActiveProfile'), ...options, })); exports.getActiveProfile = getActiveProfile; /** * Retrieves the stored static details about the currently selected game mode. * @remarks If there is no currently selected game mode, the result will have the fallback id `__placeholder`. * @returns A {@link !Promise Promise} which when resolved, passes the currently selected game mode to its {@link !Promise.then then} handler(s). * @see {@link https://toebeann.github.io/npc-vortex-api/stable/?page=vortex.Function.getCurrentGame} */ const getCurrentGame = async (options) => schemas_1.iGameStoredSchema.parse(await (0, npc_1.call)({ endpoint: (0, path_1.join)(namespace, 'getCurrentGame'), ...options })); exports.getCurrentGame = getCurrentGame; /** * Retrieves the details of installed mods for the currently selected game mode. * @returns A {@link !Promise Promise} when when resolved, passes mod details for the currently selected game mode to its {@link !Promise.then then} handler(s) * as an object where each mod is indexed by its id, or an empty object if no game mode is currently selected. * @see {@link https://toebeann.github.io/npc-vortex-api/stable/?page=vortex.Function.getMods} */ const getMods = async (options) => zod_1.z .record(schemas_1.iProfileModSchema) .and(zod_1.z.record(schemas_1.iModSchema)) .parse(await (0, npc_1.call)({ endpoint: (0, path_1.join)(namespace, 'getMods'), ...options })); exports.getMods = getMods; //# sourceMappingURL=index.js.map