nosql-constraints
Version:
Helpers to manage constrants (i.e. cascade delete) in a NoSQL database
35 lines • 1.88 kB
TypeScript
import { DocumentSchemaAdapter, DocumentSchemaChunk } from '../adapter/schema';
type RefDocTypeLiteral = string | number;
type RefDocType = Record<string, RefDocTypeLiteral>;
type EdgeProperties = {
cascadeDelete?: true;
mapProperties?: Record<string, string>;
};
type ContainerReference = {
containerId: string;
};
type DocumentReference = ContainerReference & {
refDocType?: RefDocType;
};
type Doc2DocConstraint = EdgeProperties & {
refProperties: Record<string, string>;
};
type PartitionReference = ContainerReference & {
partitionKeyProperties: string[];
};
type PartitionReferenceConstraint = Doc2DocConstraint;
export declare class ConstraintFactory {
#private;
addDocumentSchema(containerId: string, schema: DocumentSchemaAdapter): void;
protected findDocumentSchemaChunks(docRef: DocumentReference): DocumentSchemaChunk[];
protected findPartitionSchemaChunks(partitionRef: PartitionReference): DocumentSchemaChunk[];
protected validateDocumentReference(docRef: DocumentReference): void;
protected findChunksForProperty(chunks: DocumentSchemaChunk[], propertyPath: string): DocumentSchemaChunk[] | undefined;
protected validateDoc2DocConstraint(referencing: DocumentReference, constraint: Doc2DocConstraint, referenced: DocumentReference): void;
addDocument2DocumentConstraint(referencing: DocumentReference, constraint: Doc2DocConstraint, referenced: DocumentReference): void;
protected validatePartitionReference(partitionRef: PartitionReference): void;
protected validatePartition2DocConstraint(referencing: PartitionReference, constraint: PartitionReferenceConstraint, referenced: DocumentReference): void;
addPartition2DocumentConstraint(referencing: PartitionReference, constraint: PartitionReferenceConstraint, referenced: DocumentReference): void;
}
export {};
//# sourceMappingURL=factory.d.ts.map