From a38fcbe18aeb86362fb7f962bfecff7f1fbc1b20 Mon Sep 17 00:00:00 2001 From: Daniel Kluge Date: Mon, 30 Oct 2023 10:45:48 +0100 Subject: [PATCH] Begin request typing --- lib/src/interfaceConnectionObject.ts | 13 ++++--------- lib/src/types/requests.ts | 12 ++++++++++-- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/lib/src/interfaceConnectionObject.ts b/lib/src/interfaceConnectionObject.ts index 462e434..dfb85fa 100644 --- a/lib/src/interfaceConnectionObject.ts +++ b/lib/src/interfaceConnectionObject.ts @@ -11,15 +11,10 @@ export default abstract class InterfaceConnectionObject { protected abstract readonly connectionType: ConnectionType; protected abstract readonly supportsSubscriptions: boolean; - protected readonly connectionParameter: ConfigInterface; - protected readonly endpointMetadata: EndpointMetadata; - private readonly onResponseCallback: OnResponseCallback; - - public constructor(connectionParameter: ConfigInterface, endpointMetadata: EndpointMetadata, onResponseCallback: OnResponseCallback) { - this.connectionParameter = connectionParameter; - this.endpointMetadata = endpointMetadata; - this.onResponseCallback = onResponseCallback; - } + public constructor( + protected readonly connectionParameter: ConfigInterface, + protected readonly endpointMetadata: EndpointMetadata, + private readonly onResponseCallback: OnResponseCallback) {} public abstract connect(): boolean; diff --git a/lib/src/types/requests.ts b/lib/src/types/requests.ts index 053f1f3..4155ccd 100644 --- a/lib/src/types/requests.ts +++ b/lib/src/types/requests.ts @@ -1,3 +1,11 @@ -export type Request = "TODO" +import { types } from "@aas-core-works/aas-core3.0-typescript"; -export type OnRequestCallback = (request: Request) => void \ No newline at end of file +export type Request = { + type: RequestType; + target: types.Reference | types.Class | string[]; + extraData?: any; +} + +export type OnRequestCallback = (request: Request) => void + +type RequestType = "READ" | "WRITE" | "OBSERVE" | "CALL" | "CALL-ASYNC" | "GET-OP-STATE" | "GET-OP-RESULT" | "SUBSCRIBE" | "UNSUBSCRIBE" \ No newline at end of file