@nextgis/geocoder 3.0.0-alpha.12 → 3.0.0-alpha.14
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 +2 -2
- 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 +459 -444
- 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 +2 -2
- package/lib/geocoder.esm-bundler.js.map +1 -1
- package/lib/geocoder.esm-bundler.prod.js.map +1 -1
- package/lib/geocoder.global.js +459 -444
- 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/lib/index.d.ts +15 -15
- package/package.json +7 -7
package/lib/geocoder.global.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/geocoder; version: 3.0.0-alpha.
|
|
1
|
+
/** Bundle of @nextgis/geocoder; version: 3.0.0-alpha.14; author: NextGIS */
|
|
2
2
|
var Geocoder = (function (exports) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -9,14 +9,6 @@ var Geocoder = (function (exports) {
|
|
|
9
9
|
return typeof val === "string" ? !!val : defined(val);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
function getBoundsCoordinates(b) {
|
|
13
|
-
const westNorth = [b[0], b[1]];
|
|
14
|
-
const eastNorth = [b[2], b[1]];
|
|
15
|
-
const eastSouth = [b[2], b[3]];
|
|
16
|
-
const westSouth = [b[0], b[3]];
|
|
17
|
-
return [westNorth, eastNorth, eastSouth, westSouth, westNorth];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
12
|
function degrees2meters(lng, lat) {
|
|
21
13
|
lat = lat > 85.06 ? 85.06 : lat < -85.06 ? -85.06 : lat;
|
|
22
14
|
const x = lng * 2003750834e-2 / 180;
|
|
@@ -25,10 +17,23 @@ var Geocoder = (function (exports) {
|
|
|
25
17
|
return [x, y];
|
|
26
18
|
}
|
|
27
19
|
|
|
20
|
+
function getBoundsCoordinates(b) {
|
|
21
|
+
const westNorth = [b[0], b[1]];
|
|
22
|
+
const eastNorth = [b[2], b[1]];
|
|
23
|
+
const eastSouth = [b[2], b[3]];
|
|
24
|
+
const westSouth = [b[0], b[3]];
|
|
25
|
+
return [westNorth, eastNorth, eastSouth, westSouth, westNorth];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
28
|
function isLngLatBoundsArray(array) {
|
|
29
29
|
return Array.isArray(array) && array.length === 4 && array.every((x) => typeof x === "number");
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
function round(val, toFixed) {
|
|
33
|
+
const n = 1;
|
|
34
|
+
return Math.round((val + Number.EPSILON) * n) / n;
|
|
35
|
+
}
|
|
36
|
+
|
|
32
37
|
function objectAssign(target, ...sources) {
|
|
33
38
|
for (const source of sources) {
|
|
34
39
|
for (const prop of Object.getOwnPropertyNames(source)) {
|
|
@@ -83,11 +88,6 @@ var Geocoder = (function (exports) {
|
|
|
83
88
|
return newObj;
|
|
84
89
|
}
|
|
85
90
|
|
|
86
|
-
function round(val, toFixed) {
|
|
87
|
-
const n = 1;
|
|
88
|
-
return Math.round((val + Number.EPSILON) * n) / n;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
91
|
function isObject$1(val) {
|
|
92
92
|
return Object.prototype.toString.call(val) === "[object Object]";
|
|
93
93
|
}
|
|
@@ -247,7 +247,7 @@ var Geocoder = (function (exports) {
|
|
|
247
247
|
throw error[0];
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
|
-
} catch (
|
|
250
|
+
} catch (e) {
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
});
|
|
@@ -307,6 +307,245 @@ var Geocoder = (function (exports) {
|
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
+
const templateRe = /\{ *([\w_-]+) *\}/g;
|
|
311
|
+
function template(str, data) {
|
|
312
|
+
return str.replace(templateRe, (s, key) => {
|
|
313
|
+
let value = data[key];
|
|
314
|
+
if (value === void 0) {
|
|
315
|
+
throw new Error("No value provided for letiable " + s);
|
|
316
|
+
} else if (typeof value === "function") {
|
|
317
|
+
value = value(data);
|
|
318
|
+
}
|
|
319
|
+
return value;
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
var __defProp$g = Object.defineProperty;
|
|
324
|
+
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
325
|
+
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
326
|
+
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
327
|
+
var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
328
|
+
var __spreadValues$7 = (a, b) => {
|
|
329
|
+
for (var prop in b || (b = {}))
|
|
330
|
+
if (__hasOwnProp$7.call(b, prop))
|
|
331
|
+
__defNormalProp$g(a, prop, b[prop]);
|
|
332
|
+
if (__getOwnPropSymbols$7)
|
|
333
|
+
for (var prop of __getOwnPropSymbols$7(b)) {
|
|
334
|
+
if (__propIsEnum$7.call(b, prop))
|
|
335
|
+
__defNormalProp$g(a, prop, b[prop]);
|
|
336
|
+
}
|
|
337
|
+
return a;
|
|
338
|
+
};
|
|
339
|
+
var __async$6 = (__this, __arguments, generator) => {
|
|
340
|
+
return new Promise((resolve, reject) => {
|
|
341
|
+
var fulfilled = (value) => {
|
|
342
|
+
try {
|
|
343
|
+
step(generator.next(value));
|
|
344
|
+
} catch (e) {
|
|
345
|
+
reject(e);
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
var rejected = (value) => {
|
|
349
|
+
try {
|
|
350
|
+
step(generator.throw(value));
|
|
351
|
+
} catch (e) {
|
|
352
|
+
reject(e);
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
356
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
357
|
+
});
|
|
358
|
+
};
|
|
359
|
+
function apiRequest(opt) {
|
|
360
|
+
return __async$6(this, null, function* () {
|
|
361
|
+
const { params, name, connector, requestOptions } = opt;
|
|
362
|
+
const apiItems = yield connector.connect();
|
|
363
|
+
let apiItem = apiItems && apiItems[name];
|
|
364
|
+
if (apiItem) {
|
|
365
|
+
apiItem = [...apiItem];
|
|
366
|
+
let url = apiItem.shift();
|
|
367
|
+
if (apiItem.length) {
|
|
368
|
+
const replaceParams = {};
|
|
369
|
+
for (let fry = 0; fry < apiItem.length; fry++) {
|
|
370
|
+
const arg = apiItem[fry];
|
|
371
|
+
replaceParams[fry] = `{${arg}}`;
|
|
372
|
+
if (params[arg] === void 0) {
|
|
373
|
+
throw new Error(`\`${arg}\` URL API argument is not specified`);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
if (url) {
|
|
377
|
+
url = template(url, replaceParams);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
if (params) {
|
|
381
|
+
const paramArray = [];
|
|
382
|
+
const paramList = params.paramList;
|
|
383
|
+
if (Array.isArray(paramList)) {
|
|
384
|
+
paramList.forEach(([key, value]) => {
|
|
385
|
+
paramArray.push(`${key}=${value}`);
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
for (const p in params) {
|
|
389
|
+
if (apiItem.indexOf(p) === -1) {
|
|
390
|
+
paramArray.push(`${p}=${params[p]}`);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
if (paramArray.length) {
|
|
394
|
+
url = `${url}?${paramArray.join("&")}`;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
if (url) {
|
|
398
|
+
return connector.makeQuery(url, params, __spreadValues$7({
|
|
399
|
+
cacheName: name
|
|
400
|
+
}, requestOptions));
|
|
401
|
+
} else {
|
|
402
|
+
throw new Error("Request URL is not set");
|
|
403
|
+
}
|
|
404
|
+
} else {
|
|
405
|
+
return void 0;
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
var __defProp$f = Object.defineProperty;
|
|
411
|
+
var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
412
|
+
var __publicField$b = (obj, key, value) => __defNormalProp$f(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
413
|
+
const _Cache = class _Cache {
|
|
414
|
+
constructor(options = {}) {
|
|
415
|
+
__publicField$b(this, "cache", []);
|
|
416
|
+
var _a;
|
|
417
|
+
const namespace = (_a = options.namespace) != null ? _a : "default";
|
|
418
|
+
if (_Cache.instance[namespace]) {
|
|
419
|
+
return _Cache.instance[namespace];
|
|
420
|
+
}
|
|
421
|
+
_Cache.instance[namespace] = this;
|
|
422
|
+
return this;
|
|
423
|
+
}
|
|
424
|
+
clean() {
|
|
425
|
+
this.cache.length = 0;
|
|
426
|
+
}
|
|
427
|
+
all() {
|
|
428
|
+
return this.cache;
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Caching only a non-empty value.
|
|
432
|
+
*
|
|
433
|
+
* Useful for get or create strategy
|
|
434
|
+
* @example
|
|
435
|
+
* ```javascript
|
|
436
|
+
* const cache = new Cache();
|
|
437
|
+
* const getItemFunc = () => fetch(url).then((data) => {
|
|
438
|
+
* return data.json(); // undefined
|
|
439
|
+
* });
|
|
440
|
+
* const item = await cache.addFull('foo', getItemFunc);
|
|
441
|
+
* if (!item) {
|
|
442
|
+
* await createItem(); // 'New item'
|
|
443
|
+
* }
|
|
444
|
+
*
|
|
445
|
+
* // somewhere else in the code
|
|
446
|
+
* const item = await cache.addFull('foo', getItemFunc).then((resp) => {
|
|
447
|
+
* console.log(resp); // 'New item'
|
|
448
|
+
* });
|
|
449
|
+
* ```
|
|
450
|
+
*/
|
|
451
|
+
addFull(key, valueToSet, propsOrOptions, expirationTime) {
|
|
452
|
+
if (typeof propsOrOptions === "object" && "valueToSet" in propsOrOptions) {
|
|
453
|
+
propsOrOptions.onlyFull = true;
|
|
454
|
+
}
|
|
455
|
+
return this.add(key, valueToSet, propsOrOptions, true, expirationTime);
|
|
456
|
+
}
|
|
457
|
+
add(key, valueToSet, propsOrOptions, onlyFull, expirationTime) {
|
|
458
|
+
let opt;
|
|
459
|
+
let props;
|
|
460
|
+
if (typeof propsOrOptions === "object" && "valueToSet" in propsOrOptions) {
|
|
461
|
+
opt = propsOrOptions;
|
|
462
|
+
onlyFull = opt.onlyFull;
|
|
463
|
+
expirationTime = opt.expirationTime;
|
|
464
|
+
props = opt.props;
|
|
465
|
+
} else {
|
|
466
|
+
props = propsOrOptions;
|
|
467
|
+
}
|
|
468
|
+
const exist = this._find(key, props);
|
|
469
|
+
if (!exist) {
|
|
470
|
+
let value;
|
|
471
|
+
if (valueToSet instanceof Function) {
|
|
472
|
+
value = valueToSet();
|
|
473
|
+
} else {
|
|
474
|
+
value = valueToSet;
|
|
475
|
+
}
|
|
476
|
+
const nonEmptyProps = props && JSON.parse(JSON.stringify(objectRemoveEmpty(props)));
|
|
477
|
+
expirationTime = expirationTime ? Date.now() + expirationTime : void 0;
|
|
478
|
+
const cacheItem = {
|
|
479
|
+
key,
|
|
480
|
+
value,
|
|
481
|
+
props: nonEmptyProps,
|
|
482
|
+
expirationTime
|
|
483
|
+
};
|
|
484
|
+
if (onlyFull && !full(value)) {
|
|
485
|
+
return value;
|
|
486
|
+
}
|
|
487
|
+
this.cache.push(cacheItem);
|
|
488
|
+
if (value instanceof Promise) {
|
|
489
|
+
value.catch(() => {
|
|
490
|
+
this.delete(key, props);
|
|
491
|
+
});
|
|
492
|
+
if (onlyFull) {
|
|
493
|
+
value.then((x) => {
|
|
494
|
+
if (!full(x)) {
|
|
495
|
+
this.delete(key, props);
|
|
496
|
+
}
|
|
497
|
+
return x;
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
return value;
|
|
501
|
+
}
|
|
502
|
+
return value;
|
|
503
|
+
} else {
|
|
504
|
+
return exist.value;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
match(key, props) {
|
|
508
|
+
const cacheRecord = this._find(key, props);
|
|
509
|
+
if (cacheRecord && cacheRecord.expirationTime && Date.now() > cacheRecord.expirationTime) {
|
|
510
|
+
this.delete(cacheRecord);
|
|
511
|
+
return void 0;
|
|
512
|
+
}
|
|
513
|
+
return cacheRecord == null ? void 0 : cacheRecord.value;
|
|
514
|
+
}
|
|
515
|
+
matchAll(key, props) {
|
|
516
|
+
const now = Date.now();
|
|
517
|
+
this.cache.forEach((item) => {
|
|
518
|
+
if (item.expirationTime && now > item.expirationTime) {
|
|
519
|
+
this.delete(item);
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
if (key) {
|
|
523
|
+
return this.cache.filter((x) => this._filter(x, key, props)).map((x) => x.value);
|
|
524
|
+
}
|
|
525
|
+
return this.cache.map((x) => x.value);
|
|
526
|
+
}
|
|
527
|
+
delete(keyOrItem, props) {
|
|
528
|
+
const itemsToDelete = typeof keyOrItem === "string" ? this.cache.filter((x) => this._filter(x, keyOrItem, props)) : [keyOrItem];
|
|
529
|
+
for (const item of itemsToDelete) {
|
|
530
|
+
const index = this.cache.indexOf(item);
|
|
531
|
+
if (index !== -1) {
|
|
532
|
+
this.cache.splice(index, 1);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
_find(key, props) {
|
|
537
|
+
return this.cache.find((x) => this._filter(x, key, props));
|
|
538
|
+
}
|
|
539
|
+
_filter(item, key, props) {
|
|
540
|
+
if (item.key !== key) return false;
|
|
541
|
+
if (!props) return true;
|
|
542
|
+
const itemProps = item.props;
|
|
543
|
+
return objectDeepEqual(itemProps || {}, objectRemoveEmpty(props));
|
|
544
|
+
}
|
|
545
|
+
};
|
|
546
|
+
__publicField$b(_Cache, "instance", {});
|
|
547
|
+
let Cache = _Cache;
|
|
548
|
+
|
|
310
549
|
var domain;
|
|
311
550
|
|
|
312
551
|
// This constructor is used to store event handlers. Instantiating this is
|
|
@@ -779,148 +1018,9 @@ var Geocoder = (function (exports) {
|
|
|
779
1018
|
return ret;
|
|
780
1019
|
}
|
|
781
1020
|
|
|
782
|
-
var __defProp$g = Object.defineProperty;
|
|
783
|
-
var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
784
|
-
var __publicField$b = (obj, key, value) => __defNormalProp$g(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
785
|
-
const _Cache = class _Cache {
|
|
786
|
-
constructor(options = {}) {
|
|
787
|
-
__publicField$b(this, "cache", []);
|
|
788
|
-
var _a;
|
|
789
|
-
const namespace = (_a = options.namespace) != null ? _a : "default";
|
|
790
|
-
if (_Cache.instance[namespace]) {
|
|
791
|
-
return _Cache.instance[namespace];
|
|
792
|
-
}
|
|
793
|
-
_Cache.instance[namespace] = this;
|
|
794
|
-
return this;
|
|
795
|
-
}
|
|
796
|
-
clean() {
|
|
797
|
-
this.cache.length = 0;
|
|
798
|
-
}
|
|
799
|
-
all() {
|
|
800
|
-
return this.cache;
|
|
801
|
-
}
|
|
802
|
-
/**
|
|
803
|
-
* Caching only a non-empty value.
|
|
804
|
-
*
|
|
805
|
-
* Useful for get or create strategy
|
|
806
|
-
* @example
|
|
807
|
-
* ```javascript
|
|
808
|
-
* const cache = new Cache();
|
|
809
|
-
* const getItemFunc = () => fetch(url).then((data) => {
|
|
810
|
-
* return data.json(); // undefined
|
|
811
|
-
* });
|
|
812
|
-
* const item = await cache.addFull('foo', getItemFunc);
|
|
813
|
-
* if (!item) {
|
|
814
|
-
* await createItem(); // 'New item'
|
|
815
|
-
* }
|
|
816
|
-
*
|
|
817
|
-
* // somewhere else in the code
|
|
818
|
-
* const item = await cache.addFull('foo', getItemFunc).then((resp) => {
|
|
819
|
-
* console.log(resp); // 'New item'
|
|
820
|
-
* });
|
|
821
|
-
* ```
|
|
822
|
-
*/
|
|
823
|
-
addFull(key, valueToSet, propsOrOptions, expirationTime) {
|
|
824
|
-
if (typeof propsOrOptions === "object" && "valueToSet" in propsOrOptions) {
|
|
825
|
-
propsOrOptions.onlyFull = true;
|
|
826
|
-
}
|
|
827
|
-
return this.add(key, valueToSet, propsOrOptions, true, expirationTime);
|
|
828
|
-
}
|
|
829
|
-
add(key, valueToSet, propsOrOptions, onlyFull, expirationTime) {
|
|
830
|
-
let opt;
|
|
831
|
-
let props;
|
|
832
|
-
if (typeof propsOrOptions === "object" && "valueToSet" in propsOrOptions) {
|
|
833
|
-
opt = propsOrOptions;
|
|
834
|
-
onlyFull = opt.onlyFull;
|
|
835
|
-
expirationTime = opt.expirationTime;
|
|
836
|
-
props = opt.props;
|
|
837
|
-
} else {
|
|
838
|
-
props = propsOrOptions;
|
|
839
|
-
}
|
|
840
|
-
const exist = this._find(key, props);
|
|
841
|
-
if (!exist) {
|
|
842
|
-
let value;
|
|
843
|
-
if (valueToSet instanceof Function) {
|
|
844
|
-
value = valueToSet();
|
|
845
|
-
} else {
|
|
846
|
-
value = valueToSet;
|
|
847
|
-
}
|
|
848
|
-
const nonEmptyProps = props && JSON.parse(JSON.stringify(objectRemoveEmpty(props)));
|
|
849
|
-
expirationTime = expirationTime ? Date.now() + expirationTime : void 0;
|
|
850
|
-
const cacheItem = {
|
|
851
|
-
key,
|
|
852
|
-
value,
|
|
853
|
-
props: nonEmptyProps,
|
|
854
|
-
expirationTime
|
|
855
|
-
};
|
|
856
|
-
if (onlyFull && !full(value)) {
|
|
857
|
-
return value;
|
|
858
|
-
}
|
|
859
|
-
this.cache.push(cacheItem);
|
|
860
|
-
if (value instanceof Promise) {
|
|
861
|
-
value.catch((er) => {
|
|
862
|
-
this.delete(key, props);
|
|
863
|
-
});
|
|
864
|
-
if (onlyFull) {
|
|
865
|
-
value.then((x) => {
|
|
866
|
-
if (!full(x)) {
|
|
867
|
-
this.delete(key, props);
|
|
868
|
-
}
|
|
869
|
-
return x;
|
|
870
|
-
});
|
|
871
|
-
}
|
|
872
|
-
return value;
|
|
873
|
-
}
|
|
874
|
-
return value;
|
|
875
|
-
} else {
|
|
876
|
-
return exist.value;
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
match(key, props) {
|
|
880
|
-
const cacheRecord = this._find(key, props);
|
|
881
|
-
if (cacheRecord && cacheRecord.expirationTime && Date.now() > cacheRecord.expirationTime) {
|
|
882
|
-
this.delete(cacheRecord);
|
|
883
|
-
return void 0;
|
|
884
|
-
}
|
|
885
|
-
return cacheRecord == null ? void 0 : cacheRecord.value;
|
|
886
|
-
}
|
|
887
|
-
matchAll(key, props) {
|
|
888
|
-
const now = Date.now();
|
|
889
|
-
this.cache.forEach((item) => {
|
|
890
|
-
if (item.expirationTime && now > item.expirationTime) {
|
|
891
|
-
this.delete(item);
|
|
892
|
-
}
|
|
893
|
-
});
|
|
894
|
-
if (key) {
|
|
895
|
-
return this.cache.filter((x) => this._filter(x, key, props)).map((x) => x.value);
|
|
896
|
-
}
|
|
897
|
-
return this.cache.map((x) => x.value);
|
|
898
|
-
}
|
|
899
|
-
delete(keyOrItem, props) {
|
|
900
|
-
const itemsToDelete = typeof keyOrItem === "string" ? this.cache.filter((x) => this._filter(x, keyOrItem, props)) : [keyOrItem];
|
|
901
|
-
for (const item of itemsToDelete) {
|
|
902
|
-
const index = this.cache.indexOf(item);
|
|
903
|
-
if (index !== -1) {
|
|
904
|
-
this.cache.splice(index, 1);
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
}
|
|
908
|
-
_find(key, props) {
|
|
909
|
-
return this.cache.find((x) => this._filter(x, key, props));
|
|
910
|
-
}
|
|
911
|
-
_filter(item, key, props) {
|
|
912
|
-
if (item.key !== key) return false;
|
|
913
|
-
if (!props) return true;
|
|
914
|
-
const itemProps = item.props;
|
|
915
|
-
return objectDeepEqual(itemProps || {}, objectRemoveEmpty(props));
|
|
916
|
-
}
|
|
917
|
-
};
|
|
918
|
-
__publicField$b(_Cache, "instance", {});
|
|
919
|
-
let Cache = _Cache;
|
|
920
|
-
|
|
921
1021
|
var pkg = {
|
|
922
1022
|
name: "@nextgis/ngw-connector",
|
|
923
|
-
version: "3.0.0-alpha.
|
|
1023
|
+
version: "3.0.0-alpha.14",
|
|
924
1024
|
_priority: 12,
|
|
925
1025
|
description: "A lightweight HTTP client optimized for use with NextGIS Web API",
|
|
926
1026
|
main: "index.js",
|
|
@@ -929,15 +1029,15 @@ var Geocoder = (function (exports) {
|
|
|
929
1029
|
jsdelivr: "lib/ngw-connector.global.prod.js",
|
|
930
1030
|
types: "lib/index.d.ts",
|
|
931
1031
|
dependencies: {
|
|
932
|
-
"@nextgis/cache": "^3.0.0-alpha.
|
|
933
|
-
"@nextgis/cancelable-promise": "^3.0.0-alpha.
|
|
934
|
-
"@nextgis/utils": "^3.0.0-alpha.
|
|
1032
|
+
"@nextgis/cache": "^3.0.0-alpha.13",
|
|
1033
|
+
"@nextgis/cancelable-promise": "^3.0.0-alpha.13",
|
|
1034
|
+
"@nextgis/utils": "^3.0.0-alpha.13",
|
|
935
1035
|
"@types/events": "^3.0.0",
|
|
936
1036
|
events: "*",
|
|
937
1037
|
"form-data": "^4.0.0"
|
|
938
1038
|
},
|
|
939
1039
|
devDependencies: {
|
|
940
|
-
"@nextgis/build-tools": "^3.0.0-alpha.
|
|
1040
|
+
"@nextgis/build-tools": "^3.0.0-alpha.13"
|
|
941
1041
|
},
|
|
942
1042
|
scripts: {
|
|
943
1043
|
clean: "rimraf ./lib",
|
|
@@ -977,30 +1077,6 @@ var Geocoder = (function (exports) {
|
|
|
977
1077
|
gitHead: "edc68033f914f6c95c4125b9738bba6d36e990b4"
|
|
978
1078
|
};
|
|
979
1079
|
|
|
980
|
-
const CONNECTORS = [];
|
|
981
|
-
function addConnector(connector) {
|
|
982
|
-
CONNECTORS.push(connector);
|
|
983
|
-
}
|
|
984
|
-
function findConnector(options) {
|
|
985
|
-
return CONNECTORS.find((x) => {
|
|
986
|
-
if (x.options.baseUrl === options.baseUrl) {
|
|
987
|
-
if (options.auth) {
|
|
988
|
-
if (x.options.auth) {
|
|
989
|
-
return objectDeepEqual(x.options.auth, options.auth);
|
|
990
|
-
}
|
|
991
|
-
} else {
|
|
992
|
-
return true;
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
});
|
|
996
|
-
}
|
|
997
|
-
function removeConnector(connector) {
|
|
998
|
-
const index = CONNECTORS.indexOf(connector);
|
|
999
|
-
if (index !== -1) {
|
|
1000
|
-
CONNECTORS.splice(index, 1);
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
|
|
1004
1080
|
class AbortError extends Error {
|
|
1005
1081
|
constructor(message = "AbortError") {
|
|
1006
1082
|
super(message);
|
|
@@ -1008,9 +1084,9 @@ var Geocoder = (function (exports) {
|
|
|
1008
1084
|
}
|
|
1009
1085
|
}
|
|
1010
1086
|
|
|
1011
|
-
var __defProp$
|
|
1012
|
-
var __defNormalProp$
|
|
1013
|
-
var __publicField$a = (obj, key, value) => __defNormalProp$
|
|
1087
|
+
var __defProp$e = Object.defineProperty;
|
|
1088
|
+
var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1089
|
+
var __publicField$a = (obj, key, value) => __defNormalProp$e(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1014
1090
|
class NgwError extends Error {
|
|
1015
1091
|
constructor(er) {
|
|
1016
1092
|
super();
|
|
@@ -1027,9 +1103,9 @@ var Geocoder = (function (exports) {
|
|
|
1027
1103
|
}
|
|
1028
1104
|
}
|
|
1029
1105
|
|
|
1030
|
-
var __defProp$
|
|
1031
|
-
var __defNormalProp$
|
|
1032
|
-
var __publicField$9 = (obj, key, value) => __defNormalProp$
|
|
1106
|
+
var __defProp$d = Object.defineProperty;
|
|
1107
|
+
var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1108
|
+
var __publicField$9 = (obj, key, value) => __defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1033
1109
|
class InsufficientPermissionsError extends NgwError {
|
|
1034
1110
|
constructor(obj) {
|
|
1035
1111
|
super(obj);
|
|
@@ -1039,51 +1115,19 @@ var Geocoder = (function (exports) {
|
|
|
1039
1115
|
}
|
|
1040
1116
|
}
|
|
1041
1117
|
|
|
1042
|
-
var __defProp$d = Object.defineProperty;
|
|
1043
|
-
var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1044
|
-
var __publicField$8 = (obj, key, value) => __defNormalProp$d(obj, key + "" , value);
|
|
1045
|
-
class NetworkError extends Error {
|
|
1046
|
-
constructor(url) {
|
|
1047
|
-
super();
|
|
1048
|
-
__publicField$8(this, "name", "NetworkError");
|
|
1049
|
-
Object.setPrototypeOf(this, NetworkError.prototype);
|
|
1050
|
-
this.message = `Unable to request ${url}.
|
|
1051
|
-
Possibly invalid NGW URL entered or CORS not configured to get request from ${location.origin}`;
|
|
1052
|
-
}
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
1118
|
var __defProp$c = Object.defineProperty;
|
|
1056
1119
|
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1057
|
-
var __publicField$
|
|
1120
|
+
var __publicField$8 = (obj, key, value) => __defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1058
1121
|
let NetworksResponseError$1 = class NetworksResponseError extends NgwError {
|
|
1059
1122
|
constructor(obj) {
|
|
1060
1123
|
super(obj);
|
|
1061
|
-
__publicField$
|
|
1062
|
-
__publicField$
|
|
1063
|
-
__publicField$
|
|
1124
|
+
__publicField$8(this, "message", "There is no response from the server or problem connecting to server.");
|
|
1125
|
+
__publicField$8(this, "title", "Network error");
|
|
1126
|
+
__publicField$8(this, "detail", "Check network connectivity and try again later.");
|
|
1064
1127
|
Object.setPrototypeOf(this, NetworksResponseError.prototype);
|
|
1065
1128
|
}
|
|
1066
1129
|
};
|
|
1067
1130
|
|
|
1068
|
-
var __defProp$b = Object.defineProperty;
|
|
1069
|
-
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1070
|
-
var __publicField$6 = (obj, key, value) => __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1071
|
-
class ResourceNotFoundError extends NgwError {
|
|
1072
|
-
constructor(obj) {
|
|
1073
|
-
super(obj);
|
|
1074
|
-
__publicField$6(this, "name", "ResourceNotFoundError");
|
|
1075
|
-
__publicField$6(this, "exception", "nextgisweb.resource.exception.ResourceNotFound");
|
|
1076
|
-
Object.setPrototypeOf(this, ResourceNotFoundError.prototype);
|
|
1077
|
-
}
|
|
1078
|
-
}
|
|
1079
|
-
|
|
1080
|
-
function isError(error) {
|
|
1081
|
-
if (isObject$1(error)) {
|
|
1082
|
-
return error.status_code && error.exception && error.title;
|
|
1083
|
-
}
|
|
1084
|
-
return false;
|
|
1085
|
-
}
|
|
1086
|
-
|
|
1087
1131
|
function extractError(error) {
|
|
1088
1132
|
if (isObject$1(error)) {
|
|
1089
1133
|
if (error.name && error.message && error.title) {
|
|
@@ -1109,6 +1153,38 @@ var Geocoder = (function (exports) {
|
|
|
1109
1153
|
}
|
|
1110
1154
|
}
|
|
1111
1155
|
|
|
1156
|
+
function isError(error) {
|
|
1157
|
+
if (isObject$1(error)) {
|
|
1158
|
+
return error.status_code && error.exception && error.title;
|
|
1159
|
+
}
|
|
1160
|
+
return false;
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
var __defProp$b = Object.defineProperty;
|
|
1164
|
+
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1165
|
+
var __publicField$7 = (obj, key, value) => __defNormalProp$b(obj, key + "" , value);
|
|
1166
|
+
class NetworkError extends Error {
|
|
1167
|
+
constructor(url) {
|
|
1168
|
+
super();
|
|
1169
|
+
__publicField$7(this, "name", "NetworkError");
|
|
1170
|
+
Object.setPrototypeOf(this, NetworkError.prototype);
|
|
1171
|
+
this.message = `Unable to request ${url}.
|
|
1172
|
+
Possibly invalid NGW URL entered or CORS not configured to get request from ${location.origin}`;
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
var __defProp$a = Object.defineProperty;
|
|
1177
|
+
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1178
|
+
var __publicField$6 = (obj, key, value) => __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1179
|
+
class ResourceNotFoundError extends NgwError {
|
|
1180
|
+
constructor(obj) {
|
|
1181
|
+
super(obj);
|
|
1182
|
+
__publicField$6(this, "name", "ResourceNotFoundError");
|
|
1183
|
+
__publicField$6(this, "exception", "nextgisweb.resource.exception.ResourceNotFound");
|
|
1184
|
+
Object.setPrototypeOf(this, ResourceNotFoundError.prototype);
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1112
1188
|
var errors = /*#__PURE__*/Object.freeze({
|
|
1113
1189
|
__proto__: null,
|
|
1114
1190
|
AbortError: AbortError,
|
|
@@ -1121,9 +1197,9 @@ var Geocoder = (function (exports) {
|
|
|
1121
1197
|
isError: isError
|
|
1122
1198
|
});
|
|
1123
1199
|
|
|
1124
|
-
var __defProp$
|
|
1125
|
-
var __defNormalProp$
|
|
1126
|
-
var __publicField$5 = (obj, key, value) => __defNormalProp$
|
|
1200
|
+
var __defProp$9 = Object.defineProperty;
|
|
1201
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1202
|
+
var __publicField$5 = (obj, key, value) => __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1127
1203
|
class BaseAPIError extends Error {
|
|
1128
1204
|
constructor(message) {
|
|
1129
1205
|
super(message || "Something went wrong.");
|
|
@@ -1185,35 +1261,35 @@ var Geocoder = (function (exports) {
|
|
|
1185
1261
|
}
|
|
1186
1262
|
}
|
|
1187
1263
|
|
|
1188
|
-
var __defProp$
|
|
1189
|
-
var __getOwnPropSymbols$
|
|
1190
|
-
var __hasOwnProp$
|
|
1191
|
-
var __propIsEnum$
|
|
1192
|
-
var __defNormalProp$
|
|
1193
|
-
var __spreadValues$
|
|
1264
|
+
var __defProp$8 = Object.defineProperty;
|
|
1265
|
+
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
1266
|
+
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
1267
|
+
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
1268
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1269
|
+
var __spreadValues$6 = (a, b) => {
|
|
1194
1270
|
for (var prop in b || (b = {}))
|
|
1195
|
-
if (__hasOwnProp$
|
|
1196
|
-
__defNormalProp$
|
|
1197
|
-
if (__getOwnPropSymbols$
|
|
1198
|
-
for (var prop of __getOwnPropSymbols$
|
|
1199
|
-
if (__propIsEnum$
|
|
1200
|
-
__defNormalProp$
|
|
1271
|
+
if (__hasOwnProp$6.call(b, prop))
|
|
1272
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
1273
|
+
if (__getOwnPropSymbols$6)
|
|
1274
|
+
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
1275
|
+
if (__propIsEnum$6.call(b, prop))
|
|
1276
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
1201
1277
|
}
|
|
1202
1278
|
return a;
|
|
1203
1279
|
};
|
|
1204
1280
|
var __objRest$2 = (source, exclude) => {
|
|
1205
1281
|
var target = {};
|
|
1206
1282
|
for (var prop in source)
|
|
1207
|
-
if (__hasOwnProp$
|
|
1283
|
+
if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1208
1284
|
target[prop] = source[prop];
|
|
1209
|
-
if (source != null && __getOwnPropSymbols$
|
|
1210
|
-
for (var prop of __getOwnPropSymbols$
|
|
1211
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
1285
|
+
if (source != null && __getOwnPropSymbols$6)
|
|
1286
|
+
for (var prop of __getOwnPropSymbols$6(source)) {
|
|
1287
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
|
|
1212
1288
|
target[prop] = source[prop];
|
|
1213
1289
|
}
|
|
1214
1290
|
return target;
|
|
1215
1291
|
};
|
|
1216
|
-
var __async$
|
|
1292
|
+
var __async$5 = (__this, __arguments, generator) => {
|
|
1217
1293
|
return new Promise((resolve, reject) => {
|
|
1218
1294
|
var fulfilled = (value) => {
|
|
1219
1295
|
try {
|
|
@@ -1238,7 +1314,7 @@ var Geocoder = (function (exports) {
|
|
|
1238
1314
|
return ct !== void 0 && ct !== null && ct.includes("application/vnd.lunkwill.request-summary+json");
|
|
1239
1315
|
}
|
|
1240
1316
|
function responseJson(response) {
|
|
1241
|
-
return __async$
|
|
1317
|
+
return __async$5(this, null, function* () {
|
|
1242
1318
|
try {
|
|
1243
1319
|
return response.json();
|
|
1244
1320
|
} catch (e) {
|
|
@@ -1247,7 +1323,7 @@ var Geocoder = (function (exports) {
|
|
|
1247
1323
|
});
|
|
1248
1324
|
}
|
|
1249
1325
|
function lunkwillResponseUrl(lwResp) {
|
|
1250
|
-
return __async$
|
|
1326
|
+
return __async$5(this, null, function* () {
|
|
1251
1327
|
const lwData = yield responseJson(lwResp);
|
|
1252
1328
|
let delay = lwData.delay_ms;
|
|
1253
1329
|
const retry = lwData.retry_ms !== void 0 ? lwData.retry_ms : 2e3;
|
|
@@ -1291,7 +1367,7 @@ var Geocoder = (function (exports) {
|
|
|
1291
1367
|
});
|
|
1292
1368
|
}
|
|
1293
1369
|
function lunkwillFetch(lwRespUrl) {
|
|
1294
|
-
return __async$
|
|
1370
|
+
return __async$5(this, null, function* () {
|
|
1295
1371
|
try {
|
|
1296
1372
|
return yield window.fetch(lwRespUrl, { credentials: "same-origin" });
|
|
1297
1373
|
} catch (e) {
|
|
@@ -1339,14 +1415,14 @@ var Geocoder = (function (exports) {
|
|
|
1339
1415
|
return path + urlParams;
|
|
1340
1416
|
}
|
|
1341
1417
|
function request(path, options, cacheEngine) {
|
|
1342
|
-
return __async$
|
|
1343
|
-
var _b;
|
|
1418
|
+
return __async$5(this, null, function* () {
|
|
1419
|
+
var _b, _c;
|
|
1344
1420
|
const defaults = {
|
|
1345
1421
|
method: "GET",
|
|
1346
1422
|
credentials: "same-origin",
|
|
1347
1423
|
headers: {}
|
|
1348
1424
|
};
|
|
1349
|
-
const _a = __spreadValues$
|
|
1425
|
+
const _a = __spreadValues$6(__spreadValues$6({}, defaults), options), {
|
|
1350
1426
|
withCredentials,
|
|
1351
1427
|
responseType,
|
|
1352
1428
|
cacheProps,
|
|
@@ -1365,6 +1441,7 @@ var Geocoder = (function (exports) {
|
|
|
1365
1441
|
"query",
|
|
1366
1442
|
"json"
|
|
1367
1443
|
]);
|
|
1444
|
+
opt.method = (_b = opt.method) == null ? void 0 : _b.toUpperCase();
|
|
1368
1445
|
if (withCredentials) {
|
|
1369
1446
|
opt.credentials = "include";
|
|
1370
1447
|
}
|
|
@@ -1382,7 +1459,7 @@ var Geocoder = (function (exports) {
|
|
|
1382
1459
|
opt.headers = headers;
|
|
1383
1460
|
}
|
|
1384
1461
|
const url = generateUrl(path, query);
|
|
1385
|
-
const makeRequest = () => __async$
|
|
1462
|
+
const makeRequest = () => __async$5(this, null, function* () {
|
|
1386
1463
|
let response;
|
|
1387
1464
|
try {
|
|
1388
1465
|
response = yield fetch(url, opt);
|
|
@@ -1422,35 +1499,41 @@ var Geocoder = (function (exports) {
|
|
|
1422
1499
|
}
|
|
1423
1500
|
return body;
|
|
1424
1501
|
});
|
|
1425
|
-
if (cacheEngine
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1502
|
+
if (cacheEngine) {
|
|
1503
|
+
if (((_c = opt.method) == null ? void 0 : _c.toUpperCase()) === "GET") {
|
|
1504
|
+
if (cache !== false) {
|
|
1505
|
+
const props = cacheProps ? cacheProps : __spreadValues$6({}, objectRemoveEmpty({
|
|
1506
|
+
withCredentials,
|
|
1507
|
+
responseType
|
|
1508
|
+
}));
|
|
1509
|
+
return cacheEngine.add(cacheName || url, makeRequest, {
|
|
1510
|
+
props,
|
|
1511
|
+
expirationTime: cache ? void 0 : 500
|
|
1512
|
+
});
|
|
1513
|
+
}
|
|
1514
|
+
} else {
|
|
1515
|
+
cacheEngine.clean();
|
|
1516
|
+
}
|
|
1434
1517
|
}
|
|
1435
1518
|
return makeRequest();
|
|
1436
1519
|
});
|
|
1437
1520
|
}
|
|
1438
1521
|
|
|
1439
|
-
var __defProp$
|
|
1522
|
+
var __defProp$7 = Object.defineProperty;
|
|
1440
1523
|
var __defProps$4 = Object.defineProperties;
|
|
1441
1524
|
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
1442
|
-
var __getOwnPropSymbols$
|
|
1443
|
-
var __hasOwnProp$
|
|
1444
|
-
var __propIsEnum$
|
|
1445
|
-
var __defNormalProp$
|
|
1446
|
-
var __spreadValues$
|
|
1525
|
+
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
1526
|
+
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
1527
|
+
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
1528
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1529
|
+
var __spreadValues$5 = (a, b) => {
|
|
1447
1530
|
for (var prop in b || (b = {}))
|
|
1448
|
-
if (__hasOwnProp$
|
|
1449
|
-
__defNormalProp$
|
|
1450
|
-
if (__getOwnPropSymbols$
|
|
1451
|
-
for (var prop of __getOwnPropSymbols$
|
|
1452
|
-
if (__propIsEnum$
|
|
1453
|
-
__defNormalProp$
|
|
1531
|
+
if (__hasOwnProp$5.call(b, prop))
|
|
1532
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
1533
|
+
if (__getOwnPropSymbols$5)
|
|
1534
|
+
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
1535
|
+
if (__propIsEnum$5.call(b, prop))
|
|
1536
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
1454
1537
|
}
|
|
1455
1538
|
return a;
|
|
1456
1539
|
};
|
|
@@ -1458,16 +1541,16 @@ var Geocoder = (function (exports) {
|
|
|
1458
1541
|
var __objRest$1 = (source, exclude) => {
|
|
1459
1542
|
var target = {};
|
|
1460
1543
|
for (var prop in source)
|
|
1461
|
-
if (__hasOwnProp$
|
|
1544
|
+
if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1462
1545
|
target[prop] = source[prop];
|
|
1463
|
-
if (source != null && __getOwnPropSymbols$
|
|
1464
|
-
for (var prop of __getOwnPropSymbols$
|
|
1465
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
1546
|
+
if (source != null && __getOwnPropSymbols$5)
|
|
1547
|
+
for (var prop of __getOwnPropSymbols$5(source)) {
|
|
1548
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
|
|
1466
1549
|
target[prop] = source[prop];
|
|
1467
1550
|
}
|
|
1468
1551
|
return target;
|
|
1469
1552
|
};
|
|
1470
|
-
var __async$
|
|
1553
|
+
var __async$4 = (__this, __arguments, generator) => {
|
|
1471
1554
|
return new Promise((resolve, reject) => {
|
|
1472
1555
|
var fulfilled = (value) => {
|
|
1473
1556
|
try {
|
|
@@ -1518,7 +1601,7 @@ var Geocoder = (function (exports) {
|
|
|
1518
1601
|
}
|
|
1519
1602
|
function route(name, connector, ...rest) {
|
|
1520
1603
|
const result = {
|
|
1521
|
-
url: (opt) => __async$
|
|
1604
|
+
url: (opt) => __async$4(this, null, function* () {
|
|
1522
1605
|
var _a;
|
|
1523
1606
|
const routeData = yield connector.connect();
|
|
1524
1607
|
const template = routeURL(
|
|
@@ -1532,27 +1615,32 @@ var Geocoder = (function (exports) {
|
|
|
1532
1615
|
};
|
|
1533
1616
|
const methods = ["get", "post", "put", "delete", "patch"];
|
|
1534
1617
|
for (const method of methods) {
|
|
1535
|
-
const methodResp = (requestOptions) =>
|
|
1618
|
+
const methodResp = (requestOptions) => {
|
|
1536
1619
|
var _b;
|
|
1537
1620
|
const _a = requestOptions || {}, { headers: optHeaders } = _a, restOpt = __objRest$1(_a, ["headers"]);
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1621
|
+
if ((_b = requestOptions == null ? void 0 : requestOptions.signal) == null ? void 0 : _b.aborted) {
|
|
1622
|
+
throw new AbortError();
|
|
1623
|
+
}
|
|
1624
|
+
return connector.connect().then((routeData) => {
|
|
1625
|
+
var _a2;
|
|
1626
|
+
const template = routeURL(
|
|
1627
|
+
name,
|
|
1628
|
+
(_a2 = connector.options.baseUrl) != null ? _a2 : "",
|
|
1629
|
+
routeData,
|
|
1630
|
+
...rest
|
|
1631
|
+
);
|
|
1632
|
+
const headers = objectRemoveEmpty(__spreadValues$5(__spreadValues$5({}, connector.getAuthorizationHeaders()), optHeaders != null ? optHeaders : {}));
|
|
1633
|
+
return request(
|
|
1634
|
+
template,
|
|
1635
|
+
__spreadProps$4(__spreadValues$5({
|
|
1636
|
+
headers
|
|
1637
|
+
}, restOpt), {
|
|
1638
|
+
method
|
|
1639
|
+
}),
|
|
1640
|
+
connector.cache
|
|
1641
|
+
);
|
|
1642
|
+
});
|
|
1643
|
+
};
|
|
1556
1644
|
result[method] = methodResp;
|
|
1557
1645
|
}
|
|
1558
1646
|
return result;
|
|
@@ -1574,7 +1662,7 @@ var Geocoder = (function (exports) {
|
|
|
1574
1662
|
const getResponseText = () => {
|
|
1575
1663
|
try {
|
|
1576
1664
|
return JSON.parse(xhr.responseText);
|
|
1577
|
-
} catch (
|
|
1665
|
+
} catch (e) {
|
|
1578
1666
|
return xhr.responseText;
|
|
1579
1667
|
}
|
|
1580
1668
|
};
|
|
@@ -1644,34 +1732,45 @@ var Geocoder = (function (exports) {
|
|
|
1644
1732
|
};
|
|
1645
1733
|
}
|
|
1646
1734
|
|
|
1647
|
-
const
|
|
1648
|
-
function
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1735
|
+
const CONNECTORS = [];
|
|
1736
|
+
function addConnector(connector) {
|
|
1737
|
+
CONNECTORS.push(connector);
|
|
1738
|
+
}
|
|
1739
|
+
function findConnector(options) {
|
|
1740
|
+
return CONNECTORS.find((x) => {
|
|
1741
|
+
if (x.options.baseUrl === options.baseUrl) {
|
|
1742
|
+
if (options.auth) {
|
|
1743
|
+
if (x.options.auth) {
|
|
1744
|
+
return objectDeepEqual(x.options.auth, options.auth);
|
|
1745
|
+
}
|
|
1746
|
+
} else {
|
|
1747
|
+
return true;
|
|
1748
|
+
}
|
|
1655
1749
|
}
|
|
1656
|
-
return value;
|
|
1657
1750
|
});
|
|
1658
1751
|
}
|
|
1752
|
+
function removeConnector(connector) {
|
|
1753
|
+
const index = CONNECTORS.indexOf(connector);
|
|
1754
|
+
if (index !== -1) {
|
|
1755
|
+
CONNECTORS.splice(index, 1);
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1659
1758
|
|
|
1660
|
-
var __defProp$
|
|
1759
|
+
var __defProp$6 = Object.defineProperty;
|
|
1661
1760
|
var __defProps$3 = Object.defineProperties;
|
|
1662
1761
|
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
1663
|
-
var __getOwnPropSymbols$
|
|
1664
|
-
var __hasOwnProp$
|
|
1665
|
-
var __propIsEnum$
|
|
1666
|
-
var __defNormalProp$
|
|
1667
|
-
var __spreadValues$
|
|
1762
|
+
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
1763
|
+
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
1764
|
+
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
1765
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1766
|
+
var __spreadValues$4 = (a, b) => {
|
|
1668
1767
|
for (var prop in b || (b = {}))
|
|
1669
|
-
if (__hasOwnProp$
|
|
1670
|
-
__defNormalProp$
|
|
1671
|
-
if (__getOwnPropSymbols$
|
|
1672
|
-
for (var prop of __getOwnPropSymbols$
|
|
1673
|
-
if (__propIsEnum$
|
|
1674
|
-
__defNormalProp$
|
|
1768
|
+
if (__hasOwnProp$4.call(b, prop))
|
|
1769
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
1770
|
+
if (__getOwnPropSymbols$4)
|
|
1771
|
+
for (var prop of __getOwnPropSymbols$4(b)) {
|
|
1772
|
+
if (__propIsEnum$4.call(b, prop))
|
|
1773
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
1675
1774
|
}
|
|
1676
1775
|
return a;
|
|
1677
1776
|
};
|
|
@@ -1679,17 +1778,17 @@ var Geocoder = (function (exports) {
|
|
|
1679
1778
|
var __objRest = (source, exclude) => {
|
|
1680
1779
|
var target = {};
|
|
1681
1780
|
for (var prop in source)
|
|
1682
|
-
if (__hasOwnProp$
|
|
1781
|
+
if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1683
1782
|
target[prop] = source[prop];
|
|
1684
|
-
if (source != null && __getOwnPropSymbols$
|
|
1685
|
-
for (var prop of __getOwnPropSymbols$
|
|
1686
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
1783
|
+
if (source != null && __getOwnPropSymbols$4)
|
|
1784
|
+
for (var prop of __getOwnPropSymbols$4(source)) {
|
|
1785
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
|
|
1687
1786
|
target[prop] = source[prop];
|
|
1688
1787
|
}
|
|
1689
1788
|
return target;
|
|
1690
1789
|
};
|
|
1691
|
-
var __publicField$4 = (obj, key, value) => __defNormalProp$
|
|
1692
|
-
var __async$
|
|
1790
|
+
var __publicField$4 = (obj, key, value) => __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1791
|
+
var __async$3 = (__this, __arguments, generator) => {
|
|
1693
1792
|
return new Promise((resolve, reject) => {
|
|
1694
1793
|
var fulfilled = (value) => {
|
|
1695
1794
|
try {
|
|
@@ -1774,7 +1873,9 @@ var Geocoder = (function (exports) {
|
|
|
1774
1873
|
* ```
|
|
1775
1874
|
*/
|
|
1776
1875
|
connect() {
|
|
1777
|
-
return __async$
|
|
1876
|
+
return __async$3(this, arguments, function* ({
|
|
1877
|
+
signal
|
|
1878
|
+
} = {}) {
|
|
1778
1879
|
const auth = this.options.auth;
|
|
1779
1880
|
if (auth) {
|
|
1780
1881
|
const { login, password } = auth;
|
|
@@ -1783,11 +1884,12 @@ var Geocoder = (function (exports) {
|
|
|
1783
1884
|
}
|
|
1784
1885
|
}
|
|
1785
1886
|
const routeUrl = `${this.routeStr}?client=${this.client}`;
|
|
1786
|
-
return
|
|
1887
|
+
return this.makeQuery(
|
|
1787
1888
|
routeUrl,
|
|
1788
1889
|
{},
|
|
1789
1890
|
{
|
|
1790
1891
|
cacheName: "route",
|
|
1892
|
+
signal,
|
|
1791
1893
|
cache: true,
|
|
1792
1894
|
cacheProps: {
|
|
1793
1895
|
id: this.id,
|
|
@@ -1819,14 +1921,14 @@ var Geocoder = (function (exports) {
|
|
|
1819
1921
|
this.emitter.emit("logout");
|
|
1820
1922
|
}
|
|
1821
1923
|
getUserInfo(credentials, options) {
|
|
1822
|
-
return __async$
|
|
1924
|
+
return __async$3(this, null, function* () {
|
|
1823
1925
|
if (this.user && this.user.id) {
|
|
1824
1926
|
return this.user;
|
|
1825
1927
|
}
|
|
1826
1928
|
if (credentials) {
|
|
1827
1929
|
this.options.auth = credentials;
|
|
1828
1930
|
}
|
|
1829
|
-
const options_ = __spreadValues$
|
|
1931
|
+
const options_ = __spreadValues$4({
|
|
1830
1932
|
headers: this.getAuthorizationHeaders(credentials),
|
|
1831
1933
|
cache: true
|
|
1832
1934
|
}, options);
|
|
@@ -1867,7 +1969,7 @@ var Geocoder = (function (exports) {
|
|
|
1867
1969
|
this.activeRequests = {};
|
|
1868
1970
|
}
|
|
1869
1971
|
getActiveApiRequests() {
|
|
1870
|
-
return __spreadValues$
|
|
1972
|
+
return __spreadValues$4({}, this.activeRequests);
|
|
1871
1973
|
}
|
|
1872
1974
|
route(name, ...rest) {
|
|
1873
1975
|
return route(name, this, ...rest);
|
|
@@ -1879,7 +1981,7 @@ var Geocoder = (function (exports) {
|
|
|
1879
1981
|
* @param options - Request options
|
|
1880
1982
|
*/
|
|
1881
1983
|
makeQuery(_0, _1) {
|
|
1882
|
-
return __async$
|
|
1984
|
+
return __async$3(this, arguments, function* (url, params, options = {}) {
|
|
1883
1985
|
var _b;
|
|
1884
1986
|
url = (this.options.baseUrl ? this.options.baseUrl : "") + url;
|
|
1885
1987
|
if (!url) {
|
|
@@ -1890,7 +1992,7 @@ var Geocoder = (function (exports) {
|
|
|
1890
1992
|
url = template(url, restParams);
|
|
1891
1993
|
}
|
|
1892
1994
|
url = encodeURI(fixUrlStr(url));
|
|
1893
|
-
options = __spreadValues$
|
|
1995
|
+
options = __spreadValues$4({ withCredentials: this.withCredentials }, options);
|
|
1894
1996
|
const {
|
|
1895
1997
|
cache,
|
|
1896
1998
|
signal: externalSignal,
|
|
@@ -1912,7 +2014,7 @@ var Geocoder = (function (exports) {
|
|
|
1912
2014
|
});
|
|
1913
2015
|
}
|
|
1914
2016
|
options.signal = internalSignal;
|
|
1915
|
-
const createPromise = () => __async$
|
|
2017
|
+
const createPromise = () => __async$3(this, null, function* () {
|
|
1916
2018
|
const id = REQUEST_ID++;
|
|
1917
2019
|
this.activeRequests[id] = internalAbortController;
|
|
1918
2020
|
try {
|
|
@@ -1922,7 +2024,7 @@ var Geocoder = (function (exports) {
|
|
|
1922
2024
|
}
|
|
1923
2025
|
});
|
|
1924
2026
|
if (method === "GET") {
|
|
1925
|
-
const cacheOptions = cacheProps ? cacheProps : __spreadProps$3(__spreadValues$
|
|
2027
|
+
const cacheOptions = cacheProps ? cacheProps : __spreadProps$3(__spreadValues$4({}, objectRemoveEmpty({
|
|
1926
2028
|
headers,
|
|
1927
2029
|
withCredentials,
|
|
1928
2030
|
responseType,
|
|
@@ -1945,7 +2047,7 @@ var Geocoder = (function (exports) {
|
|
|
1945
2047
|
var _a;
|
|
1946
2048
|
if (this.user) {
|
|
1947
2049
|
options = options || {};
|
|
1948
|
-
options.headers = __spreadValues$
|
|
2050
|
+
options.headers = __spreadValues$4(__spreadValues$4({}, this.getAuthorizationHeaders()), options.headers);
|
|
1949
2051
|
}
|
|
1950
2052
|
if (this.requestTransform) {
|
|
1951
2053
|
const [transUrl, transOptions] = this.requestTransform(url, options);
|
|
@@ -1976,7 +2078,7 @@ var Geocoder = (function (exports) {
|
|
|
1976
2078
|
});
|
|
1977
2079
|
}
|
|
1978
2080
|
_login(credentials, options) {
|
|
1979
|
-
return __async$
|
|
2081
|
+
return __async$3(this, null, function* () {
|
|
1980
2082
|
try {
|
|
1981
2083
|
const data = yield this.getUserInfo(credentials, options);
|
|
1982
2084
|
this.user = data;
|
|
@@ -2034,27 +2136,27 @@ var Geocoder = (function (exports) {
|
|
|
2034
2136
|
return query;
|
|
2035
2137
|
}
|
|
2036
2138
|
|
|
2037
|
-
var __defProp$
|
|
2139
|
+
var __defProp$5 = Object.defineProperty;
|
|
2038
2140
|
var __defProps$2 = Object.defineProperties;
|
|
2039
2141
|
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
2040
|
-
var __getOwnPropSymbols$
|
|
2041
|
-
var __hasOwnProp$
|
|
2042
|
-
var __propIsEnum$
|
|
2043
|
-
var __defNormalProp$
|
|
2044
|
-
var __spreadValues$
|
|
2142
|
+
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
2143
|
+
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
2144
|
+
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
2145
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2146
|
+
var __spreadValues$3 = (a, b) => {
|
|
2045
2147
|
for (var prop in b || (b = {}))
|
|
2046
|
-
if (__hasOwnProp$
|
|
2047
|
-
__defNormalProp$
|
|
2048
|
-
if (__getOwnPropSymbols$
|
|
2049
|
-
for (var prop of __getOwnPropSymbols$
|
|
2050
|
-
if (__propIsEnum$
|
|
2051
|
-
__defNormalProp$
|
|
2148
|
+
if (__hasOwnProp$3.call(b, prop))
|
|
2149
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
2150
|
+
if (__getOwnPropSymbols$3)
|
|
2151
|
+
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
2152
|
+
if (__propIsEnum$3.call(b, prop))
|
|
2153
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
2052
2154
|
}
|
|
2053
2155
|
return a;
|
|
2054
2156
|
};
|
|
2055
2157
|
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
2056
|
-
var __publicField$3 = (obj, key, value) => __defNormalProp$
|
|
2057
|
-
var __async$
|
|
2158
|
+
var __publicField$3 = (obj, key, value) => __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2159
|
+
var __async$2 = (__this, __arguments, generator) => {
|
|
2058
2160
|
return new Promise((resolve, reject) => {
|
|
2059
2161
|
var fulfilled = (value) => {
|
|
2060
2162
|
try {
|
|
@@ -2095,7 +2197,7 @@ var Geocoder = (function (exports) {
|
|
|
2095
2197
|
* Fetching resource would be cached to speed up next call
|
|
2096
2198
|
*/
|
|
2097
2199
|
getOne(resource, requestOptions) {
|
|
2098
|
-
const opt = __spreadValues$
|
|
2200
|
+
const opt = __spreadValues$3({}, requestOptions);
|
|
2099
2201
|
if (typeof resource === "string") ; else if (typeof resource === "number") ; else if (isObject(resource)) {
|
|
2100
2202
|
if (resource.id !== void 0) {
|
|
2101
2203
|
resource.id;
|
|
@@ -2172,8 +2274,8 @@ var Geocoder = (function (exports) {
|
|
|
2172
2274
|
} else {
|
|
2173
2275
|
Object.assign(query, resourceToQuery(resource));
|
|
2174
2276
|
}
|
|
2175
|
-
return this.connector.route("resource.search").get(__spreadProps$2(__spreadValues$
|
|
2176
|
-
query: __spreadValues$
|
|
2277
|
+
return this.connector.route("resource.search").get(__spreadProps$2(__spreadValues$3({}, requestOptions), {
|
|
2278
|
+
query: __spreadValues$3({
|
|
2177
2279
|
serialization: "full"
|
|
2178
2280
|
}, query)
|
|
2179
2281
|
})).then((resources) => {
|
|
@@ -2226,7 +2328,7 @@ var Geocoder = (function (exports) {
|
|
|
2226
2328
|
});
|
|
2227
2329
|
}
|
|
2228
2330
|
_getChildrenOf(_0, _1) {
|
|
2229
|
-
return __async$
|
|
2331
|
+
return __async$2(this, arguments, function* (parentDef, requestOptions, _items = []) {
|
|
2230
2332
|
let parent = void 0;
|
|
2231
2333
|
if (typeof parentDef === "string") {
|
|
2232
2334
|
parent = yield this.getId(parentDef, requestOptions);
|
|
@@ -2235,7 +2337,7 @@ var Geocoder = (function (exports) {
|
|
|
2235
2337
|
} else {
|
|
2236
2338
|
parent = parentDef;
|
|
2237
2339
|
}
|
|
2238
|
-
const items = yield this.connector.route("resource.collection").get(__spreadProps$2(__spreadValues$
|
|
2340
|
+
const items = yield this.connector.route("resource.collection").get(__spreadProps$2(__spreadValues$3({}, requestOptions), {
|
|
2239
2341
|
query: {
|
|
2240
2342
|
parent
|
|
2241
2343
|
}
|
|
@@ -2263,7 +2365,7 @@ var Geocoder = (function (exports) {
|
|
|
2263
2365
|
});
|
|
2264
2366
|
}
|
|
2265
2367
|
_cleanResourceItemCache(id) {
|
|
2266
|
-
return __async$
|
|
2368
|
+
return __async$2(this, null, function* () {
|
|
2267
2369
|
var _a;
|
|
2268
2370
|
const all = this.cache.all();
|
|
2269
2371
|
const toDelete = [];
|
|
@@ -2316,93 +2418,6 @@ var Geocoder = (function (exports) {
|
|
|
2316
2418
|
}
|
|
2317
2419
|
}
|
|
2318
2420
|
|
|
2319
|
-
var __defProp$5 = Object.defineProperty;
|
|
2320
|
-
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
2321
|
-
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
2322
|
-
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
2323
|
-
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2324
|
-
var __spreadValues$3 = (a, b) => {
|
|
2325
|
-
for (var prop in b || (b = {}))
|
|
2326
|
-
if (__hasOwnProp$3.call(b, prop))
|
|
2327
|
-
__defNormalProp$5(a, prop, b[prop]);
|
|
2328
|
-
if (__getOwnPropSymbols$3)
|
|
2329
|
-
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
2330
|
-
if (__propIsEnum$3.call(b, prop))
|
|
2331
|
-
__defNormalProp$5(a, prop, b[prop]);
|
|
2332
|
-
}
|
|
2333
|
-
return a;
|
|
2334
|
-
};
|
|
2335
|
-
var __async$2 = (__this, __arguments, generator) => {
|
|
2336
|
-
return new Promise((resolve, reject) => {
|
|
2337
|
-
var fulfilled = (value) => {
|
|
2338
|
-
try {
|
|
2339
|
-
step(generator.next(value));
|
|
2340
|
-
} catch (e) {
|
|
2341
|
-
reject(e);
|
|
2342
|
-
}
|
|
2343
|
-
};
|
|
2344
|
-
var rejected = (value) => {
|
|
2345
|
-
try {
|
|
2346
|
-
step(generator.throw(value));
|
|
2347
|
-
} catch (e) {
|
|
2348
|
-
reject(e);
|
|
2349
|
-
}
|
|
2350
|
-
};
|
|
2351
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
2352
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
2353
|
-
});
|
|
2354
|
-
};
|
|
2355
|
-
function apiRequest(opt) {
|
|
2356
|
-
return __async$2(this, null, function* () {
|
|
2357
|
-
const { params, name, connector, requestOptions } = opt;
|
|
2358
|
-
const apiItems = yield connector.connect();
|
|
2359
|
-
let apiItem = apiItems && apiItems[name];
|
|
2360
|
-
if (apiItem) {
|
|
2361
|
-
apiItem = [...apiItem];
|
|
2362
|
-
let url = apiItem.shift();
|
|
2363
|
-
if (apiItem.length) {
|
|
2364
|
-
const replaceParams = {};
|
|
2365
|
-
for (let fry = 0; fry < apiItem.length; fry++) {
|
|
2366
|
-
const arg = apiItem[fry];
|
|
2367
|
-
replaceParams[fry] = `{${arg}}`;
|
|
2368
|
-
if (params[arg] === void 0) {
|
|
2369
|
-
throw new Error(`\`${arg}\` URL API argument is not specified`);
|
|
2370
|
-
}
|
|
2371
|
-
}
|
|
2372
|
-
if (url) {
|
|
2373
|
-
url = template(url, replaceParams);
|
|
2374
|
-
}
|
|
2375
|
-
}
|
|
2376
|
-
if (params) {
|
|
2377
|
-
const paramArray = [];
|
|
2378
|
-
const paramList = params.paramList;
|
|
2379
|
-
if (Array.isArray(paramList)) {
|
|
2380
|
-
paramList.forEach(([key, value]) => {
|
|
2381
|
-
paramArray.push(`${key}=${value}`);
|
|
2382
|
-
});
|
|
2383
|
-
}
|
|
2384
|
-
for (const p in params) {
|
|
2385
|
-
if (apiItem.indexOf(p) === -1) {
|
|
2386
|
-
paramArray.push(`${p}=${params[p]}`);
|
|
2387
|
-
}
|
|
2388
|
-
}
|
|
2389
|
-
if (paramArray.length) {
|
|
2390
|
-
url = `${url}?${paramArray.join("&")}`;
|
|
2391
|
-
}
|
|
2392
|
-
}
|
|
2393
|
-
if (url) {
|
|
2394
|
-
return connector.makeQuery(url, params, __spreadValues$3({
|
|
2395
|
-
cacheName: name
|
|
2396
|
-
}, requestOptions));
|
|
2397
|
-
} else {
|
|
2398
|
-
throw new Error("Request URL is not set");
|
|
2399
|
-
}
|
|
2400
|
-
} else {
|
|
2401
|
-
return void 0;
|
|
2402
|
-
}
|
|
2403
|
-
});
|
|
2404
|
-
}
|
|
2405
|
-
|
|
2406
2421
|
var __defProp$4 = Object.defineProperty;
|
|
2407
2422
|
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2408
2423
|
var __publicField$2 = (obj, key, value) => __defNormalProp$4(obj, key + "" , value);
|