@ember-data/store 5.3.0-alpha.10 → 5.3.0-alpha.12

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-1fd58f2b";
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-0a03d2a4";
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-1fd58f2b";
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-0a03d2a4";
@@ -620,6 +620,9 @@ class IdentifierCache {
620
620
  __configureMerge(method) {
621
621
  this._merge = method || defaultMergeMethod;
622
622
  }
623
+ upgradeIdentifier(resource) {
624
+ return this._getRecordIdentifier(resource, 2);
625
+ }
623
626
 
624
627
  /**
625
628
  * @method _getRecordIdentifier
@@ -662,7 +665,7 @@ class IdentifierCache {
662
665
  }
663
666
  return identifier;
664
667
  }
665
- if (shouldGenerate === false) {
668
+ if (shouldGenerate === 0) {
666
669
  if (macroCondition(getOwnConfig().debug.LOG_IDENTIFIERS)) {
667
670
  // eslint-disable-next-line no-console
668
671
  console.groupEnd();
@@ -671,8 +674,15 @@ class IdentifierCache {
671
674
  }
672
675
 
673
676
  // if we still don't have an identifier, time to generate one
674
- const keyInfo = this._keyInfoForResource(resource, null);
675
- identifier = /*#__NOINLINE__*/makeStableRecordIdentifier(keyInfo.id, keyInfo.type, lid, 'record', false);
677
+ if (shouldGenerate === 2) {
678
+ resource.lid = lid;
679
+ identifier = /*#__NOINLINE__*/makeStableRecordIdentifier(resource, 'record', false);
680
+ } else {
681
+ // we lie a bit here as a memory optimization
682
+ const keyInfo = this._keyInfoForResource(resource, null);
683
+ keyInfo.lid = lid;
684
+ identifier = /*#__NOINLINE__*/makeStableRecordIdentifier(keyInfo, 'record', false);
685
+ }
676
686
  addResourceToCache(this._cache, identifier);
677
687
  if (macroCondition(getOwnConfig().debug.LOG_IDENTIFIERS)) {
678
688
  // eslint-disable-next-line no-console
@@ -692,7 +702,7 @@ class IdentifierCache {
692
702
  * @private
693
703
  */
694
704
  peekRecordIdentifier(resource) {
695
- return this._getRecordIdentifier(resource, false);
705
+ return this._getRecordIdentifier(resource, 0);
696
706
  }
697
707
 
698
708
  /**
@@ -738,7 +748,7 @@ class IdentifierCache {
738
748
  @public
739
749
  */
740
750
  getOrCreateRecordIdentifier(resource) {
741
- return this._getRecordIdentifier(resource, true);
751
+ return this._getRecordIdentifier(resource, 1);
742
752
  }
743
753
 
744
754
  /**
@@ -754,7 +764,11 @@ class IdentifierCache {
754
764
  */
755
765
  createIdentifierForNewRecord(data) {
756
766
  let newLid = this._generate(data, 'record');
757
- let identifier = /*#__NOINLINE__*/makeStableRecordIdentifier(data.id || null, data.type, newLid, 'record', true);
767
+ let identifier = /*#__NOINLINE__*/makeStableRecordIdentifier({
768
+ id: data.id || null,
769
+ type: data.type,
770
+ lid: newLid
771
+ }, 'record', true);
758
772
 
759
773
  // populate our unique table
760
774
  if (macroCondition(getOwnConfig().env.DEBUG)) {
@@ -900,12 +914,7 @@ class IdentifierCache {
900
914
  this._reset();
901
915
  }
902
916
  }
903
- function makeStableRecordIdentifier(_id, _type, _lid, bucket, clientOriginated) {
904
- let recordIdentifier = {
905
- lid: _lid,
906
- id: _id,
907
- type: _type
908
- };
917
+ function makeStableRecordIdentifier(recordIdentifier, bucket, clientOriginated) {
909
918
  IDENTIFIERS.add(recordIdentifier);
910
919
  if (macroCondition(getOwnConfig().env.DEBUG)) {
911
920
  // we enforce immutability in dev