dag.getDescendants
This function gives all descendants of a node: the nodes that depend on this node, transitively.
CLI- Package
- @procedures/dag · README
- Path
["dag","getDescendants"]- CLI
mark dag getDescendants --nodes <any[][]> --id <string>- As data
{"$proc":["dag","getDescendants"],"input":{}}
Use it
In TypeScript
import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/dag/register"; // registers its procedures
const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["dag","getDescendants"], { nodes: [], id: "<id>" });
console.log(JSON.stringify(result));From the command line
$ mark dag getDescendants --nodes <any[][]> --id <string>
As data, in a program
{
"$proc": ["dag", "getDescendants"],
"input": { "nodes": [], "id": "<id>" }
}Input
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
nodes | any[][] | yes | ||
id | string | yes |
Output
The schema does not list fields (string[]).
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"nodes": {
"type": "array",
"items": {
"type": "array",
"items": [
{
"type": "string"
},
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Unique identifier for this node"
},
"dependencies": {
"type": "array",
"items": {
"type": "string"
},
"description": "Names/IDs of nodes this node depends on"
},
"level": {
"type": "number",
"description": "Topological level (0 = leaves, computed by Kahn's algorithm)"
},
"data": {
"description": "Optional user data associated with this node"
}
},
"required": [
"id",
"dependencies"
],
"additionalProperties": {}
}
],
"additionalItems": {},
"minItems": 2,
"maxItems": 2
},
"x-procedures-codec": "map"
},
"id": {
"type": "string"
}
},
"required": [
"nodes",
"id"
],
"additionalProperties": false
},
"output": {
"type": "array",
"items": {
"type": "string"
},
"x-procedures-codec": "set"
}
}