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

- old
+ new

@@ -4,11 +4,11 @@ /*! * @overview Ember Data * @copyright Copyright 2011-2017 Tilde Inc. and contributors. * Portions Copyright 2011 LivingSocial Inc. * @license Licensed under MIT license (see license.js) - * @version 2.17.0-beta.1 + * @version 2.17.0-beta.2 */ var loader, define, requireModule, require, requirejs; (function (global) { @@ -343,15 +343,14 @@ if (typeof exports === 'object' && typeof module === 'object' && module.exports) { module.exports = { require: require, define: define }; } })(this); -define('ember-data/-debug', ['exports', 'ember'], function (exports, _ember) { +define('ember-data/-debug', ['exports'], function (exports) { 'use strict'; exports.__esModule = true; - exports.assertPolymorphicType = undefined; exports.instrument = instrument; function instrument(method) { return method(); } @@ -381,11 +380,11 @@ if (modelClass.__isMixin) { //TODO Need to do this in order to support mixins, should convert to public api //once it exists in Ember return modelClass.__mixin.detect(addedModelClass.PrototypeMixin); } - if (_ember.default.MODEL_FACTORY_INJECTIONS) { + if (Ember.MODEL_FACTORY_INJECTIONS) { modelClass = modelClass.superclass; } return modelClass.detect(addedModelClass); }; @@ -395,52 +394,24 @@ var key = relationshipMeta.key; var relationshipModelName = relationshipMeta.type; var relationshipClass = parentInternalModel.store.modelFor(relationshipModelName); var assertionMessage = 'You cannot add a record of modelClass \'' + addedModelName + '\' to the \'' + parentModelName + '.' + key + '\' relationship (only \'' + relationshipModelName + '\' allowed)'; - (false && _ember.default.assert(assertionMessage, checkPolymorphic(relationshipClass, addedInternalModel.modelClass))); + (false && Ember.assert(assertionMessage, checkPolymorphic(relationshipClass, addedInternalModel.modelClass))); }; } exports.assertPolymorphicType = assertPolymorphicType; }); -define('ember-data/-private/adapters/build-url-mixin', ['exports', 'ember', 'ember-inflector'], function (exports, _ember, _emberInflector) { +define('ember-data/-private/adapters/build-url-mixin', ['exports', 'ember-inflector'], function (exports, _emberInflector) { 'use strict'; exports.__esModule = true; - - - var get = _ember.default.get; - - /** - - WARNING: This interface is likely to change in order to accomodate https://github.com/emberjs/rfcs/pull/4 - - ## Using BuildURLMixin - - To use url building, include the mixin when extending an adapter, and call `buildURL` where needed. - The default behaviour is designed for RESTAdapter. - - ### Example - - ```javascript - export default DS.Adapter.extend(BuildURLMixin, { - findRecord: function(store, type, id, snapshot) { - var url = this.buildURL(type.modelName, id, snapshot, 'findRecord'); - return this.ajax(url, 'GET'); - } - }); - ``` - - ### Attributes - - The `host` and `namespace` attributes will be used if defined, and are optional. - - @class BuildURLMixin - @namespace DS - */ - exports.default = _ember.default.Mixin.create({ + var camelize = Ember.String.camelize; + var Mixin = Ember.Mixin; + var get = Ember.get; + exports.default = Mixin.create({ /** Builds a URL for a given type and optional ID. By default, it pluralizes the type's name (for example, 'post' becomes 'posts' and 'person' becomes 'people'). To override the pluralization see [pathForType](#method_pathForType). @@ -801,40 +772,41 @@ ### Pathname customization For example if you have an object LineItem with an endpoint of "/line_items/". ```app/adapters/application.js import DS from 'ember-data'; + import { decamelize } from '@ember/string'; import { pluralize } from 'ember-inflector'; export default DS.RESTAdapter.extend({ pathForType: function(modelName) { - var decamelized = Ember.String.decamelize(modelName); + var decamelized = decamelize(modelName); return pluralize(decamelized); } }); ``` @method pathForType @param {String} modelName @return {String} path **/ pathForType: function (modelName) { - var camelized = _ember.default.String.camelize(modelName); + var camelized = camelize(modelName); return (0, _emberInflector.pluralize)(camelized); } }); }); -define('ember-data/-private/adapters/errors', ['exports', 'ember'], function (exports, _ember) { +define('ember-data/-private/adapters/errors', ['exports'], function (exports) { 'use strict'; exports.__esModule = true; - exports.ServerError = exports.ConflictError = exports.NotFoundError = exports.ForbiddenError = exports.UnauthorizedError = exports.AbortError = exports.TimeoutError = exports.InvalidError = undefined; exports.AdapterError = AdapterError; exports.errorsHashToArray = errorsHashToArray; exports.errorsArrayToHash = errorsArrayToHash; + var makeArray = Ember.makeArray; + var isPresent = Ember.isPresent; + var EmberError = Ember.Error; - var EmberError = _ember.default.Error; - var SOURCE_POINTER_REGEXP = /^\/?data\/(attributes|relationships)\/(.*)/; var SOURCE_POINTER_PRIMARY_REGEXP = /^\/?data/; var PRIMARY_ATTRIBUTE_KEY = 'base'; /** @@ -882,14 +854,14 @@ And can then be detected in an application and used to send the user to an `under-maintenance` route: ```app/routes/application.js - import Ember from 'ember'; + import Route from '@ember/routing/route'; import MaintenanceError from '../adapters/maintenance-error'; - export default Ember.Route.extend({ + export default Route.extend({ actions: { error(error, transition) { if (error instanceof MaintenanceError) { this.transitionTo('under-maintenance'); return; @@ -925,11 +897,11 @@ }; } function extend(ParentErrorClass, defaultMessage) { var ErrorClass = function (errors, message) { - (false && _ember.default.assert('`AdapterError` expects json-api formatted errors array.', Array.isArray(errors || []))); + (false && Ember.assert('`AdapterError` expects json-api formatted errors array.', Array.isArray(errors || []))); ParentErrorClass.call(this, errors, message || defaultMessage); }; ErrorClass.prototype = Object.create(ParentErrorClass.prototype); ErrorClass.extend = extendFn(ErrorClass); @@ -968,17 +940,17 @@ To show an error from the server related to the `title` and `content` properties your adapter could return a promise that rejects with a `DS.InvalidError` object that looks like this: ```app/adapters/post.js - import Ember from 'ember'; + import RSVP from 'RSVP'; import DS from 'ember-data'; export default DS.RESTAdapter.extend({ updateRecord() { // Fictional adapter that always rejects - return Ember.RSVP.reject(new DS.InvalidError([ + return RSVP.reject(new DS.InvalidError([ { detail: 'Must be unique', source: { pointer: '/data/attributes/title' } }, { @@ -1008,16 +980,16 @@ An example use case would be to warn the user to check their internet connection if an adapter operation has timed out: ```app/routes/application.js - import Ember from 'ember'; + import Route from '@ember/routing/route'; import DS from 'ember-data'; const { TimeoutError } = DS; - export default Ember.Route.extend({ + export default Route.extend({ actions: { error(error, transition) { if (error instanceof TimeoutError) { // alert the user alert('Are you still connected to the internet?'); @@ -1054,16 +1026,16 @@ An example use case would be to redirect the user to a log in route if a request is unauthorized: ```app/routes/application.js - import Ember from 'ember'; + import Route from '@ember/routing/route'; import DS from 'ember-data'; const { UnauthorizedError } = DS; - export default Ember.Route.extend({ + export default Route.extend({ actions: { error(error, transition) { if (error instanceof UnauthorizedError) { // go to the sign in route this.transitionTo('login'); @@ -1100,16 +1072,16 @@ An example use case would be to detect if the user has entered a route for a specific model that does not exist. For example: ```app/routes/post.js - import Ember from 'ember'; + import Route from '@ember/routing/route'; import DS from 'ember-data'; const { NotFoundError } = DS; - export default Ember.Route.extend({ + export default Route.extend({ model(params) { return this.get('store').findRecord('post', params.post_id); }, actions: { @@ -1200,13 +1172,13 @@ @return {Array} array of errors in JSON-API format */ function errorsHashToArray(errors) { var out = []; - if (_ember.default.isPresent(errors)) { + if (isPresent(errors)) { Object.keys(errors).forEach(function (key) { - var messages = _ember.default.makeArray(errors[key]); + var messages = makeArray(errors[key]); for (var i = 0; i < messages.length; i++) { var title = 'Invalid Attribute'; var pointer = '/data/attributes/' + key; if (key === PRIMARY_ATTRIBUTE_KEY) { title = 'Invalid Document'; @@ -1267,11 +1239,11 @@ @return {Object} */ function errorsArrayToHash(errors) { var out = {}; - if (_ember.default.isPresent(errors)) { + if (isPresent(errors)) { errors.forEach(function (error) { if (error.source && error.source.pointer) { var key = error.source.pointer.match(SOURCE_POINTER_REGEXP); if (key) { @@ -1289,11 +1261,11 @@ } return out; } }); -define('ember-data/-private/core', ['exports', 'ember', 'ember-data/version'], function (exports, _ember, _version) { +define('ember-data/-private/core', ['exports', 'ember-data/version'], function (exports, _version) { 'use strict'; exports.__esModule = true; @@ -1311,30 +1283,30 @@ /** @property VERSION @type String @static */ - var DS = _ember.default.Namespace.create({ + var DS = Ember.Namespace.create({ VERSION: _version.default, name: "DS" }); - if (_ember.default.libraries) { - _ember.default.libraries.registerCoreLibrary('Ember Data', DS.VERSION); + if (Ember.libraries) { + Ember.libraries.registerCoreLibrary('Ember Data', DS.VERSION); } exports.default = DS; }); -define('ember-data/-private/features', ['exports', 'ember'], function (exports, _ember) { +define('ember-data/-private/features', ['exports'], function (exports) { 'use strict'; exports.__esModule = true; exports.default = isEnabled; function isEnabled() { var _Ember$FEATURES; - return (_Ember$FEATURES = _ember.default.FEATURES).isEnabled.apply(_Ember$FEATURES, arguments); + return (_Ember$FEATURES = Ember.FEATURES).isEnabled.apply(_Ember$FEATURES, arguments); } }); define('ember-data/-private/global', ['exports'], function (exports) { 'use strict'; @@ -1651,22 +1623,22 @@ return id; } return '' + id; } }); -define('ember-data/-private/system/debug/debug-adapter', ['exports', 'ember', 'ember-data/-private/system/model/model'], function (exports, _ember, _model) { +define('ember-data/-private/system/debug/debug-adapter', ['exports', 'ember-data/-private/system/model/model'], function (exports, _model) { 'use strict'; exports.__esModule = true; - /** - @module ember-data - */ - var capitalize = _ember.default.String.capitalize; - var underscore = _ember.default.String.underscore; - var assert = _ember.default.assert, - get = _ember.default.get; - exports.default = _ember.default.DataAdapter.extend({ + var addObserver = Ember.addObserver; + var removeObserver = Ember.removeObserver; + var A = Ember.A; + var DataAdapter = Ember.DataAdapter; + var capitalize = Ember.String.capitalize; + var underscore = Ember.String.underscore; + var get = Ember.get; + exports.default = DataAdapter.extend({ getFilters: function () { return [{ name: 'isNew', desc: 'New' }, { name: 'isModified', desc: 'Modified' }, { name: 'isClean', desc: 'Clean' }]; }, detect: function (typeClass) { return typeClass !== _model.default && _model.default.detect(typeClass); @@ -1696,11 +1668,12 @@ if (match) { modelName = match[1]; } } } - assert("Cannot find model name. Please upgrade to Ember.js >= 1.13 for Ember Inspector support", !!modelName); + (false && Ember.assert("Cannot find model name. Please upgrade to Ember.js >= 1.13 for Ember Inspector support", !!modelName)); + return this.get('store').peekAll(modelName); }, getRecordColumnValues: function (record) { var _this = this; @@ -1715,11 +1688,11 @@ }); return columnValues; }, getRecordKeywords: function (record) { var keywords = []; - var keys = _ember.default.A(['id']); + var keys = A(['id']); record.eachAttribute(function (key) { return keys.push(key); }); keys.forEach(function (key) { return keywords.push(get(record, key)); @@ -1741,25 +1714,25 @@ color = 'blue'; } return color; }, observeRecord: function (record, recordUpdated) { - var releaseMethods = _ember.default.A(); - var keysToObserve = _ember.default.A(['id', 'isNew', 'hasDirtyAttributes']); + var releaseMethods = A(); + var keysToObserve = A(['id', 'isNew', 'hasDirtyAttributes']); record.eachAttribute(function (key) { return keysToObserve.push(key); }); var adapter = this; keysToObserve.forEach(function (key) { var handler = function () { recordUpdated(adapter.wrapRecord(record)); }; - _ember.default.addObserver(record, key, handler); + addObserver(record, key, handler); releaseMethods.push(function () { - _ember.default.removeObserver(record, key, handler); + removeObserver(record, key, handler); }); }); var release = function () { releaseMethods.forEach(function (fn) { @@ -2010,15 +1983,17 @@ return InternalModelMap; }(); exports.default = InternalModelMap; }); -define('ember-data/-private/system/is-array-like', ['exports', 'ember'], function (exports, _ember) { +define('ember-data/-private/system/is-array-like', ['exports'], function (exports) { 'use strict'; exports.__esModule = true; exports.default = isArrayLike; + var typeOf = Ember.typeOf; + var EmberArray = Ember.Array; /* We're using this to detect arrays and "array-like" objects. @@ -2034,30 +2009,34 @@ return false; } if (Array.isArray(obj)) { return true; } - if (_ember.default.Array.detect(obj)) { + if (EmberArray.detect(obj)) { return true; } - var type = _ember.default.typeOf(obj); + var type = typeOf(obj); if ('array' === type) { return true; } if (obj.length !== undefined && 'object' === type) { return true; } return false; } }); -define('ember-data/-private/system/many-array', ['exports', 'ember', 'ember-data/-private/system/promise-proxies', 'ember-data/-private/system/store/common', 'ember-data/-private/system/diff-array'], function (exports, _ember, _promiseProxies, _common, _diffArray) { +define('ember-data/-private/system/many-array', ['exports', 'ember-data/-private/system/promise-proxies', 'ember-data/-private/system/store/common', 'ember-data/-private/system/diff-array'], function (exports, _promiseProxies, _common, _diffArray) { 'use strict'; exports.__esModule = true; - var get = _ember.default.get; - exports.default = _ember.default.Object.extend(_ember.default.MutableArray, _ember.default.Evented, { + var all = Ember.RSVP.all; + var Evented = Ember.Evented; + var MutableArray = Ember.MutableArray; + var EmberObject = Ember.Object; + var get = Ember.get; + exports.default = EmberObject.extend(MutableArray, Evented, { init: function () { this._super.apply(this, arguments); /** The loading state of this array @@ -2250,11 +2229,11 @@ @return {DS.PromiseArray} promise */ save: function () { var manyArray = this; var promiseLabel = 'DS: ManyArray#save ' + get(this, 'type'); - var promise = _ember.default.RSVP.all(this.invoke("save"), promiseLabel).then(function () { + var promise = all(this.invoke("save"), promiseLabel).then(function () { return manyArray; }, null, 'DS: ManyArray#save return ManyArray'); return _promiseProxies.PromiseArray.create({ promise: promise }); }, @@ -2269,39 +2248,45 @@ */ createRecord: function (hash) { var store = get(this, 'store'); var type = get(this, 'type'); - (false && _ember.default.assert('You cannot add \'' + type.modelName + '\' records to this polymorphic relationship.', !get(this, 'isPolymorphic'))); + (false && Ember.assert('You cannot add \'' + type.modelName + '\' records to this polymorphic relationship.', !get(this, 'isPolymorphic'))); var record = store.createRecord(type.modelName, hash); this.pushObject(record); return record; } }); }); -define('ember-data/-private/system/model/errors', ['exports', 'ember'], function (exports, _ember) { +define('ember-data/-private/system/model/errors', ['exports'], function (exports) { 'use strict'; exports.__esModule = true; - var get = _ember.default.get, - set = _ember.default.set, - isEmpty = _ember.default.isEmpty, - makeArray = _ember.default.makeArray, - MapWithDefault = _ember.default.MapWithDefault; - exports.default = _ember.default.ArrayProxy.extend(_ember.default.Evented, { + var mapBy = Ember.computed.mapBy; + var not = Ember.computed.not; + var Evented = Ember.Evented; + var ArrayProxy = Ember.ArrayProxy; + var set = Ember.set; + var get = Ember.get; + var computed = Ember.computed; + var isEmpty = Ember.isEmpty; + var makeArray = Ember.makeArray; + var A = Ember.A; + var MapWithDefault = Ember.MapWithDefault; + exports.default = ArrayProxy.extend(Evented, { /** Register with target handler @method registerHandlers @param {Object} target @param {Function} becameInvalid @param {Function} becameValid @deprecated */ registerHandlers: function (target, becameInvalid, becameValid) { - (false && !(false) && _ember.default.deprecate('Record errors will no longer be evented.', false, { + (false && !(false) && Ember.deprecate('Record errors will no longer be evented.', false, { id: 'ds.errors.registerHandlers', until: '3.0.0' })); @@ -2323,14 +2308,14 @@ /** @property errorsByAttributeName @type {Ember.MapWithDefault} @private */ - errorsByAttributeName: _ember.default.computed(function () { + errorsByAttributeName: computed(function () { return MapWithDefault.create({ defaultValue: function () { - return _ember.default.A(); + return A(); } }); }), /** @@ -2365,19 +2350,19 @@ {{/each}} ``` @property messages @type {Array} */ - messages: _ember.default.computed.mapBy('content', 'message'), + messages: mapBy('content', 'message'), /** @property content @type {Array} @private */ - content: _ember.default.computed(function () { - return _ember.default.A(); + content: computed(function () { + return A(); }), /** @method unknownProperty @private @@ -2401,11 +2386,11 @@ /** @property isEmpty @type {Boolean} @readOnly */ - isEmpty: _ember.default.computed.not('length').readOnly(), + isEmpty: not('length').readOnly(), /** Adds error messages to a given attribute and sends `becameInvalid` event to the record. Example: @@ -2418,11 +2403,11 @@ @param {String} attribute @param {(Array|String)} messages @deprecated */ add: function (attribute, messages) { - (false && _ember.default.warn('Interacting with a record errors object will no longer change the record state.', false, { + (false && Ember.warn('Interacting with a record errors object will no longer change the record state.', false, { id: 'ds.errors.add' })); var wasEmpty = get(this, 'isEmpty'); @@ -2486,28 +2471,28 @@ twoFactorAuth: DS.attr('boolean'), phone: DS.attr('string') }); ``` ```app/routes/user/edit.js - import Ember from 'ember'; - export default Ember.Route.extend({ + import Route from '@ember/routing/route'; + export default Route.extend({ actions: { save: function(user) { - if (!user.get('twoFactorAuth')) { - user.get('errors').remove('phone'); - } - user.save(); - } + if (!user.get('twoFactorAuth')) { + user.get('errors').remove('phone'); + } + user.save(); + } } }); ``` @method remove @param {String} attribute @deprecated */ remove: function (attribute) { - (false && _ember.default.warn('Interacting with a record errors object will no longer change the record state.', false, { + (false && Ember.warn('Interacting with a record errors object will no longer change the record state.', false, { id: 'ds.errors.remove' })); if (get(this, 'isEmpty')) { @@ -2535,33 +2520,34 @@ var content = this.rejectBy('attribute', attribute); set(this, 'content', content); get(this, 'errorsByAttributeName').delete(attribute); this.notifyPropertyChange(attribute); + this.notifyPropertyChange('length'); }, /** Removes all error messages and sends `becameValid` event to the record. Example: ```app/routes/user/edit.js - import Ember from 'ember'; - export default Ember.Route.extend({ + import Route from '@ember/routing/route'; + export default Route.extend({ actions: { retrySave: function(user) { - user.get('errors').clear(); - user.save(); - } + user.get('errors').clear(); + user.save(); + } } }); ``` @method clear @deprecated */ clear: function () { - (false && _ember.default.warn('Interacting with a record errors object will no longer change the record state.', false, { + (false && Ember.warn('Interacting with a record errors object will no longer change the record state.', false, { id: 'ds.errors.clear' })); if (get(this, 'isEmpty')) { @@ -2583,37 +2569,37 @@ if (get(this, 'isEmpty')) { return; } var errorsByAttributeName = get(this, 'errorsByAttributeName'); - var attributes = _ember.default.A(); + var attributes = A(); errorsByAttributeName.forEach(function (_, attribute) { attributes.push(attribute); }); errorsByAttributeName.clear(); attributes.forEach(function (attribute) { this.notifyPropertyChange(attribute); }, this); - _ember.default.ArrayProxy.prototype.clear.call(this); + ArrayProxy.prototype.clear.call(this); }, /** Checks if there is error messages for the given attribute. ```app/routes/user/edit.js - import Ember from 'ember'; - export default Ember.Route.extend({ + import Route from '@ember/routing/route'; + export default Route.extend({ actions: { save: function(user) { - if (user.get('errors').has('email')) { - return alert('Please update your email before attempting to save.'); - } - user.save(); - } + if (user.get('errors').has('email')) { + return alert('Please update your email before attempting to save.'); + } + user.save(); + } } }); ``` @method has @param {String} attribute @@ -2622,11 +2608,11 @@ has: function (attribute) { return !isEmpty(this.errorsFor(attribute)); } }); }); -define('ember-data/-private/system/model/internal-model', ['exports', 'ember', 'ember-data/-private/system/model/states', 'ember-data/-private/system/relationships/state/create', 'ember-data/-private/system/snapshot', 'ember-data/-private/features', 'ember-data/-private/system/ordered-set', 'ember-data/-private/utils', 'ember-data/-private/system/references'], function (exports, _ember, _states, _create, _snapshot, _features, _orderedSet, _utils, _references) { +define('ember-data/-private/system/model/internal-model', ['exports', 'ember-data/-private/system/model/states', 'ember-data/-private/system/relationships/state/create', 'ember-data/-private/system/snapshot', 'ember-data/-private/features', 'ember-data/-private/system/ordered-set', 'ember-data/-private/utils', 'ember-data/-private/system/references'], function (exports, _states, _create, _snapshot, _features, _orderedSet, _utils, _references) { 'use strict'; exports.__esModule = true; function _classCallCheck(instance, Constructor) { @@ -2651,24 +2637,26 @@ if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - var get = _ember.default.get, - set = _ember.default.set, - copy = _ember.default.copy, - EmberError = _ember.default.Error, - inspect = _ember.default.inspect, - isEmpty = _ember.default.isEmpty, - isEqual = _ember.default.isEqual, - setOwner = _ember.default.setOwner, - run = _ember.default.run, - RSVP = _ember.default.RSVP, - Promise = _ember.default.RSVP.Promise; + var assign = Ember.assign; + var merge = Ember.merge; + var set = Ember.set; + var get = Ember.get; + var copy = Ember.copy; + var EmberError = Ember.Error; + var isEqual = Ember.isEqual; + var isEmpty = Ember.isEmpty; + var setOwner = Ember.setOwner; + var run = Ember.run; + var RSVP = Ember.RSVP; + var Promise = Ember.RSVP.Promise; + var inspect = Ember.inspect; - var assign = _ember.default.assign || _ember.default.merge; + var emberAssign = assign || merge; /* The TransitionChainMap caches the `state.enters`, `state.setups`, and final state reached when transitioning from one state to another, so that future transitions can replay the transition without needing to walk the state tree, collect these hook calls and determine @@ -2736,11 +2724,11 @@ var InternalModel = function () { function InternalModel(modelName, id, store, data) { this.id = id; // this ensure ordered set can quickly identify this as unique - this[_ember.default.GUID_KEY] = InternalModelReferenceId++ + 'internal-model'; + this[Ember.GUID_KEY] = InternalModelReferenceId++ + 'internal-model'; this.store = store; this.modelName = modelName; this._loadingPromise = null; this._record = null; @@ -2836,11 +2824,11 @@ isError: this.isError, adapterError: this.error }; if (typeof properties === 'object' && properties !== null) { - assign(createOptions, properties); + emberAssign(createOptions, properties); } if (setOwner) { // ensure that `getOwner(this)` works inside a model instance setOwner(createOptions, (0, _utils.getOwner)(this.store)); @@ -2939,11 +2927,11 @@ var node = queue.shift(); array.push(node); var related = node._directlyRelatedInternalModels(); for (var i = 0; i < related.length; ++i) { var internalModel = related[i]; - (false && _ember.default.assert('Internal Error: seen a future bfs iteration', internalModel._bfsId <= bfsId)); + (false && Ember.assert('Internal Error: seen a future bfs iteration', internalModel._bfsId <= bfsId)); if (internalModel._bfsId < bfsId) { queue.push(internalModel); internalModel._bfsId = bfsId; } @@ -2959,23 +2947,23 @@ this.send('unloadRecord'); this.dematerializeRecord(); if (this._scheduledDestroy === null) { // TODO: use run.schedule once we drop 1.13 - if (!_ember.default.run.currentRunLoop) { - (false && _ember.default.assert('You have turned on testing mode, which disabled the run-loop\'s autorun.\n You will need to wrap any code with asynchronous side-effects in a run', _ember.default.testing)); + if (!run.currentRunLoop) { + (false && Ember.assert('You have turned on testing mode, which disabled the run-loop\'s autorun.\n You will need to wrap any code with asynchronous side-effects in a run', Ember.testing)); } - this._scheduledDestroy = _ember.default.run.backburner.schedule('destroy', this, '_checkForOrphanedInternalModels'); + this._scheduledDestroy = run.backburner.schedule('destroy', this, '_checkForOrphanedInternalModels'); } }; InternalModel.prototype.hasScheduledDestroy = function hasScheduledDestroy() { return !!this._scheduledDestroy; }; InternalModel.prototype.cancelDestroy = function cancelDestroy() { - (false && _ember.default.assert('You cannot cancel the destruction of an InternalModel once it has already been destroyed', !this.isDestroyed)); + (false && Ember.assert('You cannot cancel the destruction of an InternalModel once it has already been destroyed', !this.isDestroyed)); this._isDematerializing = false; run.cancel(this._scheduledDestroy); this._scheduledDestroy = null; @@ -3020,11 +3008,11 @@ InternalModel.prototype.eachRelationship = function eachRelationship(callback, binding) { return this.modelClass.eachRelationship(callback, binding); }; InternalModel.prototype.destroy = function destroy() { - (false && _ember.default.assert("Cannot destroy an internalModel while its record is materialized", !this._record || this._record.get('isDestroyed') || this._record.get('isDestroying'))); + (false && Ember.assert("Cannot destroy an internalModel while its record is materialized", !this._record || this._record.get('isDestroyed') || this._record.get('isDestroying'))); this.store._internalModelDestroyed(this); this._relationships.forEach(function (name, rel) { @@ -3049,11 +3037,11 @@ if (this.hasRecord) { changedKeys = this._changedKeys(data.attributes); } - assign(this._data, data.attributes); + emberAssign(this._data, data.attributes); this.pushedData(); if (this.hasRecord) { this._record._notifyProperties(changedKeys); } @@ -3107,11 +3095,11 @@ InternalModel.prototype.changedAttributes = function changedAttributes() { var oldData = this._data; var currentData = this._attributes; var inFlightData = this._inFlightAttributes; - var newData = assign(copy(inFlightData), currentData); + var newData = emberAssign(copy(inFlightData), currentData); var diffData = Object.create(null); var newDataKeys = Object.keys(newData); for (var i = 0, length = newDataKeys.length; i < length; i++) { var key = newDataKeys[i]; @@ -3351,11 +3339,11 @@ this._preloadBelongsTo(key, preloadValue, modelClass); } }; InternalModel.prototype._preloadHasMany = function _preloadHasMany(key, preloadValue, modelClass) { - (false && _ember.default.assert("You need to pass in an array to set a hasMany property on a record", Array.isArray(preloadValue))); + (false && Ember.assert("You need to pass in an array to set a hasMany property on a record", Array.isArray(preloadValue))); var recordsToSet = new Array(preloadValue.length); for (var i = 0; i < preloadValue.length; i++) { var recordToPush = preloadValue[i]; @@ -3388,11 +3376,11 @@ InternalModel.prototype.updateRecordArrays = function updateRecordArrays() { this.store.recordArrayManager.recordDidChange(this); }; InternalModel.prototype.setId = function setId(id) { - (false && _ember.default.assert('A record\'s id cannot be changed once it is in the loaded state', this.id === null || this.id === id || this.isNew())); + (false && Ember.assert('A record\'s id cannot be changed once it is in the loaded state', this.id === null || this.id === id || this.isNew())); this.id = id; if (this._record.get('id') !== id) { this._record.set('id', id); } @@ -3430,13 +3418,13 @@ } this.didCleanError(); var changedKeys = this._changedKeys(data); - assign(this._data, this._inFlightAttributes); + emberAssign(this._data, this._inFlightAttributes); if (data) { - assign(this._data, data); + emberAssign(this._data, data); } this._inFlightAttributes = null; this.send('didCommit'); @@ -3514,12 +3502,12 @@ var attrs = void 0; if (hasAttrs) { attrs = this._attributes; } - original = assign(Object.create(null), this._data); - original = assign(original, this._inFlightAttributes); + original = emberAssign(Object.create(null), this._data); + original = emberAssign(original, this._inFlightAttributes); for (i = 0; i < length; i++) { key = keys[i]; value = updates[key]; @@ -3550,15 +3538,15 @@ if (!reference) { var relationship = this._relationships.get(name); if (false) { var modelName = this.modelName; - (false && _ember.default.assert('There is no ' + kind + ' relationship named \'' + name + '\' on a model of modelClass \'' + modelName + '\'', relationship)); + (false && Ember.assert('There is no ' + kind + ' relationship named \'' + name + '\' on a model of modelClass \'' + modelName + '\'', relationship)); var actualRelationshipKind = relationship.relationshipMeta.kind; - (false && _ember.default.assert('You tried to get the \'' + name + '\' relationship on a \'' + modelName + '\' via record.' + kind + '(\'' + name + '\'), but the relationship is of kind \'' + actualRelationshipKind + '\'. Use record.' + actualRelationshipKind + '(\'' + name + '\') instead.', actualRelationshipKind === kind)); + (false && Ember.assert('You tried to get the \'' + name + '\' relationship on a \'' + modelName + '\' via record.' + kind + '(\'' + name + '\'), but the relationship is of kind \'' + actualRelationshipKind + '\'. Use record.' + actualRelationshipKind + '(\'' + name + '\') instead.', actualRelationshipKind === kind)); } if (kind === "belongsTo") { reference = new _references.BelongsToReference(this.store, this, relationship); } else if (kind === "hasMany") { @@ -3695,17 +3683,24 @@ return this._data[key]; } }; } }); -define('ember-data/-private/system/model/model', ['exports', 'ember', 'ember-data/-private/system/promise-proxies', 'ember-data/-private/system/model/errors', 'ember-data/-private/features', 'ember-data/-private/system/model/states', 'ember-data/-private/system/relationships/ext'], function (exports, _ember, _promiseProxies, _errors, _features, _states, _ext) { +define('ember-data/-private/system/model/model', ['exports', 'ember-data/-private/system/promise-proxies', 'ember-data/-private/system/model/errors', 'ember-data/-private/features', 'ember-data/-private/system/model/states', 'ember-data/-private/system/relationships/ext'], function (exports, _promiseProxies, _errors, _features, _states, _ext) { 'use strict'; exports.__esModule = true; - var get = _ember.default.get, - computed = _ember.default.computed, - Map = _ember.default.Map; + var ComputedProperty = Ember.ComputedProperty; + var setOwner = Ember.setOwner; + var isNone = Ember.isNone; + var EmberError = Ember.Error; + var Evented = Ember.Evented; + var EmberObject = Ember.Object; + var computed = Ember.computed; + var get = Ember.get; + var observer = Ember.observer; + var Map = Ember.Map; /** @module ember-data */ @@ -3768,11 +3763,11 @@ @class Model @namespace DS @extends Ember.Object @uses Ember.Evented */ - var Model = _ember.default.Object.extend(_ember.default.Evented, { + var Model = EmberObject.extend(Evented, { _internalModel: null, store: null, __defineNonEnumerable: function (property) { this[property.name] = property.descriptor.value; }, @@ -4137,17 +4132,17 @@ return; } this._internalModel.unloadRecord(); }, _notifyProperties: function (keys) { - _ember.default.beginPropertyChanges(); + Ember.beginPropertyChanges(); var key = void 0; for (var i = 0, length = keys.length; i < length; i++) { key = keys[i]; this.notifyPropertyChange(key); } - _ember.default.endPropertyChanges(); + Ember.endPropertyChanges(); }, changedAttributes: function () { return this._internalModel.changedAttributes(); }, rollbackAttributes: function () { @@ -4191,21 +4186,21 @@ } this._super.apply(this, arguments); }, attr: function () { - (false && _ember.default.assert("The `attr` method is not available on DS.Model, a DS.Snapshot was probably expected. Are you passing a DS.Model instead of a DS.Snapshot to your serializer?", false)); + (false && Ember.assert("The `attr` method is not available on DS.Model, a DS.Snapshot was probably expected. Are you passing a DS.Model instead of a DS.Snapshot to your serializer?", false)); }, belongsTo: function (name) { return this._internalModel.referenceFor('belongsTo', name); }, hasMany: function (name) { return this._internalModel.referenceFor('hasMany', name); }, - setId: _ember.default.observer('id', function () { + setId: observer('id', function () { this._internalModel.setId(this.get('id')); }), _debugInfo: function () { var attributes = ['id']; @@ -4292,11 +4287,11 @@ Model.reopen({ init: function () { this._super.apply(this, arguments); if (!this._internalModel) { - throw new _ember.default.Error('You should not call `create` on a model. Instead, call `store.createRecord` with the attributes you would like to set.'); + throw new EmberError('You should not call `create` on a model. Instead, call `store.createRecord` with the attributes you would like to set.'); } } }); } @@ -4323,13 +4318,14 @@ store.modelFor('blog-post').modelName; // 'blog-post' ``` The most common place you'll want to access `modelName` is in your serializer's `payloadKeyFromModelName` method. For example, to change payload keys to underscore (instead of dasherized), you might use the following code: ```javascript - export default const PostSerializer = DS.RESTSerializer.extend({ - payloadKeyFromModelName: function(modelName) { - return Ember.String.underscore(modelName); + import { underscore } from '@ember/string'; + export default const PostSerializer = DS.RESTSerializer.extend({ + payloadKeyFromModelName(modelName) { + return underscore(modelName); } }); ``` @property modelName @type String @@ -4342,11 +4338,11 @@ var relationship = get(this, 'relationshipsByName').get(name); return relationship && store.modelFor(relationship.type); }, - inverseMap: _ember.default.computed(function () { + inverseMap: computed(function () { return Object.create(null); }), inverseFor: function (name, store) { var inverseMap = get(this, 'inverseMap'); @@ -4389,20 +4385,20 @@ inverse = void 0; //If inverse is specified manually, return the inverse if (options.inverse) { inverseName = options.inverse; - inverse = _ember.default.get(inverseType, 'relationshipsByName').get(inverseName); + inverse = get(inverseType, 'relationshipsByName').get(inverseName); - (false && _ember.default.assert("We found no inverse relationships by the name of '" + inverseName + "' on the '" + inverseType.modelName + "' model. This is most likely due to a missing attribute on your model definition.", !_ember.default.isNone(inverse))); + (false && Ember.assert("We found no inverse relationships by the name of '" + inverseName + "' on the '" + inverseType.modelName + "' model. This is most likely due to a missing attribute on your model definition.", !isNone(inverse))); inverseKind = inverse.kind; } else { //No inverse was specified manually, we need to use a heuristic to guess one if (propertyMeta.parentType && propertyMeta.type === propertyMeta.parentType.modelName) { - (false && _ember.default.warn('Detected a reflexive relationship by the name of \'' + name + '\' without an inverse option. Look at https://emberjs.com/guides/models/defining-models/#toc_reflexive-relation for how to explicitly specify inverses.', false, { + (false && Ember.warn('Detected a reflexive relationship by the name of \'' + name + '\' without an inverse option. Look at https://guides.emberjs.com/current/models/relationships/#toc_reflexive-relations for how to explicitly specify inverses.', false, { id: 'ds.model.reflexive-relationship-without-inverse' })); } var possibleRelationships = findPossibleInverses(this, inverseType, name); @@ -4414,18 +4410,18 @@ var filteredRelationships = possibleRelationships.filter(function (possibleRelationship) { var optionsForRelationship = inverseType.metaForProperty(possibleRelationship.name).options; return name === optionsForRelationship.inverse; }); - (false && _ember.default.assert("You defined the '" + name + "' relationship on " + this + ", but you defined the inverse relationships of type " + inverseType.toString() + " multiple times. Look at https://emberjs.com/guides/models/defining-models/#toc_explicit-inverses for how to explicitly specify inverses", filteredRelationships.length < 2)); + (false && Ember.assert("You defined the '" + name + "' relationship on " + this + ", but you defined the inverse relationships of type " + inverseType.toString() + " multiple times. Look at https://guides.emberjs.com/current/models/relationships/#toc_explicit-inverses for how to explicitly specify inverses", filteredRelationships.length < 2)); if (filteredRelationships.length === 1) { possibleRelationships = filteredRelationships; } - (false && _ember.default.assert("You defined the '" + name + "' relationship on " + this + ", but multiple possible inverse relationships of type " + this + " were found on " + inverseType + ". Look at https://emberjs.com/guides/models/defining-models/#toc_explicit-inverses for how to explicitly specify inverses", possibleRelationships.length === 1)); + (false && Ember.assert("You defined the '" + name + "' relationship on " + this + ", but multiple possible inverse relationships of type " + this + " were found on " + inverseType + ". Look at https://guides.emberjs.com/current/models/relationships/#toc_explicit-inverses for how to explicitly specify inverses", possibleRelationships.length === 1)); inverseName = possibleRelationships[0].name; inverseKind = possibleRelationships[0].kind; } @@ -4499,11 +4495,11 @@ @property relationshipNames @static @type Object @readOnly */ - relationshipNames: _ember.default.computed(function () { + relationshipNames: computed(function () { var names = { hasMany: [], belongsTo: [] }; @@ -4603,11 +4599,11 @@ @property fields @static @type Ember.Map @readOnly */ - fields: _ember.default.computed(function () { + fields: computed(function () { var map = Map.create(); this.eachComputedProperty(function (name, meta) { if (meta.isRelationship) { map.set(name, meta.kind); @@ -4682,18 +4678,18 @@ @property attributes @static @type {Ember.Map} @readOnly */ - attributes: _ember.default.computed(function () { + attributes: computed(function () { var _this3 = this; var map = Map.create(); this.eachComputedProperty(function (name, meta) { if (meta.isAttribute) { - (false && _ember.default.assert("You may not set `id` as an attribute on your model. Please remove any lines that look like: `id: DS.attr('<type>')` from " + _this3.toString(), name !== 'id')); + (false && Ember.assert("You may not set `id` as an attribute on your model. Please remove any lines that look like: `id: DS.attr('<type>')` from " + _this3.toString(), name !== 'id')); meta.name = name; map.set(name, meta); } @@ -4730,11 +4726,11 @@ @property transformedAttributes @static @type {Ember.Map} @readOnly */ - transformedAttributes: _ember.default.computed(function () { + transformedAttributes: computed(function () { var map = Map.create(); this.eachAttribute(function (key, meta) { if (meta.type) { map.set(key, meta.type); @@ -4759,16 +4755,16 @@ // if `Ember.setOwner` is defined, accessing `this.container` is // deprecated (but functional). In "standard" Ember usage, this // deprecation is actually created via an `.extend` of the factory // inside the container itself, but that only happens on models // with MODEL_FACTORY_INJECTIONS enabled :( - if (_ember.default.setOwner) { + if (setOwner) { Object.defineProperty(Model.prototype, 'container', { configurable: true, enumerable: false, get: function () { - (false && !(false) && _ember.default.deprecate('Using the injected `container` is deprecated. Please use the `getOwner` helper instead to access the owner of this object.', false, { id: 'ember-application.injected-container', until: '3.0.0' })); + (false && !(false) && Ember.deprecate('Using the injected `container` is deprecated. Please use the `getOwner` helper instead to access the owner of this object.', false, { id: 'ember-application.injected-container', until: '3.0.0' })); return this.store.container; } }); @@ -4786,16 +4782,16 @@ if (false) { Model.reopen({ willMergeMixin: function (props) { var constructor = this.constructor; - (false && _ember.default.assert('`' + intersection(Object.keys(props), RESERVED_MODEL_PROPS)[0] + '` is a reserved property name on DS.Model objects. Please choose a different property name for ' + constructor.toString(), !intersection(Object.keys(props), RESERVED_MODEL_PROPS)[0])); - (false && _ember.default.assert("You may not set `id` as an attribute on your model. Please remove any lines that look like: `id: DS.attr('<type>')` from " + constructor.toString(), Object.keys(props).indexOf('id') === -1)); + (false && Ember.assert('`' + intersection(Object.keys(props), RESERVED_MODEL_PROPS)[0] + '` is a reserved property name on DS.Model objects. Please choose a different property name for ' + constructor.toString(), !intersection(Object.keys(props), RESERVED_MODEL_PROPS)[0])); + (false && Ember.assert("You may not set `id` as an attribute on your model. Please remove any lines that look like: `id: DS.attr('<type>')` from " + constructor.toString(), Object.keys(props).indexOf('id') === -1)); }, didDefineProperty: function (proto, key, value) { // Check if the value being set is a computed property. - if (value instanceof _ember.default.ComputedProperty) { + if (value instanceof ComputedProperty) { // If it is, get the metadata for the relationship. This is // populated by the `DS.belongsTo` helper when it is creating // the computed property. var meta = value.meta(); @@ -5226,10 +5222,17 @@ function assertAgainstUnloadRecord(internalModel) { (false && Ember.assert("You can only unload a record which is not inFlight. `" + internalModel + "`", false)); } + updatedState.invalid.becameValid = function (internalModel) { + // we're eagerly transition into the loaded.saved state, even though we could + // be still dirty; but the setup hook of the loaded.saved state checks for + // dirty attributes and transitions into the corresponding dirty state + internalModel.transitionTo('loaded.saved'); + }; + updatedState.inFlight.unloadRecord = assertAgainstUnloadRecord; updatedState.uncommitted.deleteRecord = function (internalModel) { internalModel.transitionTo('deleted.uncommitted'); }; @@ -5525,15 +5528,16 @@ return { href: link }; } return null; } }); -define('ember-data/-private/system/normalize-model-name', ['exports', 'ember'], function (exports, _ember) { +define('ember-data/-private/system/normalize-model-name', ['exports'], function (exports) { 'use strict'; exports.__esModule = true; exports.default = normalizeModelName; + var dasherize = Ember.String.dasherize; // All modelNames are dasherized internally. Changing this function may // require changes to other normalization hooks (such as typeForRoot). @@ -5546,22 +5550,22 @@ @param {String} modelName @return {String} normalizedModelName @for DS */ function normalizeModelName(modelName) { - return _ember.default.String.dasherize(modelName); + return dasherize(modelName); } }); -define('ember-data/-private/system/ordered-set', ['exports', 'ember'], function (exports, _ember) { +define('ember-data/-private/system/ordered-set', ['exports'], function (exports) { 'use strict'; exports.__esModule = true; exports.default = OrderedSet; + var guidFor = Ember.guidFor; - var EmberOrderedSet = _ember.default.OrderedSet; - var guidFor = _ember.default.guidFor; + var EmberOrderedSet = Ember.OrderedSet; function OrderedSet() { this._super$constructor(); } @@ -5594,21 +5598,24 @@ this.size += 1; return this; }; }); -define('ember-data/-private/system/promise-proxies', ['exports', 'ember'], function (exports, _ember) { +define('ember-data/-private/system/promise-proxies', ['exports'], function (exports) { 'use strict'; exports.__esModule = true; - exports.PromiseManyArray = exports.PromiseObject = exports.PromiseArray = undefined; exports.promiseObject = promiseObject; exports.promiseArray = promiseArray; exports.proxyToContent = proxyToContent; exports.promiseManyArray = promiseManyArray; - var get = _ember.default.get, - Promise = _ember.default.RSVP.Promise; + var ObjectProxy = Ember.ObjectProxy; + var PromiseProxyMixin = Ember.PromiseProxyMixin; + var ArrayProxy = Ember.ArrayProxy; + var get = Ember.get; + var reads = Ember.computed.reads; + var Promise = Ember.RSVP.Promise; /** A `PromiseArray` is an object that acts like both an `Ember.Array` and a promise. When the promise is resolved the resulting value @@ -5636,11 +5643,13 @@ @class PromiseArray @namespace DS @extends Ember.ArrayProxy @uses Ember.PromiseProxyMixin */ - var PromiseArray = exports.PromiseArray = _ember.default.ArrayProxy.extend(_ember.default.PromiseProxyMixin); + var PromiseArray = exports.PromiseArray = ArrayProxy.extend(PromiseProxyMixin, { + meta: reads('content.meta') + }); /** A `PromiseObject` is an object that acts like both an `Ember.Object` and a promise. When the promise is resolved, then the resulting value will be set to the `PromiseObject`'s `content` property. This makes @@ -5667,11 +5676,11 @@ @class PromiseObject @namespace DS @extends Ember.ObjectProxy @uses Ember.PromiseProxyMixin */ - var PromiseObject = exports.PromiseObject = _ember.default.ObjectProxy.extend(_ember.default.PromiseProxyMixin); + var PromiseObject = exports.PromiseObject = ObjectProxy.extend(PromiseProxyMixin); function promiseObject(promise, label) { return PromiseObject.create({ promise: Promise.resolve(promise, label) }); @@ -5709,11 +5718,11 @@ }; } var PromiseManyArray = exports.PromiseManyArray = PromiseArray.extend({ reload: function () { - (false && _ember.default.assert('You are trying to reload an async manyArray before it has been created', get(this, 'content'))); + (false && Ember.assert('You are trying to reload an async manyArray before it has been created', get(this, 'content'))); this.set('promise', this.get('content').reload()); return this; }, @@ -5735,25 +5744,26 @@ return PromiseManyArray.create({ promise: Promise.resolve(promise, label) }); } }); -define("ember-data/-private/system/record-array-manager", ["exports", "ember", "ember-data/-private/system/record-arrays", "ember-data/-private/system/clone-null"], function (exports, _ember, _recordArrays, _cloneNull) { - "use strict"; +define('ember-data/-private/system/record-array-manager', ['exports', 'ember-data/-private/system/record-arrays', 'ember-data/-private/system/clone-null'], function (exports, _recordArrays, _cloneNull) { + 'use strict'; exports.__esModule = true; exports.associateWithRecordArray = associateWithRecordArray; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - var get = _ember.default.get, - set = _ember.default.set, - emberRun = _ember.default.run; + var A = Ember.A; + var set = Ember.set; + var get = Ember.get; + var emberRun = Ember.run; var RecordArrayManager = function () { function RecordArrayManager(options) { this.store = options.store; this.isDestroying = false; @@ -5869,11 +5879,11 @@ array._removeInternalModels(shouldBeRemoved); } }; RecordArrayManager.prototype._syncLiveRecordArray = function _syncLiveRecordArray(array, modelName) { - (false && _ember.default.assert("recordArrayManger.syncLiveRecordArray expects modelName not modelClass as the second param", typeof modelName === 'string')); + (false && Ember.assert('recordArrayManger.syncLiveRecordArray expects modelName not modelClass as the second param', typeof modelName === 'string')); var hasNoPotentialDeletions = Object.keys(this._pending).length === 0; var map = this.store._internalModelsFor(modelName); var hasNoInsertionsOrRemovals = get(map, 'length') === get(array, 'length'); @@ -5900,11 +5910,11 @@ array._pushInternalModels(modelsToAdd); }; RecordArrayManager.prototype.updateFilter = function updateFilter(array, modelName, filter) { - (false && _ember.default.assert("recordArrayManger.updateFilter expects modelName not modelClass as the second param, received " + modelName, typeof modelName === 'string')); + (false && Ember.assert('recordArrayManger.updateFilter expects modelName not modelClass as the second param, received ' + modelName, typeof modelName === 'string')); var modelMap = this.store._internalModelsFor(modelName); var internalModels = modelMap.models; this.updateFilterRecordArray(array, filter, internalModels); @@ -5916,11 +5926,11 @@ set(recordArray, 'isUpdating', false); } }; RecordArrayManager.prototype.liveRecordArrayFor = function liveRecordArrayFor(modelName) { - (false && _ember.default.assert("recordArrayManger.liveRecordArrayFor expects modelName not modelClass as the param", typeof modelName === 'string')); + (false && Ember.assert('recordArrayManger.liveRecordArrayFor expects modelName not modelClass as the param', typeof modelName === 'string')); var array = this._liveRecordArrays[modelName]; if (array) { @@ -5948,23 +5958,23 @@ } return visible; }; RecordArrayManager.prototype.filteredRecordArraysFor = function filteredRecordArraysFor(modelName) { - (false && _ember.default.assert("recordArrayManger.filteredRecordArraysFor expects modelName not modelClass as the param", typeof modelName === 'string')); + (false && Ember.assert('recordArrayManger.filteredRecordArraysFor expects modelName not modelClass as the param', typeof modelName === 'string')); return this._filteredRecordArrays[modelName] || (this._filteredRecordArrays[modelName] = []); }; RecordArrayManager.prototype.createRecordArray = function createRecordArray(modelName, content) { - (false && _ember.default.assert("recordArrayManger.createRecordArray expects modelName not modelClass as the param", typeof modelName === 'string')); + (false && Ember.assert('recordArrayManger.createRecordArray expects modelName not modelClass as the param', typeof modelName === 'string')); var array = _recordArrays.RecordArray.create({ modelName: modelName, - content: _ember.default.A(content || []), + content: A(content || []), store: this.store, isLoaded: true, manager: this }); @@ -5974,16 +5984,16 @@ return array; }; RecordArrayManager.prototype.createFilteredRecordArray = function createFilteredRecordArray(modelName, filter, query) { - (false && _ember.default.assert("recordArrayManger.createFilteredRecordArray expects modelName not modelClass as the first param, received " + modelName, typeof modelName === 'string')); + (false && Ember.assert('recordArrayManger.createFilteredRecordArray expects modelName not modelClass as the first param, received ' + modelName, typeof modelName === 'string')); var array = _recordArrays.FilteredRecordArray.create({ query: query, modelName: modelName, - content: _ember.default.A(), + content: A(), store: this.store, manager: this, filterFunction: filter }); @@ -5991,19 +6001,19 @@ return array; }; RecordArrayManager.prototype.createAdapterPopulatedRecordArray = function createAdapterPopulatedRecordArray(modelName, query, internalModels, payload) { - (false && _ember.default.assert("recordArrayManger.createAdapterPopulatedRecordArray expects modelName not modelClass as the first param, received " + modelName, typeof modelName === 'string')); + (false && Ember.assert('recordArrayManger.createAdapterPopulatedRecordArray expects modelName not modelClass as the first param, received ' + modelName, typeof modelName === 'string')); var array = void 0; if (Array.isArray(internalModels)) { array = _recordArrays.AdapterPopulatedRecordArray.create({ modelName: modelName, query: query, - content: _ember.default.A(internalModels), + content: A(internalModels), store: this.store, manager: this, isLoaded: true, isUpdating: false, meta: (0, _cloneNull.default)(payload.meta), @@ -6013,11 +6023,11 @@ associateWithRecordArray(internalModels, array); } else { array = _recordArrays.AdapterPopulatedRecordArray.create({ modelName: modelName, query: query, - content: _ember.default.A(), + content: A(), store: this.store, manager: this }); } @@ -6025,11 +6035,11 @@ return array; }; RecordArrayManager.prototype.registerFilteredRecordArray = function registerFilteredRecordArray(array, modelName, filter) { - (false && _ember.default.assert("recordArrayManger.registerFilteredRecordArray expects modelName not modelClass as the second param, received " + modelName, typeof modelName === 'string')); + (false && Ember.assert('recordArrayManger.registerFilteredRecordArray expects modelName not modelClass as the second param, received ' + modelName, typeof modelName === 'string')); this.filteredRecordArraysFor(modelName).push(array); this.updateFilter(array, modelName, filter); }; @@ -6165,26 +6175,28 @@ exports.AdapterPopulatedRecordArray = exports.FilteredRecordArray = exports.RecordArray = undefined; exports.RecordArray = _recordArray.default; exports.FilteredRecordArray = _filteredRecordArray.default; exports.AdapterPopulatedRecordArray = _adapterPopulatedRecordArray.default; }); -define("ember-data/-private/system/record-arrays/adapter-populated-record-array", ["exports", "ember", "ember-data/-private/system/record-arrays/record-array", "ember-data/-private/system/clone-null", "ember-data/-private/system/record-array-manager"], function (exports, _ember, _recordArray, _cloneNull, _recordArrayManager) { - "use strict"; +define('ember-data/-private/system/record-arrays/adapter-populated-record-array', ['exports', 'ember-data/-private/system/record-arrays/record-array', 'ember-data/-private/system/clone-null', 'ember-data/-private/system/record-array-manager'], function (exports, _recordArray, _cloneNull, _recordArrayManager) { + 'use strict'; exports.__esModule = true; - var get = _ember.default.get; + var once = Ember.run.once; + var A = Ember.A; + var get = Ember.get; exports.default = _recordArray.default.extend({ init: function () { // yes we are touching `this` before super, but ArrayProxy has a bug that requires this. - this.set('content', this.get('content') || _ember.default.A()); + this.set('content', this.get('content') || A()); this._super.apply(this, arguments); this.query = this.query || null; this.links = null; }, replace: function () { - throw new Error("The result of a server query (on " + this.modelName + ") is immutable."); + throw new Error('The result of a server query (on ' + this.modelName + ') is immutable.'); }, _update: function () { var store = get(this, 'store'); var query = get(this, 'query'); @@ -6213,19 +6225,21 @@ }); (0, _recordArrayManager.associateWithRecordArray)(internalModels, this); // TODO: should triggering didLoad event be the last action of the runLoop? - _ember.default.run.once(this, 'trigger', 'didLoad'); + once(this, 'trigger', 'didLoad'); } }); }); -define('ember-data/-private/system/record-arrays/filtered-record-array', ['exports', 'ember', 'ember-data/-private/system/record-arrays/record-array'], function (exports, _ember, _recordArray) { +define('ember-data/-private/system/record-arrays/filtered-record-array', ['exports', 'ember-data/-private/system/record-arrays/record-array'], function (exports, _recordArray) { 'use strict'; exports.__esModule = true; - var get = _ember.default.get; + var once = Ember.run.once; + var get = Ember.get; + var observer = Ember.observer; exports.default = _recordArray.default.extend({ init: function () { this._super.apply(this, arguments); this.set('filterFunction', this.get('filterFunction') || null); @@ -6269,24 +6283,26 @@ } get(this, 'manager').updateFilter(this, this.modelName, get(this, 'filterFunction')); }, - updateFilter: _ember.default.observer('filterFunction', function () { - _ember.default.run.once(this, this._updateFilter); + updateFilter: observer('filterFunction', function () { + once(this, this._updateFilter); }) }); }); -define("ember-data/-private/system/record-arrays/record-array", ["exports", "ember", "ember-data/-private/system/promise-proxies", "ember-data/-private/system/snapshot-record-array"], function (exports, _ember, _promiseProxies, _snapshotRecordArray) { - "use strict"; +define('ember-data/-private/system/record-arrays/record-array', ['exports', 'ember-data/-private/system/promise-proxies', 'ember-data/-private/system/snapshot-record-array'], function (exports, _promiseProxies, _snapshotRecordArray) { + 'use strict'; exports.__esModule = true; - var computed = _ember.default.computed, - get = _ember.default.get, - set = _ember.default.set, - Promise = _ember.default.RSVP.Promise; - exports.default = _ember.default.ArrayProxy.extend(_ember.default.Evented, { + var Evented = Ember.Evented; + var ArrayProxy = Ember.ArrayProxy; + var set = Ember.set; + var get = Ember.get; + var computed = Ember.computed; + var Promise = Ember.RSVP.Promise; + exports.default = ArrayProxy.extend(Evented, { init: function () { this._super.apply(this, arguments); /** The array of client ids backing the record array. When a @@ -6332,11 +6348,11 @@ */ this.store = this.store || null; this._updatingPromise = null; }, replace: function () { - throw new Error("The result of a server query (for all " + this.modelName + " types) is immutable. To modify contents, use toArray()"); + throw new Error('The result of a server query (for all ' + this.modelName + ' types) is immutable. To modify contents, use toArray()'); }, /** The modelClass represented by this record array. @@ -6448,11 +6464,11 @@ @return {DS.PromiseArray} promise */ save: function () { var _this2 = this; - var promiseLabel = "DS: RecordArray#save " + this.modelName; + var promiseLabel = 'DS: RecordArray#save ' + this.modelName; var promise = Promise.all(this.invoke('save'), promiseLabel).then(function () { return _this2; }, null, 'DS: RecordArray#save return RecordArray'); return _promiseProxies.PromiseArray.create({ promise: promise }); @@ -6521,14 +6537,15 @@ exports.HasManyReference = exports.BelongsToReference = exports.RecordReference = undefined; exports.RecordReference = _record.default; exports.BelongsToReference = _belongsTo.default; exports.HasManyReference = _hasMany.default; }); -define('ember-data/-private/system/references/belongs-to', ['exports', 'ember-data/-private/system/model/model', 'ember', 'ember-data/-private/system/references/reference', 'ember-data/-private/features'], function (exports, _model, _ember, _reference, _features) { +define('ember-data/-private/system/references/belongs-to', ['exports', 'ember-data/-private/system/model/model', 'ember-data/-private/system/references/reference', 'ember-data/-private/features'], function (exports, _model, _reference, _features) { 'use strict'; exports.__esModule = true; + var resolve = Ember.RSVP.resolve; /** A BelongsToReference is a low level API that allows users and addon author to perform meta-operations on a belongs-to @@ -6763,16 +6780,16 @@ @return {Promise<record>} A promise that resolves with the new value in this belongs-to relationship. */ BelongsToReference.prototype.push = function (objectOrPromise) { var _this = this; - return _ember.default.RSVP.resolve(objectOrPromise).then(function (data) { + return resolve(objectOrPromise).then(function (data) { var record = void 0; if (data instanceof _model.default) { if ((0, _features.default)('ds-overhaul-references')) { - (false && !(false) && _ember.default.deprecate("BelongsToReference#push(DS.Model) is deprecated. Update relationship via `model.set('relationshipName', value)` instead.", false, { + (false && !(false) && Ember.deprecate("BelongsToReference#push(DS.Model) is deprecated. Update relationship via `model.set('relationshipName', value)` instead.", false, { id: 'ds.references.belongs-to.push-record', until: '3.0' })); } record = data; @@ -6936,16 +6953,17 @@ }); }; exports.default = BelongsToReference; }); -define('ember-data/-private/system/references/has-many', ['exports', 'ember', 'ember-data/-private/system/references/reference', 'ember-data/-private/features'], function (exports, _ember, _reference, _features) { +define('ember-data/-private/system/references/has-many', ['exports', 'ember-data/-private/system/references/reference', 'ember-data/-private/features'], function (exports, _reference, _features) { 'use strict'; exports.__esModule = true; - var resolve = _ember.default.RSVP.resolve, - get = _ember.default.get; + var A = Ember.A; + var resolve = Ember.RSVP.resolve; + var get = Ember.get; /** A HasManyReference is a low level API that allows users and addon author to perform meta-operations on a has-many relationship. @@ -7182,11 +7200,11 @@ return resolve(objectOrPromise).then(function (payload) { var array = payload; if ((0, _features.default)("ds-overhaul-references")) { - (false && !(!Array.isArray(payload)) && _ember.default.deprecate("HasManyReference#push(array) is deprecated. Push a JSON-API document instead.", !Array.isArray(payload), { + (false && !(!Array.isArray(payload)) && Ember.deprecate("HasManyReference#push(array) is deprecated. Push a JSON-API document instead.", !Array.isArray(payload), { id: 'ds.references.has-many.push-array', until: '3.0' })); } @@ -7194,11 +7212,11 @@ if (typeof payload === "object" && payload.data) { array = payload.data; useLegacyArrayPush = array.length && array[0].data; if ((0, _features.default)('ds-overhaul-references')) { - (false && !(!useLegacyArrayPush) && _ember.default.deprecate("HasManyReference#push() expects a valid JSON-API document.", !useLegacyArrayPush, { + (false && !(!useLegacyArrayPush) && Ember.deprecate("HasManyReference#push() expects a valid JSON-API document.", !useLegacyArrayPush, { id: 'ds.references.has-many.push-invalid-json-api', until: '3.0' })); } } @@ -7218,11 +7236,11 @@ return record._internalModel; }); } else { var records = _this.store.push(payload); - internalModels = _ember.default.A(records).mapBy('_internalModel'); + internalModels = A(records).mapBy('_internalModel'); if (false) { internalModels.forEach(function (internalModel) { var relationshipMeta = _this.hasManyRelationship.relationshipMeta; }); @@ -7377,14 +7395,15 @@ 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, _reference) { +define('ember-data/-private/system/references/record', ['exports', 'ember-data/-private/system/references/reference'], function (exports, _reference) { 'use strict'; exports.__esModule = true; + var resolve = Ember.RSVP.resolve; /** An RecordReference is a low level API that allows users and addon author to perform meta-operations on a record. @@ -7474,11 +7493,11 @@ @return Promise<record> a promise for the value (record or relationship) */ RecordReference.prototype.push = function (objectOrPromise) { var _this = this; - return _ember.default.RSVP.resolve(objectOrPromise).then(function (data) { + return resolve(objectOrPromise).then(function (data) { return _this.store.push(data); }); }; /** @@ -7499,10 +7518,11 @@ */ RecordReference.prototype.value = function () { if (this.internalModel.hasRecord) { return this.internalModel.getRecord(); } + return null; }; /** Triggers a fetch for the backing entity based on its `remoteType` (see `remoteType` definitions per reference type). @@ -7597,15 +7617,17 @@ } return result; } }); -define('ember-data/-private/system/relationships/belongs-to', ['exports', 'ember', 'ember-data/-private/system/normalize-model-name'], function (exports, _ember, _normalizeModelName) { +define('ember-data/-private/system/relationships/belongs-to', ['exports', 'ember-data/-private/system/normalize-model-name'], function (exports, _normalizeModelName) { 'use strict'; exports.__esModule = true; exports.default = belongsTo; + var computed = Ember.computed; + var inspect = Ember.inspect; /** `DS.belongsTo` is used to define One-To-One and One-To-Many relationships on a [DS.Model](/api/data/classes/DS.Model.html). @@ -7691,11 +7713,11 @@ if (typeof userEnteredModelName === 'string') { userEnteredModelName = (0, _normalizeModelName.default)(userEnteredModelName); } - (false && _ember.default.assert("The first argument to DS.belongsTo must be a string representing a model type key, not an instance of " + _ember.default.inspect(userEnteredModelName) + ". E.g., to define a relation to the Person model, use DS.belongsTo('person')", typeof userEnteredModelName === 'string' || typeof userEnteredModelName === 'undefined')); + (false && Ember.assert("The first argument to DS.belongsTo must be a string representing a model type key, not an instance of " + inspect(userEnteredModelName) + ". E.g., to define a relation to the Person model, use DS.belongsTo('person')", typeof userEnteredModelName === 'string' || typeof userEnteredModelName === 'undefined')); opts = opts || {}; var meta = { @@ -7705,20 +7727,20 @@ kind: 'belongsTo', name: 'Belongs To', key: null }; - return _ember.default.computed({ + return computed({ get: function (key) { if (opts.hasOwnProperty('serialize')) { - (false && _ember.default.warn('You provided a serialize option on the "' + key + '" property in the "' + this._internalModel.modelName + '" class, this belongs in the serializer. See DS.Serializer and it\'s implementations https://emberjs.com/api/data/classes/DS.Serializer.html', false, { + (false && Ember.warn('You provided a serialize option on the "' + key + '" property in the "' + this._internalModel.modelName + '" class, this belongs in the serializer. See DS.Serializer and it\'s implementations https://emberjs.com/api/data/classes/DS.Serializer.html', false, { id: 'ds.model.serialize-option-in-belongs-to' })); } if (opts.hasOwnProperty('embedded')) { - (false && _ember.default.warn('You provided an embedded option on the "' + key + '" property in the "' + this._internalModel.modelName + '" class, this belongs in the serializer. See DS.EmbeddedRecordsMixin https://emberjs.com/api/data/classes/DS.EmbeddedRecordsMixin.html', false, { + (false && Ember.warn('You provided an embedded option on the "' + key + '" property in the "' + this._internalModel.modelName + '" class, this belongs in the serializer. See DS.EmbeddedRecordsMixin https://emberjs.com/api/data/classes/DS.EmbeddedRecordsMixin.html', false, { id: 'ds.model.embedded-option-in-belongs-to' })); } return this._internalModel._relationships.get(key).getRecord(); @@ -7738,22 +7760,21 @@ return this._internalModel._relationships.get(key).getRecord(); } }).meta(meta); } }); -define('ember-data/-private/system/relationships/ext', ['exports', 'ember', 'ember-data/-private/system/relationship-meta'], function (exports, _ember, _relationshipMeta) { +define('ember-data/-private/system/relationships/ext', ['exports', 'ember-data/-private/system/relationship-meta'], function (exports, _relationshipMeta) { 'use strict'; exports.__esModule = true; exports.relationshipsByNameDescriptor = exports.relatedTypesDescriptor = exports.relationshipsDescriptor = undefined; - - - var Map = _ember.default.Map; - var MapWithDefault = _ember.default.MapWithDefault; - - var relationshipsDescriptor = exports.relationshipsDescriptor = _ember.default.computed(function () { - if (_ember.default.testing === true && relationshipsDescriptor._cacheable === true) { + var A = Ember.A; + var computed = Ember.computed; + var MapWithDefault = Ember.MapWithDefault; + var Map = Ember.Map; + var relationshipsDescriptor = exports.relationshipsDescriptor = computed(function () { + if (Ember.testing === true && relationshipsDescriptor._cacheable === true) { relationshipsDescriptor._cacheable = false; } var map = new MapWithDefault({ defaultValue: function () { @@ -7777,43 +7798,43 @@ }); return map; }).readOnly(); - var relatedTypesDescriptor = exports.relatedTypesDescriptor = _ember.default.computed(function () { + var relatedTypesDescriptor = exports.relatedTypesDescriptor = computed(function () { var _this = this; - if (_ember.default.testing === true && relatedTypesDescriptor._cacheable === true) { + if (Ember.testing === true && relatedTypesDescriptor._cacheable === true) { relatedTypesDescriptor._cacheable = false; } var modelName = void 0; - var types = _ember.default.A(); + var types = A(); // Loop through each computed property on the class, // and create an array of the unique types involved // in relationships this.eachComputedProperty(function (name, meta) { if (meta.isRelationship) { meta.key = name; modelName = (0, _relationshipMeta.typeForRelationshipMeta)(meta); - (false && _ember.default.assert('You specified a hasMany (' + meta.type + ') on ' + meta.parentType + ' but ' + meta.type + ' was not found.', modelName)); + (false && Ember.assert('You specified a hasMany (' + meta.type + ') on ' + meta.parentType + ' but ' + meta.type + ' was not found.', modelName)); if (!types.includes(modelName)) { - (false && _ember.default.assert('Trying to sideload ' + name + ' on ' + _this.toString() + ' but the type doesn\'t exist.', !!modelName)); + (false && Ember.assert('Trying to sideload ' + name + ' on ' + _this.toString() + ' but the type doesn\'t exist.', !!modelName)); types.push(modelName); } } }); return types; }).readOnly(); - var relationshipsByNameDescriptor = exports.relationshipsByNameDescriptor = _ember.default.computed(function () { + var relationshipsByNameDescriptor = exports.relationshipsByNameDescriptor = computed(function () { var map = Map.create(); this.eachComputedProperty(function (name, meta) { if (meta.isRelationship) { meta.key = name; @@ -7824,16 +7845,19 @@ }); return map; }).readOnly(); }); -define('ember-data/-private/system/relationships/has-many', ['exports', 'ember', 'ember-data/-private/system/normalize-model-name', 'ember-data/-private/system/is-array-like'], function (exports, _ember, _normalizeModelName, _isArrayLike) { +define('ember-data/-private/system/relationships/has-many', ['exports', 'ember-data/-private/system/normalize-model-name', 'ember-data/-private/system/is-array-like'], function (exports, _normalizeModelName, _isArrayLike) { 'use strict'; exports.__esModule = true; exports.default = hasMany; - var get = _ember.default.get; + var A = Ember.A; + var get = Ember.get; + var computed = Ember.computed; + var inspect = Ember.inspect; /** `DS.hasMany` is used to define One-To-Many and Many-To-Many relationships on a [DS.Model](/api/data/classes/DS.Model.html). @@ -7944,11 +7968,11 @@ if (typeof type === 'object') { options = type; type = undefined; } - (false && _ember.default.assert('The first argument to DS.hasMany must be a string representing a model type key, not an instance of ' + _ember.default.inspect(type) + '. E.g., to define a relation to the Comment model, use DS.hasMany(\'comment\')', typeof type === 'string' || typeof type === 'undefined')); + (false && Ember.assert('The first argument to DS.hasMany must be a string representing a model type key, not an instance of ' + inspect(type) + '. E.g., to define a relation to the Comment model, use DS.hasMany(\'comment\')', typeof type === 'string' || typeof type === 'undefined')); options = options || {}; if (typeof type === 'string') { @@ -7966,18 +7990,18 @@ kind: 'hasMany', name: 'Has Many', key: null }; - return _ember.default.computed({ + return computed({ get: function (key) { return this._internalModel._relationships.get(key).getRecords(); }, set: function (key, records) { - (false && _ember.default.assert('You must pass an array of records to set a hasMany relationship', (0, _isArrayLike.default)(records))); - (false && _ember.default.assert('All elements of a hasMany relationship must be instances of DS.Model, you passed ' + _ember.default.inspect(records), function () { - return _ember.default.A(records).every(function (record) { + (false && Ember.assert('You must pass an array of records to set a hasMany relationship', (0, _isArrayLike.default)(records))); + (false && Ember.assert('All elements of a hasMany relationship must be instances of DS.Model, you passed ' + inspect(records), function () { + return A(records).every(function (record) { return record.hasOwnProperty('_internalModel') === true; }); }())); @@ -7989,77 +8013,23 @@ return relationship.getRecords(); } }).meta(meta); } }); -define('ember-data/-private/system/relationships/relationship-payloads-manager', ['exports', 'ember', 'ember-data/-private/system/relationships/relationship-payloads'], function (exports, _ember, _relationshipPayloads) { +define('ember-data/-private/system/relationships/relationship-payloads-manager', ['exports', 'ember-data/-private/system/relationships/relationship-payloads'], function (exports, _relationshipPayloads) { 'use strict'; exports.__esModule = true; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - var _get = _ember.default.get; + var _get = Ember.get; - /** - Manages relationship payloads for a given store, for uninitialized - relationships. Acts as a single source of truth (of payloads) for both sides - of an uninitialized relationship so they can agree on the most up-to-date - payload received without needing too much eager processing when those payloads - are pushed into the store. - - This minimizes the work spent on relationships that are never initialized. - - Once relationships are initialized, their state is managed in a relationship - state object (eg BelongsToRelationship or ManyRelationship). - - - @example - - let relationshipPayloadsManager = new RelationshipPayloadsManager(store); - - const User = DS.Model.extend({ - hobbies: DS.hasMany('hobby') - }); - - const Hobby = DS.Model.extend({ - user: DS.belongsTo('user') - }); - - let userPayload = { - data: { - id: 1, - type: 'user', - relationships: { - hobbies: { - data: [{ - id: 2, - type: 'hobby' - }] - } - } - }, - }; - relationshipPayloadsManager.push('user', 1, userPayload.data.relationships); - - relationshipPayloadsManager.get('hobby', 2, 'user') === { - { - data: { - id: 1, - type: 'user' - } - } - } - - @private - @class RelationshipPayloadsManager - */ - var RelationshipPayloadsManager = function () { function RelationshipPayloadsManager(store) { this._store = store; // cache of `RelationshipPayload`s this._cache = Object.create(null); @@ -8474,11 +8444,11 @@ return RelationshipPayloads; }(); exports.default = RelationshipPayloads; }); -define('ember-data/-private/system/relationships/state/belongs-to', ['exports', 'ember', 'ember-data/-private/system/promise-proxies', 'ember-data/-private/system/relationships/state/relationship'], function (exports, _ember, _promiseProxies, _relationship) { +define('ember-data/-private/system/relationships/state/belongs-to', ['exports', 'ember-data/-private/system/promise-proxies', 'ember-data/-private/system/relationships/state/relationship'], function (exports, _promiseProxies, _relationship) { 'use strict'; exports.__esModule = true; function _classCallCheck(instance, Constructor) { @@ -8509,10 +8479,13 @@ } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + var EmberPromise = Ember.RSVP.Promise; + var inspect = Ember.inspect; + var BelongsToRelationship = function (_Relationship) { _inherits(BelongsToRelationship, _Relationship); function BelongsToRelationship(store, internalModel, inverseKey, relationshipMeta) { var _this = _possibleConstructorReturn(this, _Relationship.call(this, store, internalModel, inverseKey, relationshipMeta)); @@ -8615,11 +8588,11 @@ this.notifyBelongsToChanged(); }; BelongsToRelationship.prototype.setRecordPromise = function setRecordPromise(newPromise) { var content = newPromise.get && newPromise.get('content'); - (false && _ember.default.assert("You passed in a promise that did not originate from an EmberData relationship. You can only pass promises that come from a belongsTo or hasMany relationship to the get call.", content !== undefined)); + (false && Ember.assert("You passed in a promise that did not originate from an EmberData relationship. You can only pass promises that come from a belongsTo or hasMany relationship to the get call.", content !== undefined)); this.setInternalModel(content ? content._internalModel : content); }; BelongsToRelationship.prototype.removeInternalModelFromOwn = function removeInternalModelFromOwn(internalModel) { @@ -8645,11 +8618,11 @@ BelongsToRelationship.prototype.findRecord = function findRecord() { if (this.inverseInternalModel) { return this.store._findByInternalModel(this.inverseInternalModel); } else { - return _ember.default.RSVP.Promise.resolve(null); + return EmberPromise.resolve(null); } }; BelongsToRelationship.prototype.fetchLink = function fetchLink() { var _this2 = this; @@ -8687,11 +8660,11 @@ } else { if (this.inverseInternalModel === null) { return null; } var toReturn = this.inverseInternalModel.getRecord(); - (false && _ember.default.assert("You looked up the '" + this.key + "' relationship on a '" + this.internalModel.modelName + "' with id " + this.internalModel.id + " but some of the associated records were not loaded. Either make sure they are all loaded together with the parent record, or specify that the relationship is async (`DS.belongsTo({ async: true })`)", toReturn === null || !toReturn.get('isEmpty'))); + (false && Ember.assert("You looked up the '" + this.key + "' relationship on a '" + this.internalModel.modelName + "' with id " + this.internalModel.id + " but some of the associated records were not loaded. Either make sure they are all loaded together with the parent record, or specify that the relationship is async (`DS.belongsTo({ async: true })`)", toReturn === null || !toReturn.get('isEmpty'))); return toReturn; } }; @@ -8709,11 +8682,11 @@ return this.findRecord(); }; BelongsToRelationship.prototype.updateData = function updateData(data, initial) { - (false && _ember.default.assert('Ember Data expected the data for the ' + this.key + ' relationship on a ' + this.internalModel.toString() + ' to be in a JSON API format and include an `id` and `type` property but it found ' + _ember.default.inspect(data) + '. Please check your serializer and make sure it is serializing the relationship payload into a JSON API format.', data === null || data.id !== undefined && data.type !== undefined)); + (false && Ember.assert('Ember Data expected the data for the ' + this.key + ' relationship on a ' + this.internalModel.toString() + ' to be in a JSON API format and include an `id` and `type` property but it found ' + inspect(data) + '. Please check your serializer and make sure it is serializing the relationship payload into a JSON API format.', data === null || data.id !== undefined && data.type !== undefined)); var internalModel = this.store._pushResourceIdentifier(this, data); if (initial) { this.setInitialCanonicalInternalModel(internalModel); } else { @@ -8724,11 +8697,11 @@ return BelongsToRelationship; }(_relationship.default); exports.default = BelongsToRelationship; }); -define("ember-data/-private/system/relationships/state/create", ["exports", "ember", "ember-data/-private/system/relationships/state/has-many", "ember-data/-private/system/relationships/state/belongs-to"], function (exports, _ember, _hasMany, _belongsTo) { +define("ember-data/-private/system/relationships/state/create", ["exports", "ember-data/-private/system/relationships/state/has-many", "ember-data/-private/system/relationships/state/belongs-to"], function (exports, _hasMany, _belongsTo) { "use strict"; exports.__esModule = true; function _classCallCheck(instance, Constructor) { @@ -8753,11 +8726,11 @@ if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - var _get = _ember.default.get; + var _get = Ember.get; function shouldFindInverse(relationshipMeta) { var options = relationshipMeta.options; return !(options && options.inverse === null); @@ -9229,11 +9202,11 @@ } return set; } }); -define('ember-data/-private/system/relationships/state/relationship', ['exports', 'ember-data/-private/system/ordered-set', 'ember-data/-private/system/normalize-link', 'ember'], function (exports, _orderedSet, _normalizeLink2, _ember) { +define('ember-data/-private/system/relationships/state/relationship', ['exports', 'ember-data/-private/system/ordered-set', 'ember-data/-private/system/normalize-link'], function (exports, _orderedSet, _normalizeLink2) { 'use strict'; exports.__esModule = true; function _classCallCheck(instance, Constructor) { @@ -9258,11 +9231,11 @@ if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - var guidFor = _ember.default.guidFor; + var guidFor = Ember.guidFor; var Relationship = function () { function Relationship(store, internalModel, inverseKey, relationshipMeta) { var async = relationshipMeta.options.async; var polymorphic = relationshipMeta.options.polymorphic; @@ -9528,14 +9501,14 @@ this.willSync = true; this.store._updateRelationshipState(this); }; Relationship.prototype.updateLink = function updateLink(link, initial) { - (false && _ember.default.warn('You pushed a record of type \'' + this.internalModel.modelName + '\' with a relationship \'' + this.key + '\' configured as \'async: false\'. You\'ve included a link but no primary data, this may be an error in your payload.', this.isAsync || this.hasData, { + (false && Ember.warn('You pushed a record of type \'' + this.internalModel.modelName + '\' with a relationship \'' + this.key + '\' configured as \'async: false\'. You\'ve included a link but no primary data, this may be an error in your payload.', this.isAsync || this.hasData, { id: 'ds.store.push-link-for-sync-relationship' })); - (false && _ember.default.assert('You have pushed a record of type \'' + this.internalModel.modelName + '\' with \'' + this.key + '\' as a link, but the value of that link is not a string.', typeof link === 'string' || link === null)); + (false && Ember.assert('You have pushed a record of type \'' + this.internalModel.modelName + '\' with \'' + this.key + '\' as a link, but the value of that link is not a string.', typeof link === 'string' || link === null)); this.link = link; this.linkPromise = null; @@ -9777,12 +9750,12 @@ return SnapshotRecordArray; }(); exports.default = SnapshotRecordArray; }); -define("ember-data/-private/system/snapshot", ["exports", "ember"], function (exports, _ember) { - "use strict"; +define('ember-data/-private/system/snapshot', ['exports'], function (exports) { + 'use strict'; exports.__esModule = true; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { @@ -9806,11 +9779,14 @@ if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - var get = _ember.default.get; + var copy = Ember.copy; + var inspect = Ember.inspect; + var EmberError = Ember.Error; + var get = Ember.get; var Snapshot = function () { function Snapshot(internalModel) { var _this = this; @@ -9879,24 +9855,24 @@ Snapshot.prototype.attr = function attr(keyName) { if (keyName in this._attributes) { return this._attributes[keyName]; } - throw new _ember.default.Error("Model '" + _ember.default.inspect(this.record) + "' has no attribute named '" + keyName + "' defined."); + throw new EmberError("Model '" + inspect(this.record) + "' has no attribute named '" + keyName + "' defined."); }; Snapshot.prototype.attributes = function attributes() { - return _ember.default.copy(this._attributes); + return copy(this._attributes); }; Snapshot.prototype.changedAttributes = function changedAttributes() { var changedAttributes = Object.create(null); var changedAttributeKeys = Object.keys(this._changedAttributes); for (var i = 0, length = changedAttributeKeys.length; i < length; i++) { var key = changedAttributeKeys[i]; - changedAttributes[key] = _ember.default.copy(this._changedAttributes[key]); + changedAttributes[key] = copy(this._changedAttributes[key]); } return changedAttributes; }; @@ -9915,11 +9891,11 @@ return this._belongsToRelationships[keyName]; } relationship = this._internalModel._relationships.get(keyName); if (!(relationship && relationship.relationshipMeta.kind === 'belongsTo')) { - throw new _ember.default.Error("Model '" + _ember.default.inspect(this.record) + "' has no belongsTo relationship named '" + keyName + "' defined."); + throw new EmberError("Model '" + inspect(this.record) + "' has no belongsTo relationship named '" + keyName + "' defined."); } hasData = get(relationship, 'hasData'); inverseInternalModel = get(relationship, 'inverseInternalModel'); @@ -9959,11 +9935,11 @@ return this._hasManyRelationships[keyName]; } relationship = this._internalModel._relationships.get(keyName); if (!(relationship && relationship.relationshipMeta.kind === 'hasMany')) { - throw new _ember.default.Error("Model '" + _ember.default.inspect(this.record) + "' has no hasMany relationship named '" + keyName + "' defined."); + throw new EmberError("Model '" + inspect(this.record) + "' has no hasMany relationship named '" + keyName + "' defined."); } hasData = get(relationship, 'hasData'); members = get(relationship, 'members'); @@ -10000,11 +9976,11 @@ Snapshot.prototype.serialize = function serialize(options) { return this.record.store.serializerFor(this.modelName).serialize(this, options); }; _createClass(Snapshot, [{ - key: "type", + key: 'type', get: function () { // TODO @runspired we should deprecate this in favor of modelClass but only once // we've cleaned up the internals enough that a public change to follow suite is // uncontroversial. return this._internalModel.modelClass; @@ -10014,37 +9990,35 @@ return Snapshot; }(); exports.default = Snapshot; }); -define('ember-data/-private/system/store', ['exports', 'ember', 'ember-data/-private/adapters/errors', 'ember-data/-private/system/model/model', 'ember-data/-private/system/normalize-model-name', 'ember-data/-private/system/identity-map', 'ember-data/-private/system/promise-proxies', 'ember-data/-private/system/store/common', 'ember-data/-private/system/store/serializer-response', 'ember-data/-private/system/store/serializers', 'ember-data/-private/system/relationships/relationship-payloads-manager', 'ember-data/-private/system/store/finders', 'ember-data/-private/utils', 'ember-data/-private/system/coerce-id', 'ember-data/-private/system/record-array-manager', 'ember-data/-private/system/store/container-instance-cache', 'ember-data/-private/system/model/internal-model', 'ember-data/-private/features'], function (exports, _ember, _errors, _model, _normalizeModelName, _identityMap, _promiseProxies, _common, _serializerResponse, _serializers, _relationshipPayloadsManager, _finders, _utils, _coerceId, _recordArrayManager, _containerInstanceCache, _internalModel5, _features) { +define('ember-data/-private/system/store', ['exports', 'ember-data/-private/adapters/errors', 'ember-data/-private/system/model/model', 'ember-data/-private/system/normalize-model-name', 'ember-data/-private/system/identity-map', 'ember-data/-private/system/promise-proxies', 'ember-data/-private/system/store/common', 'ember-data/-private/system/store/serializer-response', 'ember-data/-private/system/store/serializers', 'ember-data/-private/system/relationships/relationship-payloads-manager', 'ember-data/-private/system/store/finders', 'ember-data/-private/utils', 'ember-data/-private/system/coerce-id', 'ember-data/-private/system/record-array-manager', 'ember-data/-private/system/store/container-instance-cache', 'ember-data/-private/system/model/internal-model', 'ember-data/-private/features'], function (exports, _errors, _model, _normalizeModelName, _identityMap, _promiseProxies, _common, _serializerResponse, _serializers, _relationshipPayloadsManager, _finders, _utils, _coerceId, _recordArrayManager, _containerInstanceCache, _internalModel5, _features) { 'use strict'; exports.__esModule = true; exports.Store = undefined; + var A = Ember.A; + var copy = Ember.copy; + var EmberError = Ember.Error; + var MapWithDefault = Ember.MapWithDefault; + var emberRun = Ember.run; + var set = Ember.set; + var get = Ember.get; + var computed = Ember.computed; + var RSVP = Ember.RSVP; + var Service = Ember.Service; + var typeOf = Ember.typeOf; + var isPresent = Ember.isPresent; + var isNone = Ember.isNone; + var inspect = Ember.inspect; - var badIdFormatAssertion = '`id` passed to `findRecord()` has to be non-empty string or number'; /** - @module ember-data - */ + var badIdFormatAssertion = '`id` passed to `findRecord()` has to be non-empty string or number'; - var A = _ember.default.A, - Backburner = _ember.default._Backburner, - computed = _ember.default.computed, - copy = _ember.default.copy, - ENV = _ember.default.ENV, - EmberError = _ember.default.Error, - get = _ember.default.get, - inspect = _ember.default.inspect, - isNone = _ember.default.isNone, - isPresent = _ember.default.isPresent, - MapWithDefault = _ember.default.MapWithDefault, - emberRun = _ember.default.run, - set = _ember.default.set, - RSVP = _ember.default.RSVP, - Service = _ember.default.Service, - typeOf = _ember.default.typeOf; + var Backburner = Ember._Backburner, + ENV = Ember.ENV; var Promise = RSVP.Promise; //Get the materialized model from the internalModel/promise that returns //an internal model and return it in a promiseObject. Useful for returning @@ -10219,11 +10193,11 @@ @param {DS.Model} record the record to serialize @param {Object} options an options hash */ serialize: function (record, options) { if (true) { - (false && !(false) && _ember.default.deprecate('Use of store.serialize is deprecated, use record.serialize instead.', false, { + (false && !(false) && Ember.deprecate('Use of store.serialize is deprecated, use record.serialize instead.', false, { id: 'ds.store.serialize', until: '3.0' })); } var snapshot = record._internalModel.createSnapshot(); @@ -10244,11 +10218,11 @@ @return DS.Adapter */ defaultAdapter: computed('adapter', function () { var adapter = get(this, 'adapter'); - (false && _ember.default.assert('You tried to set `adapter` property to an instance of `DS.Adapter`, where it should be a name', typeof adapter === 'string')); + (false && Ember.assert('You tried to set `adapter` property to an instance of `DS.Adapter`, where it should be a name', typeof adapter === 'string')); return this.adapterFor(adapter); }), @@ -10278,12 +10252,12 @@ @param {Object} inputProperties a hash of properties to set on the newly created record. @return {DS.Model} record */ createRecord: function (modelName, inputProperties) { - (false && _ember.default.assert('You need to pass a model name to the store\'s createRecord method', isPresent(modelName))); - (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); + (false && Ember.assert('You need to pass a model name to the store\'s createRecord method', isPresent(modelName))); + (false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); var normalizedModelName = (0, _normalizeModelName.default)(modelName); var properties = copy(inputProperties) || Object.create(null); // If the passed properties do not include a primary key, @@ -10382,19 +10356,19 @@ @param {Object} options @return {Promise} promise @private */ find: function (modelName, id, options) { - // The default `model` hook in Ember.Route calls `find(modelName, id)`, + // The default `model` hook in Route calls `find(modelName, id)`, // that's why we have to keep this method around even though `findRecord` is // the public way to get a record by modelName and id. - (false && _ember.default.assert('Using store.find(type) has been removed. Use store.findAll(modelName) to retrieve all records for a given type.', arguments.length !== 1)); - (false && _ember.default.assert('Calling store.find(modelName, id, { preload: preload }) is no longer supported. Use store.findRecord(modelName, id, { preload: preload }) instead.', !options)); - (false && _ember.default.assert('You need to pass the model name and id to the store\'s find method', arguments.length === 2)); - (false && _ember.default.assert('You cannot pass \'' + id + '\' as id to the store\'s find method', typeof id === 'string' || typeof id === 'number')); - (false && _ember.default.assert('Calling store.find() with a query object is no longer supported. Use store.query() instead.', typeof id !== 'object')); - (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); + (false && Ember.assert('Using store.find(type) has been removed. Use store.findAll(modelName) to retrieve all records for a given type.', arguments.length !== 1)); + (false && Ember.assert('Calling store.find(modelName, id, { preload: preload }) is no longer supported. Use store.findRecord(modelName, id, { preload: preload }) instead.', !options)); + (false && Ember.assert('You need to pass the model name and id to the store\'s find method', arguments.length === 2)); + (false && Ember.assert('You cannot pass \'' + id + '\' as id to the store\'s find method', typeof id === 'string' || typeof id === 'number')); + (false && Ember.assert('Calling store.find() with a query object is no longer supported. Use store.query() instead.', typeof id !== 'object')); + (false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); var normalizedModelName = (0, _normalizeModelName.default)(modelName); return this.findRecord(normalizedModelName, id); @@ -10407,12 +10381,12 @@ object for a given type and `id`. The `findRecord` method will always return a **promise** that will be resolved with the record. Example ```app/routes/post.js - import Ember from 'ember'; - export default Ember.Route.extend({ + import Route from '@ember/routing/route'; + export default Route.extend({ model(params) { return this.store.findRecord('post', params.post_id); } }); ``` @@ -10501,22 +10475,22 @@ ``` If you would like to force or prevent background reloading, you can set a boolean value for `backgroundReload` in the options object for `findRecord`. ```app/routes/post/edit.js - import Ember from 'ember'; - export default Ember.Route.extend({ + import Route from '@ember/routing/route'; + export default Route.extend({ model(params) { return this.store.findRecord('post', params.post_id, { backgroundReload: false }); } }); ``` - If you pass an object on the `adapterOptions` property of the options - argument it will be passed to you adapter via the snapshot + If you pass an object on the `adapterOptions` property of the options + argument it will be passed to you adapter via the snapshot ```app/routes/post/edit.js - import Ember from 'ember'; - export default Ember.Route.extend({ + import Route from '@ember/routing/route'; + export default Route.extend({ model(params) { return this.store.findRecord('post', params.post_id, { adapterOptions: { subscribe: false } }); } @@ -10544,28 +10518,28 @@ the one you request by supplying an `include` parameter in the `options` object. For example, given a `post` model that has a `hasMany` relationship with a `comment` model, when we retrieve a specific post we can have the server also return that post's comments in the same request: ```app/routes/post.js - import Ember from 'ember'; - export default Ember.Route.extend({ + import Route from '@ember/routing/route'; + export default Route.extend({ model(params) { - return this.store.findRecord('post', params.post_id, { include: 'comments' }); + return this.store.findRecord('post', params.post_id, { include: 'comments' }); } }); ``` In this case, the post's comments would then be available in your template as `model.comments`. Multiple relationships can be requested using an `include` parameter consisting of a comma-separated list (without white-space) while nested relationships can be specified using a dot-separated sequence of relationship names. So to request both the post's comments and the authors of those comments the request would look like this: ```app/routes/post.js - import Ember from 'ember'; - export default Ember.Route.extend({ + import Route from '@ember/routing/route'; + export default Route.extend({ model(params) { - return this.store.findRecord('post', params.post_id, { include: 'comments,comments.author' }); + return this.store.findRecord('post', params.post_id, { include: 'comments,comments.author' }); } }); ``` @since 1.13.0 @method findRecord @@ -10573,13 +10547,13 @@ @param {(String|Integer)} id @param {Object} options @return {Promise} promise */ findRecord: function (modelName, id, options) { - (false && _ember.default.assert('You need to pass a model name to the store\'s findRecord method', isPresent(modelName))); - (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); - (false && _ember.default.assert(badIdFormatAssertion, typeof id === 'string' && id.length > 0 || typeof id === 'number' && !isNaN(id))); + (false && Ember.assert('You need to pass a model name to the store\'s findRecord method', isPresent(modelName))); + (false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); + (false && Ember.assert(badIdFormatAssertion, typeof id === 'string' && id.length > 0 || typeof id === 'number' && !isNaN(id))); var normalizedModelName = (0, _normalizeModelName.default)(modelName); var internalModel = this._internalModelForId(normalizedModelName, id); @@ -10652,12 +10626,12 @@ @param {String} modelName @param {Array} ids @return {Promise} promise */ findByIds: function (modelName, ids) { - (false && _ember.default.assert('You need to pass a model name to the store\'s findByIds method', isPresent(modelName))); - (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); + (false && Ember.assert('You need to pass a model name to the store\'s findByIds method', isPresent(modelName))); + (false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); var promises = new Array(ids.length); var normalizedModelName = (0, _normalizeModelName.default)(modelName); @@ -10681,12 +10655,12 @@ */ _fetchRecord: function (internalModel, options) { var modelName = internalModel.modelName; var adapter = this.adapterFor(modelName); - (false && _ember.default.assert('You tried to find a record but you have no adapter (for ' + modelName + ')', adapter)); - (false && _ember.default.assert('You tried to find a record but your adapter (for ' + modelName + ') does not implement \'findRecord\'', typeof adapter.findRecord === 'function')); + (false && Ember.assert('You tried to find a record but you have no adapter (for ' + modelName + ')', adapter)); + (false && Ember.assert('You tried to find a record but your adapter (for ' + modelName + ') does not implement \'findRecord\'', typeof adapter.findRecord === 'function')); return (0, _finders._find)(adapter, this, internalModel.type, internalModel.id, internalModel, options); }, _scheduleFetchMany: function (internalModels) { @@ -10777,11 +10751,11 @@ missingInternalModels.push(_internalModel3); } } if (missingInternalModels.length) { - (false && _ember.default.warn('Ember Data expected to find records with the following ids in the adapter response but they were missing: ' + inspect(missingInternalModels.map(function (r) { + (false && Ember.warn('Ember Data expected to find records with the following ids in the adapter response but they were missing: ' + inspect(missingInternalModels.map(function (r) { return r.id; })), false, { id: 'ds.store.missing-records-from-adapter' })); @@ -10841,11 +10815,11 @@ })(groupedInternalModels); } else if (ids.length === 1) { var pair = seeking[groupedInternalModels[0].id]; _fetchRecord(pair); } else { - (false && _ember.default.assert("You cannot return an empty array from adapter's method groupRecordsForFindMany", false)); + (false && Ember.assert("You cannot return an empty array from adapter's method groupRecordsForFindMany", false)); } } } else { for (var _i6 = 0; _i6 < totalItems; _i6++) { _fetchRecord(pendingFetchItems[_i6]); @@ -10905,12 +10879,12 @@ @param {String} modelName @param {String|Integer} id @return {DS.Model|null} record */ peekRecord: function (modelName, id) { - (false && _ember.default.assert('You need to pass a model name to the store\'s peekRecord method', isPresent(modelName))); - (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); + (false && Ember.assert('You need to pass a model name to the store\'s peekRecord method', isPresent(modelName))); + (false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); var normalizedModelName = (0, _normalizeModelName.default)(modelName); if (this.hasRecordForId(normalizedModelName, id)) { return this._internalModelForId(normalizedModelName, id).getRecord(); @@ -10934,13 +10908,13 @@ var id = internalModel.id, modelName = internalModel.modelName; var adapter = this.adapterFor(modelName); - (false && _ember.default.assert('You cannot reload a record without an ID', id)); - (false && _ember.default.assert('You tried to reload a record but you have no adapter (for ' + modelName + ')', adapter)); - (false && _ember.default.assert('You tried to reload a record but your adapter does not implement \'findRecord\'', typeof adapter.findRecord === 'function' || typeof adapter.find === 'function')); + (false && Ember.assert('You cannot reload a record without an ID', id)); + (false && Ember.assert('You tried to reload a record but you have no adapter (for ' + modelName + ')', adapter)); + (false && Ember.assert('You tried to reload a record but your adapter does not implement \'findRecord\'', typeof adapter.findRecord === 'function' || typeof adapter.find === 'function')); return this._scheduleFetch(internalModel); }, @@ -10960,12 +10934,12 @@ @param {String} modelName @param {(String|Integer)} id @return {Boolean} */ hasRecordForId: function (modelName, id) { - (false && _ember.default.assert('You need to pass a model name to the store\'s hasRecordForId method', isPresent(modelName))); - (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); + (false && Ember.assert('You need to pass a model name to the store\'s hasRecordForId method', isPresent(modelName))); + (false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); var normalizedModelName = (0, _normalizeModelName.default)(modelName); var trueId = (0, _coerceId.default)(id); @@ -10983,12 +10957,12 @@ @param {String} modelName @param {(String|Integer)} id @return {DS.Model} record */ recordForId: function (modelName, id) { - (false && _ember.default.assert('You need to pass a model name to the store\'s recordForId method', isPresent(modelName))); - (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); + (false && Ember.assert('You need to pass a model name to the store\'s recordForId method', isPresent(modelName))); + (false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); return this._internalModelForId(modelName, id).getRecord(); }, _internalModelForId: function (modelName, id) { @@ -11048,12 +11022,12 @@ @return {Promise} promise */ findHasMany: function (internalModel, link, relationship) { var adapter = this.adapterFor(internalModel.modelName); - (false && _ember.default.assert('You tried to load a hasMany relationship but you have no adapter (for ' + internalModel.modelName + ')', adapter)); - (false && _ember.default.assert('You tried to load a hasMany relationship from a specified \'link\' in the original payload but your adapter does not implement \'findHasMany\'', typeof adapter.findHasMany === 'function')); + (false && Ember.assert('You tried to load a hasMany relationship but you have no adapter (for ' + internalModel.modelName + ')', adapter)); + (false && Ember.assert('You tried to load a hasMany relationship from a specified \'link\' in the original payload but your adapter does not implement \'findHasMany\'', typeof adapter.findHasMany === 'function')); return (0, _finders._findHasMany)(adapter, this, internalModel, link, relationship); }, @@ -11067,12 +11041,12 @@ @return {Promise} promise */ findBelongsTo: function (internalModel, link, relationship) { var adapter = this.adapterFor(internalModel.modelName); - (false && _ember.default.assert('You tried to load a belongsTo relationship but you have no adapter (for ' + internalModel.modelName + ')', adapter)); - (false && _ember.default.assert('You tried to load a belongsTo relationship from a specified \'link\' in the original payload but your adapter does not implement \'findBelongsTo\'', typeof adapter.findBelongsTo === 'function')); + (false && Ember.assert('You tried to load a belongsTo relationship but you have no adapter (for ' + internalModel.modelName + ')', adapter)); + (false && Ember.assert('You tried to load a belongsTo relationship from a specified \'link\' in the original payload but your adapter does not implement \'findBelongsTo\'', typeof adapter.findBelongsTo === 'function')); return (0, _finders._findBelongsTo)(adapter, this, internalModel, link, relationship); }, @@ -11114,26 +11088,26 @@ @param {String} modelName @param {any} query an opaque query to be used by the adapter @return {Promise} promise */ query: function (modelName, query) { - (false && _ember.default.assert('You need to pass a model name to the store\'s query method', isPresent(modelName))); - (false && _ember.default.assert('You need to pass a query hash to the store\'s query method', query)); - (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); + (false && Ember.assert('You need to pass a model name to the store\'s query method', isPresent(modelName))); + (false && Ember.assert('You need to pass a query hash to the store\'s query method', query)); + (false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); var normalizedModelName = (0, _normalizeModelName.default)(modelName); return this._query(normalizedModelName, query); }, _query: function (modelName, query, array) { - (false && _ember.default.assert('You need to pass a model name to the store\'s query method', isPresent(modelName))); - (false && _ember.default.assert('You need to pass a query hash to the store\'s query method', query)); - (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); + (false && Ember.assert('You need to pass a model name to the store\'s query method', isPresent(modelName))); + (false && Ember.assert('You need to pass a query hash to the store\'s query method', query)); + (false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); var adapter = this.adapterFor(modelName); - (false && _ember.default.assert('You tried to load a query but you have no adapter (for ' + modelName + ')', adapter)); - (false && _ember.default.assert('You tried to load a query but your adapter does not implement \'query\'', typeof adapter.query === 'function')); + (false && Ember.assert('You tried to load a query but you have no adapter (for ' + modelName + ')', adapter)); + (false && Ember.assert('You tried to load a query but your adapter does not implement \'query\'', typeof adapter.query === 'function')); var pA = (0, _promiseProxies.promiseArray)((0, _finders._query)(adapter, this, modelName, query, array)); return pA; @@ -11166,14 +11140,15 @@ console.log(`Currently logged in as ${username}`); }); ``` The request is made through the adapters' `queryRecord`: ```app/adapters/user.js + import $ from 'jquery'; import DS from 'ember-data'; export default DS.Adapter.extend({ queryRecord(modelName, query) { - return Ember.$.getJSON('/api/current_user'); + return $.getJSON('/api/current_user'); } }); ``` Note: the primary use case for `store.queryRecord` is when a single record is queried and the `id` is not known beforehand. In all other cases @@ -11217,21 +11192,21 @@ @param {String} modelName @param {any} query an opaque query to be used by the adapter @return {Promise} promise which resolves with the found record or `null` */ queryRecord: function (modelName, query) { - (false && _ember.default.assert('You need to pass a model name to the store\'s queryRecord method', isPresent(modelName))); - (false && _ember.default.assert('You need to pass a query hash to the store\'s queryRecord method', query)); - (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); + (false && Ember.assert('You need to pass a model name to the store\'s queryRecord method', isPresent(modelName))); + (false && Ember.assert('You need to pass a query hash to the store\'s queryRecord method', query)); + (false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); var normalizedModelName = (0, _normalizeModelName.default)(modelName); var adapter = this.adapterFor(normalizedModelName); - (false && _ember.default.assert('You tried to make a query but you have no adapter (for ' + normalizedModelName + ')', adapter)); - (false && _ember.default.assert('You tried to make a query but your adapter does not implement \'queryRecord\'', typeof adapter.queryRecord === 'function')); + (false && Ember.assert('You tried to make a query but you have no adapter (for ' + normalizedModelName + ')', adapter)); + (false && Ember.assert('You tried to make a query but your adapter does not implement \'queryRecord\'', typeof adapter.queryRecord === 'function')); return (0, _promiseProxies.promiseObject)((0, _finders._queryRecord)(adapter, this, modelName, query).then(function (internalModel) { // the promise returned by store.queryRecord is expected to resolve with // an instance of DS.Model @@ -11248,12 +11223,12 @@ `findAll` asks the adapter's `findAll` method to find the records for the given type, and returns a promise which will resolve with all records of this type present in the store, even if the adapter only returns a subset of them. ```app/routes/authors.js - import Ember from 'ember'; - export default Ember.Route.extend({ + import Route from '@ember/routing/route'; + export default Route.extend({ model(params) { return this.store.findAll('author'); } }); ``` @@ -11287,12 +11262,12 @@ ### Background Reloading Optionally, if `adapter.shouldBackgroundReloadAll` evaluates to `true`, then a background reload is started. Once this resolves, the array with which the promise resolves, is updated automatically so it contains all the records in the store: - ```js - // app/adapters/application.js + ```app/adapters/application.js + import DS from 'ember-data'; export default DS.Adapter.extend({ shouldReloadAll(store, snapshotsArray) { return false; }, shouldBackgroundReloadAll(store, snapshotsArray) { @@ -11322,22 +11297,22 @@ ``` If you would like to force or prevent background reloading, you can set a boolean value for `backgroundReload` in the options object for `findAll`. ```app/routes/post/edit.js - import Ember from 'ember'; - export default Ember.Route.extend({ + import Route from '@ember/routing/route'; + export default Route.extend({ model() { return this.store.findAll('post', { backgroundReload: false }); } }); ``` If you pass an object on the `adapterOptions` property of the options argument it will be passed to you adapter via the `snapshotRecordArray` ```app/routes/posts.js - import Ember from 'ember'; - export default Ember.Route.extend({ + import Route from '@ember/routing/route'; + export default Route.extend({ model(params) { return this.store.findAll('post', { adapterOptions: { subscribe: false } }); } @@ -11366,26 +11341,26 @@ those requested by supplying an `include` parameter in the `options` object. For example, given a `post` model that has a `hasMany` relationship with a `comment` model, when we retrieve all of the post records we can have the server also return all of the posts' comments in the same request: ```app/routes/posts.js - import Ember from 'ember'; - export default Ember.Route.extend({ + import Route from '@ember/routing/route'; + export default Route.extend({ model() { - return this.store.findAll('post', { include: 'comments' }); + return this.store.findAll('post', { include: 'comments' }); } }); ``` Multiple relationships can be requested using an `include` parameter consisting of a comma-separated list (without white-space) while nested relationships can be specified using a dot-separated sequence of relationship names. So to request both the posts' comments and the authors of those comments the request would look like this: ```app/routes/posts.js - import Ember from 'ember'; - export default Ember.Route.extend({ + import Route from '@ember/routing/route'; + export default Route.extend({ model() { - return this.store.findAll('post', { include: 'comments,comments.author' }); + return this.store.findAll('post', { include: 'comments,comments.author' }); } }); ``` See [query](#method_query) to only get a subset of records from the server. @since 1.13.0 @@ -11393,12 +11368,12 @@ @param {String} modelName @param {Object} options @return {Promise} promise */ findAll: function (modelName, options) { - (false && _ember.default.assert('You need to pass a model name to the store\'s findAll method', isPresent(modelName))); - (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); + (false && Ember.assert('You need to pass a model name to the store\'s findAll method', isPresent(modelName))); + (false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); var normalizedModelName = (0, _normalizeModelName.default)(modelName); var fetch = this._fetchAll(normalizedModelName, this.peekAll(normalizedModelName), options); return fetch; @@ -11416,12 +11391,12 @@ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; var adapter = this.adapterFor(modelName); var sinceToken = this._internalModelsFor(modelName).metadata.since; - (false && _ember.default.assert('You tried to load all records but you have no adapter (for ' + modelName + ')', adapter)); - (false && _ember.default.assert('You tried to load all records but your adapter does not implement \'findAll\'', typeof adapter.findAll === 'function')); + (false && Ember.assert('You tried to load all records but you have no adapter (for ' + modelName + ')', adapter)); + (false && Ember.assert('You tried to load all records but your adapter does not implement \'findAll\'', typeof adapter.findAll === 'function')); if (options.reload) { set(array, 'isUpdating', true); return (0, _promiseProxies.promiseArray)((0, _finders._findAll)(adapter, this, modelName, sinceToken, options)); @@ -11454,11 +11429,11 @@ */ _didUpdateAll: function (modelName) { this.recordArrayManager._didUpdateAll(modelName); }, didUpdateAll: function (modelName) { - (false && !(false) && _ember.default.deprecate('didUpdateAll was documented as private and will be removed in the next version of Ember Data.', false, { id: 'ember-data.didUpdateAll', until: '2.17.0' })); + (false && !(false) && Ember.deprecate('didUpdateAll was documented as private and will be removed in the next version of Ember Data.', false, { id: 'ember-data.didUpdateAll', until: '2.17.0' })); return this._didUpdateAll(modelName); }, @@ -11480,31 +11455,31 @@ @method peekAll @param {String} modelName @return {DS.RecordArray} */ peekAll: function (modelName) { - (false && _ember.default.assert('You need to pass a model name to the store\'s peekAll method', isPresent(modelName))); - (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); + (false && Ember.assert('You need to pass a model name to the store\'s peekAll method', isPresent(modelName))); + (false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); var normalizedModelName = (0, _normalizeModelName.default)(modelName); return this.recordArrayManager.liveRecordArrayFor(normalizedModelName); }, /** - This method unloads all records in the store. - It schedules unloading to happen during the next run loop. - Optionally you can pass a type which unload all records for a given type. - ```javascript - store.unloadAll(); - store.unloadAll('post'); - ``` - @method unloadAll - @param {String} modelName + This method unloads all records in the store. + It schedules unloading to happen during the next run loop. + Optionally you can pass a type which unload all records for a given type. + ```javascript + store.unloadAll(); + store.unloadAll('post'); + ``` + @method unloadAll + @param {String} modelName */ unloadAll: function (modelName) { - (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, !modelName || typeof modelName === 'string')); + (false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, !modelName || typeof modelName === 'string')); if (arguments.length === 0) { this._identityMap.clear(); } else { @@ -11557,16 +11532,16 @@ @param {Function} filter @return {DS.PromiseArray} @deprecated */ filter: function (modelName, query, filter) { - (false && _ember.default.assert('You need to pass a model name to the store\'s filter method', isPresent(modelName))); - (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); + (false && Ember.assert('You need to pass a model name to the store\'s filter method', isPresent(modelName))); + (false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); if (!ENV.ENABLE_DS_FILTER) { - (false && _ember.default.assert('The filter API has been moved to a plugin. To enable store.filter using an environment flag, or to use an alternative, you can visit the ember-data-filter addon page. https://github.com/ember-data/ember-data-filter', false)); + (false && Ember.assert('The filter API has been moved to a plugin. To enable store.filter using an environment flag, or to use an alternative, you can visit the ember-data-filter addon page. https://github.com/ember-data/ember-data-filter', false)); } var promise = void 0; var length = arguments.length; var array = void 0; @@ -11603,11 +11578,11 @@ @param {String} modelName @param {string} id @return {boolean} */ recordIsLoaded: function (modelName, id) { - (false && !(false) && _ember.default.deprecate('Use of recordIsLoaded is deprecated, use hasRecordForId instead.', false, { + (false && !(false) && Ember.deprecate('Use of recordIsLoaded is deprecated, use hasRecordForId instead.', false, { id: 'ds.store.recordIsLoaded', until: '3.0' })); return this.hasRecordForId(modelName, id); @@ -11693,11 +11668,11 @@ if (data) { // normalize relationship IDs into records this.updateId(internalModel, data); this._setupRelationshipsForModel(internalModel, data); } else { - (false && _ember.default.assert('Your ' + internalModel.modelName + ' record was saved to the server, but the response does not have an id and no id has been set client side. Records must have ids. Please update the server response to provide an id in the response or generate the id on the client side either before saving the record or while normalizing the response.', internalModel.id)); + (false && Ember.assert('Your ' + internalModel.modelName + ' record was saved to the server, but the response does not have an id and no id has been set client side. Records must have ids. Please update the server response to provide an id in the response or generate the id on the client side either before saving the record or while normalizing the response.', internalModel.id)); } //We first make sure the primary data has been updated //TODO try to move notification to the user to the end of the runloop internalModel.adapterDidCommit(data); @@ -11745,28 +11720,28 @@ var oldId = internalModel.id; var modelName = internalModel.modelName; var id = (0, _coerceId.default)(data.id); // ID absolutely can't be missing if the oldID is empty (missing Id in response for a new record) - (false && _ember.default.assert('\'' + modelName + '\' was saved to the server, but the response does not have an id and your record does not either.', !(id === null && oldId === null))); + (false && Ember.assert('\'' + modelName + '\' was saved to the server, but the response does not have an id and your record does not either.', !(id === null && oldId === null))); // ID absolutely can't be different than oldID if oldID is not null - (false && _ember.default.assert('\'' + modelName + ':' + oldId + '\' was saved to the server, but the response returned the new id \'' + id + '\'. The store cannot assign a new id to a record that already has an id.', !(oldId !== null && id !== oldId))); + (false && Ember.assert('\'' + modelName + ':' + oldId + '\' was saved to the server, but the response returned the new id \'' + id + '\'. The store cannot assign a new id to a record that already has an id.', !(oldId !== null && id !== oldId))); // ID can be null if oldID is not null (altered ID in response for a record) // however, this is more than likely a developer error. if (oldId !== null && id === null) { - (false && _ember.default.warn('Your ' + modelName + ' record was saved to the server, but the response does not have an id.', !(oldId !== null && id === null))); + (false && Ember.warn('Your ' + modelName + ' record was saved to the server, but the response does not have an id.', !(oldId !== null && id === null))); return; } var existingInternalModel = this._existingInternalModelForId(modelName, id); - (false && _ember.default.assert('\'' + modelName + '\' was saved to the server, but the response returned the new id \'' + id + '\', which has already been used with another record.\'', isNone(existingInternalModel) || existingInternalModel === internalModel)); + (false && Ember.assert('\'' + modelName + '\' was saved to the server, but the response returned the new id \'' + id + '\', which has already been used with another record.\'', isNone(existingInternalModel) || existingInternalModel === internalModel)); this._internalModelsFor(internalModel.modelName).set(id, internalModel); internalModel.setId(id); @@ -11794,11 +11769,12 @@ @method _load @private @param {Object} data */ _load: function (data) { - var internalModel = this._internalModelForId(data.type, data.id); + var modelName = (0, _normalizeModelName.default)(data.type); + var internalModel = this._internalModelForId(modelName, data.id); var isUpdate = internalModel.currentState.isEmpty === false; internalModel.setupData(data); @@ -11866,12 +11842,12 @@ @method modelFor @param {String} modelName @return {DS.Model} */ modelFor: function (modelName) { - (false && _ember.default.assert('You need to pass a model name to the store\'s modelFor method', isPresent(modelName))); - (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); + (false && Ember.assert('You need to pass a model name to the store\'s modelFor method', isPresent(modelName))); + (false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); var normalizedModelName = (0, _normalizeModelName.default)(modelName); return this._modelFor(normalizedModelName); @@ -11901,11 +11877,11 @@ } // interopt with the future var klass = (0, _utils.getOwner)(this).factoryFor ? factory.class : factory; - (false && _ember.default.assert('\'' + inspect(klass) + '\' does not appear to be an ember-data model', klass.isModel)); + (false && Ember.assert('\'' + inspect(klass) + '\' does not appear to be an ember-data model', klass.isModel)); // TODO: deprecate this klass.modelName = klass.modelName || modelName; @@ -11918,12 +11894,12 @@ /* @private */ modelFactoryFor: function (modelName) { - (false && _ember.default.assert('You need to pass a model name to the store\'s modelFactoryFor method', isPresent(modelName))); - (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); + (false && Ember.assert('You need to pass a model name to the store\'s modelFactoryFor method', isPresent(modelName))); + (false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); var normalizedModelName = (0, _normalizeModelName.default)(modelName); var owner = (0, _utils.getOwner)(this); @@ -12119,11 +12095,11 @@ if (jsonApiDoc.data === null) { return null; } - (false && _ember.default.assert('Expected an object in the \'data\' property in a call to \'push\' for ' + jsonApiDoc.type + ', but was ' + typeOf(jsonApiDoc.data), typeOf(jsonApiDoc.data) === 'object')); + (false && Ember.assert('Expected an object in the \'data\' property in a call to \'push\' for ' + jsonApiDoc.type + ', but was ' + typeOf(jsonApiDoc.data), typeOf(jsonApiDoc.data) === 'object')); return _this._pushInternalModel(jsonApiDoc.data); }); @@ -12139,12 +12115,12 @@ return !!owner._lookupFactory('model:' + modelName); } }, _pushInternalModel: function (data) { var modelName = data.type; - (false && _ember.default.assert('You must include an \'id\' for ' + modelName + ' in an object passed to \'push\'', data.id !== null && data.id !== undefined && data.id !== '')); - (false && _ember.default.assert('You tried to push data with a type \'' + modelName + '\' but no model could be found with that name.', this._hasModelFor(modelName))); + (false && Ember.assert('You must include an \'id\' for ' + modelName + ' in an object passed to \'push\'', data.id !== null && data.id !== undefined && data.id !== '')); + (false && Ember.assert('You tried to push data with a type \'' + modelName + '\' but no model could be found with that name.', this._hasModelFor(modelName))); if (false) { // If ENV.DS_WARN_ON_UNKNOWN_KEYS is set to true and the payload // contains unknown attributes or relationships, log a warning. @@ -12155,19 +12131,19 @@ // Check unknown attributes var unknownAttributes = Object.keys(data.attributes || {}).filter(function (key) { return !get(modelClass, 'fields').has(key); }); var unknownAttributesMessage = 'The payload for \'' + modelName + '\' contains these unknown attributes: ' + unknownAttributes + '. Make sure they\'ve been defined in your model.'; - (false && _ember.default.warn(unknownAttributesMessage, unknownAttributes.length === 0, { id: 'ds.store.unknown-keys-in-payload' })); + (false && Ember.warn(unknownAttributesMessage, unknownAttributes.length === 0, { id: 'ds.store.unknown-keys-in-payload' })); // Check unknown relationships var unknownRelationships = Object.keys(data.relationships || {}).filter(function (key) { return !get(modelClass, 'fields').has(key); }); var unknownRelationshipsMessage = 'The payload for \'' + modelName + '\' contains these unknown relationships: ' + unknownRelationships + '. Make sure they\'ve been defined in your model.'; - (false && _ember.default.warn(unknownRelationshipsMessage, unknownRelationships.length === 0, { id: 'ds.store.unknown-keys-in-payload' })); + (false && Ember.warn(unknownRelationshipsMessage, unknownRelationships.length === 0, { id: 'ds.store.unknown-keys-in-payload' })); } } // Actually load the record into the store. var internalModel = this._load(data); @@ -12243,11 +12219,11 @@ ```app/serializers/post.js import DS from 'ember-data'; export default DS.JSONSerializer; ``` ```js - store.pushPayload('comment', pushData); // Will use the application serializer + store.pushPayload(pushData); // Will use the application serializer store.pushPayload('post', pushData); // Will use the post serializer ``` @method pushPayload @param {String} modelName Optionally, a model type used to determine which serializer will be used @param {Object} inputPayload @@ -12256,14 +12232,14 @@ var serializer = void 0; var payload = void 0; if (!inputPayload) { payload = modelName; serializer = defaultSerializer(this); - (false && _ember.default.assert('You cannot use \'store#pushPayload\' without a modelName unless your default serializer defines \'pushPayload\'', typeof serializer.pushPayload === 'function')); + (false && Ember.assert('You cannot use \'store#pushPayload\' without a modelName unless your default serializer defines \'pushPayload\'', typeof serializer.pushPayload === 'function')); } else { payload = inputPayload; - (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); + (false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); var normalizedModelName = (0, _normalizeModelName.default)(modelName); serializer = this.serializerFor(normalizedModelName); } if ((0, _features.default)('ds-pushpayload-return')) { @@ -12289,12 +12265,12 @@ @param {String} modelName The name of the model type for this payload @param {Object} payload @return {Object} The normalized payload */ normalize: function (modelName, payload) { - (false && _ember.default.assert('You need to pass a model name to the store\'s normalize method', isPresent(modelName))); - (false && _ember.default.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + inspect(modelName), typeof modelName === 'string')); + (false && Ember.assert('You need to pass a model name to the store\'s normalize method', isPresent(modelName))); + (false && Ember.assert('Passing classes to store methods has been removed. Please pass a dasherized string instead of ' + inspect(modelName), typeof modelName === 'string')); var normalizedModelName = (0, _normalizeModelName.default)(modelName); var serializer = this.serializerFor(normalizedModelName); var model = this._modelFor(normalizedModelName); return serializer.normalize(model, payload); @@ -12310,16 +12286,16 @@ @param {String} id @param {Object} data @return {InternalModel} internal model */ _buildInternalModel: function (modelName, id, data) { - (false && _ember.default.assert('You can no longer pass a modelClass as the first argument to store._buildInternalModel. Pass modelName instead.', typeof modelName === 'string')); + (false && Ember.assert('You can no longer pass a modelClass as the first argument to store._buildInternalModel. Pass modelName instead.', typeof modelName === 'string')); var existingInternalModel = this._existingInternalModelForId(modelName, id); - (false && _ember.default.assert('The id ' + id + ' has already been used with another record for modelClass \'' + modelName + '\'.', !existingInternalModel)); + (false && Ember.assert('The id ' + id + ' has already been used with another record for modelClass \'' + modelName + '\'.', !existingInternalModel)); // lookupFactory should really return an object that creates // instances with the injections applied var internalModel = new _internalModel5.default(modelName, id, this, data); @@ -12338,11 +12314,11 @@ internalModel = null; } return internalModel; }, buildInternalModel: function (modelName, id, data) { - (false && !(false) && _ember.default.deprecate('buildInternalModel was documented as private and will be removed in the next version of Ember Data.', false, { id: 'ember-data.buildInternalModel', until: '2.17.0' })); + (false && !(false) && Ember.deprecate('buildInternalModel was documented as private and will be removed in the next version of Ember Data.', false, { id: 'ember-data.buildInternalModel', until: '2.17.0' })); return this._buildInternalModel(modelName, id, data); }, @@ -12388,12 +12364,12 @@ @public @param {String} modelName @return DS.Adapter */ adapterFor: function (modelName) { - (false && _ember.default.assert('You need to pass a model name to the store\'s adapterFor method', isPresent(modelName))); - (false && _ember.default.assert('Passing classes to store.adapterFor has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); + (false && Ember.assert('You need to pass a model name to the store\'s adapterFor method', isPresent(modelName))); + (false && Ember.assert('Passing classes to store.adapterFor has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); var normalizedModelName = (0, _normalizeModelName.default)(modelName); return this._instanceCache.get('adapter', normalizedModelName); }, @@ -12419,27 +12395,27 @@ @public @param {String} modelName the record to serialize @return {DS.Serializer} */ serializerFor: function (modelName) { - (false && _ember.default.assert('You need to pass a model name to the store\'s serializerFor method', isPresent(modelName))); - (false && _ember.default.assert('Passing classes to store.serializerFor has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); + (false && Ember.assert('You need to pass a model name to the store\'s serializerFor method', isPresent(modelName))); + (false && Ember.assert('Passing classes to store.serializerFor has been removed. Please pass a dasherized string instead of ' + modelName, typeof modelName === 'string')); var normalizedModelName = (0, _normalizeModelName.default)(modelName); return this._instanceCache.get('serializer', normalizedModelName); }, lookupAdapter: function (name) { - (false && !(false) && _ember.default.deprecate('Use of lookupAdapter is deprecated, use adapterFor instead.', false, { + (false && !(false) && Ember.deprecate('Use of lookupAdapter is deprecated, use adapterFor instead.', false, { id: 'ds.store.lookupAdapter', until: '3.0' })); return this.adapterFor(name); }, lookupSerializer: function (name) { - (false && !(false) && _ember.default.deprecate('Use of lookupSerializer is deprecated, use serializerFor instead.', false, { + (false && !(false) && Ember.deprecate('Use of lookupSerializer is deprecated, use serializerFor instead.', false, { id: 'ds.store.lookupSerializer', until: '3.0' })); return this.serializerFor(name); @@ -12491,22 +12467,22 @@ _pushResourceIdentifier: function (relationship, resourceIdentifier) { if (isNone(resourceIdentifier)) { return; } - (false && _ember.default.assert('A ' + relationship.internalModel.modelName + ' record was pushed into the store with the value of ' + relationship.key + ' being ' + inspect(resourceIdentifier) + ', but ' + relationship.key + ' is a belongsTo relationship so the value must not be an array. You should probably check your data payload or serializer.', !Array.isArray(resourceIdentifier))); + (false && Ember.assert('A ' + relationship.internalModel.modelName + ' record was pushed into the store with the value of ' + relationship.key + ' being ' + inspect(resourceIdentifier) + ', but ' + relationship.key + ' is a belongsTo relationship so the value must not be an array. You should probably check your data payload or serializer.', !Array.isArray(resourceIdentifier))); //TODO:Better asserts return this._internalModelForId(resourceIdentifier.type, resourceIdentifier.id); }, _pushResourceIdentifiers: function (relationship, resourceIdentifiers) { if (isNone(resourceIdentifiers)) { return; } - (false && _ember.default.assert('A ' + relationship.internalModel.modelName + ' record was pushed into the store with the value of ' + relationship.key + ' being \'' + inspect(resourceIdentifiers) + '\', but ' + relationship.key + ' is a hasMany relationship so the value must be an array. You should probably check your data payload or serializer.', Array.isArray(resourceIdentifiers))); + (false && Ember.assert('A ' + relationship.internalModel.modelName + ' record was pushed into the store with the value of ' + relationship.key + ' being \'' + inspect(resourceIdentifiers) + '\', but ' + relationship.key + ' is a hasMany relationship so the value must be an array. You should probably check your data payload or serializer.', Array.isArray(resourceIdentifiers))); var _internalModels = new Array(resourceIdentifiers.length); for (var i = 0; i < resourceIdentifiers.length; i++) { _internalModels[i] = this._pushResourceIdentifier(relationship, resourceIdentifiers[i]); @@ -12524,18 +12500,18 @@ function _commit(adapter, store, operation, snapshot) { var internalModel = snapshot._internalModel; var modelName = snapshot.modelName; var modelClass = store._modelFor(modelName); - (false && _ember.default.assert('You tried to update a record but you have no adapter (for ' + modelName + ')', adapter)); - (false && _ember.default.assert('You tried to update a record but your adapter (for ' + modelName + ') does not implement \'' + operation + '\'', typeof adapter[operation] === 'function')); + (false && Ember.assert('You tried to update a record but you have no adapter (for ' + modelName + ')', adapter)); + (false && Ember.assert('You tried to update a record but your adapter (for ' + modelName + ') does not implement \'' + operation + '\'', typeof adapter[operation] === 'function')); var promise = adapter[operation](store, modelClass, snapshot); var serializer = (0, _serializers.serializerForAdapter)(store, adapter, modelName); var label = 'DS: Extract and notify about ' + operation + ' completion of ' + internalModel; - (false && _ember.default.assert('Your adapter\'s \'' + operation + '\' method must return a value, but it returned \'undefined\'', promise !== undefined)); + (false && Ember.assert('Your adapter\'s \'' + operation + '\' method must return a value, but it returned \'undefined\'', promise !== undefined)); promise = Promise.resolve(promise, label); promise = (0, _common._guard)(promise, (0, _common._bind)(_common._objectIsAlive, store)); promise = (0, _common._guard)(promise, (0, _common._bind)(_common._objectIsAlive, internalModel)); @@ -12634,35 +12610,35 @@ return; } if (_relationshipData.links) { var isAsync = relationshipMeta.options && relationshipMeta.options.async !== false; - (false && _ember.default.warn('You pushed a record of type \'' + internalModel.type.modelName + '\' with a relationship \'' + relationshipName + '\' configured as \'async: false\'. You\'ve included a link but no primary data, this may be an error in your payload.', isAsync || _relationshipData.data, { + (false && Ember.warn('You pushed a record of type \'' + internalModel.type.modelName + '\' with a relationship \'' + relationshipName + '\' configured as \'async: false\'. You\'ve included a link but no primary data, this may be an error in your payload.', isAsync || _relationshipData.data, { id: 'ds.store.push-link-for-sync-relationship' })); } else if (_relationshipData.data) { if (relationshipMeta.kind === 'belongsTo') { - (false && _ember.default.assert('A ' + internalModel.type.modelName + ' record was pushed into the store with the value of ' + relationshipName + ' being ' + inspect(_relationshipData.data) + ', but ' + relationshipName + ' is a belongsTo relationship so the value must not be an array. You should probably check your data payload or serializer.', !Array.isArray(_relationshipData.data))); + (false && Ember.assert('A ' + internalModel.type.modelName + ' record was pushed into the store with the value of ' + relationshipName + ' being ' + inspect(_relationshipData.data) + ', but ' + relationshipName + ' is a belongsTo relationship so the value must not be an array. You should probably check your data payload or serializer.', !Array.isArray(_relationshipData.data))); } else if (relationshipMeta.kind === 'hasMany') { - (false && _ember.default.assert('A ' + internalModel.type.modelName + ' record was pushed into the store with the value of ' + relationshipName + ' being \'' + inspect(_relationshipData.data) + '\', but ' + relationshipName + ' is a hasMany relationship so the value must be an array. You should probably check your data payload or serializer.', Array.isArray(_relationshipData.data))); + (false && Ember.assert('A ' + internalModel.type.modelName + ' record was pushed into the store with the value of ' + relationshipName + ' being \'' + inspect(_relationshipData.data) + '\', but ' + relationshipName + ' is a hasMany relationship so the value must be an array. You should probably check your data payload or serializer.', Array.isArray(_relationshipData.data))); } } } }); } exports.Store = Store; exports.default = Store; }); -define('ember-data/-private/system/store/common', ['exports', 'ember'], function (exports, _ember) { +define('ember-data/-private/system/store/common', ['exports'], function (exports) { 'use strict'; exports.__esModule = true; exports._bind = _bind; exports._guard = _guard; exports._objectIsAlive = _objectIsAlive; - var get = _ember.default.get; + var get = Ember.get; function _bind(fn) { for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } @@ -12683,22 +12659,22 @@ function _objectIsAlive(object) { return !(get(object, "isDestroyed") || get(object, "isDestroying")); } }); -define('ember-data/-private/system/store/container-instance-cache', ['exports', 'ember'], function (exports, _ember) { +define('ember-data/-private/system/store/container-instance-cache', ['exports'], function (exports) { 'use strict'; exports.__esModule = true; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - var set = _ember.default.set; + var set = Ember.set; var ContainerInstanceCache = function () { function ContainerInstanceCache(owner, store) { this.isDestroying = false; this.isDestroyed = false; @@ -12787,22 +12763,23 @@ return ContainerInstanceCache; }(); exports.default = ContainerInstanceCache; }); -define('ember-data/-private/system/store/finders', ['exports', 'ember', 'ember-data/-private/system/store/common', 'ember-data/-private/system/store/serializer-response', 'ember-data/-private/system/store/serializers'], function (exports, _ember, _common, _serializerResponse, _serializers) { +define('ember-data/-private/system/store/finders', ['exports', 'ember-data/-private/system/store/common', 'ember-data/-private/system/store/serializer-response', 'ember-data/-private/system/store/serializers'], function (exports, _common, _serializerResponse, _serializers) { 'use strict'; exports.__esModule = true; exports._find = _find; exports._findMany = _findMany; exports._findHasMany = _findHasMany; exports._findBelongsTo = _findBelongsTo; exports._findAll = _findAll; exports._query = _query; exports._queryRecord = _queryRecord; - var Promise = _ember.default.RSVP.Promise; + var A = Ember.A; + var Promise = Ember.RSVP.Promise; function payloadIsNotBlank(adapterPayload) { if (Array.isArray(adapterPayload)) { return true; @@ -12820,16 +12797,16 @@ promise = Promise.resolve(promise, label); promise = (0, _common._guard)(promise, (0, _common._bind)(_common._objectIsAlive, store)); return promise.then(function (adapterPayload) { - (false && _ember.default.assert('You made a \'findRecord\' request for a \'' + modelName + '\' with id \'' + id + '\', but the adapter\'s response did not have any data', payloadIsNotBlank(adapterPayload))); + (false && Ember.assert('You made a \'findRecord\' request for a \'' + modelName + '\' with id \'' + id + '\', but the adapter\'s response did not have any data', payloadIsNotBlank(adapterPayload))); var serializer = (0, _serializers.serializerForAdapter)(store, adapter, modelName); var payload = (0, _serializerResponse.normalizeResponseHelper)(serializer, store, modelClass, adapterPayload, id, 'findRecord'); - (false && _ember.default.assert('Ember Data expected the primary data returned from a \'findRecord\' response to be an object but instead it found an array.', !Array.isArray(payload.data))); - (false && _ember.default.warn('You requested a record of type \'' + modelName + '\' with id \'' + id + '\' but the adapter returned a payload with primary data having an id of \'' + payload.data.id + '\'. Use \'store.findRecord()\' when the requested id is the same as the one returned by the adapter. In other cases use \'store.queryRecord()\' instead https://emberjs.com/api/data/classes/DS.Store.html#method_queryRecord', payload.data.id === id, { + (false && Ember.assert('Ember Data expected the primary data returned from a \'findRecord\' response to be an object but instead it found an array.', !Array.isArray(payload.data))); + (false && Ember.warn('You requested a record of type \'' + modelName + '\' with id \'' + id + '\' but the adapter returned a payload with primary data having an id of \'' + payload.data.id + '\'. Use \'store.findRecord()\' when the requested id is the same as the one returned by the adapter. In other cases use \'store.queryRecord()\' instead https://emberjs.com/api/data/classes/DS.Store.html#method_queryRecord', payload.data.id === id, { id: 'ds.store.findRecord.id-mismatch' })); return store._push(payload); @@ -12842,11 +12819,11 @@ throw error; }, 'DS: Extract payload of \'' + modelName + '\''); } function _findMany(adapter, store, modelName, ids, internalModels) { - var snapshots = _ember.default.A(internalModels).invoke('createSnapshot'); + var snapshots = A(internalModels).invoke('createSnapshot'); var modelClass = store.modelFor(modelName); // `adapter.findMany` gets the modelClass still var promise = adapter.findMany(store, modelClass, ids, snapshots); var label = 'DS: Handle Adapter#findMany of \'' + modelName + '\''; if (promise === undefined) { @@ -12855,11 +12832,11 @@ promise = Promise.resolve(promise, label); promise = (0, _common._guard)(promise, (0, _common._bind)(_common._objectIsAlive, store)); return promise.then(function (adapterPayload) { - (false && _ember.default.assert('You made a \'findMany\' request for \'' + modelName + '\' records with ids \'[' + ids + ']\', but the adapter\'s response did not have any data', payloadIsNotBlank(adapterPayload))); + (false && Ember.assert('You made a \'findMany\' request for \'' + modelName + '\' records with ids \'[' + ids + ']\', but the adapter\'s response did not have any data', payloadIsNotBlank(adapterPayload))); var serializer = (0, _serializers.serializerForAdapter)(store, adapter, modelName); var payload = (0, _serializerResponse.normalizeResponseHelper)(serializer, store, modelClass, adapterPayload, null, 'findMany'); return store._push(payload); }, null, 'DS: Extract payload of ' + modelName); @@ -12874,11 +12851,11 @@ promise = Promise.resolve(promise, label); promise = (0, _common._guard)(promise, (0, _common._bind)(_common._objectIsAlive, store)); promise = (0, _common._guard)(promise, (0, _common._bind)(_common._objectIsAlive, internalModel)); return promise.then(function (adapterPayload) { - (false && _ember.default.assert('You made a \'findHasMany\' request for a ' + internalModel.modelName + '\'s \'' + relationship.key + '\' relationship, using link \'' + link + '\' , but the adapter\'s response did not have any data', payloadIsNotBlank(adapterPayload))); + (false && Ember.assert('You made a \'findHasMany\' request for a ' + internalModel.modelName + '\'s \'' + relationship.key + '\' relationship, using link \'' + link + '\' , but the adapter\'s response did not have any data', payloadIsNotBlank(adapterPayload))); var serializer = (0, _serializers.serializerForAdapter)(store, adapter, relationship.type); var payload = (0, _serializerResponse.normalizeResponseHelper)(serializer, store, modelClass, adapterPayload, null, 'findHasMany'); var internalModelArray = store._push(payload); @@ -12918,11 +12895,11 @@ promise = Promise.resolve(promise, label); promise = (0, _common._guard)(promise, (0, _common._bind)(_common._objectIsAlive, store)); return promise.then(function (adapterPayload) { - (false && _ember.default.assert('You made a \'findAll\' request for \'' + modelName + '\' records, but the adapter\'s response did not have any data', payloadIsNotBlank(adapterPayload))); + (false && Ember.assert('You made a \'findAll\' request for \'' + modelName + '\' records, but the adapter\'s response did not have any data', payloadIsNotBlank(adapterPayload))); var serializer = (0, _serializers.serializerForAdapter)(store, adapter, modelName); var payload = (0, _serializerResponse.normalizeResponseHelper)(serializer, store, modelClass, adapterPayload, null, 'findAll'); store._push(payload); @@ -12953,11 +12930,11 @@ var payload = (0, _serializerResponse.normalizeResponseHelper)(serializer, store, modelClass, adapterPayload, null, 'query'); var internalModels = store._push(payload); - (false && _ember.default.assert('The response to store.query is expected to be an array but it was a single record. Please wrap your response in an array or use `store.queryRecord` to query for a single record.', Array.isArray(internalModels))); + (false && Ember.assert('The response to store.query is expected to be an array but it was a single record. Please wrap your response in an array or use `store.queryRecord` to query for a single record.', Array.isArray(internalModels))); if (recordArray) { recordArray._setInternalModels(internalModels, payload); } else { recordArray = store.recordArrayManager.createAdapterPopulatedRecordArray(modelName, query, internalModels, payload); @@ -12977,25 +12954,26 @@ return promise.then(function (adapterPayload) { var serializer = (0, _serializers.serializerForAdapter)(store, adapter, modelName); var payload = (0, _serializerResponse.normalizeResponseHelper)(serializer, store, modelClass, adapterPayload, null, 'queryRecord'); - (false && _ember.default.assert('Expected the primary data returned by the serializer for a \'queryRecord\' response to be a single object or null but instead it was an array.', !Array.isArray(payload.data), { + (false && Ember.assert('Expected the primary data returned by the serializer for a \'queryRecord\' response to be a single object or null but instead it was an array.', !Array.isArray(payload.data), { id: 'ds.store.queryRecord-array-response' })); return store._push(payload); }, null, 'DS: Extract payload of queryRecord ' + modelName); } }); -define('ember-data/-private/system/store/serializer-response', ['exports', 'ember'], function (exports, _ember) { +define('ember-data/-private/system/store/serializer-response', ['exports'], function (exports) { 'use strict'; exports.__esModule = true; exports.validateDocumentStructure = validateDocumentStructure; exports.normalizeResponseHelper = normalizeResponseHelper; + var isEmpty = Ember.isEmpty; /* This is a helper method that validates a JSON API top-level document @@ -13069,11 +13047,11 @@ var normalizedResponse = serializer.normalizeResponse(store, modelClass, payload, id, requestType); var validationErrors = []; if (false) { validationErrors = validateDocumentStructure(normalizedResponse); } - (false && _ember.default.assert('normalizeResponse must return a valid JSON API document:\n\t* ' + validationErrors.join('\n\t* '), _ember.default.isEmpty(validationErrors))); + (false && Ember.assert('normalizeResponse must return a valid JSON API document:\n\t* ' + validationErrors.join('\n\t* '), isEmpty(validationErrors))); return normalizedResponse; } }); @@ -13098,19 +13076,18 @@ } return serializer; } }); -define('ember-data/-private/utils', ['exports', 'ember'], function (exports, _ember) { +define('ember-data/-private/utils', ['exports'], function (exports) { 'use strict'; exports.__esModule = true; - exports.getOwner = exports.modelHasAttributeOrRelationshipNamedType = undefined; + var emberGetOwner = Ember.getOwner; + var get = Ember.get; - var get = _ember.default.get; - /* Check if the passed model has a `type` attribute or a relationship named `type`. @method modelHasAttributeOrRelationshipNamedType @param modelClass @@ -13125,12 +13102,12 @@ triggering deprecations. */ function getOwner(context) { var owner = void 0; - if (_ember.default.getOwner) { - owner = _ember.default.getOwner(context); + if (emberGetOwner) { + owner = emberGetOwner(context); } else if (context.container) { owner = context.container; } if (owner && owner.lookupFactory && !owner._lookupFactory) { @@ -13194,15 +13171,16 @@ } return headers; } }); -define('ember-data/adapter', ['exports', 'ember'], function (exports, _ember) { +define('ember-data/adapter', ['exports'], function (exports) { 'use strict'; exports.__esModule = true; - exports.default = _ember.default.Object.extend({ + var EmberObject = Ember.Object; + exports.default = EmberObject.extend({ /** If you would like your adapter to use a custom serializer you can set the `defaultSerializer` property to be the name of the custom serializer. @@ -13226,16 +13204,17 @@ should query your persistence layer for a record with the given ID. The `findRecord` method should return a promise that will resolve to a JavaScript object that will be normalized by the serializer. Here is an example `findRecord` implementation: ```app/adapters/application.js - import Ember from 'ember'; import DS from 'ember-data'; + import RSVP from 'RSVP'; + import $ from 'jquery'; export default DS.Adapter.extend({ findRecord(store, type, id, snapshot) { - return new Ember.RSVP.Promise(function(resolve, reject) { - Ember.$.getJSON(`/${type.modelName}/${id}`).then(function(data) { + return new RSVP.Promise(function(resolve, reject) { + $.getJSON(`/${type.modelName}/${id}`).then(function(data) { resolve(data); }, function(jqXHR) { reject(jqXHR); }); }); @@ -13253,17 +13232,18 @@ /** The `findAll()` method is used to retrieve all records for a given type. Example ```app/adapters/application.js - import Ember from 'ember'; import DS from 'ember-data'; + import RSVP from 'RSVP'; + import $ from 'jquery'; export default DS.Adapter.extend({ findAll(store, type, sinceToken) { let query = { since: sinceToken }; - return new Ember.RSVP.Promise(function(resolve, reject) { - Ember.$.getJSON(`/${type.modelName}`, query).then(function(data) { + return new RSVP.Promise(function(resolve, reject) { + $.getJSON(`/${type.modelName}`, query).then(function(data) { resolve(data); }, function(jqXHR) { reject(jqXHR); }); }); @@ -13281,16 +13261,17 @@ /** This method is called when you call `query` on the store. Example ```app/adapters/application.js - import Ember from 'ember'; import DS from 'ember-data'; + import RSVP from 'RSVP'; + import $ from 'jquery'; export default DS.Adapter.extend({ query(store, type, query) { - return new Ember.RSVP.Promise(function(resolve, reject) { - Ember.$.getJSON(`/${type.modelName}`, query).then(function(data) { + return new RSVP.Promise(function(resolve, reject) { + $.getJSON(`/${type.modelName}`, query).then(function(data) { resolve(data); }, function(jqXHR) { reject(jqXHR); }); }); @@ -13313,16 +13294,17 @@ data. Once found, you can asynchronously call the store's `push()` method to push the record into the store. Here is an example `queryRecord` implementation: Example ```app/adapters/application.js - import Ember from 'ember'; import DS from 'ember-data'; + import RSVP from 'RSVP'; + import $ from 'jquery'; export default DS.Adapter.extend(DS.BuildURLMixin, { queryRecord(store, type, query) { - return new Ember.RSVP.Promise(function(resolve, reject) { - Ember.$.getJSON(`/${type.modelName}`, query).then(function(data) { + return new RSVP.Promise(function(resolve, reject) { + $.getJSON(`/${type.modelName}`, query).then(function(data) { resolve(data); }, function(jqXHR) { reject(jqXHR); }); }); @@ -13393,26 +13375,28 @@ Implement this method in a subclass to handle the creation of new records. Serializes the record and sends it to the server. Example ```app/adapters/application.js - import Ember from 'ember'; import DS from 'ember-data'; + import { run } from '@ember/runloop'; + import RSVP from 'RSVP'; + import $ from 'jquery'; export default DS.Adapter.extend({ createRecord(store, type, snapshot) { let data = this.serialize(snapshot, { includeId: true }); - return new Ember.RSVP.Promise(function(resolve, reject) { - Ember.$.ajax({ + return new RSVP.Promise(function(resolve, reject) { + $.ajax({ type: 'POST', url: `/${type.modelName}`, dataType: 'json', data: data }).then(function(data) { - Ember.run(null, resolve, data); + run(null, resolve, data); }, function(jqXHR) { jqXHR.then = null; // tame jQuery's ill mannered promises - Ember.run(null, reject, jqXHR); + run(null, reject, jqXHR); }); }); } }); ``` @@ -13435,27 +13419,29 @@ the updateRecord promise can also resolve with `undefined` and the Ember Data store will assume all of the updates were successfully applied on the backend. Example ```app/adapters/application.js - import Ember from 'ember'; import DS from 'ember-data'; + import { run } from '@ember/runloop'; + import RSVP from 'RSVP'; + import $ from 'jquery'; export default DS.Adapter.extend({ updateRecord(store, type, snapshot) { let data = this.serialize(snapshot, { includeId: true }); let id = snapshot.id; - return new Ember.RSVP.Promise(function(resolve, reject) { - Ember.$.ajax({ + return new RSVP.Promise(function(resolve, reject) { + $.ajax({ type: 'PUT', url: `/${type.modelName}/${id}`, dataType: 'json', data: data }).then(function(data) { - Ember.run(null, resolve, data); + run(null, resolve, data); }, function(jqXHR) { jqXHR.then = null; // tame jQuery's ill mannered promises - Ember.run(null, reject, jqXHR); + run(null, reject, jqXHR); }); }); } }); ``` @@ -13471,27 +13457,29 @@ Implement this method in a subclass to handle the deletion of a record. Sends a delete request for the record to the server. Example ```app/adapters/application.js - import Ember from 'ember'; import DS from 'ember-data'; + import { run } from '@ember/runloop'; + import RSVP from 'RSVP'; + import $ from 'jquery'; export default DS.Adapter.extend({ deleteRecord(store, type, snapshot) { let data = this.serialize(snapshot, { includeId: true }); let id = snapshot.id; - return new Ember.RSVP.Promise(function(resolve, reject) { - Ember.$.ajax({ + return new RSVP.Promise(function(resolve, reject) { + $.ajax({ type: 'DELETE', url: `/${type.modelName}/${id}`, dataType: 'json', data: data }).then(function(data) { - Ember.run(null, resolve, data); + run(null, resolve, data); }, function(jqXHR) { jqXHR.then = null; // tame jQuery's ill mannered promises - Ember.run(null, reject, jqXHR); + run(null, reject, jqXHR); }); }); } }); ``` @@ -13516,25 +13504,27 @@ /** The store will call `findMany` instead of multiple `findRecord` requests to find multiple records at once if coalesceFindRequests is true. ```app/adapters/application.js - import Ember from 'ember'; import DS from 'ember-data'; + import { run } from '@ember/runloop'; + import RSVP from 'RSVP'; + import $ from 'jquery'; export default DS.Adapter.extend({ findMany(store, type, ids, snapshots) { - return new Ember.RSVP.Promise(function(resolve, reject) { - Ember.$.ajax({ + return new RSVP.Promise(function(resolve, reject) { + $.ajax({ type: 'GET', url: `/${type.modelName}/`, dataType: 'json', data: { filter: { id: ids.join(',') } } }).then(function(data) { - Ember.run(null, resolve, data); + run(null, resolve, data); }, function(jqXHR) { jqXHR.then = null; // tame jQuery's ill mannered promises - Ember.run(null, reject, jqXHR); + run(null, reject, jqXHR); }); }); } }); ``` @@ -13791,14 +13781,16 @@ get: function () { return _private.errorsArrayToHash; } }); }); -define('ember-data/adapters/json-api', ['exports', 'ember', 'ember-inflector', 'ember-data/adapters/rest', 'ember-data/-private'], function (exports, _ember, _emberInflector, _rest, _private) { +define('ember-data/adapters/json-api', ['exports', 'ember-data/adapters/rest', 'ember-data/-private', 'ember-inflector'], function (exports, _rest, _private, _emberInflector) { 'use strict'; exports.__esModule = true; + var dasherize = Ember.String.dasherize; + var $ = Ember.$; /** The `JSONAPIAdapter` is the default adapter used by Ember Data. It is responsible for transforming the store's requests into HTTP @@ -13933,15 +13925,10 @@ @class JSONAPIAdapter @constructor @namespace DS @extends DS.RESTAdapter */ - /* global heimdall */ - /** - @module ember-data - */ - var JSONAPIAdapter = _rest.default.extend({ defaultSerializer: '-json-api', ajaxOptions: function (url, type, options) { var hash = this._super.apply(this, arguments); @@ -14015,11 +14002,11 @@ var url = this.buildURL(type.modelName, ids, snapshots, 'findMany'); return this.ajax(url, 'GET', { data: { filter: { id: ids.join(',') } } }); } }, pathForType: function (modelName) { - var dasherized = _ember.default.String.dasherize(modelName); + var dasherized = dasherize(modelName); return (0, _emberInflector.pluralize)(dasherized); }, updateRecord: function (store, type, snapshot) { if ((0, _private.isEnabled)('ds-improved-ajax') && !this._hasCustomizedAjax()) { return this._super.apply(this, arguments); @@ -14034,20 +14021,20 @@ return this.ajax(url, 'PATCH', { data: data }); } }, _hasCustomizedAjax: function () { if (this.ajax !== JSONAPIAdapter.prototype.ajax) { - (false && !(false) && _ember.default.deprecate('JSONAPIAdapter#ajax has been deprecated please use. `methodForRequest`, `urlForRequest`, `headersForRequest` or `dataForRequest` instead.', false, { + (false && !(false) && Ember.deprecate('JSONAPIAdapter#ajax has been deprecated please use. `methodForRequest`, `urlForRequest`, `headersForRequest` or `dataForRequest` instead.', false, { id: 'ds.json-api-adapter.ajax', until: '3.0.0' })); return true; } if (this.ajaxOptions !== JSONAPIAdapter.prototype.ajaxOptions) { - (false && !(false) && _ember.default.deprecate('JSONAPIAdapterr#ajaxOptions has been deprecated please use. `methodForRequest`, `urlForRequest`, `headersForRequest` or `dataForRequest` instead.', false, { + (false && !(false) && Ember.deprecate('JSONAPIAdapterr#ajaxOptions has been deprecated please use. `methodForRequest`, `urlForRequest`, `headersForRequest` or `dataForRequest` instead.', false, { id: 'ds.json-api-adapter.ajax-options', until: '3.0.0' })); return true; @@ -14112,20 +14099,22 @@ }); } exports.default = JSONAPIAdapter; }); -define('ember-data/adapters/rest', ['exports', 'ember', 'ember-data/adapter', 'ember-data/-private'], function (exports, _ember, _adapter, _private) { +define('ember-data/adapters/rest', ['exports', 'ember-data/adapter', 'ember-data/-private'], function (exports, _adapter, _private) { 'use strict'; exports.__esModule = true; - var MapWithDefault = _ember.default.MapWithDefault, - get = _ember.default.get, - run = _ember.default.run; + var $ = Ember.$; + var EmberPromise = Ember.RSVP.Promise; + var MapWithDefault = Ember.MapWithDefault; + var get = Ember.get; + var run = Ember.run; - var Promise = _ember.default.RSVP.Promise; + var Promise = EmberPromise; /** The REST adapter allows your store to communicate with an HTTP server by transmitting JSON via XHR. Most Ember.js apps that consume a JSON API should use the REST adapter. @@ -14341,13 +14330,14 @@ headers. In the example below, the `session` object has been injected into an adapter by Ember's container. ```app/adapters/application.js import DS from 'ember-data'; + import { computed } from '@ember/object'; export default DS.RESTAdapter.extend({ - headers: Ember.computed('session.authToken', function() { + headers: computed('session.authToken', function() { return { 'API_KEY': this.get('session.authToken'), 'ANOTHER_HEADER': 'Some header value' }; }) @@ -14361,15 +14351,17 @@ function to set the property into a non-cached mode causing the headers to be recomputed with every request. ```app/adapters/application.js import DS from 'ember-data'; + import { get } from '@ember/object'; + import { computed } from '@ember/object'; export default DS.RESTAdapter.extend({ - headers: Ember.computed(function() { + headers: computed(function() { return { - 'API_KEY': Ember.get(document.cookie.match(/apiKey\=([^;]*)/), '1'), + 'API_KEY': get(document.cookie.match(/apiKey\=([^;]*)/), '1'), 'ANOTHER_HEADER': 'Some header value' }; }).volatile() }); ``` @@ -14739,11 +14731,11 @@ adapter._ajaxRequest(hash); }, 'DS: RESTAdapter#ajax ' + type + ' to ' + url); }, _ajaxRequest: function (options) { - _ember.default.$.ajax(options); + $.ajax(options); }, ajaxOptions: function (url, type, options) { var hash = options || {}; hash.url = url; hash.type = type; @@ -14768,11 +14760,11 @@ }, parseErrorResponse: function (responseText) { var json = responseText; try { - json = _ember.default.$.parseJSON(responseText); + json = $.parseJSON(responseText); } catch (e) { // ignored } return json; @@ -14831,20 +14823,20 @@ return query; }, _hasCustomizedAjax: function () { if (this.ajax !== RESTAdapter.prototype.ajax) { - (false && !(false) && _ember.default.deprecate('RESTAdapter#ajax has been deprecated please use. `methodForRequest`, `urlForRequest`, `headersForRequest` or `dataForRequest` instead.', false, { + (false && !(false) && Ember.deprecate('RESTAdapter#ajax has been deprecated please use. `methodForRequest`, `urlForRequest`, `headersForRequest` or `dataForRequest` instead.', false, { id: 'ds.rest-adapter.ajax', until: '3.0.0' })); return true; } if (this.ajaxOptions !== RESTAdapter.prototype.ajaxOptions) { - (false && !(false) && _ember.default.deprecate('RESTAdapter#ajaxOptions has been deprecated please use. `methodForRequest`, `urlForRequest`, `headersForRequest` or `dataForRequest` instead.', false, { + (false && !(false) && Ember.deprecate('RESTAdapter#ajaxOptions has been deprecated please use. `methodForRequest`, `urlForRequest`, `headersForRequest` or `dataForRequest` instead.', false, { id: 'ds.rest-adapter.ajax-options', until: '3.0.0' })); return true; @@ -15049,11 +15041,11 @@ function ajaxError(adapter, jqXHR, requestData, responseData) { if (false) { var message = 'The server returned an empty string for ' + requestData.method + ' ' + requestData.url + ', which cannot be parsed into a valid JSON. Return either null or {}.'; var validJSONString = !(responseData.textStatus === "parsererror" && jqXHR.responseText === ""); - (false && _ember.default.warn(message, validJSONString, { + (false && Ember.warn(message, validJSONString, { id: 'ds.adapter.returned-empty-string-as-JSON' })); } var error = void 0; @@ -15084,15 +15076,16 @@ } } exports.default = RESTAdapter; }); -define('ember-data/attr', ['exports', 'ember'], function (exports, _ember) { +define('ember-data/attr', ['exports'], function (exports) { 'use strict'; exports.__esModule = true; exports.default = attr; + var computed = Ember.computed; /** @module ember-data */ @@ -15100,11 +15093,11 @@ function getDefaultValue(record, options, key) { if (typeof options.defaultValue === 'function') { return options.defaultValue.apply(null, arguments); } else { var defaultValue = options.defaultValue; - (false && !(typeof defaultValue !== 'object' || defaultValue === null) && _ember.default.deprecate('Non primitive defaultValues are deprecated because they are shared between all instances. If you would like to use a complex object as a default value please provide a function that returns the complex object.', typeof defaultValue !== 'object' || defaultValue === null, { + (false && !(typeof defaultValue !== 'object' || defaultValue === null) && Ember.deprecate('Non primitive defaultValues are deprecated because they are shared between all instances. If you would like to use a complex object as a default value please provide a function that returns the complex object.', typeof defaultValue !== 'object' || defaultValue === null, { id: 'ds.defaultValue.complex-object', until: '3.0.0' })); return defaultValue; @@ -15222,11 +15215,11 @@ type: type, isAttribute: true, options: options }; - return _ember.default.computed({ + return computed({ get: function (key) { var internalModel = this._internalModel; if (hasValue(internalModel, key)) { return getValue(internalModel, key); } else { @@ -15260,24 +15253,25 @@ return value; } }).meta(meta); } }); -define("ember-data", ["exports", "ember", "ember-data/-private", "ember-data/setup-container", "ember-data/instance-initializers/initialize-store-service", "ember-data/transforms/transform", "ember-data/transforms/number", "ember-data/transforms/date", "ember-data/transforms/string", "ember-data/transforms/boolean", "ember-data/adapter", "ember-data/adapters/json-api", "ember-data/adapters/rest", "ember-data/serializer", "ember-data/serializers/json-api", "ember-data/serializers/json", "ember-data/serializers/rest", "ember-data/serializers/embedded-records-mixin", "ember-data/attr", "ember-inflector"], function (exports, _ember, _private, _setupContainer, _initializeStoreService, _transform, _number, _date, _string, _boolean, _adapter, _jsonApi, _rest, _serializer, _jsonApi2, _json, _rest2, _embeddedRecordsMixin, _attr) { - "use strict"; +define('ember-data', ['exports', 'ember-data/-private', 'ember-data/setup-container', 'ember-data/instance-initializers/initialize-store-service', 'ember-data/transforms/transform', 'ember-data/transforms/number', 'ember-data/transforms/date', 'ember-data/transforms/string', 'ember-data/transforms/boolean', 'ember-data/adapter', 'ember-data/adapters/json-api', 'ember-data/adapters/rest', 'ember-data/serializer', 'ember-data/serializers/json-api', 'ember-data/serializers/json', 'ember-data/serializers/rest', 'ember-data/serializers/embedded-records-mixin', 'ember-data/attr', 'ember-inflector'], function (exports, _private, _setupContainer, _initializeStoreService, _transform, _number, _date, _string, _boolean, _adapter, _jsonApi, _rest, _serializer, _jsonApi2, _json, _rest2, _embeddedRecordsMixin, _attr) { + 'use strict'; exports.__esModule = true; + var EmberError = Ember.Error; /** Ember Data @module ember-data @main ember-data */ - if (_ember.default.VERSION.match(/^1\.([0-9]|1[0-2])\./)) { - throw new _ember.default.Error("Ember Data requires at least Ember 1.13.0, but you have " + _ember.default.VERSION + ". Please upgrade your version of Ember, then upgrade Ember Data."); + if (Ember.VERSION.match(/^1\.([0-9]|1[0-2])\./)) { + throw new EmberError("Ember Data requires at least Ember 1.13.0, but you have " + Ember.VERSION + ". Please upgrade your version of Ember, then upgrade Ember Data."); } _private.DS.Store = _private.Store; _private.DS.PromiseArray = _private.PromiseArray; _private.DS.PromiseObject = _private.PromiseObject; @@ -15352,11 +15346,11 @@ }); Object.defineProperty(_private.global, 'DS', { configurable: true, get: function () { - (false && !(false) && _ember.default.deprecate('Using the global version of DS is deprecated. Please either import ' + 'the specific modules needed or `import DS from \'ember-data\';`.', false, { id: 'ember-data.global-ds', until: '3.0.0' })); + (false && !(false) && Ember.deprecate('Using the global version of DS is deprecated. Please either import ' + 'the specific modules needed or `import DS from \'ember-data\';`.', false, { id: 'ember-data.global-ds', until: '3.0.0' })); return _private.DS; } }); @@ -15515,15 +15509,16 @@ get: function () { return _private.hasMany; } }); }); -define('ember-data/serializer', ['exports', 'ember'], function (exports, _ember) { +define('ember-data/serializer', ['exports'], function (exports) { 'use strict'; exports.__esModule = true; - exports.default = _ember.default.Object.extend({ + var EmberObject = Ember.Object; + exports.default = EmberObject.extend({ /** The `store` property is the application's `store` that contains all records. It can be used to look up serializers for other model types that may be nested inside the payload response. @@ -15634,11 +15629,11 @@ normalize: function (typeClass, hash) { return hash; } }); }); -define('ember-data/serializers/embedded-records-mixin', ['exports', 'ember'], function (exports, _ember) { +define('ember-data/serializers/embedded-records-mixin', ['exports'], function (exports) { 'use strict'; exports.__esModule = true; function _toConsumableArray(arr) { @@ -15651,14 +15646,17 @@ } else { return Array.from(arr); } } - var get = _ember.default.get, - set = _ember.default.set; - var camelize = _ember.default.String.camelize; - exports.default = _ember.default.Mixin.create({ + var typeOf = Ember.typeOf; + var A = Ember.A; + var Mixin = Ember.Mixin; + var camelize = Ember.String.camelize; + var set = Ember.set; + var get = Ember.get; + exports.default = Mixin.create({ /** Normalize the record and recursively normalize/extract all the embedded records while pushing them into the store as they are encountered A payload with an attr configured for embedded records needs to be extracted: @@ -15929,11 +15927,11 @@ */ _serializeHasManyAsIdsAndTypes: function (snapshot, json, relationship) { var serializedKey = this.keyForAttribute(relationship.key, 'serialize'); var hasMany = snapshot.hasMany(relationship.key); - json[serializedKey] = _ember.default.A(hasMany).map(function (recordSnapshot) { + json[serializedKey] = A(hasMany).map(function (recordSnapshot) { // // I'm sure I'm being utterly naive here. Propably id is a configurate property and // type too, and the modelName has to be normalized somehow. // return { id: recordSnapshot.id, type: recordSnapshot.modelName }; @@ -15943,11 +15941,11 @@ var serializedKey = this._getMappedKey(relationship.key, snapshot.type); if (serializedKey === relationship.key && this.keyForRelationship) { serializedKey = this.keyForRelationship(relationship.key, relationship.kind, "serialize"); } - (false && _ember.default.warn('The embedded relationship \'' + serializedKey + '\' is undefined for \'' + snapshot.modelName + '\' with id \'' + snapshot.id + '\'. Please include it in your original payload.', _ember.default.typeOf(snapshot.hasMany(relationship.key)) !== 'undefined', { id: 'ds.serializer.embedded-relationship-undefined' })); + (false && Ember.warn('The embedded relationship \'' + serializedKey + '\' is undefined for \'' + snapshot.modelName + '\' with id \'' + snapshot.id + '\'. Please include it in your original payload.', typeOf(snapshot.hasMany(relationship.key)) !== 'undefined', { id: 'ds.serializer.embedded-relationship-undefined' })); json[serializedKey] = this._generateSerializedHasMany(snapshot, relationship); }, @@ -15955,11 +15953,11 @@ /* Returns an array of embedded records serialized to JSON */ _generateSerializedHasMany: function (snapshot, relationship) { var hasMany = snapshot.hasMany(relationship.key); - var manyArray = _ember.default.A(hasMany); + var manyArray = A(hasMany); var ret = new Array(manyArray.length); for (var i = 0; i < manyArray.length; i++) { var embeddedSnapshot = manyArray[i]; var embeddedJson = embeddedSnapshot.serialize({ includeId: true }); @@ -16153,19 +16151,18 @@ }, isEmbeddedRecordsMixin: true }); }); -define('ember-data/serializers/json-api', ['exports', 'ember', 'ember-inflector', 'ember-data/serializers/json', 'ember-data/-private'], function (exports, _ember, _emberInflector, _json, _private) { +define('ember-data/serializers/json-api', ['exports', 'ember-inflector', 'ember-data/serializers/json', 'ember-data/-private'], function (exports, _emberInflector, _json, _private) { 'use strict'; exports.__esModule = true; - /** - @module ember-data - */ + var typeOf = Ember.typeOf; + var isNone = Ember.isNone; + var dasherize = Ember.String.dasherize; - var dasherize = _ember.default.String.dasherize; /** Ember Data 2.0 Serializer: In Ember Data a Serializer is used to serialize and deserialize @@ -16282,11 +16279,11 @@ @extends DS.JSONSerializer */ var JSONAPISerializer = _json.default.extend({ _normalizeDocumentHelper: function (documentHash) { - if (_ember.default.typeOf(documentHash.data) === 'object') { + if (typeOf(documentHash.data) === 'object') { documentHash.data = this._normalizeResourceHelper(documentHash.data); } else if (Array.isArray(documentHash.data)) { var ret = new Array(documentHash.data.length); for (var i = 0; i < documentHash.data.length; i++) { @@ -16317,11 +16314,11 @@ if ((0, _private.isEnabled)("ds-payload-type-hooks")) { var modelName = this.modelNameFromPayloadType(relationshipDataHash.type); var deprecatedModelNameLookup = this.modelNameFromPayloadKey(relationshipDataHash.type); if (modelName !== deprecatedModelNameLookup && this._hasCustomModelNameFromPayloadKey()) { - (false && !(false) && _ember.default.deprecate("You are using modelNameFromPayloadKey to normalize the type for a relationship. This has been deprecated in favor of modelNameFromPayloadType", false, { + (false && !(false) && Ember.deprecate("You are using modelNameFromPayloadKey to normalize the type for a relationship. This has been deprecated in favor of modelNameFromPayloadType", false, { id: 'ds.json-api-serializer.deprecated-model-name-for-relationship', until: '3.0.0' })); @@ -16334,11 +16331,11 @@ } return relationshipDataHash; }, _normalizeResourceHelper: function (resourceHash) { - (false && _ember.default.assert(this.warnMessageForUndefinedType(), !_ember.default.isNone(resourceHash.type), { + (false && Ember.assert(this.warnMessageForUndefinedType(), !isNone(resourceHash.type), { id: 'ds.serializer.type-is-undefined' })); var modelName = void 0, @@ -16349,11 +16346,11 @@ var deprecatedModelNameLookup = this.modelNameFromPayloadKey(resourceHash.type); usedLookup = 'modelNameFromPayloadType'; if (modelName !== deprecatedModelNameLookup && this._hasCustomModelNameFromPayloadKey()) { - (false && !(false) && _ember.default.deprecate("You are using modelNameFromPayloadKey to normalize the type for a resource. This has been deprecated in favor of modelNameFromPayloadType", false, { + (false && !(false) && Ember.deprecate("You are using modelNameFromPayloadKey to normalize the type for a resource. This has been deprecated in favor of modelNameFromPayloadType", false, { id: 'ds.json-api-serializer.deprecated-model-name-for-resource', until: '3.0.0' })); @@ -16364,11 +16361,11 @@ modelName = this.modelNameFromPayloadKey(resourceHash.type); usedLookup = 'modelNameFromPayloadKey'; } if (!this.store._hasModelFor(modelName)) { - (false && _ember.default.warn(this.warnMessageNoModelForType(modelName, resourceHash.type, usedLookup), false, { + (false && Ember.warn(this.warnMessageNoModelForType(modelName, resourceHash.type, usedLookup), false, { id: 'ds.serializer.model-for-type-missing' })); return null; } @@ -16394,11 +16391,11 @@ return normalizedPayload; }, normalizeQueryRecordResponse: function () { var normalized = this._super.apply(this, arguments); - (false && _ember.default.assert('Expected the primary data returned by the serializer for a `queryRecord` response to be a single object but instead it was an array.', !Array.isArray(normalized.data), { + (false && Ember.assert('Expected the primary data returned by the serializer for a `queryRecord` response to be a single object but instead it was an array.', !Array.isArray(normalized.data), { id: 'ds.serializer.json-api.queryRecord-array-response' })); return normalized; @@ -16414,21 +16411,21 @@ if (resourceHash.attributes[attributeKey] !== undefined) { attributes[key] = resourceHash.attributes[attributeKey]; } if (false) { if (resourceHash.attributes[attributeKey] === undefined && resourceHash.attributes[key] !== undefined) { - (false && _ember.default.assert('Your payload for \'' + modelClass.modelName + '\' contains \'' + key + '\', but your serializer is setup to look for \'' + attributeKey + '\'. This is most likely because Ember Data\'s JSON API serializer dasherizes attribute keys by default. You should subclass JSONAPISerializer and implement \'keyForAttribute(key) { return key; }\' to prevent Ember Data from customizing your attribute keys.', false)); + (false && Ember.assert('Your payload for \'' + modelClass.modelName + '\' contains \'' + key + '\', but your serializer is setup to look for \'' + attributeKey + '\'. This is most likely because Ember Data\'s JSON API serializer dasherizes attribute keys by default. You should subclass JSONAPISerializer and implement \'keyForAttribute(key) { return key; }\' to prevent Ember Data from customizing your attribute keys.', false)); } } }); } return attributes; }, extractRelationship: function (relationshipHash) { - if (_ember.default.typeOf(relationshipHash.data) === 'object') { + if (typeOf(relationshipHash.data) === 'object') { relationshipHash.data = this._normalizeRelationshipDataHelper(relationshipHash.data); } if (Array.isArray(relationshipHash.data)) { var ret = new Array(relationshipHash.data.length); @@ -16456,11 +16453,11 @@ var relationshipHash = resourceHash.relationships[relationshipKey]; relationships[key] = _this2.extractRelationship(relationshipHash); } if (false) { if (resourceHash.relationships[relationshipKey] === undefined && resourceHash.relationships[key] !== undefined) { - (false && _ember.default.assert('Your payload for \'' + modelClass.modelName + '\' contains \'' + key + '\', but your serializer is setup to look for \'' + relationshipKey + '\'. This is most likely because Ember Data\'s JSON API serializer dasherizes relationship keys by default. You should subclass JSONAPISerializer and implement \'keyForRelationship(key) { return key; }\' to prevent Ember Data from customizing your relationship keys.', false)); + (false && Ember.assert('Your payload for \'' + modelClass.modelName + '\' contains \'' + key + '\', but your serializer is setup to look for \'' + relationshipKey + '\'. This is most likely because Ember Data\'s JSON API serializer dasherizes relationship keys by default. You should subclass JSONAPISerializer and implement \'keyForRelationship(key) { return key; }\' to prevent Ember Data from customizing your relationship keys.', false)); } } }); } @@ -16470,11 +16467,11 @@ if ((0, _private.isEnabled)("ds-payload-type-hooks")) { var modelName = this.modelNameFromPayloadType(resourceHash.type); var deprecatedModelNameLookup = this.modelNameFromPayloadKey(resourceHash.type); if (modelName !== deprecatedModelNameLookup && this._hasCustomModelNameFromPayloadKey()) { - (false && !(false) && _ember.default.deprecate("You are using modelNameFromPayloadKey to normalize the type for a polymorphic relationship. This has been deprecated in favor of modelNameFromPayloadType", false, { + (false && !(false) && Ember.deprecate("You are using modelNameFromPayloadKey to normalize the type for a polymorphic relationship. This has been deprecated in favor of modelNameFromPayloadType", false, { id: 'ds.json-api-serializer.deprecated-model-name-for-polymorphic-type', until: '3.0.0' })); @@ -16525,11 +16522,11 @@ if ((0, _private.isEnabled)("ds-payload-type-hooks")) { payloadType = this.payloadTypeFromModelName(snapshot.modelName); var deprecatedPayloadTypeLookup = this.payloadKeyFromModelName(snapshot.modelName); if (payloadType !== deprecatedPayloadTypeLookup && this._hasCustomPayloadKeyFromModelName()) { - (false && !(false) && _ember.default.deprecate("You used payloadKeyFromModelName to customize how a type is serialized. Use payloadTypeFromModelName instead.", false, { + (false && !(false) && Ember.deprecate("You used payloadKeyFromModelName to customize how a type is serialized. Use payloadTypeFromModelName instead.", false, { id: 'ds.json-api-serializer.deprecated-payload-type-for-model', until: '3.0.0' })); @@ -16584,11 +16581,11 @@ if ((0, _private.isEnabled)("ds-payload-type-hooks")) { payloadType = this.payloadTypeFromModelName(belongsTo.modelName); var deprecatedPayloadTypeLookup = this.payloadKeyFromModelName(belongsTo.modelName); if (payloadType !== deprecatedPayloadTypeLookup && this._hasCustomPayloadKeyFromModelName()) { - (false && !(false) && _ember.default.deprecate("You used payloadKeyFromModelName to serialize type for belongs-to relationship. Use payloadTypeFromModelName instead.", false, { + (false && !(false) && Ember.deprecate("You used payloadKeyFromModelName to serialize type for belongs-to relationship. Use payloadTypeFromModelName instead.", false, { id: 'ds.json-api-serializer.deprecated-payload-type-for-belongs-to', until: '3.0.0' })); @@ -16636,11 +16633,11 @@ if ((0, _private.isEnabled)("ds-payload-type-hooks")) { payloadType = this.payloadTypeFromModelName(item.modelName); var deprecatedPayloadTypeLookup = this.payloadKeyFromModelName(item.modelName); if (payloadType !== deprecatedPayloadTypeLookup && this._hasCustomPayloadKeyFromModelName()) { - (false && !(false) && _ember.default.deprecate("You used payloadKeyFromModelName to serialize type for belongs-to relationship. Use payloadTypeFromModelName instead.", false, { + (false && !(false) && Ember.deprecate("You used payloadKeyFromModelName to serialize type for belongs-to relationship. Use payloadTypeFromModelName instead.", false, { id: 'ds.json-api-serializer.deprecated-payload-type-for-has-many', until: '3.0.0' })); @@ -16682,14 +16679,14 @@ if (false) { JSONAPISerializer.reopen({ willMergeMixin: function (props) { var constructor = this.constructor; - (false && _ember.default.warn('You\'ve defined \'extractMeta\' in ' + constructor.toString() + ' which is not used for serializers extending JSONAPISerializer. Read more at https://emberjs.com/api/data/classes/DS.JSONAPISerializer.html#toc_customizing-meta on how to customize meta when using JSON API.', _ember.default.isNone(props.extractMeta) || props.extractMeta === _json.default.prototype.extractMeta, { + (false && Ember.warn('You\'ve defined \'extractMeta\' in ' + constructor.toString() + ' which is not used for serializers extending JSONAPISerializer. Read more at https://emberjs.com/api/data/classes/DS.JSONAPISerializer.html#toc_customizing-meta on how to customize meta when using JSON API.', isNone(props.extractMeta) || props.extractMeta === _json.default.prototype.extractMeta, { id: 'ds.serializer.json-api.extractMeta' })); - (false && _ember.default.warn('The JSONAPISerializer does not work with the EmbeddedRecordsMixin because the JSON API spec does not describe how to format embedded resources.', !props.isEmbeddedRecordsMixin, { + (false && Ember.warn('The JSONAPISerializer does not work with the EmbeddedRecordsMixin because the JSON API spec does not describe how to format embedded resources.', !props.isEmbeddedRecordsMixin, { id: 'ds.serializer.embedded-records-mixin-not-supported' })); }, warnMessageForUndefinedType: function () { return 'Encountered a resource object with an undefined type (resolved resource using ' + this.constructor.toString() + ')'; @@ -16700,11 +16697,11 @@ }); } exports.default = JSONAPISerializer; }); -define('ember-data/serializers/json', ['exports', 'ember', 'ember-data/serializer', 'ember-data/-private'], function (exports, _ember, _serializer, _private) { +define('ember-data/serializers/json', ['exports', 'ember-data/serializer', 'ember-data/-private'], function (exports, _serializer, _private) { 'use strict'; exports.__esModule = true; function _toConsumableArray(arr) { @@ -16717,14 +16714,19 @@ } else { return Array.from(arr); } } - var get = _ember.default.get; - var isNone = _ember.default.isNone; - var assign = _ember.default.assign || _ember.default.merge; + var assign = Ember.assign; + var merge = Ember.merge; + var isNone = Ember.isNone; + var typeOf = Ember.typeOf; + var get = Ember.get; + + var emberAssign = assign || merge; + /** Ember Data 2.0 Serializer: In Ember Data a Serializer is used to serialize and deserialize records when they are transferred in and out of an external source. @@ -16948,11 +16950,11 @@ included: [] }; var meta = this.extractMeta(store, primaryModelClass, payload); if (meta) { - (false && _ember.default.assert('The `meta` returned from `extractMeta` has to be an object, not "' + _ember.default.typeOf(meta) + '".', _ember.default.typeOf(meta) === 'object')); + (false && Ember.assert('The `meta` returned from `extractMeta` has to be an object, not "' + typeOf(meta) + '".', typeOf(meta) === 'object')); documentHash.meta = meta; } if (isSingle) { @@ -16989,11 +16991,11 @@ normalize: function (modelClass, resourceHash) { var data = null; if (resourceHash) { this.normalizeUsingDeclaredMapping(modelClass, resourceHash); - if (_ember.default.typeOf(resourceHash.links) === 'object') { + if (typeOf(resourceHash.links) === 'object') { this.normalizeUsingDeclaredMapping(modelClass, resourceHash.links); } data = { id: this.extractId(modelClass, resourceHash), @@ -17026,19 +17028,19 @@ }); return attributes; }, extractRelationship: function (relationshipModelName, relationshipHash) { - if (_ember.default.isNone(relationshipHash)) { + if (isNone(relationshipHash)) { return null; } /* When `relationshipHash` is an object it usually means that the relationship is polymorphic. It could however also be embedded resources that the EmbeddedRecordsMixin has be able to process. */ - if (_ember.default.typeOf(relationshipHash) === 'object') { + if (typeOf(relationshipHash) === 'object') { if (relationshipHash.id) { relationshipHash.id = (0, _private.coerceId)(relationshipHash.id); } var modelClass = this.store.modelFor(relationshipModelName); @@ -17047,11 +17049,11 @@ if ((0, _private.isEnabled)("ds-payload-type-hooks")) { var modelName = this.modelNameFromPayloadType(relationshipHash.type); var deprecatedModelNameLookup = this.modelNameFromPayloadKey(relationshipHash.type); if (modelName !== deprecatedModelNameLookup && this._hasCustomModelNameFromPayloadKey()) { - (false && !(false) && _ember.default.deprecate("You used modelNameFromPayloadKey to customize how a type is normalized. Use modelNameFromPayloadType instead", false, { + (false && !(false) && Ember.deprecate("You used modelNameFromPayloadKey to customize how a type is normalized. Use modelNameFromPayloadType instead", false, { id: 'ds.json-serializer.deprecated-type-for-polymorphic-relationship', until: '3.0.0' })); @@ -17090,11 +17092,11 @@ data = _this3.extractPolymorphicRelationship(relationshipMeta.type, relationshipHash, { key: key, resourceHash: resourceHash, relationshipMeta: relationshipMeta }); } else { data = _this3.extractRelationship(relationshipMeta.type, relationshipHash); } } else if (relationshipMeta.kind === 'hasMany') { - if (!_ember.default.isNone(relationshipHash)) { + if (!isNone(relationshipHash)) { data = new Array(relationshipHash.length); for (var i = 0, l = relationshipHash.length; i < l; i++) { var item = relationshipHash[i]; data[i] = _this3.extractRelationship(relationshipMeta.type, item); } @@ -17167,11 +17169,11 @@ } } } }, _getMappedKey: function (key, modelClass) { - (false && _ember.default.warn('There is no attribute or relationship with the name `' + key + '` on `' + modelClass.modelName + '`. Check your serializers attrs hash.', get(modelClass, 'attributes').has(key) || get(modelClass, 'relationshipsByName').has(key), { + (false && Ember.warn('There is no attribute or relationship with the name `' + key + '` on `' + modelClass.modelName + '`. Check your serializers attrs hash.', get(modelClass, 'attributes').has(key) || get(modelClass, 'relationshipsByName').has(key), { id: 'ds.serializer.no-mapped-attrs-key' })); var attrs = get(this, 'attrs'); @@ -17200,11 +17202,11 @@ return attrs && attrs[key] && attrs[key].serialize === true; }, shouldSerializeHasMany: function (snapshot, key, relationship) { if (this._shouldSerializeHasMany !== JSONSerializer.prototype._shouldSerializeHasMany) { - (false && !(false) && _ember.default.deprecate('The private method _shouldSerializeHasMany has been promoted to the public API. Please remove the underscore to use the public shouldSerializeHasMany method.', false, { + (false && !(false) && Ember.deprecate('The private method _shouldSerializeHasMany has been promoted to the public API. Please remove the underscore to use the public shouldSerializeHasMany method.', false, { id: 'ds.serializer.private-should-serialize-has-many', until: '3.0.0' })); } @@ -17246,11 +17248,11 @@ }); return json; }, serializeIntoHash: function (hash, typeClass, snapshot, options) { - assign(hash, this.serialize(snapshot, options)); + emberAssign(hash, this.serialize(snapshot, options)); }, serializeAttribute: function (snapshot, json, key, attribute) { if (this._canSerialize(key)) { var type = attribute.type; @@ -17363,11 +17365,11 @@ return key; }, transformFor: function (attributeType, skipAssertion) { var transform = (0, _private.getOwner)(this).lookup('transform:' + attributeType); - (false && _ember.default.assert("Unable to find transform for '" + attributeType + "'", skipAssertion || !!transform)); + (false && Ember.assert("Unable to find transform for '" + attributeType + "'", skipAssertion || !!transform)); return transform; } }); @@ -17397,11 +17399,11 @@ }); } exports.default = JSONSerializer; }); -define('ember-data/serializers/rest', ['exports', 'ember', 'ember-inflector', 'ember-data/serializers/json', 'ember-data/-private'], function (exports, _ember, _emberInflector, _json, _private) { +define('ember-data/serializers/rest', ['exports', 'ember-inflector', 'ember-data/serializers/json', 'ember-data/-private'], function (exports, _emberInflector, _json, _private) { 'use strict'; exports.__esModule = true; function _toConsumableArray(arr) { @@ -17414,11 +17416,14 @@ } else { return Array.from(arr); } } - var camelize = _ember.default.String.camelize; + var typeOf = Ember.typeOf; + var isNone = Ember.isNone; + var makeArray = Ember.makeArray; + var camelize = Ember.String.camelize; /** Normally, applications will use the `RESTSerializer` by implementing the `normalize` method. @@ -17442,14 +17447,15 @@ can implement across-the-board rules for how to convert an attribute name in your model to a key in your JSON. ```app/serializers/application.js import DS from 'ember-data'; + import { underscore } from '@ember/string'; export default DS.RESTSerializer.extend({ keyForAttribute(attr, method) { - return Ember.String.underscore(attr).toUpperCase(); + return underscore(attr).toUpperCase(); } }); ``` You can also implement `keyForRelationship`, which takes the name @@ -17467,11 +17473,11 @@ return relationshipKey + 'Type'; }, normalize: function (modelClass, resourceHash, prop) { if (this.normalizeHash && this.normalizeHash[prop]) { - (false && !(false) && _ember.default.deprecate('`RESTSerializer.normalizeHash` has been deprecated. Please use `serializer.normalize` to modify the payload of single resources.', false, { + (false && !(false) && Ember.deprecate('`RESTSerializer.normalizeHash` has been deprecated. Please use `serializer.normalize` to modify the payload of single resources.', false, { id: 'ds.serializer.normalize-hash-deprecated', until: '3.0.0' })); this.normalizeHash[prop](resourceHash); @@ -17487,11 +17493,11 @@ }; var modelClass = store.modelFor(modelName); var serializer = store.serializerFor(modelName); - _ember.default.makeArray(arrayHash).forEach(function (hash) { + makeArray(arrayHash).forEach(function (hash) { var _normalizePolymorphic = _this._normalizePolymorphicRecord(store, hash, prop, modelClass, serializer), data = _normalizePolymorphic.data, included = _normalizePolymorphic.included; documentHash.data.push(data); @@ -17516,11 +17522,11 @@ if ((0, _private.isEnabled)("ds-payload-type-hooks")) { modelName = this.modelNameFromPayloadType(hash.type); var deprecatedModelNameLookup = this.modelNameFromPayloadKey(hash.type); if (modelName !== deprecatedModelNameLookup && !this._hasCustomModelNameFromPayloadType() && this._hasCustomModelNameFromPayloadKey()) { - (false && !(false) && _ember.default.deprecate("You are using modelNameFromPayloadKey to normalize the type for a polymorphic relationship. This is has been deprecated in favor of modelNameFromPayloadType", false, { + (false && !(false) && Ember.deprecate("You are using modelNameFromPayloadKey to normalize the type for a polymorphic relationship. This is has been deprecated in favor of modelNameFromPayloadType", false, { id: 'ds.rest-serializer.deprecated-model-name-for-polymorphic-type', until: '3.0.0' })); @@ -17544,11 +17550,11 @@ included: [] }; var meta = this.extractMeta(store, primaryModelClass, payload); if (meta) { - (false && _ember.default.assert('The `meta` returned from `extractMeta` has to be an object, not "' + _ember.default.typeOf(meta) + '".', _ember.default.typeOf(meta) === 'object')); + (false && Ember.assert('The `meta` returned from `extractMeta` has to be an object, not "' + typeOf(meta) + '".', typeOf(meta) === 'object')); documentHash.meta = meta; } var keys = Object.keys(payload); @@ -17580,11 +17586,11 @@ modelName = prop.substr(1); } var typeName = this.modelNameFromPayloadKey(modelName); if (!store.modelFactoryFor(typeName)) { - (false && _ember.default.warn(this.warnMessageNoModelForKey(modelName, typeName), false, { + (false && Ember.warn(this.warnMessageNoModelForKey(modelName, typeName), false, { id: 'ds.serializer.model-for-key-missing' })); continue; } @@ -17598,11 +17604,11 @@ if (false) { var isQueryRecordAnArray = requestType === 'queryRecord' && isPrimary && Array.isArray(value); var message = "The adapter returned an array for the primary data of a `queryRecord` response. This is deprecated as `queryRecord` should return a single record."; - (false && !(!isQueryRecordAnArray) && _ember.default.deprecate(message, !isQueryRecordAnArray, { + (false && !(!isQueryRecordAnArray) && Ember.deprecate(message, !isQueryRecordAnArray, { id: 'ds.serializer.rest.queryRecord-array-response', until: '3.0' })); } @@ -17683,20 +17689,20 @@ }; for (var prop in payload) { var modelName = this.modelNameFromPayloadKey(prop); if (!store.modelFactoryFor(modelName)) { - (false && _ember.default.warn(this.warnMessageNoModelForKey(prop, modelName), false, { + (false && Ember.warn(this.warnMessageNoModelForKey(prop, modelName), false, { id: 'ds.serializer.model-for-key-missing' })); continue; } var type = store.modelFor(modelName); var typeSerializer = store.serializerFor(type.modelName); - _ember.default.makeArray(payload[prop]).forEach(function (hash) { + makeArray(payload[prop]).forEach(function (hash) { var _typeSerializer$norma = typeSerializer.normalize(type, hash, prop), data = _typeSerializer$norma.data, included = _typeSerializer$norma.included; documentHash.data.push(data); @@ -17740,20 +17746,20 @@ // `keyForAttribute`, which is not correct. The next code checks if the old // way is used and if it differs from the new way of using // `keyForPolymorphicType`. If this is the case, a deprecation warning is // logged and the old way is restored (so nothing breaks). if (key !== typeKey && this.keyForPolymorphicType === RESTSerializer.prototype.keyForPolymorphicType) { - (false && !(false) && _ember.default.deprecate("The key to serialize the type of a polymorphic record is created via keyForAttribute which has been deprecated. Use the keyForPolymorphicType hook instead.", false, { + (false && !(false) && Ember.deprecate("The key to serialize the type of a polymorphic record is created via keyForAttribute which has been deprecated. Use the keyForPolymorphicType hook instead.", false, { id: 'ds.rest-serializer.deprecated-key-for-polymorphic-type', until: '3.0.0' })); typeKey = key; } - if (_ember.default.isNone(belongsTo)) { + if (isNone(belongsTo)) { json[typeKey] = null; } else { if ((0, _private.isEnabled)("ds-payload-type-hooks")) { json[typeKey] = this.payloadTypeFromModelName(belongsTo.modelName); } else { @@ -17794,11 +17800,11 @@ var payloadType = resourceHash[typeProperty]; var type = this.modelNameFromPayloadType(payloadType); var deprecatedTypeLookup = this.modelNameFromPayloadKey(payloadType); if (payloadType !== deprecatedTypeLookup && !this._hasCustomModelNameFromPayloadType() && this._hasCustomModelNameFromPayloadKey()) { - (false && !(false) && _ember.default.deprecate("You are using modelNameFromPayloadKey to normalize the type for a polymorphic relationship. This has been deprecated in favor of modelNameFromPayloadType", false, { + (false && !(false) && Ember.deprecate("You are using modelNameFromPayloadKey to normalize the type for a polymorphic relationship. This has been deprecated in favor of modelNameFromPayloadType", false, { id: 'ds.rest-serializer.deprecated-model-name-for-polymorphic-type', until: '3.0.0' })); @@ -17968,15 +17974,15 @@ get: function () { return _transform.default; } }); }); -define('ember-data/transforms/boolean', ['exports', 'ember', 'ember-data/transforms/transform'], function (exports, _ember, _transform) { +define('ember-data/transforms/boolean', ['exports', 'ember-data/transforms/transform'], function (exports, _transform) { 'use strict'; exports.__esModule = true; - var isNone = _ember.default.isNone; + var isNone = Ember.isNone; exports.default = _transform.default.extend({ deserialize: function (serialized, options) { var type = typeof serialized; if (isNone(serialized) && options.allowNull === true) { @@ -18000,17 +18006,17 @@ return Boolean(deserialized); } }); }); -define('ember-data/transforms/date', ['exports', 'ember-data/transforms/transform', 'ember'], function (exports, _transform, _ember) { +define('ember-data/transforms/date', ['exports', 'ember-data/transforms/transform'], function (exports, _transform) { 'use strict'; exports.__esModule = true; - _ember.default.Date = _ember.default.Date || {}; + Ember.Date = Ember.Date || {}; /** Date.parse with progressive enhancement for ISO 8601 <https://github.com/csnover/js-iso8601> © 2011 Colin Snover <http://zetafleet.com> @@ -18020,12 +18026,12 @@ @class Date @namespace Ember @static @deprecated */ - _ember.default.Date.parse = function (date) { - (false && !(false) && _ember.default.deprecate('Ember.Date.parse is deprecated because Safari 5-, IE8-, and\n Firefox 3.6- are no longer supported (see\n https://github.com/csnover/js-iso8601 for the history of this issue).\n Please use Date.parse instead', false, { + Ember.Date.parse = function (date) { + (false && !(false) && Ember.deprecate('Ember.Date.parse is deprecated because Safari 5-, IE8-, and\n Firefox 3.6- are no longer supported (see\n https://github.com/csnover/js-iso8601 for the history of this issue).\n Please use Date.parse instead', false, { id: 'ds.ember.date.parse-deprecate', until: '3.0.0' })); @@ -18060,11 +18066,11 @@ if (type === "string") { var offset = serialized.indexOf('+'); if (offset !== -1 && serialized.length - 3 === offset) { - (false && !(false) && _ember.default.deprecate('The ECMA2015 Spec for ISO 8601 dates does not allow for shorthand timezone offsets such as +00.\n Ember Data\'s normalization of date\'s allowing for this shorthand has been deprecated, please update your API to return\n UTC dates formatted with \xB1hh:mm timezone offsets or implement a custom UTC transform.', false, { + (false && !(false) && Ember.deprecate('The ECMA2015 Spec for ISO 8601 dates does not allow for shorthand timezone offsets such as +00.\n Ember Data\'s normalization of date\'s allowing for this shorthand has been deprecated, please update your API to return\n UTC dates formatted with \xB1hh:mm timezone offsets or implement a custom UTC transform.', false, { id: 'ds.attr.date.normalize-utc', until: '3.0.0' })); return new Date(serialized + ':00'); @@ -18092,18 +18098,17 @@ return null; } } }); }); -define('ember-data/transforms/number', ['exports', 'ember', 'ember-data/transforms/transform'], function (exports, _ember, _transform) { +define('ember-data/transforms/number', ['exports', 'ember-data/transforms/transform'], function (exports, _transform) { 'use strict'; exports.__esModule = true; + var empty = Ember.isEmpty; - var empty = _ember.default.isEmpty; - function isNumber(value) { return value === value && value !== Infinity && value !== -Infinity; } /** @@ -18151,61 +18156,38 @@ return isNumber(transformed) ? transformed : null; } } }); }); -define('ember-data/transforms/string', ['exports', 'ember', 'ember-data/transforms/transform'], function (exports, _ember, _transform) { +define('ember-data/transforms/string', ['exports', 'ember-data/transforms/transform'], function (exports, _transform) { 'use strict'; exports.__esModule = true; - - - var none = _ember.default.isNone; - - /** - The `DS.StringTransform` class is used to serialize and deserialize - string attributes on Ember Data record objects. This transform is - used when `string` is passed as the type parameter to the - [DS.attr](../../data#method_attr) function. - - Usage - - ```app/models/user.js - import DS from 'ember-data'; - - export default DS.Model.extend({ - isAdmin: DS.attr('boolean'), - name: DS.attr('string'), - email: DS.attr('string') - }); - ``` - - @class StringTransform - @extends DS.Transform - @namespace DS - */ + var none = Ember.isNone; exports.default = _transform.default.extend({ deserialize: function (serialized) { return none(serialized) ? null : String(serialized); }, serialize: function (deserialized) { return none(deserialized) ? null : String(deserialized); } }); }); -define('ember-data/transforms/transform', ['exports', 'ember'], function (exports, _ember) { +define('ember-data/transforms/transform', ['exports'], function (exports) { 'use strict'; exports.__esModule = true; - exports.default = _ember.default.Object.extend({ + var EmberObject = Ember.Object; + exports.default = EmberObject.extend({ /** When given a deserialized value from a record attribute this method must return the serialized value. Example ```javascript - serialize(deserialized, options) { - return Ember.isEmpty(deserialized) ? null : Number(deserialized); + import { isEmpty } from '@ember/utils'; + serialize(deserialized, options) { + return isEmpty(deserialized) ? null : Number(deserialized); } ``` @method serialize @param deserialized The deserialized value @param options hash of options passed to `DS.attr` @@ -18232,24 +18214,24 @@ }); define("ember-data/version", ["exports"], function (exports) { "use strict"; exports.__esModule = true; - exports.default = "2.17.0-beta.1"; + exports.default = "2.17.0-beta.2"; }); -define("ember-inflector", ["module", "exports", "ember", "ember-inflector/lib/system", "ember-inflector/lib/ext/string"], function (module, exports, _ember, _system) { +define("ember-inflector", ["module", "exports", "ember-inflector/lib/system", "ember-inflector/lib/ext/string"], function (module, exports, _system) { "use strict"; exports.__esModule = true; exports.defaultRules = exports.singularize = exports.pluralize = undefined; - /* global define, module */ + _system.Inflector.defaultRules = _system.defaultRules; - _ember.default.Inflector = _system.Inflector; + Ember.Inflector = _system.Inflector; - _ember.default.String.pluralize = _system.pluralize; - _ember.default.String.singularize = _system.singularize; + Ember.String.pluralize = _system.pluralize; + Ember.String.singularize = _system.singularize; exports.default = _system.Inflector; exports.pluralize = _system.pluralize; exports.singularize = _system.singularize; exports.defaultRules = _system.defaultRules; @@ -18267,14 +18249,14 @@ module['exports'] = _system.Inflector; _system.Inflector.singularize = _system.singularize; _system.Inflector.pluralize = _system.pluralize; } }); -define('ember-inflector/lib/ext/string', ['ember', 'ember-inflector/lib/system/string'], function (_ember, _string) { +define('ember-inflector/lib/ext/string', ['ember-inflector/lib/system/string'], function (_string) { 'use strict'; - if (_ember.default.EXTEND_PROTOTYPES === true || _ember.default.EXTEND_PROTOTYPES.String) { + if (Ember.EXTEND_PROTOTYPES === true || Ember.EXTEND_PROTOTYPES.String) { /** See {{#crossLink "Ember.String/pluralize"}}{{/crossLink}} @method pluralize @for String */ @@ -18354,17 +18336,17 @@ irregularPairs: [['person', 'people'], ['man', 'men'], ['child', 'children'], ['sex', 'sexes'], ['move', 'moves'], ['cow', 'kine'], ['zombie', 'zombies']], uncountable: ['equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep', 'jeans', 'police'] }; }); -define('ember-inflector/lib/system/inflector', ['exports', 'ember'], function (exports, _ember) { +define('ember-inflector/lib/system/inflector', ['exports'], function (exports) { 'use strict'; exports.__esModule = true; - var capitalize = _ember.default.String.capitalize; + var capitalize = Ember.String.capitalize; var BLANK_REGEX = /^\s*$/; var LAST_WORD_DASHED_REGEX = /([\w/-]+[_/\s-])([a-z\d]+$)/; var LAST_WORD_CAMELIZED_REGEX = /([\w/\s-]+)([A-Z][a-z\d]*$)/; var CAMELIZED_REGEX = /[A-Z][a-z\d]*$/; @@ -18685,22 +18667,22 @@ } exports.pluralize = pluralize; exports.singularize = singularize; }); -define('ember-inflector/lib/utils/make-helper', ['exports', 'ember'], function (exports, _ember) { +define('ember-inflector/lib/utils/make-helper', ['exports'], function (exports) { 'use strict'; exports.__esModule = true; exports.default = makeHelper; function makeHelper(helperFunction) { - if (_ember.default.Helper) { - return _ember.default.Helper.helper(helperFunction); + if (Ember.Helper) { + return Ember.Helper.helper(helperFunction); } - if (_ember.default.HTMLBars) { - return _ember.default.HTMLBars.makeBoundHelper(helperFunction); + if (Ember.HTMLBars) { + return Ember.HTMLBars.makeBoundHelper(helperFunction); } - return _ember.default.Handlebars.makeBoundHelper(helperFunction); + return Ember.Handlebars.makeBoundHelper(helperFunction); } }); define('ember-load-initializers', ['exports'], function (exports) { 'use strict';