Community SDK
브라우저용 게시물 읽기와 nullable 상세 결과 참조.
Community SDK
완결된 작업은 Community 가이드에서 시작하세요. 이 참조는 공개 SDK 경계를 설명합니다. import와 peer는 SDK 기본을 확인하세요.
커뮤니티 공개 읽기
커뮤니티 목록과 상세 화면에는 브라우저 안전 shaped helper를 사용합니다:
import { createClient } from '@01.software/sdk'
type Client = ReturnType<typeof createClient>
export async function readFirstPost(client: Client) {
const page = await client.community.listPosts({ limit: 20 })
if (page.docs.length === 0) return { kind: 'empty' as const }
const post = await client.community.getPost({ postId: page.docs[0].id })
if (!post) return { kind: 'absent' as const }
return { kind: 'found' as const, post }
}이 읽기에는 Publishable Key만 있으면 됩니다. getPost()는 allowlist된
CommunityPost DTO를 반환하고, 누락·숨김·다른 워크스페이스 게시글은 모두 null로
처리합니다. Customer JWT를 함께 보낼 수 있지만 Secret Key는 필요하지 않습니다.
Raw client.collections.from('posts')는 계속 server-only입니다.
인증된 참여
listPosts({ limit })는 paginated shaped feed, getPost({ postId })는 안전한 DTO 또는 정해진 missing/hidden/cross-tenant 결과의 null을 반환합니다. 다른 오류는 전파합니다. Secret Key로 고객의 거절을 우회하지 마세요. Community 작업에서 hosted identity, createComment({ postId, body }), 독립 listComments readback과 오류 처리를 확인하세요.