@ember-data/store 4.1.0 → 4.2.0-alpha.3

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.
@@ -7,8 +7,6 @@ import { assert } from '@ember/debug';
7
7
  import { get, set } from '@ember/object';
8
8
  import { _backburner as emberBackburner } from '@ember/runloop';
9
9
 
10
- import { REMOVE_RECORD_ARRAY_MANAGER_LEGACY_COMPAT } from '@ember-data/canary-features';
11
-
12
10
  import isStableIdentifier from '../identifiers/is-stable-identifier';
13
11
  import { AdapterPopulatedRecordArray, RecordArray } from './record-arrays';
14
12
  import { internalModelFactoryFor } from './store/internal-model-factory';
@@ -27,11 +25,10 @@ export function recordArraysForIdentifier(identifierOrInternalModel) {
27
25
  }
28
26
 
29
27
  const pendingForIdentifier = new Set([]);
30
- const IMDematerializing = new WeakMap();
31
28
 
32
29
  const getIdentifier = function getIdentifier(identifierOrInternalModel) {
33
30
  let i = identifierOrInternalModel;
34
- if (!REMOVE_RECORD_ARRAY_MANAGER_LEGACY_COMPAT && !isStableIdentifier(identifierOrInternalModel)) {
31
+ if (!isStableIdentifier(identifierOrInternalModel)) {
35
32
  // identifier may actually be an internalModel
36
33
  // but during materialization we will get an identifier that
37
34
  // has already been removed from the identifiers cache yet
@@ -42,18 +39,7 @@ const getIdentifier = function getIdentifier(identifierOrInternalModel) {
42
39
  return i;
43
40
  };
44
41
 
45
- // REMOVE_RECORD_ARRAY_MANAGER_LEGACY_COMPAT only
46
42
  const peekIMCache = function peekIMCache(cache, identifier) {
47
- if (!REMOVE_RECORD_ARRAY_MANAGER_LEGACY_COMPAT) {
48
- let im = IMDematerializing.get(identifier);
49
- if (im === undefined) {
50
- // if not im._isDematerializing
51
- im = cache.peek(identifier);
52
- }
53
-
54
- return im;
55
- }
56
-
57
43
  return cache.peek(identifier);
58
44
  };
59
45
 
@@ -351,14 +337,6 @@ class RecordArrayManager {
351
337
  let modelName = identifier.type;
352
338
  identifier = getIdentifier(identifier);
353
339
 
354
- if (!REMOVE_RECORD_ARRAY_MANAGER_LEGACY_COMPAT) {
355
- const cache = internalModelFactoryFor(this.store);
356
- const im = peekIMCache(cache, identifier);
357
- if (im && im._isDematerializing) {
358
- IMDematerializing.set(identifier, im);
359
- }
360
- }
361
-
362
340
  if (pendingForIdentifier.has(identifier)) {
363
341
  return;
364
342
  }
@@ -428,15 +406,10 @@ const updateLiveRecordArray = function updateLiveRecordArray(store, recordArray,
428
406
  };
429
407
 
430
408
  const pushIdentifiers = function pushIdentifiers(recordArray, identifiers, cache) {
431
- if (!REMOVE_RECORD_ARRAY_MANAGER_LEGACY_COMPAT && !recordArray._pushIdentifiers) {
432
- // deprecate('not allowed to use this intimate api any more');
433
- recordArray._pushInternalModels(identifiers.map((i) => peekIMCache(cache, i)));
434
- } else {
435
- recordArray._pushIdentifiers(identifiers);
436
- }
409
+ recordArray._pushIdentifiers(identifiers);
437
410
  };
438
411
  const removeIdentifiers = function removeIdentifiers(recordArray, identifiers, cache) {
439
- if (!REMOVE_RECORD_ARRAY_MANAGER_LEGACY_COMPAT && !recordArray._removeIdentifiers) {
412
+ if (!recordArray._removeIdentifiers) {
440
413
  // deprecate('not allowed to use this intimate api any more');
441
414
  recordArray._removeInternalModels(identifiers.map((i) => peekIMCache(cache, i)));
442
415
  } else {
@@ -4,7 +4,6 @@ import { cached, tracked } from '@glimmer/tracking';
4
4
 
5
5
  import { resolve } from 'rsvp';
6
6
 
7
- import { CUSTOM_MODEL_CLASS } from '@ember-data/canary-features';
8
7
  import { DEPRECATE_BELONGS_TO_REFERENCE_PUSH } from '@ember-data/private-build-infra/deprecations';
9
8
  import type { BelongsToRelationship } from '@ember-data/record-data/-private';
10
9
  import { assertPolymorphicType } from '@ember-data/store/-debug';
@@ -57,26 +56,22 @@ export default class BelongsToReference extends Reference {
57
56
  this.parent = parent!.recordReference;
58
57
  this.parentIdentifier = parentIdentifier;
59
58
 
60
- if (CUSTOM_MODEL_CLASS) {
61
- this.#token = store._notificationManager.subscribe(
62
- parentIdentifier,
63
- (_: StableRecordIdentifier, bucket: NotificationType, notifiedKey?: string) => {
64
- if ((bucket === 'relationships' || bucket === 'property') && notifiedKey === key) {
65
- this._ref++;
66
- }
59
+ this.#token = store._notificationManager.subscribe(
60
+ parentIdentifier,
61
+ (_: StableRecordIdentifier, bucket: NotificationType, notifiedKey?: string) => {
62
+ if ((bucket === 'relationships' || bucket === 'property') && notifiedKey === key) {
63
+ this._ref++;
67
64
  }
68
- );
69
- }
65
+ }
66
+ );
70
67
 
71
68
  // TODO inverse
72
69
  }
73
70
 
74
71
  destroy() {
75
- if (CUSTOM_MODEL_CLASS) {
76
- unsubscribe(this.#token);
77
- if (this.#relatedToken) {
78
- unsubscribe(this.#relatedToken);
79
- }
72
+ unsubscribe(this.#token);
73
+ if (this.#relatedToken) {
74
+ unsubscribe(this.#relatedToken);
80
75
  }
81
76
  }
82
77
 
@@ -147,17 +142,7 @@ export default class BelongsToReference extends Reference {
147
142
  @return {String} The id of the record in this belongsTo relationship.
148
143
  */
149
144
  id(): string | null {
150
- if (CUSTOM_MODEL_CLASS) {
151
- return this._relatedIdentifier?.id || null;
152
- }
153
- let resource = this._resource();
154
- if (resource && resource.data) {
155
- const identifier = this.store.identifierCache.getOrCreateRecordIdentifier(resource.data);
156
-
157
- return identifier.id;
158
- }
159
-
160
- return null;
145
+ return this._relatedIdentifier?.id || null;
161
146
  }
162
147
 
163
148
  _resource() {
@@ -4,7 +4,6 @@ import { cached, tracked } from '@glimmer/tracking';
4
4
 
5
5
  import { resolve } from 'rsvp';
6
6
 
7
- import { CUSTOM_MODEL_CLASS } from '@ember-data/canary-features';
8
7
  import type { ManyRelationship } from '@ember-data/record-data/-private';
9
8
  import { assertPolymorphicType } from '@ember-data/store/-debug';
10
9
 
@@ -58,28 +57,24 @@ export default class HasManyReference extends Reference {
58
57
 
59
58
  this.parent = internalModelFactoryFor(store).peek(parentIdentifier)!.recordReference;
60
59
 
61
- if (CUSTOM_MODEL_CLASS) {
62
- this.#token = store._notificationManager.subscribe(
63
- parentIdentifier,
64
- (_: StableRecordIdentifier, bucket: NotificationType, notifiedKey?: string) => {
65
- if ((bucket === 'relationships' || bucket === 'property') && notifiedKey === key) {
66
- this._ref++;
67
- }
60
+ this.#token = store._notificationManager.subscribe(
61
+ parentIdentifier,
62
+ (_: StableRecordIdentifier, bucket: NotificationType, notifiedKey?: string) => {
63
+ if ((bucket === 'relationships' || bucket === 'property') && notifiedKey === key) {
64
+ this._ref++;
68
65
  }
69
- );
70
- this.#relatedTokenMap = new Map();
71
- }
66
+ }
67
+ );
68
+ this.#relatedTokenMap = new Map();
72
69
  // TODO inverse
73
70
  }
74
71
 
75
72
  destroy() {
76
- if (CUSTOM_MODEL_CLASS) {
77
- unsubscribe(this.#token);
78
- this.#relatedTokenMap.forEach((token) => {
79
- unsubscribe(token);
80
- });
81
- this.#relatedTokenMap.clear();
82
- }
73
+ unsubscribe(this.#token);
74
+ this.#relatedTokenMap.forEach((token) => {
75
+ unsubscribe(token);
76
+ });
77
+ this.#relatedTokenMap.clear();
83
78
  }
84
79
 
85
80
  @cached
@@ -206,21 +201,7 @@ export default class HasManyReference extends Reference {
206
201
  @return {Array} The ids in this has-many relationship
207
202
  */
208
203
  ids(): Array<string | null> {
209
- if (CUSTOM_MODEL_CLASS) {
210
- return this._relatedIdentifiers.map((identifier) => identifier.id);
211
- }
212
-
213
- let resource = this._resource();
214
-
215
- if (resource && resource.data) {
216
- return resource.data.map((resourceIdentifier) => {
217
- const identifier = this.store.identifierCache.getOrCreateRecordIdentifier(resourceIdentifier);
218
-
219
- return identifier.id;
220
- });
221
- }
222
-
223
- return [];
204
+ return this._relatedIdentifiers.map((identifier) => identifier.id);
224
205
  }
225
206
 
226
207
  /**
@@ -3,8 +3,6 @@ import { cached, tracked } from '@glimmer/tracking';
3
3
 
4
4
  import RSVP, { resolve } from 'rsvp';
5
5
 
6
- import { CUSTOM_MODEL_CLASS } from '@ember-data/canary-features';
7
-
8
6
  import type { SingleResourceDocument } from '../../ts-interfaces/ember-data-json-api';
9
7
  import type { StableRecordIdentifier } from '../../ts-interfaces/identifier';
10
8
  import type { RecordInstance } from '../../ts-interfaces/record-instance';
@@ -32,22 +30,18 @@ export default class RecordReference extends Reference {
32
30
 
33
31
  constructor(public store: CoreStore, identifier: StableRecordIdentifier) {
34
32
  super(store, identifier);
35
- if (CUSTOM_MODEL_CLASS) {
36
- this.#token = store._notificationManager.subscribe(
37
- identifier,
38
- (_: StableRecordIdentifier, bucket: NotificationType, notifiedKey?: string) => {
39
- if (bucket === 'identity' || ((bucket === 'attributes' || bucket === 'property') && notifiedKey === 'id')) {
40
- this._ref++;
41
- }
33
+ this.#token = store._notificationManager.subscribe(
34
+ identifier,
35
+ (_: StableRecordIdentifier, bucket: NotificationType, notifiedKey?: string) => {
36
+ if (bucket === 'identity' || ((bucket === 'attributes' || bucket === 'property') && notifiedKey === 'id')) {
37
+ this._ref++;
42
38
  }
43
- );
44
- }
39
+ }
40
+ );
45
41
  }
46
42
 
47
43
  destroy() {
48
- if (CUSTOM_MODEL_CLASS) {
49
- unsubscribe(this.#token);
50
- }
44
+ unsubscribe(this.#token);
51
45
  }
52
46
 
53
47
  public get type(): string {
@@ -85,15 +79,7 @@ export default class RecordReference extends Reference {
85
79
  @return {String} The id of the record.
86
80
  */
87
81
  id() {
88
- if (CUSTOM_MODEL_CLASS) {
89
- return this._id;
90
- }
91
- let identifier = this.identifier();
92
- if (identifier) {
93
- return identifier.id;
94
- }
95
-
96
- return null;
82
+ return this._id;
97
83
  }
98
84
 
99
85
  /**
@@ -1,9 +1,5 @@
1
- import { deprecate } from '@ember/debug';
2
-
3
1
  import type { Object as JSONObject, Value as JSONValue } from 'json-typescript';
4
2
 
5
- import { DEPRECATE_REFERENCE_INTERNAL_MODEL } from '@ember-data/private-build-infra/deprecations';
6
-
7
3
  import type { LinkObject, PaginationLinks } from '../../ts-interfaces/ember-data-json-api';
8
4
  import type { StableRecordIdentifier } from '../../ts-interfaces/identifier';
9
5
  import type { JsonApiRelationship } from '../../ts-interfaces/record-data-json-api';
@@ -185,9 +181,9 @@ abstract class Reference {
185
181
  related: {
186
182
  href: '/articles/1/author'
187
183
  },
188
- meta: {
189
- lastUpdated: 1458014400000
190
- }
184
+ },
185
+ meta: {
186
+ lastUpdated: 1458014400000
191
187
  }
192
188
  }
193
189
  }
@@ -213,22 +209,4 @@ abstract class Reference {
213
209
  }
214
210
  }
215
211
 
216
- if (DEPRECATE_REFERENCE_INTERNAL_MODEL) {
217
- Object.defineProperty(Reference.prototype, 'internalModel', {
218
- get() {
219
- deprecate('Accessing the internalModel property of Reference is deprecated', false, {
220
- id: 'ember-data:reference-internal-model',
221
- until: '3.21',
222
- for: '@ember-data/store',
223
- since: {
224
- available: '3.19',
225
- enabled: '3.19',
226
- },
227
- });
228
-
229
- return REFERENCE_CACHE.get(this);
230
- },
231
- });
232
- }
233
-
234
212
  export default Reference;
@@ -4,7 +4,6 @@
4
4
  import { assert } from '@ember/debug';
5
5
  import { get } from '@ember/object';
6
6
 
7
- import { CUSTOM_MODEL_CLASS } from '@ember-data/canary-features';
8
7
  import { HAS_RECORD_DATA_PACKAGE } from '@ember-data/private-build-infra';
9
8
 
10
9
  import type { DSModel, DSModelSchema, ModelSchema } from '../ts-interfaces/ds-model';
@@ -65,10 +64,9 @@ export default class Snapshot implements Snapshot {
65
64
  let internalModel = (this._internalModel = _store._internalModelForResource(identifier));
66
65
  this.modelName = identifier.type;
67
66
 
68
- if (CUSTOM_MODEL_CLASS) {
69
- // TODO add public docs once this FF is on
70
- this.identifier = identifier;
71
- }
67
+ // TODO add public docs once this FF is on
68
+ this.identifier = identifier;
69
+
72
70
  /*
73
71
  If the internalModel does not yet have a record, then we are
74
72
  likely a snapshot being provided to a find request, so we
@@ -151,26 +149,15 @@ export default class Snapshot implements Snapshot {
151
149
  }
152
150
  let record = this.record;
153
151
  let attributes = (this.__attributes = Object.create(null));
154
- let attrs: string[];
155
-
156
- if (CUSTOM_MODEL_CLASS) {
157
- attrs = Object.keys(this._store._attributesDefinitionFor(this.modelName, this.identifier));
158
- } else {
159
- attrs = Object.keys(this._store._attributesDefinitionFor(this.modelName));
160
- }
161
- if (CUSTOM_MODEL_CLASS) {
162
- attrs.forEach((keyName) => {
163
- if (schemaIsDSModel(this.type)) {
164
- // if the schema is for a DSModel then the instance is too
165
- attributes[keyName] = get(record as DSModel, keyName);
166
- } else {
167
- attributes[keyName] = recordDataFor(this._internalModel).getAttr(keyName);
168
- }
169
- });
170
- } else {
171
- // When CUSTOM_MODEL_CLASS is false `record` must be DSModel
172
- (record as DSModel).eachAttribute((keyName) => (attributes[keyName] = get(record as DSModel, keyName)));
173
- }
152
+ let attrs = Object.keys(this._store._attributesDefinitionFor(this.modelName, this.identifier));
153
+ attrs.forEach((keyName) => {
154
+ if (schemaIsDSModel(this.type)) {
155
+ // if the schema is for a DSModel then the instance is too
156
+ attributes[keyName] = get(record as DSModel, keyName);
157
+ } else {
158
+ attributes[keyName] = recordDataFor(this._internalModel).getAttr(keyName);
159
+ }
160
+ });
174
161
 
175
162
  return attributes;
176
163
  }
@@ -187,9 +174,6 @@ export default class Snapshot implements Snapshot {
187
174
  }
188
175
 
189
176
  get isNew(): boolean {
190
- if (!CUSTOM_MODEL_CLASS) {
191
- throw new Error('isNew is only available when custom model class ff is on');
192
- }
193
177
  return this._internalModel.isNew();
194
178
  }
195
179
 
@@ -333,7 +317,7 @@ export default class Snapshot implements Snapshot {
333
317
  }
334
318
 
335
319
  const graphFor = require('@ember-data/record-data/-private').graphFor;
336
- const { identifier } = CUSTOM_MODEL_CLASS ? this : this._internalModel;
320
+ const { identifier } = this;
337
321
  const relationship = graphFor(this._store._storeWrapper).get(identifier, keyName);
338
322
 
339
323
  assert(
@@ -432,7 +416,7 @@ export default class Snapshot implements Snapshot {
432
416
  }
433
417
 
434
418
  const graphFor = require('@ember-data/record-data/-private').graphFor;
435
- const { identifier } = CUSTOM_MODEL_CLASS ? this : this._internalModel;
419
+ const { identifier } = this;
436
420
  const relationship = graphFor(this._store._storeWrapper).get(identifier, keyName);
437
421
  assert(
438
422
  `You looked up the ${keyName} hasMany relationship for { type: ${identifier.type}, id: ${identifier.id}, lid: ${identifier.lid} but no such relationship was found.`,
@@ -488,15 +472,10 @@ export default class Snapshot implements Snapshot {
488
472
  @public
489
473
  */
490
474
  eachAttribute(callback: (key: string, meta: AttributeSchema) => void, binding?: unknown): void {
491
- if (CUSTOM_MODEL_CLASS) {
492
- let attrDefs = this._store._attributesDefinitionFor(this.modelName, this.identifier);
493
- Object.keys(attrDefs).forEach((key) => {
494
- callback.call(binding, key, attrDefs[key] as AttributeSchema);
495
- });
496
- } else {
497
- // in the non CUSTOM_MODEL_CLASS world we only have DSModel instances
498
- (this.record as DSModel).eachAttribute(callback, binding);
499
- }
475
+ let attrDefs = this._store._attributesDefinitionFor(this.modelName, this.identifier);
476
+ Object.keys(attrDefs).forEach((key) => {
477
+ callback.call(binding, key, attrDefs[key] as AttributeSchema);
478
+ });
500
479
  }
501
480
 
502
481
  /**
@@ -517,15 +496,10 @@ export default class Snapshot implements Snapshot {
517
496
  @public
518
497
  */
519
498
  eachRelationship(callback: (key: string, meta: RelationshipSchema) => void, binding?: unknown): void {
520
- if (CUSTOM_MODEL_CLASS) {
521
- let relationshipDefs = this._store._relationshipsDefinitionFor(this.modelName, this.identifier);
522
- Object.keys(relationshipDefs).forEach((key) => {
523
- callback.call(binding, key, relationshipDefs[key] as RelationshipSchema);
524
- });
525
- } else {
526
- // in the non CUSTOM_MODEL_CLASS world we only have DSModel instances
527
- (this.record as DSModel).eachRelationship(callback, binding);
528
- }
499
+ let relationshipDefs = this._store._relationshipsDefinitionFor(this.modelName, this.identifier);
500
+ Object.keys(relationshipDefs).forEach((key) => {
501
+ callback.call(binding, key, relationshipDefs[key] as RelationshipSchema);
502
+ });
529
503
  }
530
504
 
531
505
  /**
@@ -1,11 +1,8 @@
1
- import { assert, deprecate, warn } from '@ember/debug';
1
+ import { assert, deprecate } from '@ember/debug';
2
2
  import { DEBUG } from '@glimmer/env';
3
3
 
4
4
  import { Promise } from 'rsvp';
5
5
 
6
- import { REQUEST_SERVICE } from '@ember-data/canary-features';
7
-
8
- import coerceId from '../coerce-id';
9
6
  import { _bind, _guard, _objectIsAlive, guardDestroyedStore } from './common';
10
7
  import { normalizeResponseHelper } from './serializer-response';
11
8
 
@@ -21,60 +18,7 @@ function payloadIsNotBlank(adapterPayload) {
21
18
  }
22
19
  }
23
20
 
24
- export function _find(adapter, store, modelClass, id, internalModel, options) {
25
- if (REQUEST_SERVICE) {
26
- assert(`Requests made when REQUEST_SERVICE=true should not use the legacy finders`);
27
- }
28
- let snapshot = internalModel.createSnapshot(options);
29
- let { modelName } = internalModel;
30
- let promise = Promise.resolve().then(() => {
31
- return adapter.findRecord(store, modelClass, id, snapshot);
32
- });
33
- let label = `DS: Handle Adapter#findRecord of '${modelName}' with id: '${id}'`;
34
- const { identifier } = internalModel;
35
-
36
- promise = guardDestroyedStore(promise, store, label);
37
-
38
- return promise.then(
39
- (adapterPayload) => {
40
- assert(
41
- `You made a 'findRecord' request for a '${modelName}' with id '${id}', but the adapter's response did not have any data`,
42
- payloadIsNotBlank(adapterPayload)
43
- );
44
- let serializer = store.serializerFor(modelName);
45
- let payload = normalizeResponseHelper(serializer, store, modelClass, adapterPayload, id, 'findRecord');
46
- assert(
47
- `Ember Data expected the primary data returned from a 'findRecord' response to be an object but instead it found an array.`,
48
- !Array.isArray(payload.data)
49
- );
50
- assert(
51
- `The 'findRecord' request for ${modelName}:${id} resolved indicating success but contained no primary data. To indicate a 404 not found you should either reject the promise returned by the adapter's findRecord method or throw a NotFoundError.`,
52
- 'data' in payload && payload.data !== null && typeof payload.data === 'object'
53
- );
54
- warn(
55
- `You requested a record of type '${modelName}' with id '${id}' but the adapter returned a payload with primary data having an id of '${payload.data.id}'. Use 'store.findRecord()' when the requested id is the same as the one returned by the adapter. In other cases use 'store.queryRecord()' instead.`,
56
- coerceId(payload.data.id) === coerceId(id),
57
- {
58
- id: 'ds.store.findRecord.id-mismatch',
59
- }
60
- );
61
-
62
- // ensure that regardless of id returned we assign to the correct record
63
- payload.data.lid = identifier.lid;
64
-
65
- return store._push(payload);
66
- },
67
- (error) => {
68
- internalModel.send('notFound');
69
- if (internalModel.currentState.isEmpty) {
70
- internalModel.unloadRecord();
71
- }
72
-
73
- throw error;
74
- },
75
- `DS: Extract payload of '${modelName}'`
76
- );
77
- }
21
+ export function _find() {}
78
22
 
79
23
  export function _findMany(adapter, store, modelName, ids, internalModels, optionsMap) {
80
24
  let snapshots = internalModels.map((internalModel) => internalModel.createSnapshot(optionsMap.get(internalModel)));
@@ -1,4 +1,3 @@
1
- import { CUSTOM_MODEL_CLASS } from '@ember-data/canary-features';
2
1
  import type { RelationshipDefinition } from '@ember-data/model/-private/system/relationships/relationship-meta';
3
2
  import { HAS_RECORD_DATA_PACKAGE } from '@ember-data/private-build-infra';
4
3
 
@@ -118,16 +117,13 @@ export default class RecordDataStoreWrapper implements StoreWrapper {
118
117
  if (!definition) {
119
118
  return null;
120
119
  }
121
- if (CUSTOM_MODEL_CLASS) {
122
- if (metaIsRelationshipDefinition(definition)) {
123
- return definition._inverseKey(this._store, modelClass);
124
- } else if (definition.options && definition.options.inverse !== undefined) {
125
- return definition.options.inverse;
126
- } else {
127
- return null;
128
- }
120
+
121
+ if (metaIsRelationshipDefinition(definition)) {
122
+ return definition._inverseKey(this._store, modelClass);
123
+ } else if (definition.options && definition.options.inverse !== undefined) {
124
+ return definition.options.inverse;
129
125
  } else {
130
- return (definition as RelationshipDefinition)._inverseKey(this._store, modelClass);
126
+ return null;
131
127
  }
132
128
  }
133
129
 
@@ -137,21 +133,18 @@ export default class RecordDataStoreWrapper implements StoreWrapper {
137
133
  if (!definition) {
138
134
  return false;
139
135
  }
140
- if (CUSTOM_MODEL_CLASS) {
141
- if (definition.options && definition.options.inverse === null) {
142
- return false;
143
- }
144
- if ((definition as unknown as { inverseIsAsync?: boolean }).inverseIsAsync !== undefined) {
145
- // TODO do we need to amend the RFC for this prop?
146
- // else we should add it to the TS interface and document.
147
- return !!(definition as unknown as { inverseIsAsync: boolean }).inverseIsAsync;
148
- } else if (metaIsRelationshipDefinition(definition)) {
149
- return definition._inverseIsAsync(this._store, modelClass);
150
- } else {
151
- return false;
152
- }
136
+
137
+ if (definition.options && definition.options.inverse === null) {
138
+ return false;
139
+ }
140
+ if ((definition as unknown as { inverseIsAsync?: boolean }).inverseIsAsync !== undefined) {
141
+ // TODO do we need to amend the RFC for this prop?
142
+ // else we should add it to the TS interface and document.
143
+ return !!(definition as unknown as { inverseIsAsync: boolean }).inverseIsAsync;
144
+ } else if (metaIsRelationshipDefinition(definition)) {
145
+ return definition._inverseIsAsync(this._store, modelClass);
153
146
  } else {
154
- return (definition as RelationshipDefinition)._inverseIsAsync(this._store, modelClass);
147
+ return false;
155
148
  }
156
149
  }
157
150
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ember-data/store",
3
- "version": "4.1.0",
3
+ "version": "4.2.0-alpha.3",
4
4
  "description": "The default blueprint for ember-cli addons.",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -17,8 +17,8 @@
17
17
  "start": "ember serve"
18
18
  },
19
19
  "dependencies": {
20
- "@ember-data/canary-features": "4.1.0",
21
- "@ember-data/private-build-infra": "4.1.0",
20
+ "@ember-data/canary-features": "4.2.0-alpha.3",
21
+ "@ember-data/private-build-infra": "4.2.0-alpha.3",
22
22
  "@ember/string": "^3.0.0",
23
23
  "@glimmer/tracking": "^1.0.4",
24
24
  "ember-auto-import": "^2.2.4",
@@ -28,24 +28,24 @@
28
28
  "ember-cli-typescript": "^4.1.0"
29
29
  },
30
30
  "devDependencies": {
31
- "@ember-data/unpublished-test-infra": "4.1.0",
31
+ "@ember-data/unpublished-test-infra": "4.2.0-alpha.3",
32
32
  "@ember/optional-features": "^2.0.0",
33
33
  "@ember/test-helpers": "^2.6.0",
34
34
  "@types/ember": "^3.16.5",
35
35
  "@types/rsvp": "^4.0.3",
36
36
  "broccoli-asset-rev": "^3.0.0",
37
- "ember-cli": "~3.26.1",
37
+ "ember-cli": "~4.0.1",
38
38
  "ember-cli-dependency-checker": "^3.2.0",
39
- "ember-cli-htmlbars": "^5.1.2",
39
+ "ember-cli-htmlbars": "^6.0.1",
40
40
  "ember-cli-inject-live-reload": "^2.0.2",
41
41
  "ember-cli-sri": "^2.1.1",
42
42
  "ember-cli-terser": "~4.0.1",
43
43
  "ember-disable-prototype-extensions": "^1.1.3",
44
44
  "ember-export-application-global": "^2.0.1",
45
45
  "ember-load-initializers": "^2.1.1",
46
- "ember-maybe-import-regenerator": "^0.1.6",
46
+ "ember-maybe-import-regenerator": "^1.0.0",
47
47
  "ember-qunit": "^5.1.5",
48
- "ember-resolver": "^8.0.0",
48
+ "ember-resolver": "^8.0.3",
49
49
  "ember-source": "~4.0.0",
50
50
  "ember-source-channel-url": "^3.0.0",
51
51
  "ember-try": "^1.4.0",