atriusmaps-node-sdk 3.3.957 → 3.3.960

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = "3.3.957";
5
+ var version = "3.3.960";
6
6
  var pkg = {
7
7
  version: version};
8
8
 
@@ -35,8 +35,11 @@ const fetchURL = async (token, url) => {
35
35
  };
36
36
  const createFetchJson = (token) => (url) => fetchURL(token, url).then((response) => response.json());
37
37
  const createFetchText = (token) => (url) => fetchURL(token, url).then((response) => response.text());
38
- const STYLE_URL = "https://style.maps.atrius.com/v2/style";
39
- const fetchStyleDoc = (venueId) => fetchURL(null, `${STYLE_URL}?venueId=${venueId}`).then((response) => response.json()).then((body) => body.data);
38
+ function getStyleURL(venueId) {
39
+ const smartCampusVenues = ["ayimid"];
40
+ return smartCampusVenues.includes(venueId) ? `https://style.maps.atrius.com/v1/vertical/smartcampus/venue/${venueId}` : `https://style.maps.atrius.com/v2/style?venueId=${venueId}`;
41
+ }
42
+ const fetchStyleDoc = (venueId) => fetchURL(null, `${getStyleURL(venueId)}`).then((response) => response.json()).then((body) => body.data);
40
43
  const baseContentUrl = (contentStage) => `https://api.content.locuslabs.com/${contentStage}`;
