Resolving a symbol a developer typed, and walking the graph from it.
avenx impact and avenx why are the same traversal in opposite
directions, because Atlas edges point the way dependencies point. Impact
follows edges into a node — everything that would be affected if it
changed. Why follows edges out of it — everything it is derived from.
Keeping them one function is what guarantees the two answers stay
consistent with each other.
- Source:
Members
(static, constant) KIND_LABELS :Object:.<string:, string:>
Human-readable labels for node kinds.
Type:
- Source:
(inner, constant) CONTAINMENT :Set:.<string:>
Edge kinds that carry containment rather than data flow.
A traversal follows them once, to name the component a binding lives in, but never uses them to travel further — otherwise every query would flood with every sibling declaration of everything it touched.
Type:
- Source:
(inner, constant) EDGE_PRIORITY :Object:.<string:, number:>
How consequential each edge kind is, lowest first.
Used only to choose which edge represents a node that several edges reach; it does not affect which nodes are reached.
Type:
- Source:
Methods
(static) displayName(model, node) → {string}
A display name for a node.
Parameters:
| Name | Type | Description |
|---|---|---|
model |
object | The model. |
node |
object | The node. |
- Source:
Returns:
Something a developer can search for.
- Type
- string
(static) flatten(entry) → {Array:.<object:>}
Flattens a walk into a serializable list.
Parameters:
| Name | Type | Description |
|---|---|---|
entry |
object | The tree root from walk. |
- Source:
Returns:
One record per reached node.
(static) locationOf(node) → {string}
A short file:line for a node, when it has one.
Parameters:
| Name | Type | Description |
|---|---|---|
node |
object | The node. |
- Source:
Returns:
The location, or an empty string.
- Type
- string
(static) relevantUnresolved(model, reached, rootId) → {Array:.<object:>}
Collects the unresolved entries relevant to a set of reached nodes.
A query's answer is incomplete exactly where analysis was, so the two are reported together rather than leaving the reader to guess.
Parameters:
| Name | Type | Description |
|---|---|---|
model |
object | The model. |
reached |
Array:.<object:> | Records from flatten. |
rootId |
string | The queried node id. |
- Source:
Returns:
The relevant unresolved entries.
(static) resolveSymbol(model, query) → {Array:.<object:>}
Finds the nodes a typed symbol could mean.
Accepts, in order of precision: a full node id, Owner.member, a bare owner
name, and a bare member name. Ambiguity is returned rather than guessed at —
avenx impact items on a project with three items should list them, not
pick one.
Parameters:
| Name | Type | Description |
|---|---|---|
model |
object | The model. |
query |
string | What the developer typed. |
- Source:
Returns:
Matching nodes, most precise first.
(static) walk(model, rootId, optionsopt) → {Object}
Walks the graph from a node, producing a tree of paths.
Breadth-first with a visited set, so a node appears once, at its shortest distance from the root. A dependency graph has diamonds all over it — two components reading one bridge getter — and printing every path through them would turn a useful answer into a wall.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
model |
object | The model. |
|||||||||||||
rootId |
string | Where to start. |
|||||||||||||
options |
object |
<optional> |
Traversal options. Properties
|
- Source:
Returns:
The tree.
- Type
- Object
(inner) edgePriority(kind) → {number}
The priority of an edge kind.
Parameters:
| Name | Type | Description |
|---|---|---|
kind |
string | The edge kind. |
- Source:
Returns:
Its priority, lowest first.
- Type
- number
(inner) sortTree(entry) → {void}
Orders a tree so two runs print identically.
Parameters:
| Name | Type | Description |
|---|---|---|
entry |
object | A tree entry. |
- Source:
Returns:
- Type
- void