<commit_before># frozen_string_literal: true

AnnictSchema = GraphQL::Schema.define do
  query ObjectTypes::Query
  mutation ObjectTypes::Mutation

  use GraphQL::Batch

  id_from_object ->(object, type_definition, _query_ctx) {
    GraphQL::Schema::UniqueWithinType.encode(type_definition.name, object.id)
  }

  object_from_id ->(id, _query_ctx) {
    type_name, item_id = GraphQL::Schema::UniqueWithinType.decode(id)
    Object.const_get(type_name).find(item_id)
  }
<commit_msg>Return nil if can’t get record info<commit_after># frozen_string_literal: true

AnnictSchema = GraphQL::Schema.define do
  query ObjectTypes::Query
  mutation ObjectTypes::Mutation

  use GraphQL::Batch

  id_from_object ->(object, type_definition, _query_ctx) {
    GraphQL::Schema::UniqueWithinType.encode(type_definition.name, object.id)
  }

  object_from_id ->(id, _query_ctx) {
    type_name, item_id = GraphQL::Schema::UniqueWithinType.decode(id)
    return nil if type_name.blank? || item_id.blank?
    Object.const_get(type_name).find(item_id)
  }

{'fraction_non_alphanumeric': 0.1126082771896054, 'fraction_numerical': 0.0, 'mean_word_length': 5.540880503144654, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '6117025', 'n_tokens_mistral': 359, 'n_tokens_neox': 348, 'n_words': 61}