@fleetbase/ember-core 0.0.4 → 0.0.5
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.
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import RESTSerializer from '@ember-data/serializer/rest';
|
|
2
2
|
import { isNone } from '@ember/utils';
|
|
3
3
|
import { underscore } from '@ember/string';
|
|
4
|
-
import { isArray } from '@ember/array';
|
|
5
4
|
import normalizePolymorphicTypeWithinHash from '../utils/serialize/normalize-polymorphic-type-within-hash';
|
|
6
5
|
|
|
7
6
|
export default class ApplicationSerializer extends RESTSerializer {
|
|
@@ -67,20 +66,4 @@ export default class ApplicationSerializer extends RESTSerializer {
|
|
|
67
66
|
|
|
68
67
|
return super.normalize(model, hash, prop);
|
|
69
68
|
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* We only want to save dirty/changed model attributes
|
|
73
|
-
*
|
|
74
|
-
* @param {Snapshot} snapshot
|
|
75
|
-
* @param {Object} json
|
|
76
|
-
* @param {String} key
|
|
77
|
-
* @param {Array} attributes
|
|
78
|
-
*/
|
|
79
|
-
serializeAttribute(snapshot, json, key, attributes) {
|
|
80
|
-
const excludedKeys = ['name', 'meta', 'options', 'config', 'excluded_addons', 'translations', 'tags'];
|
|
81
|
-
|
|
82
|
-
if (snapshot.record?.get('isNew') || snapshot.changedAttributes()[key] || isArray(snapshot.attr(key)) || excludedKeys.includes(key)) {
|
|
83
|
-
return super.serializeAttribute(snapshot, json, key, attributes);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
69
|
}
|
package/package.json
CHANGED