UNPKG

alinea

Version:
19 lines (18 loc) 1.16 kB
import { Field, type FieldMeta, type FieldOptions } from '../Field.js'; import { Schema } from '../Schema.js'; import { type ListMutator, type ListRow } from '../shape/ListShape.js'; import type { RecordShape } from '../shape/RecordShape.js'; export declare class ListField<StoredValue extends ListRow, QueryValue, Options extends FieldOptions<Array<unknown>>> extends Field<Array<StoredValue>, Array<QueryValue>, ListMutator<StoredValue>, Options> { constructor(schema: Schema, shapes: Record<string, RecordShape<any>>, meta: FieldMeta<Array<StoredValue>, Array<QueryValue>, ListMutator<StoredValue>, Options>); } export type ListRowInput<Row extends ListRow, Key extends Row['_type']> = Omit<Extract<Row, { _type: Key; }>, '_type' | '_id' | '_index'>; export declare class ListEditor<StoredRow extends ListRow> { private rows; constructor(rows?: Array<StoredRow>); insertAt<Key extends StoredRow['_type']>(insertAt: number, type: Key, row: ListRowInput<StoredRow, Key>): this; add<Key extends StoredRow['_type']>(type: Key, row: ListRowInput<StoredRow, Key>): this; removeAt(index: number): this; value(): StoredRow[]; }