From a30cffab3d82688b3197d0ac57eb7f80b38e8b6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isaac=20Rold=C3=A1n?= Date: Thu, 16 Jul 2026 15:33:57 +0200 Subject: [PATCH] Narrow the token-refresh client dependency Second step of the PartnersClient cleanup. createUnauthorizedHandler only uses a small slice of a developer platform client (session and unsafeRefreshToken), but was typed against the whole DeveloperPlatformClient. Narrow it to the minimal Pick subset it consumes so a client that no longer implements the full interface can still be passed. No behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../app/src/cli/utilities/developer-platform-client.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/app/src/cli/utilities/developer-platform-client.ts b/packages/app/src/cli/utilities/developer-platform-client.ts index f79054d3c9e..821bf4d2ff3 100644 --- a/packages/app/src/cli/utilities/developer-platform-client.ts +++ b/packages/app/src/cli/utilities/developer-platform-client.ts @@ -263,7 +263,10 @@ export interface MigrationDeveloperPlatformClient { migrateToUiExtension: (input: MigrateToUiExtensionVariables) => Promise } -const inProgressRefreshes = new WeakMap>() +/** The subset of a developer platform client needed to refresh an expired token. */ +type TokenRefreshableClient = Pick + +const inProgressRefreshes = new WeakMap>() /** * Creates an unauthorized handler for a developer platform client that will refresh the token @@ -275,7 +278,7 @@ const inProgressRefreshes = new WeakMap * @returns The unauthorized handler. */ export function createUnauthorizedHandler( - client: DeveloperPlatformClient, + client: TokenRefreshableClient, tokenType: 'default' | 'businessPlatform' = 'default', ): UnauthorizedHandler { return {