@tarileo/avileo-catalog-cli 0.3.16 → 0.4.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
@@ -19963,7 +19963,13 @@ var AGENT_CAPABILITY_ACTIONS = [
19963
19963
  "inventory:write",
19964
19964
  "payments:read",
19965
19965
  "payments:write",
19966
- "sales:read"
19966
+ "sales:read",
19967
+ "appointments:read",
19968
+ "appointments:write",
19969
+ "storefront:read",
19970
+ "storefront:write",
19971
+ "appearance:read",
19972
+ "appearance:write"
19967
19973
  ];
19968
19974
  var AgentCapabilityActionSchema = external_exports.enum(AGENT_CAPABILITY_ACTIONS);
19969
19975
  var AGENT_KEY_MODES = ["read", "mutate"];
@@ -19974,7 +19980,10 @@ var AGENT_KEY_READ_ACTIONS = [
19974
19980
  "assets:read",
19975
19981
  "inventory:read",
19976
19982
  "payments:read",
19977
- "sales:read"
19983
+ "sales:read",
19984
+ "appointments:read",
19985
+ "storefront:read",
19986
+ "appearance:read"
19978
19987
  ];
19979
19988
  var AgentGrantedActionsSchema = external_exports.array(AgentCapabilityActionSchema).min(1).max(AGENT_CAPABILITY_ACTIONS.length).refine((actions) => new Set(actions).size === actions.length, {
19980
19989
  message: "Las capacidades no pueden repetirse"
@@ -20601,6 +20610,95 @@ var AgentCatalogImportResultDtoSchema = external_exports.object({
20601
20610
  error: AgentCatalogImportErrorDtoSchema.nullable().optional(),
20602
20611
  items: external_exports.array(AgentCatalogImportItemResultDtoSchema).max(100).optional()
20603
20612
  }).strict();
20613
+ var AgentAppointmentServiceDtoSchema = external_exports.object({
20614
+ id: uuidSchema,
20615
+ name: nonEmptyTextSchema.max(255),
20616
+ description: external_exports.string().trim().max(1e4).nullable(),
20617
+ defaultDurationMinutes: external_exports.number().int().positive(),
20618
+ price: external_exports.number().nonnegative().nullable(),
20619
+ imageAssetId: uuidSchema.nullable(),
20620
+ requiresPrepayment: external_exports.boolean(),
20621
+ publicVisible: external_exports.boolean(),
20622
+ isActive: external_exports.boolean(),
20623
+ createdAt: timestampSchema,
20624
+ updatedAt: timestampSchema
20625
+ }).strict();
20626
+ var AgentCreateAppointmentServiceInputSchema = external_exports.object({
20627
+ name: nonEmptyTextSchema.max(255),
20628
+ description: external_exports.string().trim().max(1e4).optional(),
20629
+ defaultDurationMinutes: external_exports.number().int().min(5),
20630
+ price: external_exports.number().nonnegative().optional(),
20631
+ imageAssetId: uuidSchema.nullable().optional(),
20632
+ requiresPrepayment: external_exports.boolean().optional(),
20633
+ publicVisible: external_exports.boolean().optional()
20634
+ }).strict();
20635
+ var AgentUpdateAppointmentServiceInputSchema = external_exports.object({
20636
+ name: nonEmptyTextSchema.max(255).optional(),
20637
+ description: external_exports.string().trim().max(1e4).optional(),
20638
+ defaultDurationMinutes: external_exports.number().int().min(5).optional(),
20639
+ price: external_exports.number().nonnegative().optional(),
20640
+ imageAssetId: uuidSchema.nullable().optional(),
20641
+ requiresPrepayment: external_exports.boolean().optional(),
20642
+ publicVisible: external_exports.boolean().optional(),
20643
+ isActive: external_exports.boolean().optional()
20644
+ }).strict().refine((value) => Object.keys(value).length > 0, {
20645
+ message: "Debes indicar al menos un campo a actualizar"
20646
+ });
20647
+ var AgentAppointmentProfessionalDtoSchema = external_exports.object({
20648
+ id: uuidSchema,
20649
+ businessUserId: uuidSchema.nullable(),
20650
+ collaboratorId: uuidSchema.nullable(),
20651
+ displayName: nonEmptyTextSchema.max(160),
20652
+ specialty: external_exports.string().trim().max(120).nullable(),
20653
+ color: external_exports.string().trim().max(20).nullable(),
20654
+ defaultAppointmentDurationMinutes: external_exports.number().int().positive().nullable(),
20655
+ publicBookingEnabled: external_exports.boolean(),
20656
+ isActive: external_exports.boolean(),
20657
+ createdAt: timestampSchema,
20658
+ updatedAt: timestampSchema
20659
+ }).strict();
20660
+ var AgentCreateAppointmentProfessionalInputSchema = external_exports.object({
20661
+ businessUserId: uuidSchema.optional(),
20662
+ collaboratorId: uuidSchema.optional(),
20663
+ createWithoutAccess: external_exports.boolean().optional(),
20664
+ displayName: nonEmptyTextSchema.max(160),
20665
+ specialty: external_exports.string().trim().max(120).optional(),
20666
+ color: external_exports.string().trim().max(20).optional(),
20667
+ defaultAppointmentDurationMinutes: external_exports.number().int().min(5).optional(),
20668
+ publicBookingEnabled: external_exports.boolean().optional()
20669
+ }).strict();
20670
+ var AgentUpdateAppointmentProfessionalInputSchema = external_exports.object({
20671
+ displayName: nonEmptyTextSchema.max(160).optional(),
20672
+ specialty: external_exports.string().trim().max(120).nullable().optional(),
20673
+ color: external_exports.string().trim().max(20).nullable().optional(),
20674
+ defaultAppointmentDurationMinutes: external_exports.number().int().min(5).optional(),
20675
+ publicBookingEnabled: external_exports.boolean().optional(),
20676
+ isActive: external_exports.boolean().optional()
20677
+ }).strict().refine((value) => Object.keys(value).length > 0, {
20678
+ message: "Debes indicar al menos un campo a actualizar"
20679
+ });
20680
+ var AgentAppointmentWeeklyWindowSchema = external_exports.object({
20681
+ weekday: external_exports.number().int().min(0).max(6),
20682
+ startTime: external_exports.string().regex(/^\d{2}:\d{2}$/, "Formato HH:mm"),
20683
+ endTime: external_exports.string().regex(/^\d{2}:\d{2}$/, "Formato HH:mm")
20684
+ }).strict();
20685
+ var AgentSetAppointmentAvailabilityInputSchema = external_exports.object({
20686
+ weekly: external_exports.array(AgentAppointmentWeeklyWindowSchema).max(50)
20687
+ }).strict();
20688
+ var AgentAppointmentAvailabilityExceptionSchema = external_exports.object({
20689
+ date: external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/, "Formato YYYY-MM-DD"),
20690
+ type: external_exports.enum(["blocked", "extra_available"]),
20691
+ startTime: external_exports.string().regex(/^\d{2}:\d{2}$/, "Formato HH:mm").optional(),
20692
+ endTime: external_exports.string().regex(/^\d{2}:\d{2}$/, "Formato HH:mm").optional(),
20693
+ reason: external_exports.string().trim().max(255).optional()
20694
+ }).strict();
20695
+ var AgentSetAppointmentAvailabilityExceptionsInputSchema = external_exports.object({
20696
+ exceptions: external_exports.array(AgentAppointmentAvailabilityExceptionSchema).max(200)
20697
+ }).strict();
20698
+ var AgentSetStorefrontPublicationInputSchema = external_exports.object({
20699
+ enabled: external_exports.boolean(),
20700
+ slug: external_exports.string().trim().min(3).max(100).optional()
20701
+ }).strict();
20604
20702
  var AGENT_OPERATION_NAMES = [
20605
20703
  "catalog.products.create",
20606
20704
  "catalog.products.update",
@@ -20623,7 +20721,16 @@ var AGENT_OPERATION_NAMES = [
20623
20721
  "catalog.imports.preview",
20624
20722
  "catalog.imports.apply",
20625
20723
  "business.profile.update",
20626
- "catalog.client_keys.create"
20724
+ "catalog.client_keys.create",
20725
+ "appointments.services.create",
20726
+ "appointments.services.update",
20727
+ "appointments.services.deactivate",
20728
+ "appointments.professionals.create",
20729
+ "appointments.professionals.update",
20730
+ "appointments.professionals.deactivate",
20731
+ "appointments.availability.set",
20732
+ "appointments.availability.exceptions.set",
20733
+ "storefront.publication.set"
20627
20734
  ];
20628
20735
  var AgentOperationNameSchema = external_exports.enum(AGENT_OPERATION_NAMES);
20629
20736
  var AGENT_OPERATION_STATES = [
@@ -20891,6 +20998,142 @@ var AvileoAgentDeviceAuthClient = class {
20891
20998
  function createAvileoAgentDeviceAuth(config2 = {}) {
20892
20999
  return new AvileoAgentDeviceAuthClient(new AgentHttpClient(config2));
20893
21000
  }
21001
+ var PUBLIC_PAGE_PALETTE_IDS = [
21002
+ "clasico",
21003
+ "terracotta",
21004
+ "forest",
21005
+ "graphite",
21006
+ "rose",
21007
+ "ocean",
21008
+ "violet",
21009
+ "brasa",
21010
+ "aji",
21011
+ "mercado",
21012
+ "marino"
21013
+ ];
21014
+ var PublicPagePaletteIdSchema = external_exports.enum(PUBLIC_PAGE_PALETTE_IDS);
21015
+ var PUBLIC_PAGE_FONT_IDS = [
21016
+ "inter",
21017
+ "fraunces",
21018
+ "manrope",
21019
+ "archivo",
21020
+ "bricolage"
21021
+ ];
21022
+ var PublicPageFontIdSchema = external_exports.enum(PUBLIC_PAGE_FONT_IDS);
21023
+ var PUBLIC_PAGE_RADIUS_IDS = ["compacto", "suave", "redondeado"];
21024
+ var PublicPageRadiusIdSchema = external_exports.enum(PUBLIC_PAGE_RADIUS_IDS);
21025
+ var PublicPageAppearanceSchema = external_exports.object({
21026
+ paletteId: PublicPagePaletteIdSchema,
21027
+ fontId: PublicPageFontIdSchema,
21028
+ radiusId: PublicPageRadiusIdSchema
21029
+ });
21030
+ var PUBLIC_PAGE_HERO_LIMITS = {
21031
+ maxSlides: 6,
21032
+ eyebrowMax: 40,
21033
+ titleMax: 100,
21034
+ descriptionMax: 240,
21035
+ ctaLabelMax: 50
21036
+ };
21037
+ var PublicPageHeroCtaKindSchema = external_exports.enum(["primary", "whatsapp", "url"]);
21038
+ var PublicPageHeroCtaSchema = external_exports.object({
21039
+ label: external_exports.string().min(1).max(PUBLIC_PAGE_HERO_LIMITS.ctaLabelMax),
21040
+ kind: PublicPageHeroCtaKindSchema,
21041
+ url: external_exports.string().url().startsWith("https://").optional()
21042
+ }).refine(
21043
+ (value) => value.kind === "url" ? typeof value.url === "string" && value.url.length > 0 : true,
21044
+ {
21045
+ message: 'url es requerida cuando kind es "url"',
21046
+ path: ["url"]
21047
+ }
21048
+ ).refine((value) => value.kind !== "url" ? value.url === void 0 : true, {
21049
+ message: 'url solo aplica cuando kind es "url"',
21050
+ path: ["url"]
21051
+ });
21052
+ var PublicPageHeroSlideSchema = external_exports.object({
21053
+ id: external_exports.string().uuid(),
21054
+ imageId: external_exports.string().uuid().nullable(),
21055
+ imageUrl: external_exports.string().url().nullable(),
21056
+ eyebrow: external_exports.string().max(PUBLIC_PAGE_HERO_LIMITS.eyebrowMax).nullable(),
21057
+ title: external_exports.string().min(1).max(PUBLIC_PAGE_HERO_LIMITS.titleMax),
21058
+ description: external_exports.string().max(PUBLIC_PAGE_HERO_LIMITS.descriptionMax).nullable(),
21059
+ cta: PublicPageHeroCtaSchema.nullable()
21060
+ });
21061
+ var PublicPageHeroSchema = external_exports.object({
21062
+ slides: external_exports.array(PublicPageHeroSlideSchema).max(PUBLIC_PAGE_HERO_LIMITS.maxSlides)
21063
+ });
21064
+ var PublicPageHeroViewSlideSchema = PublicPageHeroSlideSchema.omit({ imageId: true });
21065
+ var PublicPageHeroViewSchema = external_exports.object({
21066
+ slides: external_exports.array(PublicPageHeroViewSlideSchema).max(PUBLIC_PAGE_HERO_LIMITS.maxSlides)
21067
+ });
21068
+ var PublicPageHeroSlideInputSchema = external_exports.object({
21069
+ id: external_exports.string().uuid().optional(),
21070
+ imageId: external_exports.string().uuid().nullable().optional(),
21071
+ eyebrow: external_exports.string().max(PUBLIC_PAGE_HERO_LIMITS.eyebrowMax).nullable().optional(),
21072
+ title: external_exports.string().min(1).max(PUBLIC_PAGE_HERO_LIMITS.titleMax),
21073
+ description: external_exports.string().max(PUBLIC_PAGE_HERO_LIMITS.descriptionMax).nullable().optional(),
21074
+ cta: PublicPageHeroCtaSchema.nullable().optional()
21075
+ });
21076
+ var PublicPageHeroInputSchema = external_exports.object({
21077
+ slides: external_exports.array(PublicPageHeroSlideInputSchema).max(PUBLIC_PAGE_HERO_LIMITS.maxSlides)
21078
+ });
21079
+ var PublicPageHeroSlideStoredSchema = external_exports.object({
21080
+ id: external_exports.string().uuid(),
21081
+ imageId: external_exports.string().uuid().nullable(),
21082
+ eyebrow: external_exports.string().max(PUBLIC_PAGE_HERO_LIMITS.eyebrowMax).nullable(),
21083
+ title: external_exports.string().min(1).max(PUBLIC_PAGE_HERO_LIMITS.titleMax),
21084
+ description: external_exports.string().max(PUBLIC_PAGE_HERO_LIMITS.descriptionMax).nullable(),
21085
+ cta: PublicPageHeroCtaSchema.nullable()
21086
+ });
21087
+ var PublicPageHeroStoredSchema = external_exports.object({
21088
+ slides: external_exports.array(PublicPageHeroSlideStoredSchema).max(PUBLIC_PAGE_HERO_LIMITS.maxSlides)
21089
+ });
21090
+ var publicPageAgentVersionSchema = external_exports.literal("1");
21091
+ var PublicPageAgentAppearanceSchema = external_exports.object({
21092
+ paletteId: PublicPagePaletteIdSchema,
21093
+ fontId: PublicPageFontIdSchema,
21094
+ radiusId: PublicPageRadiusIdSchema
21095
+ });
21096
+ var PublicPageAgentAppearanceOptionsSchema = external_exports.object({
21097
+ paletteIds: external_exports.array(PublicPagePaletteIdSchema).default([...PUBLIC_PAGE_PALETTE_IDS]),
21098
+ fontIds: external_exports.array(PublicPageFontIdSchema).default([...PUBLIC_PAGE_FONT_IDS]),
21099
+ radiusIds: external_exports.array(PublicPageRadiusIdSchema).default([...PUBLIC_PAGE_RADIUS_IDS])
21100
+ });
21101
+ var PublicPageAgentAppearanceResponseSchema = external_exports.object({
21102
+ version: publicPageAgentVersionSchema,
21103
+ appearance: PublicPageAgentAppearanceSchema,
21104
+ options: PublicPageAgentAppearanceOptionsSchema
21105
+ });
21106
+ var PublicPageAgentAppearanceUpdateRequestSchema = external_exports.object({
21107
+ paletteId: PublicPagePaletteIdSchema.optional(),
21108
+ fontId: PublicPageFontIdSchema.optional(),
21109
+ radiusId: PublicPageRadiusIdSchema.optional()
21110
+ }).refine(
21111
+ (value) => value.paletteId !== void 0 || value.fontId !== void 0 || value.radiusId !== void 0,
21112
+ { message: "Se requiere al menos un campo de apariencia" }
21113
+ );
21114
+ var PublicPageAgentHeroLimitsSchema = external_exports.object({
21115
+ maxSlides: external_exports.literal(PUBLIC_PAGE_HERO_LIMITS.maxSlides),
21116
+ eyebrowMax: external_exports.literal(PUBLIC_PAGE_HERO_LIMITS.eyebrowMax),
21117
+ titleMax: external_exports.literal(PUBLIC_PAGE_HERO_LIMITS.titleMax),
21118
+ descriptionMax: external_exports.literal(PUBLIC_PAGE_HERO_LIMITS.descriptionMax),
21119
+ ctaLabelMax: external_exports.literal(PUBLIC_PAGE_HERO_LIMITS.ctaLabelMax)
21120
+ });
21121
+ var PublicPageAgentHeroResponseSchema = external_exports.object({
21122
+ version: publicPageAgentVersionSchema,
21123
+ hero: PublicPageHeroSchema,
21124
+ limits: PublicPageAgentHeroLimitsSchema
21125
+ });
21126
+ var PublicPageAgentHeroUpdateRequestSchema = external_exports.object({
21127
+ slides: PublicPageHeroSlideInputSchema.array().max(PUBLIC_PAGE_HERO_LIMITS.maxSlides)
21128
+ });
21129
+ var PublicPageAgentImageResponseSchema = external_exports.object({
21130
+ version: publicPageAgentVersionSchema,
21131
+ image: external_exports.object({
21132
+ id: external_exports.string().uuid(),
21133
+ url: external_exports.string().url()
21134
+ })
21135
+ });
21136
+ var PUBLIC_PAGE_HERO_IMAGE_MAX_BYTES = 5 * 1024 * 1024;
20894
21137
  function queryString(input2) {
20895
21138
  const query = new URLSearchParams();
20896
21139
  for (const [key, value] of Object.entries(input2)) {
@@ -21240,6 +21483,82 @@ var AgentOperationsResource = class {
21240
21483
  });
21241
21484
  }
21242
21485
  };
21486
+ var AgentAppointmentsResource = class {
21487
+ constructor(http) {
21488
+ this.http = http;
21489
+ }
21490
+ http;
21491
+ listServices(includeInactive = false) {
21492
+ return this.http.request(
21493
+ `/api/v1/agent/appointments/services${queryString({ includeInactive: includeInactive || void 0 })}`
21494
+ );
21495
+ }
21496
+ listProfessionals(includeInactive = false) {
21497
+ return this.http.request(
21498
+ `/api/v1/agent/appointments/professionals${queryString({ includeInactive: includeInactive || void 0 })}`
21499
+ );
21500
+ }
21501
+ getAvailability(professionalId) {
21502
+ return this.http.request(
21503
+ `/api/v1/agent/appointments/professionals/${encodeURIComponent(professionalId)}/availability`
21504
+ );
21505
+ }
21506
+ getAgenda(date5, professionalId) {
21507
+ return this.http.request(
21508
+ `/api/v1/agent/appointments/agenda${queryString({ date: date5, professionalId })}`
21509
+ );
21510
+ }
21511
+ };
21512
+ var AgentStorefrontResource = class {
21513
+ constructor(http) {
21514
+ this.http = http;
21515
+ }
21516
+ http;
21517
+ getPublication() {
21518
+ return this.http.request("/api/v1/agent/storefront/publication");
21519
+ }
21520
+ };
21521
+ var AgentPublicPageResource = class {
21522
+ constructor(http) {
21523
+ this.http = http;
21524
+ }
21525
+ http;
21526
+ async getAppearance() {
21527
+ const result = await this.http.request("/api/v1/agent/appearance");
21528
+ return PublicPageAgentAppearanceResponseSchema.parse(result);
21529
+ }
21530
+ async updateAppearance(input2) {
21531
+ const body = PublicPageAgentAppearanceUpdateRequestSchema.parse(input2);
21532
+ const result = await this.http.request("/api/v1/agent/appearance", {
21533
+ method: "PATCH",
21534
+ body,
21535
+ dispatchIdempotency: true
21536
+ });
21537
+ return PublicPageAgentAppearanceResponseSchema.parse(result);
21538
+ }
21539
+ async getHero() {
21540
+ const result = await this.http.request("/api/v1/agent/hero");
21541
+ return PublicPageAgentHeroResponseSchema.parse(result);
21542
+ }
21543
+ async putHero(input2) {
21544
+ const result = await this.http.request("/api/v1/agent/hero", {
21545
+ method: "PUT",
21546
+ body: input2,
21547
+ dispatchIdempotency: true
21548
+ });
21549
+ return PublicPageAgentHeroResponseSchema.parse(result);
21550
+ }
21551
+ async uploadHeroImage(file2) {
21552
+ const body = new FormData();
21553
+ body.set("file", file2);
21554
+ const result = await this.http.request("/api/v1/agent/hero/images", {
21555
+ method: "POST",
21556
+ body,
21557
+ dispatchIdempotency: true
21558
+ });
21559
+ return PublicPageAgentImageResponseSchema.parse(result);
21560
+ }
21561
+ };
21243
21562
  var AgentPaymentMethodListSchema = external_exports.array(AgentPaymentMethodDtoSchema);
21244
21563
  var AgentPaymentMethodsResource = class {
21245
21564
  constructor(http) {
@@ -21332,6 +21651,9 @@ function createAvileoAgent(config2) {
21332
21651
  assets: new AgentAssetsResource(http),
21333
21652
  inventory: new AgentInventoryResource(http),
21334
21653
  imports: new AgentImportsResource(http),
21654
+ appointments: new AgentAppointmentsResource(http),
21655
+ storefront: new AgentStorefrontResource(http),
21656
+ publicPage: new AgentPublicPageResource(http),
21335
21657
  paymentLinks: new AgentPaymentLinksResource(http),
21336
21658
  paymentMethods: new AgentPaymentMethodsResource(http)
21337
21659
  };
@@ -21859,6 +22181,20 @@ function localResult(input2, current) {
21859
22181
  );
21860
22182
  return { validated: "local", current, changes };
21861
22183
  }
22184
+ function requireId(value, name) {
22185
+ if (!value.trim()) throw new CliProtocolError("CLI_VALIDATION_ERROR", `${name} es obligatorio`);
22186
+ return value;
22187
+ }
22188
+ function wantsApply(command) {
22189
+ return Boolean(command.optsWithGlobals().apply);
22190
+ }
22191
+ function withMutationOptions(command, includeFrom = true) {
22192
+ if (includeFrom) command.requiredOption("--from <json-file>", "Objeto JSON estructurado");
22193
+ return command.option(
22194
+ "--apply",
22195
+ "Crea una propuesta para aprobaci\xF3n en Avileo (apl\xEDcala luego con `operation apply <id>`)"
22196
+ );
22197
+ }
21862
22198
 
21863
22199
  // src/commands/business.ts
21864
22200
  function profileValues(profile) {
@@ -22110,15 +22446,15 @@ function approvedProductUpdate(operation, approvalId, productId) {
22110
22446
  }
22111
22447
 
22112
22448
  // src/commands/catalog.ts
22113
- function requireId(value, name) {
22449
+ function requireId2(value, name) {
22114
22450
  if (!value.trim()) throw new CliProtocolError("CLI_VALIDATION_ERROR", `${name} es obligatorio`);
22115
22451
  return value;
22116
22452
  }
22117
- function withMutationOptions(command, includeFrom = true) {
22453
+ function withMutationOptions2(command, includeFrom = true) {
22118
22454
  if (includeFrom) command.requiredOption("--from <json-file>", "Objeto JSON estructurado");
22119
22455
  return command.option("--apply", "Solicita aprobaci\xF3n o ejecuta una mutaci\xF3n aprobada").option("--approval-id <uuid>", "Aprobaci\xF3n emitida por Avileo");
22120
22456
  }
22121
- function wantsApply(command) {
22457
+ function wantsApply2(command) {
22122
22458
  return Boolean(command.optsWithGlobals().apply);
22123
22459
  }
22124
22460
  function addListOptions(command) {
@@ -22136,13 +22472,13 @@ function parseBoolean(value) {
22136
22472
  throw new CliProtocolError("CLI_VALIDATION_ERROR", "Se esperaba true o false");
22137
22473
  }
22138
22474
  async function applyOrPreview(command, input2, getClient, operationName, payload, run, current) {
22139
- if (!wantsApply(command)) {
22475
+ if (!wantsApply2(command)) {
22140
22476
  emitSuccess(localResult(input2, current ? await current() : void 0));
22141
22477
  return;
22142
22478
  }
22143
22479
  const rawApprovalId = command.optsWithGlobals().approvalId;
22144
22480
  if (typeof rawApprovalId === "string") {
22145
- emitSuccess(await run(requireId(rawApprovalId, "approvalId")));
22481
+ emitSuccess(await run(requireId2(rawApprovalId, "approvalId")));
22146
22482
  return;
22147
22483
  }
22148
22484
  emitSuccess(await getClient().operations.propose({ operationName, payload }));
@@ -22174,9 +22510,9 @@ function registerProductCommands(catalog, getClient) {
22174
22510
  );
22175
22511
  });
22176
22512
  product.command("get <productId>").action(async (productId) => {
22177
- emitSuccess(await getClient().products.get(requireId(productId, "productId")));
22513
+ emitSuccess(await getClient().products.get(requireId2(productId, "productId")));
22178
22514
  });
22179
- withMutationOptions(product.command("create")).action(async (options, command) => {
22515
+ withMutationOptions2(product.command("create")).action(async (options, command) => {
22180
22516
  const input2 = await readMutationInput(options.from);
22181
22517
  await applyOrPreview(
22182
22518
  command,
@@ -22187,15 +22523,15 @@ function registerProductCommands(catalog, getClient) {
22187
22523
  (approvalId) => getClient().products.create(input2, approvalId)
22188
22524
  );
22189
22525
  });
22190
- withMutationOptions(
22526
+ withMutationOptions2(
22191
22527
  product.command("update <productId>").option("--from <json-file>", "Objeto JSON estructurado"),
22192
22528
  false
22193
22529
  ).action(async (productId, options, command) => {
22194
- const id = requireId(productId, "productId");
22530
+ const id = requireId2(productId, "productId");
22195
22531
  const { approvalId: rawApprovalId } = command.optsWithGlobals();
22196
- const approvalId = typeof rawApprovalId === "string" ? requireId(rawApprovalId, "approvalId") : void 0;
22532
+ const approvalId = typeof rawApprovalId === "string" ? requireId2(rawApprovalId, "approvalId") : void 0;
22197
22533
  if (!options.from) {
22198
- if (!wantsApply(command) || !approvalId) {
22534
+ if (!wantsApply2(command) || !approvalId) {
22199
22535
  throw new CliProtocolError(
22200
22536
  "CLI_VALIDATION_ERROR",
22201
22537
  "--from es obligatorio salvo al aplicar con --apply --approval-id"
@@ -22209,7 +22545,7 @@ function registerProductCommands(catalog, getClient) {
22209
22545
  }
22210
22546
  const input2 = await readMutationInput(options.from);
22211
22547
  const prepared = await prepareProductUpdate(input2, options.from, approvalId === void 0);
22212
- if (wantsApply(command) && !approvalId) {
22548
+ if (wantsApply2(command) && !approvalId) {
22213
22549
  const uploaded = /* @__PURE__ */ new Map();
22214
22550
  for (const [placeholder, file2] of prepared.files) {
22215
22551
  const image = await getClient().products.uploadImage(file2);
@@ -22235,9 +22571,9 @@ function registerProductCommands(catalog, getClient) {
22235
22571
  () => getClient().products.get(id)
22236
22572
  );
22237
22573
  });
22238
- withMutationOptions(product.command("deactivate <productId>"), false).action(
22574
+ withMutationOptions2(product.command("deactivate <productId>"), false).action(
22239
22575
  async (productId, _options, command) => {
22240
- const id = requireId(productId, "productId");
22576
+ const id = requireId2(productId, "productId");
22241
22577
  await applyOrPreview(
22242
22578
  command,
22243
22579
  { isActive: false },
@@ -22253,14 +22589,14 @@ function registerProductCommands(catalog, getClient) {
22253
22589
  function registerVariantCommands(catalog, getClient) {
22254
22590
  const variant = catalog.command("variant");
22255
22591
  variant.command("list <productId>").action(async (productId) => {
22256
- emitSuccess(await getClient().variants.list(requireId(productId, "productId")));
22592
+ emitSuccess(await getClient().variants.list(requireId2(productId, "productId")));
22257
22593
  });
22258
22594
  variant.command("get <variantId>").action(async (variantId) => {
22259
- emitSuccess(await getClient().variants.get(requireId(variantId, "variantId")));
22595
+ emitSuccess(await getClient().variants.get(requireId2(variantId, "variantId")));
22260
22596
  });
22261
- withMutationOptions(variant.command("create <productId>")).action(
22597
+ withMutationOptions2(variant.command("create <productId>")).action(
22262
22598
  async (productId, options, command) => {
22263
- const id = requireId(productId, "productId");
22599
+ const id = requireId2(productId, "productId");
22264
22600
  const input2 = await readMutationInput(options.from);
22265
22601
  await applyOrPreview(
22266
22602
  command,
@@ -22272,9 +22608,9 @@ function registerVariantCommands(catalog, getClient) {
22272
22608
  );
22273
22609
  }
22274
22610
  );
22275
- withMutationOptions(variant.command("update <variantId>")).action(
22611
+ withMutationOptions2(variant.command("update <variantId>")).action(
22276
22612
  async (variantId, options, command) => {
22277
- const id = requireId(variantId, "variantId");
22613
+ const id = requireId2(variantId, "variantId");
22278
22614
  const input2 = await readMutationInput(options.from);
22279
22615
  await applyOrPreview(
22280
22616
  command,
@@ -22287,9 +22623,9 @@ function registerVariantCommands(catalog, getClient) {
22287
22623
  );
22288
22624
  }
22289
22625
  );
22290
- withMutationOptions(variant.command("deactivate <variantId>"), false).action(
22626
+ withMutationOptions2(variant.command("deactivate <variantId>"), false).action(
22291
22627
  async (variantId, _options, command) => {
22292
- const id = requireId(variantId, "variantId");
22628
+ const id = requireId2(variantId, "variantId");
22293
22629
  await applyOrPreview(
22294
22630
  command,
22295
22631
  { isActive: false },
@@ -22301,9 +22637,9 @@ function registerVariantCommands(catalog, getClient) {
22301
22637
  );
22302
22638
  }
22303
22639
  );
22304
- withMutationOptions(variant.command("reorder <productId>")).action(
22640
+ withMutationOptions2(variant.command("reorder <productId>")).action(
22305
22641
  async (productId, options, command) => {
22306
- const id = requireId(productId, "productId");
22642
+ const id = requireId2(productId, "productId");
22307
22643
  const input2 = await readMutationInput(options.from);
22308
22644
  await applyOrPreview(
22309
22645
  command,
@@ -22321,9 +22657,9 @@ function registerCategoryCommands(catalog, getClient) {
22321
22657
  const category = catalog.command("category");
22322
22658
  category.command("list").action(async () => emitSuccess(await getClient().categories.list()));
22323
22659
  category.command("get <categoryId>").action(async (categoryId) => {
22324
- emitSuccess(await getClient().categories.get(requireId(categoryId, "categoryId")));
22660
+ emitSuccess(await getClient().categories.get(requireId2(categoryId, "categoryId")));
22325
22661
  });
22326
- withMutationOptions(category.command("create")).action(async (options, command) => {
22662
+ withMutationOptions2(category.command("create")).action(async (options, command) => {
22327
22663
  const input2 = await readMutationInput(options.from);
22328
22664
  await applyOrPreview(
22329
22665
  command,
@@ -22334,9 +22670,9 @@ function registerCategoryCommands(catalog, getClient) {
22334
22670
  (approvalId) => getClient().categories.create(input2, approvalId)
22335
22671
  );
22336
22672
  });
22337
- withMutationOptions(category.command("update <categoryId>")).action(
22673
+ withMutationOptions2(category.command("update <categoryId>")).action(
22338
22674
  async (categoryId, options, command) => {
22339
- const id = requireId(categoryId, "categoryId");
22675
+ const id = requireId2(categoryId, "categoryId");
22340
22676
  const input2 = await readMutationInput(options.from);
22341
22677
  await applyOrPreview(
22342
22678
  command,
@@ -22349,9 +22685,9 @@ function registerCategoryCommands(catalog, getClient) {
22349
22685
  );
22350
22686
  }
22351
22687
  );
22352
- withMutationOptions(category.command("delete <categoryId>"), false).action(
22688
+ withMutationOptions2(category.command("delete <categoryId>"), false).action(
22353
22689
  async (categoryId, _options, command) => {
22354
- const id = requireId(categoryId, "categoryId");
22690
+ const id = requireId2(categoryId, "categoryId");
22355
22691
  await applyOrPreview(
22356
22692
  command,
22357
22693
  { delete: true },
@@ -22368,9 +22704,9 @@ function registerTagCommands(catalog, getClient) {
22368
22704
  const tag = catalog.command("tag");
22369
22705
  tag.command("list").action(async () => emitSuccess(await getClient().tags.list()));
22370
22706
  tag.command("get <tagId>").action(async (tagId) => {
22371
- emitSuccess(await getClient().tags.get(requireId(tagId, "tagId")));
22707
+ emitSuccess(await getClient().tags.get(requireId2(tagId, "tagId")));
22372
22708
  });
22373
- withMutationOptions(tag.command("create")).action(async (options, command) => {
22709
+ withMutationOptions2(tag.command("create")).action(async (options, command) => {
22374
22710
  const input2 = await readMutationInput(options.from);
22375
22711
  await applyOrPreview(
22376
22712
  command,
@@ -22381,8 +22717,8 @@ function registerTagCommands(catalog, getClient) {
22381
22717
  (approvalId) => getClient().tags.create(input2, approvalId)
22382
22718
  );
22383
22719
  });
22384
- withMutationOptions(tag.command("update <tagId>")).action(async (tagId, options, command) => {
22385
- const id = requireId(tagId, "tagId");
22720
+ withMutationOptions2(tag.command("update <tagId>")).action(async (tagId, options, command) => {
22721
+ const id = requireId2(tagId, "tagId");
22386
22722
  const input2 = await readMutationInput(options.from);
22387
22723
  await applyOrPreview(
22388
22724
  command,
@@ -22394,9 +22730,9 @@ function registerTagCommands(catalog, getClient) {
22394
22730
  () => getClient().tags.get(id)
22395
22731
  );
22396
22732
  });
22397
- withMutationOptions(tag.command("delete <tagId>"), false).action(
22733
+ withMutationOptions2(tag.command("delete <tagId>"), false).action(
22398
22734
  async (tagId, _options, command) => {
22399
- const id = requireId(tagId, "tagId");
22735
+ const id = requireId2(tagId, "tagId");
22400
22736
  await applyOrPreview(
22401
22737
  command,
22402
22738
  { delete: true },
@@ -22419,12 +22755,12 @@ function registerAssetCommands(catalog, getClient) {
22419
22755
  emitSuccess(await getClient().assets.list(parsed.data));
22420
22756
  });
22421
22757
  asset.command("get <assetId>").action(async (assetId) => {
22422
- emitSuccess(await getClient().assets.get(requireId(assetId, "assetId")));
22758
+ emitSuccess(await getClient().assets.get(requireId2(assetId, "assetId")));
22423
22759
  });
22424
- withMutationOptions(
22760
+ withMutationOptions2(
22425
22761
  asset.command("update <assetId>").option("--diff", "Incluye la ficha actual")
22426
22762
  ).action(async (assetId, options, command) => {
22427
- const id = requireId(assetId, "assetId");
22763
+ const id = requireId2(assetId, "assetId");
22428
22764
  const parsed = AssetMetadataUpdateInputSchema.safeParse(await readMutationInput(options.from));
22429
22765
  if (!parsed.success) {
22430
22766
  throw new CliProtocolError(
@@ -22443,7 +22779,7 @@ function registerAssetCommands(catalog, getClient) {
22443
22779
  options.diff ? () => getClient().assets.get(id) : void 0
22444
22780
  );
22445
22781
  });
22446
- withMutationOptions(
22782
+ withMutationOptions2(
22447
22783
  asset.command("upload").requiredOption("--file <path>", "Archivo local"),
22448
22784
  false
22449
22785
  ).action(async (options, command) => {
@@ -22452,7 +22788,7 @@ function registerAssetCommands(catalog, getClient) {
22452
22788
  if (!fileStat.isFile()) {
22453
22789
  throw new CliProtocolError("CLI_VALIDATION_ERROR", "--file debe apuntar a un archivo");
22454
22790
  }
22455
- if (!wantsApply(command)) {
22791
+ if (!wantsApply2(command)) {
22456
22792
  emitSuccess({
22457
22793
  validated: "local",
22458
22794
  file: basename3(filePath),
@@ -22472,7 +22808,7 @@ function registerAssetCommands(catalog, getClient) {
22472
22808
  const file2 = new File([contents], basename3(filePath), { type: mimeType });
22473
22809
  const rawApprovalId = command.optsWithGlobals().approvalId;
22474
22810
  if (typeof rawApprovalId === "string") {
22475
- emitSuccess(await getClient().assets.upload(file2, requireId(rawApprovalId, "approvalId")));
22811
+ emitSuccess(await getClient().assets.upload(file2, requireId2(rawApprovalId, "approvalId")));
22476
22812
  return;
22477
22813
  }
22478
22814
  emitSuccess(
@@ -22487,7 +22823,7 @@ function registerAssetCommands(catalog, getClient) {
22487
22823
  })
22488
22824
  );
22489
22825
  });
22490
- withMutationOptions(asset.command("import-url")).action(async (options, command) => {
22826
+ withMutationOptions2(asset.command("import-url")).action(async (options, command) => {
22491
22827
  const input2 = await readMutationInput(options.from);
22492
22828
  await applyOrPreview(
22493
22829
  command,
@@ -22502,16 +22838,16 @@ function registerAssetCommands(catalog, getClient) {
22502
22838
  function registerInventoryCommands(catalog, getClient) {
22503
22839
  const inventory = catalog.command("inventory");
22504
22840
  inventory.command("get <variantId>").action(async (variantId) => {
22505
- emitSuccess(await getClient().inventory.get(requireId(variantId, "variantId")));
22841
+ emitSuccess(await getClient().inventory.get(requireId2(variantId, "variantId")));
22506
22842
  });
22507
22843
  inventory.command("movements <variantId>").option("--reason <reason>").option("--limit <number>", "M\xE1ximo de resultados", parseInteger).option("--offset <number>", "Desplazamiento", parseInteger).action(async (variantId, options) => {
22508
22844
  emitSuccess(
22509
- await getClient().inventory.listMovements(requireId(variantId, "variantId"), options)
22845
+ await getClient().inventory.listMovements(requireId2(variantId, "variantId"), options)
22510
22846
  );
22511
22847
  });
22512
- withMutationOptions(inventory.command("adjust <variantId>")).action(
22848
+ withMutationOptions2(inventory.command("adjust <variantId>")).action(
22513
22849
  async (variantId, options, command) => {
22514
- const id = requireId(variantId, "variantId");
22850
+ const id = requireId2(variantId, "variantId");
22515
22851
  const input2 = await readMutationInput(options.from);
22516
22852
  await applyOrPreview(
22517
22853
  command,
@@ -22524,9 +22860,9 @@ function registerInventoryCommands(catalog, getClient) {
22524
22860
  );
22525
22861
  }
22526
22862
  );
22527
- withMutationOptions(inventory.command("set <variantId>")).action(
22863
+ withMutationOptions2(inventory.command("set <variantId>")).action(
22528
22864
  async (variantId, options, command) => {
22529
- const id = requireId(variantId, "variantId");
22865
+ const id = requireId2(variantId, "variantId");
22530
22866
  const input2 = await readMutationInput(options.from);
22531
22867
  await applyOrPreview(
22532
22868
  command,
@@ -22548,9 +22884,9 @@ function registerImportCommands(catalog, getClient) {
22548
22884
  const prepared = await prepareCatalogImport(input2, options.from, client.imports);
22549
22885
  emitSuccess(await client.imports.preview(prepared));
22550
22886
  });
22551
- withMutationOptions(imports.command("apply <importId>"), false).action(
22887
+ withMutationOptions2(imports.command("apply <importId>"), false).action(
22552
22888
  async (importId, _options, command) => {
22553
- const id = requireId(importId, "importId");
22889
+ const id = requireId2(importId, "importId");
22554
22890
  await applyOrPreview(
22555
22891
  command,
22556
22892
  { importId: id, action: "apply" },
@@ -22563,7 +22899,244 @@ function registerImportCommands(catalog, getClient) {
22563
22899
  );
22564
22900
  imports.command("example").description("Imprime el payload can\xF3nico de una importaci\xF3n").action(() => emitSuccess(CATALOG_IMPORT_EXAMPLE));
22565
22901
  imports.command("status <importId>").action(async (importId) => {
22566
- emitSuccess(await getClient().imports.get(requireId(importId, "importId")));
22902
+ emitSuccess(await getClient().imports.get(requireId2(importId, "importId")));
22903
+ });
22904
+ }
22905
+
22906
+ // src/commands/appointments.ts
22907
+ async function proposeOrPreview(command, getClient, operationName, input2, payload, current) {
22908
+ if (!wantsApply(command)) {
22909
+ emitSuccess(localResult(input2, current ? await current() : void 0));
22910
+ return;
22911
+ }
22912
+ emitSuccess(
22913
+ await getClient().operations.propose({
22914
+ operationName,
22915
+ payload
22916
+ })
22917
+ );
22918
+ }
22919
+ function requireDateFormat(value, name) {
22920
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) {
22921
+ throw new CliProtocolError("CLI_VALIDATION_ERROR", `${name} debe tener el formato YYYY-MM-DD`);
22922
+ }
22923
+ return value;
22924
+ }
22925
+ function datesInRange(from, to) {
22926
+ const start = /* @__PURE__ */ new Date(`${from}T00:00:00Z`);
22927
+ const end = /* @__PURE__ */ new Date(`${to}T00:00:00Z`);
22928
+ if (Number.isNaN(start.getTime()) || Number.isNaN(end.getTime())) {
22929
+ throw new CliProtocolError("CLI_VALIDATION_ERROR", "Fechas inv\xE1lidas");
22930
+ }
22931
+ if (end < start) {
22932
+ throw new CliProtocolError("CLI_VALIDATION_ERROR", "--to no puede ser anterior a --date");
22933
+ }
22934
+ const maxDays = 31;
22935
+ const dates = [];
22936
+ const cursor = new Date(start);
22937
+ while (cursor <= end) {
22938
+ dates.push(cursor.toISOString().slice(0, 10));
22939
+ cursor.setUTCDate(cursor.getUTCDate() + 1);
22940
+ if (dates.length > maxDays) {
22941
+ throw new CliProtocolError(
22942
+ "CLI_VALIDATION_ERROR",
22943
+ `El rango entre --date y --to no puede superar ${maxDays} d\xEDas`
22944
+ );
22945
+ }
22946
+ }
22947
+ return dates;
22948
+ }
22949
+ async function findService(getClient, serviceId) {
22950
+ const services = await getClient().appointments.listServices(true);
22951
+ const match = services.find((service) => service.id === serviceId);
22952
+ if (!match) {
22953
+ throw new CliProtocolError("CLI_NOT_FOUND", `No se encontr\xF3 el servicio ${serviceId}`);
22954
+ }
22955
+ return match;
22956
+ }
22957
+ async function findProfessional(getClient, professionalId) {
22958
+ const professionals = await getClient().appointments.listProfessionals(true);
22959
+ const match = professionals.find((professional) => professional.id === professionalId);
22960
+ if (!match) {
22961
+ throw new CliProtocolError("CLI_NOT_FOUND", `No se encontr\xF3 el profesional ${professionalId}`);
22962
+ }
22963
+ return match;
22964
+ }
22965
+ function registerServiceCommands(root, getClient) {
22966
+ const services = root.command("services").description("Consulta y gestiona los servicios de citas del negocio");
22967
+ services.command("list").option("--include-inactive", "Incluye servicios desactivados").action(async (options) => {
22968
+ emitSuccess(await getClient().appointments.listServices(Boolean(options.includeInactive)));
22969
+ });
22970
+ services.command("show <serviceId>").action(async (serviceId) => {
22971
+ emitSuccess(await findService(getClient, requireId(serviceId, "serviceId")));
22972
+ });
22973
+ withMutationOptions(services.command("create")).action(async (options, command) => {
22974
+ const input2 = await readMutationInput(options.from);
22975
+ await proposeOrPreview(command, getClient, "appointments.services.create", input2, {
22976
+ body: input2
22977
+ });
22978
+ });
22979
+ withMutationOptions(services.command("update <serviceId>")).action(
22980
+ async (serviceId, options, command) => {
22981
+ const id = requireId(serviceId, "serviceId");
22982
+ const input2 = await readMutationInput(options.from);
22983
+ await proposeOrPreview(
22984
+ command,
22985
+ getClient,
22986
+ "appointments.services.update",
22987
+ input2,
22988
+ { serviceId: id, body: input2 },
22989
+ () => findService(getClient, id)
22990
+ );
22991
+ }
22992
+ );
22993
+ withMutationOptions(services.command("deactivate <serviceId>"), false).action(
22994
+ async (serviceId, _options, command) => {
22995
+ const id = requireId(serviceId, "serviceId");
22996
+ await proposeOrPreview(
22997
+ command,
22998
+ getClient,
22999
+ "appointments.services.deactivate",
23000
+ { isActive: false },
23001
+ { serviceId: id },
23002
+ () => findService(getClient, id)
23003
+ );
23004
+ }
23005
+ );
23006
+ }
23007
+ function registerProfessionalCommands(root, getClient) {
23008
+ const professionals = root.command("professionals").description("Consulta y gestiona los profesionales de citas del negocio");
23009
+ professionals.command("list").option("--include-inactive", "Incluye profesionales desactivados").action(async (options) => {
23010
+ emitSuccess(
23011
+ await getClient().appointments.listProfessionals(Boolean(options.includeInactive))
23012
+ );
23013
+ });
23014
+ professionals.command("show <professionalId>").action(async (professionalId) => {
23015
+ emitSuccess(await findProfessional(getClient, requireId(professionalId, "professionalId")));
23016
+ });
23017
+ withMutationOptions(professionals.command("create")).action(async (options, command) => {
23018
+ const input2 = await readMutationInput(options.from);
23019
+ await proposeOrPreview(command, getClient, "appointments.professionals.create", input2, {
23020
+ body: input2
23021
+ });
23022
+ });
23023
+ withMutationOptions(professionals.command("update <professionalId>")).action(
23024
+ async (professionalId, options, command) => {
23025
+ const id = requireId(professionalId, "professionalId");
23026
+ const input2 = await readMutationInput(options.from);
23027
+ await proposeOrPreview(
23028
+ command,
23029
+ getClient,
23030
+ "appointments.professionals.update",
23031
+ input2,
23032
+ { professionalId: id, body: input2 },
23033
+ () => findProfessional(getClient, id)
23034
+ );
23035
+ }
23036
+ );
23037
+ withMutationOptions(professionals.command("deactivate <professionalId>"), false).action(
23038
+ async (professionalId, _options, command) => {
23039
+ const id = requireId(professionalId, "professionalId");
23040
+ await proposeOrPreview(
23041
+ command,
23042
+ getClient,
23043
+ "appointments.professionals.deactivate",
23044
+ { isActive: false },
23045
+ { professionalId: id },
23046
+ () => findProfessional(getClient, id)
23047
+ );
23048
+ }
23049
+ );
23050
+ }
23051
+ function registerAvailabilityCommands(root, getClient) {
23052
+ const availability = root.command("availability").description("Consulta y reemplaza el horario y las excepciones de un profesional");
23053
+ availability.command("show <professionalId>").action(async (professionalId) => {
23054
+ emitSuccess(
23055
+ await getClient().appointments.getAvailability(requireId(professionalId, "professionalId"))
23056
+ );
23057
+ });
23058
+ withMutationOptions(availability.command("set <professionalId>")).action(
23059
+ async (professionalId, options, command) => {
23060
+ const id = requireId(professionalId, "professionalId");
23061
+ const input2 = await readMutationInput(options.from);
23062
+ await proposeOrPreview(
23063
+ command,
23064
+ getClient,
23065
+ "appointments.availability.set",
23066
+ input2,
23067
+ { professionalId: id, body: input2 },
23068
+ () => getClient().appointments.getAvailability(id)
23069
+ );
23070
+ }
23071
+ );
23072
+ withMutationOptions(availability.command("exceptions-set <professionalId>")).action(
23073
+ async (professionalId, options, command) => {
23074
+ const id = requireId(professionalId, "professionalId");
23075
+ const input2 = await readMutationInput(options.from);
23076
+ await proposeOrPreview(
23077
+ command,
23078
+ getClient,
23079
+ "appointments.availability.exceptions.set",
23080
+ input2,
23081
+ { professionalId: id, body: input2 },
23082
+ () => getClient().appointments.getAvailability(id)
23083
+ );
23084
+ }
23085
+ );
23086
+ }
23087
+ function registerAgendaCommand(root, getClient) {
23088
+ root.command("agenda").description("Consulta la agenda de citas de un d\xEDa o un rango de d\xEDas").requiredOption("--date <YYYY-MM-DD>", "Fecha inicial").option("--to <YYYY-MM-DD>", "Fecha final (inclusive); por defecto igual a --date").option("--professional-id <id>", "Filtra por un profesional").action(async (options) => {
23089
+ const from = requireDateFormat(options.date, "--date");
23090
+ const to = options.to ? requireDateFormat(options.to, "--to") : from;
23091
+ const dates = datesInRange(from, to);
23092
+ const client = getClient();
23093
+ const byDate = {};
23094
+ for (const date5 of dates) {
23095
+ byDate[date5] = await client.appointments.getAgenda(date5, options.professionalId);
23096
+ }
23097
+ emitSuccess(dates.length === 1 ? byDate[from] : byDate);
23098
+ });
23099
+ }
23100
+ function registerAppointmentsCommands(root, getClient) {
23101
+ registerServiceCommands(root, getClient);
23102
+ registerProfessionalCommands(root, getClient);
23103
+ registerAvailabilityCommands(root, getClient);
23104
+ registerAgendaCommand(root, getClient);
23105
+ }
23106
+
23107
+ // src/commands/storefront.ts
23108
+ function registerStorefrontCommands(root, getClient) {
23109
+ const storefront = root.command("storefront").description("Consulta y publica la tienda p\xFAblica de citas");
23110
+ storefront.command("status").description("Muestra el estado, slug y disposici\xF3n de publicaci\xF3n de la tienda").action(async () => {
23111
+ emitSuccess(await getClient().storefront.getPublication());
23112
+ });
23113
+ storefront.command("publish").description("Previsualiza o propone publicar la tienda con un slug").option("--slug <slug>", "Slug p\xFAblico deseado (3-100 caracteres)").option(
23114
+ "--apply",
23115
+ "Crea una propuesta para aprobaci\xF3n en Avileo (apl\xEDcala luego con `operation apply <id>`)"
23116
+ ).action(async (options, command) => {
23117
+ const input2 = { enabled: true, ...options.slug ? { slug: options.slug } : {} };
23118
+ await proposeOrPreview(
23119
+ command,
23120
+ getClient,
23121
+ "storefront.publication.set",
23122
+ input2,
23123
+ input2,
23124
+ () => getClient().storefront.getPublication()
23125
+ );
23126
+ });
23127
+ storefront.command("unpublish").description("Previsualiza o propone despublicar la tienda").option(
23128
+ "--apply",
23129
+ "Crea una propuesta para aprobaci\xF3n en Avileo (apl\xEDcala luego con `operation apply <id>`)"
23130
+ ).action(async (_options, command) => {
23131
+ const input2 = { enabled: false };
23132
+ await proposeOrPreview(
23133
+ command,
23134
+ getClient,
23135
+ "storefront.publication.set",
23136
+ input2,
23137
+ input2,
23138
+ () => getClient().storefront.getPublication()
23139
+ );
22567
23140
  });
22568
23141
  }
22569
23142
 
@@ -22647,6 +23220,196 @@ function registerSalesCommands(root, getClient) {
22647
23220
  });
22648
23221
  }
22649
23222
 
23223
+ // ../../../tari/public-page/src/appearance.ts
23224
+ var PUBLIC_PAGE_PALETTE_IDS2 = [
23225
+ "clasico",
23226
+ "terracotta",
23227
+ "forest",
23228
+ "graphite",
23229
+ "rose",
23230
+ "ocean",
23231
+ "violet",
23232
+ "brasa",
23233
+ "aji",
23234
+ "mercado",
23235
+ "marino"
23236
+ ];
23237
+ var PublicPagePaletteIdSchema2 = external_exports.enum(PUBLIC_PAGE_PALETTE_IDS2);
23238
+ var PUBLIC_PAGE_FONT_IDS2 = [
23239
+ "inter",
23240
+ "fraunces",
23241
+ "manrope",
23242
+ "archivo",
23243
+ "bricolage"
23244
+ ];
23245
+ var PublicPageFontIdSchema2 = external_exports.enum(PUBLIC_PAGE_FONT_IDS2);
23246
+ var PUBLIC_PAGE_RADIUS_IDS2 = ["compacto", "suave", "redondeado"];
23247
+ var PublicPageRadiusIdSchema2 = external_exports.enum(PUBLIC_PAGE_RADIUS_IDS2);
23248
+ var PublicPageAppearanceSchema2 = external_exports.object({
23249
+ paletteId: PublicPagePaletteIdSchema2,
23250
+ fontId: PublicPageFontIdSchema2,
23251
+ radiusId: PublicPageRadiusIdSchema2
23252
+ });
23253
+
23254
+ // ../../../tari/public-page/src/hero.ts
23255
+ var PUBLIC_PAGE_HERO_LIMITS2 = {
23256
+ maxSlides: 6,
23257
+ eyebrowMax: 40,
23258
+ titleMax: 100,
23259
+ descriptionMax: 240,
23260
+ ctaLabelMax: 50
23261
+ };
23262
+ var PublicPageHeroCtaKindSchema2 = external_exports.enum(["primary", "whatsapp", "url"]);
23263
+ var PublicPageHeroCtaSchema2 = external_exports.object({
23264
+ label: external_exports.string().min(1).max(PUBLIC_PAGE_HERO_LIMITS2.ctaLabelMax),
23265
+ kind: PublicPageHeroCtaKindSchema2,
23266
+ url: external_exports.string().url().startsWith("https://").optional()
23267
+ }).refine(
23268
+ (value) => value.kind === "url" ? typeof value.url === "string" && value.url.length > 0 : true,
23269
+ {
23270
+ message: 'url es requerida cuando kind es "url"',
23271
+ path: ["url"]
23272
+ }
23273
+ ).refine((value) => value.kind !== "url" ? value.url === void 0 : true, {
23274
+ message: 'url solo aplica cuando kind es "url"',
23275
+ path: ["url"]
23276
+ });
23277
+ var PublicPageHeroSlideSchema2 = external_exports.object({
23278
+ id: external_exports.string().uuid(),
23279
+ imageId: external_exports.string().uuid().nullable(),
23280
+ imageUrl: external_exports.string().url().nullable(),
23281
+ eyebrow: external_exports.string().max(PUBLIC_PAGE_HERO_LIMITS2.eyebrowMax).nullable(),
23282
+ title: external_exports.string().min(1).max(PUBLIC_PAGE_HERO_LIMITS2.titleMax),
23283
+ description: external_exports.string().max(PUBLIC_PAGE_HERO_LIMITS2.descriptionMax).nullable(),
23284
+ cta: PublicPageHeroCtaSchema2.nullable()
23285
+ });
23286
+ var PublicPageHeroSchema2 = external_exports.object({
23287
+ slides: external_exports.array(PublicPageHeroSlideSchema2).max(PUBLIC_PAGE_HERO_LIMITS2.maxSlides)
23288
+ });
23289
+ var PublicPageHeroViewSlideSchema2 = PublicPageHeroSlideSchema2.omit({ imageId: true });
23290
+ var PublicPageHeroViewSchema2 = external_exports.object({
23291
+ slides: external_exports.array(PublicPageHeroViewSlideSchema2).max(PUBLIC_PAGE_HERO_LIMITS2.maxSlides)
23292
+ });
23293
+ var PublicPageHeroSlideInputSchema2 = external_exports.object({
23294
+ id: external_exports.string().uuid().optional(),
23295
+ imageId: external_exports.string().uuid().nullable().optional(),
23296
+ eyebrow: external_exports.string().max(PUBLIC_PAGE_HERO_LIMITS2.eyebrowMax).nullable().optional(),
23297
+ title: external_exports.string().min(1).max(PUBLIC_PAGE_HERO_LIMITS2.titleMax),
23298
+ description: external_exports.string().max(PUBLIC_PAGE_HERO_LIMITS2.descriptionMax).nullable().optional(),
23299
+ cta: PublicPageHeroCtaSchema2.nullable().optional()
23300
+ });
23301
+ var PublicPageHeroInputSchema2 = external_exports.object({
23302
+ slides: external_exports.array(PublicPageHeroSlideInputSchema2).max(PUBLIC_PAGE_HERO_LIMITS2.maxSlides)
23303
+ });
23304
+ var PublicPageHeroSlideStoredSchema2 = external_exports.object({
23305
+ id: external_exports.string().uuid(),
23306
+ imageId: external_exports.string().uuid().nullable(),
23307
+ eyebrow: external_exports.string().max(PUBLIC_PAGE_HERO_LIMITS2.eyebrowMax).nullable(),
23308
+ title: external_exports.string().min(1).max(PUBLIC_PAGE_HERO_LIMITS2.titleMax),
23309
+ description: external_exports.string().max(PUBLIC_PAGE_HERO_LIMITS2.descriptionMax).nullable(),
23310
+ cta: PublicPageHeroCtaSchema2.nullable()
23311
+ });
23312
+ var PublicPageHeroStoredSchema2 = external_exports.object({
23313
+ slides: external_exports.array(PublicPageHeroSlideStoredSchema2).max(PUBLIC_PAGE_HERO_LIMITS2.maxSlides)
23314
+ });
23315
+
23316
+ // ../../../tari/public-page/src/agent-contracts.ts
23317
+ var publicPageAgentVersionSchema2 = external_exports.literal("1");
23318
+ var PublicPageAgentAppearanceSchema2 = external_exports.object({
23319
+ paletteId: PublicPagePaletteIdSchema2,
23320
+ fontId: PublicPageFontIdSchema2,
23321
+ radiusId: PublicPageRadiusIdSchema2
23322
+ });
23323
+ var PublicPageAgentAppearanceOptionsSchema2 = external_exports.object({
23324
+ paletteIds: external_exports.array(PublicPagePaletteIdSchema2).default([...PUBLIC_PAGE_PALETTE_IDS2]),
23325
+ fontIds: external_exports.array(PublicPageFontIdSchema2).default([...PUBLIC_PAGE_FONT_IDS2]),
23326
+ radiusIds: external_exports.array(PublicPageRadiusIdSchema2).default([...PUBLIC_PAGE_RADIUS_IDS2])
23327
+ });
23328
+ var PublicPageAgentAppearanceResponseSchema2 = external_exports.object({
23329
+ version: publicPageAgentVersionSchema2,
23330
+ appearance: PublicPageAgentAppearanceSchema2,
23331
+ options: PublicPageAgentAppearanceOptionsSchema2
23332
+ });
23333
+ var PublicPageAgentAppearanceUpdateRequestSchema2 = external_exports.object({
23334
+ paletteId: PublicPagePaletteIdSchema2.optional(),
23335
+ fontId: PublicPageFontIdSchema2.optional(),
23336
+ radiusId: PublicPageRadiusIdSchema2.optional()
23337
+ }).refine(
23338
+ (value) => value.paletteId !== void 0 || value.fontId !== void 0 || value.radiusId !== void 0,
23339
+ { message: "Se requiere al menos un campo de apariencia" }
23340
+ );
23341
+ var PublicPageAgentHeroLimitsSchema2 = external_exports.object({
23342
+ maxSlides: external_exports.literal(PUBLIC_PAGE_HERO_LIMITS2.maxSlides),
23343
+ eyebrowMax: external_exports.literal(PUBLIC_PAGE_HERO_LIMITS2.eyebrowMax),
23344
+ titleMax: external_exports.literal(PUBLIC_PAGE_HERO_LIMITS2.titleMax),
23345
+ descriptionMax: external_exports.literal(PUBLIC_PAGE_HERO_LIMITS2.descriptionMax),
23346
+ ctaLabelMax: external_exports.literal(PUBLIC_PAGE_HERO_LIMITS2.ctaLabelMax)
23347
+ });
23348
+ var PublicPageAgentHeroResponseSchema2 = external_exports.object({
23349
+ version: publicPageAgentVersionSchema2,
23350
+ hero: PublicPageHeroSchema2,
23351
+ limits: PublicPageAgentHeroLimitsSchema2
23352
+ });
23353
+ var PublicPageAgentHeroUpdateRequestSchema2 = external_exports.object({
23354
+ slides: PublicPageHeroSlideInputSchema2.array().max(PUBLIC_PAGE_HERO_LIMITS2.maxSlides)
23355
+ });
23356
+ var PublicPageAgentImageResponseSchema2 = external_exports.object({
23357
+ version: publicPageAgentVersionSchema2,
23358
+ image: external_exports.object({
23359
+ id: external_exports.string().uuid(),
23360
+ url: external_exports.string().url()
23361
+ })
23362
+ });
23363
+ var PUBLIC_PAGE_HERO_IMAGE_MAX_BYTES2 = 5 * 1024 * 1024;
23364
+
23365
+ // src/commands/public-page.ts
23366
+ function registerPublicPageCommands(root, getClient) {
23367
+ const publicPage = root.command("appearance").description("Consulta o cambia los colores, tipograf\xEDa y esquinas de la p\xE1gina p\xFAblica");
23368
+ publicPage.command("show").description("Muestra la apariencia actual y las opciones disponibles").action(async () => {
23369
+ emitSuccess(await getClient().publicPage.getAppearance());
23370
+ });
23371
+ publicPage.command("set").description("Cambia la paleta, tipograf\xEDa o radio de la p\xE1gina p\xFAblica").option("--palette <id>", "Id de paleta (ver `appearance show` para las opciones)").option("--font <id>", "Id de tipograf\xEDa de t\xEDtulos").option("--radius <id>", "Id de forma de esquinas").action(async (options) => {
23372
+ if (!options.palette && !options.font && !options.radius) {
23373
+ throw new CliProtocolError(
23374
+ "CLI_VALIDATION_ERROR",
23375
+ "Indica al menos uno de --palette, --font o --radius"
23376
+ );
23377
+ }
23378
+ const parsed = PublicPageAgentAppearanceUpdateRequestSchema2.safeParse({
23379
+ ...options.palette ? { paletteId: options.palette } : {},
23380
+ ...options.font ? { fontId: options.font } : {},
23381
+ ...options.radius ? { radiusId: options.radius } : {}
23382
+ });
23383
+ if (!parsed.success) {
23384
+ throw new CliProtocolError(
23385
+ "CLI_VALIDATION_ERROR",
23386
+ "Id de paleta, tipograf\xEDa o radio inv\xE1lido: usa `appearance show` para ver las opciones"
23387
+ );
23388
+ }
23389
+ emitSuccess(await getClient().publicPage.updateAppearance(parsed.data));
23390
+ });
23391
+ const hero = root.command("hero").description("Consulta o cambia las diapositivas de inicio de la p\xE1gina p\xFAblica");
23392
+ hero.command("show").description("Muestra las diapositivas y los l\xEDmites vigentes").action(async () => {
23393
+ emitSuccess(await getClient().publicPage.getHero());
23394
+ });
23395
+ hero.command("set").description("Reemplaza la lista completa de diapositivas").requiredOption("--file <json-file>", 'Objeto JSON con {"slides": [...]}').action(async (options) => {
23396
+ const input2 = await readMutationInput(options.file);
23397
+ const parsed = PublicPageAgentHeroUpdateRequestSchema2.safeParse(input2);
23398
+ if (!parsed.success) {
23399
+ throw new CliProtocolError(
23400
+ "CLI_VALIDATION_ERROR",
23401
+ "El archivo debe contener { slides: [...] } v\xE1lido (hasta 6 diapositivas, cada una con t\xEDtulo)"
23402
+ );
23403
+ }
23404
+ emitSuccess(await getClient().publicPage.putHero(parsed.data));
23405
+ });
23406
+ const heroImage = hero.command("image").description("Sube una imagen para usarla en una diapositiva de inicio");
23407
+ heroImage.command("upload <file>").description("Sube un archivo local (JPEG/PNG/WebP, m\xE1x. 5 MB) y devuelve su id y URL p\xFAblica").action(async (file2) => {
23408
+ const image = await readImage(file2, PUBLIC_PAGE_HERO_IMAGE_MAX_BYTES2);
23409
+ emitSuccess(await getClient().publicPage.uploadHeroImage(image));
23410
+ });
23411
+ }
23412
+
22650
23413
  // src/commands/auth.ts
22651
23414
  import { spawn } from "child_process";
22652
23415
  import { dirname as dirname3 } from "path";
@@ -23109,6 +23872,9 @@ function createProgram(options = {}) {
23109
23872
  registerBusinessCommands(program, getClient);
23110
23873
  registerSalesCommands(program, getClient);
23111
23874
  registerCatalogCommands(program, getClient);
23875
+ registerAppointmentsCommands(program, getClient);
23876
+ registerStorefrontCommands(program, getClient);
23877
+ registerPublicPageCommands(program, getClient);
23112
23878
  const operation = program.command("operation").description("Consulta y aplica operaciones aprobadas en Avileo");
23113
23879
  registerOperationBatchCommands(operation, getClient);
23114
23880
  operation.command("status <id>").description("Consulta el estado de una operaci\xF3n").action(async (id) => {