UNPKG

typed-ocpp

Version:

A library for type-aware parsing, serialization and validation of OCPP 1.6, OCPP 2.0 and OCPP 2.1 messages

37 lines (36 loc) 7.92 kB
import type { AuthorizeRequest, BootNotificationRequest, CancelReservationRequest, ChangeAvailabilityRequest, ChangeConfigurationRequest, ClearCacheRequest, ClearChargingProfileRequest, DataTransferRequest, DiagnosticsStatusNotificationRequest, FirmwareStatusNotificationRequest, GetCompositeScheduleRequest, GetConfigurationRequest, GetDiagnosticsRequest, GetLocalListVersionRequest, HeartbeatRequest, MeterValuesRequest, RemoteStartTransactionRequest, RemoteStopTransactionRequest, ReserveNowRequest, ResetRequest, SendLocalListRequest, SetChargingProfileRequest, StartTransactionRequest, StatusNotificationRequest, StopTransactionRequest, TriggerMessageRequest, UnlockConnectorRequest, UpdateFirmwareRequest } from './types.js'; import type { AuthorizeResponse, BootNotificationResponse, CancelReservationResponse, ChangeAvailabilityResponse, ChangeConfigurationResponse, ClearCacheResponse, ClearChargingProfileResponse, DataTransferResponse, DiagnosticsStatusNotificationResponse, FirmwareStatusNotificationResponse, GetCompositeScheduleResponse, GetConfigurationResponse, GetDiagnosticsResponse, GetLocalListVersionResponse, HeartbeatResponse, MeterValuesResponse, RemoteStartTransactionResponse, RemoteStopTransactionResponse, ReserveNowResponse, ResetResponse, SendLocalListResponse, SetChargingProfileResponse, StartTransactionResponse, StatusNotificationResponse, StopTransactionResponse, TriggerMessageResponse, UnlockConnectorResponse, UpdateFirmwareResponse } from './types.js'; import type { AuthorizeCall, BootNotificationCall, CancelReservationCall, ChangeAvailabilityCall, ChangeConfigurationCall, ClearCacheCall, ClearChargingProfileCall, DataTransferCall, DiagnosticsStatusNotificationCall, FirmwareStatusNotificationCall, GetCompositeScheduleCall, GetConfigurationCall, GetDiagnosticsCall, GetLocalListVersionCall, HeartbeatCall, MeterValuesCall, RemoteStartTransactionCall, RemoteStopTransactionCall, ReserveNowCall, ResetCall, SendLocalListCall, SetChargingProfileCall, StartTransactionCall, StatusNotificationCall, StopTransactionCall, TriggerMessageCall, UnlockConnectorCall, UpdateFirmwareCall } from './call.js'; import type { AuthorizeCallResult, BootNotificationCallResult, CancelReservationCallResult, ChangeAvailabilityCallResult, ChangeConfigurationCallResult, ClearCacheCallResult, ClearChargingProfileCallResult, DataTransferCallResult, DiagnosticsStatusNotificationCallResult, FirmwareStatusNotificationCallResult, GetCompositeScheduleCallResult, GetConfigurationCallResult, GetDiagnosticsCallResult, GetLocalListVersionCallResult, HeartbeatCallResult, MeterValuesCallResult, RemoteStartTransactionCallResult, RemoteStopTransactionCallResult, ReserveNowCallResult, ResetCallResult, SendLocalListCallResult, SetChargingProfileCallResult, StartTransactionCallResult, StatusNotificationCallResult, StopTransactionCallResult, TriggerMessageCallResult, UnlockConnectorCallResult, UpdateFirmwareCallResult } from './callresult.js'; import type { Context, Measurand, Phase, Location, Unit, Format, SampledValue, MeterValue, Status } from './utils.js'; import type { Call } from './call.js'; import type { CallError } from './callerror.js'; import type { CallResult, CheckedCallResult, UncheckedCallResult } from './callresult.js'; import { type ValidateFn } from '../common/utils.js'; import * as schemas_ from './schemas.js'; import { Action as Action_, MessageType as MessageType_, ErrorCode as ErrorCode_ } from './utils.js'; import { ChargingManager as ChargingManager_ } from './chargingmanager.js'; export declare namespace OCPP16 { export type { AuthorizeCall, BootNotificationCall, CancelReservationCall, ChangeAvailabilityCall, ChangeConfigurationCall, ClearCacheCall, ClearChargingProfileCall, DataTransferCall, DiagnosticsStatusNotificationCall, FirmwareStatusNotificationCall, GetCompositeScheduleCall, GetConfigurationCall, GetDiagnosticsCall, GetLocalListVersionCall, HeartbeatCall, MeterValuesCall, RemoteStartTransactionCall, RemoteStopTransactionCall, ReserveNowCall, ResetCall, SendLocalListCall, SetChargingProfileCall, StartTransactionCall, StatusNotificationCall, StopTransactionCall, TriggerMessageCall, UnlockConnectorCall, UpdateFirmwareCall, }; export type { AuthorizeCallResult, BootNotificationCallResult, CancelReservationCallResult, ChangeAvailabilityCallResult, ChangeConfigurationCallResult, ClearCacheCallResult, ClearChargingProfileCallResult, DataTransferCallResult, DiagnosticsStatusNotificationCallResult, FirmwareStatusNotificationCallResult, GetCompositeScheduleCallResult, GetConfigurationCallResult, GetDiagnosticsCallResult, GetLocalListVersionCallResult, HeartbeatCallResult, MeterValuesCallResult, RemoteStartTransactionCallResult, RemoteStopTransactionCallResult, ReserveNowCallResult, ResetCallResult, SendLocalListCallResult, SetChargingProfileCallResult, StartTransactionCallResult, StatusNotificationCallResult, StopTransactionCallResult, TriggerMessageCallResult, UnlockConnectorCallResult, UpdateFirmwareCallResult, }; export type { AuthorizeRequest, BootNotificationRequest, CancelReservationRequest, ChangeAvailabilityRequest, ChangeConfigurationRequest, ClearCacheRequest, ClearChargingProfileRequest, DataTransferRequest, DiagnosticsStatusNotificationRequest, FirmwareStatusNotificationRequest, GetCompositeScheduleRequest, GetConfigurationRequest, GetDiagnosticsRequest, GetLocalListVersionRequest, HeartbeatRequest, MeterValuesRequest, RemoteStartTransactionRequest, RemoteStopTransactionRequest, ReserveNowRequest, ResetRequest, SendLocalListRequest, SetChargingProfileRequest, StartTransactionRequest, StatusNotificationRequest, StopTransactionRequest, TriggerMessageRequest, UnlockConnectorRequest, UpdateFirmwareRequest, }; export type { AuthorizeResponse, BootNotificationResponse, CancelReservationResponse, ChangeAvailabilityResponse, ChangeConfigurationResponse, ClearCacheResponse, ClearChargingProfileResponse, DataTransferResponse, DiagnosticsStatusNotificationResponse, FirmwareStatusNotificationResponse, GetCompositeScheduleResponse, GetConfigurationResponse, GetDiagnosticsResponse, GetLocalListVersionResponse, HeartbeatResponse, MeterValuesResponse, RemoteStartTransactionResponse, RemoteStopTransactionResponse, ReserveNowResponse, ResetResponse, SendLocalListResponse, SetChargingProfileResponse, StartTransactionResponse, StatusNotificationResponse, StopTransactionResponse, TriggerMessageResponse, UnlockConnectorResponse, UpdateFirmwareResponse, }; export type { Context, Measurand, Phase, Location, Unit, Format, SampledValue, MeterValue, Status, }; export type { Call, CallError, CallResult, CheckedCallResult, UncheckedCallResult, }; } export declare namespace OCPP16 { export import MessageType = MessageType_; export import Action = Action_; export import ErrorCode = ErrorCode_; const checkCallResult: import("./callresult.js").CheckCallResultFn; const schemas: typeof schemas_; const validateCall: ValidateFn<any, Call>; const validateCallError: ValidateFn<any, [msg_type: MessageType.CALLERROR, call_id: string, code: ErrorCode, description: string, details: Record<string, any>]>; const validateCallResult: ValidateFn<any, [msg_type: MessageType.CALLRESULT, call_id: string, payload: {}]>; class ChargingManager extends ChargingManager_ { } const validate: ValidateFn<any, OCPP16.Call | OCPP16.CallError | OCPP16.CallResult>; const isCall: <C extends OCPP16.Call | OCPP16.CallError | OCPP16.UncheckedCallResult | OCPP16.CallResult>(msg: C) => msg is Extract<C, OCPP16.Call>; const isCallError: <C extends OCPP16.Call | OCPP16.CallError | OCPP16.UncheckedCallResult | OCPP16.CallResult>(msg: C) => msg is Extract<C, OCPP16.CallError>; const isCallResult: <C extends OCPP16.Call | OCPP16.CallError | OCPP16.UncheckedCallResult | OCPP16.CallResult>(msg: C) => msg is Extract<C, OCPP16.UncheckedCallResult | OCPP16.CallResult>; }