@@ -39,17 +39,17 @@ const { data } = await entityClient.get('/v2/entity/schemas/contact/123')
3939Use ` getClient() ` when you need direct access to the underlying axios instance, for example to set custom headers or add interceptors.
4040
4141``` ts
42- const entityClient = await epilot .entity .getClient ()
42+ const entityClient = epilot .entity .getClient ()
4343const { data } = await entityClient .getEntity ({ slug: ' contact' , id: ' 123' })
4444```
4545
46- ` getClient() ` returns a cached singleton. Calling it multiple times returns the same instance (until config changes).
46+ ` getClient() ` is synchronous and returns a cached singleton. Calling it multiple times returns the same instance (until config changes).
4747
4848:::warning Stale references
4949If you hold a client reference and then change config, your reference still points to the old client:
5050
5151``` ts
52- const entityClient = await epilot .entity .getClient ()
52+ const entityClient = epilot .entity .getClient ()
5353
5454epilot .authorize (() => ' new-token' ) // invalidates cached clients
5555
@@ -67,7 +67,7 @@ Use `createClient()` when you need a completely independent client that is not s
6767``` ts
6868import { createClient , authorize } from ' @epilot/sdk/entity'
6969
70- const entityClient = await createClient ()
70+ const entityClient = createClient ()
7171authorize (entityClient , () => ' <my-token>' )
7272entityClient .defaults .headers .common [' x-epilot-org-id' ] = ' org-123'
7373```
@@ -79,7 +79,7 @@ Import only the APIs you use. Other APIs never touch your bundle.
7979``` ts
8080import { getClient , authorize } from ' @epilot/sdk/entity'
8181
82- const entityClient = await getClient ()
82+ const entityClient = getClient ()
8383authorize (entityClient , () => ' <my-token>' )
8484
8585const { data } = await entityClient .getEntity ({ slug: ' contact' , id: ' 123' })
@@ -141,5 +141,19 @@ When you call `authorize()`, `headers()`, `retry()`, `largeResponse()`, or `inte
141141| Pattern | Always up to date? | Notes |
142142| --- | --- | --- |
143143| ` epilot.entity.getEntity(...) ` | Yes | Re-resolves the client on every call |
144- | ` await epilot.entity.getClient() ` | At time of call | Can go stale after config changes |
145- | ` await createClient() ` | Independent | Not affected by SDK config changes |
144+ | ` epilot.entity.getClient() ` | At time of call | Can go stale after config changes |
145+ | ` createClient() ` | Independent | Not affected by SDK config changes |
146+
147+ ## Migration from ` @epilot/*-client `
148+
149+ Drop-in replacement — just change the import path:
150+
151+ ``` ts
152+ // Before
153+ import { getClient , createClient , authorize } from ' @epilot/entity-client'
154+ import type { Client , Entity } from ' @epilot/entity-client'
155+
156+ // After
157+ import { getClient , createClient , authorize } from ' @epilot/sdk/entity'
158+ import type { Client , Entity } from ' @epilot/sdk/entity'
159+ ```
0 commit comments