UNPKG

@golemio/pid

Version:
35 lines 2.25 kB
"use strict"; 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; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.JISInfotextDepartureTransformation = void 0; const shared_1 = require("../../../shared"); const AbstractTransformation_1 = require("@golemio/core/dist/helpers/transformation/AbstractTransformation"); const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe"); const DisplayTypeMapper_1 = require("../helpers/DisplayTypeMapper"); let JISInfotextDepartureTransformation = class JISInfotextDepartureTransformation extends AbstractTransformation_1.AbstractTransformation { constructor() { super(...arguments); this.name = "JISInfotextDepartureTransformation"; this.transformInternal = ({ data, timeZone }) => { const stops = data.stops ?? []; return { display_type: DisplayTypeMapper_1.DisplayTypeMapper.mapInputToOutputDisplayType(data.display_type), text: data.description_text.cs, text_en: data.description_text.en ?? null, related_stops: stops.map((stop) => stop.stop_id), valid_from: shared_1.RopidRouterUtils.formatTimestamp(data.active_period_start, timeZone) ?? data.active_period_start.toISOString(), valid_to: shared_1.RopidRouterUtils.formatTimestamp(data.active_period_end, timeZone), }; }; } }; exports.JISInfotextDepartureTransformation = JISInfotextDepartureTransformation; exports.JISInfotextDepartureTransformation = JISInfotextDepartureTransformation = __decorate([ (0, tsyringe_1.injectable)() ], JISInfotextDepartureTransformation); //# sourceMappingURL=JISInfotextDepartureTransformation.js.map