@@ -28,9 +28,16 @@ pub async fn get_flow_schema(
2828}
2929
3030#[ derive( Serialize ) ]
31- pub struct GetFlowResponse {
31+ pub struct GetFlowResponseData {
3232 flow_spec : spec:: FlowInstanceSpec ,
3333 data_schema : FlowSchema ,
34+ query_handlers_spec : HashMap < String , Arc < QueryHandlerInfo > > ,
35+ }
36+
37+ #[ derive( Serialize ) ]
38+ pub struct GetFlowResponse {
39+ #[ serde( flatten) ]
40+ data : GetFlowResponseData ,
3441 fingerprint : utils:: fingerprint:: Fingerprint ,
3542}
3643
@@ -41,17 +48,23 @@ pub async fn get_flow(
4148 let flow_ctx = lib_context. get_flow_context ( & flow_name) ?;
4249 let flow_spec = flow_ctx. flow . flow_instance . clone ( ) ;
4350 let data_schema = flow_ctx. flow . data_schema . clone ( ) ;
44- let fingerprint = utils:: fingerprint:: Fingerprinter :: default ( )
45- . with ( & flow_spec)
46- . map_err ( |e| api_error ! ( "failed to fingerprint flow spec: {e}" ) ) ?
47- . with ( & data_schema)
48- . map_err ( |e| api_error ! ( "failed to fingerprint data schema: {e}" ) ) ?
49- . into_fingerprint ( ) ;
50- Ok ( Json ( GetFlowResponse {
51+ let query_handlers_spec: HashMap < _ , _ > = {
52+ let query_handlers = flow_ctx. query_handlers . read ( ) . unwrap ( ) ;
53+ query_handlers
54+ . iter ( )
55+ . map ( |( name, handler) | ( name. clone ( ) , handler. info . clone ( ) ) )
56+ . collect ( )
57+ } ;
58+ let data = GetFlowResponseData {
5159 flow_spec,
5260 data_schema,
53- fingerprint,
54- } ) )
61+ query_handlers_spec,
62+ } ;
63+ let fingerprint = utils:: fingerprint:: Fingerprinter :: default ( )
64+ . with ( & data)
65+ . map_err ( |e| api_error ! ( "failed to fingerprint flow response: {e}" ) ) ?
66+ . into_fingerprint ( ) ;
67+ Ok ( Json ( GetFlowResponse { data, fingerprint } ) )
5568}
5669
5770#[ derive( Deserialize ) ]
@@ -257,20 +270,6 @@ pub async fn get_row_indexing_status(
257270 Ok ( Json ( indexing_status) )
258271}
259272
260- pub async fn get_query_handlers (
261- Path ( flow_name) : Path < String > ,
262- State ( lib_context) : State < Arc < LibContext > > ,
263- ) -> Result < Json < HashMap < String , Arc < QueryHandlerInfo > > > , ApiError > {
264- let flow_ctx = lib_context. get_flow_context ( & flow_name) ?;
265- let query_handlers = flow_ctx. query_handlers . read ( ) . unwrap ( ) ;
266- Ok ( Json (
267- query_handlers
268- . iter ( )
269- . map ( |( name, handler) | ( name. clone ( ) , handler. info . clone ( ) ) )
270- . collect ( ) ,
271- ) )
272- }
273-
274273pub async fn query (
275274 Path ( ( flow_name, query_handler_name) ) : Path < ( String , String ) > ,
276275 Query ( query) : Query < QueryInput > ,
0 commit comments