@peopl-health/nexus 5.51.0-dev.7630 → 5.51.0-dev.7632

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.
@@ -67,7 +67,6 @@ const triageRecommendationEventSchema = new mongoose.Schema({
67
67
  default: [],
68
68
  },
69
69
  supportPendingCandidateIds: { type: [String], default: [] },
70
- supportActionMirrorRecordId: { type: String, default: null },
71
70
  supportMirrorRecordIds: { type: [String], default: [] },
72
71
  supportActionError: { type: String, default: null },
73
72
  supportPendingSettlements: {
@@ -202,12 +202,10 @@ async function generateTriageRecommendations({ payload, provider, runId = null,
202
202
  settle.supportMirroredActions = mirroredActions;
203
203
  settle.supportPendingCandidateIds = priorSupport?.supportPendingCandidateIds
204
204
  || support.audit.supportDeliveryCandidateIds.filter((id) => !mirroredGroupIds.includes(id));
205
- settle.supportMirrorRecordIds = [...(priorSupport?.supportMirrorRecordIds
206
- || (priorSupport?.supportActionMirrorRecordId ? [priorSupport.supportActionMirrorRecordId] : []))];
205
+ settle.supportMirrorRecordIds = [...(priorSupport?.supportMirrorRecordIds || [])];
207
206
  }
208
207
  if (priorSupport?.supportAction) settle.supportAction = priorSupport.supportAction;
209
208
  if (priorSupport?.supportActionMirrored) settle.supportActionMirrored = true;
210
- if (priorSupport?.supportActionMirrorRecordId) settle.supportActionMirrorRecordId = priorSupport.supportActionMirrorRecordId;
211
209
  if (priorSupport?.supportActionMirrorUnknown) settle.supportActionMirrorUnknown = true;
212
210
  if (priorSupport?.supportPendingSettlements?.length) {
213
211
  const recovery = await settleSupportClaims(priorSupport.supportPendingSettlements);
@@ -280,7 +278,6 @@ async function generateTriageRecommendations({ payload, provider, runId = null,
280
278
  if (mirror.ok && pendingAction) {
281
279
  mirroredActions.push(...pendingAction.actions.map(({ candidateId, type }) => ({ candidateId, type })));
282
280
  settle.supportPendingCandidateIds = remainingSupportCandidates(candidates, mirroredActions).map((candidate) => candidate.candidateId);
283
- settle.supportActionMirrorRecordId = mirror.recordId;
284
281
  }
285
282
  if (!mirror.ok) {
286
283
  settle.mirrorError = 'write_failed';
@@ -104,13 +104,14 @@ async function handler(args = {}, context = {}) {
104
104
  }
105
105
  try {
106
106
  const observedAt = runtime.patientInput?.observedAt;
107
+ if (typeof observedAt !== 'string' || Number.isNaN(new Date(observedAt).getTime())) {
108
+ return JSON.stringify({ success: false, error: 'support_routing_source_time_missing', data: {} });
109
+ }
107
110
  const recommendation = new SupportRoutingRecommendation({
108
111
  patientId: runtime.patientCode,
109
112
  origin: 'chat',
110
113
  sourceId: runtime.turnId,
111
- createdAt: typeof observedAt === 'string' && !Number.isNaN(new Date(observedAt).getTime())
112
- ? new Date(observedAt).toISOString()
113
- : new Date().toISOString(),
114
+ createdAt: new Date(observedAt).toISOString(),
114
115
  decisions: (args.decisions || []).map((decision) => normalizedDecision(decision, runtime.turnId)),
115
116
  });
116
117
  if (!isRuntimeLive(runtime)) return inactiveTurn();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peopl-health/nexus",
3
- "version": "5.51.0-dev.7630",
3
+ "version": "5.51.0-dev.7632",
4
4
  "description": "Core messaging and assistant library for WhatsApp communication platforms",
5
5
  "keywords": [
6
6
  "whatsapp",