@getanthill/datastore
Version:
Event-Sourced Datastore
28 lines (27 loc) • 1.46 kB
TypeScript
import type { JSONSchemaType } from 'ajv';
import type { AnyObject } from '../typings';
import Ajv from 'ajv';
export declare function unique(value: any, index: any, self: any): boolean;
export declare function random(): number;
export declare function getDate(str?: string | number | Date): Date;
export declare function getDateNow(): number;
export declare function mergeWithReplacedArrays(_srcValue: AnyObject, objValue: AnyObject): any[] | undefined;
export declare function mapValuesDeep(obj: AnyObject, handler?: (obj: AnyObject, key: string) => AnyObject): AnyObject;
export declare function deepCoerceProp(obj: AnyObject, schema: JSONSchemaType<AnyObject>, fn: (v: AnyObject, s: JSONSchemaType<AnyObject>, p: string[]) => AnyObject, path: string[], name: string): void;
/**
* Deep coerce object against its JSON Schema
*
* @param {object} obj The object to freeze
* @returns {object} The freezed object
*/
export declare function deepCoerce(obj: AnyObject, schema: JSONSchemaType<AnyObject>, fn?: (v: AnyObject, s: JSONSchemaType<AnyObject>, p: string[]) => AnyObject, path?: string[]): AnyObject;
export declare function processExplanationPlan(raw: any): {
stage: any;
executation_time_ms: any;
index_name: any;
keys_examined: any;
docs_examined: any;
winning_plan: any;
raw: any;
};
export declare function validateEntity(validator: Ajv, entity: AnyObject, schema: AnyObject, throwOnInvalidEvent?: boolean): boolean;