@@ -2,8 +2,7 @@ use crate::prelude::*;
2
2
3
3
use crate :: base:: schema:: { FieldSchema , ValueType } ;
4
4
use crate :: base:: spec:: VectorSimilarityMetric ;
5
- use crate :: base:: spec:: { NamedSpec , ReactiveOpSpec } ;
6
- use crate :: base:: spec:: { OutputMode , RenderedSpec , RenderedSpecLine , SpecFormatter } ;
5
+ use crate :: base:: spec:: { NamedSpec , OutputMode , ReactiveOpSpec , SpecFormatter } ;
7
6
use crate :: execution:: query;
8
7
use crate :: lib_context:: { clear_lib_context, get_auth_registry, init_lib_context} ;
9
8
use crate :: ops:: interface:: { QueryResult , QueryResults } ;
@@ -115,6 +114,24 @@ impl IndexUpdateInfo {
115
114
#[ pyclass]
116
115
pub struct Flow ( pub Arc < FlowContext > ) ;
117
116
117
+ /// A single line in the rendered spec, with hierarchical children
118
+ #[ pyclass( get_all, set_all) ]
119
+ #[ derive( Debug , Clone , Serialize , Deserialize ) ]
120
+ pub struct RenderedSpecLine {
121
+ /// The formatted content of the line (e.g., "Import: name=documents, source=LocalFile")
122
+ pub content : String ,
123
+ /// Child lines in the hierarchy
124
+ pub children : Vec < RenderedSpecLine > ,
125
+ }
126
+
127
+ /// A rendered specification, grouped by sections
128
+ #[ pyclass( get_all, set_all) ]
129
+ #[ derive( Debug , Clone , Serialize , Deserialize ) ]
130
+ pub struct RenderedSpec {
131
+ /// List of (section_name, lines) pairs
132
+ pub sections : Vec < ( String , Vec < RenderedSpecLine > ) > ,
133
+ }
134
+
118
135
#[ pyclass]
119
136
pub struct FlowLiveUpdater ( pub Arc < tokio:: sync:: RwLock < execution:: FlowLiveUpdater > > ) ;
120
137
@@ -211,43 +228,31 @@ impl Flow {
211
228
. iter ( )
212
229
. map ( |op| RenderedSpecLine {
213
230
content : format ! ( "Import: name={}, {}" , op. name, op. spec. format( mode) ) ,
214
- scope : None ,
215
231
children : vec ! [ ] ,
216
232
} )
217
233
. collect ( ) ,
218
234
) ;
219
235
220
236
// Processing
221
- fn walk (
222
- op : & NamedSpec < ReactiveOpSpec > ,
223
- mode : OutputMode ,
224
- scope : Option < String > ,
225
- ) -> RenderedSpecLine {
237
+ fn walk ( op : & NamedSpec < ReactiveOpSpec > , mode : OutputMode ) -> RenderedSpecLine {
226
238
let content = format ! ( "{}: {}" , op. name, op. spec. format( mode) ) ;
227
239
228
240
let children = match & op. spec {
229
241
ReactiveOpSpec :: ForEach ( fe) => fe
230
242
. op_scope
231
243
. ops
232
244
. iter ( )
233
- . map ( |nested| walk ( nested, mode, Some ( fe . op_scope . name . clone ( ) ) ) )
245
+ . map ( |nested| walk ( nested, mode) )
234
246
. collect ( ) ,
235
247
_ => vec ! [ ] ,
236
248
} ;
237
249
238
- RenderedSpecLine {
239
- content,
240
- scope,
241
- children,
242
- }
250
+ RenderedSpecLine { content, children }
243
251
}
244
252
245
253
sections. insert (
246
254
"Processing" . to_string ( ) ,
247
- spec. reactive_ops
248
- . iter ( )
249
- . map ( |op| walk ( op, mode, None ) )
250
- . collect ( ) ,
255
+ spec. reactive_ops . iter ( ) . map ( |op| walk ( op, mode) ) . collect ( ) ,
251
256
) ;
252
257
253
258
// Targets
@@ -257,7 +262,6 @@ impl Flow {
257
262
. iter ( )
258
263
. map ( |op| RenderedSpecLine {
259
264
content : format ! ( "Export: name={}, {}" , op. name, op. spec. format( mode) ) ,
260
- scope : None ,
261
265
children : vec ! [ ] ,
262
266
} )
263
267
. collect ( ) ,
@@ -270,7 +274,6 @@ impl Flow {
270
274
. iter ( )
271
275
. map ( |decl| RenderedSpecLine {
272
276
content : format ! ( "Declaration: {}" , decl. format( mode) ) ,
273
- scope : None ,
274
277
children : vec ! [ ] ,
275
278
} )
276
279
. collect ( ) ,
0 commit comments