ponch-mcp-server 1.0.79 → 1.0.81

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
@@ -2530,9 +2530,9 @@ var MartinMemoriaSchema = import_zod21.z.object({
2530
2530
  status: StatusMemoriaEnum.default("explicito"),
2531
2531
  /** Veces que Martin la usó */
2532
2532
  aplicacionesCount: import_zod21.z.number().int().nonnegative().default(0),
2533
- ultimaAplicacionAt: import_zod21.z.string().datetime().nullable().default(null),
2534
- createdAt: import_zod21.z.string().datetime(),
2535
- updatedAt: import_zod21.z.string().datetime()
2533
+ ultimaAplicacionAt: import_zod21.z.string().datetime({ offset: true }).nullable().default(null),
2534
+ createdAt: import_zod21.z.string().datetime({ offset: true }),
2535
+ updatedAt: import_zod21.z.string().datetime({ offset: true })
2536
2536
  }).strict();
2537
2537
  function buildMartinMemoria(input) {
2538
2538
  const now2 = (/* @__PURE__ */ new Date()).toISOString();
@@ -2609,11 +2609,11 @@ var MartinRutinaSchema = import_zod22.z.object({
2609
2609
  origen: OrigenRutinaSchema,
2610
2610
  status: StatusRutinaEnum.default("activa"),
2611
2611
  ejecucionesCount: import_zod22.z.number().int().nonnegative().default(0),
2612
- ultimaEjecucionAt: import_zod22.z.string().datetime().nullable().default(null),
2612
+ ultimaEjecucionAt: import_zod22.z.string().datetime({ offset: true }).nullable().default(null),
2613
2613
  /** Calculado para optimizar query del cron */
2614
- proximaEjecucionAt: import_zod22.z.string().datetime(),
2615
- createdAt: import_zod22.z.string().datetime(),
2616
- updatedAt: import_zod22.z.string().datetime()
2614
+ proximaEjecucionAt: import_zod22.z.string().datetime({ offset: true }),
2615
+ createdAt: import_zod22.z.string().datetime({ offset: true }),
2616
+ updatedAt: import_zod22.z.string().datetime({ offset: true })
2617
2617
  }).strict();
2618
2618
  function buildMartinRutina(input) {
2619
2619
  const now2 = (/* @__PURE__ */ new Date()).toISOString();
@@ -10204,7 +10204,7 @@ function calcularProximaEjecucion(rutina, tenantTimezone, desdeISO) {
10204
10204
  }
10205
10205
  switch (frecuencia) {
10206
10206
  case "diaria":
10207
- return candidate.toISO();
10207
+ return candidate.toISO({ includeOffset: true });
10208
10208
  case "semanal": {
10209
10209
  if (config.diaSemana === null) {
10210
10210
  throw new Error("Frecuencia semanal requires config.diaSemana (0-6)");
@@ -10213,7 +10213,7 @@ function calcularProximaEjecucion(rutina, tenantTimezone, desdeISO) {
10213
10213
  while (candidate.weekday !== targetWeekday) {
10214
10214
  candidate = candidate.plus({ days: 1 });
10215
10215
  }
10216
- return candidate.toISO();
10216
+ return candidate.toISO({ includeOffset: true });
10217
10217
  }
10218
10218
  case "quincenal": {
10219
10219
  if (config.diaSemana === null) {
@@ -10225,13 +10225,13 @@ function calcularProximaEjecucion(rutina, tenantTimezone, desdeISO) {
10225
10225
  while (next.weekday !== targetWeekday) {
10226
10226
  next = next.plus({ days: 1 });
10227
10227
  }
10228
- return next.toISO();
10228
+ return next.toISO({ includeOffset: true });
10229
10229
  }
10230
10230
  while (candidate.weekday !== targetWeekday) {
10231
10231
  candidate = candidate.plus({ days: 1 });
10232
10232
  }
10233
10233
  candidate = candidate.plus({ days: 7 });
10234
- return candidate.toISO();
10234
+ return candidate.toISO({ includeOffset: true });
10235
10235
  }
10236
10236
  case "mensual": {
10237
10237
  if (config.diaMes === null) {
@@ -10242,7 +10242,7 @@ function calcularProximaEjecucion(rutina, tenantTimezone, desdeISO) {
10242
10242
  target = target.plus({ months: 1 });
10243
10243
  target = target.set({ day: Math.min(config.diaMes, target.daysInMonth) });
10244
10244
  }
10245
- return target.toISO();
10245
+ return target.toISO({ includeOffset: true });
10246
10246
  }
10247
10247
  case "trimestral": {
10248
10248
  if (config.diaMes === null) {
@@ -10253,7 +10253,7 @@ function calcularProximaEjecucion(rutina, tenantTimezone, desdeISO) {
10253
10253
  target = target.plus({ months: 3 });
10254
10254
  target = target.set({ day: Math.min(config.diaMes, target.daysInMonth) });
10255
10255
  }
10256
- return target.toISO();
10256
+ return target.toISO({ includeOffset: true });
10257
10257
  }
10258
10258
  }
10259
10259
  }
@@ -10649,7 +10649,9 @@ async function getUserContext({
10649
10649
  throw new Error(`userContext: usuario ${uid} no encontrado.`);
10650
10650
  }
10651
10651
  const tenantsMap = userDoc.tenants;
10652
- const rol = tenantsMap?.[tenantId]?.rol ?? null;
10652
+ const saasLevelRol = userDoc.rol;
10653
+ const tenantRol = tenantsMap?.[tenantId]?.rol;
10654
+ const rol = saasLevelRol && SUPER_ADMIN_ROLES.includes(saasLevelRol) ? saasLevelRol : tenantRol ?? null;
10653
10655
  let rolNombre;
10654
10656
  if (rol === null) {
10655
10657
  rolNombre = null;
@@ -16164,7 +16166,12 @@ function registerMarketingTools(server, session) {
16164
16166
  mensaje: out.mensaje
16165
16167
  };
16166
16168
  } else {
16167
- payload = { ok: false, state: result.state, mensaje: result.text };
16169
+ payload = {
16170
+ ok: false,
16171
+ state: result.state,
16172
+ mensaje: result.text,
16173
+ ...result.validationErrors && result.validationErrors.length > 0 ? { validationErrors: result.validationErrors } : {}
16174
+ };
16168
16175
  }
16169
16176
  return { content: [{ type: "text", text: JSON.stringify(payload, null, 2) }] };
16170
16177
  }
@@ -16310,7 +16317,12 @@ function registerMarketingTools(server, session) {
16310
16317
  } else if (result.state === "success") {
16311
16318
  returnPayload = result.structuredOutput;
16312
16319
  } else {
16313
- returnPayload = { ok: false, state: result.state, mensaje: result.text };
16320
+ returnPayload = {
16321
+ ok: false,
16322
+ state: result.state,
16323
+ mensaje: result.text,
16324
+ ...result.validationErrors && result.validationErrors.length > 0 ? { validationErrors: result.validationErrors } : {}
16325
+ };
16314
16326
  }
16315
16327
  return { content: [{ type: "text", text: JSON.stringify(returnPayload, null, 2) }] };
16316
16328
  }
@@ -16757,7 +16769,8 @@ function renderResult(result) {
16757
16769
  state: result.state,
16758
16770
  text: result.text,
16759
16771
  structuredOutput: result.structuredOutput,
16760
- ...result.disabledReason ? { disabledReason: result.disabledReason } : {}
16772
+ ...result.disabledReason ? { disabledReason: result.disabledReason } : {},
16773
+ ...result.validationErrors && result.validationErrors.length > 0 ? { validationErrors: result.validationErrors } : {}
16761
16774
  };
16762
16775
  return { content: [{ type: "text", text: JSON.stringify(payload, null, 2) }] };
16763
16776
  }