atriusmaps-node-sdk 3.3.898 → 3.3.899
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/nodesdk/nodeEntry.js +36 -58
- package/dist/cjs/package.json.js +8 -4
- package/dist/cjs/plugins/clientAPI/src/clientAPI.js +8 -6
- package/dist/cjs/plugins/dynamicPois/src/dynamicPois.js +50 -142
- package/dist/cjs/plugins/dynamicPois/src/processors.js +31 -53
- package/dist/cjs/plugins/flightStatus/src/flightDetailsMapper.js +47 -116
- package/dist/cjs/plugins/flightStatus/src/flightStatus.js +48 -82
- package/dist/cjs/plugins/flightStatus/src/utils.js +4 -14
- package/dist/cjs/plugins/poiDataManager/src/poiDataManager.js +77 -154
- package/dist/cjs/plugins/sdkServer/src/prepareSDKConfig.js +45 -76
- package/dist/cjs/plugins/sdkServer/src/sdkHeadless.js +70 -79
- package/dist/cjs/plugins/sdkServer/src/sdkServer.js +97 -147
- package/dist/cjs/plugins/searchService/src/flexsearchExports/lang.js +16 -190
- package/dist/cjs/plugins/searchService/src/flexsearchExports/simple.js +28 -35
- package/dist/cjs/plugins/searchService/src/poiSearch.js +10 -21
- package/dist/cjs/plugins/searchService/src/searchService.js +45 -147
- package/dist/cjs/plugins/searchService/src/searchTypeahead.js +17 -28
- package/dist/cjs/plugins/searchService/src/utils.js +9 -13
- package/dist/cjs/plugins/venueDataLoader/src/venueDataLoader.js +148 -304
- package/dist/cjs/plugins/venueDataLoader/src/venueLoadingUtils.js +47 -126
- package/dist/cjs/plugins/wayfinder/src/findRoute.js +6 -73
- package/dist/cjs/plugins/wayfinder/src/minPriorityQueue.js +7 -27
- package/dist/cjs/plugins/wayfinder/src/navGraph.js +78 -259
- package/dist/cjs/plugins/wayfinder/src/navGraphDebug.js +26 -57
- package/dist/cjs/plugins/wayfinder/src/segmentBadges.js +25 -25
- package/dist/cjs/plugins/wayfinder/src/segmentBuilder.js +50 -133
- package/dist/cjs/plugins/wayfinder/src/segmentCategories.js +29 -29
- package/dist/cjs/plugins/wayfinder/src/stepBuilder.js +53 -145
- package/dist/cjs/plugins/wayfinder/src/wayfinder.js +105 -349
- package/dist/cjs/src/app.js +53 -91
- package/dist/cjs/src/configs/postproc-mol-url-parms.js +34 -43
- package/dist/cjs/src/configs/postproc-stateTracking.js +1 -19
- package/dist/cjs/src/controller.js +4 -26
- package/dist/cjs/src/debugTools.js +55 -94
- package/dist/cjs/src/env.js +8 -19
- package/dist/cjs/src/extModules/bustle.js +15 -71
- package/dist/cjs/src/extModules/flexapi/src/help.js +7 -22
- package/dist/cjs/src/extModules/flexapi/src/index.js +15 -29
- package/dist/cjs/src/extModules/flexapi/src/validate.js +45 -93
- package/dist/cjs/src/extModules/geohasher.js +13 -31
- package/dist/cjs/src/extModules/log.js +18 -29
- package/dist/cjs/src/historyManager.js +4 -6
- package/dist/cjs/src/utils/bounds.js +2 -4
- package/dist/cjs/src/utils/buildStructureLookup.js +7 -7
- package/dist/cjs/src/utils/configUtils.js +7 -43
- package/dist/cjs/src/utils/date.js +5 -17
- package/dist/cjs/src/utils/distance.js +2 -2
- package/dist/cjs/src/utils/dom.js +9 -24
- package/dist/cjs/src/utils/funcs.js +15 -30
- package/dist/cjs/src/utils/geodesy.js +24 -39
- package/dist/cjs/src/utils/geom.js +32 -148
- package/dist/cjs/src/utils/i18n.js +39 -70
- package/dist/cjs/src/utils/isInitialState.js +7 -13
- package/dist/cjs/src/utils/location.js +10 -29
- package/dist/cjs/src/utils/observable.js +4 -29
- package/dist/cjs/src/utils/rand.js +9 -80
- package/dist/cjs/utils/constants.js +1 -1
- package/dist/package.json.js +1 -1
- package/dist/plugins/sdkServer/src/prepareSDKConfig.js +1 -1
- package/dist/src/utils/buildStructureLookup.js +1 -1
- package/dist/src/utils/date.js +1 -1
- package/package.json +1 -1
|
@@ -1,142 +1,102 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const sqStr = function (str) {
|
|
3
|
+
const SQ = "'";
|
|
4
|
+
const sqStr = function(str) {
|
|
6
5
|
return SQ + str + SQ;
|
|
7
6
|
};
|
|
8
|
-
|
|
9
7
|
function validate(library, sig, cob) {
|
|
10
8
|
if (sig.args) {
|
|
11
9
|
checkTypeList(library.customTypes, sig.args, cob);
|
|
12
10
|
}
|
|
13
11
|
}
|
|
14
|
-
|
|
15
12
|
function getSigMatch(library, cob) {
|
|
16
|
-
const matches = library.commandDefsList.filter(cd => cd.sig.command === cob.command && matchesArgs(cd.sig, cob));
|
|
13
|
+
const matches = library.commandDefsList.filter((cd) => cd.sig.command === cob.command && matchesArgs(cd.sig, cob));
|
|
17
14
|
if (matches.length > 1) {
|
|
18
|
-
throw Error(
|
|
15
|
+
throw Error("Command matches multiple signatures!");
|
|
19
16
|
}
|
|
20
17
|
if (matches.length > 0) {
|
|
21
18
|
return matches[0];
|
|
22
19
|
}
|
|
23
|
-
return null;
|
|
20
|
+
return null;
|
|
24
21
|
}
|
|
25
|
-
|
|
26
|
-
// returns true if each of the required arguments in the command
|
|
27
|
-
// spec (c) is defined within the command object (o) - else false
|
|
28
22
|
function matchesArgs(c, o) {
|
|
29
23
|
if (!c.args) {
|
|
30
24
|
return true;
|
|
31
|
-
}
|
|
32
|
-
return c.args.reduce(function
|
|
33
|
-
return o[argOb.name] !==
|
|
25
|
+
}
|
|
26
|
+
return c.args.reduce(function(cs, argOb) {
|
|
27
|
+
return o[argOb.name] !== void 0 || argOb.optional ? cs : false;
|
|
34
28
|
}, true);
|
|
35
29
|
}
|
|
36
|
-
|
|
37
30
|
function checkMinMax(name, typeSpec, value) {
|
|
38
|
-
if (typeSpec.min !==
|
|
39
|
-
throw Error(
|
|
31
|
+
if (typeSpec.min !== void 0 && value < typeSpec.min) {
|
|
32
|
+
throw Error("argument " + sqStr(name) + " must be at least " + typeSpec.min + " but is " + value);
|
|
40
33
|
}
|
|
41
|
-
if (typeSpec.max !==
|
|
42
|
-
throw Error(
|
|
34
|
+
if (typeSpec.max !== void 0 && value > typeSpec.max) {
|
|
35
|
+
throw Error("argument " + sqStr(name) + " must be at most " + typeSpec.max + " but is " + value);
|
|
43
36
|
}
|
|
44
37
|
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Checks an argument value against that arguments spec. If there are no violations of the argSpec, true is returned.
|
|
48
|
-
* If there is a violation, an error is thrown.
|
|
49
|
-
* @param {object} customTypes any defined custom types
|
|
50
|
-
* @param {object} typeSpec An type spec object which inclues a type and other constraints if applicable
|
|
51
|
-
* @param {*} value The JSON value to be checked against this spec
|
|
52
|
-
* @return {true|string} returns true if arg is valid, else a string description of the problem
|
|
53
|
-
*/
|
|
54
38
|
function checkType(customTypes, typeSpec, value) {
|
|
55
|
-
if (!typeSpec)
|
|
56
|
-
{
|
|
39
|
+
if (!typeSpec) {
|
|
57
40
|
return true;
|
|
58
41
|
}
|
|
59
|
-
|
|
60
|
-
const name = typeSpec.name || '';
|
|
61
|
-
|
|
62
|
-
// if type is a reference/custom, grab that type def but allow "optional" override - TODO: consider other overrides (perhaps all but "type"?)
|
|
42
|
+
const name = typeSpec.name || "";
|
|
63
43
|
if (customTypes && customTypes[typeSpec.type]) {
|
|
64
44
|
typeSpec = Object.assign({}, customTypes[typeSpec.type], typeSpec, {
|
|
65
|
-
type: customTypes[typeSpec.type].type
|
|
45
|
+
type: customTypes[typeSpec.type].type
|
|
66
46
|
});
|
|
67
47
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (typeof value === 'string') {
|
|
48
|
+
if (typeSpec.type === "integer") {
|
|
49
|
+
if (typeof value === "string") {
|
|
71
50
|
value = parseInt(value, 10);
|
|
72
51
|
}
|
|
73
52
|
if (!Number.isInteger(value)) {
|
|
74
|
-
throw Error(
|
|
53
|
+
throw Error("expected integer argument for argument " + sqStr(name) + " but received " + value);
|
|
75
54
|
}
|
|
76
55
|
checkMinMax(name, typeSpec, value);
|
|
77
|
-
} else if (typeSpec.type ===
|
|
78
|
-
if (typeof value ===
|
|
56
|
+
} else if (typeSpec.type === "float") {
|
|
57
|
+
if (typeof value === "string") {
|
|
79
58
|
value = parseFloat(value);
|
|
80
59
|
}
|
|
81
60
|
if (!Number.isFinite(value)) {
|
|
82
|
-
throw Error(
|
|
61
|
+
throw Error("expected float argument for argument " + sqStr(name) + " but received '" + value + "'");
|
|
83
62
|
}
|
|
84
63
|
checkMinMax(name, typeSpec, value);
|
|
85
|
-
} else if (typeSpec.type ===
|
|
86
|
-
if (typeof value !==
|
|
64
|
+
} else if (typeSpec.type === "string") {
|
|
65
|
+
if (typeof value !== "string") {
|
|
87
66
|
throw Error(`argument ${sqStr(name)} must be a string but is not (value: ${value})`);
|
|
88
67
|
}
|
|
89
68
|
if (typeSpec.minLength && value.length < typeSpec.minLength) {
|
|
90
69
|
throw Error(
|
|
91
|
-
`argument ${sqStr(name)} must be a at least ${typeSpec.minLength} characters but is '${value}' (${value.length} chars)
|
|
70
|
+
`argument ${sqStr(name)} must be a at least ${typeSpec.minLength} characters but is '${value}' (${value.length} chars)`
|
|
92
71
|
);
|
|
93
72
|
}
|
|
94
73
|
if (typeSpec.maxLength && value.length > typeSpec.maxLength) {
|
|
95
74
|
throw Error(
|
|
96
|
-
`argument ${sqStr(name)} must be a at most ${typeSpec.maxLength} characters but is '${value}' (${value.length} chars)
|
|
75
|
+
`argument ${sqStr(name)} must be a at most ${typeSpec.maxLength} characters but is '${value}' (${value.length} chars)`
|
|
97
76
|
);
|
|
98
77
|
}
|
|
99
|
-
} else if (typeSpec.type ===
|
|
100
|
-
if (
|
|
101
|
-
value !== true &&
|
|
102
|
-
value !== false &&
|
|
103
|
-
value !== 'false' &&
|
|
104
|
-
value !== 'true' &&
|
|
105
|
-
value !== 'yes' &&
|
|
106
|
-
value !== 'no'
|
|
107
|
-
) {
|
|
78
|
+
} else if (typeSpec.type === "boolean") {
|
|
79
|
+
if (value !== true && value !== false && value !== "false" && value !== "true" && value !== "yes" && value !== "no") {
|
|
108
80
|
throw Error(
|
|
109
|
-
|
|
81
|
+
"argument " + sqStr(name) + " must be a boolean but is type " + typeof value + " with value of " + value
|
|
110
82
|
);
|
|
111
83
|
}
|
|
112
|
-
} else if (typeSpec.type ===
|
|
84
|
+
} else if (typeSpec.type === "list") {
|
|
113
85
|
if (!Array.isArray(value)) {
|
|
114
|
-
throw Error(
|
|
86
|
+
throw Error("argument " + sqStr(name) + " must be a list but is not. Value = " + value);
|
|
115
87
|
}
|
|
116
|
-
if (typeSpec.minLength !==
|
|
88
|
+
if (typeSpec.minLength !== void 0 && typeSpec.minLength > value.length) {
|
|
117
89
|
throw Error(
|
|
118
|
-
|
|
119
|
-
sqStr(name) +
|
|
120
|
-
' must contain at least ' +
|
|
121
|
-
typeSpec.minLength +
|
|
122
|
-
' items but only contains ' +
|
|
123
|
-
value.length +
|
|
124
|
-
' items',
|
|
90
|
+
"argument " + sqStr(name) + " must contain at least " + typeSpec.minLength + " items but only contains " + value.length + " items"
|
|
125
91
|
);
|
|
126
92
|
}
|
|
127
|
-
if (typeSpec.maxLength !==
|
|
93
|
+
if (typeSpec.maxLength !== void 0 && typeSpec.maxLength < value.length) {
|
|
128
94
|
throw Error(
|
|
129
|
-
|
|
130
|
-
sqStr(name) +
|
|
131
|
-
' must contain at most ' +
|
|
132
|
-
typeSpec.maxLength +
|
|
133
|
-
' items but contains ' +
|
|
134
|
-
value.length +
|
|
135
|
-
' items',
|
|
95
|
+
"argument " + sqStr(name) + " must contain at most " + typeSpec.maxLength + " items but contains " + value.length + " items"
|
|
136
96
|
);
|
|
137
97
|
}
|
|
138
98
|
if (typeSpec.itemType) {
|
|
139
|
-
const allItemsValid = value.reduce(function
|
|
99
|
+
const allItemsValid = value.reduce(function(isValid, curItem) {
|
|
140
100
|
try {
|
|
141
101
|
checkType(customTypes, typeSpec.itemType, curItem);
|
|
142
102
|
} catch {
|
|
@@ -146,22 +106,22 @@ function checkType(customTypes, typeSpec, value) {
|
|
|
146
106
|
}, true);
|
|
147
107
|
if (!allItemsValid) {
|
|
148
108
|
throw Error(
|
|
149
|
-
`argument ${sqStr(name)} contains an invalid item(s). All items in the list must be of type: ${JSON.stringify(typeSpec.itemType)} - list: ${JSON.stringify(value)}
|
|
109
|
+
`argument ${sqStr(name)} contains an invalid item(s). All items in the list must be of type: ${JSON.stringify(typeSpec.itemType)} - list: ${JSON.stringify(value)}`
|
|
150
110
|
);
|
|
151
111
|
}
|
|
152
112
|
}
|
|
153
|
-
} else if (typeSpec.type ===
|
|
154
|
-
if (typeof value !==
|
|
155
|
-
throw Error(
|
|
113
|
+
} else if (typeSpec.type === "object") {
|
|
114
|
+
if (typeof value !== "object" || Array.isArray(value)) {
|
|
115
|
+
throw Error("argument " + sqStr(name) + " must be an object but is not. Value = " + value);
|
|
156
116
|
}
|
|
157
117
|
try {
|
|
158
118
|
if (typeSpec.props) {
|
|
159
119
|
checkTypeList(customTypes, typeSpec.props, value);
|
|
160
120
|
}
|
|
161
121
|
} catch (e) {
|
|
162
|
-
throw Error(
|
|
122
|
+
throw Error("Within " + name + ", " + e.message);
|
|
163
123
|
}
|
|
164
|
-
} else if (typeSpec.type ===
|
|
124
|
+
} else if (typeSpec.type === "multi") {
|
|
165
125
|
const oneTypeValid = typeSpec.types.reduce((isValid, curType) => {
|
|
166
126
|
try {
|
|
167
127
|
checkType(customTypes, curType, value);
|
|
@@ -174,24 +134,16 @@ function checkType(customTypes, typeSpec, value) {
|
|
|
174
134
|
throw Error(`Argument ${sqStr(name)} can be of several types, but is not valid for any: ${value}`);
|
|
175
135
|
}
|
|
176
136
|
} else {
|
|
177
|
-
throw Error(
|
|
137
|
+
throw Error("type " + typeSpec.type + " is an unknown type");
|
|
178
138
|
}
|
|
179
|
-
|
|
180
139
|
return true;
|
|
181
140
|
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Given a value and a typelist, ensure the value abides by the typelist
|
|
185
|
-
* @param types custom defined types
|
|
186
|
-
* @param typeList A list of types to check
|
|
187
|
-
* @param args The properties object to check against
|
|
188
|
-
*/
|
|
189
141
|
function checkTypeList(customTypes, typeList, args) {
|
|
190
|
-
typeList.forEach(nextType => {
|
|
191
|
-
if (args[nextType.name] !==
|
|
142
|
+
typeList.forEach((nextType) => {
|
|
143
|
+
if (args[nextType.name] !== void 0) {
|
|
192
144
|
checkType(customTypes, nextType, args[nextType.name]);
|
|
193
145
|
} else if (!nextType.optional) {
|
|
194
|
-
throw Error(
|
|
146
|
+
throw Error("you must include a value for " + nextType.name);
|
|
195
147
|
}
|
|
196
148
|
});
|
|
197
149
|
}
|
|
@@ -1,62 +1,45 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
// Ported from https://github.com/JacksonTian/geohasher
|
|
4
|
-
// to ESM as it was not bundling properly via Rollup as a CJS
|
|
5
|
-
|
|
6
|
-
// Geohash library for Javascript
|
|
7
|
-
// (c) 2008 David Troy
|
|
8
|
-
// (c) 2010 Chris Williams
|
|
9
|
-
// (c) 2013 Jackson Tian
|
|
10
|
-
// Distributed under the MIT License
|
|
11
|
-
|
|
12
3
|
const BITS = [16, 8, 4, 2, 1];
|
|
13
|
-
|
|
14
|
-
const BASE32 = '0123456789bcdefghjkmnpqrstuvwxyz';
|
|
15
|
-
|
|
4
|
+
const BASE32 = "0123456789bcdefghjkmnpqrstuvwxyz";
|
|
16
5
|
const NEIGHBORS = {
|
|
17
|
-
right: { even:
|
|
18
|
-
left: { even:
|
|
19
|
-
top: { even:
|
|
20
|
-
bottom: { even:
|
|
6
|
+
right: { even: "bc01fg45238967deuvhjyznpkmstqrwx" },
|
|
7
|
+
left: { even: "238967debc01fg45kmstqrwxuvhjyznp" },
|
|
8
|
+
top: { even: "p0r21436x8zb9dcf5h7kjnmqesgutwvy" },
|
|
9
|
+
bottom: { even: "14365h7k9dcfesgujnmqp0r2twvyx8zb" }
|
|
21
10
|
};
|
|
22
|
-
|
|
23
11
|
const BORDERS = {
|
|
24
|
-
right: { even:
|
|
25
|
-
left: { even:
|
|
26
|
-
top: { even:
|
|
27
|
-
bottom: { even:
|
|
12
|
+
right: { even: "bcfguvyz" },
|
|
13
|
+
left: { even: "0145hjnp" },
|
|
14
|
+
top: { even: "prxz" },
|
|
15
|
+
bottom: { even: "028b" }
|
|
28
16
|
};
|
|
29
|
-
|
|
30
17
|
NEIGHBORS.bottom.odd = NEIGHBORS.left.even;
|
|
31
18
|
NEIGHBORS.top.odd = NEIGHBORS.right.even;
|
|
32
19
|
NEIGHBORS.left.odd = NEIGHBORS.bottom.even;
|
|
33
20
|
NEIGHBORS.right.odd = NEIGHBORS.top.even;
|
|
34
|
-
|
|
35
21
|
BORDERS.bottom.odd = BORDERS.left.even;
|
|
36
22
|
BORDERS.top.odd = BORDERS.right.even;
|
|
37
23
|
BORDERS.left.odd = BORDERS.bottom.even;
|
|
38
24
|
BORDERS.right.odd = BORDERS.top.even;
|
|
39
|
-
|
|
40
25
|
function calculateAdjacent(srcHash, dir) {
|
|
41
26
|
srcHash = srcHash.toLowerCase();
|
|
42
27
|
const lastChr = srcHash.charAt(srcHash.length - 1);
|
|
43
|
-
const type = srcHash.length % 2 ?
|
|
28
|
+
const type = srcHash.length % 2 ? "odd" : "even";
|
|
44
29
|
let base = srcHash.substring(0, srcHash.length - 1);
|
|
45
30
|
if (BORDERS[dir][type].indexOf(lastChr) !== -1) {
|
|
46
31
|
base = calculateAdjacent(base, dir);
|
|
47
32
|
}
|
|
48
33
|
return base + BASE32[NEIGHBORS[dir][type].indexOf(lastChr)];
|
|
49
34
|
}
|
|
50
|
-
|
|
51
35
|
function encode(latitude, longitude, precision) {
|
|
52
36
|
let isEven = 1;
|
|
53
|
-
const lat = [-90, 90
|
|
54
|
-
const lng = [-180, 180
|
|
37
|
+
const lat = [-90, 90];
|
|
38
|
+
const lng = [-180, 180];
|
|
55
39
|
let bit = 0;
|
|
56
40
|
let ch = 0;
|
|
57
41
|
precision = precision || 12;
|
|
58
|
-
|
|
59
|
-
let geohash = '';
|
|
42
|
+
let geohash = "";
|
|
60
43
|
while (geohash.length < precision) {
|
|
61
44
|
let mid;
|
|
62
45
|
if (isEven) {
|
|
@@ -76,7 +59,6 @@ function encode(latitude, longitude, precision) {
|
|
|
76
59
|
lat[1] = mid;
|
|
77
60
|
}
|
|
78
61
|
}
|
|
79
|
-
|
|
80
62
|
isEven = !isEven;
|
|
81
63
|
if (bit < 4) {
|
|
82
64
|
bit++;
|
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
// https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
|
|
4
3
|
const nodeColorsOb = {
|
|
5
|
-
black:
|
|
6
|
-
red:
|
|
7
|
-
green:
|
|
8
|
-
yellow:
|
|
9
|
-
blue:
|
|
10
|
-
magenta:
|
|
11
|
-
cyan:
|
|
12
|
-
white:
|
|
4
|
+
black: "\x1B[30m",
|
|
5
|
+
red: "\x1B[31m",
|
|
6
|
+
green: "\x1B[32m",
|
|
7
|
+
yellow: "\x1B[33m",
|
|
8
|
+
blue: "\x1B[34m",
|
|
9
|
+
magenta: "\x1B[35m",
|
|
10
|
+
cyan: "\x1B[36m",
|
|
11
|
+
white: "\x1B[37m"
|
|
13
12
|
};
|
|
14
|
-
|
|
15
13
|
function clog(name, options = {}) {
|
|
16
|
-
let prefix = name +
|
|
14
|
+
let prefix = name + ": ";
|
|
17
15
|
let style = null;
|
|
18
|
-
|
|
19
16
|
if (options.color) {
|
|
20
17
|
if (options.isBrowser) {
|
|
21
|
-
prefix =
|
|
18
|
+
prefix = "%c" + prefix;
|
|
22
19
|
style = `color: ${options.color}`;
|
|
23
20
|
} else {
|
|
24
21
|
const cstring = nodeColorsOb[options.color];
|
|
@@ -27,14 +24,11 @@ function clog(name, options = {}) {
|
|
|
27
24
|
}
|
|
28
25
|
}
|
|
29
26
|
}
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
const checkPassesFilter = (args, filter) =>
|
|
33
|
-
typeof filter === 'string' ? args[0].includes(filter) : filter.test(args[0]);
|
|
34
|
-
|
|
27
|
+
const trunc = (str, len) => str && str.length > len ? str.substring(0, len) + "..." : str;
|
|
28
|
+
const checkPassesFilter = (args, filter) => typeof filter === "string" ? args[0].includes(filter) : filter.test(args[0]);
|
|
35
29
|
function logGen(cmethod) {
|
|
36
|
-
return function
|
|
37
|
-
const isEnabled = options.enabled ===
|
|
30
|
+
return function(...restArgs) {
|
|
31
|
+
const isEnabled = options.enabled === void 0 ? true : !!options.enabled;
|
|
38
32
|
if (isEnabled || cmethod === console.error) {
|
|
39
33
|
let args = [...restArgs];
|
|
40
34
|
if (style) {
|
|
@@ -42,8 +36,8 @@ function clog(name, options = {}) {
|
|
|
42
36
|
}
|
|
43
37
|
args.unshift(prefix);
|
|
44
38
|
if (options.truncateObjects && cmethod !== console.error) {
|
|
45
|
-
args = args.map(arg => {
|
|
46
|
-
if (typeof arg ===
|
|
39
|
+
args = args.map((arg) => {
|
|
40
|
+
if (typeof arg === "object") {
|
|
47
41
|
return trunc(JSON.stringify(arg), parseInt(options.truncateObjects) || 100);
|
|
48
42
|
}
|
|
49
43
|
return arg;
|
|
@@ -56,24 +50,19 @@ function clog(name, options = {}) {
|
|
|
56
50
|
}
|
|
57
51
|
};
|
|
58
52
|
}
|
|
59
|
-
|
|
60
53
|
const log = logGen(options.trace ? console.trace : console.log);
|
|
61
54
|
log.info = log;
|
|
62
55
|
log.warn = logGen(console.warn);
|
|
63
56
|
log.detailed = logGen(console.debug);
|
|
64
57
|
log.error = logGen(console.error);
|
|
65
|
-
|
|
66
|
-
log.setEnabled = e => {
|
|
58
|
+
log.setEnabled = (e) => {
|
|
67
59
|
options.enabled = e;
|
|
68
60
|
};
|
|
69
|
-
|
|
70
61
|
return log;
|
|
71
62
|
}
|
|
72
|
-
|
|
73
63
|
function initLog(name, options) {
|
|
74
64
|
const log = clog(name, options);
|
|
75
|
-
log.sublog = (sublogName, sublogOptions) =>
|
|
76
|
-
initLog(name + '.' + sublogName, Object.assign(Object.create(options), sublogOptions));
|
|
65
|
+
log.sublog = (sublogName, sublogOptions) => initLog(name + "." + sublogName, Object.assign(Object.create(options), sublogOptions));
|
|
77
66
|
return log;
|
|
78
67
|
}
|
|
79
68
|
|
|
@@ -2,17 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
const initHistoryManager = ({ bus }) => {
|
|
4
4
|
const stepStack = [];
|
|
5
|
-
bus.on(
|
|
5
|
+
bus.on("history/register", ({ viewId, event, params = {} }) => {
|
|
6
6
|
stepStack.push({ viewId, event, params });
|
|
7
7
|
});
|
|
8
|
-
bus.on(
|
|
8
|
+
bus.on("history/stepBack", () => {
|
|
9
9
|
const layersToHide = [];
|
|
10
10
|
const current = stepStack.pop();
|
|
11
|
-
|
|
12
11
|
if (!current) {
|
|
13
12
|
return;
|
|
14
13
|
}
|
|
15
|
-
|
|
16
14
|
layersToHide.push(current.viewId);
|
|
17
15
|
for (let i = stepStack.length - 1; i >= 0; --i) {
|
|
18
16
|
if (stepStack[i].event === current.event) {
|
|
@@ -22,11 +20,11 @@ const initHistoryManager = ({ bus }) => {
|
|
|
22
20
|
break;
|
|
23
21
|
}
|
|
24
22
|
}
|
|
25
|
-
bus.send(
|
|
23
|
+
bus.send("layers/hideMultiple", layersToHide);
|
|
26
24
|
const { event, params } = stepStack.pop();
|
|
27
25
|
bus.send(event, params);
|
|
28
26
|
});
|
|
29
|
-
bus.on(
|
|
27
|
+
bus.on("history/clean", () => {
|
|
30
28
|
stepStack.length = 0;
|
|
31
29
|
});
|
|
32
30
|
};
|
|
@@ -3,17 +3,15 @@
|
|
|
3
3
|
var R = require('ramda');
|
|
4
4
|
|
|
5
5
|
function findBoundsOfWaypoints(waypoints) {
|
|
6
|
-
const latitudes = waypoints.map(R.path([
|
|
7
|
-
const longitudes = waypoints.map(R.path([
|
|
6
|
+
const latitudes = waypoints.map(R.path(["position", "lat"])).filter(R.identity);
|
|
7
|
+
const longitudes = waypoints.map(R.path(["position", "lng"])).filter(R.identity);
|
|
8
8
|
return findBounds(latitudes, longitudes);
|
|
9
9
|
}
|
|
10
|
-
|
|
11
10
|
function findBoundsOfCoordinates(coordinates) {
|
|
12
11
|
const latitudes = coordinates.map(R.prop(0)).filter(R.identity);
|
|
13
12
|
const longitudes = coordinates.map(R.prop(1)).filter(R.identity);
|
|
14
13
|
return findBounds(latitudes, longitudes);
|
|
15
14
|
}
|
|
16
|
-
|
|
17
15
|
function findBounds(latitudes, longitudes) {
|
|
18
16
|
const n = Math.max(...latitudes);
|
|
19
17
|
const s = Math.min(...latitudes);
|
|
@@ -21,17 +21,17 @@ function _interopNamespaceDefault(e) {
|
|
|
21
21
|
|
|
22
22
|
var R__namespace = /*#__PURE__*/_interopNamespaceDefault(R);
|
|
23
23
|
|
|
24
|
-
const buildStructuresLookup = structures => {
|
|
25
|
-
const floors = R__namespace.mergeAll(structures.map(R__namespace.prop(
|
|
26
|
-
const floorIdToFloor = floorId => floors[floorId];
|
|
27
|
-
const floorIdToOrdinal = R__namespace.pipe(floorIdToFloor, R__namespace.prop(
|
|
28
|
-
const floorIdToStructure = floorId => R__namespace.find(
|
|
29
|
-
const floorIdToStructureId =
|
|
24
|
+
const buildStructuresLookup = (structures) => {
|
|
25
|
+
const floors = R__namespace.mergeAll(structures.map(R__namespace.prop("levels")));
|
|
26
|
+
const floorIdToFloor = (floorId) => floors[floorId];
|
|
27
|
+
const floorIdToOrdinal = R__namespace.pipe(floorIdToFloor, R__namespace.prop("ordinal"));
|
|
28
|
+
const floorIdToStructure = (floorId) => R__namespace.find((s) => s.levels && s.levels[floorId])(structures);
|
|
29
|
+
const floorIdToStructureId = (floorId) => floorIdToStructure(floorId)?.id;
|
|
30
30
|
return {
|
|
31
31
|
floorIdToOrdinal,
|
|
32
32
|
floorIdToFloor,
|
|
33
33
|
floorIdToStructureId,
|
|
34
|
-
floorIdToStructure
|
|
34
|
+
floorIdToStructure
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
37
|
|
|
@@ -1,72 +1,36 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Follows a localization scheme of checking for named values with locales appended,
|
|
5
|
-
* and checking more generally if values not found.
|
|
6
|
-
*
|
|
7
|
-
* For example, calling getLocalized("foo", "es-MX", "bar") would check the following keys in this order:
|
|
8
|
-
* "foo-es-MX"
|
|
9
|
-
* "foo-es"
|
|
10
|
-
* "foo"
|
|
11
|
-
*
|
|
12
|
-
* As soon as a value is found, it is returned, else the checks continue. If no value is found from any of these,
|
|
13
|
-
* the def value is returned. (If def is undefined, the undefined is returned)
|
|
14
|
-
*
|
|
15
|
-
* @param {object} config the configuration to inspect
|
|
16
|
-
* @param {string} name root key name to look up
|
|
17
|
-
* @param {string} lang language code
|
|
18
|
-
* @param {any} def default value to return if no value is found through localized checks
|
|
19
|
-
*/
|
|
20
3
|
function getLocalized(config, name, lang, def) {
|
|
21
4
|
let key = name;
|
|
22
5
|
if (lang) {
|
|
23
|
-
key +=
|
|
6
|
+
key += "-" + lang;
|
|
24
7
|
}
|
|
25
|
-
|
|
26
8
|
const value = config[key];
|
|
27
|
-
|
|
28
9
|
if (value) {
|
|
29
10
|
return value;
|
|
30
11
|
}
|
|
31
|
-
|
|
32
12
|
if (lang) {
|
|
33
|
-
if (lang.indexOf(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
// no sublanguage, so next is try the name on its own
|
|
38
|
-
else {
|
|
13
|
+
if (lang.indexOf("-") > 0) {
|
|
14
|
+
return getLocalized(config, name, lang.substring(0, lang.indexOf("-")), def);
|
|
15
|
+
} else {
|
|
39
16
|
return getLocalized(config, name, null, def);
|
|
40
17
|
}
|
|
41
18
|
}
|
|
42
|
-
|
|
43
|
-
// we are here means we just checked the name (no lang arg) and there was no value found, so
|
|
44
|
-
// we simply return the def
|
|
45
19
|
return def;
|
|
46
20
|
}
|
|
47
|
-
|
|
48
|
-
// A debug property is considered "true" if:
|
|
49
|
-
// The key is defined as a property within the debug object AND
|
|
50
|
-
// the value of that key is not "no" or "false" or false (boolean) or undefined or null
|
|
51
|
-
// Any other value will be considered true - even 0 and ""
|
|
52
21
|
function debugIsTrue(app, key) {
|
|
53
22
|
if (!app.config.debug) {
|
|
54
23
|
return false;
|
|
55
24
|
}
|
|
56
|
-
|
|
57
25
|
let value = app.config.debug[key];
|
|
58
|
-
|
|
59
|
-
if (value === undefined || value === null || value === false) {
|
|
26
|
+
if (value === void 0 || value === null || value === false) {
|
|
60
27
|
return false;
|
|
61
28
|
}
|
|
62
|
-
|
|
63
29
|
if (value === true) {
|
|
64
30
|
return true;
|
|
65
31
|
}
|
|
66
|
-
|
|
67
|
-
value
|
|
68
|
-
|
|
69
|
-
return value !== 'no' && value !== 'false';
|
|
32
|
+
value = value.toLowerCase ? value.toLowerCase() : value;
|
|
33
|
+
return value !== "no" && value !== "false";
|
|
70
34
|
}
|
|
71
35
|
|
|
72
36
|
exports.debugIsTrue = debugIsTrue;
|
|
@@ -2,28 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
var luxon = require('luxon');
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
* Pass in a luxon DateTime object and receive a simple formatted time string
|
|
7
|
-
* This adjusts for odd handling of Icelandic times by Chromium/Blink browser engines.
|
|
8
|
-
* @param {DateTime|Date} datetime A JS Date or a luxon DateTime holding the time you wish to display
|
|
9
|
-
* @param {string} locale The locale (2 character country code - plus optional variant)
|
|
10
|
-
* @returns {string} A time formatted for display
|
|
11
|
-
*/
|
|
12
|
-
const formatTime = (datetime, locale = 'en') => {
|
|
5
|
+
const formatTime = (datetime, locale = "en") => {
|
|
13
6
|
if (datetime instanceof Date) {
|
|
14
|
-
datetime = luxon.DateTime(datetime);
|
|
7
|
+
datetime = luxon.DateTime.fromJSDate(datetime);
|
|
15
8
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
// is an arbitrarily selected locale that uses 24 hour format)
|
|
19
|
-
// This is due to Chrome/Chromium/Blink not supporting Icelandic well. See https://issues.chromium.org/issues/40624456
|
|
20
|
-
if (locale === 'is') {
|
|
21
|
-
locale = 'ca';
|
|
9
|
+
if (locale === "is") {
|
|
10
|
+
locale = "ca";
|
|
22
11
|
}
|
|
23
|
-
|
|
24
12
|
return datetime.setLocale(locale).toLocaleString(luxon.DateTime.TIME_SIMPLE);
|
|
25
13
|
};
|
|
26
|
-
const msToMin = ms => Math.ceil(ms / 60 /
|
|
14
|
+
const msToMin = (ms) => Math.ceil(ms / 60 / 1e3);
|
|
27
15
|
|
|
28
16
|
exports.formatTime = formatTime;
|
|
29
17
|
exports.msToMin = msToMin;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const yardsPerMeter = 1.0936132983377;
|
|
4
|
-
const metersToYards = meters => Math.round(meters * yardsPerMeter);
|
|
3
|
+
const yardsPerMeter = 1.0936132983377;
|
|
4
|
+
const metersToYards = (meters) => Math.round(meters * yardsPerMeter);
|
|
5
5
|
|
|
6
6
|
exports.metersToYards = metersToYards;
|