refactor(api): ♻️ Move all client schema code to new package

This commit is contained in:
Jesse Wierzbinski 2025-03-22 02:34:03 +01:00
parent 52602c3da7
commit 3fe07a79b8
No known key found for this signature in database
128 changed files with 3904 additions and 169 deletions

View file

@ -1,4 +1,8 @@
import type { z } from "@hono/zod-openapi";
import type {
Application as ApplicationSchema,
CredentialApplication,
} from "@versia/client-ng/schemas";
import { Token, db } from "@versia/kit/db";
import { Applications } from "@versia/kit/tables";
import {
@ -9,10 +13,6 @@ import {
eq,
inArray,
} from "drizzle-orm";
import type {
Application as ApplicationSchema,
CredentialApplication,
} from "../schemas/application.ts";
import { BaseInterface } from "./base.ts";
type ApplicationType = InferSelectModel<typeof Applications>;

View file

@ -1,6 +1,7 @@
import { emojiValidatorWithColons, emojiValidatorWithIdentifiers } from "@/api";
import { proxyUrl } from "@/response";
import type { z } from "@hono/zod-openapi";
import type { CustomEmoji } from "@versia/client-ng/schemas";
import type { CustomEmojiExtension } from "@versia/federation/types";
import { type Instance, Media, db } from "@versia/kit/db";
import { Emojis, type Instances, type Medias } from "@versia/kit/tables";
@ -14,7 +15,6 @@ import {
inArray,
isNull,
} from "drizzle-orm";
import type { CustomEmoji } from "../schemas/emoji.ts";
import { BaseInterface } from "./base.ts";
type EmojiType = InferSelectModel<typeof Emojis> & {

View file

@ -2,6 +2,7 @@ import { join } from "node:path";
import { mimeLookup } from "@/content_types.ts";
import { proxyUrl } from "@/response";
import type { z } from "@hono/zod-openapi";
import type { Attachment as AttachmentSchema } from "@versia/client-ng/schemas";
import type { ContentFormat } from "@versia/federation/types";
import { db } from "@versia/kit/db";
import { Medias } from "@versia/kit/tables";
@ -16,7 +17,6 @@ import {
} from "drizzle-orm";
import sharp from "sharp";
import { MediaBackendType } from "~/classes/config/schema.ts";
import type { Attachment as AttachmentSchema } from "~/classes/schemas/attachment.ts";
import { config } from "~/config.ts";
import { ApiError } from "../errors/api-error.ts";
import { getMediaHash } from "../media/media-hasher.ts";

View file

@ -4,6 +4,7 @@ import { sanitizedHtmlStrip } from "@/sanitization";
import { sentry } from "@/sentry";
import type { z } from "@hono/zod-openapi";
import { getLogger } from "@logtape/logtape";
import type { Status, Status as StatusSchema } from "@versia/client-ng/schemas";
import { EntityValidator } from "@versia/federation";
import type {
ContentFormat,
@ -36,10 +37,8 @@ import {
findManyNotes,
parseTextMentions,
} from "~/classes/functions/status";
import type { Status as StatusSchema } from "~/classes/schemas/status.ts";
import { config } from "~/config.ts";
import { DeliveryJobType, deliveryQueue } from "../queues/delivery.ts";
import type { Status } from "../schemas/status.ts";
import { Application } from "./application.ts";
import { BaseInterface } from "./base.ts";
import { Emoji } from "./emoji.ts";

View file

@ -1,4 +1,5 @@
import type { z } from "@hono/zod-openapi";
import type { Notification as NotificationSchema } from "@versia/client-ng/schemas";
import { Note, User, db } from "@versia/kit/db";
import { Notifications } from "@versia/kit/tables";
import {
@ -9,7 +10,6 @@ import {
eq,
inArray,
} from "drizzle-orm";
import type { Notification as NotificationSchema } from "~/classes/schemas/notification.ts";
import {
transformOutputToUserWithRelations,
userExtrasTemplate,

View file

@ -1,4 +1,5 @@
import type { z } from "@hono/zod-openapi";
import type { WebPushSubscription as WebPushSubscriptionSchema } from "@versia/client-ng/schemas";
import { type Token, type User, db } from "@versia/kit/db";
import { PushSubscriptions, Tokens } from "@versia/kit/tables";
import {
@ -9,7 +10,6 @@ import {
eq,
inArray,
} from "drizzle-orm";
import type { WebPushSubscription as WebPushSubscriptionSchema } from "../schemas/pushsubscription.ts";
import { BaseInterface } from "./base.ts";
type PushSubscriptionType = InferSelectModel<typeof PushSubscriptions>;

View file

@ -1,4 +1,5 @@
import { z } from "@hono/zod-openapi";
import type { Relationship as RelationshipSchema } from "@versia/client-ng/schemas";
import { db } from "@versia/kit/db";
import { Relationships } from "@versia/kit/tables";
import {
@ -10,7 +11,6 @@ import {
eq,
inArray,
} from "drizzle-orm";
import type { Relationship as RelationshipSchema } from "~/classes/schemas/relationship";
import { BaseInterface } from "./base.ts";
import type { User } from "./user.ts";

View file

@ -1,4 +1,5 @@
import type { z } from "@hono/zod-openapi";
import type { Token as TokenSchema } from "@versia/client-ng/schemas";
import { type Application, User, db } from "@versia/kit/db";
import { Tokens } from "@versia/kit/tables";
import {
@ -9,7 +10,6 @@ import {
eq,
inArray,
} from "drizzle-orm";
import type { Token as TokenSchema } from "../schemas/token.ts";
import { BaseInterface } from "./base.ts";
type TokenType = InferSelectModel<typeof Tokens> & {

View file

@ -5,6 +5,11 @@ import { proxyUrl } from "@/response";
import { sentry } from "@/sentry";
import type { z } from "@hono/zod-openapi";
import { getLogger } from "@logtape/logtape";
import type {
Account,
Mention as MentionSchema,
Source,
} from "@versia/client-ng/schemas";
import {
EntityValidator,
FederationRequester,
@ -51,8 +56,6 @@ import { config } from "~/config.ts";
import type { KnownEntity } from "~/types/api.ts";
import { DeliveryJobType, deliveryQueue } from "../queues/delivery.ts";
import { PushJobType, pushQueue } from "../queues/push.ts";
import type { Account, Source } from "../schemas/account.ts";
import type { Mention as MentionSchema } from "../schemas/status.ts";
import { BaseInterface } from "./base.ts";
import { Emoji } from "./emoji.ts";
import { Instance } from "./instance.ts";