MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / entry_json

Function entry_json

atomic-cli/src/commands/vault/show.rs:107–122  ·  view source on GitHub ↗
(path: &str, entry: &VaultEntry, revision_hash: &str)

Source from the content-addressed store, hash-verified

105}
106
107pub(crate) fn entry_json(path: &str, entry: &VaultEntry, revision_hash: &str) -> serde_json::Value {
108 serde_json::json!({
109 "schema_version": 1,
110 "mode": "vault_entry_body",
111 "content_authority": "untrusted_historical_data",
112 "path": path,
113 "entry_type": entry.entry_type.to_string(),
114 "revision_hash": revision_hash,
115 "content": String::from_utf8_lossy(&entry.content_bytes),
116 "frontmatter": serde_json::from_str::<serde_json::Value>(
117 &entry.frontmatter_json
118 ).unwrap_or_default(),
119 "created_at": entry.created_at,
120 "updated_at": entry.updated_at,
121 })
122}
123
124#[cfg(test)]
125mod tests {

Callers 3

runMethod · 0.70
vault_showFunction · 0.50

Calls

no outgoing calls

Tested by 1