@citrineos/reporting
Version:
The reporting module for OCPP v2.0.1. This module is not intended to be used directly, but rather as a dependency for other modules.
52 lines • 2.72 kB
JavaScript
// SPDX-FileCopyrightText: 2025 Contributors to the CitrineOS Project
//
// SPDX-License-Identifier: Apache-2.0
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Logger } from 'tslog';
import { AbstractModuleApi, AsMessageEndpoint, DEFAULT_TENANT_ID, OCPP1_6, OCPP1_6_CallAction, OCPPVersion, } from '@citrineos/base';
import { ReportingModule } from '../module.js';
/**
* Server API for the Reporting module (OCPP 1.6).
*/
export class ReportingOcpp16Api extends AbstractModuleApi {
/**
* Constructs a new instance of the class.
*
* @param {ReportingModule} reportingModule - The Reporting module.
* @param {FastifyInstance} server - The Fastify server instance.
* @param {Logger<ILogObj>} [logger] - The logger instance.
*/
constructor(reportingModule, server, logger) {
super(reportingModule, server, OCPPVersion.OCPP1_6, logger);
}
getDiagnostics(identifier, request, callbackUrl, tenantId = DEFAULT_TENANT_ID) {
const results = identifier.map((id) => this._module.sendCall(id, tenantId, OCPPVersion.OCPP1_6, OCPP1_6_CallAction.GetDiagnostics, request, callbackUrl));
return Promise.all(results);
}
/**
* Overrides superclass method to generate the URL path based on the input {@link CallAction}
* and the module's endpoint prefix configuration.
*
* @param {CallAction} input - The input {@link CallAction}.
* @return {string} - The generated URL path.
*/
_toMessagePath(input) {
const endpointPrefix = this._module.config.modules.reporting.endpointPrefix;
return super._toMessagePath(input, endpointPrefix);
}
}
__decorate([
AsMessageEndpoint(OCPP1_6_CallAction.GetDiagnostics, OCPP1_6.GetDiagnosticsRequestSchema),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Array, Object, String, Number]),
__metadata("design:returntype", Promise)
], ReportingOcpp16Api.prototype, "getDiagnostics", null);
//# sourceMappingURL=MessageApi.js.map