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.
- package/dist/cjs/package.json.js +1 -1
- package/dist/cjs/plugins/dynamicPois/src/dynamicPois.js +4 -14
- package/dist/cjs/plugins/sdkServer/src/sdkHeadless.js +31 -40
- package/dist/package.json.js +1 -1
- package/dist/plugins/dynamicPois/src/dynamicPois.js +1 -1
- package/dist/plugins/sdkServer/src/sdkHeadless.js +1 -1
- package/package.json +1 -1
package/dist/cjs/package.json.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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
|
|
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var a="3.3.
|
|
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
|
|
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
|
|
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