dist/globals/ember-data.prod.js in ember-data-source-2.5.0.beta.1 vs dist/globals/ember-data.prod.js in ember-data-source-2.5.0.beta.2

- old
+ new

@@ -4,11 +4,11 @@ /*! * @overview Ember Data * @copyright Copyright 2011-2016 Tilde Inc. and contributors. * Portions Copyright 2011 LivingSocial Inc. * @license Licensed under MIT license (see license.js) - * @version 2.5.0-beta.1 + * @version 2.5.0-beta.2 */ var define, requireModule, require, requirejs; (function() { @@ -1305,11 +1305,11 @@ return true; } return false; } }); -define("ember-data/-private/system/many-array", ["exports", "ember", "ember-data/-private/debug", "ember-data/-private/system/promise-proxies"], function (exports, _ember, _emberDataPrivateDebug, _emberDataPrivateSystemPromiseProxies) { +define("ember-data/-private/system/many-array", ["exports", "ember", "ember-data/-private/debug", "ember-data/-private/system/promise-proxies", "ember-data/-private/system/store/common"], function (exports, _ember, _emberDataPrivateDebug, _emberDataPrivateSystemPromiseProxies, _emberDataPrivateSystemStoreCommon) { var get = _ember.default.get; var set = _ember.default.set; /** @@ -1383,16 +1383,19 @@ }); //a hack for not removing new records //TODO remove once we have proper diffing var newRecords = this.currentState.filter(function (internalModel) { - return internalModel.isNew(); + return internalModel.isNew() && toSet.indexOf(internalModel) === -1; }); toSet = toSet.concat(newRecords); var oldLength = this.length; this.arrayContentWillChange(0, this.length, toSet.length); - this.set('length', toSet.length); + // It’s possible the parent side of the relationship may have been unloaded by this point + if ((0, _emberDataPrivateSystemStoreCommon._objectIsAlive)(this)) { + this.set('length', toSet.length); + } this.currentState = toSet; this.arrayContentDidChange(0, oldLength, this.length); //TODO Figure out to notify only on additions and maybe only if unloaded this.relationship.notifyHasManyChanged(); this.record.updateRecordArrays(); @@ -5526,29 +5529,29 @@ }); }); /** @module ember-data */ -define('ember-data/-private/system/references', ['exports', 'ember-data/-private/system/references/record', 'ember-data/-private/system/references/belongs-to', 'ember-data/-private/system/references/has-many'], function (exports, _emberDataPrivateSystemReferencesRecord, _emberDataPrivateSystemReferencesBelongsTo, _emberDataPrivateSystemReferencesHasMany) { - exports.RecordReference = _emberDataPrivateSystemReferencesRecord.default; - exports.BelongsToReference = _emberDataPrivateSystemReferencesBelongsTo.default; - exports.HasManyReference = _emberDataPrivateSystemReferencesHasMany.default; +define('ember-data/-private/system/references', ['exports', '-private/system/references/record', '-private/system/references/belongs-to', '-private/system/references/has-many'], function (exports, _privateSystemReferencesRecord, _privateSystemReferencesBelongsTo, _privateSystemReferencesHasMany) { + exports.RecordReference = _privateSystemReferencesRecord.default; + exports.BelongsToReference = _privateSystemReferencesBelongsTo.default; + exports.HasManyReference = _privateSystemReferencesHasMany.default; }); -define('ember-data/-private/system/references/belongs-to', ['exports', 'ember-data/model', 'ember', 'ember-data/-private/system/references/reference', 'ember-data/-private/debug'], function (exports, _emberDataModel, _ember, _emberDataPrivateSystemReferencesReference, _emberDataPrivateDebug) { +define('ember-data/-private/system/references/belongs-to', ['exports', 'ember-data/model', 'ember', '-private/system/references/reference', 'ember-data/-private/debug'], function (exports, _emberDataModel, _ember, _privateSystemReferencesReference, _emberDataPrivateDebug) { var BelongsToReference = function (store, parentInternalModel, belongsToRelationship) { this._super$constructor(store, parentInternalModel); this.belongsToRelationship = belongsToRelationship; this.type = belongsToRelationship.relationshipMeta.type; this.parent = parentInternalModel.recordReference; // TODO inverse }; - BelongsToReference.prototype = Object.create(_emberDataPrivateSystemReferencesReference.default.prototype); + BelongsToReference.prototype = Object.create(_privateSystemReferencesReference.default.prototype); BelongsToReference.prototype.constructor = BelongsToReference; - BelongsToReference.prototype._super$constructor = _emberDataPrivateSystemReferencesReference.default; + BelongsToReference.prototype._super$constructor = _privateSystemReferencesReference.default; BelongsToReference.prototype.remoteType = function () { if (this.belongsToRelationship.link) { return "link"; } @@ -5614,11 +5617,11 @@ }); }; exports.default = BelongsToReference; }); -define('ember-data/-private/system/references/has-many', ['exports', 'ember', 'ember-data/-private/system/references/reference', 'ember-data/-private/debug'], function (exports, _ember, _emberDataPrivateSystemReferencesReference, _emberDataPrivateDebug) { +define('ember-data/-private/system/references/has-many', ['exports', 'ember', '-private/system/references/reference', 'ember-data/-private/debug'], function (exports, _ember, _privateSystemReferencesReference, _emberDataPrivateDebug) { var get = _ember.default.get; var HasManyReference = function (store, parentInternalModel, hasManyRelationship) { this._super$constructor(store, parentInternalModel); @@ -5627,13 +5630,13 @@ this.parent = parentInternalModel.recordReference; // TODO inverse }; - HasManyReference.prototype = Object.create(_emberDataPrivateSystemReferencesReference.default.prototype); + HasManyReference.prototype = Object.create(_privateSystemReferencesReference.default.prototype); HasManyReference.prototype.constructor = HasManyReference; - HasManyReference.prototype._super$constructor = _emberDataPrivateSystemReferencesReference.default; + HasManyReference.prototype._super$constructor = _privateSystemReferencesReference.default; HasManyReference.prototype.remoteType = function () { if (this.hasManyRelationship.link) { return "link"; } @@ -5714,21 +5717,21 @@ return this.hasManyRelationship.reload(); }; exports.default = HasManyReference; }); -define('ember-data/-private/system/references/record', ['exports', 'ember', 'ember-data/-private/system/references/reference'], function (exports, _ember, _emberDataPrivateSystemReferencesReference) { +define('ember-data/-private/system/references/record', ['exports', 'ember', '-private/system/references/reference'], function (exports, _ember, _privateSystemReferencesReference) { var RecordReference = function (store, internalModel) { this._super$constructor(store, internalModel); this.type = internalModel.modelName; this._id = internalModel.id; }; - RecordReference.prototype = Object.create(_emberDataPrivateSystemReferencesReference.default.prototype); + RecordReference.prototype = Object.create(_privateSystemReferencesReference.default.prototype); RecordReference.prototype.constructor = RecordReference; - RecordReference.prototype._super$constructor = _emberDataPrivateSystemReferencesReference.default; + RecordReference.prototype._super$constructor = _privateSystemReferencesReference.default; RecordReference.prototype.id = function () { return this._id; }; @@ -8585,11 +8588,11 @@ }); ``` @method findAll @param {String} modelName @param {Object} options - @return {DS.AdapterPopulatedRecordArray} + @return {Promise} promise */ findAll: function (modelName, options) { var typeClass = this.modelFor(modelName); return this._fetchAll(typeClass, this.peekAll(modelName), options); @@ -9949,11 +9952,11 @@ return promise.then(function (adapterPayload) { var record; store._adapterRun(function () { var payload = (0, _emberDataPrivateSystemStoreSerializerResponse.normalizeResponseHelper)(serializer, store, typeClass, adapterPayload, null, 'queryRecord'); - _ember.default.assert('`store.queryRecord` expected the adapter to return one record but the response from the adapter was empty.', payload.data); + //TODO Optimize record = store.push(payload); }); return record; @@ -11761,11 +11764,11 @@ @method normalizeErrorResponse @private @param {Number} status @param {Object} headers @param {Object} payload - @return {Object} errors payload + @return {Array} errors payload */ normalizeErrorResponse: function (status, headers, payload) { if (payload && typeof payload === 'object' && payload.errors) { return payload.errors; } else { @@ -11783,11 +11786,12 @@ @method generatedDetailedMessage @private @param {Number} status @param {Object} headers @param {Object} payload - @return {Object} request information + @param {Object} requestData + @return {String} detailed error message */ generatedDetailedMessage: function (status, headers, payload, requestData) { var shortenedPayload; var payloadContentType = headers["Content-Type"] || "Empty Content-Type"; @@ -11802,16 +11806,18 @@ return ['Ember Data Request ' + requestDescription + ' returned a ' + status, payloadDescription, shortenedPayload].join('\n'); }, buildQuery: function (snapshot) { - var include = snapshot.include; - var query = {}; - if (include) { - query.include = include; + if (snapshot) { + var include = snapshot.include; + + if (include) { + query.include = include; + } } return query; } }); @@ -13346,11 +13352,11 @@ ```javascript socket.on('message', function(message) { var data = message.data; var modelClass = store.modelFor(data.modelName); var serializer = store.serializerFor(data.modelName); - var json = serializer.normalizeSingleResponse(store, modelClass, data, data.id); + var normalized = serializer.normalizeSingleResponse(store, modelClass, data, data.id); store.push(normalized); }); ``` @method normalizeResponse @param {DS.Store} store @@ -15247,58 +15253,58 @@ */ deserialize: null }); }); define("ember-data/version", ["exports"], function (exports) { - exports.default = "2.5.0-beta.1"; + exports.default = "2.5.0-beta.2"; }); -define("ember-inflector", ["exports", "ember", "ember-inflector/lib/system", "ember-inflector/lib/ext/string"], function (exports, _ember, _emberInflectorLibSystem, _emberInflectorLibExtString) { +define("ember-inflector", ["exports", "ember", "lib/system", "lib/ext/string"], function (exports, _ember, _libSystem, _libExtString) { - _emberInflectorLibSystem.Inflector.defaultRules = _emberInflectorLibSystem.defaultRules; - _ember.default.Inflector = _emberInflectorLibSystem.Inflector; + _libSystem.Inflector.defaultRules = _libSystem.defaultRules; + _ember.default.Inflector = _libSystem.Inflector; - _ember.default.String.pluralize = _emberInflectorLibSystem.pluralize; - _ember.default.String.singularize = _emberInflectorLibSystem.singularize; + _ember.default.String.pluralize = _libSystem.pluralize; + _ember.default.String.singularize = _libSystem.singularize; - exports.default = _emberInflectorLibSystem.Inflector; - exports.pluralize = _emberInflectorLibSystem.pluralize; - exports.singularize = _emberInflectorLibSystem.singularize; - exports.defaultRules = _emberInflectorLibSystem.defaultRules; + exports.default = _libSystem.Inflector; + exports.pluralize = _libSystem.pluralize; + exports.singularize = _libSystem.singularize; + exports.defaultRules = _libSystem.defaultRules; if (typeof define !== 'undefined' && define.amd) { define('ember-inflector', ['exports'], function (__exports__) { - __exports__['default'] = _emberInflectorLibSystem.Inflector; - return _emberInflectorLibSystem.Inflector; + __exports__['default'] = _libSystem.Inflector; + return _libSystem.Inflector; }); } else if (typeof module !== 'undefined' && module['exports']) { - module['exports'] = _emberInflectorLibSystem.Inflector; + module['exports'] = _libSystem.Inflector; } }); /* global define, module */ -define('ember-inflector/lib/ext/string', ['exports', 'ember', 'ember-inflector/lib/system/string'], function (exports, _ember, _emberInflectorLibSystemString) { +define('ember-inflector/lib/ext/string', ['exports', 'ember', 'lib/system/string'], function (exports, _ember, _libSystemString) { if (_ember.default.EXTEND_PROTOTYPES === true || _ember.default.EXTEND_PROTOTYPES.String) { /** See {{#crossLink "Ember.String/pluralize"}}{{/crossLink}} @method pluralize @for String */ String.prototype.pluralize = function () { - return (0, _emberInflectorLibSystemString.pluralize)(this); + return (0, _libSystemString.pluralize)(this); }; /** See {{#crossLink "Ember.String/singularize"}}{{/crossLink}} @method singularize @for String */ String.prototype.singularize = function () { - return (0, _emberInflectorLibSystemString.singularize)(this); + return (0, _libSystemString.singularize)(this); }; } }); -define('ember-inflector/lib/helpers/pluralize', ['exports', 'ember-inflector', 'ember-inflector/lib/utils/make-helper'], function (exports, _emberInflector, _emberInflectorLibUtilsMakeHelper) { +define('ember-inflector/lib/helpers/pluralize', ['exports', 'ember-inflector', 'lib/utils/make-helper'], function (exports, _emberInflector, _libUtilsMakeHelper) { /** * * If you have Ember Inflector (such as if Ember Data is present), * pluralize a word. For example, turn "ox" into "oxen". @@ -15313,11 +15319,11 @@ * @for Ember.HTMLBars.helpers * @method pluralize * @param {Number|Property} [count] count of objects * @param {String|Property} word word to pluralize */ - exports.default = (0, _emberInflectorLibUtilsMakeHelper.default)(function (params) { + exports.default = (0, _libUtilsMakeHelper.default)(function (params) { var count = undefined, word = undefined; if (params.length === 1) { word = params[0]; @@ -15332,11 +15338,11 @@ return count + " " + word; } }); }); -define('ember-inflector/lib/helpers/singularize', ['exports', 'ember-inflector', 'ember-inflector/lib/utils/make-helper'], function (exports, _emberInflector, _emberInflectorLibUtilsMakeHelper) { +define('ember-inflector/lib/helpers/singularize', ['exports', 'ember-inflector', 'lib/utils/make-helper'], function (exports, _emberInflector, _libUtilsMakeHelper) { /** * * If you have Ember Inflector (such as if Ember Data is present), * singularize a word. For example, turn "oxen" into "ox". @@ -15348,22 +15354,22 @@ * * @for Ember.HTMLBars.helpers * @method singularize * @param {String|Property} word word to singularize */ - exports.default = (0, _emberInflectorLibUtilsMakeHelper.default)(function (params) { + exports.default = (0, _libUtilsMakeHelper.default)(function (params) { return (0, _emberInflector.singularize)(params[0]); }); }); -define("ember-inflector/lib/system", ["exports", "ember-inflector/lib/system/inflector", "ember-inflector/lib/system/string", "ember-inflector/lib/system/inflections"], function (exports, _emberInflectorLibSystemInflector, _emberInflectorLibSystemString, _emberInflectorLibSystemInflections) { +define("ember-inflector/lib/system", ["exports", "lib/system/inflector", "lib/system/string", "lib/system/inflections"], function (exports, _libSystemInflector, _libSystemString, _libSystemInflections) { - _emberInflectorLibSystemInflector.default.inflector = new _emberInflectorLibSystemInflector.default(_emberInflectorLibSystemInflections.default); + _libSystemInflector.default.inflector = new _libSystemInflector.default(_libSystemInflections.default); - exports.Inflector = _emberInflectorLibSystemInflector.default; - exports.singularize = _emberInflectorLibSystemString.singularize; - exports.pluralize = _emberInflectorLibSystemString.pluralize; - exports.defaultRules = _emberInflectorLibSystemInflections.default; + exports.Inflector = _libSystemInflector.default; + exports.singularize = _libSystemString.singularize; + exports.pluralize = _libSystemString.pluralize; + exports.defaultRules = _libSystemInflections.default; }); define('ember-inflector/lib/system/inflections', ['exports'], function (exports) { exports.default = { plurals: [[/$/, 's'], [/s$/i, 's'], [/^(ax|test)is$/i, '$1es'], [/(octop|vir)us$/i, '$1i'], [/(octop|vir)i$/i, '$1i'], [/(alias|status)$/i, '$1es'], [/(bu)s$/i, '$1ses'], [/(buffal|tomat)o$/i, '$1oes'], [/([ti])um$/i, '$1a'], [/([ti])a$/i, '$1a'], [/sis$/i, 'ses'], [/(?:([^f])fe|([lr])f)$/i, '$1$2ves'], [/(hive)$/i, '$1s'], [/([^aeiouy]|qu)y$/i, '$1ies'], [/(x|ch|ss|sh)$/i, '$1es'], [/(matr|vert|ind)(?:ix|ex)$/i, '$1ices'], [/^(m|l)ouse$/i, '$1ice'], [/^(m|l)ice$/i, '$1ice'], [/^(ox)$/i, '$1en'], [/^(oxen)$/i, '$1'], [/(quiz)$/i, '$1zes']], @@ -15677,17 +15683,17 @@ } }; exports.default = Inflector; }); -define('ember-inflector/lib/system/string', ['exports', 'ember-inflector/lib/system/inflector'], function (exports, _emberInflectorLibSystemInflector) { +define('ember-inflector/lib/system/string', ['exports', 'lib/system/inflector'], function (exports, _libSystemInflector) { function pluralize(word) { - return _emberInflectorLibSystemInflector.default.inflector.pluralize(word); + return _libSystemInflector.default.inflector.pluralize(word); } function singularize(word) { - return _emberInflectorLibSystemInflector.default.inflector.singularize(word); + return _libSystemInflector.default.inflector.singularize(word); } exports.pluralize = pluralize; exports.singularize = singularize; });