@peopl-health/nexus 5.76.9 → 5.76.11

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.
@@ -14,6 +14,9 @@ const NEGATION = /\b(sin|niega|no|ninguna?)\b/;
14
14
 
15
15
  const isDay = (value) => typeof value === 'string' && ISO_DAY.test(value) && !Number.isNaN(Date.parse(`${value}T00:00:00Z`));
16
16
  const dmy = (iso) => `${iso.slice(8, 10)}/${iso.slice(5, 7)}/${iso.slice(0, 4)}`;
17
+ // a weekday with the date: the model miscounts the day of the week from a bare date ("el viernes" for a Saturday)
18
+ const WEEKDAYS = ['domingo', 'lunes', 'martes', 'miércoles', 'jueves', 'viernes', 'sábado'];
19
+ const weekdayDmy = (iso) => `${WEEKDAYS[new Date(`${iso}T00:00:00Z`).getUTCDay()]} ${dmy(iso)}`;
17
20
  const addDays = (iso, days) => new Date(Date.parse(`${iso}T00:00:00Z`) + days * 86400000).toISOString().slice(0, 10);
18
21
  const fold = (value) => foldAccents(String(value || '')).toLowerCase().trim();
19
22
  const text = (value) => (typeof value === 'string' ? value.trim() : '');
@@ -132,13 +135,13 @@ function chemoLines(context, today) {
132
135
  }
133
136
  if (context.proximaSesion && context.proximaSesion.fecha >= today) {
134
137
  lines.push(context.proximaSesion.tipo === 'agendada'
135
- ? `Próxima sesión de quimioterapia: ${dmy(context.proximaSesion.fecha)}${CLOCK.test(context.proximaSesion.hora) ? ` a las ${context.proximaSesion.hora}` : ''} (${['agendada', confirmation(context.proximaSesion)].filter(Boolean).join('; ')})`
136
- : `Próxima sesión de quimioterapia: ${dmy(context.proximaSesion.fecha)} (estimada; no la confirmes como cita)`);
138
+ ? `Próxima sesión de quimioterapia: ${weekdayDmy(context.proximaSesion.fecha)}${CLOCK.test(context.proximaSesion.hora) ? ` a las ${context.proximaSesion.hora}` : ''} (${['agendada', confirmation(context.proximaSesion)].filter(Boolean).join('; ')})`
139
+ : `Próxima sesión de quimioterapia: ${weekdayDmy(context.proximaSesion.fecha)} (estimada; no la confirmes como cita)`);
137
140
  }
138
141
  const support = context.proximaVisitaSoporte;
139
142
  if (support && support.fecha >= today) {
140
143
  const care = texts(support.detalle);
141
- lines.push(`Próxima visita a la unidad sin quimioterapia: ${dmy(support.fecha)} (${[care.join(', '), confirmation(support)].filter(Boolean).join('; ')})`);
144
+ lines.push(`Próxima visita a la unidad sin quimioterapia: ${weekdayDmy(support.fecha)} (${[care.join(', '), confirmation(support)].filter(Boolean).join('; ')})`);
142
145
  }
143
146
  if (context.noAplicadas.length) lines.push(`Sesiones no aplicadas en los últimos 90 días: ${context.noAplicadas.map(dmy).join(', ')}`);
144
147
  if (text(context.reaccionInfusion?.texto)) lines.push(`Reacción durante la infusión registrada: ${text(context.reaccionInfusion.texto)} (${dmy(context.reaccionInfusion.fecha)})`);
@@ -880,7 +880,7 @@ function issuePaths(issues) {
880
880
  return [...new Set(issues.map((issue) => String(issue.path || '').replace(/\[[^\]]*\]/g, '[]')).filter(Boolean))];
881
881
  }
882
882
 
883
- // Zod issue paths in the validator's dotted form, so a DTO retry names its field like plan_invalid does.
883
+ // Zod issue paths in dotted form with indices collapsed; keys are the DTO's camelCase, not the model's snake_case.
884
884
  function dtoIssues(err) {
885
885
  const issues = Array.isArray(err?.issues) ? err.issues : [];
886
886
  const paths = issues.map((issue) => ({ path: arr(issue.path).map((key) => (typeof key === 'number' ? '[]' : `.${String(key)}`)).join('').replace(/^\./, '') }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peopl-health/nexus",
3
- "version": "5.76.9",
3
+ "version": "5.76.11",
4
4
  "description": "Core messaging and assistant library for WhatsApp communication platforms",
5
5
  "keywords": [
6
6
  "whatsapp",