From 799b4cfac34f8a692867af1528f674a157cba3fe Mon Sep 17 00:00:00 2001 From: AnastasiiaSvietlova Date: Tue, 26 Nov 2024 11:51:59 +0100 Subject: [PATCH] update extended plugin interface --- packages/plugin-client-ip/src/client-ip.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/plugin-client-ip/src/client-ip.ts b/packages/plugin-client-ip/src/client-ip.ts index 4258cd1da..c6820d417 100644 --- a/packages/plugin-client-ip/src/client-ip.ts +++ b/packages/plugin-client-ip/src/client-ip.ts @@ -7,10 +7,20 @@ interface InternalClient extends Client { } } +interface ExtendedPlugin extends Plugin { + configSchema: Record +} + +interface ValidationOption { + validate: (value: boolean) => boolean + defaultValue: () => unknown + message: string +} + /* * Prevent collection of user IPs */ -const plugin: Plugin = { +const plugin: ExtendedPlugin = { load: client => { if ((client as InternalClient)._config.collectUserIp) return @@ -24,7 +34,6 @@ const plugin: Plugin = { event.request = assign({ clientIp: '[REDACTED]' }, event.request) }) }, - // @ts-expect-error _config is private API configSchema: { collectUserIp: { defaultValue: () => true,