forked from pdsls.dev/pdsls
this repo has no description

validate PLC operations

Changed files
+17 -1
src
views
+17 -1
src/views/repo.tsx
··· 16 16 import { BlobView } from "./blob.jsx"; 17 17 import { TextInput } from "../components/text-input.jsx"; 18 18 import Tooltip from "../components/tooltip.jsx"; 19 - import { CompatibleOperationOrTombstone, defs, IndexedEntry } from "@atcute/did-plc"; 19 + import { 20 + CompatibleOperationOrTombstone, 21 + defs, 22 + IndexedEntry, 23 + processIndexedEntryLog, 24 + } from "@atcute/did-plc"; 20 25 import { createOperationHistory, DiffEntry, groupBy } from "../utils/plc-logs.js"; 21 26 import { localDateFromTimestamp } from "../utils/date.js"; 22 27 ··· 154 159 createSignal<[IndexedEntry<CompatibleOperationOrTombstone>, DiffEntry[]][]>(); 155 160 const [showPlcLogs, setShowPlcLogs] = createSignal(false); 156 161 const [loading, setLoading] = createSignal(false); 162 + const [notice, setNotice] = createSignal<string>(); 157 163 let rpc: Client; 158 164 let pds: string; 159 165 const did = params.repo; ··· 426 432 ); 427 433 const json = await response.json(); 428 434 const logs = defs.indexedEntryLog.parse(json); 435 + try { 436 + await processIndexedEntryLog(did as any, logs); 437 + } catch (e: any) { 438 + setNotice(e); 439 + console.error(e); 440 + setLoading(false); 441 + } 429 442 const opHistory = createOperationHistory(logs).reverse(); 430 443 setPlcOps(Array.from(groupBy(opHistory, (item) => item.orig))); 431 444 setLoading(false); ··· 465 478 </Show> 466 479 </div> 467 480 <Show when={showPlcLogs()}> 481 + <Show when={notice()}> 482 + <div>{notice()}</div> 483 + </Show> 468 484 <PlcLogView plcOps={plcOps() ?? []} /> 469 485 </Show> 470 486 </div>