refactor: 🔥 Remove dead code

This commit is contained in:
Jesse Wierzbinski 2024-05-07 03:13:37 +00:00
parent 592f7c0ac2
commit 7b05a34cce
No known key found for this signature in database
36 changed files with 32 additions and 1692 deletions

View file

@ -1,141 +0,0 @@
export type APActivityPubContext =
| "https://www.w3.org/ns/activitystreams"
| {
ostatus: string;
atomUri: string;
inReplyToAtomUri: string;
conversation: string;
sensitive: string;
toot: string;
votersCount: string;
litepub: string;
directMessage: string;
};
export interface APActivityPubObject {
id: string;
type: string;
summary?: string;
inReplyTo?: string;
published: string;
url: string;
attributedTo: string;
to: string[];
cc: string[];
sensitive?: boolean;
atomUri: string;
inReplyToAtomUri?: string;
conversation: string;
content: string;
contentMap: Record<string, string>;
attachment: APActivityPubAttachment[];
tag: APTag[];
context?: string;
quoteUri?: string;
quoteUrl?: string;
source?: {
content: string;
mediaType: string;
};
}
export interface APActivityPubAttachment {
type?: string;
mediaType?: string;
url?: string;
name?: string;
}
export interface APActivityPubCollection<T> {
id: string;
type: string;
first?: {
type: string;
next: string;
partOf: string;
items: T[];
};
}
export interface APActivityPubNote extends APActivityPubObject {
type: "Note";
}
export interface APActivityPubActivity {
"@context": APActivityPubContext[];
id: string;
type: string;
actor: string;
published: string;
to: string[];
cc: string[];
object: APActivityPubNote;
}
export type APActorContext =
| "https://www.w3.org/ns/activitystreams"
| "https://w3id.org/security/v1"
| Record<
string,
| string
| { "@id": string; "@type": string }
| { "@container": string; "@id": string }
>;
export interface APActorPublicKey {
id: string;
owner: string;
publicKeyPem: string;
}
export interface APActorEndpoints {
sharedInbox: string;
}
export interface APActorIcon {
type: string;
mediaType: string;
url: string;
}
export interface APActor {
"@context": APActorContext[];
id: string;
type: string;
following: string;
followers: string;
inbox: string;
outbox: string;
featured: string;
featuredTags: string;
preferredUsername: string;
name: string;
summary: string;
url: string;
manuallyApprovesFollowers: boolean;
discoverable: boolean;
indexable: boolean;
published: string;
memorial: boolean;
devices: string;
publicKey: APActorPublicKey;
tag: APTag[];
attachment: APAttachment[];
endpoints: APActorEndpoints;
icon: APActorIcon;
}
export interface APTag {
type: string;
href: string;
name: string;
}
export interface APAttachment {
type: string;
mediaType: string;
url: string;
name?: string;
blurhash?: string;
description?: string;
}

View file

