mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
Update Mastodon API types
This commit is contained in:
parent
58cd284a84
commit
82c6dc17a8
107 changed files with 577 additions and 89 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import type { InferSelectModel } from "drizzle-orm";
|
||||
import { db } from "~drizzle/db";
|
||||
import type { application } from "~drizzle/schema";
|
||||
import type { APIApplication } from "~types/entities/application";
|
||||
import type { Application as APIApplication } from "~types/mastodon/application";
|
||||
|
||||
export type Application = InferSelectModel<typeof application>;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import type * as Lysand from "lysand-types";
|
|||
import { MediaBackendType } from "media-manager";
|
||||
import { db } from "~drizzle/db";
|
||||
import { attachment } from "~drizzle/schema";
|
||||
import type { APIAsyncAttachment } from "~types/entities/async_attachment";
|
||||
import type { APIAttachment } from "~types/entities/attachment";
|
||||
import type { AsyncAttachment as APIAsyncAttachment } from "~types/mastodon/async_attachment";
|
||||
import type { Attachment as APIAttachment } from "~types/mastodon/attachment";
|
||||
|
||||
export type Attachment = InferSelectModel<typeof attachment>;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { type InferSelectModel, and, eq } from "drizzle-orm";
|
|||
import type * as Lysand from "lysand-types";
|
||||
import { db } from "~drizzle/db";
|
||||
import { emoji, instance } from "~drizzle/schema";
|
||||
import type { APIEmoji } from "~types/entities/emoji";
|
||||
import type { Emoji as APIEmoji } from "~types/mastodon/emoji";
|
||||
import { addInstanceIfNotExists } from "./Instance";
|
||||
|
||||
export type EmojiWithInstance = InferSelectModel<typeof emoji> & {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import type { InferSelectModel } from "drizzle-orm";
|
||||
import { db } from "~drizzle/db";
|
||||
import type { notification } from "~drizzle/schema";
|
||||
import type { APINotification } from "~types/entities/notification";
|
||||
import type { Notification as APINotification } from "~types/mastodon/notification";
|
||||
import {
|
||||
type StatusWithRelations,
|
||||
findFirstStatuses,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import type { InferSelectModel } from "drizzle-orm";
|
||||
import { db } from "~drizzle/db";
|
||||
import { relationship } from "~drizzle/schema";
|
||||
import type { APIRelationship } from "~types/entities/relationship";
|
||||
import type { Relationship as APIRelationship } from "~types/mastodon/relationship";
|
||||
import type { User } from "./User";
|
||||
|
||||
export type Relationship = InferSelectModel<typeof relationship>;
|
||||
|
|
@ -82,7 +82,6 @@ export const relationshipToAPI = (rel: Relationship): APIRelationship => {
|
|||
notifying: rel.notifying,
|
||||
requested: rel.requested,
|
||||
showing_reblogs: rel.showingReblogs,
|
||||
languages: rel.languages ?? [],
|
||||
note: rel.note,
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,18 +5,15 @@ import {
|
|||
and,
|
||||
eq,
|
||||
inArray,
|
||||
isNotNull,
|
||||
isNull,
|
||||
or,
|
||||
sql,
|
||||
} from "drizzle-orm";
|
||||
import { htmlToText } from "html-to-text";
|
||||
import linkifyHtml from "linkify-html";
|
||||
import linkifyStr from "linkify-string";
|
||||
import type * as Lysand from "lysand-types";
|
||||
import {
|
||||
anyOf,
|
||||
char,
|
||||
charIn,
|
||||
createRegExp,
|
||||
digit,
|
||||
|
|
@ -38,9 +35,9 @@ import {
|
|||
statusToMentions,
|
||||
user,
|
||||
} from "~drizzle/schema";
|
||||
import type { APIAttachment } from "~types/entities/attachment";
|
||||
import type { APIStatus } from "~types/entities/status";
|
||||
import type { Note } from "~types/lysand/Object";
|
||||
import type { Attachment as APIAttachment } from "~types/mastodon/attachment";
|
||||
import type { Status as APIStatus } from "~types/mastodon/status";
|
||||
import { applicationToAPI } from "./Application";
|
||||
import {
|
||||
attachmentFromLysand,
|
||||
|
|
@ -64,7 +61,6 @@ import {
|
|||
resolveUser,
|
||||
resolveWebFinger,
|
||||
transformOutputToUserWithRelations,
|
||||
userExtras,
|
||||
userExtrasTemplate,
|
||||
userRelations,
|
||||
userToAPI,
|
||||
|
|
@ -1270,12 +1266,13 @@ export const statusToAPI = async (
|
|||
config.http.base_url,
|
||||
).toString(),
|
||||
bookmarked: false,
|
||||
quote: statusToConvert.quoting
|
||||
quote: !!statusToConvert.quotingPostId /* statusToConvert.quoting
|
||||
? await statusToAPI(
|
||||
statusToConvert.quoting as unknown as StatusWithRelations,
|
||||
userFetching,
|
||||
)
|
||||
: null,
|
||||
: null, */,
|
||||
// @ts-expect-error Pleroma extension
|
||||
quote_id: statusToConvert.quotingPostId || undefined,
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ import {
|
|||
relationship,
|
||||
user,
|
||||
} from "~drizzle/schema";
|
||||
import type { APIAccount } from "~types/entities/account";
|
||||
import type { APISource } from "~types/entities/source";
|
||||
import type { Account as APIAccount } from "~types/mastodon/account";
|
||||
import type { Source as APISource } from "~types/mastodon/source";
|
||||
import {
|
||||
type EmojiWithInstance,
|
||||
emojiToAPI,
|
||||
|
|
@ -749,6 +749,7 @@ export const userToAPI = (
|
|||
discoverable: undefined,
|
||||
mute_expires_at: undefined,
|
||||
group: false,
|
||||
// @ts-expect-error Pleroma extension
|
||||
pleroma: {
|
||||
is_admin: userToConvert.isAdmin,
|
||||
is_moderator: userToConvert.isAdmin,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue