@ember-data/store 5.5.0-alpha.1 → 5.5.0-alpha.11

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 { f as AdapterPopulatedRecordArray, C as CacheHandler, h as IDENTIFIER_ARRAY_TAG, I as IdentifierArray, M as MUTATE, I as RecordArray, R as RecordArrayManager, g as SOURCE, S as Store, m as StoreMap, _ as _clearCaches, e as coerceId, j as fastPush, i as isStableIdentifier, n as notifyArray, p as peekCache, r as recordIdentifierFor, k as removeRecordDataFor, o as setCacheFor, c as setIdentifierForgetMethod, a as setIdentifierGenerationMethod, d as setIdentifierResetMethod, b as setIdentifierUpdateMethod, l as setRecordIdentifier, s as storeFor } from "./store-service-aee9dd76";
1
+ export { A as ARRAY_SIGNAL, f as AdapterPopulatedRecordArray, C as CacheHandler, I as IdentifierArray, M as MUTATE, I as RecordArray, R as RecordArrayManager, g as SOURCE, S as Store, l as StoreMap, _ as _clearCaches, e as coerceId, h as fastPush, i as isStableIdentifier, n as notifyArray, p as peekCache, r as recordIdentifierFor, j as removeRecordDataFor, m as setCacheFor, c as setIdentifierForgetMethod, a as setIdentifierGenerationMethod, d as setIdentifierResetMethod, b as setIdentifierUpdateMethod, k as setRecordIdentifier, s as storeFor } from "./store-service-b98547c2";
package/addon/index.js CHANGED
@@ -1 +1 @@
1
- export { C as CacheHandler, S as default, r as recordIdentifierFor, c as setIdentifierForgetMethod, a as setIdentifierGenerationMethod, d as setIdentifierResetMethod, b as setIdentifierUpdateMethod, s as storeFor } from "./store-service-aee9dd76";
1
+ export { C as CacheHandler, S as default, r as recordIdentifierFor, c as setIdentifierForgetMethod, a as setIdentifierGenerationMethod, d as setIdentifierResetMethod, b as setIdentifierUpdateMethod, s as storeFor } from "./store-service-b98547c2";
@@ -1,24 +1,11 @@
1
- import { macroCondition, getOwnConfig } from '@embroider/macros';
2
1
  import { getOwner } from '@ember/application';
3
2
  import { assert, deprecate, warn } from '@ember/debug';
4
3
  import EmberObject from '@ember/object';
5
- import { tracked } from '@glimmer/tracking';
4
+ import { defineSignal, addToTransaction, createSignal, subscribe, createArrayTags, addTransactionCB } from '@ember-data/tracking/-private';
5
+ import { macroCondition, getOwnConfig } from '@embroider/macros';
6
6
  import { dasherize } from '@ember/string';
7
7
  import { _backburner } from '@ember/runloop';
8
- import { addToTransaction, subscribe, addTransactionCB } from '@ember-data/tracking/-private';
9
- import { tagForProperty } from '@ember/-internals/metal';
10
- import { dependentKeyCompat } from '@ember/object/compat';
11
- import { dirtyTag } from '@glimmer/validator';
12
- import Ember from 'ember';
13
- function _initializerDefineProperty(target, property, descriptor, context) {
14
- if (!descriptor) return;
15
- Object.defineProperty(target, property, {
16
- enumerable: descriptor.enumerable,
17
- configurable: descriptor.configurable,
18
- writable: descriptor.writable,
19
- value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
20
- });
21
- }
8
+ import { compat } from '@ember-data/tracking';
22
9
  function _classPrivateFieldBase(receiver, privateKey) {
23
10
  if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) {
24
11
  throw new TypeError("attempted to use private field on non-instance");
@@ -29,43 +16,17 @@ var id = 0;
29
16
  function _classPrivateFieldKey(name) {
30
17
  return "__private_" + id++ + "_" + name;
31
18
  }
32
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
33
- var desc = {};
34
- Object.keys(descriptor).forEach(function (key) {
35
- desc[key] = descriptor[key];
36
- });
37
- desc.enumerable = !!desc.enumerable;
38
- desc.configurable = !!desc.configurable;
39
- if ('value' in desc || desc.initializer) {
40
- desc.writable = true;
41
- }
42
- desc = decorators.slice().reverse().reduce(function (desc, decorator) {
43
- return decorator(target, property, desc) || desc;
44
- }, desc);
45
- if (context && desc.initializer !== void 0) {
46
- desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
47
- desc.initializer = undefined;
48
- }
49
- if (desc.initializer === void 0) {
50
- Object.defineProperty(target, property, desc);
51
- desc = null;
52
- }
53
- return desc;
54
- }
55
- var _class$2, _descriptor$2, _descriptor2$1, _descriptor3, _descriptor4, _store, _request;
56
19
  function urlFromLink(link) {
57
20
  if (typeof link === 'string') return link;
58
21
  return link.href;
59
22
  }
