<commit_before>import Ember from 'ember';
import Base from './-base';
import ModelMixin from './-model-mixin';
import { isFunction, isArray } from 'documents/util/assert';

const {
  merge,
  copy
} = Ember;

export default class BaseProxyInternal extends ModelMixin(Base) {

  constructor(store, database, owner, opts) {
    super();
    this.store = store;
    this.database = database;
    this.owner = owner;
    this.opts = this._normalizeOptions(opts);
    this._filter = null;
    this._loader = null;
  }

  _normalizeOptions(opts) {
    opts = merge({ owner: [], document: [] }, opts);
    let { autoload, query, matches, owner, document } = opts;
    isFunction('query', query);
    isFunction('matches', matches);
    isArray('owner', owner);
    isArray('document', document);
    owner = copy(owner);
    document = copy(document);
    return { autoload, owner, document, matches, query };
  }

  //

  _createFilter() {
    let { owner, document, matches } = this.opts;
    return this.database._createInternalFilter(this.owner, { owner, document, matches });<commit_msg>default autoload to true<commit_after>import Ember from 'ember';
import Base from './-base';
import ModelMixin from './-model-mixin';
import { isFunction, isArray } from 'documents/util/assert';

const {
  merge,
  copy
} = Ember;

export default class BaseProxyInternal extends ModelMixin(Base) {

  constructor(store, database, owner, opts) {
    super();
    this.store = store;
    this.database = database;
    this.owner = owner;
    this.opts = this._normalizeOptions(opts);
    this._filter = null;
    this._loader = null;
  }

  _normalizeOptions(opts) {
    opts = merge({ autoload: true, owner: [], document: [] }, opts);
    let { autoload, query, matches, owner, document } = opts;
    isFunction('query', query);
    isFunction('matches', matches);
    isArray('owner', owner);
    isArray('document', document);
    owner = copy(owner);
    document = copy(document);
    return { autoload, owner, document, matches, query };
  }

  //

  _createFilter() {
    let { owner, document, matches } = this.opts;
    return this.database._createInternalFilter(this.owner, { owner, document, matches });
{'fraction_non_alphanumeric': 0.14110150204824762, 'fraction_numerical': 0.0, 'mean_word_length': 3.6176470588235294, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2626249', 'n_tokens_mistral': 666, 'n_tokens_neox': 655, 'n_words': 177}