mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
refactor: Streamline RepresentationMetadata interface
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { Representation } from '../ldp/representation/Representation';
|
||||
import { RepresentationPreferences } from '../ldp/representation/RepresentationPreferences';
|
||||
import { ResourceIdentifier } from '../ldp/representation/ResourceIdentifier';
|
||||
import { CONTENT_TYPE } from '../util/MetadataTypes';
|
||||
import { matchingMediaType } from '../util/Util';
|
||||
import { Conditions } from './Conditions';
|
||||
import { RepresentationConverter } from './conversion/RepresentationConverter';
|
||||
@@ -38,12 +37,12 @@ export class RepresentationConvertingStore<T extends ResourceStore = ResourceSto
|
||||
if (!preferences.type) {
|
||||
return true;
|
||||
}
|
||||
const contentType = representation.metadata.get(CONTENT_TYPE);
|
||||
const { contentType } = representation.metadata;
|
||||
return Boolean(
|
||||
contentType &&
|
||||
preferences.type.some((type): boolean =>
|
||||
type.weight > 0 &&
|
||||
matchingMediaType(type.value, contentType.value)),
|
||||
matchingMediaType(type.value, contentType)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user