@ember-data/model 4.8.0-alpha.6 → 4.8.0

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.
@@ -367,27 +367,29 @@ function extractIdentifiersFromRecords(records: RecordInstance[]): StableRecordI
367
367
  }
368
368
 
369
369
  function extractIdentifierFromRecord(recordOrPromiseRecord: PromiseProxyRecord | RecordInstance) {
370
- if (DEPRECATE_PROMISE_PROXIES && isPromiseRecord(recordOrPromiseRecord)) {
371
- let content = recordOrPromiseRecord.content;
372
- assert(
373
- 'You passed in a promise that did not originate from an EmberData relationship. You can only pass promises that come from a belongsTo relationship.',
374
- content !== undefined && content !== null
375
- );
376
- deprecate(
377
- `You passed in a PromiseProxy to a Relationship API that now expects a resolved value. await the value before setting it.`,
378
- false,
379
- {
380
- id: 'ember-data:deprecate-promise-proxies',
381
- until: '5.0',
382
- since: {
383
- enabled: '4.8',
384
- available: '4.8',
385
- },
386
- for: 'ember-data',
387
- }
388
- );
389
- assertRecordPassedToHasMany(content);
390
- return recordIdentifierFor(content);
370
+ if (DEPRECATE_PROMISE_PROXIES) {
371
+ if (isPromiseRecord(recordOrPromiseRecord)) {
372
+ let content = recordOrPromiseRecord.content;
373
+ assert(
374
+ 'You passed in a promise that did not originate from an EmberData relationship. You can only pass promises that come from a belongsTo relationship.',
375
+ content !== undefined && content !== null
376
+ );
377
+ deprecate(
378
+ `You passed in a PromiseProxy to a Relationship API that now expects a resolved value. await the value before setting it.`,
379
+ false,
380
+ {
381
+ id: 'ember-data:deprecate-promise-proxies',
382
+ until: '5.0',
383
+ since: {
384
+ enabled: '4.7',
385
+ available: '4.7',
386
+ },
387
+ for: 'ember-data',
388
+ }
389
+ );
390
+ assertRecordPassedToHasMany(content);
391
+ return recordIdentifierFor(content);
392
+ }
391
393
  }
392
394
 
393
395
  assertRecordPassedToHasMany(recordOrPromiseRecord);
@@ -3,11 +3,9 @@
3
3
  */
4
4
 
5
5
  import { assert, deprecate, warn } from '@ember/debug';
6
- import EmberError from '@ember/error';
7
6
  import EmberObject from '@ember/object';
8
7
  import { dependentKeyCompat } from '@ember/object/compat';
9
8
  import { run } from '@ember/runloop';
10
- import { isNone } from '@ember/utils';
11
9
  import { DEBUG } from '@glimmer/env';
12
10
  import { tracked } from '@glimmer/tracking';
13
11
  import Ember from 'ember';
@@ -18,6 +16,7 @@ import { HAS_DEBUG_PACKAGE } from '@ember-data/private-build-infra';
18
16
  import {
19
17
  DEPRECATE_EARLY_STATIC,
20
18
  DEPRECATE_MODEL_REOPEN,
19
+ DEPRECATE_NON_EXPLICIT_POLYMORPHISM,
21
20
  DEPRECATE_RELATIONSHIPS_WITHOUT_INVERSE,
22
21
  DEPRECATE_SAVE_PROMISE_ACCESS,
23
22
  } from '@ember-data/private-build-infra/deprecations';
@@ -58,7 +57,7 @@ function findPossibleInverses(type, inverseType, name, relationshipsSoFar) {
58
57
  let relationshipsForType = relationshipMap.get(type.modelName);
59
58
  let relationships = Array.isArray(relationshipsForType)
60
59
  ? relationshipsForType.filter((relationship) => {
61
- let optionsForRelationship = inverseType.metaForProperty(relationship.name).options;
60
+ let optionsForRelationship = relationship.options;
62
61
 
63
62
  if (!optionsForRelationship.inverse && optionsForRelationship.inverse !== null) {
64
63
  return true;
@@ -125,10 +124,12 @@ class Model extends EmberObject {
125
124
  ___private_notifications;
126
125
 
127
126
  init(options = {}) {
128
- if (DEBUG && !options._secretInit && !options._createProps) {
129
- throw new EmberError(
130
- 'You should not call `create` on a model. Instead, call `store.createRecord` with the attributes you would like to set.'
131
- );
127
+ if (DEBUG) {
128
+ if (!options._secretInit && !options._createProps) {
129
+ throw new Error(
130
+ 'You should not call `create` on a model. Instead, call `store.createRecord` with the attributes you would like to set.'
131
+ );
132
+ }
132
133
  }
133
134
  const createProps = options._createProps;
134
135
  const _secretInit = options._secretInit;
@@ -521,8 +522,10 @@ class Model extends EmberObject {
521
522
  // when using legacy/classic ember classes. Basically: lazy in prod and eager in dev.
522
523
  // so we do this to try to steer folks to the nicer "dont user currentState"
523
524
  // error.
524
- if (!DEBUG && !this.___recordState) {
525
- this.___recordState = new RecordState(this);
525
+ if (!DEBUG) {
526
+ if (!this.___recordState) {
527
+ this.___recordState = new RecordState(this);
528
+ }
526
529
  }
527
530
  return this.___recordState;
528
531
  }
@@ -1279,7 +1282,7 @@ class Model extends EmberObject {
1279
1282
  id: 'ember-data:deprecate-early-static',
1280
1283
  for: 'ember-data',
1281
1284
  until: '5.0',
1282
- since: { available: '4.8', enabled: '4.8' },
1285
+ since: { available: '4.7', enabled: '4.7' },
1283
1286
  }
1284
1287
  );
1285
1288
  } else {
@@ -1302,7 +1305,7 @@ class Model extends EmberObject {
1302
1305
  id: 'ember-data:deprecate-early-static',
1303
1306
  for: 'ember-data',
1304
1307
  until: '5.0',
1305
- since: { available: '4.8', enabled: '4.8' },
1308
+ since: { available: '4.7', enabled: '4.7' },
1306
1309
  }
1307
1310
  );
1308
1311
  } else {
@@ -1356,7 +1359,7 @@ class Model extends EmberObject {
1356
1359
  id: 'ember-data:deprecate-early-static',
1357
1360
  for: 'ember-data',
1358
1361
  until: '5.0',
1359
- since: { available: '4.8', enabled: '4.8' },
1362
+ since: { available: '4.7', enabled: '4.7' },
1360
1363
  }
1361
1364
  );
1362
1365
  } else {
@@ -1385,7 +1388,7 @@ class Model extends EmberObject {
1385
1388
  id: 'ember-data:deprecate-early-static',
1386
1389
  for: 'ember-data',
1387
1390
  until: '5.0',
1388
- since: { available: '4.8', enabled: '4.8' },
1391
+ since: { available: '4.7', enabled: '4.7' },
1389
1392
  }
1390
1393
  );
1391
1394
  } else {
@@ -1394,42 +1397,46 @@ class Model extends EmberObject {
1394
1397
  this.modelName
1395
1398
  );
1396
1399
  }
1397
- let inverseType = this.typeForRelationship(name, store);
1398
- if (!inverseType) {
1399
- return null;
1400
- }
1401
1400
 
1402
- let propertyMeta = this.metaForProperty(name);
1401
+ const relationship = this.relationshipsByName.get(name);
1402
+ const { options } = relationship;
1403
+ const isPolymorphic = options.polymorphic;
1404
+
1403
1405
  //If inverse is manually specified to be null, like `comments: hasMany('message', { inverse: null })`
1404
- let options = propertyMeta.options;
1405
- if (options.inverse === null) {
1406
+ const isExplicitInverseNull = options.inverse === null;
1407
+ const isAbstractType =
1408
+ !isExplicitInverseNull && isPolymorphic && !store.getSchemaDefinitionService().doesTypeExist(relationship.type);
1409
+
1410
+ if (isExplicitInverseNull || isAbstractType) {
1411
+ assert(
1412
+ `No schema for the abstract type '${relationship.type}' for the polymorphic relationship '${name}' on '${this.modelName}' was provided by the SchemaDefinitionService.`,
1413
+ !isPolymorphic || isExplicitInverseNull
1414
+ );
1406
1415
  return null;
1407
1416
  }
1408
1417
 
1409
- let inverseName, inverseKind, inverse, inverseOptions;
1418
+ let fieldOnInverse, inverseKind, inverseRelationship, inverseOptions;
1419
+ let inverseSchema = this.typeForRelationship(name, store);
1410
1420
 
1421
+ // if the type does not exist and we are not polymorphic
1411
1422
  //If inverse is specified manually, return the inverse
1412
- if (options.inverse) {
1413
- inverseName = options.inverse;
1414
- inverse = inverseType.relationshipsByName.get(inverseName);
1423
+ if (options.inverse !== undefined) {
1424
+ fieldOnInverse = options.inverse;
1425
+ inverseRelationship = inverseSchema && inverseSchema.relationshipsByName.get(fieldOnInverse);
1415
1426
 
1416
1427
  assert(
1417
- "We found no inverse relationships by the name of '" +
1418
- inverseName +
1419
- "' on the '" +
1420
- inverseType.modelName +
1421
- "' model. This is most likely due to a missing attribute on your model definition.",
1422
- !isNone(inverse)
1428
+ `We found no field named '${fieldOnInverse}' on the schema for '${inverseSchema.modelName}' to be the inverse of the '${name}' relationship on '${this.modelName}'. This is most likely due to a missing field on your model definition.`,
1429
+ inverseRelationship
1423
1430
  );
1424
1431
 
1425
1432
  // TODO probably just return the whole inverse here
1426
- inverseKind = inverse.kind;
1427
- inverseOptions = inverse.options;
1433
+ inverseKind = inverseRelationship.kind;
1434
+ inverseOptions = inverseRelationship.options;
1428
1435
  } else {
1429
1436
  //No inverse was specified manually, we need to use a heuristic to guess one
1430
- if (propertyMeta.type === propertyMeta.parentModelName) {
1437
+ if (relationship.type === relationship.parentModelName) {
1431
1438
  warn(
1432
- `Detected a reflexive relationship by the name of '${name}' without an inverse option. Look at https://guides.emberjs.com/current/models/relationships/#toc_reflexive-relations for how to explicitly specify inverses.`,
1439
+ `Detected a reflexive relationship named '${name}' on the schema for '${relationship.type}' without an inverse option. Look at https://guides.emberjs.com/current/models/relationships/#toc_reflexive-relations for how to explicitly specify inverses.`,
1433
1440
  false,
1434
1441
  {
1435
1442
  id: 'ds.model.reflexive-relationship-without-inverse',
@@ -1437,30 +1444,33 @@ class Model extends EmberObject {
1437
1444
  );
1438
1445
  }
1439
1446
 
1440
- let possibleRelationships = findPossibleInverses(this, inverseType, name);
1447
+ let possibleRelationships = findPossibleInverses(this, inverseSchema, name);
1441
1448
 
1442
1449
  if (possibleRelationships.length === 0) {
1443
1450
  return null;
1444
1451
  }
1445
1452
 
1446
- let filteredRelationships = possibleRelationships.filter((possibleRelationship) => {
1447
- let optionsForRelationship = inverseType.metaForProperty(possibleRelationship.name).options;
1448
- return name === optionsForRelationship.inverse;
1449
- });
1453
+ if (DEBUG) {
1454
+ let filteredRelationships = possibleRelationships.filter((possibleRelationship) => {
1455
+ let optionsForRelationship = possibleRelationship.options;
1456
+ return name === optionsForRelationship.inverse;
1457
+ });
1450
1458
 
1451
- assert(
1452
- "You defined the '" +
1453
- name +
1454
- "' relationship on " +
1455
- this +
1456
- ', but you defined the inverse relationships of type ' +
1457
- inverseType.toString() +
1458
- ' multiple times. Look at https://guides.emberjs.com/current/models/relationships/#toc_explicit-inverses for how to explicitly specify inverses',
1459
- filteredRelationships.length < 2
1460
- );
1459
+ assert(
1460
+ "You defined the '" +
1461
+ name +
1462
+ "' relationship on " +
1463
+ this +
1464
+ ', but you defined the inverse relationships of type ' +
1465
+ inverseSchema.toString() +
1466
+ ' multiple times. Look at https://guides.emberjs.com/current/models/relationships/#toc_explicit-inverses for how to explicitly specify inverses',
1467
+ filteredRelationships.length < 2
1468
+ );
1469
+ }
1461
1470
 
1462
- if (filteredRelationships.length === 1) {
1463
- possibleRelationships = filteredRelationships;
1471
+ let explicitRelationship = possibleRelationships.find((relationship) => relationship.options.inverse === name);
1472
+ if (explicitRelationship) {
1473
+ possibleRelationships = [explicitRelationship];
1464
1474
  }
1465
1475
 
1466
1476
  assert(
@@ -1471,24 +1481,82 @@ class Model extends EmberObject {
1471
1481
  ', but multiple possible inverse relationships of type ' +
1472
1482
  this +
1473
1483
  ' were found on ' +
1474
- inverseType +
1484
+ inverseSchema +
1475
1485
  '. Look at https://guides.emberjs.com/current/models/relationships/#toc_explicit-inverses for how to explicitly specify inverses',
1476
1486
  possibleRelationships.length === 1
1477
1487
  );
1478
1488
 
1479
- inverseName = possibleRelationships[0].name;
1489
+ fieldOnInverse = possibleRelationships[0].name;
1480
1490
  inverseKind = possibleRelationships[0].kind;
1481
1491
  inverseOptions = possibleRelationships[0].options;
1482
1492
  }
1483
1493
 
1494
+ // ensure inverse is properly configured
1495
+ if (DEBUG) {
1496
+ if (isPolymorphic) {
1497
+ if (DEPRECATE_NON_EXPLICIT_POLYMORPHISM) {
1498
+ if (!inverseOptions.as) {
1499
+ deprecate(
1500
+ `Relationships that satisfy polymorphic relationships MUST define which abstract-type they are satisfying using 'as'. The field '${fieldOnInverse}' on type '${inverseSchema.modelName}' is misconfigured.`,
1501
+ false,
1502
+ {
1503
+ id: 'ember-data:non-explicit-relationships',
1504
+ since: { enabled: '4.7', available: '4.7' },
1505
+ until: '5.0',
1506
+ for: 'ember-data',
1507
+ }
1508
+ );
1509
+ }
1510
+ } else {
1511
+ assert(
1512
+ `Relationships that satisfy polymorphic relationships MUST define which abstract-type they are satisfying using 'as'. The field '${fieldOnInverse}' on type '${inverseSchema.modelName}' is misconfigured.`,
1513
+ inverseOptions.as
1514
+ );
1515
+ assert(
1516
+ `options.as should match the expected type of the polymorphic relationship. Expected field '${fieldOnInverse}' on type '${inverseSchema.modelName}' to specify '${relationship.type}' but found '${inverseOptions.as}'`,
1517
+ !!inverseOptions.as && relationship.type === inverseOptions.as
1518
+ );
1519
+ }
1520
+ }
1521
+ }
1522
+
1523
+ // ensure we are properly configured
1524
+ if (DEBUG) {
1525
+ if (inverseOptions.polymorphic) {
1526
+ if (DEPRECATE_NON_EXPLICIT_POLYMORPHISM) {
1527
+ if (!options.as) {
1528
+ deprecate(
1529
+ `Relationships that satisfy polymorphic relationships MUST define which abstract-type they are satisfying using 'as'. The field '${name}' on type '${this.modelName}' is misconfigured.`,
1530
+ false,
1531
+ {
1532
+ id: 'ember-data:non-explicit-relationships',
1533
+ since: { enabled: '4.7', available: '4.7' },
1534
+ until: '5.0',
1535
+ for: 'ember-data',
1536
+ }
1537
+ );
1538
+ }
1539
+ } else {
1540
+ assert(
1541
+ `Relationships that satisfy polymorphic relationships MUST define which abstract-type they are satisfying using 'as'. The field '${name}' on type '${this.modelName}' is misconfigured.`,
1542
+ options.as
1543
+ );
1544
+ assert(
1545
+ `options.as should match the expected type of the polymorphic relationship. Expected field '${name}' on type '${this.modelName}' to specify '${inverseRelationship.type}' but found '${options.as}'`,
1546
+ !!options.as && inverseRelationship.type === options.as
1547
+ );
1548
+ }
1549
+ }
1550
+ }
1551
+
1484
1552
  assert(
1485
- `The ${inverseType.modelName}:${inverseName} relationship declares 'inverse: null', but it was resolved as the inverse for ${this.modelName}:${name}.`,
1486
- !inverseOptions || inverseOptions.inverse !== null
1553
+ `The ${inverseSchema.modelName}:${fieldOnInverse} relationship declares 'inverse: null', but it was resolved as the inverse for ${this.modelName}:${name}.`,
1554
+ inverseOptions.inverse !== null
1487
1555
  );
1488
1556
 
1489
1557
  return {
1490
- type: inverseType,
1491
- name: inverseName,
1558
+ type: inverseSchema,
1559
+ name: fieldOnInverse,
1492
1560
  kind: inverseKind,
1493
1561
  options: inverseOptions,
1494
1562
  };
@@ -1546,7 +1614,7 @@ class Model extends EmberObject {
1546
1614
  id: 'ember-data:deprecate-early-static',
1547
1615
  for: 'ember-data',
1548
1616
  until: '5.0',
1549
- since: { available: '4.8', enabled: '4.8' },
1617
+ since: { available: '4.7', enabled: '4.7' },
1550
1618
  }
1551
1619
  );
1552
1620
  } else {
@@ -1617,7 +1685,7 @@ class Model extends EmberObject {
1617
1685
  id: 'ember-data:deprecate-early-static',
1618
1686
  for: 'ember-data',
1619
1687
  until: '5.0',
1620
- since: { available: '4.8', enabled: '4.8' },
1688
+ since: { available: '4.7', enabled: '4.7' },
1621
1689
  }
1622
1690
  );
1623
1691
  } else {
@@ -1684,7 +1752,7 @@ class Model extends EmberObject {
1684
1752
  id: 'ember-data:deprecate-early-static',
1685
1753
  for: 'ember-data',
1686
1754
  until: '5.0',
1687
- since: { available: '4.8', enabled: '4.8' },
1755
+ since: { available: '4.7', enabled: '4.7' },
1688
1756
  }
1689
1757
  );
1690
1758
  } else {
@@ -1760,7 +1828,7 @@ class Model extends EmberObject {
1760
1828
  id: 'ember-data:deprecate-early-static',
1761
1829
  for: 'ember-data',
1762
1830
  until: '5.0',
1763
- since: { available: '4.8', enabled: '4.8' },
1831
+ since: { available: '4.7', enabled: '4.7' },
1764
1832
  }
1765
1833
  );
1766
1834
  } else {
@@ -1793,7 +1861,7 @@ class Model extends EmberObject {
1793
1861
  id: 'ember-data:deprecate-early-static',
1794
1862
  for: 'ember-data',
1795
1863
  until: '5.0',
1796
- since: { available: '4.8', enabled: '4.8' },
1864
+ since: { available: '4.7', enabled: '4.7' },
1797
1865
  }
1798
1866
  );
1799
1867
  } else {
@@ -1867,7 +1935,7 @@ class Model extends EmberObject {
1867
1935
  id: 'ember-data:deprecate-early-static',
1868
1936
  for: 'ember-data',
1869
1937
  until: '5.0',
1870
- since: { available: '4.8', enabled: '4.8' },
1938
+ since: { available: '4.7', enabled: '4.7' },
1871
1939
  }
1872
1940
  );
1873
1941
  } else {
@@ -1910,7 +1978,7 @@ class Model extends EmberObject {
1910
1978
  id: 'ember-data:deprecate-early-static',
1911
1979
  for: 'ember-data',
1912
1980
  until: '5.0',
1913
- since: { available: '4.8', enabled: '4.8' },
1981
+ since: { available: '4.7', enabled: '4.7' },
1914
1982
  }
1915
1983
  );
1916
1984
  } else {
@@ -1945,7 +2013,7 @@ class Model extends EmberObject {
1945
2013
  id: 'ember-data:deprecate-early-static',
1946
2014
  for: 'ember-data',
1947
2015
  until: '5.0',
1948
- since: { available: '4.8', enabled: '4.8' },
2016
+ since: { available: '4.7', enabled: '4.7' },
1949
2017
  }
1950
2018
  );
1951
2019
  } else {
@@ -1971,7 +2039,7 @@ class Model extends EmberObject {
1971
2039
  id: 'ember-data:deprecate-early-static',
1972
2040
  for: 'ember-data',
1973
2041
  until: '5.0',
1974
- since: { available: '4.8', enabled: '4.8' },
2042
+ since: { available: '4.7', enabled: '4.7' },
1975
2043
  }
1976
2044
  );
1977
2045
  } else {
@@ -2049,7 +2117,7 @@ class Model extends EmberObject {
2049
2117
  id: 'ember-data:deprecate-early-static',
2050
2118
  for: 'ember-data',
2051
2119
  until: '5.0',
2052
- since: { available: '4.8', enabled: '4.8' },
2120
+ since: { available: '4.7', enabled: '4.7' },
2053
2121
  }
2054
2122
  );
2055
2123
  } else {
@@ -2125,7 +2193,7 @@ class Model extends EmberObject {
2125
2193
  id: 'ember-data:deprecate-early-static',
2126
2194
  for: 'ember-data',
2127
2195
  until: '5.0',
2128
- since: { available: '4.8', enabled: '4.8' },
2196
+ since: { available: '4.7', enabled: '4.7' },
2129
2197
  }
2130
2198
  );
2131
2199
  } else {
@@ -2198,7 +2266,7 @@ class Model extends EmberObject {
2198
2266
  id: 'ember-data:deprecate-early-static',
2199
2267
  for: 'ember-data',
2200
2268
  until: '5.0',
2201
- since: { available: '4.8', enabled: '4.8' },
2269
+ since: { available: '4.7', enabled: '4.7' },
2202
2270
  }
2203
2271
  );
