import type { DbErrorCodes, DbErrors } from '../constants'; import type { ForeignKeyValidationErrorData } from '../errors/ForeignKeyValidationError'; export interface DbDocument { _id: string; __v: string | null; record: string; } interface DbSubroutineResponse { output: TOutput; } interface DbSubroutineOutputDeleteById { result: DbDocument | null; } type DbSubroutineResponseDeleteById = DbSubroutineResponse; export interface DbSubroutineOutputFind { count: number; documents: DbDocument[]; } type DbSubroutineResponseFind = DbSubroutineResponse; interface DbSubroutineOutputFindById { result: DbDocument | null; } type DbSubroutineResponseFindById = DbSubroutineResponse; interface DbSubroutineOutputFindByIds { result: (DbDocument | null)[]; } type DbSubroutineResponseFindByIds = DbSubroutineResponse; interface DbSubroutineOutputIncrement { originalDocument: DbDocument; updatedDocument: DbDocument; } type DbSubroutineResponseIncrement = DbSubroutineResponse; interface DbSubroutineOutputReadFileContentsById { result: string; } type DbSubroutineResponseReadFileContentsById = DbSubroutineResponse; interface DbSubroutineOutputCheckForRecordLock { result: number; } type DbSubroutineResponseCheckForRecordLock = DbSubroutineResponse; /** Characters which delimit strings on multivalue database server */ export interface DbServerDelimiters { /** Record mark */ rm: string; /** Attribute mark */ am: string; /** Value mark */ vm: string; /** Subvalue mark */ svm: string; } /** Multivalue database server limits */ export interface DbServerLimits { /** Maximum number of sort criteria in a query */ maxSort: number; /** Maximum number of conditions in a query */ maxWith: number; /** Maximum length of a query */ maxSentenceLength: number; } interface DbSubroutineOutputGetServerInfo { date: number; time: number; delimiters: DbServerDelimiters; limits: DbServerLimits; } type DbSubroutineResponseGetServerInfo = DbSubroutineResponse; interface DbSubroutineOutputSave { result: DbDocument; } type DbSubroutineResponseSave = DbSubroutineResponse; export type DbSubroutineResponseTypes = DbSubroutineResponseDeleteById | DbSubroutineResponseFind | DbSubroutineResponseFindById | DbSubroutineResponseFindByIds | DbSubroutineResponseIncrement | DbSubroutineResponseReadFileContentsById | DbSubroutineResponseGetServerInfo | DbSubroutineResponseSave | DbSubroutineResponseCheckForRecordLock; export interface DbSubroutineResponseTypesMap { deleteById: DbSubroutineResponseDeleteById; find: DbSubroutineResponseFind; findById: DbSubroutineResponseFindById; findByIds: DbSubroutineResponseFindByIds; increment: DbSubroutineResponseIncrement; readFileContentsById: DbSubroutineResponseReadFileContentsById; getServerInfo: DbSubroutineResponseGetServerInfo; save: DbSubroutineResponseSave; checkForRecordLockById: DbSubroutineResponseCheckForRecordLock; } type ForeignKeyValidationErrorCode = DbErrors['foreignKeyValidation']['code']; type BaseErrorCodes = Exclude; interface DbSubroutineOutputErrorBase { errorCode: BaseErrorCodes; } type DbSubroutineResponseErrorBase = DbSubroutineResponse; interface DbSubroutineOutputErrorForeignKey { errorCode: ForeignKeyValidationErrorCode; foreignKeyValidationErrors: ForeignKeyValidationErrorData[]; } type DbSubroutineResponseErrorForeignKey = DbSubroutineResponse; export type DbSubroutineResponseError = DbSubroutineResponseErrorBase | DbSubroutineResponseErrorForeignKey; export {};