Add userimports reducer to root reducer

Add userimports reducer to root reducer

--- client/app/reducers/app/index.js
+++ client/app/reducers/app/index.js
@@ -6,6 +6,7 @@
 import feed from 'reducers/app/feedReducer';
 import annotations from 'reducers/app/annotations';
 import deckManagement from 'reducers/app/deckManagementReducer';
+import userImports from 'reducers/app/userImportsReducer';
 import deckImport from 'reducers/app/deckImportReducer';
 import presentationView from 'reducers/app/presentationViewReducer';

@@ -16,6 +17,7 @@
   feed,
   annotations,
   deckManagement,
+  userImports,
   deckImport,
   presentationView,
 });

<|original_code|>
import { combineReducers } from 'redux';

import authentication from 'reducers/app/authenticationReducer';
import confirmEmail from 'reducers/app/confirmEmailReducer';
import slideEditor from 'reducers/app/slide-editor';
import feed from 'reducers/app/feedReducer';
import annotations from 'reducers/app/annotations';
import deckManagement from 'reducers/app/deckManagementReducer';
import deckImport from 'reducers/app/deckImportReducer';
import presentationView from 'reducers/app/presentationViewReducer';

const app = combineReducers({
  authentication,
  confirmEmail,
  slideEditor,
  feed,
  annotations,
  deckManagement,
  deckImport,
  presentationView,
});

export default app;

<|edits_diff|>
--- client/app/reducers/app/index.js
+++ client/app/reducers/app/index.js
@@ -6,6 +6,7 @@
 import feed from 'reducers/app/feedReducer';
 import annotations from 'reducers/app/annotations';
 import deckManagement from 'reducers/app/deckManagementReducer';
+import userImports from 'reducers/app/userImportsReducer';
 import deckImport from 'reducers/app/deckImportReducer';
 import presentationView from 'reducers/app/presentationViewReducer';

<|current_version|>
import { combineReducers } from 'redux';

import authentication from 'reducers/app/authenticationReducer';
import confirmEmail from 'reducers/app/confirmEmailReducer';
import slideEditor from 'reducers/app/slide-editor';
import feed from 'reducers/app/feedReducer';
import annotations from 'reducers/app/annotations';
import deckManagement from 'reducers/app/deckManagementReducer';
import userImports from 'reducers/app/userImportsReducer';
import deckImport from 'reducers/app/deckImportReducer';
import presentationView from 'reducers/app/presentationViewReducer';

const app = combineReducers({
  authentication,
  confirmEmail,
  slideEditor,
  feed,
  annotations,
  deckManagement,
  deckImport,
  presentationView,
});

export default app;

<|next_version|>
import { combineReducers } from 'redux';

import authentication from 'reducers/app/authenticationReducer';
import confirmEmail from 'reducers/app/confirmEmailReducer';
import slideEditor from 'reducers/app/slide-editor';
import feed from 'reducers/app/feedReducer';
import annotations from 'reducers/app/annotations';
import deckManagement from 'reducers/app/deckManagementReducer';
import userImports from 'reducers/app/userImportsReducer';
import deckImport from 'reducers/app/deckImportReducer';
import presentationView from 'reducers/app/presentationViewReducer';

const app = combineReducers({
  authentication,
  confirmEmail,
  slideEditor,
  feed,
  annotations,
  deckManagement,
  userImports,
  deckImport,
  presentationView,
});

export default app;


Add a first way to store information of current logged in user

--- public/assets/app/app.js
+++ public/assets/app/app.js
@@ -8,10 +8,15 @@

 	var App = new Marionette.Application();

+	// Add the main region
 	App.addRegions({
 		root: '#approot'
 	});

+	// This will store the user information
+	App.user = null;
+
+	// Catch page error event
 	App.vent.on('page:error', function()
 	{
 		require(['view/error'], function(ErrorView)
@@ -21,6 +26,7 @@
 		});
 	});

+	// Catch page login event
 	App.vent.on('page:login', function()
 	{
 		require(['view/login'], function(LoginView)
@@ -29,11 +35,13 @@
 		});
 	});

+	// Catch page logout event
 	App.vent.on('page:logout', function()
 	{
 		console.log('Do logout process');
 	});

+	// Catch welcome page event
 	App.vent.on('page:welcome', function()
 	{
 		require(['view/welcome'], function(WelcomeView)
@@ -42,6 +50,7 @@
 		});
 	});

+	// Launch application once all is loaded
 	App.addInitializer(function(options)
 	{
 		options.app = App;

<|original_code|>
define([
	'marionette',
	'router',
	'module/account/router',
], function (Marionette, AppRouter, AccountRouter)
{
	"use strict";

	var App = new Marionette.Application();

	App.addRegions({
		root: '#approot'
	});

	App.vent.on('page:error', function()
	{
		require(['view/error'], function(ErrorView)
		{
			var errorView = new ErrorView({app: App});
			App.root.show(errorView);
		});
	});

	App.vent.on('page:login', function()
	{
		require(['view/login'], function(LoginView)
		{
			App.root.show(new LoginView({app: App}));
		});
	});

	App.vent.on('page:logout', function()
	{
		console.log('Do logout process');
	});

	App.vent.on('page:welcome', function()
	{
		require(['view/welcome'], function(WelcomeView)
		{
			App.root.show(new WelcomeView({app: App}));
		});
	});

	App.addInitializer(function(options)
	{
		options.app = App;

		this.router = new AppRouter(options);
		this.accountRouter = new AccountRouter(options);

		App.vent.trigger('page:welcome');
	});

	return App;
});

<|edits_diff|>
--- public/assets/app/app.js
+++ public/assets/app/app.js
@@ -8,10 +8,15 @@

 	var App = new Marionette.Application();

+	// Add the main region
 	App.addRegions({
 		root: '#approot'
 	});

+	// This will store the user information
+	App.user = null;
+
+	// Catch page error event
 	App.vent.on('page:error', function()
 	{
 		require(['view/error'], function(ErrorView)
@@ -21,6 +26,7 @@
 		});
 	});

+	// Catch page login event
 	App.vent.on('page:login', function()
 	{
 		require(['view/login'], function(LoginView)
@@ -29,11 +35,13 @@
 		});
 	});

+	// Catch page logout event
 	App.vent.on('page:logout', function()
 	{
 		console.log('Do logout process');
 	});

