node-red-contrib-web-worldmap 5.5.3 → 5.5.6

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.
Files changed (32) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/README.md +1 -0
  3. package/node_modules/@turf/bezier-spline/dist/cjs/index.cjs +2 -2
  4. package/node_modules/@turf/bezier-spline/dist/cjs/index.cjs.map +1 -1
  5. package/node_modules/@turf/bezier-spline/dist/esm/index.js +2 -2
  6. package/node_modules/@turf/bezier-spline/dist/esm/index.js.map +1 -1
  7. package/node_modules/@turf/bezier-spline/package.json +11 -12
  8. package/node_modules/@turf/helpers/README.md +1 -1
  9. package/node_modules/@turf/helpers/dist/cjs/index.cjs.map +1 -1
  10. package/node_modules/@turf/helpers/dist/cjs/index.d.cts +6 -4
  11. package/node_modules/@turf/helpers/dist/esm/index.d.ts +6 -4
  12. package/node_modules/@turf/helpers/dist/esm/index.js.map +1 -1
  13. package/node_modules/@turf/helpers/package.json +8 -9
  14. package/node_modules/@turf/invariant/package.json +9 -10
  15. package/node_modules/express/History.md +11 -0
  16. package/node_modules/express/package.json +17 -17
  17. package/node_modules/qs/.github/SECURITY.md +11 -0
  18. package/node_modules/qs/.github/THREAT_MODEL.md +78 -0
  19. package/node_modules/qs/CHANGELOG.md +31 -0
  20. package/node_modules/qs/README.md +25 -1
  21. package/node_modules/qs/dist/qs.js +95 -44
  22. package/node_modules/qs/eslint.config.mjs +56 -0
  23. package/node_modules/qs/lib/parse.js +107 -43
  24. package/node_modules/qs/lib/stringify.js +11 -6
  25. package/node_modules/qs/lib/utils.js +61 -6
  26. package/node_modules/qs/package.json +15 -12
  27. package/node_modules/qs/test/parse.js +257 -31
  28. package/node_modules/qs/test/stringify.js +23 -11
  29. package/node_modules/qs/test/utils.js +245 -0
  30. package/package.json +8 -3
  31. package/worldmap/worldmap.js +20 -6
  32. package/node_modules/qs/.eslintrc +0 -38
@@ -4,6 +4,8 @@ var test = require('tape');
4
4
  var inspect = require('object-inspect');
5
5
  var SaferBuffer = require('safer-buffer').Buffer;
6
6
  var forEach = require('for-each');
7
+ var v = require('es-value-fixtures');
8
+
7
9
  var utils = require('../lib/utils');
8
10
 
