mvom
Version:
Multivalue Object Mapper
26 lines (25 loc) • 1.23 kB
TypeScript
import Document from '../Document';
import type { ForeignKeyDbDefinition } from '../ForeignKeyDbTransformer';
import type Schema from '../Schema';
import type { MvRecord } from '../types';
import BaseSchemaType from './BaseSchemaType';
/** Embedded Schema Type */
declare class EmbeddedType<TSchema extends Schema> extends BaseSchemaType {
/** An instance of Schema representing the the document structure of embedded object contents */
private readonly valueSchema;
constructor(valueSchema: TSchema);
/**
* Cast to embedded data type
* @throws {@link TypeError} Throws if a non-null/non-object is passed
*/
cast(value: unknown): Document<TSchema>;
/** Get value from mv data */
get(record: MvRecord): Document<TSchema>;
/** Set specified embedded document value into mv record */
set(originalRecord: MvRecord, setValue: Document<TSchema>): MvRecord;
/** Validate the embedded document */
validate(document: Document<TSchema>): Map<string, string[]>;
/** Create an array of foreign key definitions that will be validated before save */
transformForeignKeyDefinitionsToDb(document: Document<TSchema>): ForeignKeyDbDefinition[];
}
export default EmbeddedType;