mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
43 lines
1.8 KiB
TypeScript
43 lines
1.8 KiB
TypeScript
import type { Patch } from '../ldp/http/Patch';
|
|
import type { Representation } from '../ldp/representation/Representation';
|
|
import type { RepresentationPreferences } from '../ldp/representation/RepresentationPreferences';
|
|
import type { ResourceIdentifier } from '../ldp/representation/ResourceIdentifier';
|
|
import type { Conditions } from './Conditions';
|
|
import type { ResourceStore } from './ResourceStore';
|
|
|
|
/**
|
|
* Store that calls the corresponding functions of the source Store.
|
|
* Can be extended by stores that do not want to override all functions
|
|
* by implementing a decorator pattern.
|
|
*/
|
|
export class PassthroughStore<T extends ResourceStore = ResourceStore> implements ResourceStore {
|
|
protected readonly source: T;
|
|
|
|
public constructor(source: T) {
|
|
this.source = source;
|
|
}
|
|
|
|
public async addResource(container: ResourceIdentifier, representation: Representation,
|
|
conditions?: Conditions): Promise<ResourceIdentifier> {
|
|
return this.source.addResource(container, representation, conditions);
|
|
}
|
|
|
|
public async deleteResource(identifier: ResourceIdentifier, conditions?: Conditions): Promise<void> {
|
|
return this.source.deleteResource(identifier, conditions);
|
|
}
|
|
|
|
public async getRepresentation(identifier: ResourceIdentifier, preferences: RepresentationPreferences,
|
|
conditions?: Conditions): Promise<Representation> {
|
|
return this.source.getRepresentation(identifier, preferences, conditions);
|
|
}
|
|
|
|
public async modifyResource(identifier: ResourceIdentifier, patch: Patch, conditions?: Conditions): Promise<void> {
|
|
return this.source.modifyResource(identifier, patch, conditions);
|
|
}
|
|
|
|
public async setRepresentation(identifier: ResourceIdentifier, representation: Representation,
|
|
conditions?: Conditions): Promise<void> {
|
|
return this.source.setRepresentation(identifier, representation, conditions);
|
|
}
|
|
}
|