<commit_before>import { Meteor } from 'meteor/meteor';
import { AuthorityManager } from './../../authority/server/authority-manager';
import { proseMeteorConfig } from './../../config/server/prosemeteor-config';
/**
* Main ProseMeteor server class that instantiates all of ProseMeteor on the server.
*/
export class ProseMeteorServer {
  /*
  * Main ProseMeteor class on the server.
  * @param {Object} params
  * @param {String} params.protocol              protocol this server uses ('http' or 'https')
  * @param {Number} [params.snapshotIntervalMs]  interval in milliseconds that documents are backed up to a snapshot in db
  * @constructor
  */
  constructor ({
    // set default config values if not provided.
    protocol = 'http',                  // protocol this application's servers are communicating on
    snapshotIntervalMs = 5000,          // how often documents are backed up in a snapshot when open
    healthCheckIntervalMs = 1000 * 30,  // how often health checks are run against all other available application servers
    failedHealthChecksThreshold = 5,    // number of failed consecutive health checks that leads to a server being
                                        //      removed from the registry of servers available to host Authorities
    docActivityTimeoutMs = (1000 * 60) * 3  // how long a document will remain in memory without any user activity. defaults to 3 minutes
   }) {
    // create streamer for event communication with client
    this.streamerServer = new Meteor.Streamer('prosemirror-pipe', { retransmit: false });
    this.streamerServer.allowRead('all');
    this.streamerServer.allowWrite('all');

    // set all config values
    proseMeteorConfig.protocol = protocol;
    proseMeteorConfig.snapshotIntervalMs = snapshotIntervalMs;
    proseMeteorConfig.healthCheckIntervalMs = healthCheckIntervalMs;
    proseMeteorConfig.failedHealthChecksThreshold = failedHealthChecksThreshold;
    proseMeteorConfig.docActivityTimeoutMs = docActivityTimeoutMs;

    // create authority manager  to create, delete authorities and communicate with clients
    this.authorityManager = new AuthorityManager({
      streamer: this.streamerServer
    });
  }
}
<commit_msg>grab auth hooks in proseMeteorServer constructor<commit_after>import { Meteor } from 'meteor/meteor';
import { AuthorityManager } from './../../authority/server/authority-manager';
import { proseMeteorConfig } from './../../config/server/prosemeteor-config';
/**
* Main ProseMeteor server class that instantiates all of ProseMeteor on the server.
*/
export class ProseMeteorServer {
  /*
  * Main ProseMeteor class on the server.
  * @param {Object} params
  * @param {String} params.protocol              protocol this server uses ('http' or 'https')
  * @param {Number} [params.snapshotIntervalMs]  interval in milliseconds that documents are backed up to a snapshot in db
  * @constructor
  */
  constructor ({
    // set default config values if not provided.
    protocol = 'http',                  // protocol this application's servers are communicating on
    snapshotIntervalMs = 5000,          // how often documents are backed up in a snapshot when open
    healthCheckIntervalMs = 1000 * 30,  // how often health checks are run against all other available application servers
    failedHealthChecksThreshold = 5,    // number of failed consecutive health checks that leads to a server being
                                        //      removed from the registry of servers available to host Authorities
    docActivityTimeoutMs = (1000 * 60) * 3,  // how long a document will remain in memory without any user activity. defaults to 3 minutes,
    auth: {                             // authentication hooks. default everything to true (public)
      canUserViewDoc = () => true,
      canUserEditDoc = () => true,
      canUserDeleteDoc  = () => true
    }
  }) {
    // create streamer for event communication with client
    this.streamerServer = new Meteor.Streamer('prosemirror-pipe', { retransmit: false });
    this.streamerServer.allowRead('all');
    this.streamerServer.allowWrite('all');

    // set all config values
    proseMeteorConfig.protocol = protocol;
    proseMeteorConfig.snapshotIntervalMs = snapshotIntervalMs;
    proseMeteorConfig.healthCheckIntervalMs = healthCheckIntervalMs;
    proseMeteorConfig.failedHealthChecksThreshold = failedHealthChecksThreshold;
    proseMeteorConfig.docActivityTimeoutMs = docActivityTimeoutMs;

    // create authority manager  to create, delete authorities and communicate with clients
    this.authorityManager = new AuthorityManager({
      streamer: this.streamerServer
    });
  }
}

{'fraction_non_alphanumeric': 0.0815845824411135, 'fraction_numerical': 0.008137044967880086, 'mean_word_length': 3.2195121951219514, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6268613', 'n_tokens_mistral': 1228, 'n_tokens_neox': 1151, 'n_words': 411}