<commit_before>import { Observable } from 'rx';
import * as clone from 'clone';

import { wx, ObservableOrProperty, ReadOnlyProperty, Property, Command } from '../../../WebRx';
import { ObjectComparer, SortDirection } from '../../../Utils/Compare';
import { ListViewModel } from '../List/ListViewModel';
import { SearchViewModel, SearchRoutingState } from '../Search/SearchViewModel';
import { PagerViewModel, PagerRoutingState } from '../Pager/PagerViewModel';

export interface SortArgs {
  field: string;
  direction: SortDirection;
}

export interface ProjectionRequest {
  filter?: string;
  regex?: RegExp;
  offset?: number;
  limit?: number;
  sortField?: string;
  sortDirection?: SortDirection;
}

export interface ProjectionResult<TData> {
  items: TData[];
  count: number;
}

export interface DataGridRoutingState {
  search: SearchRoutingState;
  sortBy?: string;
  sortDir?: SortDirection;
  pager: PagerRoutingState;
}

export abstract class BaseDataGridViewModel<TData, TRequest extends ProjectionRequest, TResult extends ProjectionResult<TData>> extends ListViewModel<TData, DataGridRoutingState> {
  public static displayName = 'BaseDataGridViewModel';

  public readonly search: SearchViewModel;
  public readonly pager: PagerViewModel;
  public readonly defaultSortDirection: SortDirection;

  public readonly projectionRequests: ReadOnlyProperty<TRequest>;
  public readonly projectionResults: ReadOnlyProperty<TResult>;
  public readonly projectedItems: ReadOnlyProperty<TData[]>;<commit_msg>fixing defaultSortDirection protection level this should not be read only as it is only assigned a default value at construction but accepts modifications at runtime.<commit_after>import { Observable } from 'rx';
import * as clone from 'clone';

import { wx, ObservableOrProperty, ReadOnlyProperty, Property, Command } from '../../../WebRx';
import { ObjectComparer, SortDirection } from '../../../Utils/Compare';
import { ListViewModel } from '../List/ListViewModel';
import { SearchViewModel, SearchRoutingState } from '../Search/SearchViewModel';
import { PagerViewModel, PagerRoutingState } from '../Pager/PagerViewModel';

export interface SortArgs {
  field: string;
  direction: SortDirection;
}

export interface ProjectionRequest {
  filter?: string;
  regex?: RegExp;
  offset?: number;
  limit?: number;
  sortField?: string;
  sortDirection?: SortDirection;
}

export interface ProjectionResult<TData> {
  items: TData[];
  count: number;
}

export interface DataGridRoutingState {
  search: SearchRoutingState;
  sortBy?: string;
  sortDir?: SortDirection;
  pager: PagerRoutingState;
}

export abstract class BaseDataGridViewModel<TData, TRequest extends ProjectionRequest, TResult extends ProjectionResult<TData>> extends ListViewModel<TData, DataGridRoutingState> {
  public static displayName = 'BaseDataGridViewModel';

  public readonly search: SearchViewModel;
  public readonly pager: PagerViewModel;
  public defaultSortDirection: SortDirection;

  public readonly projectionRequests: ReadOnlyProperty<TRequest>;
  public readonly projectionResults: ReadOnlyProperty<TResult>;
  public readonly projectedItems: ReadOnlyProperty<TData[]>;
{'fraction_non_alphanumeric': 0.09924385633270322, 'fraction_numerical': 0.0, 'mean_word_length': 5.827956989247312, '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': '3221097', 'n_tokens_mistral': 833, 'n_tokens_neox': 826, 'n_words': 256}