mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: Patch containers by recreating Representation from metadata
Also included is a change to the Patching architecture. Patching is now done by RepresentationPatchers that take a Representation as input.
This commit is contained in:
@@ -12,11 +12,11 @@ import type { ResourceStore } from './ResourceStore';
|
||||
* otherwise the {@link PatchHandler} will be called instead.
|
||||
*/
|
||||
export class PatchingStore<T extends ResourceStore = ResourceStore> extends PassthroughStore<T> {
|
||||
private readonly patcher: PatchHandler;
|
||||
private readonly patchHandler: PatchHandler;
|
||||
|
||||
public constructor(source: T, patcher: PatchHandler) {
|
||||
public constructor(source: T, patchHandler: PatchHandler) {
|
||||
super(source);
|
||||
this.patcher = patcher;
|
||||
this.patchHandler = patchHandler;
|
||||
}
|
||||
|
||||
public async modifyResource(identifier: ResourceIdentifier, patch: Patch,
|
||||
@@ -25,7 +25,7 @@ export class PatchingStore<T extends ResourceStore = ResourceStore> extends Pass
|
||||
return await this.source.modifyResource(identifier, patch, conditions);
|
||||
} catch (error: unknown) {
|
||||
if (NotImplementedHttpError.isInstance(error)) {
|
||||
return this.patcher.handleSafe({ source: this.source, identifier, patch });
|
||||
return this.patchHandler.handleSafe({ source: this.source, identifier, patch });
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user