@ember-data/store 4.11.0 → 4.11.1

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.
@@ -122,9 +122,11 @@ export function getModelFactory(store: Store, cache, normalizedModelName: string
122
122
  let owner: any = getOwner(store);
123
123
  factory = owner.factoryFor(`model:${normalizedModelName}`);
124
124
 
125
- if (!factory && HAS_MODEL_PACKAGE) {
126
- //Support looking up mixins as base types for polymorphic relationships
127
- factory = _modelForMixin(store, normalizedModelName);
125
+ if (HAS_MODEL_PACKAGE) {
126
+ if (!factory) {
127
+ //Support looking up mixins as base types for polymorphic relationships
128
+ factory = _modelForMixin(store, normalizedModelName);
129
+ }
128
130
  }
129
131
 
130
132
  if (!factory) {
@@ -217,14 +217,16 @@ export default class FetchManager {
217
217
  const recordData = store._instanceCache.peek({ identifier, bucket: 'recordData' });
218
218
  if (!recordData || recordData.isEmpty(identifier) || isLoading) {
219
219
  let isReleasable = true;
220
- if (!recordData && HAS_RECORD_DATA_PACKAGE) {
221
- const graphFor = (
222
- importSync('@ember-data/record-data/-private') as typeof import('@ember-data/record-data/-private')
223
- ).graphFor;
224
- const graph = graphFor(store);
225
- isReleasable = graph.isReleasable(identifier);
226
- if (!isReleasable) {
227
- graph.unload(identifier, true);
220
+ if (HAS_RECORD_DATA_PACKAGE) {
221
+ if (!recordData) {
222
+ const graphFor = (
223
+ importSync('@ember-data/record-data/-private') as typeof import('@ember-data/record-data/-private')
224
+ ).graphFor;
225
+ const graph = graphFor(store);
226
+ isReleasable = graph.isReleasable(identifier);
227
+ if (!isReleasable) {
228
+ graph.unload(identifier, true);
229
+ }
228
230
  }
229
231
  }
230
232
  if (recordData || isReleasable) {
@@ -392,10 +392,12 @@ class Store extends Service {
392
392
  * @public
393
393
  */
394
394
  getSchemaDefinitionService(): SchemaDefinitionService {
395
- if (HAS_MODEL_PACKAGE && !this._schemaDefinitionService) {
396
- // it is potentially a mistake for the RFC to have not enabled chaining these services, though highlander rule is nice.
397
- // what ember-m3 did via private API to allow both worlds to interop would be much much harder using this.
398
- this._schemaDefinitionService = new DSModelSchemaDefinitionService(this);
395
+ if (HAS_MODEL_PACKAGE) {
396
+ if (!this._schemaDefinitionService) {
397
+ // it is potentially a mistake for the RFC to have not enabled chaining these services, though highlander rule is nice.
398
+ // what ember-m3 did via private API to allow both worlds to interop would be much much harder using this.
399
+ this._schemaDefinitionService = new DSModelSchemaDefinitionService(this);
400
+ }
399
401
  }
400
402
  assert(
401
403
  `You must registerSchemaDefinitionService with the store to use custom model classes`,
@@ -2692,13 +2694,10 @@ export function assertIdentifierHasId(
2692
2694
  }
2693
2695
 
2694
2696
  function isDSModel(record: RecordInstance | null): record is DSModel {
2695
- return (
2696
- HAS_MODEL_PACKAGE &&
2697
- !!record &&
2698
- 'constructor' in record &&
2699
- 'isModel' in record.constructor &&
2700
- record.constructor.isModel === true
2701
- );
2697
+ if (!HAS_MODEL_PACKAGE) {
2698
+ return false;
2699
+ }
2700
+ return !!record && 'constructor' in record && 'isModel' in record.constructor && record.constructor.isModel === true;
2702
2701
  }
2703
2702
 
2704
2703
  type AdapterErrors = Error & { errors?: unknown[]; isAdapterError?: true; code?: string };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ember-data/store",
3
- "version": "4.11.0",
3
+ "version": "4.11.1",
4
4
  "description": "The core of EmberData. Provides the Store service which coordinates the cache with the network and presentation layers.",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -14,9 +14,9 @@
14
14
  "author": "",
15
15
  "directories": {},
16
16
  "peerDependencies": {
17
- "@ember-data/model": "4.11.0",
18
- "@ember-data/record-data": "4.11.0",
19
- "@ember-data/tracking": "4.11.0",
17
+ "@ember-data/model": "4.11.1",
18
+ "@ember-data/record-data": "4.11.1",
19
+ "@ember-data/tracking": "4.11.1",
20
20
  "@ember/string": "^3.0.1",
21
21
  "@glimmer/tracking": "^1.1.2"
22
22
  },
@@ -37,8 +37,8 @@
37
37
  }
38
38
  },
39
39
  "dependencies": {
40
- "@ember-data/canary-features": "4.11.0",
41
- "@ember-data/private-build-infra": "4.11.0",
40
+ "@ember-data/canary-features": "4.11.1",
41
+ "@ember-data/private-build-infra": "4.11.1",
42
42
  "@embroider/macros": "^1.10.0",
43
43
  "ember-auto-import": "^2.4.3",
44
44
  "ember-cached-decorator-polyfill": "^1.0.1",