Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(native): return type casts (#7986)

darkskygit10a066a52a2f
diff --git a/packages/frontend/native/index.js b/packages/frontend/native/index.js
index c8426d8a88..c6c15fe67f 100644
--- a/packages/frontend/native/index.js
+++ b/packages/frontend/native/index.js
@@ -336,7 +336,7 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
nativeBinding = require('./affine.wasi.cjs')
} catch (err) {
if (process.env.NAPI_RS_FORCE_WASI) {
- console.error(err)
+ loadErrors.push(err)
}
}
if (!nativeBinding) {
@@ -344,7 +344,7 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
nativeBinding = require('@affine/native-wasm32-wasi')
} catch (err) {
if (process.env.NAPI_RS_FORCE_WASI) {
- console.error(err)
+ loadErrors.push(err)
}
}
}
diff --git a/packages/frontend/native/src/sqlite/mod.rs b/packages/frontend/native/src/sqlite/mod.rs
index 9880c33df7..00f3bd5817 100644
--- a/packages/frontend/native/src/sqlite/mod.rs
+++ b/packages/frontend/native/src/sqlite/mod.rs
@@ -166,7 +166,7 @@ impl SqliteConnection {
}
#[napi]
- pub async fn get_updates_count(&self, doc_id: Option<String>) -> napi::Result<i32> {
+ pub async fn get_updates_count(&self, doc_id: Option<String>) -> napi::Result<i64> {
let count = match doc_id {
Some(doc_id) => {
sqlx::query!(
@@ -185,9 +185,7 @@ impl SqliteConnection {
.map_err(anyhow::Error::from)?
.count
}
- }
- .try_into()
- .unwrap();
+ };
Ok(count)
}
@@ -396,14 +394,14 @@ impl SqliteConnection {
}
#[napi]
- pub async fn get_max_version(&self) -> napi::Result<i32> {
+ pub async fn get_max_version(&self) -> napi::Result<i64> {
// 4 is the current version
let version = sqlx::query!("SELECT COALESCE(MAX(version), 4) AS max_version FROM version_info")
.fetch_one(&self.pool)
.await
.map_err(anyhow::Error::from)?
.max_version;
- Ok(version.try_into().unwrap())
+ Ok(version)
}
#[napi]