| 131 | } |
| 132 | |
| 133 | public async runWebhookFlow( |
| 134 | id: string, |
| 135 | data: unknown, |
| 136 | context: { schema: SchemaOverview; accountability: Accountability | undefined } & Record<string, unknown>, |
| 137 | ): Promise<{ result: unknown; cacheEnabled?: boolean }> { |
| 138 | if (this.reloadQueue.pending > 0) await this.reloadQueue.onIdle(); |
| 139 | |
| 140 | const logger = useLogger(); |
| 141 | |
| 142 | if (!(id in this.webhookFlowHandlers)) { |
| 143 | logger.warn(`Couldn't find webhook or manual triggered flow with id "${id}"`); |
| 144 | throw new ForbiddenError(); |
| 145 | } |
| 146 | |
| 147 | const handler = this.webhookFlowHandlers[id]; |
| 148 | |
| 149 | return handler(data, context); |
| 150 | } |
| 151 | |
| 152 | public getFlow(id: string): Flow | undefined { |
| 153 | return this.flows[id]; |