fix: types

This commit is contained in:
DIYgod 2024-08-26 17:41:38 +08:00
parent a8e48f4931
commit d9458a1850
No known key found for this signature in database
4 changed files with 42 additions and 35 deletions

View File

@ -807,14 +807,20 @@ declare const entriesOpenAPISchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
media: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
url: z.ZodString;
type: z.ZodEnum<["photo", "video"]>;
width: z.ZodOptional<z.ZodNumber>;
height: z.ZodOptional<z.ZodNumber>;
preview_image_url: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
type: "photo" | "video";
url: string;
width?: number | undefined;
height?: number | undefined;
preview_image_url?: string | undefined;
}, {
type: "photo" | "video";
url: string;
width?: number | undefined;
height?: number | undefined;
preview_image_url?: string | undefined;
}>, "many">>>;
}>, "strip", z.ZodTypeAny, {
@ -834,6 +840,8 @@ declare const entriesOpenAPISchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
media?: {
type: "photo" | "video";
url: string;
width?: number | undefined;
height?: number | undefined;
preview_image_url?: string | undefined;
}[] | null | undefined;
attachments?: {
@ -860,6 +868,8 @@ declare const entriesOpenAPISchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
media?: {
type: "photo" | "video";
url: string;
width?: number | undefined;
height?: number | undefined;
preview_image_url?: string | undefined;
}[] | null | undefined;
attachments?: {
@ -3095,6 +3105,8 @@ declare const _routes: hono_hono_base.HonoBase<Env, {
media?: {
type: "photo" | "video";
url: string;
width?: number | undefined;
height?: number | undefined;
preview_image_url?: string | undefined;
}[] | null | undefined;
attachments?: {
@ -3232,6 +3244,8 @@ declare const _routes: hono_hono_base.HonoBase<Env, {
media?: {
type: "photo" | "video";
url: string;
width?: number | undefined;
height?: number | undefined;
preview_image_url?: string | undefined;
}[] | null | undefined;
attachments?: {
@ -3299,6 +3313,8 @@ declare const _routes: hono_hono_base.HonoBase<Env, {
media?: {
type: "photo" | "video";
url: string;
width?: number | undefined;
height?: number | undefined;
preview_image_url?: string | undefined;
}[] | null | undefined;
attachments?: {
@ -3380,6 +3396,8 @@ declare const _routes: hono_hono_base.HonoBase<Env, {
media?: {
type: "photo" | "video";
url: string;
width?: number | undefined;
height?: number | undefined;
preview_image_url?: string | undefined;
}[] | null | undefined;
attachments?: {

View File

@ -87,3 +87,14 @@ export type SupportedLanguages = Parameters<
>[0]["query"]["language"]
export type RecommendationItem = ExtractBizResponse<typeof apiClient.discover.rsshub.$get>["data"][string]
export type ActionOperation =
| "contains"
| "not_contains"
| "eq"
| "not_eq"
| "gt"
| "lt"
| "regex"
export type ActionEntryField = "all" | "title" | "content" | "author" | "url" | "order"
export type ActionFeedField = "view" | "title" | "site_url" | "feed_url" | "category"

View File

@ -24,24 +24,13 @@ import {
import { ViewSelectContent } from "@renderer/components/view-select-content"
import { stopPropagation } from "@renderer/lib/dom"
import { cn } from "@renderer/lib/utils"
import type { SupportedLanguages } from "@renderer/models"
type Operation =
| "contains"
| "not_contains"
| "eq"
| "not_eq"
| "gt"
| "lt"
| "regex"
type EntryField = "all" | "title" | "content" | "author" | "url" | "order"
type FeedField = "view" | "title" | "site_url" | "feed_url"
import type { ActionEntryField, ActionFeedField, ActionOperation, SupportedLanguages } from "@renderer/models"
type ActionsInput = {
name: string
condition: {
field?: FeedField
operator?: Operation
field?: ActionFeedField
operator?: ActionOperation
value?: string
}[]
result: {
@ -52,8 +41,8 @@ type ActionsInput = {
to: string
}[]
blockRules?: {
field?: EntryField
operator?: Operation
field?: ActionEntryField
operator?: ActionOperation
value?: string | number
}[]
}
@ -220,8 +209,8 @@ const OperationTableCell = ({
onValueChange,
}: {
type: string
value?: Operation
onValueChange?: (value: Operation) => void
value?: ActionOperation
onValueChange?: (value: ActionOperation) => void
}) => {
const options = OperationOptions.filter((option) =>
option.types.includes(type),
@ -368,7 +357,7 @@ export function ActionCard({
<TableCell size="sm">
<Select
value={condition.field}
onValueChange={(value: FeedField) =>
onValueChange={(value: ActionFeedField) =>
change("field", value)}
>
<CommonSelectTrigger />

View File

@ -1,7 +1,7 @@
import { Button } from "@renderer/components/ui/button"
import { useAuthQuery } from "@renderer/hooks/common"
import { apiClient, getFetchErrorMessage } from "@renderer/lib/api-fetch"
import type { ActionsResponse } from "@renderer/models"
import type { ActionEntryField, ActionFeedField, ActionOperation, ActionsResponse } from "@renderer/models"
import { ActionCard } from "@renderer/modules/settings/action-card"
import { SettingsTitle } from "@renderer/modules/settings/title"
import { defineSettingPage } from "@renderer/modules/settings/utils"
@ -20,22 +20,11 @@ export const loader = defineSettingPage({
priority,
})
type Operation =
| "contains"
| "not_contains"
| "eq"
| "not_eq"
| "gt"
| "lt"
| "regex"
type EntryField = "all" | "title" | "content" | "author" | "url" | "order"
type FeedField = "view" | "title" | "site_url" | "feed_url"
type ActionsInput = {
name: string
condition: {
field?: FeedField
operator?: Operation
field?: ActionFeedField
operator?: ActionOperation
value?: string
}[]
result: {
@ -46,8 +35,8 @@ type ActionsInput = {
to: string
}[]
blockRules?: {
field?: EntryField
operator?: Operation
field?: ActionEntryField
operator?: ActionOperation
value?: string | number
}[]
}