UNPKG

@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.

66 lines 3.92 kB
"use strict"; // Copyright (c) 2023 S44, LLC // Copyright Contributors to the CitrineOS Project // // SPDX-License-Identifier: Apache 2.0 var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.MessageConfirmationSchema = exports.UpdateChargingStationPasswordSchema = exports.SetVariableResultTypeSchema = exports.ReportDataTypeSchema = exports.ChargingStationTypeSchema = exports.BootConfigSchema = exports.AuthorizationDataSchema = exports.Namespace = exports.OCPP1_6_Namespace = exports.OCPP2_0_1_Namespace = void 0; exports.QuerySchema = QuerySchema; var namespace_1 = require("./namespace"); Object.defineProperty(exports, "OCPP2_0_1_Namespace", { enumerable: true, get: function () { return namespace_1.OCPP2_0_1_Namespace; } }); Object.defineProperty(exports, "OCPP1_6_Namespace", { enumerable: true, get: function () { return namespace_1.OCPP1_6_Namespace; } }); Object.defineProperty(exports, "Namespace", { enumerable: true, get: function () { return namespace_1.Namespace; } }); var AuthorizationDataSchema_json_1 = require("./schemas/AuthorizationDataSchema.json"); Object.defineProperty(exports, "AuthorizationDataSchema", { enumerable: true, get: function () { return __importDefault(AuthorizationDataSchema_json_1).default; } }); var BootConfigSchema_json_1 = require("./schemas/BootConfigSchema.json"); Object.defineProperty(exports, "BootConfigSchema", { enumerable: true, get: function () { return __importDefault(BootConfigSchema_json_1).default; } }); var ChargingStationTypeSchema_json_1 = require("./schemas/ChargingStationTypeSchema.json"); Object.defineProperty(exports, "ChargingStationTypeSchema", { enumerable: true, get: function () { return __importDefault(ChargingStationTypeSchema_json_1).default; } }); var ReportDataTypeSchema_json_1 = require("./schemas/ReportDataTypeSchema.json"); Object.defineProperty(exports, "ReportDataTypeSchema", { enumerable: true, get: function () { return __importDefault(ReportDataTypeSchema_json_1).default; } }); var SetVariableResultTypeSchema_json_1 = require("./schemas/SetVariableResultTypeSchema.json"); Object.defineProperty(exports, "SetVariableResultTypeSchema", { enumerable: true, get: function () { return __importDefault(SetVariableResultTypeSchema_json_1).default; } }); var UpdateChargingStationPasswordRequestSchema_json_1 = require("./schemas/UpdateChargingStationPasswordRequestSchema.json"); Object.defineProperty(exports, "UpdateChargingStationPasswordSchema", { enumerable: true, get: function () { return __importDefault(UpdateChargingStationPasswordRequestSchema_json_1).default; } }); /** * Utility function for creating querystring schemas for fastify route definitions * @param name - The name of the schema * @param properties An array of key-type pairs. Types ending in '[]' will be treated as arrays of that type. * @param required An array of required keys. * @returns */ function QuerySchema(name, properties, required) { const schema = { $id: name, type: 'object', properties: {}, }; properties.forEach((property) => { const [key, type] = property; // '[]' denotes an array if (type.endsWith('[]')) { schema['properties'][key] = { type: 'array', items: { type: type.slice(0, -2) }, // Remove '[]' to get the base type }; } else { // non-array types schema['properties'][key] = { type, }; } }); if (required) { schema['required'] = required; } return schema; } exports.MessageConfirmationSchema = QuerySchema('MessageConfirmationSchema', [ ['success', 'boolean'], ['payload', 'string'], ], ['success']); //# sourceMappingURL=index.js.map