dist/globals/ember-data.prod.js in ember-data-source-2.8.0.beta.3 vs dist/globals/ember-data.prod.js in ember-data-source-2.8.1

- 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.8.0-beta.3 + * @version 2.8.1 */ var loader, define, requireModule, require, requirejs; (function(global) { @@ -3377,17 +3377,10 @@ Fired when the record is rolled back. @event rolledBack */ rolledBack: _ember.default.K, - /** - @property data - @private - @type {Object} - */ - data: _ember.default.computed.readOnly('_internalModel._data'), - //TODO Do we want to deprecate these? /** @method send @private @param {String} name @@ -3796,10 +3789,21 @@ setId: _ember.default.observer('id', function () { this._internalModel.setId(this.get('id')); }) }); + /** + @property data + @private + @type {Object} + */ + Object.defineProperty(Model.prototype, 'data', { + get: function () { + return this._internalModel._data; + } + }); + Model.reopenClass({ /** Alias DS.Model's `create` method to `_create`. This allows us to create DS.Model instances from within the store, but if end users accidentally call `create()` (instead of `createRecord()`), we can raise an error. @@ -11554,11 +11558,11 @@ @param {Array} ids @param {Array} snapshots @return {Promise} promise */ findMany: function (store, type, ids, snapshots) { - if (true && !this._hasCustomizedAjax()) { + if (false && !this._hasCustomizedAjax()) { return this._super.apply(this, arguments); } else { var url = this.buildURL(type.modelName, ids, snapshots, 'findMany'); return this.ajax(url, 'GET', { data: { filter: { id: ids.join(',') } } }); } @@ -11581,11 +11585,11 @@ @param {DS.Model} type @param {DS.Snapshot} snapshot @return {Promise} promise */ updateRecord: function (store, type, snapshot) { - if (true && !this._hasCustomizedAjax()) { + if (false && !this._hasCustomizedAjax()) { return this._super.apply(this, arguments); } else { var data = {}; var serializer = store.serializerFor(type.modelName); @@ -11609,11 +11613,11 @@ return false; } }); - if (true) { + if (false) { JSONAPIAdapter.reopen({ methodForRequest: function (params) { if (params.requestType === 'updateRecord') { @@ -12037,11 +12041,11 @@ @param {String} id @param {DS.Snapshot} snapshot @return {Promise} promise */ findRecord: function (store, type, id, snapshot) { - if (true && !this._hasCustomizedAjax()) { + if (false && !this._hasCustomizedAjax()) { var request = this._requestFor({ store: store, type: type, id: id, snapshot: snapshot, requestType: 'findRecord' }); @@ -12067,11 +12071,11 @@ @return {Promise} promise */ findAll: function (store, type, sinceToken, snapshotRecordArray) { var query = this.buildQuery(snapshotRecordArray); - if (true && !this._hasCustomizedAjax()) { + if (false && !this._hasCustomizedAjax()) { var request = this._requestFor({ store: store, type: type, sinceToken: sinceToken, query: query, snapshots: snapshotRecordArray, requestType: 'findAll' }); @@ -12101,11 +12105,11 @@ @param {DS.Model} type @param {Object} query @return {Promise} promise */ query: function (store, type, query) { - if (true && !this._hasCustomizedAjax()) { + if (false && !this._hasCustomizedAjax()) { var request = this._requestFor({ store: store, type: type, query: query, requestType: 'query' }); @@ -12135,11 +12139,11 @@ @param {DS.Model} type @param {Object} query @return {Promise} promise */ queryRecord: function (store, type, query) { - if (true && !this._hasCustomizedAjax()) { + if (false && !this._hasCustomizedAjax()) { var request = this._requestFor({ store: store, type: type, query: query, requestType: 'queryRecord' }); @@ -12180,11 +12184,11 @@ @param {Array} ids @param {Array} snapshots @return {Promise} promise */ findMany: function (store, type, ids, snapshots) { - if (true && !this._hasCustomizedAjax()) { + if (false && !this._hasCustomizedAjax()) { var request = this._requestFor({ store: store, type: type, ids: ids, snapshots: snapshots, requestType: 'findMany' }); @@ -12220,11 +12224,11 @@ @param {DS.Snapshot} snapshot @param {String} url @return {Promise} promise */ findHasMany: function (store, snapshot, url, relationship) { - if (true && !this._hasCustomizedAjax()) { + if (false && !this._hasCustomizedAjax()) { var request = this._requestFor({ store: store, snapshot: snapshot, url: url, relationship: relationship, requestType: 'findHasMany' }); @@ -12264,11 +12268,11 @@ @param {DS.Snapshot} snapshot @param {String} url @return {Promise} promise */ findBelongsTo: function (store, snapshot, url, relationship) { - if (true && !this._hasCustomizedAjax()) { + if (false && !this._hasCustomizedAjax()) { var request = this._requestFor({ store: store, snapshot: snapshot, url: url, relationship: relationship, requestType: 'findBelongsTo' }); @@ -12294,11 +12298,11 @@ @param {DS.Model} type @param {DS.Snapshot} snapshot @return {Promise} promise */ createRecord: function (store, type, snapshot) { - if (true && !this._hasCustomizedAjax()) { + if (false && !this._hasCustomizedAjax()) { var request = this._requestFor({ store: store, type: type, snapshot: snapshot, requestType: 'createRecord' }); @@ -12326,11 +12330,11 @@ @param {DS.Model} type @param {DS.Snapshot} snapshot @return {Promise} promise */ updateRecord: function (store, type, snapshot) { - if (true && !this._hasCustomizedAjax()) { + if (false && !this._hasCustomizedAjax()) { var request = this._requestFor({ store: store, type: type, snapshot: snapshot, requestType: 'updateRecord' }); @@ -12356,11 +12360,11 @@ @param {DS.Model} type @param {DS.Snapshot} snapshot @return {Promise} promise */ deleteRecord: function (store, type, snapshot) { - if (true && !this._hasCustomizedAjax()) { + if (false && !this._hasCustomizedAjax()) { var request = this._requestFor({ store: store, type: type, snapshot: snapshot, requestType: 'deleteRecord' }); @@ -12572,29 +12576,21 @@ return new Promise(function (resolve, reject) { var hash = adapter.ajaxOptions(url, type, options); hash.success = function (payload, textStatus, jqXHR) { - try { - var response = ajaxSuccess(adapter, jqXHR, payload, requestData); - _ember.default.run.join(null, resolve, response); - } catch (error) { - _ember.default.run.join(null, reject, error); - } + var response = ajaxSuccess(adapter, jqXHR, payload, requestData); + _ember.default.run.join(null, resolve, response); }; hash.error = function (jqXHR, textStatus, errorThrown) { - try { - var responseData = { - textStatus: textStatus, - errorThrown: errorThrown - }; - var error = ajaxError(adapter, jqXHR, requestData, responseData); - _ember.default.run.join(null, reject, error); - } catch (error) { - _ember.default.run.join(null, reject, error); - } + var responseData = { + textStatus: textStatus, + errorThrown: errorThrown + }; + var error = ajaxError(adapter, jqXHR, requestData, responseData); + _ember.default.run.join(null, reject, error); }; adapter._ajaxRequest(hash); }, 'DS: RESTAdapter#ajax ' + type + ' to ' + url); }, @@ -12731,11 +12727,11 @@ return false; } }); - if (true) { + if (false) { RESTAdapter.reopen({ /** * Get the data (body or query params) for a request. @@ -12954,39 +12950,36 @@ var requestData = { method: method, url: url }; return new _ember.default.RSVP.Promise(function (resolve, reject) { hash.success = function (payload, textStatus, jqXHR) { - try { - var response = ajaxSuccess(adapter, jqXHR, payload, requestData); - _ember.default.run.join(null, resolve, response); - } catch (error) { - _ember.default.run.join(null, reject, error); - } + var response = ajaxSuccess(adapter, jqXHR, payload, requestData); + _ember.default.run.join(null, resolve, response); }; hash.error = function (jqXHR, textStatus, errorThrown) { - try { - var responseData = { - textStatus: textStatus, - errorThrown: errorThrown - }; - var error = ajaxError(adapter, jqXHR, requestData, responseData); - _ember.default.run.join(null, reject, error); - } catch (error) { - _ember.default.run.join(null, reject, error); - } + var responseData = { + textStatus: textStatus, + errorThrown: errorThrown + }; + var error = ajaxError(adapter, jqXHR, requestData, responseData); + _ember.default.run.join(null, reject, error); }; adapter._ajaxRequest(hash); }, 'DS: RESTAdapter#makeRequest: ' + method + ' ' + url); } }); } function ajaxSuccess(adapter, jqXHR, payload, requestData) { - var response = adapter.handleResponse(jqXHR.status, (0, _emberDataPrivateUtilsParseResponseHeaders.default)(jqXHR.getAllResponseHeaders()), payload, requestData); + var response = undefined; + try { + response = adapter.handleResponse(jqXHR.status, (0, _emberDataPrivateUtilsParseResponseHeaders.default)(jqXHR.getAllResponseHeaders()), payload, requestData); + } catch (error) { + return Promise.reject(error); + } if (response && response.isAdapterError) { return Promise.reject(response); } else { return response; @@ -13002,11 +12995,15 @@ } else if (responseData.textStatus === 'timeout') { error = new _emberDataAdaptersErrors.TimeoutError(); } else if (responseData.textStatus === 'abort') { error = new _emberDataAdaptersErrors.AbortError(); } else { - error = adapter.handleResponse(jqXHR.status, (0, _emberDataPrivateUtilsParseResponseHeaders.default)(jqXHR.getAllResponseHeaders()), adapter.parseErrorResponse(jqXHR.responseText) || responseData.errorThrown, requestData); + try { + error = adapter.handleResponse(jqXHR.status, (0, _emberDataPrivateUtilsParseResponseHeaders.default)(jqXHR.getAllResponseHeaders()), adapter.parseErrorResponse(jqXHR.responseText) || responseData.errorThrown, requestData); + } catch (e) { + error = e; + } } return error; } @@ -13283,10 +13280,115 @@ } }); exports.default = _emberDataPrivateCore.default; }); +define('ember-data/initializers/data-adapter', ['exports', 'ember'], function (exports, _ember) { + + /* + This initializer is here to keep backwards compatibility with code depending + on the `data-adapter` initializer (before Ember Data was an addon). + + Should be removed for Ember Data 3.x + */ + + exports.default = { + name: 'data-adapter', + before: 'store', + initialize: _ember.default.K + }; +}); +define('ember-data/initializers/ember-data', ['exports', 'ember-data/setup-container', 'ember-data/-private/core'], function (exports, _emberDataSetupContainer, _emberDataPrivateCore) { + + /* + + This code initializes Ember-Data onto an Ember application. + + If an Ember.js developer defines a subclass of DS.Store on their application, + as `App.StoreService` (or via a module system that resolves to `service:store`) + this code will automatically instantiate it and make it available on the + router. + + Additionally, after an application's controllers have been injected, they will + each have the store made available to them. + + For example, imagine an Ember.js application with the following classes: + + App.StoreService = DS.Store.extend({ + adapter: 'custom' + }); + + App.PostsController = Ember.ArrayController.extend({ + // ... + }); + + When the application is initialized, `App.ApplicationStore` will automatically be + instantiated, and the instance of `App.PostsController` will have its `store` + property set to that instance. + + Note that this code will only be run if the `ember-application` package is + loaded. If Ember Data is being used in an environment other than a + typical application (e.g., node.js where only `ember-runtime` is available), + this code will be ignored. + */ + + exports.default = { + name: 'ember-data', + initialize: _emberDataSetupContainer.default + }; +}); +define('ember-data/initializers/injectStore', ['exports', 'ember'], function (exports, _ember) { + + /* + This initializer is here to keep backwards compatibility with code depending + on the `injectStore` initializer (before Ember Data was an addon). + + Should be removed for Ember Data 3.x + */ + + exports.default = { + name: 'injectStore', + before: 'store', + initialize: _ember.default.K + }; +}); +define('ember-data/initializers/store', ['exports', 'ember'], function (exports, _ember) { + + /* + This initializer is here to keep backwards compatibility with code depending + on the `store` initializer (before Ember Data was an addon). + + Should be removed for Ember Data 3.x + */ + + exports.default = { + name: 'store', + after: 'ember-data', + initialize: _ember.default.K + }; +}); +define('ember-data/initializers/transforms', ['exports', 'ember'], function (exports, _ember) { + + /* + This initializer is here to keep backwards compatibility with code depending + on the `transforms` initializer (before Ember Data was an addon). + + Should be removed for Ember Data 3.x + */ + + exports.default = { + name: 'transforms', + before: 'store', + initialize: _ember.default.K + }; +}); +define("ember-data/instance-initializers/ember-data", ["exports", "ember-data/-private/instance-initializers/initialize-store-service"], function (exports, _emberDataPrivateInstanceInitializersInitializeStoreService) { + exports.default = { + name: "ember-data", + initialize: _emberDataPrivateInstanceInitializersInitializeStoreService.default + }; +}); define("ember-data/model", ["exports", "ember-data/-private/system/model"], function (exports, _emberDataPrivateSystemModel) { exports.default = _emberDataPrivateSystemModel.default; }); define("ember-data/relationships", ["exports", "ember-data/-private/system/relationships/belongs-to", "ember-data/-private/system/relationships/has-many"], function (exports, _emberDataPrivateSystemRelationshipsBelongsTo, _emberDataPrivateSystemRelationshipsHasMany) { exports.belongsTo = _emberDataPrivateSystemRelationshipsBelongsTo.default; @@ -16995,11 +17097,11 @@ */ deserialize: null }); }); define("ember-data/version", ["exports"], function (exports) { - exports.default = "2.8.0-beta.3"; + exports.default = "2.8.1"; }); define("ember-inflector", ["exports", "ember", "ember-inflector/lib/system", "ember-inflector/lib/ext/string"], function (exports, _ember, _emberInflectorLibSystem, _emberInflectorLibExtString) { _emberInflectorLibSystem.Inflector.defaultRules = _emberInflectorLibSystem.defaultRules; _ember.default.Inflector = _emberInflectorLibSystem.Inflector; @@ -17450,9 +17552,42 @@ if (_ember.default.HTMLBars) { return _ember.default.HTMLBars.makeBoundHelper(helperFunction); } return _ember.default.Handlebars.makeBoundHelper(helperFunction); } +}); +define('ember-load-initializers', ['exports', 'ember'], function (exports, _ember) { + exports.default = function (app, prefix) { + var regex = new RegExp('^' + prefix + '\/((?:instance-)?initializers)\/'); + var getKeys = Object.keys || _ember.default.keys; + + getKeys(requirejs._eak_seen).map(function (moduleName) { + return { + moduleName: moduleName, + matches: regex.exec(moduleName) + }; + }).filter(function (dep) { + return dep.matches && dep.matches.length === 2; + }).forEach(function (dep) { + var moduleName = dep.moduleName; + + var module = require(moduleName, null, null, true); + if (!module) { + throw new Error(moduleName + ' must export an initializer.'); + } + + var initializerType = _ember.default.String.camelize(dep.matches[1].substring(0, dep.matches[1].length - 1)); + var initializer = module['default']; + if (!initializer.name) { + var initializerName = moduleName.match(/[^\/]+\/?$/)[0]; + initializer.name = initializerName; + } + + if (app[initializerType]) { + app[initializerType](initializer); + } + }); + }; }); define('ember', [], function() { return { default: Ember };