atmosphere explorer pdsls.dev
atproto tool typescript

revert local schema validation

juli.ee 38df6c06 e1224663

verified
Changed files
+123 -1
src
utils
types
views
+2
package.json
··· 28 28 "@atcute/did-plc": "^0.2.0", 29 29 "@atcute/identity": "^1.1.3", 30 30 "@atcute/identity-resolver": "^1.1.4", 31 + "@atcute/leaflet": "^1.0.12", 31 32 "@atcute/lexicon-doc": "^2.0.1", 32 33 "@atcute/lexicon-resolver": "^0.1.4", 33 34 "@atcute/lexicons": "^1.2.4", 34 35 "@atcute/oauth-browser-client": "^2.0.1", 35 36 "@atcute/repo": "^0.1.0", 37 + "@atcute/tangled": "^1.0.12", 36 38 "@atcute/tid": "^1.0.3", 37 39 "@codemirror/commands": "^6.10.0", 38 40 "@codemirror/lang-json": "^6.0.2",
+22
pnpm-lock.yaml
··· 29 29 '@atcute/identity-resolver': 30 30 specifier: ^1.1.4 31 31 version: 1.1.4(@atcute/identity@1.1.3) 32 + '@atcute/leaflet': 33 + specifier: ^1.0.12 34 + version: 1.0.12 32 35 '@atcute/lexicon-doc': 33 36 specifier: ^2.0.1 34 37 version: 2.0.1 ··· 44 47 '@atcute/repo': 45 48 specifier: ^0.1.0 46 49 version: 0.1.0 50 + '@atcute/tangled': 51 + specifier: ^1.0.12 52 + version: 1.0.12 47 53 '@atcute/tid': 48 54 specifier: ^1.0.3 49 55 version: 1.0.3 ··· 161 167 '@atcute/identity@1.1.3': 162 168 resolution: {integrity: sha512-oIqPoI8TwWeQxvcLmFEZLdN2XdWcaLVtlm8pNk0E72As9HNzzD9pwKPrLr3rmTLRIoULPPFmq9iFNsTeCIU9ng==} 163 169 170 + '@atcute/leaflet@1.0.12': 171 + resolution: {integrity: sha512-T5laBTl8vwzy0eZXBy07IQSjsLqhbZmRJsffnNQ6XMSc+lnCZ/NHfuKy8TNJbDU6dc26Z7o5l0ELfWz5QESo+w==} 172 + 164 173 '@atcute/lexicon-doc@2.0.1': 165 174 resolution: {integrity: sha512-yWgcBYkvifczVODZSgdVkIljzIfdh50t+QXjkDL/FSu2RP43NGBEZ5xfZqJcT68/UoyE+doSg0dhvOEIlVGU/A==} 166 175 ··· 184 193 185 194 '@atcute/repo@0.1.0': 186 195 resolution: {integrity: sha512-INiYAuma8dydBu7cqd2WVpcXh3mzhIepYBUqFWAK5MqMulPRLTRCc/9GW3G9pxYrOdlvLCVamG2Jf8XK0nuFEw==} 196 + 197 + '@atcute/tangled@1.0.12': 198 + resolution: {integrity: sha512-JKA5sOhd8SLhDFhY+PKHqLLytQBBKSiwcaEzfYUJBeyfvqXFPNNAwvRbe3VST4IQ3izoOu3O0R9/b1mjL45UzA==} 187 199 188 200 '@atcute/tid@1.0.3': 189 201 resolution: {integrity: sha512-wfMJx1IMdnu0CZgWl0uR4JO2s6PGT1YPhpytD4ZHzEYKKQVuqV6Eb/7vieaVo1eYNMp2FrY67FZObeR7utRl2w==} ··· 1758 1770 '@atcute/lexicons': 1.2.4 1759 1771 '@badrap/valita': 0.4.6 1760 1772 1773 + '@atcute/leaflet@1.0.12': 1774 + dependencies: 1775 + '@atcute/atproto': 3.1.9 1776 + '@atcute/lexicons': 1.2.4 1777 + 1761 1778 '@atcute/lexicon-doc@2.0.1': 1762 1779 dependencies: 1763 1780 '@atcute/identity': 1.1.3 ··· 1809 1826 '@atcute/lexicons': 1.2.4 1810 1827 '@atcute/mst': 0.1.0 1811 1828 '@atcute/uint8array': 1.0.5 1829 + 1830 + '@atcute/tangled@1.0.12': 1831 + dependencies: 1832 + '@atcute/atproto': 3.1.9 1833 + '@atcute/lexicons': 1.2.4 1812 1834 1813 1835 '@atcute/tid@1.0.3': {} 1814 1836
+94
src/utils/types/lexicons.ts
··· 1 + import { 2 + AppBskyActorProfile, 3 + AppBskyActorStatus, 4 + AppBskyFeedGenerator, 5 + AppBskyFeedLike, 6 + AppBskyFeedPost, 7 + AppBskyFeedPostgate, 8 + AppBskyFeedRepost, 9 + AppBskyFeedThreadgate, 10 + AppBskyGraphBlock, 11 + AppBskyGraphFollow, 12 + AppBskyGraphList, 13 + AppBskyGraphListblock, 14 + AppBskyGraphListitem, 15 + AppBskyGraphStarterpack, 16 + AppBskyGraphVerification, 17 + AppBskyLabelerService, 18 + ChatBskyActorDeclaration, 19 + } from "@atcute/bluesky"; 20 + import { 21 + PubLeafletComment, 22 + PubLeafletDocument, 23 + PubLeafletGraphSubscription, 24 + PubLeafletPublication, 25 + } from "@atcute/leaflet"; 26 + import { 27 + ShTangledActorProfile, 28 + ShTangledFeedStar, 29 + ShTangledGraphFollow, 30 + ShTangledKnot, 31 + ShTangledKnotMember, 32 + ShTangledPublicKey, 33 + ShTangledRepo, 34 + ShTangledRepoArtifact, 35 + ShTangledRepoIssue, 36 + ShTangledRepoIssueComment, 37 + ShTangledRepoIssueState, 38 + ShTangledRepoIssueStateClosed, 39 + ShTangledRepoIssueStateOpen, 40 + ShTangledRepoPull, 41 + ShTangledRepoPullComment, 42 + ShTangledRepoPullStatus, 43 + ShTangledRepoPullStatusClosed, 44 + ShTangledRepoPullStatusMerged, 45 + ShTangledRepoPullStatusOpen, 46 + } from "@atcute/tangled"; 47 + 48 + export const lexicons: Record<string, any> = { 49 + // Bluesky 50 + "app.bsky.actor.profile": AppBskyActorProfile.mainSchema, 51 + "app.bsky.actor.status": AppBskyActorStatus.mainSchema, 52 + "app.bsky.feed.generator": AppBskyFeedGenerator.mainSchema, 53 + "app.bsky.feed.like": AppBskyFeedLike.mainSchema, 54 + "app.bsky.feed.post": AppBskyFeedPost.mainSchema, 55 + "app.bsky.feed.postgate": AppBskyFeedPostgate.mainSchema, 56 + "app.bsky.feed.repost": AppBskyFeedRepost.mainSchema, 57 + "app.bsky.feed.threadgate": AppBskyFeedThreadgate.mainSchema, 58 + "app.bsky.graph.block": AppBskyGraphBlock.mainSchema, 59 + "app.bsky.graph.follow": AppBskyGraphFollow.mainSchema, 60 + "app.bsky.graph.list": AppBskyGraphList.mainSchema, 61 + "app.bsky.graph.listblock": AppBskyGraphListblock.mainSchema, 62 + "app.bsky.graph.listitem": AppBskyGraphListitem.mainSchema, 63 + "app.bsky.graph.starterpack": AppBskyGraphStarterpack.mainSchema, 64 + "app.bsky.graph.verification": AppBskyGraphVerification.mainSchema, 65 + "app.bsky.labeler.service": AppBskyLabelerService.mainSchema, 66 + "chat.bsky.actor.declaration": ChatBskyActorDeclaration.mainSchema, 67 + 68 + // Tangled 69 + "sh.tangled.actor.profile": ShTangledActorProfile.mainSchema, 70 + "sh.tangled.feed.star": ShTangledFeedStar.mainSchema, 71 + "sh.tangled.graph.follow": ShTangledGraphFollow.mainSchema, 72 + "sh.tangled.knot.member": ShTangledKnotMember.mainSchema, 73 + "sh.tangled.publicKey": ShTangledPublicKey.mainSchema, 74 + "sh.tangled.repo": ShTangledRepo.mainSchema, 75 + "sh.tangled.repo.artifact": ShTangledRepoArtifact.mainSchema, 76 + "sh.tangled.repo.issue": ShTangledRepoIssue.mainSchema, 77 + "sh.tangled.repo.issue.comment": ShTangledRepoIssueComment.mainSchema, 78 + "sh.tangled.repo.issue.state": ShTangledRepoIssueState.mainSchema, 79 + "sh.tangled.repo.issue.state.closed": ShTangledRepoIssueStateClosed.mainSchema, 80 + "sh.tangled.repo.issue.state.open": ShTangledRepoIssueStateOpen.mainSchema, 81 + "sh.tangled.repo.pull": ShTangledRepoPull.mainSchema, 82 + "sh.tangled.repo.pull.comment": ShTangledRepoPullComment.mainSchema, 83 + "sh.tangled.repo.pull.status": ShTangledRepoPullStatus.mainSchema, 84 + "sh.tangled.repo.pull.status.closed": ShTangledRepoPullStatusClosed.mainSchema, 85 + "sh.tangled.repo.pull.status.merged": ShTangledRepoPullStatusMerged.mainSchema, 86 + "sh.tangled.repo.pull.status.open": ShTangledRepoPullStatusOpen.mainSchema, 87 + "sh.tangled.knot": ShTangledKnot.mainSchema, 88 + 89 + // Leaflet 90 + "pub.leaflet.comment": PubLeafletComment.mainSchema, 91 + "pub.leaflet.document": PubLeafletDocument.mainSchema, 92 + "pub.leaflet.graph.subscription": PubLeafletGraphSubscription.mainSchema, 93 + "pub.leaflet.publication": PubLeafletPublication.mainSchema, 94 + };
+5 -1
src/views/record.tsx
··· 2 2 import { lexiconDoc } from "@atcute/lexicon-doc"; 3 3 import { RecordValidator } from "@atcute/lexicon-doc/validations"; 4 4 import { ResolvedSchema } from "@atcute/lexicon-resolver"; 5 - import { ActorIdentifier, Nsid } from "@atcute/lexicons"; 5 + import { ActorIdentifier, is, Nsid } from "@atcute/lexicons"; 6 6 import { AtprotoDid, Did, isNsid } from "@atcute/lexicons/syntax"; 7 7 import { verifyRecord } from "@atcute/repo"; 8 8 import { A, useLocation, useNavigate, useParams } from "@solidjs/router"; ··· 33 33 import Tooltip from "../components/tooltip.jsx"; 34 34 import { resolveLexiconAuthority, resolveLexiconSchema, resolvePDS } from "../utils/api.js"; 35 35 import { AtUri, uriTemplates } from "../utils/templates.js"; 36 + import { lexicons } from "../utils/types/lexicons.js"; 36 37 37 38 const extractRefs = (obj: any): Nsid[] => { 38 39 const refs: Set<string> = new Set(); ··· 163 164 setLexiconNotFound(false); 164 165 lexiconDoc.parse(record, { mode: "passthrough" }); 165 166 setValidSchema(true); 167 + } else if (params.collection && params.collection in lexicons) { 168 + if (is(lexicons[params.collection], record)) setValidSchema(true); 169 + else setValidSchema(false); 166 170 } else { 167 171 const { resolved, failed } = await resolveAllLexicons(params.collection as Nsid); 168 172