atriusmaps-node-sdk 3.3.388 → 3.3.389
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 +2 -2
- package/dist/cjs/plugins/dynamicPois/mocks/mockDynamicRoutingData.js +41 -0
- package/dist/cjs/plugins/dynamicPois/src/dynamicPois.js +54 -2
- package/dist/cjs/plugins/wayfinder/src/navGraph.js +23 -5
- package/dist/cjs/plugins/wayfinder/src/wayfinder.js +8 -0
- package/dist/package.json.js +1 -1
- package/dist/plugins/dynamicPois/mocks/mockDynamicRoutingData.js +1 -0
- package/dist/plugins/dynamicPois/src/dynamicPois.js +1 -1
- package/dist/plugins/wayfinder/src/navGraph.js +1 -1
- package/dist/plugins/wayfinder/src/wayfinder.js +1 -1
- package/package.json +1 -1
package/dist/cjs/package.json.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var name = "web-engine";
|
|
6
|
-
var version = "3.3.
|
|
6
|
+
var version = "3.3.389";
|
|
7
7
|
var license = "UNLICENSED";
|
|
8
8
|
var type = "module";
|
|
9
9
|
var main = "src/main.js";
|
|
@@ -35,7 +35,7 @@ var scripts = {
|
|
|
35
35
|
prepare: "husky install",
|
|
36
36
|
test: "jest --no-cache --verbose",
|
|
37
37
|
"test-watch": "jest --verbose --watch",
|
|
38
|
-
"test:vitest": "vitest"
|
|
38
|
+
"test:vitest": "vitest run"
|
|
39
39
|
};
|
|
40
40
|
var browserslist = [
|
|
41
41
|
"defaults"
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const dynamicRoutingData = {
|
|
4
|
+
868: {
|
|
5
|
+
category: 'portal',
|
|
6
|
+
description: 'Elevator',
|
|
7
|
+
poiId: '868',
|
|
8
|
+
position: {
|
|
9
|
+
floorId: 'staticdca-terminals-departures',
|
|
10
|
+
latitude: 38.851973,
|
|
11
|
+
longitude: -77.082142
|
|
12
|
+
},
|
|
13
|
+
dynamicData: {
|
|
14
|
+
'dynamic-routing': {
|
|
15
|
+
navGraphHidden: true,
|
|
16
|
+
navGraphHiddenReason: 'reason 2',
|
|
17
|
+
expiration: 2055958719000
|
|
18
|
+
// expiration: 1740608456150
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
869: {
|
|
23
|
+
category: 'portal',
|
|
24
|
+
description: 'Elevator',
|
|
25
|
+
poiId: '869',
|
|
26
|
+
position: {
|
|
27
|
+
floorId: 'staticdca-terminals-departures',
|
|
28
|
+
latitude: 38.851973,
|
|
29
|
+
longitude: -77.082142
|
|
30
|
+
},
|
|
31
|
+
dynamicData: {
|
|
32
|
+
'dynamic-routing': {
|
|
33
|
+
navGraphHidden: true,
|
|
34
|
+
navGraphHiddenReason: 'reason 2',
|
|
35
|
+
expiration: 2055958719000
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
exports.dynamicRoutingData = dynamicRoutingData;
|
|
@@ -1,8 +1,30 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var luxon = require('luxon');
|
|
4
|
+
var R = require('ramda');
|
|
3
5
|
var Zousan = require('zousan');
|
|
6
|
+
var mockDynamicRoutingData = require('../mocks/mockDynamicRoutingData.js');
|
|
4
7
|
var processors = require('./processors.js');
|
|
5
8
|
|
|
9
|
+
function _interopNamespaceDefault(e) {
|
|
10
|
+
var n = Object.create(null);
|
|
11
|
+
if (e) {
|
|
12
|
+
Object.keys(e).forEach(function (k) {
|
|
13
|
+
if (k !== 'default') {
|
|
14
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return e[k]; }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
n.default = e;
|
|
23
|
+
return Object.freeze(n);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var R__namespace = /*#__PURE__*/_interopNamespaceDefault(R);
|
|
27
|
+
|
|
6
28
|
/*
|
|
7
29
|
This service obtains dynamic POI data from our own backend REST API service.
|
|
8
30
|
Currently it drives dynamic data for Security Wait Times and Parking Status.
|
|
@@ -38,7 +60,8 @@ const ACCOUNT_ID_HEADER = 'x-account-id';
|
|
|
38
60
|
|
|
39
61
|
function create (app, config = {}) {
|
|
40
62
|
const state = {
|
|
41
|
-
dynamicDataNotPending: new Zousan()
|
|
63
|
+
dynamicDataNotPending: new Zousan(),
|
|
64
|
+
poisToAvoid: new Zousan()
|
|
42
65
|
};
|
|
43
66
|
const T = app.gt();
|
|
44
67
|
|
|
@@ -49,6 +72,8 @@ function create (app, config = {}) {
|
|
|
49
72
|
// by returning this dynamicDataLoaded promise, we hold sdkReady event until this is resolved
|
|
50
73
|
app.bus.on('system/readywhenyouare', () => state.dynamicDataNotPending);
|
|
51
74
|
|
|
75
|
+
app.bus.on('dynamicRouting/poisToAvoid', () => state.poisToAvoid);
|
|
76
|
+
|
|
52
77
|
const init = async () => {
|
|
53
78
|
const [accountId, venueId] = await Promise.all([
|
|
54
79
|
app.bus.get('venueData/getAccountId'),
|
|
@@ -89,10 +114,11 @@ function create (app, config = {}) {
|
|
|
89
114
|
return state.dynamicDataNotPending.resolve(true) // no need to wait for this since there is no dynamic data
|
|
90
115
|
};
|
|
91
116
|
|
|
92
|
-
function processDynamicPois (pois) {
|
|
117
|
+
async function processDynamicPois (pois) {
|
|
93
118
|
processParkingPOIS(pois);
|
|
94
119
|
processOpenClosedPois(pois);
|
|
95
120
|
processSecurityWaitTimes(pois);
|
|
121
|
+
await fetchDynamicRouting(mockDynamicRoutingData.dynamicRoutingData); // TODO: change this later to use the data from the api
|
|
96
122
|
}
|
|
97
123
|
|
|
98
124
|
function processParkingPOIS (poiMap) {
|
|
@@ -130,6 +156,32 @@ function create (app, config = {}) {
|
|
|
130
156
|
app.bus.send('poi/setDynamicData', { plugin: 'open-closed-status', idValuesMap });
|
|
131
157
|
}
|
|
132
158
|
|
|
159
|
+
async function fetchDynamicRouting (pois) {
|
|
160
|
+
let poiResults = [];
|
|
161
|
+
|
|
162
|
+
if (!config.dynamicRoutingEnabled) {
|
|
163
|
+
state.poisToAvoid.resolve(poiResults); // if dynamic routing is disabled, resolve to empty array
|
|
164
|
+
return
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const now = luxon.DateTime.now().toMillis();
|
|
168
|
+
|
|
169
|
+
const poiIdsToAvoid = Object.values(R__namespace.filter(
|
|
170
|
+
poi => {
|
|
171
|
+
const navGraphHidden = R__namespace.path(['dynamicData', 'dynamic-routing', 'navGraphHidden'], poi);
|
|
172
|
+
const expiration = R__namespace.path(['dynamicData', 'dynamic-routing', 'expiration'], poi);
|
|
173
|
+
return navGraphHidden === true && expiration > now
|
|
174
|
+
},
|
|
175
|
+
pois
|
|
176
|
+
));
|
|
177
|
+
|
|
178
|
+
if (poiIdsToAvoid.length > 0) {
|
|
179
|
+
const poisObj = await app.bus.get('poi/getAll');
|
|
180
|
+
poiResults = Object.values(poisObj).length > 0 ? poiIdsToAvoid.map(poi => poisObj[poi?.poiId]) : [];
|
|
181
|
+
}
|
|
182
|
+
state.poisToAvoid.resolve(poiResults);
|
|
183
|
+
}
|
|
184
|
+
|
|
133
185
|
return {
|
|
134
186
|
init
|
|
135
187
|
}
|
|
@@ -40,6 +40,7 @@ const CLOSED_CHECKPOINT_EDGE_WEIGHT = 9999;
|
|
|
40
40
|
function createNavGraph (data, floorIdToOrdinal, floorIdToStructureId, securityLanesMap) {
|
|
41
41
|
const nodes = { };
|
|
42
42
|
const geoDb = { };
|
|
43
|
+
const nodesToAvoid = new Set();
|
|
43
44
|
let securityWaitTimes = {};
|
|
44
45
|
|
|
45
46
|
data.nodes.forEach(nodeData => {
|
|
@@ -132,7 +133,17 @@ function createNavGraph (data, floorIdToOrdinal, floorIdToStructureId, securityL
|
|
|
132
133
|
// options.maxOrd = Math.max(start.ordinal, end.ordinal)
|
|
133
134
|
// options.structureId = start.structureId
|
|
134
135
|
// }
|
|
135
|
-
return findShortestPath(startNode, endNode, nodes, securityWaitTimes, securityLanesMap, options)
|
|
136
|
+
return findShortestPath(startNode, endNode, nodes, nodesToAvoid, securityWaitTimes, securityLanesMap, options)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
*
|
|
141
|
+
* @param {Array.<string>} nodes - Array of nodes to avoid
|
|
142
|
+
*/
|
|
143
|
+
function updateNodesToAvoid (nodes) {
|
|
144
|
+
// We want to replace entire list when we get new nodes, not just add
|
|
145
|
+
nodesToAvoid.clear();
|
|
146
|
+
nodes.forEach(n => nodesToAvoid.add(n));
|
|
136
147
|
}
|
|
137
148
|
/**
|
|
138
149
|
* @param {Endpoint} start - start endpoint
|
|
@@ -144,7 +155,7 @@ function createNavGraph (data, floorIdToOrdinal, floorIdToStructureId, securityL
|
|
|
144
155
|
const startNode = findClosestNode(start);
|
|
145
156
|
const destNodeArray = destArray.map(dest => findClosestNode(dest));
|
|
146
157
|
if (!startNode || !destNodeArray.length) return []
|
|
147
|
-
return findAllShortestPathsImpl(startNode, destNodeArray, nodes, securityWaitTimes, securityLanesMap, options)
|
|
158
|
+
return findAllShortestPathsImpl(startNode, destNodeArray, nodes, nodesToAvoid, securityWaitTimes, securityLanesMap, options)
|
|
148
159
|
}
|
|
149
160
|
|
|
150
161
|
function updateWithSecurityWaitTime (waitTimesData) {
|
|
@@ -155,6 +166,8 @@ function createNavGraph (data, floorIdToOrdinal, floorIdToStructureId, securityL
|
|
|
155
166
|
return {
|
|
156
167
|
_nodes: nodes,
|
|
157
168
|
_geoDb: geoDb,
|
|
169
|
+
_nodesToAvoid: nodesToAvoid,
|
|
170
|
+
addNodesToAvoid: (nodes) => updateNodesToAvoid(nodes),
|
|
158
171
|
findClosestNode: (floorId, lat, lng) => findClosestNodeByFloor(floorId, lat, lng, geoDb, nodes),
|
|
159
172
|
findShortestPath: (start, end, options) => findShortestPathEntry(start, end, nodes, options),
|
|
160
173
|
findAllShortestPaths,
|
|
@@ -176,12 +189,13 @@ function distanceBetweenNodes (n1, n2, nodes) {
|
|
|
176
189
|
* @param {Object.<Node>} start - a node in the navGraph to start on
|
|
177
190
|
* @param {Array.<Node>} destinations - array of nodes to find path to
|
|
178
191
|
* @param {Object.<string, NavNode>} nodes - dictionary of nodes by id
|
|
192
|
+
* @param {Set.<string>} nodesToAvoid - set of nodes to avoid
|
|
179
193
|
* @param {Object.<string, SecurityWaitTime>} securityWaitTimes - map of POI id to security wait time
|
|
180
194
|
* @param {Object.<string, SecurityLane>} securityLanesMap - map of POI id to security lane
|
|
181
195
|
* @param {RouteOptions} [options={}] extra options (such as requireAccessibility)
|
|
182
196
|
* @returns {Array.<Array.<Node>>} list of shortest path to each destination
|
|
183
197
|
*/
|
|
184
|
-
function findAllShortestPathsImpl (start, destinations, nodes, securityWaitTimes = {}, securityLanesMap = {}, options = {}) {
|
|
198
|
+
function findAllShortestPathsImpl (start, destinations, nodes, nodesToAvoid, securityWaitTimes = {}, securityLanesMap = {}, options = {}) {
|
|
185
199
|
// const previous = findPaths(start, start, nodes, options)
|
|
186
200
|
|
|
187
201
|
// const backtrackPath = node => buildBacktrackPath(nodes, previous, node)
|
|
@@ -191,7 +205,7 @@ function findAllShortestPathsImpl (start, destinations, nodes, securityWaitTimes
|
|
|
191
205
|
// return new Map(poiPathTuples)
|
|
192
206
|
return destinations.map(d => {
|
|
193
207
|
try {
|
|
194
|
-
return findShortestPath(start, d, nodes, securityWaitTimes, securityLanesMap, options)
|
|
208
|
+
return findShortestPath(start, d, nodes, nodesToAvoid, securityWaitTimes, securityLanesMap, options)
|
|
195
209
|
} catch (e) { return null }
|
|
196
210
|
})
|
|
197
211
|
}
|
|
@@ -215,12 +229,13 @@ const clearCache = () => {
|
|
|
215
229
|
* @param {Object<Node>} start a node in the navGraph to start on
|
|
216
230
|
* @param {Object<Node>} end a node in the navGraph to find path to
|
|
217
231
|
* @param {Object.<string, Node>} nodes dictionary of nodes by id
|
|
232
|
+
* @param {Set.<string>} nodesToAvoid - set of nodes to avoid
|
|
218
233
|
* @param {Object.<string, SecurityWaitTime>} securityWaitTimes - map of POI id to security wait time
|
|
219
234
|
* @param {Object.<string, SecurityLane>} securityLanesMap - map of POI id to security lane
|
|
220
235
|
* @param {RouteOptions} options={} extra options (such as requireAccessibility)
|
|
221
236
|
* @returns {Array.<Node>} an array of nodes that represent the shortest route from start to end. null if no route exists.
|
|
222
237
|
*/
|
|
223
|
-
function findShortestPath (start, end, nodes, securityWaitTimes = {}, securityLanesMap = {}, options = { }) {
|
|
238
|
+
function findShortestPath (start, end, nodes, nodesToAvoid, securityWaitTimes = {}, securityLanesMap = {}, options = { }) {
|
|
224
239
|
if (start.id !== lastStartId || lastOptionsStr !== JSON.stringify(options)) {
|
|
225
240
|
clearCache();
|
|
226
241
|
visitQueue.offerWithPriority(start.id, 0);
|
|
@@ -238,6 +253,9 @@ function findShortestPath (start, end, nodes, securityWaitTimes = {}, securityLa
|
|
|
238
253
|
for (let ei = 0; ei < node.edges.length; ei++) {
|
|
239
254
|
const e = node.edges[ei]; // next edge from this node
|
|
240
255
|
|
|
256
|
+
if (nodesToAvoid.size > 0 && nodesToAvoid.has(e.dst)) {
|
|
257
|
+
continue
|
|
258
|
+
}
|
|
241
259
|
if (visited[e.dst])
|
|
242
260
|
continue
|
|
243
261
|
|
|
@@ -119,9 +119,17 @@ function create (app, config) {
|
|
|
119
119
|
structureLookup.floorIdToStructureId,
|
|
120
120
|
securityLanesMap
|
|
121
121
|
);
|
|
122
|
+
const nodesToAvoid = await createNodesToAvoid(graph);
|
|
123
|
+
graph.addNodesToAvoid(nodesToAvoid);
|
|
122
124
|
graphLoadedProm.resolve(graph);
|
|
123
125
|
});
|
|
124
126
|
|
|
127
|
+
async function createNodesToAvoid (graph) {
|
|
128
|
+
const poisToAvoid = await app.bus.get('dynamicRouting/poisToAvoid');
|
|
129
|
+
const nodesToAvoid = poisToAvoid.map(poi => graph.findClosestNode(poi.position.floorId, poi.position.latitude, poi.position.longitude).id);
|
|
130
|
+
return nodesToAvoid
|
|
131
|
+
}
|
|
132
|
+
|
|
125
133
|
const prepareSecurityLanes = async () => {
|
|
126
134
|
const securityPois = await app.bus.get('poi/getByCategoryId', { categoryId: 'security' });
|
|
127
135
|
return R__namespace.pipe(R__namespace.map(getSecurityLane), R__namespace.filter(R__namespace.identity))(securityPois)
|
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e="web-engine",s="3.3.
|
|
1
|
+
var e="web-engine",s="3.3.389",o="UNLICENSED",l="module",t="src/main.js",r=["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/**'",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:vitest":"vitest run"},i=["defaults"],n={react:"^18.3.1"},c={"@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","@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","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:"^18.3.1","react-compound-slider":"^3.3.1","react-dom":"^18.3.1","react-json-editor-ajrm":"^2.5.13","react-qr-svg":"^2.2.1","react-svg":"^16.1.29","react-virtualized-auto-sizer":"^1.0.2","react-window":"^1.8.11","smoothscroll-polyfill":"^0.4.4","styled-components":"^6.1.14","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"},p={"@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","@types/react":"^19.0.10","@types/react-dom":"^19.0.4","@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-plugin-styled-components":"^2.1.4","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"},d="yarn@4.3.1",m={node:"20.x"},u={},b={name:e,version:s,private:!0,license:o,type:l,main:t,workspaces:r,scripts:a,"lint-staged":{"*.js":["eslint --fix"]},browserslist:i,resolutions:n,dependencies:c,devDependencies:p,packageManager:d,engines:m,nx:u};export{i as browserslist,b as default,c as dependencies,p as devDependencies,m as engines,o as license,t as main,e as name,u as nx,d as packageManager,n as resolutions,a as scripts,l as type,s as version,r as workspaces};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a={868:{category:"portal",description:"Elevator",poiId:"868",position:{floorId:"staticdca-terminals-departures",latitude:38.851973,longitude:-77.082142},dynamicData:{"dynamic-routing":{navGraphHidden:!0,navGraphHiddenReason:"reason 2",expiration:2055958719e3}}},869:{category:"portal",description:"Elevator",poiId:"869",position:{floorId:"staticdca-terminals-departures",latitude:38.851973,longitude:-77.082142},dynamicData:{"dynamic-routing":{navGraphHidden:!0,navGraphHiddenReason:"reason 2",expiration:2055958719e3}}}};export{a as dynamicRoutingData};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"zousan";import{processParkingPOIS as
|
|
1
|
+
import{DateTime as t}from"luxon";import*as n from"ramda";import e from"zousan";import{dynamicRoutingData as a}from"../mocks/mockDynamicRoutingData.js";import{processParkingPOIS as o,processSecurityWaitTimes as i,mutateSecurityCheckpointLabel as s,processOpenClosedPois as c}from"./processors.js";let r=3e4;const u="x-account-id";function d(d,l={}){const m={dynamicDataNotPending:new e,poisToAvoid:new e},p=d.gt();l._overrideRefreshFrequency&&(r=l._overrideRefreshFrequency),d.bus.on("system/readywhenyouare",(()=>m.dynamicDataNotPending)),d.bus.on("dynamicRouting/poisToAvoid",(()=>m.poisToAvoid));const y=async t=>{const n={};for(const e of t){const t=await d.bus.get("poi/getById",{id:e});t&&(n[e]=t.name)}return n};return{init:async()=>{const[e,g]=await Promise.all([d.bus.get("venueData/getAccountId"),d.bus.get("venueData/getVenueId")]),f=`https://marketplace.locuslabs.com/venueId/${g}/dynamic-poi`;let v,h=0,D=0;const b=async()=>{const r=await fetch(f,{headers:{[u]:e}});if(r.ok)return r.json().then((({data:e})=>async function(e){(function(t){const n=o(t);d.bus.send("poi/setDynamicData",{plugin:"parking",idValuesMap:n})})(e),function(t){const n=c(t);d.bus.send("poi/setDynamicData",{plugin:"open-closed-status",idValuesMap:n})}(e),async function(t){const n=i(t);d.bus.send("poi/setDynamicData",{plugin:"security",idValuesMap:n});const e=await y(Object.keys(n));d.bus.send("map/mutateFeature",{functor:s(p,n,e)})}(e),await async function(e){let a=[];if(!l.dynamicRoutingEnabled)return void m.poisToAvoid.resolve(a);const o=t.now().toMillis(),i=Object.values(n.filter((t=>{const e=n.path(["dynamicData","dynamic-routing","navGraphHidden"],t),a=n.path(["dynamicData","dynamic-routing","expiration"],t);return!0===e&&a>o}),e));if(i.length>0){const t=await d.bus.get("poi/getAll");a=Object.values(t).length>0?i.map((n=>t[n?.poiId])):[]}m.poisToAvoid.resolve(a)}(a)}(e))).then((()=>{D++})).catch(console.error);console.warn("dynamicPois: fetch response status not ok",r),h++,h>=3&&h>D&&clearInterval(v)},w=await d.bus.get("venueData/getQueueTypes");return w.SecurityLane&&w.SecurityLane.length?b().then((()=>{v=setInterval(b,r)})).finally((()=>m.dynamicDataNotPending.resolve(!0))):m.dynamicDataNotPending.resolve(!0)}}}export{d as create};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{pick as t,isNil as o,map as n,omit as e,path as r}from"ramda";import{encode as i,calculateAdjacent as s}from"../../../src/extModules/geohasher.js";import{distance as l}from"../../../src/utils/geodesy.js";import
|
|
1
|
+
import{pick as t,isNil as o,map as n,omit as e,path as r}from"ramda";import{encode as i,calculateAdjacent as s}from"../../../src/extModules/geohasher.js";import{distance as l}from"../../../src/utils/geodesy.js";import d from"./minPriorityQueue.js";function u(r,s,l,d){const u={},c={},a=new Set;let h={};r.nodes.forEach((o=>{const n=s(o.floorId),e=l(o.floorId);!function(t){const o=t.floorId+":"+i(t.lat,t.lng).substr(0,7),n=t.floorId+":"+i(t.lat,t.lng).substr(0,8);c[o]||(c[o]=[]);c[o].push(t),c[n]||(c[n]=[]);c[n].push(t),u[t.id]=t}({...t(["id","lat","lng","floorId"],o),edges:[],ordinal:n,structureId:e})})),r.edges.forEach((t=>u[t.s].edges.push(function(t,n){const e=function(t){return t.x?"Security Checkpoint":""===t.t?"Ground":t.t}(t),r="escalator"!==e.toLowerCase()&&"stairs"!==e.toLowerCase(),i=f(t.s,t.d,n),s=t.l||i/60,l=t=>t.map((t=>({start:{lat:t.s[0],lng:t.s[1]},out:{lat:t.o[0],lng:t.o[1]},in:{lat:t.i[0],lng:t.i[1]},end:{lat:t.e[0],lng:t.e[1]}}))),d=t.p?l(t.p):null;return{distance:i,dst:t.d,o:t.o,isAccessible:r,isDriveway:!o(t.h)&&!t.h,src:t.s,transitTime:s,type:e,path:d,weight:s}}(t,u))));const p=t=>{if(void 0===t.floorId&&void 0===t.ordinal)throw Error("Endpoint specified in findRoute without floorId nor an ordinal");const o=t.lat||t.latitude,n=t.lng||t.longitude;return t.floorId?w(t.floorId,o,n,c,u):T(t.ordinal,o,n,u)};return{_nodes:u,_geoDb:c,_nodesToAvoid:a,addNodesToAvoid:t=>function(t){a.clear(),t.forEach((t=>a.add(t)))}(t),findClosestNode:(t,o,n)=>w(t,o,n,c,u),findShortestPath:(t,o,n)=>function(t,o,n,e={}){return I(p(t),p(o),n,a,h,d,e)}(t,o,u,n),findAllShortestPaths:function(t,o,n){const e=p(t),r=o.map((t=>p(t)));return e&&r.length?function(t,o,n,e,r={},i={},s={}){return o.map((o=>{try{return I(t,o,n,e,r,i,s)}catch(t){return null}}))}(e,r,u,a,h,d,n):[]},floorIdToOrdinal:s,floorIdToStructureId:l,updateWithSecurityWaitTime:function(t){h=n(e(["lastUpdated"]),t),y()},clearCache:y}}function f(t,o,n){const e=n[t],r=n[o];return l(e.lat,e.lng,r.lat,r.lng)}let c,a,h,p,g,m;const y=()=>{c={},a={},h={},p=new d,g=null,m={}};function I(t,o,n,e,i={},s={},l={}){for(t.id===g&&m===JSON.stringify(l)||(y(),p.offerWithPriority(t.id,0),c[t.id]=0,h[t.id]=!0,g=t.id,m=JSON.stringify(l));!p.isEmpty()&&!h[o.id];){const t=n[p.poll()],o=c[t.id];for(let n=0;n<t.edges.length;n++){const d=t.edges[n];if(e.size>0&&e.has(d.dst))continue;if(h[d.dst])continue;if(l.requiresAccessibility&&!d.isAccessible)continue;let u=d.weight;if(d.o&&i[d.o]){const t=i[d.o];t.queueTime&&(u=t.queueTime),t.isTemporarilyClosed&&(u=9999),d.securityWaitTimes=t}if(d.o&&s[d.o]){d.securityLane=s[d.o];const{type:t,id:o}=s[d.o],n=r(["selectedSecurityLanes",t],l);if(n&&!n.includes(o))continue}void 0===c[d.dst]?(a[d.dst]=t,c[d.dst]=o+u,p.offerWithPriority(d.dst,o+u)):c[d.dst]>o+u&&(c[d.dst]=o+u,a[d.dst]=t,p.raisePriority(d.dst,o+u))}h[t.id]=!0}if(!h[o.id])return null;const d=[];let u=o;for(;u;)d.push(u),u=a[u.id];return d.reverse()}function b(t,o,n,e){const r=o.substr(0,e),i=[];i.push(t+":"+s(s(r,"top"),"left")),i.push(t+":"+s(r,"top")),i.push(t+":"+s(s(r,"top"),"right")),i.push(t+":"+s(r,"left")),i.push(t+":"+r),i.push(t+":"+s(r,"right")),i.push(t+":"+s(s(r,"bottom"),"left")),i.push(t+":"+s(r,"bottom")),i.push(t+":"+s(s(r,"bottom"),"right"));const l=[];for(let t=0;t<i.length;t++){const o=n[i[t]];if(o)for(let t=0;t<o.length;t++)l.push(o[t])}return l}function w(t,o,n,e,r){const s=function(t,o,n){let e=b(t,o,n,8);return e.length>0?e:(e=b(t,o,n,7),e.length>0?e:null)}(t,i(o,n),e)||function(t,o,n,e){const r=Object.values(e).filter((o=>o.floorId===t)).map((t=>[t,l(t.lat,t.lng,o,n)]));if(!r.length)throw Error(`findClosestNodeByFloor2 found no nodes on floor ${t}`);return v(r)}(t,o,n,r),d=[];for(let t=0;t<s.length;t++){const e=l(o,n,s[t].lat,s[t].lng);d.push([s[t],e])}d.sort((function(t,o){return t[1]-o[1]}));const u=[];for(let t=0;t<d.length;t++)u.push(d[t][0]);return u[0]}function T(t,o,n,e){const r=Object.values(e).filter((o=>o.ordinal===t)).map((t=>[t,l(t.lat,t.lng,o,n)]));if(!r.length)throw Error(`findClosestNodeByOrdinal found no nodes on ordinal ${t}`);return v(r)}function v(t){let o=t[0];for(let n=1;n<t.length;n++)t[n][1]<o[1]&&(o=t[n]);return o[0]}export{u as createNavGraph,T as findClosestNodeByOrdinal,I as findShortestPath};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as t from"ramda";import n from"zousan";import{buildStructuresLookup as o}from"../../../src/utils/buildStructureLookup.js";import{distance as
|
|
1
|
+
import*as t from"ramda";import n from"zousan";import{buildStructuresLookup as o}from"../../../src/utils/buildStructureLookup.js";import{distance as i}from"../../../src/utils/geodesy.js";import{findRoute as e}from"./findRoute.js";import{createNavGraph as r}from"./navGraph.js";import{enrichDebugNavGraph as a}from"./navGraphDebug.js";import{buildSegments as s}from"./segmentBuilder.js";const u={SECURITY:"SecurityLane",IMMIGRATION:"ImmigrationLane"};function d(d,l){const p=d.log.sublog("wayfinder"),c=async()=>{d.bus.send("venueData/loadNavGraph")};let f=new n;d.bus.on("wayfinder/_getNavGraph",(()=>f)),d.bus.on("venueData/navGraphLoaded",(async({navGraphData:t,structures:n})=>{const i=o(n),e=await y(),a=r(t,i.floorIdToOrdinal,i.floorIdToStructureId,e),s=await async function(t){const n=(await d.bus.get("dynamicRouting/poisToAvoid")).map((n=>t.findClosestNode(n.position.floorId,n.position.latitude,n.position.longitude).id));return n}(a);a.addNodesToAvoid(s),f.resolve(a)}));const y=async()=>{const n=await d.bus.get("poi/getByCategoryId",{categoryId:"security"});return t.pipe(t.map(m),t.filter(t.identity))(n)},m=n=>n.queue&&{type:t.path(["queue","queueType"],n),id:t.path(["queue","queueSubtype"],n)};d.bus.on("wayfinder/showNavLineFromPhysicalLocation",(async({toEndpoint:t,selectedSecurityLanes:n=null,requiresAccessibility:o})=>async function(t,n,o){const i=await b({fromEndpoint:t,toEndpoint:n,options:o});if(i){const{segments:t}=i;o.primary&&d.bus.send("map/resetNavlineFeatures"),d.bus.send("map/showNavlineFeatures",{segments:t,category:o.primary?"primary":"alternative"})}return i}(await d.bus.getFirst("user/getPhysicalLocation"),t,{selectedSecurityLanes:n,requiresAccessibility:o,primary:!0})));const g=(t,n)=>d.bus.get("poi/getById",{id:t}).then((o=>{if(o&&o.position)return w(o,n);throw Error("Unknown POI ID "+t)}));const h=["lat","lng","floorId","ordinal"],I=t.pipe(t.pick(h),t.keys,t.propEq(h.length,"length"),Boolean),w=(t,n)=>({lat:t.position.latitude,lng:t.position.longitude,floorId:t.position.floorId,ordinal:n(t.position.floorId),title:t.name});async function b({fromEndpoint:t,toEndpoint:n,options:o={}}){const i=await d.bus.get("poi/getAll")||{},r=Array.isArray(i)?i[0]:i,a=Object.values(r).filter((t=>t.category&&t.category.startsWith("security")));return f.then((async i=>{o.compareFindPaths=l.compareFindPaths;const r=e(i,t,n,o);if(!r)return null;t.floorId&&n.floorId&&T(t,n,r);const u=await d.bus.get("venueData/getFloorIdToNameMap"),c=await d.bus.get("venueData/getQueueTypes"),f=d.gt(),y=o.requiresAccessibility,{steps:m,segments:g}=s(r.waypoints,t,n,u,f,c,y,a);p.info("route",r);const h=Math.round(r.waypoints.reduce(((t,{eta:n})=>t+n),0)),I=Math.round(r.waypoints.reduce(((t,{distance:n})=>t+n),0));return{...r,segments:g,steps:m,time:h,distance:I}}))}d.bus.on("wayfinder/getNavigationEndpoint",(({ep:t})=>async function(t){return f.then((n=>{if(!t)throw Error("wayfinder: Invalid endpoint definition",t);if("number"==typeof t)return g(t,n.floorIdToOrdinal);if("string"==typeof t){if(t.match(/^\d+$/))return g(parseInt(t),n.floorIdToOrdinal);if(t.indexOf(",")>0){let[o,i,e,r]=t.split(",");if(!n.floorIdToStructureId(e))throw Error("Unknown floorId in endpoint: "+e);return r||(r="Starting Point"),{lat:parseFloat(o),lng:parseFloat(i),ordinal:n.floorIdToOrdinal(e),floorId:e,title:r}}}if(I(t))return t;if(t.latitude)return{lat:t.latitude,lng:t.longitude,floorId:t.floorId,ordinal:n.floorIdToOrdinal(t.floorId),title:t.title};if(t.position&&t.name)return w(t,n.floorIdToOrdinal);throw Error("Invalid start or end point: "+t)}))}(t))),d.bus.on("wayfinder/checkIfPathHasSecurity",(({fromEndpoint:n,toEndpoint:o,options:i={}})=>f.then((r=>{i.compareFindPaths=l.compareFindPaths;const a=e(r,n,o,i);if(!a)return{routeExists:!1};const s=n=>Boolean(a.waypoints.find(t.pathEq(n,["securityLane","type"])));return{routeExists:!0,queues:a.waypoints.filter((n=>t.pathEq(u.SECURITY,["securityLane","type"],n)||t.pathEq(u.IMMIGRATION,["securityLane","type"],n))),hasSecurity:s(u.SECURITY),hasImmigration:s(u.IMMIGRATION)}})))),d.bus.on("wayfinder/getRoute",b);const T=(t,n,o)=>d.bus.send("session/submitEvent",{type:"navigation",startPosition:{venueId:t.floorId.split("-")[0],buildingId:o.waypoints[0].position.structureId,floorId:o.waypoints[0].position.floorId,lat:o.waypoints[0].position.lat,lng:o.waypoints[0].position.lng},endPosition:{venueId:n.floorId.split("-")[0],buildingId:o.waypoints[o.waypoints.length-1].position.structureId,floorId:o.waypoints[o.waypoints.length-1].position.floorId,lat:o.waypoints[o.waypoints.length-1].position.lat,lng:o.waypoints[o.waypoints.length-1].position.lng}});function v(n,o,i,e){let r=t.clone(n);return r=E(r,i,e),o&&o.length?{...r,transitTime:S(o,"transitTime"),distance:S(o,"distance")}:(r.distance="start"===e?P(r,i):P(i,r),r.transitTime=L(r.distance),r)}function S(n,o){return t.aperture(2,n).map((([n,o])=>{return(i=o.id,n=>t.find((t=>t.dst===i),n.edges))(n);var i})).map(t.prop(o)).reduce(((t,n)=>t+n),0)}function E(t,n,o){return{...t,[o+"Information"]:{lat:n?.lat||n?.position?.latitude,lng:n?.lng||n?.position?.longitude,floorId:n?.floorId||n?.position?.floorId}}}function P(t,n){return i(n?.lat||n?.position?.latitude,n?.lng||n?.position?.longitude,t?.lat||t?.position?.latitude,t?.lng||t?.position?.longitude)}function L(t){return t/60}function O(n){const o=n.filter((t=>null!==t));return t.sortBy(t.propOr(1/0,"transitTime"),o)}function A(n,o,i,e,r){const a=q(o,e,n),s=q(i,n,r);if(!a||!s)return null;const u=N(o,a),d=N(i,s);let l=t.clone(n);return l=E(l,e,"start"),l=E(l,r,"end"),{...l,transitTime:u+d,distance:a+s,startInformation:{...l.startInformation,transitTime:u,distance:a},endInformation:{...l.endInformation,transitTime:d,distance:s}}}function N(t,n){return t&&t.length?S(t,"transitTime"):L(n)}function q(t,n,o){return t&&t.length?S(t,"distance"):P(o,n)}return d.bus.on("wayfinder/addPathTimeSingle",(async({poi:t,startLocation:n,options:o={}})=>n?f.then((i=>function(t,n,o,i){const e=w(o,t.floorIdToOrdinal),r=t.findShortestPath(i,e,n);return v(o,r,i,"start")}(i,o,t,n))):t)),d.bus.on("wayfinder/addPathTimeMultiple",(async({pois:n,startLocation:o,options:i={}})=>o?f.then((e=>function(n,o,i,e){try{const r=t.clone(i),a=r.map((t=>w(t,n.floorIdToOrdinal))),s=n.findAllShortestPaths(e,a,o);return O(r.map(((t,n)=>v(t,s[n],e,"start"))))}catch(t){return p.error(t),i}}(e,i,n,o))):n)),d.bus.on("wayfinder/multipointAddPathTimeMultiple",(async({pois:n,startLocation:o,endLocation:i,options:e={}})=>o||i?f.then((r=>function(n,o,i,e,r){try{const a=t.clone(i),s=a.map((t=>w(t,n.floorIdToOrdinal)));let u,d,l;return e&&(u=n.findAllShortestPaths(e,s,o)),r&&(d=function(t,n,o,i){const e=[];for(const r of n)e.push(t.findShortestPath(r,o,i));return e}(n,s,r,o)),l=e&&r?a.map(((t,n)=>A(t,u[n],d[n],e,r))):e?a.map(((t,n)=>v(t,u[n],e,"start"))):a.map(((t,n)=>v(t,d[n],r,"end"))),O(l)}catch(t){return p.error(t),i}}(r,e,n,o,i))):n)),d.bus.on("wayfinder/multipointAddPathTimeSingle",(async({poi:t,startLocation:n,endLocation:o,options:i={}})=>n||o?f.then((e=>function(t,n,o,i,e){const r=w(o,t.floorIdToOrdinal);let a,s;i&&(a=t.findShortestPath(i,r,n));e&&(s=t.findShortestPath(r,e,n));return i&&e?A(o,a,s,i,e):i?v(o,a,i,"start"):e?v(o,s,e,"end"):o}(e,i,t,n,o))):t)),d.bus.on("venueData/loadNewVenue",(()=>{f=new n,c()})),d.bus.on("poi/setDynamicData",(({plugin:t,idValuesMap:n})=>{"security"===t&&f.then((t=>t.updateWithSecurityWaitTime(n)))})),d.bus.on("wayfinder/getNavGraphFeatures",(()=>f.then((({_nodes:t})=>a(t))))),{init:c,internal:{resolveNavGraph:t=>f.resolve(t),prepareSecurityLanes:y}}}export{u as SecurityLaneType,d as create};
|
package/package.json
CHANGED