<commit_before>import DS from "ember-data";
import Ember from "ember";
import Inflector from "ember-inflector";
import { readOnly } from "@ember/object/computed";
import { inject as service } from "@ember/service";

const { RESTAdapter } = DS;

const host = Ember.testing ? "/" : readOnly("firebase.url");
const inflector = new Inflector(Inflector.defaultRules);
const namespace = Ember.testing ? "" : readOnly("firebase.userId");

export default RESTAdapter.extend({
  host,
  namespace,
  defaultSerializer: "firebase",
  firebase: service("firebase"),

  buildURL() {
    const url = this._super(...arguments);
    return `${url}.json?auth=${this.get("firebase.token")}`;
  },

  createRecord(store, model) {
    return this._super(...arguments).then(payload => {
      const record = Object.assign({}, { id: payload.name });
      return { [inflector.pluralize(model.modelName)]: record };
    });
  },

  findAll(store, model) {
    return this._super(...arguments).then(payload => {
      const records = Object.keys(payload || {}).map(id => {<commit_msg>Fix building url in application's adapter for cli tests<commit_after>import DS from "ember-data";
import Ember from "ember";
import Inflector from "ember-inflector";
import { readOnly } from "@ember/object/computed";
import { inject as service } from "@ember/service";

const { RESTAdapter } = DS;

const host = Ember.testing ? "/" : readOnly("firebase.url");
const inflector = new Inflector(Inflector.defaultRules);
const namespace = Ember.testing ? "" : readOnly("firebase.userId");

export default RESTAdapter.extend({
  host,
  namespace,
  defaultSerializer: "firebase",
  firebase: service("firebase"),

  buildURL() {
    const url = `${this._super(...arguments)}.json?auth=${this.get(
      "firebase.token"
    )}`;
    return url.startsWith("http") ? url : `/${url}`;
  },

  createRecord(store, model) {
    return this._super(...arguments).then(payload => {
      const record = Object.assign({}, { id: payload.name });
      return { [inflector.pluralize(model.modelName)]: record };
    });
  },

  findAll(store, model) {
    return this._super(...arguments).then(payload => {
      const records = Object.keys(payload || {}).map(id => {
{'fraction_non_alphanumeric': 0.16809760506100316, 'fraction_numerical': 0.0, 'mean_word_length': 4.089655172413793, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '5740155', 'n_tokens_mistral': 676, 'n_tokens_neox': 684, 'n_words': 155}