@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
|
function styleInject(css, ref) {
|
|
3
3
|
if ( ref === void 0 ) ref = {};
|
|
4
4
|
var insertAt = ref.insertAt;
|
|
@@ -18011,10 +18011,23 @@ const _Cache = class _Cache {
|
|
|
18011
18011
|
* });
|
|
18012
18012
|
* ```
|
|
18013
18013
|
*/
|
|
18014
|
-
addFull(key, valueToSet,
|
|
18015
|
-
|
|
18014
|
+
addFull(key, valueToSet, propsOrOptions, expirationTime) {
|
|
18015
|
+
if (typeof propsOrOptions === "object" && "valueToSet" in propsOrOptions) {
|
|
18016
|
+
propsOrOptions.onlyFull = true;
|
|
18017
|
+
}
|
|
18018
|
+
return this.add(key, valueToSet, propsOrOptions, true, expirationTime);
|
|
18016
18019
|
}
|
|
18017
|
-
add(key, valueToSet,
|
|
18020
|
+
add(key, valueToSet, propsOrOptions, onlyFull, expirationTime) {
|
|
18021
|
+
let opt;
|
|
18022
|
+
let props;
|
|
18023
|
+
if (typeof propsOrOptions === "object" && "valueToSet" in propsOrOptions) {
|
|
18024
|
+
opt = propsOrOptions;
|
|
18025
|
+
onlyFull = opt.onlyFull;
|
|
18026
|
+
expirationTime = opt.expirationTime;
|
|
18027
|
+
props = opt.props;
|
|
18028
|
+
} else {
|
|
18029
|
+
props = propsOrOptions;
|
|
18030
|
+
}
|
|
18018
18031
|
const exist = this._find(key, props);
|
|
18019
18032
|
if (!exist) {
|
|
18020
18033
|
let value;
|
|
@@ -18024,10 +18037,12 @@ const _Cache = class _Cache {
|
|
|
18024
18037
|
value = valueToSet;
|
|
18025
18038
|
}
|
|
18026
18039
|
const nonEmptyProps = props && JSON.parse(JSON.stringify(objectRemoveEmpty(props)));
|
|
18040
|
+
expirationTime = expirationTime ? Date.now() + expirationTime : void 0;
|
|
18027
18041
|
const cacheItem = {
|
|
18028
18042
|
key,
|
|
18029
18043
|
value,
|
|
18030
|
-
props: nonEmptyProps
|
|
18044
|
+
props: nonEmptyProps,
|
|
18045
|
+
expirationTime
|
|
18031
18046
|
};
|
|
18032
18047
|
if (onlyFull && !full(value)) {
|
|
18033
18048
|
return value;
|
|
@@ -18054,9 +18069,19 @@ const _Cache = class _Cache {
|
|
|
18054
18069
|
}
|
|
18055
18070
|
match(key, props) {
|
|
18056
18071
|
const cacheRecord = this._find(key, props);
|
|
18072
|
+
if (cacheRecord && cacheRecord.expirationTime && Date.now() > cacheRecord.expirationTime) {
|
|
18073
|
+
this.delete(cacheRecord);
|
|
18074
|
+
return void 0;
|
|
18075
|
+
}
|
|
18057
18076
|
return cacheRecord == null ? void 0 : cacheRecord.value;
|
|
18058
18077
|
}
|
|
18059
18078
|
matchAll(key, props) {
|
|
18079
|
+
const now = Date.now();
|
|
18080
|
+
this.cache.forEach((item) => {
|
|
18081
|
+
if (item.expirationTime && now > item.expirationTime) {
|
|
18082
|
+
this.delete(item);
|
|
18083
|
+
}
|
|
18084
|
+
});
|
|
18060
18085
|
if (key) {
|
|
18061
18086
|
return this.cache.filter((x) => this._filter(x, key, props)).map((x) => x.value);
|
|
18062
18087
|
}
|
|
@@ -18086,7 +18111,7 @@ let Cache = _Cache;
|
|
|
18086
18111
|
|
|
18087
18112
|
var pkg = {
|
|
18088
18113
|
name: "@nextgis/ngw-connector",
|
|
18089
|
-
version: "3.0.0-alpha.
|
|
18114
|
+
version: "3.0.0-alpha.7",
|
|
18090
18115
|
_priority: 12,
|
|
18091
18116
|
description: "A lightweight HTTP client optimized for use with NextGIS Web API",
|
|
18092
18117
|
main: "index.js",
|
|
@@ -18095,7 +18120,7 @@ var pkg = {
|
|
|
18095
18120
|
jsdelivr: "lib/ngw-connector.global.prod.js",
|
|
18096
18121
|
types: "lib/index.d.ts",
|
|
18097
18122
|
dependencies: {
|
|
18098
|
-
"@nextgis/cache": "^3.0.0-alpha.
|
|
18123
|
+
"@nextgis/cache": "^3.0.0-alpha.7",
|
|
18099
18124
|
"@nextgis/cancelable-promise": "^3.0.0-alpha.5",
|
|
18100
18125
|
"@nextgis/utils": "^3.0.0-alpha.5",
|
|
18101
18126
|
"@types/events": "^3.0.0",
|
|
@@ -18847,9 +18872,6 @@ class NgwConnector {
|
|
|
18847
18872
|
addConnector(this);
|
|
18848
18873
|
}
|
|
18849
18874
|
}
|
|
18850
|
-
static create(options) {
|
|
18851
|
-
return new this(options);
|
|
18852
|
-
}
|
|
18853
18875
|
/**
|
|
18854
18876
|
* Clear the cache.
|
|
18855
18877
|
*/
|
|
@@ -19030,7 +19052,7 @@ class NgwConnector {
|
|
|
19030
19052
|
this._cleanActiveRequest(id);
|
|
19031
19053
|
}
|
|
19032
19054
|
});
|
|
19033
|
-
if (
|
|
19055
|
+
if (method === "GET") {
|
|
19034
19056
|
const cacheOptions = cacheProps ? cacheProps : __spreadProps$h(__spreadValues$s({}, objectRemoveEmpty({
|
|
19035
19057
|
headers,
|
|
19036
19058
|
withCredentials,
|
|
@@ -19040,12 +19062,10 @@ class NgwConnector {
|
|
|
19040
19062
|
})), {
|
|
19041
19063
|
params
|
|
19042
19064
|
});
|
|
19043
|
-
return this.cache.add(
|
|
19044
|
-
|
|
19045
|
-
|
|
19046
|
-
|
|
19047
|
-
false
|
|
19048
|
-
);
|
|
19065
|
+
return this.cache.add(cacheName || url, createPromise, {
|
|
19066
|
+
props: cacheOptions,
|
|
19067
|
+
expirationTime: cache ? void 0 : 500
|
|
19068
|
+
});
|
|
19049
19069
|
}
|
|
19050
19070
|
return createPromise();
|
|
19051
19071
|
});
|
|
@@ -19503,13 +19523,15 @@ var __publicField$q = (obj, key, value) => __defNormalProp$B(obj, key + "" , val
|
|
|
19503
19523
|
class NgwConnectorExtended extends NgwConnector {
|
|
19504
19524
|
constructor(options) {
|
|
19505
19525
|
super(options);
|
|
19506
|
-
this.options = options;
|
|
19507
19526
|
__publicField$q(this, "resources");
|
|
19508
19527
|
this.resources = new ResourcesControl({
|
|
19509
19528
|
connector: this,
|
|
19510
19529
|
cacheId: options.cacheId
|
|
19511
19530
|
});
|
|
19512
19531
|
}
|
|
19532
|
+
static create(options) {
|
|
19533
|
+
return new this(options);
|
|
19534
|
+
}
|
|
19513
19535
|
/**
|
|
19514
19536
|
* Clear the cache.
|
|
19515
19537
|
*/
|