atriusmaps-node-sdk 3.3.787 → 3.3.789
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/README.md +1 -0
- package/dist/cjs/package.json.js +1 -1
- package/dist/cjs/plugins/dynamicPois/src/dynamicPois.js +26 -0
- package/dist/cjs/plugins/sdkServer/src/sdkHeadless.js +8 -0
- 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/README.md
CHANGED
|
@@ -67,6 +67,7 @@ Your map function is ready to receive commands – of which the following are cu
|
|
|
67
67
|
- `getAllPOIs`: Get a list of all POIs for the venue
|
|
68
68
|
- `getStructures`: Returns a list of structures (buildings) within the venue along with their properties
|
|
69
69
|
- `getVenueData`: Returns a complete venue object containing all venue details
|
|
70
|
+
- `getSecurityWaitTimes`: Returns processed security wait times for security lanes, optionally filtered by open or closed status
|
|
70
71
|
- `search`: Performs a search against a term specified
|
|
71
72
|
|
|
72
73
|
For details on these commands, including their arguments, return value formats, and examples, see https://locusmapsjs.readme.io/docs/commands
|
package/dist/cjs/package.json.js
CHANGED
|
@@ -35,6 +35,7 @@ const MARKETPLACE_URL_BASE = 'https://marketplace.locuslabs.com';
|
|
|
35
35
|
const MAX_FETCH_FAILS = 3; // 3 strikes and you're out!
|
|
36
36
|
|
|
37
37
|
const ACCOUNT_ID_HEADER = 'x-account-id';
|
|
38
|
+
const isObject = value => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
38
39
|
|
|
39
40
|
function create(app, config = {}) {
|
|
40
41
|
const state = {
|
|
@@ -42,6 +43,30 @@ function create(app, config = {}) {
|
|
|
42
43
|
};
|
|
43
44
|
const T = app.gt();
|
|
44
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Returns security checkpoint POIs that have dynamic security data.
|
|
48
|
+
*
|
|
49
|
+
* @param {{ isOpen?: boolean }} [options] Optional open-state filter. Omit to return all checkpoints,
|
|
50
|
+
* set to true for open checkpoints, or false for temporarily closed checkpoints.
|
|
51
|
+
* @returns {Promise<Array<{id: number, name: string, queueTime?: number, isTemporarilyClosed?: boolean, timeIsReal?: boolean, lastUpdated?: string}>>}
|
|
52
|
+
*/
|
|
53
|
+
const getSecurityWaitTimes = async ({ isOpen } = {}) => {
|
|
54
|
+
const pois = await app.bus.get('poi/getAll');
|
|
55
|
+
return Object.values(pois)
|
|
56
|
+
.filter(
|
|
57
|
+
poi =>
|
|
58
|
+
poi.category === 'security.checkpoint' &&
|
|
59
|
+
poi?.dynamicData?.security &&
|
|
60
|
+
isObject(poi?.dynamicData?.security) &&
|
|
61
|
+
(isOpen === undefined ? true : poi?.dynamicData?.security?.isTemporarilyClosed !== isOpen),
|
|
62
|
+
)
|
|
63
|
+
.map(poi => ({
|
|
64
|
+
id: poi.poiId,
|
|
65
|
+
name: poi.name,
|
|
66
|
+
...poi.dynamicData.security,
|
|
67
|
+
}));
|
|
68
|
+
};
|
|
69
|
+
|
|
45
70
|
// used in testing
|
|
46
71
|
if (config._overrideRefreshFrequency) {
|
|
47
72
|
REFRESH_FREQUENCY = config._overrideRefreshFrequency;
|
|
@@ -49,6 +74,7 @@ function create(app, config = {}) {
|
|
|
49
74
|
|
|
50
75
|
// by returning this dynamicDataLoaded promise, we hold sdkReady event until this is resolved
|
|
51
76
|
app.bus.on('system/readywhenyouare', () => state.dynamicDataNotPending);
|
|
77
|
+
app.bus.on('dynamicPois/getSecurityWaitTimes', getSecurityWaitTimes);
|
|
52
78
|
|
|
53
79
|
const init = async () => {
|
|
54
80
|
const [accountId, venueId] = await Promise.all([
|
|
@@ -58,6 +58,10 @@ const headlessCommands = [
|
|
|
58
58
|
{ command: 'getAllPOIs' },
|
|
59
59
|
{ command: 'getStructures' },
|
|
60
60
|
{ command: 'getVenueData' },
|
|
61
|
+
{
|
|
62
|
+
command: 'getSecurityWaitTimes',
|
|
63
|
+
args: [{ name: 'isOpen', type: 'boolean', optional: true }],
|
|
64
|
+
},
|
|
61
65
|
{
|
|
62
66
|
command: 'search',
|
|
63
67
|
args: [
|
|
@@ -113,6 +117,10 @@ function handleHeadless(app) {
|
|
|
113
117
|
|
|
114
118
|
app.bus.on('clientAPI/getStructures', () => location.getStructures(app));
|
|
115
119
|
|
|
120
|
+
app.bus.on('clientAPI/getSecurityWaitTimes', async ({ isOpen }) =>
|
|
121
|
+
app.bus.get('dynamicPois/getSecurityWaitTimes', { isOpen }),
|
|
122
|
+
);
|
|
123
|
+
|
|
116
124
|
const isNotFunction = o => typeof o !== 'function';
|
|
117
125
|
app.bus.on('clientAPI/getVenueData', async () => {
|
|
118
126
|
const vd = await app.bus.get('venueData/getVenueData');
|
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e="web-engine",t="3.3.
|
|
1
|
+
var e="web-engine",t="3.3.789",s="UNLICENSED",r="module",o="src/main.js",i=["demo","deploy","nodesdk","src/extModules/flexapi","services/*","libraries/*"],l={colors:"cat utils/colors1.txt && node utils/processColors.js | pbcopy && cat utils/colors2.txt","cypress:comp":"cypress open --component --browser chrome","cypress:comp:ci":"cypress run --component",demo:"cd demo/ && yarn start",dev:"yarn mol e2e","format:check":"yarn prettier . --check","format:fix":"yarn prettier . --write",goProd:"cd deploy && scripts/goProd.sh",goStaging:"deploy/scripts/goStaging.sh","icons:convert":"node scripts/convertSvgToJsx.mjs",lint:"eslint . --ext .js,.jsx,.ts,.tsx",mod:"demo/startMod.sh",mol:"demo/startMol.sh","mol:build":"demo/startMolBuild.sh",molProd:"cd deploy && yarn buildAndRunMol","playwright:ci":"yarn playwright test --grep-invert sdk","playwright:ci:failed":"yarn playwright test --last-failed --grep-invert sdk","playwright:sdk":"yarn start-server-and-test 'cd ./deploy && yarn buildDev && yarn serveLocal' 8085 'cd ./test/sdk && npx http-server' 8080 'yarn playwright test sdk --ui'","playwright:ui":"yarn playwright test --ui --grep-invert sdk",prepare:"husky",test:"jest --no-cache --verbose","test-watch":"jest --verbose --watch","test:all":"yarn lint && yarn format:check && yarn test && yarn test:vitest && yarn cypress:comp:ci && yarn playwright:ci","test:mod":"playwright test --config=playwright.mod.config.ts","test:vitest":"vitest run",typecheck:"tsc -p tsconfig.checkjs.json",storybook:"storybook dev -p 6006","build-storybook":"storybook build"},a=["defaults"],n={"@azure/event-hubs":"^5.12.2","@csstools/normalize.css":"^11.0.1","@dnd-kit/core":"^6.3.1","@dnd-kit/modifiers":"^9.0.0","@dnd-kit/sortable":"^10.0.0","@dnd-kit/utilities":"^3.2.2","@locus-labs/mod-badge":"^0.1.102","@locus-labs/mod-footer":"^0.0.111","@locus-labs/mod-header":"^0.0.105","@locus-labs/mod-location-marker":"^0.0.104","@locus-labs/mod-map-legend":"^0.0.104","@locus-labs/mod-offscreen-indicator":"^0.0.104","@locus-labs/mod-pin":"^0.0.104","@locus-labs/mod-qr-code-card":"^0.0.104","@locus-labs/mod-qr-code-window":"^0.0.105","@locus-labs/mod-walk-time-matrix":"^0.0.103","@mapbox/mapbox-gl-draw":"^1.5.0","@mapbox/mapbox-gl-draw-static-mode":"^1.0.1","@microsoft/applicationinsights-web":"^3.3.6","@turf/area":"^7.2.0","@turf/bbox-clip":"^7.2.0","@turf/bbox-polygon":"^7.2.0","@turf/bearing":"^7.2.0","@turf/circle":"^7.2.0","@turf/helpers":"^7.2.0","@turf/point-to-line-distance":"^7.2.0","@vitejs/plugin-react":"^5.2.0","axe-core":"^4.10.3",browserslist:"^4.27.0","crypto-browserify":"^3.12.1","cypress-multi-reporters":"^2.0.5","cypress-real-events":"^1.14.0",dompurify:"^3.3.3","file-loader":"^6.2.0",flexsearch:"^0.7.43","h3-js":"^4.1.0",i18next:"^20.6.1","i18next-browser-languagedetector":"^6.1.1","jest-transform-css":"6.0.2",jsdom:"^25.0.1",jsonschema:"^1.5.0",luxon:"^3.5.0","maplibre-gl":"^4.7.1","mini-css-extract-plugin":"^2.9.2","mocha-junit-reporter":"^2.2.1",mochawesome:"^7.1.3","node-polyfill-webpack-plugin":"^4.1.0","path-browserify":"^1.0.1",pmtiles:"^4.4.0","prop-types":"^15.8.1","qrcode.react":"^4.2.0",ramda:"^0.30.1",react:"^19.2.4","react-compound-slider":"^3.4.0","react-dom":"^19.2.4","react-json-editor-ajrm":"^2.5.14","react-svg":"^16.3.0","react-virtualized-auto-sizer":"^1.0.25","react-window":"^1.8.11","smoothscroll-polyfill":"^0.4.4","styled-components":"^6.1.15","styled-normalize":"^8.1.1","throttle-debounce":"^5.0.2",trackjs:"^3.10.4","ua-parser-js":"^0.7.40",uuid:"11.1.0",zousan:"^3.0.1","zousan-plus":"^4.0.1"},c={"@applitools/eyes-playwright":"^1.44.1","@axe-core/playwright":"^4.10.2","@azure/identity":"^4.13.0","@azure/playwright":"^1.0.0","@babel/core":"^7.26.10","@babel/eslint-parser":"^7.26.10","@babel/plugin-proposal-class-properties":"^7.18.6","@babel/plugin-syntax-dynamic-import":"^7.8.3","@babel/plugin-syntax-import-assertions":"^7.26.0","@babel/plugin-transform-modules-commonjs":"^7.26.3","@babel/plugin-transform-runtime":"^7.26.10","@babel/preset-env":"^7.26.9","@babel/preset-react":"^7.26.3","@playwright/test":"^1.56.0","@storybook/addon-essentials":"^8.6.15","@storybook/blocks":"^8.6.15","@storybook/react":"^8.6.15","@storybook/react-vite":"^8.6.15","@testing-library/jest-dom":"^6.6.3","@types/react":"^19.0.10","@types/react-dom":"^19.0.4","@typescript-eslint/eslint-plugin":"^8.26.1","@typescript-eslint/parser":"^8.26.1","babel-jest":"^29.7.0","babel-loader":"^10.0.0","babel-plugin-inline-json-import":"^0.3.2","babel-plugin-module-resolver":"^5.0.2","babel-plugin-styled-components":"^2.1.4","chai-colors":"^1.0.1","css-loader":"^7.1.2",cypress:"^15.0.0","cypress-wait-until":"^3.0.2",eslint:"^8.57.1","eslint-config-prettier":"^10.1.8","eslint-config-standard":"^17.1.0","eslint-import-resolver-alias":"^1.1.2","eslint-import-resolver-typescript":"^3.9.1","eslint-plugin-cypress":"^2.15.2","eslint-plugin-import":"^2.31.0","eslint-plugin-jest":"^28.11.0","eslint-plugin-n":"^17.16.2","eslint-plugin-node":"^11.1.0","eslint-plugin-playwright":"^2.2.2","eslint-plugin-promise":"^5.2.0","eslint-plugin-react":"^7.37.4","eslint-plugin-standard":"^5.0.0","fetch-mock-jest":"^1.5.1",glob:"^11.0.1",husky:"^9.1.7",jest:"29.7.0","jest-environment-jsdom":"^29.7.0","lint-staged":"^15.5.0","node-fetch":"^2.7.0","null-loader":"^4.0.1",nx:"19.8.14","nx-remotecache-azure":"^19.0.0","os-browserify":"^0.3.0",prettier:"3.7.4","start-server-and-test":"^2.0.11",storybook:"^8.6.15",typescript:"^5.8.2",vite:"^7.3.2",vitest:"^4.1.2","webpack-merge":"^6.0.1"},p="yarn@4.13.0",d={node:"24.x"},m={},y={name:e,version:t,private:!0,license:s,type:r,main:o,workspaces:i,scripts:l,"lint-staged":{"*.js":["eslint --fix","prettier --check"],"*.{json,md,css,ts,tsx,jsx}":["prettier --check"]},browserslist:a,dependencies:n,devDependencies:c,packageManager:p,engines:d,nx:m};export{a as browserslist,y as default,n as dependencies,c as devDependencies,d as engines,s as license,o as main,e as name,m as nx,p as packageManager,l as scripts,r as type,t as version,i as workspaces};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"zousan";import{processParkingPOIS as t,processOpenClosedPois as n,processSecurityWaitTimes as a,mutateSecurityCheckpointLabel as s,processRoutingPois as i}from"./processors.js";let o=3e4;const c="x-account-id";function r(r,u={}){const y={dynamicDataNotPending:new e},d=r.gt();u._overrideRefreshFrequency&&(o=u._overrideRefreshFrequency),r.bus.on("system/readywhenyouare",()=>y.dynamicDataNotPending),r.bus.on("dynamicPois/getSecurityWaitTimes",async({isOpen:e}={})=>{const t=await r.bus.get("poi/getAll");return Object.values(t).filter(t=>{return"security.checkpoint"===t.category&&t?.dynamicData?.security&&(n=t?.dynamicData?.security,"object"==typeof n&&null!==n&&!Array.isArray(n))&&(void 0===e||t?.dynamicData?.security?.isTemporarilyClosed!==e);var n}).map(e=>({id:e.poiId,name:e.name,...e.dynamicData.security}))});const l=async e=>{const t={};for(const n of e){const e=await r.bus.get("poi/getById",{id:n});e&&(t[n]=e.name)}return t};return{init:async()=>{const[e,u]=await Promise.all([r.bus.get("venueData/getAccountId"),r.bus.get("venueData/getVenueId")]),p=`https://marketplace.locuslabs.com/venueId/${u}/dynamic-poi`;let m,f=0,g=0;const D=async()=>{const o=await fetch(p,{headers:{[c]:e}});if(o.ok)return o.json().then(({data:e})=>async function(e){(function(e){const n=t(e);r.bus.send("poi/setDynamicData",{plugin:"parking",idValuesMap:n})})(e),function(e){const t=n(e);r.bus.send("poi/setDynamicData",{plugin:"open-closed-status",idValuesMap:t})}(e),async function(e){const t=a(e);r.bus.send("poi/setDynamicData",{plugin:"security",idValuesMap:t});const n=await l(Object.keys(t));r.bus.send("map/mutateFeature",{functor:s(d,t,n)})}(e),async function(e){const t=await i(e);r.bus.send("poi/setDynamicRouting",{plugin:"routing",idValuesMap:t})}(e)}(e)).then(()=>{g++}).catch(console.error);console.warn("dynamicPois: fetch response status not ok",o),f++,f>=3&&f>g&&clearInterval(m)};return D().then(()=>{m=setInterval(D,o),"function"==typeof m.unref&&m.unref()}).finally(()=>y.dynamicDataNotPending.resolve(!0))}}}export{r 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}]}];function s(i){i.bus.on("clientAPI/destroy",async()=>i.destroy()),i.bus.on("clientAPI/getDirections",async({from:n,to:s,accessible:a,queueTypes:o})=>{const c=await t(i,n),r=await t(i,s),m={requiresAccessibility:!!a};return o&&(m.selectedSecurityLanes={SecurityLane:o}),i.bus.get("wayfinder/getRoute",{fromEndpoint:c,toEndpoint:r,options:m}).then(e.pick(["distance","time","steps","navline","waypoints"]))}),i.bus.on("clientAPI/getDirectionsMultiple",async({locations:n,accessible:s,queueTypes:a})=>{const o=await Promise.all(n.map(async e=>t(i,e))),c={requiresAccessibility:!!s};a&&(c.selectedSecurityLanes={SecurityLane:a});const r=await Promise.all(e.aperture(2,o).map(async e=>i.bus.get("wayfinder/getRoute",{fromEndpoint:e[0],toEndpoint:e[1],options:c}))),m=e.map(e.pick(["distance","time","steps","navline","waypoints"]),r);return{total:{distance:e.sum(e.map(e=>e.distance,m)),time:e.sum(e.map(e=>e.time,m))},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}));const s=e=>"function"!=typeof e;i.bus.on("clientAPI/getVenueData",async()=>{const t=await i.bus.get("venueData/getVenueData");return e.filter(s,t)}),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);return i.bus.send("event/search",{referrer:"prog",searchMethod:null,query:e,entities:s}),t?n:s}))}export{s as handleHeadless,i as headlessCommands};
|
package/package.json
CHANGED