<commit_before>import { ValidationError } from '../errors';
import { IHooks } from '../hooks';
import { Model } from '../model';

export type Path = Array<string | number>;

export type PopulateReference = IPopulateMap | true;

export interface IPopulateMap {
  [k: string]: PopulateReference;
}

export interface IPopulateOptions {
  populateReference: PopulateReference;
}

export interface ISanitizeOptions {
  /** Set undefined values to defaults (if configured). Default is false. */
  defaults?: boolean;
  /** Unset all properties that are not provided in the data. Default is false. */
  replace?: boolean;
  /** Parent schema node */
  parent?: IParent;
}

export interface IToObjectOptions {
  /** Turn populated references into references */
  unpopulate?: boolean;
}

export interface IParent<T = any> {
  metaValue: MetaValue<any>;
  path: string | number;
}

export interface ISchemaOptions<TSchema> {
  required?: boolean;
  validate?(schema: TSchema): Promise<void>;
}
<commit_msg>schema: add beforeChange and afterChange hooks<commit_after>import { ValidationError } from '../errors';
import { IHooks } from '../hooks';
import { Model } from '../model';

export type Path = Array<string | number>;

export type PopulateReference = IPopulateMap | true;

export interface IPopulateMap {
  [k: string]: PopulateReference;
}

export interface IPopulateOptions {
  populateReference: PopulateReference;
}

export interface ISanitizeOptions {
  /** Set undefined values to defaults (if configured). Default is false. */
  defaults?: boolean;
  /** Unset all properties that are not provided in the data. Default is false. */
  replace?: boolean;
  /** Parent schema node */
  parent?: IParent;
}

export interface IToObjectOptions {
  /** Turn populated references into references */
  unpopulate?: boolean;
}

export interface IParentMetaValue<T = any> {
  beforeChange(path: Path, metaValue: MetaValue<T>);
  afterChange(path: Path, metaValue: MetaValue<T>);
}

export interface IParent<T = any> {
  metaValue: MetaValue<T> & IParentMetaValue<T>;
  path: string | number;
}

export interface ISchemaOptions<TSchema> {
  required?: boolean;
  validate?(schema: TSchema): Promise<void>;
}

{'fraction_non_alphanumeric': 0.1159090909090909, 'fraction_numerical': 0.0, 'mean_word_length': 4.558080808080808, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2748883', 'n_tokens_mistral': 623, 'n_tokens_neox': 628, 'n_words': 208}