<commit_before>// @flow

import { manager } from '../../../core/service-providers/manager'

import {
  buildSchema
} from 'graphql'

export const schema = buildSchema(`
  type Asset {
    name: String!
    role: String
  }

  type UserAccountServiceInfo {
    id: String!
    displayName: String!
    hasRoles: Boolean!
    assets: [Asset]
  }

  type UserAccountAggregate {
    email: String!
    isNewUser: Boolean
    services: [UserAccountServiceInfo]!
  }

  type Query {
    accounts(serviceId: String): [UserAccountAggregate]
  }
`)

export const root = {
  accounts: function (args: { serviceId: string }) {
    return manager.download(args.serviceId || 'all')
  }
}<commit_msg>WIP: A Graphiql user can configure a service<commit_after>// @flow
import { manager } from '../../../core/service-providers/manager'
import { configStore } from '../../../core/data/config-store'

import {
  buildSchema
} from 'graphql'

export const schema = buildSchema(`
  type Asset {
    name: String!
    role: String
  }

  type UserAccountServiceInfo {
    id: String!
    displayName: String!
    hasRoles: Boolean!
    assets: [Asset]
  }

  type UserAccountAggregate {
    email: String!
    isNewUser: Boolean
    services: [UserAccountServiceInfo]!
  }

  type ServiceProviderModule {
    id: String!
    displayName: String!
    hasRoles: Boolean!
    configKeys: [String]
  }

  type Query {
    accounts(serviceId: String): [UserAccountAggregate]
  }

  type Mutation {
    configureService(serviceId: String, config: [String]): String
  }
`)

export const root = {
  accounts: function (args: { serviceId: string }) {
    return manager.download(args.serviceId || 'all')
  },
  configureService: function (args: { serviceId: string }) {
    configStore.save(args.serviceId, args.config)
    const service = configStore.get(args.serviceId)
    return `${service} configured!`
  }
}
{'fraction_non_alphanumeric': 0.12380446333687567, 'fraction_numerical': 0.0, 'mean_word_length': 3.250564334085779, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2336653', 'n_tokens_mistral': 588, 'n_tokens_neox': 587, 'n_words': 149}