atriusmaps-node-sdk 3.3.364 → 3.3.365
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 +14 -25
- package/dist/cjs/plugins/dynamicPois/src/processors.js +10 -9
- 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
|
@@ -35,23 +35,14 @@ const V1_URL_BASE = 'https://rest.locuslabs.com/v1';
|
|
|
35
35
|
|
|
36
36
|
function create (app) {
|
|
37
37
|
const state = {
|
|
38
|
-
dataLoadedProm: new Zousan(),
|
|
39
38
|
dynamicDataNotPending: new Zousan()
|
|
40
39
|
};
|
|
41
40
|
const T = app.gt();
|
|
42
41
|
|
|
43
|
-
app.bus.on('venueData/venueDataLoaded', ({ venueData }) => {
|
|
44
|
-
if (state.dataLoadedProm.v) // non-standard - indicates promise has been resolved...
|
|
45
|
-
state.dataLoadedProm = Zousan.resolve(venueData);
|
|
46
|
-
else
|
|
47
|
-
state.dataLoadedProm.resolve(venueData);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
42
|
// by returning this dynamicDataLoaded promise, we hold sdkReady event until this is resolved
|
|
51
43
|
app.bus.on('system/readywhenyouare', () => state.dynamicDataNotPending);
|
|
52
44
|
|
|
53
45
|
const init = async () => {
|
|
54
|
-
await state.dataLoadedProm;
|
|
55
46
|
const [accountId, venueId] = await Promise.all([
|
|
56
47
|
app.bus.get('venueData/getAccountId'),
|
|
57
48
|
app.bus.get('venueData/getVenueId')
|
|
@@ -64,15 +55,14 @@ function create (app) {
|
|
|
64
55
|
Promise.all([
|
|
65
56
|
fetch(dynamicPoisUrl)
|
|
66
57
|
.then(r => r.json())
|
|
67
|
-
.then(poiMap => processDynamicPois(
|
|
58
|
+
.then(poiMap => processDynamicPois(poiMap)),
|
|
68
59
|
fetch(waitTimesUrl)
|
|
69
60
|
.then(r => r.json())
|
|
70
|
-
.then(waitTimes => processSecurityWaitTimes(
|
|
71
|
-
])
|
|
61
|
+
.then(waitTimes => processSecurityWaitTimes(waitTimes))
|
|
62
|
+
])
|
|
72
63
|
.catch(err => {
|
|
73
64
|
console.error(err);
|
|
74
|
-
|
|
75
|
-
});
|
|
65
|
+
}).finally(() => state.dynamicDataNotPending.resolve(true));
|
|
76
66
|
|
|
77
67
|
// Currently, the only way to know if a venue has dynamic POIs is if they have security wait times
|
|
78
68
|
// and the only way we know that is if they have queueTypes.
|
|
@@ -80,20 +70,19 @@ function create (app) {
|
|
|
80
70
|
// This will certainly need to change at some point.
|
|
81
71
|
const queueTypes = await app.bus.get('venueData/getQueueTypes');
|
|
82
72
|
if (queueTypes.SecurityLane && queueTypes.SecurityLane.length) {
|
|
83
|
-
return
|
|
84
|
-
.then(updateFromAPI)
|
|
73
|
+
return updateFromAPI()
|
|
85
74
|
.then(() => setInterval(updateFromAPI, REFRESH_FREQUENCY))
|
|
86
75
|
} else
|
|
87
76
|
return state.dynamicDataNotPending.resolve(true) // no need to wait for this since there is no dynamic data
|
|
88
77
|
};
|
|
89
78
|
|
|
90
|
-
function processDynamicPois (
|
|
91
|
-
processParkingPOIS(
|
|
92
|
-
processOpenClosedPois(
|
|
79
|
+
function processDynamicPois (pois) {
|
|
80
|
+
processParkingPOIS(pois);
|
|
81
|
+
processOpenClosedPois(pois);
|
|
93
82
|
}
|
|
94
83
|
|
|
95
|
-
function processParkingPOIS (
|
|
96
|
-
const idValuesMap = processors.processParkingPOIS(
|
|
84
|
+
function processParkingPOIS (poiMap) {
|
|
85
|
+
const idValuesMap = processors.processParkingPOIS(poiMap);
|
|
97
86
|
app.bus.send('poi/setDynamicData', { plugin: 'parking', idValuesMap });
|
|
98
87
|
}
|
|
99
88
|
|
|
@@ -110,8 +99,8 @@ function create (app) {
|
|
|
110
99
|
/*
|
|
111
100
|
API response: https://gitlab.com/locuslabs/core-data-team/json-schemas/-/blob/develop/src/api-marketplace/dynamic-queue-data.json
|
|
112
101
|
*/
|
|
113
|
-
async function processSecurityWaitTimes (
|
|
114
|
-
const idValuesMap = processors.processSecurityWaitTimes(
|
|
102
|
+
async function processSecurityWaitTimes (waitTimes) {
|
|
103
|
+
const idValuesMap = processors.processSecurityWaitTimes(waitTimes);
|
|
115
104
|
|
|
116
105
|
app.bus.send('poi/setDynamicData', { plugin: 'security', idValuesMap });
|
|
117
106
|
|
|
@@ -122,8 +111,8 @@ function create (app) {
|
|
|
122
111
|
});
|
|
123
112
|
}
|
|
124
113
|
|
|
125
|
-
function processOpenClosedPois (
|
|
126
|
-
const idValuesMap = processors.processOpenClosedPois(
|
|
114
|
+
function processOpenClosedPois (poiMap) {
|
|
115
|
+
const idValuesMap = processors.processOpenClosedPois(poiMap);
|
|
127
116
|
app.bus.send('poi/setDynamicData', { plugin: 'open-closed-status', idValuesMap });
|
|
128
117
|
}
|
|
129
118
|
|
|
@@ -40,7 +40,8 @@ const mutateSecurityCheckpointLabel = (T, queueTimes, labels) => feature => {
|
|
|
40
40
|
return feature
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
const processParkingPOIS = (
|
|
43
|
+
const processParkingPOIS = (poiMap) => {
|
|
44
|
+
console.log({ poiMap });
|
|
44
45
|
const idValuesMap =
|
|
45
46
|
R__namespace.pipe(
|
|
46
47
|
R__namespace.filter(poi => poi.category === 'parking'),
|
|
@@ -48,7 +49,7 @@ const processParkingPOIS = (timeNowMs, poiMap) => {
|
|
|
48
49
|
const da = poi.dynamicAttributes;
|
|
49
50
|
if (!da)
|
|
50
51
|
throw Error(`No dynamicAttributes defined for parking POI ${poi.poiId}`)
|
|
51
|
-
const age = (
|
|
52
|
+
const age = (Date.now() - poi.timestamp) / 1000; // how long ago this was updated by backend (in seconds)
|
|
52
53
|
const props = (age < da['parking.timeToLive']) // if this update is recent enough, consider it "valid"
|
|
53
54
|
? R__namespace.pick(['lotStatus', 'rateDay', 'rateHour', 'timeIsReal', 'timeToTerminal1', 'timeToTerminal2'], poi)
|
|
54
55
|
: { lotStatus: da['parking.default'], rateDay: '$ -', rateHour: '$ -', timeIsReal: false };
|
|
@@ -58,13 +59,13 @@ const processParkingPOIS = (timeNowMs, poiMap) => {
|
|
|
58
59
|
return idValuesMap
|
|
59
60
|
};
|
|
60
61
|
|
|
61
|
-
const processOpenClosedPois = (
|
|
62
|
+
const processOpenClosedPois = (poiMap) => {
|
|
62
63
|
const pathToOpenClosedData = ['dynamicData', 'openClosed'];
|
|
63
64
|
const openClosedPois = R__namespace.filter(R__namespace.hasPath(pathToOpenClosedData), poiMap);
|
|
64
65
|
const openClosedStatuses = R__namespace.map(R__namespace.path(pathToOpenClosedData), openClosedPois);
|
|
65
66
|
|
|
66
67
|
if (R__namespace.all(R__namespace.both(R__namespace.has('isOpen'), R__namespace.has('expiration')), R__namespace.values(openClosedStatuses))) {
|
|
67
|
-
const isExpired = R__namespace.pipe(R__namespace.prop('expiration'), R__namespace.lt(
|
|
68
|
+
const isExpired = R__namespace.pipe(R__namespace.prop('expiration'), R__namespace.lt(Date.now()));
|
|
68
69
|
const idValuesMap = R__namespace.filter(isExpired, openClosedStatuses);
|
|
69
70
|
|
|
70
71
|
return idValuesMap
|
|
@@ -73,19 +74,19 @@ const processOpenClosedPois = (timeNowMs, poiMap) => {
|
|
|
73
74
|
}
|
|
74
75
|
};
|
|
75
76
|
|
|
76
|
-
const toDynamicWaitTime = (
|
|
77
|
+
const toDynamicWaitTime = (waitTime) => ({
|
|
77
78
|
queueTime: waitTime.queueTime,
|
|
78
79
|
isTemporarilyClosed: waitTime.isTemporarilyClosed,
|
|
79
|
-
timeIsReal: !waitTime.isQueueTimeDefault && waitTime.expiration >
|
|
80
|
-
lastUpdated:
|
|
80
|
+
timeIsReal: !waitTime.isQueueTimeDefault && waitTime.expiration > Date.now(),
|
|
81
|
+
lastUpdated: Date.now()
|
|
81
82
|
});
|
|
82
83
|
|
|
83
84
|
/*
|
|
84
85
|
API response: https://gitlab.com/locuslabs/core-data-team/json-schemas/-/blob/develop/src/api-marketplace/dynamic-queue-data.json
|
|
85
86
|
*/
|
|
86
|
-
const processSecurityWaitTimes = (
|
|
87
|
+
const processSecurityWaitTimes = (waitTimes) => {
|
|
87
88
|
const idValuesMap = R__namespace.pipe(
|
|
88
|
-
R__namespace.map(waitTime => [waitTime.poiId, toDynamicWaitTime(
|
|
89
|
+
R__namespace.map(waitTime => [waitTime.poiId, toDynamicWaitTime(waitTime)]),
|
|
89
90
|
R__namespace.fromPairs
|
|
90
91
|
)(waitTimes);
|
|
91
92
|
|
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e="web-engine",s="3.3.
|
|
1
|
+
var e="web-engine",s="3.3.365",o="UNLICENSED",r="module",l="src/main.js",t=["demo","deploy","nodesdk","src/extModules/flexapi","services/*","libraries/*"],a={colors:"cat utils/colors1.txt && node utils/processColors.js | pbcopy && cat utils/colors2.txt","cypress:a11y":"APPLITOOLS_IS_DISABLED=true && cypress open --browser chrome --env INPUT_MODALITY='keyboard'","cypress:comp":"APPLITOOLS_IS_DISABLED=true && cypress open --component --browser chrome","cypress:e2e":"APPLITOOLS_IS_DISABLED=true && cypress open --e2e --browser chrome",demo:"cd demo/ && yarn start","e2e:comp":"cypress run --component","e2e:record":"yarn cypress run --env RECORD_MODE=true",e2eSDKTest:"yarn start-server-and-test 'cd ./deploy && yarn buildDev && yarn serveLocal' 8085 'cd ./cypress/e2e/sdk && npx http-server' 8080 'yarn cypress run --spec cypress/e2e/sdk/**'",e2eTest:"cypress run --browser chrome",goProd:"cd deploy && scripts/goProd.sh",goStaging:"deploy/scripts/goStaging.sh",i18nOverrides:"yarn node utils/i18nOverrideCli src/i18n src/i18n-overrides",lint:"eslint .",mod:"demo/startMod.sh",mol:"demo/startMol.sh","mol:build":"demo/startMolBuild.sh",molProd:"cd deploy && yarn buildAndRunMol",prepare:"husky install",test:"jest --no-cache --verbose","test-watch":"jest --verbose --watch","test:e2e:video":"cypress run","test:vitest":"vitest"},i=["defaults"],n={"@azure/event-hubs":"^5.12.2","@dnd-kit/core":"^6.1.0","@dnd-kit/modifiers":"^7.0.0","@dnd-kit/sortable":"^8.0.0","@dnd-kit/utilities":"^3.2.2","@john-osullivan/react-window-dynamic-fork":"^1.9.0-alpha.1","@locus-labs/mod-badge":"^0.1.102","@locus-labs/mod-default-theme":"^0.0.113","@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","@locus-labs/mol-desktop-building-level-selector":"^0.1.119","@locus-labs/mol-desktop-compass":"^0.1.120","@locus-labs/mol-desktop-default-theme":"^0.2.105","@locus-labs/mol-desktop-icon":"^0.1.131","@locus-labs/mol-desktop-logo":"^0.1.101","@locus-labs/mol-desktop-map-nav-button":"^0.1.130","@locus-labs/mol-desktop-tooltip":"^0.3.102","@locus-labs/mol-desktop-zoom-control":"^0.1.141","@locus-labs/mol-mobile-box":"^0.1.115","@locus-labs/mol-mobile-floating-action-button":"^0.0.117","@locus-labs/mol-mobile-icon":"^0.1.118","@locus-labs/mol-mobile-text":"^0.1.116","@locus-labs/mol-mobile-toast":"^0.1.102","@mapbox/mapbox-gl-draw":"^1.4.3","@mapbox/mapbox-gl-draw-static-mode":"^1.0.1","@microsoft/applicationinsights-web":"^3.3.4","@turf/circle":"^6.5.0","@turf/helpers":"^6.5.0","@turf/point-to-line-distance":"^6.5.0","@vitejs/plugin-react":"^4.0.1",IObject:"^0.7.2","axe-core":"^4.9.0",browserslist:"^4.24.2","crypto-browserify":"^3.12.0","cypress-axe":"^1.5.0","cypress-multi-reporters":"^1.6.4","file-loader":"^6.2.0",flexsearch:"^0.7.43","h3-js":"^4.1.0",i18next:"^20.3.4","i18next-browser-languagedetector":"^6.1.1","jest-transform-css":"6.0.1",jsdom:"^25.0.1",jsonschema:"^1.2.6",luxon:"^3.3.0","maplibre-gl":"^4.7.1","mini-css-extract-plugin":"^1.6.0","mocha-junit-reporter":"^2.2.1",mochawesome:"^7.1.3","node-polyfill-webpack-plugin":"^1.1.4","path-browserify":"^1.0.1",polished:"^4.0.2","prop-types":"^15.7.2","query-string":"^8.1.0",ramda:"^0.30.1",react:"^17.0.2","react-compound-slider":"^3.3.1","react-dom":"^17.0.2","react-json-editor-ajrm":"^2.5.13","react-qr-svg":"^2.2.1","react-svg":"^16.1.29","react-tageditor":"^0.2.3","react-virtualized-auto-sizer":"^1.0.2","smoothscroll-polyfill":"^0.4.4","styled-components":"5.1.0","styled-normalize":"^8.0.6","throttle-debounce":"^3.0.1",trackjs:"^3.7.4","ua-parser-js":"^0.7.23",uuid:"3.3.2",zousan:"^3.0.1","zousan-plus":"^4.0.1"},c={"@applitools/eyes-cypress":"^3.47.0","@babel/core":"^7.26.0","@babel/eslint-parser":"^7.25.9","@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.25.9","@babel/plugin-transform-runtime":"^7.25.9","@babel/preset-env":"^7.26.0","@babel/preset-react":"^7.25.9","@testing-library/jest-dom":"^6.6.3","@typescript-eslint/eslint-plugin":"^7.13.0","@typescript-eslint/parser":"^7.13.0","babel-jest":"^27.0.6","babel-loader":"^8.2.2","babel-plugin-inline-json-import":"^0.3.2","babel-plugin-module-resolver":"^5.0.0","babel-polyfill":"^6.26.0","chai-colors":"^1.0.1","css-loader":"^5.2.4",cypress:"^12.17.2","cypress-browser-permissions":"^1.1.0","cypress-real-events":"^1.11.0","cypress-wait-until":"^1.7.1",eslint:"^8.57.0","eslint-config-standard":"^16.0.3","eslint-import-resolver-typescript":"^3.6.1","eslint-plugin-cypress":"^2.11.1","eslint-plugin-import":"^2.16.0","eslint-plugin-jest":"^28.6.0","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^5.1.0","eslint-plugin-react":"^7.12.4","eslint-plugin-standard":"^5.0.0","fetch-mock-jest":"^1.3.0",glob:"^10.3.3",husky:"^6.0.0",jest:"29.7.0","jest-environment-jsdom":"^29.7.0","lint-staged":"^11.0.1","node-fetch":"^2.6.0","null-loader":"^4.0.1",nx:"19.4.2","nx-remotecache-azure":"^19.0.0","start-server-and-test":"^2.0.0",typescript:"^5.4.5",vite:"^4.3.9",vitest:"^2.1.5",webpack:"^5.96.1","webpack-merge":"^6.0.1"},p="yarn@4.3.1",d={node:">=20"},m={},u={name:e,version:s,private:!0,license:o,type:r,main:l,workspaces:t,scripts:a,"lint-staged":{"*.js":["eslint --fix"]},browserslist:i,dependencies:n,devDependencies:c,packageManager:p,engines:d,nx:m};export{i as browserslist,u as default,n as dependencies,c as devDependencies,d as engines,o as license,l as main,e as name,m as nx,p as packageManager,a as scripts,r as type,s as version,t as workspaces};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"zousan";import{processParkingPOIS as t,processSecurityWaitTimes as
|
|
1
|
+
import e from"zousan";import{processParkingPOIS as t,processSecurityWaitTimes as n,mutateSecurityCheckpointLabel as a,processOpenClosedPois as s}from"./processors.js";function o(o){const c={dynamicDataNotPending:new e},u=o.gt();o.bus.on("system/readywhenyouare",(()=>c.dynamicDataNotPending));const i=async e=>{const t={};for(const n of e){const e=await o.bus.get("poi/getById",{id:n});e&&(t[n]=e.name)}return t};return{init:async()=>{const[e,r]=await Promise.all([o.bus.get("venueData/getAccountId"),o.bus.get("venueData/getVenueId")]),d=`https://rest.locuslabs.com/v1/venue/${r}/account/${e}/get-all-dynamic-pois/`,l=`https://rest.locuslabs.com/v3/venueId/${r}/accountId/${e}/get-dynamic-queue-times/`,y=async()=>Promise.all([fetch(d).then((e=>e.json())).then((e=>{return function(e){const n=t(e);o.bus.send("poi/setDynamicData",{plugin:"parking",idValuesMap:n})}(n=e),void function(e){const t=s(e);o.bus.send("poi/setDynamicData",{plugin:"open-closed-status",idValuesMap:t})}(n);var n})),fetch(l).then((e=>e.json())).then((e=>async function(e){const t=n(e);o.bus.send("poi/setDynamicData",{plugin:"security",idValuesMap:t});const s=await i(Object.keys(t));o.bus.send("map/mutateFeature",{functor:a(u,t,s)})}(e)))]).catch((e=>{console.error(e)})).finally((()=>c.dynamicDataNotPending.resolve(!0))),m=await o.bus.get("venueData/getQueueTypes");return m.SecurityLane&&m.SecurityLane.length?y().then((()=>setInterval(y,3e4))):c.dynamicDataNotPending.resolve(!0)}}}export{o as create};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"ramda";const t=(e,t,i)=>a=>{const
|
|
1
|
+
import*as e from"ramda";const t=(e,t,i)=>a=>{const o=a.properties.id,r=t[o],p=i[o];if(r){const{queueTime:t,isTemporarilyClosed:i}=r,o=i?e("ui:Closed"):e("ui:_xx_ minute wait",{count:t});a.properties.text=`${p}\n${o}`}return a},i=t=>{console.log({poiMap:t});return e.pipe(e.filter((e=>"parking"===e.category)),e.map((t=>{const i=t.dynamicAttributes;if(!i)throw Error(`No dynamicAttributes defined for parking POI ${t.poiId}`);return{...(Date.now()-t.timestamp)/1e3<i["parking.timeToLive"]?e.pick(["lotStatus","rateDay","rateHour","timeIsReal","timeToTerminal1","timeToTerminal2"],t):{lotStatus:i["parking.default"],rateDay:"$ -",rateHour:"$ -",timeIsReal:!1},lastUpdated:t.timestamp,lotName:t.lotName}})))(t)},a=t=>{const i=["dynamicData","openClosed"],a=e.filter(e.hasPath(i),t),o=e.map(e.path(i),a);if(e.all(e.both(e.has("isOpen"),e.has("expiration")),e.values(o))){const t=e.pipe(e.prop("expiration"),e.lt(Date.now()));return e.filter(t,o)}throw Error("Open Closed poi status is malformed.")},o=e=>({queueTime:e.queueTime,isTemporarilyClosed:e.isTemporarilyClosed,timeIsReal:!e.isQueueTimeDefault&&e.expiration>Date.now(),lastUpdated:Date.now()}),r=t=>e.pipe(e.map((e=>[e.poiId,o(e)])),e.fromPairs)(t);export{t as mutateSecurityCheckpointLabel,a as processOpenClosedPois,i as processParkingPOIS,r as processSecurityWaitTimes};
|
package/package.json
CHANGED