mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: add additional supported interfaces
This includes the relevant auth headers and a simplification of several others.
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import { Representation } from './Representation';
|
||||
|
||||
/**
|
||||
* Represents the changes needed for a PATCH request.
|
||||
*/
|
||||
export interface Patch {}
|
||||
export interface Patch extends Representation {}
|
||||
|
||||
8
src/ldp/http/RequestParser.ts
Normal file
8
src/ldp/http/RequestParser.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { AsyncHandler } from '../../util/AsyncHandler';
|
||||
import { HttpRequest } from '../../server/HttpRequest';
|
||||
import { Operation } from '../operations/Operation';
|
||||
|
||||
/**
|
||||
* Converts an incoming HttpRequest to an Operation.
|
||||
*/
|
||||
export type RequestParser = AsyncHandler<HttpRequest, Operation>;
|
||||
@@ -1,21 +1,7 @@
|
||||
import { AsyncHandler } from '../../util/AsyncHandler';
|
||||
import { Operation } from './Operation';
|
||||
|
||||
/**
|
||||
* Handler for a specific operation type.
|
||||
*/
|
||||
export interface OperationHandler {
|
||||
/**
|
||||
* Checks if the handler supports the given operation.
|
||||
* @param operation - The input operation.
|
||||
*
|
||||
* @returns A promise resolving to a boolean indicating if this handler supports the operation.
|
||||
*/
|
||||
canHandle: (operation: Operation) => Promise<boolean>;
|
||||
/**
|
||||
* Handles the given operation.
|
||||
* @param operation - The input operation.
|
||||
*
|
||||
* @returns A promise resolving when the operation is handled.
|
||||
*/
|
||||
handle: (operation: Operation) => Promise<void>;
|
||||
}
|
||||
export type OperationHandler = AsyncHandler<Operation>;
|
||||
|
||||
9
src/ldp/permissions/PermissionSet.ts
Normal file
9
src/ldp/permissions/PermissionSet.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* A data interface indicating which permissions are allowed (based on the context).
|
||||
*/
|
||||
export interface PermissionSet {
|
||||
read: boolean;
|
||||
append: boolean;
|
||||
write: boolean;
|
||||
delete: boolean;
|
||||
}
|
||||
8
src/ldp/permissions/PermissionsExtractor.ts
Normal file
8
src/ldp/permissions/PermissionsExtractor.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { AsyncHandler } from '../../util/AsyncHandler';
|
||||
import { Operation } from '../operations/Operation';
|
||||
import { PermissionSet } from './PermissionSet';
|
||||
|
||||
/**
|
||||
* Verifies which permissions are requested on a given {@link Operation}.
|
||||
*/
|
||||
export type PermissionsExtractor = AsyncHandler<Operation, PermissionSet>;
|
||||
Reference in New Issue
Block a user