ember-data-source 2.15.0.beta.2 → 2.15.0.beta.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dist/globals/ember-data.js +256 -117
- data/dist/globals/ember-data.min.js +6 -6
- data/dist/globals/ember-data.prod.js +256 -117
- data/package.json +3 -3
- metadata +11 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89f46fe8435761f8c85c9e6ffd3ea19552acedd4
|
4
|
+
data.tar.gz: d9b704812d614b98c36c9251c62550b5362650ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5992d8c95932387e4db709d9a343aedd0e92371fa98176c020856e993ec301a1801edc7eb77429c98acd8bc8888fefc5bb796b9a4ae9498ac5dcbae537df135b
|
7
|
+
data.tar.gz: 527a2224fbfca7a23e0bdb4b50ca523874fa205475402ac477687efe48fe7c8625815b39eaac351c1661b16ef0109c92d7b4429af91f9f1dec4a2728f4692201
|
data/dist/globals/ember-data.js
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
* @copyright Copyright 2011-2017 Tilde Inc. and contributors.
|
7
7
|
* Portions Copyright 2011 LivingSocial Inc.
|
8
8
|
* @license Licensed under MIT license (see license.js)
|
9
|
-
* @version 2.15.0-beta.
|
9
|
+
* @version 2.15.0-beta.3
|
10
10
|
*/
|
11
11
|
|
12
12
|
var loader, define, requireModule, require, requirejs;
|
@@ -14,8 +14,6 @@ var loader, define, requireModule, require, requirejs;
|
|
14
14
|
(function (global) {
|
15
15
|
'use strict';
|
16
16
|
|
17
|
-
var heimdall = global.heimdall;
|
18
|
-
|
19
17
|
function dict() {
|
20
18
|
var obj = Object.create(null);
|
21
19
|
obj['__'] = undefined;
|
@@ -32,9 +30,9 @@ var loader, define, requireModule, require, requirejs;
|
|
32
30
|
requirejs: requirejs
|
33
31
|
};
|
34
32
|
|
35
|
-
requirejs = require = requireModule = function (
|
33
|
+
requirejs = require = requireModule = function (id) {
|
36
34
|
var pending = [];
|
37
|
-
var mod = findModule(
|
35
|
+
var mod = findModule(id, '(require)', pending);
|
38
36
|
|
39
37
|
for (var i = pending.length - 1; i >= 0; i--) {
|
40
38
|
pending[i].exports();
|
@@ -57,32 +55,25 @@ var loader, define, requireModule, require, requirejs;
|
|
57
55
|
}
|
58
56
|
}
|
59
57
|
}
|
60
|
-
}
|
58
|
+
},
|
59
|
+
// Option to enable or disable the generation of default exports
|
60
|
+
makeDefaultExport: true
|
61
61
|
};
|
62
62
|
|
63
|
-
var _isArray;
|
64
|
-
if (!Array.isArray) {
|
65
|
-
_isArray = function (x) {
|
66
|
-
return Object.prototype.toString.call(x) === '[object Array]';
|
67
|
-
};
|
68
|
-
} else {
|
69
|
-
_isArray = Array.isArray;
|
70
|
-
}
|
71
|
-
|
72
63
|
var registry = dict();
|
73
64
|
var seen = dict();
|
74
65
|
|
75
66
|
var uuid = 0;
|
76
67
|
|
77
68
|
function unsupportedModule(length) {
|
78
|
-
throw new Error('an unsupported module was defined, expected `define(
|
69
|
+
throw new Error('an unsupported module was defined, expected `define(id, deps, module)` instead got: `' + length + '` arguments to define`');
|
79
70
|
}
|
80
71
|
|
81
72
|
var defaultDeps = ['require', 'exports', 'module'];
|
82
73
|
|
83
|
-
function Module(
|
84
|
-
this.
|
85
|
-
this.
|
74
|
+
function Module(id, deps, callback, alias) {
|
75
|
+
this.uuid = uuid++;
|
76
|
+
this.id = id;
|
86
77
|
this.deps = !deps.length && callback.length ? defaultDeps : deps;
|
87
78
|
this.module = { exports: {} };
|
88
79
|
this.callback = callback;
|
@@ -116,19 +107,23 @@ var loader, define, requireModule, require, requirejs;
|
|
116
107
|
return this.module.exports;
|
117
108
|
}
|
118
109
|
|
110
|
+
|
119
111
|
if (loader.wrapModules) {
|
120
|
-
this.callback = loader.wrapModules(this.
|
112
|
+
this.callback = loader.wrapModules(this.id, this.callback);
|
121
113
|
}
|
122
114
|
|
123
115
|
this.reify();
|
124
116
|
|
125
117
|
var result = this.callback.apply(this, this.reified);
|
118
|
+
this.reified.length = 0;
|
126
119
|
this.state = 'finalized';
|
127
120
|
|
128
121
|
if (!(this.hasExportsAsDep && result === undefined)) {
|
129
122
|
this.module.exports = result;
|
130
123
|
}
|
131
|
-
|
124
|
+
if (loader.makeDefaultExport) {
|
125
|
+
this.makeDefaultExport();
|
126
|
+
}
|
132
127
|
return this.module.exports;
|
133
128
|
};
|
134
129
|
|
@@ -181,27 +176,28 @@ var loader, define, requireModule, require, requirejs;
|
|
181
176
|
} else if (dep === 'module') {
|
182
177
|
entry.exports = this.module;
|
183
178
|
} else {
|
184
|
-
entry.module = findModule(resolve(dep, this.
|
179
|
+
entry.module = findModule(resolve(dep, this.id), this.id, pending);
|
185
180
|
}
|
186
181
|
}
|
187
182
|
};
|
188
183
|
|
189
184
|
Module.prototype.makeRequire = function () {
|
190
|
-
var
|
185
|
+
var id = this.id;
|
191
186
|
var r = function (dep) {
|
192
|
-
return require(resolve(dep,
|
187
|
+
return require(resolve(dep, id));
|
193
188
|
};
|
194
189
|
r['default'] = r;
|
190
|
+
r.moduleId = id;
|
195
191
|
r.has = function (dep) {
|
196
|
-
return has(resolve(dep,
|
192
|
+
return has(resolve(dep, id));
|
197
193
|
};
|
198
194
|
return r;
|
199
195
|
};
|
200
196
|
|
201
|
-
define = function (
|
202
|
-
var module = registry[
|
197
|
+
define = function (id, deps, callback) {
|
198
|
+
var module = registry[id];
|
203
199
|
|
204
|
-
// If a module for this
|
200
|
+
// If a module for this id has already been defined and is in any state
|
205
201
|
// other than `new` (meaning it has been or is currently being required),
|
206
202
|
// then we return early to avoid redefinition.
|
207
203
|
if (module && module.state !== 'new') {
|
@@ -212,42 +208,65 @@ var loader, define, requireModule, require, requirejs;
|
|
212
208
|
unsupportedModule(arguments.length);
|
213
209
|
}
|
214
210
|
|
215
|
-
if (!
|
211
|
+
if (!Array.isArray(deps)) {
|
216
212
|
callback = deps;
|
217
213
|
deps = [];
|
218
214
|
}
|
219
215
|
|
220
216
|
if (callback instanceof Alias) {
|
221
|
-
registry[
|
217
|
+
registry[id] = new Module(callback.id, deps, callback, true);
|
222
218
|
} else {
|
223
|
-
registry[
|
219
|
+
registry[id] = new Module(id, deps, callback, false);
|
220
|
+
}
|
221
|
+
};
|
222
|
+
|
223
|
+
define.exports = function (name, defaultExport) {
|
224
|
+
var module = registry[name];
|
225
|
+
|
226
|
+
// If a module for this name has already been defined and is in any state
|
227
|
+
// other than `new` (meaning it has been or is currently being required),
|
228
|
+
// then we return early to avoid redefinition.
|
229
|
+
if (module && module.state !== 'new') {
|
230
|
+
return;
|
224
231
|
}
|
232
|
+
|
233
|
+
module = new Module(name, [], noop, null);
|
234
|
+
module.module.exports = defaultExport;
|
235
|
+
module.state = 'finalized';
|
236
|
+
registry[name] = module;
|
237
|
+
|
238
|
+
return module;
|
225
239
|
};
|
226
240
|
|
241
|
+
function noop() {}
|
227
242
|
// we don't support all of AMD
|
228
243
|
// define.amd = {};
|
229
244
|
|
230
|
-
function Alias(
|
231
|
-
this.
|
245
|
+
function Alias(id) {
|
246
|
+
this.id = id;
|
232
247
|
}
|
233
248
|
|
234
|
-
define.alias = function (
|
235
|
-
|
249
|
+
define.alias = function (id, target) {
|
250
|
+
if (arguments.length === 2) {
|
251
|
+
return define(target, new Alias(id));
|
252
|
+
}
|
253
|
+
|
254
|
+
return new Alias(id);
|
236
255
|
};
|
237
256
|
|
238
|
-
function missingModule(
|
239
|
-
throw new Error('Could not find module `' +
|
257
|
+
function missingModule(id, referrer) {
|
258
|
+
throw new Error('Could not find module `' + id + '` imported from `' + referrer + '`');
|
240
259
|
}
|
241
260
|
|
242
|
-
function findModule(
|
243
|
-
var mod = registry[
|
261
|
+
function findModule(id, referrer, pending) {
|
262
|
+
var mod = registry[id] || registry[id + '/index'];
|
244
263
|
|
245
264
|
while (mod && mod.isAlias) {
|
246
|
-
mod = registry[mod.
|
265
|
+
mod = registry[mod.id];
|
247
266
|
}
|
248
267
|
|
249
268
|
if (!mod) {
|
250
|
-
missingModule(
|
269
|
+
missingModule(id, referrer);
|
251
270
|
}
|
252
271
|
|
253
272
|
if (pending && mod.state !== 'pending' && mod.state !== 'finalized') {
|
@@ -257,13 +276,14 @@ var loader, define, requireModule, require, requirejs;
|
|
257
276
|
return mod;
|
258
277
|
}
|
259
278
|
|
260
|
-
function resolve(child,
|
279
|
+
function resolve(child, id) {
|
261
280
|
if (child.charAt(0) !== '.') {
|
262
281
|
return child;
|
263
282
|
}
|
264
283
|
|
284
|
+
|
265
285
|
var parts = child.split('/');
|
266
|
-
var nameParts =
|
286
|
+
var nameParts = id.split('/');
|
267
287
|
var parentBase = nameParts.slice(0, -1);
|
268
288
|
|
269
289
|
for (var i = 0, l = parts.length; i < l; i++) {
|
@@ -284,14 +304,14 @@ var loader, define, requireModule, require, requirejs;
|
|
284
304
|
return parentBase.join('/');
|
285
305
|
}
|
286
306
|
|
287
|
-
function has(
|
288
|
-
return !!(registry[
|
307
|
+
function has(id) {
|
308
|
+
return !!(registry[id] || registry[id + '/index']);
|
289
309
|
}
|
290
310
|
|
291
311
|
requirejs.entries = requirejs._eak_seen = registry;
|
292
312
|
requirejs.has = has;
|
293
|
-
requirejs.unsee = function (
|
294
|
-
findModule(
|
313
|
+
requirejs.unsee = function (id) {
|
314
|
+
findModule(id, '(unsee)', false).unsee();
|
295
315
|
};
|
296
316
|
|
297
317
|
requirejs.clear = function () {
|
@@ -310,9 +330,12 @@ var loader, define, requireModule, require, requirejs;
|
|
310
330
|
});
|
311
331
|
define('foo/baz', [], define.alias('foo'));
|
312
332
|
define('foo/quz', define.alias('foo'));
|
333
|
+
define.alias('foo', 'foo/qux');
|
313
334
|
define('foo/bar', ['foo', './quz', './baz', './asdf', './bar', '../foo'], function () {});
|
314
335
|
define('foo/main', ['foo/bar'], function () {});
|
336
|
+
define.exports('foo/exports', {});
|
315
337
|
|
338
|
+
require('foo/exports');
|
316
339
|
require('foo/main');
|
317
340
|
require.unsee('foo/bar');
|
318
341
|
|
@@ -3008,17 +3031,11 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
3008
3031
|
};
|
3009
3032
|
|
3010
3033
|
InternalModel.prototype._directlyRelatedInternalModels = function _directlyRelatedInternalModels() {
|
3011
|
-
var _this = this;
|
3012
|
-
|
3013
3034
|
var array = [];
|
3014
|
-
this.
|
3015
|
-
|
3016
|
-
|
3017
|
-
|
3018
|
-
var serverRelationships = _relationship.canonicalMembers.toArray();
|
3019
|
-
|
3020
|
-
array = array.concat(localRelationships, serverRelationships);
|
3021
|
-
}
|
3035
|
+
this._relationships.forEach(function (name, rel) {
|
3036
|
+
var local = rel.members.toArray();
|
3037
|
+
var server = rel.canonicalMembers.toArray();
|
3038
|
+
array = array.concat(local, server);
|
3022
3039
|
});
|
3023
3040
|
return array;
|
3024
3041
|
};
|
@@ -3049,6 +3066,7 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
3049
3066
|
InternalModel.prototype.unloadRecord = function unloadRecord() {
|
3050
3067
|
this.send('unloadRecord');
|
3051
3068
|
this.dematerializeRecord();
|
3069
|
+
|
3052
3070
|
if (this._scheduledDestroy === null) {
|
3053
3071
|
this._scheduledDestroy = run.schedule('destroy', this, '_checkForOrphanedInternalModels');
|
3054
3072
|
}
|
@@ -3094,6 +3112,11 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
3094
3112
|
|
3095
3113
|
|
3096
3114
|
this.store._internalModelDestroyed(this);
|
3115
|
+
|
3116
|
+
this._relationships.forEach(function (name, rel) {
|
3117
|
+
return rel.destroy();
|
3118
|
+
});
|
3119
|
+
|
3097
3120
|
this._isDestroyed = true;
|
3098
3121
|
};
|
3099
3122
|
|
@@ -3222,12 +3245,6 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
3222
3245
|
}
|
3223
3246
|
};
|
3224
3247
|
|
3225
|
-
InternalModel.prototype.notifyHasManyRemoved = function notifyHasManyRemoved(key, record, idx) {
|
3226
|
-
if (this.hasRecord) {
|
3227
|
-
this._record.notifyHasManyRemoved(key, record, idx);
|
3228
|
-
}
|
3229
|
-
};
|
3230
|
-
|
3231
3248
|
InternalModel.prototype.notifyBelongsToChanged = function notifyBelongsToChanged(key, record) {
|
3232
3249
|
if (this.hasRecord) {
|
3233
3250
|
this._record.notifyBelongsToChanged(key, record);
|
@@ -3261,7 +3278,7 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
3261
3278
|
}
|
3262
3279
|
|
3263
3280
|
if (this.isNew()) {
|
3264
|
-
this.
|
3281
|
+
this.removeFromInverseRelationships(true);
|
3265
3282
|
}
|
3266
3283
|
|
3267
3284
|
if (this.isValid()) {
|
@@ -3377,47 +3394,68 @@ define('ember-data/-private/system/model/internal-model', ['exports', 'ember', '
|
|
3377
3394
|
triggers.length = 0;
|
3378
3395
|
};
|
3379
3396
|
|
3380
|
-
InternalModel.prototype.
|
3381
|
-
var
|
3397
|
+
InternalModel.prototype.removeFromInverseRelationships = function removeFromInverseRelationships() {
|
3398
|
+
var isNew = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
3382
3399
|
|
3383
|
-
this.
|
3384
|
-
|
3385
|
-
|
3400
|
+
this._relationships.forEach(function (name, rel) {
|
3401
|
+
rel.removeCompletelyFromInverse();
|
3402
|
+
if (isNew === true) {
|
3386
3403
|
rel.clear();
|
3387
|
-
rel.removeInverseRelationships();
|
3388
3404
|
}
|
3389
3405
|
});
|
3390
|
-
|
3391
|
-
|
3392
|
-
|
3406
|
+
|
3407
|
+
var implicitRelationships = this._implicitRelationships;
|
3408
|
+
this.__implicitRelationships = null;
|
3409
|
+
|
3410
|
+
Object.keys(implicitRelationships).forEach(function (key) {
|
3411
|
+
var rel = implicitRelationships[key];
|
3412
|
+
|
3413
|
+
rel.removeCompletelyFromInverse();
|
3414
|
+
if (isNew === true) {
|
3415
|
+
rel.clear();
|
3416
|
+
}
|
3393
3417
|
});
|
3394
3418
|
};
|
3395
3419
|
|
3396
3420
|
InternalModel.prototype.destroyRelationships = function destroyRelationships() {
|
3397
|
-
var
|
3421
|
+
var _this = this;
|
3398
3422
|
|
3399
|
-
this.
|
3400
|
-
if (
|
3401
|
-
|
3423
|
+
this._relationships.forEach(function (name, rel) {
|
3424
|
+
if (rel._inverseIsAsync()) {
|
3425
|
+
rel.removeInternalModelFromInverse(_this);
|
3402
3426
|
rel.removeInverseRelationships();
|
3427
|
+
} else {
|
3428
|
+
rel.removeCompletelyFromInverse();
|
3403
3429
|
}
|
3404
3430
|
});
|
3405
|
-
|
3406
|
-
|
3431
|
+
|
3432
|
+
var implicitRelationships = this._implicitRelationships;
|
3433
|
+
this.__implicitRelationships = null;
|
3434
|
+
Object.keys(implicitRelationships).forEach(function (key) {
|
3435
|
+
var rel = implicitRelationships[key];
|
3436
|
+
|
3437
|
+
if (rel._inverseIsAsync()) {
|
3438
|
+
rel.removeInternalModelFromInverse(_this);
|
3439
|
+
rel.removeInverseRelationships();
|
3440
|
+
} else {
|
3441
|
+
rel.removeCompletelyFromInverse();
|
3442
|
+
}
|
3443
|
+
|
3444
|
+
rel.destroy();
|
3407
3445
|
});
|
3408
3446
|
};
|
3409
3447
|
|
3410
3448
|
InternalModel.prototype.preloadData = function preloadData(preload) {
|
3411
|
-
var
|
3449
|
+
var _this2 = this;
|
3412
3450
|
|
3413
3451
|
//TODO(Igor) consider the polymorphic case
|
3414
3452
|
Object.keys(preload).forEach(function (key) {
|
3415
3453
|
var preloadValue = get(preload, key);
|
3416
|
-
var relationshipMeta =
|
3454
|
+
var relationshipMeta = _this2.modelClass.metaForProperty(key);
|
3417
3455
|
if (relationshipMeta.isRelationship) {
|
3418
|
-
|
3456
|
+
_this2._preloadRelationship(key, preloadValue);
|
3419
3457
|
} else {
|
3420
|
-
|
3458
|
+
_this2._data[key] = preloadValue;
|
3421
3459
|
}
|
3422
3460
|
});
|
3423
3461
|
};
|
@@ -5512,7 +5550,7 @@ define('ember-data/-private/system/model/states', ['exports'], function (exports
|
|
5512
5550
|
isDirty: false,
|
5513
5551
|
|
5514
5552
|
setup: function (internalModel) {
|
5515
|
-
internalModel.
|
5553
|
+
internalModel.removeFromInverseRelationships();
|
5516
5554
|
},
|
5517
5555
|
invokeLifecycleCallbacks: function (internalModel) {
|
5518
5556
|
internalModel.triggerLater('didDelete', internalModel);
|
@@ -8388,13 +8426,12 @@ define('ember-data/-private/system/relationships/relationship-payloads', ['expor
|
|
8388
8426
|
id: id,
|
8389
8427
|
type: modelName
|
8390
8428
|
}
|
8391
|
-
};
|
8392
8429
|
|
8393
|
-
|
8394
|
-
|
8395
|
-
|
8396
|
-
|
8397
|
-
var previousPayload = void 0;
|
8430
|
+
// start flushing this individual payload. The logic is the same whether
|
8431
|
+
// it's for the left hand side of the relationship or the right hand side,
|
8432
|
+
// except the role of primary and inverse idToPayloads is reversed
|
8433
|
+
//
|
8434
|
+
};var previousPayload = void 0;
|
8398
8435
|
var idToPayloads = void 0;
|
8399
8436
|
var inverseIdToPayloads = void 0;
|
8400
8437
|
var inverseIsMany = void 0;
|
@@ -8660,6 +8697,19 @@ define('ember-data/-private/system/relationships/state/belongs-to', ['exports',
|
|
8660
8697
|
this.notifyBelongsToChanged();
|
8661
8698
|
};
|
8662
8699
|
|
8700
|
+
BelongsToRelationship.prototype.removeCompletelyFromOwn = function removeCompletelyFromOwn(internalModel) {
|
8701
|
+
_Relationship.prototype.removeCompletelyFromOwn.call(this, internalModel);
|
8702
|
+
|
8703
|
+
if (this.canonicalState === internalModel) {
|
8704
|
+
this.canonicalState = null;
|
8705
|
+
}
|
8706
|
+
|
8707
|
+
if (this.inverseInternalModel === internalModel) {
|
8708
|
+
this.inverseInternalModel = null;
|
8709
|
+
this.notifyBelongsToChanged();
|
8710
|
+
}
|
8711
|
+
};
|
8712
|
+
|
8663
8713
|
BelongsToRelationship.prototype.flushCanonical = function flushCanonical() {
|
8664
8714
|
//temporary fix to not remove newly created records if server returned null.
|
8665
8715
|
//TODO remove once we have proper diffing
|
@@ -8874,6 +8924,13 @@ define("ember-data/-private/system/relationships/state/create", ["exports", "emb
|
|
8874
8924
|
return !!this.initializedRelationships[key];
|
8875
8925
|
};
|
8876
8926
|
|
8927
|
+
Relationships.prototype.forEach = function forEach(cb) {
|
8928
|
+
var rels = this.initializedRelationships;
|
8929
|
+
Object.keys(rels).forEach(function (name) {
|
8930
|
+
cb(name, rels[name]);
|
8931
|
+
});
|
8932
|
+
};
|
8933
|
+
|
8877
8934
|
Relationships.prototype.get = function get(key) {
|
8878
8935
|
var relationships = this.initializedRelationships;
|
8879
8936
|
var relationship = relationships[key];
|
@@ -9060,6 +9117,26 @@ define('ember-data/-private/system/relationships/state/has-many', ['exports', 'e
|
|
9060
9117
|
_Relationship.prototype.removeCanonicalInternalModelFromOwn.call(this, internalModel, idx);
|
9061
9118
|
};
|
9062
9119
|
|
9120
|
+
ManyRelationship.prototype.removeCompletelyFromOwn = function removeCompletelyFromOwn(internalModel) {
|
9121
|
+
_Relationship.prototype.removeCompletelyFromOwn.call(this, internalModel);
|
9122
|
+
|
9123
|
+
var canonicalIndex = this.canonicalState.indexOf(internalModel);
|
9124
|
+
|
9125
|
+
if (canonicalIndex !== -1) {
|
9126
|
+
this.canonicalState.splice(canonicalIndex, 1);
|
9127
|
+
}
|
9128
|
+
|
9129
|
+
var manyArray = this._manyArray;
|
9130
|
+
|
9131
|
+
if (manyArray) {
|
9132
|
+
var idx = manyArray.currentState.indexOf(internalModel);
|
9133
|
+
|
9134
|
+
if (idx !== -1) {
|
9135
|
+
manyArray.internalReplace(idx, 1);
|
9136
|
+
}
|
9137
|
+
}
|
9138
|
+
};
|
9139
|
+
|
9063
9140
|
ManyRelationship.prototype.flushCanonical = function flushCanonical() {
|
9064
9141
|
if (this._manyArray) {
|
9065
9142
|
this._manyArray.flushCanonical();
|
@@ -9136,33 +9213,41 @@ define('ember-data/-private/system/relationships/state/has-many', ['exports', 'e
|
|
9136
9213
|
};
|
9137
9214
|
|
9138
9215
|
ManyRelationship.prototype.setInitialInternalModels = function setInitialInternalModels(internalModels) {
|
9139
|
-
var
|
9216
|
+
var _canonicalState;
|
9140
9217
|
|
9141
|
-
if (
|
9218
|
+
if (Array.isArray(internalModels) === false || internalModels.length === 0) {
|
9142
9219
|
return;
|
9143
9220
|
}
|
9144
9221
|
|
9145
|
-
var
|
9146
|
-
|
9147
|
-
internalModels.
|
9148
|
-
|
9149
|
-
|
9150
|
-
|
9151
|
-
|
9222
|
+
var forCanonical = [];
|
9223
|
+
|
9224
|
+
for (var i = 0; i < internalModels.length; i++) {
|
9225
|
+
var internalModel = internalModels[i];
|
9226
|
+
if (this.canonicalMembers.has(internalModel)) {
|
9227
|
+
continue;
|
9228
|
+
}
|
9229
|
+
|
9230
|
+
forCanonical.push(internalModel);
|
9231
|
+
this.canonicalMembers.add(internalModel);
|
9232
|
+
this.members.add(internalModel);
|
9233
|
+
this.setupInverseRelationship(internalModel);
|
9234
|
+
}
|
9235
|
+
|
9236
|
+
(_canonicalState = this.canonicalState).splice.apply(_canonicalState, [0, this.canonicalState.length].concat(forCanonical));
|
9152
9237
|
};
|
9153
9238
|
|
9154
9239
|
ManyRelationship.prototype.fetchLink = function fetchLink() {
|
9155
|
-
var
|
9240
|
+
var _this2 = this;
|
9156
9241
|
|
9157
9242
|
return this.store.findHasMany(this.internalModel, this.link, this.relationshipMeta).then(function (records) {
|
9158
9243
|
if (records.hasOwnProperty('meta')) {
|
9159
|
-
|
9244
|
+
_this2.updateMeta(records.meta);
|
9160
9245
|
}
|
9161
|
-
|
9162
|
-
|
9163
|
-
|
9246
|
+
_this2.store._backburner.join(function () {
|
9247
|
+
_this2.updateInternalModelsFromAdapter(records);
|
9248
|
+
_this2.manyArray.set('isLoaded', true);
|
9164
9249
|
});
|
9165
|
-
return
|
9250
|
+
return _this2.manyArray;
|
9166
9251
|
});
|
9167
9252
|
};
|
9168
9253
|
|
@@ -9185,7 +9270,7 @@ define('ember-data/-private/system/relationships/state/has-many', ['exports', 'e
|
|
9185
9270
|
};
|
9186
9271
|
|
9187
9272
|
ManyRelationship.prototype.getRecords = function getRecords() {
|
9188
|
-
var
|
9273
|
+
var _this3 = this;
|
9189
9274
|
|
9190
9275
|
//TODO(Igor) sync server here, once our syncing is not stupid
|
9191
9276
|
var manyArray = this.manyArray;
|
@@ -9196,7 +9281,7 @@ define('ember-data/-private/system/relationships/state/has-many', ['exports', 'e
|
|
9196
9281
|
promise = this.findRecords();
|
9197
9282
|
} else {
|
9198
9283
|
promise = this.findLink().then(function () {
|
9199
|
-
return
|
9284
|
+
return _this3.findRecords();
|
9200
9285
|
});
|
9201
9286
|
}
|
9202
9287
|
} else {
|
@@ -9225,6 +9310,20 @@ define('ember-data/-private/system/relationships/state/has-many', ['exports', 'e
|
|
9225
9310
|
}
|
9226
9311
|
};
|
9227
9312
|
|
9313
|
+
ManyRelationship.prototype.destroy = function destroy() {
|
9314
|
+
_Relationship.prototype.destroy.call(this);
|
9315
|
+
var manyArray = this._manyArray;
|
9316
|
+
if (manyArray) {
|
9317
|
+
manyArray.destroy();
|
9318
|
+
}
|
9319
|
+
|
9320
|
+
var proxy = this.__loadingPromise;
|
9321
|
+
|
9322
|
+
if (proxy) {
|
9323
|
+
proxy.destroy();
|
9324
|
+
}
|
9325
|
+
};
|
9326
|
+
|
9228
9327
|
_createClass(ManyRelationship, [{
|
9229
9328
|
key: '_loadingPromise',
|
9230
9329
|
get: function () {
|
@@ -9266,7 +9365,7 @@ define('ember-data/-private/system/relationships/state/has-many', ['exports', 'e
|
|
9266
9365
|
return set;
|
9267
9366
|
}
|
9268
9367
|
});
|
9269
|
-
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) {
|
9368
|
+
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) {
|
9270
9369
|
'use strict';
|
9271
9370
|
|
9272
9371
|
exports.__esModule = true;
|
@@ -9295,6 +9394,8 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
|
|
9295
9394
|
};
|
9296
9395
|
}();
|
9297
9396
|
|
9397
|
+
var guidFor = _ember.default.guidFor;
|
9398
|
+
|
9298
9399
|
var Relationship = function () {
|
9299
9400
|
function Relationship(store, internalModel, inverseKey, relationshipMeta) {
|
9300
9401
|
_classCallCheck(this, Relationship);
|
@@ -9319,6 +9420,13 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
|
|
9319
9420
|
this.hasLoaded = false;
|
9320
9421
|
}
|
9321
9422
|
|
9423
|
+
Relationship.prototype._inverseIsAsync = function _inverseIsAsync() {
|
9424
|
+
if (!this.inverseKey || !this.inverseInternalModel) {
|
9425
|
+
return false;
|
9426
|
+
}
|
9427
|
+
return this.inverseInternalModel._relationships.get(this.inverseKey).isAsync;
|
9428
|
+
};
|
9429
|
+
|
9322
9430
|
Relationship.prototype.removeInverseRelationships = function removeInverseRelationships() {
|
9323
9431
|
var _this = this;
|
9324
9432
|
|
@@ -9413,7 +9521,7 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
|
|
9413
9521
|
var _relationships = internalModel._implicitRelationships;
|
9414
9522
|
var _relationship = _relationships[this.inverseKeyForImplicit];
|
9415
9523
|
if (!_relationship) {
|
9416
|
-
_relationship = _relationships[this.inverseKeyForImplicit] = new Relationship(this.store, internalModel, this.key, { options: {} });
|
9524
|
+
_relationship = _relationships[this.inverseKeyForImplicit] = new Relationship(this.store, internalModel, this.key, { options: { async: this.isAsync } });
|
9417
9525
|
}
|
9418
9526
|
_relationship.addCanonicalInternalModel(this.internalModel);
|
9419
9527
|
}
|
@@ -9451,7 +9559,7 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
|
|
9451
9559
|
internalModel._relationships.get(this.inverseKey).addInternalModel(this.internalModel);
|
9452
9560
|
} else {
|
9453
9561
|
if (!internalModel._implicitRelationships[this.inverseKeyForImplicit]) {
|
9454
|
-
internalModel._implicitRelationships[this.inverseKeyForImplicit] = new Relationship(this.store, internalModel, this.key, { options: {} });
|
9562
|
+
internalModel._implicitRelationships[this.inverseKeyForImplicit] = new Relationship(this.store, internalModel, this.key, { options: { async: this.isAsync } });
|
9455
9563
|
}
|
9456
9564
|
internalModel._implicitRelationships[this.inverseKeyForImplicit].addInternalModel(this.internalModel);
|
9457
9565
|
}
|
@@ -9483,7 +9591,6 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
|
|
9483
9591
|
|
9484
9592
|
Relationship.prototype.removeInternalModelFromOwn = function removeInternalModelFromOwn(internalModel) {
|
9485
9593
|
this.members.delete(internalModel);
|
9486
|
-
this.notifyRecordRelationshipRemoved(internalModel);
|
9487
9594
|
this.internalModel.updateRecordArrays();
|
9488
9595
|
};
|
9489
9596
|
|
@@ -9500,6 +9607,38 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
|
|
9500
9607
|
this.flushCanonicalLater();
|
9501
9608
|
};
|
9502
9609
|
|
9610
|
+
Relationship.prototype.removeCompletelyFromInverse = function removeCompletelyFromInverse() {
|
9611
|
+
var _this4 = this;
|
9612
|
+
|
9613
|
+
if (!this.inverseKey) {
|
9614
|
+
return;
|
9615
|
+
}
|
9616
|
+
|
9617
|
+
// we actually want a union of members and canonicalMembers
|
9618
|
+
// they should be disjoint but currently are not due to a bug
|
9619
|
+
var seen = Object.create(null);
|
9620
|
+
var internalModel = this.internalModel;
|
9621
|
+
|
9622
|
+
var unload = function (inverseInternalModel) {
|
9623
|
+
var id = guidFor(inverseInternalModel);
|
9624
|
+
|
9625
|
+
if (seen[id] === undefined) {
|
9626
|
+
var relationship = inverseInternalModel._relationships.get(_this4.inverseKey);
|
9627
|
+
relationship.removeCompletelyFromOwn(internalModel);
|
9628
|
+
seen[id] = true;
|
9629
|
+
}
|
9630
|
+
};
|
9631
|
+
|
9632
|
+
this.members.forEach(unload);
|
9633
|
+
this.canonicalMembers.forEach(unload);
|
9634
|
+
};
|
9635
|
+
|
9636
|
+
Relationship.prototype.removeCompletelyFromOwn = function removeCompletelyFromOwn(internalModel) {
|
9637
|
+
this.canonicalMembers.delete(internalModel);
|
9638
|
+
this.members.delete(internalModel);
|
9639
|
+
this.internalModel.updateRecordArrays();
|
9640
|
+
};
|
9641
|
+
|
9503
9642
|
Relationship.prototype.flushCanonical = function flushCanonical() {
|
9504
9643
|
var list = this.members.list;
|
9505
9644
|
this.willSync = false;
|
@@ -9528,10 +9667,10 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
|
|
9528
9667
|
};
|
9529
9668
|
|
9530
9669
|
Relationship.prototype.updateLink = function updateLink(link) {
|
9531
|
-
(false &&
|
9670
|
+
(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, {
|
9532
9671
|
id: 'ds.store.push-link-for-sync-relationship'
|
9533
9672
|
}));
|
9534
|
-
(false &&
|
9673
|
+
(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));
|
9535
9674
|
|
9536
9675
|
|
9537
9676
|
this.link = link;
|
@@ -9559,8 +9698,6 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
|
|
9559
9698
|
|
9560
9699
|
Relationship.prototype.notifyRecordRelationshipAdded = function notifyRecordRelationshipAdded() {};
|
9561
9700
|
|
9562
|
-
Relationship.prototype.notifyRecordRelationshipRemoved = function notifyRecordRelationshipRemoved() {};
|
9563
|
-
|
9564
9701
|
Relationship.prototype.setHasData = function setHasData(value) {
|
9565
9702
|
this.hasData = value;
|
9566
9703
|
};
|
@@ -9611,6 +9748,8 @@ define('ember-data/-private/system/relationships/state/relationship', ['exports'
|
|
9611
9748
|
|
9612
9749
|
Relationship.prototype.updateData = function updateData() {};
|
9613
9750
|
|
9751
|
+
Relationship.prototype.destroy = function destroy() {};
|
9752
|
+
|
9614
9753
|
_createClass(Relationship, [{
|
9615
9754
|
key: 'parentType',
|
9616
9755
|
get: function () {
|
@@ -15351,7 +15490,7 @@ define('ember-data/initializers/data-adapter', ['exports'], function (exports) {
|
|
15351
15490
|
initialize: function () {}
|
15352
15491
|
};
|
15353
15492
|
});
|
15354
|
-
define('ember-data/initializers/ember-data', ['exports', 'ember-data/setup-container', 'ember-data
|
15493
|
+
define('ember-data/initializers/ember-data', ['exports', 'ember-data/setup-container', 'ember-data'], function (exports, _setupContainer) {
|
15355
15494
|
'use strict';
|
15356
15495
|
|
15357
15496
|
exports.__esModule = true;
|
@@ -18301,7 +18440,7 @@ define("ember-data/version", ["exports"], function (exports) {
|
|
18301
18440
|
"use strict";
|
18302
18441
|
|
18303
18442
|
exports.__esModule = true;
|
18304
|
-
exports.default = "2.15.0-beta.
|
18443
|
+
exports.default = "2.15.0-beta.3";
|
18305
18444
|
});
|
18306
18445
|
define("ember-inflector", ["module", "exports", "ember", "ember-inflector/lib/system", "ember-inflector/lib/ext/string"], function (module, exports, _ember, _system) {
|
18307
18446
|
"use strict";
|