+	// Catch welcome page event
 	App.vent.on('page:welcome', function()
 	{
 		require(['view/welcome'], function(WelcomeView)
<|current_version|>
define([
	'marionette',
	'router',
	'module/account/router',
], function (Marionette, AppRouter, AccountRouter)
{
	"use strict";

	var App = new Marionette.Application();

	// Add the main region
	App.addRegions({
		root: '#approot'
	});

	// This will store the user information
	App.user = null;

	// Catch page error event
	App.vent.on('page:error', function()
	{
		require(['view/error'], function(ErrorView)
		{
			var errorView = new ErrorView({app: App});
			App.root.show(errorView);
		});
	});

	// Catch page login event
	App.vent.on('page:login', function()
	{
		require(['view/login'], function(LoginView)
		{
			App.root.show(new LoginView({app: App}));
		});
	});

	// Catch page logout event
	App.vent.on('page:logout', function()
	{
		console.log('Do logout process');
	});

	// Catch welcome page event
	App.vent.on('page:welcome', function()
	{
		require(['view/welcome'], function(WelcomeView)
		{
			App.root.show(new WelcomeView({app: App}));
		});
	});

	App.addInitializer(function(options)
	{
		options.app = App;

		this.router = new AppRouter(options);
		this.accountRouter = new AccountRouter(options);

		App.vent.trigger('page:welcome');
	});

	return App;
});

<|next_version|>
define([
	'marionette',
	'router',
	'module/account/router',
], function (Marionette, AppRouter, AccountRouter)
{
	"use strict";

	var App = new Marionette.Application();

	// Add the main region
	App.addRegions({
		root: '#approot'
	});

	// This will store the user information
	App.user = null;

	// Catch page error event
	App.vent.on('page:error', function()
	{
		require(['view/error'], function(ErrorView)
		{
			var errorView = new ErrorView({app: App});
			App.root.show(errorView);
		});
	});

	// Catch page login event
	App.vent.on('page:login', function()
	{
		require(['view/login'], function(LoginView)
		{
			App.root.show(new LoginView({app: App}));
		});
	});

	// Catch page logout event
	App.vent.on('page:logout', function()
	{
		console.log('Do logout process');
	});

	// Catch welcome page event
	App.vent.on('page:welcome', function()
	{
		require(['view/welcome'], function(WelcomeView)
		{
			App.root.show(new WelcomeView({app: App}));
		});
	});

	// Launch application once all is loaded
	App.addInitializer(function(options)
	{
		options.app = App;

		this.router = new AppRouter(options);
		this.accountRouter = new AccountRouter(options);

		App.vent.trigger('page:welcome');
	});

	return App;
});


Add special case for directory

Add special case for directory

--- bin/projects-get.js
+++ bin/projects-get.js
@@ -13,6 +13,7 @@
 var util = require('util');

 var storage = require('../lib/storage.js');
+var utilities = require('../lib/utilities.js');

 program.option('--porcelain', 'Get the value in a machine-readable way');

@@ -33,6 +34,11 @@

   var project = storage.getProjectOrDie(name);

+  // XXX: Store the expanded directory instead? This feels hacky...
+  if (attribute === 'directory') {
+    project.directory = utilities.expand(project.directory);
+  }
+
   if (program.porcelain) {
     console.log(project[attribute]);
   } else {

<|original_code|>
#!/usr/bin/env node

exports.command = {
  description: 'get an attribute for a project',
  arguments: '<project> <attribute>'
};

if (require.main !== module) {
  return;
}

var program = require('commander');
var util = require('util');

var storage = require('../lib/storage.js');

program.option('--porcelain', 'Get the value in a machine-readable way');

program._name = 'get';
program.usage('<project> <attribute> <value>');
program.parse(process.argv);

storage.setup(function () {
  if (program.args.length !== 2) {
    console.error('Please specify a project and attribute.');

    process.exit(1);
  }

  // TODO: Support '.' for the project in the current directory
  var name = program.args[0];
  var attribute = program.args[1];

  var project = storage.getProjectOrDie(name);

  if (program.porcelain) {
    console.log(project[attribute]);
  } else {
    console.log(util.format('%s:%s: "%s"', project.name, attribute,
      project[attribute]));
  }
});

<|edits_diff|>
--- bin/projects-get.js
+++ bin/projects-get.js
@@ -13,6 +13,7 @@
 var util = require('util');

 var storage = require('../lib/storage.js');
+var utilities = require('../lib/utilities.js');

 program.option('--porcelain', 'Get the value in a machine-readable way');

<|current_version|>
#!/usr/bin/env node

exports.command = {
  description: 'get an attribute for a project',
  arguments: '<project> <attribute>'
};

if (require.main !== module) {
  return;
}

var program = require('commander');
var util = require('util');

var storage = require('../lib/storage.js');
var utilities = require('../lib/utilities.js');

program.option('--porcelain', 'Get the value in a machine-readable way');

program._name = 'get';
program.usage('<project> <attribute> <value>');
program.parse(process.argv);

storage.setup(function () {
  if (program.args.length !== 2) {
    console.error('Please specify a project and attribute.');

    process.exit(1);
  }

  // TODO: Support '.' for the project in the current directory
  var name = program.args[0];
  var attribute = program.args[1];

  var project = storage.getProjectOrDie(name);

  if (program.porcelain) {
    console.log(project[attribute]);
  } else {
    console.log(util.format('%s:%s: "%s"', project.name, attribute,
      project[attribute]));
  }
});

<|next_version|>
#!/usr/bin/env node

exports.command = {
  description: 'get an attribute for a project',
  arguments: '<project> <attribute>'
};

if (require.main !== module) {
  return;
}

var program = require('commander');
var util = require('util');

var storage = require('../lib/storage.js');
var utilities = require('../lib/utilities.js');

program.option('--porcelain', 'Get the value in a machine-readable way');

program._name = 'get';
program.usage('<project> <attribute> <value>');
program.parse(process.argv);

storage.setup(function () {
  if (program.args.length !== 2) {
    console.error('Please specify a project and attribute.');

    process.exit(1);
  }

  // TODO: Support '.' for the project in the current directory
  var name = program.args[0];
  var attribute = program.args[1];

  var project = storage.getProjectOrDie(name);

  // XXX: Store the expanded directory instead? This feels hacky...
  if (attribute === 'directory') {
    project.directory = utilities.expand(project.directory);
  }

  if (program.porcelain) {
    console.log(project[attribute]);
  } else {
    console.log(util.format('%s:%s: "%s"', project.name, attribute,
      project[attribute]));
  }
});


Check for input types in methods

Check for input types in methods

--- packages/category/both/collections/categories.js
+++ packages/category/both/collections/categories.js
@@ -34,6 +34,8 @@

 Meteor.methods({
   createCategory: function (category) {
+    check(category, Object);
+
     var maxPosition = Categories.find().count();

     _.extend(category, {
@@ -46,6 +48,9 @@
     return categoryId;
   },
   updateCategory: function (modifier, categoryId) {
+    check(modifier, Object);
+    check(categoryId, String);
+
     var categoryName = modifier.$set.name;

     // Generate a new slug

<|original_code|>
Categories = new Mongo.Collection('categories');

Schema.categories = new SimpleSchema({
  name: {
    type: String
  },
  slug: {
    type: String,
    index: true,
    unique: true
  },
  description: {
    type: String
  },
  position: {
    type: Number
  },
  topicCount: {
    type: Number,
    defaultValue: 0
  },
  createdAt: {
    type: Date,
    defaultValue: new Date(),
    denyUpdate: true
  }
});

Categories.attachSchema(Schema.categories);

Categories.simpleSchema().messages({
  notUnique: 'A duplicate slug exists.'
});

Meteor.methods({
  createCategory: function (category) {
    var maxPosition = Categories.find().count();

    _.extend(category, {
      slug: getSlug(category.name),
      position: maxPosition + 1
    });

    var categoryId = Categories.insert(category);

    return categoryId;
  },
  updateCategory: function (modifier, categoryId) {
    var categoryName = modifier.$set.name;

    // Generate a new slug
    modifier.$set.slug = getSlug(categoryName);

    Categories.update(categoryId, modifier);

    var category = Categories.findOne(categoryId);

    return category;
  },
  incrementTopicCount: function (categoryId) {
    check(categoryId, String);

    Categories.update(categoryId, {$inc: {topicCount: 1}});
  },
  removeCategory: function (categoryId) {
    check(categoryId, String);

    Categories.remove(categoryId);
    //TODO: call removeTopic that removes topic and all its posts
    Topics.remove({categoryId: categoryId});
  }
});

<|edits_diff|>
--- packages/category/both/collections/categories.js
+++ packages/category/both/collections/categories.js
@@ -34,6 +34,8 @@

 Meteor.methods({
   createCategory: function (category) {
+    check(category, Object);
+
     var maxPosition = Categories.find().count();

     _.extend(category, {
<|current_version|>
Categories = new Mongo.Collection('categories');

Schema.categories = new SimpleSchema({
  name: {
    type: String
  },
  slug: {
    type: String,
    index: true,
    unique: true
  },
  description: {
    type: String
  },
  position: {
    type: Number
  },
  topicCount: {
    type: Number,
    defaultValue: 0
  },
  createdAt: {
    type: Date,
    defaultValue: new Date(),
    denyUpdate: true
  }
});

Categories.attachSchema(Schema.categories);

Categories.simpleSchema().messages({
  notUnique: 'A duplicate slug exists.'
});

Meteor.methods({
  createCategory: function (category) {
    check(category, Object);

    var maxPosition = Categories.find().count();

    _.extend(category, {
      slug: getSlug(category.name),
      position: maxPosition + 1
    });

    var categoryId = Categories.insert(category);

    return categoryId;
  },
  updateCategory: function (modifier, categoryId) {
    var categoryName = modifier.$set.name;

    // Generate a new slug
    modifier.$set.slug = getSlug(categoryName);

    Categories.update(categoryId, modifier);

    var category = Categories.findOne(categoryId);

    return category;
  },
  incrementTopicCount: function (categoryId) {
    check(categoryId, String);

    Categories.update(categoryId, {$inc: {topicCount: 1}});
  },
  removeCategory: function (categoryId) {
    check(categoryId, String);

    Categories.remove(categoryId);
    //TODO: call removeTopic that removes topic and all its posts
    Topics.remove({categoryId: categoryId});
  }
});

<|next_version|>
Categories = new Mongo.Collection('categories');

Schema.categories = new SimpleSchema({
  name: {
    type: String
  },
  slug: {
    type: String,
    index: true,
    unique: true
  },
  description: {
    type: String
  },
  position: {
    type: Number
  },
  topicCount: {
    type: Number,
    defaultValue: 0
  },
  createdAt: {
    type: Date,
    defaultValue: new Date(),
    denyUpdate: true
  }
});

Categories.attachSchema(Schema.categories);

Categories.simpleSchema().messages({
  notUnique: 'A duplicate slug exists.'
});

Meteor.methods({
  createCategory: function (category) {
    check(category, Object);

    var maxPosition = Categories.find().count();

    _.extend(category, {
      slug: getSlug(category.name),
      position: maxPosition + 1
    });

    var categoryId = Categories.insert(category);

    return categoryId;
  },
  updateCategory: function (modifier, categoryId) {
    check(modifier, Object);
    check(categoryId, String);

    var categoryName = modifier.$set.name;

    // Generate a new slug
    modifier.$set.slug = getSlug(categoryName);

    Categories.update(categoryId, modifier);

    var category = Categories.findOne(categoryId);

    return category;
  },
  incrementTopicCount: function (categoryId) {
    check(categoryId, String);

    Categories.update(categoryId, {$inc: {topicCount: 1}});
  },
  removeCategory: function (categoryId) {
    check(categoryId, String);

    Categories.remove(categoryId);
    //TODO: call removeTopic that removes topic and all its posts
    Topics.remove({categoryId: categoryId});
  }
});


Add feature flag for enabling partial rendering in Relay Hooks by default

Reviewed By: josephsavona

Differential Revision: D16768104

fbshipit-source-id: 878b99fb4a29a1e8283432f579ed4d0c18813617

--- packages/relay-runtime/util/RelayFeatureFlags.js
+++ packages/relay-runtime/util/RelayFeatureFlags.js
@@ -13,6 +13,7 @@
 type FeatureFlags = {|
   ENABLE_VARIABLE_CONNECTION_KEY: boolean,
   ENABLE_CONNECTION_RESOLVERS: boolean,
+  ENABLE_PARTIAL_RENDERING_DEFAULT: boolean,
   USE_RECORD_SOURCE_MAP_IMPL: boolean,
 |};

@@ -20,6 +21,7 @@
   // T45504512: new connection model
   ENABLE_VARIABLE_CONNECTION_KEY: false,
   ENABLE_CONNECTION_RESOLVERS: false,
+  ENABLE_PARTIAL_RENDERING_DEFAULT: false,
   USE_RECORD_SOURCE_MAP_IMPL: false,
 };

<|original_code|>
/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow strict
 * @format
 */

'use strict';

type FeatureFlags = {|
  ENABLE_VARIABLE_CONNECTION_KEY: boolean,
  ENABLE_CONNECTION_RESOLVERS: boolean,
  USE_RECORD_SOURCE_MAP_IMPL: boolean,
|};

const RelayFeatureFlags: FeatureFlags = {
  // T45504512: new connection model
  ENABLE_VARIABLE_CONNECTION_KEY: false,
  ENABLE_CONNECTION_RESOLVERS: false,
  USE_RECORD_SOURCE_MAP_IMPL: false,
};

module.exports = RelayFeatureFlags;

<|edits_diff|>
--- packages/relay-runtime/util/RelayFeatureFlags.js
+++ packages/relay-runtime/util/RelayFeatureFlags.js
@@ -13,6 +13,7 @@
 type FeatureFlags = {|
   ENABLE_VARIABLE_CONNECTION_KEY: boolean,
   ENABLE_CONNECTION_RESOLVERS: boolean,
+  ENABLE_PARTIAL_RENDERING_DEFAULT: boolean,
   USE_RECORD_SOURCE_MAP_IMPL: boolean,
 |};

<|current_version|>
/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow strict
 * @format
 */

'use strict';

type FeatureFlags = {|
  ENABLE_VARIABLE_CONNECTION_KEY: boolean,
  ENABLE_CONNECTION_RESOLVERS: boolean,
  ENABLE_PARTIAL_RENDERING_DEFAULT: boolean,
  USE_RECORD_SOURCE_MAP_IMPL: boolean,
|};

const RelayFeatureFlags: FeatureFlags = {
  // T45504512: new connection model
  ENABLE_VARIABLE_CONNECTION_KEY: false,
  ENABLE_CONNECTION_RESOLVERS: false,
  USE_RECORD_SOURCE_MAP_IMPL: false,
};

module.exports = RelayFeatureFlags;

<|next_version|>
/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow strict
 * @format
 */

'use strict';

type FeatureFlags = {|
  ENABLE_VARIABLE_CONNECTION_KEY: boolean,
  ENABLE_CONNECTION_RESOLVERS: boolean,
  ENABLE_PARTIAL_RENDERING_DEFAULT: boolean,
  USE_RECORD_SOURCE_MAP_IMPL: boolean,
|};

const RelayFeatureFlags: FeatureFlags = {
  // T45504512: new connection model
  ENABLE_VARIABLE_CONNECTION_KEY: false,
  ENABLE_CONNECTION_RESOLVERS: false,
  ENABLE_PARTIAL_RENDERING_DEFAULT: false,
  USE_RECORD_SOURCE_MAP_IMPL: false,
};

module.exports = RelayFeatureFlags;


Add scroll position function calls

Add scroll position function calls

--- WiffleChat.js
+++ WiffleChat.js
@@ -32,10 +32,15 @@

           document.getElementById('message').value = '';
           message.value = '';
+          scrollPosition();
         }
       }
     }
   };
+
+$(document).ready(function(){
+  scrollPosition();
+});

 if (Meteor.isServer) {
   Meteor.startup(function () {

<|original_code|>
if (Meteor.isClient) {

  Accounts.ui.config({
     passwordSignupFields: 'USERNAME_ONLY'
  });

  Template.messages.helpers({
      messages: function() {
          return Messages.find({}, { sort: { time: 1}});
      }
  });

  var scrollPosition = function() {
    $('#messages').scrollTop($('#messages')[0].scrollHeight);
  };

  Template.input.events = {
    'keydown input#message' : function (event) {
      if (event.which == 13) {
        if (Meteor.user())
          var name = Meteor.user().username;
        else
          var name = 'Anonymous';
        var message = document.getElementById('message');

        if (message.value != '') {
          Messages.insert({
            name: name,
            message: message.value,
            time: Date.now(),
          });

          document.getElementById('message').value = '';
          message.value = '';
        }
      }
    }
  };

if (Meteor.isServer) {
  Meteor.startup(function () {
    // code to run on server at startup
  });
}
}

<|edits_diff|>
--- WiffleChat.js
+++ WiffleChat.js
@@ -32,6 +32,7 @@

           document.getElementById('message').value = '';
           message.value = '';
+          scrollPosition();
         }
       }
     }
<|current_version|>
if (Meteor.isClient) {

  Accounts.ui.config({
     passwordSignupFields: 'USERNAME_ONLY'
  });

  Template.messages.helpers({
      messages: function() {
          return Messages.find({}, { sort: { time: 1}});
      }
  });

  var scrollPosition = function() {
    $('#messages').scrollTop($('#messages')[0].scrollHeight);
  };

  Template.input.events = {
    'keydown input#message' : function (event) {
      if (event.which == 13) {
        if (Meteor.user())
          var name = Meteor.user().username;
        else
          var name = 'Anonymous';
        var message = document.getElementById('message');

        if (message.value != '') {
          Messages.insert({
            name: name,
            message: message.value,
            time: Date.now(),
          });

          document.getElementById('message').value = '';
          message.value = '';
          scrollPosition();
        }
      }
    }
  };

if (Meteor.isServer) {
  Meteor.startup(function () {
    // code to run on server at startup
  });
}
}

<|next_version|>
if (Meteor.isClient) {

  Accounts.ui.config({
     passwordSignupFields: 'USERNAME_ONLY'
  });

  Template.messages.helpers({
      messages: function() {
          return Messages.find({}, { sort: { time: 1}});
      }
  });

  var scrollPosition = function() {
    $('#messages').scrollTop($('#messages')[0].scrollHeight);
  };

  Template.input.events = {
    'keydown input#message' : function (event) {
      if (event.which == 13) {
        if (Meteor.user())
          var name = Meteor.user().username;
        else
          var name = 'Anonymous';
        var message = document.getElementById('message');

        if (message.value != '') {
          Messages.insert({
            name: name,
            message: message.value,
            time: Date.now(),
          });

          document.getElementById('message').value = '';
          message.value = '';
          scrollPosition();
        }
      }
    }
  };

$(document).ready(function(){
  scrollPosition();
});

if (Meteor.isServer) {
  Meteor.startup(function () {
    // code to run on server at startup
  });
}
}


Add loading status, and response status from errors to verification scope.

--- src/verification/scripts/directives.js
+++ src/verification/scripts/directives.js
@@ -14,10 +14,16 @@
                 link: function (scope, element, attrs) {
                     var TOKEN = $route.current.pathParams.token;

+                    scope.loading = true;
                     verificationFactory
                         .verify.post(TOKEN)
                         .then(function (response) {
                             scope.status = response.status;
+                        }, function (response) {
+                            scope.status = response.status;
+                        })
+                        ['finally'](function () {
+                            scope.loading = false;
                         });
                 }
             };

<|original_code|>
(function (angular) {
    'use strict';

    var module = angular.module('user_management.verification');

    module.directive('verify', [
        '$route',
        'verificationFactory',
        function ($route, verificationFactory) {
            return {
                restrict: 'A',
                scope: true,
                templateUrl: 'templates/user_management/verification/verify.html',
                link: function (scope, element, attrs) {
                    var TOKEN = $route.current.pathParams.token;

                    verificationFactory
                        .verify.post(TOKEN)
                        .then(function (response) {
                            scope.status = response.status;
                        });
                }
            };
        }
    ]);

}(window.angular));

<|edits_diff|>
--- src/verification/scripts/directives.js
+++ src/verification/scripts/directives.js
@@ -14,6 +14,7 @@
                 link: function (scope, element, attrs) {
                     var TOKEN = $route.current.pathParams.token;

+                    scope.loading = true;
                     verificationFactory
                         .verify.post(TOKEN)
                         .then(function (response) {
<|current_version|>
(function (angular) {
    'use strict';

    var module = angular.module('user_management.verification');

    module.directive('verify', [
        '$route',
        'verificationFactory',
        function ($route, verificationFactory) {
            return {
                restrict: 'A',
                scope: true,
                templateUrl: 'templates/user_management/verification/verify.html',
                link: function (scope, element, attrs) {
                    var TOKEN = $route.current.pathParams.token;

                    scope.loading = true;
                    verificationFactory
                        .verify.post(TOKEN)
                        .then(function (response) {
                            scope.status = response.status;
                        });
                }
            };
        }
    ]);

}(window.angular));

<|next_version|>
(function (angular) {
    'use strict';

    var module = angular.module('user_management.verification');

    module.directive('verify', [
        '$route',
        'verificationFactory',
        function ($route, verificationFactory) {
            return {
                restrict: 'A',
                scope: true,
                templateUrl: 'templates/user_management/verification/verify.html',
                link: function (scope, element, attrs) {
                    var TOKEN = $route.current.pathParams.token;

                    scope.loading = true;
                    verificationFactory
                        .verify.post(TOKEN)
                        .then(function (response) {
                            scope.status = response.status;
                        }, function (response) {
                            scope.status = response.status;
                        })
                        ['finally'](function () {
                            scope.loading = false;
                        });
                }
            };
        }
    ]);

}(window.angular));


Add StatusBar to unpkg bundle.

Add StatusBar to unpkg bundle.

--- src/index.js
+++ src/index.js
@@ -16,6 +16,7 @@
 const Webcam = require('./plugins/Webcam/index.js')

 // Progressindicators
+const StatusBar = require('./plugins/StatusBar')
 const ProgressBar = require('./plugins/ProgressBar.js')
 const Informer = require('./plugins/Informer.js')

@@ -32,6 +33,7 @@
   Core,
   Plugin,
   Dummy,
+  StatusBar,
   ProgressBar,
   Informer,
   DragDrop,

<|original_code|>
const Core = require('./core/index.js')

// Parent
const Plugin = require('./plugins/Plugin')

// Orchestrators
const Dashboard = require('./plugins/Dashboard/index.js')

// Acquirers
const Dummy = require('./plugins/Dummy')
const DragDrop = require('./plugins/DragDrop/index.js')
const FileInput = require('./plugins/FileInput.js')
const GoogleDrive = require('./plugins/GoogleDrive/index.js')
const Dropbox = require('./plugins/Dropbox/index.js')
const Instagram = require('./plugins/Instagram/index.js')
const Webcam = require('./plugins/Webcam/index.js')

// Progressindicators
const ProgressBar = require('./plugins/ProgressBar.js')
const Informer = require('./plugins/Informer.js')

// Modifiers
const MetaData = require('./plugins/MetaData.js')

// Uploaders
const Tus10 = require('./plugins/Tus10')
const XHRUpload = require('./plugins/XHRUpload')
const Transloadit = require('./plugins/Transloadit')
const AwsS3 = require('./plugins/AwsS3')

module.exports = {
  Core,
  Plugin,
  Dummy,
  ProgressBar,
  Informer,
  DragDrop,
  GoogleDrive,
  Dropbox,
  Instagram,
  FileInput,
  Tus10,
  XHRUpload,
  Transloadit,
  AwsS3,
  Dashboard,
  MetaData,
  Webcam
}

<|edits_diff|>
--- src/index.js
+++ src/index.js
@@ -16,6 +16,7 @@
 const Webcam = require('./plugins/Webcam/index.js')

 // Progressindicators
+const StatusBar = require('./plugins/StatusBar')
 const ProgressBar = require('./plugins/ProgressBar.js')
 const Informer = require('./plugins/Informer.js')

<|current_version|>
const Core = require('./core/index.js')

// Parent
const Plugin = require('./plugins/Plugin')

// Orchestrators
const Dashboard = require('./plugins/Dashboard/index.js')

// Acquirers
const Dummy = require('./plugins/Dummy')
const DragDrop = require('./plugins/DragDrop/index.js')
const FileInput = require('./plugins/FileInput.js')
const GoogleDrive = require('./plugins/GoogleDrive/index.js')
const Dropbox = require('./plugins/Dropbox/index.js')
const Instagram = require('./plugins/Instagram/index.js')
const Webcam = require('./plugins/Webcam/index.js')

// Progressindicators
const StatusBar = require('./plugins/StatusBar')
const ProgressBar = require('./plugins/ProgressBar.js')
const Informer = require('./plugins/Informer.js')

// Modifiers
const MetaData = require('./plugins/MetaData.js')

// Uploaders
const Tus10 = require('./plugins/Tus10')
const XHRUpload = require('./plugins/XHRUpload')
const Transloadit = require('./plugins/Transloadit')
const AwsS3 = require('./plugins/AwsS3')

module.exports = {
  Core,
  Plugin,
  Dummy,
  ProgressBar,
  Informer,
  DragDrop,
  GoogleDrive,
  Dropbox,
  Instagram,
  FileInput,
  Tus10,
  XHRUpload,
  Transloadit,
  AwsS3,
  Dashboard,
  MetaData,
  Webcam
}

<|next_version|>
const Core = require('./core/index.js')

// Parent
const Plugin = require('./plugins/Plugin')

// Orchestrators
const Dashboard = require('./plugins/Dashboard/index.js')

// Acquirers
const Dummy = require('./plugins/Dummy')
const DragDrop = require('./plugins/DragDrop/index.js')
const FileInput = require('./plugins/FileInput.js')
const GoogleDrive = require('./plugins/GoogleDrive/index.js')
const Dropbox = require('./plugins/Dropbox/index.js')
const Instagram = require('./plugins/Instagram/index.js')
const Webcam = require('./plugins/Webcam/index.js')

// Progressindicators
const StatusBar = require('./plugins/StatusBar')
const ProgressBar = require('./plugins/ProgressBar.js')
const Informer = require('./plugins/Informer.js')

// Modifiers
const MetaData = require('./plugins/MetaData.js')

// Uploaders
const Tus10 = require('./plugins/Tus10')
const XHRUpload = require('./plugins/XHRUpload')
const Transloadit = require('./plugins/Transloadit')
const AwsS3 = require('./plugins/AwsS3')

module.exports = {
  Core,
  Plugin,
  Dummy,
  StatusBar,
  ProgressBar,
  Informer,
  DragDrop,
  GoogleDrive,
  Dropbox,
  Instagram,
  FileInput,
  Tus10,
  XHRUpload,
  Transloadit,
  AwsS3,
  Dashboard,
  MetaData,
  Webcam
}


Set role dialog for modal

feat: Set role dialog for modal

--- app/components/em-modal.js
+++ app/components/em-modal.js
@@ -2,10 +2,12 @@
 import $ from 'jquery';

 export default Ember.Component.extend({
+  attributeBindings: ['role'],
   didInsertElement () {
     const $emEl = this.$();
     const $modalBtn = $('[em-modal-open]');

+    $emEl.attr('role', 'dialog');
     $modalBtn.click(() => {
       $emEl.fadeIn(100);
     });

<|original_code|>
import Ember from 'ember';
import $ from 'jquery';

export default Ember.Component.extend({
  didInsertElement () {
    const $emEl = this.$();
    const $modalBtn = $('[em-modal-open]');

    $modalBtn.click(() => {
      $emEl.fadeIn(100);
    });

    $emEl.click(event => {
      if (!$(event.target).parents(`#${this.$().attr('id')}`).length) {
        $emEl.fadeOut(100);
      }
    });
  }
});

<|edits_diff|>
--- app/components/em-modal.js
+++ app/components/em-modal.js
@@ -2,6 +2,7 @@
 import $ from 'jquery';

 export default Ember.Component.extend({
+  attributeBindings: ['role'],
   didInsertElement () {
     const $emEl = this.$();
     const $modalBtn = $('[em-modal-open]');
<|current_version|>
import Ember from 'ember';
import $ from 'jquery';

export default Ember.Component.extend({
  attributeBindings: ['role'],
  didInsertElement () {
    const $emEl = this.$();
    const $modalBtn = $('[em-modal-open]');

    $modalBtn.click(() => {
      $emEl.fadeIn(100);
    });

    $emEl.click(event => {
      if (!$(event.target).parents(`#${this.$().attr('id')}`).length) {
        $emEl.fadeOut(100);
      }
    });
  }
});

<|next_version|>
import Ember from 'ember';
import $ from 'jquery';

export default Ember.Component.extend({
  attributeBindings: ['role'],
  didInsertElement () {
    const $emEl = this.$();
    const $modalBtn = $('[em-modal-open]');

    $emEl.attr('role', 'dialog');
    $modalBtn.click(() => {
      $emEl.fadeIn(100);
    });

    $emEl.click(event => {
      if (!$(event.target).parents(`#${this.$().attr('id')}`).length) {
        $emEl.fadeOut(100);
      }
    });
  }
});


Add dispensary reducer to redux

Add dispensary reducer to redux

--- src/reducers/index.js
+++ src/reducers/index.js
@@ -4,6 +4,7 @@
 import { PagesReducer } from './PagesReducer';
 import { ModulesReducer } from './ModulesReducer';
 import { UserReducer } from './UserReducer';
+import { DispensaryReducer } from './DispensaryReducer';

 export default combineReducers({
   user: UserReducer,
@@ -11,4 +12,5 @@
   sync: SyncReducer,
   pages: PagesReducer,
   modules: ModulesReducer,
+  dispensary: DispensaryReducer,
 });

<|original_code|>
import { combineReducers } from 'redux';
import NavigationReducer from './NavigationReducer';
import SyncReducer from './SyncReducer';
import { PagesReducer } from './PagesReducer';
import { ModulesReducer } from './ModulesReducer';
import { UserReducer } from './UserReducer';

export default combineReducers({
  user: UserReducer,
  nav: NavigationReducer,
  sync: SyncReducer,
  pages: PagesReducer,
  modules: ModulesReducer,
});

<|edits_diff|>
--- src/reducers/index.js
+++ src/reducers/index.js
@@ -4,6 +4,7 @@
 import { PagesReducer } from './PagesReducer';
 import { ModulesReducer } from './ModulesReducer';
 import { UserReducer } from './UserReducer';
+import { DispensaryReducer } from './DispensaryReducer';

 export default combineReducers({
   user: UserReducer,
<|current_version|>
import { combineReducers } from 'redux';
import NavigationReducer from './NavigationReducer';
import SyncReducer from './SyncReducer';
import { PagesReducer } from './PagesReducer';
import { ModulesReducer } from './ModulesReducer';
import { UserReducer } from './UserReducer';
import { DispensaryReducer } from './DispensaryReducer';

export default combineReducers({
  user: UserReducer,
  nav: NavigationReducer,
  sync: SyncReducer,
  pages: PagesReducer,
  modules: ModulesReducer,
});

<|next_version|>
import { combineReducers } from 'redux';
import NavigationReducer from './NavigationReducer';
import SyncReducer from './SyncReducer';
import { PagesReducer } from './PagesReducer';
import { ModulesReducer } from './ModulesReducer';
import { UserReducer } from './UserReducer';
import { DispensaryReducer } from './DispensaryReducer';

export default combineReducers({
  user: UserReducer,
  nav: NavigationReducer,
  sync: SyncReducer,
  pages: PagesReducer,
  modules: ModulesReducer,
  dispensary: DispensaryReducer,
});


Sort the reducers to improve everybodys life

--- app/routes/index.js
+++ app/routes/index.js
@@ -7,6 +7,7 @@
 import meetings from './meetings';
 import admin from './admin';
 import quotes from './quotes';
+import podcasts from './podcasts';
 import photos from './photos';
 import pages from './pages';
 import search from './search';
@@ -33,6 +34,7 @@
     meetings,
     admin,
     quotes,
+    podcasts,
     pages,
     company,
     search,

<|original_code|>
import { AppRoute } from './app';
import overview from './overview';
import events from './events';
import company from './company';
import users from './users';
import articles from './articles';
import meetings from './meetings';
import admin from './admin';
import quotes from './quotes';
import photos from './photos';
import pages from './pages';
import search from './search';
import interestGroups from './interestgroups';
import joblistings from './joblistings';
import pageNotFound from './pageNotFound';
import announcements from './announcements';
import companyInterest from './companyInterest';
import bdb from './bdb';
import contact from './contact';
import timeline from './timeline';
import surveys from './surveys';
import tags from './tags';

export default {
  path: '/',
  component: AppRoute,
  indexRoute: overview,
  childRoutes: [
    events,
    users,
    articles,
    photos,
    meetings,
    admin,
    quotes,
    pages,
    company,
    search,
    interestGroups,
    joblistings,
    announcements,
    bdb,
    contact,
    timeline,
    ...companyInterest,
    surveys,
    tags,
    pageNotFound
  ]
};

<|edits_diff|>
--- app/routes/index.js
+++ app/routes/index.js
@@ -7,6 +7,7 @@
 import meetings from './meetings';
 import admin from './admin';
 import quotes from './quotes';
+import podcasts from './podcasts';
 import photos from './photos';
 import pages from './pages';
 import search from './search';
<|current_version|>
import { AppRoute } from './app';
import overview from './overview';
import events from './events';
import company from './company';
import users from './users';
import articles from './articles';
import meetings from './meetings';
import admin from './admin';
import quotes from './quotes';
import podcasts from './podcasts';
import photos from './photos';
import pages from './pages';
import search from './search';
import interestGroups from './interestgroups';
import joblistings from './joblistings';
import pageNotFound from './pageNotFound';
import announcements from './announcements';
import companyInterest from './companyInterest';
import bdb from './bdb';
import contact from './contact';
import timeline from './timeline';
import surveys from './surveys';
import tags from './tags';

export default {
  path: '/',
  component: AppRoute,
  indexRoute: overview,
  childRoutes: [
    events,
    users,
    articles,
    photos,
    meetings,
    admin,
    quotes,
    pages,
    company,
    search,
    interestGroups,
    joblistings,
    announcements,
    bdb,
    contact,
    timeline,
    ...companyInterest,
    surveys,
    tags,
    pageNotFound
  ]
};

<|next_version|>
import { AppRoute } from './app';
import overview from './overview';
import events from './events';
import company from './company';
import users from './users';
import articles from './articles';
import meetings from './meetings';
import admin from './admin';
import quotes from './quotes';
import podcasts from './podcasts';
import photos from './photos';
import pages from './pages';
import search from './search';
import interestGroups from './interestgroups';
import joblistings from './joblistings';
import pageNotFound from './pageNotFound';
import announcements from './announcements';
import companyInterest from './companyInterest';
import bdb from './bdb';
import contact from './contact';
import timeline from './timeline';
import surveys from './surveys';
import tags from './tags';

export default {
  path: '/',
  component: AppRoute,
  indexRoute: overview,
  childRoutes: [
    events,
    users,
    articles,
    photos,
    meetings,
    admin,
    quotes,
    podcasts,
    pages,
    company,
    search,
    interestGroups,
    joblistings,
    announcements,
    bdb,
    contact,
    timeline,
    ...companyInterest,
    surveys,
    tags,
    pageNotFound
  ]
};


Add comment and import const for 'null' string value on default config

--- ui/src/utils/defaultQueryConfig.js
+++ ui/src/utils/defaultQueryConfig.js
@@ -1,3 +1,5 @@
+import {NULL} from 'shared/constants/queryFillOptions'
+
 export default function defaultQueryConfig(id) {
   return {
     id,
@@ -10,6 +12,7 @@
       time: null,
       tags: [],
     },
+    fill: NULL, // handle all fill values as strings, including null
     areTagsAccepted: true,
     rawText: null,
     status: null,

<|original_code|>
export default function defaultQueryConfig(id) {
  return {
    id,
    database: null,
    measurement: null,
    retentionPolicy: null,
    fields: [],
    tags: {},
    groupBy: {
      time: null,
      tags: [],
    },
    areTagsAccepted: true,
    rawText: null,
    status: null,
  }
}

<|edits_diff|>
--- ui/src/utils/defaultQueryConfig.js
+++ ui/src/utils/defaultQueryConfig.js
@@ -1,3 +1,5 @@
+import {NULL} from 'shared/constants/queryFillOptions'
+
 export default function defaultQueryConfig(id) {
   return {
     id,
<|current_version|>
import {NULL} from 'shared/constants/queryFillOptions'

export default function defaultQueryConfig(id) {
  return {
    id,
    database: null,
    measurement: null,
    retentionPolicy: null,
    fields: [],
    tags: {},
    groupBy: {
      time: null,
      tags: [],
    },
    areTagsAccepted: true,
    rawText: null,
    status: null,
  }
}

<|next_version|>
import {NULL} from 'shared/constants/queryFillOptions'

export default function defaultQueryConfig(id) {
  return {
    id,
    database: null,
    measurement: null,
    retentionPolicy: null,
    fields: [],
    tags: {},
    groupBy: {
      time: null,
      tags: [],
    },
    fill: NULL, // handle all fill values as strings, including null
    areTagsAccepted: true,
    rawText: null,
    status: null,
  }
}


Use git ssh key when cloning

Use git ssh key when cloning

--- test/actions/getGitHubRepositoryNameTest.js
+++ test/actions/getGitHubRepositoryNameTest.js
@@ -2,9 +2,11 @@
 import test from 'ava'
 import useGitHub from 'create-npm/test/helpers/useGitHub'
 import useGitHubRepository from 'create-npm/test/helpers/useGitHubRepository'
+import useGitSshKey from 'create-npm/test/helpers/useGitSshKey'
 import { getGitHubRepositoryName } from 'create-npm/src/actions'

 useGitHub()
+useGitSshKey()
 const localPath = useGitHubRepository('test-create-npm/existing-repo')

 test('reading the name of a GitHub repository', async t => {

<|original_code|>
/* @flow */
import test from 'ava'
import useGitHub from 'create-npm/test/helpers/useGitHub'
import useGitHubRepository from 'create-npm/test/helpers/useGitHubRepository'
import { getGitHubRepositoryName } from 'create-npm/src/actions'

useGitHub()
const localPath = useGitHubRepository('test-create-npm/existing-repo')

test('reading the name of a GitHub repository', async t => {
  t.is(
    await getGitHubRepositoryName(localPath),
    'test-create-npm/existing-repo'
  )
})

<|edits_diff|>
--- test/actions/getGitHubRepositoryNameTest.js
+++ test/actions/getGitHubRepositoryNameTest.js
@@ -2,6 +2,7 @@
 import test from 'ava'
 import useGitHub from 'create-npm/test/helpers/useGitHub'
 import useGitHubRepository from 'create-npm/test/helpers/useGitHubRepository'
+import useGitSshKey from 'create-npm/test/helpers/useGitSshKey'
 import { getGitHubRepositoryName } from 'create-npm/src/actions'

 useGitHub()
<|current_version|>
/* @flow */
import test from 'ava'
import useGitHub from 'create-npm/test/helpers/useGitHub'
import useGitHubRepository from 'create-npm/test/helpers/useGitHubRepository'
import useGitSshKey from 'create-npm/test/helpers/useGitSshKey'
import { getGitHubRepositoryName } from 'create-npm/src/actions'

useGitHub()
const localPath = useGitHubRepository('test-create-npm/existing-repo')

test('reading the name of a GitHub repository', async t => {
  t.is(
    await getGitHubRepositoryName(localPath),
    'test-create-npm/existing-repo'
  )
})

<|next_version|>
/* @flow */
import test from 'ava'
import useGitHub from 'create-npm/test/helpers/useGitHub'
import useGitHubRepository from 'create-npm/test/helpers/useGitHubRepository'
import useGitSshKey from 'create-npm/test/helpers/useGitSshKey'
import { getGitHubRepositoryName } from 'create-npm/src/actions'

useGitHub()
useGitSshKey()
const localPath = useGitHubRepository('test-create-npm/existing-repo')

test('reading the name of a GitHub repository', async t => {
  t.is(
    await getGitHubRepositoryName(localPath),
    'test-create-npm/existing-repo'
  )
})


Add nice database close for RSS

Add nice database close for RSS

--- src/util/fec/rss.js
+++ src/util/fec/rss.js
@@ -31,6 +31,7 @@
                     });

                     async.mapSeries(_.difference(newFilings,filings), checkForFiling, function () {
+                        models.sequelize.close();
                         console.log('done');
                         // setTimeout(queueFilingsToCheck,interval);
                     });
@@ -41,6 +42,7 @@
         else {
             console.error(error);

+            models.sequelize.close();
             console.log('done');
             // setTimeout(queueFilingsToCheck,interval);
         }

<|original_code|>
var _ = require('lodash'),
    async = require('async'),
    checkForFiling = require('./check'),
    request = require('request'),
    models = require('../../models'),
    parser = require('rss-parser');

// var interval = 60000;

function queueFilingsToCheck() {
    console.log('checking RSS');

    parser.parseURL('http://efilingapps.fec.gov/rss/generate?preDefinedFilingType=ALL', function(err, parsed) {
        if (!err && parsed && parsed.feed && parsed.feed.entries) {
            var newFilings = parsed.feed.entries.map(function (filing) {
                return parseInt(filing.link.replace('http://docquery.fec.gov/dcdev/posted/','').replace('.fec',''));
            });

            models.fec_filing.findAll({
                    attributes: ['filing_id'],
                    where: {
                        filing_id: {
                            gte: _.min(newFilings)
                        }
                    }
                })
                .then(function(filings) {
                    filings = filings.map(function(filing) {
                        return filing.filing_id;
                    });

                    async.mapSeries(_.difference(newFilings,filings), checkForFiling, function () {
                        console.log('done');
                        // setTimeout(queueFilingsToCheck,interval);
                    });

                });

        }
        else {
            console.error(error);

            console.log('done');
            // setTimeout(queueFilingsToCheck,interval);
        }
    });
}

queueFilingsToCheck();

<|edits_diff|>
--- src/util/fec/rss.js
+++ src/util/fec/rss.js
@@ -31,6 +31,7 @@
                     });

                     async.mapSeries(_.difference(newFilings,filings), checkForFiling, function () {
+                        models.sequelize.close();
                         console.log('done');
                         // setTimeout(queueFilingsToCheck,interval);
                     });
<|current_version|>
var _ = require('lodash'),
    async = require('async'),
    checkForFiling = require('./check'),
    request = require('request'),
    models = require('../../models'),
    parser = require('rss-parser');

// var interval = 60000;

function queueFilingsToCheck() {
    console.log('checking RSS');

    parser.parseURL('http://efilingapps.fec.gov/rss/generate?preDefinedFilingType=ALL', function(err, parsed) {
        if (!err && parsed && parsed.feed && parsed.feed.entries) {
            var newFilings = parsed.feed.entries.map(function (filing) {
                return parseInt(filing.link.replace('http://docquery.fec.gov/dcdev/posted/','').replace('.fec',''));
            });

            models.fec_filing.findAll({
                    attributes: ['filing_id'],
                    where: {
                        filing_id: {
                            gte: _.min(newFilings)
                        }
                    }
                })
                .then(function(filings) {
                    filings = filings.map(function(filing) {
                        return filing.filing_id;
                    });

                    async.mapSeries(_.difference(newFilings,filings), checkForFiling, function () {
                        models.sequelize.close();
                        console.log('done');
                        // setTimeout(queueFilingsToCheck,interval);
                    });

                });

        }
        else {
            console.error(error);

            console.log('done');
            // setTimeout(queueFilingsToCheck,interval);
        }
    });
}

queueFilingsToCheck();

<|next_version|>
var _ = require('lodash'),
    async = require('async'),
    checkForFiling = require('./check'),
    request = require('request'),
    models = require('../../models'),
    parser = require('rss-parser');

// var interval = 60000;

function queueFilingsToCheck() {
    console.log('checking RSS');

    parser.parseURL('http://efilingapps.fec.gov/rss/generate?preDefinedFilingType=ALL', function(err, parsed) {
        if (!err && parsed && parsed.feed && parsed.feed.entries) {
            var newFilings = parsed.feed.entries.map(function (filing) {
                return parseInt(filing.link.replace('http://docquery.fec.gov/dcdev/posted/','').replace('.fec',''));
            });

            models.fec_filing.findAll({
                    attributes: ['filing_id'],
                    where: {
                        filing_id: {
                            gte: _.min(newFilings)
                        }
                    }
                })
                .then(function(filings) {
                    filings = filings.map(function(filing) {
                        return filing.filing_id;
                    });

                    async.mapSeries(_.difference(newFilings,filings), checkForFiling, function () {
                        models.sequelize.close();
                        console.log('done');
                        // setTimeout(queueFilingsToCheck,interval);
                    });

                });

        }
        else {
            console.error(error);

            models.sequelize.close();
            console.log('done');
            // setTimeout(queueFilingsToCheck,interval);
        }
    });
}

queueFilingsToCheck();


Add extend and from to Id spec

Add extend and from to Id spec

--- id.js
+++ id.js
@@ -27,9 +27,19 @@
     return f(this.value);
 };

+// Extend
+Id.prototype.extend = function(f){
+  return new Id(f(this.value));
+}
+
 // Monad
 Id.of = function(a) {
     return new Id(a);
 };

+// Comonad
+Id.from = function(a){
+  return a.value;
+}
+
 if(typeof module == 'object') module.exports = Id;

<|original_code|>
function Id(a) {
    this.value = a;
}

// Semigroup (value must also be a Semigroup)
Id.prototype.concat = function(b) {
    return new Id(this.value.concat(b.value));
};

// Monoid (value must also be a Monoid)
Id.prototype.empty = function() {
    return new Id(this.value.empty ? this.value.empty() : this.value.constructor.empty());
};

// Functor
Id.prototype.map = function(f) {
    return new Id(f(this.value));
};

// Applicative
Id.prototype.ap = function(b) {
    return new Id(this.value(b.value));
};

// Chain
Id.prototype.chain = function(f) {
    return f(this.value);
};

// Monad
Id.of = function(a) {
    return new Id(a);
};

if(typeof module == 'object') module.exports = Id;

<|edits_diff|>
--- id.js
+++ id.js
@@ -27,6 +27,11 @@
     return f(this.value);
 };

+// Extend
+Id.prototype.extend = function(f){
+  return new Id(f(this.value));
+}
+
 // Monad
 Id.of = function(a) {
     return new Id(a);
<|current_version|>
function Id(a) {
    this.value = a;
}

// Semigroup (value must also be a Semigroup)
Id.prototype.concat = function(b) {
    return new Id(this.value.concat(b.value));
};

// Monoid (value must also be a Monoid)
Id.prototype.empty = function() {
    return new Id(this.value.empty ? this.value.empty() : this.value.constructor.empty());
};

// Functor
Id.prototype.map = function(f) {
    return new Id(f(this.value));
};

// Applicative
Id.prototype.ap = function(b) {
    return new Id(this.value(b.value));
};

// Chain
Id.prototype.chain = function(f) {
    return f(this.value);
};

// Extend
Id.prototype.extend = function(f){
  return new Id(f(this.value));
}

// Monad
Id.of = function(a) {
    return new Id(a);
};

if(typeof module == 'object') module.exports = Id;

<|next_version|>
function Id(a) {
    this.value = a;
}

// Semigroup (value must also be a Semigroup)
Id.prototype.concat = function(b) {
    return new Id(this.value.concat(b.value));
};

// Monoid (value must also be a Monoid)
Id.prototype.empty = function() {
    return new Id(this.value.empty ? this.value.empty() : this.value.constructor.empty());
};

// Functor
Id.prototype.map = function(f) {
    return new Id(f(this.value));
};

// Applicative
Id.prototype.ap = function(b) {
    return new Id(this.value(b.value));
};

// Chain
Id.prototype.chain = function(f) {
    return f(this.value);
};

// Extend
Id.prototype.extend = function(f){
  return new Id(f(this.value));
}

// Monad
Id.of = function(a) {
    return new Id(a);
};

// Comonad
Id.from = function(a){
  return a.value;
}

if(typeof module == 'object') module.exports = Id;


Add filter to allow access control of endpoints

--- server/server.js
+++ server/server.js
@@ -4,6 +4,7 @@
     const morgan = require("morgan");
     const express = require("express");
     const login = require(`${__dirname}/routes/login`);
+    const jwt = require("jsonwebtoken");
     const app = express();

     /** Use Morgan to log requests */
@@ -12,8 +13,17 @@
     /** Add static sites */
     app.use(express.static("public"));

+    app.get("/dashboard", function (req, res) {
+        res.send("hello");
+    });
+
     /** Add login Route */
     app.use("/login", login);

+    app.use(authFilter);
+
+    app.get("/secure", function (req, res) {
+        res.send(`Hello from the secure route!`);
+    });
     app.listen(process.env.PORT || 8080);
 }());

<|original_code|>
(function start() {
    "use strict";

    const morgan = require("morgan");
    const express = require("express");
    const login = require(`${__dirname}/routes/login`);
    const app = express();

    /** Use Morgan to log requests */
    app.use(morgan("dev"));

    /** Add static sites */
    app.use(express.static("public"));

    /** Add login Route */
    app.use("/login", login);

    app.listen(process.env.PORT || 8080);
}());

<|edits_diff|>
--- server/server.js
+++ server/server.js
@@ -4,6 +4,7 @@
     const morgan = require("morgan");
     const express = require("express");
     const login = require(`${__dirname}/routes/login`);
+    const jwt = require("jsonwebtoken");
     const app = express();

     /** Use Morgan to log requests */
@@ -12,6 +13,10 @@
     /** Add static sites */
     app.use(express.static("public"));

+    app.get("/dashboard", function (req, res) {
+        res.send("hello");
+    });
+
     /** Add login Route */
     app.use("/login", login);

<|current_version|>
(function start() {
    "use strict";

    const morgan = require("morgan");
    const express = require("express");
    const login = require(`${__dirname}/routes/login`);
    const jwt = require("jsonwebtoken");
    const app = express();

    /** Use Morgan to log requests */
    app.use(morgan("dev"));

    /** Add static sites */
    app.use(express.static("public"));

    app.get("/dashboard", function (req, res) {
        res.send("hello");
    });

    /** Add login Route */
    app.use("/login", login);

    app.listen(process.env.PORT || 8080);
}());

<|next_version|>
(function start() {
    "use strict";

    const morgan = require("morgan");
    const express = require("express");
    const login = require(`${__dirname}/routes/login`);
    const jwt = require("jsonwebtoken");
    const app = express();

    /** Use Morgan to log requests */
    app.use(morgan("dev"));

    /** Add static sites */
    app.use(express.static("public"));

    app.get("/dashboard", function (req, res) {
        res.send("hello");
    });

    /** Add login Route */
    app.use("/login", login);

    app.use(authFilter);

    app.get("/secure", function (req, res) {
        res.send(`Hello from the secure route!`);
    });
    app.listen(process.env.PORT || 8080);
}());


Add output variable to CLI

Add output variable to CLI

--- cli.js
+++ cli.js
@@ -1,8 +1,17 @@
+var Bundler = require('../')
 var argv = require('minimist')(process.argv.slice(2))
+var fs = require('fs')
+
+var bundle = Bundler()
+var entry = argv.entry || argv.e || '.'
+var output = argv.output || argv.o || './export.tgz'

 if (!argv.length || argv.h || argv.help) {
   console.log(help())
 }
+
+bundle.createBundle()
+  .pipe(fs.createWriteStream(output))

 function help () {
   return [

<|original_code|>
var argv = require('minimist')(process.argv.slice(2))

if (!argv.length || argv.h || argv.help) {
  console.log(help())
}

function help () {
  return [
    'Usage:',
    '  matrix-bundler [entry] [opts]',
    '',
    'Options:',
    '  --help, -h           show help message',
    '  --entry, -e          the enrty point for bundler, default "."',
    '  --output, -o         the exported file bundle, default "./export.tgz"',
    '  --parent, -p         an asset id to import the files under, default "1"',
    '  --link, -l           the link type all assets will be imported as, default "TYPE_1"',
    '  --unrestricted, -u   whether unrestricted access is allowed, default "false"',
    '',
    'Examples:',
    '  matrix-bundler --entry ./files --link 2 --unrestricted --output ./files.tgz'
  ].join('\n')
}

<|edits_diff|>
--- cli.js
+++ cli.js
@@ -1,4 +1,10 @@
+var Bundler = require('../')
 var argv = require('minimist')(process.argv.slice(2))
+var fs = require('fs')
+
+var bundle = Bundler()
+var entry = argv.entry || argv.e || '.'
+var output = argv.output || argv.o || './export.tgz'

 if (!argv.length || argv.h || argv.help) {
   console.log(help())
<|current_version|>
var Bundler = require('../')
var argv = require('minimist')(process.argv.slice(2))
var fs = require('fs')

var bundle = Bundler()
var entry = argv.entry || argv.e || '.'
var output = argv.output || argv.o || './export.tgz'

if (!argv.length || argv.h || argv.help) {
  console.log(help())
}

function help () {
  return [
    'Usage:',
    '  matrix-bundler [entry] [opts]',
    '',
    'Options:',
    '  --help, -h           show help message',
    '  --entry, -e          the enrty point for bundler, default "."',
    '  --output, -o         the exported file bundle, default "./export.tgz"',
    '  --parent, -p         an asset id to import the files under, default "1"',
    '  --link, -l           the link type all assets will be imported as, default "TYPE_1"',
    '  --unrestricted, -u   whether unrestricted access is allowed, default "false"',
    '',
    'Examples:',
    '  matrix-bundler --entry ./files --link 2 --unrestricted --output ./files.tgz'
  ].join('\n')
}

<|next_version|>
var Bundler = require('../')
var argv = require('minimist')(process.argv.slice(2))
var fs = require('fs')

var bundle = Bundler()
var entry = argv.entry || argv.e || '.'
var output = argv.output || argv.o || './export.tgz'

if (!argv.length || argv.h || argv.help) {
  console.log(help())
}

bundle.createBundle()
  .pipe(fs.createWriteStream(output))

function help () {
  return [
    'Usage:',
    '  matrix-bundler [entry] [opts]',
    '',
    'Options:',
    '  --help, -h           show help message',
    '  --entry, -e          the enrty point for bundler, default "."',
    '  --output, -o         the exported file bundle, default "./export.tgz"',
    '  --parent, -p         an asset id to import the files under, default "1"',
    '  --link, -l           the link type all assets will be imported as, default "TYPE_1"',
    '  --unrestricted, -u   whether unrestricted access is allowed, default "false"',
    '',
    'Examples:',
    '  matrix-bundler --entry ./files --link 2 --unrestricted --output ./files.tgz'
  ].join('\n')
}


Add a route displaying connecting Android devices

--- server.js
+++ server.js
@@ -1,5 +1,6 @@
 const express = require('express');
 const installer = require('./installer');
+const androidClient = require('./android-client');

 const app = express();

@@ -8,6 +9,11 @@
   .then(() => res.send('Done'))
 );

+app.get('/devices', (req, res) =>
+  androidClient.getDevices()
+  .then(devices => res.json(devices))
+);
+
 app.listen(3000, () => {
   console.log('Bot listening on port 3000');
 });

<|original_code|>
const express = require('express');
const installer = require('./installer');

const app = express();

app.get('/install/:hockeyAppId', (req, res) =>
  installer.getMyApp(req.params.hockeyAppId)
  .then(() => res.send('Done'))
);

app.listen(3000, () => {
  console.log('Bot listening on port 3000');
});

<|edits_diff|>
--- server.js
+++ server.js
@@ -1,5 +1,6 @@
 const express = require('express');
 const installer = require('./installer');
+const androidClient = require('./android-client');

 const app = express();

<|current_version|>
const express = require('express');
const installer = require('./installer');
const androidClient = require('./android-client');

const app = express();

app.get('/install/:hockeyAppId', (req, res) =>
  installer.getMyApp(req.params.hockeyAppId)
  .then(() => res.send('Done'))
);

app.listen(3000, () => {
  console.log('Bot listening on port 3000');
});

<|next_version|>
const express = require('express');
const installer = require('./installer');
const androidClient = require('./android-client');

const app = express();

app.get('/install/:hockeyAppId', (req, res) =>
  installer.getMyApp(req.params.hockeyAppId)
  .then(() => res.send('Done'))
);

app.get('/devices', (req, res) =>
  androidClient.getDevices()
  .then(devices => res.json(devices))
);

app.listen(3000, () => {
  console.log('Bot listening on port 3000');
});


Add an empty line between rules

Add an empty line between rules

--- .eslintrc.js
+++ .eslintrc.js
@@ -29,13 +29,16 @@
         readonly: "generic",
       },
     ],
+
     // Mandatory return types is too verbose for my taste.
     "@typescript-eslint/explicit-module-boundary-types": "off",
+
     // Empty constructors make sense for singleton classes.
     "@typescript-eslint/no-empty-function": [
       "error",
       { allow: ["constructors"] },
     ],
+
     // Let TypeScript test for unused variables.
     "@typescript-eslint/no-unused-vars": "off",
   },

<|original_code|>
module.exports = {
  parser: "@typescript-eslint/parser",
  extends: [
    "eslint:recommended",
    "plugin:react/recommended",
    "plugin:@typescript-eslint/recommended",
    // Consider adding these rules. This requires parserOptions.project to be set, and ESLint will then complain about .js files not being included.
    // "plugin:@typescript-eslint/recommended-requiring-type-checking",
    "prettier",
  ],
  // parserOptions: {
  //   project: "./tsconfig.json",
  //   sourceType: "module",
  // },
  // Ignore .js files since we're coding in TypeScript.
  ignorePatterns: ["**/*.js"],
  settings: {
    react: {
      version: "detect",
    },
  },
  env: { node: true },
  rules: {
    // Use the Array<foo> syntax instead of foo[] in types.
    "@typescript-eslint/array-type": [
      "error",
      {
        default: "generic",
        readonly: "generic",
      },
    ],
    // Mandatory return types is too verbose for my taste.
    "@typescript-eslint/explicit-module-boundary-types": "off",
    // Empty constructors make sense for singleton classes.
    "@typescript-eslint/no-empty-function": [
      "error",
      { allow: ["constructors"] },
    ],
    // Let TypeScript test for unused variables.
    "@typescript-eslint/no-unused-vars": "off",
  },
}

<|edits_diff|>
--- .eslintrc.js
+++ .eslintrc.js
@@ -29,8 +29,10 @@
         readonly: "generic",
       },
     ],
+
     // Mandatory return types is too verbose for my taste.
     "@typescript-eslint/explicit-module-boundary-types": "off",
+
     // Empty constructors make sense for singleton classes.
     "@typescript-eslint/no-empty-function": [
       "error",
<|current_version|>
module.exports = {
  parser: "@typescript-eslint/parser",
  extends: [
    "eslint:recommended",
    "plugin:react/recommended",
    "plugin:@typescript-eslint/recommended",
    // Consider adding these rules. This requires parserOptions.project to be set, and ESLint will then complain about .js files not being included.
    // "plugin:@typescript-eslint/recommended-requiring-type-checking",
    "prettier",
  ],
  // parserOptions: {
  //   project: "./tsconfig.json",
  //   sourceType: "module",
  // },
  // Ignore .js files since we're coding in TypeScript.
  ignorePatterns: ["**/*.js"],
  settings: {
    react: {
      version: "detect",
    },
  },
  env: { node: true },
  rules: {
    // Use the Array<foo> syntax instead of foo[] in types.
    "@typescript-eslint/array-type": [
      "error",
      {
        default: "generic",
        readonly: "generic",
      },
    ],

    // Mandatory return types is too verbose for my taste.
    "@typescript-eslint/explicit-module-boundary-types": "off",

    // Empty constructors make sense for singleton classes.
    "@typescript-eslint/no-empty-function": [
      "error",
      { allow: ["constructors"] },
    ],
    // Let TypeScript test for unused variables.
    "@typescript-eslint/no-unused-vars": "off",
  },
}

<|next_version|>
module.exports = {
  parser: "@typescript-eslint/parser",
  extends: [
    "eslint:recommended",
    "plugin:react/recommended",
    "plugin:@typescript-eslint/recommended",
    // Consider adding these rules. This requires parserOptions.project to be set, and ESLint will then complain about .js files not being included.
    // "plugin:@typescript-eslint/recommended-requiring-type-checking",
    "prettier",
  ],
  // parserOptions: {
  //   project: "./tsconfig.json",
  //   sourceType: "module",
  // },
  // Ignore .js files since we're coding in TypeScript.
  ignorePatterns: ["**/*.js"],
  settings: {
    react: {
      version: "detect",
    },
  },
  env: { node: true },
  rules: {
    // Use the Array<foo> syntax instead of foo[] in types.
    "@typescript-eslint/array-type": [
      "error",
      {
        default: "generic",
        readonly: "generic",
      },
    ],

    // Mandatory return types is too verbose for my taste.
    "@typescript-eslint/explicit-module-boundary-types": "off",

    // Empty constructors make sense for singleton classes.
    "@typescript-eslint/no-empty-function": [
      "error",
      { allow: ["constructors"] },
    ],

    // Let TypeScript test for unused variables.
    "@typescript-eslint/no-unused-vars": "off",
  },
}


Enable some more syntax extensions for the Babylon parser.

Should fix https://github.com/meteor/meteor/issues/9471.

--- lib/parsers/babylon.js
+++ lib/parsers/babylon.js
@@ -9,6 +9,9 @@
     "*", "flow", "jsx",
     // The "*" glob no longer seems to include the following plugins:
     "asyncGenerators",
+    "bigInt",
+    "classPrivateMethods",
+    "classPrivateProperties",
     "classProperties",
     "decorators",
     "doExpressions",
@@ -16,7 +19,14 @@
     "exportExtensions",
     "functionBind",
     "functionSent",
+    "importMeta",
+    "nullishCoalescingOperator",
+    "numericSeparator",
     "objectRestSpread",
+    "optionalCatchBinding",
+    "optionalChaining",
+    "pipelineOperator",
+    "throwExpressions",
     // Other experimental plugins that we could enable:
     // https://github.com/babel/babylon#plugins
   ],

<|original_code|>
"use strict";

const babylon = require("babylon");

exports.options = {
  allowImportExportEverywhere: true,
  allowReturnOutsideFunction: true,
  plugins: [
    "*", "flow", "jsx",
    // The "*" glob no longer seems to include the following plugins:
    "asyncGenerators",
    "classProperties",
    "decorators",
    "doExpressions",
    "dynamicImport",
    "exportExtensions",
    "functionBind",
    "functionSent",
    "objectRestSpread",
    // Other experimental plugins that we could enable:
    // https://github.com/babel/babylon#plugins
  ],
  sourceType: "module",
  strictMode: false
};

function parse(code) {
  return babylon.parse(code, exports.options);
}

exports.parse = parse;

<|edits_diff|>
--- lib/parsers/babylon.js
+++ lib/parsers/babylon.js
@@ -9,6 +9,9 @@
     "*", "flow", "jsx",
     // The "*" glob no longer seems to include the following plugins:
     "asyncGenerators",
+    "bigInt",
+    "classPrivateMethods",
+    "classPrivateProperties",
     "classProperties",
     "decorators",
     "doExpressions",
@@ -16,6 +19,9 @@
     "exportExtensions",
     "functionBind",
     "functionSent",
+    "importMeta",
+    "nullishCoalescingOperator",
+    "numericSeparator",
     "objectRestSpread",
     // Other experimental plugins that we could enable:
     // https://github.com/babel/babylon#plugins
<|current_version|>
"use strict";

const babylon = require("babylon");

exports.options = {
  allowImportExportEverywhere: true,
  allowReturnOutsideFunction: true,
  plugins: [
    "*", "flow", "jsx",
    // The "*" glob no longer seems to include the following plugins:
    "asyncGenerators",
    "bigInt",
    "classPrivateMethods",
    "classPrivateProperties",
    "classProperties",
    "decorators",
    "doExpressions",
    "dynamicImport",
    "exportExtensions",
    "functionBind",
    "functionSent",
    "importMeta",
    "nullishCoalescingOperator",
    "numericSeparator",
    "objectRestSpread",
    // Other experimental plugins that we could enable:
    // https://github.com/babel/babylon#plugins
  ],
  sourceType: "module",
  strictMode: false
};

function parse(code) {
  return babylon.parse(code, exports.options);
}

exports.parse = parse;

<|next_version|>
"use strict";

const babylon = require("babylon");

exports.options = {
  allowImportExportEverywhere: true,
  allowReturnOutsideFunction: true,
  plugins: [
    "*", "flow", "jsx",
    // The "*" glob no longer seems to include the following plugins:
    "asyncGenerators",
    "bigInt",
    "classPrivateMethods",
    "classPrivateProperties",
    "classProperties",
    "decorators",
    "doExpressions",
    "dynamicImport",
    "exportExtensions",
    "functionBind",
    "functionSent",
    "importMeta",
    "nullishCoalescingOperator",
    "numericSeparator",
    "objectRestSpread",
    "optionalCatchBinding",
    "optionalChaining",
    "pipelineOperator",
    "throwExpressions",
    // Other experimental plugins that we could enable:
    // https://github.com/babel/babylon#plugins
  ],
  sourceType: "module",
  strictMode: false
};

function parse(code) {
  return babylon.parse(code, exports.options);
}

exports.parse = parse;


Add gzip compression to dist server

Add gzip compression to dist server

--- tools/distServer.js
+++ tools/distServer.js
@@ -1,11 +1,14 @@
 import express from 'express';
 import path from 'path';
 import open from 'open';
+import compression from 'compression';

 /*eslint-disable no-console*/

 const port = 3000;
 const app = express();
+
+app.use(compression());

 app.use(express.static('dist'));

<|original_code|>
import express from 'express';
import path from 'path';
import open from 'open';

/*eslint-disable no-console*/

const port = 3000;
const app = express();

app.use(express.static('dist'));

app.get('*', (req,res) => {
  res.sendFile(path.join(__dirname, '../dist/index.html'));
});

app.listen(port, error => {
  if (error) {
    console.log(error);
  } else {
    console.log(`Server started at http://localhost:${port}`);
  }
});

<|edits_diff|>
--- tools/distServer.js
+++ tools/distServer.js
@@ -1,6 +1,7 @@
 import express from 'express';
 import path from 'path';
 import open from 'open';
+import compression from 'compression';

 /*eslint-disable no-console*/

<|current_version|>
import express from 'express';
import path from 'path';
import open from 'open';
import compression from 'compression';

/*eslint-disable no-console*/

const port = 3000;
const app = express();

app.use(express.static('dist'));

app.get('*', (req,res) => {
  res.sendFile(path.join(__dirname, '../dist/index.html'));
});

app.listen(port, error => {
  if (error) {
    console.log(error);
  } else {
    console.log(`Server started at http://localhost:${port}`);
  }
});

<|next_version|>
import express from 'express';
import path from 'path';
import open from 'open';
import compression from 'compression';

/*eslint-disable no-console*/

const port = 3000;
const app = express();

app.use(compression());

app.use(express.static('dist'));

app.get('*', (req,res) => {
  res.sendFile(path.join(__dirname, '../dist/index.html'));
});

app.listen(port, error => {
  if (error) {
    console.log(error);
  } else {
    console.log(`Server started at http://localhost:${port}`);
  }
});


ui: Enable compile-error dev server overlay, SPA routing

--- ui/webpack.config.js
+++ ui/webpack.config.js
@@ -38,12 +38,18 @@
   ],
   devServer: {
     inline: true,
+    historyApiFallback: true,
     hot: true,
     stats: { colors: true },
+    overlay: true,
+    open: true,
     proxy: [{
       context: ['/api', '/debug', '/serve'],
       target: 'http://localhost:9000',
       ws: true,
     }],
+    watchOptions: {
+      ignored: /node_modules/,
+    },
   },
 };

<|original_code|>
const HtmlWebpackPlugin = require('html-webpack-plugin')
const webpack = require('webpack')

module.exports = {
  mode: 'development',
  output: {
    filename: 'static/[name].js',
    publicPath: '/',
  },
  module: {
    rules: [
      {
        test: /\.elm$/,
        exclude: [/elm-stuff/, /node_modules/],
        use: [
          { loader: 'elm-hot-webpack-loader' },
          {
            loader: 'elm-webpack-loader',
            options: {
              debug: true
            },
          },
        ],
      },
      {
        test: /\.css$/,
        exclude: [/node_modules/],
        loader: ['style-loader', 'css-loader'],
      },
    ]
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: 'public/index.html',
      favicon: 'public/favicon.png',
    }),
    new webpack.HotModuleReplacementPlugin(),
  ],
  devServer: {
    inline: true,
    hot: true,
    stats: { colors: true },
    proxy: [{
      context: ['/api', '/debug', '/serve'],
      target: 'http://localhost:9000',
      ws: true,
    }],
  },
};

<|edits_diff|>
--- ui/webpack.config.js
+++ ui/webpack.config.js
@@ -38,8 +38,11 @@
   ],
   devServer: {
     inline: true,
+    historyApiFallback: true,
     hot: true,
     stats: { colors: true },
+    overlay: true,
+    open: true,
     proxy: [{
       context: ['/api', '/debug', '/serve'],
       target: 'http://localhost:9000',
<|current_version|>
const HtmlWebpackPlugin = require('html-webpack-plugin')
const webpack = require('webpack')

module.exports = {
  mode: 'development',
  output: {
    filename: 'static/[name].js',
    publicPath: '/',
  },
  module: {
    rules: [
      {
        test: /\.elm$/,
        exclude: [/elm-stuff/, /node_modules/],
        use: [
          { loader: 'elm-hot-webpack-loader' },
          {
            loader: 'elm-webpack-loader',
            options: {
              debug: true
            },
          },
        ],
      },
      {
        test: /\.css$/,
        exclude: [/node_modules/],
        loader: ['style-loader', 'css-loader'],
      },
    ]
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: 'public/index.html',
      favicon: 'public/favicon.png',
    }),
    new webpack.HotModuleReplacementPlugin(),
  ],
  devServer: {
    inline: true,
    historyApiFallback: true,
    hot: true,
    stats: { colors: true },
    overlay: true,
    open: true,
    proxy: [{
      context: ['/api', '/debug', '/serve'],
      target: 'http://localhost:9000',
      ws: true,
    }],
  },
};

<|next_version|>
const HtmlWebpackPlugin = require('html-webpack-plugin')
const webpack = require('webpack')

module.exports = {
  mode: 'development',
  output: {
    filename: 'static/[name].js',
    publicPath: '/',
  },
  module: {
    rules: [
      {
        test: /\.elm$/,
        exclude: [/elm-stuff/, /node_modules/],
        use: [
          { loader: 'elm-hot-webpack-loader' },
          {
            loader: 'elm-webpack-loader',
            options: {
              debug: true
            },
          },
        ],
      },
      {
        test: /\.css$/,
        exclude: [/node_modules/],
        loader: ['style-loader', 'css-loader'],
      },
    ]
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: 'public/index.html',
      favicon: 'public/favicon.png',
    }),
    new webpack.HotModuleReplacementPlugin(),
  ],
  devServer: {
    inline: true,
    historyApiFallback: true,
    hot: true,
    stats: { colors: true },
    overlay: true,
    open: true,
    proxy: [{
      context: ['/api', '/debug', '/serve'],
      target: 'http://localhost:9000',
      ws: true,
    }],
    watchOptions: {
      ignored: /node_modules/,
    },
  },
};


Make Grunt copy bullet.js into example js libs dir

--- Gruntfile.js
+++ Gruntfile.js
@@ -4,6 +4,7 @@

     var jsSrcFile = 'src/bullet.js';
     var jsDistDir = 'dist/';
+    var jsExampleLibsDir = 'example/js/libs/';
     var testDir = 'test/spec/';

     grunt.initConfig({
@@ -55,6 +56,11 @@
             dist : {
                 src : jsSrcFile,
                 dest : jsDistDir + 'bullet.js'
+            },
+
+            example : {
+                src : jsSrcFile,
+                dest : jsExampleLibsDir + 'bullet.js'
             }
         }
     });

<|original_code|>
module.exports = function (grunt) {

    'use strict';

    var jsSrcFile = 'src/bullet.js';
    var jsDistDir = 'dist/';
    var testDir = 'test/spec/';

    grunt.initConfig({

        watch : {

            js: {
                files: [
                    jsSrcFile,
                    testDir + '**/*.js'
                ],

                tasks: ['dist']
            }
        },

        simplemocha : {

            options: {
                timeout: 3000,
                ignoreLeaks: false,
            },

            testAll : {
                src: testDir + '**/*.js'
            }
        },

        uglify : {

            options : {
                compress : {
                    drop_console: true
                },
                mangle : true,
                sourceMap : false,
                preserveComments : false,
                report : 'gzip' // TODO : does this report option still work?
            },

            dist : {
                src : jsSrcFile,
                dest : jsDistDir + 'bullet.min.js'
            }
        },

        copy : {

            dist : {
                src : jsSrcFile,
                dest : jsDistDir + 'bullet.js'
            }
        }
    });

    require('load-grunt-tasks')(grunt, {pattern: ['grunt-*']});

    grunt.registerTask('default', ['simplemocha', 'uglify', 'copy', 'watch']);
    grunt.registerTask('dist', ['simplemocha', 'uglify', 'copy']);
    grunt.registerTask('test', ['simplemocha']);
};
<|edits_diff|>
--- Gruntfile.js
+++ Gruntfile.js
@@ -4,6 +4,7 @@

     var jsSrcFile = 'src/bullet.js';
     var jsDistDir = 'dist/';
+    var jsExampleLibsDir = 'example/js/libs/';
     var testDir = 'test/spec/';

     grunt.initConfig({
<|current_version|>
module.exports = function (grunt) {

    'use strict';

    var jsSrcFile = 'src/bullet.js';
    var jsDistDir = 'dist/';
    var jsExampleLibsDir = 'example/js/libs/';
    var testDir = 'test/spec/';

    grunt.initConfig({

        watch : {

            js: {
                files: [
                    jsSrcFile,
                    testDir + '**/*.js'
                ],

                tasks: ['dist']
            }
        },

        simplemocha : {

            options: {
                timeout: 3000,
                ignoreLeaks: false,
            },

            testAll : {
                src: testDir + '**/*.js'
            }
        },

        uglify : {

            options : {
                compress : {
                    drop_console: true
                },
                mangle : true,
                sourceMap : false,
                preserveComments : false,
                report : 'gzip' // TODO : does this report option still work?
            },

            dist : {
                src : jsSrcFile,
                dest : jsDistDir + 'bullet.min.js'
            }
        },

        copy : {

            dist : {
                src : jsSrcFile,
                dest : jsDistDir + 'bullet.js'
            }
        }
    });

    require('load-grunt-tasks')(grunt, {pattern: ['grunt-*']});

    grunt.registerTask('default', ['simplemocha', 'uglify', 'copy', 'watch']);
    grunt.registerTask('dist', ['simplemocha', 'uglify', 'copy']);
    grunt.registerTask('test', ['simplemocha']);
};
<|next_version|>
module.exports = function (grunt) {

    'use strict';

    var jsSrcFile = 'src/bullet.js';
    var jsDistDir = 'dist/';
    var jsExampleLibsDir = 'example/js/libs/';
    var testDir = 'test/spec/';

    grunt.initConfig({

        watch : {

            js: {
                files: [
                    jsSrcFile,
                    testDir + '**/*.js'
                ],

                tasks: ['dist']
            }
        },

        simplemocha : {

            options: {
                timeout: 3000,
                ignoreLeaks: false,
            },

            testAll : {
                src: testDir + '**/*.js'
            }
        },

        uglify : {

            options : {
                compress : {
                    drop_console: true
                },
                mangle : true,
                sourceMap : false,
                preserveComments : false,
                report : 'gzip' // TODO : does this report option still work?
            },

            dist : {
                src : jsSrcFile,
                dest : jsDistDir + 'bullet.min.js'
            }
        },

        copy : {

            dist : {
                src : jsSrcFile,
                dest : jsDistDir + 'bullet.js'
            },

            example : {
                src : jsSrcFile,
                dest : jsExampleLibsDir + 'bullet.js'
            }
        }
    });

    require('load-grunt-tasks')(grunt, {pattern: ['grunt-*']});

    grunt.registerTask('default', ['simplemocha', 'uglify', 'copy', 'watch']);
    grunt.registerTask('dist', ['simplemocha', 'uglify', 'copy']);
    grunt.registerTask('test', ['simplemocha']);
};


Use Device module for deviceClass

Use Device module for deviceClass

--- src/kinvey.js
+++ src/kinvey.js
@@ -1,12 +1,14 @@
 import NodeKinvey from 'kinvey-node-sdk';
 import { CacheRack } from './rack';
 import Popup from './popup';
+import Device from './device';
 import assign from 'lodash/assign';

 export default class Kinvey extends NodeKinvey {
   static init(options = {}) {
     options = assign({
       cacheRack: new CacheRack(),
+      deviceClass: Device,
       popupClass: Popup
     }, options);
     return super.init(options);

<|original_code|>
import NodeKinvey from 'kinvey-node-sdk';
import { CacheRack } from './rack';
import Popup from './popup';
import assign from 'lodash/assign';

export default class Kinvey extends NodeKinvey {
  static init(options = {}) {
    options = assign({
      cacheRack: new CacheRack(),
      popupClass: Popup
    }, options);
    return super.init(options);
  }
}

<|edits_diff|>
--- src/kinvey.js
+++ src/kinvey.js
@@ -1,6 +1,7 @@
 import NodeKinvey from 'kinvey-node-sdk';
 import { CacheRack } from './rack';
 import Popup from './popup';
+import Device from './device';
 import assign from 'lodash/assign';

 export default class Kinvey extends NodeKinvey {
<|current_version|>
import NodeKinvey from 'kinvey-node-sdk';
import { CacheRack } from './rack';
import Popup from './popup';
import Device from './device';
import assign from 'lodash/assign';

export default class Kinvey extends NodeKinvey {
  static init(options = {}) {
    options = assign({
      cacheRack: new CacheRack(),
      popupClass: Popup
    }, options);
    return super.init(options);
  }
}

<|next_version|>
import NodeKinvey from 'kinvey-node-sdk';
import { CacheRack } from './rack';
import Popup from './popup';
import Device from './device';
import assign from 'lodash/assign';

export default class Kinvey extends NodeKinvey {
  static init(options = {}) {
    options = assign({
      cacheRack: new CacheRack(),
      deviceClass: Device,
      popupClass: Popup
    }, options);
    return super.init(options);
  }
}


Disable button on click :: master

Disable button on click :: master

--- public/js/script.js
+++ public/js/script.js
@@ -11,7 +11,11 @@
   }

   $('#toggleBtn').on('click', function(){
+    $('#toggleBtn').prop("disabled",true);
     toggleGarageDoor();
+    setTimeout(function(){
+      $('#toggleBtn').prop("disabled",false);
+    }, 1000 * 10); //10 seconds
   });

   setInterval(function(){

<|original_code|>

(function(document, window, $){
  var apiUrl = 'http://' +  window.location.hostname + ':' + window.location.port;

  var garageDoorStatus = function(){
    return $.get(apiUrl + '/status');
  };

  var toggleGarageDoor = function(){
    return $.post(apiUrl + '/toggle');
  }

  $('#toggleBtn').on('click', function(){
    toggleGarageDoor();
  });

  setInterval(function(){
    garageDoorStatus().done(function(response){
      $('#status').text(response.text);
    });
  }, 1000)

})(document, window, $)

<|edits_diff|>
--- public/js/script.js
+++ public/js/script.js
@@ -11,6 +11,7 @@
   }

   $('#toggleBtn').on('click', function(){
+    $('#toggleBtn').prop("disabled",true);
     toggleGarageDoor();
   });

<|current_version|>

(function(document, window, $){
  var apiUrl = 'http://' +  window.location.hostname + ':' + window.location.port;

  var garageDoorStatus = function(){
    return $.get(apiUrl + '/status');
  };

  var toggleGarageDoor = function(){
    return $.post(apiUrl + '/toggle');
  }

  $('#toggleBtn').on('click', function(){
    $('#toggleBtn').prop("disabled",true);
    toggleGarageDoor();
  });

  setInterval(function(){
    garageDoorStatus().done(function(response){
      $('#status').text(response.text);
    });
  }, 1000)

})(document, window, $)

<|next_version|>

(function(document, window, $){
  var apiUrl = 'http://' +  window.location.hostname + ':' + window.location.port;

  var garageDoorStatus = function(){
    return $.get(apiUrl + '/status');
  };

  var toggleGarageDoor = function(){
    return $.post(apiUrl + '/toggle');
  }

  $('#toggleBtn').on('click', function(){
    $('#toggleBtn').prop("disabled",true);
    toggleGarageDoor();
    setTimeout(function(){
      $('#toggleBtn').prop("disabled",false);
    }, 1000 * 10); //10 seconds
  });

  setInterval(function(){
    garageDoorStatus().done(function(response){
      $('#status').text(response.text);
    });
  }, 1000)

})(document, window, $)


Add Grunt JSHint task aliases

Add Grunt JSHint task aliases

--- gruntfile.js
+++ gruntfile.js
@@ -2,12 +2,17 @@
 module.exports = function (grunt) {
 	// Start w/ a clean slate
 	grunt.initConfig({});
+
 	// JSHint
 	grunt.loadNpmTasks("grunt-contrib-jshint");
 	grunt.config("jshint", {
 		"options": {"jshintrc": true},
 		"all": ["*.js"]
 	});
+
 	// Default task
 	grunt.registerTask("default", "Does nothing", function () { /* Does nothing */ });
+	// Aliases
+	grunt.registerTask("hint", ["jshint"]);
+	grunt.registerTask("lint", ["jshint"]);
 };

<|original_code|>
"use strict";
module.exports = function (grunt) {
	// Start w/ a clean slate
	grunt.initConfig({});
	// JSHint
	grunt.loadNpmTasks("grunt-contrib-jshint");
	grunt.config("jshint", {
		"options": {"jshintrc": true},
		"all": ["*.js"]
	});
	// Default task
	grunt.registerTask("default", "Does nothing", function () { /* Does nothing */ });
};

<|edits_diff|>
--- gruntfile.js
+++ gruntfile.js
@@ -2,12 +2,14 @@
 module.exports = function (grunt) {
 	// Start w/ a clean slate
 	grunt.initConfig({});
+
 	// JSHint
 	grunt.loadNpmTasks("grunt-contrib-jshint");
 	grunt.config("jshint", {
 		"options": {"jshintrc": true},
 		"all": ["*.js"]
 	});
+
 	// Default task
 	grunt.registerTask("default", "Does nothing", function () { /* Does nothing */ });
 };
<|current_version|>
"use strict";
module.exports = function (grunt) {
	// Start w/ a clean slate
	grunt.initConfig({});

	// JSHint
	grunt.loadNpmTasks("grunt-contrib-jshint");
	grunt.config("jshint", {
		"options": {"jshintrc": true},
		"all": ["*.js"]
	});

	// Default task
	grunt.registerTask("default", "Does nothing", function () { /* Does nothing */ });
};

<|next_version|>
"use strict";
module.exports = function (grunt) {
	// Start w/ a clean slate
	grunt.initConfig({});

	// JSHint
	grunt.loadNpmTasks("grunt-contrib-jshint");
	grunt.config("jshint", {
		"options": {"jshintrc": true},
		"all": ["*.js"]
	});

	// Default task
	grunt.registerTask("default", "Does nothing", function () { /* Does nothing */ });
	// Aliases
	grunt.registerTask("hint", ["jshint"]);
	grunt.registerTask("lint", ["jshint"]);
};


Update isFeatureEnabled to require a Set and add guard.

--- assets/js/features/index.js
+++ assets/js/features/index.js
@@ -22,11 +22,15 @@
  * Returns true if a feature is enabled; false otherwise.
  *
  * @since 1.25.0
+ * @since n.e.x.t Changed _enabledFeatures argument to be a `Set` instead of `Array`.
  *
  * @param {string} feature            The name of the feature to check.
  * @param {Set}    [_enabledFeatures] Optional. The set of enabled features. Uses `enabledFeatures` set by the server in a global JS variable, by default.
  * @return {boolean} `true` if a feature is enabled; `false` otherwise.
  */
 export const isFeatureEnabled = ( feature, _enabledFeatures = enabledFeatures ) => {
+	if ( ! ( _enabledFeatures instanceof Set ) ) {
+		return false;
+	}
 	return _enabledFeatures.has( feature );
 };

<|original_code|>
/**
 * Feature flags.
 *
 * Site Kit by Google, Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

export const enabledFeatures = new Set( global?._googlesitekitBaseData?.enabledFeatures || [] );

/**
 * Returns true if a feature is enabled; false otherwise.
 *
 * @since 1.25.0
 *
 * @param {string} feature            The name of the feature to check.
 * @param {Set}    [_enabledFeatures] Optional. The set of enabled features. Uses `enabledFeatures` set by the server in a global JS variable, by default.
 * @return {boolean} `true` if a feature is enabled; `false` otherwise.
 */
export const isFeatureEnabled = ( feature, _enabledFeatures = enabledFeatures ) => {
	return _enabledFeatures.has( feature );
};

<|edits_diff|>
--- assets/js/features/index.js
+++ assets/js/features/index.js
@@ -22,6 +22,7 @@
  * Returns true if a feature is enabled; false otherwise.
  *
  * @since 1.25.0
+ * @since n.e.x.t Changed _enabledFeatures argument to be a `Set` instead of `Array`.
  *
  * @param {string} feature            The name of the feature to check.
  * @param {Set}    [_enabledFeatures] Optional. The set of enabled features. Uses `enabledFeatures` set by the server in a global JS variable, by default.
<|current_version|>
/**
 * Feature flags.
 *
 * Site Kit by Google, Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

export const enabledFeatures = new Set( global?._googlesitekitBaseData?.enabledFeatures || [] );

/**
 * Returns true if a feature is enabled; false otherwise.
 *
 * @since 1.25.0
 * @since n.e.x.t Changed _enabledFeatures argument to be a `Set` instead of `Array`.
 *
 * @param {string} feature            The name of the feature to check.
 * @param {Set}    [_enabledFeatures] Optional. The set of enabled features. Uses `enabledFeatures` set by the server in a global JS variable, by default.
 * @return {boolean} `true` if a feature is enabled; `false` otherwise.
 */
export const isFeatureEnabled = ( feature, _enabledFeatures = enabledFeatures ) => {
	return _enabledFeatures.has( feature );
};

<|next_version|>
/**
 * Feature flags.
 *
 * Site Kit by Google, Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

export const enabledFeatures = new Set( global?._googlesitekitBaseData?.enabledFeatures || [] );

/**
 * Returns true if a feature is enabled; false otherwise.
 *
 * @since 1.25.0
 * @since n.e.x.t Changed _enabledFeatures argument to be a `Set` instead of `Array`.
 *
 * @param {string} feature            The name of the feature to check.
 * @param {Set}    [_enabledFeatures] Optional. The set of enabled features. Uses `enabledFeatures` set by the server in a global JS variable, by default.
 * @return {boolean} `true` if a feature is enabled; `false` otherwise.
 */
export const isFeatureEnabled = ( feature, _enabledFeatures = enabledFeatures ) => {
	if ( ! ( _enabledFeatures instanceof Set ) ) {
		return false;
	}
	return _enabledFeatures.has( feature );
};