From 2faf2e34331703b3bdea3eb487cb8799c8d65377 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Tue, 19 Sep 2023 18:13:57 +0200 Subject: refactor(build): replace paths aliases with relative paths Using paths aliases starting with "@" can be confusing and can lead to conflict with existings modules. I prefer to use relative paths to avoid extra configuration in tools because of these aliases. --- src/types/raw-data.ts | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 src/types/raw-data.ts (limited to 'src/types/raw-data.ts') diff --git a/src/types/raw-data.ts b/src/types/raw-data.ts new file mode 100644 index 0000000..022016e --- /dev/null +++ b/src/types/raw-data.ts @@ -0,0 +1,111 @@ +/** + * Types for raw data coming from GraphQL API. + */ + +import { ContentKind } from './app'; +import { GraphQLNode, GraphQLPageInfo } from './graphql/generics'; + +export type ACFPosts = { + postsInThematic?: RawThematicPreview[]; + postsInTopic?: RawTopicPreview[]; +}; + +export type ACFThematics = { + postsInThematic: RawArticle[]; +}; + +export type ACFTopics = { + officialWebsite: string; + postsInTopic: RawArticle[]; +}; + +export type ContentParts = { + afterMore: string; + beforeMore: string; +}; + +export type Info = { + wordsCount: number; +}; + +export type RawAuthor = { + description?: T extends 'comment' ? never : string; + gravatarUrl?: string; + name: string; + url?: string; +}; + +export type RawComment = { + approved: boolean; + author: GraphQLNode>; + content: string; + databaseId: number; + date: string; + parentDatabaseId: number; +}; + +export type RawCommentsPage = { + comments: RawComment[]; + hasNextPage: boolean; + endCursor: string; +}; + +export type RawCover = { + altText: string; + mediaDetails: { + width: number; + height: number; + }; + sourceUrl: string; + title?: string; +}; + +export type RawArticle = RawPage & { + acfPosts: ACFPosts; + commentCount: number | null; +}; + +export type RawArticlePreview = Pick< + RawArticle, + 'databaseId' | 'date' | 'featuredImage' | 'slug' | 'title' +>; + +export type RawPage = { + author?: GraphQLNode>; + contentParts: ContentParts; + databaseId: number; + date: string; + featuredImage: GraphQLNode | null; + info: Info; + modified: string; + seo?: RawSEO; + slug: string; + title: string; +}; + +export type RawSEO = { + metaDesc: string; + title: string; +}; + +export type RawThematic = RawPage & { + acfThematics: ACFThematics; +}; + +export type RawThematicPreview = Pick< + RawThematic, + 'databaseId' | 'featuredImage' | 'slug' | 'title' +>; + +export type RawTopic = RawPage & { + acfTopics: ACFTopics; +}; + +export type RawTopicPreview = Pick< + RawTopic, + 'databaseId' | 'featuredImage' | 'slug' | 'title' +>; + +export type TotalItems = { + pageInfo: Pick; +}; -- cgit v1.2.3