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.

17 lines (16 loc) 1.18 kB
import { type ErrorType, type Result } from '../ErrorResult.js'; import { BaseSchema } from './BaseSchema.js'; import { PublishedSchema } from './PublishedSchema.js'; import type { SchemaMigrationAction, SchemaSpecification, SchemaSpecificationUpdate, SchemaSpecificationWithMigrations } from './SchemaSpecification.js'; export declare class Schema<TSpec extends SchemaSpecification | SchemaSpecificationWithMigrations = SchemaSpecification> extends BaseSchema<TSpec> { private cachedPublishedSchema; static createAndValidate(update: SchemaSpecificationUpdate): Result<Schema, typeof ErrorType.BadRequest>; constructor(spec: TSpec); validate(): Result<void, typeof ErrorType.BadRequest>; toPublishedSchema(): PublishedSchema; } export declare class SchemaWithMigrations extends Schema<SchemaSpecificationWithMigrations> { static createAndValidate(update: SchemaSpecificationUpdate): Result<SchemaWithMigrations, typeof ErrorType.BadRequest>; updateAndValidate(update: SchemaSpecificationUpdate): Result<SchemaWithMigrations, typeof ErrorType.BadRequest>; collectMigrationActionsSinceVersion(oldSchemaVersion: number): SchemaMigrationAction[]; }