@ -1,5 +1,10 @@
export interface APIRouteMeta {
allowedMethods: ("GET" | "POST" | "PUT" | "DELETE" | "PATCH")[];
import type { Hono } from "hono";
import type { RouterRoute } from "hono/types";
import type { z } from "zod";
export type HttpVerb = "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "OPTIONS";
export interface APIRouteMetadata {
allowedMethods: HttpVerb[];
ratelimits: {
max: number;
duration: number;
@ -7,7 +12,16 @@ export interface APIRouteMeta {
route: string;
auth: {
required: boolean;
requiredOnMethods?: ("GET" | "POST" | "PUT" | "DELETE" | "PATCH")[];
requiredOnMethods?: HttpVerb[];
oauthPermissions?: string[];
};
}
export interface APIRouteExports {
meta: APIRouteMetadata;
schemas?: {
query?: z.AnyZodObject;
body?: z.AnyZodObject;
};
default: (app: Hono) => RouterRoute;
}

View file

@ -1,6 +0,0 @@
import type { LysandObjectType } from "./Object";
export interface ExtensionType extends LysandObjectType {
type: "Extension";
extension_type: string;
}

View file

@ -1,177 +0,0 @@
import type { Emoji } from "./extensions/org.lysand/custom_emojis";
export interface LysandObjectType {
type: string;
id: string; // Either a UUID or some kind of time-based UUID-compatible system
uri: string; // URI to the note
created_at: string;
extensions?: {
// Should be in the format
// "organization:extension_name": value
// Example: "org.joinmastodon:spoiler_text": "This is a spoiler!"
"org.lysand:custom_emojis"?: {
emojis: Emoji[];
};
"org.lysand:reactions"?: {
reactions: string;
};
"org.lysand:polls"?: {
poll: {
options: ContentFormat[][];
votes: number[];
expires_at: string;
multiple_choice: boolean;
};
};
[key: string]: Record<string, unknown> | undefined;
};
}
export interface ActorPublicKeyData {
public_key: string;
actor: string;
}
export interface Collection<T> {
first: string;
last: string;
next?: string;
prev?: string;
items: T[];
}
export interface LysandUser extends LysandObjectType {
type: "User";
bio: ContentFormat[];
inbox: string;
outbox: string;
followers: string;
following: string;
liked: string;
disliked: string;
featured: string;
indexable: boolean;
fields?: {
key: ContentFormat[];
value: ContentFormat[];
}[];
display_name?: string;
public_key?: ActorPublicKeyData;
username: string;
avatar?: ContentFormat[];
header?: ContentFormat[];
}
export interface LysandPublication extends LysandObjectType {
type: "Note" | "Patch";
author: string;
contents: ContentFormat[];
mentions: string[];
replies_to: string[];
quotes: string[];
is_sensitive: boolean;
subject: string;
attachments: ContentFormat[][];
}
export interface LysandAction extends LysandObjectType {
type:
| "Like"
| "Dislike"
| "Follow"
| "FollowAccept"
| "FollowReject"
| "Announce"
| "Undo"
| "Extension";
author: string;
}
/**
* A Note is a publication on the network, such as a post or comment
*/
export interface Note extends LysandPublication {
type: "Note";
}
/**
* A Patch is an edit to a Note
*/
export interface Patch extends LysandPublication {
type: "Patch";
patched_id: string;
patched_at: string;
}
export interface Like extends LysandAction {
type: "Like";
object: string;
}
export interface Dislike extends LysandAction {
type: "Dislike";
object: string;
}
export interface Announce extends LysandAction {
type: "Announce";
object: string;
}
export interface Undo extends LysandAction {
type: "Undo";
object: string;
}
export interface Follow extends LysandAction {
type: "Follow";
followee: string;
}
export interface FollowAccept extends LysandAction {
type: "FollowAccept";
follower: string;
}
export interface FollowReject extends LysandAction {
type: "FollowReject";
follower: string;
}
export interface ServerMetadata extends LysandObjectType {
type: "ServerMetadata";
name: string;
version?: string;
description?: string;
website?: string;
moderators?: string[];
admins?: string[];
logo?: ContentFormat[];
banner?: ContentFormat[];
supported_extensions?: string[];
}
/**
* Content format is an array of objects that contain the content and the content type.
*/
export interface ContentFormat {
content: string;
content_type: string;
description?: string;
size?: number;
hash?: {
md5?: string;
sha1?: string;
sha256?: string;
sha512?: string;
[key: string]: string | undefined;
};
blurhash?: string;
fps?: number;
width?: number;
height?: number;
duration?: number;
}

View file

@ -1,7 +0,0 @@
import type { ContentFormat } from "../../Object";
export interface Emoji {
name: string;
url: ContentFormat[];
alt?: string;
}

View file

@ -1,14 +0,0 @@
import type { ExtensionType } from "../../Extension";
export interface OrgLysandPollsVoteType extends ExtensionType {
extension_type: "org.lysand:polls/Vote";
author: string;
poll: string;
option: number;
}
export interface OrgLysandPollsVoteResultType extends ExtensionType {
extension_type: "org.lysand:polls/VoteResult";
poll: string;
votes: number[];
}

View file

@ -1,8 +0,0 @@
import type { ExtensionType } from "../../Extension";
export interface OrgLysandReactionsType extends ExtensionType {
extension_type: "org.lysand:reactions/Reaction";
author: string;
object: string;
content: string;
}