UNPKG

@golemio/parkings

Version:
42 lines 3.13 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; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.IptOictDataSource = void 0; const IptOictFeatureCollectionSchemaGenerator_1 = require("../../../schema-definitions/datasources/iptoict/IptOictFeatureCollectionSchemaGenerator"); const integration_engine_1 = require("@golemio/core/dist/integration-engine"); const HTTPRequestProtocolStrategyStreamed_1 = require("@golemio/core/dist/integration-engine/datasources/protocol-strategy/HTTPRequestProtocolStrategyStreamed"); const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator"); const tsyringe_1 = require("@golemio/core/dist/shared/tsyringe"); const JSONStream_1 = __importDefault(require("JSONStream")); let IptOictDataSource = exports.IptOictDataSource = class IptOictDataSource { getParkingDataStream(sourceUrl) { return new integration_engine_1.DataSourceStreamed("IptOictParkingDataSource", new HTTPRequestProtocolStrategyStreamed_1.HTTPRequestProtocolStrategyStreamed({ method: "GET", url: sourceUrl, headers: { "Content-Type": "application/json; charset=utf-8", }, }).setStreamTransformer(JSONStream_1.default.parse("features.*")), new integration_engine_1.JSONDataTypeStrategy({ resultsPath: "" }), new golemio_validator_1.JSONSchemaValidator("IptOictParkingDataSourceValidator", IptOictFeatureCollectionSchemaGenerator_1.IptOictFeatureCollectionSchemaGenerator.getParkingSchema().properties.features)); } getParkingLocationDataStream(sourceUrl) { return new integration_engine_1.DataSourceStreamed("IptOictParkingLocationDataSource", new HTTPRequestProtocolStrategyStreamed_1.HTTPRequestProtocolStrategyStreamed({ method: "GET", url: sourceUrl, headers: { "Content-Type": "application/json; charset=utf-8", }, }).setStreamTransformer(JSONStream_1.default.parse("features.*")), new integration_engine_1.JSONDataTypeStrategy({ resultsPath: "" }), new golemio_validator_1.JSONSchemaValidator("IptOictParkingDataSourceSourceValidator", IptOictFeatureCollectionSchemaGenerator_1.IptOictFeatureCollectionSchemaGenerator.getParkingSpacesSchema().properties.features)); } }; exports.IptOictDataSource = IptOictDataSource = __decorate([ (0, tsyringe_1.injectable)() ], IptOictDataSource); //# sourceMappingURL=IptOictDataSource.js.map