mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: Integrate setup behaviour
This adds options for enabling setup to the config folder. All default configs with permanent storage (file/sparql) are configured to require setup at server start. Memory-based configs merely have it as an option.
This commit is contained in:
@@ -317,6 +317,7 @@ export * from './util/handlers/BooleanHandler';
|
||||
export * from './util/handlers/ConditionalHandler';
|
||||
export * from './util/handlers/ParallelHandler';
|
||||
export * from './util/handlers/SequenceHandler';
|
||||
export * from './util/handlers/StaticHandler';
|
||||
export * from './util/handlers/UnsupportedAsyncHandler';
|
||||
export * from './util/handlers/WaterfallHandler';
|
||||
|
||||
|
||||
22
src/util/handlers/StaticHandler.ts
Normal file
22
src/util/handlers/StaticHandler.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { AsyncHandler } from './AsyncHandler';
|
||||
|
||||
/**
|
||||
* A handler that always resolves and always returns the stored value.
|
||||
* Will return undefined if no value is stored.
|
||||
*
|
||||
* The generic type extends `any` due to Components.js requirements.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
|
||||
export class StaticHandler<T extends any = void> extends AsyncHandler<any, T> {
|
||||
private readonly value?: T;
|
||||
|
||||
public constructor(value?: T) {
|
||||
super();
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public async handle(): Promise<T> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
||||
return this.value!;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user