@ember-data/store 5.6.0-alpha.2 → 5.6.0-alpha.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.
Files changed (69) hide show
  1. package/README.md +5 -5
  2. package/dist/-private.js +2 -2
  3. package/dist/{configure-BfLLW6GY.js → configure-BCr2QDik.js} +0 -1
  4. package/dist/configure-BCr2QDik.js.map +1 -0
  5. package/dist/configure.js +1 -1
  6. package/dist/index.js +2 -2
  7. package/dist/{request-state-uRtpn0Lc.js → request-state-BEsHKec0.js} +119 -255
  8. package/dist/request-state-BEsHKec0.js.map +1 -0
  9. package/package.json +11 -14
  10. package/unstable-preview-types/-private/cache-handler/handler.d.ts +3 -6
  11. package/unstable-preview-types/-private/cache-handler/handler.d.ts.map +1 -1
  12. package/unstable-preview-types/-private/cache-handler/types.d.ts +1 -7
  13. package/unstable-preview-types/-private/cache-handler/types.d.ts.map +1 -1
  14. package/unstable-preview-types/-private/caches/identifier-cache.d.ts +0 -9
  15. package/unstable-preview-types/-private/caches/identifier-cache.d.ts.map +1 -1
  16. package/unstable-preview-types/-private/caches/instance-cache.d.ts +2 -3
  17. package/unstable-preview-types/-private/caches/instance-cache.d.ts.map +1 -1
  18. package/unstable-preview-types/-private/document.d.ts +10 -16
  19. package/unstable-preview-types/-private/document.d.ts.map +1 -1
  20. package/unstable-preview-types/-private/legacy-model-support/record-reference.d.ts +0 -13
  21. package/unstable-preview-types/-private/legacy-model-support/record-reference.d.ts.map +1 -1
  22. package/unstable-preview-types/-private/managers/cache-capabilities-manager.d.ts +0 -3
  23. package/unstable-preview-types/-private/managers/cache-capabilities-manager.d.ts.map +1 -1
  24. package/unstable-preview-types/-private/managers/cache-manager.d.ts +2 -35
  25. package/unstable-preview-types/-private/managers/cache-manager.d.ts.map +1 -1
  26. package/unstable-preview-types/-private/managers/notification-manager.d.ts +0 -6
  27. package/unstable-preview-types/-private/managers/notification-manager.d.ts.map +1 -1
  28. package/unstable-preview-types/-private/managers/record-array-manager.d.ts +0 -1
  29. package/unstable-preview-types/-private/managers/record-array-manager.d.ts.map +1 -1
  30. package/unstable-preview-types/-private/network/request-cache.d.ts +0 -3
  31. package/unstable-preview-types/-private/network/request-cache.d.ts.map +1 -1
  32. package/unstable-preview-types/-private/new-core-tmp/promise-state.d.ts +0 -32
  33. package/unstable-preview-types/-private/new-core-tmp/promise-state.d.ts.map +1 -1
  34. package/unstable-preview-types/-private/new-core-tmp/reactivity/configure.d.ts +0 -1
  35. package/unstable-preview-types/-private/new-core-tmp/reactivity/configure.d.ts.map +1 -1
  36. package/unstable-preview-types/-private/new-core-tmp/request-state.d.ts +9 -29
  37. package/unstable-preview-types/-private/new-core-tmp/request-state.d.ts.map +1 -1
  38. package/unstable-preview-types/-private/record-arrays/identifier-array.d.ts +0 -2
  39. package/unstable-preview-types/-private/record-arrays/identifier-array.d.ts.map +1 -1
  40. package/unstable-preview-types/-private/record-arrays/many-array.d.ts +12 -13
  41. package/unstable-preview-types/-private/record-arrays/many-array.d.ts.map +1 -1
  42. package/unstable-preview-types/-private/store-service.d.ts +41 -52
  43. package/unstable-preview-types/-private/store-service.d.ts.map +1 -1
  44. package/unstable-preview-types/-private/utils/coerce-id.d.ts +0 -3
  45. package/unstable-preview-types/-private/utils/coerce-id.d.ts.map +1 -1
  46. package/unstable-preview-types/-private/utils/uuid-polyfill.d.ts.map +1 -1
  47. package/unstable-preview-types/-private.d.ts +0 -3
  48. package/unstable-preview-types/-private.d.ts.map +1 -1
  49. package/unstable-preview-types/-types/q/cache-capabilities-manager.d.ts +0 -8
  50. package/unstable-preview-types/-types/q/cache-capabilities-manager.d.ts.map +1 -1
  51. package/unstable-preview-types/-types/q/ds-model.d.ts +0 -1
  52. package/unstable-preview-types/-types/q/ds-model.d.ts.map +1 -1
  53. package/unstable-preview-types/-types/q/identifier.d.ts +0 -18
  54. package/unstable-preview-types/-types/q/identifier.d.ts.map +1 -1
  55. package/unstable-preview-types/-types/q/record-data-json-api.d.ts +0 -3
  56. package/unstable-preview-types/-types/q/record-data-json-api.d.ts.map +1 -1
  57. package/unstable-preview-types/-types/q/record-instance.d.ts +0 -5
  58. package/unstable-preview-types/-types/q/record-instance.d.ts.map +1 -1
  59. package/unstable-preview-types/-types/q/schema-service.d.ts +1 -21
  60. package/unstable-preview-types/-types/q/schema-service.d.ts.map +1 -1
  61. package/unstable-preview-types/-types/q/store.d.ts +0 -1
  62. package/unstable-preview-types/-types/q/store.d.ts.map +1 -1
  63. package/unstable-preview-types/configure.d.ts +1 -5
  64. package/unstable-preview-types/configure.d.ts.map +1 -1
  65. package/unstable-preview-types/index.d.ts +34 -35
  66. package/dist/configure-BfLLW6GY.js.map +0 -1
  67. package/dist/request-state-uRtpn0Lc.js.map +0 -1
  68. package/unstable-preview-types/-types/overview.d.ts +0 -21
  69. package/unstable-preview-types/-types/overview.d.ts.map +0 -1
@@ -1,17 +1,12 @@
1
1
  import { deprecate, warn } from '@ember/debug';
2
2
  import { macroCondition, getGlobalConfig, dependencySatisfies, importSync } from '@embroider/macros';
3
- import { EnableHydration, SkipCache } from '@warp-drive/core-types/request';
3
+ import { withBrand, EnableHydration, SkipCache } from '@warp-drive/core-types/request';
4
4
  import { setLogging, getRuntimeConfig } from '@warp-drive/core-types/runtime';
5
5
  import { getOrSetGlobal, peekTransient, setTransient } from '@warp-drive/core-types/-private';
6
- import { a as createSignal, b as consumeSignal, n as notifySignal, c as createMemo, w as willSyncFlushWatchers, A as ARRAY_SIGNAL } from "./configure-BfLLW6GY.js";
6
+ import { a as createSignal, b as consumeSignal, n as notifySignal, c as createMemo, w as willSyncFlushWatchers, A as ARRAY_SIGNAL } from "./configure-BCr2QDik.js";
7
7
  import { CACHE_OWNER, DEBUG_STALE_CACHE_OWNER, DEBUG_IDENTIFIER_BUCKET, DEBUG_CLIENT_ORIGINATED } from '@warp-drive/core-types/identifier';
8
8
  import { dasherize } from '@ember-data/request-utils/string';
9
9
  import { getPromiseResult, setPromiseResult } from '@ember-data/request';
