@ember-data/model 4.12.0-alpha.0 → 4.12.0-alpha.2
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,5 +1,5 @@
|
|
|
1
|
-
import { M as Model } from "./has-many-
|
|
2
|
-
export { E as Errors, L as LEGACY_SUPPORT, R as ManyArray, P as PromiseBelongsTo, c as PromiseManyArray, a as attr, b as belongsTo, h as hasMany } from "./has-many-
|
|
1
|
+
import { M as Model } from "./has-many-26353d30";
|
|
2
|
+
export { E as Errors, L as LEGACY_SUPPORT, R as ManyArray, P as PromiseBelongsTo, c as PromiseManyArray, a as attr, b as belongsTo, h as hasMany } from "./has-many-26353d30";
|
|
3
3
|
import { getOwner } from '@ember/application';
|
|
4
4
|
|
|
5
5
|
/*
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { macroCondition, isDevelopingApp, getOwnConfig, importSync,
|
|
1
|
+
import { macroCondition, isDevelopingApp, getOwnConfig, importSync, dependencySatisfies } from '@embroider/macros';
|
|
2
2
|
import { assert, deprecate, warn, inspect } from '@ember/debug';
|
|
3
3
|
import EmberObject, { computed, get } from '@ember/object';
|
|
4
4
|
import { recordIdentifierFor, storeFor } from '@ember-data/store';
|
|
5
|
-
import { recordDataFor, RecordArray, MUTATE, SOURCE, recordIdentifierFor as recordIdentifierFor$1, IDENTIFIER_ARRAY_TAG, isStableIdentifier, storeFor as storeFor$1, fastPush, coerceId } from '@ember-data/store/-private';
|
|
5
|
+
import { recordDataFor, RecordArray, MUTATE, SOURCE, recordIdentifierFor as recordIdentifierFor$1, IDENTIFIER_ARRAY_TAG, notifyArray, isStableIdentifier, storeFor as storeFor$1, fastPush, coerceId } from '@ember-data/store/-private';
|
|
6
6
|
import { dasherize } from '@ember/string';
|
|
7
7
|
import ArrayMixin, { A, NativeArray } from '@ember/array';
|
|
8
8
|
import { singularize } from 'ember-inflector';
|
|
@@ -1224,8 +1224,9 @@ class RelatedCollection extends RecordArray {
|
|
|
1224
1224
|
}
|
|
1225
1225
|
notify() {
|
|
1226
1226
|
const tag = this[IDENTIFIER_ARRAY_TAG];
|
|
1227
|
-
tag.ref = null;
|
|
1228
1227
|
tag.shouldReset = true;
|
|
1228
|
+
// @ts-expect-error
|
|
1229
|
+
notifyArray(this);
|
|
1229
1230
|
}
|
|
1230
1231
|
|
|
1231
1232
|
/**
|
|
@@ -2892,7 +2893,7 @@ class LegacySupport {
|
|
|
2892
2893
|
return [identifiers, jsonApi];
|
|
2893
2894
|
}
|
|
2894
2895
|
getManyArray(key, definition) {
|
|
2895
|
-
if (
|
|
2896
|
+
if (macroCondition(dependencySatisfies("@ember-data/json-api", "*"))) {
|
|
2896
2897
|
let manyArray = this._manyArrayCache[key];
|
|
2897
2898
|
if (!definition) {
|
|
2898
2899
|
const graphFor = importSync('@ember-data/graph/-private').graphFor;
|
|
@@ -2923,7 +2924,7 @@ class LegacySupport {
|
|
|
2923
2924
|
assert('hasMany only works with the @ember-data/json-api package');
|
|
2924
2925
|
}
|
|
2925
2926
|
fetchAsyncHasMany(key, relationship, manyArray, options) {
|
|
2926
|
-
if (
|
|
2927
|
+
if (macroCondition(dependencySatisfies("@ember-data/json-api", "*"))) {
|
|
2927
2928
|
let loadingPromise = this._relationshipPromisesCache[key];
|
|
2928
2929
|
if (loadingPromise) {
|
|
2929
2930
|
return loadingPromise;
|
|
@@ -2941,7 +2942,7 @@ class LegacySupport {
|
|
|
2941
2942
|
assert('hasMany only works with the @ember-data/json-api package');
|
|
2942
2943
|
}
|
|
2943
2944
|
reloadHasMany(key, options) {
|
|
2944
|
-
if (
|
|
2945
|
+
if (macroCondition(dependencySatisfies("@ember-data/json-api", "*"))) {
|
|
2945
2946
|
let loadingPromise = this._relationshipPromisesCache[key];
|
|
2946
2947
|
if (loadingPromise) {
|
|
2947
2948
|
return loadingPromise;
|
|
@@ -2966,7 +2967,7 @@ class LegacySupport {
|
|
|
2966
2967
|
assert(`hasMany only works with the @ember-data/json-api package`);
|
|
2967
2968
|
}
|
|
2968
2969
|
getHasMany(key, options) {
|
|
2969
|
-
if (
|
|
2970
|
+
if (macroCondition(dependencySatisfies("@ember-data/json-api", "*"))) {
|
|
2970
2971
|
const graphFor = importSync('@ember-data/graph/-private').graphFor;
|
|
2971
2972
|
const relationship = graphFor(this.store).get(this.identifier, key);
|
|
2972
2973
|
const {
|
|
@@ -3024,7 +3025,7 @@ class LegacySupport {
|
|
|
3024
3025
|
referenceFor(kind, name) {
|
|
3025
3026
|
let reference = this.references[name];
|
|
3026
3027
|
if (!reference) {
|
|
3027
|
-
if (!
|
|
3028
|
+
if (macroCondition(!dependencySatisfies("@ember-data/json-api", "*"))) {
|
|
3028
3029
|
// TODO @runspired while this feels odd, it is not a regression in capability because we do
|
|
3029
3030
|
// not today support references pulling from RecordDatas other than our own
|
|
3030
3031
|
// because of the intimate API access involved. This is something we will need to redesign.
|
|
@@ -3051,7 +3052,7 @@ class LegacySupport {
|
|
|
3051
3052
|
return reference;
|
|
3052
3053
|
}
|
|
3053
3054
|
_findHasManyByJsonApiResource(resource, parentIdentifier, relationship, options = {}) {
|
|
3054
|
-
if (
|
|
3055
|
+
if (macroCondition(dependencySatisfies("@ember-data/json-api", "*"))) {
|
|
3055
3056
|
if (!resource) {
|
|
3056
3057
|
return;
|
|
3057
3058
|
}
|
|
@@ -3384,6 +3385,9 @@ let Tag = (_class$1 = class Tag {
|
|
|
3384
3385
|
this.rev = 1;
|
|
3385
3386
|
this.isDirty = true;
|
|
3386
3387
|
this.value = undefined;
|
|
3388
|
+
/*
|
|
3389
|
+
* whether this was part of a transaction when mutated
|
|
3390
|
+
*/
|
|
3387
3391
|
this.t = false;
|
|
3388
3392
|
}
|
|
3389
3393
|
notify() {
|
|
@@ -5702,7 +5706,7 @@ let Model = (_class = (_class2 = class Model extends EmberObject {
|
|
|
5702
5706
|
// the values initialized during create to `setUnknownProperty`
|
|
5703
5707
|
Model.prototype._createProps = null;
|
|
5704
5708
|
Model.prototype._secretInit = null;
|
|
5705
|
-
if (getOwnConfig().includeDataAdapter) {
|
|
5709
|
+
if (macroCondition(getOwnConfig().includeDataAdapter)) {
|
|
5706
5710
|
/**
|
|
5707
5711
|
Provides info about the model for debugging purposes
|
|
5708
5712
|
by grouping the properties into more semantic groups.
|