atriusmaps-node-sdk 3.3.894 → 3.3.895
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 +19 -4
- package/dist/cjs/plugins/dynamicPois/src/processors.js +19 -0
- package/dist/package.json.js +1 -1
- package/dist/plugins/dynamicPois/src/dynamicPois.js +1 -1
- package/dist/plugins/dynamicPois/src/processors.js +1 -1
- package/package.json +1 -1
package/dist/cjs/package.json.js
CHANGED
|
@@ -135,17 +135,17 @@ function create(app, config = {}) {
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
/**
|
|
138
|
-
* Extracts `
|
|
139
|
-
* `poi/setCoreAttributes` for any changes. A `null` name signals a revert to the original value.
|
|
138
|
+
* Extracts `dynamicData.poiAttributes.name` overrides from each POI in the API response and emits
|
|
139
|
+
* `poi/setCoreAttributes` and `map/mutateFeature` for any changes. A `null` name signals a revert to the original value.
|
|
140
140
|
* Only emits when a value actually changes to avoid unnecessary downstream updates.
|
|
141
141
|
*
|
|
142
142
|
* @param {Object} poiDataMap - The `data` map from the /dynamic-poi API response
|
|
143
143
|
*/
|
|
144
|
-
function processDynamicAttributes(poiDataMap) {
|
|
144
|
+
async function processDynamicAttributes(poiDataMap) {
|
|
145
145
|
const updates = {};
|
|
146
146
|
|
|
147
147
|
for (const [poiId, poiData] of Object.entries(poiDataMap)) {
|
|
148
|
-
const name = poiData?.
|
|
148
|
+
const name = poiData?.dynamicData?.poiAttributes?.name ?? null;
|
|
149
149
|
const previous = previousNameOverrides.get(poiId); // undefined if never tracked
|
|
150
150
|
|
|
151
151
|
if (previous === undefined) {
|
|
@@ -171,6 +171,10 @@ function create(app, config = {}) {
|
|
|
171
171
|
|
|
172
172
|
if (Object.keys(updates).length > 0) {
|
|
173
173
|
app.bus.send('poi/setCoreAttributes', updates);
|
|
174
|
+
const originalNames = await getPoiOriginalNames(Object.keys(updates));
|
|
175
|
+
app.bus.send('map/mutateFeature', {
|
|
176
|
+
functor: processors.mutatePoiName(T, updates, originalNames),
|
|
177
|
+
});
|
|
174
178
|
}
|
|
175
179
|
}
|
|
176
180
|
|
|
@@ -190,6 +194,17 @@ function create(app, config = {}) {
|
|
|
190
194
|
return nameMap;
|
|
191
195
|
};
|
|
192
196
|
|
|
197
|
+
const getPoiOriginalNames = async idArray => {
|
|
198
|
+
const nameMap = {};
|
|
199
|
+
for (const poiId of idArray) {
|
|
200
|
+
const poi = await app.bus.get('poi/getById', { id: poiId });
|
|
201
|
+
if (poi) {
|
|
202
|
+
nameMap[poiId] = poi._originalName ?? poi.name;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return nameMap;
|
|
206
|
+
};
|
|
207
|
+
|
|
193
208
|
/*
|
|
194
209
|
API response: https://gitlab.com/locuslabs/core-data-team/json-schemas/-/blob/develop/src/api-marketplace/dynamic-queue-data.json
|
|
195
210
|
*/
|
|
@@ -41,6 +41,24 @@ const mutateSecurityCheckpointLabel = (T, queueTimes, labels) => feature => {
|
|
|
41
41
|
return feature;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
const mutatePoiName = (_T, nameOverrides, originalNames) => feature => {
|
|
45
|
+
const id = feature.properties?.id;
|
|
46
|
+
const override = id !== undefined && nameOverrides?.[String(id)];
|
|
47
|
+
if (!override) {
|
|
48
|
+
return feature;
|
|
49
|
+
}
|
|
50
|
+
const { name } = override;
|
|
51
|
+
if (name === null) {
|
|
52
|
+
const original = originalNames?.[String(id)];
|
|
53
|
+
if (original) {
|
|
54
|
+
feature.properties.text = original;
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
feature.properties.text = name;
|
|
58
|
+
}
|
|
59
|
+
return feature;
|
|
60
|
+
};
|
|
61
|
+
|
|
44
62
|
const processParkingPOIS = poiMap => {
|
|
45
63
|
const idValuesMap = R__namespace.pipe(
|
|
46
64
|
R__namespace.filter(poi => poi.category === 'parking'),
|
|
@@ -109,6 +127,7 @@ const processRoutingPois = poiMap => {
|
|
|
109
127
|
}, poiMap);
|
|
110
128
|
};
|
|
111
129
|
|
|
130
|
+
exports.mutatePoiName = mutatePoiName;
|
|
112
131
|
exports.mutateSecurityCheckpointLabel = mutateSecurityCheckpointLabel;
|
|
113
132
|
exports.processOpenClosedPois = processOpenClosedPois;
|
|
114
133
|
exports.processParkingPOIS = processParkingPOIS;
|
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var t="web-engine",e="3.3.
|
|
1
|
+
var t="web-engine",e="3.3.895",s="UNLICENSED",r="module",o="src/main.ts",i=["demo","deploy","nodesdk","src/extModules/flexapi","services/*","libraries/*"],a={"build-storybook":"storybook build",colors:"cat utils/colors1.txt && node --experimental-strip-types utils/processColors.ts | pbcopy && cat utils/colors2.txt",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",storybook:"storybook dev -p 6006",test:"vitest run --project unit","test-watch":"vitest --watch","test:comp":"vitest run --project browser","test:comp:ci":"vitest run --project browser --reporter=dot","test:comp:ui":"VITE_COMP_UI=1 vitest --project browser --ui --browser.headless=false","test:all":"yarn lint && yarn format:check && yarn test && yarn playwright:ci","test:mod":"playwright test --config=playwright.mod.config.ts",typecheck:"tsc -p tsconfig.checkjs.json"},l=["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","@mapbox/mapbox-gl-draw":"^1.5.0","@mapbox/mapbox-gl-draw-static-mode":"^1.0.1","@microsoft/applicationinsights-web":"^3.3.6","@styled-system/prop-types":"^5.1.5","@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","@zumer/snapdom":"^2.9.0","axe-core":"^4.10.3",browserslist:"^4.27.0","crypto-browserify":"^3.12.1",dompurify:"^3.3.3","file-loader":"^6.2.0",flexsearch:"^0.7.43","h3-js":"^4.1.0",i18next:"^26.0.0","i18next-browser-languagedetector":"^6.1.1",jsdom:"^25.0.1",jsonschema:"^1.5.0",luxon:"^3.5.0","maplibre-gl":"^4.7.1","mini-css-extract-plugin":"^2.9.2","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","styled-system":"^5.1.5","styled-tools":"^1.7.2","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"},p={"@applitools/eyes-playwright":"^1.46.8","@axe-core/playwright":"^4.10.2","@azure/identity":"^4.13.0","@azure/playwright":"^1.0.0","@playwright/test":"~1.59.1","@storybook/addon-essentials":"^8.6.15","@storybook/blocks":"^8.6.15","@storybook/react":"^8.6.15","@storybook/react-vite":"^8.6.15","@testing-library/dom":"^10.4.1","@testing-library/jest-dom":"^6.6.3","@testing-library/react":"^16.3.0","@testing-library/user-event":"^14.5.2","@types/react":"^19.0.10","@types/react-dom":"^19.0.4","@typescript-eslint/eslint-plugin":"^8.26.1","@typescript-eslint/parser":"^8.26.1","@vitest/browser":"4.1.6","@vitest/browser-playwright":"4.1.6","@vitest/ui":"4.1.6","css-loader":"^7.1.2",eslint:"^8.57.1","eslint-config-prettier":"^10.1.8","eslint-import-resolver-alias":"^1.1.2","eslint-plugin-playwright":"^2.2.2","eslint-plugin-react":"^7.37.4","eslint-plugin-vitest":"^0.5.4","fetch-mock":"^12.6.0",glob:"^11.0.1",husky:"^9.1.7","lint-staged":"^16.4.0","node-fetch":"^2.7.0",nx:"19.8.14","nx-remotecache-azure":"^19.0.0","os-browserify":"^0.3.0",prettier:"^3.8.3","start-server-and-test":"^2.0.11",storybook:"^8.6.15",typescript:"^5.8.2",vite:"^7.3.2",vitest:"^4.1.8","webpack-merge":"^6.0.1"},c="yarn@4.13.0",d={node:"24.x"},y={},u={name:t,version:e,private:!0,license:s,type:r,main:o,workspaces:i,scripts:a,"lint-staged":{"*.{js,ts,tsx}":["eslint --fix","prettier --check"],"*.{json,md,css,ts,tsx,jsx}":["prettier --check"],"src/i18n/**/*.json":["node --experimental-strip-types utils/sort-json.ts","prettier --write"]},browserslist:l,dependencies:n,devDependencies:p,packageManager:c,engines:d,nx:y};export{l as browserslist,u as default,n as dependencies,p as devDependencies,d as engines,s as license,o as main,t as name,y as nx,c as packageManager,a as scripts,r as type,e as version,i as workspaces};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
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._originalName??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 +1 @@
|
|
|
1
|
-
import*as t from"ramda";const e=(t,e,a)=>i=>{const r=i.properties.id,o=e[r],n=a[r];if(o){const{queueTime:e,isTemporarilyClosed:a}=o,r=a?t("ui:Closed"):t("ui:_xx_ minute wait",{count:e});i.properties.text=`${n}\n${r}`}return i},a=e=>t.pipe(t.filter(t=>"parking"===t.category),t.map(e=>{const a=e.dynamicAttributes;if(!a)throw Error(`No dynamicAttributes defined for parking POI ${e.poiId}`);return{...(Date.now()-e.timestamp)/1e3<a["parking.timeToLive"]?t.pick(["lotStatus","rateDay","rateHour","timeIsReal","timeToTerminal1","timeToTerminal2"],e):{lotStatus:a["parking.default"],rateDay:"$ -",rateHour:"$ -",timeIsReal:!1},lastUpdated:e.timestamp,lotName:e.lotName}}))(e),
|
|
1
|
+
import*as t from"ramda";const e=(t,e,a)=>i=>{const r=i.properties.id,o=e[r],n=a[r];if(o){const{queueTime:e,isTemporarilyClosed:a}=o,r=a?t("ui:Closed"):t("ui:_xx_ minute wait",{count:e});i.properties.text=`${n}\n${r}`}return i},a=(t,e,a)=>t=>{const i=t.properties?.id,r=void 0!==i&&e?.[String(i)];if(!r)return t;const{name:o}=r;if(null===o){const e=a?.[String(i)];e&&(t.properties.text=e)}else t.properties.text=o;return t},i=e=>t.pipe(t.filter(t=>"parking"===t.category),t.map(e=>{const a=e.dynamicAttributes;if(!a)throw Error(`No dynamicAttributes defined for parking POI ${e.poiId}`);return{...(Date.now()-e.timestamp)/1e3<a["parking.timeToLive"]?t.pick(["lotStatus","rateDay","rateHour","timeIsReal","timeToTerminal1","timeToTerminal2"],e):{lotStatus:a["parking.default"],rateDay:"$ -",rateHour:"$ -",timeIsReal:!1},lastUpdated:e.timestamp,lotName:e.lotName}}))(e),r=e=>{const a=["dynamicData","openClosed"],i=t.filter(t.hasPath(a),e),r=t.map(t.path(a),i);if(t.all(t.both(t.has("isOpen"),t.has("expiration")),t.values(r))){const e=t.pipe(t.prop("expiration"),t.lt(Date.now()));return t.filter(e,r)}throw Error("Open Closed poi status is malformed.")},o=e=>{const a=["dynamicData","queue"],i=t.filter(t.hasPath(a),e),r=t.map(t.path(a),i);return t.map(t=>({isTemporarilyClosed:t.isTemporarilyClosed,queueTime:t.queueTime,timeIsReal:!t.isQueueTimeDefault&&t.expiration>Date.now(),lastUpdated:Date.now()}),r)},n=e=>{const a=Date.now();return t.filter(e=>{const i=t.path(["dynamicData","dynamic-routing","navGraphHidden"],e),r=t.path(["dynamicData","dynamic-routing","expiration"],e);return!0===i&&r>a},e)};export{a as mutatePoiName,e as mutateSecurityCheckpointLabel,r as processOpenClosedPois,i as processParkingPOIS,n as processRoutingPois,o as processSecurityWaitTimes};
|
package/package.json
CHANGED