ir

@hlang-org/ir

The hlang intermediate representation: IGraph types, validation, and the execution plan shared by the interpreter and the compiler. Version 1.0.1, 19 exports.

Classes

GraphError

Defined in: packages/ir/src/plan.ts:56

Thrown by planGraph when a graph violates hlang's rules.

Extends

  • Error

Constructors

Constructor
TypeScript
new GraphError(code, message): GraphError;

Defined in: packages/ir/src/plan.ts:59

Parameters
ParameterType
codeGraphErrorCode
messagestring
Returns

GraphError

Overrides

Error.constructor

Properties

PropertyModifierTypeDefined in
codereadonlyGraphErrorCodepackages/ir/src/plan.ts:57

Interfaces

ExecutionPlan

Defined in: packages/ir/src/plan.ts:38

A validated, backend-neutral program.

Properties

PropertyModifierTypeDescriptionDefined in
connectionsreadonlyreadonly PlannedConnection[]Connections in graph order.packages/ir/src/plan.ts:42
nodesreadonlyreadonly PlannedNode[]Nodes in graph order.packages/ir/src/plan.ts:40
rootsreadonlyreadonly string[]Node ids of the Readable roots, in graph order. Never empty.packages/ir/src/plan.ts:44

IBizData

Defined in: packages/ir/src/igraph.ts:38

Business data attached to a node; params is the user-facing config.

Indexable

TypeScript
[key: string]: unknown

Properties

PropertyModifierTypeDefined in
flowId?readonlystringpackages/ir/src/igraph.ts:39
nodeId?readonlystringpackages/ir/src/igraph.ts:40
params?readonlyReadonly<Record<string, ParamValue>>packages/ir/src/igraph.ts:41

IConnection

Defined in: packages/ir/src/igraph.ts:64

A single connection. Direction is inverted from intuition and MUST be preserved: Output is the upstream source (an O port), Input is the downstream target (an I port). Wiring is Output.O(id).connect(Input.I(id)).

Properties


IConnectionEndpoint

Defined in: packages/ir/src/igraph.ts:46

One endpoint of a connection, as serialized.

Properties

PropertyModifierTypeDescriptionDefined in
name?readonlystring-packages/ir/src/igraph.ts:47
nodeIdreadonlystring-packages/ir/src/igraph.ts:49
portConf?readonlyobjectPort configuration. The port is identified by id (its name), e.g. "Input" / "Output" / "@node/error". Both portConf and the legacy portConfig spelling appear across fixtures; readers must accept either.packages/ir/src/igraph.ts:55
portConf.idreadonlystring-packages/ir/src/igraph.ts:55
portConf.type?readonlystring-packages/ir/src/igraph.ts:55
portConfig?readonlyReadonly<Record<string, unknown>>-packages/ir/src/igraph.ts:56
type?readonlyNodeKind-packages/ir/src/igraph.ts:48

IGraph

Defined in: packages/ir/src/igraph.ts:100

The complete serialized graph.

Properties

PropertyModifierTypeDefined in
connectionsreadonlyreadonly IConnection[]packages/ir/src/igraph.ts:102
deps?readonlyreadonly IPackageInfo[]packages/ir/src/igraph.ts:101
nodeListreadonlyreadonly INodeInfo[]packages/ir/src/igraph.ts:103

INodeInfo

Defined in: packages/ir/src/igraph.ts:76

A node entry in the graph's node list.

Indexable

TypeScript
[key: string]: unknown

Properties

PropertyModifierTypeDescriptionDefined in
bizData?readonlyIBizData-packages/ir/src/igraph.ts:83
codereadonlystringNode type key. A backend resolves it to a runtime node class.packages/ir/src/igraph.ts:78
groupCode?readonlystring-packages/ir/src/igraph.ts:86
namereadonlystring-packages/ir/src/igraph.ts:79
nodeIdreadonlystringStable per-instance id used to correlate nodes and connections.packages/ir/src/igraph.ts:82
portInfo?readonlyIPortInfo-packages/ir/src/igraph.ts:84
position?readonlyobject-packages/ir/src/igraph.ts:85
position.xreadonlynumber-packages/ir/src/igraph.ts:85
position.yreadonlynumber-packages/ir/src/igraph.ts:85
runtimeResource?readonlystringnpm coordinate of the runtime implementation, e.g. "pkg@1.2.3".packages/ir/src/igraph.ts:88
typereadonlyNodeKind-packages/ir/src/igraph.ts:80

