@ember-data/store 5.1.0-alpha.7 → 5.1.0-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/addon/-private.js CHANGED
@@ -1 +1 @@
1
- export { f as AdapterPopulatedRecordArray, C as CacheHandler, h as IDENTIFIER_ARRAY_TAG, I as IdentifierArray, M as MUTATE, I as RecordArray, R as RecordArrayManager, g as SOURCE, S as Store, _ as _clearCaches, e as coerceId, j as fastPush, i as isStableIdentifier, n as notifyArray, p as peekCache, r as recordIdentifierFor, k as removeRecordDataFor, c as setIdentifierForgetMethod, a as setIdentifierGenerationMethod, d as setIdentifierResetMethod, b as setIdentifierUpdateMethod, s as storeFor } from "./store-service-b3adf748";
1
+ export { f as AdapterPopulatedRecordArray, C as CacheHandler, h as IDENTIFIER_ARRAY_TAG, I as IdentifierArray, M as MUTATE, I as RecordArray, R as RecordArrayManager, g as SOURCE, S as Store, _ as _clearCaches, e as coerceId, j as fastPush, i as isStableIdentifier, n as notifyArray, p as peekCache, r as recordIdentifierFor, k as removeRecordDataFor, c as setIdentifierForgetMethod, a as setIdentifierGenerationMethod, d as setIdentifierResetMethod, b as setIdentifierUpdateMethod, s as storeFor } from "./store-service-fe7f006c";
package/addon/index.js CHANGED
@@ -1 +1 @@
1
- export { C as CacheHandler, S as default, r as recordIdentifierFor, c as setIdentifierForgetMethod, a as setIdentifierGenerationMethod, d as setIdentifierResetMethod, b as setIdentifierUpdateMethod, s as storeFor } from "./store-service-b3adf748";
1
+ export { C as CacheHandler, S as default, r as recordIdentifierFor, c as setIdentifierForgetMethod, a as setIdentifierGenerationMethod, d as setIdentifierResetMethod, b as setIdentifierUpdateMethod, s as storeFor } from "./store-service-fe7f006c";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,5 +1,6 @@
1
1
  import { getOwner, setOwner } from '@ember/application';
2
2
  import { assert, warn } from '@ember/debug';
3
+ import EmberObject from '@ember/object';
3
4
  import { _backburner } from '@ember/runloop';
4
5
  import { macroCondition, getOwnConfig, importSync } from '@embroider/macros';
5
6
  import { tracked } from '@glimmer/tracking';
@@ -2362,8 +2363,8 @@ class CacheManager {
2362
2363
  * @public
2363
2364
  * @param identifier
2364
2365
  */
2365
- willCommit(identifier) {
2366
- _classPrivateFieldBase(this, _cache)[_cache].willCommit(identifier);
2366
+ willCommit(identifier, context) {
2367
+ _classPrivateFieldBase(this, _cache)[_cache].willCommit(identifier, context);
2367
2368
  }
2368
2369
 
2369
2370
  /**
@@ -2375,8 +2376,8 @@ class CacheManager {
2375
2376
  * @param identifier
2376
2377
  * @param data
2377
2378
  */
2378
- didCommit(identifier, data) {
2379
- _classPrivateFieldBase(this, _cache)[_cache].didCommit(identifier, data);
2379
+ didCommit(identifier, result) {
2380
+ return _classPrivateFieldBase(this, _cache)[_cache].didCommit(identifier, result);
2380
2381
  }
2381
2382
 
2382
2383
  /**
@@ -2989,6 +2990,7 @@ function extractIdentifierFromRecord$1(record) {
2989
2990
  /**
2990
2991
  @module @ember-data/store
2991
2992
  */
2993
+
2992
2994
  const RecordArraysCache = new Map();
2993
2995
  const FAKE_ARR = {};
2994
2996
  const SLICE_BATCH_SIZE = 1200;
@@ -3575,9 +3577,8 @@ let _Cache;
3575
3577
 
3576
3578
  @class Store
3577
3579
  @public
3578
- */
3579
-
3580
- class Store {
3580
+ */ // @ts-expect-error
3581
+ class Store extends EmberObject {
3581
3582
  /**
3582
3583
  * Provides access to the NotificationManager associated
3583
3584
  * with this Store instance.
@@ -3676,13 +3677,27 @@ class Store {
3676
3677
 
3677
3678
  // DEBUG-only properties
3678
3679
 
3680
+ // @ts-expect-error
3681
+ get isDestroying() {
3682
+ return this._isDestroying;
3683
+ }
3684
+ set isDestroying(value) {
3685
+ this._isDestroying = value;
3686
+ }
3687
+ // @ts-expect-error
3688
+ get isDestroyed() {
3689
+ return this._isDestroyed;
3690
+ }
3691
+ set isDestroyed(value) {
3692
+ this._isDestroyed = value;
3693
+ }
3694
+
3679
3695
  /**
3680
3696
  @method init
3681
3697
  @private
3682
3698
  */
3683
3699
  constructor(createArgs) {
3684
- this.isDestroying = false;
3685
- this.isDestroyed = false;
3700
+ super(createArgs);
3686
3701
  Object.assign(this, createArgs);
3687
3702
  this.identifierCache = new IdentifierCache();
3688
3703
  this.notifications = new NotificationManager(this);
@@ -3699,6 +3714,8 @@ class Store {
3699
3714
  this._serializerCache = Object.create(null);
3700
3715
  this._modelFactoryCache = Object.create(null);
3701
3716
  this._documentCache = new Map();
3717
+ this.isDestroying = false;
3718
+ this.isDestroyed = false;
3702
3719
  }
3703
3720
  _run(cb) {
3704
3721
  assert(`EmberData should never encounter a nested run`, !this._cbs);
@@ -5299,7 +5316,6 @@ class Store {
5299
5316
  if (resourceIsFullyDeleted(this._instanceCache, identifier)) {
5300
5317
  return Promise.resolve(record);
5301
5318
  }
5302
- cache.willCommit(identifier);
5303
5319
  if (isDSModel(record)) {
5304
5320
  record.errors.clear();
5305
5321
  }
@@ -5312,7 +5328,7 @@ class Store {
5312
5328
  } else if (cache.isDeleted(identifier)) {
5313
5329
  operation = 'deleteRecord';
5314
5330
  }
5315
- return this.request({
5331
+ const request = {
5316
5332
  op: operation,
5317
5333
  data: {
5318
5334
  options,
@@ -5321,7 +5337,13 @@ class Store {
5321
5337
  cacheOptions: {
5322
5338
  [SkipCache]: true
5323
5339
  }
5324
- }).then(document => document.content);
5340
+ };
5341
+
5342
+ // we lie here on the type because legacy doesn't have enough context
5343
+ cache.willCommit(identifier, {
5344
+ request
5345
+ });
5346
+ return this.request(request).then(document => document.content);
5325
5347
  }
5326
5348
 
5327
5349
  /**
@@ -5488,6 +5510,8 @@ class Store {
5488
5510
  }
5489
5511
  return null;
5490
5512
  }
5513
+
5514
+ // @ts-expect-error
5491
5515
  destroy() {
5492
5516
  if (this.isDestroyed) {
5493
5517
  // @ember/test-helpers will call destroy multiple times