@ember-data/store 4.12.0-beta.1 → 4.12.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/addon/-private.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { C as AdapterPopulatedRecordArray,
|
|
1
|
+
export { C as AdapterPopulatedRecordArray, j as IDENTIFIER_ARRAY_TAG, I as IdentifierArray, M as MUTATE, I as RecordArray, R as RecordArrayManager, h as SOURCE, a as Snapshot, l as SnapshotRecordArray, S as Store, f as coerceId, k as fastPush, i as isStableIdentifier, n as normalizeModelName, g as notifyArray, m as recordDataFor, r as recordIdentifierFor, o as removeRecordDataFor, d as setIdentifierForgetMethod, b as setIdentifierGenerationMethod, e as setIdentifierResetMethod, c as setIdentifierUpdateMethod, s as storeFor } from "./index-6511184b";
|
|
@@ -6,10 +6,12 @@ import { _backburner } from '@ember/runloop';
|
|
|
6
6
|
import { registerWaiter, unregisterWaiter } from '@ember/test';
|
|
7
7
|
import RSVP, { resolve, Promise as Promise$1, reject } from 'rsvp';
|
|
8
8
|
import { tracked } from '@glimmer/tracking';
|
|
9
|
-
import { subscribe, addToTransaction } from '@ember-data/tracking/-private';
|
|
9
|
+
import { subscribe, addToTransaction, addTransactionCB } from '@ember-data/tracking/-private';
|
|
10
|
+
import { tagForProperty } from '@ember/-internals/metal';
|
|
10
11
|
import { get, set } from '@ember/object';
|
|
11
12
|
import { dependentKeyCompat } from '@ember/object/compat';
|
|
12
13
|
import { compare } from '@ember/utils';
|
|
14
|
+
import { dirtyTag } from '@glimmer/validator';
|
|
13
15
|
import Ember from 'ember';
|
|
14
16
|
import { reads } from '@ember/object/computed';
|
|
15
17
|
import ArrayProxy from '@ember/array/proxy';
|
|
@@ -3535,6 +3537,16 @@ function isArraySetter(prop) {
|
|
|
3535
3537
|
const IDENTIFIER_ARRAY_TAG = Symbol('#tag');
|
|
3536
3538
|
const SOURCE = Symbol('#source');
|
|
3537
3539
|
const MUTATE = Symbol('#update');
|
|
3540
|
+
const NOTIFY = Symbol('#notify');
|
|
3541
|
+
function notifyArray(arr) {
|
|
3542
|
+
arr[IDENTIFIER_ARRAY_TAG].ref = null;
|
|
3543
|
+
if (macroCondition(getOwnConfig().deprecations.DEPRECATE_COMPUTED_CHAINS)) {
|
|
3544
|
+
// eslint-disable-next-line
|
|
3545
|
+
dirtyTag(tagForProperty(arr, 'length'));
|
|
3546
|
+
// eslint-disable-next-line
|
|
3547
|
+
dirtyTag(tagForProperty(arr, '[]'));
|
|
3548
|
+
}
|
|
3549
|
+
}
|
|
3538
3550
|
function convertToInt(prop) {
|
|
3539
3551
|
if (typeof prop === 'symbol') return null;
|
|
3540
3552
|
const num = Number(prop);
|
|
@@ -3613,12 +3625,15 @@ let IdentifierArray = (_class3 = class IdentifierArray {
|
|
|
3613
3625
|
@type Boolean
|
|
3614
3626
|
*/
|
|
3615
3627
|
|
|
3628
|
+
[NOTIFY]() {
|
|
3629
|
+
notifyArray(this);
|
|
3630
|
+
}
|
|
3616
3631
|
destroy() {
|
|
3617
3632
|
this.isDestroying = true;
|
|
3618
3633
|
// changing the reference breaks the Proxy
|
|
3619
3634
|
// this[SOURCE] = [];
|
|
3620
3635
|
this[SOURCE].length = 0;
|
|
3621
|
-
this[
|
|
3636
|
+
this[NOTIFY]();
|
|
3622
3637
|
this.isDestroyed = true;
|
|
3623
3638
|
}
|
|
3624
3639
|
|
|
@@ -3629,6 +3644,14 @@ let IdentifierArray = (_class3 = class IdentifierArray {
|
|
|
3629
3644
|
set length(value) {
|
|
3630
3645
|
this[SOURCE].length = value;
|
|
3631
3646
|
}
|
|
3647
|
+
|
|
3648
|
+
// here to support computed chains
|
|
3649
|
+
// and {{#each}}
|
|
3650
|
+
get '[]'() {
|
|
3651
|
+
if (macroCondition(getOwnConfig().deprecations.DEPRECATE_COMPUTED_CHAINS)) {
|
|
3652
|
+
return this;
|
|
3653
|
+
}
|
|
3654
|
+
}
|
|
3632
3655
|
constructor(options) {
|
|
3633
3656
|
_initializerDefineProperty(this, "isUpdating", _descriptor2, this);
|
|
3634
3657
|
this.isLoaded = true;
|
|
@@ -3734,6 +3757,9 @@ let IdentifierArray = (_class3 = class IdentifierArray {
|
|
|
3734
3757
|
return receiver[receiver.length - 1];
|
|
3735
3758
|
}
|
|
3736
3759
|
}
|
|
3760
|
+
if (prop === NOTIFY || prop === IDENTIFIER_ARRAY_TAG || prop === SOURCE) {
|
|
3761
|
+
return self[prop];
|
|
3762
|
+
}
|
|
3737
3763
|
let fn = boundFns.get(prop);
|
|
3738
3764
|
if (fn) return fn;
|
|
3739
3765
|
let outcome = self[prop];
|
|
@@ -3830,6 +3856,7 @@ let IdentifierArray = (_class3 = class IdentifierArray {
|
|
|
3830
3856
|
assert(`Do not call A() on EmberData RecordArrays`);
|
|
3831
3857
|
};
|
|
3832
3858
|
}
|
|
3859
|
+
this[NOTIFY] = this[NOTIFY].bind(proxy);
|
|
3833
3860
|
return proxy;
|
|
3834
3861
|
}
|
|
3835
3862
|
|
|
@@ -3958,7 +3985,7 @@ class Collection extends IdentifierArray {
|
|
|
3958
3985
|
Collection.prototype.query = null;
|
|
3959
3986
|
|
|
3960
3987
|
// Ensure instanceof works correctly
|
|
3961
|
-
//
|
|
3988
|
+
//Object.setPrototypeOf(IdentifierArray.prototype, Array.prototype);
|
|
3962
3989
|
|
|
3963
3990
|
if (macroCondition(getOwnConfig().deprecations.DEPRECATE_ARRAY_LIKE)) {
|
|
3964
3991
|
IdentifierArray.prototype.DEPRECATED_CLASS_NAME = 'RecordArray';
|
|
@@ -4403,9 +4430,9 @@ class RecordArrayManager {
|
|
|
4403
4430
|
let tag = array[IDENTIFIER_ARRAY_TAG];
|
|
4404
4431
|
if (!tag.shouldReset) {
|
|
4405
4432
|
tag.shouldReset = true;
|
|
4406
|
-
|
|
4407
|
-
} else if (delta > 0 && tag.t) {
|
|
4408
|
-
|
|
4433
|
+
addTransactionCB(array[NOTIFY]);
|
|
4434
|
+
} else if (delta > 0 && !tag.t) {
|
|
4435
|
+
addTransactionCB(array[NOTIFY]);
|
|
4409
4436
|
}
|
|
4410
4437
|
}
|
|
4411
4438
|
_getPendingFor(identifier, includeManaged, isRemove) {
|
|
@@ -4462,7 +4489,7 @@ class RecordArrayManager {
|
|
|
4462
4489
|
const old = source.slice();
|
|
4463
4490
|
source.length = 0;
|
|
4464
4491
|
fastPush(source, identifiers);
|
|
4465
|
-
array
|
|
4492
|
+
notifyArray(array);
|
|
4466
4493
|
array.meta = payload.meta || null;
|
|
4467
4494
|
array.links = payload.links || null;
|
|
4468
4495
|
array.isLoaded = true;
|
|
@@ -7660,4 +7687,4 @@ function normalizeModelName(modelName) {
|
|
|
7660
7687
|
}
|
|
7661
7688
|
assert(`normalizeModelName support has been removed`);
|
|
7662
7689
|
}
|
|
7663
|
-
export { Collection as C, IdentifierArray as I, MUTATE as M, RecordArrayManager as R, Store as S, Snapshot as a, setIdentifierGenerationMethod as b, setIdentifierUpdateMethod as c, setIdentifierForgetMethod as d, setIdentifierResetMethod as e, coerceId as f,
|
|
7690
|
+
export { Collection as C, IdentifierArray as I, MUTATE as M, RecordArrayManager as R, Store as S, Snapshot as a, setIdentifierGenerationMethod as b, setIdentifierUpdateMethod as c, setIdentifierForgetMethod as d, setIdentifierResetMethod as e, coerceId as f, notifyArray as g, SOURCE as h, isStableIdentifier as i, IDENTIFIER_ARRAY_TAG as j, fastPush as k, SnapshotRecordArray as l, recordDataFor as m, normalizeModelName as n, removeRecordDataFor as o, recordIdentifierFor as r, storeFor as s };
|