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

Function kg_node_domain

atomic-cli/src/commands/rpc.rs:147–162  ·  view source on GitHub ↗

Wire KGNode → the domain node (kind/label/summary/source/metadata), the shape the local JSON serializes.

(node: &pb::KgNode)

Source from the content-addressed store, hash-verified

145/// Wire KGNode → the domain node (kind/label/summary/source/metadata),
146/// the shape the local JSON serializes.
147fn kg_node_domain(node: &pb::KgNode) -> atomic_core::pristine::vault::KgNode {
148 atomic_core::pristine::vault::KgNode {
149 id: node.id.clone(),
150 types: node.types.clone(),
151 label: node.name.clone().unwrap_or_default(),
152 summary: node
153 .data
154 .as_ref()
155 .map(|data| String::from_utf8_lossy(data).into_owned()),
156 source: node.source.clone().unwrap_or_default(),
157 metadata: node
158 .metadata
159 .as_ref()
160 .and_then(|metadata| serde_json::from_slice(metadata).ok()),
161 }
162}
163
164/// Wire KGEdge → the domain edge.
165fn kg_edge_domain(edge: &pb::KgEdge) -> CliResult<atomic_core::pristine::vault::KgEdge> {

Callers

nothing calls this directly

Calls 3

as_refMethod · 0.80
cloneMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected