repositories
/
e-mobility-charging-stations-simulator.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix type cast at AsyncResource usage
[e-mobility-charging-stations-simulator.git]
/
src
/
charging-station
/
ocpp
/
OCPPIncomingRequestService.ts
diff --git
a/src/charging-station/ocpp/OCPPIncomingRequestService.ts
b/src/charging-station/ocpp/OCPPIncomingRequestService.ts
index 2ee0465cb583476288289fdd9523d637b2fbde27..06ccd312c0e970022c844f200fe3d0b631ef8c93 100644
(file)
--- a/
src/charging-station/ocpp/OCPPIncomingRequestService.ts
+++ b/
src/charging-station/ocpp/OCPPIncomingRequestService.ts
@@
-1,3
+1,5
@@
+import { AsyncResource } from 'async_hooks';
+
import type { JSONSchemaType } from 'ajv';
import Ajv from 'ajv-draft-04';
import ajvFormats from 'ajv-formats';
import type { JSONSchemaType } from 'ajv';
import Ajv from 'ajv-draft-04';
import ajvFormats from 'ajv-formats';
@@
-14,9
+16,11
@@
const moduleName = 'OCPPIncomingRequestService';
export default abstract class OCPPIncomingRequestService {
private static instance: OCPPIncomingRequestService | null = null;
export default abstract class OCPPIncomingRequestService {
private static instance: OCPPIncomingRequestService | null = null;
+ protected asyncResource: AsyncResource;
private ajv: Ajv;
protected constructor() {
private ajv: Ajv;
protected constructor() {
+ this.asyncResource = new AsyncResource(moduleName);
this.ajv = new Ajv();
ajvFormats(this.ajv);
this.incomingRequestHandler.bind(this);
this.ajv = new Ajv();
ajvFormats(this.ajv);
this.incomingRequestHandler.bind(this);
@@
-37,7
+41,7
@@
export default abstract class OCPPIncomingRequestService {
params: HandleErrorParams<T> = { throwError: true }
): T {
logger.error(
params: HandleErrorParams<T> = { throwError: true }
): T {
logger.error(
- `${chargingStation.logPrefix()} ${moduleName}.handleIncomingRequestError: Incoming request command
${commandName}
error:`,
+ `${chargingStation.logPrefix()} ${moduleName}.handleIncomingRequestError: Incoming request command
'${commandName}'
error:`,
error
);
if (!params?.throwError && params?.errorResponse) {
error
);
if (!params?.throwError && params?.errorResponse) {
@@
-57,7
+61,7
@@
export default abstract class OCPPIncomingRequestService {
schema: JSONSchemaType<T>,
payload: T
): boolean {
schema: JSONSchemaType<T>,
payload: T
): boolean {
- if (
!chargingStation.getPayloadSchemaValidation()
) {
+ if (
chargingStation.getPayloadSchemaValidation() === false
) {
return true;
}
const validate = this.ajv.compile(schema);
return true;
}
const validate = this.ajv.compile(schema);