@tarileo/avileo-catalog-cli 0.3.5 → 0.3.7

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
@@ -6,7 +6,8 @@ var __export = (target, all) => {
6
6
  };
7
7
 
8
8
  // src/program.ts
9
- import { Command, CommanderError } from "commander";
9
+ import { readFileSync as readFileSync2 } from "fs";
10
+ import { Command } from "commander";
10
11
 
11
12
  // ../../../node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/external.js
12
13
  var external_exports = {};
@@ -14994,6 +14995,12 @@ var AgentBusinessDtoSchema = external_exports.object({
14994
14995
  tenantState: external_exports.literal("active"),
14995
14996
  approvalStatus: external_exports.enum(["approved", "not_required"]),
14996
14997
  subscriptionStatus: external_exports.string().trim().min(1),
14998
+ /**
14999
+ * Derived, additive hint for agents: `ctx.subscription() !== null`, i.e. the
15000
+ * business has a usable subscription right now. Optional so an older server
15001
+ * response stays valid; agents must treat `undefined` as "unknown".
15002
+ */
15003
+ catalogWritable: external_exports.boolean().optional(),
14997
15004
  catalogEnabled: external_exports.literal(true),
14998
15005
  storefronts: external_exports.array(AgentStorefrontDtoSchema).max(20),
14999
15006
  grantedActions: AgentGrantedActionsSchema
@@ -15251,6 +15258,16 @@ var AgentCatalogImportPreviewDtoSchema = external_exports.object({
15251
15258
  summary: AgentCatalogImportSummaryDtoSchema,
15252
15259
  createdAt: timestampSchema
15253
15260
  }).strict();
15261
+ var AgentCatalogImportErrorDtoSchema = external_exports.object({
15262
+ code: nonEmptyTextSchema.max(100),
15263
+ message: nonEmptyTextSchema.max(500)
15264
+ }).strict();
15265
+ var AgentCatalogImportItemResultDtoSchema = external_exports.object({
15266
+ ordinal: external_exports.number().int().nonnegative(),
15267
+ action: AgentCatalogImportActionSchema,
15268
+ status: AgentCatalogImportItemStatusSchema,
15269
+ error: AgentCatalogImportErrorDtoSchema.nullable()
15270
+ }).strict();
15254
15271
  var AgentCatalogImportResultDtoSchema = external_exports.object({
15255
15272
  importId: uuidSchema,
15256
15273
  status: AgentCatalogImportRunStatusSchema,
@@ -15258,7 +15275,14 @@ var AgentCatalogImportResultDtoSchema = external_exports.object({
15258
15275
  retryable: external_exports.boolean(),
15259
15276
  createdAt: timestampSchema,
15260
15277
  updatedAt: timestampSchema,
15261
- completedAt: timestampSchema.nullable()
15278
+ completedAt: timestampSchema.nullable(),
15279
+ /**
15280
+ * Additive diagnostics: why the run failed, and the per-item outcome with
15281
+ * its own error. Optional so responses from an older server stay valid.
15282
+ * Historically omitted, which forced agents to guess the failure cause.
15283
+ */
15284
+ error: AgentCatalogImportErrorDtoSchema.nullable().optional(),
15285
+ items: external_exports.array(AgentCatalogImportItemResultDtoSchema).max(100).optional()
15262
15286
  }).strict();
15263
15287
  var AGENT_OPERATION_NAMES = [
15264
15288
  "catalog.products.create",
@@ -17109,6 +17133,12 @@ function registerAuthCommands(root, options) {
17109
17133
  }
17110
17134
 
17111
17135
  // src/program.ts
17136
+ var CliVersionRequested = class extends Error {
17137
+ constructor() {
17138
+ super("version requested");
17139
+ this.name = "CliVersionRequested";
17140
+ }
17141
+ };
17112
17142
  function createProgram(options = {}) {
17113
17143
  const program = new Command();
17114
17144
  let client;
@@ -17119,10 +17149,15 @@ function createProgram(options = {}) {
17119
17149
  });
17120
17150
  return client;
17121
17151
  });
17122
- program.name("avileo").description("CLI seguro para el cat\xE1logo de un negocio Avileo").option("--json", "Emite la envoltura JSON versionada para automatizaci\xF3n");
17152
+ const packageJson = JSON.parse(
17153
+ readFileSync2(new URL("../package.json", import.meta.url), "utf8")
17154
+ );
17155
+ const cliVersion = typeof packageJson === "object" && packageJson !== null && "version" in packageJson && typeof packageJson.version === "string" ? packageJson.version : "0.0.0";
17156
+ program.name("avileo").description("CLI seguro para el cat\xE1logo de un negocio Avileo").version(cliVersion, "--version", "Muestra la versi\xF3n del paquete publicado").option("--json", "Emite la envoltura JSON versionada para automatizaci\xF3n");
17123
17157
  program.configureOutput({ writeErr: () => void 0 });
17124
17158
  program.exitOverride((error51) => {
17125
17159
  if (error51.code === "commander.helpDisplayed") return;
17160
+ if (error51.code === "commander.version") throw new CliVersionRequested();
17126
17161
  throw new CliProtocolError("CLI_USAGE_ERROR", error51.message);
17127
17162
  });
17128
17163
  registerAuthCommands(program, {
@@ -17161,7 +17196,9 @@ function createProgram(options = {}) {
17161
17196
  try {
17162
17197
  return await parseAsync3(...args);
17163
17198
  } catch (error51) {
17164
- if (error51 instanceof CommanderError && error51.code === "commander.helpDisplayed")
17199
+ if (error51 instanceof CliVersionRequested) return program;
17200
+ const errorCode = typeof error51 === "object" && error51 !== null && "code" in error51 ? String(error51.code) : "";
17201
+ if (errorCode === "commander.helpDisplayed" || errorCode === "commander.version")
17165
17202
  return program;
17166
17203
  emitFailure(toFailure(error51));
17167
17204
  process.exitCode = exitCodeFor(error51);