@@ -11,10 +11,10 @@ export interface Repository<T> {
1111"# ;
1212
1313macro_rules! create_wasm_repository {
14- ( $name: ident, $ty: ty) => {
14+ ( $name: ident, $ty: ty, $typescript_ty : literal ) => {
1515 #[ wasm_bindgen]
1616 extern "C" {
17- #[ wasm_bindgen( js_name = $name, typescript_type = "Repository<Cipher>" ) ]
17+ #[ wasm_bindgen( js_name = $name, typescript_type = $typescript_ty ) ]
1818 pub type $name;
1919
2020 #[ wasm_bindgen( method, catch) ]
@@ -44,20 +44,20 @@ macro_rules! create_wasm_repository {
4444 ) -> :: std:: sync:: Arc <impl bitwarden_core:: client:: repository:: Repository <$ty>> {
4545 use :: bitwarden_core:: client:: repository:: * ;
4646
47- use crate :: platform:: repository:: __macro_internal:: * ;
47+ use $ crate:: platform:: repository:: __macro_internal:: * ;
4848
49- struct Store ( :: bitwarden_threading:: ThreadBoundRunner <CipherRepository >) ;
49+ struct Store ( :: bitwarden_threading:: ThreadBoundRunner <$name >) ;
5050 let store = Store ( :: bitwarden_threading:: ThreadBoundRunner :: new( self ) ) ;
5151
5252 #[ async_trait:: async_trait]
53- impl Repository <Cipher > for Store {
54- async fn get( & self , id: String ) -> Result <Option <Cipher >, RepositoryError > {
53+ impl Repository <$ty > for Store {
54+ async fn get( & self , id: String ) -> Result <Option <$ty >, RepositoryError > {
5555 run_convert( & self . 0 , |s| async move { s. get( id) . await } ) . await
5656 }
57- async fn list( & self ) -> Result <Vec <Cipher >, RepositoryError > {
57+ async fn list( & self ) -> Result <Vec <$ty >, RepositoryError > {
5858 run_convert( & self . 0 , |s| async move { s. list( ) . await } ) . await
5959 }
60- async fn set( & self , id: String , value: Cipher ) -> Result <( ) , RepositoryError > {
60+ async fn set( & self , id: String , value: $ty ) -> Result <( ) , RepositoryError > {
6161 run_convert( & self . 0 , |s| async move { s. set( id, value) . await . and( UNIT ) } )
6262 . await
6363 }
0 commit comments