Comparing version 5.8.0 to 5.9.0
@@ -17,7 +17,7 @@ var gulp = require('gulp'), | ||
var args = minimist(process.argv); | ||
var options = {}; | ||
if (semver.valid(args.version)) options.version = args.version; | ||
else options.type = args.version; | ||
return gulp.src(['./package.json']) | ||
@@ -49,2 +49,3 @@ .pipe(bump(options).on('error', gutil.log)) | ||
runSequence( | ||
'postpublish', | ||
'version-bump', | ||
@@ -51,0 +52,0 @@ 'version-commit', |
@@ -0,0 +0,0 @@ function __export(m) { |
@@ -432,2 +432,12 @@ /// <reference path="../_references.d.ts" /> | ||
}; | ||
Model.prototype.aggregate = function (pipeline) { | ||
var _this = this; | ||
return new Bluebird(function (resolve, reject) { | ||
_this.collection.aggregate(pipeline, function (err, results) { | ||
if (err) | ||
return reject(err); | ||
return resolve(results); | ||
}); | ||
}); | ||
}; | ||
Model.prototype.ensureIndex = function (specification, options, callback) { | ||
@@ -434,0 +444,0 @@ var _this = this; |
@@ -0,0 +0,0 @@ /// <reference path="../../_references.d.ts" /> |
@@ -30,2 +30,3 @@ /// <reference path="../_references.d.ts" /> | ||
import InstanceImplementation from './InstanceInterface'; | ||
import * as AggregationPipeline from './Aggregate'; | ||
@@ -49,5 +50,5 @@ /** | ||
if (!_.isPlainObject(instanceType.schema) || instanceType.schema._id === undefined) throw new Error("You failed to provide a valid schema for this model"); | ||
this._core = core; | ||
this.loadExternal(instanceType); | ||
@@ -57,3 +58,3 @@ this.onNewModel(); | ||
} | ||
private loadExternal(instanceType: InstanceImplementation<TDocument, TInstance>) { | ||
@@ -67,5 +68,5 @@ this._collection = instanceType.collection; | ||
this._indexes = instanceType.indexes || []; | ||
if(!this._schema._id) this._schema._id = MongoDB.ObjectID; | ||
if(this._schema._id === MongoDB.ObjectID && !this._transforms['_id']) | ||
@@ -82,3 +83,3 @@ this._transforms['_id'] = { | ||
} | ||
private loadInternal() { | ||
@@ -89,3 +90,3 @@ this._cache = new ModelCache(this); | ||
} | ||
private onNewModel() { | ||
@@ -112,5 +113,5 @@ this._core.plugins.forEach(plugin => plugin.newModel && plugin.newModel(this)); | ||
} | ||
private _hooks: Hooks<TDocument, TInstance> = {}; | ||
/** | ||
@@ -154,3 +155,3 @@ * Gets the even hooks subscribed on this model for a number of different state changes | ||
} | ||
/** | ||
@@ -200,21 +201,21 @@ * Gets the name of the underlying MongoDB collection from which this model's documents are retrieved | ||
} | ||
private _transforms: { [property: string]: { fromDB: (value: any) => any; toDB: (value: any) => any; } }; | ||
get transforms() { | ||
return this._transforms; | ||
} | ||
private _validators: Skmatc.Validator[]; | ||
get validators() { | ||
return this._validators; | ||
} | ||
private _indexes: (Index.Index | Index.IndexSpecification)[]; | ||
get indexes() { | ||
return this._indexes; | ||
} | ||
/** | ||
@@ -509,3 +510,3 @@ * Retrieves all documents in the collection and wraps them as instances | ||
} | ||
options = options || {}; | ||
@@ -600,3 +601,3 @@ | ||
var conditions: { _id?: any, [key: string]: any } = <{ _id?: any, [key: string]: any }>conds; | ||
if (typeof options === 'function') { | ||
@@ -606,3 +607,3 @@ callback = <General.Callback<number>>options; | ||
} | ||
if (typeof conds == 'function') { | ||
@@ -616,3 +617,3 @@ callback = <General.Callback<number>>conds; | ||
options = options || {}; | ||
_.defaults(options, { | ||
@@ -641,2 +642,11 @@ w: 'majority' | ||
aggregate<T>(pipeline: AggregationPipeline.Stage[]): Bluebird<T[]> { | ||
return new Bluebird<T[]>((resolve, reject) => { | ||
this.collection.aggregate(pipeline, (err, results) => { | ||
if(err) return reject(err); | ||
return resolve(results); | ||
}); | ||
}); | ||
} | ||
/** | ||
@@ -643,0 +653,0 @@ * Ensures that the given index is created for the collection |
{ | ||
"name": "iridium", | ||
"version": "5.8.0", | ||
"version": "5.9.0", | ||
"author": "Benjamin Pannell <admin@sierrasoftworks.com>", | ||
@@ -5,0 +5,0 @@ "description": "A custom lightweight ORM for MongoDB designed for power-users", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1121657
185
5118