<commit_before>'use babel'

import minimatch from 'minimatch'
import axios from 'axios'

import { JsonSchemaProposalProvider } from '../../json-schema-proposal-provider'
import { CompoundProposalProvider } from './compound-provider'
import { resolve } from '../../json-schema-resolver'
import { wrap } from '../../json-schema'

export default class SchemaStoreProvider {
  constructor() {
    this.compoundProvier = new CompoundProposalProvider()
    this.blackList = {}
  }

  getSchemaInfos() {
    if (this.schemaInfos) {
      return Promise.resolve(this.schemaInfos)
    }
    return axios.get('http://schemastore.org/api/json/catalog.json')
      .then(response => response.data)
      .then(data => data.schemas.filter(schema => Boolean(schema.fileMatch)))
      .then(schemaInfos => {
        this.schemaInfos = schemaInfos
        return schemaInfos
      })
  }

  getProposals(request) {
    const file = request.editor.buffer.file
    if (this.blackList[file.getBaseName()]) {
      console.warn('schemas not available')
      return Promise.resolve([])
    }

    if (!this.compoundProvier.hasProposals(file)) {
      return this.getSchemaInfos()<commit_msg>disable agressive caching in axios (or some underlying http layer)<commit_after>'use babel'

import minimatch from 'minimatch'
import axios from 'axios'

import { JsonSchemaProposalProvider } from '../../json-schema-proposal-provider'
import { CompoundProposalProvider } from './compound-provider'
import { resolve } from '../../json-schema-resolver'
import { wrap } from '../../json-schema'

export default class SchemaStoreProvider {
  constructor() {
    this.compoundProvier = new CompoundProposalProvider()
    this.blackList = {}
  }

  getSchemaInfos() {
    if (this.schemaInfos) {
      return Promise.resolve(this.schemaInfos)
    }
    return axios.get('http://schemastore.org/api/json/catalog.json', { headers: { 'Cache-Control': 'no-cache' } })
      .then(response => response.data)
      .then(data => data.schemas.filter(schema => Boolean(schema.fileMatch)))
      .then(schemaInfos => {
        this.schemaInfos = schemaInfos
        return schemaInfos
      })
  }

  getProposals(request) {
    const file = request.editor.buffer.file
    if (this.blackList[file.getBaseName()]) {
      console.warn('schemas not available')
      return Promise.resolve([])
    }

    if (!this.compoundProvier.hasProposals(file)) {
      return this.getSchemaInfos()
{'fraction_non_alphanumeric': 0.1356001638672675, 'fraction_numerical': 0.0, 'mean_word_length': 3.368515205724508, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '6640502', 'n_tokens_mistral': 742, 'n_tokens_neox': 728, 'n_words': 145}