import { TransformDataError } from './errors'; import type Schema from './Schema'; import type { InferDocumentObject } from './Schema'; import type { DbServerDelimiters, DeepOptionalNullable, MvRecord } from './types'; /** Type of data property for constructing a document dependent upon the schema */ export type DocumentData = DeepOptionalNullable>; export interface DocumentConstructorOptions { data?: DocumentData; record?: MvRecord; isSubdocument?: boolean; } export interface BuildForeignKeyDefinitionsResult { filename: string[]; entityName: string; entityIds: string[]; } /** * An intersection type that combines the `Document` class instance with the * inferred shape of the document object based on the schema definition. */ export type DocumentCompositeValue = Document & InferDocumentObject; /** A document object */ declare class Document { #private; [key: string]: unknown; _raw: TSchema extends Schema ? never : MvRecord; /** Array of any errors which occurred during transformation from the database */ _transformationErrors: TransformDataError[]; protected constructor(schema: TSchema, options: DocumentConstructorOptions); /** Create a new Subdocument instance from a record array */ static createSubdocumentFromRecord(schema: TSchema, record: MvRecord): DocumentCompositeValue; /** Create a new Subdocument instance from data */ static createSubdocumentFromData(schema: TSchema, data: DocumentData): DocumentCompositeValue; /** Create a new Document instance from a record string */ static createDocumentFromRecordString(schema: TSchema, recordString: string, dbServerDelimiters: DbServerDelimiters): DocumentCompositeValue; /** Convert a multivalue string to an array */ static convertMvStringToArray(recordString: string, dbServerDelimiters: DbServerDelimiters): MvRecord; /** Transform document structure to multivalue array structure */ transformDocumentToRecord(): MvRecord; /** Build a list of foreign key definitions to be used by the database for foreign key validation */ buildForeignKeyDefinitions(): BuildForeignKeyDefinitionsResult[]; /** Validate document for errors */ validate(): Map; } export default Document;