MCPcopy Create free account
hub / github.com/EvoMap/evolver / normalizeValidateResult

Function normalizeValidateResult

src/gep/cliContracts.js:564–584  ·  view source on GitHub ↗
(result)

Source from the content-addressed store, hash-verified

562}
563
564function normalizeValidateResult(result) {
565 const raw = record(result) || {};
566 const status = typeof raw.status === 'number' ? raw.status : (raw.ok ? 200 : 0);
567 const body = raw.body;
568 if (!raw.ok) {
569 return {
570 ok: false,
571 status,
572 reason: stableReason(raw.reason, PUBLISH_FAILURE_REASONS) || hubReason(body) || ('hub ' + status),
573 body,
574 };
575 }
576 const payload = record(body && body.payload);
577 const passed = Boolean(payload && (payload.valid === true || payload.ok === true));
578 return {
579 ok: passed,
580 status,
581 reason: stringField(payload, 'reason') || stringField(payload, 'error'),
582 body,
583 };
584}
585
586async function postPublish(message, deps) {
587 if (deps.publish) return deps.publish(message);

Callers 1

postValidateFunction · 0.85

Calls 4

recordFunction · 0.85
stableReasonFunction · 0.85
hubReasonFunction · 0.85
stringFieldFunction · 0.85

Tested by

no test coverage detected