@sjvair/monitor-map 2.1.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{a8 as n}from"../sjvairMonitorMap.js";const t=new n(new function(n){return new Worker("/static/monitor-map/assets/EVWorker-DUQOiwdE.js",{type:"module",name:n?.name})});async function r(){return await t.run("fetchLvl2Stations")}async function a(){return await t.run("fetchLvl3Stations")}export{r as fetchLvl2Stations,a as fetchLvl3Stations};
1
+ import{a7 as n}from"../sjvairMonitorMap.js";const t=new n(new function(n){return new Worker("/static/monitor-map/assets/EVWorker-DUQOiwdE.js",{type:"module",name:n?.name})});async function r(){return await t.run("fetchLvl2Stations")}async function a(){return await t.run("fetchLvl3Stations")}export{r as fetchLvl2Stations,a as fetchLvl3Stations};
@@ -0,0 +1 @@
1
+ class e{id;error;success;payload;constructor(e){this.id=e}pass(e){this.success=!0,this.payload=e}fail(e){this.success=!1,this.error=e}}function s(){return new URL(`https://www.sjvair.com/api/2.0/${"calibrations"}/`)}async function t(){const e=s();return await async function(e,s){return await fetch(e,s).then(async s=>{const t=await s.json().catch(t=>{throw new Error(`Request to endpoint "${e.href}" failed`,{cause:s})});return{headers:s.headers,body:t,ok:s.ok,redirected:s.redirected,status:s.status,statusText:s.statusText,url:s.url}})}(e)}function a(e){const{data:s}=e.body;return Array.isArray(s)&&s.length?s:[]}var r=Object.freeze({__proto__:null,fetchCalibrators:async function(){return await async function(){return await t().then(a)}()}});new class{serviceModule;serviceModuleName;constructor(s,t){this.serviceModule=t,this.serviceModuleName=s,self.addEventListener("message",async s=>{const{id:t,taskName:a,parameters:r}=s.data;this.serviceModule[a];const n=new e(t);a in this.serviceModule?await this.serviceModule[a](...r).then(e=>n.pass(e)).catch(e=>n.fail(e.message)):n.fail(`Background task "${String(a)}" not found in "${this.serviceModuleName}" controller`),self.postMessage(n)})}}("CalibratorsService",r);