From 402aba2d384a988d547e311c82aeb0ed9bd4b6cf Mon Sep 17 00:00:00 2001 From: Dessalines Date: Mon, 15 May 2023 15:41:44 -0400 Subject: [PATCH] Remove bigints (#121) * Alter script to change bigints to numbers * Run script to convert bigints to numbers --- copy_generated_types_from_lemmy.sh | 5 ++++- src/types/BanFromCommunity.ts | 2 +- src/types/BanPerson.ts | 2 +- src/types/CommentAggregates.ts | 6 +++--- src/types/CommunityAggregates.ts | 14 +++++++------- src/types/GetComments.ts | 4 ++-- src/types/GetModlog.ts | 4 ++-- src/types/GetPersonDetails.ts | 4 ++-- src/types/GetPersonMentions.ts | 4 ++-- src/types/GetPosts.ts | 4 ++-- src/types/GetPrivateMessages.ts | 4 ++-- src/types/GetReplies.ts | 4 ++-- src/types/GetReportCountResponse.ts | 6 +++--- src/types/GetUnreadCountResponse.ts | 6 +++--- ...UnreadRegistrationApplicationCountResponse.ts | 2 +- src/types/ListCommentReports.ts | 4 ++-- src/types/ListCommunities.ts | 4 ++-- src/types/ListPostReports.ts | 4 ++-- src/types/ListPrivateMessageReports.ts | 4 ++-- src/types/ListRegistrationApplications.ts | 4 ++-- src/types/ModlogListParams.ts | 4 ++-- src/types/PersonAggregates.ts | 8 ++++---- src/types/PostAggregates.ts | 8 ++++---- src/types/PostView.ts | 2 +- src/types/RemoveCommunity.ts | 2 +- src/types/Search.ts | 4 ++-- src/types/SiteAggregates.ts | 16 ++++++++-------- 27 files changed, 69 insertions(+), 66 deletions(-) diff --git a/copy_generated_types_from_lemmy.sh b/copy_generated_types_from_lemmy.sh index 6d2b0dc..662befe 100755 --- a/copy_generated_types_from_lemmy.sh +++ b/copy_generated_types_from_lemmy.sh @@ -13,4 +13,7 @@ cp db_views/bindings/* ../../lemmy-js-client/src/types/ cp db_views_actor/bindings/* ../../lemmy-js-client/src/types/ cp db_views_moderator/bindings/* ../../lemmy-js-client/src/types/ -node ../../lemmy-js-client/putTypesInIndex.js \ No newline at end of file +# Change all the bigints to numbers +find ../../lemmy-js-client/src/types -type f -name '*.ts' -exec sed -i 's/bigint/number/g' {} + + +node ../../lemmy-js-client/putTypesInIndex.js diff --git a/src/types/BanFromCommunity.ts b/src/types/BanFromCommunity.ts index 41716bf..b155377 100644 --- a/src/types/BanFromCommunity.ts +++ b/src/types/BanFromCommunity.ts @@ -8,6 +8,6 @@ export interface BanFromCommunity { ban: boolean; remove_data?: boolean; reason?: string; - expires?: bigint; + expires?: number; auth: string; } diff --git a/src/types/BanPerson.ts b/src/types/BanPerson.ts index c2d53cf..0fd1bbb 100644 --- a/src/types/BanPerson.ts +++ b/src/types/BanPerson.ts @@ -6,6 +6,6 @@ export interface BanPerson { ban: boolean; remove_data?: boolean; reason?: string; - expires?: bigint; + expires?: number; auth: string; } diff --git a/src/types/CommentAggregates.ts b/src/types/CommentAggregates.ts index 720a4ca..b766119 100644 --- a/src/types/CommentAggregates.ts +++ b/src/types/CommentAggregates.ts @@ -4,9 +4,9 @@ import type { CommentId } from "./CommentId"; export interface CommentAggregates { id: number; comment_id: CommentId; - score: bigint; - upvotes: bigint; - downvotes: bigint; + score: number; + upvotes: number; + downvotes: number; published: string; child_count: number; } diff --git a/src/types/CommunityAggregates.ts b/src/types/CommunityAggregates.ts index 9b74d6e..733ad5b 100644 --- a/src/types/CommunityAggregates.ts +++ b/src/types/CommunityAggregates.ts @@ -4,12 +4,12 @@ import type { CommunityId } from "./CommunityId"; export interface CommunityAggregates { id: number; community_id: CommunityId; - subscribers: bigint; - posts: bigint; - comments: bigint; + subscribers: number; + posts: number; + comments: number; published: string; - users_active_day: bigint; - users_active_week: bigint; - users_active_month: bigint; - users_active_half_year: bigint; + users_active_day: number; + users_active_week: number; + users_active_month: number; + users_active_half_year: number; } diff --git a/src/types/GetComments.ts b/src/types/GetComments.ts index 47ad7e4..dabef71 100644 --- a/src/types/GetComments.ts +++ b/src/types/GetComments.ts @@ -9,8 +9,8 @@ export interface GetComments { type_?: ListingType; sort?: CommentSortType; max_depth?: number; - page?: bigint; - limit?: bigint; + page?: number; + limit?: number; community_id?: CommunityId; community_name?: string; post_id?: PostId; diff --git a/src/types/GetModlog.ts b/src/types/GetModlog.ts index 280ddf2..895122d 100644 --- a/src/types/GetModlog.ts +++ b/src/types/GetModlog.ts @@ -6,8 +6,8 @@ import type { PersonId } from "./PersonId"; export interface GetModlog { mod_person_id?: PersonId; community_id?: CommunityId; - page?: bigint; - limit?: bigint; + page?: number; + limit?: number; type_?: ModlogActionType; other_person_id?: PersonId; auth?: string; diff --git a/src/types/GetPersonDetails.ts b/src/types/GetPersonDetails.ts index dbd6684..8cdc8ff 100644 --- a/src/types/GetPersonDetails.ts +++ b/src/types/GetPersonDetails.ts @@ -7,8 +7,8 @@ export interface GetPersonDetails { person_id?: PersonId; username?: string; sort?: SortType; - page?: bigint; - limit?: bigint; + page?: number; + limit?: number; community_id?: CommunityId; saved_only?: boolean; auth?: string; diff --git a/src/types/GetPersonMentions.ts b/src/types/GetPersonMentions.ts index 047eb0c..fa7a8a3 100644 --- a/src/types/GetPersonMentions.ts +++ b/src/types/GetPersonMentions.ts @@ -3,8 +3,8 @@ import type { CommentSortType } from "./CommentSortType"; export interface GetPersonMentions { sort?: CommentSortType; - page?: bigint; - limit?: bigint; + page?: number; + limit?: number; unread_only?: boolean; auth: string; } diff --git a/src/types/GetPosts.ts b/src/types/GetPosts.ts index 96e6667..5198bfa 100644 --- a/src/types/GetPosts.ts +++ b/src/types/GetPosts.ts @@ -6,8 +6,8 @@ import type { SortType } from "./SortType"; export interface GetPosts { type_?: ListingType; sort?: SortType; - page?: bigint; - limit?: bigint; + page?: number; + limit?: number; community_id?: CommunityId; community_name?: string; saved_only?: boolean; diff --git a/src/types/GetPrivateMessages.ts b/src/types/GetPrivateMessages.ts index 2a35e45..009ea40 100644 --- a/src/types/GetPrivateMessages.ts +++ b/src/types/GetPrivateMessages.ts @@ -2,7 +2,7 @@ export interface GetPrivateMessages { unread_only?: boolean; - page?: bigint; - limit?: bigint; + page?: number; + limit?: number; auth: string; } diff --git a/src/types/GetReplies.ts b/src/types/GetReplies.ts index f06fd21..8266069 100644 --- a/src/types/GetReplies.ts +++ b/src/types/GetReplies.ts @@ -3,8 +3,8 @@ import type { CommentSortType } from "./CommentSortType"; export interface GetReplies { sort?: CommentSortType; - page?: bigint; - limit?: bigint; + page?: number; + limit?: number; unread_only?: boolean; auth: string; } diff --git a/src/types/GetReportCountResponse.ts b/src/types/GetReportCountResponse.ts index b75472f..f6e8e4d 100644 --- a/src/types/GetReportCountResponse.ts +++ b/src/types/GetReportCountResponse.ts @@ -3,7 +3,7 @@ import type { CommunityId } from "./CommunityId"; export interface GetReportCountResponse { community_id?: CommunityId; - comment_reports: bigint; - post_reports: bigint; - private_message_reports?: bigint; + comment_reports: number; + post_reports: number; + private_message_reports?: number; } diff --git a/src/types/GetUnreadCountResponse.ts b/src/types/GetUnreadCountResponse.ts index e98eb81..a156270 100644 --- a/src/types/GetUnreadCountResponse.ts +++ b/src/types/GetUnreadCountResponse.ts @@ -1,7 +1,7 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. export interface GetUnreadCountResponse { - replies: bigint; - mentions: bigint; - private_messages: bigint; + replies: number; + mentions: number; + private_messages: number; } diff --git a/src/types/GetUnreadRegistrationApplicationCountResponse.ts b/src/types/GetUnreadRegistrationApplicationCountResponse.ts index 1663d1f..2257f54 100644 --- a/src/types/GetUnreadRegistrationApplicationCountResponse.ts +++ b/src/types/GetUnreadRegistrationApplicationCountResponse.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. export interface GetUnreadRegistrationApplicationCountResponse { - registration_applications: bigint; + registration_applications: number; } diff --git a/src/types/ListCommentReports.ts b/src/types/ListCommentReports.ts index 1f118a0..1c5f18e 100644 --- a/src/types/ListCommentReports.ts +++ b/src/types/ListCommentReports.ts @@ -2,8 +2,8 @@ import type { CommunityId } from "./CommunityId"; export interface ListCommentReports { - page?: bigint; - limit?: bigint; + page?: number; + limit?: number; unresolved_only?: boolean; community_id?: CommunityId; auth: string; diff --git a/src/types/ListCommunities.ts b/src/types/ListCommunities.ts index aed22c0..ee52be4 100644 --- a/src/types/ListCommunities.ts +++ b/src/types/ListCommunities.ts @@ -5,7 +5,7 @@ import type { SortType } from "./SortType"; export interface ListCommunities { type_?: ListingType; sort?: SortType; - page?: bigint; - limit?: bigint; + page?: number; + limit?: number; auth?: string; } diff --git a/src/types/ListPostReports.ts b/src/types/ListPostReports.ts index a4936ff..3f6778d 100644 --- a/src/types/ListPostReports.ts +++ b/src/types/ListPostReports.ts @@ -2,8 +2,8 @@ import type { CommunityId } from "./CommunityId"; export interface ListPostReports { - page?: bigint; - limit?: bigint; + page?: number; + limit?: number; unresolved_only?: boolean; community_id?: CommunityId; auth: string; diff --git a/src/types/ListPrivateMessageReports.ts b/src/types/ListPrivateMessageReports.ts index af007a7..a94a439 100644 --- a/src/types/ListPrivateMessageReports.ts +++ b/src/types/ListPrivateMessageReports.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. export interface ListPrivateMessageReports { - page?: bigint; - limit?: bigint; + page?: number; + limit?: number; unresolved_only?: boolean; auth: string; } diff --git a/src/types/ListRegistrationApplications.ts b/src/types/ListRegistrationApplications.ts index 06fa517..e5d4802 100644 --- a/src/types/ListRegistrationApplications.ts +++ b/src/types/ListRegistrationApplications.ts @@ -2,7 +2,7 @@ export interface ListRegistrationApplications { unread_only?: boolean; - page?: bigint; - limit?: bigint; + page?: number; + limit?: number; auth: string; } diff --git a/src/types/ModlogListParams.ts b/src/types/ModlogListParams.ts index 207c53a..4725790 100644 --- a/src/types/ModlogListParams.ts +++ b/src/types/ModlogListParams.ts @@ -6,7 +6,7 @@ export interface ModlogListParams { community_id?: CommunityId; mod_person_id?: PersonId; other_person_id?: PersonId; - page?: bigint; - limit?: bigint; + page?: number; + limit?: number; hide_modlog_names: boolean; } diff --git a/src/types/PersonAggregates.ts b/src/types/PersonAggregates.ts index 6a5bdf6..74dfa29 100644 --- a/src/types/PersonAggregates.ts +++ b/src/types/PersonAggregates.ts @@ -4,8 +4,8 @@ import type { PersonId } from "./PersonId"; export interface PersonAggregates { id: number; person_id: PersonId; - post_count: bigint; - post_score: bigint; - comment_count: bigint; - comment_score: bigint; + post_count: number; + post_score: number; + comment_count: number; + comment_score: number; } diff --git a/src/types/PostAggregates.ts b/src/types/PostAggregates.ts index ecf31b9..c9b0996 100644 --- a/src/types/PostAggregates.ts +++ b/src/types/PostAggregates.ts @@ -4,10 +4,10 @@ import type { PostId } from "./PostId"; export interface PostAggregates { id: number; post_id: PostId; - comments: bigint; - score: bigint; - upvotes: bigint; - downvotes: bigint; + comments: number; + score: number; + upvotes: number; + downvotes: number; published: string; newest_comment_time_necro: string; newest_comment_time: string; diff --git a/src/types/PostView.ts b/src/types/PostView.ts index 70a13ce..4081e05 100644 --- a/src/types/PostView.ts +++ b/src/types/PostView.ts @@ -16,5 +16,5 @@ export interface PostView { read: boolean; creator_blocked: boolean; my_vote?: number; - unread_comments: bigint; + unread_comments: number; } diff --git a/src/types/RemoveCommunity.ts b/src/types/RemoveCommunity.ts index 60565e3..1010743 100644 --- a/src/types/RemoveCommunity.ts +++ b/src/types/RemoveCommunity.ts @@ -5,6 +5,6 @@ export interface RemoveCommunity { community_id: CommunityId; removed: boolean; reason?: string; - expires?: bigint; + expires?: number; auth: string; } diff --git a/src/types/Search.ts b/src/types/Search.ts index da9503f..c145d9b 100644 --- a/src/types/Search.ts +++ b/src/types/Search.ts @@ -13,7 +13,7 @@ export interface Search { type_?: SearchType; sort?: SortType; listing_type?: ListingType; - page?: bigint; - limit?: bigint; + page?: number; + limit?: number; auth?: string; } diff --git a/src/types/SiteAggregates.ts b/src/types/SiteAggregates.ts index 86536f0..ac8e461 100644 --- a/src/types/SiteAggregates.ts +++ b/src/types/SiteAggregates.ts @@ -4,12 +4,12 @@ import type { SiteId } from "./SiteId"; export interface SiteAggregates { id: number; site_id: SiteId; - users: bigint; - posts: bigint; - comments: bigint; - communities: bigint; - users_active_day: bigint; - users_active_week: bigint; - users_active_month: bigint; - users_active_half_year: bigint; + users: number; + posts: number; + comments: number; + communities: number; + users_active_day: number; + users_active_week: number; + users_active_month: number; + users_active_half_year: number; }