2021-08-12 15:04:37 +02:00
|
|
|
import Webhook from './webhook';
|
|
|
|
import SlackAddon from './slack';
|
|
|
|
import TeamsAddon from './teams';
|
|
|
|
import DatadogAddon from './datadog';
|
2024-07-05 15:16:00 +02:00
|
|
|
import NewRelicAddon from './new-relic';
|
2024-03-18 13:58:05 +01:00
|
|
|
import type Addon from './addon';
|
2023-07-14 10:49:34 +02:00
|
|
|
import SlackAppAddon from './slack-app';
|
chore: register integration events in webhooks (#7621)
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\" }"
}
}
```
2024-07-19 11:07:52 +02:00
|
|
|
import type { IAddonConfig } from '../types';
|
2021-08-12 15:04:37 +02:00
|
|
|
|
|
|
|
export interface IAddonProviders {
|
|
|
|
[key: string]: Addon;
|
|
|
|
}
|
|
|
|
|
chore: register integration events in webhooks (#7621)
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\" }"
}
}
```
2024-07-19 11:07:52 +02:00
|
|
|
export const getAddons: (args: IAddonConfig) => IAddonProviders = (args) => {
|
2023-07-14 10:49:34 +02:00
|
|
|
const addons: Addon[] = [
|
chore: register integration events in webhooks (#7621)
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\" }"
}
}
```
2024-07-19 11:07:52 +02:00
|
|
|
new Webhook(args),
|
|
|
|
new SlackAddon(args),
|
|
|
|
new SlackAppAddon(args),
|
|
|
|
new TeamsAddon(args),
|
|
|
|
new DatadogAddon(args),
|
|
|
|
new NewRelicAddon(args),
|
2021-08-12 15:04:37 +02:00
|
|
|
];
|
2023-07-14 10:49:34 +02:00
|
|
|
|
2021-08-12 15:04:37 +02:00
|
|
|
return addons.reduce((map, addon) => {
|
|
|
|
// eslint-disable-next-line no-param-reassign
|
|
|
|
map[addon.name] = addon;
|
|
|
|
return map;
|
|
|
|
}, {});
|
|
|
|
};
|