@nextgis/geocoder 2.2.3 → 2.4.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/lib/geocoder.cjs.js +5 -17
- package/lib/geocoder.cjs.js.map +1 -1
- package/lib/geocoder.cjs.prod.js +1 -1
- package/lib/geocoder.cjs.prod.js.map +1 -1
- package/lib/geocoder.esm-browser.js +71 -115
- package/lib/geocoder.esm-browser.js.map +1 -1
- package/lib/geocoder.esm-browser.prod.js +1 -1
- package/lib/geocoder.esm-browser.prod.js.map +1 -1
- package/lib/geocoder.esm-bundler.js +11 -35
- package/lib/geocoder.esm-bundler.js.map +1 -1
- package/lib/geocoder.esm-bundler.prod.js +1 -1
- package/lib/geocoder.esm-bundler.prod.js.map +1 -1
- package/lib/geocoder.global.js +71 -115
- package/lib/geocoder.global.js.map +1 -1
- package/lib/geocoder.global.prod.js +1 -1
- package/lib/geocoder.global.prod.js.map +1 -1
- package/package.json +7 -7
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
/** Bundle of @nextgis/geocoder; version: 2.
|
|
1
|
+
/** Bundle of @nextgis/geocoder; version: 2.4.0; author: NextGIS */
|
|
2
2
|
var __defProp$g = Object.defineProperty;
|
|
3
3
|
var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
-
var __publicField$e = (obj, key, value) =>
|
|
5
|
-
__defNormalProp$g(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6
|
-
return value;
|
|
7
|
-
};
|
|
4
|
+
var __publicField$e = (obj, key, value) => __defNormalProp$g(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
8
5
|
class CancelError extends Error {
|
|
9
6
|
constructor() {
|
|
10
7
|
super();
|
|
@@ -15,10 +12,7 @@ class CancelError extends Error {
|
|
|
15
12
|
|
|
16
13
|
var __defProp$f = Object.defineProperty;
|
|
17
14
|
var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
18
|
-
var __publicField$d = (obj, key, value) =>
|
|
19
|
-
__defNormalProp$f(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
20
|
-
return value;
|
|
21
|
-
};
|
|
15
|
+
var __publicField$d = (obj, key, value) => __defNormalProp$f(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
22
16
|
class PromiseControl {
|
|
23
17
|
constructor(options = {}) {
|
|
24
18
|
this.options = options;
|
|
@@ -100,10 +94,7 @@ class PromiseControl {
|
|
|
100
94
|
|
|
101
95
|
var __defProp$e = Object.defineProperty;
|
|
102
96
|
var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
103
|
-
var __publicField$c = (obj, key, value) =>
|
|
104
|
-
__defNormalProp$e(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
105
|
-
return value;
|
|
106
|
-
};
|
|
97
|
+
var __publicField$c = (obj, key, value) => __defNormalProp$e(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
107
98
|
class TimeoutError extends Error {
|
|
108
99
|
constructor() {
|
|
109
100
|
super();
|
|
@@ -114,10 +105,7 @@ class TimeoutError extends Error {
|
|
|
114
105
|
|
|
115
106
|
var __defProp$d = Object.defineProperty;
|
|
116
107
|
var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
117
|
-
var __publicField$b = (obj, key, value) =>
|
|
118
|
-
__defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
119
|
-
return value;
|
|
120
|
-
};
|
|
108
|
+
var __publicField$b = (obj, key, value) => __defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
121
109
|
var _a;
|
|
122
110
|
const handleCallback = (resolve, reject, callback, r) => {
|
|
123
111
|
try {
|
|
@@ -127,6 +115,7 @@ const handleCallback = (resolve, reject, callback, r) => {
|
|
|
127
115
|
}
|
|
128
116
|
};
|
|
129
117
|
let ID$2 = 0;
|
|
118
|
+
_a = Symbol.toStringTag;
|
|
130
119
|
const _CancelablePromise = class _CancelablePromise {
|
|
131
120
|
constructor(executor, timeout) {
|
|
132
121
|
// @ts-ignore
|
|
@@ -306,7 +295,6 @@ const _CancelablePromise = class _CancelablePromise {
|
|
|
306
295
|
this._promise = void 0;
|
|
307
296
|
}
|
|
308
297
|
};
|
|
309
|
-
_a = Symbol.toStringTag;
|
|
310
298
|
__publicField$b(_CancelablePromise, "CancelError", CancelError);
|
|
311
299
|
__publicField$b(_CancelablePromise, "TimeoutError", TimeoutError);
|
|
312
300
|
__publicField$b(_CancelablePromise, "PromiseControl", PromiseControl);
|
|
@@ -350,19 +338,15 @@ function objectAssign(target, ...sources) {
|
|
|
350
338
|
|
|
351
339
|
function isEqual(a, b, o, p) {
|
|
352
340
|
if (a instanceof Array) {
|
|
353
|
-
if (!(b instanceof Array))
|
|
354
|
-
return false;
|
|
341
|
+
if (!(b instanceof Array)) return false;
|
|
355
342
|
return b.sort().join("") === a.sort().join("");
|
|
356
343
|
} else if (a instanceof Date) {
|
|
357
|
-
if (!(b instanceof Date))
|
|
358
|
-
return false;
|
|
344
|
+
if (!(b instanceof Date)) return false;
|
|
359
345
|
return "" + a === "" + b;
|
|
360
346
|
} else if (a instanceof Function) {
|
|
361
|
-
if (!(b instanceof Function))
|
|
362
|
-
return false;
|
|
347
|
+
if (!(b instanceof Function)) return false;
|
|
363
348
|
} else if (a instanceof Object) {
|
|
364
|
-
if (!(b instanceof Object))
|
|
365
|
-
return false;
|
|
349
|
+
if (!(b instanceof Object)) return false;
|
|
366
350
|
if (a === o) {
|
|
367
351
|
return b === p;
|
|
368
352
|
} else {
|
|
@@ -374,10 +358,8 @@ function isEqual(a, b, o, p) {
|
|
|
374
358
|
function objectDeepEqual(o, p) {
|
|
375
359
|
const keysO = Object.keys(o).sort();
|
|
376
360
|
const keysP = Object.keys(p).sort();
|
|
377
|
-
if (keysO.length !== keysP.length)
|
|
378
|
-
|
|
379
|
-
if (keysO.join("") !== keysP.join(""))
|
|
380
|
-
return false;
|
|
361
|
+
if (keysO.length !== keysP.length) return false;
|
|
362
|
+
if (keysO.join("") !== keysP.join("")) return false;
|
|
381
363
|
for (let i = 0; i < keysO.length; i++) {
|
|
382
364
|
const oVal = o[keysO[i]];
|
|
383
365
|
const pVal = p[keysP[i]];
|
|
@@ -430,9 +412,7 @@ var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
|
430
412
|
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
431
413
|
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
432
414
|
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
433
|
-
var __knownSymbol$2 = (name, symbol) =>
|
|
434
|
-
return (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
435
|
-
};
|
|
415
|
+
var __knownSymbol$2 = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
436
416
|
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
437
417
|
var __spreadValues$5 = (a, b) => {
|
|
438
418
|
for (var prop in b || (b = {}))
|
|
@@ -446,10 +426,7 @@ var __spreadValues$5 = (a, b) => {
|
|
|
446
426
|
return a;
|
|
447
427
|
};
|
|
448
428
|
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
449
|
-
var __publicField$a = (obj, key, value) =>
|
|
450
|
-
__defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
451
|
-
return value;
|
|
452
|
-
};
|
|
429
|
+
var __publicField$a = (obj, key, value) => __defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
453
430
|
var __async$1 = (__this, __arguments, generator) => {
|
|
454
431
|
return new Promise((resolve, reject) => {
|
|
455
432
|
var fulfilled = (value) => {
|
|
@@ -482,9 +459,7 @@ var __asyncGenerator$2 = (__this, __arguments, generator) => {
|
|
|
482
459
|
} catch (e) {
|
|
483
460
|
no(e);
|
|
484
461
|
}
|
|
485
|
-
};
|
|
486
|
-
var method = (k) => it[k] = (x) => new Promise((yes, no) => resume(k, x, yes, no));
|
|
487
|
-
var it = {};
|
|
462
|
+
}, method = (k) => it[k] = (x) => new Promise((yes, no) => resume(k, x, yes, no)), it = {};
|
|
488
463
|
return generator = generator.apply(__this, __arguments), it[__knownSymbol$2("asyncIterator")] = () => it, method("next"), method("throw"), method("return"), it;
|
|
489
464
|
};
|
|
490
465
|
var __forAwait = (obj, it, method) => (it = obj[__knownSymbol$2("asyncIterator")]) ? it.call(obj) : (obj = obj[__knownSymbol$2("iterator")](), it = {}, method = (key, fn) => (fn = obj[key]) && (it[key] = (arg) => new Promise((yes, no, done) => (arg = fn.call(obj, arg), done = arg.done, Promise.resolve(arg.value).then((value) => yes({ value, done }), no)))), method("next"), method("return"), it);
|
|
@@ -614,10 +589,7 @@ class Geocoder extends BaseGeocoder {
|
|
|
614
589
|
|
|
615
590
|
var __defProp$b = Object.defineProperty;
|
|
616
591
|
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
617
|
-
var __publicField$9 = (obj, key, value) =>
|
|
618
|
-
__defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
619
|
-
return value;
|
|
620
|
-
};
|
|
592
|
+
var __publicField$9 = (obj, key, value) => __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
621
593
|
class BaseProvider extends BaseGeocoder {
|
|
622
594
|
constructor() {
|
|
623
595
|
super(...arguments);
|
|
@@ -1108,10 +1080,7 @@ function unwrapListeners(arr) {
|
|
|
1108
1080
|
|
|
1109
1081
|
var __defProp$a = Object.defineProperty;
|
|
1110
1082
|
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1111
|
-
var __publicField$8 = (obj, key, value) =>
|
|
1112
|
-
__defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1113
|
-
return value;
|
|
1114
|
-
};
|
|
1083
|
+
var __publicField$8 = (obj, key, value) => __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1115
1084
|
const _Cache = class _Cache {
|
|
1116
1085
|
constructor(options = {}) {
|
|
1117
1086
|
__publicField$8(this, "cache", []);
|
|
@@ -1238,10 +1207,7 @@ let Cache = _Cache;
|
|
|
1238
1207
|
|
|
1239
1208
|
var __defProp$9 = Object.defineProperty;
|
|
1240
1209
|
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1241
|
-
var __publicField$7 = (obj, key, value) =>
|
|
1242
|
-
__defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1243
|
-
return value;
|
|
1244
|
-
};
|
|
1210
|
+
var __publicField$7 = (obj, key, value) => __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1245
1211
|
class NgwError extends Error {
|
|
1246
1212
|
constructor(er) {
|
|
1247
1213
|
super();
|
|
@@ -1260,10 +1226,7 @@ class NgwError extends Error {
|
|
|
1260
1226
|
|
|
1261
1227
|
var __defProp$8 = Object.defineProperty;
|
|
1262
1228
|
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1263
|
-
var __publicField$6 = (obj, key, value) =>
|
|
1264
|
-
__defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1265
|
-
return value;
|
|
1266
|
-
};
|
|
1229
|
+
var __publicField$6 = (obj, key, value) => __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1267
1230
|
class ResourceNotFoundError extends NgwError {
|
|
1268
1231
|
constructor(obj) {
|
|
1269
1232
|
super(obj);
|
|
@@ -1321,10 +1284,7 @@ var __spreadValues$4 = (a, b) => {
|
|
|
1321
1284
|
return a;
|
|
1322
1285
|
};
|
|
1323
1286
|
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
1324
|
-
var __publicField$5 = (obj, key, value) =>
|
|
1325
|
-
__defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1326
|
-
return value;
|
|
1327
|
-
};
|
|
1287
|
+
var __publicField$5 = (obj, key, value) => __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1328
1288
|
var __async = (__this, __arguments, generator) => {
|
|
1329
1289
|
return new Promise((resolve, reject) => {
|
|
1330
1290
|
var fulfilled = (value) => {
|
|
@@ -1346,9 +1306,14 @@ var __async = (__this, __arguments, generator) => {
|
|
|
1346
1306
|
});
|
|
1347
1307
|
};
|
|
1348
1308
|
class ResourcesControl {
|
|
1349
|
-
constructor(
|
|
1309
|
+
constructor({
|
|
1310
|
+
connector,
|
|
1311
|
+
cacheId
|
|
1312
|
+
}) {
|
|
1313
|
+
__publicField$5(this, "cache");
|
|
1314
|
+
__publicField$5(this, "connector");
|
|
1350
1315
|
this.connector = connector;
|
|
1351
|
-
|
|
1316
|
+
this.cache = new Cache({ namespace: cacheId });
|
|
1352
1317
|
}
|
|
1353
1318
|
// -------------------------------------------------------------------------
|
|
1354
1319
|
// Resource Methods
|
|
@@ -1361,7 +1326,7 @@ class ResourcesControl {
|
|
|
1361
1326
|
* Fetching resource would be cached to speed up next call
|
|
1362
1327
|
*/
|
|
1363
1328
|
getOne(resource, requestOptions) {
|
|
1364
|
-
const cache =
|
|
1329
|
+
const cache = this.cache;
|
|
1365
1330
|
const forCache = {};
|
|
1366
1331
|
const opt = __spreadProps$2(__spreadValues$4({}, requestOptions), { cache: false });
|
|
1367
1332
|
if (typeof resource === "string") {
|
|
@@ -1390,7 +1355,10 @@ class ResourcesControl {
|
|
|
1390
1355
|
}
|
|
1391
1356
|
return CancelablePromise.resolve(void 0);
|
|
1392
1357
|
};
|
|
1393
|
-
|
|
1358
|
+
if (requestOptions == null ? void 0 : requestOptions.cache) {
|
|
1359
|
+
return cache.addFull("resource", makeRequest, forCache);
|
|
1360
|
+
}
|
|
1361
|
+
return makeRequest();
|
|
1394
1362
|
}
|
|
1395
1363
|
getOneOrFail(resource, requestOptions) {
|
|
1396
1364
|
return this.getOne(resource, requestOptions).then((res) => {
|
|
@@ -1551,14 +1519,17 @@ class ResourcesControl {
|
|
|
1551
1519
|
}
|
|
1552
1520
|
_fetchResourceById(id, requestOptions) {
|
|
1553
1521
|
const promise = () => this.connector.get("resource.item", requestOptions, { id });
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1522
|
+
if (requestOptions == null ? void 0 : requestOptions.cache) {
|
|
1523
|
+
return this.cache.add("resource.item", promise, {
|
|
1524
|
+
id
|
|
1525
|
+
}).catch((er) => {
|
|
1526
|
+
if (!(er instanceof ResourceNotFoundError)) {
|
|
1527
|
+
throw er;
|
|
1528
|
+
}
|
|
1529
|
+
return void 0;
|
|
1530
|
+
});
|
|
1531
|
+
}
|
|
1532
|
+
return promise();
|
|
1562
1533
|
}
|
|
1563
1534
|
_fetchResourceBy(resource, requestOptions) {
|
|
1564
1535
|
return this.getMany(resource, requestOptions).then((resources) => {
|
|
@@ -1612,10 +1583,7 @@ function removeConnector(connector) {
|
|
|
1612
1583
|
|
|
1613
1584
|
var __defProp$6 = Object.defineProperty;
|
|
1614
1585
|
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1615
|
-
var __publicField$4 = (obj, key, value) =>
|
|
1616
|
-
__defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1617
|
-
return value;
|
|
1618
|
-
};
|
|
1586
|
+
var __publicField$4 = (obj, key, value) => __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1619
1587
|
class InsufficientPermissionsError extends NgwError {
|
|
1620
1588
|
constructor(obj) {
|
|
1621
1589
|
super(obj);
|
|
@@ -1641,7 +1609,7 @@ function template(str, data) {
|
|
|
1641
1609
|
function apiRequest(opt) {
|
|
1642
1610
|
const params = opt.params;
|
|
1643
1611
|
return new CancelablePromise((resolve, reject) => {
|
|
1644
|
-
opt.connector.connect().then((apiItems) => {
|
|
1612
|
+
return opt.connector.connect().then((apiItems) => {
|
|
1645
1613
|
let apiItem = apiItems && apiItems[opt.name];
|
|
1646
1614
|
if (apiItem) {
|
|
1647
1615
|
apiItem = [...apiItem];
|
|
@@ -1695,10 +1663,7 @@ function apiRequest(opt) {
|
|
|
1695
1663
|
|
|
1696
1664
|
var __defProp$5 = Object.defineProperty;
|
|
1697
1665
|
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1698
|
-
var __publicField$3 = (obj, key, value) =>
|
|
1699
|
-
__defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1700
|
-
return value;
|
|
1701
|
-
};
|
|
1666
|
+
var __publicField$3 = (obj, key, value) => __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1702
1667
|
class NetworkError extends Error {
|
|
1703
1668
|
constructor(url) {
|
|
1704
1669
|
super();
|
|
@@ -1807,10 +1772,7 @@ var __spreadValues$3 = (a, b) => {
|
|
|
1807
1772
|
}
|
|
1808
1773
|
return a;
|
|
1809
1774
|
};
|
|
1810
|
-
var __publicField$2 = (obj, key, value) =>
|
|
1811
|
-
__defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1812
|
-
return value;
|
|
1813
|
-
};
|
|
1775
|
+
var __publicField$2 = (obj, key, value) => __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1814
1776
|
let ID = 0;
|
|
1815
1777
|
class NgwConnector {
|
|
1816
1778
|
constructor(options) {
|
|
@@ -1819,10 +1781,12 @@ class NgwConnector {
|
|
|
1819
1781
|
__publicField$2(this, "emitter", new EventEmitter());
|
|
1820
1782
|
__publicField$2(this, "user");
|
|
1821
1783
|
__publicField$2(this, "resources");
|
|
1784
|
+
__publicField$2(this, "cache");
|
|
1822
1785
|
__publicField$2(this, "routeStr", "/api/component/pyramid/route");
|
|
1823
1786
|
__publicField$2(this, "activeRequests", []);
|
|
1824
1787
|
__publicField$2(this, "requestTransform");
|
|
1825
1788
|
const exist = findConnector(options);
|
|
1789
|
+
this.cache = new Cache({ namespace: options.cacheId });
|
|
1826
1790
|
if (exist) {
|
|
1827
1791
|
return exist;
|
|
1828
1792
|
} else {
|
|
@@ -1832,13 +1796,23 @@ class NgwConnector {
|
|
|
1832
1796
|
if (this.options.requestTransform) {
|
|
1833
1797
|
this.requestTransform = this.options.requestTransform;
|
|
1834
1798
|
}
|
|
1835
|
-
this.resources = new ResourcesControl(
|
|
1799
|
+
this.resources = new ResourcesControl({
|
|
1800
|
+
connector: this,
|
|
1801
|
+
cacheId: options.cacheId
|
|
1802
|
+
});
|
|
1836
1803
|
addConnector(this);
|
|
1837
1804
|
}
|
|
1838
1805
|
}
|
|
1839
1806
|
static create(options) {
|
|
1840
1807
|
return new this(options);
|
|
1841
1808
|
}
|
|
1809
|
+
/**
|
|
1810
|
+
* Clear the cache.
|
|
1811
|
+
*/
|
|
1812
|
+
clearCache() {
|
|
1813
|
+
this.cache.clean();
|
|
1814
|
+
this.resources.cache.clean();
|
|
1815
|
+
}
|
|
1842
1816
|
setRequestTransform(requestTransform) {
|
|
1843
1817
|
this.requestTransform = requestTransform;
|
|
1844
1818
|
}
|
|
@@ -1866,7 +1840,6 @@ class NgwConnector {
|
|
|
1866
1840
|
* ```
|
|
1867
1841
|
*/
|
|
1868
1842
|
connect() {
|
|
1869
|
-
const cache = new Cache();
|
|
1870
1843
|
const auth = this.options.auth;
|
|
1871
1844
|
const makeConnect = () => new CancelablePromise((resolve, reject) => {
|
|
1872
1845
|
const makeQuery = () => {
|
|
@@ -1886,7 +1859,7 @@ class NgwConnector {
|
|
|
1886
1859
|
}
|
|
1887
1860
|
return makeQuery();
|
|
1888
1861
|
});
|
|
1889
|
-
return cache.add("route", makeConnect, {
|
|
1862
|
+
return this.cache.add("route", makeConnect, {
|
|
1890
1863
|
id: this.id,
|
|
1891
1864
|
auth,
|
|
1892
1865
|
baseUrl: this.options.baseUrl
|
|
@@ -1909,8 +1882,8 @@ class NgwConnector {
|
|
|
1909
1882
|
removeConnector(this);
|
|
1910
1883
|
this.options.auth = void 0;
|
|
1911
1884
|
this.user = void 0;
|
|
1885
|
+
this.clearCache();
|
|
1912
1886
|
this.emitter.emit("logout");
|
|
1913
|
-
this.resources.cache.clean();
|
|
1914
1887
|
}
|
|
1915
1888
|
getUserInfo(credentials, options) {
|
|
1916
1889
|
if (this.user && this.user.id) {
|
|
@@ -1995,8 +1968,7 @@ class NgwConnector {
|
|
|
1995
1968
|
const params = objectRemoveEmpty(params_);
|
|
1996
1969
|
const makeApiRequest = () => apiRequest({ name, params, requestOptions, connector: this });
|
|
1997
1970
|
if (requestOptions.cache && method === "GET") {
|
|
1998
|
-
|
|
1999
|
-
return cache.add(name, makeApiRequest, __spreadValues$3({
|
|
1971
|
+
return this.cache.add(name, makeApiRequest, __spreadValues$3({
|
|
2000
1972
|
params
|
|
2001
1973
|
}, objectRemoveEmpty({
|
|
2002
1974
|
headers,
|
|
@@ -2266,10 +2238,8 @@ function reEscape(s) {
|
|
|
2266
2238
|
function like(b, a, iLike) {
|
|
2267
2239
|
a = String(a);
|
|
2268
2240
|
b = String(b);
|
|
2269
|
-
if (a === b)
|
|
2270
|
-
|
|
2271
|
-
if (iLike && a.toUpperCase() === b.toUpperCase())
|
|
2272
|
-
return true;
|
|
2241
|
+
if (a === b) return true;
|
|
2242
|
+
if (iLike && a.toUpperCase() === b.toUpperCase()) return true;
|
|
2273
2243
|
const re = `^${reEscape(a)}$`.replace(/%/g, ".*").replace("_", ".");
|
|
2274
2244
|
return new RegExp(re, iLike ? "i" : "").exec(b) !== null;
|
|
2275
2245
|
}
|
|
@@ -2613,9 +2583,7 @@ var __defProp$1 = Object.defineProperty;
|
|
|
2613
2583
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
2614
2584
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
2615
2585
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
2616
|
-
var __knownSymbol$1 = (name, symbol) =>
|
|
2617
|
-
return (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
2618
|
-
};
|
|
2586
|
+
var __knownSymbol$1 = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
2619
2587
|
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2620
2588
|
var __spreadValues = (a, b) => {
|
|
2621
2589
|
for (var prop in b || (b = {}))
|
|
@@ -2628,10 +2596,7 @@ var __spreadValues = (a, b) => {
|
|
|
2628
2596
|
}
|
|
2629
2597
|
return a;
|
|
2630
2598
|
};
|
|
2631
|
-
var __publicField$1 = (obj, key, value) =>
|
|
2632
|
-
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2633
|
-
return value;
|
|
2634
|
-
};
|
|
2599
|
+
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2635
2600
|
var __await$1 = function(promise, isYieldStar) {
|
|
2636
2601
|
this[0] = promise;
|
|
2637
2602
|
this[1] = isYieldStar;
|
|
@@ -2644,9 +2609,7 @@ var __asyncGenerator$1 = (__this, __arguments, generator) => {
|
|
|
2644
2609
|
} catch (e) {
|
|
2645
2610
|
no(e);
|
|
2646
2611
|
}
|
|
2647
|
-
};
|
|
2648
|
-
var method = (k) => it[k] = (x) => new Promise((yes, no) => resume(k, x, yes, no));
|
|
2649
|
-
var it = {};
|
|
2612
|
+
}, method = (k) => it[k] = (x) => new Promise((yes, no) => resume(k, x, yes, no)), it = {};
|
|
2650
2613
|
return generator = generator.apply(__this, __arguments), it[__knownSymbol$1("asyncIterator")] = () => it, method("next"), method("throw"), method("return"), it;
|
|
2651
2614
|
};
|
|
2652
2615
|
const _NgwProvider = class _NgwProvider extends BaseProvider {
|
|
@@ -2793,14 +2756,9 @@ __publicField$1(_NgwProvider, "limit", 300);
|
|
|
2793
2756
|
let NgwProvider = _NgwProvider;
|
|
2794
2757
|
|
|
2795
2758
|
var __defProp = Object.defineProperty;
|
|
2796
|
-
var __knownSymbol = (name, symbol) =>
|
|
2797
|
-
return (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
2798
|
-
};
|
|
2759
|
+
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
2799
2760
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2800
|
-
var __publicField = (obj, key, value) =>
|
|
2801
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2802
|
-
return value;
|
|
2803
|
-
};
|
|
2761
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2804
2762
|
var __await = function(promise, isYieldStar) {
|
|
2805
2763
|
this[0] = promise;
|
|
2806
2764
|
this[1] = isYieldStar;
|
|
@@ -2813,9 +2771,7 @@ var __asyncGenerator = (__this, __arguments, generator) => {
|
|
|
2813
2771
|
} catch (e) {
|
|
2814
2772
|
no(e);
|
|
2815
2773
|
}
|
|
2816
|
-
};
|
|
2817
|
-
var method = (k) => it[k] = (x) => new Promise((yes, no) => resume(k, x, yes, no));
|
|
2818
|
-
var it = {};
|
|
2774
|
+
}, method = (k) => it[k] = (x) => new Promise((yes, no) => resume(k, x, yes, no)), it = {};
|
|
2819
2775
|
return generator = generator.apply(__this, __arguments), it[__knownSymbol("asyncIterator")] = () => it, method("next"), method("throw"), method("return"), it;
|
|
2820
2776
|
};
|
|
2821
2777
|
class NominatimProvider extends BaseProvider {
|