Ionosphere.tv
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: publish concepts and annotations to PDS

Previously only checked if concepts existed; now publishes all concepts
and annotations from the staging DB with DID rewriting.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+35 -8
+35 -8
apps/ionosphere-appview/src/publish.ts
··· 140 140 } 141 141 console.log(`\nPublished ${transcriptCount} transcripts.`); 142 142 143 - // 5. Publish concepts (from PDS — they were written by enrich.ts) 144 - // Concepts are already on the PDS from the enrichment pipeline. 145 - // Just verify they're there. 146 - const conceptsRes = await fetch( 147 - `${PDS_URL}/xrpc/com.atproto.repo.listRecords?repo=${did}&collection=tv.ionosphere.concept&limit=100` 148 - ); 149 - const conceptsData = await conceptsRes.json(); 150 - console.log(`\nConcepts already on PDS: ${conceptsData.records?.length ?? 0}`); 143 + // 5. Publish concepts 144 + const concepts = db.prepare("SELECT * FROM concepts").all() as any[]; 145 + console.log(`\nPublishing ${concepts.length} concepts...`); 146 + for (const concept of concepts) { 147 + await pds.putRecord("tv.ionosphere.concept", concept.rkey, { 148 + $type: "tv.ionosphere.concept", 149 + name: concept.name, 150 + ...(concept.aliases && { aliases: JSON.parse(concept.aliases) }), 151 + ...(concept.description && { description: concept.description }), 152 + ...(concept.wikidata_id && { wikidataId: concept.wikidata_id }), 153 + ...(concept.url && { url: concept.url }), 154 + }); 155 + } 156 + console.log(` Done.`); 157 + 158 + // 6. Publish annotations 159 + const annotations = db.prepare("SELECT * FROM annotations").all() as any[]; 160 + console.log(`\nPublishing ${annotations.length} annotations...`); 161 + for (const ann of annotations) { 162 + const talkUri = ann.talk_uri 163 + ? ann.talk_uri.replace(/^at:\/\/[^/]+/, `at://${did}`) 164 + : null; 165 + const transcriptUri = ann.transcript_uri.replace(/^at:\/\/[^/]+/, `at://${did}`); 166 + const conceptUri = ann.concept_uri.replace(/^at:\/\/[^/]+/, `at://${did}`); 167 + await pds.putRecord("tv.ionosphere.annotation", ann.rkey, { 168 + $type: "tv.ionosphere.annotation", 169 + transcriptUri, 170 + ...(talkUri && { talkUri }), 171 + conceptUri, 172 + byteStart: ann.byte_start, 173 + byteEnd: ann.byte_end, 174 + ...(ann.text && { text: ann.text }), 175 + }); 176 + } 177 + console.log(` Done.`); 151 178 152 179 console.log(`\nAll records published to ${PDS_URL}`); 153 180 console.log(`DID: ${did}`);