From 825abaf174c6c0f93bed9c9382b7eea0d03a76f1 Mon Sep 17 00:00:00 2001 From: Samuel Albert Date: Thu, 2 Jan 2025 16:55:17 +0100 Subject: [PATCH] Updating IntegrationManager so "token-refreshed" events are passed with a dictionary for consistency. --- src/backend/integrations/integration-manager.ts | 4 ++-- src/types/integrations.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backend/integrations/integration-manager.ts b/src/backend/integrations/integration-manager.ts index f3452b384..f915a0a50 100644 --- a/src/backend/integrations/integration-manager.ts +++ b/src/backend/integrations/integration-manager.ts @@ -363,7 +363,7 @@ class IntegrationManager extends TypedEmitter { const updatedToken = await authManager.refreshTokenIfExpired(providerId, authData.auth); if (updatedToken != null) { this.saveIntegrationAuth(int, updatedToken); - this.emit("token-refreshed", integrationId, updatedToken); + this.emit("token-refreshed", {"integrationId": integrationId, "updatedToken": updatedToken}); } authData.auth = updatedToken; } else if (authManager.tokenExpired(providerId, authData.auth)) { @@ -423,7 +423,7 @@ class IntegrationManager extends TypedEmitter { this.saveIntegrationAuth(int, updatedToken); authData = updatedToken; - this.emit("token-refreshed", integrationId, updatedToken); + this.emit("token-refreshed", {"integrationId": integrationId, "updatedToken": updatedToken}); } integrationData.auth = authData; } diff --git a/src/types/integrations.ts b/src/types/integrations.ts index 416ea0661..c659493c0 100644 --- a/src/types/integrations.ts +++ b/src/types/integrations.ts @@ -81,7 +81,7 @@ export interface IntegrationManagerEvents { "integrationRegistered": (integration: Integration) => void; "integration-connected": (integrationId: string) => void; "integration-disconnected": (integrationId: string) => void; - "token-refreshed": (integrationId: string, updatedToken: AuthDetails) => void; + "token-refreshed": (data: {integrationId: string, updatedToken: AuthDetails}) => void; } export declare class IntegrationManager extends TypedEmitter {