10
-
11
- /**
12
- @module @ember-data/store
13
- */
14
-
15
10
  function coerceId(id) {
16
11
  if (macroCondition(getGlobalConfig().WarpDrive.deprecations.DEPRECATE_NON_STRICT_ID)) {
17
12
  let normalized;
@@ -68,11 +63,6 @@ function normalizeModelName(type) {
68
63
  }
69
64
  return type;
70
65
  }
71
-
72
- /**
73
- @module @ember-data/store
74
- */
75
-
76
66
  function installPolyfill() {
77
67
  const isFastBoot = typeof FastBoot !== 'undefined';
78
68
  const CRYPTO = isFastBoot ? FastBoot.require('crypto') : globalThis.crypto;
@@ -125,10 +115,6 @@ function hasId(resource) {
125
115
  function hasType(resource) {
126
116
  return hasProp(resource, 'type');
127
117
  }
128
-
129
- /**
130
- @module @ember-data/store
131
- */
132
118
  const DOCUMENTS = getOrSetGlobal('DOCUMENTS', new Set());
133
119
  function isStableIdentifier(identifier) {
134
120
  return identifier[CACHE_OWNER] !== undefined;
@@ -293,7 +279,6 @@ class IdentifierCache {
293
279
  * we allow late binding of this private internal merge so that
294
280
  * the cache can insert itself here to handle elimination of duplicates
295
281
  *
296
- * @method __configureMerge
297
282
  * @private
298
283
  */
299
284
  __configureMerge(method) {
@@ -304,7 +289,6 @@ class IdentifierCache {
304
289
  }
305
290
 
306
291
  /**
307
- * @method _getRecordIdentifier
308
292
  * @private
309
293
  */
310
294
 
@@ -389,7 +373,6 @@ class IdentifierCache {
389
373
  * useful for the "create" case when we need to see if
390
374
  * we are accidentally overwritting something
391
375
  *
392
- * @method peekRecordIdentifier
393
376
  * @param resource
394
377
  * @return {StableRecordIdentifier | undefined}
395
378
  * @private
@@ -401,8 +384,7 @@ class IdentifierCache {
401
384
  /**
402
385
  Returns the DocumentIdentifier for the given Request, creates one if it does not yet exist.
403
386
  Returns `null` if the request does not have a `cacheKey` or `url`.
404
- @method getOrCreateDocumentIdentifier
405
- @param request
387
+ @param request
406
388
  @return {StableDocumentIdentifier | null}
407
389
  @public
408
390
  */
@@ -435,8 +417,7 @@ class IdentifierCache {
435
417
  - return an object with an `lid` that is stable (repeated calls with the same
436
418
  `id` + `type` or `lid` will return the same `lid` value)
437
419
  - this referential stability of the object itself is guaranteed
438
- @method getOrCreateRecordIdentifier
439
- @param resource
420
+ @param resource
440
421
  @return {StableRecordIdentifier}
441
422
  @public
442
423
  */
@@ -450,8 +431,7 @@ class IdentifierCache {
450
431
  potentially does not have an `id`.
451
432
  Delegates generation to the user supplied `GenerateMethod` if one has been provided
452
433
  with the signature `generateMethod({ type }, 'record')`.
453
- @method createIdentifierForNewRecord
454
- @param data
434
+ @param data
455
435
  @return {StableRecordIdentifier}
456
436
  @public
457
437
  */
@@ -494,8 +474,7 @@ class IdentifierCache {
494
474
  If a merge occurs, it is possible the returned identifier does not match the originally
495
475
  provided identifier. In this case the abandoned identifier will go through the usual
496
476
  `forgetRecordIdentifier` codepaths.
497
- @method updateRecordIdentifier
498
- @param identifierObject
477
+ @param identifierObject
499
478
  @param data
500
479
  @return {StableRecordIdentifier}
501
480
  @public
@@ -564,7 +543,6 @@ class IdentifierCache {
564
543
  }
565
544
 
566
545
  /**
567
- * @method _mergeRecordIdentifiers
568
546
  * @private
569
547
  */
570
548
  _mergeRecordIdentifiers(keyInfo, identifier, existingIdentifier, data) {
@@ -612,8 +590,7 @@ class IdentifierCache {
612
590
  Useful when a record has been deleted and the deletion has been persisted and
613
591
  we do not care about the record anymore. Especially useful when an `id` of a
614
592
  deleted record might be reused later for a new record.
615
- @method forgetRecordIdentifier
616
- @param identifierObject
593
+ @param identifierObject
617
594
  @public
618
595
  */
619
596
  forgetRecordIdentifier(identifierObject) {
@@ -1135,11 +1112,6 @@ function defineGate(obj, key, desc) {
1135
1112
  }, gate(obj, key, desc));
1136
1113
  Object.defineProperty(obj, key, options);
1137
1114
  }
1138
-
1139
- /**
1140
- * @module @ember-data/store
1141
- */
1142
-
1143
1115
  function urlFromLink(link) {
1144
1116
  if (typeof link === 'string') return link;
1145
1117
  return link.href;
@@ -1235,7 +1207,10 @@ class ReactiveDocument {
1235
1207
  });
1236
1208
  }
1237
1209
  }
1238
- async #request(link, options) {
1210
+ async #request(link, options = withBrand({
1211
+ url: '',
1212
+ method: 'GET'
1213
+ })) {
1239
1214
  const href = this.links?.[link];
1240
1215
  if (!href) {
1241
1216
  return null;
@@ -1253,12 +1228,14 @@ class ReactiveDocument {
1253
1228
  * with the document when the request completes. If no related link is present,
1254
1229
  * will fallback to the self link if present
1255
1230
  *
1256
- * @method fetch
1257
1231
  * @public
1258
1232
  * @param {Object} options
1259
- * @return Promise<Document>
1233
+ * @return {Promise<Document>}
1260
1234
  */
1261
- fetch(options = {}) {
1235
+ fetch(options = withBrand({
1236
+ url: '',
1237
+ method: 'GET'
1238
+ })) {
1262
1239
  macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
1263
1240
  if (!test) {
1264
1241
  throw new Error(`No self or related link`);
@@ -1274,12 +1251,11 @@ class ReactiveDocument {
1274
1251
  * with the new document when the request completes, or null if there is no
1275
1252
  * next link.
1276
1253
  *
1277
- * @method next
1278
1254
  * @public
1279
1255
  * @param {Object} options
1280
- * @return Promise<Document | null>
1256
+ * @return {Promise<Document | null>}
1281
1257
  */
1282
- next(options = {}) {
1258
+ next(options) {
1283
1259
  return this.#request('next', options);
1284
1260
  }
1285
1261
 
@@ -1288,12 +1264,11 @@ class ReactiveDocument {
1288
1264
  * with the new document when the request completes, or null if there is no
1289
1265
  * prev link.
1290
1266
  *
1291
- * @method prev
1292
1267
  * @public
1293
1268
  * @param {Object} options
1294
- * @return Promise<Document | null>
1269
+ * @return {Promise<Document | null>}
1295
1270
  */
1296
- prev(options = {}) {
1271
+ prev(options) {
1297
1272
  return this.#request('prev', options);
1298
1273
  }
1299
1274
 
@@ -1302,12 +1277,11 @@ class ReactiveDocument {
1302
1277
  * with the new document when the request completes, or null if there is no
1303
1278
  * first link.
1304
1279
  *
1305
- * @method first
1306
1280
  * @public
1307
1281
  * @param {Object} options
1308
- * @return Promise<Document | null>
1282
+ * @return {Promise<Document | null>}
1309
1283
  */
1310
- first(options = {}) {
1284
+ first(options) {
1311
1285
  return this.#request('first', options);
1312
1286
  }
1313
1287
 
@@ -1316,12 +1290,11 @@ class ReactiveDocument {
1316
1290
  * with the new document when the request completes, or null if there is no
1317
1291
  * last link.
1318
1292
  *
1319
- * @method last
1320
1293
  * @public
1321
1294
  * @param {Object} options
1322
- * @return Promise<Document | null>
1295
+ * @return {Promise<Document | null>}
1323
1296
  */
1324
- last(options = {}) {
1297
+ last(options) {
1325
1298
  return this.#request('last', options);
1326
1299
  }
1327
1300
 
@@ -1334,7 +1307,6 @@ class ReactiveDocument {
1334
1307
  * the document's contents, leaving that to the individual record
1335
1308
  * instances to determine how to do, if at all.
1336
1309
  *
1337
- * @method toJSON
1338
1310
  * @public
1339
1311
  * @return
1340
1312
  */
@@ -1441,14 +1413,6 @@ defineGate(ReactiveDocument.prototype, 'meta', {
1441
1413
  }
1442
1414
  });
1443
1415
 
1444
- /**
1445
- @module @ember-data/store
1446
- */
1447
-
1448
- /**
1449
- @module @ember-data/store
1450
- */
1451
-
1452
1416
  /**
1453
1417
  A `RecordReference` is a low-level API that allows users and
1454
1418
  addon authors to perform meta-operations on a record.
@@ -1485,8 +1449,7 @@ class RecordReference {
1485
1449
  let userRef = store.getReference('user', 1);
1486
1450
  userRef.id(); // '1'
1487
1451
  ```
1488
- @method id
1489
- @public
1452
+ @public
1490
1453
  @return {String} The id of the record.
1491
1454
  */
1492
1455
  id() {
@@ -1504,8 +1467,7 @@ class RecordReference {
1504
1467
  let userRef = store.getReference('user', 1);
1505
1468
  userRef.identifier(); // '1'
1506
1469
  ```
1507
- @method identifier
1508
- @public
1470
+ @public
1509
1471
  @return {String} The identifier of the record.
1510
1472
  */
1511
1473
  identifier() {
@@ -1521,8 +1483,7 @@ class RecordReference {
1521
1483
  const userRef = store.getReference('user', 1);
1522
1484
  userRef.remoteType(); // 'identity'
1523
1485
  ```
1524
- @method remoteType
1525
- @public
1486
+ @public
1526
1487
  @return {String} 'identity'
1527
1488
  */
1528
1489
  remoteType() {
@@ -1557,8 +1518,7 @@ class RecordReference {
1557
1518
  userRef.value() === user;
1558
1519
  });
1559
1520
  ```
1560
- @method push
1561
- @public
1521
+ @public
1562
1522
  @param objectOrPromise a JSON:API ResourceDocument or a promise resolving to one
1563
1523
  @return a promise for the value (record or relationship)
1564
1524
  */
@@ -1578,8 +1538,7 @@ class RecordReference {
1578
1538
  let userRef = store.getReference('user', 1);
1579
1539
  userRef.value(); // user
1580
1540
  ```
1581
- @method value
1582
- @public
1541
+ @public
1583
1542
  @return {Model} the record for this RecordReference
1584
1543
  */
1585
1544
  value() {
@@ -1595,8 +1554,7 @@ class RecordReference {
1595
1554
  // load user (via store.find)
1596
1555
  userRef.load().then(...)
1597
1556
  ```
1598
- @method load
1599
- @public
1557
+ @public
1600
1558
  @return {Promise<record>} the record for this RecordReference
1601
1559
  */
1602
1560
  load() {
@@ -1620,8 +1578,7 @@ class RecordReference {
1620
1578
  // or trigger a reload
1621
1579
  userRef.reload().then(...)
1622
1580
  ```
1623
- @method reload
1624
- @public
1581
+ @public
1625
1582
  @return {Promise<record>} the record for this RecordReference
1626
1583
  */
1627
1584
  reload() {
@@ -1639,10 +1596,6 @@ class RecordReference {
1639
1596
  }
1640
1597
  }
1641
1598
  defineSignal(RecordReference.prototype, '_ref');
1642
-
1643
- /**
1644
- @module @ember-data/store
1645
- */
1646
1599
  class CacheCapabilitiesManager {
1647
1600
  constructor(_store) {
1648
1601
  this._store = _store;
@@ -1759,11 +1712,6 @@ function peekCache(instance) {
1759
1712
  function isDestroyable(record) {
1760
1713
  return Boolean(record && typeof record === 'object' && typeof record.destroy === 'function');
1761
1714
  }
1762
-
1763
- /**
1764
- @module @ember-data/store
1765
- */
1766
-
1767
1715
  const RecordCache = getOrSetGlobal('RecordCache', new Map());
1768
1716
  function peekRecordIdentifier(record) {
1769
1717
  return RecordCache.get(record);
@@ -1772,6 +1720,7 @@ function peekRecordIdentifier(record) {
1772
1720
  /**
1773
1721
  Retrieves the unique referentially-stable [RecordIdentifier](/ember-data/release/classes/StableRecordIdentifier)
1774
1722
  assigned to the given record instance.
1723
+
1775
1724
  ```js
1776
1725
  import { recordIdentifierFor } from "@ember-data/store";
1777
1726
  // ... gain access to a record, for instance with peekRecord or findRecord
@@ -1781,10 +1730,8 @@ function peekRecordIdentifier(record) {
1781
1730
  // access the identifier's properties.
1782
1731
  const { id, type, lid } = identifier;
1783
1732
  ```
1784
- @method recordIdentifierFor
1733
+
1785
1734
  @public
1786
- @static
1787
- @for @ember-data/store
1788
1735
  @param {Object} record a record instance previously obstained from the store.
1789
1736
  @return {StableRecordIdentifier}
1790
1737
  */
@@ -2330,7 +2277,6 @@ class CacheManager {
2330
2277
  * a `content` member and therefor must not assume the existence
2331
2278
  * of `request` and `response` on the document.
2332
2279
  *
2333
- * @method put
2334
2280
  * @param {StructuredDocument} doc
2335
2281
  * @return {ResourceDocument}
2336
2282
  * @public
@@ -2345,7 +2291,6 @@ class CacheManager {
2345
2291
  * Note: currently the only valid operation is a MergeOperation
2346
2292
  * which occurs when a collision of identifiers is detected.
2347
2293
  *
2348
- * @method patch
2349
2294
  * @public
2350
2295
  * @param op the operation to perform
2351
2296
  * @return {void}
@@ -2358,7 +2303,6 @@ class CacheManager {
2358
2303
  * Update resource data with a local mutation. Currently supports operations
2359
2304
  * on relationships only.
2360
2305
  *
2361
- * @method mutate
2362
2306
  * @public
2363
2307
  * @param mutation
2364
2308
  */
@@ -2393,7 +2337,6 @@ class CacheManager {
2393
2337
  * of the Graph handling necessary entanglements and
2394
2338
  * notifications for relational data.
2395
2339
  *
2396
- * @method peek
2397
2340
  * @public
2398
2341
  * @param {StableRecordIdentifier | StableDocumentIdentifier} identifier
2399
2342
  * @return {ResourceDocument | ResourceBlob | null} the known resource data
@@ -2409,7 +2352,6 @@ class CacheManager {
2409
2352
  * Peek the Cache for the existing request data associated with
2410
2353
  * a cacheable request
2411
2354
  *
2412
- * @method peekRequest
2413
2355
  * @param {StableDocumentIdentifier}
2414
2356
  * @return {StableDocumentIdentifier | null}
2415
2357
  * @public
@@ -2421,7 +2363,6 @@ class CacheManager {
2421
2363
  /**
2422
2364
  * Push resource data from a remote source into the cache for this identifier
2423
2365
  *
2424
- * @method upsert
2425
2366
  * @public
2426
2367
  * @param identifier
2427
2368
  * @param data
@@ -2442,9 +2383,8 @@ class CacheManager {
2442
2383
  * preferring instead to fork at the Store level, which will
2443
2384
  * utilize this method to fork the cache.
2444
2385
  *
2445
- * @method fork
2446
2386
  * @public
2447
- * @return Promise<Cache>
2387
+ * @return {Promise<Cache>}
2448
2388
  */
2449
2389
  fork() {
2450
2390
  return this.#cache.fork();
@@ -2457,10 +2397,9 @@ class CacheManager {
2457
2397
  * preferring instead to merge at the Store level, which will
2458
2398
  * utilize this method to merge the caches.
2459
2399
  *
2460
- * @method merge
2461
2400
  * @param {Cache} cache
2462
2401
  * @public
2463
- * @return Promise<void>
2402
+ * @return {Promise<void>}
2464
2403
  */
2465
2404
  merge(cache) {
2466
2405
  return this.#cache.merge(cache);
@@ -2496,7 +2435,6 @@ class CacheManager {
2496
2435
  * }
2497
2436
  * ```
2498
2437
  *
2499
- * @method diff
2500
2438
  * @public
2501
2439
  */
2502
2440
  diff() {
@@ -2511,7 +2449,6 @@ class CacheManager {
2511
2449
  * which may be fed back into a new instance of the same Cache
2512
2450
  * via `cache.hydrate`.
2513
2451
  *
2514
- * @method dump
2515
2452
  * @return {Promise<ReadableStream>}
2516
2453
  * @public
2517
2454
  */
@@ -2531,7 +2468,6 @@ class CacheManager {
2531
2468
  * behavior supports optimizing pre/fetching of data for route transitions
2532
2469
  * via data-only SSR modes.
2533
2470
  *
2534
- * @method hydrate
2535
2471
  * @param {ReadableStream} stream
2536
2472
  * @return {Promise<void>}
2537
2473
  * @public
@@ -2552,7 +2488,6 @@ class CacheManager {
2552
2488
  * It returns properties from options that should be set on the record during the create
2553
2489
  * process. This return value behavior is deprecated.
2554
2490
  *
2555
- * @method clientDidCreate
2556
2491
  * @public
2557
2492
  * @param identifier
2558
2493
  * @param options
@@ -2565,7 +2500,6 @@ class CacheManager {
2565
2500
  * [LIFECYCLE] Signals to the cache that a resource
2566
2501
  * will be part of a save transaction.
2567
2502
  *
2568
- * @method willCommit
2569
2503
  * @public
2570
2504
  * @param identifier
2571
2505
  */
@@ -2577,7 +2511,6 @@ class CacheManager {
2577
2511
  * [LIFECYCLE] Signals to the cache that a resource
2578
2512
  * was successfully updated as part of a save transaction.
2579
2513
  *
2580
- * @method didCommit
2581
2514
  * @public
2582
2515
  * @param identifier
2583
2516
  * @param data
@@ -2590,7 +2523,6 @@ class CacheManager {
2590
2523
  * [LIFECYCLE] Signals to the cache that a resource
2591
2524
  * was update via a save transaction failed.
2592
2525
  *
2593
- * @method commitWasRejected
2594
2526
  * @public
2595
2527
  * @param identifier
2596
2528
  * @param errors
@@ -2603,7 +2535,6 @@ class CacheManager {
2603
2535
  * [LIFECYCLE] Signals to the cache that all data for a resource
2604
2536
  * should be cleared.
2605
2537
  *
2606
- * @method unloadRecord
2607
2538
  * @public
2608
2539
  * @param identifier
2609
2540
  */
@@ -2617,7 +2548,6 @@ class CacheManager {
2617
2548
  /**
2618
2549
  * Retrieve the data for an attribute from the cache
2619
2550
  *
2620
- * @method getAttr
2621
2551
  * @public
2622
2552
  * @param identifier
2623
2553
  * @param propertyName
@@ -2630,7 +2560,6 @@ class CacheManager {
2630
2560
  /**
2631
2561
  * Retrieve the remote state for an attribute from the cache
2632
2562
  *
2633
- * @method getRemoteAttr
2634
2563
  * @public
2635
2564
  * @param identifier
2636
2565
  * @param propertyName
@@ -2643,7 +2572,6 @@ class CacheManager {
2643
2572
  /**
2644
2573
  * Mutate the data for an attribute in the cache
2645
2574
  *
2646
- * @method setAttr
2647
2575
  * @public
2648
2576
  * @param identifier
2649
2577
  * @param propertyName
@@ -2656,7 +2584,6 @@ class CacheManager {
2656
2584
  /**
2657
2585
  * Query the cache for the changed attributes of a resource.
2658
2586
  *
2659
- * @method changedAttrs
2660
2587
  * @public
2661
2588
  * @param identifier
2662
2589
  * @return
@@ -2668,7 +2595,6 @@ class CacheManager {
2668
2595
  /**
2669
2596
  * Query the cache for whether any mutated attributes exist
2670
2597
  *
2671
- * @method hasChangedAttrs
2672
2598
  * @public
2673
2599
  * @param identifier
2674
2600
  * @return {Boolean}
@@ -2680,7 +2606,6 @@ class CacheManager {
2680
2606
  /**
2681
2607
  * Tell the cache to discard any uncommitted mutations to attributes
2682
2608
  *
2683
- * @method rollbackAttrs
2684
2609
  * @public
2685
2610
  * @param identifier
2686
2611
  * @return the names of attributes that were restored
@@ -2714,7 +2639,6 @@ class CacheManager {
2714
2639
  };
2715
2640
  ```
2716
2641
  *
2717
- * @method changedRelationships
2718
2642
  * @public
2719
2643
  * @param {StableRecordIdentifier} identifier
2720
2644
  * @return {Map<string, RelationshipDiff>}
@@ -2726,7 +2650,6 @@ class CacheManager {
2726
2650
  /**
2727
2651
  * Query the cache for whether any mutated attributes exist
2728
2652
  *
2729
- * @method hasChangedRelationships
2730
2653
  * @public
2731
2654
  * @param {StableRecordIdentifier} identifier
2732
2655
  * @return {Boolean}
@@ -2742,7 +2665,6 @@ class CacheManager {
2742
2665
  *
2743
2666
  * This method is a candidate to become a mutation
2744
2667
  *
2745
- * @method rollbackRelationships
2746
2668
  * @public
2747
2669
  * @param {StableRecordIdentifier} identifier
2748
2670
  * @return {String[]} the names of relationships that were restored
@@ -2754,7 +2676,6 @@ class CacheManager {
2754
2676
  /**
2755
2677
  * Query the cache for the current state of a relationship property
2756
2678
  *
2757
- * @method getRelationship
2758
2679
  * @public
2759
2680
  * @param identifier
2760
2681
  * @param propertyName
@@ -2767,7 +2688,6 @@ class CacheManager {
2767
2688
  /**
2768
2689
  * Query the cache for the remote state of a relationship property
2769
2690
  *
2770
- * @method getRelationship
2771
2691
  * @public
2772
2692
  * @param identifier
2773
2693
  * @param propertyName
@@ -2784,7 +2704,6 @@ class CacheManager {
2784
2704
  * Update the cache state for the given resource to be marked as locally deleted,
2785
2705
  * or remove such a mark.
2786
2706
  *
2787
- * @method setIsDeleted
2788
2707
  * @public
2789
2708
  * @param identifier
2790
2709
  * @param isDeleted
@@ -2796,7 +2715,6 @@ class CacheManager {
2796
2715
  /**
2797
2716
  * Query the cache for any validation errors applicable to the given resource.
2798
2717
  *
2799
- * @method getErrors
2800
2718
  * @public
2801
2719
  * @param identifier
2802
2720
  * @return
@@ -2808,7 +2726,6 @@ class CacheManager {
2808
2726
  /**
2809
2727
  * Query the cache for whether a given resource has any available data
2810
2728
  *
2811
- * @method isEmpty
2812
2729
  * @public
2813
2730
  * @param identifier
2814
2731
  * @return {Boolean}
@@ -2821,7 +2738,6 @@ class CacheManager {
2821
2738
  * Query the cache for whether a given resource was created locally and not
2822
2739
  * yet persisted.
2823
2740
  *
2824
- * @method isNew
2825
2741
  * @public
2826
2742
  * @param identifier
2827
2743
  * @return {Boolean}
@@ -2834,7 +2750,6 @@ class CacheManager {
2834
2750
  * Query the cache for whether a given resource is marked as deleted (but not
2835
2751
  * necessarily persisted yet).
2836
2752
  *
2837
- * @method isDeleted
2838
2753
  * @public
2839
2754
  * @param identifier
2840
2755
  * @return {Boolean}
@@ -2847,7 +2762,6 @@ class CacheManager {
2847
2762
  * Query the cache for whether a given resource has been deleted and that deletion
2848
2763
  * has also been persisted.
2849
2764
  *
2850
- * @method isDeletionCommitted
2851
2765
  * @public
2852
2766
  * @param identifier
2853
2767
  * @return {Boolean}
@@ -2856,11 +2770,6 @@ class CacheManager {
2856
2770
  return this.#cache.isDeletionCommitted(identifier);
2857
2771
  }
2858
2772
  }
2859
-
2860
- /**
2861
- * @module @ember-data/store
2862
- */
2863
-
2864
2773
  function isCacheOperationValue(value) {
2865
2774
  return value === 'added' || value === 'state' || value === 'updated' || value === 'removed' || value === 'invalidated';
2866
2775
  }
@@ -2945,7 +2854,6 @@ class NotificationManager {
2945
2854
  * }
2946
2855
  * ```
2947
2856
  *
2948
- * @method subscribe
2949
2857
  * @public
2950
2858
  * @param {StableDocumentIdentifier | StableRecordIdentifier | 'resource' | 'document'} identifier
2951
2859
  * @param {NotificationCallback | ResourceOperationCallback | DocumentOperationCallback} callback
@@ -2983,7 +2891,6 @@ class NotificationManager {
2983
2891
  /**
2984
2892
  * remove a previous subscription
2985
2893
  *
2986
- * @method unsubscribe
2987
2894
  * @public
2988
2895
  * @param {UnsubscribeToken} token
2989
2896
  */
@@ -2996,7 +2903,6 @@ class NotificationManager {
2996
2903
  /**
2997
2904
  * Custom Caches and Application Code should not call this method directly.
2998
2905
  *
2999
- * @method notify
3000
2906
  * @param identifier
3001
2907
  * @param value
3002
2908
  * @param key
@@ -3126,11 +3032,6 @@ class NotificationManager {
3126
3032
  */
3127
3033
 
3128
3034
  const NativeProxy = Proxy;
3129
-
3130
- /**
3131
- @module @ember-data/store
3132
- */
3133
-
3134
3035
  const ARRAY_GETTER_METHODS = new Set([Symbol.iterator, 'concat', 'entries', 'every', 'fill', 'filter', 'find', 'findIndex', 'flat', 'flatMap', 'forEach', 'includes', 'indexOf', 'join', 'keys', 'lastIndexOf', 'map', 'reduce', 'reduceRight', 'slice', 'some', 'values']);
3135
3036
  const ARRAY_SETTER_METHODS = new Set(['push', 'pop', 'unshift', 'shift', 'splice', 'sort']);
3136
3037
  const SYNC_PROPS = new Set(['[]', 'length', 'links', 'meta']);
@@ -3482,8 +3383,7 @@ class IdentifierArray {
3482
3383
  });
3483
3384
  people.isUpdating; // true
3484
3385
  ```
3485
- @method update
3486
- @public
3386
+ @public
3487
3387
  */
3488
3388
  update() {
3489
3389
  if (this.isUpdating) {
@@ -3532,8 +3432,7 @@ class IdentifierArray {
3532
3432
  });
3533
3433
  messages.save();
3534
3434
  ```
3535
- @method save
3536
- @public
3435
+ @public
3537
3436
  @return {Promise<IdentifierArray>} promise
3538
3437
  */
3539
3438
  save() {
@@ -3626,11 +3525,6 @@ function extractIdentifierFromRecord$2(record) {
3626
3525
  assertRecordPassedToHasMany$1(record);
3627
3526
  return recordIdentifierFor(record);
3628
3527
  }
3629
-
3630
- /**
3631
- @module @ember-data/store
3632
- */
3633
-
3634
3528
  const FAKE_ARR = getOrSetGlobal('FAKE_ARR', {});
3635
3529
  const SLICE_BATCH_SIZE = 1200;
3636
3530
  /**
@@ -3758,8 +3652,7 @@ class RecordArrayManager {
3758
3652
  /**
3759
3653
  Get the `RecordArray` for a modelName, which contains all loaded records of
3760
3654
  given modelName.
3761
- @method liveArrayFor
3762
- @internal
3655
+ @internal
3763
3656
  @param {String} modelName
3764
3657
  @return {RecordArray}
3765
3658
  */
@@ -4028,11 +3921,6 @@ function sync(array, changes, arraySet) {
4028
3921
  function isCollection(array) {
4029
3922
  return array.identifier !== null;
4030
3923
  }
4031
-
4032
- /**
4033
- * @module @ember-data/store
4034
- */
4035
-
4036
3924
  const Touching = getOrSetGlobal('Touching', Symbol('touching'));
4037
3925
  const RequestPromise = getOrSetGlobal('RequestPromise', Symbol('promise'));
4038
3926
  const EMPTY_ARR = macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? Object.freeze([]) : [];
@@ -4189,7 +4077,6 @@ class RequestStateService {
4189
4077
  * with the RequestManager for these purposes is likely to be a better long-term
4190
4078
  * design.
4191
4079
  *
4192
- * @method subscribeForRecord
4193
4080
  * @public
4194
4081
  * @param {StableRecordIdentifier} identifier
4195
4082
  * @param {(state: RequestCacheRequestState) => void} callback
@@ -4206,7 +4093,6 @@ class RequestStateService {
4206
4093
  /**
4207
4094
  * Retrieve all active requests for a given resource identity.
4208
4095
  *
4209
- * @method getPendingRequestsForRecord
4210
4096
  * @public
4211
4097
  * @param {StableRecordIdentifier} identifier
4212
4098
  * @return {RequestCacheRequestState[]} an array of request states for any pending requests for the given identifier
@@ -4218,7 +4104,6 @@ class RequestStateService {
4218
4104
  /**
4219
4105
  * Retrieve the last completed request for a given resource identity.
4220
4106
  *
4221
- * @method getLastRequestForRecord
4222
4107
  * @public
4223
4108
  * @param {StableRecordIdentifier} identifier
4224
4109
  * @return {RequestCacheRequestState | null} the state of the most recent request for the given identifier
@@ -4283,9 +4168,6 @@ function constructResource(type, id, lid) {
4283
4168
  }
4284
4169
  }
4285
4170
 
4286
- /**
4287
- @module @ember-data/store
4288
- */
4289
4171
  // this import location is deprecated but breaks in 4.8 and older
4290
4172
 
4291
4173
  // @ts-expect-error adding to globalThis
@@ -4417,7 +4299,6 @@ if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_METRIC_COUNTS))
4417
4299
  * TODO: These are limitations we want to (and can) address. If you
4418
4300
  * have need of lifting these limitations, please open an issue.
4419
4301
  *
4420
- * @typedoc
4421
4302
  */
4422
4303
 
4423
4304
  /**
@@ -4425,7 +4306,7 @@ if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_METRIC_COUNTS))
4425
4306
  * and sources of data (such as your API or a local persistence layer)
4426
4307
  * accessed via a [RequestManager](https://github.com/emberjs/data/tree/main/packages/request).
4427
4308
  *
4428
- * ```app/services/store.js
4309
+ * ```js [app/services/store.js]
4429
4310
  * import Store from '@ember-data/store';
4430
4311
  *
4431
4312
  * export default class extends Store {}
@@ -4474,6 +4355,8 @@ const app = new EmberApp(defaults, {
4474
4355
  });
4475
4356
  }
4476
4357
  class Store extends BaseClass {
4358
+ /** @internal */
4359
+
4477
4360
  /**
4478
4361
  * Provides access to the NotificationManager associated
4479
4362
  * with this Store instance.
@@ -4503,6 +4386,7 @@ class Store extends BaseClass {
4503
4386
  }
4504
4387
  return this._schema;
4505
4388
  }
4389
+ /** @internal */
4506
4390
 
4507
4391
  /**
4508
4392
  * Provides access to the IdentifierCache instance
@@ -4574,6 +4458,15 @@ class Store extends BaseClass {
4574
4458
  */
4575
4459
 
4576
4460
  // Private
4461
+ /** @internal */
4462
+
4463
+ /** @internal */
4464
+
4465
+ /** @internal */
4466
+
4467
+ /** @internal */
4468
+
4469
+ /** @internal */
4577
4470
 
4578
4471
  /**
4579
4472
  * Async flush buffers notifications until flushed
@@ -4587,13 +4480,20 @@ class Store extends BaseClass {
4587
4480
  */
4588
4481
 
4589
4482
  // DEBUG-only properties
4483
+ /** @internal */
4484
+
4485
+ /** @internal */
4590
4486
 
4487
+ /** @internal */
4488
+
4489
+ /** @internal */
4591
4490
  get isDestroying() {
4592
4491
  return this._isDestroying;
4593
4492
  }
4594
4493
  set isDestroying(value) {
4595
4494
  this._isDestroying = value;
4596
4495
  }
4496
+ /** @internal */
4597
4497
  get isDestroyed() {
4598
4498
  return this._isDestroyed;
4599
4499
  }
@@ -4602,7 +4502,6 @@ class Store extends BaseClass {
4602
4502
  }
4603
4503
 
4604
4504
  /**
4605
- @method init
4606
4505
  @private
4607
4506
  */
4608
4507
  constructor(createArgs) {
@@ -4622,6 +4521,8 @@ class Store extends BaseClass {
4622
4521
  this.isDestroying = false;
4623
4522
  this.isDestroyed = false;
4624
4523
  }
4524
+
4525
+ /** @internal */
4625
4526
  _run(cb) {
4626
4527
  macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
4627
4528
  if (!test) {
@@ -4675,6 +4576,8 @@ class Store extends BaseClass {
4675
4576
  this._run(cb);
4676
4577
  }
4677
4578
  }
4579
+
4580
+ /** @internal */
4678
4581
  _schedule(name, cb) {
4679
4582
  macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
4680
4583
  if (!test) {
@@ -4696,13 +4599,14 @@ class Store extends BaseClass {
4696
4599
  * This can be used to query the status of requests
4697
4600
  * that have been initiated for a given identifier.
4698
4601
  *
4699
- * @method getRequestStateService
4700
4602
  * @return {RequestStateService}
4701
4603
  * @public
4702
4604
  */
4703
4605
  getRequestStateService() {
4704
4606
  return this._requestCache;
4705
4607
  }
4608
+
4609
+ /** @internal */
4706
4610
  _getAllPending() {
4707
4611
  if (macroCondition(getGlobalConfig().WarpDrive.env.TESTING)) {
4708
4612
  const all = [];
@@ -4765,7 +4669,6 @@ class Store extends BaseClass {
4765
4669
  * is that `store.request` will attempt to hydrate the response content into
4766
4670
  * a response Document containing RecordInstances.
4767
4671
  *
4768
- * @method request
4769
4672
  * @param {StoreRequestInput} requestConfig
4770
4673
  * @return {Future}
4771
4674
  * @public
@@ -4826,7 +4729,6 @@ class Store extends BaseClass {
4826
4729
  * mechanism of presenting cache data to the ui for access
4827
4730
  * mutation, and interaction.
4828
4731
  *
4829
- * @method instantiateRecord (hook)
4830
4732
  * @param identifier
4831
4733
  * @param createRecordArgs
4832
4734
  * @param recordDataFor deprecated use this.cache
@@ -4841,7 +4743,6 @@ class Store extends BaseClass {
4841
4743
  * be used to teardown any custom record instances instantiated
4842
4744
  * with `instantiateRecord`.
4843
4745
  *
4844
- * @method teardownRecord (hook)
4845
4746
  * @public
4846
4747
  * @param record
4847
4748
  */
@@ -4859,8 +4760,7 @@ class Store extends BaseClass {
4859
4760
  relationship names of the model, see
4860
4761
  [`relationshipNames`](/ember-data/release/classes/Model?anchor=relationshipNames)
4861
4762
  for example.
4862
- @method modelFor
4863
- @public
4763
+ @public
4864
4764
  @deprecated
4865
4765
  @param {String} type
4866
4766
  @return {ModelSchema}
@@ -4904,8 +4804,7 @@ class Store extends BaseClass {
4904
4804
  user: user
4905
4805
  });
4906
4806
  ```
4907
- @method createRecord
4908
- @public
4807
+ @public
4909
4808
  @param {String} type the name of the resource
4910
4809
  @param {Object} inputProperties a hash of properties to set on the
4911
4810
  newly created record.
@@ -4984,8 +4883,7 @@ class Store extends BaseClass {
4984
4883
  });
4985
4884
  store.deleteRecord(post);
4986
4885
  ```
4987
- @method deleteRecord
4988
- @public
4886
+ @public
4989
4887
  @param {unknown} record
4990
4888
  */
4991
4889
  deleteRecord(record) {
@@ -5015,8 +4913,7 @@ class Store extends BaseClass {
5015
4913
  const { content: { data: post } } = await store.request(findRecord({ type: 'post', id: '1' }));
5016
4914
  store.unloadRecord(post);
5017
4915
  ```
5018
- @method unloadRecord
5019
- @public
4916
+ @public
5020
4917
  @param {Model} record
5021
4918
  */
5022
4919
  unloadRecord(record) {
@@ -5036,7 +4933,7 @@ class Store extends BaseClass {
5036
4933
  The `findRecord` method will always return a **promise** that will be
5037
4934
  resolved with the record.
5038
4935
  **Example 1**
5039
- ```app/routes/post.js
4936
+ ```js [app/routes/post.js]
5040
4937
  export default class PostRoute extends Route {
5041
4938
  model({ post_id }) {
5042
4939
  return this.store.findRecord('post', post_id);
@@ -5047,7 +4944,7 @@ class Store extends BaseClass {
5047
4944
  `findRecord` can be called with a single identifier argument instead of the combination
5048
4945
  of `type` (modelName) and `id` as separate arguments. You may recognize this combo as
5049
4946
  the typical pairing from [JSON:API](https://jsonapi.org/format/#document-resource-object-identification)
5050
- ```app/routes/post.js
4947
+ ```js [app/routes/post.js]
5051
4948
  export default class PostRoute extends Route {
5052
4949
  model({ post_id: id }) {
5053
4950
  return this.store.findRecord({ type: 'post', id });
@@ -5057,7 +4954,7 @@ class Store extends BaseClass {
5057
4954
  **Example 3**
5058
4955
  If you have previously received an lid via an Identifier for this record, and the record
5059
4956
  has already been assigned an id, you can find the record again using just the lid.
5060
- ```app/routes/post.js
4957
+ ```js [app/routes/post.js]
5061
4958
  store.findRecord({ lid });
5062
4959
  ```
5063
4960
  If the record is not yet available, the store will ask the adapter's `findRecord`
@@ -5070,7 +4967,7 @@ class Store extends BaseClass {
5070
4967
  For example, if your Ember route looks like `/posts/1/comments/2` and your API route
5071
4968
  for the comment also looks like `/posts/1/comments/2` if you want to fetch the comment
5072
4969
  without also fetching the post you can pass in the post to the `findRecord` call:
5073
- ```app/routes/post-comments.js
4970
+ ```js [app/routes/post-comments.js]
5074
4971
  export default class PostRoute extends Route {
5075
4972
  model({ post_id, comment_id: id }) {
5076
4973
  return this.store.findRecord({ type: 'comment', id, { preload: { post: post_id }} });
@@ -5079,7 +4976,7 @@ class Store extends BaseClass {
5079
4976
  ```
5080
4977
  In your adapter you can then access this id without triggering a network request via the
5081
4978
  snapshot:
5082
- ```app/adapters/application.js
4979
+ ```js [app/adapters/application.js]
5083
4980
  export default class Adapter {
5084
4981
  findRecord(store, schema, id, snapshot) {
5085
4982
  let type = schema.modelName;
@@ -5096,14 +4993,14 @@ class Store extends BaseClass {
5096
4993
  ```
5097
4994
  This could also be achieved by supplying the post id to the adapter via the adapterOptions
5098
4995
  property on the options hash.
5099
- ```app/routes/post-comments.js
4996
+ ```js [app/routes/post-comments.js]
5100
4997
  export default class PostRoute extends Route {
5101
4998
  model({ post_id, comment_id: id }) {
5102
4999
  return this.store.findRecord({ type: 'comment', id, { adapterOptions: { post: post_id }} });
5103
5000
  }
5104
5001
  }
5105
5002
  ```
5106
- ```app/adapters/application.js
5003
+ ```js [app/adapters/application.js]
5107
5004
  export default class Adapter {
5108
5005
  findRecord(store, schema, id, snapshot) {
5109
5006
  let type = schema.modelName;
@@ -5190,7 +5087,7 @@ class Store extends BaseClass {
5190
5087
  If you would like to force or prevent background reloading, you can set a
5191
5088
  boolean value for `backgroundReload` in the options object for
5192
5089
  `findRecord`.
5193
- ```app/routes/post/edit.js
5090
+ ```js [app/routes/post/edit.js]
5194
5091
  export default class PostEditRoute extends Route {
5195
5092
  model(params) {
5196
5093
  return this.store.findRecord('post', params.post_id, { backgroundReload: false });
@@ -5199,7 +5096,7 @@ class Store extends BaseClass {
5199
5096
  ```
5200
5097
  If you pass an object on the `adapterOptions` property of the options
5201
5098
  argument it will be passed to your adapter via the snapshot
5202
- ```app/routes/post/edit.js
5099
+ ```js [app/routes/post/edit.js]
5203
5100
  export default class PostEditRoute extends Route {
5204
5101
  model(params) {
5205
5102
  return this.store.findRecord('post', params.post_id, {
@@ -5208,7 +5105,7 @@ class Store extends BaseClass {
5208
5105
  }
5209
5106
  }
5210
5107
  ```
5211
- ```app/adapters/post.js
5108
+ ```js [app/adapters/post.js]
5212
5109
  import MyCustomAdapter from './custom-adapter';
5213
5110
  export default class PostAdapter extends MyCustomAdapter {
5214
5111
  findRecord(store, type, id, snapshot) {
@@ -5231,14 +5128,14 @@ class Store extends BaseClass {
5231
5128
  For example, given a `post` model that has a `hasMany` relationship with a `comment`
5232
5129
  model, when we retrieve a specific post we can have the server also return that post's
5233
5130
  comments in the same request:
5234
- ```app/routes/post.js
5131
+ ```js [app/routes/post.js]
5235
5132
  export default class PostRoute extends Route {
5236
5133
  model(params) {
5237
5134
  return this.store.findRecord('post', params.post_id, { include: ['comments'] });
5238
5135
  }
5239
5136
  }
5240
5137
  ```
5241
- ```app/adapters/application.js
5138
+ ```js [app/adapters/application.js]
5242
5139
  export default class Adapter {
5243
5140
  findRecord(store, schema, id, snapshot) {
5244
5141
  let type = schema.modelName;
@@ -5259,7 +5156,7 @@ class Store extends BaseClass {
5259
5156
  list of relationship names, while nested relationships can be specified
5260
5157
  using a dot-separated sequence of relationship names. So to request both the post's
5261
5158
  comments and the authors of those comments the request would look like this:
5262
- ```app/routes/post.js
5159
+ ```js [app/routes/post.js]
5263
5160
  export default class PostRoute extends Route {
5264
5161
  model(params) {
5265
5162
  return this.store.findRecord('post', params.post_id, { include: ['comments','comments.author'] });
@@ -5270,7 +5167,7 @@ class Store extends BaseClass {
5270
5167
  If your server endpoint supports the use of a ['fields' query parameter](https://jsonapi.org/format/#fetching-sparse-fieldsets),
5271
5168
  you can use pass those fields through to your server. At this point in time, this requires a few manual steps on your part.
5272
5169
  1. Implement `buildQuery` in your adapter.
5273
- ```app/adapters/application.js
5170
+ ```js [app/adapters/application.js]
5274
5171
  buildQuery(snapshot) {
5275
5172
  let query = super.buildQuery(...arguments);
5276
5173
  let { fields } = snapshot.adapterOptions;
@@ -5282,7 +5179,7 @@ class Store extends BaseClass {
5282
5179
  ```
5283
5180
  2. Then pass through the applicable fields to your `findRecord` request.
5284
5181
  Given a `post` model with attributes body, title, publishDate and meta, you can retrieve a filtered list of attributes.
5285
- ```app/routes/post.js
5182
+ ```js [app/routes/post.js]
5286
5183
  export default class extends Route {
5287
5184
  model(params) {
5288
5185
  return this.store.findRecord('post', params.post_id, { adapterOptions: { fields: { post: 'body,title' } });
@@ -5291,7 +5188,7 @@ class Store extends BaseClass {
5291
5188
  ```
5292
5189
  Moreover, you can filter attributes on related models as well. If a `post` has a `belongsTo` relationship to a user,
5293
5190
  just include the relationship key and attributes.
5294
- ```app/routes/post.js
5191
+ ```js [app/routes/post.js]
5295
5192
  export default class extends Route {
5296
5193
  model(params) {
5297
5194
  return this.store.findRecord('post', params.post_id, { adapterOptions: { fields: { post: 'body,title', user: 'name,email' } });
@@ -5299,7 +5196,6 @@ class Store extends BaseClass {
5299
5196
  }
5300
5197
  ```
5301
5198
  @since 1.13.0
5302
- @method findRecord
5303
5199
  @public
5304
5200
  @param {String|object} type - either a string representing the name of the resource or a ResourceIdentifier object containing both the type (a string) and the id (a string) for the record or an lid (a string) of an existing record
5305
5201
  @param {(String|Integer|Object)} id - optional object with options for the request only if the first param is a ResourceIdentifier, else the string id of the record to be retrieved
@@ -5378,8 +5274,7 @@ class Store extends BaseClass {
5378
5274
  userRef.value() === user;
5379
5275
  });
5380
5276
  ```
5381
- @method getReference
5382
- @public
5277
+ @public
5383
5278
  @param {String|object} resource - modelName (string) or Identifier (object)
5384
5279
  @param {String|Integer} id
5385
5280
  @since 2.5.0
@@ -5435,7 +5330,6 @@ class Store extends BaseClass {
5435
5330
  post.id; // '1'
5436
5331
  ```
5437
5332
  @since 1.13.0
5438
- @method peekRecord
5439
5333
  @public
5440
5334
  @param {String|object} modelName - either a string representing the modelName or a ResourceIdentifier object containing both the type (a string) and the id (a string) for the record or an lid (a string) of an existing record
5441
5335
  @param {String|Integer} id - optional only if the first param is a ResourceIdentifier, else the string id of the record to be retrieved.
@@ -5504,7 +5398,6 @@ class Store extends BaseClass {
5504
5398
  [`Collection`](/ember-data/release/classes/Collection)
5505
5399
  once the server returns.
5506
5400
  @since 1.13.0
5507
- @method query
5508
5401
  @public
5509
5402
  @param {String} type the name of the resource
5510
5403
  @param {Object} query a query to be used by the adapter
@@ -5572,7 +5465,7 @@ class Store extends BaseClass {
5572
5465
  });
5573
5466
  ```
5574
5467
  The request is made through the adapters' `queryRecord`:
5575
- ```app/adapters/user.js
5468
+ ```js [app/adapters/user.js]
5576
5469
  import Adapter from '@ember-data/adapter';
5577
5470
  import $ from 'jquery';
5578
5471
  export default class UserAdapter extends Adapter {
@@ -5619,7 +5512,6 @@ class Store extends BaseClass {
5619
5512
  });
5620
5513
  ```
5621
5514
  @since 1.13.0
5622
- @method queryRecord
5623
5515
  @public
5624
5516
  @param {String} type
5625
5517
  @param {Object} query an opaque query to be used by the adapter
@@ -5665,7 +5557,7 @@ class Store extends BaseClass {
5665
5557
  given type, and returns a promise which will resolve with all records of
5666
5558
  this type present in the store, even if the adapter only returns a subset
5667
5559
  of them.
5668
- ```app/routes/authors.js
5560
+ ```js [app/routes/authors.js]
5669
5561
  export default class AuthorsRoute extends Route {
5670
5562
  model(params) {
5671
5563
  return this.store.findAll('author');
@@ -5704,7 +5596,7 @@ class Store extends BaseClass {
5704
5596
  then a background reload is started. Once this resolves, the array with
5705
5597
  which the promise resolves, is updated automatically so it contains all the
5706
5598
  records in the store:
5707
- ```app/adapters/application.js
5599
+ ```js [app/adapters/application.js]
5708
5600
  import Adapter from '@ember-data/adapter';
5709
5601
  export default class ApplicationAdapter extends Adapter {
5710
5602
  shouldReloadAll(store, snapshotsArray) {
@@ -5738,7 +5630,7 @@ class Store extends BaseClass {
5738
5630
  If you would like to force or prevent background reloading, you can set a
5739
5631
  boolean value for `backgroundReload` in the options object for
5740
5632
  `findAll`.
5741
- ```app/routes/post/edit.js
5633
+ ```js [app/routes/post/edit.js]
5742
5634
  export default class PostEditRoute extends Route {
5743
5635
  model() {
5744
5636
  return this.store.findAll('post', { backgroundReload: false });
@@ -5747,7 +5639,7 @@ class Store extends BaseClass {
5747
5639
  ```
5748
5640
  If you pass an object on the `adapterOptions` property of the options
5749
5641
  argument it will be passed to you adapter via the `snapshotRecordArray`
5750
- ```app/routes/posts.js
5642
+ ```js [app/routes/posts.js]
5751
5643
  export default class PostsRoute extends Route {
5752
5644
  model(params) {
5753
5645
  return this.store.findAll('post', {
@@ -5756,7 +5648,7 @@ class Store extends BaseClass {
5756
5648
  }
5757
5649
  }
5758
5650
  ```
5759
- ```app/adapters/post.js
5651
+ ```js [app/adapters/post.js]
5760
5652
  import MyCustomAdapter from './custom-adapter';
5761
5653
  export default class UserAdapter extends MyCustomAdapter {
5762
5654
  findAll(store, type, sinceToken, snapshotRecordArray) {
@@ -5780,7 +5672,7 @@ class Store extends BaseClass {
5780
5672
  For example, given a `post` model that has a `hasMany` relationship with a `comment`
5781
5673
  model, when we retrieve all of the post records we can have the server also return
5782
5674
  all of the posts' comments in the same request:
5783
- ```app/routes/posts.js
5675
+ ```js [app/routes/posts.js]
5784
5676
  export default class PostsRoute extends Route {
5785
5677
  model() {
5786
5678
  return this.store.findAll('post', { include: ['comments'] });
@@ -5791,7 +5683,7 @@ class Store extends BaseClass {
5791
5683
  list or relationship names, while nested relationships can be specified
5792
5684
  using a dot-separated sequence of relationship names. So to request both the posts'
5793
5685
  comments and the authors of those comments the request would look like this:
5794
- ```app/routes/posts.js
5686
+ ```js [app/routes/posts.js]
5795
5687
  export default class PostsRoute extends Route {
5796
5688
  model() {
5797
5689
  return this.store.findAll('post', { include: ['comments','comments.author'] });
@@ -5800,7 +5692,6 @@ class Store extends BaseClass {
5800
5692
  ```
5801
5693
  See [query](../methods/query?anchor=query) to only get a subset of records from the server.
5802
5694
  @since 1.13.0
5803
- @method findAll
5804
5695
  @public
5805
5696
  @param {String} type the name of the resource
5806
5697
  @param {Object} options
@@ -5849,7 +5740,6 @@ class Store extends BaseClass {
5849
5740
  let localPosts = store.peekAll('post');
5850
5741
  ```
5851
5742
  @since 1.13.0
5852
- @method peekAll
5853
5743
  @public
5854
5744
  @param {String} type the name of the resource
5855
5745
  @return {RecordArray}
@@ -5880,8 +5770,7 @@ class Store extends BaseClass {
5880
5770
  store.unloadAll();
5881
5771
  store.unloadAll('post');
5882
5772
  ```
5883
- @method unloadAll
5884
- @param {String} type the name of the resource
5773
+ @param {String} type the name of the resource
5885
5774
  @public
5886
5775
  */
5887
5776
 
@@ -5962,7 +5851,7 @@ class Store extends BaseClass {
5962
5851
  - [`data`](http://jsonapi.org/format/#document-resource-object-linkage) - place for primary data
5963
5852
  - [`meta`](http://jsonapi.org/format/#document-meta) - object which contains meta-information about relationship
5964
5853
  For this model:
5965
- ```app/models/person.js
5854
+ ```js [app/models/person.js]
5966
5855
  import Model, { attr, hasMany } from '@ember-data/model';
5967
5856
  export default class PersonRoute extends Route {
5968
5857
  @attr('string') firstName;
@@ -6032,8 +5921,7 @@ class Store extends BaseClass {
6032
5921
  ```
6033
5922
  This method can be used both to push in brand new
6034
5923
  records, as well as to update existing records.
6035
- @method push
6036
- @public
5924
+ @public
6037
5925
  @param {Object} data
6038
5926
  @return the record(s) that was created or
6039
5927
  updated.
@@ -6056,8 +5944,7 @@ class Store extends BaseClass {
6056
5944
  /**
6057
5945
  Push some data in the form of a json-api document into the store,
6058
5946
  without creating materialized records.
6059
- @method _push
6060
- @private
5947
+ @private
6061
5948
  @param {Object} jsonApiDoc
6062
5949
  @return {StableRecordIdentifier|Array<StableRecordIdentifier>|null} identifiers for the primary records that had data loaded
6063
5950
  */
@@ -6083,7 +5970,6 @@ class Store extends BaseClass {
6083
5970
  *
6084
5971
  * Returns a promise resolving with the same record when the save is complete.
6085
5972
  *
6086
- * @method saveRecord
6087
5973
  * @public
6088
5974
  * @param {unknown} record
6089
5975
  * @param options
@@ -6143,7 +6029,6 @@ class Store extends BaseClass {
6143
6029
  * This hook should not be called directly by consuming applications or libraries.
6144
6030
  * Use `Store.cache` to access the Cache instance.
6145
6031
  *
6146
- * @method createCache (hook)
6147
6032
  * @public
6148
6033
  * @param storeWrapper
6149
6034
  * @return {Cache}
@@ -6379,10 +6264,6 @@ function getPriority(identifier, deduped, priority) {
6379
6264
  return priority;
6380
6265
  }
6381
6266
 
6382
- /**
6383
- * @module @ember-data/store
6384
- */
6385
-
6386
6267
  /**
6387
6268
  * A CacheHandler that adds support for using an EmberData Cache with a RequestManager.
6388
6269
  *
@@ -6422,7 +6303,6 @@ function getPriority(identifier, deduped, priority) {
6422
6303
  * [EnableHydration]: true
6423
6304
  * });
6424
6305
  *
6425
- * @typedoc
6426
6306
  */
6427
6307
  const CacheHandler = {
6428
6308
  request(context, next) {
@@ -6667,9 +6547,6 @@ function fetchContentAndHydrate(next, context, identifier, priority) {
6667
6547
  });
6668
6548
  }
6669
6549
 
6670
- /**
6671
- @module @ember-data/store
6672
- */
6673
6550
  /**
6674
6551
  A `ManyArray` is a `MutableArray` that represents the contents of a has-many
6675
6552
  relationship.
@@ -6685,7 +6562,7 @@ function fetchContentAndHydrate(next, context, identifier, priority) {
6685
6562
  an inverse. For example, imagine the following models are
6686
6563
  defined:
6687
6564
 
6688
- ```app/models/post.js
6565
+ ```js [app/models/post.js]
6689
6566
  import Model, { hasMany } from '@ember-data/model';
6690
6567
 
6691
6568
  export default class PostModel extends Model {
@@ -6693,7 +6570,7 @@ function fetchContentAndHydrate(next, context, identifier, priority) {
6693
6570
  }
6694
6571
  ```
6695
6572
 
6696
- ```app/models/comment.js
6573
+ ```js [app/models/comment.js]
6697
6574
  import Model, { belongsTo } from '@ember-data/model';
6698
6575
 
6699
6576
  export default class CommentModel extends Model {
@@ -6988,8 +6865,7 @@ class RelatedCollection extends IdentifierArray {
6988
6865
  let permissions = await user.permissions;
6989
6866
  await permissions.reload();
6990
6867
  ```
6991
- @method reload
6992
- @public
6868
+ @public
6993
6869
  */
6994
6870
  reload(options) {
6995
6871
  macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
@@ -7001,27 +6877,9 @@ class RelatedCollection extends IdentifierArray {
7001
6877
  return this._manager.reloadHasMany(this.key, options);
7002
6878
  }
7003
6879
 
7004
- /**
7005
- Saves all of the records in the `ManyArray`.
7006
- Note: this API can only be used in legacy mode with a configured Adapter.
7007
- Example
7008
- ```javascript
7009
- const { content: { data: inbox } } = await store.request(findRecord({ type: 'inbox', id: '1' }));
7010
- let messages = await inbox.messages;
7011
- messages.forEach((message) => {
7012
- message.isRead = true;
7013
- });
7014
- messages.save();
7015
- ```
7016
- @method save
7017
- @public
7018
- @return {PromiseArray} promise
7019
- */
7020
-
7021
6880
  /**
7022
6881
  Create a child record within the owner
7023
- @method createRecord
7024
- @public
6882
+ @public
7025
6883
  @param {Object} hash
7026
6884
  @return {Model} record
7027
6885
  */
@@ -7038,6 +6896,24 @@ class RelatedCollection extends IdentifierArray {
7038
6896
  this.push(record);
7039
6897
  return record;
7040
6898
  }
6899
+
6900
+ /**
6901
+ Saves all of the records in the `ManyArray`.
6902
+ Note: this API can only be used in legacy mode with a configured Adapter.
6903
+ Example
6904
+ ```javascript
6905
+ const { content: { data: inbox } } = await store.request(findRecord({ type: 'inbox', id: '1' }));
6906
+ let messages = await inbox.messages;
6907
+ messages.forEach((message) => {
6908
+ message.isRead = true;
6909
+ });
6910
+ messages.save();
6911
+ ```
6912
+ @public
6913
+ @return {PromiseArray} promise
6914
+ */
6915
+
6916
+ /** @internal */
7041
6917
  destroy() {
7042
6918
  super.destroy(false);
7043
6919
  }
@@ -7145,7 +7021,6 @@ const PromiseCache = new WeakMap();
7145
7021
  * The state of a promise in the "pending"
7146
7022
  * state. This is the default initial state.
7147
7023
  *
7148
- * @typedoc
7149
7024
  */
7150
7025
 
7151
7026
  /**
@@ -7153,7 +7028,6 @@ const PromiseCache = new WeakMap();
7153
7028
  * This is the state of a promise that has resolved
7154
7029
  * successfully.
7155
7030
  *
7156
- * @typedoc
7157
7031
  */
7158
7032
 
7159
7033
  /**
@@ -7161,7 +7035,6 @@ const PromiseCache = new WeakMap();
7161
7035
  * This is the state of a promise that has rejected
7162
7036
  * with an error.
7163
7037
  *
7164
- * @typedoc
7165
7038
  */
7166
7039
 
7167
7040
  /**
@@ -7173,7 +7046,6 @@ const PromiseCache = new WeakMap();
7173
7046
  * - {@link ResolvedPromise}
7174
7047
  * - {@link RejectedPromise}
7175
7048
  *
7176
- * @typedoc
7177
7049
  */
7178
7050
 
7179
7051
  const PromiseStateProto = {};
@@ -7294,7 +7166,6 @@ function getPromise(promise) {
7294
7166
  *
7295
7167
  * If looking to use in a template, consider also the `<Await />` component.
7296
7168
  *
7297
- * @typedoc
7298
7169
  */
7299
7170
  function getPromiseState(promise) {
7300
7171
  const _promise = getPromise(promise);
@@ -7368,7 +7239,6 @@ async function watchStream(stream, state) {
7368
7239
  * reactive properties that can be used to build UIs that respond
7369
7240
  * to the progress of a request.
7370
7241
  *
7371
- * @typedoc
7372
7242
  */
7373
7243
  class RequestLoadingState {
7374
7244
  _stream = null;
@@ -7498,7 +7368,6 @@ defineNonEnumerableSignal(RequestLoadingState.prototype, '_lastPacketTime', 0);
7498
7368
  *
7499
7369
  * Extends the {@link PendingPromise} interface.
7500
7370
  *
7501
- * @typedoc
7502
7371
  */
7503
7372
 
7504
7373
  /**
@@ -7508,7 +7377,6 @@ defineNonEnumerableSignal(RequestLoadingState.prototype, '_lastPacketTime', 0);
7508
7377
  *
7509
7378
  * Extends the {@link ResolvedPromise} interface.
7510
7379
  *
7511
- * @typedoc
7512
7380
  */
7513
7381
 
7514
7382
  /**
@@ -7518,7 +7386,6 @@ defineNonEnumerableSignal(RequestLoadingState.prototype, '_lastPacketTime', 0);
7518
7386
  *
7519
7387
  * Extends the {@link RejectedPromise} interface.
7520
7388
  *
7521
- * @typedoc
7522
7389
  */
7523
7390
 
7524
7391
  /**
@@ -7526,7 +7393,6 @@ defineNonEnumerableSignal(RequestLoadingState.prototype, '_lastPacketTime', 0);
7526
7393
  * This is the state of a promise that has been
7527
7394
  * cancelled.
7528
7395
  *
7529
- * @typedoc
7530
7396
  */
7531
7397
 
7532
7398
  /**
@@ -7560,7 +7426,6 @@ defineNonEnumerableSignal(RequestLoadingState.prototype, '_lastPacketTime', 0);
7560
7426
  * - {@link RejectedRequest}
7561
7427
  * - {@link CancelledRequest}
7562
7428
  *
7563
- * @typedoc
7564
7429
  */
7565
7430
 
7566
7431
  const RequestStateProto = {};
@@ -7696,7 +7561,6 @@ function createRequestState(future) {
7696
7561
  * which offers a numbe of additional capabilities for requests *beyond* what
7697
7562
  * `RequestState` provides.
7698
7563
  *
7699
- * @typedoc
7700
7564
  */
7701
7565
  function getRequestState(future) {
7702
7566
  let state = RequestCache.get(future);