<commit_before>'use strict';

const { getDataArgument } = require('./data');
const { getFilterArgument } = require('./filter');
const { getOrderArgument } = require('./order');
const { getPaginationArgument } = require('./pagination');
const { getSilentArgument } = require('./silent');
const { getDryrunArgument } = require('./dryrun');
const { getCascadeArgument } = require('./cascade');
const { getParamsArgument } = require('./params');

// Retrieves all resolver arguments, before resolve function is fired
const getArgs = function (def, opts) {
  // Only for top-level actions
  const isTopLevel = ['Query', 'Mutation'].includes(opts.parentDef.model);
  if (!isTopLevel) { return; }

  const optsA = getArgTypes(def, opts);

  return {
    ...getDataArgument(def, optsA),
    ...getFilterArgument(def, optsA),
    ...getCascadeArgument(def, optsA),
    ...getOrderArgument(def, optsA),
    ...getPaginationArgument(def, optsA),
    ...getDryrunArgument(def, optsA),
    ...getSilentArgument(def, optsA),
    ...getParamsArgument(def, optsA),
  };
};

// Builds types used for `data` and `filter` arguments
const getArgTypes = function (def, opts) {
  const { getType } = opts;
  const dataObjectType = getType(def, { ...opts, inputObjectType: 'data' });
  const filterObjectType = getType(
    { ...def, arrayWrapped: true },
    { ...opts, inputObjectType: 'filter' },
  );
  return { ...opts, dataObjectType, filterObjectType };
};

module.exports = {
  getArgs,
};
<commit_msg>Fix args.data being an array of arrays<commit_after>'use strict';

const { getDataArgument } = require('./data');
const { getFilterArgument } = require('./filter');
const { getOrderArgument } = require('./order');
const { getPaginationArgument } = require('./pagination');
const { getSilentArgument } = require('./silent');
const { getDryrunArgument } = require('./dryrun');
const { getCascadeArgument } = require('./cascade');
const { getParamsArgument } = require('./params');

// Retrieves all resolver arguments, before resolve function is fired
const getArgs = function (def, opts) {
  // Only for top-level actions
  const isTopLevel = ['Query', 'Mutation'].includes(opts.parentDef.model);
  if (!isTopLevel) { return; }

  const optsA = getArgTypes(def, opts);

  return {
    ...getDataArgument(def, optsA),
    ...getFilterArgument(def, optsA),
    ...getCascadeArgument(def, optsA),
    ...getOrderArgument(def, optsA),
    ...getPaginationArgument(def, optsA),
    ...getDryrunArgument(def, optsA),
    ...getSilentArgument(def, optsA),
    ...getParamsArgument(def, optsA),
  };
};

// Builds types used for `data` and `filter` arguments
const getArgTypes = function (def, opts) {
  const { getType } = opts;
  const defA = { ...def, arrayWrapped: true };
  const dataObjectType = getType(
    defA,
    { ...opts, inputObjectType: 'data' },
  );
  const filterObjectType = getType(
    defA,
    { ...opts, inputObjectType: 'filter' },
  );
  return { ...opts, dataObjectType, filterObjectType };
};

module.exports = {
  getArgs,
};

{'fraction_non_alphanumeric': 0.16611733684904417, 'fraction_numerical': 0.0, 'mean_word_length': 3.879421221864952, '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': '3407004', 'n_tokens_mistral': 922, 'n_tokens_neox': 923, 'n_words': 228}