<commit_before>import { remote } from 'electron';
import { Injectable } from '@angular/core';
import { Response, Headers, RequestOptions } from '@angular/http';
import { ProgressHttp } from 'angular-progress-http';
import { Observable, ReplaySubject } from 'rxjs';
import { BundleData, BundleDiffs, Bundle, DiffItem } from './bundle';

import 'rxjs/add/observable/of';
import 'rxjs/add/observable/throw';
import 'rxjs/add/observable/empty';
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/share';
import 'rxjs/add/operator/map';

import * as os from 'os';
import * as fs from 'fs';
import * as path from 'path';
import schemas from '../schemas';
import SharedService from './sharedService';
import { SchemaDict, SchemaColumn } from '../schemas/schema';
import Auth from './auth';

const uuid = require('uuid');
const base64 = require('uuid-base64');
const jetpack = require('fs-jetpack');
const pjson = require('../../../package.json');
const storeSettings = require('../storeSettings.json');

declare var ENV: string;
let SERVER = storeSettings.live_api_url;
if (ENV !== 'production') {
    SERVER = storeSettings.live_api_url;
}


@Injectable()
export default class DataApiService {
    private _desa = new ReplaySubject<any>(1);
    private _auth : Auth = null;

    constructor(private http: ProgressHttp, private sharedService: SharedService) {
        this._auth = this.getAuthFromFile();
    }

    getLocalDesas(): any[] {
        let result = [];
        let fileName = path.join(this.sharedService.getDataDirectory(), "desa.json");

        if (jetpack.exists(fileName))
            result = JSON.parse(jetpack.read(fileName));

        return result;
    }

    getLocalContent(bundleSchemas: SchemaDict, type: string, subType?: string): Bundle {
        let bundle: Bundle = null;
        let jsonFile = this.sharedService.getContentFile(type, subType);
        try {
            if(jetpack.exists(jsonFile))<commit_msg>fix ckan<commit_after>import { remote } from 'electron';
import { Injectable } from '@angular/core';
import { Response, Headers, RequestOptions } from '@angular/http';
import { ProgressHttp } from 'angular-progress-http';
import { Observable, ReplaySubject } from 'rxjs';
import { BundleData, BundleDiffs, Bundle, DiffItem } from './bundle';

import 'rxjs/add/observable/of';
import 'rxjs/add/observable/throw';
import 'rxjs/add/observable/empty';
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/share';
import 'rxjs/add/operator/map';

import * as os from 'os';
import * as fs from 'fs';
import * as path from 'path';
import schemas from '../schemas';
import SharedService from './sharedService';
import { SchemaDict, SchemaColumn } from '../schemas/schema';
import Auth from './auth';

const uuid = require('uuid');
const base64 = require('uuid-base64');
const jetpack = require('fs-jetpack');
const pjson = require('../../../package.json');
const storeSettings = require('../storeSettings.json');

declare var ENV: string;
let SERVER = storeSettings.live_api_url;
if (ENV !== 'production') {
    SERVER = storeSettings.ckan_api_url;
}


@Injectable()
export default class DataApiService {
    private _desa = new ReplaySubject<any>(1);
    private _auth : Auth = null;

    constructor(private http: ProgressHttp, private sharedService: SharedService) {
        this._auth = this.getAuthFromFile();
    }

    getLocalDesas(): any[] {
        let result = [];
        let fileName = path.join(this.sharedService.getDataDirectory(), "desa.json");

        if (jetpack.exists(fileName))
            result = JSON.parse(jetpack.read(fileName));

        return result;
    }

    getLocalContent(bundleSchemas: SchemaDict, type: string, subType?: string): Bundle {
        let bundle: Bundle = null;
        let jsonFile = this.sharedService.getContentFile(type, subType);
        try {
            if(jetpack.exists(jsonFile))
{'fraction_non_alphanumeric': 0.14112799381921196, 'fraction_numerical': 0.0025753283543651817, 'mean_word_length': 3.94147582697201, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2954550', 'n_tokens_mistral': 1160, 'n_tokens_neox': 1131, 'n_words': 306}