unpin lex-client, drop 0.2.4 export-car workaround
The pnpm override pinned @atproto/lex-client to 0.2.4, predating both lex-client 0.3.0 and sdk preview.2 - which assumes 0.3.0 semantics (per-call service: null is a no-op on 0.2.4). 0.3.0 also returns non-JSON encodings raw, so the ExportCarDialog fetchHandler workaround for mis-parsed application/jsonl is unnecessary. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,9 +4,6 @@ strictPeerDependencies: false # default: false
|
|||||||
trustPolicy: 'no-downgrade' # default: off
|
trustPolicy: 'no-downgrade' # default: off
|
||||||
trustPolicyIgnoreAfter: 10080 # 7 days, default: undefined
|
trustPolicyIgnoreAfter: 10080 # 7 days, default: undefined
|
||||||
overrides:
|
overrides:
|
||||||
'@atproto/lex-schema': '0.2.2'
|
|
||||||
'@atproto/lex-data': '0.1.5'
|
|
||||||
'@atproto/lex-client': '0.2.4'
|
|
||||||
'@react-native/babel-preset': '0.81.5'
|
'@react-native/babel-preset': '0.81.5'
|
||||||
'@react-native/normalize-colors': '0.81.5'
|
'@react-native/normalize-colors': '0.81.5'
|
||||||
'@expo/image-utils': '0.8.12'
|
'@expo/image-utils': '0.8.12'
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import {InlineLinkText} from '#/components/Link'
|
|||||||
import {Loader} from '#/components/Loader'
|
import {Loader} from '#/components/Loader'
|
||||||
import * as Toast from '#/components/Toast'
|
import * as Toast from '#/components/Toast'
|
||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
import {com} from '#/lexicons'
|
import {chat, com} from '#/lexicons'
|
||||||
|
|
||||||
export function ExportCarDialog({
|
export function ExportCarDialog({
|
||||||
control,
|
control,
|
||||||
@@ -35,7 +35,12 @@ export function ExportCarDialog({
|
|||||||
try {
|
try {
|
||||||
setLoading('repo')
|
setLoading('repo')
|
||||||
const did = currentAccount.did as DidString
|
const did = currentAccount.did as DidString
|
||||||
const data = await pdsClient.call(com.atproto.sync.getRepo, {did})
|
const data = await pdsClient.call(
|
||||||
|
com.atproto.sync.getRepo,
|
||||||
|
{did},
|
||||||
|
// service: null strips the appview proxy header - this must hit the account host (PDS)
|
||||||
|
{service: null},
|
||||||
|
)
|
||||||
/*
|
/*
|
||||||
* getRepo returns raw bytes; the lex client does not surface the response
|
* getRepo returns raw bytes; the lex client does not surface the response
|
||||||
* content-type, and this endpoint always returns CAR data, so the constant
|
* content-type, and this endpoint always returns CAR data, so the constant
|
||||||
@@ -65,24 +70,17 @@ export function ExportCarDialog({
|
|||||||
try {
|
try {
|
||||||
setLoading('chat')
|
setLoading('chat')
|
||||||
/*
|
/*
|
||||||
* Using the client's low-level fetchHandler because the XRPC client
|
* lex-client 0.3.0 leaves non-JSON encodings (like this endpoint's
|
||||||
* incorrectly tries to JSON-parse application/jsonl responses (substring
|
* application/jsonl) unparsed and returns the raw bytes, so the old
|
||||||
* match on application/json). The chat client already proxies to
|
* low-level fetchHandler workaround (which 0.3.0 also removed from
|
||||||
* `did:web:api.bsky.chat`, so no manual proxy header is needed - it would
|
* Client) is no longer needed. The chat client's proxy header rides
|
||||||
* otherwise be double-set.
|
* along as usual.
|
||||||
*/
|
*/
|
||||||
const res = await chatClient.fetchHandler(
|
const data = await chatClient.call(chat.bsky.actor.exportAccountData, {})
|
||||||
'/xrpc/chat.bsky.actor.exportAccountData',
|
|
||||||
{},
|
|
||||||
)
|
|
||||||
if (!res.ok) {
|
|
||||||
throw new Error(`HTTP ${res.status}`)
|
|
||||||
}
|
|
||||||
const data = new Uint8Array(await res.arrayBuffer())
|
|
||||||
const saveRes = await saveBytesToDisk(
|
const saveRes = await saveBytesToDisk(
|
||||||
'chat.jsonl',
|
'chat.jsonl',
|
||||||
data,
|
data,
|
||||||
res.headers.get('content-type') || 'application/jsonl',
|
'application/jsonl',
|
||||||
)
|
)
|
||||||
|
|
||||||
if (saveRes) {
|
if (saveRes) {
|
||||||
|
|||||||
Reference in New Issue
Block a user