60
- let Document = (_class$2 = (_store = /*#__PURE__*/_classPrivateFieldKey("store"), _request = /*#__PURE__*/_classPrivateFieldKey("request"), class Document {
23
+ var _store = /*#__PURE__*/_classPrivateFieldKey("store");
24
+ var _request = /*#__PURE__*/_classPrivateFieldKey("request");
25
+ class Document {
61
26
  constructor(store, identifier) {
62
27
  Object.defineProperty(this, _request, {
63
28
  value: _request2
64
29
  });
65
- _initializerDefineProperty(this, "links", _descriptor$2, this);
66
- _initializerDefineProperty(this, "data", _descriptor2$1, this);
67
- _initializerDefineProperty(this, "errors", _descriptor3, this);
68
- _initializerDefineProperty(this, "meta", _descriptor4, this);
69
30
  Object.defineProperty(this, _store, {
70
31
  writable: true,
71
32
  value: void 0
@@ -108,27 +69,7 @@ let Document = (_class$2 = (_store = /*#__PURE__*/_classPrivateFieldKey("store")
108
69
  }
109
70
  return data;
110
71
  }
111
- }), (_descriptor$2 = _applyDecoratedDescriptor(_class$2.prototype, "links", [tracked], {
112
- configurable: true,
113
- enumerable: true,
114
- writable: true,
115
- initializer: null
116
- }), _descriptor2$1 = _applyDecoratedDescriptor(_class$2.prototype, "data", [tracked], {
117
- configurable: true,
118
- enumerable: true,
119
- writable: true,
120
- initializer: null
121
- }), _descriptor3 = _applyDecoratedDescriptor(_class$2.prototype, "errors", [tracked], {
122
- configurable: true,
123
- enumerable: true,
124
- writable: true,
125
- initializer: null
126
- }), _descriptor4 = _applyDecoratedDescriptor(_class$2.prototype, "meta", [tracked], {
127
- configurable: true,
128
- enumerable: true,
129
- writable: true,
130
- initializer: null
131
- })), _class$2);
72
+ }
132
73
  async function _request2(link, options = {}) {
133
74
  const href = this.links?.[link];
134
75
  if (!href) {
@@ -139,6 +80,10 @@ async function _request2(link, options = {}) {
139
80
  }));
140
81
  return response.content;
141
82
  }
83
+ defineSignal(Document.prototype, 'data');
84
+ defineSignal(Document.prototype, 'links');
85
+ defineSignal(Document.prototype, 'errors');
86
+ defineSignal(Document.prototype, 'meta');
142
87
  function isErrorDocument(document) {
143
88
  return 'errors' in document;
144
89
  }
@@ -391,12 +336,10 @@ function copyDocumentProperties(target, source) {
391
336
  }
392
337
  }
393
338
 
394
- // Used by the store to normalize IDs entering the store. Despite the fact
395
- // that developers may provide IDs as numbers (e.g., `store.findRecord('person', 1)`),
396
- // it is important that internally we use strings, since IDs may be serialized
397
- // and lose type information. For example, Ember's router may put a record's
398
- // ID into the URL, and if we later try to deserialize that URL and find the
399
- // corresponding record, we will not know if it is a string or a number.
339
+ /**
340
+ @module @ember-data/store
341
+ */
342
+
400
343
  function coerceId(id) {
401
344
  if (macroCondition(getOwnConfig().deprecations.DEPRECATE_NON_STRICT_ID)) {
402
345
  let normalized;
@@ -1124,11 +1067,11 @@ function addResourceToCache(cache, identifier) {
1124
1067
  typeSet.id.set(identifier.id, identifier);
1125
1068
  }
1126
1069
  }
1127
- var _class$1, _descriptor$1;
1128
1070
 
1129
1071
  /**
1130
1072
  @module @ember-data/store
1131
1073
  */
1074
+
1132
1075
  /**
1133
1076
  @module @ember-data/store
1134
1077
  */
@@ -1140,12 +1083,11 @@ var _class$1, _descriptor$1;
1140
1083
  @public
1141
1084
  @extends Reference
1142
1085
  */
1143
- let RecordReference = (_class$1 = class RecordReference {
1086
+ class RecordReference {
1144
1087
  constructor(store, identifier) {
1145
1088
  // unsubscribe token given to us by the notification manager
1146
1089
  this.___token = void 0;
1147
1090
  this.___identifier = void 0;
1148
- _initializerDefineProperty(this, "_ref", _descriptor$1, this);
1149
1091
  this.store = store;
1150
1092
  this.___identifier = identifier;
1151
1093
  this.___token = store.notifications.subscribe(identifier, (_, bucket, notifiedKey) => {
@@ -1313,14 +1255,8 @@ let RecordReference = (_class$1 = class RecordReference {
1313
1255
  }
1314
1256
  assert(`Unable to fetch record of type ${this.type} without an id`);
1315
1257
  }
1316
- }, _descriptor$1 = _applyDecoratedDescriptor(_class$1.prototype, "_ref", [tracked], {
1317
- configurable: true,
1318
- enumerable: true,
1319
- writable: true,
1320
- initializer: function () {
1321
- return 0;
1322
- }
1323
- }), _class$1);
1258
+ }
1259
+ defineSignal(RecordReference.prototype, '_ref');
1324
1260
 
1325
1261
  /**
1326
1262
  @module @ember-data/store
@@ -1415,11 +1351,6 @@ function peekCache(instance) {
1415
1351
  }
1416
1352
  return null;
1417
1353
  }
1418
-
1419
- /**
1420
- @module @ember-data/store
1421
- */
1422
-
1423
1354
  const RecordCache = new Map();
1424
1355
  function peekRecordIdentifier(record) {
1425
1356
  return RecordCache.get(record);
@@ -2410,6 +2341,10 @@ class CacheManager {
2410
2341
  return _classPrivateFieldBase(this, _cache)[_cache].isDeletionCommitted(identifier);
2411
2342
  }
2412
2343
  }
2344
+
2345
+ /**
2346
+ * @module @ember-data/store
2347
+ */
2413
2348
  let tokenId = 0;
2414
2349
  const CacheOperations = new Set(['added', 'removed', 'state', 'updated']);
2415
2350
  function isCacheOperationValue(value) {
@@ -2607,7 +2542,30 @@ class NotificationManager {
2607
2542
  this._cache.clear();
2608
2543
  }
2609
2544
  }
2610
- var _class, _descriptor, _class3, _descriptor2;
2545
+ function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
2546
+ var desc = {};
2547
+ Object.keys(descriptor).forEach(function (key) {
2548
+ desc[key] = descriptor[key];
2549
+ });
2550
+ desc.enumerable = !!desc.enumerable;
2551
+ desc.configurable = !!desc.configurable;
2552
+ if ('value' in desc || desc.initializer) {
2553
+ desc.writable = true;
2554
+ }
2555
+ desc = decorators.slice().reverse().reduce(function (desc, decorator) {
2556
+ return decorator(target, property, desc) || desc;
2557
+ }, desc);
2558
+ if (context && desc.initializer !== void 0) {
2559
+ desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
2560
+ desc.initializer = undefined;
2561
+ }
2562
+ if (desc.initializer === void 0) {
2563
+ Object.defineProperty(target, property, desc);
2564
+ desc = null;
2565
+ }
2566
+ return desc;
2567
+ }
2568
+ var _class;
2611
2569
  const ARRAY_GETTER_METHODS = new Set([Symbol.iterator, 'concat', 'entries', 'every', 'fill', 'filter', 'find', 'findIndex', 'flat', 'flatMap', 'forEach', 'includes', 'indexOf', 'join', 'keys', 'lastIndexOf', 'map', 'reduce', 'reduceRight', 'slice', 'some', 'values']);
2612
2570
  const ARRAY_SETTER_METHODS = new Set(['push', 'pop', 'unshift', 'shift', 'splice', 'sort']);
2613
2571
  const SYNC_PROPS = new Set(['[]', 'length', 'links', 'meta']);
@@ -2617,19 +2575,13 @@ function isArrayGetter(prop) {
2617
2575
  function isArraySetter(prop) {
2618
2576
  return ARRAY_SETTER_METHODS.has(prop);
2619
2577
  }
2620
- const IDENTIFIER_ARRAY_TAG = Symbol('#tag');
2578
+ const ARRAY_SIGNAL = Symbol('#signal');
2621
2579
  const SOURCE = Symbol('#source');
2622
2580
  const MUTATE = Symbol('#update');
2623
2581
  const NOTIFY = Symbol('#notify');
2624
2582
  const IS_COLLECTION = Symbol.for('Collection');
2625
2583
  function notifyArray(arr) {
2626
- addToTransaction(arr[IDENTIFIER_ARRAY_TAG]);
2627
- if (macroCondition(getOwnConfig().deprecations.DEPRECATE_COMPUTED_CHAINS)) {
2628
- // eslint-disable-next-line
2629
- dirtyTag(tagForProperty(arr, 'length'));
2630
- // eslint-disable-next-line
2631
- dirtyTag(tagForProperty(arr, '[]'));
2632
- }
2584
+ addToTransaction(arr[ARRAY_SIGNAL]);
2633
2585
  }
2634
2586
  function convertToInt(prop) {
2635
2587
  if (typeof prop === 'symbol') return null;
@@ -2637,29 +2589,6 @@ function convertToInt(prop) {
2637
2589
  if (isNaN(num)) return null;
2638
2590
  return num % 1 === 0 ? num : null;
2639
2591
  }
2640
- let Tag = (_class = class Tag {
2641
- /*
2642
- * whether this was part of a transaction when last mutated
2643
- */
2644
-
2645
- constructor() {
2646
- _initializerDefineProperty(this, "ref", _descriptor, this);
2647
- if (macroCondition(getOwnConfig().env.DEBUG)) {
2648
- const [arr, prop] = arguments;
2649
- this._debug_base = arr.constructor.name + ':' + String(arr.modelName);
2650
- this._debug_prop = prop;
2651
- }
2652
- this.shouldReset = false;
2653
- this.t = false;
2654
- }
2655
- }, _descriptor = _applyDecoratedDescriptor(_class.prototype, "ref", [tracked], {
2656
- configurable: true,
2657
- enumerable: true,
2658
- writable: true,
2659
- initializer: function () {
2660
- return null;
2661
- }
2662
- }), _class);
2663
2592
  function safeForEach(instance, arr, store, callback, target) {
2664
2593
  if (target === undefined) {
2665
2594
  target = null;
@@ -2692,7 +2621,7 @@ function safeForEach(instance, arr, store, callback, target) {
2692
2621
  @class RecordArray
2693
2622
  @public
2694
2623
  */
2695
- let IdentifierArray = (_class3 = class IdentifierArray {
2624
+ let IdentifierArray = (_class = class IdentifierArray {
2696
2625
  [NOTIFY]() {
2697
2626
  notifyArray(this);
2698
2627
  }
@@ -2720,14 +2649,6 @@ let IdentifierArray = (_class3 = class IdentifierArray {
2720
2649
  set length(value) {
2721
2650
  this[SOURCE].length = value;
2722
2651
  }
2723
-
2724
- // here to support computed chains
2725
- // and {{#each}}
2726
- get '[]'() {
2727
- if (macroCondition(getOwnConfig().deprecations.DEPRECATE_COMPUTED_CHAINS)) {
2728
- return this;
2729
- }
2730
- }
2731
2652
  constructor(options) {
2732
2653
  /**
2733
2654
  The flag to signal a `RecordArray` is currently loading data.
@@ -2742,7 +2663,6 @@ let IdentifierArray = (_class3 = class IdentifierArray {
2742
2663
  @public
2743
2664
  @type Boolean
2744
2665
  */
2745
- _initializerDefineProperty(this, "isUpdating", _descriptor2, this);
2746
2666
  this.isLoaded = true;
2747
2667
  this.isDestroying = false;
2748
2668
  this.isDestroyed = false;
@@ -2755,11 +2675,10 @@ let IdentifierArray = (_class3 = class IdentifierArray {
2755
2675
  this.store = options.store;
2756
2676
  this._manager = options.manager;
2757
2677
  this[SOURCE] = options.identifiers;
2758
- // @ts-expect-error
2759
- this[IDENTIFIER_ARRAY_TAG] = macroCondition(getOwnConfig().env.DEBUG) ? new Tag(this, 'length') : new Tag();
2678
+ this[ARRAY_SIGNAL] = createSignal(this, 'length');
2760
2679
  const store = options.store;
2761
2680
  const boundFns = new Map();
2762
- const _TAG = this[IDENTIFIER_ARRAY_TAG];
2681
+ const _SIGNAL = this[ARRAY_SIGNAL];
2763
2682
  const PrivateState = {
2764
2683
  links: options.links || null,
2765
2684
  meta: options.meta || null
@@ -2773,27 +2692,27 @@ let IdentifierArray = (_class3 = class IdentifierArray {
2773
2692
  const proxy = new Proxy(this[SOURCE], {
2774
2693
  get(target, prop, receiver) {
2775
2694
  let index = convertToInt(prop);
2776
- if (_TAG.shouldReset && (index !== null || SYNC_PROPS.has(prop) || isArrayGetter(prop))) {
2695
+ if (_SIGNAL.shouldReset && (index !== null || SYNC_PROPS.has(prop) || isArrayGetter(prop))) {
2777
2696
  options.manager._syncArray(receiver);
2778
- _TAG.t = false;
2779
- _TAG.shouldReset = false;
2697
+ _SIGNAL.t = false;
2698
+ _SIGNAL.shouldReset = false;
2780
2699
  }
2781
2700
  if (index !== null) {
2782
2701
  const identifier = target[index];
2783
2702
  if (!transaction) {
2784
- subscribe(_TAG);
2703
+ subscribe(_SIGNAL);
2785
2704
  }
2786
2705
  return identifier && store._instanceCache.getRecord(identifier);
2787
2706
  }
2788
- if (prop === 'meta') return subscribe(_TAG), PrivateState.meta;
2789
- if (prop === 'links') return subscribe(_TAG), PrivateState.links;
2790
- if (prop === '[]') return subscribe(_TAG), receiver;
2707
+ if (prop === 'meta') return subscribe(_SIGNAL), PrivateState.meta;
2708
+ if (prop === 'links') return subscribe(_SIGNAL), PrivateState.links;
2709
+ if (prop === '[]') return subscribe(_SIGNAL), receiver;
2791
2710
  if (isArrayGetter(prop)) {
2792
2711
  let fn = boundFns.get(prop);
2793
2712
  if (fn === undefined) {
2794
2713
  if (prop === 'forEach') {
2795
2714
  fn = function () {
2796
- subscribe(_TAG);
2715
+ subscribe(_SIGNAL);
2797
2716
  transaction = true;
2798
2717
  let result = safeForEach(receiver, target, store, arguments[0], arguments[1]);
2799
2718
  transaction = false;
@@ -2801,7 +2720,7 @@ let IdentifierArray = (_class3 = class IdentifierArray {
2801
2720
  };
2802
2721
  } else {
2803
2722
  fn = function () {
2804
- subscribe(_TAG);
2723
+ subscribe(_SIGNAL);
2805
2724
  // array functions must run through Reflect to work properly
2806
2725
  // binding via other means will not work.
2807
2726
  transaction = true;
@@ -2829,7 +2748,7 @@ let IdentifierArray = (_class3 = class IdentifierArray {
2829
2748
  transaction = true;
2830
2749
  let result = Reflect.apply(target[prop], receiver, args);
2831
2750
  self[MUTATE](prop, args, result);
2832
- addToTransaction(_TAG);
2751
+ addToTransaction(_SIGNAL);
2833
2752
  // TODO handle cache updates
2834
2753
  transaction = false;
2835
2754
  return result;
@@ -2839,7 +2758,7 @@ let IdentifierArray = (_class3 = class IdentifierArray {
2839
2758
  return fn;
2840
2759
  }
2841
2760
  if (prop in self) {
2842
- if (prop === NOTIFY || prop === IDENTIFIER_ARRAY_TAG || prop === SOURCE) {
2761
+ if (prop === NOTIFY || prop === ARRAY_SIGNAL || prop === SOURCE) {
2843
2762
  return self[prop];
2844
2763
  }
2845
2764
  let fn = boundFns.get(prop);
@@ -2847,7 +2766,7 @@ let IdentifierArray = (_class3 = class IdentifierArray {
2847
2766
  let outcome = self[prop];
2848
2767
  if (typeof outcome === 'function') {
2849
2768
  fn = function () {
2850
- subscribe(_TAG);
2769
+ subscribe(_SIGNAL);
2851
2770
  // array functions must run through Reflect to work properly
2852
2771
  // binding via other means will not work.
2853
2772
  return Reflect.apply(outcome, receiver, arguments);
@@ -2855,7 +2774,7 @@ let IdentifierArray = (_class3 = class IdentifierArray {
2855
2774
  boundFns.set(prop, fn);
2856
2775
  return fn;
2857
2776
  }
2858
- return subscribe(_TAG), outcome;
2777
+ return subscribe(_SIGNAL), outcome;
2859
2778
  }
2860
2779
  return target[prop];
2861
2780
  },
@@ -2863,7 +2782,7 @@ let IdentifierArray = (_class3 = class IdentifierArray {
2863
2782
  if (prop === 'length') {
2864
2783
  if (!transaction && value === 0) {
2865
2784
  transaction = true;
2866
- addToTransaction(_TAG);
2785
+ addToTransaction(_SIGNAL);
2867
2786
  Reflect.set(target, prop, value);
2868
2787
  self[MUTATE]('length 0', []);
2869
2788
  transaction = false;
@@ -2899,7 +2818,7 @@ let IdentifierArray = (_class3 = class IdentifierArray {
2899
2818
  target[index] = newIdentifier;
2900
2819
  if (!transaction) {
2901
2820
  self[MUTATE]('replace cell', [index, original, newIdentifier]);
2902
- addToTransaction(_TAG);
2821
+ addToTransaction(_SIGNAL);
2903
2822
  }
2904
2823
  return true;
2905
2824
  },
@@ -2914,12 +2833,7 @@ let IdentifierArray = (_class3 = class IdentifierArray {
2914
2833
  return IdentifierArray.prototype;
2915
2834
  }
2916
2835
  });
2917
- if (macroCondition(getOwnConfig().env.DEBUG)) {
2918
- const meta = Ember.meta(this);
2919
- meta.addMixin = mixin => {
2920
- assert(`Do not call A() on EmberData RecordArrays`);
2921
- };
2922
- }
2836
+ createArrayTags(proxy, _SIGNAL);
2923
2837
  this[NOTIFY] = this[NOTIFY].bind(proxy);
2924
2838
  return proxy;
2925
2839
  }
@@ -2986,14 +2900,20 @@ let IdentifierArray = (_class3 = class IdentifierArray {
2986
2900
  let promise = Promise.all(this.map(record => this.store.saveRecord(record))).then(() => this);
2987
2901
  return promise;
2988
2902
  }
2989
- }, (_descriptor2 = _applyDecoratedDescriptor(_class3.prototype, "isUpdating", [tracked], {
2990
- configurable: true,
2903
+ }, _applyDecoratedDescriptor(_class.prototype, "length", [compat], Object.getOwnPropertyDescriptor(_class.prototype, "length"), _class.prototype), _class); // this will error if someone tries to call
2904
+ // A(identifierArray) since it is not configurable
2905
+ // which is preferrable to the `meta` override we used
2906
+ // before which required importing all of Ember
2907
+ const desc = {
2991
2908
  enumerable: true,
2992
- writable: true,
2993
- initializer: function () {
2994
- return false;
2909
+ configurable: false,
2910
+ get: function () {
2911
+ return this;
2995
2912
  }
2996
- }), _applyDecoratedDescriptor(_class3.prototype, "length", [dependentKeyCompat], Object.getOwnPropertyDescriptor(_class3.prototype, "length"), _class3.prototype)), _class3);
2913
+ };
2914
+ compat(desc);
2915
+ Object.defineProperty(IdentifierArray.prototype, '[]', desc);
2916
+ defineSignal(IdentifierArray.prototype, 'isUpdating', false);
2997
2917
  class Collection extends IdentifierArray {
2998
2918
  constructor(options) {
2999
2919
  super(options);
@@ -3025,7 +2945,7 @@ class Collection extends IdentifierArray {
3025
2945
  Collection.prototype.query = null;
3026
2946
 
3027
2947
  // Ensure instanceof works correctly
3028
- //Object.setPrototypeOf(IdentifierArray.prototype, Array.prototype);
2948
+ // Object.setPrototypeOf(IdentifierArray.prototype, Array.prototype);
3029
2949
  function assertRecordPassedToHasMany(record) {
3030
2950
  assert(`All elements of a hasMany relationship must be instances of Model, you passed $${typeof record}`, function () {
3031
2951
  try {
@@ -3194,7 +3114,7 @@ class RecordArrayManager {
3194
3114
  if (array === FAKE_ARR) {
3195
3115
  return;
3196
3116
  }
3197
- let tag = array[IDENTIFIER_ARRAY_TAG];
3117
+ let tag = array[ARRAY_SIGNAL];
3198
3118
  if (!tag.shouldReset) {
3199
3119
  tag.shouldReset = true;
3200
3120
  addTransactionCB(array[NOTIFY]);
@@ -3361,13 +3281,13 @@ function sync(array, changes, arraySet) {
3361
3281
  } else {
3362
3282
  if (arraySet.has(key)) {
3363
3283
  removes.push(key);
3284
+ arraySet.delete(key);
3364
3285
  }
3365
3286
  }
3366
3287
  });
3367
3288
  if (removes.length) {
3368
3289
  if (removes.length === state.length) {
3369
3290
  state.length = 0;
3370
- arraySet.clear();
3371
3291
  // changing the reference breaks the Proxy
3372
3292
  // state = array[SOURCE] = [];
3373
3293
  } else {
@@ -3394,6 +3314,9 @@ function sync(array, changes, arraySet) {
3394
3314
  }
3395
3315
  }
3396
3316
 
3317
+ /**
3318
+ * @module @ember-data/store
3319
+ */
3397
3320
  const Touching = Symbol('touching');
3398
3321
  const RequestPromise = Symbol('promise');
3399
3322
  const EMPTY_ARR = macroCondition(getOwnConfig().env.DEBUG) ? Object.freeze([]) : [];
@@ -3628,6 +3551,11 @@ function constructResource(type, id, lid) {
3628
3551
  }
3629
3552
  }
3630
3553
 
3554
+ /**
3555
+ @module @ember-data/store
3556
+ */
3557
+ // this import location is deprecated but breaks in 4.8 and older
3558
+
3631
3559
  /**
3632
3560
  * A Store coordinates interaction between your application, a [Cache](https://api.emberjs.com/ember-data/release/classes/%3CInterface%3E%20Cache),
3633
3561
  * and sources of data (such as your API or a local persistence layer)
@@ -4289,8 +4217,7 @@ class Store extends EmberObject {
4289
4217
  In your adapter you can then access this id without triggering a network request via the
4290
4218
  snapshot:
4291
4219
  ```app/adapters/application.js
4292
- import EmberObject from '@ember/object';
4293
- export default class Adapter extends EmberObject {
4220
+ export default class Adapter {
4294
4221
  findRecord(store, schema, id, snapshot) {
4295
4222
  let type = schema.modelName;
4296
4223
  if (type === 'comment')
@@ -4299,6 +4226,9 @@ class Store extends EmberObject {
4299
4226
  .then(response => response.json())
4300
4227
  }
4301
4228
  }
4229
+ static create() {
4230
+ return new this();
4231
+ }
4302
4232
  }
4303
4233
  ```
4304
4234
  This could also be achieved by supplying the post id to the adapter via the adapterOptions
@@ -4312,9 +4242,8 @@ class Store extends EmberObject {
4312
4242
  }
4313
4243
  ```
4314
4244
  ```app/adapters/application.js
4315
- import EmberObject from '@ember/object';
4316
- export default class Adapter extends EmberObject {
4317
- findRecord(store, schema, id, snapshot) {
4245
+ export default class Adapter {
4246
+ findRecord(store, schema, id, snapshot) {
4318
4247
  let type = schema.modelName;
4319
4248
  if (type === 'comment')
4320
4249
  let postId = snapshot.adapterOptions.post;
@@ -4322,6 +4251,9 @@ class Store extends EmberObject {
4322
4251
  .then(response => response.json())
4323
4252
  }
4324
4253
  }
4254
+ static create() {
4255
+ return new this();
4256
+ }
4325
4257
  }
4326
4258
  ```
4327
4259
  If you have access to the post model you can also pass the model itself to preload:
@@ -4448,9 +4380,8 @@ class Store extends EmberObject {
4448
4380
  }
4449
4381
  ```
4450
4382
  ```app/adapters/application.js
4451
- import EmberObject from '@ember/object';
4452
- export default class Adapter extends EmberObject {
4453
- findRecord(store, schema, id, snapshot) {
4383
+ export default class Adapter {
4384
+ findRecord(store, schema, id, snapshot) {
4454
4385
  let type = schema.modelName;
4455
4386
  if (type === 'post')
4456
4387
  let includes = snapshot.adapterOptions.include;
@@ -4458,6 +4389,9 @@ class Store extends EmberObject {
4458
4389
  .then(response => response.json())
4459
4390
  }
4460
4391
  }
4392
+ static create() {
4393
+ return new this();
4394
+ }
4461
4395
  }
4462
4396
  ```
4463
4397
  In this case, the post's comments would then be available in your template as
@@ -5609,4 +5543,4 @@ function extractIdentifierFromRecord(recordOrPromiseRecord) {
5609
5543
  const extract = recordIdentifierFor;
5610
5544
  return extract(recordOrPromiseRecord);
5611
5545
  }
5612
- export { CacheHandler as C, IdentifierArray as I, MUTATE as M, RecordArrayManager as R, Store as S, _clearCaches as _, setIdentifierGenerationMethod as a, setIdentifierUpdateMethod as b, setIdentifierForgetMethod as c, setIdentifierResetMethod as d, coerceId as e, Collection as f, SOURCE as g, IDENTIFIER_ARRAY_TAG as h, isStableIdentifier as i, fastPush as j, removeRecordDataFor as k, setRecordIdentifier as l, StoreMap as m, notifyArray as n, setCacheFor as o, peekCache as p, recordIdentifierFor as r, storeFor as s };
5546
+ export { ARRAY_SIGNAL as A, CacheHandler as C, IdentifierArray as I, MUTATE as M, RecordArrayManager as R, Store as S, _clearCaches as _, setIdentifierGenerationMethod as a, setIdentifierUpdateMethod as b, setIdentifierForgetMethod as c, setIdentifierResetMethod as d, coerceId as e, Collection as f, SOURCE as g, fastPush as h, isStableIdentifier as i, removeRecordDataFor as j, setRecordIdentifier as k, StoreMap as l, setCacheFor as m, notifyArray as n, peekCache as p, recordIdentifierFor as r, storeFor as s };