@luxonis/depthai-pipeline-lib 3.8.2 → 3.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,14 +1,90 @@
1
- # DepthAI Pipeline Library
1
+ # DepthAI Pipeline Lib
2
2
 
3
- ## Testing / Development
3
+ React components and parsing utilities for rendering DepthAI pipeline graphs.
4
+
5
+ ## Purpose
6
+
7
+ `@luxonis/depthai-pipeline-lib` converts DepthAI pipeline payloads into renderable graph data and provides a React Flow based canvas for displaying pipeline structure and runtime state.
8
+
9
+ Use this package when an application needs to:
10
+
11
+ - Parse raw pipeline graph payloads from a DepthAI backend.
12
+ - Parse live node and handle runtime state.
13
+ - Render an interactive pipeline canvas.
14
+ - Display device/host nodes, grouped nodes, bridge edges, connected handles, and runtime timing/state overlays.
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ npm install @luxonis/depthai-pipeline-lib
20
+ ```
21
+
22
+ The package expects the host application to provide compatible React and React DOM versions.
23
+
24
+ ## Imports
25
+
26
+ ```ts
27
+ import {
28
+ PipelineCanvas,
29
+ parsePipeline,
30
+ parsePipelineState,
31
+ } from '@luxonis/depthai-pipeline-lib';
32
+ import '@luxonis/depthai-pipeline-lib/styles';
33
+ ```
34
+
35
+ ## Basic Usage
36
+
37
+ ```tsx
38
+ import {
39
+ PipelineCanvas,
40
+ parsePipeline,
41
+ parsePipelineState,
42
+ } from '@luxonis/depthai-pipeline-lib';
43
+ import '@luxonis/depthai-pipeline-lib/styles';
44
+
45
+ export function PipelineView({ rawPipeline, rawPipelineState }) {
46
+ const pipeline = rawPipeline ? parsePipeline(rawPipeline) : null;
47
+ const pipelineState = rawPipelineState
48
+ ? parsePipelineState(rawPipelineState)
49
+ : null;
50
+
51
+ return (
52
+ <PipelineCanvas
53
+ pipeline={pipeline}
54
+ pipelineState={pipelineState}
55
+ />
56
+ );
57
+ }
58
+ ```
59
+
60
+ ## API Documentation
61
+
62
+ TSDoc comments in `src/` are the source of truth for generated API reference documentation.
63
+
64
+ Generate the TypeDoc JSON API model from the repository root:
65
+
66
+ ```bash
67
+ npm run docs:api-json:pipelines
68
+ ```
69
+
70
+ The generated JSON is written to:
71
+
72
+ ```text
73
+ dist/docs-api/depthai-pipeline-lib.json
74
+ ```
75
+
76
+ This file is an intermediate build artifact for the `docs-content` pipeline. Do not edit it manually.
77
+
78
+ ## Development
79
+
80
+ From the repository root:
4
81
 
5
82
  ```bash
6
- $ npm run dev
83
+ npm run build:depthai-pipeline-lib
7
84
  ```
8
85
 
9
- ## Building / Publishing
86
+ On Windows:
10
87
 
11
88
  ```bash
