digitaltwin-core
Version:
Minimalist framework to collect and handle data in a Digital Twin project
33 lines • 1.22 kB
TypeScript
import type { Component, Servable } from './interfaces.js';
import type { ComponentConfiguration } from './types.js';
import type { DataResponse } from './types.js';
import type { HttpMethod } from '../engine/endpoints.js';
/**
* Description of a runtime HTTP endpoint handler.
*/
type EndpointDescriptor = {
method: HttpMethod;
path: string;
responseType?: string;
handler: (...args: any[]) => Promise<DataResponse>;
};
/**
* Base abstract class for defining a Handler component.
* A Handler is a stateless, servable component that exposes HTTP endpoints,
* useful for on-demand computation or utility services.
*/
export declare abstract class Handler implements Component, Servable {
/**
* Returns the static configuration of the handler.
* Must be implemented by subclasses.
*/
abstract getConfiguration(): ComponentConfiguration;
/**
* Resolves and returns the list of servable endpoints defined on the class.
* Uses static metadata declared on the constructor (__endpoints).
* @returns A list of endpoint descriptors mapping method/path to handlers.
*/
getEndpoints(): EndpointDescriptor[];
}
export {};
//# sourceMappingURL=handler.d.ts.map