import { Core } from '@strapi/strapi'; import { Edge, Field, Graph, GraphOptions } from '../types'; export declare const DEFAULTS: GraphOptions; export interface RawAttribute { type: string; relation?: string; target?: string; component?: string; components?: string[]; repeatable?: boolean; required?: boolean; /** Present on the *non-owning* side of a two-sided relation. */ mappedBy?: string; inversedBy?: string; } export interface RawModel { uid: string; kind?: string; modelType?: string; category?: string; info?: { displayName?: string; singularName?: string; }; attributes?: Record; pluginOptions?: { 'content-type-builder'?: { visible?: boolean; }; }; } declare const graph: ({ strapi }: { strapi: Core.Strapi; }) => { /** * The whole schema as a graph. * * Reads Strapi's own loaded models rather than the files on disk, so a * content type a plugin adds at runtime is on the diagram too, and nothing * has to be parsed. */ build(options?: Partial): Graph; fieldsOf(model: RawModel, opts: GraphOptions): Field[]; /** * Edges, one per reason two boxes are joined. * * Both ends of a two-sided relation describe the same line. Strapi marks * the non-owning end with `mappedBy`, so skipping those leaves exactly one * edge - deduplicating by node pair instead would silently merge two * genuinely different relations between the same two types. * * Edges to something not on the diagram are dropped rather than drawn into * nothing: with `includeComponents` off, every component attribute would * otherwise become a line to a box that is not there. * * A field that is not drawn does not get a line either, and that is not a * detail. i18n adds a `localizations` relation **to every content type, * pointing at itself**, so skipping it in the field list but not here put a * self-loop on every single box on the diagram. */ edgesOf(present: Map, opts: GraphOptions): Edge[]; /** Everything that could be excluded, for the settings UI. */ catalogue(): Array<{ uid: string; label: string; kind: string; }>; }; export default graph;