node-red-contrib-web-worldmap 5.5.7 → 5.6.0
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/CHANGELOG.md +2 -0
- package/README.md +5 -1
- package/node_modules/qs/.editorconfig +1 -1
- package/node_modules/qs/CHANGELOG.md +14 -1
- package/node_modules/qs/README.md +11 -4
- package/node_modules/qs/dist/qs.js +20 -20
- package/node_modules/qs/lib/parse.js +21 -10
- package/node_modules/qs/lib/utils.js +28 -8
- package/node_modules/qs/package.json +1 -1
- package/node_modules/qs/test/parse.js +125 -9
- package/node_modules/qs/test/utils.js +36 -20
- package/package.json +4 -2
- package/worldmap/worldmap.js +55 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
### Change Log for Node-RED Worldmap
|
|
2
2
|
|
|
3
|
+
- v5.6.0 - Autoswitch pmtiles basemaps based on zoom and/or coverage.
|
|
4
|
+
- v5.5.8 - Bump qs dep for CVE
|
|
3
5
|
- v5.5.7 - Fix COG handling for built in icons, bump various libs for CVEs
|
|
4
6
|
- v5.5.4 - slight tweak to geojson property display as table
|
|
5
7
|
- v5.5.3 - ensure SOG gets picked up earlier in chain
|
package/README.md
CHANGED
|
@@ -10,6 +10,8 @@ A <a href="https://nodered.org" target="mapinfo">Node-RED</a> node to provide a
|
|
|
10
10
|
|
|
11
11
|
### Updates
|
|
12
12
|
|
|
13
|
+
- v5.6.0 - Autoswitch pmtiles basemaps based on zoom and/or coverage.
|
|
14
|
+
- v5.5.8 - Bump qs dep for CVE
|
|
13
15
|
- v5.5.7 - Fix COG handling for built in icons, bump various libs for CVEs
|
|
14
16
|
- v5.5.4 - slight tweak to geojson property display as table
|
|
15
17
|
- v5.5.3 - ensure SOG gets picked up earlier in chain
|
|
@@ -133,7 +135,7 @@ To do this you need to supply a `msg.payload.SIDC` 2525 code instead of an icon,
|
|
|
133
135
|
|
|
134
136
|
SIDC codes can be generated using the built-in unitgenerator tool.
|
|
135
137
|
|
|
136
|
-
There are lots of extra options you can specify as `msg.payload.options` - see the <a href="https://
|
|
138
|
+
There are lots of extra options you can specify as `msg.payload.options` - see the <a href="https://github.com/spatialillusions/milsymbol/blob/master/docs/README.md" target="mapinfo">milsymbol docs here</a>.
|
|
137
139
|
|
|
138
140
|
Note: If the SIDC code is a 2525C 15 characters long, where chars 13 and 14 are a country code - then the country flag emoji is added to the staffComments field of the icon. If it's a 20 char 2525D code then the options:country property will be used to create the flag.
|
|
139
141
|
|
|
@@ -766,6 +768,8 @@ You can also load them dynamically with a command like
|
|
|
766
768
|
|
|
767
769
|
Where `opt` can be as per the options file mentioned above - or omitted completely.
|
|
768
770
|
|
|
771
|
+
If you have multiple pmtiles loaded then the map will try to autoswitch if you move out of bounds of one and into another - or zoom in or out beyond the zoom limits and there is another suitable pmtiles file available.
|
|
772
|
+
|
|
769
773
|
NOTE: for some reason many files converted to pmtiles format fail to load/display. In this case you can easily use the tileserver-gl map server either natively or via docker (see below) to serve the pmtiles format file.
|
|
770
774
|
|
|
771
775
|
### Using a Docker Map Server
|
|
@@ -1,5 +1,18 @@
|
|
|
1
|
+
## **6.14.2**
|
|
2
|
+
- [Fix] `parse`: mark overflow objects for indexed notation exceeding `arrayLimit` (#546)
|
|
3
|
+
- [Fix] `arrayLimit` means max count, not max index, in `combine`/`merge`/`parseArrayValue`
|
|
4
|
+
- [Fix] `parse`: throw on `arrayLimit` exceeded with indexed notation when `throwOnLimitExceeded` is true (#529)
|
|
5
|
+
- [Fix] `parse`: enforce `arrayLimit` on `comma`-parsed values
|
|
6
|
+
- [Fix] `parse`: fix error message to reflect arrayLimit as max index; remove extraneous comments (#545)
|
|
7
|
+
- [Robustness] avoid `.push`, use `void`
|
|
8
|
+
- [readme] document that `addQueryPrefix` does not add `?` to empty output (#418)
|
|
9
|
+
- [readme] clarify `parseArrays` and `arrayLimit` documentation (#543)
|
|
10
|
+
- [readme] replace runkit CI badge with shields.io check-runs badge
|
|
11
|
+
- [meta] fix changelog typo (`arrayLength` → `arrayLimit`)
|
|
12
|
+
- [actions] fix rebase workflow permissions
|
|
13
|
+
|
|
1
14
|
## **6.14.1**
|
|
2
|
-
- [Fix] ensure
|
|
15
|
+
- [Fix] ensure `arrayLimit` applies to `[]` notation as well
|
|
3
16
|
- [Fix] `parse`: when a custom decoder returns `null` for a key, ignore that key
|
|
4
17
|
- [Refactor] `parse`: extract key segment splitting helper
|
|
5
18
|
- [meta] add threat model
|
|
@@ -282,8 +282,8 @@ var withIndexedEmptyString = qs.parse('a[0]=b&a[1]=&a[2]=c');
|
|
|
282
282
|
assert.deepEqual(withIndexedEmptyString, { a: ['b', '', 'c'] });
|
|
283
283
|
```
|
|
284
284
|
|
|
285
|
-
**qs** will also limit
|
|
286
|
-
Any array members with an index of
|
|
285
|
+
**qs** will also limit arrays to a maximum of `20` elements.
|
|
286
|
+
Any array members with an index of `20` or greater will instead be converted to an object with the index as the key.
|
|
287
287
|
This is needed to handle cases when someone sent, for example, `a[999999999]` and it will take significant time to iterate over this huge array.
|
|
288
288
|
|
|
289
289
|
```javascript
|
|
@@ -310,7 +310,8 @@ try {
|
|
|
310
310
|
|
|
311
311
|
When `throwOnLimitExceeded` is set to `false` (default), **qs** will parse up to the specified `arrayLimit` and if the limit is exceeded, the array will instead be converted to an object with the index as the key
|
|
312
312
|
|
|
313
|
-
To
|
|
313
|
+
To prevent array syntax (`a[]`, `a[0]`) from being parsed as arrays, set `parseArrays` to `false`.
|
|
314
|
+
Note that duplicate keys (e.g. `a=b&a=c`) may still produce arrays when `duplicates` is `'combine'` (the default).
|
|
314
315
|
|
|
315
316
|
```javascript
|
|
316
317
|
var noParsingArrays = qs.parse('a[]=b', { parseArrays: false });
|
|
@@ -512,6 +513,12 @@ The query string may optionally be prepended with a question mark:
|
|
|
512
513
|
assert.equal(qs.stringify({ a: 'b', c: 'd' }, { addQueryPrefix: true }), '?a=b&c=d');
|
|
513
514
|
```
|
|
514
515
|
|
|
516
|
+
Note that when the output is an empty string, the prefix will not be added:
|
|
517
|
+
|
|
518
|
+
```javascript
|
|
519
|
+
assert.equal(qs.stringify({}, { addQueryPrefix: true }), '');
|
|
520
|
+
```
|
|
521
|
+
|
|
515
522
|
The delimiter may be overridden with stringify as well:
|
|
516
523
|
|
|
517
524
|
```javascript
|
|
@@ -723,7 +730,7 @@ Save time, reduce risk, and improve code health, while paying the maintainers of
|
|
|
723
730
|
[downloads-url]: https://npm-stat.com/charts.html?package=qs
|
|
724
731
|
[codecov-image]: https://codecov.io/gh/ljharb/qs/branch/main/graphs/badge.svg
|
|
725
732
|
[codecov-url]: https://app.codecov.io/gh/ljharb/qs/
|
|
726
|
-
[actions-image]: https://img.shields.io/
|
|
733
|
+
[actions-image]: https://img.shields.io/github/check-runs/ljharb/qs/main
|
|
727
734
|
[actions-url]: https://github.com/ljharb/qs/actions
|
|
728
735
|
|
|
729
736
|
## Acknowledgements
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
"use strict";var stringify=require(4),parse=require(3),formats=require(1);module.exports={formats:formats,parse:parse,stringify:stringify};
|
|
6
6
|
|
|
7
7
|
},{"1":1,"3":3,"4":4}],3:[function(require,module,exports){
|
|
8
|
-
"use strict";var utils=require(5),has=Object.prototype.hasOwnProperty,isArray=Array.isArray,defaults={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:utils.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},interpretNumericEntities=function(e){return e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},parseArrayValue=function(e,t,r){if(e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1)return e.split(",");if(t.throwOnLimitExceeded&&r>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return e},isoSentinel="utf8=%26%2310003%3B",charsetSentinel="utf8=%E2%9C%93",parseValues=function parseQueryStringValues(e,t){var r={__proto__:null},i=t.ignoreQueryPrefix?e.replace(/^\?/,""):e;i=i.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var a=t.parameterLimit===1/0?void 0:t.parameterLimit,o=i.split(t.delimiter,t.throwOnLimitExceeded?a+1:a);if(t.throwOnLimitExceeded&&o.length>a)throw new RangeError("Parameter limit exceeded. Only "+a+" parameter"+(1===a?"":"s")+" allowed.");var l,n=-1,s=t.charset;if(t.charsetSentinel)for(l=0;l<o.length;++l)0===o[l].indexOf("utf8=")&&(o[l]===charsetSentinel?s="utf-8":o[l]===isoSentinel&&(s="iso-8859-1"),n=l,l=o.length);for(l=0;l<o.length;++l)if(l!==n){var p,
|
|
8
|
+
"use strict";var utils=require(5),has=Object.prototype.hasOwnProperty,isArray=Array.isArray,defaults={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:utils.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},interpretNumericEntities=function(e){return e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},parseArrayValue=function(e,t,r){if(e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1)return e.split(",");if(t.throwOnLimitExceeded&&r>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return e},isoSentinel="utf8=%26%2310003%3B",charsetSentinel="utf8=%E2%9C%93",parseValues=function parseQueryStringValues(e,t){var r={__proto__:null},i=t.ignoreQueryPrefix?e.replace(/^\?/,""):e;i=i.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var a=t.parameterLimit===1/0?void 0:t.parameterLimit,o=i.split(t.delimiter,t.throwOnLimitExceeded?a+1:a);if(t.throwOnLimitExceeded&&o.length>a)throw new RangeError("Parameter limit exceeded. Only "+a+" parameter"+(1===a?"":"s")+" allowed.");var l,n=-1,s=t.charset;if(t.charsetSentinel)for(l=0;l<o.length;++l)0===o[l].indexOf("utf8=")&&(o[l]===charsetSentinel?s="utf-8":o[l]===isoSentinel&&(s="iso-8859-1"),n=l,l=o.length);for(l=0;l<o.length;++l)if(l!==n){var d,p,c=o[l],u=c.indexOf("]="),y=-1===u?c.indexOf("="):u+1;if(-1===y?(d=t.decoder(c,defaults.decoder,s,"key"),p=t.strictNullHandling?null:""):null!==(d=t.decoder(c.slice(0,y),defaults.decoder,s,"key"))&&(p=utils.maybeMap(parseArrayValue(c.slice(y+1),t,isArray(r[d])?r[d].length:0),function(e){return t.decoder(e,defaults.decoder,s,"value")})),p&&t.interpretNumericEntities&&"iso-8859-1"===s&&(p=interpretNumericEntities(String(p))),c.indexOf("[]=")>-1&&(p=isArray(p)?[p]:p),t.comma&&isArray(p)&&p.length>t.arrayLimit){if(t.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");p=utils.combine([],p,t.arrayLimit,t.plainObjects)}if(null!==d){var f=has.call(r,d);f&&"combine"===t.duplicates?r[d]=utils.combine(r[d],p,t.arrayLimit,t.plainObjects):f&&"last"!==t.duplicates||(r[d]=p)}}return r},parseObject=function(e,t,r,i){var a=0;if(e.length>0&&"[]"===e[e.length-1]){var o=e.slice(0,-1).join("");a=Array.isArray(t)&&t[o]?t[o].length:0}for(var l=i?t:parseArrayValue(t,r,a),n=e.length-1;n>=0;--n){var s,d=e[n];if("[]"===d&&r.parseArrays)s=utils.isOverflow(l)?l:r.allowEmptyArrays&&(""===l||r.strictNullHandling&&null===l)?[]:utils.combine([],l,r.arrayLimit,r.plainObjects);else{s=r.plainObjects?{__proto__:null}:{};var p="["===d.charAt(0)&&"]"===d.charAt(d.length-1)?d.slice(1,-1):d,c=r.decodeDotInKeys?p.replace(/%2E/g,"."):p,u=parseInt(c,10),y=!isNaN(u)&&d!==c&&String(u)===c&&u>=0&&r.parseArrays;if(r.parseArrays||""!==c)if(y&&u<r.arrayLimit)(s=[])[u]=l;else{if(y&&r.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+r.arrayLimit+" element"+(1===r.arrayLimit?"":"s")+" allowed in an array.");y?(s[u]=l,utils.markOverflow(s,u)):"__proto__"!==c&&(s[c]=l)}else s={0:l}}l=s}return l},splitKeyIntoSegments=function splitKeyIntoSegments(e,t){var r=t.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e;if(t.depth<=0){if(!t.plainObjects&&has.call(Object.prototype,r)&&!t.allowPrototypes)return;return[r]}var i=/(\[[^[\]]*])/g,a=/(\[[^[\]]*])/.exec(r),o=a?r.slice(0,a.index):r,l=[];if(o){if(!t.plainObjects&&has.call(Object.prototype,o)&&!t.allowPrototypes)return;l[l.length]=o}for(var n=0;null!==(a=i.exec(r))&&n<t.depth;){n+=1;var s=a[1].slice(1,-1);if(!t.plainObjects&&has.call(Object.prototype,s)&&!t.allowPrototypes)return;l[l.length]=a[1]}if(a){if(!0===t.strictDepth)throw new RangeError("Input depth exceeded depth option of "+t.depth+" and strictDepth is true");l[l.length]="["+r.slice(a.index)+"]"}return l},parseKeys=function parseQueryStringKeys(e,t,r,i){if(e){var a=splitKeyIntoSegments(e,r);if(a)return parseObject(a,t,r,i)}},normalizeParseOptions=function normalizeParseOptions(e){if(!e)return defaults;if(void 0!==e.allowEmptyArrays&&"boolean"!=typeof e.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==e.decodeDotInKeys&&"boolean"!=typeof e.decodeDotInKeys)throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(void 0!==e.throwOnLimitExceeded&&"boolean"!=typeof e.throwOnLimitExceeded)throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var t=void 0===e.charset?defaults.charset:e.charset,r=void 0===e.duplicates?defaults.duplicates:e.duplicates;if("combine"!==r&&"first"!==r&&"last"!==r)throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:void 0===e.allowDots?!0===e.decodeDotInKeys||defaults.allowDots:!!e.allowDots,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:defaults.allowEmptyArrays,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:defaults.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:defaults.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:defaults.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:defaults.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:defaults.comma,decodeDotInKeys:"boolean"==typeof e.decodeDotInKeys?e.decodeDotInKeys:defaults.decodeDotInKeys,decoder:"function"==typeof e.decoder?e.decoder:defaults.decoder,delimiter:"string"==typeof e.delimiter||utils.isRegExp(e.delimiter)?e.delimiter:defaults.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:defaults.depth,duplicates:r,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:defaults.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:defaults.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:defaults.plainObjects,strictDepth:"boolean"==typeof e.strictDepth?!!e.strictDepth:defaults.strictDepth,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:defaults.strictNullHandling,throwOnLimitExceeded:"boolean"==typeof e.throwOnLimitExceeded&&e.throwOnLimitExceeded}};module.exports=function(e,t){var r=normalizeParseOptions(t);if(""===e||null==e)return r.plainObjects?{__proto__:null}:{};for(var i="string"==typeof e?parseValues(e,r):e,a=r.plainObjects?{__proto__:null}:{},o=Object.keys(i),l=0;l<o.length;++l){var n=o[l],s=parseKeys(n,i[n],r,"string"==typeof e);a=utils.merge(a,s,r)}return!0===r.allowSparse?a:utils.compact(a)};
|
|
9
9
|
|
|
10
10
|
},{"5":5}],4:[function(require,module,exports){
|
|
11
11
|
"use strict";var getSideChannel=require(46),utils=require(5),formats=require(1),has=Object.prototype.hasOwnProperty,arrayPrefixGenerators={brackets:function brackets(e){return e+"[]"},comma:"comma",indices:function indices(e,r){return e+"["+r+"]"},repeat:function repeat(e){return e}},isArray=Array.isArray,push=Array.prototype.push,pushToArray=function(e,r){push.apply(e,isArray(r)?r:[r])},toISO=Date.prototype.toISOString,defaultFormat=formats.default,defaults={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:utils.encode,encodeValuesOnly:!1,filter:void 0,format:defaultFormat,formatter:formats.formatters[defaultFormat],indices:!1,serializeDate:function serializeDate(e){return toISO.call(e)},skipNulls:!1,strictNullHandling:!1},isNonNullishPrimitive=function isNonNullishPrimitive(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||"symbol"==typeof e||"bigint"==typeof e},sentinel={},stringify=function stringify(e,r,t,o,a,n,i,l,s,f,u,d,y,c,p,m,h,v){for(var g=e,w=v,b=0,A=!1;void 0!==(w=w.get(sentinel))&&!A;){var D=w.get(e);if(b+=1,void 0!==D){if(D===b)throw new RangeError("Cyclic object value");A=!0}void 0===w.get(sentinel)&&(b=0)}if("function"==typeof f?g=f(r,g):g instanceof Date?g=y(g):"comma"===t&&isArray(g)&&(g=utils.maybeMap(g,function(e){return e instanceof Date?y(e):e})),null===g){if(n)return s&&!m?s(r,defaults.encoder,h,"key",c):r;g=""}if(isNonNullishPrimitive(g)||utils.isBuffer(g))return s?[p(m?r:s(r,defaults.encoder,h,"key",c))+"="+p(s(g,defaults.encoder,h,"value",c))]:[p(r)+"="+p(String(g))];var S,E=[];if(void 0===g)return E;if("comma"===t&&isArray(g))m&&s&&(g=utils.maybeMap(g,s)),S=[{value:g.length>0?g.join(",")||null:void 0}];else if(isArray(f))S=f;else{var N=Object.keys(g);S=u?N.sort(u):N}var T=l?String(r).replace(/\./g,"%2E"):String(r),O=o&&isArray(g)&&1===g.length?T+"[]":T;if(a&&isArray(g)&&0===g.length)return O+"[]";for(var k=0;k<S.length;++k){var I=S[k],P="object"==typeof I&&I&&void 0!==I.value?I.value:g[I];if(!i||null!==P){var x=d&&l?String(I).replace(/\./g,"%2E"):String(I),z=isArray(g)?"function"==typeof t?t(O,x):O:O+(d?"."+x:"["+x+"]");v.set(e,b);var K=getSideChannel();K.set(sentinel,v),pushToArray(E,stringify(P,z,t,o,a,n,i,l,"comma"===t&&m&&isArray(g)?null:s,f,u,d,y,c,p,m,h,K))}}return E},normalizeStringifyOptions=function normalizeStringifyOptions(e){if(!e)return defaults;if(void 0!==e.allowEmptyArrays&&"boolean"!=typeof e.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==e.encodeDotInKeys&&"boolean"!=typeof e.encodeDotInKeys)throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var r=e.charset||defaults.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=formats.default;if(void 0!==e.format){if(!has.call(formats.formatters,e.format))throw new TypeError("Unknown format option provided.");t=e.format}var o,a=formats.formatters[t],n=defaults.filter;if(("function"==typeof e.filter||isArray(e.filter))&&(n=e.filter),o=e.arrayFormat in arrayPrefixGenerators?e.arrayFormat:"indices"in e?e.indices?"indices":"repeat":defaults.arrayFormat,"commaRoundTrip"in e&&"boolean"!=typeof e.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var i=void 0===e.allowDots?!0===e.encodeDotInKeys||defaults.allowDots:!!e.allowDots;return{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:defaults.addQueryPrefix,allowDots:i,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:defaults.allowEmptyArrays,arrayFormat:o,charset:r,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:defaults.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:void 0===e.delimiter?defaults.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:defaults.encode,encodeDotInKeys:"boolean"==typeof e.encodeDotInKeys?e.encodeDotInKeys:defaults.encodeDotInKeys,encoder:"function"==typeof e.encoder?e.encoder:defaults.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:defaults.encodeValuesOnly,filter:n,format:t,formatter:a,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:defaults.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:defaults.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:defaults.strictNullHandling}};module.exports=function(e,r){var t,o=e,a=normalizeStringifyOptions(r);"function"==typeof a.filter?o=(0,a.filter)("",o):isArray(a.filter)&&(t=a.filter);var n=[];if("object"!=typeof o||null===o)return"";var i=arrayPrefixGenerators[a.arrayFormat],l="comma"===i&&a.commaRoundTrip;t||(t=Object.keys(o)),a.sort&&t.sort(a.sort);for(var s=getSideChannel(),f=0;f<t.length;++f){var u=t[f],d=o[u];a.skipNulls&&null===d||pushToArray(n,stringify(d,u,i,l,a.allowEmptyArrays,a.strictNullHandling,a.skipNulls,a.encodeDotInKeys,a.encode?a.encoder:null,a.filter,a.sort,a.allowDots,a.serializeDate,a.format,a.formatter,a.encodeValuesOnly,a.charset,s))}var y=n.join(a.delimiter),c=!0===a.addQueryPrefix?"?":"";return a.charsetSentinel&&("iso-8859-1"===a.charset?c+="utf8=%26%2310003%3B&":c+="utf8=%E2%9C%93&"),y.length>0?c+y:""};
|
|
12
12
|
|
|
13
13
|
},{"1":1,"46":46,"5":5}],5:[function(require,module,exports){
|
|
14
|
-
"use strict";var formats=require(1),getSideChannel=require(46),has=Object.prototype.hasOwnProperty,isArray=Array.isArray,overflowChannel=getSideChannel(),markOverflow=function markOverflow(e,r){return overflowChannel.set(e,r),e},isOverflow=function isOverflow(e){return overflowChannel.has(e)},getMaxIndex=function getMaxIndex(e){return overflowChannel.get(e)},setMaxIndex=function setMaxIndex(e,r){overflowChannel.set(e,r)},hexTable=function(){for(var e=[],r=0;r<256;++r)e.
|
|
14
|
+
"use strict";var formats=require(1),getSideChannel=require(46),has=Object.prototype.hasOwnProperty,isArray=Array.isArray,overflowChannel=getSideChannel(),markOverflow=function markOverflow(e,r){return overflowChannel.set(e,r),e},isOverflow=function isOverflow(e){return overflowChannel.has(e)},getMaxIndex=function getMaxIndex(e){return overflowChannel.get(e)},setMaxIndex=function setMaxIndex(e,r){overflowChannel.set(e,r)},hexTable=function(){for(var e=[],r=0;r<256;++r)e[e.length]="%"+((r<16?"0":"")+r.toString(16)).toUpperCase();return e}(),compactQueue=function compactQueue(e){for(;e.length>1;){var r=e.pop(),t=r.obj[r.prop];if(isArray(t)){for(var n=[],o=0;o<t.length;++o)void 0!==t[o]&&(n[n.length]=t[o]);r.obj[r.prop]=n}}},arrayToObject=function arrayToObject(e,r){for(var t=r&&r.plainObjects?{__proto__:null}:{},n=0;n<e.length;++n)void 0!==e[n]&&(t[n]=e[n]);return t},merge=function merge(e,r,t){if(!r)return e;if("object"!=typeof r&&"function"!=typeof r){if(isArray(e)){var n=e.length;if(t&&"number"==typeof t.arrayLimit&&n>t.arrayLimit)return markOverflow(arrayToObject(e.concat(r),t),n);e[n]=r}else{if(!e||"object"!=typeof e)return[e,r];if(isOverflow(e)){var o=getMaxIndex(e)+1;e[o]=r,setMaxIndex(e,o)}else(t&&(t.plainObjects||t.allowPrototypes)||!has.call(Object.prototype,r))&&(e[r]=!0)}return e}if(!e||"object"!=typeof e){if(isOverflow(r)){for(var a=Object.keys(r),i=t&&t.plainObjects?{__proto__:null,0:e}:{0:e},c=0;c<a.length;c++)i[parseInt(a[c],10)+1]=r[a[c]];return markOverflow(i,getMaxIndex(r)+1)}var l=[e].concat(r);return t&&"number"==typeof t.arrayLimit&&l.length>t.arrayLimit?markOverflow(arrayToObject(l,t),l.length-1):l}var f=e;return isArray(e)&&!isArray(r)&&(f=arrayToObject(e,t)),isArray(e)&&isArray(r)?(r.forEach(function(r,n){if(has.call(e,n)){var o=e[n];o&&"object"==typeof o&&r&&"object"==typeof r?e[n]=merge(o,r,t):e[e.length]=r}else e[n]=r}),e):Object.keys(r).reduce(function(e,n){var o=r[n];if(has.call(e,n)?e[n]=merge(e[n],o,t):e[n]=o,isOverflow(r)&&!isOverflow(e)&&markOverflow(e,getMaxIndex(r)),isOverflow(e)){var a=parseInt(n,10);String(a)===n&&a>=0&&a>getMaxIndex(e)&&setMaxIndex(e,a)}return e},f)},assign=function assignSingleSource(e,r){return Object.keys(r).reduce(function(e,t){return e[t]=r[t],e},e)},decode=function(e,r,t){var n=e.replace(/\+/g," ");if("iso-8859-1"===t)return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(e){return n}},limit=1024,encode=function encode(e,r,t,n,o){if(0===e.length)return e;var a=e;if("symbol"==typeof e?a=Symbol.prototype.toString.call(e):"string"!=typeof e&&(a=String(e)),"iso-8859-1"===t)return escape(a).replace(/%u[0-9a-f]{4}/gi,function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"});for(var i="",c=0;c<a.length;c+=limit){for(var l=a.length>=limit?a.slice(c,c+limit):a,f=[],s=0;s<l.length;++s){var u=l.charCodeAt(s);45===u||46===u||95===u||126===u||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||o===formats.RFC1738&&(40===u||41===u)?f[f.length]=l.charAt(s):u<128?f[f.length]=hexTable[u]:u<2048?f[f.length]=hexTable[192|u>>6]+hexTable[128|63&u]:u<55296||u>=57344?f[f.length]=hexTable[224|u>>12]+hexTable[128|u>>6&63]+hexTable[128|63&u]:(s+=1,u=65536+((1023&u)<<10|1023&l.charCodeAt(s)),f[f.length]=hexTable[240|u>>18]+hexTable[128|u>>12&63]+hexTable[128|u>>6&63]+hexTable[128|63&u])}i+=f.join("")}return i},compact=function compact(e){for(var r=[{obj:{o:e},prop:"o"}],t=[],n=0;n<r.length;++n)for(var o=r[n],a=o.obj[o.prop],i=Object.keys(a),c=0;c<i.length;++c){var l=i[c],f=a[l];"object"==typeof f&&null!==f&&-1===t.indexOf(f)&&(r[r.length]={obj:a,prop:l},t[t.length]=f)}return compactQueue(r),e},isRegExp=function isRegExp(e){return"[object RegExp]"===Object.prototype.toString.call(e)},isBuffer=function isBuffer(e){return!(!e||"object"!=typeof e||!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e)))},combine=function combine(e,r,t,n){if(isOverflow(e)){var o=getMaxIndex(e)+1;return e[o]=r,setMaxIndex(e,o),e}var a=[].concat(e,r);return a.length>t?markOverflow(arrayToObject(a,{plainObjects:n}),a.length-1):a},maybeMap=function maybeMap(e,r){if(isArray(e)){for(var t=[],n=0;n<e.length;n+=1)t[t.length]=r(e[n]);return t}return r(e)};module.exports={/* common-shake removed: arrayToObject:arrayToObject *//* common-shake removed: assign:assign */combine:combine,compact:compact,decode:decode,encode:encode,isBuffer:isBuffer,isOverflow:isOverflow,isRegExp:isRegExp,markOverflow:markOverflow,maybeMap:maybeMap,merge:merge};
|
|
15
15
|
|
|
16
16
|
},{"1":1,"46":46}],46:[function(require,module,exports){
|
|
17
17
|
"use strict";var $TypeError=require(20),inspect=require(42),getSideChannelList=require(43),getSideChannelMap=require(44),getSideChannelWeakMap=require(45),makeChannel=getSideChannelWeakMap||getSideChannelMap||getSideChannelList;module.exports=function getSideChannel(){var e,n={assert:function(e){if(!n.has(e))throw new $TypeError("Side channel does not contain "+inspect(e))},delete:function(n){return!!e&&e.delete(n)},get:function(n){return e&&e.get(n)},has:function(n){return!!e&&e.has(n)},set:function(n,t){e||(e=makeChannel()),e.set(n,t)}};return n};
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
},{}],7:[function(require,module,exports){
|
|
22
22
|
"use strict";var bind=require(24),$apply=require(8),$call=require(9),$reflectApply=require(11);module.exports=$reflectApply||bind.call($call,$apply);
|
|
23
23
|
|
|
24
|
-
},{"11":11,"24":24,"8":8,"9":9}],
|
|
25
|
-
"use strict";module.exports=Function.prototype.apply;
|
|
26
|
-
|
|
27
|
-
},{}],9:[function(require,module,exports){
|
|
24
|
+
},{"11":11,"24":24,"8":8,"9":9}],9:[function(require,module,exports){
|
|
28
25
|
"use strict";module.exports=Function.prototype.call;
|
|
29
26
|
|
|
27
|
+
},{}],8:[function(require,module,exports){
|
|
28
|
+
"use strict";module.exports=Function.prototype.apply;
|
|
29
|
+
|
|
30
30
|
},{}],24:[function(require,module,exports){
|
|
31
31
|
"use strict";var implementation=require(23);module.exports=Function.prototype.bind||implementation;
|
|
32
32
|
|
|
@@ -78,23 +78,23 @@
|
|
|
78
78
|
},{}],23:[function(require,module,exports){
|
|
79
79
|
"use strict";var ERROR_MESSAGE="Function.prototype.bind called on incompatible ",toStr=Object.prototype.toString,max=Math.max,funcType="[object Function]",concatty=function concatty(t,n){for(var r=[],o=0;o<t.length;o+=1)r[o]=t[o];for(var e=0;e<n.length;e+=1)r[e+t.length]=n[e];return r},slicy=function slicy(t,n){for(var r=[],o=n||0,e=0;o<t.length;o+=1,e+=1)r[e]=t[o];return r},joiny=function(t,n){for(var r="",o=0;o<t.length;o+=1)r+=t[o],o+1<t.length&&(r+=n);return r};module.exports=function bind(t){var n=this;if("function"!=typeof n||toStr.apply(n)!==funcType)throw new TypeError(ERROR_MESSAGE+n);for(var r,o=slicy(arguments,1),e=max(0,n.length-o.length),i=[],c=0;c<e;c++)i[c]="$"+c;if(r=Function("binder","return function ("+joiny(i,",")+"){ return binder.apply(this,arguments); }")(function(){if(this instanceof r){var e=n.apply(this,concatty(o,arguments));return Object(e)===e?e:this}return n.apply(t,concatty(o,arguments))}),n.prototype){var p=function Empty(){};p.prototype=n.prototype,r.prototype=new p,p.prototype=null}return r};
|
|
80
80
|
|
|
81
|
-
},{}],
|
|
82
|
-
"use strict";module.exports=Math.
|
|
83
|
-
|
|
84
|
-
},{}],40:[function(require,module,exports){
|
|
85
|
-
"use strict";module.exports=Math.round;
|
|
81
|
+
},{}],39:[function(require,module,exports){
|
|
82
|
+
"use strict";module.exports=Math.pow;
|
|
86
83
|
|
|
87
84
|
},{}],37:[function(require,module,exports){
|
|
88
85
|
"use strict";module.exports=Math.max;
|
|
89
86
|
|
|
87
|
+
},{}],34:[function(require,module,exports){
|
|
88
|
+
"use strict";module.exports=Math.abs;
|
|
89
|
+
|
|
90
90
|
},{}],38:[function(require,module,exports){
|
|
91
91
|
"use strict";module.exports=Math.min;
|
|
92
92
|
|
|
93
|
-
},{}],
|
|
94
|
-
"use strict";module.exports=Math.
|
|
93
|
+
},{}],35:[function(require,module,exports){
|
|
94
|
+
"use strict";module.exports=Math.floor;
|
|
95
95
|
|
|
96
|
-
},{}],
|
|
97
|
-
"use strict";module.exports=Math.
|
|
96
|
+
},{}],40:[function(require,module,exports){
|
|
97
|
+
"use strict";module.exports=Math.round;
|
|
98
98
|
|
|
99
99
|
},{}],27:[function(require,module,exports){
|
|
100
100
|
"use strict";module.exports="undefined"!=typeof Reflect&&Reflect.getPrototypeOf||null;
|
|
@@ -102,13 +102,13 @@
|
|
|
102
102
|
},{}],26:[function(require,module,exports){
|
|
103
103
|
"use strict";var $Object=require(22);module.exports=$Object.getPrototypeOf||null;
|
|
104
104
|
|
|
105
|
-
},{"22":22}],
|
|
106
|
-
"use strict";var call=Function.prototype.call,$hasOwn=Object.prototype.hasOwnProperty,bind=require(24);module.exports=bind.call(call,$hasOwn);
|
|
107
|
-
|
|
108
|
-
},{"24":24}],41:[function(require,module,exports){
|
|
105
|
+
},{"22":22}],41:[function(require,module,exports){
|
|
109
106
|
"use strict";var $isNaN=require(36);module.exports=function sign(i){return $isNaN(i)||0===i?i:i<0?-1:1};
|
|
110
107
|
|
|
111
|
-
},{"36":36}],
|
|
108
|
+
},{"36":36}],33:[function(require,module,exports){
|
|
109
|
+
"use strict";var call=Function.prototype.call,$hasOwn=Object.prototype.hasOwnProperty,bind=require(24);module.exports=bind.call(call,$hasOwn);
|
|
110
|
+
|
|
111
|
+
},{"24":24}],31:[function(require,module,exports){
|
|
112
112
|
"use strict";var origSymbol="undefined"!=typeof Symbol&&Symbol,hasSymbolSham=require(32);module.exports=function hasNativeSymbols(){return"function"==typeof origSymbol&&"function"==typeof Symbol&&"symbol"==typeof origSymbol("foo")&&"symbol"==typeof Symbol("bar")&&hasSymbolSham()};
|
|
113
113
|
|
|
114
114
|
},{"32":32}],28:[function(require,module,exports){
|
|
@@ -63,7 +63,7 @@ var parseValues = function parseQueryStringValues(str, options) {
|
|
|
63
63
|
var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
|
|
64
64
|
cleanStr = cleanStr.replace(/%5B/gi, '[').replace(/%5D/gi, ']');
|
|
65
65
|
|
|
66
|
-
var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
|
|
66
|
+
var limit = options.parameterLimit === Infinity ? void undefined : options.parameterLimit;
|
|
67
67
|
var parts = cleanStr.split(
|
|
68
68
|
options.delimiter,
|
|
69
69
|
options.throwOnLimitExceeded ? limit + 1 : limit
|
|
@@ -130,6 +130,13 @@ var parseValues = function parseQueryStringValues(str, options) {
|
|
|
130
130
|
val = isArray(val) ? [val] : val;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
if (options.comma && isArray(val) && val.length > options.arrayLimit) {
|
|
134
|
+
if (options.throwOnLimitExceeded) {
|
|
135
|
+
throw new RangeError('Array limit exceeded. Only ' + options.arrayLimit + ' element' + (options.arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
|
|
136
|
+
}
|
|
137
|
+
val = utils.combine([], val, options.arrayLimit, options.plainObjects);
|
|
138
|
+
}
|
|
139
|
+
|
|
133
140
|
if (key !== null) {
|
|
134
141
|
var existing = has.call(obj, key);
|
|
135
142
|
if (existing && options.duplicates === 'combine') {
|
|
@@ -180,17 +187,21 @@ var parseObject = function (chain, val, options, valuesParsed) {
|
|
|
180
187
|
var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
|
|
181
188
|
var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, '.') : cleanRoot;
|
|
182
189
|
var index = parseInt(decodedRoot, 10);
|
|
183
|
-
|
|
184
|
-
obj = { 0: leaf };
|
|
185
|
-
} else if (
|
|
186
|
-
!isNaN(index)
|
|
190
|
+
var isValidArrayIndex = !isNaN(index)
|
|
187
191
|
&& root !== decodedRoot
|
|
188
192
|
&& String(index) === decodedRoot
|
|
189
193
|
&& index >= 0
|
|
190
|
-
&&
|
|
191
|
-
) {
|
|
194
|
+
&& options.parseArrays;
|
|
195
|
+
if (!options.parseArrays && decodedRoot === '') {
|
|
196
|
+
obj = { 0: leaf };
|
|
197
|
+
} else if (isValidArrayIndex && index < options.arrayLimit) {
|
|
192
198
|
obj = [];
|
|
193
199
|
obj[index] = leaf;
|
|
200
|
+
} else if (isValidArrayIndex && options.throwOnLimitExceeded) {
|
|
201
|
+
throw new RangeError('Array limit exceeded. Only ' + options.arrayLimit + ' element' + (options.arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
|
|
202
|
+
} else if (isValidArrayIndex) {
|
|
203
|
+
obj[index] = leaf;
|
|
204
|
+
utils.markOverflow(obj, index);
|
|
194
205
|
} else if (decodedRoot !== '__proto__') {
|
|
195
206
|
obj[decodedRoot] = leaf;
|
|
196
207
|
}
|
|
@@ -230,7 +241,7 @@ var splitKeyIntoSegments = function splitKeyIntoSegments(givenKey, options) {
|
|
|
230
241
|
}
|
|
231
242
|
}
|
|
232
243
|
|
|
233
|
-
keys.
|
|
244
|
+
keys[keys.length] = parent;
|
|
234
245
|
}
|
|
235
246
|
|
|
236
247
|
var i = 0;
|
|
@@ -244,7 +255,7 @@ var splitKeyIntoSegments = function splitKeyIntoSegments(givenKey, options) {
|
|
|
244
255
|
}
|
|
245
256
|
}
|
|
246
257
|
|
|
247
|
-
keys.
|
|
258
|
+
keys[keys.length] = segment[1];
|
|
248
259
|
}
|
|
249
260
|
|
|
250
261
|
if (segment) {
|
|
@@ -252,7 +263,7 @@ var splitKeyIntoSegments = function splitKeyIntoSegments(givenKey, options) {
|
|
|
252
263
|
throw new RangeError('Input depth exceeded depth option of ' + options.depth + ' and strictDepth is true');
|
|
253
264
|
}
|
|
254
265
|
|
|
255
|
-
keys.
|
|
266
|
+
keys[keys.length] = '[' + key.slice(segment.index) + ']';
|
|
256
267
|
}
|
|
257
268
|
|
|
258
269
|
return keys;
|
|
@@ -30,7 +30,7 @@ var setMaxIndex = function setMaxIndex(obj, maxIndex) {
|
|
|
30
30
|
var hexTable = (function () {
|
|
31
31
|
var array = [];
|
|
32
32
|
for (var i = 0; i < 256; ++i) {
|
|
33
|
-
array.
|
|
33
|
+
array[array.length] = '%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase();
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
return array;
|
|
@@ -46,7 +46,7 @@ var compactQueue = function compactQueue(queue) {
|
|
|
46
46
|
|
|
47
47
|
for (var j = 0; j < obj.length; ++j) {
|
|
48
48
|
if (typeof obj[j] !== 'undefined') {
|
|
49
|
-
compacted.
|
|
49
|
+
compacted[compacted.length] = obj[j];
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -74,7 +74,11 @@ var merge = function merge(target, source, options) {
|
|
|
74
74
|
|
|
75
75
|
if (typeof source !== 'object' && typeof source !== 'function') {
|
|
76
76
|
if (isArray(target)) {
|
|
77
|
-
target.
|
|
77
|
+
var nextIndex = target.length;
|
|
78
|
+
if (options && typeof options.arrayLimit === 'number' && nextIndex > options.arrayLimit) {
|
|
79
|
+
return markOverflow(arrayToObject(target.concat(source), options), nextIndex);
|
|
80
|
+
}
|
|
81
|
+
target[nextIndex] = source;
|
|
78
82
|
} else if (target && typeof target === 'object') {
|
|
79
83
|
if (isOverflow(target)) {
|
|
80
84
|
// Add at next numeric index for overflow objects
|
|
@@ -107,7 +111,11 @@ var merge = function merge(target, source, options) {
|
|
|
107
111
|
}
|
|
108
112
|
return markOverflow(result, getMaxIndex(source) + 1);
|
|
109
113
|
}
|
|
110
|
-
|
|
114
|
+
var combined = [target].concat(source);
|
|
115
|
+
if (options && typeof options.arrayLimit === 'number' && combined.length > options.arrayLimit) {
|
|
116
|
+
return markOverflow(arrayToObject(combined, options), combined.length - 1);
|
|
117
|
+
}
|
|
118
|
+
return combined;
|
|
111
119
|
}
|
|
112
120
|
|
|
113
121
|
var mergeTarget = target;
|
|
@@ -122,7 +130,7 @@ var merge = function merge(target, source, options) {
|
|
|
122
130
|
if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
|
|
123
131
|
target[i] = merge(targetItem, item, options);
|
|
124
132
|
} else {
|
|
125
|
-
target.
|
|
133
|
+
target[target.length] = item;
|
|
126
134
|
}
|
|
127
135
|
} else {
|
|
128
136
|
target[i] = item;
|
|
@@ -139,6 +147,17 @@ var merge = function merge(target, source, options) {
|
|
|
139
147
|
} else {
|
|
140
148
|
acc[key] = value;
|
|
141
149
|
}
|
|
150
|
+
|
|
151
|
+
if (isOverflow(source) && !isOverflow(acc)) {
|
|
152
|
+
markOverflow(acc, getMaxIndex(source));
|
|
153
|
+
}
|
|
154
|
+
if (isOverflow(acc)) {
|
|
155
|
+
var keyNum = parseInt(key, 10);
|
|
156
|
+
if (String(keyNum) === key && keyNum >= 0 && keyNum > getMaxIndex(acc)) {
|
|
157
|
+
setMaxIndex(acc, keyNum);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
142
161
|
return acc;
|
|
143
162
|
}, mergeTarget);
|
|
144
163
|
};
|
|
@@ -255,8 +274,8 @@ var compact = function compact(value) {
|
|
|
255
274
|
var key = keys[j];
|
|
256
275
|
var val = obj[key];
|
|
257
276
|
if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
|
|
258
|
-
queue.
|
|
259
|
-
refs.
|
|
277
|
+
queue[queue.length] = { obj: obj, prop: key };
|
|
278
|
+
refs[refs.length] = val;
|
|
260
279
|
}
|
|
261
280
|
}
|
|
262
281
|
}
|
|
@@ -298,7 +317,7 @@ var maybeMap = function maybeMap(val, fn) {
|
|
|
298
317
|
if (isArray(val)) {
|
|
299
318
|
var mapped = [];
|
|
300
319
|
for (var i = 0; i < val.length; i += 1) {
|
|
301
|
-
mapped.
|
|
320
|
+
mapped[mapped.length] = fn(val[i]);
|
|
302
321
|
}
|
|
303
322
|
return mapped;
|
|
304
323
|
}
|
|
@@ -315,6 +334,7 @@ module.exports = {
|
|
|
315
334
|
isBuffer: isBuffer,
|
|
316
335
|
isOverflow: isOverflow,
|
|
317
336
|
isRegExp: isRegExp,
|
|
337
|
+
markOverflow: markOverflow,
|
|
318
338
|
maybeMap: maybeMap,
|
|
319
339
|
merge: merge
|
|
320
340
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "qs",
|
|
3
3
|
"description": "A querystring parser that supports nesting and arrays, with a depth limit",
|
|
4
4
|
"homepage": "https://github.com/ljharb/qs",
|
|
5
|
-
"version": "6.14.
|
|
5
|
+
"version": "6.14.2",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/ljharb/qs.git"
|
|
@@ -261,11 +261,11 @@ test('parse()', function (t) {
|
|
|
261
261
|
});
|
|
262
262
|
|
|
263
263
|
t.test('limits specific array indices to arrayLimit', function (st) {
|
|
264
|
-
st.deepEqual(qs.parse('a[
|
|
265
|
-
st.deepEqual(qs.parse('a[
|
|
264
|
+
st.deepEqual(qs.parse('a[19]=a', { arrayLimit: 20 }), { a: ['a'] });
|
|
265
|
+
st.deepEqual(qs.parse('a[20]=a', { arrayLimit: 20 }), { a: { 20: 'a' } });
|
|
266
266
|
|
|
267
|
-
st.deepEqual(qs.parse('a[
|
|
268
|
-
st.deepEqual(qs.parse('a[
|
|
267
|
+
st.deepEqual(qs.parse('a[19]=a'), { a: ['a'] });
|
|
268
|
+
st.deepEqual(qs.parse('a[20]=a'), { a: { 20: 'a' } });
|
|
269
269
|
st.end();
|
|
270
270
|
});
|
|
271
271
|
|
|
@@ -483,7 +483,7 @@ test('parse()', function (t) {
|
|
|
483
483
|
|
|
484
484
|
t.test('allows overriding array limit', function (st) {
|
|
485
485
|
st.deepEqual(qs.parse('a[0]=b', { arrayLimit: -1 }), { a: { 0: 'b' } });
|
|
486
|
-
st.deepEqual(qs.parse('a[0]=b', { arrayLimit: 0 }), { a:
|
|
486
|
+
st.deepEqual(qs.parse('a[0]=b', { arrayLimit: 0 }), { a: { 0: 'b' } });
|
|
487
487
|
|
|
488
488
|
st.deepEqual(qs.parse('a[-1]=b', { arrayLimit: -1 }), { a: { '-1': 'b' } });
|
|
489
489
|
st.deepEqual(qs.parse('a[-1]=b', { arrayLimit: 0 }), { a: { '-1': 'b' } });
|
|
@@ -1118,6 +1118,7 @@ test('parse()', function (t) {
|
|
|
1118
1118
|
});
|
|
1119
1119
|
|
|
1120
1120
|
st.test('throws error when array limit exceeded', function (sst) {
|
|
1121
|
+
// 4 elements exceeds limit of 3
|
|
1121
1122
|
sst['throws'](
|
|
1122
1123
|
function () {
|
|
1123
1124
|
qs.parse('a[]=1&a[]=2&a[]=3&a[]=4', { arrayLimit: 3, throwOnLimitExceeded: true });
|
|
@@ -1128,6 +1129,14 @@ test('parse()', function (t) {
|
|
|
1128
1129
|
sst.end();
|
|
1129
1130
|
});
|
|
1130
1131
|
|
|
1132
|
+
st.test('does not throw when at limit', function (sst) {
|
|
1133
|
+
// 3 elements = limit of 3, should not throw
|
|
1134
|
+
var result = qs.parse('a[]=1&a[]=2&a[]=3', { arrayLimit: 3, throwOnLimitExceeded: true });
|
|
1135
|
+
sst.ok(Array.isArray(result.a), 'result is an array');
|
|
1136
|
+
sst.deepEqual(result.a, ['1', '2', '3'], 'all values present');
|
|
1137
|
+
sst.end();
|
|
1138
|
+
});
|
|
1139
|
+
|
|
1131
1140
|
st.test('converts array to object if length is greater than limit', function (sst) {
|
|
1132
1141
|
var result = qs.parse('a[1]=1&a[2]=2&a[3]=3&a[4]=4&a[5]=5&a[6]=6', { arrayLimit: 5 });
|
|
1133
1142
|
|
|
@@ -1135,6 +1144,40 @@ test('parse()', function (t) {
|
|
|
1135
1144
|
sst.end();
|
|
1136
1145
|
});
|
|
1137
1146
|
|
|
1147
|
+
st.test('throws error when indexed notation exceeds arrayLimit with throwOnLimitExceeded', function (sst) {
|
|
1148
|
+
sst['throws'](
|
|
1149
|
+
function () {
|
|
1150
|
+
qs.parse('a[1001]=b', { arrayLimit: 1000, throwOnLimitExceeded: true });
|
|
1151
|
+
},
|
|
1152
|
+
new RangeError('Array limit exceeded. Only 1000 elements allowed in an array.'),
|
|
1153
|
+
'throws error for a single index exceeding arrayLimit'
|
|
1154
|
+
);
|
|
1155
|
+
|
|
1156
|
+
sst['throws'](
|
|
1157
|
+
function () {
|
|
1158
|
+
qs.parse('a[0]=1&a[1]=2&a[2]=3&a[10]=4', { arrayLimit: 6, throwOnLimitExceeded: true, allowSparse: true });
|
|
1159
|
+
},
|
|
1160
|
+
new RangeError('Array limit exceeded. Only 6 elements allowed in an array.'),
|
|
1161
|
+
'throws error when a sparse index exceeds arrayLimit'
|
|
1162
|
+
);
|
|
1163
|
+
|
|
1164
|
+
sst.end();
|
|
1165
|
+
});
|
|
1166
|
+
|
|
1167
|
+
st.test('does not throw for indexed notation within arrayLimit with throwOnLimitExceeded', function (sst) {
|
|
1168
|
+
var result = qs.parse('a[4]=b', { arrayLimit: 5, throwOnLimitExceeded: true, allowSparse: true });
|
|
1169
|
+
sst.ok(Array.isArray(result.a), 'result is an array');
|
|
1170
|
+
sst.equal(result.a.length, 5, 'array has correct length');
|
|
1171
|
+
sst.equal(result.a[4], 'b', 'value at index 4 is correct');
|
|
1172
|
+
sst.end();
|
|
1173
|
+
});
|
|
1174
|
+
|
|
1175
|
+
st.test('silently converts to object for indexed notation exceeding arrayLimit without throwOnLimitExceeded', function (sst) {
|
|
1176
|
+
var result = qs.parse('a[1001]=b', { arrayLimit: 1000 });
|
|
1177
|
+
sst.deepEqual(result, { a: { 1001: 'b' } }, 'converts to object without throwing');
|
|
1178
|
+
sst.end();
|
|
1179
|
+
});
|
|
1180
|
+
|
|
1138
1181
|
st.end();
|
|
1139
1182
|
});
|
|
1140
1183
|
|
|
@@ -1304,24 +1347,72 @@ test('DOS', function (t) {
|
|
|
1304
1347
|
});
|
|
1305
1348
|
|
|
1306
1349
|
test('arrayLimit boundary conditions', function (t) {
|
|
1350
|
+
// arrayLimit is the max number of elements allowed in an array
|
|
1307
1351
|
t.test('exactly at the limit stays as array', function (st) {
|
|
1352
|
+
// 3 elements = limit of 3
|
|
1308
1353
|
var result = qs.parse('a[]=1&a[]=2&a[]=3', { arrayLimit: 3 });
|
|
1309
|
-
st.ok(Array.isArray(result.a), 'result is an array when
|
|
1354
|
+
st.ok(Array.isArray(result.a), 'result is an array when count equals limit');
|
|
1310
1355
|
st.deepEqual(result.a, ['1', '2', '3'], 'all values present');
|
|
1311
1356
|
st.end();
|
|
1312
1357
|
});
|
|
1313
1358
|
|
|
1314
1359
|
t.test('one over the limit converts to object', function (st) {
|
|
1360
|
+
// 4 elements exceeds limit of 3
|
|
1315
1361
|
var result = qs.parse('a[]=1&a[]=2&a[]=3&a[]=4', { arrayLimit: 3 });
|
|
1316
1362
|
st.notOk(Array.isArray(result.a), 'result is not an array when over limit');
|
|
1317
1363
|
st.deepEqual(result.a, { 0: '1', 1: '2', 2: '3', 3: '4' }, 'all values preserved as object');
|
|
1318
1364
|
st.end();
|
|
1319
1365
|
});
|
|
1320
1366
|
|
|
1321
|
-
t.test('arrayLimit 1 with
|
|
1367
|
+
t.test('arrayLimit 1 with one value', function (st) {
|
|
1368
|
+
// 1 element = limit of 1
|
|
1369
|
+
var result = qs.parse('a[]=1', { arrayLimit: 1 });
|
|
1370
|
+
st.ok(Array.isArray(result.a), 'result is an array when count equals limit');
|
|
1371
|
+
st.deepEqual(result.a, ['1'], 'value preserved as array');
|
|
1372
|
+
st.end();
|
|
1373
|
+
});
|
|
1374
|
+
|
|
1375
|
+
t.test('arrayLimit 1 with two values converts to object', function (st) {
|
|
1376
|
+
// 2 elements exceeds limit of 1
|
|
1322
1377
|
var result = qs.parse('a[]=1&a[]=2', { arrayLimit: 1 });
|
|
1323
1378
|
st.notOk(Array.isArray(result.a), 'result is not an array');
|
|
1324
|
-
st.deepEqual(result.a, { 0: '1', 1: '2' }, '
|
|
1379
|
+
st.deepEqual(result.a, { 0: '1', 1: '2' }, 'all values preserved as object');
|
|
1380
|
+
st.end();
|
|
1381
|
+
});
|
|
1382
|
+
|
|
1383
|
+
t.end();
|
|
1384
|
+
});
|
|
1385
|
+
|
|
1386
|
+
test('comma + arrayLimit', function (t) {
|
|
1387
|
+
t.test('comma-separated values within arrayLimit stay as array', function (st) {
|
|
1388
|
+
var result = qs.parse('a=1,2,3', { comma: true, arrayLimit: 5 });
|
|
1389
|
+
st.ok(Array.isArray(result.a), 'result is an array');
|
|
1390
|
+
st.deepEqual(result.a, ['1', '2', '3'], 'all values present');
|
|
1391
|
+
st.end();
|
|
1392
|
+
});
|
|
1393
|
+
|
|
1394
|
+
t.test('comma-separated values exceeding arrayLimit convert to object', function (st) {
|
|
1395
|
+
var result = qs.parse('a=1,2,3,4', { comma: true, arrayLimit: 3 });
|
|
1396
|
+
st.notOk(Array.isArray(result.a), 'result is not an array when over limit');
|
|
1397
|
+
st.deepEqual(result.a, { 0: '1', 1: '2', 2: '3', 3: '4' }, 'all values preserved as object');
|
|
1398
|
+
st.end();
|
|
1399
|
+
});
|
|
1400
|
+
|
|
1401
|
+
t.test('comma-separated values exceeding arrayLimit with throwOnLimitExceeded throws', function (st) {
|
|
1402
|
+
st['throws'](
|
|
1403
|
+
function () {
|
|
1404
|
+
qs.parse('a=1,2,3,4', { comma: true, arrayLimit: 3, throwOnLimitExceeded: true });
|
|
1405
|
+
},
|
|
1406
|
+
new RangeError('Array limit exceeded. Only 3 elements allowed in an array.'),
|
|
1407
|
+
'throws error when comma-split exceeds array limit'
|
|
1408
|
+
);
|
|
1409
|
+
st.end();
|
|
1410
|
+
});
|
|
1411
|
+
|
|
1412
|
+
t.test('comma-separated values at exactly arrayLimit stay as array', function (st) {
|
|
1413
|
+
var result = qs.parse('a=1,2,3', { comma: true, arrayLimit: 3 });
|
|
1414
|
+
st.ok(Array.isArray(result.a), 'result is an array when exactly at limit');
|
|
1415
|
+
st.deepEqual(result.a, ['1', '2', '3'], 'all values present');
|
|
1325
1416
|
st.end();
|
|
1326
1417
|
});
|
|
1327
1418
|
|
|
@@ -1384,13 +1475,38 @@ test('mixed array and object notation', function (t) {
|
|
|
1384
1475
|
});
|
|
1385
1476
|
|
|
1386
1477
|
t.test('multiple plain values exceeding limit', function (st) {
|
|
1478
|
+
// 3 elements (indices 0-2), max index 2 > limit 1
|
|
1387
1479
|
st.deepEqual(
|
|
1388
|
-
qs.parse('a=b&a=c&a=d', { arrayLimit:
|
|
1480
|
+
qs.parse('a=b&a=c&a=d', { arrayLimit: 1 }),
|
|
1389
1481
|
{ a: { 0: 'b', 1: 'c', 2: 'd' } },
|
|
1390
1482
|
'duplicate plain keys convert to object when exceeding limit'
|
|
1391
1483
|
);
|
|
1392
1484
|
st.end();
|
|
1393
1485
|
});
|
|
1394
1486
|
|
|
1487
|
+
t.test('mixed notation produces consistent results when arrayLimit is exceeded', function (st) {
|
|
1488
|
+
var expected = { a: { 0: 'b', 1: 'c', 2: 'd' } };
|
|
1489
|
+
|
|
1490
|
+
st.deepEqual(
|
|
1491
|
+
qs.parse('a[]=b&a[1]=c&a=d', { arrayLimit: -1 }),
|
|
1492
|
+
expected,
|
|
1493
|
+
'arrayLimit -1'
|
|
1494
|
+
);
|
|
1495
|
+
|
|
1496
|
+
st.deepEqual(
|
|
1497
|
+
qs.parse('a[]=b&a[1]=c&a=d', { arrayLimit: 0 }),
|
|
1498
|
+
expected,
|
|
1499
|
+
'arrayLimit 0'
|
|
1500
|
+
);
|
|
1501
|
+
|
|
1502
|
+
st.deepEqual(
|
|
1503
|
+
qs.parse('a[]=b&a[1]=c&a=d', { arrayLimit: 1 }),
|
|
1504
|
+
expected,
|
|
1505
|
+
'arrayLimit 1'
|
|
1506
|
+
);
|
|
1507
|
+
|
|
1508
|
+
st.end();
|
|
1509
|
+
});
|
|
1510
|
+
|
|
1395
1511
|
t.end();
|
|
1396
1512
|
});
|
|
@@ -69,12 +69,14 @@ test('merge()', function (t) {
|
|
|
69
69
|
);
|
|
70
70
|
|
|
71
71
|
t.test('with overflow objects (from arrayLimit)', function (st) {
|
|
72
|
+
// arrayLimit is max index, so with limit 0, max index 0 is allowed (1 element)
|
|
73
|
+
// To create overflow, need 2+ elements with limit 0, or 3+ with limit 1, etc.
|
|
72
74
|
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'
|
|
75
|
+
// Create an overflow object via combine: 3 elements (indices 0-2) with limit 0
|
|
76
|
+
var overflow = utils.combine(['a', 'b'], 'c', 0, false);
|
|
75
77
|
s2t.ok(utils.isOverflow(overflow), 'overflow object is marked');
|
|
76
|
-
var merged = utils.merge(overflow, '
|
|
77
|
-
s2t.deepEqual(merged, { 0: 'a', 1: 'b', 2: 'c' }, 'adds primitive at next numeric index');
|
|
78
|
+
var merged = utils.merge(overflow, 'd');
|
|
79
|
+
s2t.deepEqual(merged, { 0: 'a', 1: 'b', 2: 'c', 3: 'd' }, 'adds primitive at next numeric index');
|
|
78
80
|
s2t.end();
|
|
79
81
|
});
|
|
80
82
|
|
|
@@ -94,21 +96,21 @@ test('merge()', function (t) {
|
|
|
94
96
|
});
|
|
95
97
|
|
|
96
98
|
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
|
+
// Create an overflow object via combine: 2 elements (indices 0-1) with limit 0
|
|
100
|
+
var overflow = utils.combine(['a'], 'b', 0, false);
|
|
99
101
|
s2t.ok(utils.isOverflow(overflow), 'overflow object is marked');
|
|
100
|
-
var merged = utils.merge('
|
|
102
|
+
var merged = utils.merge('c', overflow);
|
|
101
103
|
s2t.ok(utils.isOverflow(merged), 'result is also marked as overflow');
|
|
102
|
-
s2t.deepEqual(merged, { 0: '
|
|
104
|
+
s2t.deepEqual(merged, { 0: 'c', 1: 'a', 2: 'b' }, 'creates object with primitive at 0, source values shifted');
|
|
103
105
|
s2t.end();
|
|
104
106
|
});
|
|
105
107
|
|
|
106
108
|
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'
|
|
109
|
+
// Create an overflow object via combine: 3 elements (indices 0-2) with limit 0
|
|
110
|
+
var overflow = utils.combine(['b', 'c'], 'd', 0, false);
|
|
109
111
|
s2t.ok(utils.isOverflow(overflow), 'overflow object is marked');
|
|
110
112
|
var merged = utils.merge('a', overflow);
|
|
111
|
-
s2t.deepEqual(merged, { 0: 'a', 1: 'b', 2: 'c' }, 'shifts all source indices by 1');
|
|
113
|
+
s2t.deepEqual(merged, { 0: 'a', 1: 'b', 2: 'c', 3: 'd' }, 'shifts all source indices by 1');
|
|
112
114
|
s2t.end();
|
|
113
115
|
});
|
|
114
116
|
|
|
@@ -196,7 +198,7 @@ test('combine()', function (t) {
|
|
|
196
198
|
|
|
197
199
|
st.test('exactly at the limit stays as array', function (s2t) {
|
|
198
200
|
var combined = utils.combine(['a', 'b'], 'c', 3, false);
|
|
199
|
-
s2t.deepEqual(combined, ['a', 'b', 'c'], 'stays as array when
|
|
201
|
+
s2t.deepEqual(combined, ['a', 'b', 'c'], 'stays as array when count equals limit');
|
|
200
202
|
s2t.ok(Array.isArray(combined), 'result is an array');
|
|
201
203
|
s2t.end();
|
|
202
204
|
});
|
|
@@ -208,16 +210,30 @@ test('combine()', function (t) {
|
|
|
208
210
|
s2t.end();
|
|
209
211
|
});
|
|
210
212
|
|
|
211
|
-
st.test('with arrayLimit
|
|
213
|
+
st.test('with arrayLimit 1', function (s2t) {
|
|
214
|
+
var combined = utils.combine([], 'a', 1, false);
|
|
215
|
+
s2t.deepEqual(combined, ['a'], 'stays as array when count equals limit');
|
|
216
|
+
s2t.ok(Array.isArray(combined), 'result is an array');
|
|
217
|
+
s2t.end();
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
st.test('with arrayLimit 0 converts single element to object', function (s2t) {
|
|
212
221
|
var combined = utils.combine([], 'a', 0, false);
|
|
213
|
-
s2t.deepEqual(combined, { 0: 'a' }, 'converts
|
|
222
|
+
s2t.deepEqual(combined, { 0: 'a' }, 'converts to object when count exceeds limit');
|
|
223
|
+
s2t.notOk(Array.isArray(combined), 'result is not an array');
|
|
224
|
+
s2t.end();
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
st.test('with arrayLimit 0 and two elements converts to object', function (s2t) {
|
|
228
|
+
var combined = utils.combine(['a'], 'b', 0, false);
|
|
229
|
+
s2t.deepEqual(combined, { 0: 'a', 1: 'b' }, 'converts to object when count exceeds limit');
|
|
214
230
|
s2t.notOk(Array.isArray(combined), 'result is not an array');
|
|
215
231
|
s2t.end();
|
|
216
232
|
});
|
|
217
233
|
|
|
218
234
|
st.test('with plainObjects option', function (s2t) {
|
|
219
|
-
var combined = utils.combine(['a'
|
|
220
|
-
var expected = { __proto__: null, 0: 'a', 1: 'b' };
|
|
235
|
+
var combined = utils.combine(['a', 'b'], 'c', 1, true);
|
|
236
|
+
var expected = { __proto__: null, 0: 'a', 1: 'b', 2: 'c' };
|
|
221
237
|
s2t.deepEqual(combined, expected, 'converts to object with null prototype');
|
|
222
238
|
s2t.equal(Object.getPrototypeOf(combined), null, 'result has null prototype when plainObjects is true');
|
|
223
239
|
s2t.end();
|
|
@@ -228,13 +244,13 @@ test('combine()', function (t) {
|
|
|
228
244
|
|
|
229
245
|
t.test('with existing overflow object', function (st) {
|
|
230
246
|
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'
|
|
247
|
+
// Create overflow object first via combine: 3 elements (indices 0-2) with limit 0
|
|
248
|
+
var overflow = utils.combine(['a', 'b'], 'c', 0, false);
|
|
233
249
|
s2t.ok(utils.isOverflow(overflow), 'initial object is marked as overflow');
|
|
234
250
|
|
|
235
|
-
var combined = utils.combine(overflow, '
|
|
251
|
+
var combined = utils.combine(overflow, 'd', 10, false);
|
|
236
252
|
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');
|
|
253
|
+
s2t.deepEqual(combined, { 0: 'a', 1: 'b', 2: 'c', 3: 'd' }, 'adds value at next numeric index');
|
|
238
254
|
s2t.end();
|
|
239
255
|
});
|
|
240
256
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-web-worldmap",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.6.0",
|
|
4
4
|
"description": "A Node-RED node to provide a web page of a world map for plotting things on.",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@turf/bezier-spline": "~7.3.4",
|
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
},
|
|
12
12
|
"overrides": {
|
|
13
13
|
"express": {
|
|
14
|
-
"
|
|
14
|
+
"body-parser": {
|
|
15
|
+
"qs": "^6.14.2"
|
|
16
|
+
}
|
|
15
17
|
}
|
|
16
18
|
},
|
|
17
19
|
"bundledDependencies": [
|
package/worldmap/worldmap.js
CHANGED
|
@@ -18,7 +18,7 @@ var menuOpen = false;
|
|
|
18
18
|
var clusterAt = 0;
|
|
19
19
|
var maxage = 900; // default max age of icons on map in seconds - cleared after 15 mins
|
|
20
20
|
var baselayername = "OSM grey"; // Default base layer OSM but uniform grey
|
|
21
|
-
var pagefoot = " © DCJ
|
|
21
|
+
var pagefoot = " © DCJ 2026";
|
|
22
22
|
var inIframe = false;
|
|
23
23
|
var showUserMenu = true;
|
|
24
24
|
var showLayerMenu = true;
|
|
@@ -878,6 +878,59 @@ map.on('moveend', function() {
|
|
|
878
878
|
oldBounds = {sw:{lat:b._southWest.lat,lng:b._southWest.lng},ne:{lat:b._northEast.lat,lng:b._northEast.lng}};
|
|
879
879
|
}
|
|
880
880
|
edgeAware();
|
|
881
|
+
|
|
882
|
+
// if we have bounds meta data for the current baselayer (usually pmtiles)
|
|
883
|
+
if (basemaps[baselayername] && basemaps[baselayername].hasOwnProperty("meta")) {
|
|
884
|
+
const m = basemaps[baselayername].meta
|
|
885
|
+
const c = map.getCenter()
|
|
886
|
+
const z = map.getZoom();
|
|
887
|
+
//console.log("ZOOM: "+m.minZoom+" - "+z+" - "+m.maxZoom)
|
|
888
|
+
// if we are within the meta bounds and we have zoomed in beyond the max zoom level for this baselayer, try to find a more suitable baselayer
|
|
889
|
+
if (c.lat > m.minLat && c.lat < m.maxLat && c.lng > m.minLon && c.lng < m.maxLon) {
|
|
890
|
+
if (z > m.maxZoom) {
|
|
891
|
+
for (var key in basemaps) {
|
|
892
|
+
if (key !== baselayername && basemaps[key].hasOwnProperty("meta")) {
|
|
893
|
+
const mb = basemaps[key].meta;
|
|
894
|
+
if (z <= mb.maxZoom && c.lat > mb.minLat && c.lat < mb.maxLat && c.lng > mb.minLon && c.lng < mb.maxLon) {
|
|
895
|
+
console.log("Zoom greater than "+m.maxZoom+", Switching to "+key);
|
|
896
|
+
map.removeLayer(basemaps[baselayername]);
|
|
897
|
+
baselayername = key;
|
|
898
|
+
map.addLayer(basemaps[baselayername]);
|
|
899
|
+
break;
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
else if (z <= m.minZoom) {
|
|
905
|
+
for (var key in basemaps) {
|
|
906
|
+
if (key !== baselayername && basemaps[key].hasOwnProperty("meta")) {
|
|
907
|
+
if (z >= basemaps[key].meta.minZoom) {
|
|
908
|
+
console.log("Zoom below min "+m.minZoom+", Switching to "+key);
|
|
909
|
+
map.removeLayer(basemaps[baselayername]);
|
|
910
|
+
baselayername = key;
|
|
911
|
+
map.addLayer(basemaps[baselayername]);
|
|
912
|
+
break;
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
// if we are outside the meta bounds, try to find a baselayer that does cover this area
|
|
919
|
+
else {
|
|
920
|
+
for (var key in basemaps) {
|
|
921
|
+
if (basemaps[key].hasOwnProperty("meta") && key !== baselayername) {
|
|
922
|
+
const mb = basemaps[key].meta;
|
|
923
|
+
if (c.lat > mb.minLat && c.lat < mb.maxLat && c.lng > mb.minLon && c.lng < mb.maxLon) {
|
|
924
|
+
console.log("Outside Bounds, Switching to "+key);
|
|
925
|
+
map.removeLayer(basemaps[baselayername]);
|
|
926
|
+
baselayername = key;
|
|
927
|
+
map.addLayer(basemaps[baselayername]);
|
|
928
|
+
break;
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
}
|
|
881
934
|
});
|
|
882
935
|
map.on('locationfound', onLocationFound);
|
|
883
936
|
map.on('locationerror', onLocationError);
|
|
@@ -2754,6 +2807,7 @@ function doCommand(cmd) {
|
|
|
2754
2807
|
else {
|
|
2755
2808
|
basemaps[cmd.map.name] = pmtiles.leafletRasterLayer(p, opt);
|
|
2756
2809
|
}
|
|
2810
|
+
basemaps[cmd.map.name].meta = { minZoom: h.minZoom, maxZoom: h.maxZoom, minLat: h.minLat, maxLat: h.maxLat, minLon: h.minLon, maxLon: h.maxLon };
|
|
2757
2811
|
if (!existsalready) {
|
|
2758
2812
|
layercontrol.addBaseLayer(basemaps[cmd.map.name],cmd.map.name);
|
|
2759
2813
|
}
|