- if (new.target?.name === moduleName) {
- throw new TypeError(`Cannot construct ${new.target?.name} instances directly`);
- }
- super();
- this.incomingRequestHandlers = new Map<OCPP20IncomingRequestCommand, IncomingRequestHandler>();
- this.jsonSchemas = new Map<OCPP20IncomingRequestCommand, JSONSchemaType<JsonObject>>();
- this.validatePayload.bind(this);
+ // if (new.target?.name === moduleName) {
+ // throw new TypeError(`Cannot construct ${new.target?.name} instances directly`);
+ // }
+ super(OCPPVersion.VERSION_20);
+ this.incomingRequestHandlers = new Map<OCPP20IncomingRequestCommand, IncomingRequestHandler>([
+ [OCPP20IncomingRequestCommand.CLEAR_CACHE, this.handleRequestClearCache.bind(this)],
+ ]);
+ this.jsonSchemas = new Map<OCPP20IncomingRequestCommand, JSONSchemaType<JsonType>>([
+ [
+ OCPP20IncomingRequestCommand.CLEAR_CACHE,
+ OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20ClearCacheRequest>(
+ 'assets/json-schemas/ocpp/2.0/ClearCacheRequest.json',
+ moduleName,
+ 'constructor',
+ ),
+ ],
+ ]);
+ this.validatePayload = this.validatePayload.bind(this) as (
+ chargingStation: ChargingStation,
+ commandName: OCPP20IncomingRequestCommand,
+ commandPayload: JsonType,
+ ) => boolean;