<commit_before>import DS from 'ember-data';
import Ember from 'ember';
import Soda from 'npm:soda-js';

export default DS.Adapter.extend({
  findRecord(store, type, id) {
    let adapter = this;
    return new Ember.RSVP.Promise(function(resolve, reject) {
      let consumer = new Soda.Consumer(adapter.get('config.dataRepo'));
      let modelId = `${type.modelName}_id`;
      let data = {};
      data[modelId] = id;
      consumer
        .query()
        .withDataset(adapter.get('dataset'))
        .where(data)
        .limit(1)
        .getRows()
        .on('success', function(data) {
          Ember.run(null, resolve, data);
        })
        .on('error', function(error) {
          Ember.run(null, reject, error);
        });
    });
  },
  findAll() {
    let adapter = this;
    return new Ember.RSVP.Promise(function(resolve, reject) {
      let consumer = new Soda.Consumer(adapter.get('config.dataRepo'));
      consumer
        .query()
        .withDataset(adapter.get('dataset'))
        .limit()
        .getRows()
        .on('success', function(data) {
          Ember.run(null, resolve, data);
        })
        .on('error', function(error) {
          Ember.run(null, reject, error);
        });
    });
  },
  query(store, type, query) {
    let adapter = this;
    return new Ember.RSVP.Promise(function(resolve, reject) {
      let consumer = new Soda.Consumer(adapter.get('config.dataRepo'));
      consumer
        .query()
        .withDataset(adapter.get('dataset'))
        .where(query)
        .limit()
        .getRows()
        .on('success', function(data) {
          Ember.run(null, resolve, data);
        })
        .on('error', function(error) {
          Ember.run(null, reject, error);
        });
    });
  },
});<commit_msg>Refactored adapter<commit_after>import DS from 'ember-data';
import Ember from 'ember';
import Soda from 'npm:soda-js';

export default DS.Adapter.extend({
  findRecord(store, type, id) {
    let adapter = this;
    let consumer = new Soda.Consumer(adapter.get('config.dataRepo'));
    let modelId = `${type.modelName}_id`;
    let data = {};
    data[modelId] = id;
    return new Ember.RSVP.Promise(function(resolve, reject) {
      consumer
        .query()
        .withDataset(adapter.get('dataset'))
        .where(data)
        .limit(1)
        .getRows()
        .on('success', function(data) {
          Ember.run(null, resolve, data);
        })
        .on('error', function(error) {
          Ember.run(null, reject, error);
        });
    });
  },
  findAll() {
    let adapter = this;
    let consumer = new Soda.Consumer(adapter.get('config.dataRepo'));
    return new Ember.RSVP.Promise(function(resolve, reject) {
      consumer
        .query()
        .withDataset(adapter.get('dataset'))
        .getRows()
        .on('success', function(data) {
          Ember.run(null, resolve, data);
        })
        .on('error', function(error) {
          Ember.run(null, reject, error);
        });
    });
  },
  query(store, type, query) {
    let adapter = this;
    let consumer = new Soda.Consumer(adapter.get('config.dataRepo'));
    return new Ember.RSVP.Promise(function(resolve, reject) {
      consumer
        .query()
        .withDataset(adapter.get('dataset'))
        .where(query)
        .getRows()
        .on('success', function(data) {
          Ember.run(null, resolve, data);
        })
        .on('error', function(error) {
          Ember.run(null, reject, error);
        });
    });
  },
});
{'fraction_non_alphanumeric': 0.15901966372185808, 'fraction_numerical': 0.0005699629524080935, 'mean_word_length': 2.2025547445255476, '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': '3917128', 'n_tokens_mistral': 1080, 'n_tokens_neox': 1091, 'n_words': 217}