@unified-product-graph/core
v0.9.13
Published
Unified Product Graph — open specification and TypeScript types for product knowledge
Maintainers
Readme
@unified-product-graph/core
The TypeScript core for the Unified Product Graph (UPG), an open specification that gives product tools a shared vocabulary for entities, edges, and frameworks.
312 entity types across 36 domains. 938 typed edges. 34 canonical framework definitions, with more added as each is reviewed.
Install
npm install @unified-product-graph/coreQuick usage
import {
type UPGDocument,
validateUPGDocument,
isUPGDocument,
UPG_VERSION,
UPG_FORMAT_VERSION,
} from '@unified-product-graph/core'
// UPG_VERSION (0.5.0) is the catalogue version. UPG_FORMAT_VERSION (0.4.0)
// is the on-disk .upg document format. The format evolves more slowly.
const doc: UPGDocument = {
upg_version: UPG_FORMAT_VERSION,
exported_at: new Date().toISOString(),
source: { tool: 'my-app', tool_version: '1.0.0' },
product: { id: 'p1', title: 'My Product' },
nodes: [
{ id: 'n1', type: 'persona', title: 'Power User' },
{ id: 'n2', type: 'job', title: 'Get insights faster' },
],
edges: [
{ id: 'e1', source: 'n1', target: 'n2', type: 'persona_pursues_job' },
],
}
const result = validateUPGDocument(doc)
console.log(result.valid, result.errors, result.warnings)
if (isUPGDocument(doc)) {
console.log(`${doc.nodes.length} nodes exported`)
}Documentation
Architecture guide: src/ARCHITECTURE.md
Full spec: unifiedproductgraph.org
License
MIT