41
44
  const remapContentUrl = (url, category, contentStage, accountId, venueId, key) => {
42
45
  if (key === "theme" || key === "style") {
@@ -173,7 +176,6 @@ const normalizeCoords = (coords, venueBounds) => {
173
176
  return coords.map(swapFirstTwoItems);
174
177
  };
175
178
 
176
- exports.STYLE_URL = STYLE_URL;
177
179
  exports.buildStructures = buildStructures;
178
180
  exports.createFetchJson = createFetchJson;
179
181
  exports.createFetchText = createFetchText;
@@ -1 +1 @@
1
- var a="3.3.957",e={version:a};export{e as default,a as version};
1
+ var a="3.3.960",e={version:a};export{e as default,a as version};
@@ -1 +1 @@
1
- import*as e from"ramda";import{findBoundsOfCoordinates as t}from"../../../src/utils/bounds.js";const n=async(e,t)=>e?fetch(t,{headers:{Authorization:e}}):fetch(t),s=e=>t=>n(e,t).then(e=>e.json()),a=e=>t=>n(e,t).then(e=>e.text()),l="https://style.maps.atrius.com/v2/style",o=e=>n(null,`${l}?venueId=${e}`).then(e=>e.json()).then(e=>e.data),r=e=>`https://api.content.locuslabs.com/${e}`,c=(t,n,s,a,l)=>e.mapObjIndexed((e,n)=>((e,t,n,s,a,l)=>"theme"===l||"style"===l?`${r(n)}/${t}/${l}/${a}/${s}/${l}.json`:e.replace(/https:\/\/content.locuslabs.com/gi,r(n)))(e,t,s,a,l,n),n),i=[["zh-CN","zh-SG","zh-Hans"],["zh-TW","zh-HK","zh-MO","zh-Hant"]],u=e=>{const t=(e=>{const t=i.find(t=>t.includes(e));return t?t.filter(t=>t!==e):[]})(e),n=e.slice(0,2);return[t=>t===e,e=>t.includes(e),e=>e.slice(0,2)===n]},d=(e,t,n=null)=>{for(const s of u(t)){if(n&&s(n.locale))return n;const t=e.find(e=>s(e.locale));if(t)return t}return null},h=async(e,t,n)=>{const s={alpha:"alpha-a.locuslabs.com",beta:"beta-a.locuslabs.com",gamma:"gamma-a.locuslabs.com",prod:"a.locuslabs.com"},{assetStage:a,accountId:l,formatVersion:o}=e;let{venueId:r}=e;const i=`https://${s[a]||s.prod}/accounts/${l}`,u=o||"v5",h=e.dataFetch&&globalThis[e.dataFetch]&&globalThis[e.dataFetch].getFiles?await globalThis[e.dataFetch].getFiles(e):await t(`${i}/${u}.json`),g=h[r]?h[r].venueCode:null;if(g){const t=Object.values(h).filter(e=>e.venueCode===g),s=h[r];for(const a of n){const n=d(t,a,s);if(n){r=n.id,e.venueId=`${r}`;break}}}if(!h[r])throw Error(`Attempt to access venue ${r} which is not within venue list: ${Object.keys(h)}`);const f=h[r].files,b=(e.dataFetch&&globalThis[e.dataFetch]&&globalThis[e.dataFetch].getVenueData?await globalThis[e.dataFetch].getVenueData(e):await t(f.venueData))[r];b.tileServerAuthInfo&&function(e){const t={defaultOrdinal:0,defaultStructureId:"singleBuilding",formatVersion:"v5",structures:{singleBuilding:{name:"singleBuilding",boundsPolygon:[],defaultLevelId:"singleLevel",id:"singleBuilding",levels:{singleLevel:{boundsPolygon:[],clfloor:0,details:"",id:"singleLevel",name:"singleLevel",ordinal:0}}}},structureOrder:["singleBuilding"]};for(const n in t)e[n]=t[n]}(b),b.venueList=h;const m=(e=>{const t=e.deepLinkProps?e.deepLinkProps.contentStage:null;return"alpha"===t||"beta"===t||"prod"===t?t:null})(e);return b.files=m?c(b.category,f,m,l,r):f,b},g=e=>{const{structureOrder:n,structures:s}=e;return n.map(e=>{const n=s[e];Object.values(n.levels).forEach(e=>e.bounds=t(e.boundsPolygon));const a=t(n.boundsPolygon);return{...n,bounds:a}})};const f=([e,t,...n])=>[t,e,...n],b=(e,t)=>{return!e||!Array.isArray(e)||e.length<1?e:(n=e[0][0],s=t.ne.lng,a=t.sw.lng,(n>s?n<=a:e=>a)?e:e.map(f));var n,s,a};export{l as STYLE_URL,g as buildStructures,s as createFetchJson,a as createFetchText,o as fetchStyleDoc,d as findVenueForLocale,h as getVenueDataFromUrls,b as normalizeCoords};
1
+ import*as e from"ramda";import{findBoundsOfCoordinates as t}from"../../../src/utils/bounds.js";const n=async(e,t)=>e?fetch(t,{headers:{Authorization:e}}):fetch(t),s=e=>t=>n(e,t).then(e=>e.json()),a=e=>t=>n(e,t).then(e=>e.text());const l=e=>n(null,`${function(e){return["ayimid"].includes(e)?`https://style.maps.atrius.com/v1/vertical/smartcampus/venue/${e}`:`https://style.maps.atrius.com/v2/style?venueId=${e}`}(e)}`).then(e=>e.json()).then(e=>e.data),o=e=>`https://api.content.locuslabs.com/${e}`,r=(t,n,s,a,l)=>e.mapObjIndexed((e,n)=>((e,t,n,s,a,l)=>"theme"===l||"style"===l?`${o(n)}/${t}/${l}/${a}/${s}/${l}.json`:e.replace(/https:\/\/content.locuslabs.com/gi,o(n)))(e,t,s,a,l,n),n),c=[["zh-CN","zh-SG","zh-Hans"],["zh-TW","zh-HK","zh-MO","zh-Hant"]],i=e=>{const t=(e=>{const t=c.find(t=>t.includes(e));return t?t.filter(t=>t!==e):[]})(e),n=e.slice(0,2);return[t=>t===e,e=>t.includes(e),e=>e.slice(0,2)===n]},u=(e,t,n=null)=>{for(const s of i(t)){if(n&&s(n.locale))return n;const t=e.find(e=>s(e.locale));if(t)return t}return null},d=async(e,t,n)=>{const s={alpha:"alpha-a.locuslabs.com",beta:"beta-a.locuslabs.com",gamma:"gamma-a.locuslabs.com",prod:"a.locuslabs.com"},{assetStage:a,accountId:l,formatVersion:o}=e;let{venueId:c}=e;const i=`https://${s[a]||s.prod}/accounts/${l}`,d=o||"v5",h=e.dataFetch&&globalThis[e.dataFetch]&&globalThis[e.dataFetch].getFiles?await globalThis[e.dataFetch].getFiles(e):await t(`${i}/${d}.json`),g=h[c]?h[c].venueCode:null;if(g){const t=Object.values(h).filter(e=>e.venueCode===g),s=h[c];for(const a of n){const n=u(t,a,s);if(n){c=n.id,e.venueId=`${c}`;break}}}if(!h[c])throw Error(`Attempt to access venue ${c} which is not within venue list: ${Object.keys(h)}`);const m=h[c].files,f=(e.dataFetch&&globalThis[e.dataFetch]&&globalThis[e.dataFetch].getVenueData?await globalThis[e.dataFetch].getVenueData(e):await t(m.venueData))[c];f.tileServerAuthInfo&&function(e){const t={defaultOrdinal:0,defaultStructureId:"singleBuilding",formatVersion:"v5",structures:{singleBuilding:{name:"singleBuilding",boundsPolygon:[],defaultLevelId:"singleLevel",id:"singleBuilding",levels:{singleLevel:{boundsPolygon:[],clfloor:0,details:"",id:"singleLevel",name:"singleLevel",ordinal:0}}}},structureOrder:["singleBuilding"]};for(const n in t)e[n]=t[n]}(f),f.venueList=h;const b=(e=>{const t=e.deepLinkProps?e.deepLinkProps.contentStage:null;return"alpha"===t||"beta"===t||"prod"===t?t:null})(e);return f.files=b?r(f.category,m,b,l,c):m,f},h=e=>{const{structureOrder:n,structures:s}=e;return n.map(e=>{const n=s[e];Object.values(n.levels).forEach(e=>e.bounds=t(e.boundsPolygon));const a=t(n.boundsPolygon);return{...n,bounds:a}})};const g=([e,t,...n])=>[t,e,...n],m=(e,t)=>{return!e||!Array.isArray(e)||e.length<1?e:(n=e[0][0],s=t.ne.lng,a=t.sw.lng,(n>s?n<=a:e=>a)?e:e.map(g));var n,s,a};export{h as buildStructures,s as createFetchJson,a as createFetchText,l as fetchStyleDoc,u as findVenueForLocale,d as getVenueDataFromUrls,m as normalizeCoords};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atriusmaps-node-sdk",
3
- "version": "3.3.957",
3
+ "version": "3.3.960",
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,7 +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.1.0",
54
+ "zousan": "^4.2.0",
55
55
  "zousan-plus": "^4.0.1"
56
56
  },
57
57
  "devDependencies": {