@ember-data/store 4.12.3 → 4.12.4

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, j as IDENTIFIER_ARRAY_TAG, I as IdentifierArray, M as MUTATE, I as RecordArray, R as RecordArrayManager, h as SOURCE, S as Store, _ as _clearCaches, e as coerceId, k as fastPush, i as isStableIdentifier, n as normalizeModelName, g as notifyArray, p as peekCache, r as recordIdentifierFor, l as removeRecordDataFor, c as setIdentifierForgetMethod, a as setIdentifierGenerationMethod, d as setIdentifierResetMethod, b as setIdentifierUpdateMethod, s as storeFor } from "./index-36c7ac56";
1
+ export { f as AdapterPopulatedRecordArray, C as CacheHandler, j as IDENTIFIER_ARRAY_TAG, I as IdentifierArray, M as MUTATE, I as RecordArray, R as RecordArrayManager, h as SOURCE, S as Store, _ as _clearCaches, e as coerceId, k as fastPush, i as isStableIdentifier, n as normalizeModelName, g as notifyArray, p as peekCache, r as recordIdentifierFor, l as removeRecordDataFor, c as setIdentifierForgetMethod, a as setIdentifierGenerationMethod, d as setIdentifierResetMethod, b as setIdentifierUpdateMethod, s as storeFor } from "./index-7883b099";
@@ -3493,7 +3493,7 @@ class ShimModelClass {
3493
3493
  });
3494
3494
  Object.keys(attrDefs).forEach(key => {
3495
3495
  if (attrDefs[key].type) {
3496
- callback.call(binding, key, attrDefs[key].type);
3496
+ callback.call(binding, key, attrDefs[key]?.type ?? null);
3497
3497
  }
3498
3498
  });
3499
3499
  }
@@ -4958,13 +4958,13 @@ function sync(array, changes, arraySet) {
4958
4958
  } else {
4959
4959
  if (arraySet.has(key)) {
4960
4960
  removes.push(key);
4961
+ arraySet.delete(key);
4961
4962
  }
4962
4963
  }
4963
4964
  });
4964
4965
  if (removes.length) {
4965
4966
  if (removes.length === state.length) {
4966
4967
  state.length = 0;
4967
- arraySet.clear();
4968
4968
  // changing the reference breaks the Proxy
4969
4969
  // state = array[SOURCE] = [];
4970
4970
  } else {
@@ -5524,7 +5524,9 @@ class Store extends EmberObject {
5524
5524
 
5525
5525
  // ensure that `getOwner(this)` works inside a model instance
5526
5526
  setOwner(createOptions, getOwner(this));
5527
- return getModelFactory(this, this._modelFactoryCache, modelName).class.create(createOptions);
5527
+ const factory = getModelFactory(this, this._modelFactoryCache, modelName);
5528
+ assert(`No model was found for '${modelName}'`, factory);
5529
+ return factory.class.create(createOptions);
5528
5530
  }
5529
5531
  assert(`You must implement the store's instantiateRecord hook for your custom model class.`);
5530
5532
  }
@@ -5713,7 +5715,7 @@ class Store extends EmberObject {
5713
5715
  let maybeFactory = getModelFactory(this, this._modelFactoryCache, normalizedModelName);
5714
5716
 
5715
5717
  // for factorFor factory/class split
5716
- let klass = maybeFactory && maybeFactory.class ? maybeFactory.class : maybeFactory;
5718
+ const klass = maybeFactory && maybeFactory.class ? maybeFactory.class : null;
5717
5719
  if (!klass || !klass.isModel || this._forceShim) {
5718
5720
  assert(`No model was found for '${modelName}' and no schema handles the type`, this.getSchemaDefinitionService().doesTypeExist(modelName));
5719
5721
  return getShimClass(this, modelName);