Files
outline/plugins/slack/server/index.ts
Apoorv Mishra 85c8f83e33 PluginManager refactor (#6677)
* fix: refactor plugin manager

* fix: make id optional

* fix: allow add to accept single object

* fix: getHooks

* fix: tsc

* fix: remove id
2024-03-16 21:22:25 +05:30

28 lines
613 B
TypeScript

import { PluginManager, Hook } from "@server/utils/PluginManager";
import config from "../plugin.json";
import hooks from "./api/hooks";
import router from "./auth/slack";
import env from "./env";
import SlackProcessor from "./processors/SlackProcessor";
const enabled = !!env.SLACK_CLIENT_ID && !!env.SLACK_CLIENT_SECRET;
if (enabled) {
PluginManager.add([
{
...config,
type: Hook.AuthProvider,
value: { router, id: config.id },
},
{
...config,
type: Hook.API,
value: hooks,
},
{
type: Hook.Processor,
value: SlackProcessor,
},
]);
}