link
Assert a typed memory-to-memory edge, alongside the ones the write pipeline infers.
link(input: LinkInput): Promise<LinkResult>link(request: LinkRequest): Promise<LinkResponse>Parameters
ParameterTypeRequired
sourcestring (wire: 64-bit integer)requiredThe memory the edge leaves.
targetstring (wire: 64-bit integer)requiredThe memory it points at.
kindEdgeKindrequiredOne of caused, followed_by, derived_from, similar_to, contradicts, supports, references, part_of. Anything else is BadEdgeKind. On the wire these are integer discriminants, not lowercase strings.
weightfloatoptionalEdge strength. Defaults server-side.
Returns
FieldTypePresence
source / target / kind / weight—alwaysEchoed back as stored.
createdAtUnixNanos64-bit integeralwaysWhen the edge was written.
alreadyExistedbooleanalwaystrue when the edge was already there. This is what makes link idempotent — a repeat is a success, not a duplicate.
Example
await brain.link({ source: outageId, target: rollbackId, kind: "caused", weight: 0.9 });See also
Was this page helpful?