Update changeset to better reflect changes ()

* Update changeset to better reflect changes

* Remove un-necessary packages from changeset

* codegen

* expose lexicons instead of schemas

* export a copy of the internal lexicon

* typo

* fix minor typos in changesets

---------

Co-authored-by: Devin Ivy <devinivy@gmail.com>
This commit is contained in:
Matthieu Sieben 2024-08-12 21:58:58 +02:00 committed by GitHub
parent b934b396b1
commit 2bdf75d7a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 29 additions and 25 deletions

@ -0,0 +1,5 @@
---
"@atproto/lexicon": patch
---
Remove internal circular dependency.

@ -1,13 +1,6 @@
---
"@atproto/lex-cli": minor
"@atproto/xrpc": minor
"@atproto/api": minor
"@atproto/dev-env": patch
"@atproto/lexicon": patch
"@atproto/ozone": patch
"@atproto/bsky": patch
"@atproto/pds": patch
"@atproto/xrpc-server": patch
---
## Motivation
@ -177,10 +170,7 @@ baseClient.xrpc.lex.assertValidXrpcMessage('io.example.doStuff', {
<td>
```ts
import { schemas } from '@atproto/api'
import { Lexicons } from '@atproto/lexicon'
const lexicons = new Lexicons(schemas)
import { lexicons } from '@atproto/api'
lexicons.assertValidXrpcMessage('io.example.doStuff', {
// ...
@ -206,7 +196,7 @@ import { BskyAgent } from '@atproto/api'
class MyAgent extends BskyAgent {
private accessToken?: string
async createOrRefleshSession(identifier: string, password: string) {
async createOrRefreshSession(identifier: string, password: string) {
// custom logic here
this.accessToken = 'my-access-jwt'
@ -263,7 +253,7 @@ class MyAgent extends Agent {
</table>
If you are monkey patching the the `xrpc` service client to perform client-side rate limiting, you can now do this in the `FetchHandler` function:
If you are monkey patching the `xrpc` service client to perform client-side rate limiting, you can now do this in the `FetchHandler` function:
<table>
<tr>
@ -416,7 +406,7 @@ future version.
Since its use has completely changed, the `FetchHandler` type has also
completely changed. The new `FetchHandler` type is now a function that receives
a `url` pathname and a `RequestInit` object and returns a `Promise<Response>`.
This function is responsible from making the actual request to the server.
This function is responsible for making the actual request to the server.
```ts
export type FetchHandler = (

@ -0,0 +1,5 @@
---
"@atproto/lex-cli": minor
---
The generated client implementation uses the new `XrpcClient` class from `@atproto/xrpc`, instead of the deprecated `Client` and `ServiceClient` class.

@ -1073,12 +1073,11 @@ export class ComAtprotoServerNS {
params?: ComAtprotoServerGetServiceAuth.QueryParams,
opts?: ComAtprotoServerGetServiceAuth.CallOptions,
): Promise<ComAtprotoServerGetServiceAuth.Response> {
return this._client.call(
'com.atproto.server.getServiceAuth',
params,
undefined,
opts,
)
return this._client
.call('com.atproto.server.getServiceAuth', params, undefined, opts)
.catch((e) => {
throw ComAtprotoServerGetServiceAuth.toKnownErr(e)
})
}
getSession(

@ -11673,9 +11673,7 @@ export const schemaDict = {
},
},
}
export const schemas = Object.freeze(
Object.values(schemaDict),
) as readonly LexiconDoc[]
export const schemas: LexiconDoc[] = Object.values(schemaDict) as LexiconDoc[]
export const lexicons: Lexicons = new Lexicons(schemas)
export const ids = {
ComAtprotoAdminDefs: 'com.atproto.admin.defs',

@ -36,7 +36,7 @@ export interface Response {
export class BadExpirationError extends XRPCError {
constructor(src: XRPCError) {
super(src.status, src.error, src.message, src.headers)
super(src.status, src.error, src.message, src.headers, { cause: src })
}
}
@ -44,5 +44,6 @@ export function toKnownErr(e: any) {
if (e instanceof XRPCError) {
if (e.error === 'BadExpiration') return new BadExpirationError(e)
}
return e
}

@ -1,3 +1,6 @@
import { Lexicons } from '@atproto/lexicon'
import { lexicons as internalLexicons } from './client/lexicons'
export { AtUri } from '@atproto/syntax'
export {
BlobRef,
@ -11,7 +14,6 @@ export * from './types'
export * from './const'
export * from './util'
export * from './client'
export { schemas } from './client/lexicons'
export * from './rich-text/rich-text'
export * from './rich-text/sanitization'
export * from './rich-text/unicode'
@ -27,3 +29,7 @@ export { BskyAgent } from './bsky-agent'
/** @deprecated */
export { AtpAgent as default } from './atp-agent'
// Expose a copy to prevent alteration of the internal Lexicon instance used by
// the AtpBaseClient class.
export const lexicons = new Lexicons(internalLexicons)