@citrineos/base
Version:
The base module for OCPP v2.0.1 including all interfaces. This module is not intended to be used directly, but rather as a dependency for other modules.
225 lines • 19.7 kB
JavaScript
;
// Copyright (c) 2023 S44, LLC
// Copyright Contributors to the CitrineOS Project
//
// SPDX-License-Identifier: Apache 2.0
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Ajv = exports.AuthorizationSecurity = exports.UnauthorizedError = exports.deepDirectionalEqual = exports.notNull = exports.assert = exports.Currency = exports.Money = exports.HttpStatus = exports.HttpHeader = exports.UnauthorizedException = exports.eventGroupFromString = exports.OCPP2_0_1_CALL_RESULT_SCHEMA_MAP = exports.OCPP1_6_CALL_RESULT_SCHEMA_MAP = exports.OCPP2_0_1_CALL_SCHEMA_MAP = exports.OCPP1_6_CALL_SCHEMA_MAP = exports.LOG_LEVEL_OCPP = exports.MeterValueUtils = exports.RequestBuilder = exports.ConfigStoreFactory = exports.SignedMeterValuesConfig = exports.defineConfig = exports.BOOT_STATUS = exports.CrudRepository = exports.ChargingStationSequenceType = exports.mapToCallAction = exports.OCPPVersion = exports.OcppError = exports.MessageTypeId = exports.ErrorCode = exports.OCPP2_0_1_CallAction = exports.OCPP1_6_CallAction = exports.AsHandler = exports.AbstractModule = exports.RetryMessageError = exports.MessageState = exports.MessageOrigin = exports.Message = exports.EventGroup = exports.AbstractMessageSender = exports.AbstractMessageHandler = exports.AbstractMessageRouter = exports.CacheNamespace = exports.BadRequestError = exports.HttpMethod = exports.AsMessageEndpoint = exports.AsDataEndpoint = exports.AbstractModuleApi = void 0;
// Base Library Interfaces
var api_1 = require("./interfaces/api");
Object.defineProperty(exports, "AbstractModuleApi", { enumerable: true, get: function () { return api_1.AbstractModuleApi; } });
Object.defineProperty(exports, "AsDataEndpoint", { enumerable: true, get: function () { return api_1.AsDataEndpoint; } });
Object.defineProperty(exports, "AsMessageEndpoint", { enumerable: true, get: function () { return api_1.AsMessageEndpoint; } });
Object.defineProperty(exports, "HttpMethod", { enumerable: true, get: function () { return api_1.HttpMethod; } });
var BadRequestError_1 = require("./interfaces/api/exceptions/BadRequestError");
Object.defineProperty(exports, "BadRequestError", { enumerable: true, get: function () { return BadRequestError_1.BadRequestError; } });
var types_1 = require("./interfaces/cache/types");
Object.defineProperty(exports, "CacheNamespace", { enumerable: true, get: function () { return types_1.CacheNamespace; } });
var router_1 = require("./interfaces/router");
Object.defineProperty(exports, "AbstractMessageRouter", { enumerable: true, get: function () { return router_1.AbstractMessageRouter; } });
var messages_1 = require("./interfaces/messages");
Object.defineProperty(exports, "AbstractMessageHandler", { enumerable: true, get: function () { return messages_1.AbstractMessageHandler; } });
Object.defineProperty(exports, "AbstractMessageSender", { enumerable: true, get: function () { return messages_1.AbstractMessageSender; } });
Object.defineProperty(exports, "EventGroup", { enumerable: true, get: function () { return messages_1.EventGroup; } });
Object.defineProperty(exports, "Message", { enumerable: true, get: function () { return messages_1.Message; } });
Object.defineProperty(exports, "MessageOrigin", { enumerable: true, get: function () { return messages_1.MessageOrigin; } });
Object.defineProperty(exports, "MessageState", { enumerable: true, get: function () { return messages_1.MessageState; } });
Object.defineProperty(exports, "RetryMessageError", { enumerable: true, get: function () { return messages_1.RetryMessageError; } });
var modules_1 = require("./interfaces/modules");
Object.defineProperty(exports, "AbstractModule", { enumerable: true, get: function () { return modules_1.AbstractModule; } });
Object.defineProperty(exports, "AsHandler", { enumerable: true, get: function () { return modules_1.AsHandler; } });
var message_1 = require("./ocpp/rpc/message");
Object.defineProperty(exports, "OCPP1_6_CallAction", { enumerable: true, get: function () { return message_1.OCPP1_6_CallAction; } });
Object.defineProperty(exports, "OCPP2_0_1_CallAction", { enumerable: true, get: function () { return message_1.OCPP2_0_1_CallAction; } });
Object.defineProperty(exports, "ErrorCode", { enumerable: true, get: function () { return message_1.ErrorCode; } });
Object.defineProperty(exports, "MessageTypeId", { enumerable: true, get: function () { return message_1.MessageTypeId; } });
Object.defineProperty(exports, "OcppError", { enumerable: true, get: function () { return message_1.OcppError; } });
Object.defineProperty(exports, "OCPPVersion", { enumerable: true, get: function () { return message_1.OCPPVersion; } });
Object.defineProperty(exports, "mapToCallAction", { enumerable: true, get: function () { return message_1.mapToCallAction; } });
var requestIds_1 = require("./ocpp/model/requestIds");
Object.defineProperty(exports, "ChargingStationSequenceType", { enumerable: true, get: function () { return requestIds_1.ChargingStationSequenceType; } });
// Persistence Interfaces
var repository_1 = require("./interfaces/repository");
Object.defineProperty(exports, "CrudRepository", { enumerable: true, get: function () { return repository_1.CrudRepository; } });
__exportStar(require("./ocpp/persistence"), exports);
// Configuration Types
var BootConfig_1 = require("./config/BootConfig");
Object.defineProperty(exports, "BOOT_STATUS", { enumerable: true, get: function () { return BootConfig_1.BOOT_STATUS; } });
var defineConfig_1 = require("./config/defineConfig");
Object.defineProperty(exports, "defineConfig", { enumerable: true, get: function () { return defineConfig_1.defineConfig; } });
var signedMeterValuesConfig_1 = require("./config/signedMeterValuesConfig");
Object.defineProperty(exports, "SignedMeterValuesConfig", { enumerable: true, get: function () { return signedMeterValuesConfig_1.SignedMeterValuesConfig; } });
var ConfigStore_1 = require("./config/ConfigStore");
Object.defineProperty(exports, "ConfigStoreFactory", { enumerable: true, get: function () { return ConfigStore_1.ConfigStoreFactory; } });
// Utils
var request_1 = require("./util/request");
Object.defineProperty(exports, "RequestBuilder", { enumerable: true, get: function () { return request_1.RequestBuilder; } });
var MeterValueUtils_1 = require("./util/MeterValueUtils");
Object.defineProperty(exports, "MeterValueUtils", { enumerable: true, get: function () { return MeterValueUtils_1.MeterValueUtils; } });
exports.LOG_LEVEL_OCPP = 10;
// OCPP 2.0.1 Interfaces
__exportStar(require("./ocpp/model"), exports);
const index_1 = require("./ocpp/model/index");
const message_2 = require("./ocpp/rpc/message");
const ajv_1 = __importDefault(require("ajv"));
exports.Ajv = ajv_1.default;
exports.OCPP1_6_CALL_SCHEMA_MAP = new Map([
[message_2.OCPP1_6_CallAction.Authorize, index_1.OCPP1_6.AuthorizeRequestSchema],
[message_2.OCPP1_6_CallAction.BootNotification, index_1.OCPP1_6.BootNotificationRequestSchema],
[message_2.OCPP1_6_CallAction.DataTransfer, index_1.OCPP1_6.DataTransferRequestSchema],
[
message_2.OCPP1_6_CallAction.DiagnosticsStatusNotification,
index_1.OCPP1_6.DiagnosticsStatusNotificationRequestSchema,
],
[
message_2.OCPP1_6_CallAction.FirmwareStatusNotification,
index_1.OCPP1_6.FirmwareStatusNotificationRequestSchema,
],
[message_2.OCPP1_6_CallAction.Heartbeat, index_1.OCPP1_6.HeartbeatRequestSchema],
[message_2.OCPP1_6_CallAction.MeterValues, index_1.OCPP1_6.MeterValuesRequestSchema],
[message_2.OCPP1_6_CallAction.StartTransaction, index_1.OCPP1_6.StartTransactionRequestSchema],
[message_2.OCPP1_6_CallAction.StatusNotification, index_1.OCPP1_6.StatusNotificationRequestSchema],
[message_2.OCPP1_6_CallAction.StopTransaction, index_1.OCPP1_6.StopTransactionRequestSchema],
]);
exports.OCPP2_0_1_CALL_SCHEMA_MAP = new Map([
[message_2.OCPP2_0_1_CallAction.Authorize, index_1.OCPP2_0_1.AuthorizeRequestSchema],
[message_2.OCPP2_0_1_CallAction.BootNotification, index_1.OCPP2_0_1.BootNotificationRequestSchema],
[message_2.OCPP2_0_1_CallAction.ClearedChargingLimit, index_1.OCPP2_0_1.ClearedChargingLimitRequestSchema],
[message_2.OCPP2_0_1_CallAction.DataTransfer, index_1.OCPP2_0_1.DataTransferRequestSchema],
[
message_2.OCPP2_0_1_CallAction.FirmwareStatusNotification,
index_1.OCPP2_0_1.FirmwareStatusNotificationRequestSchema,
],
[message_2.OCPP2_0_1_CallAction.Get15118EVCertificate, index_1.OCPP2_0_1.Get15118EVCertificateRequestSchema],
[message_2.OCPP2_0_1_CallAction.GetCertificateStatus, index_1.OCPP2_0_1.GetCertificateStatusRequestSchema],
[message_2.OCPP2_0_1_CallAction.Heartbeat, index_1.OCPP2_0_1.HeartbeatRequestSchema],
[message_2.OCPP2_0_1_CallAction.LogStatusNotification, index_1.OCPP2_0_1.LogStatusNotificationRequestSchema],
[message_2.OCPP2_0_1_CallAction.MeterValues, index_1.OCPP2_0_1.MeterValuesRequestSchema],
[message_2.OCPP2_0_1_CallAction.NotifyChargingLimit, index_1.OCPP2_0_1.NotifyChargingLimitRequestSchema],
[
message_2.OCPP2_0_1_CallAction.NotifyCustomerInformation,
index_1.OCPP2_0_1.NotifyCustomerInformationRequestSchema,
],
[message_2.OCPP2_0_1_CallAction.NotifyDisplayMessages, index_1.OCPP2_0_1.NotifyDisplayMessagesRequestSchema],
[message_2.OCPP2_0_1_CallAction.NotifyEVChargingNeeds, index_1.OCPP2_0_1.NotifyEVChargingNeedsRequestSchema],
[message_2.OCPP2_0_1_CallAction.NotifyEVChargingSchedule, index_1.OCPP2_0_1.NotifyEVChargingScheduleRequestSchema],
[message_2.OCPP2_0_1_CallAction.NotifyEvent, index_1.OCPP2_0_1.NotifyEventRequestSchema],
[message_2.OCPP2_0_1_CallAction.NotifyMonitoringReport, index_1.OCPP2_0_1.NotifyMonitoringReportRequestSchema],
[message_2.OCPP2_0_1_CallAction.NotifyReport, index_1.OCPP2_0_1.NotifyReportRequestSchema],
[
message_2.OCPP2_0_1_CallAction.PublishFirmwareStatusNotification,
index_1.OCPP2_0_1.PublishFirmwareStatusNotificationRequestSchema,
],
[message_2.OCPP2_0_1_CallAction.ReportChargingProfiles, index_1.OCPP2_0_1.ReportChargingProfilesRequestSchema],
[message_2.OCPP2_0_1_CallAction.ReservationStatusUpdate, index_1.OCPP2_0_1.ReservationStatusUpdateRequestSchema],
[
message_2.OCPP2_0_1_CallAction.SecurityEventNotification,
index_1.OCPP2_0_1.SecurityEventNotificationRequestSchema,
],
[message_2.OCPP2_0_1_CallAction.SignCertificate, index_1.OCPP2_0_1.SignCertificateRequestSchema],
[message_2.OCPP2_0_1_CallAction.StatusNotification, index_1.OCPP2_0_1.StatusNotificationRequestSchema],
[message_2.OCPP2_0_1_CallAction.TransactionEvent, index_1.OCPP2_0_1.TransactionEventRequestSchema],
]);
exports.OCPP1_6_CALL_RESULT_SCHEMA_MAP = new Map([
[message_2.OCPP1_6_CallAction.CancelReservation, index_1.OCPP1_6.CancelReservationResponseSchema],
[message_2.OCPP1_6_CallAction.ChangeAvailability, index_1.OCPP1_6.ChangeAvailabilityResponseSchema],
[message_2.OCPP1_6_CallAction.ChangeConfiguration, index_1.OCPP1_6.ChangeConfigurationResponseSchema],
[message_2.OCPP1_6_CallAction.ClearCache, index_1.OCPP1_6.ClearCacheResponseSchema],
[message_2.OCPP1_6_CallAction.ClearChargingProfile, index_1.OCPP1_6.ClearChargingProfileResponseSchema],
[message_2.OCPP1_6_CallAction.DataTransfer, index_1.OCPP1_6.DataTransferResponseSchema],
[message_2.OCPP1_6_CallAction.GetCompositeSchedule, index_1.OCPP1_6.GetCompositeScheduleResponseSchema],
[message_2.OCPP1_6_CallAction.GetConfiguration, index_1.OCPP1_6.GetConfigurationResponseSchema],
[message_2.OCPP1_6_CallAction.GetDiagnostics, index_1.OCPP1_6.GetDiagnosticsResponseSchema],
[message_2.OCPP1_6_CallAction.GetLocalListVersion, index_1.OCPP1_6.GetLocalListVersionResponseSchema],
[message_2.OCPP1_6_CallAction.RemoteStartTransaction, index_1.OCPP1_6.RemoteStartTransactionResponseSchema],
[message_2.OCPP1_6_CallAction.RemoteStopTransaction, index_1.OCPP1_6.RemoteStopTransactionResponseSchema],
[message_2.OCPP1_6_CallAction.ReserveNow, index_1.OCPP1_6.ReserveNowResponseSchema],
[message_2.OCPP1_6_CallAction.Reset, index_1.OCPP1_6.ResetResponseSchema],
[message_2.OCPP1_6_CallAction.SendLocalList, index_1.OCPP1_6.SendLocalListResponseSchema],
[message_2.OCPP1_6_CallAction.SetChargingProfile, index_1.OCPP1_6.SetChargingProfileResponseSchema],
[message_2.OCPP1_6_CallAction.TriggerMessage, index_1.OCPP1_6.TriggerMessageResponseSchema],
[message_2.OCPP1_6_CallAction.UnlockConnector, index_1.OCPP1_6.UnlockConnectorResponseSchema],
[message_2.OCPP1_6_CallAction.UpdateFirmware, index_1.OCPP1_6.UpdateFirmwareResponseSchema],
]);
exports.OCPP2_0_1_CALL_RESULT_SCHEMA_MAP = new Map([
[message_2.OCPP2_0_1_CallAction.CancelReservation, index_1.OCPP2_0_1.CancelReservationResponseSchema],
[message_2.OCPP2_0_1_CallAction.CertificateSigned, index_1.OCPP2_0_1.CertificateSignedResponseSchema],
[message_2.OCPP2_0_1_CallAction.ChangeAvailability, index_1.OCPP2_0_1.ChangeAvailabilityResponseSchema],
[message_2.OCPP2_0_1_CallAction.ClearCache, index_1.OCPP2_0_1.ClearCacheResponseSchema],
[message_2.OCPP2_0_1_CallAction.ClearChargingProfile, index_1.OCPP2_0_1.ClearChargingProfileResponseSchema],
[message_2.OCPP2_0_1_CallAction.ClearDisplayMessage, index_1.OCPP2_0_1.ClearDisplayMessageResponseSchema],
[message_2.OCPP2_0_1_CallAction.ClearVariableMonitoring, index_1.OCPP2_0_1.ClearVariableMonitoringResponseSchema],
[message_2.OCPP2_0_1_CallAction.CustomerInformation, index_1.OCPP2_0_1.CustomerInformationResponseSchema],
[message_2.OCPP2_0_1_CallAction.CostUpdated, index_1.OCPP2_0_1.CostUpdatedResponseSchema],
[message_2.OCPP2_0_1_CallAction.DataTransfer, index_1.OCPP2_0_1.DataTransferResponseSchema],
[message_2.OCPP2_0_1_CallAction.DeleteCertificate, index_1.OCPP2_0_1.DeleteCertificateResponseSchema],
[message_2.OCPP2_0_1_CallAction.GetBaseReport, index_1.OCPP2_0_1.GetBaseReportResponseSchema],
[message_2.OCPP2_0_1_CallAction.GetChargingProfiles, index_1.OCPP2_0_1.GetChargingProfilesResponseSchema],
[message_2.OCPP2_0_1_CallAction.GetCompositeSchedule, index_1.OCPP2_0_1.GetCompositeScheduleResponseSchema],
[message_2.OCPP2_0_1_CallAction.GetLocalListVersion, index_1.OCPP2_0_1.GetLocalListVersionResponseSchema],
[message_2.OCPP2_0_1_CallAction.GetLog, index_1.OCPP2_0_1.GetLogResponseSchema],
[message_2.OCPP2_0_1_CallAction.GetMonitoringReport, index_1.OCPP2_0_1.GetMonitoringReportResponseSchema],
[message_2.OCPP2_0_1_CallAction.GetReport, index_1.OCPP2_0_1.GetReportResponseSchema],
[message_2.OCPP2_0_1_CallAction.GetTransactionStatus, index_1.OCPP2_0_1.GetTransactionStatusResponseSchema],
[message_2.OCPP2_0_1_CallAction.InstallCertificate, index_1.OCPP2_0_1.InstallCertificateResponseSchema],
[message_2.OCPP2_0_1_CallAction.GetCertificateStatus, index_1.OCPP2_0_1.GetCertificateStatusRequestSchema],
[
message_2.OCPP2_0_1_CallAction.GetInstalledCertificateIds,
index_1.OCPP2_0_1.GetInstalledCertificateIdsResponseSchema,
],
[message_2.OCPP2_0_1_CallAction.GetVariables, index_1.OCPP2_0_1.GetVariablesResponseSchema],
[message_2.OCPP2_0_1_CallAction.RequestStartTransaction, index_1.OCPP2_0_1.RequestStartTransactionResponseSchema],
[message_2.OCPP2_0_1_CallAction.RequestStopTransaction, index_1.OCPP2_0_1.RequestStopTransactionResponseSchema],
[message_2.OCPP2_0_1_CallAction.ReserveNow, index_1.OCPP2_0_1.ReserveNowResponseSchema],
[message_2.OCPP2_0_1_CallAction.Reset, index_1.OCPP2_0_1.ResetResponseSchema],
[message_2.OCPP2_0_1_CallAction.SendLocalList, index_1.OCPP2_0_1.SendLocalListResponseSchema],
[message_2.OCPP2_0_1_CallAction.SetChargingProfile, index_1.OCPP2_0_1.SetChargingProfileResponseSchema],
[message_2.OCPP2_0_1_CallAction.SetDisplayMessage, index_1.OCPP2_0_1.SetDisplayMessageResponseSchema],
[message_2.OCPP2_0_1_CallAction.SetMonitoringBase, index_1.OCPP2_0_1.SetMonitoringBaseResponseSchema],
[message_2.OCPP2_0_1_CallAction.SetMonitoringLevel, index_1.OCPP2_0_1.SetMonitoringLevelResponseSchema],
[message_2.OCPP2_0_1_CallAction.SetNetworkProfile, index_1.OCPP2_0_1.SetNetworkProfileResponseSchema],
[message_2.OCPP2_0_1_CallAction.SetVariableMonitoring, index_1.OCPP2_0_1.SetVariableMonitoringResponseSchema],
[message_2.OCPP2_0_1_CallAction.SetVariables, index_1.OCPP2_0_1.SetVariablesResponseSchema],
[message_2.OCPP2_0_1_CallAction.TriggerMessage, index_1.OCPP2_0_1.TriggerMessageResponseSchema],
[message_2.OCPP2_0_1_CallAction.UnlockConnector, index_1.OCPP2_0_1.UnlockConnectorResponseSchema],
[message_2.OCPP2_0_1_CallAction.UnpublishFirmware, index_1.OCPP2_0_1.UnpublishFirmwareResponseSchema],
[message_2.OCPP2_0_1_CallAction.UpdateFirmware, index_1.OCPP2_0_1.UpdateFirmwareResponseSchema],
]);
var messages_2 = require("./interfaces/messages");
Object.defineProperty(exports, "eventGroupFromString", { enumerable: true, get: function () { return messages_2.eventGroupFromString; } });
var unauthorized_exception_1 = require("./interfaces/api/exceptions/unauthorized.exception");
Object.defineProperty(exports, "UnauthorizedException", { enumerable: true, get: function () { return unauthorized_exception_1.UnauthorizedException; } });
var http_header_1 = require("./interfaces/api/http.header");
Object.defineProperty(exports, "HttpHeader", { enumerable: true, get: function () { return http_header_1.HttpHeader; } });
var http_status_1 = require("./interfaces/api/http.status");
Object.defineProperty(exports, "HttpStatus", { enumerable: true, get: function () { return http_status_1.HttpStatus; } });
var Money_1 = require("./money/Money");
Object.defineProperty(exports, "Money", { enumerable: true, get: function () { return Money_1.Money; } });
var Currency_1 = require("./money/Currency");
Object.defineProperty(exports, "Currency", { enumerable: true, get: function () { return Currency_1.Currency; } });
var assertion_1 = require("./assertion/assertion");
Object.defineProperty(exports, "assert", { enumerable: true, get: function () { return assertion_1.assert; } });
Object.defineProperty(exports, "notNull", { enumerable: true, get: function () { return assertion_1.notNull; } });
Object.defineProperty(exports, "deepDirectionalEqual", { enumerable: true, get: function () { return assertion_1.deepDirectionalEqual; } });
var UnauthorizedError_1 = require("./interfaces/api/exception/UnauthorizedError");
Object.defineProperty(exports, "UnauthorizedError", { enumerable: true, get: function () { return UnauthorizedError_1.UnauthorizedError; } });
var AuthorizationSecurity_1 = require("./interfaces/api/AuthorizationSecurity");
Object.defineProperty(exports, "AuthorizationSecurity", { enumerable: true, get: function () { return AuthorizationSecurity_1.AuthorizationSecurity; } });
//# sourceMappingURL=index.js.map