@nextgis/ngw-leaflet 3.0.0-alpha.5 → 3.0.0-alpha.7
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/lib/ngw-leaflet.esm-browser.js +40 -18
- package/lib/ngw-leaflet.esm-browser.js.map +1 -1
- package/lib/ngw-leaflet.esm-browser.prod.js +1 -1
- package/lib/ngw-leaflet.esm-browser.prod.js.map +1 -1
- package/lib/ngw-leaflet.esm-bundler.js +1 -1
- package/lib/ngw-leaflet.global.js +40 -18
- package/lib/ngw-leaflet.global.js.map +1 -1
- package/lib/ngw-leaflet.global.prod.js +1 -1
- package/lib/ngw-leaflet.global.prod.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-leaflet; version: 3.0.0-alpha.
|
|
1
|
+
/** Bundle of @nextgis/ngw-leaflet; version: 3.0.0-alpha.7; author: NextGIS */
|
|
2
2
|
import 'leaflet/dist/leaflet.css';
|
|
3
3
|
import LeafletMapAdapter from '@nextgis/leaflet-map-adapter';
|
|
4
4
|
import { NgwMap } from '@nextgis/ngw-map';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-leaflet; version: 3.0.0-alpha.
|
|
1
|
+
/** Bundle of @nextgis/ngw-leaflet; version: 3.0.0-alpha.7; author: NextGIS */
|
|
2
2
|
var NgwLeaflet = (function () {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -18014,10 +18014,23 @@ var NgwLeaflet = (function () {
|
|
|
18014
18014
|
* });
|
|
18015
18015
|
* ```
|
|
18016
18016
|
*/
|
|
18017
|
-
addFull(key, valueToSet,
|
|
18018
|
-
|
|
18017
|
+
addFull(key, valueToSet, propsOrOptions, expirationTime) {
|
|
18018
|
+
if (typeof propsOrOptions === "object" && "valueToSet" in propsOrOptions) {
|
|
18019
|
+
propsOrOptions.onlyFull = true;
|
|
18020
|
+
}
|
|
18021
|
+
return this.add(key, valueToSet, propsOrOptions, true, expirationTime);
|
|
18019
18022
|
}
|
|
18020
|
-
add(key, valueToSet,
|
|
18023
|
+
add(key, valueToSet, propsOrOptions, onlyFull, expirationTime) {
|
|
18024
|
+
let opt;
|
|
18025
|
+
let props;
|
|
18026
|
+
if (typeof propsOrOptions === "object" && "valueToSet" in propsOrOptions) {
|
|
18027
|
+
opt = propsOrOptions;
|
|
18028
|
+
onlyFull = opt.onlyFull;
|
|
18029
|
+
expirationTime = opt.expirationTime;
|
|
18030
|
+
props = opt.props;
|
|
18031
|
+
} else {
|
|
18032
|
+
props = propsOrOptions;
|
|
18033
|
+
}
|
|
18021
18034
|
const exist = this._find(key, props);
|
|
18022
18035
|
if (!exist) {
|
|
18023
18036
|
let value;
|
|
@@ -18027,10 +18040,12 @@ var NgwLeaflet = (function () {
|
|
|
18027
18040
|
value = valueToSet;
|
|
18028
18041
|
}
|
|
18029
18042
|
const nonEmptyProps = props && JSON.parse(JSON.stringify(objectRemoveEmpty(props)));
|
|
18043
|
+
expirationTime = expirationTime ? Date.now() + expirationTime : void 0;
|
|
18030
18044
|
const cacheItem = {
|
|
18031
18045
|
key,
|
|
18032
18046
|
value,
|
|
18033
|
-
props: nonEmptyProps
|
|
18047
|
+
props: nonEmptyProps,
|
|
18048
|
+
expirationTime
|
|
18034
18049
|
};
|
|
18035
18050
|
if (onlyFull && !full(value)) {
|
|
18036
18051
|
return value;
|
|
@@ -18057,9 +18072,19 @@ var NgwLeaflet = (function () {
|
|
|
18057
18072
|
}
|
|
18058
18073
|
match(key, props) {
|
|
18059
18074
|
const cacheRecord = this._find(key, props);
|
|
18075
|
+
if (cacheRecord && cacheRecord.expirationTime && Date.now() > cacheRecord.expirationTime) {
|
|
18076
|
+
this.delete(cacheRecord);
|
|
18077
|
+
return void 0;
|
|
18078
|
+
}
|
|
18060
18079
|
return cacheRecord == null ? void 0 : cacheRecord.value;
|
|
18061
18080
|
}
|
|
18062
18081
|
matchAll(key, props) {
|
|
18082
|
+
const now = Date.now();
|
|
18083
|
+
this.cache.forEach((item) => {
|
|
18084
|
+
if (item.expirationTime && now > item.expirationTime) {
|
|
18085
|
+
this.delete(item);
|
|
18086
|
+
}
|
|
18087
|
+
});
|
|
18063
18088
|
if (key) {
|
|
18064
18089
|
return this.cache.filter((x) => this._filter(x, key, props)).map((x) => x.value);
|
|
18065
18090
|
}
|
|
@@ -18089,7 +18114,7 @@ var NgwLeaflet = (function () {
|
|
|
18089
18114
|
|
|
18090
18115
|
var pkg = {
|
|
18091
18116
|
name: "@nextgis/ngw-connector",
|
|
18092
|
-
version: "3.0.0-alpha.
|
|
18117
|
+
version: "3.0.0-alpha.7",
|
|
18093
18118
|
_priority: 12,
|
|
18094
18119
|
description: "A lightweight HTTP client optimized for use with NextGIS Web API",
|
|
18095
18120
|
main: "index.js",
|
|
@@ -18098,7 +18123,7 @@ var NgwLeaflet = (function () {
|
|
|
18098
18123
|
jsdelivr: "lib/ngw-connector.global.prod.js",
|
|
18099
18124
|
types: "lib/index.d.ts",
|
|
18100
18125
|
dependencies: {
|
|
18101
|
-
"@nextgis/cache": "^3.0.0-alpha.
|
|
18126
|
+
"@nextgis/cache": "^3.0.0-alpha.7",
|
|
18102
18127
|
"@nextgis/cancelable-promise": "^3.0.0-alpha.5",
|
|
18103
18128
|
"@nextgis/utils": "^3.0.0-alpha.5",
|
|
18104
18129
|
"@types/events": "^3.0.0",
|
|
@@ -18850,9 +18875,6 @@ var NgwLeaflet = (function () {
|
|
|
18850
18875
|
addConnector(this);
|
|
18851
18876
|
}
|
|
18852
18877
|
}
|
|
18853
|
-
static create(options) {
|
|
18854
|
-
return new this(options);
|
|
18855
|
-
}
|
|
18856
18878
|
/**
|
|
18857
18879
|
* Clear the cache.
|
|
18858
18880
|
*/
|
|
@@ -19033,7 +19055,7 @@ var NgwLeaflet = (function () {
|
|
|
19033
19055
|
this._cleanActiveRequest(id);
|
|
19034
19056
|
}
|
|
19035
19057
|
});
|
|
19036
|
-
if (
|
|
19058
|
+
if (method === "GET") {
|
|
19037
19059
|
const cacheOptions = cacheProps ? cacheProps : __spreadProps$h(__spreadValues$s({}, objectRemoveEmpty({
|
|
19038
19060
|
headers,
|
|
19039
19061
|
withCredentials,
|
|
@@ -19043,12 +19065,10 @@ var NgwLeaflet = (function () {
|
|
|
19043
19065
|
})), {
|
|
19044
19066
|
params
|
|
19045
19067
|
});
|
|
19046
|
-
return this.cache.add(
|
|
19047
|
-
|
|
19048
|
-
|
|
19049
|
-
|
|
19050
|
-
false
|
|
19051
|
-
);
|
|
19068
|
+
return this.cache.add(cacheName || url, createPromise, {
|
|
19069
|
+
props: cacheOptions,
|
|
19070
|
+
expirationTime: cache ? void 0 : 500
|
|
19071
|
+
});
|
|
19052
19072
|
}
|
|
19053
19073
|
return createPromise();
|
|
19054
19074
|
});
|
|
@@ -19506,13 +19526,15 @@ var NgwLeaflet = (function () {
|
|
|
19506
19526
|
class NgwConnectorExtended extends NgwConnector {
|
|
19507
19527
|
constructor(options) {
|
|
19508
19528
|
super(options);
|
|
19509
|
-
this.options = options;
|
|
19510
19529
|
__publicField$q(this, "resources");
|
|
19511
19530
|
this.resources = new ResourcesControl({
|
|
19512
19531
|
connector: this,
|
|
19513
19532
|
cacheId: options.cacheId
|
|
19514
19533
|
});
|
|
19515
19534
|
}
|
|
19535
|
+
static create(options) {
|
|
19536
|
+
return new this(options);
|
|
19537
|
+
}
|
|
19516
19538
|
/**
|
|
19517
19539
|
* Clear the cache.
|
|
19518
19540
|
*/
|