# Pipeline

TypeScript source: `services/pipeline.ts`

## Types

### ParsedNode

Source: `services/pipeline.ts:137`

```ts
Node<{ extras?: NodeExtras; handles: { input: ParsedHandle[]; output: ParsedHandle[] }; id: string; name: string; nodeType?: "device" | "host"; parentId?: string }>
```

React Flow node used by the pipeline canvas.

#### Members

| Name | Type | Description |
| --- | --- | --- |
| `extras?` | `NodeExtras` | Parsed runtime metadata overlaid onto the graph. |
| `handles` | `{ input: ParsedHandle[]; output: ParsedHandle[] }` | Parsed input and output handles. |
| `id` | `string` | String node id used by React Flow. |
| `name` | `string` | Display name rendered in the node. |
| `nodeType?` | `"device" | "host"` | Runtime placement of the node when known. |
| `parentId?` | `string` | Parent group node id, if this node is rendered inside a group. |

### Pipeline

Source: `services/pipeline.ts:123`

Parsed pipeline graph ready for PipelineCanvas.

#### Members

| Name | Type | Description |
| --- | --- | --- |
| `edges` | `Edge[]` | React Flow edges rendered by PipelineCanvas. |
| `nodes` | `ParsedNode[]` | React Flow nodes rendered by PipelineCanvas. |

### RawPipeline

Source: `services/pipeline.ts:105`

Raw pipeline graph before it is normalized for rendering.

#### Members

| Name | Type | Description |
| --- | --- | --- |
| `bridges?` | `[number, number][]` | Optional bridge edges rendered as animated connections between node groups. |
| `connections` | `RawPipelineEdge[]` | Raw node-to-node connections. |
| `nodes` | `[number, RawPipelineNode][]` | Raw nodes keyed by numeric node id. |

### RawPipelineEdge

Source: `services/pipeline.ts:73`

Raw connection between two pipeline node handles.

#### Members

| Name | Type | Description |
| --- | --- | --- |
| `node1Id` | `number` | Source node id. |
| `node1Output` | `string` | Source output handle name. |
| `node2Id` | `number` | Target node id. |
| `node2Input` | `string` | Target input handle name. |

### RawPipelineNode

Source: `services/pipeline.ts:47`

Raw node metadata as received from the pipeline service.

#### Members

| Name | Type | Description |
| --- | --- | --- |
| `deviceNode?` | `boolean` | Indicates whether the node runs on the device or host when that information is known. |
| `id` | `number` | Numeric node id from the backend payload. |
| `ioInfo` | `RawPipelineNodeIO[]` | Raw input and output metadata for this node. |
| `name` | `string` | Display name for the node. |
| `parentId?` | `number` | Parent node id, if the backend groups this node under another node. |

### RawPipelineNodeIO

Source: `services/pipeline.ts:12`

```ts
[[string, string], { blocking: boolean; id: number; name: string; queueSize: number; type: 0 | 3 }]
```

Raw IO metadata for one pipeline node input or output.

#### Remarks

This tuple mirrors the compact payload emitted by the backend before it is converted into React Flow handles.

### RawPipelinePayload

Source: `services/pipeline.ts:95`

Top-level raw payload accepted by parsePipeline.

#### Members

| Name | Type | Description |
| --- | --- | --- |
| `pipeline` | `RawPipeline` | Raw pipeline graph payload. |

## Functions

### parsePipeline

Source: `services/pipeline.ts:205`

```ts
(rawPayload: RawPipelinePayload) => Pipeline
```

Converts a raw DepthAI pipeline payload into a renderable graph.

#### Remarks

The parser filters out disconnected nodes, creates placeholder parent nodes when a grouped child references a missing parent, and
marks handles as connected or disconnected based on the generated edge list.

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `rawPayload` | `RawPipelinePayload` | Pipeline payload returned by the backend pipeline service. |

#### Returns

A normalized graph with React Flow nodes, normal edges, and optional bridge edges.

#### Example

```ts
const pipeline = parsePipeline(rawPipelinePayload);
```
