Skip to content

Commit dc0dfdb

Browse files
committed
refactor notify plugin
1 parent 770b398 commit dc0dfdb

File tree

13 files changed

+116
-412
lines changed

13 files changed

+116
-412
lines changed

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/notify/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ tokio = { workspace = true, features = ["macros"] }
1818
notify = "8"
1919

2020
tauri = { workspace = true, features = ["test"] }
21+
tauri-plugin-path2 = { workspace = true }
2122
tauri-specta = { workspace = true, features = ["derive", "typescript"] }
2223

2324
serde = { workspace = true }
2425
specta = { workspace = true }
2526

2627
thiserror = { workspace = true }
28+
tracing = { workspace = true }

plugins/notify/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const COMMANDS: &[&str] = &["ping"];
1+
const COMMANDS: &[&str] = &[];
22

33
fn main() {
44
tauri_plugin::Builder::new(COMMANDS).build();

plugins/notify/js/bindings.gen.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,19 @@
66

77

88
export const commands = {
9-
async ping() : Promise<Result<null, string>> {
10-
try {
11-
return { status: "ok", data: await TAURI_INVOKE("plugin:notify|ping") };
12-
} catch (e) {
13-
if(e instanceof Error) throw e;
14-
else return { status: "error", error: e as any };
15-
}
16-
}
9+
1710
}
1811

1912
/** user-defined events **/
2013

2114

2215
export const events = __makeEvents__<{
16+
entityChanged: EntityChanged,
17+
fileChanged: FileChanged,
2318
settingsChanged: SettingsChanged
2419
}>({
20+
entityChanged: "plugin:notify:entity-changed",
21+
fileChanged: "plugin:notify:file-changed",
2522
settingsChanged: "plugin:notify:settings-changed"
2623
})
2724

@@ -31,6 +28,10 @@ settingsChanged: "plugin:notify:settings-changed"
3128

3229
/** user-defined types **/
3330

31+
export type ChangeAction = "created" | "updated" | "deleted"
32+
export type EntityChanged = { entity_type: EntityType; entity_id: string; action: ChangeAction }
33+
export type EntityType = "session" | "transcript" | "human" | "organization" | "event" | "chat_group" | "chat_message" | "enhanced_note" | "template" | "memory" | "folder" | "tag" | "prompt" | "chat_shortcut"
34+
export type FileChanged = { path: string }
3435
export type SettingsChanged = { path: string }
3536

3637
/** tauri-specta globals **/

plugins/notify/permissions/autogenerated/commands/ping.toml

Lines changed: 0 additions & 13 deletions
This file was deleted.

plugins/notify/permissions/autogenerated/reference.md

Lines changed: 0 additions & 43 deletions
This file was deleted.

plugins/notify/permissions/default.toml

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)