## [1.5.0](https://github.com/SAP/e-mobility-charging-stations-simulator/compare/simulator@v1.4.2...simulator@v1.5.0) (2024-07-25)
-
### 🚀 Features
-* add initial node sea support ([f6e18e3](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/f6e18e33b68a67239eba3f4d873172a491283d00))
-
+- add initial node sea support ([f6e18e3](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/f6e18e33b68a67239eba3f4d873172a491283d00))
### 🐞 Bug Fixes
-* ensure OCPP payload validation report error details ([45087a8](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/45087a81ca7dda0b6e72897acd1391d859026961))
-
+- ensure OCPP payload validation report error details ([45087a8](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/45087a81ca7dda0b6e72897acd1391d859026961))
### ✨ Polish
-* npx -> pnpm dlx where appropriates ([bf25e53](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/bf25e531346a2e0579cb14d1d7c1da45dbb0aa08))
-* permit build code to run with other JS runtime ([456b7f2](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/456b7f2d7fc934d306e948e906c847417432009b))
-* refine OCPP PDU validation error messages ([5827ccc](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/5827ccc27d6c46f82df4e42a5707cfa19b550442))
-* refine station information validation error message ([915c88d](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/915c88d593292e7a47c92868e4b2d3752cce4dcd))
-* validate station information at CS init ([b55f94b](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/b55f94b6ac5dee58f38d13781b4345c4cc43f349))
-
+- npx -> pnpm dlx where appropriates ([bf25e53](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/bf25e531346a2e0579cb14d1d7c1da45dbb0aa08))
+- permit build code to run with other JS runtime ([456b7f2](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/456b7f2d7fc934d306e948e906c847417432009b))
+- refine OCPP PDU validation error messages ([5827ccc](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/5827ccc27d6c46f82df4e42a5707cfa19b550442))
+- refine station information validation error message ([915c88d](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/915c88d593292e7a47c92868e4b2d3752cce4dcd))
+- validate station information at CS init ([b55f94b](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/b55f94b6ac5dee58f38d13781b4345c4cc43f349))
### 🧪 Tests
-* fix clone() test ([53ec800](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/53ec800a644f89a299cede7a89dd8a7b05959797))
-
+- fix clone() test ([53ec800](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/53ec800a644f89a299cede7a89dd8a7b05959797))
### 📚 Documentation
-* **README.md:** refine volta installation on windows ([fad9e72](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/fad9e7271b22c74fe6eb67e939090cf529a2b249))
-
+- **README.md:** refine volta installation on windows ([fad9e72](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/fad9e7271b22c74fe6eb67e939090cf529a2b249))
### 🤖 Automation
-* **ci:** fix autofix GH action ([c033310](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/c03331039ff7a080a3456d5a88fb7b18d505df7f))
-* **deps-dev:** bump @types/node from 20.14.11 to 20.14.12 ([#1106](https://github.com/SAP/e-mobility-charging-stations-simulator/issues/1106)) ([fb46a87](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/fb46a877f5c2b880759b9e70a08092510a7cb473))
-* **deps-dev:** bump @vitejs/plugin-vue from 5.0.5 to 5.1.0 ([#1105](https://github.com/SAP/e-mobility-charging-stations-simulator/issues/1105)) ([d36c4c8](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/d36c4c840ab5ac7a9c7fe6abbd2ae01844cb981e))
-* **deps-dev:** bump @vitest/coverage-v8 from 2.0.1 to 2.0.2 ([bbdb386](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/bbdb3861ed14ea52669231e5d372add76c50d65e))
-* **deps-dev:** bump eslint-plugin-jsdoc from 48.5.2 to 48.6.0 ([fd091c8](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/fd091c8cd219780ff650859e7b4506180f436861))
-* **deps-dev:** bump glob from 10.4.3 to 11.0.0 ([cff23bd](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/cff23bd9ab0f9ca92bc2d4721bf454b00a54daf0))
-* **deps-dev:** bump husky from 9.0.11 to 9.1.0 ([#1091](https://github.com/SAP/e-mobility-charging-stations-simulator/issues/1091)) ([e74759d](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/e74759d1c5cc66ef325b75bae39cc930ae33eb92))
-* **deps-dev:** bump rimraf from 5.0.8 to 6.0.0 ([207408c](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/207408cf661a7b8a1d35f8a9aa5ff02104fcd8ba))
-* **deps-dev:** bump typescript-eslint from 7.16.0 to 7.16.1 ([a60a99d](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/a60a99dce05328466e9a631ba83a9d527f3b4548))
-* **deps-dev:** bump vitest from 2.0.1 to 2.0.2 ([#1082](https://github.com/SAP/e-mobility-charging-stations-simulator/issues/1082)) ([f3d0d30](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/f3d0d30346974ec0e979d53d8a761ce254ba8bb0))
-* **deps:** bump github/combine-prs from 5.0.0 to 5.1.0 ([#1093](https://github.com/SAP/e-mobility-charging-stations-simulator/issues/1093)) ([55f4d38](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/55f4d386ab0e3903101c8a4b296b962cf71c9427))
-* **deps:** bump tar from 7.4.0 to 7.4.1 ([#1102](https://github.com/SAP/e-mobility-charging-stations-simulator/issues/1102)) ([0da233c](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/0da233c3b206d71bda0504908a1fd429547de923))
-* **deps:** bump vue from 3.4.33 to 3.4.34 ([#1107](https://github.com/SAP/e-mobility-charging-stations-simulator/issues/1107)) ([0bfef14](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/0bfef1423a926bd6054a25934957148d1d2fb4b0))
+- **ci:** fix autofix GH action ([c033310](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/c03331039ff7a080a3456d5a88fb7b18d505df7f))
+- **deps-dev:** bump @types/node from 20.14.11 to 20.14.12 ([#1106](https://github.com/SAP/e-mobility-charging-stations-simulator/issues/1106)) ([fb46a87](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/fb46a877f5c2b880759b9e70a08092510a7cb473))
+- **deps-dev:** bump @vitejs/plugin-vue from 5.0.5 to 5.1.0 ([#1105](https://github.com/SAP/e-mobility-charging-stations-simulator/issues/1105)) ([d36c4c8](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/d36c4c840ab5ac7a9c7fe6abbd2ae01844cb981e))
+- **deps-dev:** bump @vitest/coverage-v8 from 2.0.1 to 2.0.2 ([bbdb386](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/bbdb3861ed14ea52669231e5d372add76c50d65e))
+- **deps-dev:** bump eslint-plugin-jsdoc from 48.5.2 to 48.6.0 ([fd091c8](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/fd091c8cd219780ff650859e7b4506180f436861))
+- **deps-dev:** bump glob from 10.4.3 to 11.0.0 ([cff23bd](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/cff23bd9ab0f9ca92bc2d4721bf454b00a54daf0))
+- **deps-dev:** bump husky from 9.0.11 to 9.1.0 ([#1091](https://github.com/SAP/e-mobility-charging-stations-simulator/issues/1091)) ([e74759d](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/e74759d1c5cc66ef325b75bae39cc930ae33eb92))
+- **deps-dev:** bump rimraf from 5.0.8 to 6.0.0 ([207408c](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/207408cf661a7b8a1d35f8a9aa5ff02104fcd8ba))
+- **deps-dev:** bump typescript-eslint from 7.16.0 to 7.16.1 ([a60a99d](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/a60a99dce05328466e9a631ba83a9d527f3b4548))
+- **deps-dev:** bump vitest from 2.0.1 to 2.0.2 ([#1082](https://github.com/SAP/e-mobility-charging-stations-simulator/issues/1082)) ([f3d0d30](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/f3d0d30346974ec0e979d53d8a761ce254ba8bb0))
+- **deps:** bump github/combine-prs from 5.0.0 to 5.1.0 ([#1093](https://github.com/SAP/e-mobility-charging-stations-simulator/issues/1093)) ([55f4d38](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/55f4d386ab0e3903101c8a4b296b962cf71c9427))
+- **deps:** bump tar from 7.4.0 to 7.4.1 ([#1102](https://github.com/SAP/e-mobility-charging-stations-simulator/issues/1102)) ([0da233c](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/0da233c3b206d71bda0504908a1fd429547de923))
+- **deps:** bump vue from 3.4.33 to 3.4.34 ([#1107](https://github.com/SAP/e-mobility-charging-stations-simulator/issues/1107)) ([0bfef14](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/0bfef1423a926bd6054a25934957148d1d2fb4b0))
## [1.4.2](https://github.com/SAP/e-mobility-charging-stations-simulator/compare/simulator@v1.4.1...simulator@v1.4.2) (2024-07-06)
files: [
'src/charging-station/Bootstrap.ts',
'src/charging-station/ChargingStation.ts',
+ 'src/charging-station/Helpers.ts',
'src/charging-station/ocpp/OCPPServiceUtils.ts',
'src/charging-station/ocpp/1.6/OCPP16ResponseService.ts',
'src/performance/PerformanceStatistics.ts',
logger.warn(
`${this.logPrefix()} Error thrown at incoming OCPP command ${
commandName ?? requestCommandName ?? Constants.UNKNOWN_OCPP_COMMAND
- // eslint-disable-next-line @typescript-eslint/no-base-to-string
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
} message '${data.toString()}' handling is not an OCPPError:`,
error
)
logger.error(
`${this.logPrefix()} Incoming OCPP command '${
commandName ?? requestCommandName ?? Constants.UNKNOWN_OCPP_COMMAND
- // eslint-disable-next-line @typescript-eslint/no-base-to-string
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
}' message '${data.toString()}'${
this.requests.has(messageId)
? ` matching cached request '${JSON.stringify(
if (isEmpty(chargingStation.stationInfo?.maximumPower)) {
throw new BaseError(`${chargingStationId}: Missing maximumPower in stationInfo properties`)
}
- if (chargingStation.stationInfo?.maximumPower != null && chargingStation.stationInfo.maximumPower <= 0) {
- throw new RangeError(`${chargingStationId}: Invalid maximumPower value in stationInfo properties`)
+ if (
+ chargingStation.stationInfo?.maximumPower != null &&
+ chargingStation.stationInfo.maximumPower <= 0
+ ) {
+ throw new RangeError(
+ `${chargingStationId}: Invalid maximumPower value in stationInfo properties`
+ )
}
if (isEmpty(chargingStation.stationInfo?.maximumAmperage)) {
throw new BaseError(`${chargingStationId}: Missing maximumAmperage in stationInfo properties`)
}
- if (chargingStation.stationInfo?.maximumAmperage != null && chargingStation.stationInfo.maximumAmperage <= 0) {
- throw new RangeError(`${chargingStationId}: Invalid maximumAmperage value in stationInfo properties`)
+ if (
+ chargingStation.stationInfo?.maximumAmperage != null &&
+ chargingStation.stationInfo.maximumAmperage <= 0
+ ) {
+ throw new RangeError(
+ `${chargingStationId}: Invalid maximumAmperage value in stationInfo properties`
+ )
}
switch (chargingStation.stationInfo?.ocppVersion) {
case OCPPVersion.VERSION_20:
case OCPPVersion.VERSION_201:
if (chargingStation.evses.size === 0) {
- throw new BaseError(`${chargingStationId}: OCPP 2.0 or superior requires at least one EVSE defined in the charging station template/configuration`)
+ throw new BaseError(
+ `${chargingStationId}: OCPP 2.0 or superior requires at least one EVSE defined in the charging station template/configuration`
+ )
}
}
}
case BroadcastChannelProcedureName.AUTHORIZE:
if (
(
- commandResponse as StartTransactionResponse | StopTransactionResponse | AuthorizeResponse
+ commandResponse as
+ | StartTransactionResponse
+ | StopTransactionResponse
+ | AuthorizeResponse
).idTagInfo?.status === AuthorizationStatus.ACCEPTED
) {
return ResponseStatus.SUCCESS
>([
[
OCPP16IncomingRequestCommand.RESET,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<ResetRequest>(
- 'assets/json-schemas/ocpp/1.6/Reset.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<ResetRequest>(
+ 'assets/json-schemas/ocpp/1.6/Reset.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.CLEAR_CACHE,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16ClearCacheRequest>(
- 'assets/json-schemas/ocpp/1.6/ClearCache.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16ClearCacheRequest>(
+ 'assets/json-schemas/ocpp/1.6/ClearCache.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.UNLOCK_CONNECTOR,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<UnlockConnectorRequest>(
- 'assets/json-schemas/ocpp/1.6/UnlockConnector.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<UnlockConnectorRequest>(
+ 'assets/json-schemas/ocpp/1.6/UnlockConnector.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.GET_CONFIGURATION,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<GetConfigurationRequest>(
- 'assets/json-schemas/ocpp/1.6/GetConfiguration.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<GetConfigurationRequest>(
+ 'assets/json-schemas/ocpp/1.6/GetConfiguration.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.CHANGE_CONFIGURATION,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<ChangeConfigurationRequest>(
- 'assets/json-schemas/ocpp/1.6/ChangeConfiguration.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<ChangeConfigurationRequest>(
+ 'assets/json-schemas/ocpp/1.6/ChangeConfiguration.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.GET_DIAGNOSTICS,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<GetDiagnosticsRequest>(
- 'assets/json-schemas/ocpp/1.6/GetDiagnostics.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<GetDiagnosticsRequest>(
+ 'assets/json-schemas/ocpp/1.6/GetDiagnostics.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.GET_COMPOSITE_SCHEDULE,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16GetCompositeScheduleRequest>(
- 'assets/json-schemas/ocpp/1.6/GetCompositeSchedule.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16GetCompositeScheduleRequest>(
+ 'assets/json-schemas/ocpp/1.6/GetCompositeSchedule.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.SET_CHARGING_PROFILE,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<SetChargingProfileRequest>(
- 'assets/json-schemas/ocpp/1.6/SetChargingProfile.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<SetChargingProfileRequest>(
+ 'assets/json-schemas/ocpp/1.6/SetChargingProfile.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.CLEAR_CHARGING_PROFILE,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16ClearChargingProfileRequest>(
- 'assets/json-schemas/ocpp/1.6/ClearChargingProfile.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16ClearChargingProfileRequest>(
+ 'assets/json-schemas/ocpp/1.6/ClearChargingProfile.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.CHANGE_AVAILABILITY,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16ChangeAvailabilityRequest>(
- 'assets/json-schemas/ocpp/1.6/ChangeAvailability.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16ChangeAvailabilityRequest>(
+ 'assets/json-schemas/ocpp/1.6/ChangeAvailability.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.REMOTE_START_TRANSACTION,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<RemoteStartTransactionRequest>(
- 'assets/json-schemas/ocpp/1.6/RemoteStartTransaction.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<RemoteStartTransactionRequest>(
+ 'assets/json-schemas/ocpp/1.6/RemoteStartTransaction.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.REMOTE_STOP_TRANSACTION,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<RemoteStopTransactionRequest>(
- 'assets/json-schemas/ocpp/1.6/RemoteStopTransaction.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<RemoteStopTransactionRequest>(
+ 'assets/json-schemas/ocpp/1.6/RemoteStopTransaction.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.TRIGGER_MESSAGE,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16TriggerMessageRequest>(
- 'assets/json-schemas/ocpp/1.6/TriggerMessage.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16TriggerMessageRequest>(
+ 'assets/json-schemas/ocpp/1.6/TriggerMessage.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.DATA_TRANSFER,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16DataTransferRequest>(
- 'assets/json-schemas/ocpp/1.6/DataTransfer.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16DataTransferRequest>(
+ 'assets/json-schemas/ocpp/1.6/DataTransfer.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.UPDATE_FIRMWARE,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16UpdateFirmwareRequest>(
- 'assets/json-schemas/ocpp/1.6/UpdateFirmware.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16UpdateFirmwareRequest>(
+ 'assets/json-schemas/ocpp/1.6/UpdateFirmware.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.RESERVE_NOW,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16ReserveNowRequest>(
- 'assets/json-schemas/ocpp/1.6/ReserveNow.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16ReserveNowRequest>(
+ 'assets/json-schemas/ocpp/1.6/ReserveNow.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.CANCEL_RESERVATION,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16CancelReservationRequest>(
- 'assets/json-schemas/ocpp/1.6/CancelReservation.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16CancelReservationRequest>(
+ 'assets/json-schemas/ocpp/1.6/CancelReservation.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
])
// Handle incoming request events
this.payloadValidateFunctions = new Map<OCPP16RequestCommand, ValidateFunction<JsonType>>([
[
OCPP16RequestCommand.AUTHORIZE,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16AuthorizeRequest>(
- 'assets/json-schemas/ocpp/1.6/Authorize.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16AuthorizeRequest>(
+ 'assets/json-schemas/ocpp/1.6/Authorize.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16RequestCommand.BOOT_NOTIFICATION,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16BootNotificationRequest>(
- 'assets/json-schemas/ocpp/1.6/BootNotification.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16BootNotificationRequest>(
+ 'assets/json-schemas/ocpp/1.6/BootNotification.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16RequestCommand.DIAGNOSTICS_STATUS_NOTIFICATION,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16DiagnosticsStatusNotificationRequest>(
- 'assets/json-schemas/ocpp/1.6/DiagnosticsStatusNotification.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16DiagnosticsStatusNotificationRequest>(
+ 'assets/json-schemas/ocpp/1.6/DiagnosticsStatusNotification.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16RequestCommand.HEARTBEAT,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16HeartbeatRequest>(
- 'assets/json-schemas/ocpp/1.6/Heartbeat.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16HeartbeatRequest>(
+ 'assets/json-schemas/ocpp/1.6/Heartbeat.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16RequestCommand.METER_VALUES,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16MeterValuesRequest>(
- 'assets/json-schemas/ocpp/1.6/MeterValues.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16MeterValuesRequest>(
+ 'assets/json-schemas/ocpp/1.6/MeterValues.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16RequestCommand.STATUS_NOTIFICATION,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16StatusNotificationRequest>(
- 'assets/json-schemas/ocpp/1.6/StatusNotification.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16StatusNotificationRequest>(
+ 'assets/json-schemas/ocpp/1.6/StatusNotification.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16RequestCommand.START_TRANSACTION,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16StartTransactionRequest>(
- 'assets/json-schemas/ocpp/1.6/StartTransaction.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16StartTransactionRequest>(
+ 'assets/json-schemas/ocpp/1.6/StartTransaction.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16RequestCommand.STOP_TRANSACTION,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16StopTransactionRequest>(
- 'assets/json-schemas/ocpp/1.6/StopTransaction.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16StopTransactionRequest>(
+ 'assets/json-schemas/ocpp/1.6/StopTransaction.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16RequestCommand.DATA_TRANSFER,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16DataTransferRequest>(
- 'assets/json-schemas/ocpp/1.6/DataTransfer.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16DataTransferRequest>(
+ 'assets/json-schemas/ocpp/1.6/DataTransfer.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16RequestCommand.FIRMWARE_STATUS_NOTIFICATION,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16FirmwareStatusNotificationRequest>(
- 'assets/json-schemas/ocpp/1.6/FirmwareStatusNotification.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16FirmwareStatusNotificationRequest>(
+ 'assets/json-schemas/ocpp/1.6/FirmwareStatusNotification.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
])
this.buildRequestPayload = this.buildRequestPayload.bind(this)
this.payloadValidateFunctions = new Map<OCPP16RequestCommand, ValidateFunction<JsonType>>([
[
OCPP16RequestCommand.BOOT_NOTIFICATION,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16BootNotificationResponse>(
- 'assets/json-schemas/ocpp/1.6/BootNotificationResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16BootNotificationResponse>(
+ 'assets/json-schemas/ocpp/1.6/BootNotificationResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16RequestCommand.HEARTBEAT,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16HeartbeatResponse>(
- 'assets/json-schemas/ocpp/1.6/HeartbeatResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16HeartbeatResponse>(
+ 'assets/json-schemas/ocpp/1.6/HeartbeatResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16RequestCommand.AUTHORIZE,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16AuthorizeResponse>(
- 'assets/json-schemas/ocpp/1.6/AuthorizeResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16AuthorizeResponse>(
+ 'assets/json-schemas/ocpp/1.6/AuthorizeResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16RequestCommand.START_TRANSACTION,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16StartTransactionResponse>(
- 'assets/json-schemas/ocpp/1.6/StartTransactionResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16StartTransactionResponse>(
+ 'assets/json-schemas/ocpp/1.6/StartTransactionResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16RequestCommand.STOP_TRANSACTION,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16StopTransactionResponse>(
- 'assets/json-schemas/ocpp/1.6/StopTransactionResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16StopTransactionResponse>(
+ 'assets/json-schemas/ocpp/1.6/StopTransactionResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16RequestCommand.STATUS_NOTIFICATION,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16StatusNotificationResponse>(
- 'assets/json-schemas/ocpp/1.6/StatusNotificationResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16StatusNotificationResponse>(
+ 'assets/json-schemas/ocpp/1.6/StatusNotificationResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16RequestCommand.METER_VALUES,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16MeterValuesResponse>(
- 'assets/json-schemas/ocpp/1.6/MeterValuesResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16MeterValuesResponse>(
+ 'assets/json-schemas/ocpp/1.6/MeterValuesResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16RequestCommand.DIAGNOSTICS_STATUS_NOTIFICATION,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16DiagnosticsStatusNotificationResponse>(
- 'assets/json-schemas/ocpp/1.6/DiagnosticsStatusNotificationResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16DiagnosticsStatusNotificationResponse>(
+ 'assets/json-schemas/ocpp/1.6/DiagnosticsStatusNotificationResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16RequestCommand.DATA_TRANSFER,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16DataTransferResponse>(
- 'assets/json-schemas/ocpp/1.6/DataTransferResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16DataTransferResponse>(
+ 'assets/json-schemas/ocpp/1.6/DataTransferResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16RequestCommand.FIRMWARE_STATUS_NOTIFICATION,
- this.ajv
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16FirmwareStatusNotificationResponse>(
- 'assets/json-schemas/ocpp/1.6/FirmwareStatusNotificationResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16FirmwareStatusNotificationResponse>(
+ 'assets/json-schemas/ocpp/1.6/FirmwareStatusNotificationResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
])
this.incomingRequestResponsePayloadValidateFunctions = new Map<
>([
[
OCPP16IncomingRequestCommand.RESET,
- this.ajvIncomingRequest
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<GenericResponse>(
- 'assets/json-schemas/ocpp/1.6/ResetResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajvIncomingRequest.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<GenericResponse>(
+ 'assets/json-schemas/ocpp/1.6/ResetResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.CLEAR_CACHE,
- this.ajvIncomingRequest
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<GenericResponse>(
- 'assets/json-schemas/ocpp/1.6/ClearCacheResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajvIncomingRequest.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<GenericResponse>(
+ 'assets/json-schemas/ocpp/1.6/ClearCacheResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.CHANGE_AVAILABILITY,
- this.ajvIncomingRequest
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16ChangeAvailabilityResponse>(
- 'assets/json-schemas/ocpp/1.6/ChangeAvailabilityResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajvIncomingRequest.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16ChangeAvailabilityResponse>(
+ 'assets/json-schemas/ocpp/1.6/ChangeAvailabilityResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.UNLOCK_CONNECTOR,
- this.ajvIncomingRequest
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<UnlockConnectorResponse>(
- 'assets/json-schemas/ocpp/1.6/UnlockConnectorResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajvIncomingRequest.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<UnlockConnectorResponse>(
+ 'assets/json-schemas/ocpp/1.6/UnlockConnectorResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.GET_CONFIGURATION,
- this.ajvIncomingRequest
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<GetConfigurationResponse>(
- 'assets/json-schemas/ocpp/1.6/GetConfigurationResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajvIncomingRequest.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<GetConfigurationResponse>(
+ 'assets/json-schemas/ocpp/1.6/GetConfigurationResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.CHANGE_CONFIGURATION,
- this.ajvIncomingRequest
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<ChangeConfigurationResponse>(
- 'assets/json-schemas/ocpp/1.6/ChangeConfigurationResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajvIncomingRequest.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<ChangeConfigurationResponse>(
+ 'assets/json-schemas/ocpp/1.6/ChangeConfigurationResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.GET_COMPOSITE_SCHEDULE,
- this.ajvIncomingRequest
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16GetCompositeScheduleResponse>(
- 'assets/json-schemas/ocpp/1.6/GetCompositeScheduleResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajvIncomingRequest.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16GetCompositeScheduleResponse>(
+ 'assets/json-schemas/ocpp/1.6/GetCompositeScheduleResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.SET_CHARGING_PROFILE,
- this.ajvIncomingRequest
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<SetChargingProfileResponse>(
- 'assets/json-schemas/ocpp/1.6/SetChargingProfileResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajvIncomingRequest.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<SetChargingProfileResponse>(
+ 'assets/json-schemas/ocpp/1.6/SetChargingProfileResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.CLEAR_CHARGING_PROFILE,
- this.ajvIncomingRequest
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16ClearChargingProfileResponse>(
- 'assets/json-schemas/ocpp/1.6/ClearChargingProfileResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajvIncomingRequest.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16ClearChargingProfileResponse>(
+ 'assets/json-schemas/ocpp/1.6/ClearChargingProfileResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.REMOTE_START_TRANSACTION,
- this.ajvIncomingRequest
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<GenericResponse>(
- 'assets/json-schemas/ocpp/1.6/RemoteStartTransactionResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajvIncomingRequest.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<GenericResponse>(
+ 'assets/json-schemas/ocpp/1.6/RemoteStartTransactionResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.REMOTE_STOP_TRANSACTION,
- this.ajvIncomingRequest
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<GenericResponse>(
- 'assets/json-schemas/ocpp/1.6/RemoteStopTransactionResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajvIncomingRequest.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<GenericResponse>(
+ 'assets/json-schemas/ocpp/1.6/RemoteStopTransactionResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.GET_DIAGNOSTICS,
- this.ajvIncomingRequest
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<GetDiagnosticsResponse>(
- 'assets/json-schemas/ocpp/1.6/GetDiagnosticsResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajvIncomingRequest.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<GetDiagnosticsResponse>(
+ 'assets/json-schemas/ocpp/1.6/GetDiagnosticsResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.TRIGGER_MESSAGE,
- this.ajvIncomingRequest
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16TriggerMessageResponse>(
- 'assets/json-schemas/ocpp/1.6/TriggerMessageResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajvIncomingRequest.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16TriggerMessageResponse>(
+ 'assets/json-schemas/ocpp/1.6/TriggerMessageResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.DATA_TRANSFER,
- this.ajvIncomingRequest
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16DataTransferResponse>(
- 'assets/json-schemas/ocpp/1.6/DataTransferResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajvIncomingRequest.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16DataTransferResponse>(
+ 'assets/json-schemas/ocpp/1.6/DataTransferResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.UPDATE_FIRMWARE,
- this.ajvIncomingRequest
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16UpdateFirmwareResponse>(
- 'assets/json-schemas/ocpp/1.6/UpdateFirmwareResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajvIncomingRequest.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16UpdateFirmwareResponse>(
+ 'assets/json-schemas/ocpp/1.6/UpdateFirmwareResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.RESERVE_NOW,
- this.ajvIncomingRequest
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16ReserveNowResponse>(
- 'assets/json-schemas/ocpp/1.6/ReserveNowResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajvIncomingRequest.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16ReserveNowResponse>(
+ 'assets/json-schemas/ocpp/1.6/ReserveNowResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP16IncomingRequestCommand.CANCEL_RESERVATION,
- this.ajvIncomingRequest
- .compile(
- OCPP16ServiceUtils.parseJsonSchemaFile<GenericResponse>(
- 'assets/json-schemas/ocpp/1.6/CancelReservationResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajvIncomingRequest.compile(
+ OCPP16ServiceUtils.parseJsonSchemaFile<GenericResponse>(
+ 'assets/json-schemas/ocpp/1.6/CancelReservationResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
])
this.validatePayload = this.validatePayload.bind(this)
>([
[
OCPP20IncomingRequestCommand.CLEAR_CACHE,
- this.ajv
- .compile(
- OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20ClearCacheRequest>(
- 'assets/json-schemas/ocpp/2.0/ClearCacheRequest.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20ClearCacheRequest>(
+ 'assets/json-schemas/ocpp/2.0/ClearCacheRequest.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
])
this.validatePayload = this.validatePayload.bind(this)
this.payloadValidateFunctions = new Map<OCPP20RequestCommand, ValidateFunction<JsonType>>([
[
OCPP20RequestCommand.BOOT_NOTIFICATION,
- this.ajv
- .compile(
- OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20BootNotificationRequest>(
- 'assets/json-schemas/ocpp/2.0/BootNotificationRequest.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20BootNotificationRequest>(
+ 'assets/json-schemas/ocpp/2.0/BootNotificationRequest.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP20RequestCommand.HEARTBEAT,
- this.ajv
- .compile(
- OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20HeartbeatRequest>(
- 'assets/json-schemas/ocpp/2.0/HeartbeatRequest.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20HeartbeatRequest>(
+ 'assets/json-schemas/ocpp/2.0/HeartbeatRequest.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP20RequestCommand.STATUS_NOTIFICATION,
- this.ajv
- .compile(
- OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20StatusNotificationRequest>(
- 'assets/json-schemas/ocpp/2.0/StatusNotificationRequest.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20StatusNotificationRequest>(
+ 'assets/json-schemas/ocpp/2.0/StatusNotificationRequest.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
])
this.buildRequestPayload = this.buildRequestPayload.bind(this)
this.payloadValidateFunctions = new Map<OCPP20RequestCommand, ValidateFunction<JsonType>>([
[
OCPP20RequestCommand.BOOT_NOTIFICATION,
- this.ajv
- .compile(
- OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20BootNotificationResponse>(
- 'assets/json-schemas/ocpp/2.0/BootNotificationResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20BootNotificationResponse>(
+ 'assets/json-schemas/ocpp/2.0/BootNotificationResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP20RequestCommand.HEARTBEAT,
- this.ajv
- .compile(
- OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20HeartbeatResponse>(
- 'assets/json-schemas/ocpp/2.0/HeartbeatResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20HeartbeatResponse>(
+ 'assets/json-schemas/ocpp/2.0/HeartbeatResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
[
OCPP20RequestCommand.STATUS_NOTIFICATION,
- this.ajv
- .compile(
- OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20StatusNotificationResponse>(
- 'assets/json-schemas/ocpp/2.0/StatusNotificationResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajv.compile(
+ OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20StatusNotificationResponse>(
+ 'assets/json-schemas/ocpp/2.0/StatusNotificationResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
])
this.incomingRequestResponsePayloadValidateFunctions = new Map<
>([
[
OCPP20IncomingRequestCommand.CLEAR_CACHE,
- this.ajvIncomingRequest
- .compile(
- OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20ClearCacheResponse>(
- 'assets/json-schemas/ocpp/2.0/ClearCacheResponse.json',
- moduleName,
- 'constructor'
- )
- ),
+ this.ajvIncomingRequest.compile(
+ OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20ClearCacheResponse>(
+ 'assets/json-schemas/ocpp/2.0/ClearCacheResponse.json',
+ moduleName,
+ 'constructor'
+ )
+ ),
],
])
this.validatePayload = this.validatePayload.bind(this)
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
const logMsg = `Unknown application protocol type '${uiServerConfiguration.type}' in '${
ConfigurationSection.uiServer
- // eslint-disable-next-line @typescript-eslint/no-base-to-string
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
}' configuration section from values '${ApplicationProtocol.toString()}', defaulting to '${
ApplicationProtocol.WS
}'`
`${this.logPrefix(
moduleName,
'validateRawDataRequest'
- // eslint-disable-next-line @typescript-eslint/no-base-to-string
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
)} UI protocol request is not valid JSON: ${rawData.toString()}`
)
return false
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
`${this.logPrefix} ${this.getDBNameFromStorageType(type)} error '${
error.message
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
}'${inTableOrCollectionStr}:`,
error
)
## [1.5.0](https://github.com/SAP/e-mobility-charging-stations-simulator/compare/ocpp-server@v1.4.2...ocpp-server@v1.5.0) (2024-07-25)
-
### 🤖 Automation
-* **deps-dev:** bump ruff from 0.5.2 to 0.5.3 in /tests/ocpp-server ([#1094](https://github.com/SAP/e-mobility-charging-stations-simulator/issues/1094)) ([be27d4e](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/be27d4eacbbc58857c7c8a3caac51383f920b2f9))
+- **deps-dev:** bump ruff from 0.5.2 to 0.5.3 in /tests/ocpp-server ([#1094](https://github.com/SAP/e-mobility-charging-stations-simulator/issues/1094)) ([be27d4e](https://github.com/SAP/e-mobility-charging-stations-simulator/commit/be27d4eacbbc58857c7c8a3caac51383f920b2f9))
## [1.4.2](https://github.com/SAP/e-mobility-charging-stations-simulator/compare/ocpp-server@v1.4.1...ocpp-server@v1.4.2) (2024-07-06)
export default {
'*.{.css,json,md,yml,yaml,html,js,jsx,cjs,mjs,ts,tsx,cts,mts}': 'prettier --cache --write',
- // '*.{vue,js,jsx,cjs,mjs,ts,tsx,cts,mts}':
- // 'eslint . --cache --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore',
+ '*.{vue,js,jsx,cjs,mjs,ts,tsx,cts,mts}': 'eslint --cache --fix',
}
"dev": "vite",
"clean:dist": "pnpm exec rimraf dist",
"clean:node_modules": "pnpm exec rimraf node_modules",
- "lint": "cross-env TIMING=1 eslint .",
- "lint:fix": "cross-env TIMING=1 eslint .",
+ "lint": "cross-env TIMING=1 eslint --cache .",
+ "lint:fix": "cross-env TIMING=1 eslint --cache --fix .",
"format": "prettier --cache --write .",
"test": "vitest",
"coverage": "vitest run --coverage"
ResponseHandler
>
- private constructor(private uiServerConfiguration: UIServerConfigurationSection) {
+ private constructor (private uiServerConfiguration: UIServerConfigurationSection) {
this.openWS()
this.responseHandlers = new Map<
`${string}-${string}-${string}-${string}-${string}`,
>()
}
- public static getInstance(uiServerConfiguration?: UIServerConfigurationSection): UIClient {
+ public static getInstance (uiServerConfiguration?: UIServerConfigurationSection): UIClient {
if (UIClient.instance === null) {
if (uiServerConfiguration == null) {
throw new Error('Cannot initialize UIClient if no configuration is provided')
return UIClient.instance
}
- public setConfiguration(uiServerConfiguration: UIServerConfigurationSection): void {
+ public setConfiguration (uiServerConfiguration: UIServerConfigurationSection): void {
if (this.ws?.readyState === WebSocket.OPEN) {
this.ws.close()
delete this.ws
this.ws?.removeEventListener(event, listener, options)
}
- public async simulatorState(): Promise<ResponsePayload> {
+ public async simulatorState (): Promise<ResponsePayload> {
return this.sendRequest(ProcedureName.SIMULATOR_STATE, {})
}
- public async startSimulator(): Promise<ResponsePayload> {
+ public async startSimulator (): Promise<ResponsePayload> {
return this.sendRequest(ProcedureName.START_SIMULATOR, {})
}
- public async stopSimulator(): Promise<ResponsePayload> {
+ public async stopSimulator (): Promise<ResponsePayload> {
return this.sendRequest(ProcedureName.STOP_SIMULATOR, {})
}
- public async listTemplates(): Promise<ResponsePayload> {
+ public async listTemplates (): Promise<ResponsePayload> {
return this.sendRequest(ProcedureName.LIST_TEMPLATES, {})
}
- public async listChargingStations(): Promise<ResponsePayload> {
+ public async listChargingStations (): Promise<ResponsePayload> {
return this.sendRequest(ProcedureName.LIST_CHARGING_STATIONS, {})
}
- public async addChargingStations(
+ public async addChargingStations (
template: string,
numberOfStations: number,
options?: ChargingStationOptions
})
}
- public async deleteChargingStation(hashId: string): Promise<ResponsePayload> {
+ public async deleteChargingStation (hashId: string): Promise<ResponsePayload> {
return this.sendRequest(ProcedureName.DELETE_CHARGING_STATIONS, {
hashIds: [hashId],
})
}
- public async setSupervisionUrl(hashId: string, supervisionUrl: string): Promise<ResponsePayload> {
+ public async setSupervisionUrl (hashId: string, supervisionUrl: string): Promise<ResponsePayload> {
return this.sendRequest(ProcedureName.SET_SUPERVISION_URL, {
hashIds: [hashId],
url: supervisionUrl,
})
}
- public async startChargingStation(hashId: string): Promise<ResponsePayload> {
+ public async startChargingStation (hashId: string): Promise<ResponsePayload> {
return this.sendRequest(ProcedureName.START_CHARGING_STATION, {
hashIds: [hashId],
})
}
- public async stopChargingStation(hashId: string): Promise<ResponsePayload> {
+ public async stopChargingStation (hashId: string): Promise<ResponsePayload> {
return this.sendRequest(ProcedureName.STOP_CHARGING_STATION, {
hashIds: [hashId],
})
}
- public async openConnection(hashId: string): Promise<ResponsePayload> {
+ public async openConnection (hashId: string): Promise<ResponsePayload> {
return this.sendRequest(ProcedureName.OPEN_CONNECTION, {
hashIds: [hashId],
})
}
- public async closeConnection(hashId: string): Promise<ResponsePayload> {
+ public async closeConnection (hashId: string): Promise<ResponsePayload> {
return this.sendRequest(ProcedureName.CLOSE_CONNECTION, {
hashIds: [hashId],
})
}
- public async startTransaction(
+ public async startTransaction (
hashId: string,
connectorId: number,
idTag: string | undefined
})
}
- public async stopTransaction(
+ public async stopTransaction (
hashId: string,
transactionId: number | undefined
): Promise<ResponsePayload> {
})
}
- public async startAutomaticTransactionGenerator(
+ public async startAutomaticTransactionGenerator (
hashId: string,
connectorId: number
): Promise<ResponsePayload> {
})
}
- public async stopAutomaticTransactionGenerator(
+ public async stopAutomaticTransactionGenerator (
hashId: string,
connectorId: number
): Promise<ResponsePayload> {
})
}
- private openWS(): void {
+ private openWS (): void {
const protocols =
this.uiServerConfiguration.authentication?.enabled === true &&
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
}
}
- private async sendRequest(
+ private async sendRequest (
procedureName: ProcedureName,
payload: RequestPayload
): Promise<ResponsePayload> {
})
}
- private responseHandler(messageEvent: MessageEvent<string>): void {
+ private responseHandler (messageEvent: MessageEvent<string>): void {
let response: ProtocolResponse
try {
response = JSON.parse(messageEvent.data) as ProtocolResponse
export enum IdTagDistribution {
RANDOM = 'random',
ROUND_ROBIN = 'round-robin',
- CONNECTOR_AFFINITY = 'connector-affinity',
+ CONNECTOR_AFFINITY = 'connector-affinity'
}
export interface AutomaticTransactionGeneratorConfiguration extends JsonObject {
Idle = 'Idle',
InstallationFailed = 'InstallationFailed',
Installing = 'Installing',
- Installed = 'Installed',
+ Installed = 'Installed'
}
export interface FirmwareUpgrade extends JsonObject {
REMOTE_START_TRANSACTION = 'RemoteStartTransaction',
REMOTE_STOP_TRANSACTION = 'RemoteStopTransaction',
GET_DIAGNOSTICS = 'GetDiagnostics',
- TRIGGER_MESSAGE = 'TriggerMessage',
+ TRIGGER_MESSAGE = 'TriggerMessage'
}
export const IncomingRequestCommand = {
START_TRANSACTION = 'StartTransaction',
STOP_TRANSACTION = 'StopTransaction',
METER_VALUES = 'MeterValues',
- DIAGNOSTICS_STATUS_NOTIFICATION = 'DiagnosticsStatusNotification',
+ DIAGNOSTICS_STATUS_NOTIFICATION = 'DiagnosticsStatusNotification'
}
export const RequestCommand = {
export enum OCPP16RegistrationStatus {
ACCEPTED = 'Accepted',
PENDING = 'Pending',
- REJECTED = 'Rejected',
+ REJECTED = 'Rejected'
}
export interface OCPP16BootNotificationResponse extends JsonObject {
FirmwareStatusNotification = 'FirmwareStatusNotification',
Heartbeat = 'Heartbeat',
MeterValues = 'MeterValues',
- StatusNotification = 'StatusNotification',
+ StatusNotification = 'StatusNotification'
}
export const MessageTrigger = {
export enum OCPPVersion {
VERSION_16 = '1.6',
VERSION_20 = '2.0',
- VERSION_201 = '2.0.1',
+ VERSION_201 = '2.0.1'
}
export enum OCPPProtocol {
- JSON = 'json',
+ JSON = 'json'
}
export enum CurrentType {
AC = 'AC',
- DC = 'DC',
+ DC = 'DC'
}
export enum Voltage {
VOLTAGE_110 = 110,
VOLTAGE_230 = 230,
VOLTAGE_400 = 400,
- VOLTAGE_800 = 800,
+ VOLTAGE_800 = 800
}
export enum AmpereUnits {
MILLI_AMPERE = 'mA',
CENTI_AMPERE = 'cA',
DECI_AMPERE = 'dA',
- AMPERE = 'A',
+ AMPERE = 'A'
}
export interface ConnectorStatus extends JsonObject {
export enum OCPP16AvailabilityType {
INOPERATIVE = 'Inoperative',
- OPERATIVE = 'Operative',
+ OPERATIVE = 'Operative'
}
export type AvailabilityType = OCPP16AvailabilityType
FINISHING = 'Finishing',
RESERVED = 'Reserved',
UNAVAILABLE = 'Unavailable',
- FAULTED = 'Faulted',
+ FAULTED = 'Faulted'
}
export type ChargePointStatus = OCPP16ChargePointStatus
import type { JsonObject } from './JsonType'
export enum Protocol {
- UI = 'ui',
+ UI = 'ui'
}
export enum ApplicationProtocol {
WS = 'ws',
- WSS = 'wss',
+ WSS = 'wss'
}
export enum ProtocolVersion {
- '0.0.1' = '0.0.1',
+ '0.0.1' = '0.0.1'
}
export enum AuthenticationType {
- PROTOCOL_BASIC_AUTH = 'protocol-basic-auth',
+ PROTOCOL_BASIC_AUTH = 'protocol-basic-auth'
}
export type ProtocolRequest = [
`${string}-${string}-${string}-${string}-${string}`,
ProcedureName,
- RequestPayload,
+ RequestPayload
]
export type ProtocolResponse = [
`${string}-${string}-${string}-${string}-${string}`,
- ResponsePayload,
+ ResponsePayload
]
export type ProtocolRequestHandler = (
START_AUTOMATIC_TRANSACTION_GENERATOR = 'startAutomaticTransactionGenerator',
STOP_AUTOMATIC_TRANSACTION_GENERATOR = 'stopAutomaticTransactionGenerator',
START_TRANSACTION = 'startTransaction',
- STOP_TRANSACTION = 'stopTransaction',
+ STOP_TRANSACTION = 'stopTransaction'
}
export interface RequestPayload extends JsonObject {
export enum ResponseStatus {
SUCCESS = 'success',
- FAILURE = 'failure',
+ FAILURE = 'failure'
}
export interface ResponsePayload extends JsonObject {
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.tsx"
- ],
- "exclude": ["node_modules"]
+ ]
}