(action: TriggerAction, apiKey: string, opts: Record<string, any> = {})
| 69 | | "VALIDATE"; |
| 70 | |
| 71 | const buildRequest = (action: TriggerAction, apiKey: string, opts: Record<string, any> = {}) => { |
| 72 | if (action === "DELIVER_HTTP_SOURCE_REQUEST") { |
| 73 | throw new Error(`action ${action} not implemented yet`); |
| 74 | } |
| 75 | return new Request("https://example.com/trigger", { |
| 76 | method: "POST", |
| 77 | headers: { |
| 78 | "Content-Type": "application/json", |
| 79 | "x-trigger-api-key": apiKey, |
| 80 | "x-trigger-action": action, |
| 81 | "x-trigger-endpoint-id": opts.endpointId, |
| 82 | "x-trigger-job-id": opts.jobId, |
| 83 | }, |
| 84 | body: JSON.stringify(opts.body), |
| 85 | }); |
| 86 | }; |
| 87 | |
| 88 | const buildRequestBody = (event: RunJobBody["event"], job: RunJobBody["job"]): RunJobBody => ({ |
| 89 | event, |
no outgoing calls
no test coverage detected
searching dependent graphs…