@ember-data/store 5.4.0-alpha.11 → 5.4.0-alpha.13
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, 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-
|
|
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-6855d74f";
|
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-6855d74f";
|
|
@@ -2,9 +2,9 @@ import { macroCondition, getOwnConfig } from '@embroider/macros';
|
|
|
2
2
|
import { getOwner } from '@ember/application';
|
|
3
3
|
import { assert, deprecate, warn } from '@ember/debug';
|
|
4
4
|
import EmberObject from '@ember/object';
|
|
5
|
-
import { _backburner } from '@ember/runloop';
|
|
6
5
|
import { tracked } from '@glimmer/tracking';
|
|
7
6
|
import { dasherize } from '@ember/string';
|
|
7
|
+
import { _backburner } from '@ember/runloop';
|
|
8
8
|
import { addToTransaction, subscribe, addTransactionCB } from '@ember-data/tracking/-private';
|
|
9
9
|
import { tagForProperty } from '@ember/-internals/metal';
|
|
10
10
|
import { dependentKeyCompat } from '@ember/object/compat';
|
|
@@ -2879,7 +2879,7 @@ let IdentifierArray = (_class3 = class IdentifierArray {
|
|
|
2879
2879
|
});
|
|
2880
2880
|
if (macroCondition(getOwnConfig().env.DEBUG)) {
|
|
2881
2881
|
const meta = Ember.meta(this);
|
|
2882
|
-
meta.
|
|
2882
|
+
meta.addMixin = mixin => {
|
|
2883
2883
|
assert(`Do not call A() on EmberData RecordArrays`);
|
|
2884
2884
|
};
|
|
2885
2885
|
}
|
|
@@ -4108,43 +4108,41 @@ class Store extends EmberObject {
|
|
|
4108
4108
|
//
|
|
4109
4109
|
// to remove this, we would need to move to a new `async` API.
|
|
4110
4110
|
let record;
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
};
|
|
4111
|
+
this._join(() => {
|
|
4112
|
+
let normalizedModelName = normalizeModelName(modelName);
|
|
4113
|
+
let properties = {
|
|
4114
|
+
...inputProperties
|
|
4115
|
+
};
|
|
4117
4116
|
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4117
|
+
// If the passed properties do not include a primary key,
|
|
4118
|
+
// give the adapter an opportunity to generate one. Typically,
|
|
4119
|
+
// client-side ID generators will use something like uuid.js
|
|
4120
|
+
// to avoid conflicts.
|
|
4122
4121
|
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
}
|
|
4122
|
+
if (properties.id === null || properties.id === undefined) {
|
|
4123
|
+
let adapter = this.adapterFor(modelName, true);
|
|
4124
|
+
if (adapter && adapter.generateIdForRecord) {
|
|
4125
|
+
properties.id = adapter.generateIdForRecord(this, modelName, properties);
|
|
4126
|
+
} else {
|
|
4127
|
+
properties.id = null;
|
|
4130
4128
|
}
|
|
4129
|
+
}
|
|
4131
4130
|
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
});
|
|
4131
|
+
// Coerce ID to a string
|
|
4132
|
+
properties.id = coerceId(properties.id);
|
|
4133
|
+
const resource = {
|
|
4134
|
+
type: normalizedModelName,
|
|
4135
|
+
id: properties.id
|
|
4136
|
+
};
|
|
4137
|
+
if (resource.id) {
|
|
4138
|
+
const identifier = this.identifierCache.peekRecordIdentifier(resource);
|
|
4139
|
+
assert(`The id ${String(properties.id)} has already been used with another '${normalizedModelName}' record.`, !identifier);
|
|
4140
|
+
}
|
|
4141
|
+
const identifier = this.identifierCache.createIdentifierForNewRecord(resource);
|
|
4142
|
+
const cache = this.cache;
|
|
4143
|
+
const createOptions = normalizeProperties(this, identifier, properties);
|
|
4144
|
+
const resultProps = cache.clientDidCreate(identifier, createOptions);
|
|
4145
|
+
record = this._instanceCache.getRecord(identifier, resultProps);
|
|
4148
4146
|
});
|
|
4149
4147
|
return record;
|
|
4150
4148
|
}
|
|
@@ -4172,9 +4170,7 @@ class Store extends EmberObject {
|
|
|
4172
4170
|
this._join(() => {
|
|
4173
4171
|
cache.setIsDeleted(identifier, true);
|
|
4174
4172
|
if (cache.isNew(identifier)) {
|
|
4175
|
-
|
|
4176
|
-
this._instanceCache.unloadRecord(identifier);
|
|
4177
|
-
});
|
|
4173
|
+
this._instanceCache.unloadRecord(identifier);
|
|
4178
4174
|
}
|
|
4179
4175
|
});
|
|
4180
4176
|
}
|