export interface ObjectFromAPIInterface { '@id' : string ; '@type' : string ; } export class AbstractSerializerApplication { protected model = AbstractModelApplication ; public serializeMany ( items ) { return items . map ( ( item ) => new this . model ( item ) ) ; } public serialize ( item ) { return new this . model ( item ) ; } } export class AbstractNormalizerApplication { protected model = AbstractModelAPI ; public normalizeMany ( items ) { return items . map ( ( item ) => new this . model ( item ) ) ; } public normalize ( item ) { return new this . model ( item ) ; } } export class AbstractModelApplication { public '@id' : string ; public '@type' : string ; public id : string ; constructor ( props ) { this [ '@id' ] = props [ '@id' ] ; this [ '@type' ] = props [ '@type' ] ; this . id = props [ '@id' ] . split ( '/' ) . pop ( ) ; } } export class AbstractModelAPI { public '@id' : string ; constructor ( props ) { this [ '@id' ] = props [ '@id' ] ; } }