import { Schema } from '@strapi/strapi'; import { SearchQuery } from '../config/query.schema'; export type Mutable = { -readonly [P in keyof T]: T[P]; }; export interface Config { includeMatches?: boolean; contentTypes: ContentType[]; } export interface FuzzySortOptions { threshold?: number; limit?: number; characterLimit?: number; keys: { name: string; weight?: number; }[]; } export interface ContentType extends Schema.ContentType { transliterate?: boolean; includeMatches?: boolean; fuzzysortOptions: FuzzySortOptions; } export interface QueryResult extends ContentType { entries: Entry[]; } export interface Result { fuzzysortResults: Fuzzysort.KeysResults; schema: ContentType; } export interface FieldMatchResult { score: number | null; indexes: readonly number[] | null; } export interface SearchMeta { score: number; matches: Record; } export interface Entry { id: string | number; searchMeta?: SearchMeta; [x: string]: any; } export interface PaginationMeta { start: number; limit: number; total?: number; } export interface RESTPaginationMeta { pagination: { page: number; pageSize: number; pageCount?: number; total?: number; }; } export interface PaginatedModelResponse { meta: Meta; data: unknown[]; } export type ResultsResponse = Record[]>; export type PaginatedResultsResponse = Record>; export interface SearchResponseArgs { query: string; locale?: string; } export type SearchResponseReturnType = SearchResponseArgs & { auth: Record; }; export type PaginationParams = Record; export interface PaginationArgs { page?: number; pageSize?: number; limit?: number; start?: number; } export interface TransformedPagination { limit: number; start: number; } export interface Context { state: { auth: unknown; }; query: SearchQuery; badRequest: (prefix: string, message: string) => void; } export interface Attribute { type: string; writable?: boolean; relation?: string; [key: string]: unknown; } export interface Model { uid?: string; kind: 'singleType' | 'collectionType'; info: { singularName: string; pluralName: string; }; options: { populateCreatorFields: boolean; }; privateAttributes?: string[]; attributes: Record; }