atriusmaps-node-sdk 3.3.945 → 3.3.946

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = "3.3.945";
5
+ var version = "3.3.946";
6
6
  var pkg = {
7
7
  version: version};
8
8
 
@@ -92,7 +92,7 @@ function create(app, config = {}) {
92
92
  }
93
93
  if (Object.keys(updates).length > 0) {
94
94
  app.bus.send("poi/setCoreAttributes", updates);
95
- const originalNames = await getPoiOriginalNames(Object.keys(updates));
95
+ const originalNames = await getPoiNameMap(Object.keys(updates), (poi) => poi.staticName ?? poi.name);
96
96
  app.bus.send("map/mutateFeature", {
97
97
  functor: processors.mutatePoiName(T, updates, originalNames)
98
98
  });
@@ -102,22 +102,12 @@ function create(app, config = {}) {
102
102
  const idValuesMap = processors.processParkingPOIS(poiMap);
103
103
  app.bus.send("poi/setDynamicData", { plugin: "parking", idValuesMap });
104
104
  }
105
- const getPOILabels = async (idArray) => {
105
+ const getPoiNameMap = async (idArray, selector = (poi) => poi.name) => {
106
106
  const nameMap = {};
107
107
  for (const poiId of idArray) {
108
108
  const poi = await app.bus.get("poi/getById", { id: poiId });
109
109
  if (poi) {
110
- nameMap[poiId] = poi.name;
111
- }
112
- }
113
- return nameMap;
114
- };
115
- const getPoiOriginalNames = async (idArray) => {
116
- const nameMap = {};
117
- for (const poiId of idArray) {
118
- const poi = await app.bus.get("poi/getById", { id: poiId });
119
- if (poi) {
120
- nameMap[poiId] = poi.staticName ?? poi.name;
110
+ nameMap[poiId] = selector(poi);
121
111
  }
122
112
  }
123
113
  return nameMap;
@@ -125,7 +115,7 @@ function create(app, config = {}) {
125
115
  async function processSecurityWaitTimes(poiMap) {
126
116
  const idValuesMap = processors.processSecurityWaitTimes(poiMap);
127
117
  app.bus.send("poi/setDynamicData", { plugin: "security", idValuesMap });
128
- const labels = await getPOILabels(Object.keys(idValuesMap));
118
+ const labels = await getPoiNameMap(Object.keys(idValuesMap));
129
119
  app.bus.send("map/mutateFeature", {
130
120
  functor: processors.mutateSecurityCheckpointLabel(T, idValuesMap, labels)
131
121
  });
@@ -1 +1 @@
1
- var a="3.3.945",e={version:a};export{e as default,a as version};
1
+ var a="3.3.946",e={version:a};export{e as default,a as version};
@@ -1 +1 @@
1
- import t from"zousan";import{processParkingPOIS as e,processOpenClosedPois as n,processSecurityWaitTimes as a,mutateSecurityCheckpointLabel as s,processRoutingPois as o,mutatePoiName as i}from"./processors.js";let c=3e4;const r="x-account-id";function u(u,y={}){const l={dynamicDataNotPending:new t},d=u.gt();y._overrideRefreshFrequency&&(c=y._overrideRefreshFrequency);const m=new Map;u.bus.on("system/readywhenyouare",()=>l.dynamicDataNotPending),u.bus.on("dynamicPois/getSecurityWaitTimes",async({isOpen:t}={})=>{const e=await u.bus.get("poi/getAll");return Object.values(e).filter(e=>{return"security.checkpoint"===e.category&&e?.dynamicData?.security&&(n=e?.dynamicData?.security,"object"==typeof n&&null!==n&&!Array.isArray(n))&&(void 0===t||e?.dynamicData?.security?.isTemporarilyClosed!==t);var n}).map(t=>({id:t.poiId,name:t.name,...t.dynamicData.security}))});const p=async t=>{const e={};for(const n of t){const t=await u.bus.get("poi/getById",{id:n});t&&(e[n]=t.name)}return e},f=async t=>{const e={};for(const n of t){const t=await u.bus.get("poi/getById",{id:n});t&&(e[n]=t.staticName??t.name)}return e};return{init:async()=>{const[t,y]=await Promise.all([u.bus.get("venueData/getAccountId"),u.bus.get("venueData/getVenueId")]),g=`https://marketplace.locuslabs.com/venueId/${y}/dynamic-poi`;let b,D=0,h=0;const v=async()=>{const c=await fetch(g,{headers:{[r]:t}});if(c.ok)return c.json().then(({data:t})=>async function(t){(function(t){const n=e(t);u.bus.send("poi/setDynamicData",{plugin:"parking",idValuesMap:n})})(t),function(t){const e=n(t);u.bus.send("poi/setDynamicData",{plugin:"open-closed-status",idValuesMap:e})}(t),async function(t){const e=a(t);u.bus.send("poi/setDynamicData",{plugin:"security",idValuesMap:e});const n=await p(Object.keys(e));u.bus.send("map/mutateFeature",{functor:s(d,e,n)})}(t),async function(t){const e=await o(t);u.bus.send("poi/setDynamicRouting",{plugin:"routing",idValuesMap:e})}(t),async function(t){const e={};for(const[n,a]of Object.entries(t)){const t=a?.dynamicData?.poiAttributes?.name??null,s=m.get(n);void 0===s?null!==t&&(e[n]={name:t},m.set(n,t)):s!==t&&(e[n]={name:t},m.set(n,t))}for(const[n,a]of m.entries())n in t||null===a||(e[n]={name:null},m.set(n,null));if(Object.keys(e).length>0){u.bus.send("poi/setCoreAttributes",e);const t=await f(Object.keys(e));u.bus.send("map/mutateFeature",{functor:i(d,e,t)})}}(t)}(t)).then(()=>{h++}).catch(console.error);console.warn("dynamicPois: fetch response status not ok",c),D++,D>=3&&D>h&&clearInterval(b)};return await v().then(()=>{b=setInterval(v,c),"function"==typeof b.unref&&b.unref()}).finally(()=>l.dynamicDataNotPending.resolve(!0)),()=>clearInterval(b)}}}export{u as create};
1
+ import t from"zousan";import{processParkingPOIS as e,processOpenClosedPois as n,processSecurityWaitTimes as a,mutateSecurityCheckpointLabel as s,processRoutingPois as o,mutatePoiName as i}from"./processors.js";let c=3e4;const r="x-account-id";function u(u,y={}){const l={dynamicDataNotPending:new t},d=u.gt();y._overrideRefreshFrequency&&(c=y._overrideRefreshFrequency);const m=new Map;u.bus.on("system/readywhenyouare",()=>l.dynamicDataNotPending),u.bus.on("dynamicPois/getSecurityWaitTimes",async({isOpen:t}={})=>{const e=await u.bus.get("poi/getAll");return Object.values(e).filter(e=>{return"security.checkpoint"===e.category&&e?.dynamicData?.security&&(n=e?.dynamicData?.security,"object"==typeof n&&null!==n&&!Array.isArray(n))&&(void 0===t||e?.dynamicData?.security?.isTemporarilyClosed!==t);var n}).map(t=>({id:t.poiId,name:t.name,...t.dynamicData.security}))});const p=async(t,e=t=>t.name)=>{const n={};for(const a of t){const t=await u.bus.get("poi/getById",{id:a});t&&(n[a]=e(t))}return n};return{init:async()=>{const[t,y]=await Promise.all([u.bus.get("venueData/getAccountId"),u.bus.get("venueData/getVenueId")]),f=`https://marketplace.locuslabs.com/venueId/${y}/dynamic-poi`;let g,b=0,D=0;const h=async()=>{const c=await fetch(f,{headers:{[r]:t}});if(c.ok)return c.json().then(({data:t})=>async function(t){(function(t){const n=e(t);u.bus.send("poi/setDynamicData",{plugin:"parking",idValuesMap:n})})(t),function(t){const e=n(t);u.bus.send("poi/setDynamicData",{plugin:"open-closed-status",idValuesMap:e})}(t),async function(t){const e=a(t);u.bus.send("poi/setDynamicData",{plugin:"security",idValuesMap:e});const n=await p(Object.keys(e));u.bus.send("map/mutateFeature",{functor:s(d,e,n)})}(t),async function(t){const e=await o(t);u.bus.send("poi/setDynamicRouting",{plugin:"routing",idValuesMap:e})}(t),async function(t){const e={};for(const[n,a]of Object.entries(t)){const t=a?.dynamicData?.poiAttributes?.name??null,s=m.get(n);void 0===s?null!==t&&(e[n]={name:t},m.set(n,t)):s!==t&&(e[n]={name:t},m.set(n,t))}for(const[n,a]of m.entries())n in t||null===a||(e[n]={name:null},m.set(n,null));if(Object.keys(e).length>0){u.bus.send("poi/setCoreAttributes",e);const t=await p(Object.keys(e),t=>t.staticName??t.name);u.bus.send("map/mutateFeature",{functor:i(d,e,t)})}}(t)}(t)).then(()=>{D++}).catch(console.error);console.warn("dynamicPois: fetch response status not ok",c),b++,b>=3&&b>D&&clearInterval(g)};return await h().then(()=>{g=setInterval(h,c),"function"==typeof g.unref&&g.unref()}).finally(()=>l.dynamicDataNotPending.resolve(!0)),()=>clearInterval(g)}}}export{u as create};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atriusmaps-node-sdk",
3
- "version": "3.3.945",
3
+ "version": "3.3.946",
4
4
  "description": "This project provides an API to Atrius Personal Wayfinder maps within a Node environment. See the README.md for more information",
5
5
  "keywords": [
6
6
  "map",