| 72 | }; |
| 73 | |
| 74 | class HttpTrigger<TEventSpecification extends EventSpecification<any>> |
| 75 | implements Trigger<TEventSpecification> |
| 76 | { |
| 77 | constructor(private readonly options: TriggerOptions<TEventSpecification>) {} |
| 78 | |
| 79 | toJSON(): TriggerMetadata { |
| 80 | return { |
| 81 | type: "static", |
| 82 | title: this.options.endpointId, |
| 83 | properties: this.options.event.properties, |
| 84 | rule: { |
| 85 | event: `httpendpoint.${this.options.endpointId}`, |
| 86 | payload: this.options.filter ?? {}, |
| 87 | source: this.options.event.source, |
| 88 | }, |
| 89 | link: `http-endpoints/${this.options.endpointId}`, |
| 90 | help: { |
| 91 | noRuns: { |
| 92 | text: "To start triggering runs click here to setup your HTTP Endpoint with the external API service you want to receive webhooks from.", |
| 93 | link: `http-endpoints/${this.options.endpointId}`, |
| 94 | }, |
| 95 | }, |
| 96 | }; |
| 97 | } |
| 98 | |
| 99 | get event() { |
| 100 | return this.options.event; |
| 101 | } |
| 102 | |
| 103 | attachToJob(triggerClient: TriggerClient, job: Job<Trigger<TEventSpecification>, any>): void {} |
| 104 | |
| 105 | get preprocessRuns() { |
| 106 | return false; |
| 107 | } |
| 108 | |
| 109 | async verifyPayload(payload: Request) { |
| 110 | const clonedRequest = payload.clone(); |
| 111 | return this.options.verify(clonedRequest); |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | type RespondWith = { |
| 116 | /** Only Requests that match this filter will cause the `handler` function to run. |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…