atriusmaps-node-sdk 3.3.1013 → 3.3.1018
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
CHANGED
|
@@ -41,9 +41,9 @@ async function create(app) {
|
|
|
41
41
|
const floor = structuresLookup.floorIdToFloor(position.floorId);
|
|
42
42
|
const detailedPosition = {
|
|
43
43
|
...position,
|
|
44
|
-
structureName: structure.name,
|
|
44
|
+
structureName: poi.structureNameOverride || structure.name,
|
|
45
45
|
buildingId: structure.id,
|
|
46
|
-
floorName: floor.name,
|
|
46
|
+
floorName: poi.levelNameOverride || floor.name,
|
|
47
47
|
floorOrdinal: floor.ordinal
|
|
48
48
|
};
|
|
49
49
|
return { ...poi, position: detailedPosition };
|
|
@@ -286,6 +286,7 @@ async function create(app) {
|
|
|
286
286
|
runTest,
|
|
287
287
|
internal: {
|
|
288
288
|
addImages,
|
|
289
|
+
fixPositionInfo,
|
|
289
290
|
pseudoTransPoi,
|
|
290
291
|
applyPoiNameOverride
|
|
291
292
|
}
|
package/dist/cjs/src/app.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var R = require('ramda');
|
|
4
|
-
var
|
|
4
|
+
var evaluate = require('zousan/evaluate');
|
|
5
|
+
var series = require('zousan/series');
|
|
5
6
|
var i18n = require('./utils/i18n.js');
|
|
6
7
|
var isInitialState = require('./utils/isInitialState.js');
|
|
7
8
|
var _package = require('../package.json.js');
|
|
@@ -85,7 +86,7 @@ async function extendConfig(config, extendsConfigs) {
|
|
|
85
86
|
return newConfig;
|
|
86
87
|
}
|
|
87
88
|
const createPostProcessor = (name) => (config) => import(`./configs/postproc-${name}.ts`).then((pp) => pp.process(config));
|
|
88
|
-
const handleConfigPostProcess = async (config) => config.configPostProc ?
|
|
89
|
+
const handleConfigPostProcess = async (config) => config.configPostProc ? series.series(config, ...config.configPostProc.map(createPostProcessor)) : config;
|
|
89
90
|
async function create(rawConfig) {
|
|
90
91
|
const appInstance = /* @__PURE__ */ Object.create(null);
|
|
91
92
|
let config = rawConfig.extends ? await extendConfig(rawConfig, rawConfig.extends) : rawConfig;
|
|
@@ -134,18 +135,19 @@ async function create(rawConfig) {
|
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
137
|
appInstance.env = env.buildEnv(appInstance);
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
const { theme } = config;
|
|
139
|
+
if (theme) {
|
|
140
|
+
await evaluate.evaluateResults(
|
|
139
141
|
{ name: "ThemeManagerModule", value: Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('../_virtual/_empty_module_placeholder.js')); }) },
|
|
140
142
|
{ name: "HistoryManager", value: Promise.resolve().then(function () { return require('./historyManager.js'); }) },
|
|
141
143
|
{ name: "LayerManager", value: Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('../_virtual/_empty_module_placeholder.js')); }) }
|
|
142
144
|
).then(async ({ LayerManager, HistoryManager, ThemeManagerModule }) => {
|
|
143
145
|
const ThemeManager = ThemeManagerModule.initThemeManager(appInstance);
|
|
144
|
-
appInstance.themePack = await ThemeManager.buildTheme(
|
|
146
|
+
appInstance.themePack = await ThemeManager.buildTheme(theme, config.defaultTheme);
|
|
145
147
|
isInitialState.startInitialStateListener();
|
|
146
148
|
LayerManager.initLayerManager(appInstance);
|
|
147
149
|
HistoryManager.initHistoryManager(appInstance);
|
|
148
|
-
appInstance.destroy = () => LayerManager.destroy(
|
|
150
|
+
appInstance.destroy = () => LayerManager.destroy();
|
|
149
151
|
});
|
|
150
152
|
} else {
|
|
151
153
|
appInstance.destroy = () => {
|
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var a="3.3.
|
|
1
|
+
var a="3.3.1018",e={version:a};export{e as default,a as version};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"ramda";import o from"zousan";import{buildStructuresLookup as t}from"../../../src/utils/buildStructureLookup.js";import{debugIsTrue as a}from"../../../src/utils/configUtils.js";import{toLang as i}from"../../../src/utils/i18n.js";async function n(i){const n=i.log.sublog("poiDataManager"),u=()=>{i.bus.send("venueData/loadPoiData")};let p=new o;const d=(e,o)=>{const{position:t}=e,a=o.floorIdToStructure(t.floorId);if(!a)return n.error(`No structure found for floorId: ${t.floorId} for POI ${e.poiId}`),{...e};const i=o.floorIdToFloor(t.floorId),r={...t,structureName:a.name,buildingId:a.id,floorName:i.name,floorOrdinal:i.ordinal};return{...e,position:r}},l=(e,o)=>{e.roomInfo||(e.roomInfo=[]),e.roomInfo.push(o)},c=e.pipe(e.propOr([],"externalIds"),e.find(e.propEq("roomId","type")),e.prop("id"),e.unless(e.isNil,e.tail));i.bus.on("venueData/poiDataLoaded",async({pois:o,structures:r})=>{if(o=((o,t)=>e.pipe(e.values,e.map(e=>{e.distance=null,e.staticName=e.name,e.isNavigable=void 0===e.isNavigable||!0===e.isNavigable,e.capacity&&l(e,{name:`Seats ${e.capacity.join("-")}`,svgId:"number-of-seats"}),e.category.startsWith("meeting")&&l(e,{name:i.gt()("poiView:Conference Room"),svgId:"conference-room"});const o=c(e);return o&&(e.roomId=o),[e.poiId,d(e,t)]}),e.fromPairs)(o))(o,t(r)),a(i,"pseudoTransPois"))for(const e in o)o[e]=s(o[e],i.i18n().language);o=function(e){const o=[];return Object.values(e).forEach(e=>{try{const t=e.position;t?["buildingId","structureName","floorId","floorName","floorOrdinal","latitude","longitude"].forEach(a=>{null!==t[a]&&void 0!==t[a]||o.push({id:e.poiId,e:`invalid position property: ${a}: ${t[a]}`})}):o.push({poi:e,e:"No position information"})}catch(t){n.error(t),o.push({id:e.poiId,e:t.message})}}),o.length&&(n.warn("badPois:",o),o.forEach(o=>{delete e[o.id]})),e}(o),await async function(e){for(const o of Object.values(e))await I(o);return e}(o),p.resolve(o),i.config.debug&&i.env.isBrowser&&(window._pois=o),i.config.debug&&async function(e){const o=Date.now(),t=[],a=await i.bus.get("wayfinder/_getNavGraph");Object.values(e).forEach(e=>{try{const o=e.position;a.findClosestNode(o.floorId,o.latitude,o.longitude)||t.push({id:e.poiId,e:"No closest Navgraph Node"})}catch(o){n.error(o),t.push({id:e.poiId,e:o.message})}}),t.length&&n.warn("badPois:",t),n(`Total time for navgraph POI check: ${Date.now()-o}ms`)}(o)}),i.bus.on("poi/getById",async({id:e})=>p.then(o=>o[e])),i.bus.on("poi/getByFloorId",async({floorId:o})=>p.then(e.pickBy(e.pathEq(o,["position","floorId"])))),i.bus.on("poi/getByCategoryId",async({categoryId:o})=>p.then(e.pickBy(e=>e.category===o||e.category.startsWith(o+".")))),i.bus.on("poi/getAll",async()=>p);const m=["queue","primaryQueueId"],f=(o,t,a)=>{const i=e.path(["queue","queueType"],t);if(!i)return null;const n=o[i],r=e.path(m,t);return a.filter(e.pathEq(r,m)).filter(e=>e.poiId!==t.poiId).map(o=>{const t=e.path(["queue","queueSubtype"],o),a=g(t)(n);return{poiId:o.poiId,...a}})},g=o=>{return e.pipe(e.find(e.propEq(o,"id")),(t=`No queue found with ID: ${o}`,e=>{if(null!=e)return e;throw Error(t)}),e.pick(["displayText","imageId"]));var t};i.bus.on("poi/addOtherSecurityLanes",({poi:o})=>(async o=>{if(!e.path(m,o))return o;const t=await i.bus.get("venueData/getQueueTypes"),a=await i.bus.get("poi/getByCategoryId",{categoryId:"security"}),n=Object.values(a);return o.queue.otherQueues=f(t,o,n),o})(o));const y=e=>!!e?.startsWith("https:");async function I(t){if(!t)return;const a="undefined"==typeof window?1:window.devicePixelRatio||1,n=`${Math.round(351*a)}x${Math.round(197*a)}`;return e.length(t.images)?y(t.images[0])||(t.images=await o.all(t.images.map(e=>i.bus.get("venueData/getPoiImageUrl",{imageName:e,size:n})))):t.images=[],e.length(t.fullImages)?y(t.fullImages[0]?.url)||(t.fullImages=await o.all(t.fullImages.map(async({url:e,...o})=>({url:await i.bus.get("venueData/getPoiImageUrl",{imageName:e,size:n}),...o})))):t.fullImages=[],t}const h=e.memoizeWith(e.identity,e.pipe(e.pluck("category"),e.values,e.uniq));i.bus.on("poi/getAllCategories",async()=>p.then(h)),i.bus.on("venueData/loadNewVenue",()=>{p=new o,u()}),i.bus.on("poi/setDynamicData",({plugin:o,idValuesMap:t})=>{p.then(a=>{for(const i in t){const n=a[i].dynamicData||{};n[o]={...t[i]};const r=e.mergeRight(a[i],{dynamicData:n});a[i]=r}})}),i.bus.on("poi/setCoreAttributes",e=>{p.then(o=>{const t=[];for(const a in e){r(o,a,e[a]?.name)&&(i.bus.send("map/mutateFeature",{poiId:a,name:o[a].name}),t.push(o[a]))}t.length>0&&i.bus.send("poi/updated",{pois:t})})});return{init:u,runTest:async e=>(await e(),p),internal:{addImages:I,pseudoTransPoi:s,applyPoiNameOverride:r}}}function r(e,o,t){return!!e[o]&&(e[o].name=t||e[o].staticName,!0)}function s(e,o){return["description","nearbyLandmark","name","phone","operationHours"].forEach(t=>{e[t]&&(e[t]=i(e[t],o))}),e.keywords&&(e.keywords=e.keywords.map(e=>(e.name=i(e.name,o),e))),e.position.floorName&&(e.position.floorName=i(e.position.floorName,o)),e.position.structureName&&(e.position.structureName=i(e.position.structureName,o)),e}export{r as applyPoiNameOverride,n as create};
|
|
1
|
+
import*as e from"ramda";import o from"zousan";import{buildStructuresLookup as t}from"../../../src/utils/buildStructureLookup.js";import{debugIsTrue as a}from"../../../src/utils/configUtils.js";import{toLang as i}from"../../../src/utils/i18n.js";async function n(i){const n=i.log.sublog("poiDataManager"),u=()=>{i.bus.send("venueData/loadPoiData")};let p=new o;const d=(e,o)=>{const{position:t}=e,a=o.floorIdToStructure(t.floorId);if(!a)return n.error(`No structure found for floorId: ${t.floorId} for POI ${e.poiId}`),{...e};const i=o.floorIdToFloor(t.floorId),r={...t,structureName:e.structureNameOverride||a.name,buildingId:a.id,floorName:e.levelNameOverride||i.name,floorOrdinal:i.ordinal};return{...e,position:r}},l=(e,o)=>{e.roomInfo||(e.roomInfo=[]),e.roomInfo.push(o)},c=e.pipe(e.propOr([],"externalIds"),e.find(e.propEq("roomId","type")),e.prop("id"),e.unless(e.isNil,e.tail));i.bus.on("venueData/poiDataLoaded",async({pois:o,structures:r})=>{if(o=((o,t)=>e.pipe(e.values,e.map(e=>{e.distance=null,e.staticName=e.name,e.isNavigable=void 0===e.isNavigable||!0===e.isNavigable,e.capacity&&l(e,{name:`Seats ${e.capacity.join("-")}`,svgId:"number-of-seats"}),e.category.startsWith("meeting")&&l(e,{name:i.gt()("poiView:Conference Room"),svgId:"conference-room"});const o=c(e);return o&&(e.roomId=o),[e.poiId,d(e,t)]}),e.fromPairs)(o))(o,t(r)),a(i,"pseudoTransPois"))for(const e in o)o[e]=s(o[e],i.i18n().language);o=function(e){const o=[];return Object.values(e).forEach(e=>{try{const t=e.position;t?["buildingId","structureName","floorId","floorName","floorOrdinal","latitude","longitude"].forEach(a=>{null!==t[a]&&void 0!==t[a]||o.push({id:e.poiId,e:`invalid position property: ${a}: ${t[a]}`})}):o.push({poi:e,e:"No position information"})}catch(t){n.error(t),o.push({id:e.poiId,e:t.message})}}),o.length&&(n.warn("badPois:",o),o.forEach(o=>{delete e[o.id]})),e}(o),await async function(e){for(const o of Object.values(e))await I(o);return e}(o),p.resolve(o),i.config.debug&&i.env.isBrowser&&(window._pois=o),i.config.debug&&async function(e){const o=Date.now(),t=[],a=await i.bus.get("wayfinder/_getNavGraph");Object.values(e).forEach(e=>{try{const o=e.position;a.findClosestNode(o.floorId,o.latitude,o.longitude)||t.push({id:e.poiId,e:"No closest Navgraph Node"})}catch(o){n.error(o),t.push({id:e.poiId,e:o.message})}}),t.length&&n.warn("badPois:",t),n(`Total time for navgraph POI check: ${Date.now()-o}ms`)}(o)}),i.bus.on("poi/getById",async({id:e})=>p.then(o=>o[e])),i.bus.on("poi/getByFloorId",async({floorId:o})=>p.then(e.pickBy(e.pathEq(o,["position","floorId"])))),i.bus.on("poi/getByCategoryId",async({categoryId:o})=>p.then(e.pickBy(e=>e.category===o||e.category.startsWith(o+".")))),i.bus.on("poi/getAll",async()=>p);const m=["queue","primaryQueueId"],f=(o,t,a)=>{const i=e.path(["queue","queueType"],t);if(!i)return null;const n=o[i],r=e.path(m,t);return a.filter(e.pathEq(r,m)).filter(e=>e.poiId!==t.poiId).map(o=>{const t=e.path(["queue","queueSubtype"],o),a=g(t)(n);return{poiId:o.poiId,...a}})},g=o=>{return e.pipe(e.find(e.propEq(o,"id")),(t=`No queue found with ID: ${o}`,e=>{if(null!=e)return e;throw Error(t)}),e.pick(["displayText","imageId"]));var t};i.bus.on("poi/addOtherSecurityLanes",({poi:o})=>(async o=>{if(!e.path(m,o))return o;const t=await i.bus.get("venueData/getQueueTypes"),a=await i.bus.get("poi/getByCategoryId",{categoryId:"security"}),n=Object.values(a);return o.queue.otherQueues=f(t,o,n),o})(o));const y=e=>!!e?.startsWith("https:");async function I(t){if(!t)return;const a="undefined"==typeof window?1:window.devicePixelRatio||1,n=`${Math.round(351*a)}x${Math.round(197*a)}`;return e.length(t.images)?y(t.images[0])||(t.images=await o.all(t.images.map(e=>i.bus.get("venueData/getPoiImageUrl",{imageName:e,size:n})))):t.images=[],e.length(t.fullImages)?y(t.fullImages[0]?.url)||(t.fullImages=await o.all(t.fullImages.map(async({url:e,...o})=>({url:await i.bus.get("venueData/getPoiImageUrl",{imageName:e,size:n}),...o})))):t.fullImages=[],t}const h=e.memoizeWith(e.identity,e.pipe(e.pluck("category"),e.values,e.uniq));i.bus.on("poi/getAllCategories",async()=>p.then(h)),i.bus.on("venueData/loadNewVenue",()=>{p=new o,u()}),i.bus.on("poi/setDynamicData",({plugin:o,idValuesMap:t})=>{p.then(a=>{for(const i in t){const n=a[i].dynamicData||{};n[o]={...t[i]};const r=e.mergeRight(a[i],{dynamicData:n});a[i]=r}})}),i.bus.on("poi/setCoreAttributes",e=>{p.then(o=>{const t=[];for(const a in e){r(o,a,e[a]?.name)&&(i.bus.send("map/mutateFeature",{poiId:a,name:o[a].name}),t.push(o[a]))}t.length>0&&i.bus.send("poi/updated",{pois:t})})});return{init:u,runTest:async e=>(await e(),p),internal:{addImages:I,fixPositionInfo:d,pseudoTransPoi:s,applyPoiNameOverride:r}}}function r(e,o,t){return!!e[o]&&(e[o].name=t||e[o].staticName,!0)}function s(e,o){return["description","nearbyLandmark","name","phone","operationHours"].forEach(t=>{e[t]&&(e[t]=i(e[t],o))}),e.keywords&&(e.keywords=e.keywords.map(e=>(e.name=i(e.name,o),e))),e.position.floorName&&(e.position.floorName=i(e.position.floorName,o)),e.position.structureName&&(e.position.structureName=i(e.position.structureName,o)),e}export{r as applyPoiNameOverride,n as create};
|
package/dist/src/app.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{map as e,mergeDeepRight as n}from"ramda";import t
|
|
1
|
+
import{map as e,mergeDeepRight as n}from"ramda";import{evaluateResults as t}from"zousan/evaluate";import{series as o}from"zousan/series";import i from"./utils/i18n.js";import{startInitialStateListener as a}from"./utils/isInitialState.js";import{version as r}from"../package.json.js";import s from"./debugTools.js";import{buildEnv as l}from"./env.js";import{create as u}from"./extModules/bustle.js";import{initLog as c}from"./extModules/log.js";const g="undefined"!=typeof window;async function d(e,n,t){if(!t)return e.log.info(`Plugin ${n} explicitly disabled`),null;if(void 0!==t.active&&(!1===t.active||"notLocalhost"===t.active&&e.env.isLocalhost()))return e.log.info(`Plugin ${n} explicitly deativated`),null;return(n.includes("/")?(()=>{const[e,t]=n.split("/");return import(`../plugins/${e}/${t}/src/index.js`)})():import(`../plugins/${n}/src/index.js`)).then(o=>(e.log.info(`Creating plugin ${n}`),o.create(e,t)))}async function p(e){return g?import(`./configs/${e}.json`):import(`./configs/${e}.json.js`)}async function m(e,t){let o={};const i=await Promise.all(t.map(p));for(const e of i){let t=e.default;t=t.extends?await m(t,t.extends):t,o=n(o,t)}return o=n(o,e),o}const f=e=>n=>import(`./configs/postproc-${e}.ts`).then(e=>e.process(n));async function w(n){const p=Object.create(null);let w=n.extends?await m(n,n.extends):n;if(w.plugins?.monitoring){const e=w.plugins.monitoring;try{const n=await import("../_virtual/_empty_module_placeholder.js");await n.activate(e)}catch(e){const n=e instanceof Error?e.message:String(e);console.warn("Monitoring plugin failed to load (continuing without it):",n)}}w=await(async e=>e.configPostProc?o(e,...e.configPostProc.map(f)):e)(w);const h=(e=>{const n=e.supportedLanguages||["am","ar","de","el-GR","en","es","fr","hi","is","it","ja","ko","nl","pl","pt","ru","so","th","zh-Hans","zh-Hant"];if("undefined"!=typeof window){let e=new URLSearchParams(location.search).get("lang")||navigator.language;for(;e;){if(e&&n.includes(e))return e;e=e.substring(0,e.lastIndexOf("-"))}}return e.defaultLanguage||"en"})(w),y=await i(h,{debug:w.debug});p.i18n=()=>y,p.gt=()=>y.t.bind(y),p.config=w,p.plugins={};const b=c("web-engine",{enabled:!!w.debug,isBrowser:g,color:"cyan",logFilter:w.logFilter,truncateObjects:!g,trace:false});p.log=b.sublog(w.name),p.bus=u({showEvents:!0,reportAllErrors:!0,log:b}),p.info={wePkg:{version:r}},"undefined"!=typeof window&&(w.debug?(p.debug=e(e=>e.bind(p),s),s.dndGo.call(p)):p.debug={},window._app=p,window.document&&window.document.title&&w.setWindowTitle&&(document.title=w.name)),p.env=l(p);const{theme:j}=w;if(j?await t({name:"ThemeManagerModule",value:import("../_virtual/_empty_module_placeholder.js")},{name:"HistoryManager",value:import("./historyManager.js")},{name:"LayerManager",value:import("../_virtual/_empty_module_placeholder.js")}).then(async({LayerManager:e,HistoryManager:n,ThemeManagerModule:t})=>{const o=t.initThemeManager(p);p.themePack=await o.buildTheme(j,w.defaultTheme),a(),e.initLayerManager(p),n.initHistoryManager(p),p.destroy=()=>e.destroy()}):p.destroy=()=>{},w.plugins){for(const e in w.plugins)try{const n=w.plugins[e];if(p.plugins[e])throw Error(`Duplicate plugin name "${e}"`);const t=await d(p,e,n);t&&(p.plugins[e]=t)}catch(n){b.error("Error instantiating plugin "+e),b.error(n)}for(const e in p.plugins)p.plugins[e].init()}return"undefined"!=typeof window&&p.bus.send("appInsights/log",{name:"app/loaded",properties:{deploymentHost:window.location.host}}),p}export{w as create};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atriusmaps-node-sdk",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.1018",
|
|
4
4
|
"description": "This project provides an API to Atrius Personal Wayfinder maps within a Node environment. See the README.md for more information",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"map",
|
|
@@ -51,8 +51,7 @@
|
|
|
51
51
|
"node-fetch": "^2.7.0",
|
|
52
52
|
"ramda": "^0.32.0",
|
|
53
53
|
"throttle-debounce": "^5.0.2",
|
|
54
|
-
"zousan": "^4.
|
|
55
|
-
"zousan-plus": "^4.0.1"
|
|
54
|
+
"zousan": "^4.3.0"
|
|
56
55
|
},
|
|
57
56
|
"devDependencies": {
|
|
58
57
|
"@rollup/plugin-json": "^6.1.0",
|