dist/globals/ember-data.prod.js in ember-data-source-2.8.1 vs dist/globals/ember-data.prod.js in ember-data-source-2.9.0.beta.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.1
+ * @version 2.9.0-beta.1
*/
var loader, define, requireModule, require, requirejs;
(function(global) {
@@ -947,64 +947,10 @@
function coerceId(id) {
return id === null || id === undefined || id === '' ? null : id + '';
}
});
-define('ember-data/-private/system/container-proxy', ['exports', 'ember-data/-private/debug'], function (exports, _emberDataPrivateDebug) {
- exports.default = ContainerProxy;
-
- /*
- This is used internally to enable deprecation of container paths and provide
- a decent message to the user indicating how to fix the issue.
-
- @class ContainerProxy
- @namespace DS
- @private
- */
-
- function ContainerProxy(container) {
- this.container = container;
- }
-
- ContainerProxy.prototype.aliasedFactory = function (path, preLookup) {
- var _this = this;
-
- return {
- create: function () {
- if (preLookup) {
- preLookup();
- }
-
- return _this.container.lookup(path);
- }
- };
- };
-
- ContainerProxy.prototype.registerAlias = function (source, dest, preLookup) {
- var factory = this.aliasedFactory(dest, preLookup);
-
- return this.container.register(source, factory);
- };
-
- ContainerProxy.prototype.registerDeprecation = function (deprecated, valid) {
- var preLookupCallback = function () {};
-
- return this.registerAlias(deprecated, valid, preLookupCallback);
- };
-
- ContainerProxy.prototype.registerDeprecations = function (proxyPairs) {
- var i, proxyPair, deprecated, valid;
-
- for (i = proxyPairs.length; i > 0; i--) {
- proxyPair = proxyPairs[i - 1];
- deprecated = proxyPair['deprecated'];
- valid = proxyPair['valid'];
-
- this.registerDeprecation(deprecated, valid);
- }
- };
-});
define("ember-data/-private/system/debug", ["exports", "ember-data/-private/system/debug/debug-adapter"], function (exports, _emberDataPrivateSystemDebugDebugAdapter) {
exports.default = _emberDataPrivateSystemDebugDebugAdapter.default;
});
/**
@module ember-data
@@ -2957,11 +2903,11 @@
return reference;
}
};
- if (false) {
+ if ((0, _emberDataPrivateFeatures.default)('ds-reset-attribute')) {
/*
Returns the latest truth for an attribute - the canonical value, or the
in-flight value.
@method lastAcknowledgedValue
@private
@@ -3377,10 +3323,17 @@
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
@@ -3789,21 +3742,10 @@
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.
@@ -3846,10 +3788,11 @@
});
```
@property modelName
@type String
@readonly
+ @static
*/
modelName: null
});
// if `Ember.setOwner` is defined, accessing `this.container` is
@@ -3866,11 +3809,11 @@
return this.store.container;
}
});
}
- if (false) {
+ if ((0, _emberDataPrivateFeatures.default)('ds-reset-attribute')) {
Model.reopen({
/**
Discards any unsaved changes to the given attribute.
Example
```javascript
@@ -4684,17 +4627,21 @@
}
});
define('ember-data/-private/system/normalize-model-name', ['exports', 'ember'], function (exports, _ember) {
exports.default = normalizeModelName;
+ // All modelNames are dasherized internally. Changing this function may
+ // require changes to other normalization hooks (such as typeForRoot).
+
/**
- All modelNames are dasherized internally. Changing this function may
- require changes to other normalization hooks (such as typeForRoot).
+ This method normalizes a modelName into the format Ember Data uses
+ internally.
+
@method normalizeModelName
@public
@param {String} modelName
- @return {String} if the adapter can generate one, an ID
+ @return {String} normalizedModelName
@for DS
*/
function normalizeModelName(modelName) {
return _ember.default.String.dasherize(modelName);
@@ -5596,11 +5543,11 @@
return _ember.default.RSVP.resolve(objectOrPromise).then(function (data) {
var record;
if (data instanceof _emberDataModel.default) {
- if (false) {}
+ if ((0, _emberDataPrivateFeatures.default)('ds-overhaul-references')) {}
record = data;
} else {
record = _this.store.push(data);
}
@@ -5690,21 +5637,21 @@
var _this = this;
return _ember.default.RSVP.resolve(objectOrPromise).then(function (payload) {
var array = payload;
- if (false) {}
+ if ((0, _emberDataPrivateFeatures.default)("ds-overhaul-references")) {}
var useLegacyArrayPush = true;
if (typeof payload === "object" && payload.data) {
array = payload.data;
useLegacyArrayPush = array.length && array[0].data;
- if (false) {}
+ if ((0, _emberDataPrivateFeatures.default)('ds-overhaul-references')) {}
}
- if (!false) {
+ if (!(0, _emberDataPrivateFeatures.default)('ds-overhaul-references')) {
useLegacyArrayPush = true;
}
var internalModels = undefined;
if (useLegacyArrayPush) {
@@ -9380,13 +9327,15 @@
return factory;
},
/**
- Returns a model class for a particular key. Used by
- methods that take a type key (like `find`, `createRecord`,
- etc.)
+ Returns the model class for the particular `modelName`.
+ The class of a model might be useful if you want to get a list of all the
+ relationship names of the model, see
+ [`relationshipNames`](http://emberjs.com/api/data/classes/DS.Model.html#property_relationshipNames)
+ for example.
@method modelFor
@param {String} modelName
@return {DS.Model}
*/
modelFor: function (modelName) {
@@ -9647,11 +9596,11 @@
} else {
payload = inputPayload;
serializer = this.serializerFor(modelName);
}
- if (false) {
+ if ((0, _emberDataPrivateFeatures.default)('ds-pushpayload-return')) {
return this._adapterRun(function () {
return serializer.pushPayload(_this3, payload);
});
} else {
this._adapterRun(function () {
@@ -10011,11 +9960,11 @@
define('ember-data/-private/system/store/container-instance-cache', ['exports', 'ember', 'ember-data/-private/system/empty-object'], function (exports, _ember, _emberDataPrivateSystemEmptyObject) {
exports.default = ContainerInstanceCache;
var assign = _ember.default.assign || _ember.default.merge;
- /**
+ /*
* The `ContainerInstanceCache` serves as a lazy cache for looking up
* instances of serializers and adapters. It has some additional logic for
* finding the 'fallback' adapter or serializer.
*
* The 'fallback' adapter or serializer is an adapter or serializer that is looked up
@@ -10420,10 +10369,24 @@
name: DS.attr('string'),
email: DS.attr('string')
});
```
+ By default the boolean transform only allows for values of `true` or
+ `false`. You can opt into allowing `null` values for
+ boolean attributes via `DS.attr('boolean', { allowNull: true })`
+
+ ```app/models/user.js
+ import DS from 'ember-data';
+
+ export default DS.Model.extend({
+ email: DS.attr('string'),
+ username: DS.attr('string'),
+ wantsWeeklyEmail: DS.attr('boolean', { allowNull: true })
+ });
+ ```
+
@class BooleanTransform
@extends DS.Transform
@namespace DS
*/
exports.default = _emberDataTransform.default.extend({
@@ -10488,11 +10451,12 @@
/**
The `DS.DateTransform` class is used to serialize and deserialize
date attributes on Ember Data record objects. This transform is used
when `date` is passed as the type parameter to the
- [DS.attr](../../data#method_attr) function.
+ [DS.attr](../../data#method_attr) function. It uses the [`ISO 8601`](https://en.wikipedia.org/wiki/ISO_8601)
+ standard.
```app/models/score.js
import DS from 'ember-data';
export default DS.Model.extend({
@@ -11104,11 +11068,11 @@
can only reserve tickets for 20 minutes at a time, and want to ensure that
in each route you have data that is no more than 20 minutes old you could
write:
```javascript
shouldReloadRecord: function(store, ticketSnapshot) {
- var timeDiff = moment().diff(ticketSnapshot.attr('lastAccessedAt')).minutes();
+ var timeDiff = moment().diff(ticketSnapshot.attr('lastAccessedAt'), 'minutes');
if (timeDiff > 20) {
return true;
} else {
return false;
}
@@ -11118,10 +11082,14 @@
id)` you will always get a ticket that is no more than 20 minutes old. In
case the cached version is more than 20 minutes old, `findRecord` will not
resolve until you fetched the latest version.
By default this hook returns `false`, as most UIs should not block user
interactions while waiting on data update.
+ Note that, with default settings, `shouldBackgroundReloadRecord` will always
+ re-fetch the records in the background even if `shouldReloadRecord` returns
+ `false`. You can override `shouldBackgroundReloadRecord` if this does not
+ suit your use case.
@since 1.13.0
@method shouldReloadRecord
@param {DS.Store} store
@param {DS.Snapshot} snapshot
@return {Boolean}
@@ -11143,11 +11111,11 @@
write:
```javascript
shouldReloadAll: function(store, snapshotArray) {
var snapshots = snapshotArray.snapshots();
return snapshots.any(function(ticketSnapshot) {
- var timeDiff = moment().diff(ticketSnapshot.attr('lastAccessedAt')).minutes();
+ var timeDiff = moment().diff(ticketSnapshot.attr('lastAccessedAt'), 'minutes');
if (timeDiff > 20) {
return true;
} else {
return false;
}
@@ -11159,10 +11127,14 @@
case a cached version is more than 20 minutes old, `findAll` will not
resolve until you fetched the latest versions.
By default this methods returns `true` if the passed `snapshotRecordArray`
is empty (meaning that there are no records locally available yet),
otherwise it returns `false`.
+ Note that, with default settings, `shouldBackgroundReloadAll` will always
+ re-fetch all the records in the background even if `shouldReloadAll` returns
+ `false`. You can override `shouldBackgroundReloadAll` if this does not suit
+ your use case.
@since 1.13.0
@method shouldReloadAll
@param {DS.Store} store
@param {DS.SnapshotRecordArray} snapshotRecordArray
@return {Boolean}
@@ -11268,11 +11240,11 @@
detail: message
}];
}
var extendedErrorsEnabled = false;
- if (false) {
+ if ((0, _emberDataPrivateFeatures.default)('ds-extended-errors')) {
extendedErrorsEnabled = true;
}
function extendFn(ErrorClass) {
return function () {
@@ -11558,11 +11530,11 @@
@param {Array} ids
@param {Array} snapshots
@return {Promise} promise
*/
findMany: function (store, type, ids, snapshots) {
- if (false && !this._hasCustomizedAjax()) {
+ if (true && !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(',') } } });
}
@@ -11585,11 +11557,11 @@
@param {DS.Model} type
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
updateRecord: function (store, type, snapshot) {
- if (false && !this._hasCustomizedAjax()) {
+ if (true && !this._hasCustomizedAjax()) {
return this._super.apply(this, arguments);
} else {
var data = {};
var serializer = store.serializerFor(type.modelName);
@@ -11613,11 +11585,11 @@
return false;
}
});
- if (false) {
+ if (true) {
JSONAPIAdapter.reopen({
methodForRequest: function (params) {
if (params.requestType === 'updateRecord') {
@@ -12041,11 +12013,11 @@
@param {String} id
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
findRecord: function (store, type, id, snapshot) {
- if (false && !this._hasCustomizedAjax()) {
+ if (true && !this._hasCustomizedAjax()) {
var request = this._requestFor({
store: store, type: type, id: id, snapshot: snapshot,
requestType: 'findRecord'
});
@@ -12071,11 +12043,11 @@
@return {Promise} promise
*/
findAll: function (store, type, sinceToken, snapshotRecordArray) {
var query = this.buildQuery(snapshotRecordArray);
- if (false && !this._hasCustomizedAjax()) {
+ if (true && !this._hasCustomizedAjax()) {
var request = this._requestFor({
store: store, type: type, sinceToken: sinceToken, query: query,
snapshots: snapshotRecordArray,
requestType: 'findAll'
});
@@ -12105,11 +12077,11 @@
@param {DS.Model} type
@param {Object} query
@return {Promise} promise
*/
query: function (store, type, query) {
- if (false && !this._hasCustomizedAjax()) {
+ if (true && !this._hasCustomizedAjax()) {
var request = this._requestFor({
store: store, type: type, query: query,
requestType: 'query'
});
@@ -12139,11 +12111,11 @@
@param {DS.Model} type
@param {Object} query
@return {Promise} promise
*/
queryRecord: function (store, type, query) {
- if (false && !this._hasCustomizedAjax()) {
+ if (true && !this._hasCustomizedAjax()) {
var request = this._requestFor({
store: store, type: type, query: query,
requestType: 'queryRecord'
});
@@ -12184,11 +12156,11 @@
@param {Array} ids
@param {Array} snapshots
@return {Promise} promise
*/
findMany: function (store, type, ids, snapshots) {
- if (false && !this._hasCustomizedAjax()) {
+ if (true && !this._hasCustomizedAjax()) {
var request = this._requestFor({
store: store, type: type, ids: ids, snapshots: snapshots,
requestType: 'findMany'
});
@@ -12224,11 +12196,11 @@
@param {DS.Snapshot} snapshot
@param {String} url
@return {Promise} promise
*/
findHasMany: function (store, snapshot, url, relationship) {
- if (false && !this._hasCustomizedAjax()) {
+ if (true && !this._hasCustomizedAjax()) {
var request = this._requestFor({
store: store, snapshot: snapshot, url: url, relationship: relationship,
requestType: 'findHasMany'
});
@@ -12268,11 +12240,11 @@
@param {DS.Snapshot} snapshot
@param {String} url
@return {Promise} promise
*/
findBelongsTo: function (store, snapshot, url, relationship) {
- if (false && !this._hasCustomizedAjax()) {
+ if (true && !this._hasCustomizedAjax()) {
var request = this._requestFor({
store: store, snapshot: snapshot, url: url, relationship: relationship,
requestType: 'findBelongsTo'
});
@@ -12298,11 +12270,11 @@
@param {DS.Model} type
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
createRecord: function (store, type, snapshot) {
- if (false && !this._hasCustomizedAjax()) {
+ if (true && !this._hasCustomizedAjax()) {
var request = this._requestFor({
store: store, type: type, snapshot: snapshot,
requestType: 'createRecord'
});
@@ -12330,11 +12302,11 @@
@param {DS.Model} type
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
updateRecord: function (store, type, snapshot) {
- if (false && !this._hasCustomizedAjax()) {
+ if (true && !this._hasCustomizedAjax()) {
var request = this._requestFor({
store: store, type: type, snapshot: snapshot,
requestType: 'updateRecord'
});
@@ -12360,11 +12332,11 @@
@param {DS.Model} type
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
deleteRecord: function (store, type, snapshot) {
- if (false && !this._hasCustomizedAjax()) {
+ if (true && !this._hasCustomizedAjax()) {
var request = this._requestFor({
store: store, type: type, snapshot: snapshot,
requestType: 'deleteRecord'
});
@@ -12496,11 +12468,11 @@
}
var errors = this.normalizeErrorResponse(status, headers, payload);
var detailedMessage = this.generatedDetailedMessage(status, headers, payload, requestData);
- if (false) {
+ if ((0, _emberDataPrivateFeatures.default)('ds-extended-errors')) {
switch (status) {
case 401:
return new _emberDataAdaptersErrors.UnauthorizedError(errors, detailedMessage);
case 403:
return new _emberDataAdaptersErrors.ForbiddenError(errors, detailedMessage);
@@ -12576,21 +12548,29 @@
return new Promise(function (resolve, reject) {
var hash = adapter.ajaxOptions(url, type, options);
hash.success = function (payload, textStatus, jqXHR) {
- var response = ajaxSuccess(adapter, jqXHR, payload, requestData);
- _ember.default.run.join(null, resolve, response);
+ try {
+ var response = ajaxSuccess(adapter, jqXHR, payload, requestData);
+ _ember.default.run.join(null, resolve, response);
+ } catch (error) {
+ _ember.default.run.join(null, reject, error);
+ }
};
hash.error = function (jqXHR, textStatus, errorThrown) {
- var responseData = {
- textStatus: textStatus,
- errorThrown: errorThrown
- };
- var error = ajaxError(adapter, jqXHR, requestData, responseData);
- _ember.default.run.join(null, reject, error);
+ 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);
+ }
};
adapter._ajaxRequest(hash);
}, 'DS: RESTAdapter#ajax ' + type + ' to ' + url);
},
@@ -12727,11 +12707,11 @@
return false;
}
});
- if (false) {
+ if (true) {
RESTAdapter.reopen({
/**
* Get the data (body or query params) for a request.
@@ -12950,36 +12930,39 @@
var requestData = { method: method, url: url };
return new _ember.default.RSVP.Promise(function (resolve, reject) {
hash.success = function (payload, textStatus, jqXHR) {
- var response = ajaxSuccess(adapter, jqXHR, payload, requestData);
- _ember.default.run.join(null, resolve, response);
+ try {
+ var response = ajaxSuccess(adapter, jqXHR, payload, requestData);
+ _ember.default.run.join(null, resolve, response);
+ } catch (error) {
+ _ember.default.run.join(null, reject, error);
+ }
};
hash.error = function (jqXHR, textStatus, errorThrown) {
- var responseData = {
- textStatus: textStatus,
- errorThrown: errorThrown
- };
- var error = ajaxError(adapter, jqXHR, requestData, responseData);
- _ember.default.run.join(null, reject, error);
+ 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);
+ }
};
adapter._ajaxRequest(hash);
}, 'DS: RESTAdapter#makeRequest: ' + method + ' ' + url);
}
});
}
function ajaxSuccess(adapter, jqXHR, payload, requestData) {
- var response = undefined;
- try {
- response = adapter.handleResponse(jqXHR.status, (0, _emberDataPrivateUtilsParseResponseHeaders.default)(jqXHR.getAllResponseHeaders()), payload, requestData);
- } catch (error) {
- return Promise.reject(error);
- }
+ var response = adapter.handleResponse(jqXHR.status, (0, _emberDataPrivateUtilsParseResponseHeaders.default)(jqXHR.getAllResponseHeaders()), payload, requestData);
if (response && response.isAdapterError) {
return Promise.reject(response);
} else {
return response;
@@ -12995,15 +12978,11 @@
} else if (responseData.textStatus === 'timeout') {
error = new _emberDataAdaptersErrors.TimeoutError();
} else if (responseData.textStatus === 'abort') {
error = new _emberDataAdaptersErrors.AbortError();
} else {
- try {
- error = adapter.handleResponse(jqXHR.status, (0, _emberDataPrivateUtilsParseResponseHeaders.default)(jqXHR.getAllResponseHeaders()), adapter.parseErrorResponse(jqXHR.responseText) || responseData.errorThrown, requestData);
- } catch (e) {
- error = e;
- }
+ error = adapter.handleResponse(jqXHR.status, (0, _emberDataPrivateUtilsParseResponseHeaders.default)(jqXHR.getAllResponseHeaders()), adapter.parseErrorResponse(jqXHR.responseText) || responseData.errorThrown, requestData);
}
return error;
}
@@ -13181,11 +13160,11 @@
return value;
}
}).meta(meta);
}
});
-define("ember-data", ["exports", "ember", "ember-data/-private/debug", "ember-data/-private/features", "ember-data/-private/global", "ember-data/-private/core", "ember-data/-private/system/normalize-model-name", "ember-data/-private/system/model/internal-model", "ember-data/-private/system/promise-proxies", "ember-data/-private/system/store", "ember-data/-private/system/model", "ember-data/model", "ember-data/-private/system/snapshot", "ember-data/adapter", "ember-data/serializer", "ember-data/-private/system/debug", "ember-data/adapters/errors", "ember-data/-private/system/record-arrays", "ember-data/-private/system/many-array", "ember-data/-private/system/record-array-manager", "ember-data/-private/adapters", "ember-data/-private/adapters/build-url-mixin", "ember-data/-private/serializers", "ember-inflector", "ember-data/serializers/embedded-records-mixin", "ember-data/-private/transforms", "ember-data/relationships", "ember-data/setup-container", "ember-data/-private/instance-initializers/initialize-store-service", "ember-data/-private/system/container-proxy", "ember-data/-private/system/relationships/state/relationship"], function (exports, _ember, _emberDataPrivateDebug, _emberDataPrivateFeatures, _emberDataPrivateGlobal, _emberDataPrivateCore, _emberDataPrivateSystemNormalizeModelName, _emberDataPrivateSystemModelInternalModel, _emberDataPrivateSystemPromiseProxies, _emberDataPrivateSystemStore, _emberDataPrivateSystemModel, _emberDataModel, _emberDataPrivateSystemSnapshot, _emberDataAdapter, _emberDataSerializer, _emberDataPrivateSystemDebug, _emberDataAdaptersErrors, _emberDataPrivateSystemRecordArrays, _emberDataPrivateSystemManyArray, _emberDataPrivateSystemRecordArrayManager, _emberDataPrivateAdapters, _emberDataPrivateAdaptersBuildUrlMixin, _emberDataPrivateSerializers, _emberInflector, _emberDataSerializersEmbeddedRecordsMixin, _emberDataPrivateTransforms, _emberDataRelationships, _emberDataSetupContainer, _emberDataPrivateInstanceInitializersInitializeStoreService, _emberDataPrivateSystemContainerProxy, _emberDataPrivateSystemRelationshipsStateRelationship) {
+define("ember-data", ["exports", "ember", "ember-data/-private/debug", "ember-data/-private/features", "ember-data/-private/global", "ember-data/-private/core", "ember-data/-private/system/normalize-model-name", "ember-data/-private/system/model/internal-model", "ember-data/-private/system/promise-proxies", "ember-data/-private/system/store", "ember-data/-private/system/model", "ember-data/model", "ember-data/-private/system/snapshot", "ember-data/adapter", "ember-data/serializer", "ember-data/-private/system/debug", "ember-data/adapters/errors", "ember-data/-private/system/record-arrays", "ember-data/-private/system/many-array", "ember-data/-private/system/record-array-manager", "ember-data/-private/adapters", "ember-data/-private/adapters/build-url-mixin", "ember-data/-private/serializers", "ember-inflector", "ember-data/serializers/embedded-records-mixin", "ember-data/-private/transforms", "ember-data/relationships", "ember-data/setup-container", "ember-data/-private/instance-initializers/initialize-store-service", "ember-data/-private/system/relationships/state/relationship"], function (exports, _ember, _emberDataPrivateDebug, _emberDataPrivateFeatures, _emberDataPrivateGlobal, _emberDataPrivateCore, _emberDataPrivateSystemNormalizeModelName, _emberDataPrivateSystemModelInternalModel, _emberDataPrivateSystemPromiseProxies, _emberDataPrivateSystemStore, _emberDataPrivateSystemModel, _emberDataModel, _emberDataPrivateSystemSnapshot, _emberDataAdapter, _emberDataSerializer, _emberDataPrivateSystemDebug, _emberDataAdaptersErrors, _emberDataPrivateSystemRecordArrays, _emberDataPrivateSystemManyArray, _emberDataPrivateSystemRecordArrayManager, _emberDataPrivateAdapters, _emberDataPrivateAdaptersBuildUrlMixin, _emberDataPrivateSerializers, _emberInflector, _emberDataSerializersEmbeddedRecordsMixin, _emberDataPrivateTransforms, _emberDataRelationships, _emberDataSetupContainer, _emberDataPrivateInstanceInitializersInitializeStoreService, _emberDataPrivateSystemRelationshipsStateRelationship) {
/**
Ember Data
@module ember-data
@main ember-data
@@ -13214,11 +13193,11 @@
_emberDataPrivateCore.default.AdapterError = _emberDataAdaptersErrors.AdapterError;
_emberDataPrivateCore.default.InvalidError = _emberDataAdaptersErrors.InvalidError;
_emberDataPrivateCore.default.TimeoutError = _emberDataAdaptersErrors.TimeoutError;
_emberDataPrivateCore.default.AbortError = _emberDataAdaptersErrors.AbortError;
- if (false) {
+ if ((0, _emberDataPrivateFeatures.default)('ds-extended-errors')) {
_emberDataPrivateCore.default.UnauthorizedError = _emberDataAdaptersErrors.UnauthorizedError;
_emberDataPrivateCore.default.ForbiddenError = _emberDataAdaptersErrors.ForbiddenError;
_emberDataPrivateCore.default.NotFoundError = _emberDataAdaptersErrors.NotFoundError;
_emberDataPrivateCore.default.ConflictError = _emberDataAdaptersErrors.ConflictError;
_emberDataPrivateCore.default.ServerError = _emberDataAdaptersErrors.ServerError;
@@ -13258,12 +13237,10 @@
_emberDataPrivateCore.default.belongsTo = _emberDataRelationships.belongsTo;
_emberDataPrivateCore.default.hasMany = _emberDataRelationships.hasMany;
_emberDataPrivateCore.default.Relationship = _emberDataPrivateSystemRelationshipsStateRelationship.default;
- _emberDataPrivateCore.default.ContainerProxy = _emberDataPrivateSystemContainerProxy.default;
-
_emberDataPrivateCore.default._setupContainer = _emberDataSetupContainer.default;
_emberDataPrivateCore.default._initializeStoreService = _emberDataPrivateInstanceInitializersInitializeStoreService.default;
Object.defineProperty(_emberDataPrivateCore.default, 'normalizeModelName', {
enumerable: true,
@@ -13280,115 +13257,10 @@
}
});
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;
@@ -14194,11 +14066,11 @@
@param {Object} relationshipDataHash
@return {Object}
@private
*/
_normalizeRelationshipDataHelper: function (relationshipDataHash) {
- if (false) {
+ if ((0, _emberDataPrivateFeatures.default)("ds-payload-type-hooks")) {
var modelName = this.modelNameFromPayloadType(relationshipDataHash.type);
var deprecatedModelNameLookup = this.modelNameFromPayloadKey(relationshipDataHash.type);
if (modelName !== deprecatedModelNameLookup && this._hasCustomModelNameFromPayloadKey()) {
@@ -14223,11 +14095,11 @@
_normalizeResourceHelper: function (resourceHash) {
var modelName = undefined,
usedLookup = undefined;
- if (false) {
+ if ((0, _emberDataPrivateFeatures.default)("ds-payload-type-hooks")) {
modelName = this.modelNameFromPayloadType(resourceHash.type);
var deprecatedModelNameLookup = this.modelNameFromPayloadKey(resourceHash.type);
usedLookup = 'modelNameFromPayloadType';
@@ -14260,11 +14132,11 @@
@param {DS.Store} store
@param {Object} payload
*/
pushPayload: function (store, payload) {
var normalizedPayload = this._normalizeDocumentHelper(payload);
- if (false) {
+ if ((0, _emberDataPrivateFeatures.default)('ds-pushpayload-return')) {
return store.push(normalizedPayload);
} else {
store.push(normalizedPayload);
}
},
@@ -14370,11 +14242,11 @@
@param {Object} resourceHash
@return {String}
@private
*/
_extractType: function (modelClass, resourceHash) {
- if (false) {
+ if ((0, _emberDataPrivateFeatures.default)("ds-payload-type-hooks")) {
var modelName = this.modelNameFromPayloadType(resourceHash.type);
var deprecatedModelNameLookup = this.modelNameFromPayloadKey(resourceHash.type);
if (modelName !== deprecatedModelNameLookup && this._hasCustomModelNameFromPayloadKey()) {
@@ -14493,11 +14365,11 @@
*/
serialize: function (snapshot, options) {
var data = this._super.apply(this, arguments);
var payloadType = undefined;
- if (false) {
+ if ((0, _emberDataPrivateFeatures.default)("ds-payload-type-hooks")) {
payloadType = this.payloadTypeFromModelName(snapshot.modelName);
var deprecatedPayloadTypeLookup = this.payloadKeyFromModelName(snapshot.modelName);
if (payloadType !== deprecatedPayloadTypeLookup && this._hasCustomPayloadKeyFromModelName()) {
@@ -14562,11 +14434,11 @@
var data = null;
if (belongsTo) {
var payloadType = undefined;
- if (false) {
+ if ((0, _emberDataPrivateFeatures.default)("ds-payload-type-hooks")) {
payloadType = this.payloadTypeFromModelName(belongsTo.modelName);
var deprecatedPayloadTypeLookup = this.payloadKeyFromModelName(belongsTo.modelName);
if (payloadType !== deprecatedPayloadTypeLookup && this._hasCustomPayloadKeyFromModelName()) {
@@ -14594,11 +14466,11 @@
@param {Object} relationship
*/
serializeHasMany: function (snapshot, json, relationship) {
var key = relationship.key;
var shouldSerializeHasMany = '_shouldSerializeHasMany';
- if (false) {
+ if ((0, _emberDataPrivateFeatures.default)("ds-check-should-serialize-relationships")) {
shouldSerializeHasMany = 'shouldSerializeHasMany';
}
if (this[shouldSerializeHasMany](snapshot, key, relationship)) {
var hasMany = snapshot.hasMany(key);
@@ -14616,11 +14488,11 @@
for (var i = 0; i < hasMany.length; i++) {
var item = hasMany[i];
var payloadType = undefined;
- if (false) {
+ if ((0, _emberDataPrivateFeatures.default)("ds-payload-type-hooks")) {
payloadType = this.payloadTypeFromModelName(item.modelName);
var deprecatedPayloadTypeLookup = this.payloadKeyFromModelName(item.modelName);
if (payloadType !== deprecatedPayloadTypeLookup && this._hasCustomPayloadKeyFromModelName()) {
@@ -14640,11 +14512,11 @@
}
}
}
});
- if (false) {
+ if ((0, _emberDataPrivateFeatures.default)("ds-payload-type-hooks")) {
JSONAPISerializer.reopen({
/**
`modelNameFromPayloadType` can be used to change the mapping for a DS model
@@ -15320,11 +15192,11 @@
}
var modelClass = this.store.modelFor(relationshipModelName);
if (relationshipHash.type && !(0, _emberDataPrivateUtils.modelHasAttributeOrRelationshipNamedType)(modelClass)) {
- if (false) {
+ if ((0, _emberDataPrivateFeatures.default)("ds-payload-type-hooks")) {
var modelName = this.modelNameFromPayloadType(relationshipHash.type);
var deprecatedModelNameLookup = this.modelNameFromPayloadKey(relationshipHash.type);
if (modelName !== deprecatedModelNameLookup && this._hasCustomModelNameFromPayloadKey()) {
@@ -15878,11 +15750,11 @@
@param {Object} relationship
*/
serializeHasMany: function (snapshot, json, relationship) {
var key = relationship.key;
var shouldSerializeHasMany = '_shouldSerializeHasMany';
- if (false) {
+ if ((0, _emberDataPrivateFeatures.default)("ds-check-should-serialize-relationships")) {
shouldSerializeHasMany = 'shouldSerializeHasMany';
}
if (this[shouldSerializeHasMany](snapshot, key, relationship)) {
var hasMany = snapshot.hasMany(key, { ids: true });
@@ -16129,11 +16001,11 @@
return transform;
}
});
- if (false) {
+ if ((0, _emberDataPrivateFeatures.default)("ds-payload-type-hooks")) {
JSONSerializer.reopen({
/**
@method modelNameFromPayloadType
@@ -16336,11 +16208,11 @@
var primaryHasTypeAttribute = (0, _emberDataPrivateUtils.modelHasAttributeOrRelationshipNamedType)(primaryModelClass);
if (!primaryHasTypeAttribute && hash.type) {
// Support polymorphic records in async relationships
var modelName = undefined;
- if (false) {
+ if ((0, _emberDataPrivateFeatures.default)("ds-payload-type-hooks")) {
modelName = this.modelNameFromPayloadType(hash.type);
var deprecatedModelNameLookup = this.modelNameFromPayloadKey(hash.type);
if (modelName !== deprecatedModelNameLookup && !this._hasCustomModelNameFromPayloadType() && this._hasCustomModelNameFromPayloadKey()) {
@@ -16552,11 +16424,11 @@
(_documentHash$included5 = documentHash.included).push.apply(_documentHash$included5, _toConsumableArray(included));
}
});
}
- if (false) {
+ if ((0, _emberDataPrivateFeatures.default)('ds-pushpayload-return')) {
return store.push(documentHash);
} else {
store.push(documentHash);
}
},
@@ -16827,11 +16699,11 @@
}
if (_ember.default.isNone(belongsTo)) {
json[typeKey] = null;
} else {
- if (false) {
+ if ((0, _emberDataPrivateFeatures.default)("ds-payload-type-hooks")) {
json[typeKey] = this.payloadTypeFromModelName(belongsTo.modelName);
} else {
json[typeKey] = camelize(belongsTo.modelName);
}
}
@@ -16871,11 +16743,11 @@
var isPolymorphic = relationshipMeta.options.polymorphic;
var typeProperty = this.keyForPolymorphicType(key, relationshipType, 'deserialize');
if (isPolymorphic && resourceHash[typeProperty] !== undefined && typeof relationshipHash !== 'object') {
- if (false) {
+ if ((0, _emberDataPrivateFeatures.default)("ds-payload-type-hooks")) {
var payloadType = resourceHash[typeProperty];
var type = this.modelNameFromPayloadType(payloadType);
var deprecatedTypeLookup = this.modelNameFromPayloadKey(payloadType);
@@ -16900,11 +16772,11 @@
return this._super.apply(this, arguments);
}
});
- if (false) {
+ if ((0, _emberDataPrivateFeatures.default)("ds-payload-type-hooks")) {
RESTSerializer.reopen({
/**
`modelNameFromPayloadType` can be used to change the mapping for a DS model
@@ -17039,19 +16911,48 @@
```app/transforms/temperature.js
import DS from 'ember-data';
// Converts centigrade in the JSON to fahrenheit in the app
export default DS.Transform.extend({
- deserialize: function(serialized) {
+ deserialize: function(serialized, options) {
return (serialized * 1.8) + 32;
},
- serialize: function(deserialized) {
+ serialize: function(deserialized, options) {
return (deserialized - 32) / 1.8;
}
});
```
+ The options passed into the `DS.attr` function when the attribute is
+ declared on the model is also available in the transform.
+
+ ```app/models/post.js
+ export default DS.Model.extend({
+ title: DS.attr('string'),
+ markdown: DS.attr('markdown', {
+ markdown: {
+ gfm: false,
+ sanitize: true
+ }
+ })
+ });
+ ```
+
+ ```app/transforms/markdown.js
+ export default DS.Transform.extend({
+ serialize: function (deserialized, options) {
+ return deserialized.raw;
+ },
+
+ deserialize: function (serialized, options) {
+ var markdownOptions = options.markdown || {};
+
+ return marked(serialized, markdownOptions);
+ }
+ });
+ ```
+
Usage
```app/models/requirement.js
import DS from 'ember-data';
@@ -17097,11 +16998,11 @@
*/
deserialize: null
});
});
define("ember-data/version", ["exports"], function (exports) {
- exports.default = "2.8.1";
+ exports.default = "2.9.0-beta.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;
@@ -17552,42 +17453,9 @@
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
};