Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
registry.register(
'service:store',
DS.Store.extend({
adapter: adapter,
})
);
registry.optionsForType('serializer', { singleton: false });
registry.optionsForType('adapter', { singleton: false });
registry.register('adapter:-default', DS.Adapter);
registry.register('serializer:-default', DS.JSONAPISerializer);
registry.register('serializer:-json', DS.JSONSerializer);
registry.register('serializer:-rest', DS.RESTSerializer);
registry.register('adapter:-rest', DS.RESTAdapter);
registry.register('adapter:-json-api', DS.JSONAPIAdapter);
registry.injection('serializer', 'store', 'service:store');
env.store = container.lookup('service:store');
env.restSerializer = container.lookup('serializer:-rest');
env.restSerializer.store = env.store;
env.serializer = env.store.serializerFor('-default');
env.serializer.store = env.store;
// lazily create the adapter method because some tets depend on
// modifiying the adapter in the container after setupStore is
// called
Object.defineProperty(env, 'adapter', {
get() {
import Ember from 'ember';
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
primaryKey: 'objectId',
extractArray: function( store, primaryType, payload ) {
var namespacedPayload = {};
namespacedPayload[ Ember.String.pluralize( primaryType.typeKey ) ] = payload.results;
return this._super( store, primaryType, namespacedPayload );
},
extractSingle: function( store, primaryType, payload, recordId ) {
var namespacedPayload = {};
namespacedPayload[ primaryType.typeKey ] = payload; // this.normalize(primaryType, payload);
return this._super( store, primaryType, namespacedPayload, recordId );
},
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
extractMeta: function(store, type, payload) {
if (payload && payload.metadata) {
store.metaForType(type, payload.metadata);
delete payload.metadata;
}
},
extractArray: function(store, type, payload) {
var new_payload = {};
var typename = type.toString().split(':')[1].split(':')[0];
console.log('typename:' + typename);
new_payload[typename + 's'] = payload.result;
return this._super(store, type, new_payload);
}
import DS from 'ember-data';
import Ember from 'ember';
export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
/**
This indicates that the
store should call `normalizeResponse` instead of `extract` and to expect
a JSON-API Document back.
@property isNewSerializerAPI
*/
isNewSerializerAPI: true,
/**
`keyForAttribute` can be used to define rules for how to convert an
attribute name in your model to a key in your JSON.
@method keyForAttribute
@param {String} key
@param {String} method
@return {String} normalized key
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
extractArray: function(store, type, payload) {
let areMine = payload.href.indexOf(this.get('session.user.href')) !== -1;
let playlists = payload.items || [payload];
if (areMine) {
playlists.setEach('isMine', true);
}
payload = {
playlists: playlists
};
return this._super(store, type, payload);
}
});
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
});
import DS from 'ember-data';
export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
attrs: {
definitions: {embedded: 'always'}
}
});
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
});