SDK · Playground
Pick a recipe, hit Run to see the simulated output, or Open in StackBlitz to get a live Node.js environment with @unified-product-graph/sdk pre-installed and the recipe ready to edit and run.
Cookbook · Reading
Fuzzy match across every node. Cheap, returns ranked hits.
Code
import { UPGClient } from '@unified-product-graph/sdk'
const upg = new UPGClient({ file: './product.upg' })
const hits = await upg.search('dark mode', { limit: 5 })
for (const hit of hits) {
console.log(
hit.score.toFixed(2),
hit.node.type.padEnd(12),
hit.node.title,
)
}Output
// click ▶ Run to see what this snippet would print locally