From 6f1fab4b140756bc601ad51c3858423ce8c40ed3 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Tue, 7 Jan 2025 19:46:51 -0600 Subject: [PATCH] Add a few utils --- src/lib/api/index.ts | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/lib/api/index.ts b/src/lib/api/index.ts index 75b9938fcc..1803a811ac 100644 --- a/src/lib/api/index.ts +++ b/src/lib/api/index.ts @@ -13,6 +13,7 @@ import { ComAtprotoRepoStrongRef, RichText, } from '@atproto/api' +import {$Typed} from '@atproto/api/dist/client/util' import {TID} from '@atproto/common-web' import * as dcbor from '@ipld/dag-cbor' import {t} from '@lingui/macro' @@ -74,7 +75,7 @@ export async function post( } const did = agent.assertDid - const writes: ComAtprotoRepoApplyWrites.Create[] = [] + const writes: $Typed[] = [] const uris: string[] = [] let now = new Date() @@ -91,7 +92,7 @@ export async function post( draft, opts.onStateChange, ) - let labels: ComAtprotoLabelDefs.SelfLabels | undefined + let labels: $Typed | undefined if (draft.labels.length) { labels = { $type: 'com.atproto.label.defs#selfLabels', @@ -225,11 +226,11 @@ async function resolveEmbed( draft: PostDraft, onStateChange: ((state: string) => void) | undefined, ): Promise< - | AppBskyEmbedImages.Main - | AppBskyEmbedVideo.Main - | AppBskyEmbedExternal.Main - | AppBskyEmbedRecord.Main - | AppBskyEmbedRecordWithMedia.Main + | $Typed + | $Typed + | $Typed + | $Typed + | $Typed | undefined > { if (draft.embed.quote) { @@ -283,9 +284,9 @@ async function resolveMedia( embedDraft: EmbedDraft, onStateChange: ((state: string) => void) | undefined, ): Promise< - | AppBskyEmbedExternal.Main - | AppBskyEmbedImages.Main - | AppBskyEmbedVideo.Main + | $Typed + | $Typed + | $Typed | undefined > { if (embedDraft.media?.type === 'images') {