atriusmaps-node-sdk 3.3.945 → 3.3.947

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.947";
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
  });
@@ -68,11 +68,11 @@ function handleHeadless(app) {
68
68
  }
69
69
  const routeRecord = route;
70
70
  return {
71
- distance: routeRecord.distance,
72
- time: routeRecord.time,
73
- steps: routeRecord.steps,
74
- navline: routeRecord.navline,
75
- waypoints: routeRecord.waypoints
71
+ distance: Number(routeRecord.distance ?? 0),
72
+ time: Number(routeRecord.time ?? 0),
73
+ steps: Array.isArray(routeRecord.steps) ? routeRecord.steps : [],
74
+ navline: Array.isArray(routeRecord.navline) ? routeRecord.navline : void 0,
75
+ waypoints: Array.isArray(routeRecord.waypoints) ? routeRecord.waypoints : void 0
76
76
  };
77
77
  };
78
78
  app.bus.on("clientAPI/destroy", async () => app.destroy?.());
@@ -86,37 +86,31 @@ function handleHeadless(app) {
86
86
  const route = await app.bus.get("wayfinder/getRoute", { fromEndpoint, toEndpoint, options });
87
87
  return pickRouteSummary(route);
88
88
  });
89
- app.bus.on(
90
- "clientAPI/getDirectionsMultiple",
91
- async ({ locations, accessible, queueTypes }) => {
92
- const endpoints = await Promise.all(locations.map(async (location$1) => location.locationToEndpoint(app, location$1)));
93
- const options = { requiresAccessibility: !!accessible };
94
- if (queueTypes) {
95
- options.selectedSecurityLanes = { SecurityLane: queueTypes };
96
- }
97
- const routes = await Promise.all(
98
- R__namespace.aperture(2, endpoints).map(
99
- async (pair) => app.bus.get("wayfinder/getRoute", {
100
- fromEndpoint: pair[0],
101
- toEndpoint: pair[1],
102
- options
103
- })
104
- )
105
- );
106
- const directions = routes.map(pickRouteSummary);
107
- return {
108
- total: {
109
- distance: R__namespace.sum(directions.map((direction) => Number(direction.distance ?? 0))),
110
- time: R__namespace.sum(directions.map((direction) => Number(direction.time ?? 0)))
111
- },
112
- directions
113
- };
89
+ app.bus.on("clientAPI/getDirectionsMultiple", async ({ locations, accessible, queueTypes }) => {
90
+ const endpoints = await Promise.all(locations.map(async (location$1) => location.locationToEndpoint(app, location$1)));
91
+ const options = { requiresAccessibility: !!accessible };
92
+ if (queueTypes) {
93
+ options.selectedSecurityLanes = { SecurityLane: queueTypes };
114
94
  }
115
- );
116
- app.bus.on(
117
- "clientAPI/getPOIDetails",
118
- async ({ poiId }) => app.bus.get("poi/getById", { id: poiId })
119
- );
95
+ const routes = await Promise.all(
96
+ R__namespace.aperture(2, endpoints).map(
97
+ async (pair) => app.bus.get("wayfinder/getRoute", {
98
+ fromEndpoint: pair[0],
99
+ toEndpoint: pair[1],
100
+ options
101
+ })
102
+ )
103
+ );
104
+ const directions = routes.map(pickRouteSummary);
105
+ return {
106
+ total: {
107
+ distance: R__namespace.sum(directions.map((direction) => Number(direction.distance ?? 0))),
108
+ time: R__namespace.sum(directions.map((direction) => Number(direction.time ?? 0)))
109
+ },
110
+ directions
111
+ };
112
+ });
113
+ app.bus.on("clientAPI/getPOIDetails", async ({ poiId }) => app.bus.get("poi/getById", { id: poiId }));
120
114
  app.bus.on("clientAPI/getAllPOIs", async () => app.bus.get("poi/getAll"));
121
115
  app.bus.on("clientAPI/getStructures", () => location.getStructures(app));
122
116
  app.bus.on(
@@ -130,7 +124,7 @@ function handleHeadless(app) {
130
124
  app.bus.on(
131
125
  "clientAPI/search",
132
126
  async ({ term, details }) => app.bus.get("search/queryAsync", { term }).then((poiList) => {
133
- const poiIdList = poiList.map((poi) => poi.poiId);
127
+ const poiIdList = poiList.map((poi) => poi.poiId).filter((poiId) => poiId !== void 0);
134
128
  app.bus.send("event/search", {
135
129
  referrer: "prog",
136
130
  searchMethod: null,
@@ -142,10 +136,7 @@ function handleHeadless(app) {
142
136
  );
143
137
  app.bus.on(
144
138
  "clientAPI/getFlightStatus",
145
- async ({ term, type = "all" }) => app.bus.get(
146
- "flightStatus/query",
147
- { term, type }
148
- )
139
+ async ({ term, type = "all" }) => app.bus.get("flightStatus/query", { term, type })
149
140
  );
150
141
  }
151
142
 
@@ -1 +1 @@
1
- var a="3.3.945",e={version:a};export{e as default,a as version};
1
+ var a="3.3.947",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};
@@ -1 +1 @@
1
- import*as e from"ramda";import{locationToEndpoint as t,getStructures as n}from"../../../src/utils/location.js";const s=[{command:"destroy"},{command:"getDirections",args:[{name:"from",type:"location"},{name:"to",type:"location"},{name:"accessible",type:"boolean",optional:!0},{name:"queueTypes",type:"list",itemType:{type:"string"},optional:!0}]},{command:"getDirectionsMultiple",args:[{name:"locations",type:"list",itemType:{type:"location"}},{name:"accessible",type:"boolean",optional:!0},{name:"queueTypes",type:"list",itemType:{type:"string"},optional:!0}]},{command:"getPOIDetails",args:[{name:"poiId",type:"integer",min:0}]},{command:"getAllPOIs"},{command:"getStructures"},{command:"getVenueData"},{command:"getSecurityWaitTimes",args:[{name:"isOpen",type:"boolean",optional:!0}]},{command:"search",args:[{name:"term",type:"string",minLength:2},{name:"details",type:"boolean",optional:!0}]},{command:"getFlightStatus",args:[{name:"term",type:"string",optional:!0},{name:"type",type:"string",optional:!0}]}];function i(s){const i=e=>{if(null==e)throw new Error("Route is unreachable");const t=e;return{distance:t.distance,time:t.time,steps:t.steps,navline:t.navline,waypoints:t.waypoints}};s.bus.on("clientAPI/destroy",async()=>s.destroy?.()),s.bus.on("clientAPI/getDirections",async({from:e,to:n,accessible:a,queueTypes:o})=>{const r=await t(s,e),c=await t(s,n),m={requiresAccessibility:!!a};o&&(m.selectedSecurityLanes={SecurityLane:o});const l=await s.bus.get("wayfinder/getRoute",{fromEndpoint:r,toEndpoint:c,options:m});return i(l)}),s.bus.on("clientAPI/getDirectionsMultiple",async({locations:n,accessible:a,queueTypes:o})=>{const r=await Promise.all(n.map(async e=>t(s,e))),c={requiresAccessibility:!!a};o&&(c.selectedSecurityLanes={SecurityLane:o});const m=(await Promise.all(e.aperture(2,r).map(async e=>s.bus.get("wayfinder/getRoute",{fromEndpoint:e[0],toEndpoint:e[1],options:c})))).map(i);return{total:{distance:e.sum(m.map(e=>Number(e.distance??0))),time:e.sum(m.map(e=>Number(e.time??0)))},directions:m}}),s.bus.on("clientAPI/getPOIDetails",async({poiId:e})=>s.bus.get("poi/getById",{id:e})),s.bus.on("clientAPI/getAllPOIs",async()=>s.bus.get("poi/getAll")),s.bus.on("clientAPI/getStructures",()=>n(s)),s.bus.on("clientAPI/getSecurityWaitTimes",async({isOpen:e})=>s.bus.get("dynamicPois/getSecurityWaitTimes",{isOpen:e})),s.bus.on("clientAPI/getVenueData",async()=>{const e=await s.bus.get("venueData/getVenueData");return Object.fromEntries(Object.entries(e).filter(([,e])=>"function"!=typeof e))}),s.bus.on("clientAPI/search",async({term:e,details:t})=>s.bus.get("search/queryAsync",{term:e}).then(n=>{const i=n.map(e=>e.poiId);return s.bus.send("event/search",{referrer:"prog",searchMethod:null,query:e,entities:i}),t?n:i})),s.bus.on("clientAPI/getFlightStatus",async({term:e,type:t="all"})=>s.bus.get("flightStatus/query",{term:e,type:t}))}export{i as handleHeadless,s as headlessCommands};
1
+ import*as e from"ramda";import{locationToEndpoint as t,getStructures as n}from"../../../src/utils/location.js";const i=[{command:"destroy"},{command:"getDirections",args:[{name:"from",type:"location"},{name:"to",type:"location"},{name:"accessible",type:"boolean",optional:!0},{name:"queueTypes",type:"list",itemType:{type:"string"},optional:!0}]},{command:"getDirectionsMultiple",args:[{name:"locations",type:"list",itemType:{type:"location"}},{name:"accessible",type:"boolean",optional:!0},{name:"queueTypes",type:"list",itemType:{type:"string"},optional:!0}]},{command:"getPOIDetails",args:[{name:"poiId",type:"integer",min:0}]},{command:"getAllPOIs"},{command:"getStructures"},{command:"getVenueData"},{command:"getSecurityWaitTimes",args:[{name:"isOpen",type:"boolean",optional:!0}]},{command:"search",args:[{name:"term",type:"string",minLength:2},{name:"details",type:"boolean",optional:!0}]},{command:"getFlightStatus",args:[{name:"term",type:"string",optional:!0},{name:"type",type:"string",optional:!0}]}];function s(i){const s=e=>{if(null==e)throw new Error("Route is unreachable");const t=e;return{distance:Number(t.distance??0),time:Number(t.time??0),steps:Array.isArray(t.steps)?t.steps:[],navline:Array.isArray(t.navline)?t.navline:void 0,waypoints:Array.isArray(t.waypoints)?t.waypoints:void 0}};i.bus.on("clientAPI/destroy",async()=>i.destroy?.()),i.bus.on("clientAPI/getDirections",async({from:e,to:n,accessible:a,queueTypes:o})=>{const r=await t(i,e),c=await t(i,n),m={requiresAccessibility:!!a};o&&(m.selectedSecurityLanes={SecurityLane:o});const l=await i.bus.get("wayfinder/getRoute",{fromEndpoint:r,toEndpoint:c,options:m});return s(l)}),i.bus.on("clientAPI/getDirectionsMultiple",async({locations:n,accessible:a,queueTypes:o})=>{const r=await Promise.all(n.map(async e=>t(i,e))),c={requiresAccessibility:!!a};o&&(c.selectedSecurityLanes={SecurityLane:o});const m=(await Promise.all(e.aperture(2,r).map(async e=>i.bus.get("wayfinder/getRoute",{fromEndpoint:e[0],toEndpoint:e[1],options:c})))).map(s);return{total:{distance:e.sum(m.map(e=>Number(e.distance??0))),time:e.sum(m.map(e=>Number(e.time??0)))},directions:m}}),i.bus.on("clientAPI/getPOIDetails",async({poiId:e})=>i.bus.get("poi/getById",{id:e})),i.bus.on("clientAPI/getAllPOIs",async()=>i.bus.get("poi/getAll")),i.bus.on("clientAPI/getStructures",()=>n(i)),i.bus.on("clientAPI/getSecurityWaitTimes",async({isOpen:e})=>i.bus.get("dynamicPois/getSecurityWaitTimes",{isOpen:e})),i.bus.on("clientAPI/getVenueData",async()=>{const e=await i.bus.get("venueData/getVenueData");return Object.fromEntries(Object.entries(e).filter(([,e])=>"function"!=typeof e))}),i.bus.on("clientAPI/search",async({term:e,details:t})=>i.bus.get("search/queryAsync",{term:e}).then(n=>{const s=n.map(e=>e.poiId).filter(e=>void 0!==e);return i.bus.send("event/search",{referrer:"prog",searchMethod:null,query:e,entities:s}),t?n:s})),i.bus.on("clientAPI/getFlightStatus",async({term:e,type:t="all"})=>i.bus.get("flightStatus/query",{term:e,type:t}))}export{s as handleHeadless,i as headlessCommands};
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.947",
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",