UNPKG

@dossierhq/core

Version:

The core Dossier library used by clients and server alike, used to interact with schema and entities directly, as well as remotely through a client.

16 lines (15 loc) 1.13 kB
import type { ComponentTypeSpecification, FieldSpecification, PublishedSchemaSpecification, SchemaIndexSpecification, SchemaPatternSpecification, SchemaSpecification, SchemaSpecificationWithMigrations } from './SchemaSpecification.js'; export declare class BaseSchema<T extends SchemaSpecification | SchemaSpecificationWithMigrations | PublishedSchemaSpecification> { readonly spec: T; private cachedPatternRegExps; constructor(spec: T); getEntityTypeCount(): number; getEntityTypeSpecification(type: string): T['entityTypes'][number] | null; getEntityFieldSpecification(entitySpec: T['entityTypes'][number], fieldName: string): T['entityTypes'][number]['fields'][number] | null; getComponentTypeCount(): number; getComponentTypeSpecification(type: string): T['componentTypes'][number] | null; getComponentFieldSpecification(componentSpec: ComponentTypeSpecification, fieldName: string): FieldSpecification | null; getPattern(name: string): SchemaPatternSpecification | null; getPatternRegExp(name: string): RegExp | null; getIndex(name: string): SchemaIndexSpecification | null; }