dist/globals/ember-data.prod.js in ember-data-source-2.14.7 vs dist/globals/ember-data.prod.js in ember-data-source-2.14.8
- old
+ new
@@ -4,20 +4,18 @@
/*!
* @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.14.7
+ * @version 2.14.8
*/
var loader, define, requireModule, require, requirejs;
(function (global) {
'use strict';
- var heimdall = global.heimdall;
-
function dict() {
var obj = Object.create(null);
obj['__'] = undefined;
delete obj['__'];
return obj;
@@ -55,11 +53,13 @@
global[newName] = global[oldName];
global[oldName] = oldGlobals[oldName];
}
}
}
- }
+ },
+ // Option to enable or disable the generation of default exports
+ makeDefaultExport: true
};
var registry = dict();
var seen = dict();
@@ -105,10 +105,11 @@
// circular dependency so we must return our (partial) exports.
if (this.state === 'finalized' || this.state === 'reifying') {
return this.module.exports;
}
+
if (loader.wrapModules) {
this.callback = loader.wrapModules(this.id, this.callback);
}
this.reify();
@@ -118,11 +119,13 @@
this.state = 'finalized';
if (!(this.hasExportsAsDep && result === undefined)) {
this.module.exports = result;
}
- this.makeDefaultExport();
+ if (loader.makeDefaultExport) {
+ this.makeDefaultExport();
+ }
return this.module.exports;
};
Module.prototype.unsee = function () {
this.state = 'new';
@@ -276,10 +279,11 @@
function resolve(child, id) {
if (child.charAt(0) !== '.') {
return child;
}
+
var parts = child.split('/');
var nameParts = id.split('/');
var parentBase = nameParts.slice(0, -1);
for (var i = 0, l = parts.length; i < l; i++) {
@@ -3055,17 +3059,28 @@
if (this._scheduledDestroy === null) {
this._scheduledDestroy = run.schedule('destroy', this, '_checkForOrphanedInternalModels');
}
};
+ InternalModel.prototype.hasScheduledDestroy = function hasScheduledDestroy() {
+ return !!this._scheduledDestroy;
+ };
+
InternalModel.prototype.cancelDestroy = function cancelDestroy() {
this._isDematerializing = false;
run.cancel(this._scheduledDestroy);
this._scheduledDestroy = null;
};
+ InternalModel.prototype.destroySync = function destroySync() {
+ if (this._isDematerializing) {
+ this.cancelDestroy();
+ }
+ this._checkForOrphanedInternalModels();
+ };
+
InternalModel.prototype._checkForOrphanedInternalModels = function _checkForOrphanedInternalModels() {
this._isDematerializing = false;
this._scheduledDestroy = null;
if (this.isDestroyed) {
return;
@@ -12038,17 +12053,25 @@
@param {Object} data
@return {InternalModel} internal model
*/
_buildInternalModel: function (modelName, id, data) {
- var recordMap = this._internalModelsFor(modelName);
+ var internalModels = this._internalModelsFor(modelName);
+ var existingInternalModel = internalModels.get(id);
+ if (existingInternalModel && existingInternalModel.hasScheduledDestroy()) {
+ // unloadRecord is async, if one attempts to unload + then sync create,
+ // we must ensure the unload is complete before starting the create
+ existingInternalModel.destroySync();
+ existingInternalModel = null;
+ }
+
// lookupFactory should really return an object that creates
// instances with the injections applied
var internalModel = new _internalModel5.default(modelName, id, this, data);
- recordMap.add(internalModel, id);
+ internalModels.add(internalModel, id);
return internalModel;
},
buildInternalModel: function (modelName, id, data) {
return this._buildInternalModel(modelName, id, data);
@@ -17754,10 +17777,10 @@
});
define("ember-data/version", ["exports"], function (exports) {
"use strict";
exports.__esModule = true;
- exports.default = "2.14.7";
+ exports.default = "2.14.8";
});
define("ember-inflector", ["module", "exports", "ember", "ember-inflector/lib/system", "ember-inflector/lib/ext/string"], function (module, exports, _ember, _system) {
"use strict";
exports.__esModule = true;