* Tool prepare method success callback * * @param {object} data - append tool to available list
(data: { toolName: string })
| 223 | * @param {object} data - append tool to available list |
| 224 | */ |
| 225 | private toolPrepareMethodSuccess(data: { toolName: string }): void { |
| 226 | const tool = this.factory.get(data.toolName); |
| 227 | |
| 228 | if (tool.isInline()) { |
| 229 | /** |
| 230 | * Some Tools validation |
| 231 | */ |
| 232 | const inlineToolRequiredMethods = [ 'render' ]; |
| 233 | const notImplementedMethods = inlineToolRequiredMethods.filter((method) => !tool.create()[method]); |
| 234 | |
| 235 | if (notImplementedMethods.length) { |
| 236 | _.log( |
| 237 | `Incorrect Inline Tool: ${tool.name}. Some of required methods is not implemented %o`, |
| 238 | 'warn', |
| 239 | notImplementedMethods |
| 240 | ); |
| 241 | |
| 242 | this.toolsUnavailable.set(tool.name, tool); |
| 243 | |
| 244 | return; |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | this.toolsAvailable.set(tool.name, tool); |
| 249 | } |
| 250 | |
| 251 | /** |
| 252 | * Tool prepare method fail callback |