| 6 | import type {Graph} from '@core/index.js'; |
| 7 | |
| 8 | export class SearchOperations extends EventEmitter { |
| 9 | constructor(private searchManager: ISearchManager) { |
| 10 | super(); |
| 11 | } |
| 12 | |
| 13 | async searchNodes(query: string): Promise<OpenNodesResult> { |
| 14 | this.emit('beforeSearch', {query}); |
| 15 | const result = await this.searchManager.searchNodes(query); |
| 16 | this.emit('afterSearch', result); |
| 17 | return result; |
| 18 | } |
| 19 | |
| 20 | async openNodes(names: string[]): Promise<OpenNodesResult> { |
| 21 | this.emit('beforeOpenNodes', {names}); |
| 22 | const result = await this.searchManager.openNodes(names); |
| 23 | this.emit('afterOpenNodes', result); |
| 24 | return result; |
| 25 | } |
| 26 | |
| 27 | async readGraph(): Promise<Graph> { |
| 28 | this.emit('beforeReadGraph', {}); |
| 29 | const result = await this.searchManager.readGraph(); |
| 30 | this.emit('afterReadGraph', result); |
| 31 | return result; |
| 32 | } |
| 33 | } |
nothing calls this directly
no outgoing calls
no test coverage detected