From 6d85dbdfcb7b4b97dfc7e14bcfbef7b85199ed1d Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Mon, 26 May 2025 11:04:09 +0200 Subject: [PATCH] fix(packages/client): :bug: Fix client types, and add missing banner schema for Instance --- packages/client/schemas/instance.ts | 19 +++++++++++++++++++ packages/client/versia/base.ts | 2 +- tests/utils.ts | 2 -- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/packages/client/schemas/instance.ts b/packages/client/schemas/instance.ts index bde4f485..0914138b 100644 --- a/packages/client/schemas/instance.ts +++ b/packages/client/schemas/instance.ts @@ -102,6 +102,25 @@ export const Instance = z .openapi({ description: "An image used to represent this instance.", }), + /* Versia Server API extension */ + banner: z + .object({ + url: z.string().url().openapi({ + description: "The URL for the banner image.", + example: + "https://files.mastodon.social/site_uploads/files/000/000/001/@1x/57c12f441d083cde.png", + }), + blurhash: z.string().optional().openapi({ + description: + "A hash computed by the BlurHash algorithm, for generating colorful preview thumbnails when media has not been downloaded yet.", + example: "UUKJMXv|x]t7^*t7Rjaz^jazRjaz", + }), + }) + .optional() + .openapi({ + description: + "A wide banner image used to represent this instance.", + }), icon: z.array(InstanceIcon).openapi({ description: "The list of available size variants for this instance configured icon.", diff --git a/packages/client/versia/base.ts b/packages/client/versia/base.ts index b648f0e0..91df1081 100644 --- a/packages/client/versia/base.ts +++ b/packages/client/versia/base.ts @@ -103,7 +103,7 @@ export class BaseClient { } /** Overridable by testing */ - private fetch = fetch; + private fetch = (...args: Parameters) => fetch(...args); private async request( request: Request, diff --git a/tests/utils.ts b/tests/utils.ts index aac3d05a..410906c3 100644 --- a/tests/utils.ts +++ b/tests/utils.ts @@ -61,8 +61,6 @@ export const generateClient = async ( token?.data.accessToken, ); - // @ts-expect-error This doesn't include fetch.preconnect, which is a custom property - // added by Bun // biome-ignore lint/complexity/useLiteralKeys: Overriding private properties client["fetch"] = ( input: RequestInfo | string | URL | Request,