2204
2272
  } else {
@@ -2266,7 +2334,7 @@ class Model extends EmberObject {
2266
2334
  id: 'ember-data:deprecate-early-static',
2267
2335
  for: 'ember-data',
2268
2336
  until: '5.0',
2269
- since: { available: '4.8', enabled: '4.8' },
2337
+ since: { available: '4.7', enabled: '4.7' },
2270
2338
  }
2271
2339
  );
2272
2340
  } else {
@@ -2296,7 +2364,7 @@ class Model extends EmberObject {
2296
2364
  id: 'ember-data:deprecate-early-static',
2297
2365
  for: 'ember-data',
2298
2366
  until: '5.0',
2299
- since: { available: '4.8', enabled: '4.8' },
2367
+ since: { available: '4.7', enabled: '4.7' },
2300
2368
  }
2301
2369
  );
2302
2370
  } else {
@@ -2408,7 +2476,7 @@ if (DEBUG) {
2408
2476
  let idDesc = lookupDescriptor(this, 'id');
2409
2477
 
2410
2478
  if (idDesc.get !== ID_DESCRIPTOR.get) {
2411
- throw new EmberError(
2479
+ throw new Error(
2412
2480
  `You may not set 'id' as an attribute on your model. Please remove any lines that look like: \`id: attr('<type>')\` from ${this.constructor.toString()}`
2413
2481
  );
2414
2482
  }
@@ -2424,7 +2492,7 @@ if (DEBUG) {
2424
2492
  id: 'ember-data:deprecate-model-reopen',
2425
2493
  for: 'ember-data',
2426
2494
  until: '5.0',
2427
- since: { available: '4.8', enabled: '4.8' },
2495
+ since: { available: '4.7', enabled: '4.7' },
2428
2496
  });
2429
2497
  return originalReopen.call(this, ...arguments);
2430
2498
  };
@@ -2437,7 +2505,7 @@ if (DEBUG) {
2437
2505
  id: 'ember-data:deprecate-model-reopenclass',
2438
2506
  for: 'ember-data',
2439
2507
  until: '5.0',
2440
- since: { available: '4.8', enabled: '4.8' },
2508
+ since: { available: '4.7', enabled: '4.7' },
2441
2509
  }
2442
2510
  );
