/** * This module is concerned with the static types for the API of building up an ADT. */ import type { SomeSchema, SomeSchemaDef } from '../../core/internal.js'; import type { CodecImplementation, ExtensionsBase, SomeName, StoredRecords } from '../../core/types.js'; import type { SomeRecordController } from '../../record/types/controller.js'; import type { SomeStoredRecord, StoredRecord } from '../../record/types/StoredRecord.js'; import type { DataController } from './Controller.js'; /** * The initial API for building an ADT. */ export type Initial = RecordRequired; /** * The builder API when it is in a state where a record is required. * * @remarks This happens to be the initial state of the builder API. */ export interface RecordRequired { record(name: Name): PostRecord, Rs>; record(recordController: RC): PostRecord, Rs>; } /** * The builder API when it is in a state where a record is required. * * @remarks This happens to be the initial state of the builder API. */ export interface PostRecord extends RecordRequired, Done { schema(schema: Schema): PostSchema, Vs>; schema(schemaDefinition: SchemaDef): PostSchema, Vs>; } /** * The builder API when it is a state of having at least one record defined. * At this point the ADT can be marked as done. */ export interface PostSchema extends RecordRequired, Done { codec(name: Name, implementation: CodecImplementation): PostSchema, Rs>; extend(extensions: Extensions): PostSchema, Rs>; } export interface Done { done(): DataController; } export type StoredADT = { name: Name; }; export declare namespace StoredADT { type Create = StoredADT; } //# sourceMappingURL=Builder.d.ts.map