<commit_before>var async = require('async');
var _ = require('lodash');
var debug = require('debug')('4front:dynamodb');

module.exports = function(DynamoDb) {
	DynamoDb.prototype.createVersion = function(versionData, callback) {
		debugger;
		this.models.Version.create(versionData, this._itemCallback(callback));
	};

	DynamoDb.prototype.getVersion = function(appId, versionId, callback) {
		debug("get version appId=%s, versionId=%s", appId, versionId);
		this.models.Version.get({appId: appId, versionId: versionId}, this._itemCallback(callback));
	};

	// List the versions for an app
	DynamoDb.prototype.listVersions = function(options, callback) {
		_.defaults(options, {
			excludeInactive: true
		});

		// var self = this;
		debug("list versions for app %s", options.appId);

		var chain = this.models.Version.query(options.appId);
		if (options.minVersionNum) {
			chain = chain.where('versionNum')
				.gte(options.minVersionNum)
				.usingIndex('appIdVersionNumIndex');
		}

		if (options.excludeInactive)
			chain = chain.filter('active').equals(true);

		if (options.limit)<commit_msg>Remove debugger statement<commit_after>var async = require('async');
var _ = require('lodash');
var debug = require('debug')('4front:dynamodb');

module.exports = function(DynamoDb) {
	DynamoDb.prototype.createVersion = function(versionData, callback) {
		this.models.Version.create(versionData, this._itemCallback(callback));
	};

	DynamoDb.prototype.getVersion = function(appId, versionId, callback) {
		debug("get version appId=%s, versionId=%s", appId, versionId);
		this.models.Version.get({appId: appId, versionId: versionId}, this._itemCallback(callback));
	};

	// List the versions for an app
	DynamoDb.prototype.listVersions = function(options, callback) {
		_.defaults(options, {
			excludeInactive: true
		});

		// var self = this;
		debug("list versions for app %s", options.appId);

		var chain = this.models.Version.query(options.appId);
		if (options.minVersionNum) {
			chain = chain.where('versionNum')
				.gte(options.minVersionNum)
				.usingIndex('appIdVersionNumIndex');
		}

		if (options.excludeInactive)
			chain = chain.filter('active').equals(true);

		if (options.limit)
{'fraction_non_alphanumeric': 0.14681818181818182, 'fraction_numerical': 0.0009090909090909091, 'mean_word_length': 5.113888888888889, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4767282', 'n_tokens_mistral': 766, 'n_tokens_neox': 695, 'n_words': 134}