<commit_before>import Observable from '@sanity/observable'
import createDocumentStore from '@sanity/document-store'
import client from 'part:@sanity/base/client'

function fetchDocumentSnapshot(id) {
  return client.observable.getDocument(id)
    .map(document => {
      return {
        type: 'snapshot',
        document: document
      }
    })
}

function fetchQuerySnapshot(query, params) {
  return client.observable.fetch(query, params)
    .map(documents => {
      return {
        type: 'snapshot',
        documents: documents
      }
    })
}

const serverConnection = {
  byId(id) {
    return Observable.from(client.listen('*[_id == $id]', {id: id}, {events: ['welcome', 'mutation']}))
      .concatMap(event => {
        return (event.type === 'welcome')
          ? Observable.from(fetchDocumentSnapshot(id))
          : Observable.of(event)
      })
  },

  query(query, params) {
    return Observable.from(client.observable.listen(query, params || {}, {events: ['welcome', 'mutation']}))
      .concatMap(event => {
        return (event.type === 'welcome')
          ? Observable.from(fetchQuerySnapshot(query, params))
          : Observable.of(event)
      })
  },

  mutate(mutations) {
    return Observable.from(client.observable.dataRequest('mutate', mutations, {visibility: 'async', returnDocuments: false}))
  },

  delete(id) {
    return Observable.from(client.observable.delete(id, {visibility: 'async', returnDocuments: false}))
  },

  create(doc) {
    return Observable.from(client.observable.create(doc))
  },
  createIfNotExists(doc) {
    return Observable.from(client.observable.createIfNotExists(doc))
  },
  createOrReplace(doc) {
    return Observable.from(client.observable.createOrReplace(doc))
  }
}

export default createDocumentStore({serverConnection})<commit_msg>[base] Don't include results on document store listeners (#579)<commit_after>import Observable from '@sanity/observable'
import createDocumentStore from '@sanity/document-store'
import client from 'part:@sanity/base/client'

function fetchDocumentSnapshot(id) {
  return client.observable.getDocument(id)
    .map(document => {
      return {
        type: 'snapshot',
        document: document
      }
    })
}

function fetchQuerySnapshot(query, params) {
  return client.observable.fetch(query, params)
    .map(documents => {
      return {
        type: 'snapshot',
        documents: documents
      }
    })
}

const serverConnection = {
  byId(id) {
    return Observable.from(client.listen('*[_id == $id]', {id: id}, {includeResult: false, events: ['welcome', 'mutation']}))
      .concatMap(event => {
        return (event.type === 'welcome')
          ? Observable.from(fetchDocumentSnapshot(id))
          : Observable.of(event)
      })
  },

  query(query, params) {
    return Observable.from(client.observable.listen(query, params || {}, {includeResult: false, events: ['welcome', 'mutation']}))
      .concatMap(event => {
        return (event.type === 'welcome')
          ? Observable.from(fetchQuerySnapshot(query, params))
          : Observable.of(event)
      })
  },

  mutate(mutations) {
    return Observable.from(client.observable.dataRequest('mutate', mutations, {visibility: 'async', returnDocuments: false}))
  },

  delete(id) {
    return Observable.from(client.observable.delete(id, {visibility: 'async', returnDocuments: false}))
  },

  create(doc) {
    return Observable.from(client.observable.create(doc))
  },
  createIfNotExists(doc) {
    return Observable.from(client.observable.createIfNotExists(doc))
  },
  createOrReplace(doc) {
    return Observable.from(client.observable.createOrReplace(doc))
  }
}

export default createDocumentStore({serverConnection})
{'fraction_non_alphanumeric': 0.14408602150537633, 'fraction_numerical': 0.0008064516129032258, 'mean_word_length': 3.61090458488228, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '6716106', 'n_tokens_mistral': 1112, 'n_tokens_neox': 1090, 'n_words': 197}