@@ -2,8 +2,7 @@ use crate::prelude::*;
22
33use crate :: base:: schema:: { FieldSchema , ValueType } ;
44use 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 } ;
76use crate :: execution:: query;
87use crate :: lib_context:: { clear_lib_context, get_auth_registry, init_lib_context} ;
98use crate :: ops:: interface:: { QueryResult , QueryResults } ;
@@ -115,6 +114,24 @@ impl IndexUpdateInfo {
115114#[ pyclass]
116115pub struct Flow ( pub Arc < FlowContext > ) ;
117116
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+
118135#[ pyclass]
119136pub struct FlowLiveUpdater ( pub Arc < tokio:: sync:: RwLock < execution:: FlowLiveUpdater > > ) ;
120137
@@ -211,43 +228,31 @@ impl Flow {
211228 . iter ( )
212229 . map ( |op| RenderedSpecLine {
213230 content : format ! ( "Import: name={}, {}" , op. name, op. spec. format( mode) ) ,
214- scope : None ,
215231 children : vec ! [ ] ,
216232 } )
217233 . collect ( ) ,
218234 ) ;
219235
220236 // 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 {
226238 let content = format ! ( "{}: {}" , op. name, op. spec. format( mode) ) ;
227239
228240 let children = match & op. spec {
229241 ReactiveOpSpec :: ForEach ( fe) => fe
230242 . op_scope
231243 . ops
232244 . iter ( )
233- . map ( |nested| walk ( nested, mode, Some ( fe . op_scope . name . clone ( ) ) ) )
245+ . map ( |nested| walk ( nested, mode) )
234246 . collect ( ) ,
235247 _ => vec ! [ ] ,
236248 } ;
237249
238- RenderedSpecLine {
239- content,
240- scope,
241- children,
242- }
250+ RenderedSpecLine { content, children }
243251 }
244252
245253 sections. insert (
246254 "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 ( ) ,
251256 ) ;
252257
253258 // Targets
@@ -257,7 +262,6 @@ impl Flow {
257262 . iter ( )
258263 . map ( |op| RenderedSpecLine {
259264 content : format ! ( "Export: name={}, {}" , op. name, op. spec. format( mode) ) ,
260- scope : None ,
261265 children : vec ! [ ] ,
262266 } )
263267 . collect ( ) ,
@@ -270,7 +274,6 @@ impl Flow {
270274 . iter ( )
271275 . map ( |decl| RenderedSpecLine {
272276 content : format ! ( "Declaration: {}" , decl. format( mode) ) ,
273- scope : None ,
274277 children : vec ! [ ] ,
275278 } )
276279 . collect ( ) ,
0 commit comments