Nathan.fooo 55c97b56a3
feat: calling user event from web (#4535)
* refactor: user manager

* refactor: user manager

* refactor: session location

* refactor: user manager

* chore: gen ts files

* feat: implement indexeddb persistence

* chore: integrate user manager

* chore: update

* chore: run on web thread

* chore: run on web thread

* chore: fix test

* chore: add test

* chore: add test

* chore: add user & sign in with password

* chore: fix test

* chore: update docs

* chore: fix warnings

* chore: gen files

* chore: add user

* chore: add files

* chore: update config

* chore: update scirpt

* chore: update scirpt

* fix: build

* chore: update command

* fix: ci

* ci: fix

* fix: compile

* fix: compile

* fix: ci

* fix: compile

* fix: tauri build

* chore: fix test

* chore: fix test
2024-01-30 05:36:27 +08:00

74 lines
1.9 KiB
Rust

#[cfg(feature = "proto_gen")]
pub mod protobuf_file;
#[cfg(feature = "dart_event")]
pub mod dart_event;
#[cfg(feature = "ts_event")]
pub mod ts_event;
#[cfg(any(feature = "proto_gen", feature = "dart_event", feature = "ts_event"))]
mod flowy_toml;
pub(crate) mod ast;
#[cfg(any(feature = "proto_gen", feature = "dart_event", feature = "ts_event"))]
pub mod util;
#[derive(serde::Serialize, serde::Deserialize)]
pub struct ProtoCache {
pub structs: Vec<String>,
pub enums: Vec<String>,
}
pub enum Project {
Tauri,
Web { relative_path: String },
Native,
}
impl Project {
pub fn dst(&self) -> String {
match self {
Project::Tauri => "appflowy_tauri/src/services/backend".to_string(),
Project::Web { .. } => "appflowy_web/src/services/backend".to_string(),
Project::Native => panic!("Native project is not supported yet."),
}
}
pub fn event_root(&self) -> String {
match self {
Project::Tauri => "../../".to_string(),
Project::Web { relative_path } => relative_path.to_string(),
Project::Native => panic!("Native project is not supported yet."),
}
}
pub fn model_root(&self) -> String {
match self {
Project::Tauri => "../../".to_string(),
Project::Web { relative_path } => relative_path.to_string(),
Project::Native => panic!("Native project is not supported yet."),
}
}
pub fn event_imports(&self) -> String {
match self {
Project::Tauri => r#"
/// Auto generate. Do not edit
import { Ok, Err, Result } from "ts-results";
import { invoke } from "@tauri-apps/api/tauri";
import * as pb from "../..";
"#
.to_string(),
Project::Web { .. } => r#"
/// Auto generate. Do not edit
import { Ok, Err, Result } from "ts-results";
import { invoke } from "@/application/app.ts";
import * as pb from "../..";
"#
.to_string(),
Project::Native => panic!("Native project is not supported yet."),
}
}
}