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