Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

orm

Package Overview
Dependencies
Maintainers
2
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

orm - npm Package Compare versions

Comparing version 3.1.0 to 3.2.0

328

Changelog.md

@@ -0,6 +1,10 @@

### v3.2.0
- Make [.find|.where|.all] synonyms & allow them to chain multiple times
- Update dependencies
### v3.1.0
- Add `enumerable` flag to exclude instance properties from enumeration (#724)
- Add `enumerable` flag to exclude instance properties from enumeration ([#724](../../issues/724))
### v3.0.0
- Rename `cache` -> `identityCache` and **disable by default** (#350, #564, #626, #672, #684, #694, #721)
- Rename `cache` -> `identityCache` and **disable by default** ([#350](../../issues/350), [#564](../../issues/564), [#626](../../issues/626), [#672](../../issues/672), [#684](../../issues/684), [#694](../../issues/694), [#721](../../issues/721))

@@ -22,10 +26,10 @@ **This is a potentially breaking change:**

### v2.1.29
- Fix hasOne association when ID is 0 (#681)
- Fix global var leak (#682)
- Fix hasOne association when ID is 0 ([#681](../../issues/681))
- Fix global var leak ([#682](../../issues/682))
### v2.1.28
- Ensure hasMany associations work when properties have mapsTo (#679)
- Ensure hasMany associations work when properties have mapsTo ([#679](../../issues/679))
### v2.1.27
- Fix noisy mysql debug output (#642)
- Fix noisy mysql debug output ([#642](../../issues/642))

@@ -37,4 +41,4 @@ ### v2.1.26

### v2.1.25
- Fix `pool` and `debug` query options boolean check (#638)
- Add `hasOne(field: 'userId', mapsTo: 'user_id')` option (#638)
- Fix `pool` and `debug` query options boolean check ([#638](../../issues/638))
- Add `hasOne(field: 'userId', mapsTo: 'user_id')` option ([#638](../../issues/638))

@@ -45,27 +49,27 @@ ### v2.1.24

### v2.1.23
- Green tests on io.js & node 0.12 (#618)
- Don't crash on null dates if timezone is set (#618)
- Fix wrong error when module is missing (#593)
- Fix key field when using `mapsTo` and cache (#580)
- Green tests on io.js & node 0.12 ([#618](../../issues/618))
- Don't crash on null dates if timezone is set ([#618](../../issues/618))
- Fix wrong error when module is missing ([#593](../../issues/593))
- Fix key field when using `mapsTo` and cache ([#580](../../issues/580))
### v2.1.22
- Fix ignorecase unique scope for hasOne property (#603)
- Fix ignorecase unique scope for hasOne property ([#603](../../issues/603))
### v2.1.21
- Fix mixed case uniqueness constraint on postgres (#597)
- Fix mongo adapter association delete (#543)
- Fix mongo ne/eq comparators for _id key (#586)
- Fix mixed case uniqueness constraint on postgres ([#597](../../issues/597))
- Fix mongo adapter association delete ([#543](../../issues/543))
- Fix mongo ne/eq comparators for _id key ([#586](../../issues/586))
### v2.1.20 - 19 Nov 2014
- Exposing dirty properties array on the instance (#575)
- Bump node-enforce version (#562)
- Exposing dirty properties array on the instance ([#575](../../issues/575))
- Bump node-enforce version ([#562](../../issues/562))
### v2.1.19 - 21 Aug 2014
- Fix Chain.find().remove() & Chain.find.count() with mapsTo keys (#530)
- Fix Chain.find().remove() & Chain.find.count() with mapsTo keys ([#530](../../issues/530))
- Add not_like comparator
### v2.1.18 - 29 Jul 2014
- Add `alwaysValidate` flag (#540, #352)
- Fix mongo hasMany wrong instance bug (#479)
- Fix mysql index bug (dresende/node-sql-ddl-sync#19)
- Add `alwaysValidate` flag ([#540](../../issues/540), [#352](../../issues/352))
- Fix mongo hasMany wrong instance bug ([#479](../../issues/479))
- Fix mysql index bug (dresende/node-sql-ddl-sync[#19](../../issues/19))

@@ -77,3 +81,3 @@ ### v2.1.17 - 24 Jul 2014

- Fix Model.create missing properties bug
- Add missing `var` (#523)
- Add missing `var` ([#523](../../issues/523))
- Fix hasOne `required: true` when `instance.returnAllErrors` is true.

@@ -83,11 +87,11 @@ This also makes hasOne required validations messages consistent with other validation messages.

### v2.1.15 - 05 Jun 2014
- Feature: Enable plugging in custom third-party drivers (now known as adapters) (#512)
- Add Instance.set() so that properties of type object can have their properties set and mark model as dirty (#517)
- Feature: Enable plugging in custom third-party drivers (now known as adapters) ([#512](../../issues/512))
- Add Instance.set() so that properties of type object can have their properties set and mark model as dirty ([#517](../../issues/517))
- Add Instance.markAsDirty(propName) to force a properties state to dirty/changed.
- Enable Property.mapsTo for keys (#509)
- Fix hasMany join tables with custom key columns (#510)
- Enable Property.mapsTo for keys ([#509](../../issues/509))
- Fix hasMany join tables with custom key columns ([#510](../../issues/510))
### v2.1.14 - 22 May 2014
- Allow explicitly specifying `key: true` on properties rather than passing in an array of ids.
- Fix Property.mapsTo (#506)
- Fix Property.mapsTo ([#506](../../issues/506))

@@ -99,3 +103,3 @@ ### v2.1.13 - 21 May 2014

- Add custom-type support to hasMany extra properties.
- Fix SQLite index name collisions (#499)
- Fix SQLite index name collisions ([#499](../../issues/499))

@@ -106,10 +110,10 @@ ### v2.1.11 - 19 May 2014

### v2.1.10 - 09 May 2014
- Fix sqlite Dialect.clear - resets incremental counters (#497)
- Fix sqlite Dialect.clear - resets incremental counters ([#497](../../issues/497))
### v2.1.9 - 06 May 2014
- Add basic PostGIS support - (#456, #375)
- Allow mapping model properties to differently named columns (#273, #495)
- Add basic PostGIS support - ([#456](../../issues/456), [#375](../../issues/375))
- Allow mapping model properties to differently named columns ([#273](../../issues/273), [#495](../../issues/495))
### v2.1.8 - 28 Apr 2014
- Fix '.omit' (#491)
- Fix '.omit' ([#491](../../issues/491))

@@ -124,31 +128,31 @@ ### v2.1.7 - 25 Apr 2014

### v2.1.5 - 08 Apr 2014
- Don't create indexes for primary/composite keys; they are created automatically (#484)
- Don't create indexes for primary/composite keys; they are created automatically ([#484](../../issues/484))
### v2.1.4 - 19 Mar 2014
- Fix TypeScript module declaration (#362)
- Fixes reversed hasOne.getAccessor when called without callback (#267)
- Fixes default pool value (#366)
- Fixes erroneous misformatting of top-level $and/$or clauses (#365)
- Fix and improve TypeScript declaration (#369)
- Use local as default timezone, pass timezone option to Query (#325)
- Postgres: always save object as Buffer (#378)
- Postgres: fix queries for prop create index, and for primary keys (#377)
- Typo in property definition (#382)
- Implement eager loading - huge performance win (#393)
- Make model methods defined by `defineProperty` writable so they can be mocked (#399)
- Allow composite keys when calling remove. (#345, #358)
- Fixed bug on like expression using MongoDB (#403)
- Fixes pool and debug settings always true (#405)
- Update express middleware for express.io (#413)
- Fix TypeScript module declaration ([#362](../../issues/362))
- Fixes reversed hasOne.getAccessor when called without callback ([#267](../../issues/267))
- Fixes default pool value ([#366](../../issues/366))
- Fixes erroneous misformatting of top-level $and/$or clauses ([#365](../../issues/365))
- Fix and improve TypeScript declaration ([#369](../../issues/369))
- Use local as default timezone, pass timezone option to Query ([#325](../../issues/325))
- Postgres: always save object as Buffer ([#378](../../issues/378))
- Postgres: fix queries for prop create index, and for primary keys ([#377](../../issues/377))
- Typo in property definition ([#382](../../issues/382))
- Implement eager loading - huge performance win ([#393](../../issues/393))
- Make model methods defined by `defineProperty` writable so they can be mocked ([#399](../../issues/399))
- Allow composite keys when calling remove. ([#345](../../issues/345), [#358](../../issues/358))
- Fixed bug on like expression using MongoDB ([#403](../../issues/403))
- Fixes pool and debug settings always true ([#405](../../issues/405))
- Update express middleware for express.io ([#413](../../issues/413))
- Allow HasMany.setAccessor to take an empty array
- Fix DML if object value is null, JSON.stringify return string 'null' (#380)
- Correct sqlite log statement (#452)
- Make association methods writable so they can be mocked (#451)
- Throw ORM errors rather than generic ones (#455)
- Fix sqlite3 driver with config object on windows (#461)
- Fix 'No associations defined' error (#398)
- Don't modify connection object (#469)
- Don't fire afterSave hooks when calling save with no changes (#457)
- Fix reverse has one association findBy* (#450)
- Auto cast hasMany extra properties with types like 'Object' (#466)
- Fix DML if object value is null, JSON.stringify return string 'null' ([#380](../../issues/380))
- Correct sqlite log statement ([#452](../../issues/452))
- Make association methods writable so they can be mocked ([#451](../../issues/451))
- Throw ORM errors rather than generic ones ([#455](../../issues/455))
- Fix sqlite3 driver with config object on windows ([#461](../../issues/461))
- Fix 'No associations defined' error ([#398](../../issues/398))
- Don't modify connection object ([#469](../../issues/469))
- Don't fire afterSave hooks when calling save with no changes ([#457](../../issues/457))
- Fix reverse has one association findBy* ([#450](../../issues/450))
- Auto cast hasMany extra properties with types like 'Object' ([#466](../../issues/466))
- Add example full featured express app - AnonTXT

@@ -158,16 +162,16 @@

- Fixes connection strings being parsed by url module to don't forget about port :) (#355)
- Fixes connection strings being parsed by url module to don't forget about port :) ([#355](../../issues/355))
- Fixes tests common.getConnectionString to use common.getConfig
- Converts indentation from spaces:2 to tabs
- Removes unnecessary path requirement in ORM.js
- Changes user methods to be writeable property instances (fixes #296)
- Fixes afterAutoFetch next(err) bubling up just like afterLoad (#301)
- Fixes cache for hasOne associations (#339)
- Adds findByAssociation to extendsTo (#314)
- Fixes Model.extendsTo autoFetch not working (throwing) (#323)
- Adds hasMany hooks.beforeSave (#324)
- Changes user methods to be writeable property instances (fixes [#296](../../issues/296))
- Fixes afterAutoFetch next(err) bubling up just like afterLoad ([#301](../../issues/301))
- Fixes cache for hasOne associations ([#339](../../issues/339))
- Adds findByAssociation to extendsTo ([#314](../../issues/314))
- Fixes Model.extendsTo autoFetch not working (throwing) ([#323](../../issues/323))
- Adds hasMany hooks.beforeSave ([#324](../../issues/324))
### v2.1.2 - 16 Sep 2013
- Fixes stack overflow on instance.save() with a reversed hasOne association (#338)
- Fixes stack overflow on instance.save() with a reversed hasOne association ([#338](../../issues/338))
- Reverts should dev dependency to 1.2.2 (newer version was causing problems)

@@ -179,21 +183,21 @@ - When using postgres you can now use pg@2.6.2 (unless when connecting to Heroku - use 2.5.0)

- Add TypeScript interface
- Allow custom join tables (#276)
- Fixes stack overflow when saving auto-fetched model with relations (#279)
- Unique validator can be scoped and case insensitive (#288)
- Allow async express middleware (#291)
- Allow finding by associations (#293)
- Fix sqlite find with boolean (#292)
- Fix `afterLoad` hook error handling (#301)
- Allow auto-escaping for custom queries (#304)
- Add support for custom property types (#305)
- Allow ordering by raw sql - .orderRaw() when chaining (#308, #311)
- Fix saving Instance.extra fields (#312)
- Fix `NaN` handling (#310)
- Fix incorrect SQL query (#313)
- Deprecated `PARAM_MISSMATCH` ErrorCode in favour of correctly spelt `PARAM_MISMATCH` (#315)
- Add promises to query chain (#316)
- Adds a test for hasMany.delAccessor with arguments switched (#320)
- Allow passing timezone in database connection string, local timezone is now default (#325, #303)
- Adds ability to call db.load() with multiple files (closes #329)
- For mysql driver, when using pool, use con.release() instead of con.end() (if defined) (closes #335)
- Allow custom join tables ([#276](../../issues/276))
- Fixes stack overflow when saving auto-fetched model with relations ([#279](../../issues/279))
- Unique validator can be scoped and case insensitive ([#288](../../issues/288))
- Allow async express middleware ([#291](../../issues/291))
- Allow finding by associations ([#293](../../issues/293))
- Fix sqlite find with boolean ([#292](../../issues/292))
- Fix `afterLoad` hook error handling ([#301](../../issues/301))
- Allow auto-escaping for custom queries ([#304](../../issues/304))
- Add support for custom property types ([#305](../../issues/305))
- Allow ordering by raw sql - .orderRaw() when chaining ([#308](../../issues/308), [#311](../../issues/311))
- Fix saving Instance.extra fields ([#312](../../issues/312))
- Fix `NaN` handling ([#310](../../issues/310))
- Fix incorrect SQL query ([#313](../../issues/313))
- Deprecated `PARAM_MISSMATCH` ErrorCode in favour of correctly spelt `PARAM_MISMATCH` ([#315](../../issues/315))
- Add promises to query chain ([#316](../../issues/316))
- Adds a test for hasMany.delAccessor with arguments switched ([#320](../../issues/320))
- Allow passing timezone in database connection string, local timezone is now default ([#325](../../issues/325), [#303](../../issues/303))
- Adds ability to call db.load() with multiple files (closes [#329](../../issues/329))
- For mysql driver, when using pool, use con.release() instead of con.end() (if defined) (closes [#335](../../issues/335))
- Passes error from afterLoad hook to ready event

@@ -208,11 +212,11 @@ - Most errors now have a model property

- Adds License (MIT) file (closes #271)
- Make Model.get respect Model autoFetch default value (#277)
- Changes the way ":" is added to sqlite db paths (#270)
- Fixes duplicated debug lines for postgres (#258)
- Fixes not saving associations if no changes (other than associations) are made (#256)
- Fixes autoFetch being discarded in Model.get options (closes #266)
- Adds beforeDefine to plugins (#263)
- Allows user to pass an object to extendsTo.setAccessor instead of an instance (detected via #250)
- Changes autoFetch to avoid autofetching if instance is not saved (it's new!) (#242)
- Adds License (MIT) file (closes [#271](../../issues/271))
- Make Model.get respect Model autoFetch default value ([#277](../../issues/277))
- Changes the way ":" is added to sqlite db paths ([#270](../../issues/270))
- Fixes duplicated debug lines for postgres ([#258](../../issues/258))
- Fixes not saving associations if no changes (other than associations) are made ([#256](../../issues/256))
- Fixes autoFetch being discarded in Model.get options (closes [#266](../../issues/266))
- Adds beforeDefine to plugins ([#263](../../issues/263))
- Allows user to pass an object to extendsTo.setAccessor instead of an instance (detected via [#250](../../issues/250))
- Changes autoFetch to avoid autofetching if instance is not saved (it's new!) ([#242](../../issues/242))
- Changes validations and predefined validators to use enforce@0.1.1

@@ -226,3 +230,3 @@ - Adds support for setting properties.association_key to be a function (name, field)

- Allow before* hooks to modify the instance
- Fixes #226 - hasOne delAccessor not working
- Fixes [#226](../../issues/226) - hasOne delAccessor not working
- Adds Utilities.getRealPath to look for the real path to load based on the file where it was called from (for db.load and db.use)

@@ -235,11 +239,11 @@ - Fixes Model.aggregate().call() to accept no arguments except function name

- Support for 'point' type as a property (#221)
- .call() in aggregates for generic functions (#204)
- Adds hook afterAutoFetch triggered after extending and auto fetching (if any) associations (#219)
- Support for 'point' type as a property ([#221](../../issues/221))
- .call() in aggregates for generic functions ([#204](../../issues/204))
- Adds hook afterAutoFetch triggered after extending and auto fetching (if any) associations ([#219](../../issues/219))
- Adds predefined validator .password()
- Adds ability to have the afterLoad hook blocking (#219)
- Adds ability to have the afterLoad hook blocking ([#219](../../issues/219))
- Changes Model.create() to wait for createInstance callback instead of using the returned value
- Fixes problem with hasOne associations for none persisted instances and autoFetch active just blocking
- Refactored Model.hasOne() constructor to be able to mix parameters
- Fixes reversed hasOne association on the reversed model not being correctly saved (#216)
- Fixes reversed hasOne association on the reversed model not being correctly saved ([#216](../../issues/216))
- Changes Model.hasMany.addAccessor to throw just like .setAccessor when no associations are passed

@@ -249,3 +253,3 @@ - Adds ability to pass an Array to hasMany.hasAccessor and also not passing any instance to hasAccessor and have it check for any associated item

- Fixes postgres driver not returning numbers for number columns
- Fixes passing json object instead of instances to Model.create() associations (#216)
- Fixes passing json object instead of instances to Model.create() associations ([#216](../../issues/216))
- Passes Model to Instance directly, changes Instance to use Model.properties instead of opts.properties

@@ -258,3 +262,3 @@ - Exposes Model.properties

- Adds db.drop() - similar to db.sync()
- Changes hasMany.getAccessor to support order as string (closes #196)
- Changes hasMany.getAccessor to support order as string (closes [#196](../../issues/196))
- Handle django string formatted sqlite datetime

@@ -265,8 +269,8 @@ - Many bug fixes

- Changes many errors to use the ErrorCodes generator (#206)
- Changes Model.aggregate() to support multiple orders when calling .order() (#207)
- Changes many errors to use the ErrorCodes generator ([#206](../../issues/206))
- Changes Model.aggregate() to support multiple orders when calling .order() ([#207](../../issues/207))
- Changes Readme.md sqlite3 version and adds warning.
- Fix wrong import of debug output for aggregate functions
- Fix orm when running on node v0.6 (at least) and module not found error has no code property
- Adds model.namePrefix setting (#203)
- Adds model.namePrefix setting ([#203](../../issues/203))
- Fixes bug when passing an array (object) of ids but no options object

@@ -280,5 +284,5 @@ - Only mark model as dirty if a property has _really_ changed

- Fix required property model.save only threw a single error with returnAllErrors = true
- Fixes some hasMany association usage of Association.id to check for real id property name (#197)
- Changes db.load() to return value from loaded and invoked function (#194)
- Adds possibility to add a callback to ChainFind.find() (#190)
- Fixes some hasMany association usage of Association.id to check for real id property name ([#197](../../issues/197))
- Changes db.load() to return value from loaded and invoked function ([#194](../../issues/194))
- Adds possibility to add a callback to ChainFind.find() ([#190](../../issues/190))
- Adds .findByX(...) to .hasOne("X", ...)

@@ -293,7 +297,7 @@ - Allow db.load() to work outside of module.exports

- Avoids throwing when calling db.close() without a callback and using pool in mysql (fixes #180)
- Adds initial code to support passing associations when creating new instances (#162)
- Avoids throwing when calling db.close() without a callback and using pool in mysql (fixes [#180](../../issues/180))
- Adds initial code to support passing associations when creating new instances ([#162](../../issues/162))
- Changes Model.exists() to allow array or object passing
- Allows passing an object instead of an instance as an hasOne asssociation
- Fixes bug introduced in 2.0.12 forcing extra properties being ignored (fixes #183)
- Fixes bug introduced in 2.0.12 forcing extra properties being ignored (fixes [#183](../../issues/183))

@@ -303,11 +307,11 @@ ### v2.0.12 - 30 May 2013

- New plugin: orm-paging
- Adds Model.one() as an alias for Model.all().limit(1) (#148)
- Changes Model.one() to return only one instance (or null) instead of an Array (#148)
- Allow passing a single object to Model.create() (#159)
- Fixes passing unknown properties to new instances (fixes #178)
- Adds AggregateFunctions.limit() (#172)
- Checks for driver debug flag and prints debug lines in AggregateFunctions (#171)
- Adds Model.one() as an alias for Model.all().limit(1) ([#148](../../issues/148))
- Changes Model.one() to return only one instance (or null) instead of an Array ([#148](../../issues/148))
- Allow passing a single object to Model.create() ([#159](../../issues/159))
- Fixes passing unknown properties to new instances (fixes [#178](../../issues/178))
- Adds AggregateFunctions.limit() ([#172](../../issues/172))
- Checks for driver debug flag and prints debug lines in AggregateFunctions ([#171](../../issues/171))
- Added Hook 'beforeValidation' prior to _all_ validations
- Avoids JSON parsing values when they are already objects (and not string buffers) (#168)
- Changes beforeRemove, beforeCreate, beforeSave and beforeValidation to use Hooks.wait() (sync or async hooks) (#167)
- Avoids JSON parsing values when they are already objects (and not string buffers) ([#168](../../issues/168))
- Changes beforeRemove, beforeCreate, beforeSave and beforeValidation to use Hooks.wait() (sync or async hooks) ([#167](../../issues/167))
- Support specifying size of number columns

@@ -321,7 +325,7 @@ - Many more bug fixes

- Changes orm.connect() to return an EventEmitter
- Avoids saving an instance if a property is null and is marked as required (#142)
- Avoids passing property validations if property is null and is not required (#142)
- Fixes documentation where user should be used instead of username in connection options (closes #145)
- Avoids saving an instance if a property is null and is marked as required ([#142](../../issues/142))
- Avoids passing property validations if property is null and is not required ([#142](../../issues/142))
- Fixes documentation where user should be used instead of username in connection options (closes [#145](../../issues/145))
- Adds postgresql schema support
- Fixes autoFetchLimit and cascadeRemove options not being used when set to 0 or false (fixes #144)
- Fixes autoFetchLimit and cascadeRemove options not being used when set to 0 or false (fixes [#144](../../issues/144))

@@ -334,8 +338,8 @@ ### v2.0.10 - 25 Apr 2013

- Adds initial support for multi primary key models
- Updates DB.define() and Model.get() to support tables with multiple primary keys (#135)
- Updates DB.define() and Model.get() to support tables with multiple primary keys ([#135](../../issues/135))
- Creates Model.all() as alias to Model.find(), adds simple example
- Fixes autoFetch option not being considered in Model.find() (#120)
- Fixes autoFetch option not being considered in Model.find() ([#120](../../issues/120))
- Adds support for chaining and rechaining with ChainFind
- Fixes bug about connection config object not having query key (fixes #130)
- Adds initial plugin architecture - .use() (#121)
- Fixes bug about connection config object not having query key (fixes [#130](../../issues/130))
- Adds initial plugin architecture - .use() ([#121](../../issues/121))
- Fixes some bugs

@@ -347,12 +351,12 @@ - Adds more tests

- Correct 'returnAllErrors' setting behaviour
- Adds default settings properties.required = false (#110)
- Changes instance.save() to support an hash of changes before saving (#111)
- Adds setting connection.reconnect (default=false) to auto-reconnect (only mysql for now) (#112)
- Adds possibility of .order() to aggregate method (#114)
- Adds .select() aggregate function to support additional properties to be selected (#114)
- Adds .as() aggregate function to define alias to previous function (#123)
- Adds .distinct() aggregate function to all drivers (#123)
- Changes model.find() queries to specify columns instead of selecting * from tables (#106)
- Changes hasMany.addAccessor to support arrays of instances (#97)
- Adds support for descending ordering using "-property" (#115)
- Adds default settings properties.required = false ([#110](../../issues/110))
- Changes instance.save() to support an hash of changes before saving ([#111](../../issues/111))
- Adds setting connection.reconnect (default=false) to auto-reconnect (only mysql for now) ([#112](../../issues/112))
- Adds possibility of .order() to aggregate method ([#114](../../issues/114))
- Adds .select() aggregate function to support additional properties to be selected ([#114](../../issues/114))
- Adds .as() aggregate function to define alias to previous function ([#123](../../issues/123))
- Adds .distinct() aggregate function to all drivers ([#123](../../issues/123))
- Changes model.find() queries to specify columns instead of selecting * from tables ([#106](../../issues/106))
- Changes hasMany.addAccessor to support arrays of instances ([#97](../../issues/97))
- Adds support for descending ordering using "-property" ([#115](../../issues/115))
- Adds pool support to postgres driver

@@ -369,9 +373,9 @@ - Removes postgres axomic driver

- Adds more aggregate functions to the several drivers
- Adds groupBy to aggregate methods (#99)
- Adds groupBy to aggregate methods ([#99](../../issues/99))
- Adds possibility to use "-property" to indicate a descending order in Model.find()
- Adds setting instance.returnAllErrors (default: true)
- Changes hasMany.setAccessor to support passing an array of instances (#97)
- Fixes property defaultValue not being set if property is null (closes #104)
- Adds support for indexes on properties that are no associations (#98)
- Adds a new option to add multi-column indexes to models (#98)
- Changes hasMany.setAccessor to support passing an array of instances ([#97](../../issues/97))
- Fixes property defaultValue not being set if property is null (closes [#104](../../issues/104))
- Adds support for indexes on properties that are no associations ([#98](../../issues/98))
- Adds a new option to add multi-column indexes to models ([#98](../../issues/98))
- Bug fixes

@@ -382,19 +386,19 @@

- Fixed SQLite driver writing to console when it should not
- Changes Express middleware to wait for connections (errored or not) before processing requests (#92)
- Avoids loosing previously set limit (if set) on Model.fin() (#93)
- Changes Express middleware to wait for connections (errored or not) before processing requests ([#92](../../issues/92))
- Avoids loosing previously set limit (if set) on Model.fin() ([#93](../../issues/93))
- Fixes hasMany getAccessor when using an Array as only argument (specific properties)
- Adds ChainFind .last() (similar to .first())
- Fixes hasMany acessor names to correctly convert prop_name to PropName (underscores)
- Adds hasMany hasAcessor conditional to ChainFind (#94)
- Adds hasMany hasAcessor conditional to ChainFind ([#94](../../issues/94))
### v2.0.6 - 22 Mar 2013
- Changes orm.connect to check connection url/opts to avoid throwing some errors about missing protocol or database (#75)
- Changes orm.connect to check connection url/opts to avoid throwing some errors about missing protocol or database ([#75](../../issues/75))
- Hardens some validators againt null/undefined, changes match validator to avoid compiling regex everytime it's called
- Changes back default instance properties to null instead of undefined
- Changes Express middleware to be able to have more than one connection (#76)
- Changes Singleton to avoid cache if save_check option is enabled and cached instance is not saved (#78)
- Changes Express middleware to be able to have more than one connection ([#76](../../issues/76))
- Changes Singleton to avoid cache if save_check option is enabled and cached instance is not saved ([#78](../../issues/78))
- Adds Model.aggregate()
- Adds 'required' option to hasOne associations
- Changes singleton uid creation to use driver uid (#86)
- Changes singleton uid creation to use driver uid ([#86](../../issues/86))
- Changes Model.drop and Model.sync to be resistive to no callback

@@ -408,8 +412,8 @@ - Changes ORM.sync() to also be resistant to no callback

- Adds initial middleware for Express
- Moves beforeCreate to near beforeSave so people can change instance just like beforeSave (#69)
- Fixes bug when creating Models without all data (#69)
- Changes drivers.count() to be able to pass options (related to #68)
- Changes postgres DDL to create ENUM types before table (#71)
- Moves beforeCreate to near beforeSave so people can change instance just like beforeSave ([#69](../../issues/69))
- Fixes bug when creating Models without all data ([#69](../../issues/69))
- Changes drivers.count() to be able to pass options (related to [#68](../../issues/68))
- Changes postgres DDL to create ENUM types before table ([#71](../../issues/71))
- Changes hasOne.getAccessor to be able to fetch instance before association (if needed)
- Adds support for Object property type in DDL drivers (#72)
- Adds support for Object property type in DDL drivers ([#72](../../issues/72))

@@ -419,11 +423,11 @@ ### v2.0.4 - 7 Mar 2013

- Changes db.load() to behave like builtin require()
- Moves hook beforeSave to before checking validations (#66)
- Moves hook beforeSave to before checking validations ([#66](../../issues/66))
- Changes postgres driver to support ssl flag and pass it to pg driver
- Adds possibility to add order to hasMany getAccessor (#58)
- Adds possibility to add order to hasMany getAccessor ([#58](../../issues/58))
- Fixes hasOne reversed associations not having setAccessor
- Adds db.ping() (#57)
- Adds db.ping() ([#57](../../issues/57))
- Changes db.load to avoid throwing and just create the error
- Added "afterRemove" hook
- Added "afterCreate" hook
- Support Model.find({ prop: null }) (closes #59)
- Support Model.find({ prop: null }) (closes [#59](../../issues/59))
- Adds LIKE operator

@@ -434,5 +438,5 @@ - Many bug fixes

- Fixes postgresql integer columns (#52)
- Adds boolean support for sqlite (#50)
- Fixes an issue where hasMany association properties were not being checked (#49)
- Fixes postgresql integer columns ([#52](../../issues/52))
- Adds boolean support for sqlite ([#50](../../issues/50))
- Fixes an issue where hasMany association properties were not being checked ([#49](../../issues/49))
- Changes hasMany associations to be able to make some call without callback

@@ -439,0 +443,0 @@ - Makes Instances trigger beforeRemove event

@@ -21,2 +21,73 @@ var _ = require("lodash");

var chainRun = function (cb) {
var order, conditions;
conditions = Utilities.transformPropertyNames(
opts.conditions, opts.properties
);
order = Utilities.transformOrderPropertyNames(
opts.order, opts.properties
);
opts.driver.find(opts.only, opts.table, conditions, {
limit : opts.limit,
order : order,
merge : opts.merge,
offset : opts.offset,
exists : opts.exists
}, function (err, data) {
if (err) {
return cb(err);
}
if (data.length === 0) {
return cb(null, []);
}
var pending = data.length;
var createInstance = function (idx) {
opts.newInstance(data[idx], function (err, instance) {
data[idx] = instance;
if (--pending === 0) {
return (opts.__eager && opts.__eager.length ? eagerLoading : cb)(null, data);
}
});
};
var eagerLoading = function (err, data) {
var pending = opts.__eager.length;
var idMap = {};
var count = 0;
var keys = _.map(data, function (instance) {
var key = instance[opts.keys[0]];
// Create the association arrays
for (var i = 0, association; association = opts.__eager[i]; i++) {
instance[association.name] = [];
}
idMap[key] = count++;
return key;
});
_.map(opts.__eager, function (association) {
opts.driver.eagerQuery(association, opts, keys, function (err, instances) {
for (var i = 0, instance; instance = instances[i]; i++) {
// Perform a parent lookup with $p, and initialize it as an instance.
data[idMap[instance.$p]][association.name].push(association.model(instance));
}
if (--pending === 0) {
return cb(null, data);
}
});
});
};
for (var i = 0; i < data.length; i++) {
createInstance(i);
}
});
}
var promise = null;

@@ -42,3 +113,3 @@ var chain = {

if (cb) {
return this.all(cb);
chainRun(cb);
}

@@ -154,3 +225,4 @@ return this;

run: function (cb) {
return this.all(cb);
chainRun(cb);
return this;
},

@@ -185,76 +257,5 @@ success: function (cb) {

return this;
},
all: function (cb) {
var order, conditions;
conditions = Utilities.transformPropertyNames(
opts.conditions, opts.properties
);
order = Utilities.transformOrderPropertyNames(
opts.order, opts.properties
);
opts.driver.find(opts.only, opts.table, conditions, {
limit : opts.limit,
order : order,
merge : opts.merge,
offset : opts.offset,
exists : opts.exists
}, function (err, data) {
if (err) {
return cb(err);
}
if (data.length === 0) {
return cb(null, []);
}
var pending = data.length;
var createInstance = function (idx) {
opts.newInstance(data[idx], function (err, instance) {
data[idx] = instance;
if (--pending === 0) {
return (opts.__eager && opts.__eager.length ? eagerLoading : cb)(null, data);
}
});
};
var eagerLoading = function (err, data) {
var pending = opts.__eager.length;
var idMap = {};
var count = 0;
var keys = _.map(data, function (instance) {
var key = instance[opts.keys[0]];
// Create the association arrays
for (var i = 0, association; association = opts.__eager[i]; i++) {
instance[association.name] = [];
}
idMap[key] = count++;
return key;
});
_.map(opts.__eager, function (association) {
opts.driver.eagerQuery(association, opts, keys, function (err, instances) {
for (var i = 0, instance; instance = instances[i]; i++) {
// Perform a parent lookup with $p, and initialize it as an instance.
data[idMap[instance.$p]][association.name].push(association.model(instance));
}
if (--pending === 0) {
return cb(null, data);
}
});
});
};
for (var i = 0; i < data.length; i++) {
createInstance(i);
}
});
return this;
}
};
chain.where = chain.find;
chain.all = chain.where = chain.find;

@@ -269,3 +270,3 @@ if (opts.associations) {

"hasOne", "hasMany",
"drop", "sync", "get", "find", "all", "count", "clear", "create",
"drop", "sync", "get", "clear", "create",
"exists", "settings", "aggregate"

@@ -275,3 +276,3 @@ ].indexOf(k) >= 0) {

}
if (typeof Model[k] !== "function") {
if (typeof Model[k] !== "function" || chain[k]) {
continue;

@@ -278,0 +279,0 @@ }

@@ -47,3 +47,3 @@ var Utilities = require("./Utilities");

var handleValidations = function (cb) {
var pending = [], errors = [], required;
var pending = [], errors = [], required, alwaysValidate;

@@ -50,0 +50,0 @@ Hook.wait(instance, opts.hooks.beforeValidation, function (err) {

@@ -429,10 +429,9 @@ var _ = require("lodash");

return chain;
} else {
chain.run(cb);
return this;
}
chain.run(cb);
return this;
};
model.all = model.find;
model.where = model.all = model.find;

@@ -439,0 +438,0 @@ model.one = function () {

@@ -15,3 +15,3 @@ {

],
"version" : "3.1.0",
"version" : "3.2.0",
"license" : "MIT",

@@ -42,18 +42,18 @@ "homepage" : "http://dresende.github.io/node-orm2",

"sql-query" : "0.1.26",
"sql-ddl-sync" : "0.3.11",
"sql-ddl-sync" : "0.3.12",
"hat" : "0.0.3",
"lodash" : "4.11.2",
"path-is-absolute" : "1.0.0"
"lodash" : "4.17.2",
"path-is-absolute" : "1.0.1"
},
"devDependencies": {
"mysql" : "2.10.2",
"pg" : "4.5.5",
"sqlite3" : "3.1.3",
"mysql" : "2.12.0",
"pg" : "6.1.0",
"sqlite3" : "3.1.8",
"async" : "1.5.2",
"mocha" : "2.4.5",
"should" : "8.3.1",
"mocha" : "3.2.0",
"should" : "11.1.1",
"mongodb" : "1.4.10",
"glob" : "7.0.3"
"glob" : "7.1.1"
},
"optionalDependencies": {}
}

@@ -393,3 +393,3 @@ ## Object Relational Mapping

#### Chaining
### Chaining

@@ -414,2 +414,4 @@ If you prefer less complicated syntax you can chain `.find()` by not giving a callback parameter.

`.find`, `.where` & `.all` do the same thing; they are all interchangeable and chainable.
You can also `order` or `orderRaw`:

@@ -416,0 +418,0 @@ ```js

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc