@ember-data/store 5.5.0-alpha.10 → 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-76b33f02";
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-76b33f02";
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
1
  import { getOwner } from '@ember/application';
2
2
  import { assert, deprecate, warn } from '@ember/debug';
3
3
  import EmberObject from '@ember/object';
4
- import { tracked } from '@glimmer/tracking';
4
+ import { defineSignal, addToTransaction, createSignal, subscribe, createArrayTags, addTransactionCB } from '@ember-data/tracking/-private';
5
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
  }
@@ -1122,11 +1067,11 @@ function addResourceToCache(cache, identifier) {
1122
1067
  typeSet.id.set(identifier.id, identifier);
1123
1068
  }
1124
1069
  }
1125
- var _class$1, _descriptor$1;
1126
1070
 
1127
1071
  /**
1128
1072
  @module @ember-data/store
1129
1073
  */
1074
+
1130
1075
  /**
1131
1076
  @module @ember-data/store
1132
1077
  */
@@ -1138,12 +1083,11 @@ var _class$1, _descriptor$1;
1138
1083
  @public
1139
1084
  @extends Reference
1140
1085
  */
1141
- let RecordReference = (_class$1 = class RecordReference {
1086
+ class RecordReference {
1142
1087
  constructor(store, identifier) {
1143
1088
  // unsubscribe token given to us by the notification manager
1144
1089
  this.___token = void 0;
1145
1090
  this.___identifier = void 0;
1146
- _initializerDefineProperty(this, "_ref", _descriptor$1, this);
1147
1091
  this.store = store;
1148
1092
  this.___identifier = identifier;
1149
1093
  this.___token = store.notifications.subscribe(identifier, (_, bucket, notifiedKey) => {
@@ -1311,14 +1255,8 @@ let RecordReference = (_class$1 = class RecordReference {
1311
1255
  }
1312
1256
  assert(`Unable to fetch record of type ${this.type} without an id`);
1313
1257
  }
1314
- }, _descriptor$1 = _applyDecoratedDescriptor(_class$1.prototype, "_ref", [tracked], {
1315
- configurable: true,
1316
- enumerable: true,
1317
- writable: true,
1318
- initializer: function () {
1319
- return 0;
1320
- }
1321
- }), _class$1);
1258
+ }
1259
+ defineSignal(RecordReference.prototype, '_ref');
1322
1260
 
1323
1261
  /**
1324
1262
  @module @ember-data/store
@@ -2604,7 +2542,30 @@ class NotificationManager {
2604
2542
  this._cache.clear();
2605
2543
  }
2606
2544
  }
2607
- 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;
2608
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']);
2609
2570
  const ARRAY_SETTER_METHODS = new Set(['push', 'pop', 'unshift', 'shift', 'splice', 'sort']);
2610
2571
  const SYNC_PROPS = new Set(['[]', 'length', 'links', 'meta']);
@@ -2614,21 +2575,13 @@ function isArrayGetter(prop) {
2614
2575
  function isArraySetter(prop) {
2615
2576
  return ARRAY_SETTER_METHODS.has(prop);
2616
2577
  }
2617
- const IDENTIFIER_ARRAY_TAG = Symbol('#tag');
2578
+ const ARRAY_SIGNAL = Symbol('#signal');
2618
2579
  const SOURCE = Symbol('#source');
2619
2580
  const MUTATE = Symbol('#update');
2620
2581
  const NOTIFY = Symbol('#notify');
2621
2582
  const IS_COLLECTION = Symbol.for('Collection');
2622
2583
  function notifyArray(arr) {
2623
- addToTransaction(arr[IDENTIFIER_ARRAY_TAG]);
2624
- if (macroCondition(getOwnConfig().deprecations.DEPRECATE_COMPUTED_CHAINS)) {
2625
- // @ts-expect-error tagForProperty is mistyped to Tag instead of DirtyableTag
2626
- // eslint-disable-next-line
2627
- dirtyTag(tagForProperty(arr, 'length'));
2628
- // @ts-expect-error tagForProperty is mistyped to Tag instead of DirtyableTag
2629
- // eslint-disable-next-line
2630
- dirtyTag(tagForProperty(arr, '[]'));
2631
- }
2584
+ addToTransaction(arr[ARRAY_SIGNAL]);
2632
2585
  }
2633
2586
  function convertToInt(prop) {
2634
2587
  if (typeof prop === 'symbol') return null;
@@ -2636,29 +2589,6 @@ function convertToInt(prop) {
2636
2589
  if (isNaN(num)) return null;
2637
2590
  return num % 1 === 0 ? num : null;
2638
2591
  }
2639
- let Tag = (_class = class Tag {
2640
- /*
2641
- * whether this was part of a transaction when last mutated
2642
- */
2643
-
2644
- constructor() {
2645
- _initializerDefineProperty(this, "ref", _descriptor, this);
2646
- if (macroCondition(getOwnConfig().env.DEBUG)) {
2647
- const [arr, prop] = arguments;
2648
- this._debug_base = arr.constructor.name + ':' + String(arr.modelName);
2649
- this._debug_prop = prop;
2650
- }
2651
- this.shouldReset = false;
2652
- this.t = false;
2653
- }
2654
- }, _descriptor = _applyDecoratedDescriptor(_class.prototype, "ref", [tracked], {
2655
- configurable: true,
2656
- enumerable: true,
2657
- writable: true,
2658
- initializer: function () {
2659
- return null;
2660
- }
2661
- }), _class);
2662
2592
  function safeForEach(instance, arr, store, callback, target) {
2663
2593
  if (target === undefined) {
2664
2594
  target = null;
@@ -2691,7 +2621,7 @@ function safeForEach(instance, arr, store, callback, target) {
2691
2621
  @class RecordArray
2692
2622
  @public
2693
2623
  */
2694
- let IdentifierArray = (_class3 = class IdentifierArray {
2624
+ let IdentifierArray = (_class = class IdentifierArray {
2695
2625
  [NOTIFY]() {
2696
2626
  notifyArray(this);
2697
2627
  }
@@ -2719,14 +2649,6 @@ let IdentifierArray = (_class3 = class IdentifierArray {
2719
2649
  set length(value) {
2720
2650
  this[SOURCE].length = value;
2721
2651
  }
2722
-
2723
- // here to support computed chains
2724
- // and {{#each}}
2725
- get '[]'() {
2726
- if (macroCondition(getOwnConfig().deprecations.DEPRECATE_COMPUTED_CHAINS)) {
2727
- return this;
2728
- }
2729
- }
2730
2652
  constructor(options) {
2731
2653
  /**
2732
2654
  The flag to signal a `RecordArray` is currently loading data.
@@ -2741,7 +2663,6 @@ let IdentifierArray = (_class3 = class IdentifierArray {
2741
2663
  @public
2742
2664
  @type Boolean
2743
2665
  */
2744
- _initializerDefineProperty(this, "isUpdating", _descriptor2, this);
2745
2666
  this.isLoaded = true;
2746
2667
  this.isDestroying = false;
2747
2668
  this.isDestroyed = false;
@@ -2754,11 +2675,10 @@ let IdentifierArray = (_class3 = class IdentifierArray {
2754
2675
  this.store = options.store;
2755
2676
  this._manager = options.manager;
2756
2677
  this[SOURCE] = options.identifiers;
2757
- // @ts-expect-error
2758
- this[IDENTIFIER_ARRAY_TAG] = macroCondition(getOwnConfig().env.DEBUG) ? new Tag(this, 'length') : new Tag();
2678
+ this[ARRAY_SIGNAL] = createSignal(this, 'length');
2759
2679
  const store = options.store;
2760
2680
  const boundFns = new Map();
2761
- const _TAG = this[IDENTIFIER_ARRAY_TAG];
2681
+ const _SIGNAL = this[ARRAY_SIGNAL];
2762
2682
  const PrivateState = {
2763
2683
  links: options.links || null,
2764
2684
  meta: options.meta || null
@@ -2772,27 +2692,27 @@ let IdentifierArray = (_class3 = class IdentifierArray {
2772
2692
  const proxy = new Proxy(this[SOURCE], {
2773
2693
  get(target, prop, receiver) {
2774
2694
  let index = convertToInt(prop);
2775
- if (_TAG.shouldReset && (index !== null || SYNC_PROPS.has(prop) || isArrayGetter(prop))) {
2695
+ if (_SIGNAL.shouldReset && (index !== null || SYNC_PROPS.has(prop) || isArrayGetter(prop))) {
2776
2696
  options.manager._syncArray(receiver);
2777
- _TAG.t = false;
2778
- _TAG.shouldReset = false;
2697
+ _SIGNAL.t = false;
2698
+ _SIGNAL.shouldReset = false;
2779
2699
  }
2780
2700
  if (index !== null) {
2781
2701
  const identifier = target[index];
2782
2702
  if (!transaction) {
2783
- subscribe(_TAG);
2703
+ subscribe(_SIGNAL);
2784
2704
  }
2785
2705
  return identifier && store._instanceCache.getRecord(identifier);
2786
2706
  }
2787
- if (prop === 'meta') return subscribe(_TAG), PrivateState.meta;
2788
- if (prop === 'links') return subscribe(_TAG), PrivateState.links;
2789
- 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;
2790
2710
  if (isArrayGetter(prop)) {
2791
2711
  let fn = boundFns.get(prop);
2792
2712
  if (fn === undefined) {
2793
2713
  if (prop === 'forEach') {
2794
2714
  fn = function () {
2795
- subscribe(_TAG);
2715
+ subscribe(_SIGNAL);
2796
2716
  transaction = true;
2797
2717
  let result = safeForEach(receiver, target, store, arguments[0], arguments[1]);
2798
2718
  transaction = false;
@@ -2800,7 +2720,7 @@ let IdentifierArray = (_class3 = class IdentifierArray {
2800
2720
  };
2801
2721
  } else {
2802
2722
  fn = function () {
2803
- subscribe(_TAG);
2723
+ subscribe(_SIGNAL);
2804
2724
  // array functions must run through Reflect to work properly
2805
2725
  // binding via other means will not work.
2806
2726
  transaction = true;
@@ -2828,7 +2748,7 @@ let IdentifierArray = (_class3 = class IdentifierArray {
2828
2748
  transaction = true;
2829
2749
  let result = Reflect.apply(target[prop], receiver, args);
2830
2750
  self[MUTATE](prop, args, result);
2831
- addToTransaction(_TAG);
2751
+ addToTransaction(_SIGNAL);
2832
2752
  // TODO handle cache updates
2833
2753
  transaction = false;
2834
2754
  return result;
@@ -2838,7 +2758,7 @@ let IdentifierArray = (_class3 = class IdentifierArray {
2838
2758
  return fn;
2839
2759
  }
2840
2760
  if (prop in self) {
2841
- if (prop === NOTIFY || prop === IDENTIFIER_ARRAY_TAG || prop === SOURCE) {
2761
+ if (prop === NOTIFY || prop === ARRAY_SIGNAL || prop === SOURCE) {
2842
2762
  return self[prop];
2843
2763
  }
2844
2764
  let fn = boundFns.get(prop);
@@ -2846,7 +2766,7 @@ let IdentifierArray = (_class3 = class IdentifierArray {
2846
2766
  let outcome = self[prop];
2847
2767
  if (typeof outcome === 'function') {
2848
2768
  fn = function () {
2849
- subscribe(_TAG);
2769
+ subscribe(_SIGNAL);
2850
2770
  // array functions must run through Reflect to work properly
2851
2771
  // binding via other means will not work.
2852
2772
  return Reflect.apply(outcome, receiver, arguments);
@@ -2854,7 +2774,7 @@ let IdentifierArray = (_class3 = class IdentifierArray {
2854
2774
  boundFns.set(prop, fn);
2855
2775
  return fn;
2856
2776
  }
2857
- return subscribe(_TAG), outcome;
2777
+ return subscribe(_SIGNAL), outcome;
2858
2778
  }
2859
2779
  return target[prop];
2860
2780
  },
@@ -2862,7 +2782,7 @@ let IdentifierArray = (_class3 = class IdentifierArray {
2862
2782
  if (prop === 'length') {
2863
2783
  if (!transaction && value === 0) {
2864
2784
  transaction = true;
2865
- addToTransaction(_TAG);
2785
+ addToTransaction(_SIGNAL);
2866
2786
  Reflect.set(target, prop, value);
2867
2787
  self[MUTATE]('length 0', []);
2868
2788
  transaction = false;
@@ -2898,7 +2818,7 @@ let IdentifierArray = (_class3 = class IdentifierArray {
2898
2818
  target[index] = newIdentifier;
2899
2819
  if (!transaction) {
2900
2820
  self[MUTATE]('replace cell', [index, original, newIdentifier]);
2901
- addToTransaction(_TAG);
2821
+ addToTransaction(_SIGNAL);
2902
2822
  }
2903
2823
  return true;
2904
2824
  },
@@ -2913,12 +2833,7 @@ let IdentifierArray = (_class3 = class IdentifierArray {
2913
2833
  return IdentifierArray.prototype;
2914
2834
  }
2915
2835
  });
2916
- if (macroCondition(getOwnConfig().env.DEBUG)) {
2917
- const meta = Ember.meta(this);
2918
- meta.addMixin = mixin => {
2919
- assert(`Do not call A() on EmberData RecordArrays`);
2920
- };
2921
- }
2836
+ createArrayTags(proxy, _SIGNAL);
2922
2837
  this[NOTIFY] = this[NOTIFY].bind(proxy);
2923
2838
  return proxy;
2924
2839
  }
@@ -2985,14 +2900,20 @@ let IdentifierArray = (_class3 = class IdentifierArray {
2985
2900
  let promise = Promise.all(this.map(record => this.store.saveRecord(record))).then(() => this);
2986
2901
  return promise;
2987
2902
  }
2988
- }, (_descriptor2 = _applyDecoratedDescriptor(_class3.prototype, "isUpdating", [tracked], {
2989
- 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 = {
2990
2908
  enumerable: true,
2991
- writable: true,
2992
- initializer: function () {
2993
- return false;
2909
+ configurable: false,
2910
+ get: function () {
2911
+ return this;
2994
2912
  }
2995
- }), _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);
2996
2917
  class Collection extends IdentifierArray {
2997
2918
  constructor(options) {
2998
2919
  super(options);
@@ -3024,7 +2945,7 @@ class Collection extends IdentifierArray {
3024
2945
  Collection.prototype.query = null;
3025
2946
 
3026
2947
  // Ensure instanceof works correctly
3027
- //Object.setPrototypeOf(IdentifierArray.prototype, Array.prototype);
2948
+ // Object.setPrototypeOf(IdentifierArray.prototype, Array.prototype);
3028
2949
  function assertRecordPassedToHasMany(record) {
3029
2950
  assert(`All elements of a hasMany relationship must be instances of Model, you passed $${typeof record}`, function () {
3030
2951
  try {
@@ -3193,7 +3114,7 @@ class RecordArrayManager {
3193
3114
  if (array === FAKE_ARR) {
3194
3115
  return;
3195
3116
  }
3196
- let tag = array[IDENTIFIER_ARRAY_TAG];
3117
+ let tag = array[ARRAY_SIGNAL];
3197
3118
  if (!tag.shouldReset) {
3198
3119
  tag.shouldReset = true;
3199
3120
  addTransactionCB(array[NOTIFY]);
@@ -4296,8 +4217,7 @@ class Store extends EmberObject {
4296
4217
  In your adapter you can then access this id without triggering a network request via the
4297
4218
  snapshot:
4298
4219
  ```app/adapters/application.js
4299
- import EmberObject from '@ember/object';
4300
- export default class Adapter extends EmberObject {
4220
+ export default class Adapter {
4301
4221
  findRecord(store, schema, id, snapshot) {
4302
4222
  let type = schema.modelName;
4303
4223
  if (type === 'comment')
@@ -4306,6 +4226,9 @@ class Store extends EmberObject {
4306
4226
  .then(response => response.json())
4307
4227
  }
4308
4228
  }
4229
+ static create() {
4230
+ return new this();
4231
+ }
4309
4232
  }
4310
4233
  ```
4311
4234
  This could also be achieved by supplying the post id to the adapter via the adapterOptions
@@ -4319,9 +4242,8 @@ class Store extends EmberObject {
4319
4242
  }
4320
4243
  ```
4321
4244
  ```app/adapters/application.js
4322
- import EmberObject from '@ember/object';
4323
- export default class Adapter extends EmberObject {
4324
- findRecord(store, schema, id, snapshot) {
4245
+ export default class Adapter {
4246
+ findRecord(store, schema, id, snapshot) {
4325
4247
  let type = schema.modelName;
4326
4248
  if (type === 'comment')
4327
4249
  let postId = snapshot.adapterOptions.post;
@@ -4329,6 +4251,9 @@ class Store extends EmberObject {
4329
4251
  .then(response => response.json())
4330
4252
  }
4331
4253
  }
4254
+ static create() {
4255
+ return new this();
4256
+ }
4332
4257
  }
4333
4258
  ```
4334
4259
  If you have access to the post model you can also pass the model itself to preload:
@@ -4455,9 +4380,8 @@ class Store extends EmberObject {
4455
4380
  }
4456
4381
  ```
4457
4382
  ```app/adapters/application.js
4458
- import EmberObject from '@ember/object';
4459
- export default class Adapter extends EmberObject {
4460
- findRecord(store, schema, id, snapshot) {
4383
+ export default class Adapter {
4384
+ findRecord(store, schema, id, snapshot) {
4461
4385
  let type = schema.modelName;
4462
4386
  if (type === 'post')
4463
4387
  let includes = snapshot.adapterOptions.include;
@@ -4465,6 +4389,9 @@ class Store extends EmberObject {
4465
4389
  .then(response => response.json())
4466
4390
  }
4467
4391
  }
4392
+ static create() {
4393
+ return new this();
4394
+ }
4468
4395
  }
4469
4396
  ```
4470
4397
  In this case, the post's comments would then be available in your template as
@@ -5616,4 +5543,4 @@ function extractIdentifierFromRecord(recordOrPromiseRecord) {
5616
5543
  const extract = recordIdentifierFor;
5617
5544
  return extract(recordOrPromiseRecord);
5618
5545
  }
5619
- 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 };