@ember-data/model 4.12.0-alpha.8 → 4.12.0-alpha.9
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-2cd7707a";
|
|
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-2cd7707a";
|
|
3
3
|
import { getOwner } from '@ember/application';
|
|
4
4
|
|
|
5
5
|
/*
|
|
@@ -1118,7 +1118,7 @@ class RelatedCollection extends RecordArray {
|
|
|
1118
1118
|
switch (prop) {
|
|
1119
1119
|
case 'length 0':
|
|
1120
1120
|
{
|
|
1121
|
-
this._manager.
|
|
1121
|
+
this._manager.mutate({
|
|
1122
1122
|
op: 'replaceRelatedRecords',
|
|
1123
1123
|
record: this.identifier,
|
|
1124
1124
|
field: this.key,
|
|
@@ -1129,7 +1129,7 @@ class RelatedCollection extends RecordArray {
|
|
|
1129
1129
|
case 'replace cell':
|
|
1130
1130
|
{
|
|
1131
1131
|
const [index, prior, value] = args;
|
|
1132
|
-
this._manager.
|
|
1132
|
+
this._manager.mutate({
|
|
1133
1133
|
op: 'replaceRelatedRecord',
|
|
1134
1134
|
record: this.identifier,
|
|
1135
1135
|
field: this.key,
|
|
@@ -1140,7 +1140,7 @@ class RelatedCollection extends RecordArray {
|
|
|
1140
1140
|
break;
|
|
1141
1141
|
}
|
|
1142
1142
|
case 'push':
|
|
1143
|
-
this._manager.
|
|
1143
|
+
this._manager.mutate({
|
|
1144
1144
|
op: 'addToRelatedRecords',
|
|
1145
1145
|
record: this.identifier,
|
|
1146
1146
|
field: this.key,
|
|
@@ -1149,7 +1149,7 @@ class RelatedCollection extends RecordArray {
|
|
|
1149
1149
|
break;
|
|
1150
1150
|
case 'pop':
|
|
1151
1151
|
if (result) {
|
|
1152
|
-
this._manager.
|
|
1152
|
+
this._manager.mutate({
|
|
1153
1153
|
op: 'removeFromRelatedRecords',
|
|
1154
1154
|
record: this.identifier,
|
|
1155
1155
|
field: this.key,
|
|
@@ -1158,7 +1158,7 @@ class RelatedCollection extends RecordArray {
|
|
|
1158
1158
|
}
|
|
1159
1159
|
break;
|
|
1160
1160
|
case 'unshift':
|
|
1161
|
-
this._manager.
|
|
1161
|
+
this._manager.mutate({
|
|
1162
1162
|
op: 'addToRelatedRecords',
|
|
1163
1163
|
record: this.identifier,
|
|
1164
1164
|
field: this.key,
|
|
@@ -1168,7 +1168,7 @@ class RelatedCollection extends RecordArray {
|
|
|
1168
1168
|
break;
|
|
1169
1169
|
case 'shift':
|
|
1170
1170
|
if (result) {
|
|
1171
|
-
this._manager.
|
|
1171
|
+
this._manager.mutate({
|
|
1172
1172
|
op: 'removeFromRelatedRecords',
|
|
1173
1173
|
record: this.identifier,
|
|
1174
1174
|
field: this.key,
|
|
@@ -1178,7 +1178,7 @@ class RelatedCollection extends RecordArray {
|
|
|
1178
1178
|
}
|
|
1179
1179
|
break;
|
|
1180
1180
|
case 'sort':
|
|
1181
|
-
this._manager.
|
|
1181
|
+
this._manager.mutate({
|
|
1182
1182
|
op: 'sortRelatedRecords',
|
|
1183
1183
|
record: this.identifier,
|
|
1184
1184
|
field: this.key,
|
|
@@ -1190,7 +1190,7 @@ class RelatedCollection extends RecordArray {
|
|
|
1190
1190
|
const [start, removeCount, ...adds] = args;
|
|
1191
1191
|
// detect a full replace
|
|
1192
1192
|
if (removeCount > 0 && adds.length === this[SOURCE].length) {
|
|
1193
|
-
this._manager.
|
|
1193
|
+
this._manager.mutate({
|
|
1194
1194
|
op: 'replaceRelatedRecords',
|
|
1195
1195
|
record: this.identifier,
|
|
1196
1196
|
field: this.key,
|
|
@@ -1199,7 +1199,7 @@ class RelatedCollection extends RecordArray {
|
|
|
1199
1199
|
return;
|
|
1200
1200
|
}
|
|
1201
1201
|
if (removeCount > 0) {
|
|
1202
|
-
this._manager.
|
|
1202
|
+
this._manager.mutate({
|
|
1203
1203
|
op: 'removeFromRelatedRecords',
|
|
1204
1204
|
record: this.identifier,
|
|
1205
1205
|
field: this.key,
|
|
@@ -1208,7 +1208,7 @@ class RelatedCollection extends RecordArray {
|
|
|
1208
1208
|
});
|
|
1209
1209
|
}
|
|
1210
1210
|
if (adds?.length) {
|
|
1211
|
-
this._manager.
|
|
1211
|
+
this._manager.mutate({
|
|
1212
1212
|
op: 'addToRelatedRecords',
|
|
1213
1213
|
record: this.identifier,
|
|
1214
1214
|
field: this.key,
|
|
@@ -1278,6 +1278,7 @@ class RelatedCollection extends RecordArray {
|
|
|
1278
1278
|
const {
|
|
1279
1279
|
store
|
|
1280
1280
|
} = this;
|
|
1281
|
+
assert(`Expected modelName to be set`, this.modelName);
|
|
1281
1282
|
const record = store.createRecord(this.modelName, hash);
|
|
1282
1283
|
this.push(record);
|
|
1283
1284
|
return record;
|
|
@@ -2802,8 +2803,8 @@ class LegacySupport {
|
|
|
2802
2803
|
currentState.length = 0;
|
|
2803
2804
|
fastPush(currentState, identifiers);
|
|
2804
2805
|
}
|
|
2805
|
-
|
|
2806
|
-
this.cache.
|
|
2806
|
+
mutate(mutation) {
|
|
2807
|
+
this.cache.mutate(mutation);
|
|
2807
2808
|
}
|
|
2808
2809
|
_findBelongsTo(key, resource, relationship, options) {
|
|
2809
2810
|
// TODO @runspired follow up if parent isNew then we should not be attempting load here
|
|
@@ -2870,7 +2871,7 @@ class LegacySupport {
|
|
|
2870
2871
|
}
|
|
2871
2872
|
}
|
|
2872
2873
|
setDirtyBelongsTo(key, value) {
|
|
2873
|
-
return this.cache.
|
|
2874
|
+
return this.cache.mutate({
|
|
2874
2875
|
op: 'replaceRelatedRecord',
|
|
2875
2876
|
record: this.identifier,
|
|
2876
2877
|
field: key,
|