Comparing version 3.0.0-rc.6 to 3.0.0-rc.7
@@ -0,1 +1,14 @@ | ||
##### 3.0.0-rc.7 - 29 January 2017 | ||
###### Bug fixes | ||
- #433 - `Collection#add` is missing a "silent" option | ||
###### Backwards compatible changes | ||
- Added a `emitRecordEvents` option to `Collection` which defaults to `true` | ||
###### Other | ||
- Moved Babel config from `package.json` to `.babelrc` | ||
- Upgraded devDependencies | ||
- Added a `yarn.lock` file | ||
##### 3.0.0-rc.6 - 05 October 2016 | ||
@@ -2,0 +15,0 @@ |
{ | ||
"name": "js-data", | ||
"description": "Robust, framework-agnostic in-memory data store.", | ||
"version": "3.0.0-rc.6", | ||
"version": "3.0.0-rc.7", | ||
"homepage": "http://www.js-data.io", | ||
@@ -21,3 +21,4 @@ "repository": { | ||
"CONTRIBUTORS", | ||
"typings.json" | ||
"typings.json", | ||
"yarn.lock" | ||
], | ||
@@ -46,14 +47,5 @@ "keywords": [ | ||
}, | ||
"babel": { | ||
"presets": [ | ||
"es2015" | ||
], | ||
"plugins": [ | ||
"syntax-async-functions", | ||
"transform-regenerator" | ||
] | ||
}, | ||
"scripts": { | ||
"doc": "jsdoc -c conf.json src && node scripts/cleanup.js", | ||
"lint": "repo-tools lint src/**/*.js test/**/*.js scripts/*.js lib/**/*.js *.config.js", | ||
"lint": "standard 'src/**/*.js' 'test/**/*.js' 'scripts/*.js' 'lib/**/*.js' '*.config.js'", | ||
"bundle:es5": "rollup src/index.js -c -o dist/js-data.js -m dist/js-data.js.map -f umd", | ||
@@ -73,18 +65,31 @@ "bundle:next": "rollup src/index.js -c -o dist/js-data.es2015.js -m dist/js-data.es2015.js.map -f es", | ||
"devDependencies": { | ||
"babel-plugin-external-helpers": "^6.8.0", | ||
"babel-core": "6.22.1", | ||
"babel-eslint": "7.1.1", | ||
"babel-plugin-external-helpers": "6.22.0", | ||
"babel-plugin-syntax-async-functions": "6.13.0", | ||
"babel-plugin-transform-es2015-modules-umd": "6.12.0", | ||
"babel-plugin-transform-regenerator": "6.16.1", | ||
"js-data-repo-tools": "0.5.7", | ||
"karma": "1.3.0", | ||
"babel-plugin-transform-es2015-modules-umd": "6.22.0", | ||
"babel-plugin-transform-regenerator": "6.22.0", | ||
"babel-polyfill": "6.22.0", | ||
"babel-preset-es2015": "6.22.0", | ||
"chai": "3.5.0", | ||
"ink-docstrap": "git+https://github.com/js-data/docstrap.git#cfbe45fa313e1628c493076d5e15d2b855dfbf2c", | ||
"js-data-repo-tools": "1.0.0", | ||
"jsdoc": "3.4.3", | ||
"karma": "1.4.1", | ||
"karma-babel-preprocessor": "6.0.1", | ||
"karma-chai": "0.1.0", | ||
"karma-chrome-launcher": "2.0.0", | ||
"karma-mocha": "1.2.0", | ||
"karma-mocha": "1.3.0", | ||
"karma-phantomjs-launcher": "1.0.2", | ||
"karma-sauce-launcher": "1.0.0", | ||
"karma-sauce-launcher": "1.1.0", | ||
"karma-sinon": "1.0.5", | ||
"phantomjs-prebuilt": "2.1.13", | ||
"uglify-js": "2.7.3" | ||
"mocha": "3.2.0", | ||
"nyc": "10.1.2", | ||
"phantomjs-prebuilt": "2.1.14", | ||
"rollup": "0.41.4", | ||
"rollup-plugin-babel": "2.7.1", | ||
"sinon": "1.17.7", | ||
"standard": "8.6.0", | ||
"uglify-js": "2.7.5" | ||
} | ||
} |
@@ -20,2 +20,11 @@ import utils from './utils' | ||
/** | ||
* Whether record events should bubble up and be emitted by the collection. | ||
* | ||
* @name Collection#emitRecordEvents | ||
* @type {boolean} | ||
* @default true | ||
*/ | ||
emitRecordEvents: true, | ||
/** | ||
* Field to be used as the unique identifier for records in this collection. | ||
@@ -187,3 +196,5 @@ * Defaults to `"id"` unless {@link Collection#mapper} is set, in which case | ||
_onRecordEvent (...args) { | ||
this.emit(...args) | ||
if (this.emitRecordEvents) { | ||
this.emit(...args) | ||
} | ||
}, | ||
@@ -282,3 +293,5 @@ | ||
const result = singular ? records[0] : records | ||
this.emit('add', result) | ||
if (!opts.silent) { | ||
this.emit('add', result) | ||
} | ||
return this.afterAdd(records, opts, result) || result | ||
@@ -285,0 +298,0 @@ }, |
@@ -11,4 +11,2 @@ import utils, { safeSetLink, safeSetProp } from './utils' | ||
const DOMAIN = 'DataStore' | ||
const DATASTORE_DEFAULTS = { | ||
@@ -15,0 +13,0 @@ /** |
@@ -18,3 +18,3 @@ import utils from './utils' | ||
// Used by our JavaScript implementation of the LIKE operator | ||
const escapeRegExp = /([.*+?^=!:${}()|[\]\/\\])/g | ||
const escapeRegExp = /([.*+?^=!:${}()|[\]/\\])/g | ||
const percentRegExp = /%/g | ||
@@ -21,0 +21,0 @@ const underscoreRegExp = /_/g |
@@ -5,3 +5,2 @@ import utils, { safeSetLink } from './utils' | ||
import { | ||
belongsToType, | ||
hasManyType, | ||
@@ -405,3 +404,3 @@ hasOneType | ||
removeInverseRelation(currentParent, id, inverseDef, idAttribute) { | ||
removeInverseRelation (currentParent, id, inverseDef, idAttribute) { | ||
if (inverseDef.type === hasOneType) { | ||
@@ -420,3 +419,3 @@ safeSetLink(currentParent, inverseDef.localField, undefined) | ||
setupInverseRelation(record, id, inverseDef, idAttribute) { | ||
setupInverseRelation (record, id, inverseDef, idAttribute) { | ||
// Update (set) inverse relation | ||
@@ -655,3 +654,3 @@ if (inverseDef.type === hasOneType) { | ||
* // Update the record in the database | ||
* return user.save() | ||
* return session.save() | ||
* }) | ||
@@ -658,0 +657,0 @@ * |
@@ -487,2 +487,7 @@ import utils from './utils' | ||
opts || (opts = {}) | ||
if (utils.isArray(value)) { | ||
return | ||
} | ||
// Can be a boolean or an object | ||
@@ -492,4 +497,3 @@ // Technically the default is an "empty schema", but here "true" is | ||
const additionalProperties = schema.additionalProperties === undefined ? true : schema.additionalProperties | ||
// "s": The property set of the instance to validate. | ||
const toValidate = {} | ||
const validated = [] | ||
// "p": The property set from "properties". | ||
@@ -503,14 +507,9 @@ // Default is an object | ||
// Collect set "s" | ||
utils.forOwn(value, function (_value, prop) { | ||
toValidate[prop] = undefined | ||
}) | ||
// Remove from "s" all elements of "p", if any. | ||
utils.forOwn(properties || {}, function (_schema, prop) { | ||
utils.forOwn(properties, function (_schema, prop) { | ||
opts.prop = prop | ||
errors = errors.concat(validate(value[prop], _schema, opts) || []) | ||
delete toValidate[prop] | ||
validated.push(prop) | ||
}) | ||
// For each regex in "pp", remove all elements of "s" which this regex | ||
// matches. | ||
const toValidate = utils.omit(value, validated) | ||
utils.forOwn(patternProperties, function (_schema, pattern) { | ||
@@ -520,8 +519,9 @@ utils.forOwn(toValidate, function (undef, prop) { | ||
opts.prop = prop | ||
// console.log(_schema) | ||
errors = errors.concat(validate(value[prop], _schema, opts) || []) | ||
delete toValidate[prop] | ||
validated.push(prop) | ||
} | ||
}) | ||
}) | ||
const keys = Object.keys(toValidate) | ||
const keys = Object.keys(utils.omit(value, validated)) | ||
// If "s" is not empty, validation fails | ||
@@ -859,3 +859,3 @@ if (additionalProperties === false) { | ||
const changes = utils.diffObjects({ [prop] : value }, { [prop] : current }) | ||
const changes = utils.diffObjects({ [prop]: value }, { [prop]: current }) | ||
@@ -1035,3 +1035,4 @@ if (_get(keepChangeHistoryPath)) { | ||
if (this.type === 'object' && this.properties) { | ||
if (this.type === 'object') { | ||
this.properties = this.properties || {} | ||
utils.forOwn(this.properties, (_definition, prop) => { | ||
@@ -1233,2 +1234,1 @@ if (!(_definition instanceof Schema)) { | ||
*/ | ||
@@ -290,3 +290,3 @@ /** | ||
} else if (utils.isRegExp(from)) { | ||
to = new RegExp(from.source, from.toString().match(/[^\/]*$/)[0]) | ||
to = new RegExp(from.source, from.toString().match(/[^/]*$/)[0]) | ||
to.lastIndex = from.lastIndex | ||
@@ -1311,9 +1311,6 @@ } else if (utils.isObject(from)) { | ||
pick (props, keys) { | ||
const _props = {} | ||
utils.forOwn(props, function (value, key) { | ||
if (keys.indexOf(key) !== -1) { | ||
_props[key] = value | ||
} | ||
}) | ||
return _props | ||
return keys.reduce((map, key) => { | ||
map[key] = props[key] | ||
return map | ||
}, {}) | ||
}, | ||
@@ -1581,4 +1578,3 @@ | ||
object[last] = undefined | ||
}, | ||
} | ||
} | ||
@@ -1585,0 +1581,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
2993190
37
28
40499