Closed matthieusieben closed 1 month ago
Hey @devinivy, thank you for the review. I moved the OAuthAtpAgent
class into the api
agent. This reverses the dependency between @atproto/api
and @atproto/oauth-client
but that extra dependency in api
is only needed for typing purposes and should not impact the bundle size.
With this change, the @atproto/api
is no longer needed in order to instantiate custom @atproto/xrpc
clients.
This whole PR introduces a breaking change in the oauth-client*
packages but I think it's fine since those were not released yet (will impact ozone but no big deal).
cc @foysalit
Thanks @surfdude29 for your careful review <3
Thanks @surfdude29 for your careful review <3
No worries, happy to help :)
@atproto/api
'sAgent
class can now be instantiated using aSessionManager
interface (new Agent(sessMgr)
)@atproto/client
'sOAuthSession
implements theSessionManager
interface meaning that we can donew Agent(oauthSession)
@atproto/api
'sAtpAgent
works exactly as before. A comment was added to say that is will soon become deprecated as it adds no value anymore.@atproto/api
now exposes anCredentialSession
class that can be used to instantiate bothnew Agent(credSession)
as-well-asnew XrpcClient(credSession, myLex)
Potentially breaking changes:
Agent
is no longer abstract, and its constructor signature has changed. This means that any implementation extending that class will be broken. Since this abstract class was release very recently, the impact should be minimal.Agent
no longer extendsAtpBaseClient
(this is an implementation detail so should no really impact anything)@atproto/oauth-client*
no longer expose anagent
, but asession
instead. Adapting to this is very straight forward (new Agent(session)
).OAuthAgent
was renamed intoOAuthSession
and some method signatures where changed