Refine some type definitions
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 1 Oct 2021 19:28:50 +0000 (21:28 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Fri, 1 Oct 2021 19:28:50 +0000 (21:28 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
src/charging-station/ChargingStation.ts
src/charging-station/ocpp/OCPPRequestService.ts
src/types/ocpp/Requests.ts

index b7fff8015274c050d9cff4caba5c98700aad203c..edcd312da8dcb06db37b8d68f37249707ca3779f 100644 (file)
@@ -655,7 +655,7 @@ export default class ChargingStation {
   private async onMessage(data: Data): Promise<void> {
     let [messageType, messageId, commandName, commandPayload, errorDetails]: IncomingRequest = [0, '', '' as IncomingRequestCommand, {}, {}];
     let responseCallback: (payload: Record<string, unknown> | string, requestPayload: Record<string, unknown>) => void;
-    let rejectCallback: (error: OCPPError) => void;
+    let rejectCallback: (error: OCPPError, requestStatistic?: boolean) => void;
     let requestCommandName: RequestCommand | IncomingRequestCommand;
     let requestPayload: Record<string, unknown>;
     let cachedRequest: CachedRequest;
index f3f64514a954a76cf8c61bd000f572eed0659714..842b644613bfa544236b9c44a49786d9603e0891 100644 (file)
@@ -101,7 +101,8 @@ export default abstract class OCPPRequestService {
   }
 
   private buildMessageToSend(messageId: string, commandParams: Record<string, unknown>, messageType: MessageType, commandName: RequestCommand | IncomingRequestCommand,
-      responseCallback: (payload: Record<string, unknown> | string, requestPayload: Record<string, unknown>) => Promise<void>, rejectCallback: (error: OCPPError) => void): string {
+      responseCallback: (payload: Record<string, unknown> | string, requestPayload: Record<string, unknown>) => Promise<void>,
+      rejectCallback: (error: OCPPError, requestStatistic?: boolean) => void): string {
     let messageToSend: string;
     // Type of message
     switch (messageType) {
index f32db002c98da786fb9066a4a5f0f442b131c3f6..bf3bd76dcaabf2d7b99b2c7cc556caa5825373e7 100644 (file)
@@ -36,4 +36,4 @@ export type Request = [MessageType, string, RequestCommand, Record<string, unkno
 
 export type IncomingRequest = [MessageType, string, IncomingRequestCommand, Record<string, unknown>, Record<string, unknown>];
 
-export type CachedRequest = [(payload: Record<string, unknown> | string, requestPayload: Record<string, unknown>) => void, (error: OCPPError) => void, RequestCommand | IncomingRequestCommand, Record<string, unknown>];
+export type CachedRequest = [(payload: Record<string, unknown> | string, requestPayload: Record<string, unknown>) => void, (error: OCPPError, requestStatistic?: boolean) => void, RequestCommand | IncomingRequestCommand, Record<string, unknown>];