()
| 42 | } |
| 43 | |
| 44 | function mockSdk() { |
| 45 | const functions = new Map<string, Function>(); |
| 46 | return { |
| 47 | registerFunction: (idOrOpts: string | { id: string }, handler: Function) => { |
| 48 | const id = typeof idOrOpts === "string" ? idOrOpts : idOrOpts.id; |
| 49 | functions.set(id, handler); |
| 50 | }, |
| 51 | registerTrigger: () => {}, |
| 52 | trigger: async (idOrInput: string | { function_id: string; payload: unknown }, data?: unknown) => { |
| 53 | const id = typeof idOrInput === "string" ? idOrInput : idOrInput.function_id; |
| 54 | const payload = typeof idOrInput === "string" ? data : idOrInput.payload; |
| 55 | const fn = functions.get(id); |
| 56 | if (!fn) throw new Error(`No function: ${id}`); |
| 57 | return fn(payload); |
| 58 | }, |
| 59 | }; |
| 60 | } |
| 61 | |
| 62 | const enabledConfig: ClaudeBridgeConfig = { |
| 63 | enabled: true, |
no test coverage detected