Skip to content

Commit e9681da

Browse files
committed
Remove cipher references from the macro
1 parent 9c2013d commit e9681da

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

crates/bitwarden-wasm-internal/src/platform/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl RepositoryClient {
2929
}
3030
}
3131

32-
repository::create_wasm_repository!(CipherRepository, Cipher);
32+
repository::create_wasm_repository!(CipherRepository, Cipher, "Repository<Cipher>");
3333

3434
#[wasm_bindgen]
3535
impl RepositoryClient {

crates/bitwarden-wasm-internal/src/platform/repository.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ export interface Repository<T> {
1111
"#;
1212

1313
macro_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

Comments
 (0)