2443
2511
  return originalReopenClass.call(this, ...arguments);
@@ -64,7 +64,7 @@ export default class PromiseManyArray {
64
64
  deprecate(`Do not use A() on an EmberData PromiseManyArray`, false, {
65
65
  id: 'ember-data:no-a-with-array-like',
66
66
  until: '5.0',
67
- since: { enabled: '4.8', available: '4.8' },
67
+ since: { enabled: '4.7', available: '4.7' },
68
68
  for: 'ember-data',
69
69
  });
70
70
  // @ts-expect-error ArrayMixin is more than a type
@@ -261,7 +261,7 @@ if (DEPRECATE_PROMISE_MANY_ARRAY_BEHAVIORS) {
261
261
  {
262
262
  id: 'ember-data:deprecate-promise-many-array-behaviors',
263
263
  until: '5.0',
264
- since: { enabled: '4.8', available: '4.8' },
264
+ since: { enabled: '4.7', available: '4.7' },
265
265
  for: 'ember-data',
266
266
  }
267
267
  );
@@ -277,7 +277,7 @@ if (DEPRECATE_PROMISE_MANY_ARRAY_BEHAVIORS) {
277
277
  {
278
278
  id: 'ember-data:deprecate-promise-many-array-behaviors',
279
279
  until: '5.0',
280
- since: { enabled: '4.8', available: '4.8' },
280
+ since: { enabled: '4.7', available: '4.7' },
281
281
  for: 'ember-data',
282
282
  }
283
283
  );
@@ -293,7 +293,7 @@ if (DEPRECATE_PROMISE_MANY_ARRAY_BEHAVIORS) {
293
293
  {
294
294
  id: 'ember-data:deprecate-promise-many-array-behaviors',
295
295
  until: '5.0',
296
- since: { enabled: '4.8', available: '4.8' },
296
+ since: { enabled: '4.7', available: '4.7' },
297
297
  for: 'ember-data',
298
298
  }
299
299
  );
@@ -347,7 +347,7 @@ if (DEPRECATE_PROMISE_MANY_ARRAY_BEHAVIORS) {
347
347
  {
348
348
  id: 'ember-data:deprecate-promise-many-array-behaviors',
349
349
  until: '5.0',
350
- since: { enabled: '4.8', available: '4.8' },
350
+ since: { enabled: '4.7', available: '4.7' },
351
351
  for: 'ember-data',
352
352
  }
353
353
  );
@@ -414,7 +414,7 @@ if (DEPRECATE_PROMISE_MANY_ARRAY_BEHAVIORS) {
414
414
  {
415
415
  id: 'ember-data:deprecate-promise-many-array-behaviors',
416
416
  until: '5.0',
417
- since: { enabled: '4.8', available: '4.8' },
417
+ since: { enabled: '4.7', available: '4.7' },
418
418
  for: 'ember-data',
419
419
  }
420
420
  );
@@ -8,6 +8,7 @@ import { storeFor } from '@ember-data/store';
8
8
  import { recordIdentifierFor } from '@ember-data/store/-private';
9
9
  import type { NotificationType } from '@ember-data/store/-private/managers/record-notification-manager';
10
10
  import type RequestCache from '@ember-data/store/-private/network/request-cache';
11
+ import { addToTransaction, subscribe } from '@ember-data/tracking/-private';
11
12
  import type { StableRecordIdentifier } from '@ember-data/types/q/identifier';
12
13
  import type { RecordData } from '@ember-data/types/q/record-data';
13
14
 
@@ -35,21 +36,19 @@ class Tag {
35
36
  declare rev: number;
36
37
  declare isDirty: boolean;
37
38
  declare value: any;
39
+ declare t: boolean;
38
40
 
39
41
  constructor() {
40
42
  this.rev = 1;
41
43
  this.isDirty = true;
42
44
  this.value = undefined;
45
+ this.t = false;
43
46
  }
44
- @tracked _tracking = 0;
45
-
46
- subscribe() {
47
- this._tracking;
48
- }
47
+ @tracked ref = null;
49
48
 
50
49
  notify() {
51
50
  this.isDirty = true;
52
- this._tracking = this.rev;
51
+ addToTransaction(this);
53
52
  this.rev++;
54
53
  }
55
54
  consume(v) {
@@ -86,7 +85,7 @@ export function tagged(_target, key, desc) {
86
85
  const setter = desc.set;
87
86
  desc.get = function () {
88
87
  let tag = getTag(this, key);
89
- tag.subscribe();
88
+ subscribe(tag);
90
89
 
91
90
  if (tag.isDirty) {
92
91
  tag.consume(getter.call(this));