import { Database } from '@strapi/database'; import { FindOneParams, Params } from '@strapi/database/dist/entity-manager/types'; import type { Core } from '@strapi/strapi'; import { ContentTypesUUIDs } from '../content-types'; type DatabaseRepository = ReturnType & { findOne: (params: FindOneParams) => Promise; create: (params: Params) => Promise; }; export type CoreStrapi = Omit & { query: (query: T) => DatabaseRepository; plugin: (pluginName: string) => Omit & { contentTypes: Record; }; }; export type StrapiContext = { readonly strapi: CoreStrapi; }; export type Id = number | string; type CommentApprovalStatus = 'PENDING' | 'APPROVED' | 'REJECTED'; export type Comment = { id: Id; content: string; author?: TAuthor; children?: Array; reports?: Array; threadOf: Comment | number | null; gotThread?: boolean; related?: any; blocked?: boolean; blockedThread?: boolean; itemsInTread?: number; approvalStatus?: CommentApprovalStatus | null; firstThreadItemId?: Id; threadFirstItemId?: Id; isAdminComment?: boolean; rating?: number; lastExperience?: string; } & CommentAuthorPartial; export type CommentAuthor = { id: Id; name?: string; email?: string; avatar?: string | object; }; export type CommentAuthorPartial = { authorId?: Id; authorName?: string; authorEmail?: string; authorAvatar?: string; authorUser?: unknown; }; export type CommentAuthorResolved> = CommentAuthor & TExtension; export type CommentReport = { id: Id; related: Comment | Id; reason: any; content: string; resolved: boolean; }; export type RelatedEntity = { id: Id; uid: string; requireCommentsApproval?: boolean; }; export type ToBeFixed = any; export type PathTo = T extends object ? { [K in keyof T]: T[K] extends object ? K extends string ? K | `${K}.${PathTo}` : never : K extends string ? K : never; }[keyof T] : never; export type PathValue = P extends keyof T ? T[P] : P extends `${infer K}.${infer R}` ? K extends keyof T ? PathValue : never : never; export {};