Even more documentation

This commit is contained in:
Daniel Kluge
2023-11-01 23:44:43 +01:00
parent 86dcd8d2f8
commit 591cf6662b
10 changed files with 506 additions and 8 deletions
+38 -1
View File
@@ -1,18 +1,55 @@
import { types } from "@aas-core-works/aas-core3.0-typescript";
import type { Request, OnRequestCallback } from "./types/requests";
import type { OnRequestCallback } from "./types/requests";
/**
* Abstract class for an interface server.
* This should be used as base class for your own interface servers!
*
* @typeParam ConfigInterface - The config interface for your interface server.
*/
export default abstract class AASInterfaceServer<ConfigInterface> {
/**
* A name for your interface server.
* @remarks
* Currently unused
*/
public static readonly serverInterfaceName: string;
/**
* Whether your interface server supports subscriptions.
* @remarks
* Currently unused
*/
public static readonly supportsSubscriptions: boolean;
/**
* Crate the interface server.
* @param config Interface server config
* @param aas AAS Environment for the server
* @param onRequestCallback Callback when a request is received and parsed
*/
constructor(
protected readonly config: ConfigInterface,
protected readonly aas: types.Environment,
protected readonly onRequestCallback: OnRequestCallback) {}
/**
* Prepare the interface server.
* @remarks
* Here you can create routes, listeners, callbacks,...
*/
public abstract prepare(): void;
/**
* Run the interface server.
*/
public abstract run(): void;
/**
* Stop the interface server.
*/
public abstract stop(): void;
/**
* Notify observers/subscribers about an event.
* @param event Event to notify the interface server about
*/
public abstract notify(event: any): void;
}