@tarileo/avileo-catalog-cli 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -14557,7 +14557,7 @@ var AgentImportError = class extends AgentError {
14557
14557
  };
14558
14558
  var AgentNetworkError = class extends AgentError {
14559
14559
  };
14560
- var AVILEO_AGENT_API_URL = "https://api.avileo.com";
14560
+ var AVILEO_AGENT_API_URL = "https://avileo.theelena.me";
14561
14561
  function configuredApiKey(config2) {
14562
14562
  if (!("apiKey" in config2)) return void 0;
14563
14563
  const apiKey = config2.apiKey.trim();
@@ -15433,7 +15433,11 @@ function normalizeAgentKey(value, message) {
15433
15433
  function localCredentialPath(env = process.env) {
15434
15434
  const configured = env.AVILEO_AGENT_CONFIG_PATH?.trim();
15435
15435
  if (configured) return configured;
15436
- return join(env.XDG_CONFIG_HOME?.trim() || join(homedir(), ".config"), "avileo", "credentials.json");
15436
+ return join(
15437
+ env.XDG_CONFIG_HOME?.trim() || join(homedir(), ".config"),
15438
+ "avileo",
15439
+ "credentials.json"
15440
+ );
15437
15441
  }
15438
15442
  function readLocalCredential(env = process.env) {
15439
15443
  let parsed;
@@ -15457,7 +15461,10 @@ function resolveCredential(env = process.env) {
15457
15461
  const environmentValue = env.AVILEO_AGENT_API_KEY;
15458
15462
  if (environmentValue !== void 0) {
15459
15463
  return {
15460
- apiKey: normalizeAgentKey(environmentValue, "AVILEO_AGENT_API_KEY no es una Agent Key v\xE1lida"),
15464
+ apiKey: normalizeAgentKey(
15465
+ environmentValue,
15466
+ "AVILEO_AGENT_API_KEY no es una Agent Key v\xE1lida"
15467
+ ),
15461
15468
  source: "environment",
15462
15469
  ...env.AVILEO_AGENT_BASE_URL?.trim() ? { baseUrl: env.AVILEO_AGENT_BASE_URL.trim() } : {}
15463
15470
  };
@@ -15471,7 +15478,10 @@ function resolveCredential(env = process.env) {
15471
15478
  };
15472
15479
  }
15473
15480
  function saveLocalCredential(credential, env = process.env) {
15474
- const apiKey = normalizeAgentKey(credential.apiKey, "Solo se pueden guardar Agent Keys de Avileo");
15481
+ const apiKey = normalizeAgentKey(
15482
+ credential.apiKey,
15483
+ "Solo se pueden guardar Agent Keys de Avileo"
15484
+ );
15475
15485
  const path = localCredentialPath(env);
15476
15486
  mkdirSync(dirname(path), { recursive: true, mode: 448 });
15477
15487
  const temporaryPath = `${path}.${randomUUID()}.tmp`;
@@ -15878,7 +15888,10 @@ async function openVerificationUri(uri) {
15878
15888
  return false;
15879
15889
  }
15880
15890
  if (parsed.protocol !== "http:" && parsed.protocol !== "https:") return false;
15881
- const candidates = process.platform === "darwin" ? [["open", [parsed.toString()]]] : process.platform === "win32" ? [["explorer.exe", [parsed.toString()]]] : [["xdg-open", [parsed.toString()]], ["open", [parsed.toString()]]];
15891
+ const candidates = process.platform === "darwin" ? [["open", [parsed.toString()]]] : process.platform === "win32" ? [["explorer.exe", [parsed.toString()]]] : [
15892
+ ["xdg-open", [parsed.toString()]],
15893
+ ["open", [parsed.toString()]]
15894
+ ];
15882
15895
  for (const [command, args] of candidates) {
15883
15896
  if (await openWithExecutable(command, args)) return true;
15884
15897
  }
@@ -15909,12 +15922,18 @@ async function login(options) {
15909
15922
  return;
15910
15923
  }
15911
15924
  if (!result.agentKey || !result.keyId || !result.businessId) {
15912
- throw new CliProtocolError("CLI_AUTH_ERROR", "La autorizaci\xF3n aprobada no devolvi\xF3 una credencial v\xE1lida");
15925
+ throw new CliProtocolError(
15926
+ "CLI_AUTH_ERROR",
15927
+ "La autorizaci\xF3n aprobada no devolvi\xF3 una credencial v\xE1lida"
15928
+ );
15913
15929
  }
15914
- saveLocalCredential({
15915
- apiKey: result.agentKey,
15916
- ...baseUrl ? { baseUrl } : {}
15917
- }, options.env);
15930
+ saveLocalCredential(
15931
+ {
15932
+ apiKey: result.agentKey,
15933
+ ...baseUrl ? { baseUrl } : {}
15934
+ },
15935
+ options.env
15936
+ );
15918
15937
  emitSuccess(safeFinalResult(start, browserOpened, result));
15919
15938
  return;
15920
15939
  }
@@ -15963,7 +15982,10 @@ function createProgram(options = {}) {
15963
15982
  const program = new Command();
15964
15983
  let client;
15965
15984
  const getClient = options.getClient ?? (() => {
15966
- client ??= createClientFromEnvironment({ env: options.env, clientFactory: options.clientFactory });
15985
+ client ??= createClientFromEnvironment({
15986
+ env: options.env,
15987
+ clientFactory: options.clientFactory
15988
+ });
15967
15989
  return client;
15968
15990
  });
15969
15991
  program.name("avileo").description("CLI seguro para el cat\xE1logo de un negocio Avileo").option("--json", "Emite la envoltura JSON versionada para automatizaci\xF3n");
@@ -15986,7 +16008,8 @@ function createProgram(options = {}) {
15986
16008
  try {
15987
16009
  return await parseAsync3(...args);
15988
16010
  } catch (error51) {
15989
- if (error51 instanceof CommanderError && error51.code === "commander.helpDisplayed") return program;
16011
+ if (error51 instanceof CommanderError && error51.code === "commander.helpDisplayed")
16012
+ return program;
15990
16013
  emitFailure(toFailure(error51));
15991
16014
  process.exitCode = exitCodeFor(error51);
15992
16015
  return program;