@@ -45,7 +45,7 @@ use napi_derive::napi;
4545#[ derive( Debug , Clone ) ]
4646#[ cfg_attr( feature = "py" , pyo3:: pyclass) ]
4747#[ cfg_attr( feature = "js" , napi) ]
48- pub struct Workspace ( Arc < WorkspaceInner > ) ;
48+ pub struct Workspace ( pub ( crate ) Arc < WorkspaceInner > ) ;
4949
5050#[ derive( Debug ) ]
5151struct WorkspaceInner {
@@ -87,17 +87,16 @@ impl AsyncReceiver<Event> for Workspace {
8787}
8888
8989impl Workspace {
90- #[ tracing:: instrument( skip( id, user, token , claims ) , fields( ws = %id) ) ]
90+ #[ tracing:: instrument( skip( id, user, workspace_claim , user_claim ) , fields( ws = %id) ) ]
9191 pub ( crate ) async fn connect (
9292 id : Uuid ,
9393 user : Arc < User > ,
9494 config : crate :: api:: Config ,
95- token : Token ,
96- claims : tokio:: sync:: watch:: Receiver < codemp_proto:: common:: Token > ,
95+ workspace_claim : tokio :: sync :: watch :: Receiver < codemp_proto :: common :: Token > ,
96+ user_claim : tokio:: sync:: watch:: Receiver < codemp_proto:: common:: Token > ,
9797 ) -> ConnectionResult < Self > {
98- let workspace_claim = InternallyMutable :: new ( token) ;
9998 let services =
100- Services :: try_new ( & config. endpoint ( ) , claims , workspace_claim. channel ( ) ) . await ?;
99+ Services :: try_new ( & config. endpoint ( ) , user_claim , workspace_claim) . await ?;
101100 let ws_stream = services. ws ( ) . attach ( Empty { } ) . await ?. into_inner ( ) ;
102101
103102 let ( tx, rx) = mpsc:: channel ( 128 ) ;
@@ -146,6 +145,10 @@ impl Workspace {
146145 Ok ( ws)
147146 }
148147
148+ pub ( crate ) fn services ( & self ) -> & Services {
149+ & self . 0 . services
150+ }
151+
149152 /// drop arc, return true if was last
150153 pub ( crate ) fn consume ( self ) -> bool {
151154 Arc :: into_inner ( self . 0 ) . is_some ( )
0 commit comments