{"version":3,"sources":["webpack:///./node_modules/@abaco/activities-module/src/modules/activities-module/api/SensorXApi.ts"],"names":["SeedApi","http","this","rootPath","subjectId","url","get","res","data","results","filter","r","type","stationId","forEach","propsToDate","sensorId","startDate","endDate","params","from","to"],"mappings":"uQAIqBA,E,WAKjB,WAAYC,GAAgB,uBACxBC,KAAKD,KAAOA,EACZC,KAAKC,SAAW,mB,2GAGpB,WAAkBC,GAAlB,gGACUC,EADV,UACmBH,KAAKC,SADxB,iBACyCC,EADzC,sBAEuBF,KAAKD,KAAKK,IAA8BD,GAF/D,cAEUE,EAFV,OAEqEC,KAAKC,QAF1E,kBAIWF,EAAIG,QAAO,SAAAC,GAAC,MAAe,oBAAXA,EAAEC,SAJ7B,gD,2IAOA,WAAiBR,EAAmBS,GAApC,gGACUR,EADV,UACmBH,KAAKC,SADxB,iBACyCC,EADzC,qBAC+DS,EAD/D,qBAEuBX,KAAKD,KAAKK,IAA6BD,GAF9D,cAEUE,EAFV,OAEoEC,KAAKC,QACrEF,EAAIO,SAAQ,SAAAH,GAAC,OAAII,eAAYJ,EAAG,CAAC,YAHrC,kBAIWJ,GAJX,gD,sJAOA,WAA0BH,EAAmBS,EAAmBG,EAAkBC,EAAiBC,GAAnG,kGACUb,EADV,UACmBH,KAAKC,SADxB,iBACyCC,EADzC,qBAC+DS,EAD/D,oBACoFG,EADpF,SAEUG,EAAS,CACXC,KAAMH,EACNI,GAAIH,GAJZ,SAMuBhB,KAAKD,KAAKK,IAA8BD,EAAK,CAACc,WANrE,cAMUZ,EANV,OAM+EC,KAAKC,QAChFF,EAAIO,SAAQ,SAAAH,GAAC,OAAII,eAAYJ,EAAG,CAAC,YAPrC,kBAQWJ,GARX,gD","file":"js/chunk-2d221799.499469e8.js","sourcesContent":["import { HTTPClient, propsToDate } from '@abaco/web-common/src/HTTP';\nimport { Reading, Sensor, SensorXResult, Station } from '../models/SensorX';\n\n\nexport default class SeedApi {\n\n private http: HTTPClient;\n private rootPath: string;\n\n constructor(http: HTTPClient) {\n this.http = http;\n this.rootPath = '/sensor-x/api/v1'\n }\n\n async getStations(subjectId: number) {\n const url = `${this.rootPath}/farm/${subjectId}/stations`;\n const res = (await this.http.get>(url)).data.results;\n // res.forEach(r => propsToDate(r, [\"date\"]));\n return res.filter(r => r.type !== \"EQUIPMENT_TRACK\");\n }\n\n async getSensors(subjectId: number, stationId: string) {\n const url = `${this.rootPath}/farm/${subjectId}/stations/${stationId}/sensors`;\n const res = (await this.http.get>(url)).data.results;\n res.forEach(r => propsToDate(r, [\"date\"]));\n return res;\n }\n\n async getReadingsBySensor(subjectId: number, stationId: string, sensorId: string, startDate: Date, endDate: Date) {\n const url = `${this.rootPath}/farm/${subjectId}/stations/${stationId}/sensors/${sensorId}/data`\n const params = {\n from: startDate,\n to: endDate\n }\n const res = (await this.http.get>(url, {params})).data.results;\n res.forEach(r => propsToDate(r, [\"when\"]));\n return res;\n }\n}\n"],"sourceRoot":""}