9
11
  test('merge()', function (t) {
@@ -28,6 +30,20 @@ test('merge()', function (t) {
28
30
  var noOptionsNonObjectSource = utils.merge({ foo: 'baz' }, 'bar');
29
31
  t.deepEqual(noOptionsNonObjectSource, { foo: 'baz', bar: true });
30
32
 
33
+ var func = function f() {};
34
+ t.deepEqual(
35
+ utils.merge(func, { foo: 'bar' }),
36
+ [func, { foo: 'bar' }],
37
+ 'functions can not be merged into'
38
+ );
39
+
40
+ func.bar = 'baz';
41
+ t.deepEqual(
42
+ utils.merge({ foo: 'bar' }, func),
43
+ { foo: 'bar', bar: 'baz' },
44
+ 'functions can be merge sources'
45
+ );
46
+
31
47
  t.test(
32
48
  'avoids invoking array setters unnecessarily',
33
49
  { skip: typeof Object.defineProperty !== 'function' },
@@ -52,6 +68,60 @@ test('merge()', function (t) {
52
68
  }
53
69
  );
54
70
 
71
+ t.test('with overflow objects (from arrayLimit)', function (st) {
72
+ st.test('merges primitive into overflow object at next index', function (s2t) {
73
+ // Create an overflow object via combine
74
+ var overflow = utils.combine(['a'], 'b', 1, false);
75
+ s2t.ok(utils.isOverflow(overflow), 'overflow object is marked');
76
+ var merged = utils.merge(overflow, 'c');
77
+ s2t.deepEqual(merged, { 0: 'a', 1: 'b', 2: 'c' }, 'adds primitive at next numeric index');
78
+ s2t.end();
79
+ });
80
+
81
+ st.test('merges primitive into regular object with numeric keys normally', function (s2t) {
82
+ var obj = { 0: 'a', 1: 'b' };
83
+ s2t.notOk(utils.isOverflow(obj), 'plain object is not marked as overflow');
84
+ var merged = utils.merge(obj, 'c');
85
+ s2t.deepEqual(merged, { 0: 'a', 1: 'b', c: true }, 'adds primitive as key (not at next index)');
86
+ s2t.end();
87
+ });
88
+
89
+ st.test('merges primitive into object with non-numeric keys normally', function (s2t) {
90
+ var obj = { foo: 'bar' };
91
+ var merged = utils.merge(obj, 'baz');
92
+ s2t.deepEqual(merged, { foo: 'bar', baz: true }, 'adds primitive as key with value true');
93
+ s2t.end();
94
+ });
95
+
96
+ st.test('merges overflow object into primitive', function (s2t) {
97
+ // Create an overflow object via combine
98
+ var overflow = utils.combine([], 'b', 0, false);
99
+ s2t.ok(utils.isOverflow(overflow), 'overflow object is marked');
100
+ var merged = utils.merge('a', overflow);
101
+ s2t.ok(utils.isOverflow(merged), 'result is also marked as overflow');
102
+ s2t.deepEqual(merged, { 0: 'a', 1: 'b' }, 'creates object with primitive at 0, source values shifted');
103
+ s2t.end();
104
+ });
105
+
106
+ st.test('merges overflow object with multiple values into primitive', function (s2t) {
107
+ // Create an overflow object via combine
108
+ var overflow = utils.combine(['b'], 'c', 1, false);
109
+ s2t.ok(utils.isOverflow(overflow), 'overflow object is marked');
110
+ var merged = utils.merge('a', overflow);
111
+ s2t.deepEqual(merged, { 0: 'a', 1: 'b', 2: 'c' }, 'shifts all source indices by 1');
112
+ s2t.end();
113
+ });
114
+
115
+ st.test('merges regular object into primitive as array', function (s2t) {
116
+ var obj = { foo: 'bar' };
117
+ var merged = utils.merge('a', obj);
118
+ s2t.deepEqual(merged, ['a', { foo: 'bar' }], 'creates array with primitive and object');
119
+ s2t.end();
120
+ });
121
+
122
+ st.end();
123
+ });
124
+
55
125
  t.end();
56
126
  });
57
127
 
@@ -116,6 +186,169 @@ test('combine()', function (t) {
116
186
  st.end();
117
187
  });
118
188
 
189
+ t.test('with arrayLimit', function (st) {
190
+ st.test('under the limit', function (s2t) {
191
+ var combined = utils.combine(['a', 'b'], 'c', 10, false);
192
+ s2t.deepEqual(combined, ['a', 'b', 'c'], 'returns array when under limit');
193
+ s2t.ok(Array.isArray(combined), 'result is an array');
194
+ s2t.end();
195
+ });
196
+
197
+ st.test('exactly at the limit stays as array', function (s2t) {
198
+ var combined = utils.combine(['a', 'b'], 'c', 3, false);
199
+ s2t.deepEqual(combined, ['a', 'b', 'c'], 'stays as array when exactly at limit');
200
+ s2t.ok(Array.isArray(combined), 'result is an array');
201
+ s2t.end();
202
+ });
203
+
204
+ st.test('over the limit', function (s2t) {
205
+ var combined = utils.combine(['a', 'b', 'c'], 'd', 3, false);
206
+ s2t.deepEqual(combined, { 0: 'a', 1: 'b', 2: 'c', 3: 'd' }, 'converts to object when over limit');
207
+ s2t.notOk(Array.isArray(combined), 'result is not an array');
208
+ s2t.end();
209
+ });
210
+
211
+ st.test('with arrayLimit 0', function (s2t) {
212
+ var combined = utils.combine([], 'a', 0, false);
213
+ s2t.deepEqual(combined, { 0: 'a' }, 'converts single element to object with arrayLimit 0');
214
+ s2t.notOk(Array.isArray(combined), 'result is not an array');
215
+ s2t.end();
216
+ });
217
+
218
+ st.test('with plainObjects option', function (s2t) {
219
+ var combined = utils.combine(['a'], 'b', 1, true);
220
+ var expected = { __proto__: null, 0: 'a', 1: 'b' };
221
+ s2t.deepEqual(combined, expected, 'converts to object with null prototype');
222
+ s2t.equal(Object.getPrototypeOf(combined), null, 'result has null prototype when plainObjects is true');
223
+ s2t.end();
224
+ });
225
+
226
+ st.end();
227
+ });
228
+
229
+ t.test('with existing overflow object', function (st) {
230
+ st.test('adds to existing overflow object at next index', function (s2t) {
231
+ // Create overflow object first via combine
232
+ var overflow = utils.combine(['a'], 'b', 1, false);
233
+ s2t.ok(utils.isOverflow(overflow), 'initial object is marked as overflow');
234
+
235
+ var combined = utils.combine(overflow, 'c', 10, false);
236
+ s2t.equal(combined, overflow, 'returns the same object (mutated)');
237
+ s2t.deepEqual(combined, { 0: 'a', 1: 'b', 2: 'c' }, 'adds value at next numeric index');
238
+ s2t.end();
239
+ });
240
+
241
+ st.test('does not treat plain object with numeric keys as overflow', function (s2t) {
242
+ var plainObj = { 0: 'a', 1: 'b' };
243
+ s2t.notOk(utils.isOverflow(plainObj), 'plain object is not marked as overflow');
244
+
245
+ // combine treats this as a regular value, not an overflow object to append to
246
+ var combined = utils.combine(plainObj, 'c', 10, false);
247
+ s2t.deepEqual(combined, [{ 0: 'a', 1: 'b' }, 'c'], 'concatenates as regular values');
248
+ s2t.end();
249
+ });
250
+
251
+ st.end();
252
+ });
253
+
254
+ t.end();
255
+ });
256
+
257
+ test('decode', function (t) {
258
+ t.equal(
259
+ utils.decode('a+b'),
260
+ 'a b',
261
+ 'decodes + to space'
262
+ );
263
+
264
+ t.equal(
265
+ utils.decode('name%2Eobj'),
266
+ 'name.obj',
267
+ 'decodes a string'
268
+ );
269
+ t.equal(
270
+ utils.decode('name%2Eobj%2Efoo', null, 'iso-8859-1'),
271
+ 'name.obj.foo',
272
+ 'decodes a string in iso-8859-1'
273
+ );
274
+
275
+ t.end();
276
+ });
277
+
278
+ test('encode', function (t) {
279
+ forEach(v.nullPrimitives, function (nullish) {
280
+ t['throws'](
281
+ function () { utils.encode(nullish); },
282
+ TypeError,
283
+ inspect(nullish) + ' is not a string'
284
+ );
285
+ });
286
+
287
+ t.equal(utils.encode(''), '', 'empty string returns itself');
288
+ t.deepEqual(utils.encode([]), [], 'empty array returns itself');
289
+ t.deepEqual(utils.encode({ length: 0 }), { length: 0 }, 'empty arraylike returns itself');
290
+
291
+ t.test('symbols', { skip: !v.hasSymbols }, function (st) {
292
+ st.equal(utils.encode(Symbol('x')), 'Symbol%28x%29', 'symbol is encoded');
293
+
294
+ st.end();
295
+ });
296
+
297
+ t.equal(
298
+ utils.encode('(abc)'),
299
+ '%28abc%29',
300
+ 'encodes parentheses'
301
+ );
302
+ t.equal(
303
+ utils.encode({ toString: function () { return '(abc)'; } }),
304
+ '%28abc%29',
305
+ 'toStrings and encodes parentheses'
306
+ );
307
+
308
+ t.equal(
309
+ utils.encode('abc 123 💩', null, 'iso-8859-1'),
310
+ 'abc%20123%20%26%2355357%3B%26%2356489%3B',
311
+ 'encodes in iso-8859-1'
312
+ );
313
+
314
+ var longString = '';
315
+ var expectedString = '';
316
+ for (var i = 0; i < 1500; i++) {
317
+ longString += ' ';
318
+ expectedString += '%20';
319
+ }
320
+
321
+ t.equal(
322
+ utils.encode(longString),
323
+ expectedString,
324
+ 'encodes a long string'
325
+ );
326
+
327
+ t.equal(
328
+ utils.encode('\x28\x29'),
329
+ '%28%29',
330
+ 'encodes parens normally'
331
+ );
332
+ t.equal(
333
+ utils.encode('\x28\x29', null, null, null, 'RFC1738'),
334
+ '()',
335
+ 'does not encode parens in RFC1738'
336
+ );
337
+
338
+ // todo RFC1738 format
339
+
340
+ t.equal(
341
+ utils.encode('Āက豈'),
342
+ '%C4%80%E1%80%80%EF%A4%80',
343
+ 'encodes multibyte chars'
344
+ );
345
+
346
+ t.equal(
347
+ utils.encode('\uD83D \uDCA9'),
348
+ '%F0%9F%90%A0%F0%BA%90%80',
349
+ 'encodes lone surrogates'
350
+ );
351
+
119
352
  t.end();
120
353
  });
121
354
 
@@ -134,3 +367,15 @@ test('isBuffer()', function (t) {
134
367
  t.equal(utils.isBuffer(buffer), true, 'real Buffer instance is a buffer');
135
368
  t.end();
136
369
  });
370
+
371
+ test('isRegExp()', function (t) {
372
+ t.equal(utils.isRegExp(/a/g), true, 'RegExp is a RegExp');
373
+ t.equal(utils.isRegExp(new RegExp('a', 'g')), true, 'new RegExp is a RegExp');
374
+ t.equal(utils.isRegExp(new Date()), false, 'Date is not a RegExp');
375
+
376
+ forEach(v.primitives, function (primitive) {
377
+ t.equal(utils.isRegExp(primitive), false, inspect(primitive) + ' is not a RegExp');
378
+ });
379
+
380
+ t.end();
381
+ });
package/package.json CHANGED
@@ -1,14 +1,19 @@
1
1
  {
2
2
  "name": "node-red-contrib-web-worldmap",
3
- "version": "5.5.3",
3
+ "version": "5.5.6",
4
4
  "description": "A Node-RED node to provide a web page of a world map for plotting things on.",
5
5
  "dependencies": {
6
- "@turf/bezier-spline": "~7.2.0",
6
+ "@turf/bezier-spline": "~7.3.2",
7
7
  "cgi": "0.3.1",
8
8
  "compression": "^1.8.1",
9
- "express": "^4.21.2",
9
+ "express": "^4.22.1",
10
10
  "sockjs": "~0.3.24"
11
11
  },
12
+ "overrides": {
13
+ "express": {
14
+ "qs": "^6.14.1"
15
+ }
16
+ },
12
17
  "bundledDependencies": [
13
18
  "cgi",
14
19
  "compression",
@@ -562,6 +562,7 @@ function doTidyUp(l) {
562
562
  layers[markers[m].lay].removeLayer(markers[m]);
563
563
  delete markers[m];
564
564
  delete allData[m];
565
+ edgeAware();
565
566
  }
566
567
  }
567
568
  }
@@ -2167,6 +2168,7 @@ function setMarker(data) {
2167
2168
  data.speed = opts?.speed || data?.speed; // If SIDC then options.speed can override the speed.
2168
2169
  if (data?.speed && !opts?.direction) { opts.direction = data?.track || data?.hdg || data?.heading || data?.COG || data?.bearing }
2169
2170
  if (data.speed == undefined) { delete data.speed; }
2171
+ if (data.speed === 0 && opts.direction === 0) { delete opts.direction; }
2170
2172
  // escape out any isocodes eg flag symbols
2171
2173
  var optfields = ["additionalInformation","higherFormation","specialHeadquarters","staffComments","type","uniqueDesignation","speed","country"];
2172
2174
  //const regex = /\p{Extended_Pictographic}/ug;
@@ -3255,6 +3257,9 @@ function doGeojson(n,g,l,o,i) { // name, geojson, layer, options, icon
3255
3257
  delete feature.properties["fill-opacity"];
3256
3258
  delete feature.properties["font-color"];
3257
3259
  delete feature.properties["font-opacity"];
3260
+ // delete feature.properties["styleUrl"];
3261
+ delete feature.properties["styleHash"];
3262
+ delete feature.properties["styleMapHash"];
3258
3263
  }
3259
3264
  if (feature.hasOwnProperty("style")) {
3260
3265
  //console.log("GSTYLE", feature.style)
@@ -3338,12 +3343,21 @@ function doGeojson(n,g,l,o,i) { // name, geojson, layer, options, icon
3338
3343
  delete tx["_gpxType"];
3339
3344
  var n = tx["name"];
3340
3345
  delete tx["name"];
3341
- tx = JSON.stringify(tx,null,' ');
3342
- if ( tx !== "{}") {
3343
- var gp = '<pre style="overflow-x:scroll">'+tx.replace(/[\{\}"]/g,'')+'</pre>'
3344
- if (n) { gp = '<b>'+n+'</b>' + gp; }
3345
- l.bindPopup(gp);
3346
- }
3346
+ var tx2 = Object.entries(tx);
3347
+ var gp = '<table style="border:none;">';
3348
+ for (var i=0; i < tx2.length; i++) {
3349
+ gp += '<tr><td style="border:none; vertical-align:top; padding-right:3px;">'+tx2[i][0]+'</td><td style="border:none; vertical-align:top;">'+tx2[i][1]+'</td></tr>';
3350
+ }
3351
+ gp += '</table>';
3352
+ //tx = JSON.stringify(tx,null,' ');
3353
+ // if ( tx !== "{}") {
3354
+ // //var gp = '<pre style="overflow-x:scroll">'+tx.replace(/[\{\}"]/g,'')+'</pre>'
3355
+ // var gp = '<pre>'+tx.replace(/[\{\}"]/g,'')+'</pre>'
3356
+ // if (n) { gp = '<b>'+n+'</b>' + gp; }
3357
+ // l.bindPopup(gp);
3358
+ // }
3359
+ if (n) { gp = '<b>'+n+'</b>' + gp; }
3360
+ if (gp.length > 36) { l.bindPopup(gp); }
3347
3361
  }
3348
3362
  if (o && o.hasOwnProperty("clickable") && o.clickable === true) {
3349
3363
  l.on('click', function (e) {
@@ -1,38 +0,0 @@
1
- {
2
- "root": true,
3
-
4
- "extends": "@ljharb",
5
-
6
- "ignorePatterns": [
7
- "dist/",
8
- ],
9
-
10
- "rules": {
11
- "complexity": 0,
12
- "consistent-return": 1,
13
- "func-name-matching": 0,
14
- "id-length": [2, { "min": 1, "max": 25, "properties": "never" }],
15
- "indent": [2, 4],
16
- "max-lines-per-function": [2, { "max": 150 }],
17
- "max-params": [2, 18],
18
- "max-statements": [2, 100],
19
- "multiline-comment-style": 0,
20
- "no-continue": 1,
21
- "no-magic-numbers": 0,
22
- "no-restricted-syntax": [2, "BreakStatement", "DebuggerStatement", "ForInStatement", "LabeledStatement", "WithStatement"],
23
- },
24
-
25
- "overrides": [
26
- {
27
- "files": "test/**",
28
- "rules": {
29
- "function-paren-newline": 0,
30
- "max-lines-per-function": 0,
31
- "max-statements": 0,
32
- "no-buffer-constructor": 0,
33
- "no-extend-native": 0,
34
- "no-throw-literal": 0,
35
- },
36
- },
37
- ],
38
- }