From fb9c9e4d6cff28a83075302840570ff326adb1fc Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Sat, 5 Oct 2024 01:06:54 +0900 Subject: [PATCH] Move function --- src/lib/api/index.ts | 14 +++++++++++++- src/lib/api/resolve.ts | 11 ----------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/lib/api/index.ts b/src/lib/api/index.ts index 2673b5c0a1..e6e8eea3da 100644 --- a/src/lib/api/index.ts +++ b/src/lib/api/index.ts @@ -9,6 +9,7 @@ import { BlobRef, BskyAgent, ComAtprotoLabelDefs, + ComAtprotoRepoStrongRef, RichText, } from '@atproto/api' @@ -26,7 +27,7 @@ import { import {ComposerState, EmbedDraft} from '#/view/com/composer/state/composer' import {createGIFDescription} from '../gif-alt-text' import {LinkMeta} from '../link-meta/link-meta' -import {resolveGif, resolveLink, resolveRecord} from './resolve' +import {resolveGif, resolveLink} from './resolve' import {uploadBlob} from './upload-blob' export {uploadBlob} @@ -326,3 +327,14 @@ async function resolveMedia( } return undefined } + +async function resolveRecord( + agent: BskyAgent, + uri: string, +): Promise { + const resolvedLink = await resolveLink(agent, uri) + if (resolvedLink.type !== 'record') { + throw Error('Expected uri to resolve to a record') + } + return resolvedLink.record +} diff --git a/src/lib/api/resolve.ts b/src/lib/api/resolve.ts index 9cc7b2fd2c..a97a3f31c4 100644 --- a/src/lib/api/resolve.ts +++ b/src/lib/api/resolve.ts @@ -40,17 +40,6 @@ type ResolvedRecord = { type ResolvedLink = ResolvedExternalLink | ResolvedRecord -export async function resolveRecord( - agent: BskyAgent, - uri: string, -): Promise { - const resolvedLink = await resolveLink(agent, uri) - if (resolvedLink.type !== 'record') { - throw Error('Expected uri to resolve to a record') - } - return resolvedLink.record -} - export async function resolveLink( agent: BskyAgent, uri: string,