From 807a97f05c0aadeafd0060e88e93ce6246cb2332 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Mon, 13 Nov 2023 11:42:10 -0500 Subject: [PATCH] Adding changes from lemmy, mainly removing aggregate ids. --- src/index.ts | 5 +++-- src/types/{CommunityBlockId.ts => ActivityId.ts} | 2 +- src/types/CommentAggregates.ts | 1 - src/types/CommunityAggregates.ts | 1 - src/types/CustomEmojiKeyword.ts | 1 - src/types/FederatedInstances.ts | 8 ++++---- src/types/ImageUpload.ts | 2 -- src/types/ImageUploadId.ts | 3 --- src/types/InstanceWithFederationState.ts | 13 +++++++++++++ src/types/LemmyErrorType.ts | 2 ++ src/types/LocalSite.ts | 1 + src/types/LocalSiteRateLimit.ts | 1 - src/types/LocalUser.ts | 1 + src/types/LoginToken.ts | 1 - src/types/PersonAggregates.ts | 1 - src/types/PostAggregates.ts | 1 - src/types/ReadableFederationState.ts | 12 ++++++++++++ src/types/SaveUserSettings.ts | 1 + src/types/SiteAggregates.ts | 1 - 19 files changed, 38 insertions(+), 20 deletions(-) rename src/types/{CommunityBlockId.ts => ActivityId.ts} (70%) delete mode 100644 src/types/ImageUploadId.ts create mode 100644 src/types/InstanceWithFederationState.ts create mode 100644 src/types/ReadableFederationState.ts diff --git a/src/index.ts b/src/index.ts index ef62258..1b77709 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,5 @@ export * from "./http"; +export { ActivityId } from "./types/ActivityId"; export { AddAdmin } from "./types/AddAdmin"; export { AddAdminResponse } from "./types/AddAdminResponse"; export { AddModToCommunity } from "./types/AddModToCommunity"; @@ -41,7 +42,6 @@ export { CommentSortType } from "./types/CommentSortType"; export { CommentView } from "./types/CommentView"; export { Community } from "./types/Community"; export { CommunityAggregates } from "./types/CommunityAggregates"; -export { CommunityBlockId } from "./types/CommunityBlockId"; export { CommunityBlockView } from "./types/CommunityBlockView"; export { CommunityFollowerView } from "./types/CommunityFollowerView"; export { CommunityId } from "./types/CommunityId"; @@ -110,10 +110,10 @@ export { GetUnreadCountResponse } from "./types/GetUnreadCountResponse"; export { GetUnreadRegistrationApplicationCountResponse } from "./types/GetUnreadRegistrationApplicationCountResponse"; export { HideCommunity } from "./types/HideCommunity"; export { ImageUpload } from "./types/ImageUpload"; -export { ImageUploadId } from "./types/ImageUploadId"; export { Instance } from "./types/Instance"; export { InstanceBlockView } from "./types/InstanceBlockView"; export { InstanceId } from "./types/InstanceId"; +export { InstanceWithFederationState } from "./types/InstanceWithFederationState"; export { Language } from "./types/Language"; export { LanguageId } from "./types/LanguageId"; export { LemmyErrorType } from "./types/LemmyErrorType"; @@ -204,6 +204,7 @@ export { PurgeComment } from "./types/PurgeComment"; export { PurgeCommunity } from "./types/PurgeCommunity"; export { PurgePerson } from "./types/PurgePerson"; export { PurgePost } from "./types/PurgePost"; +export { ReadableFederationState } from "./types/ReadableFederationState"; export { Register } from "./types/Register"; export { RegistrationApplication } from "./types/RegistrationApplication"; export { RegistrationApplicationResponse } from "./types/RegistrationApplicationResponse"; diff --git a/src/types/CommunityBlockId.ts b/src/types/ActivityId.ts similarity index 70% rename from src/types/CommunityBlockId.ts rename to src/types/ActivityId.ts index c430dc7..77411c7 100644 --- a/src/types/CommunityBlockId.ts +++ b/src/types/ActivityId.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type CommunityBlockId = number; +export type ActivityId = /* integer */ number; diff --git a/src/types/CommentAggregates.ts b/src/types/CommentAggregates.ts index 1fe6d88..be63154 100644 --- a/src/types/CommentAggregates.ts +++ b/src/types/CommentAggregates.ts @@ -2,7 +2,6 @@ import type { CommentId } from "./CommentId"; export interface CommentAggregates { - id: number; comment_id: CommentId; score: /* integer */ number; upvotes: /* integer */ number; diff --git a/src/types/CommunityAggregates.ts b/src/types/CommunityAggregates.ts index 1a5dd5d..d686794 100644 --- a/src/types/CommunityAggregates.ts +++ b/src/types/CommunityAggregates.ts @@ -2,7 +2,6 @@ import type { CommunityId } from "./CommunityId"; export interface CommunityAggregates { - id: number; community_id: CommunityId; subscribers: /* integer */ number; posts: /* integer */ number; diff --git a/src/types/CustomEmojiKeyword.ts b/src/types/CustomEmojiKeyword.ts index 5af1ce0..ddcb818 100644 --- a/src/types/CustomEmojiKeyword.ts +++ b/src/types/CustomEmojiKeyword.ts @@ -2,7 +2,6 @@ import type { CustomEmojiId } from "./CustomEmojiId"; export interface CustomEmojiKeyword { - id: number; custom_emoji_id: CustomEmojiId; keyword: string; } diff --git a/src/types/FederatedInstances.ts b/src/types/FederatedInstances.ts index 10fb4fc..55b56f8 100644 --- a/src/types/FederatedInstances.ts +++ b/src/types/FederatedInstances.ts @@ -1,8 +1,8 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { Instance } from "./Instance"; +import type { InstanceWithFederationState } from "./InstanceWithFederationState"; export interface FederatedInstances { - linked: Array; - allowed: Array; - blocked: Array; + linked: Array; + allowed: Array; + blocked: Array; } diff --git a/src/types/ImageUpload.ts b/src/types/ImageUpload.ts index c4f2f14..34bf9cc 100644 --- a/src/types/ImageUpload.ts +++ b/src/types/ImageUpload.ts @@ -1,9 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { ImageUploadId } from "./ImageUploadId"; import type { LocalUserId } from "./LocalUserId"; export interface ImageUpload { - id: ImageUploadId; local_user_id: LocalUserId; pictrs_alias: string; pictrs_delete_token: string; diff --git a/src/types/ImageUploadId.ts b/src/types/ImageUploadId.ts deleted file mode 100644 index dc07512..0000000 --- a/src/types/ImageUploadId.ts +++ /dev/null @@ -1,3 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type ImageUploadId = number; diff --git a/src/types/InstanceWithFederationState.ts b/src/types/InstanceWithFederationState.ts new file mode 100644 index 0000000..5d65844 --- /dev/null +++ b/src/types/InstanceWithFederationState.ts @@ -0,0 +1,13 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { InstanceId } from "./InstanceId"; +import type { ReadableFederationState } from "./ReadableFederationState"; + +export interface InstanceWithFederationState { + id: InstanceId; + domain: string; + published: string; + updated?: string; + software?: string; + version?: string; + federation_state?: ReadableFederationState; +} diff --git a/src/types/LemmyErrorType.ts b/src/types/LemmyErrorType.ts index 242e197..6ac5d74 100644 --- a/src/types/LemmyErrorType.ts +++ b/src/types/LemmyErrorType.ts @@ -35,6 +35,8 @@ export type LemmyErrorType = | { error: "couldnt_find_community" } | { error: "couldnt_find_person" } | { error: "person_is_blocked" } + | { error: "community_is_blocked" } + | { error: "instance_is_blocked" } | { error: "downvotes_are_disabled" } | { error: "instance_is_private" } | { error: "invalid_password" } diff --git a/src/types/LocalSite.ts b/src/types/LocalSite.ts index 307a803..67aab50 100644 --- a/src/types/LocalSite.ts +++ b/src/types/LocalSite.ts @@ -28,4 +28,5 @@ export interface LocalSite { updated?: string; registration_mode: RegistrationMode; reports_email_admins: boolean; + federation_signed_fetch: boolean; } diff --git a/src/types/LocalSiteRateLimit.ts b/src/types/LocalSiteRateLimit.ts index a05ded6..4c972ae 100644 --- a/src/types/LocalSiteRateLimit.ts +++ b/src/types/LocalSiteRateLimit.ts @@ -2,7 +2,6 @@ import type { LocalSiteId } from "./LocalSiteId"; export interface LocalSiteRateLimit { - id: number; local_site_id: LocalSiteId; message: number; message_per_second: number; diff --git a/src/types/LocalUser.ts b/src/types/LocalUser.ts index bb0a069..86cd81a 100644 --- a/src/types/LocalUser.ts +++ b/src/types/LocalUser.ts @@ -30,4 +30,5 @@ export interface LocalUser { totp_2fa_enabled: boolean; enable_keyboard_navigation: boolean; enable_animated_images: boolean; + collapse_bot_comments: boolean; } diff --git a/src/types/LoginToken.ts b/src/types/LoginToken.ts index da9ab1a..21e0c26 100644 --- a/src/types/LoginToken.ts +++ b/src/types/LoginToken.ts @@ -2,7 +2,6 @@ import type { LocalUserId } from "./LocalUserId"; export interface LoginToken { - id: number; user_id: LocalUserId; published: string; ip?: string; diff --git a/src/types/PersonAggregates.ts b/src/types/PersonAggregates.ts index 47e7442..5888474 100644 --- a/src/types/PersonAggregates.ts +++ b/src/types/PersonAggregates.ts @@ -2,7 +2,6 @@ import type { PersonId } from "./PersonId"; export interface PersonAggregates { - id: number; person_id: PersonId; post_count: /* integer */ number; comment_count: /* integer */ number; diff --git a/src/types/PostAggregates.ts b/src/types/PostAggregates.ts index dfbdf00..91e4195 100644 --- a/src/types/PostAggregates.ts +++ b/src/types/PostAggregates.ts @@ -2,7 +2,6 @@ import type { PostId } from "./PostId"; export interface PostAggregates { - id: number; post_id: PostId; comments: /* integer */ number; score: /* integer */ number; diff --git a/src/types/ReadableFederationState.ts b/src/types/ReadableFederationState.ts new file mode 100644 index 0000000..f8bd37d --- /dev/null +++ b/src/types/ReadableFederationState.ts @@ -0,0 +1,12 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { ActivityId } from "./ActivityId"; +import type { InstanceId } from "./InstanceId"; + +export interface ReadableFederationState { + instance_id: InstanceId; + last_successful_id?: ActivityId; + last_successful_published_time?: string; + fail_count: number; + last_retry?: string; + next_retry?: string; +} diff --git a/src/types/SaveUserSettings.ts b/src/types/SaveUserSettings.ts index 77b778d..a2d3677 100644 --- a/src/types/SaveUserSettings.ts +++ b/src/types/SaveUserSettings.ts @@ -31,4 +31,5 @@ export interface SaveUserSettings { post_listing_mode?: PostListingMode; enable_keyboard_navigation?: boolean; enable_animated_images?: boolean; + collapse_bot_comments?: boolean; } diff --git a/src/types/SiteAggregates.ts b/src/types/SiteAggregates.ts index df2dd80..bdd7c6d 100644 --- a/src/types/SiteAggregates.ts +++ b/src/types/SiteAggregates.ts @@ -2,7 +2,6 @@ import type { SiteId } from "./SiteId"; export interface SiteAggregates { - id: number; site_id: SiteId; users: /* integer */ number; posts: /* integer */ number;