mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-04 00:18:01 +01:00
0869e39603
https://linear.app/unleash/issue/2-2450/register-integration-events-webhook Registers integration events in the **Webhook** integration. Even though this touches a lot of files, most of it is preparation for the next steps. The only actual implementation of registering integration events is in the **Webhook** integration. The rest will follow on separate PRs. Here's an example of how this looks like in the database table: ```json { "id": 7, "integration_id": 2, "created_at": "2024-07-18T18:11:11.376348+01:00", "state": "failed", "state_details": "Webhook request failed with status code: ECONNREFUSED", "event": { "id": 130, "data": null, "tags": [], "type": "feature-environment-enabled", "preData": null, "project": "default", "createdAt": "2024-07-18T17:11:10.821Z", "createdBy": "admin", "environment": "development", "featureName": "test", "createdByUserId": 1 }, "details": { "url": "http://localhost:1337", "body": "{ \"id\": 130, \"type\": \"feature-environment-enabled\", \"createdBy\": \"admin\", \"createdAt\": \"2024-07-18T17: 11: 10.821Z\", \"createdByUserId\": 1, \"data\": null, \"preData\": null, \"tags\": [], \"featureName\": \"test\", \"project\": \"default\", \"environment\": \"development\" }" } } ```
30 lines
832 B
TypeScript
30 lines
832 B
TypeScript
import Webhook from './webhook';
|
|
import SlackAddon from './slack';
|
|
import TeamsAddon from './teams';
|
|
import DatadogAddon from './datadog';
|
|
import NewRelicAddon from './new-relic';
|
|
import type Addon from './addon';
|
|
import SlackAppAddon from './slack-app';
|
|
import type { IAddonConfig } from '../types';
|
|
|
|
export interface IAddonProviders {
|
|
[key: string]: Addon;
|
|
}
|
|
|
|
export const getAddons: (args: IAddonConfig) => IAddonProviders = (args) => {
|
|
const addons: Addon[] = [
|
|
new Webhook(args),
|
|
new SlackAddon(args),
|
|
new SlackAppAddon(args),
|
|
new TeamsAddon(args),
|
|
new DatadogAddon(args),
|
|
new NewRelicAddon(args),
|
|
];
|
|
|
|
return addons.reduce((map, addon) => {
|
|
// eslint-disable-next-line no-param-reassign
|
|
map[addon.name] = addon;
|
|
return map;
|
|
}, {});
|
|
};
|