12
- $ npm run build
13
- $ npm publish
89
+ npm run build:depthai-pipeline-lib:win
14
90
  ```
@@ -1,10 +1,41 @@
1
1
  import React from 'react';
2
2
  import type { Pipeline } from '../services/pipeline.js';
3
3
  import type { PipelineState } from '../services/pipeline-state.js';
4
+ /**
5
+ * Props for {@link PipelineCanvas}.
6
+ */
4
7
  export type PipelineCanvasProps = {
8
+ /**
9
+ * Parsed pipeline graph to render, or `null` while pipeline data is loading.
10
+ */
5
11
  pipeline: Pipeline | null;
12
+ /**
13
+ * Runtime state for nodes and IO handles, or `null` when live state is unavailable.
14
+ */
6
15
  pipelineState: PipelineState[] | null;
16
+ /**
17
+ * Optional content rendered in the top-center panel above the graph.
18
+ */
7
19
  header?: React.ReactNode;
20
+ /**
21
+ * Shows debugging-oriented legend entries when enabled.
22
+ *
23
+ * @defaultValue `false`
24
+ */
8
25
  isDebugging?: boolean;
9
26
  };
27
+ /**
28
+ * Renders an interactive DepthAI pipeline graph.
29
+ *
30
+ * @remarks
31
+ * The component expects graph data produced by {@link parsePipeline} and can overlay
32
+ * runtime node/handle state produced by {@link parsePipelineState}. It wraps the graph
33
+ * in a React Flow provider, lays nodes out automatically until the user drags a node,
34
+ * and exposes a built-in legend panel.
35
+ *
36
+ * @example
37
+ * ```tsx
38
+ * <PipelineCanvas pipeline={pipeline} pipelineState={pipelineState} />
39
+ * ```
40
+ */
10
41
  export declare const PipelineCanvas: React.FC<PipelineCanvasProps>;
@@ -70,4 +70,18 @@ const PipelineCanvasBody = ({ pipeline, pipelineState: pipelineStateParsed, head
70
70
  }, [shouldFitAndResize]);
71
71
  return (_jsxs(Flex, { align: "center", justify: "center", full: true, className: "border border-border rounded-sm", children: [!pipeline && _jsx(Header, { text: "Loading pipeline..." }), pipeline && (_jsxs(ReactFlow, { nodes: nodes, edges: edges, onNodeDragStart: () => (autoArrangeRef.current = false), onNodesChange: onNodesChange, fitView: true, nodeTypes: nodeTypes, edgeTypes: edgeTypes, minZoom: 0.4, colorMode: colorMode, children: [header && _jsx(Panel, { position: "top-center", children: header }), _jsx(Panel, { position: "top-right", children: _jsxs(Flex, { gap: "xs", direction: "column", children: [_jsx(Button, { onClick: () => setOpenLegend(!openLegend), label: openLegend ? 'Collapse' : 'Legend' }), openLegend && _jsx(PipelineLegend, { isDebugging: isDebugging })] }) })] }))] }));
72
72
  };
73
+ /**
74
+ * Renders an interactive DepthAI pipeline graph.
75
+ *
76
+ * @remarks
77
+ * The component expects graph data produced by {@link parsePipeline} and can overlay
78
+ * runtime node/handle state produced by {@link parsePipelineState}. It wraps the graph
79
+ * in a React Flow provider, lays nodes out automatically until the user drags a node,
80
+ * and exposes a built-in legend panel.
81
+ *
82
+ * @example
83
+ * ```tsx
84
+ * <PipelineCanvas pipeline={pipeline} pipelineState={pipelineState} />
85
+ * ```
86
+ */
73
87
  export const PipelineCanvas = (props) => (_jsx(ReactFlowProvider, { children: _jsx(PipelineCanvasBody, { ...props }) }));
@@ -1,7 +1,13 @@
1
+ /**
2
+ * React components and parsing utilities for rendering DepthAI pipeline graphs.
3
+ *
4
+ * @packageDocumentation
5
+ */
1
6
  export type { PipelineCanvasProps } from './components/PipelineCanvas.js';
2
7
  export { PipelineCanvas } from './components/PipelineCanvas.js';
3
- export type { Pipeline, RawPipelinePayload } from './services/pipeline.js';
8
+ export type { ParsedNode, Pipeline, RawPipeline, RawPipelineEdge, RawPipelineNode, RawPipelineNodeIO, RawPipelinePayload, } from './services/pipeline.js';
4
9
  export { parsePipeline } from './services/pipeline.js';
5
- export type { PipelineState, RawPipelineStatePayload, } from './services/pipeline-state.js';
10
+ export type { ParsedHandle } from './services/pipeline-handles.js';
11
+ export type { GPSTTimingsType, IONodeState, IOStates, NodeExtras, NodeState, NodeStateRaw, PipelineState, PipelineStateDotColor, RawPipelineState, RawPipelineStatePayload, Timing, TimingWithFps, } from './services/pipeline-state.js';
6
12
  export { parsePipelineState } from './services/pipeline-state.js';
7
13
  export { PACKAGE_VERSION } from './version.js';
package/dist/src/index.js CHANGED
@@ -1,3 +1,8 @@
1
+ /**
2
+ * React components and parsing utilities for rendering DepthAI pipeline graphs.
3
+ *
4
+ * @packageDocumentation
5
+ */
1
6
  export { PipelineCanvas } from './components/PipelineCanvas.js';
2
7
  export { parsePipeline } from './services/pipeline.js';
3
8
  export { parsePipelineState } from './services/pipeline-state.js';
@@ -1,16 +1,49 @@
1
1
  import type { Edge } from '@xyflow/react';
2
2
  import type { ParsedNode, RawPipelineNodeIO } from './pipeline';
3
3
  import type { PipelineStateDotColor } from './pipeline-state';
4
+ /**
5
+ * Raw bridge connection between two node ids.
6
+ */
4
7
  export type RawPipelineBridge = [number, number];
8
+ /**
9
+ * Parsed input or output handle rendered on a pipeline node.
10
+ */
5
11
  export type ParsedHandle = {
12
+ /**
13
+ * Numeric handle id from the raw pipeline payload.
14
+ */
6
15
  id: number;
16
+ /**
17
+ * Handle name used as the React Flow handle id.
18
+ */
7
19
  name: string;
20
+ /**
21
+ * Direction of the handle on the node.
22
+ */
8
23
  type: 'input' | 'output';
24
+ /**
25
+ * Indicates whether this handle blocks when its queue is full or empty.
26
+ */
9
27
  blocking: boolean;
28
+ /**
29
+ * Current queue size configured for the handle.
30
+ */
10
31
  queueSize: number;
32
+ /**
33
+ * Whether the handle participates in at least one rendered edge.
34
+ */
11
35
  connected: boolean;
36
+ /**
37
+ * Maximum observed queue size from runtime state, when available.
38
+ */
12
39
  maxQueueSize?: number;
40
+ /**
41
+ * Frames-per-second value from runtime state, when available.
42
+ */
13
43
  fps?: number;
44
+ /**
45
+ * Runtime status color rendered next to the handle.
46
+ */
14
47
  dotColor?: PipelineStateDotColor;
15
48
  };
16
49
  export declare function parseHandles(handles: RawPipelineNodeIO[]): {
@@ -22,24 +55,72 @@ export declare function filterNodesHandles(nodes: ParsedNode[], edges: Edge[]):
22
55
  handles: {
23
56
  input: {
24
57
  connected: boolean;
58
+ /**
59
+ * Numeric handle id from the raw pipeline payload.
60
+ */
25
61
  id: number;
62
+ /**
63
+ * Handle name used as the React Flow handle id.
64
+ */
26
65
  name: string;
66
+ /**
67
+ * Direction of the handle on the node.
68
+ */
27
69
  type: "input" | "output";
70
+ /**
71
+ * Indicates whether this handle blocks when its queue is full or empty.
72
+ */
28
73
  blocking: boolean;
74
+ /**
75
+ * Current queue size configured for the handle.
76
+ */
29
77
  queueSize: number;
78
+ /**
79
+ * Maximum observed queue size from runtime state, when available.
80
+ */
30
81
  maxQueueSize?: number;
82
+ /**
83
+ * Frames-per-second value from runtime state, when available.
84
+ */
31
85
  fps?: number;
86
+ /**
87
+ * Runtime status color rendered next to the handle.
88
+ */
32
89
  dotColor?: PipelineStateDotColor;
33
90
  }[];
34
91
  output: {
35
92
  connected: boolean;
93
+ /**
94
+ * Numeric handle id from the raw pipeline payload.
95
+ */
36
96
  id: number;
97
+ /**
98
+ * Handle name used as the React Flow handle id.
99
+ */
37
100
  name: string;
101
+ /**
102
+ * Direction of the handle on the node.
103
+ */
38
104
  type: "input" | "output";
105
+ /**
106
+ * Indicates whether this handle blocks when its queue is full or empty.
107
+ */
39
108
  blocking: boolean;
109
+ /**
110
+ * Current queue size configured for the handle.
111
+ */
40
112
  queueSize: number;
113
+ /**
114
+ * Maximum observed queue size from runtime state, when available.
115
+ */
41
116
  maxQueueSize?: number;
117
+ /**
118
+ * Frames-per-second value from runtime state, when available.
119
+ */
42
120
  fps?: number;
121
+ /**
122
+ * Runtime status color rendered next to the handle.
123
+ */
43
124
  dotColor?: PipelineStateDotColor;
44
125
  }[];
45
126
  };
@@ -1,65 +1,233 @@
1
+ /**
2
+ * Top-level raw runtime-state payload accepted by {@link parsePipelineState}.
3
+ */
1
4
  export type RawPipelineStatePayload = {
5
+ /**
6
+ * Raw state tuples keyed by node id.
7
+ */
2
8
  nodeStates: RawPipelineState[];
3
9
  };
4
- type IONodeState = 0 | 1 | 2;
10
+ /**
11
+ * Raw IO state value reported for a node input or output.
12
+ *
13
+ * @remarks
14
+ * `0` maps to green, `1` maps to yellow, `2` maps to red, and any missing or
15
+ * unknown value maps to gray.
16
+ */
17
+ export type IONodeState = 0 | 1 | 2;
18
+ /**
19
+ * Runtime state indexed by input or output handle name.
20
+ */
5
21
  export type IOStates = {
6
22
  [key: string]: {
23
+ /**
24
+ * Number of queued messages for this handle.
25
+ */
7
26
  numQueued: number;
27
+ /**
28
+ * Timing and FPS statistics reported for this handle.
29
+ */
8
30
  timing: TimingWithFps;
31
+ /**
32
+ * Raw IO state value from the runtime.
33
+ */
9
34
  state?: IONodeState;
35
+ /**
36
+ * UI color derived from the raw state value by {@link parsePipelineState}.
37
+ */
10
38
  dotColor?: PipelineStateDotColor;
11
39
  };
12
40
  };
13
- type Timing = {
41
+ /**
42
+ * Duration statistics reported in microseconds.
43
+ */
44
+ export type Timing = {
45
+ /**
46
+ * Recent average duration in microseconds.
47
+ */
14
48
  averageMicrosRecent: number;
49
+ /**
50
+ * Maximum duration across the observed window in microseconds.
51
+ */
15
52
  maxMicros: number;
53
+ /**
54
+ * Recent maximum duration in microseconds.
55
+ */
16
56
  maxMicrosRecent: number;
57
+ /**
58
+ * Recent median duration in microseconds.
59
+ */
17
60
  medianMicrosRecent: number;
61
+ /**
62
+ * Minimum duration across the observed window in microseconds.
63
+ */
18
64
  minMicros: number;
65
+ /**
66
+ * Recent minimum duration in microseconds.
67
+ */
19
68
  minMicrosRecent: number;
69
+ /**
70
+ * Recent duration standard deviation in microseconds.
71
+ */
20
72
  stdDevMicrosRecent: number;
21
73
  };
22
- type TimingWithFps = {
74
+ /**
75
+ * Timing statistics with the observed frames-per-second value.
76
+ */
77
+ export type TimingWithFps = {
78
+ /**
79
+ * Duration statistics for this timing bucket.
80
+ */
23
81
  durationStats: Timing;
82
+ /**
83
+ * Frames-per-second rate reported for this timing bucket.
84
+ */
24
85
  fps: number;
25
86
  };
26
- type NodeStateRaw = 0 | 1 | 2 | 3;
27
- type NodeState = 'IDLE' | 'GETTING_INPUTS' | 'PROCESSING' | 'SENDING_OUTPUTS';
87
+ /**
88
+ * Raw node state value reported by the runtime.
89
+ *
90
+ * @remarks
91
+ * `0` is idle, `1` is getting inputs, `2` is processing, and `3` is sending outputs.
92
+ */
93
+ export type NodeStateRaw = 0 | 1 | 2 | 3;
94
+ /**
95
+ * Normalized node state label used by parsed pipeline state.
96
+ */
97
+ export type NodeState = 'IDLE' | 'GETTING_INPUTS' | 'PROCESSING' | 'SENDING_OUTPUTS';
98
+ /**
99
+ * Raw runtime-state tuple for one pipeline node.
100
+ */
28
101
  export type RawPipelineState = [
102
+ /**
103
+ * Numeric node id.
104
+ */
29
105
  number,
106
+ /**
107
+ * Runtime state payload for the node.
108
+ */
30
109
  {
110
+ /**
111
+ * Raw event list reserved for runtime diagnostics.
112
+ */
31
113
  events: unknown[];
114
+ /**
115
+ * Raw input handle states.
116
+ */
32
117
  inputStates: IOStates;
118
+ /**
119
+ * Timing for collecting node inputs.
120
+ */
33
121
  inputsGetTiming: TimingWithFps;
122
+ /**
123
+ * Timing for the node main loop.
124
+ */
34
125
  mainLoopTiming: TimingWithFps;
126
+ /**
127
+ * Additional runtime timing buckets not currently rendered by the canvas.
128
+ */
35
129
  otherTimings: object;
130
+ /**
131
+ * Raw output handle states.
132
+ */
36
133
  outputStates: IOStates;
134
+ /**
135
+ * Timing for sending node outputs.
136
+ */
37
137
  outputsSendTiming: TimingWithFps;
138
+ /**
139
+ * Raw node execution state.
140
+ */
38
141
  state?: NodeStateRaw;
39
142
  }
40
143
  ];
144
+ /**
145
+ * Dot color used by the canvas legend and node handles.
146
+ */
41
147
  export type PipelineStateDotColor = 'gray' | 'green' | 'yellow' | 'red';
148
+ /**
149
+ * Average node timing breakdown in microseconds.
150
+ *
151
+ * @remarks
152
+ * `G` is time spent getting inputs, `P` is processing time, `S` is time spent
153
+ * sending outputs, and `T` is the total main-loop time.
154
+ */
42
155
  export type GPSTTimingsType = {
156
+ /**
157
+ * Average time spent getting inputs.
158
+ */
43
159
  G: number;
160
+ /**
161
+ * Average processing time.
162
+ */
44
163
  P: number;
164
+ /**
165
+ * Average time spent sending outputs.
166
+ */
45
167
  S: number;
168
+ /**
169
+ * Average total main-loop time.
170
+ */
46
171
  T: number;
47
172
  };
173
+ /**
174
+ * Additional runtime metadata attached to a parsed pipeline node.
175
+ */
48
176
  export type NodeExtras = {
177
+ /**
178
+ * Parsed timing breakdown for the node.
179
+ */
49
180
  gpstTimings?: GPSTTimingsType;
181
+ /**
182
+ * Parsed node execution state and display labels.
183
+ */
50
184
  stateInfo?: {
185
+ /**
186
+ * Normalized execution state.
187
+ */
51
188
  state: NodeState;
189
+ /**
190
+ * Human-readable state label.
191
+ */
52
192
  label: string;
193
+ /**
194
+ * Short state letter rendered in compact UI.
195
+ */
53
196
  letter: string;
54
197
  };
55
198
  };
199
+ /**
200
+ * Parsed runtime state for one pipeline node.
201
+ */
56
202
  export type PipelineState = {
203
+ /**
204
+ * Numeric node id matching the raw pipeline node id.
205
+ */
57
206
  id: number;
207
+ /**
208
+ * Parsed input handle states.
209
+ */
58
210
  inputs: IOStates;
211
+ /**
212
+ * Parsed output handle states.
213
+ */
59
214
  outputs: IOStates;
60
215
  } & NodeExtras;
216
+ /**
217
+ * Converts raw runtime-state payloads into canvas-friendly node state.
218
+ *
219
+ * @param rawPayload - Runtime-state payload returned by the backend pipeline service.
220
+ * @returns Parsed node states with handle colors, timing breakdowns, and state labels.
221
+ *
222
+ * @remarks
223
+ * Timing values are kept in microseconds so the renderer can decide how to format them.
224
+ *
225
+ * @example
226
+ * ```ts
227
+ * const pipelineState = parsePipelineState(rawPipelineStatePayload);
228
+ * ```
229
+ */
61
230
  export declare function parsePipelineState(rawPayload: RawPipelineStatePayload): PipelineState[];
62
231
  export declare function stateToLabel(state: NodeState): string;
63
232
  export declare function stateToLetter(state: NodeState): string;
64
233
  export declare function formatTiming(time: number): string;
65
- export {};
@@ -36,6 +36,20 @@ function formatIOStates(values) {
36
36
  }
37
37
  return returnObj;
38
38
  }
39
+ /**
40
+ * Converts raw runtime-state payloads into canvas-friendly node state.
41
+ *
42
+ * @param rawPayload - Runtime-state payload returned by the backend pipeline service.
43
+ * @returns Parsed node states with handle colors, timing breakdowns, and state labels.
44
+ *
45
+ * @remarks
46
+ * Timing values are kept in microseconds so the renderer can decide how to format them.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * const pipelineState = parsePipelineState(rawPipelineStatePayload);
51
+ * ```
52
+ */
39
53
  export function parsePipelineState(rawPayload) {
40
54
  const { nodeStates } = rawPayload;
41
55
  const parsedNodeStates = [];
@@ -1,53 +1,178 @@
1
1
  import type { Edge, Node } from '@xyflow/react';
2
2
  import { type ParsedHandle } from './pipeline-handles';
3
3
  import type { NodeExtras } from './pipeline-state';
4
+ /**
5
+ * Raw IO metadata for one pipeline node input or output.
6
+ *
7
+ * @remarks
8
+ * This tuple mirrors the compact payload emitted by the backend before it is converted
9
+ * into React Flow handles.
10
+ */
4
11
  export type RawPipelineNodeIO = [
12
+ /**
13
+ * Raw socket identity tuple emitted by the backend.
14
+ */
5
15
  [
6
16
  string,
7
17
  string
8
18
  ],
19
+ /**
20
+ * Queue and direction metadata for the socket.
21
+ */
9
22
  {
23
+ /**
24
+ * Numeric IO id.
25
+ */
10
26
  id: number;
27
+ /**
28
+ * IO name used to connect edges to handles.
29
+ */
11
30
  name: string;
31
+ /**
32
+ * Raw IO direction where `3` represents an input and `0` represents an output.
33
+ */
12
34
  type: 0 | 3;
35
+ /**
36
+ * Indicates whether the IO queue blocks.
37
+ */
13
38
  blocking: boolean;
39
+ /**
40
+ * Configured queue size for this IO.
41
+ */
14
42
  queueSize: number;
15
43
  }
16
44
  ];
45
+ /**
46
+ * Raw node metadata as received from the pipeline service.
47
+ */
17
48
  export type RawPipelineNode = {
49
+ /**
50
+ * Numeric node id from the backend payload.
51
+ */
18
52
  id: number;
53
+ /**
54
+ * Raw input and output metadata for this node.
55
+ */
19
56
  ioInfo: RawPipelineNodeIO[];
57
+ /**
58
+ * Display name for the node.
59
+ */
20
60
  name: string;
61
+ /**
62
+ * Parent node id, if the backend groups this node under another node.
63
+ */
21
64
  parentId?: number;
65
+ /**
66
+ * Indicates whether the node runs on the device or host when that information is known.
67
+ */
22
68
  deviceNode?: boolean;
23
69
  };
70
+ /**
71
+ * Raw connection between two pipeline node handles.
72
+ */
24
73
  export type RawPipelineEdge = {
74
+ /**
75
+ * Source node id.
76
+ */
25
77
  node1Id: number;
78
+ /**
79
+ * Source output handle name.
80
+ */
26
81
  node1Output: string;
82
+ /**
83
+ * Target node id.
84
+ */
27
85
  node2Id: number;
86
+ /**
87
+ * Target input handle name.
88
+ */
28
89
  node2Input: string;
29
90
  };
91
+ /**
92
+ * Top-level raw payload accepted by {@link parsePipeline}.
93
+ */
30
94
  export type RawPipelinePayload = {
95
+ /**
96
+ * Raw pipeline graph payload.
97
+ */
31
98
  pipeline: RawPipeline;
32
99
  };
100
+ /**
101
+ * Raw pipeline graph before it is normalized for rendering.
102
+ */
33
103
  export type RawPipeline = {
104
+ /**
105
+ * Raw node-to-node connections.
106
+ */
34
107
  connections: RawPipelineEdge[];
108
+ /**
109
+ * Raw nodes keyed by numeric node id.
110
+ */
35
111
  nodes: [number, RawPipelineNode][];
112
+ /**
113
+ * Optional bridge edges rendered as animated connections between node groups.
114
+ */
36
115
  bridges?: [number, number][];
37
116
  };
117
+ /**
118
+ * Parsed pipeline graph ready for {@link PipelineCanvas}.
119
+ */
38
120
  export type Pipeline = {
121
+ /**
122
+ * React Flow nodes rendered by {@link PipelineCanvas}.
123
+ */
39
124
  nodes: ParsedNode[];
125
+ /**
126
+ * React Flow edges rendered by {@link PipelineCanvas}.
127
+ */
40
128
  edges: Edge[];
41
129
  };
130
+ /**
131
+ * React Flow node used by the pipeline canvas.
132
+ */
42
133
  export type ParsedNode = Node<{
134
+ /**
135
+ * String node id used by React Flow.
136
+ */
43
137
  id: string;
138
+ /**
139
+ * Parent group node id, if this node is rendered inside a group.
140
+ */
44
141
  parentId?: string;
142
+ /**
143
+ * Display name rendered in the node.
144
+ */
45
145
  name: string;
146
+ /**
147
+ * Parsed input and output handles.
148
+ */
46
149
  handles: {
47
150
  input: ParsedHandle[];
48
151
  output: ParsedHandle[];
49
152
  };
153
+ /**
154
+ * Runtime placement of the node when known.
155
+ */
50
156
  nodeType?: 'device' | 'host';
157
+ /**
158
+ * Parsed runtime metadata overlaid onto the graph.
159
+ */
51
160
  extras?: NodeExtras;
52
161
  }>;
162
+ /**
163
+ * Converts a raw DepthAI pipeline payload into a renderable graph.
164
+ *
165
+ * @param rawPayload - Pipeline payload returned by the backend pipeline service.
166
+ * @returns A normalized graph with React Flow nodes, normal edges, and optional bridge edges.
167
+ *
168
+ * @remarks
169
+ * The parser filters out disconnected nodes, creates placeholder parent nodes when a
170
+ * grouped child references a missing parent, and marks handles as connected or
171
+ * disconnected based on the generated edge list.
172
+ *
173
+ * @example
174
+ * ```ts
175
+ * const pipeline = parsePipeline(rawPipelinePayload);
176
+ * ```
177
+ */
53
178
  export declare function parsePipeline(rawPayload: RawPipelinePayload): Pipeline;
@@ -20,6 +20,22 @@ function addFakeNode(id) {
20
20
  },
21
21
  ];
