@golemio/energetics
Version:
Golemio Energetics Module
32 lines • 1.65 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.PtasWebScrapingController = void 0;
const constants_1 = require("../../integration-engine/commodity-providers/constants");
const PtasWebScrapingJsonSchema_1 = require("../../schema-definitions/datasources/PtasWebScrapingJsonSchema");
const controllers_1 = require("@golemio/core/dist/input-gateway/controllers");
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
class PtasWebScrapingController extends controllers_1.BaseController {
constructor() {
super(constants_1.WORKER_NAME, new golemio_validator_1.JSONSchemaValidator("PtasWebScrapingController", PtasWebScrapingJsonSchema_1.ptasWebScrapingJsonSchema));
this.processData = async (inputData) => {
try {
await this.validator.Validate(inputData);
const queue = "input." + this.queuePrefix + ".savePtasMeasurements";
await this.sendMessageToExchange(queue, JSON.stringify(inputData), {
persistent: true,
});
}
catch (err) {
if (err instanceof golemio_errors_1.AbstractGolemioError) {
throw err;
}
else {
throw new golemio_errors_1.GeneralError("Error while validating input data.", this.name, err, 422);
}
}
};
}
}
exports.PtasWebScrapingController = PtasWebScrapingController;
//# sourceMappingURL=PtasWebScrapingController.js.map
;