fix(protocol): refactor oauth-authorize to accept an ImageLike when authorizing

This commit moves the image.ts file from the frontend into the protocol package, allowing the argument type to be updated.
This commit is contained in:
ByteAtATime 2025-07-01 22:11:08 -07:00
parent fa3fbe3044
commit c7937e040a
No known key found for this signature in database
9 changed files with 9 additions and 7 deletions

View file

@ -1,4 +1,5 @@
import { z } from 'zod/v4';
import { ImageLikeSchema } from './image';
export const OpenPayloadSchema = z.object({
target: z.string(),
@ -93,7 +94,7 @@ export const ClipboardClearMessageSchema = z.object({
export const OauthAuthorizePayloadSchema = z.object({
url: z.string(),
providerName: z.string(),
providerIcon: z.string().optional(),
providerIcon: ImageLikeSchema.optional(),
description: z.string().optional()
});
export const OauthAuthorizeMessageSchema = z.object({

View file

@ -0,0 +1,15 @@
import { z } from 'zod/v4';
export const ImageMaskSchema = z.enum(['circle', 'roundedRectangle']);
export const RaycastIconSchema = z.templateLiteral([z.string(), '-16']);
export const ImageLikeSchema = z.union([
RaycastIconSchema,
z.string(),
z.object({
source: z.union([z.string(), z.object({ light: z.string(), dark: z.string() })]),
mask: ImageMaskSchema.optional()
})
]);
export type ImageLike = z.infer<typeof ImageLikeSchema>;

View file

@ -7,3 +7,4 @@ export * from './main';
export * from './plugin';
export * from './preferences';
export * from './toast';
export * from './image';