22
22
  }
23
+ /**
24
+ * Converts a raw DepthAI pipeline payload into a renderable graph.
25
+ *
26
+ * @param rawPayload - Pipeline payload returned by the backend pipeline service.
27
+ * @returns A normalized graph with React Flow nodes, normal edges, and optional bridge edges.
28
+ *
29
+ * @remarks
30
+ * The parser filters out disconnected nodes, creates placeholder parent nodes when a
31
+ * grouped child references a missing parent, and marks handles as connected or
32
+ * disconnected based on the generated edge list.
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * const pipeline = parsePipeline(rawPipelinePayload);
37
+ * ```
38
+ */
23
39
  export function parsePipeline(rawPayload) {
24
40
  const { pipeline } = rawPayload;
25
41
  // Set all nodes as generic nodes
@@ -1 +1,4 @@
1
- export declare const PACKAGE_VERSION = "3.8.2";
1
+ /**
2
+ * Package version injected during the library build.
3
+ */
4
+ export declare const PACKAGE_VERSION = "3.9.0";
@@ -1,2 +1,5 @@
1
1
  // Do not edit it manually.
2
- export const PACKAGE_VERSION = '3.8.2';
2
+ /**
3
+ * Package version injected during the library build.
4
+ */
5
+ export const PACKAGE_VERSION = '3.9.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luxonis/depthai-pipeline-lib",
3
- "version": "3.8.2",
3
+ "version": "3.9.0",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "main": "./dist/src/index.js",
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@dagrejs/dagre": "^1.1.3",
18
- "@luxonis/ui-components": "^1.3.7",
18
+ "@luxonis/ui-components": "^1.3.8",
19
19
  "@xyflow/react": "^12.0.4",
20
20
  "postcss-import": "^16.1.0",
21
21
  "postcss-nested": "^6.2.0",