<commit_before>const DataLoader = require('dataloader')
const { parseAsync } = require('json2csv')
const _ = require('lodash/fp')

const filters = require('../../filters')
const cashOutTx = require('../../../cash-out/cash-out-tx')
const cashInTx = require('../../../cash-in/cash-in-tx')
const transactions = require('../../services/transactions')
const anonymous = require('../../../constants').anonymousCustomer
const logDateFormat = require('../../../logs').logDateFormat

const transactionsLoader = new DataLoader(ids => transactions.getCustomerTransactionsBatch(ids), { cache: false })

const resolvers = {
  Customer: {
    transactions: parent => transactionsLoader.load(parent.id)
  },
  Transaction: {
    isAnonymous: parent => (parent.customerId === anonymous.uuid)
  },
  Query: {
    transactions: (...[, { from, until, limit, offset, deviceId, txClass, machineName, customerName, fiatCode, cryptoCode, toAddress, status, excludeTestingCustomers }]) =>
      transactions.batch(from, until, limit, offset, deviceId, txClass, machineName, customerName, fiatCode, cryptoCode, toAddress, status, excludeTestingCustomers),
    transactionsCsv: (...[, { from, until, limit, offset, txClass, machineName, customerName, fiatCode, cryptoCode, toAddress, status, timezone, excludeTestingCustomers, simplified }]) =>
      transactions.batch(from, until, limit, offset, null, txClass, machineName, customerName, fiatCode, cryptoCode, toAddress, status, excludeTestingCustomers, simplified)
        .then(data => parseAsync(logDateFormat(timezone, data, ['created', 'sendTime', 'publishedAt']))),
    transactionCsv: (...[, { id, txClass, timezone }]) =>
      transactions.getTx(id, txClass).then(data => 
        parseAsync(logDateFormat(timezone, [data], ['created', 'sendTime', 'publishedAt']))
      ),
    txAssociatedDataCsv: (...[, { id, txClass, timezone }]) =>
      transactions.getTxAssociatedData(id, txClass).then(data =>
        parseAsync(logDateFormat(timezone, data, ['created']))
      ),
    transactionFilters: () => filters.transaction()
  },
  Mutation: {
    cancelCashOutTransaction: (...[, { id }]) => cashOutTx.cancel(id),
    cancelCashInTransaction: (...[, { id }]) => cashInTx.cancel(id)
  }
}
<commit_msg>fix: txs resolver<commit_after>const DataLoader = require('dataloader')
const { parseAsync } = require('json2csv')
const _ = require('lodash/fp')

const filters = require('../../filters')
const cashOutTx = require('../../../cash-out/cash-out-tx')
const cashInTx = require('../../../cash-in/cash-in-tx')
const transactions = require('../../services/transactions')
const anonymous = require('../../../constants').anonymousCustomer
const logDateFormat = require('../../../logs').logDateFormat

const transactionsLoader = new DataLoader(ids => transactions.getCustomerTransactionsBatch(ids), { cache: false })

const resolvers = {
  Customer: {
    transactions: parent => transactionsLoader.load(parent.id)
  },
  Transaction: {
    isAnonymous: parent => (parent.customerId === anonymous.uuid)
  },
  Query: {
    transactions: (...[, { from, until, limit, offset, deviceId, txClass, machineName, customerName, fiatCode, cryptoCode, toAddress, status, swept, excludeTestingCustomers }]) =>
      transactions.batch(from, until, limit, offset, deviceId, txClass, machineName, customerName, fiatCode, cryptoCode, toAddress, status, swept, excludeTestingCustomers),
    transactionsCsv: (...[, { from, until, limit, offset, txClass, machineName, customerName, fiatCode, cryptoCode, toAddress, status, swept, timezone, excludeTestingCustomers, simplified }]) =>
      transactions.batch(from, until, limit, offset, null, txClass, machineName, customerName, fiatCode, cryptoCode, toAddress, status, swept, excludeTestingCustomers, simplified)
        .then(data => parseAsync(logDateFormat(timezone, data, ['created', 'sendTime', 'publishedAt']))),
    transactionCsv: (...[, { id, txClass, timezone }]) =>
      transactions.getTx(id, txClass).then(data => 
        parseAsync(logDateFormat(timezone, [data], ['created', 'sendTime', 'publishedAt']))
      ),
    txAssociatedDataCsv: (...[, { id, txClass, timezone }]) =>
      transactions.getTxAssociatedData(id, txClass).then(data =>
        parseAsync(logDateFormat(timezone, data, ['created']))
      ),
    transactionFilters: () => filters.transaction()
  },
  Mutation: {
    cancelCashOutTransaction: (...[, { id }]) => cashOutTx.cancel(id),
    cancelCashInTransaction: (...[, { id }]) => cashInTx.cancel(id)
  }
}

{'fraction_non_alphanumeric': 0.17021748779405238, 'fraction_numerical': 0.0004438526409232135, 'mean_word_length': 4.503052503052503, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 29, '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': '1559800', 'n_tokens_mistral': 1320, 'n_tokens_neox': 1305, 'n_words': 278}