@ember-data/store 5.3.0-alpha.3 → 5.3.0-alpha.5
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-
|
|
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, m as StoreMap, _ as _clearCaches, e as coerceId, j as fastPush, i as isStableIdentifier, n as notifyArray, p as peekCache, r as recordIdentifierFor, k as removeRecordDataFor, o as setCacheFor, c as setIdentifierForgetMethod, a as setIdentifierGenerationMethod, d as setIdentifierResetMethod, b as setIdentifierUpdateMethod, l as setRecordIdentifier, s as storeFor } from "./store-service-7750e2f0";
|
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-
|
|
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-7750e2f0";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { macroCondition, getOwnConfig } from '@embroider/macros';
|
|
2
|
+
import { getOwner } from '@ember/application';
|
|
2
3
|
import { assert, warn } from '@ember/debug';
|
|
3
4
|
import EmberObject from '@ember/object';
|
|
4
5
|
import { _backburner } from '@ember/runloop';
|
|
5
|
-
import { macroCondition, getOwnConfig, importSync } from '@embroider/macros';
|
|
6
6
|
import { tracked } from '@glimmer/tracking';
|
|
7
7
|
import { dasherize } from '@ember/string';
|
|
8
8
|
import { addToTransaction, subscribe, addTransactionCB } from '@ember-data/tracking/-private';
|
|
@@ -354,26 +354,6 @@ function copyDocumentProperties(target, source) {
|
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
356
|
|
|
357
|
-
/*
|
|
358
|
-
* Returns the Cache instance associated with a given
|
|
359
|
-
* Model or Identifier
|
|
360
|
-
*/
|
|
361
|
-
|
|
362
|
-
const CacheForIdentifierCache = new Map();
|
|
363
|
-
function setCacheFor(identifier, cache) {
|
|
364
|
-
assert(`Illegal set of identifier`, !CacheForIdentifierCache.has(identifier) || CacheForIdentifierCache.get(identifier) === cache);
|
|
365
|
-
CacheForIdentifierCache.set(identifier, cache);
|
|
366
|
-
}
|
|
367
|
-
function removeRecordDataFor(identifier) {
|
|
368
|
-
CacheForIdentifierCache.delete(identifier);
|
|
369
|
-
}
|
|
370
|
-
function peekCache(instance) {
|
|
371
|
-
if (CacheForIdentifierCache.has(instance)) {
|
|
372
|
-
return CacheForIdentifierCache.get(instance);
|
|
373
|
-
}
|
|
374
|
-
return null;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
357
|
/**
|
|
378
358
|
@module @ember-data/store
|
|
379
359
|
*/
|
|
@@ -1335,14 +1315,25 @@ class CacheStoreWrapper {
|
|
|
1335
1315
|
this._pendingNotifies.delete(identifier);
|
|
1336
1316
|
}
|
|
1337
1317
|
}
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1318
|
+
|
|
1319
|
+
/*
|
|
1320
|
+
* Returns the Cache instance associated with a given
|
|
1321
|
+
* Model or Identifier
|
|
1322
|
+
*/
|
|
1323
|
+
|
|
1324
|
+
const CacheForIdentifierCache = new Map();
|
|
1325
|
+
function setCacheFor(identifier, cache) {
|
|
1326
|
+
assert(`Illegal set of identifier`, !CacheForIdentifierCache.has(identifier) || CacheForIdentifierCache.get(identifier) === cache);
|
|
1327
|
+
CacheForIdentifierCache.set(identifier, cache);
|
|
1328
|
+
}
|
|
1329
|
+
function removeRecordDataFor(identifier) {
|
|
1330
|
+
CacheForIdentifierCache.delete(identifier);
|
|
1331
|
+
}
|
|
1332
|
+
function peekCache(instance) {
|
|
1333
|
+
if (CacheForIdentifierCache.has(instance)) {
|
|
1334
|
+
return CacheForIdentifierCache.get(instance);
|
|
1335
|
+
}
|
|
1336
|
+
return null;
|
|
1346
1337
|
}
|
|
1347
1338
|
|
|
1348
1339
|
/**
|
|
@@ -1441,11 +1432,8 @@ class InstanceCache {
|
|
|
1441
1432
|
|
|
1442
1433
|
/*
|
|
1443
1434
|
TODO @runspired consider adding this to make polymorphism even nicer
|
|
1444
|
-
if (HAS_GRAPH_PACKAGE) {
|
|
1445
1435
|
if (identifier.type !== matchedIdentifier.type) {
|
|
1446
|
-
|
|
1447
|
-
graphFor(this).registerPolymorphicType(identifier.type, matchedIdentifier.type);
|
|
1448
|
-
}
|
|
1436
|
+
this.store._graph?.registerPolymorphicType(identifier.type, matchedIdentifier.type);
|
|
1449
1437
|
}
|
|
1450
1438
|
*/
|
|
1451
1439
|
|
|
@@ -1507,12 +1495,7 @@ class InstanceCache {
|
|
|
1507
1495
|
disconnect(identifier) {
|
|
1508
1496
|
const record = this.__instances.record.get(identifier);
|
|
1509
1497
|
assert('Cannot destroy record while it is still materialized', !record || record.isDestroyed || record.isDestroying);
|
|
1510
|
-
|
|
1511
|
-
let graph = _peekGraph(this.store);
|
|
1512
|
-
if (graph) {
|
|
1513
|
-
graph.remove(identifier);
|
|
1514
|
-
}
|
|
1515
|
-
}
|
|
1498
|
+
this.store._graph?.remove(identifier);
|
|
1516
1499
|
this.store.identifierCache.forgetRecordIdentifier(identifier);
|
|
1517
1500
|
removeRecordDataFor(identifier);
|
|
1518
1501
|
this.store._requestCache._clearEntries(identifier);
|
|
@@ -1712,84 +1695,6 @@ function _clearCaches() {
|
|
|
1712
1695
|
StoreMap.clear();
|
|
1713
1696
|
CacheForIdentifierCache.clear();
|
|
1714
1697
|
}
|
|
1715
|
-
let _modelForMixin;
|
|
1716
|
-
if (macroCondition(getOwnConfig().packages.HAS_MODEL_PACKAGE)) {
|
|
1717
|
-
let _found;
|
|
1718
|
-
_modelForMixin = function () {
|
|
1719
|
-
if (!_found) {
|
|
1720
|
-
_found = importSync('@ember-data/model/-private')._modelForMixin;
|
|
1721
|
-
}
|
|
1722
|
-
return _found(...arguments);
|
|
1723
|
-
};
|
|
1724
|
-
}
|
|
1725
|
-
class DSModelSchemaDefinitionService {
|
|
1726
|
-
constructor(store) {
|
|
1727
|
-
this.store = store;
|
|
1728
|
-
this._relationshipsDefCache = Object.create(null);
|
|
1729
|
-
this._attributesDefCache = Object.create(null);
|
|
1730
|
-
}
|
|
1731
|
-
|
|
1732
|
-
// Following the existing RD implementation
|
|
1733
|
-
attributesDefinitionFor(identifier) {
|
|
1734
|
-
let modelName, attributes;
|
|
1735
|
-
modelName = identifier.type;
|
|
1736
|
-
attributes = this._attributesDefCache[modelName];
|
|
1737
|
-
if (attributes === undefined) {
|
|
1738
|
-
let modelClass = this.store.modelFor(modelName);
|
|
1739
|
-
let attributeMap = modelClass.attributes;
|
|
1740
|
-
attributes = Object.create(null);
|
|
1741
|
-
attributeMap.forEach((meta, name) => attributes[name] = meta);
|
|
1742
|
-
this._attributesDefCache[modelName] = attributes;
|
|
1743
|
-
}
|
|
1744
|
-
return attributes;
|
|
1745
|
-
}
|
|
1746
|
-
|
|
1747
|
-
// Following the existing RD implementation
|
|
1748
|
-
relationshipsDefinitionFor(identifier) {
|
|
1749
|
-
let modelName, relationships;
|
|
1750
|
-
modelName = identifier.type;
|
|
1751
|
-
relationships = this._relationshipsDefCache[modelName];
|
|
1752
|
-
if (relationships === undefined) {
|
|
1753
|
-
let modelClass = this.store.modelFor(modelName);
|
|
1754
|
-
relationships = modelClass.relationshipsObject || null;
|
|
1755
|
-
this._relationshipsDefCache[modelName] = relationships;
|
|
1756
|
-
}
|
|
1757
|
-
return relationships;
|
|
1758
|
-
}
|
|
1759
|
-
doesTypeExist(modelName) {
|
|
1760
|
-
let normalizedModelName = normalizeModelName(modelName);
|
|
1761
|
-
let factory = getModelFactory(this.store, this.store._modelFactoryCache, normalizedModelName);
|
|
1762
|
-
return factory !== null;
|
|
1763
|
-
}
|
|
1764
|
-
}
|
|
1765
|
-
function getModelFactory(store, cache, normalizedModelName) {
|
|
1766
|
-
let factory = cache[normalizedModelName];
|
|
1767
|
-
if (!factory) {
|
|
1768
|
-
let owner = getOwner(store);
|
|
1769
|
-
factory = owner.factoryFor(`model:${normalizedModelName}`);
|
|
1770
|
-
if (macroCondition(getOwnConfig().packages.HAS_MODEL_PACKAGE)) {
|
|
1771
|
-
if (!factory) {
|
|
1772
|
-
//Support looking up mixins as base types for polymorphic relationships
|
|
1773
|
-
factory = _modelForMixin(store, normalizedModelName);
|
|
1774
|
-
}
|
|
1775
|
-
}
|
|
1776
|
-
if (!factory) {
|
|
1777
|
-
// we don't cache misses in case someone wants to register a missing model
|
|
1778
|
-
return null;
|
|
1779
|
-
}
|
|
1780
|
-
let klass = factory.class;
|
|
1781
|
-
if (klass.isModel) {
|
|
1782
|
-
let hasOwnModelNameSet = klass.modelName && Object.prototype.hasOwnProperty.call(klass, 'modelName');
|
|
1783
|
-
if (!hasOwnModelNameSet) {
|
|
1784
|
-
Object.defineProperty(klass, 'modelName', {
|
|
1785
|
-
value: normalizedModelName
|
|
1786
|
-
});
|
|
1787
|
-
}
|
|
1788
|
-
}
|
|
1789
|
-
cache[normalizedModelName] = factory;
|
|
1790
|
-
}
|
|
1791
|
-
return factory;
|
|
1792
|
-
}
|
|
1793
1698
|
|
|
1794
1699
|
// if modelFor turns out to be a bottleneck we should replace with a Map
|
|
1795
1700
|
// and clear it during store teardown.
|
|
@@ -3559,14 +3464,6 @@ function constructResource(type, id, lid) {
|
|
|
3559
3464
|
}
|
|
3560
3465
|
}
|
|
3561
3466
|
|
|
3562
|
-
/**
|
|
3563
|
-
@module @ember-data/store
|
|
3564
|
-
*/
|
|
3565
|
-
|
|
3566
|
-
// hello world
|
|
3567
|
-
|
|
3568
|
-
let _Cache;
|
|
3569
|
-
|
|
3570
3467
|
/**
|
|
3571
3468
|
* A Store coordinates interaction between your application, a [Cache](https://api.emberjs.com/ember-data/release/classes/%3CInterface%3E%20Cache),
|
|
3572
3469
|
* and sources of data (such as your API or a local persistence layer)
|
|
@@ -3720,7 +3617,6 @@ class Store extends EmberObject {
|
|
|
3720
3617
|
this._instanceCache = new InstanceCache(this);
|
|
3721
3618
|
this._adapterCache = Object.create(null);
|
|
3722
3619
|
this._serializerCache = Object.create(null);
|
|
3723
|
-
this._modelFactoryCache = Object.create(null);
|
|
3724
3620
|
this._documentCache = new Map();
|
|
3725
3621
|
this.isDestroying = false;
|
|
3726
3622
|
this.isDestroyed = false;
|
|
@@ -3802,7 +3698,7 @@ class Store extends EmberObject {
|
|
|
3802
3698
|
* MUST be supplied for the document to be cached.
|
|
3803
3699
|
*
|
|
3804
3700
|
* @method request
|
|
3805
|
-
* @param {
|
|
3701
|
+
* @param {StoreRequestInput} requestConfig
|
|
3806
3702
|
* @returns {Future}
|
|
3807
3703
|
* @public
|
|
3808
3704
|
*/
|
|
@@ -3814,6 +3710,10 @@ class Store extends EmberObject {
|
|
|
3814
3710
|
store: this,
|
|
3815
3711
|
[EnableHydration]: true
|
|
3816
3712
|
};
|
|
3713
|
+
if (requestConfig.records) {
|
|
3714
|
+
const identifierCache = this.identifierCache;
|
|
3715
|
+
opts.records = requestConfig.records.map(r => identifierCache.getOrCreateRecordIdentifier(r));
|
|
3716
|
+
}
|
|
3817
3717
|
if (macroCondition(getOwnConfig().env.TESTING)) {
|
|
3818
3718
|
if (this.DISABLE_WAITER) {
|
|
3819
3719
|
opts.disableTestWaiter = typeof requestConfig.disableTestWaiter === 'boolean' ? requestConfig.disableTestWaiter : true;
|
|
@@ -3861,28 +3761,6 @@ class Store extends EmberObject {
|
|
|
3861
3761
|
* @returns A record instance
|
|
3862
3762
|
* @public
|
|
3863
3763
|
*/
|
|
3864
|
-
instantiateRecord(identifier, createRecordArgs) {
|
|
3865
|
-
if (macroCondition(getOwnConfig().packages.HAS_MODEL_PACKAGE)) {
|
|
3866
|
-
let modelName = identifier.type;
|
|
3867
|
-
const cache = this.cache;
|
|
3868
|
-
// TODO deprecate allowing unknown args setting
|
|
3869
|
-
let createOptions = {
|
|
3870
|
-
_createProps: createRecordArgs,
|
|
3871
|
-
// TODO @deprecate consider deprecating accessing record properties during init which the below is necessary for
|
|
3872
|
-
_secretInit: {
|
|
3873
|
-
identifier,
|
|
3874
|
-
cache,
|
|
3875
|
-
store: this,
|
|
3876
|
-
cb: secretInit
|
|
3877
|
-
}
|
|
3878
|
-
};
|
|
3879
|
-
|
|
3880
|
-
// ensure that `getOwner(this)` works inside a model instance
|
|
3881
|
-
setOwner(createOptions, getOwner(this));
|
|
3882
|
-
return getModelFactory(this, this._modelFactoryCache, modelName).class.create(createOptions);
|
|
3883
|
-
}
|
|
3884
|
-
assert(`You must implement the store's instantiateRecord hook for your custom model class.`);
|
|
3885
|
-
}
|
|
3886
3764
|
|
|
3887
3765
|
/**
|
|
3888
3766
|
* A hook which an app or addon may implement. Called when
|
|
@@ -3894,14 +3772,6 @@ class Store extends EmberObject {
|
|
|
3894
3772
|
* @public
|
|
3895
3773
|
* @param record
|
|
3896
3774
|
*/
|
|
3897
|
-
teardownRecord(record) {
|
|
3898
|
-
if (macroCondition(getOwnConfig().packages.HAS_MODEL_PACKAGE)) {
|
|
3899
|
-
assert(`expected to receive an instance of DSModel. If using a custom model make sure you implement teardownRecord`, 'destroy' in record);
|
|
3900
|
-
record.destroy();
|
|
3901
|
-
} else {
|
|
3902
|
-
assert(`You must implement the store's teardownRecord hook for your custom models`);
|
|
3903
|
-
}
|
|
3904
|
-
}
|
|
3905
3775
|
|
|
3906
3776
|
/**
|
|
3907
3777
|
* Provides access to the SchemaDefinitionService instance
|
|
@@ -3914,13 +3784,6 @@ class Store extends EmberObject {
|
|
|
3914
3784
|
* @public
|
|
3915
3785
|
*/
|
|
3916
3786
|
getSchemaDefinitionService() {
|
|
3917
|
-
if (macroCondition(getOwnConfig().packages.HAS_MODEL_PACKAGE)) {
|
|
3918
|
-
if (!this._schema) {
|
|
3919
|
-
// it is potentially a mistake for the RFC to have not enabled chaining these services, though highlander rule is nice.
|
|
3920
|
-
// what ember-m3 did via private API to allow both worlds to interop would be much much harder using this.
|
|
3921
|
-
this._schema = new DSModelSchemaDefinitionService(this);
|
|
3922
|
-
}
|
|
3923
|
-
}
|
|
3924
3787
|
assert(`You must registerSchemaDefinitionService with the store to use custom model classes`, this._schema);
|
|
3925
3788
|
return this._schema;
|
|
3926
3789
|
}
|
|
@@ -4052,33 +3915,18 @@ class Store extends EmberObject {
|
|
|
4052
3915
|
for example.
|
|
4053
3916
|
@method modelFor
|
|
4054
3917
|
@public
|
|
4055
|
-
@param {String}
|
|
4056
|
-
@return {
|
|
3918
|
+
@param {String} type
|
|
3919
|
+
@return {ModelSchema}
|
|
4057
3920
|
*/
|
|
4058
3921
|
// TODO @deprecate in favor of schema APIs, requires adapter/serializer overhaul or replacement
|
|
4059
3922
|
|
|
4060
|
-
modelFor(
|
|
3923
|
+
modelFor(type) {
|
|
4061
3924
|
if (macroCondition(getOwnConfig().env.DEBUG)) {
|
|
4062
3925
|
assertDestroyedStoreOnly(this, 'modelFor');
|
|
4063
3926
|
}
|
|
4064
|
-
assert(`You need to pass
|
|
4065
|
-
assert(`
|
|
4066
|
-
|
|
4067
|
-
let normalizedModelName = normalizeModelName(modelName);
|
|
4068
|
-
let maybeFactory = getModelFactory(this, this._modelFactoryCache, normalizedModelName);
|
|
4069
|
-
|
|
4070
|
-
// for factorFor factory/class split
|
|
4071
|
-
let klass = maybeFactory && maybeFactory.class ? maybeFactory.class : maybeFactory;
|
|
4072
|
-
if (!klass || !klass.isModel || this._forceShim) {
|
|
4073
|
-
assert(`No model was found for '${modelName}' and no schema handles the type`, this.getSchemaDefinitionService().doesTypeExist(modelName));
|
|
4074
|
-
return getShimClass(this, modelName);
|
|
4075
|
-
} else {
|
|
4076
|
-
// TODO @deprecate ever returning the klass, always return the shim
|
|
4077
|
-
return klass;
|
|
4078
|
-
}
|
|
4079
|
-
}
|
|
4080
|
-
assert(`No model was found for '${modelName}' and no schema handles the type`, this.getSchemaDefinitionService().doesTypeExist(modelName));
|
|
4081
|
-
return getShimClass(this, modelName);
|
|
3927
|
+
assert(`You need to pass <type> to the store's modelFor method`, typeof type === 'string' && type.length);
|
|
3928
|
+
assert(`No model was found for '${type}' and no schema handles the type`, this.getSchemaDefinitionService().doesTypeExist(type));
|
|
3929
|
+
return getShimClass(this, type);
|
|
4082
3930
|
}
|
|
4083
3931
|
|
|
4084
3932
|
/**
|
|
@@ -5023,13 +4871,7 @@ class Store extends EmberObject {
|
|
|
5023
4871
|
// destroy the graph before unloadAll
|
|
5024
4872
|
// since then we avoid churning relationships
|
|
5025
4873
|
// during unload
|
|
5026
|
-
|
|
5027
|
-
const peekGraph = importSync('@ember-data/graph/-private').peekGraph;
|
|
5028
|
-
const graph = peekGraph(this);
|
|
5029
|
-
if (graph) {
|
|
5030
|
-
graph.identifiers.clear();
|
|
5031
|
-
}
|
|
5032
|
-
}
|
|
4874
|
+
this._graph?.identifiers.clear();
|
|
5033
4875
|
this.recordArrayManager.clear();
|
|
5034
4876
|
this._instanceCache.clear();
|
|
5035
4877
|
} else {
|
|
@@ -5284,19 +5126,6 @@ class Store extends EmberObject {
|
|
|
5284
5126
|
serializer.pushPayload(this, payload);
|
|
5285
5127
|
}
|
|
5286
5128
|
|
|
5287
|
-
// TODO @runspired @deprecate records should implement their own serialization if desired
|
|
5288
|
-
serializeRecord(record, options) {
|
|
5289
|
-
// TODO we used to check if the record was destroyed here
|
|
5290
|
-
if (macroCondition(getOwnConfig().packages.HAS_COMPAT_PACKAGE)) {
|
|
5291
|
-
if (!this._fetchManager) {
|
|
5292
|
-
const FetchManager = importSync('@ember-data/legacy-compat/-private').FetchManager;
|
|
5293
|
-
this._fetchManager = new FetchManager(this);
|
|
5294
|
-
}
|
|
5295
|
-
return this._fetchManager.createSnapshot(recordIdentifierFor(record)).serialize(options);
|
|
5296
|
-
}
|
|
5297
|
-
assert(`Store.serializeRecord is only available when utilizing @ember-data/legacy-compat for legacy compatibility`);
|
|
5298
|
-
}
|
|
5299
|
-
|
|
5300
5129
|
/**
|
|
5301
5130
|
* Trigger a save for a Record.
|
|
5302
5131
|
*
|
|
@@ -5323,9 +5152,6 @@ class Store extends EmberObject {
|
|
|
5323
5152
|
if (resourceIsFullyDeleted(this._instanceCache, identifier)) {
|
|
5324
5153
|
return Promise.resolve(record);
|
|
5325
5154
|
}
|
|
5326
|
-
if (isDSModel(record)) {
|
|
5327
|
-
record.errors.clear();
|
|
5328
|
-
}
|
|
5329
5155
|
if (!options) {
|
|
5330
5156
|
options = {};
|
|
5331
5157
|
}
|
|
@@ -5365,15 +5191,6 @@ class Store extends EmberObject {
|
|
|
5365
5191
|
* @param storeWrapper
|
|
5366
5192
|
* @returns {Cache}
|
|
5367
5193
|
*/
|
|
5368
|
-
createCache(storeWrapper) {
|
|
5369
|
-
if (macroCondition(getOwnConfig().packages.HAS_JSON_API_PACKAGE)) {
|
|
5370
|
-
if (_Cache === undefined) {
|
|
5371
|
-
_Cache = importSync('@ember-data/json-api').default;
|
|
5372
|
-
}
|
|
5373
|
-
return new _Cache(storeWrapper);
|
|
5374
|
-
}
|
|
5375
|
-
assert(`Expected store.createCache to be implemented but it wasn't`);
|
|
5376
|
-
}
|
|
5377
5194
|
|
|
5378
5195
|
/**
|
|
5379
5196
|
* Returns the cache instance associated to this Store, instantiates the Cache
|
|
@@ -5538,13 +5355,8 @@ class Store extends EmberObject {
|
|
|
5538
5355
|
serializer.destroy();
|
|
5539
5356
|
}
|
|
5540
5357
|
}
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
let graph = peekGraph(this);
|
|
5544
|
-
if (graph) {
|
|
5545
|
-
graph.destroy();
|
|
5546
|
-
}
|
|
5547
|
-
}
|
|
5358
|
+
this._graph?.destroy();
|
|
5359
|
+
this._graph = undefined;
|
|
5548
5360
|
this.notifications.destroy();
|
|
5549
5361
|
this.recordArrayManager.destroy();
|
|
5550
5362
|
this.identifierCache.destroy();
|
|
@@ -5568,12 +5380,6 @@ if (macroCondition(getOwnConfig().env.DEBUG)) {
|
|
|
5568
5380
|
function isMaybeIdentifier(maybeIdentifier) {
|
|
5569
5381
|
return Boolean(maybeIdentifier !== null && typeof maybeIdentifier === 'object' && ('id' in maybeIdentifier && 'type' in maybeIdentifier && maybeIdentifier.id && maybeIdentifier.type || maybeIdentifier.lid));
|
|
5570
5382
|
}
|
|
5571
|
-
function isDSModel(record) {
|
|
5572
|
-
if (macroCondition(!getOwnConfig().packages.HAS_MODEL_PACKAGE)) {
|
|
5573
|
-
return false;
|
|
5574
|
-
}
|
|
5575
|
-
return !!record && 'constructor' in record && 'isModel' in record.constructor && record.constructor.isModel === true;
|
|
5576
|
-
}
|
|
5577
5383
|
function normalizeProperties(store, identifier, properties) {
|
|
5578
5384
|
// assert here
|
|
5579
5385
|
if (properties !== undefined) {
|
|
@@ -5634,9 +5440,4 @@ function extractIdentifierFromRecord(recordOrPromiseRecord) {
|
|
|
5634
5440
|
const extract = recordIdentifierFor;
|
|
5635
5441
|
return extract(recordOrPromiseRecord);
|
|
5636
5442
|
}
|
|
5637
|
-
|
|
5638
|
-
setRecordIdentifier(record, identifier);
|
|
5639
|
-
StoreMap.set(record, store);
|
|
5640
|
-
setCacheFor(record, cache);
|
|
5641
|
-
}
|
|
5642
|
-
export { CacheHandler as C, IdentifierArray as I, MUTATE as M, RecordArrayManager as R, Store as S, _clearCaches as _, setIdentifierGenerationMethod as a, setIdentifierUpdateMethod as b, setIdentifierForgetMethod as c, setIdentifierResetMethod as d, coerceId as e, Collection as f, SOURCE as g, IDENTIFIER_ARRAY_TAG as h, isStableIdentifier as i, fastPush as j, removeRecordDataFor as k, notifyArray as n, peekCache as p, recordIdentifierFor as r, storeFor as s };
|
|
5443
|
+
export { CacheHandler as C, IdentifierArray as I, MUTATE as M, RecordArrayManager as R, Store as S, _clearCaches as _, setIdentifierGenerationMethod as a, setIdentifierUpdateMethod as b, setIdentifierForgetMethod as c, setIdentifierResetMethod as d, coerceId as e, Collection as f, SOURCE as g, IDENTIFIER_ARRAY_TAG as h, isStableIdentifier as i, fastPush as j, removeRecordDataFor as k, setRecordIdentifier as l, StoreMap as m, notifyArray as n, setCacheFor as o, peekCache as p, recordIdentifierFor as r, storeFor as s };
|