@ember-data/serializer 4.2.0-beta.0 → 4.4.0-alpha.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 +1 -7
- package/addon/json.js +1 -1
- package/addon/rest.js +10 -22
- package/blueprints/serializer-test/mocha-rfc-232-files/__root__/__path__/__test__.js +1 -1
- package/blueprints/serializer-test/qunit-files/__root__/__path__/__test__.js +1 -1
- package/blueprints/transform-test/mocha-rfc-232-files/__root__/__path__/__test__.js +1 -1
- package/blueprints/transform-test/qunit-files/__root__/__path__/__test__.js +1 -1
- package/package.json +14 -14
|
@@ -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 = hash.included.concat(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 = hash.included.concat(included);
|
|
608
608
|
}
|
|
609
609
|
|
|
610
610
|
let belongsTo = { id: data.id, type: data.type };
|
package/addon/json-api.js
CHANGED
|
@@ -8,7 +8,6 @@ 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';
|
|
12
11
|
import JSONSerializer from '@ember-data/serializer/json';
|
|
13
12
|
import { normalizeModelName } from '@ember-data/store';
|
|
14
13
|
|
|
@@ -675,12 +674,7 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
675
674
|
|
|
676
675
|
if (this._canSerialize(key)) {
|
|
677
676
|
let belongsTo = snapshot.belongsTo(key);
|
|
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
|
-
}
|
|
677
|
+
let belongsToIsNotNew = belongsTo && !belongsTo.isNew;
|
|
684
678
|
|
|
685
679
|
if (belongsTo === null || belongsToIsNotNew) {
|
|
686
680
|
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 = documentHash.included.concat(included);
|
|
544
544
|
}
|
|
545
545
|
ret[i] = data;
|
|
546
546
|
}
|
package/addon/rest.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @module @ember-data/serializer/rest
|
|
3
3
|
*/
|
|
4
4
|
import { makeArray } from '@ember/array';
|
|
5
|
-
import { assert,
|
|
5
|
+
import { assert, warn } from '@ember/debug';
|
|
6
6
|
import { camelize } from '@ember/string';
|
|
7
7
|
import { isNone, typeOf } from '@ember/utils';
|
|
8
8
|
import { DEBUG } from '@glimmer/env';
|
|
@@ -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 = documentHash.included.concat(included);
|
|
189
189
|
}
|
|
190
190
|
});
|
|
191
191
|
|
|
@@ -284,22 +284,10 @@ const RESTSerializer = JSONSerializer.extend({
|
|
|
284
284
|
continue;
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
deprecate(message, !isQueryRecordAnArray, {
|
|
293
|
-
id: 'ds.serializer.rest.queryRecord-array-response',
|
|
294
|
-
until: '3.0',
|
|
295
|
-
url: 'https://deprecations.emberjs.com/ember-data/v2.x/#toc_store-queryrecord-array-response-with-restserializer',
|
|
296
|
-
for: '@ember-data/serializer',
|
|
297
|
-
since: {
|
|
298
|
-
available: '3.0',
|
|
299
|
-
enabled: '3.0',
|
|
300
|
-
},
|
|
301
|
-
});
|
|
302
|
-
}
|
|
287
|
+
assert(
|
|
288
|
+
'The adapter returned an array for the primary data of a `queryRecord` response. `queryRecord` should return a single record.',
|
|
289
|
+
!(requestType === 'queryRecord' && isPrimary && Array.isArray(value))
|
|
290
|
+
);
|
|
303
291
|
|
|
304
292
|
/*
|
|
305
293
|
Support primary data as an object instead of an array.
|
|
@@ -316,7 +304,7 @@ const RESTSerializer = JSONSerializer.extend({
|
|
|
316
304
|
let { data, included } = this._normalizePolymorphicRecord(store, value, prop, primaryModelClass, this);
|
|
317
305
|
documentHash.data = data;
|
|
318
306
|
if (included) {
|
|
319
|
-
documentHash.included.
|
|
307
|
+
documentHash.included = documentHash.included.concat(included);
|
|
320
308
|
}
|
|
321
309
|
continue;
|
|
322
310
|
}
|
|
@@ -324,7 +312,7 @@ const RESTSerializer = JSONSerializer.extend({
|
|
|
324
312
|
let { data, included } = this._normalizeArray(store, typeName, value, prop);
|
|
325
313
|
|
|
326
314
|
if (included) {
|
|
327
|
-
documentHash.included.
|
|
315
|
+
documentHash.included = documentHash.included.concat(included);
|
|
328
316
|
}
|
|
329
317
|
|
|
330
318
|
if (isSingle) {
|
|
@@ -352,7 +340,7 @@ const RESTSerializer = JSONSerializer.extend({
|
|
|
352
340
|
documentHash.data = data;
|
|
353
341
|
} else {
|
|
354
342
|
if (data) {
|
|
355
|
-
documentHash.included.
|
|
343
|
+
documentHash.included = documentHash.included.concat(data);
|
|
356
344
|
}
|
|
357
345
|
}
|
|
358
346
|
}
|
|
@@ -418,7 +406,7 @@ const RESTSerializer = JSONSerializer.extend({
|
|
|
418
406
|
let { data, included } = typeSerializer.normalize(type, hash, prop);
|
|
419
407
|
documentHash.data.push(data);
|
|
420
408
|
if (included) {
|
|
421
|
-
documentHash.included.
|
|
409
|
+
documentHash.included = documentHash.included.concat(included);
|
|
422
410
|
}
|
|
423
411
|
});
|
|
424
412
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-data/serializer",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0-alpha.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.
|
|
22
|
-
"@ember-data/store": "4.
|
|
21
|
+
"@ember-data/private-build-infra": "4.4.0-alpha.0",
|
|
22
|
+
"@ember-data/store": "4.4.0-alpha.0",
|
|
23
23
|
"ember-auto-import": "^2.2.4",
|
|
24
|
-
"ember-cli-babel": "^7.26.
|
|
24
|
+
"ember-cli-babel": "^7.26.11",
|
|
25
25
|
"ember-cli-test-info": "^1.0.0",
|
|
26
|
-
"ember-cli-typescript": "^
|
|
26
|
+
"ember-cli-typescript": "^5.0.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@ember-data/unpublished-test-infra": "4.
|
|
29
|
+
"@ember-data/unpublished-test-infra": "4.4.0-alpha.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": "~4.1.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": "^6.0.1",
|
|
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": "^0.
|
|
44
|
+
"ember-maybe-import-regenerator": "^1.0.0",
|
|
45
45
|
"ember-qunit": "^5.1.5",
|
|
46
|
-
"ember-resolver": "^8.0.
|
|
47
|
-
"ember-source": "~4.
|
|
46
|
+
"ember-resolver": "^8.0.3",
|
|
47
|
+
"ember-source": "~4.2.0",
|
|
48
48
|
"ember-source-channel-url": "^3.0.0",
|
|
49
|
-
"ember-try": "^
|
|
49
|
+
"ember-try": "^2.0.0",
|
|
50
50
|
"loader.js": "^4.7.0",
|
|
51
|
-
"qunit": "^2.
|
|
52
|
-
"qunit-dom": "^
|
|
51
|
+
"qunit": "^2.17.0",
|
|
52
|
+
"qunit-dom": "^2.0.0",
|
|
53
53
|
"silent-error": "^1.1.1",
|
|
54
54
|
"webpack": "^5.37.1"
|
|
55
55
|
},
|