From 32fe00138990627749da58ff9f845584013aa219 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 18 Jul 2019 16:43:41 +0200 Subject: Provide logger to plugins --- server/typings/plugins/index.d.ts | 2 ++ server/typings/plugins/plugin-library.model.ts | 7 +++++++ server/typings/plugins/register-options.model.ts | 19 +++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 server/typings/plugins/index.d.ts create mode 100644 server/typings/plugins/plugin-library.model.ts create mode 100644 server/typings/plugins/register-options.model.ts (limited to 'server/typings/plugins') diff --git a/server/typings/plugins/index.d.ts b/server/typings/plugins/index.d.ts new file mode 100644 index 000000000..bddb3089e --- /dev/null +++ b/server/typings/plugins/index.d.ts @@ -0,0 +1,2 @@ +export * from './register-options.model' +export * from './plugin-library.model' diff --git a/server/typings/plugins/plugin-library.model.ts b/server/typings/plugins/plugin-library.model.ts new file mode 100644 index 000000000..fd90a3b46 --- /dev/null +++ b/server/typings/plugins/plugin-library.model.ts @@ -0,0 +1,7 @@ +import { RegisterOptions } from './register-options.model' + +export interface PluginLibrary { + register: (options: RegisterOptions) => Promise + + unregister: () => Promise +} diff --git a/server/typings/plugins/register-options.model.ts b/server/typings/plugins/register-options.model.ts new file mode 100644 index 000000000..007ef5e1b --- /dev/null +++ b/server/typings/plugins/register-options.model.ts @@ -0,0 +1,19 @@ +import { logger } from '../../helpers/logger' +import { RegisterHookOptions } from '../../../shared/models/plugins/register-hook.model' +import { RegisterSettingOptions } from '../../../shared/models/plugins/register-setting.model' +import { PluginSettingsManager } from '../../../shared/models/plugins/plugin-settings-manager.model' +import { PluginStorageManager } from '../../../shared/models/plugins/plugin-storage-manager.model' + +export type RegisterOptions = { + registerHook: (options: RegisterHookOptions) => void + + registerSetting: (options: RegisterSettingOptions) => void + + settingsManager: PluginSettingsManager + + storageManager: PluginStorageManager + + peertubeHelpers: { + logger: typeof logger + } +} -- cgit v1.2.3