fix: update eslint settings

This commit is contained in:
Joachim Van Herwegen
2020-06-03 16:02:19 +02:00
parent 3e2cfaf11e
commit a07f440ab6
12 changed files with 47 additions and 53 deletions

View File

@@ -46,22 +46,17 @@ export interface AuthenticatedLdpHandlerArgs {
*/
export class AuthenticatedLdpHandler extends HttpHandler {
private readonly requestParser: RequestParser;
private readonly credentialsExtractor: CredentialsExtractor;
private readonly permissionsExtractor: PermissionsExtractor;
private readonly authorizer: Authorizer;
private readonly operationHandler: OperationHandler;
private readonly responseWriter: ResponseWriter;
/**
* Creates the handler.
* @param args - The handlers required. None of them are optional.
*/
public constructor (args: AuthenticatedLdpHandlerArgs) {
public constructor(args: AuthenticatedLdpHandlerArgs) {
super();
Object.assign(this, args);
}
@@ -73,7 +68,7 @@ export class AuthenticatedLdpHandler extends HttpHandler {
*
* @returns A promise resolving if this request can be handled, otherwise rejecting with an Error.
*/
public async canHandle (input: { request: HttpRequest; response: HttpResponse }): Promise<void> {
public async canHandle(input: { request: HttpRequest; response: HttpResponse }): Promise<void> {
return this.requestParser.canHandle(input.request);
}
@@ -90,7 +85,7 @@ export class AuthenticatedLdpHandler extends HttpHandler {
*
* @returns A promise resolving when the handling is finished.
*/
public async handle (input: { request: HttpRequest; response: HttpResponse }): Promise<void> {
public async handle(input: { request: HttpRequest; response: HttpResponse }): Promise<void> {
let err: Error;
let operation: Operation;
@@ -112,15 +107,11 @@ export class AuthenticatedLdpHandler extends HttpHandler {
*
* @returns A promise resolving to the generated Operation.
*/
private async runHandlers (request: HttpRequest): Promise<Operation> {
private async runHandlers(request: HttpRequest): Promise<Operation> {
const op: Operation = await this.requestParser.handleSafe(request);
const credentials: Credentials = await this.credentialsExtractor.handleSafe(request);
const permissions: PermissionSet = await this.permissionsExtractor.handleSafe(op);
await this.authorizer.handleSafe({ credentials, identifier: op.target, permissions });
await this.operationHandler.handleSafe(op);
return op;

View File

@@ -27,7 +27,7 @@ export abstract class AsyncHandler<TInput, TOutput = void> {
*
* @returns The result of the handle function of the handler.
*/
public async handleSafe (data: TInput): Promise<TOutput> {
public async handleSafe(data: TInput): Promise<TOutput> {
await this.canHandle(data);
return this.handle(data);

View File

@@ -12,7 +12,7 @@ export class CompositeAsyncHandler<TIn, TOut> implements AsyncHandler<TIn, TOut>
* Creates a new CompositeAsyncHandler that stores the given handlers.
* @param handlers - Handlers over which it will run.
*/
public constructor (handlers: AsyncHandler<TIn, TOut>[]) {
public constructor(handlers: AsyncHandler<TIn, TOut>[]) {
this.handlers = handlers;
}
@@ -22,7 +22,7 @@ export class CompositeAsyncHandler<TIn, TOut> implements AsyncHandler<TIn, TOut>
*
* @returns A promise resolving if at least 1 handler supports to input, or rejecting if none do.
*/
public async canHandle (input: TIn): Promise<void> {
public async canHandle(input: TIn): Promise<void> {
await this.findHandler(input);
}
@@ -33,7 +33,7 @@ export class CompositeAsyncHandler<TIn, TOut> implements AsyncHandler<TIn, TOut>
* @returns A promise corresponding to the handle call of a handler that supports the input.
* It rejects if no handlers support the given data.
*/
public async handle (input: TIn): Promise<TOut> {
public async handle(input: TIn): Promise<TOut> {
let handler: AsyncHandler<TIn, TOut>;
try {
@@ -52,7 +52,7 @@ export class CompositeAsyncHandler<TIn, TOut> implements AsyncHandler<TIn, TOut>
* @returns A promise corresponding to the handle call of a handler that supports the input.
* It rejects if no handlers support the given data.
*/
public async handleSafe (input: TIn): Promise<TOut> {
public async handleSafe(input: TIn): Promise<TOut> {
const handler = await this.findHandler(input);
return handler.handle(input);
@@ -66,7 +66,7 @@ export class CompositeAsyncHandler<TIn, TOut> implements AsyncHandler<TIn, TOut>
*
* @returns A promise resolving to a handler that supports the data or otherwise rejecting.
*/
private async findHandler (input: TIn): Promise<AsyncHandler<TIn, TOut>> {
private async findHandler(input: TIn): Promise<AsyncHandler<TIn, TOut>> {
const errors: Error[] = [];
for (const handler of this.handlers) {

View File

@@ -11,7 +11,7 @@ export abstract class HttpError extends Error {
* @param name - Error name. Useful for logging and stack tracing.
* @param message - Message to be thrown.
*/
protected constructor (statusCode: number, name: string, message: string) {
protected constructor(statusCode: number, name: string, message: string) {
super(message);
this.statusCode = statusCode;
this.name = name;

View File

@@ -9,7 +9,7 @@ export class UnsupportedHttpError extends HttpError {
* Default message is 'The given input is not supported by the server configuration.'.
* @param message - Optional, more specific, message.
*/
public constructor (message?: string) {
public constructor(message?: string) {
super(400, 'UnsupportedHttpError', message || 'The given input is not supported by the server configuration.');
}
}