IPackageInfo

Defined in: packages/ir/src/igraph.ts:93

A dependency descriptor (populated by the compiler; optional for interpret).

Properties

PropertyModifierTypeDefined in
local?readonlybooleanpackages/ir/src/igraph.ts:96
namereadonlystringpackages/ir/src/igraph.ts:94
version?readonlystringpackages/ir/src/igraph.ts:95

IParamObject

Defined in: packages/ir/src/igraph.ts:30

Object-valued parameters. Declared as an interface (not a Record alias) so the recursive ParamValue reference resolves without a circular-alias error.

Indexable

TypeScript
[key: string]: ParamValue

IPortInfo

Defined in: packages/ir/src/igraph.ts:70

Port metadata carried on a node (the design-time port descriptors).

Properties

PropertyModifierTypeDefined in
Input?readonlyreadonly Readonly<Record<string, unknown>>[]packages/ir/src/igraph.ts:71
Output?readonlyreadonly Readonly<Record<string, unknown>>[]packages/ir/src/igraph.ts:72

PlannedConnection

Defined in: packages/ir/src/plan.ts:32

source is an output (O) port; target is an input (I) port.

Properties

PropertyModifierTypeDefined in
sourcereadonlyPlannedEndpointpackages/ir/src/plan.ts:33
targetreadonlyPlannedEndpointpackages/ir/src/plan.ts:34

PlannedEndpoint

Defined in: packages/ir/src/plan.ts:26

One end of a planned connection.

Properties

PropertyModifierTypeDefined in
nodeIdreadonlystringpackages/ir/src/plan.ts:27
portIdreadonlystringpackages/ir/src/plan.ts:28

PlannedNode

Defined in: packages/ir/src/plan.ts:18

A node to construct. config is passed to the node constructor.

Properties

PropertyModifierTypeDefined in
codereadonlystringpackages/ir/src/plan.ts:20
configreadonlyReadonly<Record<string, unknown>>packages/ir/src/plan.ts:22
kindreadonlyNodeKindpackages/ir/src/plan.ts:21
nodeIdreadonlystringpackages/ir/src/plan.ts:19

Type Aliases

GraphErrorCode

TypeScript
type GraphErrorCode = 
  | "duplicate-node-id"
  | "invalid-node-kind"
  | "unknown-node"
  | "invalid-connection"
  | "no-readable-root";

Defined in: packages/ir/src/plan.ts:48

Machine-readable reasons a graph cannot be planned.


NodeKind

TypeScript
type NodeKind = "R" | "T" | "W";

Defined in: packages/ir/src/igraph.ts:12

The three hlang node kinds: Readable (source), Transform, Writable (sink).


ParamBag

TypeScript
type ParamBag = Readonly<Record<string, ParamValue>>;

Defined in: packages/ir/src/igraph.ts:35

A bag of node parameters (the params object under bizData).


ParamValue

TypeScript
type ParamValue = 
  | string
  | number
  | boolean
  | null
  | readonly ParamValue[]
  | IParamObject;

Defined in: packages/ir/src/igraph.ts:18

Serialized parameter values carried in bizData.params.

Variables

ERROR_PORT_NAME

TypeScript
const ERROR_PORT_NAME: "@node/error" = '@node/error';

Defined in: packages/ir/src/igraph.ts:15

The output port every Readable and Transform node exposes for errors.

Functions

planGraph()

TypeScript
function planGraph(graph): ExecutionPlan;

Defined in: packages/ir/src/plan.ts:70

Validate graph and lower it to an ExecutionPlan.

Parameters

ParameterType
graphIGraph

Returns

ExecutionPlan

Generated by TypeDoc from packages/ir/src at build time.