diff --git a/src/authentication/SimpleCredentialsExtractor.ts b/src/authentication/SimpleCredentialsExtractor.ts index 874bbcd3b..0047a8ff8 100644 --- a/src/authentication/SimpleCredentialsExtractor.ts +++ b/src/authentication/SimpleCredentialsExtractor.ts @@ -2,6 +2,9 @@ import { Credentials } from './Credentials'; import { CredentialsExtractor } from './CredentialsExtractor'; import { HttpRequest } from '../server/HttpRequest'; +/** + * Credentials extractor which simply interprets the contents of the Authorization header as a webID. + */ export class SimpleCredentialsExtractor extends CredentialsExtractor { public async canHandle(): Promise { return undefined; diff --git a/src/authorization/SimpleAuthorizer.ts b/src/authorization/SimpleAuthorizer.ts index 7de480769..b872d1644 100644 --- a/src/authorization/SimpleAuthorizer.ts +++ b/src/authorization/SimpleAuthorizer.ts @@ -1,6 +1,9 @@ import { UnsupportedHttpError } from '../util/errors/UnsupportedHttpError'; import { Authorizer, AuthorizerArgs } from './Authorizer'; +/** + * Authorizer which allows all access independent of the identifier and requested permissions. + */ export class SimpleAuthorizer extends Authorizer { public async canHandle(input: AuthorizerArgs): Promise { if (!input.identifier || !input.permissions) { diff --git a/src/ldp/http/BodyParser.ts b/src/ldp/http/BodyParser.ts index ac3c3620f..95694f406 100644 --- a/src/ldp/http/BodyParser.ts +++ b/src/ldp/http/BodyParser.ts @@ -2,4 +2,7 @@ import { AsyncHandler } from '../../util/AsyncHandler'; import { HttpRequest } from '../../server/HttpRequest'; import { Representation } from '../representation/Representation'; +/** + * Parses the body of an incoming {@link HttpRequest} and converts it to a {@link Representation}. + */ export abstract class BodyParser extends AsyncHandler {} diff --git a/src/ldp/http/PreferenceParser.ts b/src/ldp/http/PreferenceParser.ts index 7c31e41d8..61649d1ae 100644 --- a/src/ldp/http/PreferenceParser.ts +++ b/src/ldp/http/PreferenceParser.ts @@ -2,4 +2,7 @@ import { AsyncHandler } from '../../util/AsyncHandler'; import { HttpRequest } from '../../server/HttpRequest'; import { RepresentationPreferences } from '../representation/RepresentationPreferences'; +/** + * Creates {@link RepresentationPreferences} based on the incoming HTTP headers in a {@link HttpRequest}. + */ export abstract class PreferenceParser extends AsyncHandler {} diff --git a/src/ldp/http/SimpleBodyParser.ts b/src/ldp/http/SimpleBodyParser.ts index c8383c71b..1ad22eef5 100644 --- a/src/ldp/http/SimpleBodyParser.ts +++ b/src/ldp/http/SimpleBodyParser.ts @@ -5,6 +5,10 @@ import { RepresentationMetadata } from '../representation/RepresentationMetadata import { StreamParser } from 'n3'; import { UnsupportedMediaTypeHttpError } from '../../util/errors/UnsupportedMediaTypeHttpError'; +/** + * Parses the incoming {@link HttpRequest} if there is no body or if it contains turtle (or similar) RDF data. + * Naively parses the content-type header to determine the body type. + */ export class SimpleBodyParser extends BodyParser { private static readonly contentTypes = [ 'application/n-quads', diff --git a/src/ldp/http/SimplePreferenceParser.ts b/src/ldp/http/SimplePreferenceParser.ts index 015e1886b..0700994b8 100644 --- a/src/ldp/http/SimplePreferenceParser.ts +++ b/src/ldp/http/SimplePreferenceParser.ts @@ -3,6 +3,10 @@ import { PreferenceParser } from './PreferenceParser'; import { RepresentationPreference } from '../representation/RepresentationPreference'; import { RepresentationPreferences } from '../representation/RepresentationPreferences'; +/** + * Extracts preferences from the accept-* headers from an incoming {@link HttpRequest}. + * Parsing of header strings is done naively. + */ export class SimplePreferenceParser extends PreferenceParser { public constructor() { super(); diff --git a/src/ldp/http/SimpleRequestParser.ts b/src/ldp/http/SimpleRequestParser.ts index 808964fac..07beeb3b3 100644 --- a/src/ldp/http/SimpleRequestParser.ts +++ b/src/ldp/http/SimpleRequestParser.ts @@ -14,6 +14,10 @@ export interface SimpleRequestParserArgs { bodyParser: BodyParser; } +/** + * Creates an {@link Operation} from an incoming {@link HttpRequest} by aggregating the results + * of a {@link TargetExtractor}, {@link PreferenceParser}, and {@link BodyParser}. + */ export class SimpleRequestParser extends RequestParser { private readonly targetExtractor: TargetExtractor; private readonly preferenceParser: PreferenceParser; diff --git a/src/ldp/http/SimpleResponseWriter.ts b/src/ldp/http/SimpleResponseWriter.ts index 3308c100d..3b504cd84 100644 --- a/src/ldp/http/SimpleResponseWriter.ts +++ b/src/ldp/http/SimpleResponseWriter.ts @@ -4,6 +4,9 @@ import { ResponseDescription } from '../operations/ResponseDescription'; import { ResponseWriter } from './ResponseWriter'; import { UnsupportedHttpError } from '../../util/errors/UnsupportedHttpError'; +/** + * Writes to an {@link HttpResponse} based on the incoming {@link ResponseDescription} or error. + */ export class SimpleResponseWriter extends ResponseWriter { public async canHandle(input: { response: HttpResponse; description?: ResponseDescription; error?: Error }): Promise { if (!input.description && !input.error) { diff --git a/src/ldp/http/SimpleTargetExtractor.ts b/src/ldp/http/SimpleTargetExtractor.ts index 0b1def084..27903e6ca 100644 --- a/src/ldp/http/SimpleTargetExtractor.ts +++ b/src/ldp/http/SimpleTargetExtractor.ts @@ -2,6 +2,10 @@ import { HttpRequest } from '../../server/HttpRequest'; import { ResourceIdentifier } from '../representation/ResourceIdentifier'; import { TargetExtractor } from './TargetExtractor'; +/** + * Extracts an identifier from an incoming {@link HttpRequest}. + * Simply takes the input URl without any parsing/cleaning. + */ export class SimpleTargetExtractor extends TargetExtractor { public async canHandle(input: HttpRequest): Promise { if (!input.url) { diff --git a/src/ldp/http/TargetExtractor.ts b/src/ldp/http/TargetExtractor.ts index 51cbad75b..6c758c810 100644 --- a/src/ldp/http/TargetExtractor.ts +++ b/src/ldp/http/TargetExtractor.ts @@ -2,4 +2,7 @@ import { AsyncHandler } from '../../util/AsyncHandler'; import { HttpRequest } from '../../server/HttpRequest'; import { ResourceIdentifier } from '../representation/ResourceIdentifier'; +/** + * Extracts a {@link ResourceIdentifier} from an incoming {@link HttpRequest}. + */ export abstract class TargetExtractor extends AsyncHandler {} diff --git a/src/ldp/operations/SimpleDeleteOperationHandler.ts b/src/ldp/operations/SimpleDeleteOperationHandler.ts index fd36f5323..de1cf2bd2 100644 --- a/src/ldp/operations/SimpleDeleteOperationHandler.ts +++ b/src/ldp/operations/SimpleDeleteOperationHandler.ts @@ -4,6 +4,10 @@ import { ResourceStore } from '../../storage/ResourceStore'; import { ResponseDescription } from './ResponseDescription'; import { UnsupportedHttpError } from '../../util/errors/UnsupportedHttpError'; +/** + * Handles DELETE {@link Operation}s. + * Calls the deleteResource function from a {@link ResourceStore}. + */ export class SimpleDeleteOperationHandler extends OperationHandler { private readonly store: ResourceStore; diff --git a/src/ldp/operations/SimpleGetOperationHandler.ts b/src/ldp/operations/SimpleGetOperationHandler.ts index 1b6abdd50..634e9138d 100644 --- a/src/ldp/operations/SimpleGetOperationHandler.ts +++ b/src/ldp/operations/SimpleGetOperationHandler.ts @@ -4,6 +4,10 @@ import { ResourceStore } from '../../storage/ResourceStore'; import { ResponseDescription } from './ResponseDescription'; import { UnsupportedHttpError } from '../../util/errors/UnsupportedHttpError'; +/** + * Handles GET {@link Operation}s. + * Calls the getRepresentation function from a {@link ResourceStore}. + */ export class SimpleGetOperationHandler extends OperationHandler { private readonly store: ResourceStore; diff --git a/src/ldp/operations/SimplePostOperationHandler.ts b/src/ldp/operations/SimplePostOperationHandler.ts index f375a77d1..33f7394b8 100644 --- a/src/ldp/operations/SimplePostOperationHandler.ts +++ b/src/ldp/operations/SimplePostOperationHandler.ts @@ -4,6 +4,10 @@ import { ResourceStore } from '../../storage/ResourceStore'; import { ResponseDescription } from './ResponseDescription'; import { UnsupportedHttpError } from '../../util/errors/UnsupportedHttpError'; +/** + * Handles POST {@link Operation}s. + * Calls the addResource function from a {@link ResourceStore}. + */ export class SimplePostOperationHandler extends OperationHandler { private readonly store: ResourceStore; diff --git a/src/ldp/permissions/SimplePermissionsExtractor.ts b/src/ldp/permissions/SimplePermissionsExtractor.ts index 6da507987..facaaab37 100644 --- a/src/ldp/permissions/SimplePermissionsExtractor.ts +++ b/src/ldp/permissions/SimplePermissionsExtractor.ts @@ -2,6 +2,9 @@ import { Operation } from '../operations/Operation'; import { PermissionSet } from './PermissionSet'; import { PermissionsExtractor } from './PermissionsExtractor'; +/** + * Makes some simplified assumption based on the {@link Operation} method to generate a {@link PermissionSet}. + */ export class SimplePermissionsExtractor extends PermissionsExtractor { public async canHandle(): Promise { return undefined; diff --git a/src/ldp/representation/NamedRepresentation.ts b/src/ldp/representation/NamedRepresentation.ts index a1a63807f..ac64718db 100644 --- a/src/ldp/representation/NamedRepresentation.ts +++ b/src/ldp/representation/NamedRepresentation.ts @@ -1,6 +1,9 @@ import { Representation } from './Representation'; import { ResourceIdentifier } from './ResourceIdentifier'; +/** + * A {@link Representation} with an identifier. + */ export interface NamedRepresentation extends Representation { /** * The identifier of this representation. diff --git a/src/ldp/representation/RepresentationMetadata.ts b/src/ldp/representation/RepresentationMetadata.ts index e2a70642d..f1b03c4e7 100644 --- a/src/ldp/representation/RepresentationMetadata.ts +++ b/src/ldp/representation/RepresentationMetadata.ts @@ -3,6 +3,9 @@ */ import { Quad } from 'rdf-js'; +/** + * Metadata corresponding to a {@link Representation}. + */ export interface RepresentationMetadata { /** * All metadata triples of the resource. diff --git a/src/util/errors/NotFoundHttpError.ts b/src/util/errors/NotFoundHttpError.ts index 276d2c1ed..ea5e054c1 100644 --- a/src/util/errors/NotFoundHttpError.ts +++ b/src/util/errors/NotFoundHttpError.ts @@ -1,5 +1,7 @@ import { HttpError } from './HttpError'; - +/** + * An error thrown when no data was found for the requested identifier. + */ export class NotFoundHttpError extends HttpError { public constructor(message?: string) { super(404, 'NotFoundHttpError', message); diff --git a/src/util/errors/UnsupportedMediaTypeHttpError.ts b/src/util/errors/UnsupportedMediaTypeHttpError.ts index a8ae555f9..8fa562995 100644 --- a/src/util/errors/UnsupportedMediaTypeHttpError.ts +++ b/src/util/errors/UnsupportedMediaTypeHttpError.ts @@ -1,7 +1,10 @@ import { HttpError } from './HttpError'; +/** + * An error thrown when the media type of incoming data is not supported by a parser. + */ export class UnsupportedMediaTypeHttpError extends HttpError { public constructor(message?: string) { - super(415, 'UnsupportedHttpError', message); + super(415, 'UnsupportedMediaTypeHttpError', message); } }