1 import type { JsonObject
} from
'./JsonType.js'
2 import type { BroadcastChannelResponsePayload
} from
'./WorkerBroadcastChannel.js'
8 export enum ApplicationProtocol
{
13 export enum AuthenticationType
{
14 BASIC_AUTH
= 'basic-auth',
15 PROTOCOL_BASIC_AUTH
= 'protocol-basic-auth'
18 export enum ProtocolVersion
{
22 export type ProtocolRequest
= [string, ProcedureName
, RequestPayload
]
23 export type ProtocolResponse
= [string, ResponsePayload
]
25 export type ProtocolRequestHandler
= (
27 procedureName
?: ProcedureName
,
28 payload
?: RequestPayload
29 ) => undefined | Promise
<undefined> | ResponsePayload
| Promise
<ResponsePayload
>
31 export enum ProcedureName
{
32 SIMULATOR_STATE
= 'simulatorState',
33 START_SIMULATOR
= 'startSimulator',
34 STOP_SIMULATOR
= 'stopSimulator',
35 LIST_TEMPLATES
= 'listTemplates',
36 LIST_CHARGING_STATIONS
= 'listChargingStations',
37 ADD_CHARGING_STATIONS
= 'addChargingStations',
38 DELETE_CHARGING_STATIONS
= 'deleteChargingStations',
39 PERFORMANCE_STATISTICS
= 'performanceStatistics',
40 START_CHARGING_STATION
= 'startChargingStation',
41 STOP_CHARGING_STATION
= 'stopChargingStation',
42 OPEN_CONNECTION
= 'openConnection',
43 CLOSE_CONNECTION
= 'closeConnection',
44 START_AUTOMATIC_TRANSACTION_GENERATOR
= 'startAutomaticTransactionGenerator',
45 STOP_AUTOMATIC_TRANSACTION_GENERATOR
= 'stopAutomaticTransactionGenerator',
46 SET_SUPERVISION_URL
= 'setSupervisionUrl',
47 START_TRANSACTION
= 'startTransaction',
48 STOP_TRANSACTION
= 'stopTransaction',
49 AUTHORIZE
= 'authorize',
50 BOOT_NOTIFICATION
= 'bootNotification',
51 STATUS_NOTIFICATION
= 'statusNotification',
52 HEARTBEAT
= 'heartbeat',
53 METER_VALUES
= 'meterValues',
54 DATA_TRANSFER
= 'dataTransfer',
55 DIAGNOSTICS_STATUS_NOTIFICATION
= 'diagnosticsStatusNotification',
56 FIRMWARE_STATUS_NOTIFICATION
= 'firmwareStatusNotification'
59 export interface RequestPayload
extends JsonObject
{
61 connectorIds
?: number[]
64 export enum ResponseStatus
{
69 export interface ResponsePayload
extends JsonObject
{
70 status: ResponseStatus
71 hashIdsSucceeded
?: string[]
72 hashIdsFailed
?: string[]
73 responsesFailed
?: BroadcastChannelResponsePayload
[]
76 export interface TemplateStatistics
extends JsonObject
{
83 export interface SimulatorState
extends JsonObject
{
86 templateStatistics
: Record
<string, TemplateStatistics
>