@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
package/lib/geocoder.global.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
/** Bundle of @nextgis/geocoder; version: 2.
|
|
1
|
+
/** Bundle of @nextgis/geocoder; version: 2.4.0; author: NextGIS */
|
|
2
2
|
var Geocoder = (function (exports) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
5
|
var __defProp$g = Object.defineProperty;
|
|
6
6
|
var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
-
var __publicField$e = (obj, key, value) =>
|
|
8
|
-
__defNormalProp$g(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
9
|
-
return value;
|
|
10
|
-
};
|
|
7
|
+
var __publicField$e = (obj, key, value) => __defNormalProp$g(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
11
8
|
class CancelError extends Error {
|
|
12
9
|
constructor() {
|
|
13
10
|
super();
|
|
@@ -18,10 +15,7 @@ var Geocoder = (function (exports) {
|
|
|
18
15
|
|
|
19
16
|
var __defProp$f = Object.defineProperty;
|
|
20
17
|
var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
21
|
-
var __publicField$d = (obj, key, value) =>
|
|
22
|
-
__defNormalProp$f(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
23
|
-
return value;
|
|
24
|
-
};
|
|
18
|
+
var __publicField$d = (obj, key, value) => __defNormalProp$f(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
25
19
|
class PromiseControl {
|
|
26
20
|
constructor(options = {}) {
|
|
27
21
|
this.options = options;
|
|
@@ -103,10 +97,7 @@ var Geocoder = (function (exports) {
|
|
|
103
97
|
|
|
104
98
|
var __defProp$e = Object.defineProperty;
|
|
105
99
|
var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
106
|
-
var __publicField$c = (obj, key, value) =>
|
|
107
|
-
__defNormalProp$e(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
108
|
-
return value;
|
|
109
|
-
};
|
|
100
|
+
var __publicField$c = (obj, key, value) => __defNormalProp$e(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
110
101
|
class TimeoutError extends Error {
|
|
111
102
|
constructor() {
|
|
112
103
|
super();
|
|
@@ -117,10 +108,7 @@ var Geocoder = (function (exports) {
|
|
|
117
108
|
|
|
118
109
|
var __defProp$d = Object.defineProperty;
|
|
119
110
|
var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
120
|
-
var __publicField$b = (obj, key, value) =>
|
|
121
|
-
__defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
122
|
-
return value;
|
|
123
|
-
};
|
|
111
|
+
var __publicField$b = (obj, key, value) => __defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
124
112
|
var _a;
|
|
125
113
|
const handleCallback = (resolve, reject, callback, r) => {
|
|
126
114
|
try {
|
|
@@ -130,6 +118,7 @@ var Geocoder = (function (exports) {
|
|
|
130
118
|
}
|
|
131
119
|
};
|
|
132
120
|
let ID$2 = 0;
|
|
121
|
+
_a = Symbol.toStringTag;
|
|
133
122
|
const _CancelablePromise = class _CancelablePromise {
|
|
134
123
|
constructor(executor, timeout) {
|
|
135
124
|
// @ts-ignore
|
|
@@ -309,7 +298,6 @@ var Geocoder = (function (exports) {
|
|
|
309
298
|
this._promise = void 0;
|
|
310
299
|
}
|
|
311
300
|
};
|
|
312
|
-
_a = Symbol.toStringTag;
|
|
313
301
|
__publicField$b(_CancelablePromise, "CancelError", CancelError);
|
|
314
302
|
__publicField$b(_CancelablePromise, "TimeoutError", TimeoutError);
|
|
315
303
|
__publicField$b(_CancelablePromise, "PromiseControl", PromiseControl);
|
|
@@ -353,19 +341,15 @@ var Geocoder = (function (exports) {
|
|
|
353
341
|
|
|
354
342
|
function isEqual(a, b, o, p) {
|
|
355
343
|
if (a instanceof Array) {
|
|
356
|
-
if (!(b instanceof Array))
|
|
357
|
-
return false;
|
|
344
|
+
if (!(b instanceof Array)) return false;
|
|
358
345
|
return b.sort().join("") === a.sort().join("");
|
|
359
346
|
} else if (a instanceof Date) {
|
|
360
|
-
if (!(b instanceof Date))
|
|
361
|
-
return false;
|
|
347
|
+
if (!(b instanceof Date)) return false;
|
|
362
348
|
return "" + a === "" + b;
|
|
363
349
|
} else if (a instanceof Function) {
|
|
364
|
-
if (!(b instanceof Function))
|
|
365
|
-
return false;
|
|
350
|
+
if (!(b instanceof Function)) return false;
|
|
366
351
|
} else if (a instanceof Object) {
|
|
367
|
-
if (!(b instanceof Object))
|
|
368
|
-
return false;
|
|
352
|
+
if (!(b instanceof Object)) return false;
|
|
369
353
|
if (a === o) {
|
|
370
354
|
return b === p;
|
|
371
355
|
} else {
|
|
@@ -377,10 +361,8 @@ var Geocoder = (function (exports) {
|
|
|
377
361
|
function objectDeepEqual(o, p) {
|
|
378
362
|
const keysO = Object.keys(o).sort();
|
|
379
363
|
const keysP = Object.keys(p).sort();
|
|
380
|
-
if (keysO.length !== keysP.length)
|
|
381
|
-
|
|
382
|
-
if (keysO.join("") !== keysP.join(""))
|
|
383
|
-
return false;
|
|
364
|
+
if (keysO.length !== keysP.length) return false;
|
|
365
|
+
if (keysO.join("") !== keysP.join("")) return false;
|
|
384
366
|
for (let i = 0; i < keysO.length; i++) {
|
|
385
367
|
const oVal = o[keysO[i]];
|
|
386
368
|
const pVal = p[keysP[i]];
|
|
@@ -433,9 +415,7 @@ var Geocoder = (function (exports) {
|
|
|
433
415
|
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
434
416
|
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
435
417
|
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
436
|
-
var __knownSymbol$2 = (name, symbol) =>
|
|
437
|
-
return (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
438
|
-
};
|
|
418
|
+
var __knownSymbol$2 = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
439
419
|
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
440
420
|
var __spreadValues$5 = (a, b) => {
|
|
441
421
|
for (var prop in b || (b = {}))
|
|
@@ -449,10 +429,7 @@ var Geocoder = (function (exports) {
|
|
|
449
429
|
return a;
|
|
450
430
|
};
|
|
451
431
|
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
452
|
-
var __publicField$a = (obj, key, value) =>
|
|
453
|
-
__defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
454
|
-
return value;
|
|
455
|
-
};
|
|
432
|
+
var __publicField$a = (obj, key, value) => __defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
456
433
|
var __async$1 = (__this, __arguments, generator) => {
|
|
457
434
|
return new Promise((resolve, reject) => {
|
|
458
435
|
var fulfilled = (value) => {
|
|
@@ -485,9 +462,7 @@ var Geocoder = (function (exports) {
|
|
|
485
462
|
} catch (e) {
|
|
486
463
|
no(e);
|
|
487
464
|
}
|
|
488
|
-
};
|
|
489
|
-
var method = (k) => it[k] = (x) => new Promise((yes, no) => resume(k, x, yes, no));
|
|
490
|
-
var it = {};
|
|
465
|
+
}, method = (k) => it[k] = (x) => new Promise((yes, no) => resume(k, x, yes, no)), it = {};
|
|
491
466
|
return generator = generator.apply(__this, __arguments), it[__knownSymbol$2("asyncIterator")] = () => it, method("next"), method("throw"), method("return"), it;
|
|
492
467
|
};
|
|
493
468
|
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);
|
|
@@ -617,10 +592,7 @@ var Geocoder = (function (exports) {
|
|
|
617
592
|
|
|
618
593
|
var __defProp$b = Object.defineProperty;
|
|
619
594
|
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
620
|
-
var __publicField$9 = (obj, key, value) =>
|
|
621
|
-
__defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
622
|
-
return value;
|
|
623
|
-
};
|
|
595
|
+
var __publicField$9 = (obj, key, value) => __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
624
596
|
class BaseProvider extends BaseGeocoder {
|
|
625
597
|
constructor() {
|
|
626
598
|
super(...arguments);
|
|
@@ -1111,10 +1083,7 @@ var Geocoder = (function (exports) {
|
|
|
1111
1083
|
|
|
1112
1084
|
var __defProp$a = Object.defineProperty;
|
|
1113
1085
|
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1114
|
-
var __publicField$8 = (obj, key, value) =>
|
|
1115
|
-
__defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1116
|
-
return value;
|
|
1117
|
-
};
|
|
1086
|
+
var __publicField$8 = (obj, key, value) => __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1118
1087
|
const _Cache = class _Cache {
|
|
1119
1088
|
constructor(options = {}) {
|
|
1120
1089
|
__publicField$8(this, "cache", []);
|
|
@@ -1241,10 +1210,7 @@ var Geocoder = (function (exports) {
|
|
|
1241
1210
|
|
|
1242
1211
|
var __defProp$9 = Object.defineProperty;
|
|
1243
1212
|
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1244
|
-
var __publicField$7 = (obj, key, value) =>
|
|
1245
|
-
__defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1246
|
-
return value;
|
|
1247
|
-
};
|
|
1213
|
+
var __publicField$7 = (obj, key, value) => __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1248
1214
|
class NgwError extends Error {
|
|
1249
1215
|
constructor(er) {
|
|
1250
1216
|
super();
|
|
@@ -1263,10 +1229,7 @@ var Geocoder = (function (exports) {
|
|
|
1263
1229
|
|
|
1264
1230
|
var __defProp$8 = Object.defineProperty;
|
|
1265
1231
|
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1266
|
-
var __publicField$6 = (obj, key, value) =>
|
|
1267
|
-
__defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1268
|
-
return value;
|
|
1269
|
-
};
|
|
1232
|
+
var __publicField$6 = (obj, key, value) => __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1270
1233
|
class ResourceNotFoundError extends NgwError {
|
|
1271
1234
|
constructor(obj) {
|
|
1272
1235
|
super(obj);
|
|
@@ -1324,10 +1287,7 @@ var Geocoder = (function (exports) {
|
|
|
1324
1287
|
return a;
|
|
1325
1288
|
};
|
|
1326
1289
|
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
1327
|
-
var __publicField$5 = (obj, key, value) =>
|
|
1328
|
-
__defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1329
|
-
return value;
|
|
1330
|
-
};
|
|
1290
|
+
var __publicField$5 = (obj, key, value) => __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1331
1291
|
var __async = (__this, __arguments, generator) => {
|
|
1332
1292
|
return new Promise((resolve, reject) => {
|
|
1333
1293
|
var fulfilled = (value) => {
|
|
@@ -1349,9 +1309,14 @@ var Geocoder = (function (exports) {
|
|
|
1349
1309
|
});
|
|
1350
1310
|
};
|
|
1351
1311
|
class ResourcesControl {
|
|
1352
|
-
constructor(
|
|
1312
|
+
constructor({
|
|
1313
|
+
connector,
|
|
1314
|
+
cacheId
|
|
1315
|
+
}) {
|
|
1316
|
+
__publicField$5(this, "cache");
|
|
1317
|
+
__publicField$5(this, "connector");
|
|
1353
1318
|
this.connector = connector;
|
|
1354
|
-
|
|
1319
|
+
this.cache = new Cache({ namespace: cacheId });
|
|
1355
1320
|
}
|
|
1356
1321
|
// -------------------------------------------------------------------------
|
|
1357
1322
|
// Resource Methods
|
|
@@ -1364,7 +1329,7 @@ var Geocoder = (function (exports) {
|
|
|
1364
1329
|
* Fetching resource would be cached to speed up next call
|
|
1365
1330
|
*/
|
|
1366
1331
|
getOne(resource, requestOptions) {
|
|
1367
|
-
const cache =
|
|
1332
|
+
const cache = this.cache;
|
|
1368
1333
|
const forCache = {};
|
|
1369
1334
|
const opt = __spreadProps$2(__spreadValues$4({}, requestOptions), { cache: false });
|
|
1370
1335
|
if (typeof resource === "string") {
|
|
@@ -1393,7 +1358,10 @@ var Geocoder = (function (exports) {
|
|
|
1393
1358
|
}
|
|
1394
1359
|
return CancelablePromise.resolve(void 0);
|
|
1395
1360
|
};
|
|
1396
|
-
|
|
1361
|
+
if (requestOptions == null ? void 0 : requestOptions.cache) {
|
|
1362
|
+
return cache.addFull("resource", makeRequest, forCache);
|
|
1363
|
+
}
|
|
1364
|
+
return makeRequest();
|
|
1397
1365
|
}
|
|
1398
1366
|
getOneOrFail(resource, requestOptions) {
|
|
1399
1367
|
return this.getOne(resource, requestOptions).then((res) => {
|
|
@@ -1554,14 +1522,17 @@ var Geocoder = (function (exports) {
|
|
|
1554
1522
|
}
|
|
1555
1523
|
_fetchResourceById(id, requestOptions) {
|
|
1556
1524
|
const promise = () => this.connector.get("resource.item", requestOptions, { id });
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1525
|
+
if (requestOptions == null ? void 0 : requestOptions.cache) {
|
|
1526
|
+
return this.cache.add("resource.item", promise, {
|
|
1527
|
+
id
|
|
1528
|
+
}).catch((er) => {
|
|
1529
|
+
if (!(er instanceof ResourceNotFoundError)) {
|
|
1530
|
+
throw er;
|
|
1531
|
+
}
|
|
1532
|
+
return void 0;
|
|
1533
|
+
});
|
|
1534
|
+
}
|
|
1535
|
+
return promise();
|
|
1565
1536
|
}
|
|
1566
1537
|
_fetchResourceBy(resource, requestOptions) {
|
|
1567
1538
|
return this.getMany(resource, requestOptions).then((resources) => {
|
|
@@ -1615,10 +1586,7 @@ var Geocoder = (function (exports) {
|
|
|
1615
1586
|
|
|
1616
1587
|
var __defProp$6 = Object.defineProperty;
|
|
1617
1588
|
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1618
|
-
var __publicField$4 = (obj, key, value) =>
|
|
1619
|
-
__defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1620
|
-
return value;
|
|
1621
|
-
};
|
|
1589
|
+
var __publicField$4 = (obj, key, value) => __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1622
1590
|
class InsufficientPermissionsError extends NgwError {
|
|
1623
1591
|
constructor(obj) {
|
|
1624
1592
|
super(obj);
|
|
@@ -1644,7 +1612,7 @@ var Geocoder = (function (exports) {
|
|
|
1644
1612
|
function apiRequest(opt) {
|
|
1645
1613
|
const params = opt.params;
|
|
1646
1614
|
return new CancelablePromise((resolve, reject) => {
|
|
1647
|
-
opt.connector.connect().then((apiItems) => {
|
|
1615
|
+
return opt.connector.connect().then((apiItems) => {
|
|
1648
1616
|
let apiItem = apiItems && apiItems[opt.name];
|
|
1649
1617
|
if (apiItem) {
|
|
1650
1618
|
apiItem = [...apiItem];
|
|
@@ -1698,10 +1666,7 @@ var Geocoder = (function (exports) {
|
|
|
1698
1666
|
|
|
1699
1667
|
var __defProp$5 = Object.defineProperty;
|
|
1700
1668
|
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1701
|
-
var __publicField$3 = (obj, key, value) =>
|
|
1702
|
-
__defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1703
|
-
return value;
|
|
1704
|
-
};
|
|
1669
|
+
var __publicField$3 = (obj, key, value) => __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1705
1670
|
class NetworkError extends Error {
|
|
1706
1671
|
constructor(url) {
|
|
1707
1672
|
super();
|
|
@@ -1810,10 +1775,7 @@ var Geocoder = (function (exports) {
|
|
|
1810
1775
|
}
|
|
1811
1776
|
return a;
|
|
1812
1777
|
};
|
|
1813
|
-
var __publicField$2 = (obj, key, value) =>
|
|
1814
|
-
__defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1815
|
-
return value;
|
|
1816
|
-
};
|
|
1778
|
+
var __publicField$2 = (obj, key, value) => __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1817
1779
|
let ID = 0;
|
|
1818
1780
|
class NgwConnector {
|
|
1819
1781
|
constructor(options) {
|
|
@@ -1822,10 +1784,12 @@ var Geocoder = (function (exports) {
|
|
|
1822
1784
|
__publicField$2(this, "emitter", new EventEmitter());
|
|
1823
1785
|
__publicField$2(this, "user");
|
|
1824
1786
|
__publicField$2(this, "resources");
|
|
1787
|
+
__publicField$2(this, "cache");
|
|
1825
1788
|
__publicField$2(this, "routeStr", "/api/component/pyramid/route");
|
|
1826
1789
|
__publicField$2(this, "activeRequests", []);
|
|
1827
1790
|
__publicField$2(this, "requestTransform");
|
|
1828
1791
|
const exist = findConnector(options);
|
|
1792
|
+
this.cache = new Cache({ namespace: options.cacheId });
|
|
1829
1793
|
if (exist) {
|
|
1830
1794
|
return exist;
|
|
1831
1795
|
} else {
|
|
@@ -1835,13 +1799,23 @@ var Geocoder = (function (exports) {
|
|
|
1835
1799
|
if (this.options.requestTransform) {
|
|
1836
1800
|
this.requestTransform = this.options.requestTransform;
|
|
1837
1801
|
}
|
|
1838
|
-
this.resources = new ResourcesControl(
|
|
1802
|
+
this.resources = new ResourcesControl({
|
|
1803
|
+
connector: this,
|
|
1804
|
+
cacheId: options.cacheId
|
|
1805
|
+
});
|
|
1839
1806
|
addConnector(this);
|
|
1840
1807
|
}
|
|
1841
1808
|
}
|
|
1842
1809
|
static create(options) {
|
|
1843
1810
|
return new this(options);
|
|
1844
1811
|
}
|
|
1812
|
+
/**
|
|
1813
|
+
* Clear the cache.
|
|
1814
|
+
*/
|
|
1815
|
+
clearCache() {
|
|
1816
|
+
this.cache.clean();
|
|
1817
|
+
this.resources.cache.clean();
|
|
1818
|
+
}
|
|
1845
1819
|
setRequestTransform(requestTransform) {
|
|
1846
1820
|
this.requestTransform = requestTransform;
|
|
1847
1821
|
}
|
|
@@ -1869,7 +1843,6 @@ var Geocoder = (function (exports) {
|
|
|
1869
1843
|
* ```
|
|
1870
1844
|
*/
|
|
1871
1845
|
connect() {
|
|
1872
|
-
const cache = new Cache();
|
|
1873
1846
|
const auth = this.options.auth;
|
|
1874
1847
|
const makeConnect = () => new CancelablePromise((resolve, reject) => {
|
|
1875
1848
|
const makeQuery = () => {
|
|
@@ -1889,7 +1862,7 @@ var Geocoder = (function (exports) {
|
|
|
1889
1862
|
}
|
|
1890
1863
|
return makeQuery();
|
|
1891
1864
|
});
|
|
1892
|
-
return cache.add("route", makeConnect, {
|
|
1865
|
+
return this.cache.add("route", makeConnect, {
|
|
1893
1866
|
id: this.id,
|
|
1894
1867
|
auth,
|
|
1895
1868
|
baseUrl: this.options.baseUrl
|
|
@@ -1912,8 +1885,8 @@ var Geocoder = (function (exports) {
|
|
|
1912
1885
|
removeConnector(this);
|
|
1913
1886
|
this.options.auth = void 0;
|
|
1914
1887
|
this.user = void 0;
|
|
1888
|
+
this.clearCache();
|
|
1915
1889
|
this.emitter.emit("logout");
|
|
1916
|
-
this.resources.cache.clean();
|
|
1917
1890
|
}
|
|
1918
1891
|
getUserInfo(credentials, options) {
|
|
1919
1892
|
if (this.user && this.user.id) {
|
|
@@ -1998,8 +1971,7 @@ var Geocoder = (function (exports) {
|
|
|
1998
1971
|
const params = objectRemoveEmpty(params_);
|
|
1999
1972
|
const makeApiRequest = () => apiRequest({ name, params, requestOptions, connector: this });
|
|
2000
1973
|
if (requestOptions.cache && method === "GET") {
|
|
2001
|
-
|
|
2002
|
-
return cache.add(name, makeApiRequest, __spreadValues$3({
|
|
1974
|
+
return this.cache.add(name, makeApiRequest, __spreadValues$3({
|
|
2003
1975
|
params
|
|
2004
1976
|
}, objectRemoveEmpty({
|
|
2005
1977
|
headers,
|
|
@@ -2269,10 +2241,8 @@ var Geocoder = (function (exports) {
|
|
|
2269
2241
|
function like(b, a, iLike) {
|
|
2270
2242
|
a = String(a);
|
|
2271
2243
|
b = String(b);
|
|
2272
|
-
if (a === b)
|
|
2273
|
-
|
|
2274
|
-
if (iLike && a.toUpperCase() === b.toUpperCase())
|
|
2275
|
-
return true;
|
|
2244
|
+
if (a === b) return true;
|
|
2245
|
+
if (iLike && a.toUpperCase() === b.toUpperCase()) return true;
|
|
2276
2246
|
const re = `^${reEscape(a)}$`.replace(/%/g, ".*").replace("_", ".");
|
|
2277
2247
|
return new RegExp(re, iLike ? "i" : "").exec(b) !== null;
|
|
2278
2248
|
}
|
|
@@ -2616,9 +2586,7 @@ var Geocoder = (function (exports) {
|
|
|
2616
2586
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
2617
2587
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
2618
2588
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
2619
|
-
var __knownSymbol$1 = (name, symbol) =>
|
|
2620
|
-
return (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
2621
|
-
};
|
|
2589
|
+
var __knownSymbol$1 = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
2622
2590
|
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2623
2591
|
var __spreadValues = (a, b) => {
|
|
2624
2592
|
for (var prop in b || (b = {}))
|
|
@@ -2631,10 +2599,7 @@ var Geocoder = (function (exports) {
|
|
|
2631
2599
|
}
|
|
2632
2600
|
return a;
|
|
2633
2601
|
};
|
|
2634
|
-
var __publicField$1 = (obj, key, value) =>
|
|
2635
|
-
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2636
|
-
return value;
|
|
2637
|
-
};
|
|
2602
|
+
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2638
2603
|
var __await$1 = function(promise, isYieldStar) {
|
|
2639
2604
|
this[0] = promise;
|
|
2640
2605
|
this[1] = isYieldStar;
|
|
@@ -2647,9 +2612,7 @@ var Geocoder = (function (exports) {
|
|
|
2647
2612
|
} catch (e) {
|
|
2648
2613
|
no(e);
|
|
2649
2614
|
}
|
|
2650
|
-
};
|
|
2651
|
-
var method = (k) => it[k] = (x) => new Promise((yes, no) => resume(k, x, yes, no));
|
|
2652
|
-
var it = {};
|
|
2615
|
+
}, method = (k) => it[k] = (x) => new Promise((yes, no) => resume(k, x, yes, no)), it = {};
|
|
2653
2616
|
return generator = generator.apply(__this, __arguments), it[__knownSymbol$1("asyncIterator")] = () => it, method("next"), method("throw"), method("return"), it;
|
|
2654
2617
|
};
|
|
2655
2618
|
const _NgwProvider = class _NgwProvider extends BaseProvider {
|
|
@@ -2796,14 +2759,9 @@ var Geocoder = (function (exports) {
|
|
|
2796
2759
|
let NgwProvider = _NgwProvider;
|
|
2797
2760
|
|
|
2798
2761
|
var __defProp = Object.defineProperty;
|
|
2799
|
-
var __knownSymbol = (name, symbol) =>
|
|
2800
|
-
return (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
2801
|
-
};
|
|
2762
|
+
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
2802
2763
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2803
|
-
var __publicField = (obj, key, value) =>
|
|
2804
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2805
|
-
return value;
|
|
2806
|
-
};
|
|
2764
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2807
2765
|
var __await = function(promise, isYieldStar) {
|
|
2808
2766
|
this[0] = promise;
|
|
2809
2767
|
this[1] = isYieldStar;
|
|
@@ -2816,9 +2774,7 @@ var Geocoder = (function (exports) {
|
|
|
2816
2774
|
} catch (e) {
|
|
2817
2775
|
no(e);
|
|
2818
2776
|
}
|
|
2819
|
-
};
|
|
2820
|
-
var method = (k) => it[k] = (x) => new Promise((yes, no) => resume(k, x, yes, no));
|
|
2821
|
-
var it = {};
|
|
2777
|
+
}, method = (k) => it[k] = (x) => new Promise((yes, no) => resume(k, x, yes, no)), it = {};
|
|
2822
2778
|
return generator = generator.apply(__this, __arguments), it[__knownSymbol("asyncIterator")] = () => it, method("next"), method("throw"), method("return"), it;
|
|
2823
2779
|
};
|
|
2824
2780
|
class NominatimProvider extends BaseProvider {
|