···
import { Client, CredentialManager } from "@atcute/client";
import { lexiconDoc } from "@atcute/lexicon-doc";
3
+
import { ResolvedSchema } from "@atcute/lexicon-resolver";
import { ActorIdentifier, is, Nsid, ResourceUri } from "@atcute/lexicons";
import { A, useLocation, useNavigate, useParams } from "@solidjs/router";
import { createResource, createSignal, ErrorBoundary, Show, Suspense } from "solid-js";
···
import { pds } from "../components/navbar.jsx";
import Tooltip from "../components/tooltip.jsx";
import { setNotif } from "../layout.jsx";
17
-
import { didDocCache, resolveLexiconAuthority, resolvePDS } from "../utils/api.js";
20
+
resolveLexiconAuthority,
21
+
resolveLexiconSchema,
23
+
} from "../utils/api.js";
import { AtUri, uriTemplates } from "../utils/templates.js";
import { lexicons } from "../utils/types/lexicons.js";
import { verifyRecord } from "../utils/verify.js";
···
const [lexiconUri, setLexiconUri] = createSignal<string>();
const [validRecord, setValidRecord] = createSignal<boolean | undefined>(undefined);
const [validSchema, setValidSchema] = createSignal<boolean | undefined>(undefined);
40
+
const [schema, setSchema] = createSignal<ResolvedSchema>();
41
+
const [lexiconNotFound, setLexiconNotFound] = createSignal<boolean>();
···
if (is(lexicons[params.collection], record.value)) setValidSchema(true);
else setValidSchema(false);
} else if (params.collection === "com.atproto.lexicon.schema") {
83
+
setLexiconNotFound(false);
lexiconDoc.parse(record.value, { mode: "passthrough" });
···
const resolveLexicon = async (nsid: Nsid) => {
104
-
const res = await resolveLexiconAuthority(nsid);
105
-
setLexiconUri(`at://${res}/com.atproto.lexicon.schema/${nsid}`);
113
+
const authority = await resolveLexiconAuthority(nsid);
114
+
setLexiconUri(`at://${authority}/com.atproto.lexicon.schema/${nsid}`);
115
+
if (params.collection !== "com.atproto.lexicon.schema") {
116
+
const schema = await resolveLexiconSchema(authority, nsid);
118
+
setLexiconNotFound(false);
121
+
setLexiconNotFound(true);
const deleteRecord = async () => {
···
<div class="dark:shadow-dark-700 dark:bg-dark-300 mb-3 flex w-full justify-between rounded-lg border-[0.5px] border-neutral-300 bg-neutral-50 px-2 py-1.5 text-sm shadow-xs dark:border-neutral-700">
<RecordTab tab="record" label="Record" />
169
-
<Show when={params.collection === "com.atproto.lexicon.schema"}>
170
-
<RecordTab tab="schema" label="Schema" />
185
+
<RecordTab tab="schema" label="Schema" />
<RecordTab tab="backlinks" label="Backlinks" />
<RecordTab tab="info" label="Info" error />
···
<JSONValue data={record()?.value as any} repo={record()!.uri.split("/")[2]} />
242
-
(location.hash === "#schema" || location.hash.startsWith("#schema:")) &&
243
-
params.collection === "com.atproto.lexicon.schema"
246
-
<ErrorBoundary fallback={(err) => <div>Error: {err.message}</div>}>
247
-
<LexiconSchemaView schema={record()?.value as any} />
254
+
<Show when={location.hash === "#schema" || location.hash.startsWith("#schema:")}>
255
+
<Show when={lexiconNotFound() === true}>
256
+
<span class="w-full px-2 text-sm">Lexicon schema could not be resolved.</span>
258
+
<Show when={lexiconNotFound() === undefined}>
259
+
<span class="w-full px-2 text-sm">Resolving lexicon schema...</span>
261
+
<Show when={schema() || params.collection === "com.atproto.lexicon.schema"}>
262
+
<ErrorBoundary fallback={(err) => <div>Error: {err.message}</div>}>
263
+
<LexiconSchemaView schema={schema()?.rawSchema ?? (record()?.value as any)} />
<Show when={location.hash === "#backlinks"}>
<ErrorBoundary fallback={(err) => <div class="break-words">Error: {err.message}</div>}>