| 10 | const debug = Debug('5ire:stores:usePromptStore'); |
| 11 | |
| 12 | export interface IPromptStore { |
| 13 | prompt: IPromptDef | null; |
| 14 | prompts: IPromptDef[]; |
| 15 | createPrompt: (prompt: Partial<IPromptDef>) => Promise<IPromptDef>; |
| 16 | updatePrompt: ( |
| 17 | prompt: { id: string } & Partial<IPromptDef>, |
| 18 | ) => Promise<boolean>; |
| 19 | deletePrompt: (id: string) => Promise<boolean>; |
| 20 | setPrompt: (prompt: IPromptDef | null) => void; |
| 21 | getPrompt: (id: string) => Promise<IPromptDef>; |
| 22 | fetchPrompts: ({ |
| 23 | limit, // to fetch all prompts practically |
| 24 | offset, |
| 25 | keyword, |
| 26 | }: { |
| 27 | limit?: number; |
| 28 | offset?: number; |
| 29 | keyword?: string; |
| 30 | }) => Promise<IPromptDef[]>; |
| 31 | } |
| 32 | |
| 33 | const usePromptStore = create<IPromptStore>((set, get) => ({ |
| 34 | prompt: null, |
nothing calls this directly
no outgoing calls
no test coverage detected