mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
refactor: Move handlers into subfolder.
This commit is contained in:
parent
d7256fb20a
commit
eb1440851a
@ -1,5 +1,5 @@
|
||||
import type { HttpRequest } from '../server/HttpRequest';
|
||||
import { AsyncHandler } from '../util/AsyncHandler';
|
||||
import { AsyncHandler } from '../util/handlers/AsyncHandler';
|
||||
import type { Credentials } from './Credentials';
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { Credentials } from '../authentication/Credentials';
|
||||
import type { PermissionSet } from '../ldp/permissions/PermissionSet';
|
||||
import type { ResourceIdentifier } from '../ldp/representation/ResourceIdentifier';
|
||||
import { AsyncHandler } from '../util/AsyncHandler';
|
||||
import { AsyncHandler } from '../util/handlers/AsyncHandler';
|
||||
|
||||
/**
|
||||
* Verifies if the given credentials have access to the given permissions on the given resource.
|
||||
|
10
src/index.ts
10
src/index.ts
@ -187,6 +187,12 @@ export * from './util/errors/SystemError';
|
||||
export * from './util/errors/UnauthorizedHttpError';
|
||||
export * from './util/errors/UnsupportedMediaTypeHttpError';
|
||||
|
||||
// Util/Handlers
|
||||
export * from './util/handlers/AsyncHandler';
|
||||
export * from './util/handlers/SequenceHandler';
|
||||
export * from './util/handlers/UnsupportedAsyncHandler';
|
||||
export * from './util/handlers/WaterfallHandler';
|
||||
|
||||
// Util/Identifiers
|
||||
export * from './util/identifiers/IdentifierStrategy';
|
||||
export * from './util/identifiers/SingleRootIdentifierStrategy';
|
||||
@ -198,16 +204,12 @@ export * from './util/locking/SingleThreadedResourceLocker';
|
||||
export * from './util/locking/WrappedExpiringResourceLocker';
|
||||
|
||||
// Util
|
||||
export * from './util/AsyncHandler';
|
||||
export * from './util/ContentTypes';
|
||||
export * from './util/GuardedStream';
|
||||
export * from './util/HeaderUtil';
|
||||
export * from './util/PathUtil';
|
||||
export * from './util/QuadUtil';
|
||||
export * from './util/RecordObject';
|
||||
export * from './util/SequenceHandler';
|
||||
export * from './util/StreamUtil';
|
||||
export * from './util/TermUtil';
|
||||
export * from './util/UnsupportedAsyncHandler';
|
||||
export * from './util/Vocabularies';
|
||||
export * from './util/WaterfallHandler';
|
||||
|
@ -1,3 +1,3 @@
|
||||
import { AsyncHandler } from '../util/AsyncHandler';
|
||||
import { AsyncHandler } from '../util/handlers/AsyncHandler';
|
||||
|
||||
export abstract class Initializer extends AsyncHandler {}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { HttpRequest } from '../../server/HttpRequest';
|
||||
import { AsyncHandler } from '../../util/AsyncHandler';
|
||||
import { AsyncHandler } from '../../util/handlers/AsyncHandler';
|
||||
import type { Representation } from '../representation/Representation';
|
||||
import type { RepresentationMetadata } from '../representation/RepresentationMetadata';
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { HttpRequest } from '../../server/HttpRequest';
|
||||
import { AsyncHandler } from '../../util/AsyncHandler';
|
||||
import { AsyncHandler } from '../../util/handlers/AsyncHandler';
|
||||
import type { RepresentationPreferences } from '../representation/RepresentationPreferences';
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { HttpRequest } from '../../server/HttpRequest';
|
||||
import { AsyncHandler } from '../../util/AsyncHandler';
|
||||
import { AsyncHandler } from '../../util/handlers/AsyncHandler';
|
||||
import type { Operation } from '../operations/Operation';
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { HttpResponse } from '../../server/HttpResponse';
|
||||
import { AsyncHandler } from '../../util/AsyncHandler';
|
||||
import { AsyncHandler } from '../../util/handlers/AsyncHandler';
|
||||
import type { ResponseDescription } from './response/ResponseDescription';
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { HttpRequest } from '../../server/HttpRequest';
|
||||
import { AsyncHandler } from '../../util/AsyncHandler';
|
||||
import { AsyncHandler } from '../../util/handlers/AsyncHandler';
|
||||
import type { ResourceIdentifier } from '../representation/ResourceIdentifier';
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { HttpRequest } from '../../../server/HttpRequest';
|
||||
import { AsyncHandler } from '../../../util/AsyncHandler';
|
||||
import { AsyncHandler } from '../../../util/handlers/AsyncHandler';
|
||||
import type { RepresentationMetadata } from '../../representation/RepresentationMetadata';
|
||||
import type { ResourceIdentifier } from '../../representation/ResourceIdentifier';
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { HttpResponse } from '../../../server/HttpResponse';
|
||||
import { AsyncHandler } from '../../../util/AsyncHandler';
|
||||
import { AsyncHandler } from '../../../util/handlers/AsyncHandler';
|
||||
import type { RepresentationMetadata } from '../../representation/RepresentationMetadata';
|
||||
|
||||
/**
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { AsyncHandler } from '../../util/AsyncHandler';
|
||||
import { AsyncHandler } from '../../util/handlers/AsyncHandler';
|
||||
import type { ResponseDescription } from '../http/response/ResponseDescription';
|
||||
import type { Operation } from './Operation';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { AsyncHandler } from '../../util/AsyncHandler';
|
||||
import { AsyncHandler } from '../../util/handlers/AsyncHandler';
|
||||
import type { Operation } from '../operations/Operation';
|
||||
import type { PermissionSet } from './PermissionSet';
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { Representation } from '../../ldp/representation/Representation';
|
||||
import { AsyncHandler } from '../../util/AsyncHandler';
|
||||
import { AsyncHandler } from '../../util/handlers/AsyncHandler';
|
||||
import type { Agent } from './Agent';
|
||||
|
||||
/**
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { AsyncHandler } from '../util/AsyncHandler';
|
||||
import { AsyncHandler } from '../util/handlers/AsyncHandler';
|
||||
import type { HttpRequest } from './HttpRequest';
|
||||
import type { HttpResponse } from './HttpResponse';
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type WebSocket from 'ws';
|
||||
import { AsyncHandler } from '../util/AsyncHandler';
|
||||
import { AsyncHandler } from '../util/handlers/AsyncHandler';
|
||||
import type { HttpRequest } from './HttpRequest';
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { Representation } from '../../ldp/representation/Representation';
|
||||
import { getLoggerFor } from '../../logging/LogUtil';
|
||||
import { InternalServerError } from '../../util/errors/InternalServerError';
|
||||
import { UnsupportedAsyncHandler } from '../../util/UnsupportedAsyncHandler';
|
||||
import { UnsupportedAsyncHandler } from '../../util/handlers/UnsupportedAsyncHandler';
|
||||
import { hasMatchingMediaTypes } from './ConversionUtil';
|
||||
import { RepresentationConverter } from './RepresentationConverter';
|
||||
import type { RepresentationConverterArgs } from './RepresentationConverter';
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { Representation } from '../../ldp/representation/Representation';
|
||||
import type { RepresentationPreferences } from '../../ldp/representation/RepresentationPreferences';
|
||||
import type { ResourceIdentifier } from '../../ldp/representation/ResourceIdentifier';
|
||||
import { AsyncHandler } from '../../util/AsyncHandler';
|
||||
import { AsyncHandler } from '../../util/handlers/AsyncHandler';
|
||||
|
||||
export interface RepresentationConverterArgs {
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { Patch } from '../../ldp/http/Patch';
|
||||
import type { ResourceIdentifier } from '../../ldp/representation/ResourceIdentifier';
|
||||
import { AsyncHandler } from '../../util/AsyncHandler';
|
||||
import { AsyncHandler } from '../../util/handlers/AsyncHandler';
|
||||
|
||||
export abstract class PatchHandler extends AsyncHandler<{identifier: ResourceIdentifier; patch: Patch}> {}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import type { Representation } from '../../ldp/representation/Representation';
|
||||
import type { ResourceIdentifier } from '../../ldp/representation/ResourceIdentifier';
|
||||
import { AsyncHandler } from '../../util/AsyncHandler';
|
||||
import { AsyncHandler } from '../../util/handlers/AsyncHandler';
|
||||
import type { ResourceStore } from '../ResourceStore';
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { NotImplementedHttpError } from '../errors/NotImplementedHttpError';
|
||||
import { AsyncHandler } from './AsyncHandler';
|
||||
import { NotImplementedHttpError } from './errors/NotImplementedHttpError';
|
||||
|
||||
/**
|
||||
* Handler that does not support any input and will always throw an error.
|
@ -1,9 +1,9 @@
|
||||
import { getLoggerFor } from '../logging/LogUtil';
|
||||
import { getLoggerFor } from '../../logging/LogUtil';
|
||||
import { BadRequestHttpError } from '../errors/BadRequestHttpError';
|
||||
import { isNativeError } from '../errors/ErrorUtil';
|
||||
import { HttpError } from '../errors/HttpError';
|
||||
import { InternalServerError } from '../errors/InternalServerError';
|
||||
import type { AsyncHandler } from './AsyncHandler';
|
||||
import { BadRequestHttpError } from './errors/BadRequestHttpError';
|
||||
import { isNativeError } from './errors/ErrorUtil';
|
||||
import { HttpError } from './errors/HttpError';
|
||||
import { InternalServerError } from './errors/InternalServerError';
|
||||
|
||||
/**
|
||||
* A composite handler that tries multiple handlers one by one
|
@ -1,5 +1,5 @@
|
||||
import { AsyncHandler } from '../../../src/util/AsyncHandler';
|
||||
import { StaticAsyncHandler } from '../../util/StaticAsyncHandler';
|
||||
import { AsyncHandler } from '../../../../src/util/handlers/AsyncHandler';
|
||||
import { StaticAsyncHandler } from '../../../util/StaticAsyncHandler';
|
||||
|
||||
describe('An AsyncHandler', (): void => {
|
||||
it('supports any input by default.', async(): Promise<void> => {
|
@ -1,5 +1,5 @@
|
||||
import type { AsyncHandler } from '../../../src/util/AsyncHandler';
|
||||
import { SequenceHandler } from '../../../src/util/SequenceHandler';
|
||||
import type { AsyncHandler } from '../../../../src/util/handlers/AsyncHandler';
|
||||
import { SequenceHandler } from '../../../../src/util/handlers/SequenceHandler';
|
||||
|
||||
describe('A SequenceHandler', (): void => {
|
||||
const handlers: jest.Mocked<AsyncHandler<string, string>>[] = [
|
@ -1,5 +1,5 @@
|
||||
import { NotImplementedHttpError } from '../../../src/util/errors/NotImplementedHttpError';
|
||||
import { UnsupportedAsyncHandler } from '../../../src/util/UnsupportedAsyncHandler';
|
||||
import { NotImplementedHttpError } from '../../../../src/util/errors/NotImplementedHttpError';
|
||||
import { UnsupportedAsyncHandler } from '../../../../src/util/handlers/UnsupportedAsyncHandler';
|
||||
|
||||
describe('An UnsupportedAsyncHandler', (): void => {
|
||||
it('throws a default error when no message is set.', async(): Promise<void> => {
|
@ -1,8 +1,8 @@
|
||||
import type { AsyncHandler } from '../../../src/util/AsyncHandler';
|
||||
import { BadRequestHttpError } from '../../../src/util/errors/BadRequestHttpError';
|
||||
import { HttpError } from '../../../src/util/errors/HttpError';
|
||||
import { WaterfallHandler } from '../../../src/util/WaterfallHandler';
|
||||
import { StaticAsyncHandler } from '../../util/StaticAsyncHandler';
|
||||
import { BadRequestHttpError } from '../../../../src/util/errors/BadRequestHttpError';
|
||||
import { HttpError } from '../../../../src/util/errors/HttpError';
|
||||
import type { AsyncHandler } from '../../../../src/util/handlers/AsyncHandler';
|
||||
import { WaterfallHandler } from '../../../../src/util/handlers/WaterfallHandler';
|
||||
import { StaticAsyncHandler } from '../../../util/StaticAsyncHandler';
|
||||
|
||||
describe('A WaterfallHandler', (): void => {
|
||||
describe('with no handlers', (): void => {
|
@ -1,4 +1,4 @@
|
||||
import { AsyncHandler } from '../../src/util/AsyncHandler';
|
||||
import { AsyncHandler } from '../../src/util/handlers/AsyncHandler';
|
||||
|
||||
export class StaticAsyncHandler<TOut> extends AsyncHandler<any, TOut> {
|
||||
private readonly canHandleStatic: boolean;
|
||||
|
Loading…
x
Reference in New Issue
Block a user