@x12i/memorix-graphifier
v1.3.0
Published
Memorix Graphifier — explore SDK for host graph views and a capability worker. Graphify content, records, JSON Schema, OpenAPI endpoints, and object properties (org-scoped).
Downloads
1,424
Maintainers
Readme
Memorix Graphifier
Turn org knowledge into a knowledge graph, then load that graph from your view — not the Graphifier SPA.
Graphifier accepts content, records, JSON Schema, OpenAPI / endpoints, and object properties. Isolation is always per organization (graphified-<orgId> Mongo DB). Optional agentId is host/Memorix context only; it does not filter Graphifier storage.
Published as @x12i/memorix-graphifier.
npm install @x12i/memorix-graphifier@">=1.3.0"Two surfaces
| You want | Use |
|----------|-----|
| Embed an org or item graph in a host app | Explore SDK — createGraphifierClient (talks to Graphifier REST) |
| Pipeline analyze drafts for Memorix write-record | Capability worker — createGraphifierWorker / buildAnalyzeDraft |
This package does not ship the React explorer under ui/. Analyze never writes Memorix subjects or Mongo domain data; REST graphify is the persist path for the explore API.
Explore SDK — host views
import {
createGraphifierClient,
graphViewFrom,
isGraphifierApiError,
} from "@x12i/memorix-graphifier";
const client = createGraphifierClient({
baseUrl: "http://127.0.0.1:8080",
orgId: "authix",
agentId: "opx", // host context only — not a DB filter
graphId: "default",
});
try {
// Org canvas (nodes include properties — schemas/endpoints keep their payload)
const viz = await client.getVisualization({
maximumNodes: 500,
nodeTypes: ["schema", "endpoint", "property", "openapi"],
});
// Item ego-network
const around = await client.getItemNeighborhood("default", "user-schema", {
depth: 1,
});
const view = graphViewFrom(around); // { nodes, edges } for Cytoscape / Sigma / custom
console.log(client.scope, view.nodes.length);
} catch (err) {
if (isGraphifierApiError(err)) {
console.error(err.code, err.status, err.message);
} else {
throw err;
}
}View scopes
| View intent | SDK usage |
|-------------|-----------|
| Org graph | getVisualization / searchNodes / getNeighbors |
| Item + connected | getItemNeighborhood(graphId, itemId, { depth }) |
| Schema / endpoint slice | getVisualization({ nodeTypes: ["schema","endpoint","property"] }) or listNodes(graphId, { type: "endpoint" }) |
forScope({ orgId, agentId, graphId }) clones the client. REST paths are always /v1/orgs/{orgId}/…. See examples/explore-host-view.ts.
Graphify schemas, endpoints, and objects
Content and record-shaped items still work. Structured JSON that looks like a schema or API is graphified without registering JSONPath object-types:
- JSON Schema —
$schemaor apropertiesmap of objects →schema+propertynodes,has_property/refs - OpenAPI —
openapi/swaggerorpaths→openapi+endpointnodes,exposes/uses_schema - Endpoint object —
method+path(orurl) - Nested objects — child nodes +
has_property(depth 2). Scalar record fields (e.g.name,ownerTeamId) stay on the entity; they are not exploded into property nodes
Offline draft (no REST)
import { buildAnalyzeDraft, SERVICE_ID } from "@x12i/memorix-graphifier";
const draft = buildAnalyzeDraft(
{
schemas: [
{
id: "user",
title: "User",
$schema: "https://json-schema.org/draft/2020-12/schema",
properties: { email: { type: "string" } },
},
],
},
{ serviceId: SERVICE_ID },
);
// draft.graphDraft.nodes / .edges — same envelope as analyze since 1.0.5Bags: items, records, snapshot, schemas, endpoints, objects.
Persist via REST
await client.graphify({
items: [
{
id: "pets-api",
inputType: "structured",
objectType: "openapi",
data: {
openapi: "3.0.0",
paths: { "/pets": { get: { operationId: "listPets" } } },
},
},
],
});Optional putObjectType / listObjectTypes still apply JSONPath mappings when you want them; they are not required for schema/endpoint ingest. Full sample: examples/graphify-schema-endpoint.ts.
Requires the Graphifier REST API (memorix_graphifier, typically :8080).
Env (operator-side)
| Variable | Purpose |
|----------|---------|
| GRAPHIFIER_API_URL | REST base for the client |
| GRAPHIFIER_DEFAULT_ORG_ID / GRAPHIFIER_DEFAULT_TENANT | Default orgId or full graphified-<orgId> |
| GRAPHIFIER_DEFAULT_DATABASE_NAME | Optional default full org DB name (must match prefix form) |
| GRAPHIFIER_DEFAULT_AGENT_ID | Optional host agent context |
| GRAPHIFIER_DEFAULT_GRAPH_ID | Default graph id (default) |
| GRAPHIFIER_MONGO_DATABASE_PREFIX | Default graphified- |
Capability worker (Memorix pipelines)
Stable analyze → persist envelope (graphDraft / patchPlan with array nodes/edges and sourceRefs) since 1.0.5. Pin writers at >=1.0.5. Platform sequence is analyze → write-record (portConfig.mode: "graphifier"). Details: docs/memorix-binding.md.
npm install
npm test
npm startWorker listen URL is printed as JSON (endpoint → ServiceRef). Defaults: host 127.0.0.1, port 7500 from @x12i/ports-manager zone memorix-graphier.
- serviceId:
memorix-graphifier - operation:
analyze - Pack:
metadata/services.json - Sample pipeline:
examples/pipeline.v2.json
import {
graphifierCapability,
createGraphifierWorker,
SERVICE_ID,
} from "@x12i/memorix-graphifier";Depends on @x12i/memorix-sdk only. Do not install Memorix engine packages in this app.
Manual invoke
curl -sS -X POST "http://127.0.0.1:${MEMORIX_WORKER_PORT}/" \
-H 'content-type: application/json' \
-d '{
"version":"memorix-capability/1",
"serviceId":"memorix-graphifier",
"operation":"analyze",
"scope":{"orgId":"sandbox1","agentIds":["opx"]},
"execution":{
"runId":"r1","stepId":"s1","attempt":1,"correlationId":"c1"
},
"inputs":{
"items":[
{"id":"credorix","inputType":"structured","objectType":"product",
"data":{"name":"Credorix","ownerTeamId":"identity-team"}}
]
}
}'Smoke and CI fixtures: sandbox* orgs and agentIds: ["opx"] only.
Legacy Python REST (optional)
memorix_graphifier/ is a FastAPI + Mongo explore/ingest API. It is not the Memorix called-service surface. The explore SDK uses it as the data plane.
export GRAPHIFIER_USE_MEMORY_STORE=true
pip install -e ".[dev]"
memorix-graphifierSee ARCHITECTURE.md.
Knowledge Graph UI
Optional full SPA (not this npm package):
# API: set GRAPHIFIER_CORS_ORIGINS=http://127.0.0.1:7501
cd ui && cp .env.example .env && npm install && npm run dev
# open http://127.0.0.1:7501/organizations/<orgId>/knowledge-graphDetails: ui/README.md.
License
Apache License 2.0. Upstream Graphify attribution is retained in NOTICE and LICENSE-MIT for applicable portions.
