MCPcopy
hub / github.com/npmx-dev/npmx.dev / syncsiteStandardDocuments

Function syncsiteStandardDocuments

modules/standard-site-sync.ts:130–155  ·  view source on GitHub ↗
(client: Client, documentsToSync: DocumentToSync[])

Source from the content-addressed store, hash-verified

128}
129
130async function syncsiteStandardDocuments(client: Client, documentsToSync: DocumentToSync[]) {
131 let currentCommit = await client.xrpc(com.atproto.sync.getLatestCommit, {
132 params: {
133 did: client.assertDid,
134 },
135 })
136
137 let writes = documentsToSync.map(doc =>
138 //this should be an .update but having issues with it, and the records are checked before creating
139 com.atproto.repo.applyWrites.create.$build({
140 rkey: doc.tid,
141 value: doc.document,
142 collection: site.standard.document.$nsid,
143 }),
144 )
145
146 await client.xrpc(com.atproto.repo.applyWrites, {
147 body: {
148 repo: client.assertDid,
149 writes,
150 swapCommit: currentCommit.body.cid,
151 },
152 })
153
154 console.log('[standard-site-sync] synced all new publications')
155}
156
157// Schema expects 'path' & frontmatter provides 'slug'
158function normalizeBlogFrontmatter(frontmatter: Record<string, unknown>): Record<string, unknown> {

Callers 1

setupFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected