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.

34 lines 1.48 kB
"use strict"; // Copyright (c) 2023 S44, LLC // Copyright Contributors to the CitrineOS Project // // SPDX-License-Identifier: Apache 2.0 Object.defineProperty(exports, "__esModule", { value: true }); exports.AsMessageEndpoint = void 0; const _1 = require("."); /** * Decorator for use in module API class to expose methods as REST OCPP message endpoints. * * @param {CallAction} action - The call action. * @param {object} bodySchema - The body schema. * @param {Record<string, any>} optionalQuerystrings - The optional querystrings. * @return {void} This function does not return anything. */ const AsMessageEndpoint = function (action, bodySchema, optionalQuerystrings) { return (target, propertyKey, descriptor) => { if (!Reflect.hasMetadata(_1.METADATA_MESSAGE_ENDPOINTS, target.constructor)) { Reflect.defineMetadata(_1.METADATA_MESSAGE_ENDPOINTS, new Array(), target.constructor); } const messageEndpoints = Reflect.getMetadata(_1.METADATA_MESSAGE_ENDPOINTS, target.constructor); messageEndpoints.push({ action: action, method: descriptor.value, methodName: propertyKey, bodySchema: bodySchema, optionalQuerystrings: optionalQuerystrings, }); Reflect.defineMetadata(_1.METADATA_MESSAGE_ENDPOINTS, messageEndpoints, target.constructor); }; }; exports.AsMessageEndpoint = AsMessageEndpoint; //# sourceMappingURL=AsMessageEndpoint.js.map