Conversation
Move exchangeCodeForTokens, getGoogleAccountProfile, and buildConsentUrl out of googleOAuthCallback.ts and startGoogleOAuth.ts into a dedicated GoogleOAuthClient class in src/services/. Add IGoogleOAuthClient interface to types.ts so handlers depend on the abstraction, not the concrete class.
Prefix all exported public-contract interfaces with I (IGmailService, IOAuthStateRepository, etc.) per the updated Type Guidance in AGENTS.md. Convert file-local dependency bags and internal data shapes (config objects, DynamoDB item shapes, handler deps) from interface to type and drop the I prefix, since they are never implemented or extended.
Input shapes, result shapes, config records, and context objects that are never implemented or extended (UpsertPrimaryGmailConnectionInput, SendReplyInput, AppConfig, AppSecrets, GmailConnectionRecord, etc.) are converted from interface to type and the I prefix is removed. Public service and repository contracts that classes implement retain the interface keyword and I prefix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extract
GoogleOAuthClientservice — moves three hanging module-level functions (exchangeCodeForTokens,getGoogleAccountProfile,buildConsentUrl) out ofgoogleOAuthCallback.tsandstartGoogleOAuth.tsinto a dedicatedGoogleOAuthClientclass insrc/services/. Handlers now depend on theIGoogleOAuthClientinterface, keeping Google SDK details out of handler files.Adopt
interfacevstypenaming conventions — all exported public-contract interfaces are prefixed withI(e.g.IGmailService,IOAuthStateRepository). File-local dependency bags, config objects, and internal DynamoDB item shapes are converted frominterfacetotypeand drop theIprefix, since they are never implemented or extended.Update
AGENTS.md— documents theinterface/typedistinction so future agents and contributors follow the same pattern.Changed files
src/services/googleOAuthClient.tsGoogleOAuthClientclass with 3 methodssrc/types.tsIGoogleOAuthClient,ITokenExchangeResult,IGoogleAccountProfile; prefix all 23 exported interfaces withIsrc/handlers/googleOAuthCallback.tsgoogleOAuthClient; config/deps shapes →typesrc/handlers/startGoogleOAuth.tsgoogleOAuthClientthrough deps; config/deps shapes →typesrc/repositories/dynamoDb*.tstype, dropIprefixsrc/services/*.ts,src/utils/*.ts,src/handler.tsI-prefixed interfacessrc/handler.test.ts,src/handlers/*.test.tsAGENTS.mdinterfacevstyperule