@ember-data/serializer 4.2.0-alpha.8 → 4.2.0
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/embedded-records-mixin.js +2 -2
- package/addon/json-api.js +7 -1
- package/addon/json.js +1 -1
- package/addon/rest.js +5 -5
- package/package.json +9 -9
|
@@ -580,7 +580,7 @@ export default Mixin.create({
|
|
|
580
580
|
hash.included = hash.included || [];
|
|
581
581
|
hash.included.push(data);
|
|
582
582
|
if (included) {
|
|
583
|
-
hash.included
|
|
583
|
+
hash.included.push(...included);
|
|
584
584
|
}
|
|
585
585
|
|
|
586
586
|
hasMany[i] = { id: data.id, type: data.type };
|
|
@@ -604,7 +604,7 @@ export default Mixin.create({
|
|
|
604
604
|
hash.included = hash.included || [];
|
|
605
605
|
hash.included.push(data);
|
|
606
606
|
if (included) {
|
|
607
|
-
hash.included
|
|
607
|
+
hash.included.push(...included);
|
|
608
608
|
}
|
|
609
609
|
|
|
610
610
|
let belongsTo = { id: data.id, type: data.type };
|
package/addon/json-api.js
CHANGED
|
@@ -8,6 +8,7 @@ import { DEBUG } from '@glimmer/env';
|
|
|
8
8
|
|
|
9
9
|
import { pluralize, singularize } from 'ember-inflector';
|
|
10
10
|
|
|
11
|
+
import { CUSTOM_MODEL_CLASS } from '@ember-data/canary-features';
|
|
11
12
|
import JSONSerializer from '@ember-data/serializer/json';
|
|
12
13
|
import { normalizeModelName } from '@ember-data/store';
|
|
13
14
|
|
|
@@ -674,7 +675,12 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
674
675
|
|
|
675
676
|
if (this._canSerialize(key)) {
|
|
676
677
|
let belongsTo = snapshot.belongsTo(key);
|
|
677
|
-
let belongsToIsNotNew
|
|
678
|
+
let belongsToIsNotNew;
|
|
679
|
+
if (CUSTOM_MODEL_CLASS) {
|
|
680
|
+
belongsToIsNotNew = belongsTo && !belongsTo.isNew;
|
|
681
|
+
} else {
|
|
682
|
+
belongsToIsNotNew = belongsTo && belongsTo.record && !belongsTo.record.get('isNew');
|
|
683
|
+
}
|
|
678
684
|
|
|
679
685
|
if (belongsTo === null || belongsToIsNotNew) {
|
|
680
686
|
json.relationships = json.relationships || {};
|
package/addon/json.js
CHANGED
|
@@ -540,7 +540,7 @@ const JSONSerializer = Serializer.extend({
|
|
|
540
540
|
let item = payload[i];
|
|
541
541
|
let { data, included } = this.normalize(primaryModelClass, item);
|
|
542
542
|
if (included) {
|
|
543
|
-
documentHash.included
|
|
543
|
+
documentHash.included.push(...included);
|
|
544
544
|
}
|
|
545
545
|
ret[i] = data;
|
|
546
546
|
}
|
package/addon/rest.js
CHANGED
|
@@ -185,7 +185,7 @@ const RESTSerializer = JSONSerializer.extend({
|
|
|
185
185
|
let { data, included } = this._normalizePolymorphicRecord(store, hash, prop, modelClass, serializer);
|
|
186
186
|
documentHash.data.push(data);
|
|
187
187
|
if (included) {
|
|
188
|
-
documentHash.included
|
|
188
|
+
documentHash.included.push(...included);
|
|
189
189
|
}
|
|
190
190
|
});
|
|
191
191
|
|
|
@@ -316,7 +316,7 @@ const RESTSerializer = JSONSerializer.extend({
|
|
|
316
316
|
let { data, included } = this._normalizePolymorphicRecord(store, value, prop, primaryModelClass, this);
|
|
317
317
|
documentHash.data = data;
|
|
318
318
|
if (included) {
|
|
319
|
-
documentHash.included
|
|
319
|
+
documentHash.included.push(...included);
|
|
320
320
|
}
|
|
321
321
|
continue;
|
|
322
322
|
}
|
|
@@ -324,7 +324,7 @@ const RESTSerializer = JSONSerializer.extend({
|
|
|
324
324
|
let { data, included } = this._normalizeArray(store, typeName, value, prop);
|
|
325
325
|
|
|
326
326
|
if (included) {
|
|
327
|
-
documentHash.included
|
|
327
|
+
documentHash.included.push(...included);
|
|
328
328
|
}
|
|
329
329
|
|
|
330
330
|
if (isSingle) {
|
|
@@ -352,7 +352,7 @@ const RESTSerializer = JSONSerializer.extend({
|
|
|
352
352
|
documentHash.data = data;
|
|
353
353
|
} else {
|
|
354
354
|
if (data) {
|
|
355
|
-
documentHash.included
|
|
355
|
+
documentHash.included.push(...data);
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
358
|
}
|
|
@@ -418,7 +418,7 @@ const RESTSerializer = JSONSerializer.extend({
|
|
|
418
418
|
let { data, included } = typeSerializer.normalize(type, hash, prop);
|
|
419
419
|
documentHash.data.push(data);
|
|
420
420
|
if (included) {
|
|
421
|
-
documentHash.included
|
|
421
|
+
documentHash.included.push(...included);
|
|
422
422
|
}
|
|
423
423
|
});
|
|
424
424
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-data/serializer",
|
|
3
|
-
"version": "4.2.0
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "The default blueprint for ember-cli addons.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -18,38 +18,38 @@
|
|
|
18
18
|
"test:node": "mocha"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@ember-data/private-build-infra": "4.2.0
|
|
22
|
-
"@ember-data/store": "4.2.0
|
|
21
|
+
"@ember-data/private-build-infra": "4.2.0",
|
|
22
|
+
"@ember-data/store": "4.2.0",
|
|
23
23
|
"ember-auto-import": "^2.2.4",
|
|
24
24
|
"ember-cli-babel": "^7.26.6",
|
|
25
25
|
"ember-cli-test-info": "^1.0.0",
|
|
26
26
|
"ember-cli-typescript": "^4.1.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@ember-data/unpublished-test-infra": "4.2.0
|
|
29
|
+
"@ember-data/unpublished-test-infra": "4.2.0",
|
|
30
30
|
"@ember/optional-features": "^2.0.0",
|
|
31
31
|
"@ember/string": "^3.0.0",
|
|
32
32
|
"@ember/test-helpers": "^2.6.0",
|
|
33
33
|
"broccoli-asset-rev": "^3.0.0",
|
|
34
|
-
"ember-cli": "~
|
|
34
|
+
"ember-cli": "~3.26.1",
|
|
35
35
|
"ember-cli-blueprint-test-helpers": "^0.19.1",
|
|
36
36
|
"ember-cli-dependency-checker": "^3.2.0",
|
|
37
|
-
"ember-cli-htmlbars": "^
|
|
37
|
+
"ember-cli-htmlbars": "^5.1.2",
|
|
38
38
|
"ember-cli-inject-live-reload": "^2.0.2",
|
|
39
39
|
"ember-cli-sri": "^2.1.1",
|
|
40
40
|
"ember-cli-terser": "~4.0.1",
|
|
41
41
|
"ember-disable-prototype-extensions": "^1.1.3",
|
|
42
42
|
"ember-export-application-global": "^2.0.1",
|
|
43
43
|
"ember-load-initializers": "^2.1.1",
|
|
44
|
-
"ember-maybe-import-regenerator": "^1.
|
|
44
|
+
"ember-maybe-import-regenerator": "^0.1.6",
|
|
45
45
|
"ember-qunit": "^5.1.5",
|
|
46
|
-
"ember-resolver": "^8.0.
|
|
46
|
+
"ember-resolver": "^8.0.0",
|
|
47
47
|
"ember-source": "~4.0.0",
|
|
48
48
|
"ember-source-channel-url": "^3.0.0",
|
|
49
49
|
"ember-try": "^1.4.0",
|
|
50
50
|
"loader.js": "^4.7.0",
|
|
51
51
|
"qunit": "^2.15.0",
|
|
52
|
-
"qunit-dom": "^
|
|
52
|
+
"qunit-dom": "^1.6.0",
|
|
53
53
|
"silent-error": "^1.1.1",
|
|
54
54
|
"webpack": "^5.37.1"
|
|
55
55
|
},
|