@peopl-health/nexus 5.56.0 → 5.57.0-dev.8654
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.
|
@@ -99,8 +99,10 @@ async function writeUnresolvedRequest({ code, trace, question, details, resoluti
|
|
|
99
99
|
const fingerprint = createHash('sha1')
|
|
100
100
|
.update(JSON.stringify([code, category || null, question || null, urgency || null, Boolean(forDoctorOffice)]))
|
|
101
101
|
.digest('hex');
|
|
102
|
-
|
|
103
|
-
const
|
|
102
|
+
const cached = await recentUnresolvedCache.get(code);
|
|
103
|
+
const open = typeof cached === 'string' ? { fingerprint: cached, recordId: null } : cached;
|
|
104
|
+
const duplicate = !replacesClosedTask && open?.fingerprint === fingerprint;
|
|
105
|
+
let recordId = duplicate ? open.recordId ?? null : null;
|
|
104
106
|
const written = await auditedWrite({
|
|
105
107
|
trace,
|
|
106
108
|
code,
|
|
@@ -123,7 +125,7 @@ async function writeUnresolvedRequest({ code, trace, question, details, resoluti
|
|
|
123
125
|
return created;
|
|
124
126
|
},
|
|
125
127
|
});
|
|
126
|
-
if (written) await recentUnresolvedCache.set(code, fingerprint);
|
|
128
|
+
if (written) await recentUnresolvedCache.set(code, { fingerprint, recordId });
|
|
127
129
|
return { written, recordId, duplicate };
|
|
128
130
|
}
|
|
129
131
|
|