nosql-constraints
Version:
Helpers to manage constrants (i.e. cascade delete) in a NoSQL database
20 lines (19 loc) • 1.45 kB
TypeScript
import { UnknownStringRecord } from 'typesafe-utilities';
import { IDiGraph } from 'ya-digraph-js';
import { Constraint, ConstraintPathElement, ConstraintVertexWithId, DocumentReference, RefDocType } from './types';
type _ConstraintVertex = DocumentReference<UnknownStringRecord>;
type _ConstraintEdge = Constraint<UnknownStringRecord, UnknownStringRecord>;
type _ConstraintVertexWithId = ConstraintVertexWithId<UnknownStringRecord>;
type _ConstraintPathElement = ConstraintPathElement<UnknownStringRecord, UnknownStringRecord>;
/**
* Constraints class, supporting fast access to the constraints
*/
export declare class Constraints {
readonly constraintsGraph: IDiGraph<_ConstraintVertex, _ConstraintEdge>;
readonly constraintsMap: ReadonlyMap<_ConstraintVertexWithId, _ConstraintPathElement[][]>;
constructor(constraintsGraph: IDiGraph<_ConstraintVertex, _ConstraintEdge>, constraintsMap: ReadonlyMap<_ConstraintVertexWithId, _ConstraintPathElement[][]>);
getDirectConstraints<TDoc extends UnknownStringRecord>(containerId: string, refDocType?: RefDocType<TDoc>, cascadeDelete?: boolean): _ConstraintPathElement[];
getDirectCascadeDeleteConstraints<TDoc extends UnknownStringRecord>(containerId: string, refDocType?: RefDocType<TDoc>): _ConstraintPathElement[];
getDirectNoCascadeDeleteConstraints<TDoc extends UnknownStringRecord>(containerId: string, refDocType?: RefDocType<TDoc>): _ConstraintPathElement[];
}
export {};