<commit_before>Meteor.publish('dashboards', function() {
  return Dashboards.find(filterByAccess(this.userId), {
    fields : { title: 1, owner: 1, ownerId: 1, tags: 1 },
    sort   : { title: 1 }
  });
});

Meteor.publishComposite('dashboard', function(_id) {
  return {
    find: function() {
      return Dashboards.find({ $and: [filterByAccess(this.userId), { _id: _id }] });
    },
    children: [{
      find: function(dashboard) {
        return Visualizations.find({ _id: { $in: _.pluck(dashboard.widgets, 'visId') } });
      },
      children: [{
        find: (vis) => Jobs.find(vis.jobId)
      }]
    }]
  };
});

Meteor.publishComposite('dashboardForm', function(_id) {
  return {
    find: function() {
      return Dashboards.find({ $and: [filterByAccess(this.userId), { _id: _id }] });
    },
    children: [{
      find: function(dashboard) {
        return Visualizations.find({ _id: { $in: _.pluck(dashboard.widgets, 'visId') } }, {
          fields: { title: 1, jobId: 1 }
        });
      },
      children: [{
        find: (vis) => Jobs.find(vis.jobId, { fields: { name: 1, owner: 1 } })
      }]
    }]
  };
});


Meteor.publish('jobs', function() {
  return Jobs.find(filterByAccess(this.userId), {
    fields : { name: 1, owner: 1, ownerId: 1, createdAt: 1, schedule: 1, status: 1, alarmStatus: 1 }
  });
});

Meteor.publish('job', function(_id) {
  requireAccess(this.userId, Jobs.findOne(_id));

  return [
    Jobs.find(_id),
    Visualizations.find({ jobId: _id })
  ];
});

Meteor.publishComposite('visualizations', function() {
  return {
    find: () => Jobs.find(filterByAccess(this.userId), { fields: { name: 1, owner: 1 } }),
    children: [{
      find: (job) => Visualizations.find({ jobId: job._id })
    }]
  }
});

Meteor.publish('visualization', function(_id) {
  const vis = Visualizations.findOne(_id);
  requireAccess(this.userId, vis.job());

  return [
    Visualizations.find(_id),<commit_msg>limit visualization data piped to dashboard form<commit_after>Meteor.publish('dashboards', function() {
  return Dashboards.find(filterByAccess(this.userId), {
    fields : { title: 1, owner: 1, ownerId: 1, tags: 1 },
    sort   : { title: 1 }
  });
});

Meteor.publishComposite('dashboard', function(_id) {
  return {
    find: function() {
      return Dashboards.find({ $and: [filterByAccess(this.userId), { _id: _id }] });
    },
    children: [{
      find: function(dashboard) {
        return Visualizations.find({ _id: { $in: _.pluck(dashboard.widgets, 'visId') } });
      },
      children: [{
        find: (vis) => Jobs.find(vis.jobId)
      }]
    }]
  };
});

Meteor.publishComposite('dashboardForm', function(_id) {
  return {
    find: function() {
      return Dashboards.find({ $and: [filterByAccess(this.userId), { _id: _id }] });
    },
    children: [{
      find: function(dashboard) {
        return Visualizations.find({ _id: { $in: _.pluck(dashboard.widgets, 'visId') } }, {
          fields: { title: 1, jobId: 1 }
        });
      },
      children: [{
        find: (vis) => Jobs.find(vis.jobId, { fields: { name: 1, owner: 1 } })
      }]
    }]
  };
});


Meteor.publish('jobs', function() {
  return Jobs.find(filterByAccess(this.userId), {
    fields : { name: 1, owner: 1, ownerId: 1, createdAt: 1, schedule: 1, status: 1, alarmStatus: 1 }
  });
});

Meteor.publish('job', function(_id) {
  requireAccess(this.userId, Jobs.findOne(_id));

  return [
    Jobs.find(_id),
    Visualizations.find({ jobId: _id })
  ];
});

Meteor.publishComposite('visualizations', function() {
  return {
    find: () => Jobs.find(filterByAccess(this.userId), { fields: { name: 1, owner: 1 } }),
    children: [{
      find: (job) => Visualizations.find({ jobId: job._id }, { fields: { title: 1, jobId: 1 } })
    }]
  }
});

Meteor.publish('visualization', function(_id) {
  const vis = Visualizations.findOne(_id);
  requireAccess(this.userId, vis.job());

  return [
    Visualizations.find(_id),
{'fraction_non_alphanumeric': 0.18574677786201668, 'fraction_numerical': 0.00960323477381855, 'mean_word_length': 3.0973084886128364, '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': '6237261', 'n_tokens_mistral': 1414, 'n_tokens_neox': 1345, 'n_words': 264}