atriusmaps-node-sdk 3.3.407 → 3.3.409

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.
@@ -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.407";
6
+ var version = "3.3.409";
7
7
  var license = "UNLICENSED";
8
8
  var type = "module";
9
9
  var main = "src/main.js";
@@ -147,18 +147,10 @@ function create (app, config) {
147
147
  async function getUniqueRandomCategories (limit) {
148
148
  const allCategories = (await app.bus.send('poi/getAllCategories'))[0];
149
149
  const uniqueCategories = Array.from(new Set(allCategories));
150
- const shuffledUniqueCategories = shuffle(uniqueCategories);
150
+ const shuffledUniqueCategories = rand.randomizeArray(uniqueCategories);
151
151
  return shuffledUniqueCategories.slice(0, limit)
152
152
  }
153
153
 
154
- function shuffle (a) {
155
- for (let i = a.length - 1; i > 0; i--) {
156
- const j = Math.floor(Math.random() * (i + 1));
157
- [a[i], a[j]] = [a[j], a[i]];
158
- }
159
- return a
160
- }
161
-
162
154
  /**
163
155
  * Returns list of up to 'limit' unique random navigable POIs.
164
156
  *
@@ -1,85 +1,124 @@
1
1
  'use strict';
2
2
 
3
- const jsRandom = () => ({
4
- nextInt: max => Math.floor(Math.random() * max)
5
- });
3
+ // Simple seedable random number generator - NOT cryptographicaly secure!
4
+ function mulberry32 (seed) {
5
+ return function () {
6
+ let t = seed += 0x6D2B79F5;
7
+ t = Math.imul(t ^ (t >>> 15), t | 1);
8
+ t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
9
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296
10
+ }
11
+ }
6
12
 
7
- const defaultRandom = jsRandom();
13
+ // ONLY use this for making tests deterministic - otherwise its a bad practice
14
+ const isCypress = typeof window !== 'undefined' && window.Cypress;
15
+ const random = isCypress ? mulberry32(12345678) : Math.random;
8
16
 
9
17
  /**
10
- * Returns a random list of length size of numbers from 0 to max-1, which represents a set of
11
- * those numbers. i.e. no number will repeat. (size is forced to not be bigger than max)
18
+ * Returns a random integer between the min and max values. Can also
19
+ * be called with a single value which becomes the max and min is set to 0.
20
+ * @param {integer} min minimum integer value to return (inclusive)
21
+ * @param {integer} max maximum integer value to return (exclusive)
22
+ * @returns random integer between min and max.
23
+ */
24
+ const rand = (min, max) => {
25
+ if (max == null) {
26
+ max = min;
27
+ min = 0;
28
+ }
29
+ return Math.floor(random() * (max - min) + min)
30
+ };
31
+
32
+ /**
33
+ * Returns a random list of length `size` with unique integers from 0 to `max` - 1.
12
34
  *
13
- * Can be used to choose a random selection from a list of selections. Or if
14
- * size = max, it becomes a random ordering of a List.
35
+ * No number will repeat. If `size > max`, it is clamped to `max`.
36
+ * If `max` is not provided, it defaults to `size`, resulting in a random shuffle of [0..size-1].
15
37
  *
16
- * NOTE: if the setSize is 0, max will set to 0 and you get an empty List object
38
+ * This is useful for randomly selecting a subset of indices or shuffling a range.
17
39
  *
18
- * ForExample:
19
- * randomSet(3, 5) = [3, 2, 0]
20
- * randomSet(3, 5) = [1, 0, 3]
21
- * randomSet(3, 5) = [1, 4, 2]
40
+ * For example:
41
+ * randomSet(3, 5) [3, 2, 0]
42
+ * randomSet(5) [1, 4, 0, 3, 2] // full shuffle of 0..4
22
43
  *
23
- * @param size the number of values to return
24
- * @param max a positive integer
25
- * @param r an optional Random instance (else one is generated)
26
- * @return a List of random values from 0 to max-1 with no number repeating
44
+ * @param {number} size - Number of unique values to return
45
+ * @param {number} [max] - Range upper bound (exclusive); defaults to `size`
46
+ * @returns {number[]} An array of unique random integers from 0 to max-1
27
47
  */
28
- function randomSet (size, max, r) {
29
- r = r || defaultRandom;
30
-
31
- let i;
32
-
33
- if (!max)
34
- max = size;
48
+ function randomSet (size, max) {
49
+ if (!max) max = size;
50
+ if (size > max) size = max;
35
51
 
36
- if (size > max)
37
- size = max;
52
+ const result = [];
38
53
 
39
- const list = [];
54
+ // Threshold for choosing sparse vs dense algorithm
55
+ // If we're selecting less than 30% of the range, collisions are rare
56
+ const SPARSITY_THRESHOLD = 0.3;
57
+ const isSparse = (size / max) < SPARSITY_THRESHOLD;
40
58
 
41
- if (((max / size) >= 2.0) || (max < 40)) {
42
- // if the set we are choosing from is considerably bigger than the number we are selecting
43
- // then let's just grab random values and check to see if they are in our new list yet.
44
- while (list.length < size) {
45
- i = r.nextInt(max);
46
- if (list.indexOf(i) < 0)
47
- list.push(i);
59
+ if (isSparse) {
60
+ // Sparse strategy: randomly generate values and skip duplicates
61
+ // Fast when the number of needed values is small relative to the range
62
+ const seen = new Set();
63
+ while (result.length < size) {
64
+ const i = rand(max);
65
+ if (!seen.has(i)) {
66
+ seen.add(i);
67
+ result.push(i);
68
+ }
48
69
  }
49
70
  } else {
50
- // if the list is to be nearly same size as what we are choosing from, let's build a source
51
- // list of the numbers and grab from them one at a time.
52
- const source = [];
53
- for (i = 0; i < max; i++)
54
- source.push(i);
71
+ // Dense strategy: partial in-place Fisher-Yates shuffle
72
+ // More efficient when selecting a large portion of the range
73
+ const source = Array.from({ length: max }, (_, i) => i);
74
+
75
+ for (let i = 0; i < size; i++) {
76
+ // Select a random index in the shrinking source array
77
+ const index = rand(max - i);
78
+
79
+ // Add the selected value to the result
80
+ result.push(source[index]);
55
81
 
56
- for (i = 0; i < size; i++) {
57
- const index = r.nextInt(source.length);
58
- list.push(source[index]);
59
- source.splice(index, 1);
82
+ // Move the last unchosen item into the chosen spot to "remove" it
83
+ source[index] = source[max - i - 1];
60
84
  }
61
85
  }
62
86
 
63
- return list
87
+ return result
64
88
  }
65
89
 
66
- // Pass in a source array and a map array of indices, and this returns a new
67
- // array of the members of the first based on the indices of the second. Useful when
68
- // used along with randomset above.
69
- // i.e.
70
- // a1 = [ "a", "b", "c", "d", "e", "f" ]
71
- // a2 = [ 2, 3, 5, 4, 0, 1]
72
- // a3 = getMappedArray(a1, a2) = [ "c", "d", "f", "e", "a", "b" ]
90
+ /**
91
+ * Given a source array and an array of indices, return a new array
92
+ * containing the source elements at the specified indices.
93
+ *
94
+ * @param {Array} array - The source array
95
+ * @param {number[]} map - Array of indices to pull from the source
96
+ * @returns {Array} - Mapped array
97
+ */
73
98
  const getMappedArray = (array, map) => map.map(i => array[i]);
74
99
 
75
- // Randomly pick a number of items from an array and return them in an array
76
- // leaving the original array untouched. If no number is specified, a length
77
- // of 1 is returned.
78
- const arrayPick = (array, num) => {
79
- num = num || 1;
80
- const map = randomSet(num, array.length);
81
- return getMappedArray(array, map)
82
- };
100
+ /**
101
+ * Returns a new array containing the elements of the input array in random order.
102
+ * Original array is not modified.
103
+ *
104
+ * @param {Array} array - The array to shuffle
105
+ * @returns {Array} - A new randomized array
106
+ */
107
+ const randomizeArray = array => getMappedArray(array, randomSet(array.length));
108
+
109
+ /**
110
+ * Returns a random selection of `num` elements from the array, in random order.
111
+ * Original array is not modified. If `num` is not specified, returns a single random item.
112
+ * If `num > array.length`, it is clamped to the array length.
113
+ *
114
+ * @param {Array} array - The array to sample from
115
+ * @param {number} [num=1] - Number of items to pick
116
+ * @returns {Array} - Randomly selected items
117
+ */
118
+ const arrayPick = (array, num = 1) =>
119
+ getMappedArray(array, randomSet(num, array.length));
83
120
 
84
121
  exports.arrayPick = arrayPick;
122
+ exports.rand = rand;
85
123
  exports.randomSet = randomSet;
124
+ exports.randomizeArray = randomizeArray;
@@ -1 +1 @@
1
- var e="web-engine",s="3.3.407",o="UNLICENSED",t="module",l="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",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.3.1","@dnd-kit/modifiers":"^9.0.0","@dnd-kit/sortable":"^10.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.5.0","@mapbox/mapbox-gl-draw-static-mode":"^1.0.1","@microsoft/applicationinsights-web":"^3.3.6","@turf/area":"^7.2.0","@turf/bbox-clip":"^7.2.0","@turf/bbox-polygon":"^7.2.0","@turf/circle":"^7.2.0","@turf/helpers":"^7.2.0","@turf/point-to-line-distance":"^7.2.0","@vitejs/plugin-react":"^4.3.4","axe-core":"^4.10.3",browserslist:"^4.24.4","crypto-browserify":"^3.12.1","cypress-axe":"^1.6.0","cypress-multi-reporters":"^2.0.5","cypress-real-events":"^1.14.0","file-loader":"^6.2.0",flexsearch:"^0.7.43","h3-js":"^4.1.0",i18next:"^20.6.1","i18next-browser-languagedetector":"^6.1.1","jest-transform-css":"6.0.2",jsdom:"^25.0.1",jsonschema:"^1.5.0",luxon:"^3.5.0","maplibre-gl":"^4.7.1","mini-css-extract-plugin":"^2.9.2","mocha-junit-reporter":"^2.2.1",mochawesome:"^7.1.3","node-polyfill-webpack-plugin":"^1.1.4","path-browserify":"^1.0.1",polished:"^4.3.1","prop-types":"^15.8.1","query-string":"^9.1.1",ramda:"^0.30.1",react:"^18.3.1","react-compound-slider":"^3.4.0","react-dom":"^18.3.1","react-json-editor-ajrm":"^2.5.14","react-qr-svg":"^2.4.0","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","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-cypress":"^3.50.3","@babel/core":"^7.26.10","@babel/eslint-parser":"^7.26.10","@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.26.3","@babel/plugin-transform-runtime":"^7.26.10","@babel/preset-env":"^7.26.9","@babel/preset-react":"^7.26.3","@testing-library/jest-dom":"^6.6.3","@types/react":"^19.0.10","@types/react-dom":"^19.0.4","@typescript-eslint/eslint-plugin":"^8.26.1","@typescript-eslint/parser":"^8.26.1","babel-jest":"^29.7.0","babel-loader":"^10.0.0","babel-plugin-inline-json-import":"^0.3.2","babel-plugin-module-resolver":"^5.0.2","babel-plugin-styled-components":"^2.1.4","babel-polyfill":"^6.26.0","chai-colors":"^1.0.1","css-loader":"^7.1.2",cypress:"^14.2.0","cypress-browser-permissions":"^1.1.0","cypress-wait-until":"^3.0.2",eslint:"^8.57.1","eslint-config-standard":"^17.1.0","eslint-import-resolver-typescript":"^3.9.1","eslint-plugin-cypress":"^2.15.2","eslint-plugin-import":"^2.31.0","eslint-plugin-jest":"^28.11.0","eslint-plugin-n":"^17.16.2","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^5.2.0","eslint-plugin-react":"^7.37.4","eslint-plugin-standard":"^5.0.0","fetch-mock-jest":"^1.5.1",glob:"^11.0.1",husky:"^9.1.7",jest:"29.7.0","jest-environment-jsdom":"^29.7.0","lint-staged":"^15.5.0","node-fetch":"^2.7.0","null-loader":"^4.0.1",nx:"19.8.14","nx-remotecache-azure":"^19.0.0","start-server-and-test":"^2.0.11",typescript:"^5.8.2",vite:"^4.3.9",vitest:"^2.1.9",webpack:"^5.98.0","webpack-merge":"^6.0.1"},d="yarn@4.7.0",m={node:"20.x"},u={},b={name:e,version:s,private:!0,license:o,type:t,main:l,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,l as main,e as name,u as nx,d as packageManager,n as resolutions,a as scripts,t as type,s as version,r as workspaces};
1
+ var e="web-engine",s="3.3.409",o="UNLICENSED",t="module",l="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",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.3.1","@dnd-kit/modifiers":"^9.0.0","@dnd-kit/sortable":"^10.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.5.0","@mapbox/mapbox-gl-draw-static-mode":"^1.0.1","@microsoft/applicationinsights-web":"^3.3.6","@turf/area":"^7.2.0","@turf/bbox-clip":"^7.2.0","@turf/bbox-polygon":"^7.2.0","@turf/circle":"^7.2.0","@turf/helpers":"^7.2.0","@turf/point-to-line-distance":"^7.2.0","@vitejs/plugin-react":"^4.3.4","axe-core":"^4.10.3",browserslist:"^4.24.4","crypto-browserify":"^3.12.1","cypress-axe":"^1.6.0","cypress-multi-reporters":"^2.0.5","cypress-real-events":"^1.14.0","file-loader":"^6.2.0",flexsearch:"^0.7.43","h3-js":"^4.1.0",i18next:"^20.6.1","i18next-browser-languagedetector":"^6.1.1","jest-transform-css":"6.0.2",jsdom:"^25.0.1",jsonschema:"^1.5.0",luxon:"^3.5.0","maplibre-gl":"^4.7.1","mini-css-extract-plugin":"^2.9.2","mocha-junit-reporter":"^2.2.1",mochawesome:"^7.1.3","node-polyfill-webpack-plugin":"^1.1.4","path-browserify":"^1.0.1",polished:"^4.3.1","prop-types":"^15.8.1","query-string":"^9.1.1",ramda:"^0.30.1",react:"^18.3.1","react-compound-slider":"^3.4.0","react-dom":"^18.3.1","react-json-editor-ajrm":"^2.5.14","react-qr-svg":"^2.4.0","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","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-cypress":"^3.50.3","@babel/core":"^7.26.10","@babel/eslint-parser":"^7.26.10","@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.26.3","@babel/plugin-transform-runtime":"^7.26.10","@babel/preset-env":"^7.26.9","@babel/preset-react":"^7.26.3","@testing-library/jest-dom":"^6.6.3","@types/react":"^19.0.10","@types/react-dom":"^19.0.4","@typescript-eslint/eslint-plugin":"^8.26.1","@typescript-eslint/parser":"^8.26.1","babel-jest":"^29.7.0","babel-loader":"^10.0.0","babel-plugin-inline-json-import":"^0.3.2","babel-plugin-module-resolver":"^5.0.2","babel-plugin-styled-components":"^2.1.4","babel-polyfill":"^6.26.0","chai-colors":"^1.0.1","css-loader":"^7.1.2",cypress:"^14.2.0","cypress-browser-permissions":"^1.1.0","cypress-wait-until":"^3.0.2",eslint:"^8.57.1","eslint-config-standard":"^17.1.0","eslint-import-resolver-typescript":"^3.9.1","eslint-plugin-cypress":"^2.15.2","eslint-plugin-import":"^2.31.0","eslint-plugin-jest":"^28.11.0","eslint-plugin-n":"^17.16.2","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^5.2.0","eslint-plugin-react":"^7.37.4","eslint-plugin-standard":"^5.0.0","fetch-mock-jest":"^1.5.1",glob:"^11.0.1",husky:"^9.1.7",jest:"29.7.0","jest-environment-jsdom":"^29.7.0","lint-staged":"^15.5.0","node-fetch":"^2.7.0","null-loader":"^4.0.1",nx:"19.8.14","nx-remotecache-azure":"^19.0.0","start-server-and-test":"^2.0.11",typescript:"^5.8.2",vite:"^4.3.9",vitest:"^2.1.9",webpack:"^5.98.0","webpack-merge":"^6.0.1"},d="yarn@4.7.0",m={node:"20.x"},u={},b={name:e,version:s,private:!0,license:o,type:t,main:l,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,l as main,e as name,u as nx,d as packageManager,n as resolutions,a as scripts,t as type,s as version,r as workspaces};
@@ -1 +1 @@
1
- import*as e from"ramda";import r from"zousan";import{getLocalized as a}from"../../../src/utils/configUtils.js";import{arrayPick as s}from"../../../src/utils/rand.js";import t from"./poiSearch.js";import n from"./searchTypeahead.js";function o(o,i){const c={poiSearch:null,typeahead:null,indexesCreated:new r,defaultSearchTerms:null,specialQueryTerms:{}},u=async()=>{const e=await o.bus.get("poi/getAll");c.poiSearch=t(e,o.i18n().language),c.typeahead=n(e,c.poiSearch.search,o.i18n().language),c.defaultSearchTerms=a(i,"defaultSearchTerms",o.i18n().language),c.indexesCreated.resolve()};async function d(){const r=await o.bus.getFirst("user/getPhysicalLocation");if(!r?.floorId)return[];const a=await o.bus.get("poi/getByFloorId",{floorId:r?.floorId}),s=Object.values(e.pickBy((e=>-1===e.category.indexOf("portal")&&"element.door"!==e.category),a)),t=await o.bus.get("wayfinder/addPathTimeMultiple",{pois:s,startLocation:r});return e.sortBy(e.prop("distance"),Object.values(t)).slice(0,50)}o.bus.on("search/queryNearby",(async()=>{const e=await d();return o.bus.send("search/showNearby",{pois:e,term:"Nearby"}),e})),o.bus.on("search/queryNearbyAsync",d),o.bus.on("search/queryCategory",(async({category:e,categoryName:r,searchTerm:a})=>{const s=await c.indexesCreated.then((()=>c.poiSearch.search({query:a||e})));return o.bus.send("search/showCategory",{pois:s,category:e,categoryName:r}),s})),o.bus.on("search/query",(({term:e})=>c.indexesCreated.then((()=>{const r=c.poiSearch.search({query:e});return o.bus.send("search/showSearchResults",{results:r,term:e}),r})))),o.bus.on("search/queryAsync",(({term:e})=>c.indexesCreated.then((()=>c.poiSearch.search({query:e}))))),o.bus.on("search/queryWithSpecial",(({term:e})=>{if(c.specialQueryTerms[e]){const{event:r,params:a}=c.specialQueryTerms[e];return o.bus.send(r,a)}return o.bus.get("search/query",{term:e})})),o.bus.on("search/getDefaultSearchTerms",(async({limit:e=5}={})=>{const r=c.defaultSearchTerms,a=r&&r.length?r:await async function(e){const r=(await o.bus.send("poi/getAllCategories"))[0],a=Array.from(new Set(r));return function(e){for(let r=e.length-1;r>0;r--){const a=Math.floor(Math.random()*(r+1));[e[r],e[a]]=[e[a],e[r]]}return e}(a).slice(0,e)}(e);return o.bus.send("search/showDefaultSearchKeywords",{keywords:a}),a})),o.bus.on("search/getDefaultSearchPois",(async({limit:r=5}={})=>{const a=await o.bus.get("poi/getAll"),t=e.pickBy(((e,r)=>e.isNavigable),a);return s(Object.values(t),r)})),o.bus.on("search/registerSpecialQuery",(({term:e,event:r,params:a,addKeyword:s=!0})=>{c.indexesCreated.then((()=>{s&&c.typeahead.addKeyword(e),c.specialQueryTerms[e]={event:r,params:a}}))})),o.bus.on("search/addKeywords",(({keywords:e})=>c.indexesCreated.then((()=>e.forEach((e=>c.typeahead.addKeyword(e))))))),o.bus.on("search/typeahead",(({term:e,limit:r})=>c.indexesCreated.then((()=>{const{keywords:a,pois:s}=c.typeahead.query(e,r);return{keywords:a,pois:s,term:e}})))),o.bus.on("venueData/loadNewVenue",(()=>{c.indexesCreated=new r,u()})),o.bus.on("poi/setDynamicData",(async({plugin:e,idValuesMap:r})=>{if("grab"!==e)return;const a=Object.keys(r).map((e=>o.bus.get("poi/getById",{id:e})));return Promise.all(a).then((e=>c.indexesCreated.then((()=>c.poiSearch.updateMultiple(e)))))}));return{init:u,runTest:async(e,r)=>(await r(),c)}}export{o as create};
1
+ import*as e from"ramda";import r from"zousan";import{getLocalized as a}from"../../../src/utils/configUtils.js";import{randomizeArray as s,arrayPick as t}from"../../../src/utils/rand.js";import n from"./poiSearch.js";import o from"./searchTypeahead.js";function i(i,c){const u={poiSearch:null,typeahead:null,indexesCreated:new r,defaultSearchTerms:null,specialQueryTerms:{}},d=async()=>{const e=await i.bus.get("poi/getAll");u.poiSearch=n(e,i.i18n().language),u.typeahead=o(e,u.poiSearch.search,i.i18n().language),u.defaultSearchTerms=a(c,"defaultSearchTerms",i.i18n().language),u.indexesCreated.resolve()};async function y(){const r=await i.bus.getFirst("user/getPhysicalLocation");if(!r?.floorId)return[];const a=await i.bus.get("poi/getByFloorId",{floorId:r?.floorId}),s=Object.values(e.pickBy((e=>-1===e.category.indexOf("portal")&&"element.door"!==e.category),a)),t=await i.bus.get("wayfinder/addPathTimeMultiple",{pois:s,startLocation:r});return e.sortBy(e.prop("distance"),Object.values(t)).slice(0,50)}i.bus.on("search/queryNearby",(async()=>{const e=await y();return i.bus.send("search/showNearby",{pois:e,term:"Nearby"}),e})),i.bus.on("search/queryNearbyAsync",y),i.bus.on("search/queryCategory",(async({category:e,categoryName:r,searchTerm:a})=>{const s=await u.indexesCreated.then((()=>u.poiSearch.search({query:a||e})));return i.bus.send("search/showCategory",{pois:s,category:e,categoryName:r}),s})),i.bus.on("search/query",(({term:e})=>u.indexesCreated.then((()=>{const r=u.poiSearch.search({query:e});return i.bus.send("search/showSearchResults",{results:r,term:e}),r})))),i.bus.on("search/queryAsync",(({term:e})=>u.indexesCreated.then((()=>u.poiSearch.search({query:e}))))),i.bus.on("search/queryWithSpecial",(({term:e})=>{if(u.specialQueryTerms[e]){const{event:r,params:a}=u.specialQueryTerms[e];return i.bus.send(r,a)}return i.bus.get("search/query",{term:e})})),i.bus.on("search/getDefaultSearchTerms",(async({limit:e=5}={})=>{const r=u.defaultSearchTerms,a=r&&r.length?r:await async function(e){const r=(await i.bus.send("poi/getAllCategories"))[0],a=Array.from(new Set(r));return s(a).slice(0,e)}(e);return i.bus.send("search/showDefaultSearchKeywords",{keywords:a}),a})),i.bus.on("search/getDefaultSearchPois",(async({limit:r=5}={})=>{const a=await i.bus.get("poi/getAll"),s=e.pickBy(((e,r)=>e.isNavigable),a);return t(Object.values(s),r)})),i.bus.on("search/registerSpecialQuery",(({term:e,event:r,params:a,addKeyword:s=!0})=>{u.indexesCreated.then((()=>{s&&u.typeahead.addKeyword(e),u.specialQueryTerms[e]={event:r,params:a}}))})),i.bus.on("search/addKeywords",(({keywords:e})=>u.indexesCreated.then((()=>e.forEach((e=>u.typeahead.addKeyword(e))))))),i.bus.on("search/typeahead",(({term:e,limit:r})=>u.indexesCreated.then((()=>{const{keywords:a,pois:s}=u.typeahead.query(e,r);return{keywords:a,pois:s,term:e}})))),i.bus.on("venueData/loadNewVenue",(()=>{u.indexesCreated=new r,d()})),i.bus.on("poi/setDynamicData",(async({plugin:e,idValuesMap:r})=>{if("grab"!==e)return;const a=Object.keys(r).map((e=>i.bus.get("poi/getById",{id:e})));return Promise.all(a).then((e=>u.indexesCreated.then((()=>u.poiSearch.updateMultiple(e)))))}));return{init:d,runTest:async(e,r)=>(await r(),u)}}export{i as create};
@@ -1 +1 @@
1
- const t={nextInt:t=>Math.floor(Math.random()*t)};function n(n,e,o){let s;o=o||t,e||(e=n),n>e&&(n=e);const h=[];if(e/n>=2||e<40)for(;h.length<n;)s=o.nextInt(e),h.indexOf(s)<0&&h.push(s);else{const t=[];for(s=0;s<e;s++)t.push(s);for(s=0;s<n;s++){const n=o.nextInt(t.length);h.push(t[n]),t.splice(n,1)}}return h}const e=(t,e)=>((t,n)=>n.map((n=>t[n])))(t,n(e=e||1,t.length));export{e as arrayPick,n as randomSet};
1
+ const n="undefined"!=typeof window&&window.Cypress?(t=12345678,function(){let n=t+=1831565813;return n=Math.imul(n^n>>>15,1|n),n^=n+Math.imul(n^n>>>7,61|n),((n^n>>>14)>>>0)/4294967296}):Math.random;var t;const o=(t,o)=>(null==o&&(o=t,t=0),Math.floor(n()*(o-t)+t));function e(n,t){t||(t=n),n>t&&(n=t);const e=[];if(n/t<.3){const r=new Set;for(;e.length<n;){const n=o(t);r.has(n)||(r.add(n),e.push(n))}}else{const r=Array.from({length:t},((n,t)=>t));for(let s=0;s<n;s++){const n=o(t-s);e.push(r[n]),r[n]=r[t-s-1]}}return e}const r=(n,t)=>t.map((t=>n[t])),s=n=>r(n,e(n.length)),l=(n,t=1)=>r(n,e(t,n.length));export{l as arrayPick,o as rand,e as randomSet,s as randomizeArray};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atriusmaps-node-sdk",
3
- "version": "3.3.407",
3
+ "version": "3.3.409",
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",