mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-11-30 05:34:21 +03:00
fix: update octobase and fix type mismatching
This commit is contained in:
parent
5513cbf724
commit
51a427496c
@ -1 +1 @@
|
|||||||
Subproject commit d682a717e37b1eb202224891340fb39d68d172db
|
Subproject commit f7f7eee8492a95509d237d64081e03669df2e31f
|
13
client-app/src-tauri/Cargo.lock
generated
13
client-app/src-tauri/Cargo.lock
generated
@ -1746,9 +1746,11 @@ dependencies = [
|
|||||||
"base64 0.20.0",
|
"base64 0.20.0",
|
||||||
"bytes",
|
"bytes",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
"dotenvy",
|
||||||
"futures",
|
"futures",
|
||||||
"jwst",
|
"jwst",
|
||||||
"jwst-logger",
|
"jwst-logger",
|
||||||
|
"path-ext",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_repr",
|
"serde_repr",
|
||||||
@ -1756,6 +1758,7 @@ dependencies = [
|
|||||||
"sqlx",
|
"sqlx",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-util",
|
"tokio-util",
|
||||||
|
"uuid 1.2.2",
|
||||||
"yrs",
|
"yrs",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -2407,6 +2410,15 @@ version = "1.0.9"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1"
|
checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "path-ext"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d8285c3c3c3085f8819bdcebc9c7e783851527f34974d7d283ced36c977ae812"
|
||||||
|
dependencies = [
|
||||||
|
"walkdir",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pathdiff"
|
name = "pathdiff"
|
||||||
version = "0.2.1"
|
version = "0.2.1"
|
||||||
@ -4363,6 +4375,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "422ee0de9031b5b948b97a8fc04e3aa35230001a722ddd27943e0be31564ce4c"
|
checksum = "422ee0de9031b5b948b97a8fc04e3aa35230001a722ddd27943e0be31564ce4c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom 0.2.8",
|
"getrandom 0.2.8",
|
||||||
|
"rand 0.8.5",
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ ipc_types = { path = "./types" }
|
|||||||
futures = "^0.3.25"
|
futures = "^0.3.25"
|
||||||
js-sys = "0.3.60"
|
js-sys = "0.3.60"
|
||||||
jwst = { path = "../src-OctoBase/libs/jwst" }
|
jwst = { path = "../src-OctoBase/libs/jwst" }
|
||||||
jwst-storage = { path = "../src-OctoBase/libs/jwst-storage", features = ["sqlite"] }
|
jwst-storage = { path = "../src-OctoBase/libs/jwst-storage", features = ["sqlite", "server"] }
|
||||||
lib0 = "0.12.0"
|
lib0 = "0.12.0"
|
||||||
project-root = "0.2.2"
|
project-root = "0.2.2"
|
||||||
schemars = "0.8.3"
|
schemars = "0.8.3"
|
||||||
|
@ -17,7 +17,7 @@ pub async fn get_doc<'s>(
|
|||||||
.lock()
|
.lock()
|
||||||
.await
|
.await
|
||||||
.doc_storage
|
.doc_storage
|
||||||
.get(parameters.id)
|
.get(parameters.id.clone())
|
||||||
.await
|
.await
|
||||||
.ok()
|
.ok()
|
||||||
{
|
{
|
||||||
@ -27,7 +27,7 @@ pub async fn get_doc<'s>(
|
|||||||
} else {
|
} else {
|
||||||
Err(format!(
|
Err(format!(
|
||||||
"Failed to get yDoc from {}",
|
"Failed to get yDoc from {}",
|
||||||
parameters.id.to_string()
|
parameters.id
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -42,7 +42,7 @@ pub async fn update_y_document<'s>(
|
|||||||
.lock()
|
.lock()
|
||||||
.await
|
.await
|
||||||
.doc_storage
|
.doc_storage
|
||||||
.write_update(parameters.id, ¶meters.update)
|
.write_update(parameters.id.clone(), ¶meters.update)
|
||||||
.await
|
.await
|
||||||
.ok()
|
.ok()
|
||||||
{
|
{
|
||||||
@ -50,7 +50,7 @@ pub async fn update_y_document<'s>(
|
|||||||
} else {
|
} else {
|
||||||
Err(format!(
|
Err(format!(
|
||||||
"Failed to update yDoc to {}",
|
"Failed to update yDoc to {}",
|
||||||
parameters.id.to_string()
|
parameters.id
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ pub async fn create_workspace<'s>(
|
|||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
Ok(new_workspace) => {
|
Ok(new_workspace) => {
|
||||||
let workspace_doc = OctoBaseWorkspace::new(new_workspace.id.to_string());
|
let workspace_doc = OctoBaseWorkspace::new(new_workspace.id.clone());
|
||||||
|
|
||||||
workspace_doc.with_trx(|mut workspace_doc_transaction| {
|
workspace_doc.with_trx(|mut workspace_doc_transaction| {
|
||||||
workspace_doc_transaction.set_metadata(
|
workspace_doc_transaction.set_metadata(
|
||||||
@ -32,13 +32,13 @@ pub async fn create_workspace<'s>(
|
|||||||
.lock()
|
.lock()
|
||||||
.await
|
.await
|
||||||
.doc_storage
|
.doc_storage
|
||||||
.write_doc(new_workspace.id, workspace_doc.doc())
|
.write_doc(new_workspace.id.clone(), workspace_doc.doc())
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
Err(error_message.to_string())
|
Err(error_message.to_string())
|
||||||
} else {
|
} else {
|
||||||
Ok(CreateWorkspaceResult {
|
Ok(CreateWorkspaceResult {
|
||||||
id: new_workspace.id.to_string(),
|
id: new_workspace.id.clone(),
|
||||||
name: parameters.name,
|
name: parameters.name,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use jwst_storage::{BlobFsStorage, DBContext, DocFsStorage};
|
use jwst_storage::{BlobFsStorage, SqliteDBContext, DocFsStorage};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use tauri::api::path::document_dir;
|
use tauri::api::path::document_dir;
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
@ -6,7 +6,7 @@ use tokio::sync::Mutex;
|
|||||||
pub struct AppStateRaw {
|
pub struct AppStateRaw {
|
||||||
pub blob_storage: BlobFsStorage,
|
pub blob_storage: BlobFsStorage,
|
||||||
pub doc_storage: DocFsStorage,
|
pub doc_storage: DocFsStorage,
|
||||||
pub metadata_db: DBContext,
|
pub metadata_db: SqliteDBContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AppStateRaw {
|
impl AppStateRaw {
|
||||||
@ -27,7 +27,7 @@ impl AppStateRaw {
|
|||||||
Some(Self {
|
Some(Self {
|
||||||
doc_storage: DocFsStorage::new(Some(16), 500, Path::new(&doc_env).into()).await,
|
doc_storage: DocFsStorage::new(Some(16), 500, Path::new(&doc_env).into()).await,
|
||||||
blob_storage: BlobFsStorage::new(Some(16), Path::new(&blob_env).into()).await,
|
blob_storage: BlobFsStorage::new(Some(16), Path::new(&blob_env).into()).await,
|
||||||
metadata_db: DBContext::new(db_env).await,
|
metadata_db: SqliteDBContext::new(db_env).await,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,12 +4,12 @@ use serde::{Deserialize, Serialize};
|
|||||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
|
||||||
pub struct YDocumentUpdate {
|
pub struct YDocumentUpdate {
|
||||||
pub update: Vec<u8>,
|
pub update: Vec<u8>,
|
||||||
pub id: i64,
|
pub id: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
|
||||||
pub struct GetDocumentParameter {
|
pub struct GetDocumentParameter {
|
||||||
pub id: i64,
|
pub id: String,
|
||||||
}
|
}
|
||||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
|
||||||
pub struct GetDocumentResponse {
|
pub struct GetDocumentResponse {
|
||||||
|
@ -39,8 +39,7 @@
|
|||||||
"required": ["id"],
|
"required": ["id"],
|
||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
"id": {
|
||||||
"type": "integer",
|
"type": "string"
|
||||||
"format": "int64"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -63,8 +62,7 @@
|
|||||||
"required": ["id", "update"],
|
"required": ["id", "update"],
|
||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
"id": {
|
||||||
"type": "integer",
|
"type": "string"
|
||||||
"format": "int64"
|
|
||||||
},
|
},
|
||||||
"update": {
|
"update": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
|
@ -17,12 +17,12 @@ export type IDocumentParameters =
|
|||||||
};
|
};
|
||||||
|
|
||||||
export interface YDocumentUpdate {
|
export interface YDocumentUpdate {
|
||||||
id: number;
|
id: string;
|
||||||
update: number[];
|
update: number[];
|
||||||
[k: string]: unknown;
|
[k: string]: unknown;
|
||||||
}
|
}
|
||||||
export interface GetDocumentParameter {
|
export interface GetDocumentParameter {
|
||||||
id: number;
|
id: string;
|
||||||
[k: string]: unknown;
|
[k: string]: unknown;
|
||||||
}
|
}
|
||||||
export interface GetDocumentResponse {
|
export interface GetDocumentResponse {
|
||||||
|
Loading…
Reference in New Issue
Block a user