@nextgis/ngw-connector 1.11.3 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,49 +1,145 @@
1
- /** Bundle of @nextgis/ngw-connector; version: 1.11.3; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-connector; version: 1.12.0; author: NextGIS */
2
2
  import { EventEmitter } from 'events';
3
3
  import CancelablePromise from '@nextgis/cancelable-promise';
4
4
  import { objectDeepEqual, defined, objectRemoveEmpty, fixUrlStr } from '@nextgis/utils';
5
5
  import Cache from '@nextgis/cache';
6
6
 
7
+ /*! *****************************************************************************
8
+ Copyright (c) Microsoft Corporation.
9
+
10
+ Permission to use, copy, modify, and/or distribute this software for any
11
+ purpose with or without fee is hereby granted.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
+ PERFORMANCE OF THIS SOFTWARE.
20
+ ***************************************************************************** */
21
+ /* global Reflect, Promise */
22
+
23
+ var extendStatics = function(d, b) {
24
+ extendStatics = Object.setPrototypeOf ||
25
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
26
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
27
+ return extendStatics(d, b);
28
+ };
29
+
30
+ function __extends(d, b) {
31
+ if (typeof b !== "function" && b !== null)
32
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
33
+ extendStatics(d, b);
34
+ function __() { this.constructor = d; }
35
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
36
+ }
37
+
38
+ var __assign = function() {
39
+ __assign = Object.assign || function __assign(t) {
40
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
41
+ s = arguments[i];
42
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
43
+ }
44
+ return t;
45
+ };
46
+ return __assign.apply(this, arguments);
47
+ };
48
+
49
+ function __awaiter(thisArg, _arguments, P, generator) {
50
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
51
+ return new (P || (P = Promise))(function (resolve, reject) {
52
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
53
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
54
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
55
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
56
+ });
57
+ }
58
+
59
+ function __generator(thisArg, body) {
60
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
61
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
62
+ function verb(n) { return function (v) { return step([n, v]); }; }
63
+ function step(op) {
64
+ if (f) throw new TypeError("Generator is already executing.");
65
+ while (_) try {
66
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
67
+ if (y = 0, t) op = [op[0] & 2, t.value];
68
+ switch (op[0]) {
69
+ case 0: case 1: t = op; break;
70
+ case 4: _.label++; return { value: op[1], done: false };
71
+ case 5: _.label++; y = op[1]; op = [0]; continue;
72
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
73
+ default:
74
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
75
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
76
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
77
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
78
+ if (t[2]) _.ops.pop();
79
+ _.trys.pop(); continue;
80
+ }
81
+ op = body.call(thisArg, _);
82
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
83
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
84
+ }
85
+ }
86
+
87
+ function __spreadArray(to, from, pack) {
88
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
89
+ if (ar || !(i in from)) {
90
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
91
+ ar[i] = from[i];
92
+ }
93
+ }
94
+ return to.concat(ar || Array.prototype.slice.call(from));
95
+ }
96
+
7
97
  /**
8
98
  * Thrown when...
9
99
  */
10
- class NgwError extends Error {
11
- constructor(er) {
12
- super();
13
- this.name = 'NgwError';
14
- Object.assign(this, er);
15
- Object.setPrototypeOf(this, NgwError.prototype);
100
+ var NgwError = /** @class */ (function (_super) {
101
+ __extends(NgwError, _super);
102
+ function NgwError(er) {
103
+ var _this = _super.call(this) || this;
104
+ _this.name = 'NgwError';
105
+ Object.assign(_this, er);
106
+ Object.setPrototypeOf(_this, NgwError.prototype);
107
+ return _this;
16
108
  }
17
- }
109
+ return NgwError;
110
+ }(Error));
18
111
 
19
112
  /**
20
113
  * Thrown when...
21
114
  */
22
- class NetworkError extends Error {
23
- constructor(url) {
24
- super();
25
- this.name = 'NetworkError';
26
- Object.setPrototypeOf(this, NetworkError.prototype);
27
- this.message = `Unable to request ${url}.
28
- Possibly invalid NGW URL entered or CORS not configured to get request from ${location.origin}`; // /control-panel/cors
115
+ var NetworkError = /** @class */ (function (_super) {
116
+ __extends(NetworkError, _super);
117
+ function NetworkError(url) {
118
+ var _this = _super.call(this) || this;
119
+ _this.name = 'NetworkError';
120
+ Object.setPrototypeOf(_this, NetworkError.prototype);
121
+ _this.message = "Unable to request ".concat(url, ".\n Possibly invalid NGW URL entered or CORS not configured to get request from ").concat(location.origin); // /control-panel/cors
122
+ return _this;
29
123
  }
30
- }
124
+ return NetworkError;
125
+ }(Error));
31
126
 
32
127
  function isObject(val) {
33
128
  return Object.prototype.toString.call(val) === '[object Object]';
34
129
  }
35
130
 
36
- let loadData;
131
+ var loadData;
37
132
  // @ts-ignore
38
133
  {
39
- loadData = (url, callback, options = {}, error, onCancel) => {
134
+ loadData = function (url, callback, options, error, onCancel) {
135
+ if (options === void 0) { options = {}; }
40
136
  options.method = options.method || 'GET';
41
- const xhr = new XMLHttpRequest();
137
+ var xhr = new XMLHttpRequest();
42
138
  xhr.open(options.method || 'GET', url, true); // true for asynchronous
43
139
  if (options.responseType === 'blob') {
44
140
  xhr.responseType = options.responseType;
45
141
  }
46
- const getResponseText = () => {
142
+ var getResponseText = function () {
47
143
  try {
48
144
  return JSON.parse(xhr.responseText);
49
145
  }
@@ -51,8 +147,9 @@ let loadData;
51
147
  return xhr.responseText;
52
148
  }
53
149
  };
54
- const processingResponse = (forError = false) => {
55
- const cb = forError ? error : callback;
150
+ var processingResponse = function (forError) {
151
+ if (forError === void 0) { forError = false; }
152
+ var cb = forError ? error : callback;
56
153
  if (options.responseType === 'blob') {
57
154
  cb(xhr.response);
58
155
  }
@@ -65,7 +162,7 @@ let loadData;
65
162
  }
66
163
  }
67
164
  };
68
- xhr.onload = () => {
165
+ xhr.onload = function () {
69
166
  if ([401, 403, 404, 422, 500].indexOf(xhr.status) !== -1) {
70
167
  error(new NgwError(getResponseText()));
71
168
  }
@@ -87,7 +184,7 @@ let loadData;
87
184
  // error('request error');
88
185
  // }
89
186
  // };
90
- xhr.onerror = (er) => {
187
+ xhr.onerror = function (er) {
91
188
  if (xhr.status === 0) {
92
189
  error(new NetworkError(url));
93
190
  }
@@ -97,17 +194,17 @@ let loadData;
97
194
  };
98
195
  xhr.upload.onprogress = function (e) {
99
196
  if (e.lengthComputable) {
100
- const percentComplete = (e.loaded / e.total) * 100;
197
+ var percentComplete = (e.loaded / e.total) * 100;
101
198
  if (options.onProgress) {
102
199
  options.onProgress(percentComplete, e);
103
200
  }
104
201
  // console.log(percentComplete + '% uploaded');
105
202
  }
106
203
  };
107
- const headers = options.headers;
204
+ var headers = options.headers;
108
205
  if (headers) {
109
- for (const h in headers) {
110
- const header = headers[h];
206
+ for (var h in headers) {
207
+ var header = headers[h];
111
208
  if (typeof header === 'string') {
112
209
  xhr.setRequestHeader(h, header);
113
210
  }
@@ -116,12 +213,12 @@ let loadData;
116
213
  if (options.withCredentials !== undefined) {
117
214
  xhr.withCredentials = options.withCredentials;
118
215
  }
119
- let data;
216
+ var data;
120
217
  if (options.file) {
121
218
  data = new FormData();
122
219
  data.append('file', options.file);
123
220
  if (options.data) {
124
- for (const d in options.data) {
221
+ for (var d in options.data) {
125
222
  data.append(d, data[d]);
126
223
  }
127
224
  }
@@ -134,7 +231,7 @@ let loadData;
134
231
  : null;
135
232
  }
136
233
  if (onCancel) {
137
- onCancel(() => {
234
+ onCancel(function () {
138
235
  xhr.abort();
139
236
  });
140
237
  }
@@ -143,10 +240,10 @@ let loadData;
143
240
  }
144
241
 
145
242
  // https://github.com/Leaflet/Leaflet/blob/b507e21c510b53cd704fb8d3f89bb46ea925c8eb/src/core/Util.js#L165
146
- const templateRe = /\{ *([\w_-]+) *\}/g;
243
+ var templateRe = /\{ *([\w_-]+) *\}/g;
147
244
  function template(str, data) {
148
- return str.replace(templateRe, (s, key) => {
149
- let value = data[key];
245
+ return str.replace(templateRe, function (s, key) {
246
+ var value = data[key];
150
247
  if (value === undefined) {
151
248
  throw new Error('No value provided for letiable ' + s);
152
249
  }
@@ -160,33 +257,39 @@ function template(str, data) {
160
257
  /**
161
258
  * Thrown when ...
162
259
  */
163
- class ResourceNotFoundError extends NgwError {
164
- constructor(obj) {
165
- super(obj);
166
- this.name = 'ResourceNotFoundError';
167
- this.exception = 'nextgisweb.resource.exception.ResourceNotFound';
168
- Object.setPrototypeOf(this, ResourceNotFoundError.prototype);
260
+ var ResourceNotFoundError = /** @class */ (function (_super) {
261
+ __extends(ResourceNotFoundError, _super);
262
+ function ResourceNotFoundError(obj) {
263
+ var _this = _super.call(this, obj) || this;
264
+ _this.name = 'ResourceNotFoundError';
265
+ _this.exception = 'nextgisweb.resource.exception.ResourceNotFound';
266
+ Object.setPrototypeOf(_this, ResourceNotFoundError.prototype);
267
+ return _this;
169
268
  }
170
- }
269
+ return ResourceNotFoundError;
270
+ }(NgwError));
171
271
 
172
272
  /**
173
273
  * Thrown when ...
174
274
  */
175
- class InsufficientPermissionsError extends NgwError {
176
- constructor(obj) {
177
- super(obj);
178
- this.name = 'InsufficientPermissionsError';
179
- this.exception = 'nextgisweb.core.exception.InsufficientPermissions';
180
- Object.setPrototypeOf(this, InsufficientPermissionsError.prototype);
275
+ var InsufficientPermissionsError = /** @class */ (function (_super) {
276
+ __extends(InsufficientPermissionsError, _super);
277
+ function InsufficientPermissionsError(obj) {
278
+ var _this = _super.call(this, obj) || this;
279
+ _this.name = 'InsufficientPermissionsError';
280
+ _this.exception = 'nextgisweb.core.exception.InsufficientPermissions';
281
+ Object.setPrototypeOf(_this, InsufficientPermissionsError.prototype);
282
+ return _this;
181
283
  }
182
- }
284
+ return InsufficientPermissionsError;
285
+ }(NgwError));
183
286
 
184
- const CONNECTORS = [];
287
+ var CONNECTORS = [];
185
288
  function addConnector(connector) {
186
289
  CONNECTORS.push(connector);
187
290
  }
188
291
  function findConnector(options) {
189
- return CONNECTORS.find((x) => {
292
+ return CONNECTORS.find(function (x) {
190
293
  if (x.options.baseUrl === options.baseUrl) {
191
294
  if (options.auth) {
192
295
  if (x.options.auth) {
@@ -201,13 +304,13 @@ function findConnector(options) {
201
304
  });
202
305
  }
203
306
  function removeConnector(connector) {
204
- const index = CONNECTORS.indexOf(connector);
307
+ var index = CONNECTORS.indexOf(connector);
205
308
  if (index !== -1) {
206
309
  CONNECTORS.splice(index, 1);
207
310
  }
208
311
  }
209
312
 
210
- const exclude = ['description'];
313
+ var exclude = ['description'];
211
314
  /**
212
315
  * @remarks
213
316
  * https://docs.nextgis.ru/docs_ngweb_dev/doc/developer/resource.html#search-resources
@@ -218,14 +321,16 @@ const exclude = ['description'];
218
321
  *
219
322
  * @param resource - Any property from NGW resource item
220
323
  */
221
- function resourceToQuery(resource, prefix = '') {
324
+ function resourceToQuery(resource, prefix) {
325
+ if (prefix === void 0) { prefix = ''; }
222
326
  prefix = prefix ? prefix + '__' : '';
223
- const query = {};
224
- for (const [key, value] of Object.entries(resource)) {
327
+ var query = {};
328
+ for (var _i = 0, _a = Object.entries(resource); _i < _a.length; _i++) {
329
+ var _b = _a[_i], key = _b[0], value = _b[1];
225
330
  if (exclude.indexOf(key) === -1) {
226
331
  if (isObject(value)) {
227
332
  if (key === 'owner_user') {
228
- const children = resourceToQuery(value, key);
333
+ var children = resourceToQuery(value, key);
229
334
  Object.assign(query, children);
230
335
  }
231
336
  else if (key === 'parent' && 'id' in value) {
@@ -244,8 +349,8 @@ function resourceCompare(res1, res2) {
244
349
  return objectDeepEqual(res1, res2);
245
350
  }
246
351
 
247
- class ResourcesControl {
248
- constructor(connector) {
352
+ var ResourcesControl = /** @class */ (function () {
353
+ function ResourcesControl(connector) {
249
354
  this.connector = connector;
250
355
  this.cache = new Cache();
251
356
  }
@@ -259,10 +364,11 @@ class ResourcesControl {
259
364
  * @remarks
260
365
  * Fetching resource would be cached to speed up next call
261
366
  */
262
- getOne(resource, requestOptions) {
263
- const cache = new Cache();
264
- const forCache = {};
265
- const opt = { ...requestOptions, cache: false };
367
+ ResourcesControl.prototype.getOne = function (resource, requestOptions) {
368
+ var _this = this;
369
+ var cache = new Cache();
370
+ var forCache = {};
371
+ var opt = __assign(__assign({}, requestOptions), { cache: false });
266
372
  if (typeof resource === 'string') {
267
373
  forCache.keyname = resource;
268
374
  }
@@ -272,28 +378,28 @@ class ResourcesControl {
272
378
  else if (isObject(resource)) {
273
379
  forCache.id = resource.id;
274
380
  }
275
- const makeRequest = () => {
381
+ var makeRequest = function () {
276
382
  if (typeof resource === 'string') {
277
- return this._fetchResourceBy({ keyname: resource }, opt);
383
+ return _this._fetchResourceBy({ keyname: resource }, opt);
278
384
  }
279
385
  else if (typeof resource === 'number') {
280
- return this._fetchResourceById(resource, opt);
386
+ return _this._fetchResourceById(resource, opt);
281
387
  }
282
388
  else if (isObject(resource)) {
283
- return this._fetchResourceBy(resource, opt);
389
+ return _this._fetchResourceBy(resource, opt);
284
390
  }
285
391
  return CancelablePromise.resolve(undefined);
286
392
  };
287
393
  return cache.addFull('resource', makeRequest, forCache);
288
- }
289
- getOneOrFail(resource, requestOptions) {
290
- return this.getOne(resource, requestOptions).then((res) => {
394
+ };
395
+ ResourcesControl.prototype.getOneOrFail = function (resource, requestOptions) {
396
+ return this.getOne(resource, requestOptions).then(function (res) {
291
397
  if (res) {
292
398
  return res;
293
399
  }
294
400
  throw new ResourceNotFoundError();
295
401
  });
296
- }
402
+ };
297
403
  /**
298
404
  * A fast way to retrieve resource ID for any resource definition.
299
405
  * @param resource - Any available resource definition
@@ -304,19 +410,19 @@ class ResourcesControl {
304
410
  * then this method will come in handy to facilitate the extraction of the identifier
305
411
  * if the resource is specified through a keyname or other parameters.
306
412
  */
307
- getId(resource, requestOptions) {
413
+ ResourcesControl.prototype.getId = function (resource, requestOptions) {
308
414
  if (typeof resource === 'number') {
309
415
  return CancelablePromise.resolve(resource);
310
416
  }
311
417
  else if (typeof resource === 'string' || isObject(resource)) {
312
- return this.getOne(resource, requestOptions).then((res) => {
418
+ return this.getOne(resource, requestOptions).then(function (res) {
313
419
  if (res) {
314
420
  return res.resource.id;
315
421
  }
316
422
  });
317
423
  }
318
424
  return CancelablePromise.resolve(undefined);
319
- }
425
+ };
320
426
  /**
321
427
  * A fast way to retrieve resource ID for any resource definition.
322
428
  * @param resource - Any available resource definition
@@ -325,33 +431,32 @@ class ResourcesControl {
325
431
  * Similar with {@link NgwConnector.getResourceId | getResourceId} but rise error if resource is not exist.
326
432
  * To not make one more checks if the resource is definitely exists
327
433
  */
328
- getIdOrFail(resource, requestOptions) {
329
- return this.getId(resource, requestOptions).then((resp) => {
434
+ ResourcesControl.prototype.getIdOrFail = function (resource, requestOptions) {
435
+ return this.getId(resource, requestOptions).then(function (resp) {
330
436
  if (resp === undefined) {
331
437
  throw new Error();
332
438
  }
333
439
  return resp;
334
440
  });
335
- }
336
- getMany(resource, requestOptions) {
337
- return this._resourceCacheFilter(resource).then((items) => {
441
+ };
442
+ ResourcesControl.prototype.getMany = function (resource, requestOptions) {
443
+ var _this = this;
444
+ return this._resourceCacheFilter(resource).then(function (items) {
338
445
  if (!items.length) {
339
- const query = {};
446
+ var query = {};
340
447
  if (resource.keyname) {
341
448
  query.keyname = resource.keyname;
342
449
  }
343
450
  else {
344
451
  Object.assign(query, resourceToQuery(resource));
345
452
  }
346
- return this.connector
347
- .get('resource.search', requestOptions, {
348
- serialization: 'full',
349
- ...query,
350
- })
351
- .then((resources) => {
453
+ return _this.connector
454
+ .get('resource.search', requestOptions, __assign({ serialization: 'full' }, query))
455
+ .then(function (resources) {
352
456
  if (resources) {
353
- for (const x of resources) {
354
- this.cache.add('resource.item', CancelablePromise.resolve(x), {
457
+ for (var _i = 0, resources_1 = resources; _i < resources_1.length; _i++) {
458
+ var x = resources_1[_i];
459
+ _this.cache.add('resource.item', CancelablePromise.resolve(x), {
355
460
  id: x.resource.id,
356
461
  });
357
462
  }
@@ -361,97 +466,122 @@ class ResourcesControl {
361
466
  }
362
467
  return items;
363
468
  });
364
- }
365
- getParent(resource, requestOptions) {
366
- return this.getOne(resource, requestOptions).then((child) => {
469
+ };
470
+ ResourcesControl.prototype.getParent = function (resource, requestOptions) {
471
+ var _this = this;
472
+ return this.getOne(resource, requestOptions).then(function (child) {
367
473
  if (child) {
368
- return this.getOne(child.resource.parent.id, requestOptions);
474
+ return _this.getOne(child.resource.parent.id, requestOptions);
369
475
  }
370
476
  return CancelablePromise.resolve(undefined);
371
477
  });
372
- }
373
- getChildrenOf(resource, requestOptions) {
374
- return this.getId(resource).then((parent) => {
375
- return this.connector
376
- .get('resource.collection', { cache: true, ...requestOptions }, {
377
- parent,
478
+ };
479
+ ResourcesControl.prototype.getChildrenOf = function (resource, requestOptions) {
480
+ var _this = this;
481
+ return this.getId(resource).then(function (parent) {
482
+ return _this.connector
483
+ .get('resource.collection', __assign({ cache: true }, requestOptions), {
484
+ parent: parent,
378
485
  })
379
- .then((items) => {
380
- for (const i of items) {
381
- this.cache.add('resource.item', CancelablePromise.resolve(i), {
486
+ .then(function (items) {
487
+ for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
488
+ var i = items_1[_i];
489
+ _this.cache.add('resource.item', CancelablePromise.resolve(i), {
382
490
  id: i.resource.id,
383
491
  });
384
492
  }
385
493
  return items;
386
494
  });
387
495
  });
388
- }
389
- update(resource, data) {
390
- return this.getId(resource).then((id) => {
496
+ };
497
+ ResourcesControl.prototype.update = function (resource, data) {
498
+ var _this = this;
499
+ return this.getId(resource).then(function (id) {
391
500
  if (id !== undefined) {
392
- return this.connector.put('resource.item', { data }, { id });
501
+ return _this.connector.put('resource.item', { data: data }, { id: id });
393
502
  }
394
503
  });
395
- }
504
+ };
396
505
  /**
397
506
  * Fast way to delete resource from NGW and clean cache.
398
507
  * @param resource - Resource definition
399
508
  */
400
- delete(resource) {
401
- return this.getId(resource).then((id) => {
509
+ ResourcesControl.prototype.delete = function (resource) {
510
+ var _this = this;
511
+ return this.getId(resource).then(function (id) {
402
512
  if (id !== undefined) {
403
- return this.connector.delete('resource.item', null, { id }).then(() => {
404
- this._cleanResourceItemCache(id);
513
+ return _this.connector.delete('resource.item', null, { id: id }).then(function () {
514
+ _this._cleanResourceItemCache(id);
405
515
  return undefined;
406
516
  });
407
517
  }
408
518
  });
409
- }
410
- async _cleanResourceItemCache(id) {
411
- const all = this.cache.all();
412
- const toDelete = [];
413
- for (const c of all) {
414
- const cid = c.options && c.options.id;
415
- if (['resource.item', 'resource'].includes(c.key) && cid !== undefined) {
416
- if (typeof cid === 'number') {
417
- if (cid === id) {
418
- toDelete.push(c);
419
- }
420
- }
421
- else {
422
- const rid = await this.getId(cid);
423
- if (rid === id) {
424
- toDelete.push(c);
425
- }
519
+ };
520
+ ResourcesControl.prototype._cleanResourceItemCache = function (id) {
521
+ return __awaiter(this, void 0, void 0, function () {
522
+ var all, toDelete, _i, all_1, c, cid, rid, _a, toDelete_1, d;
523
+ return __generator(this, function (_b) {
524
+ switch (_b.label) {
525
+ case 0:
526
+ all = this.cache.all();
527
+ toDelete = [];
528
+ _i = 0, all_1 = all;
529
+ _b.label = 1;
530
+ case 1:
531
+ if (!(_i < all_1.length)) return [3 /*break*/, 5];
532
+ c = all_1[_i];
533
+ cid = c.options && c.options.id;
534
+ if (!(['resource.item', 'resource'].includes(c.key) && cid !== undefined)) return [3 /*break*/, 4];
535
+ if (!(typeof cid === 'number')) return [3 /*break*/, 2];
536
+ if (cid === id) {
537
+ toDelete.push(c);
538
+ }
539
+ return [3 /*break*/, 4];
540
+ case 2: return [4 /*yield*/, this.getId(cid)];
541
+ case 3:
542
+ rid = _b.sent();
543
+ if (rid === id) {
544
+ toDelete.push(c);
545
+ }
546
+ _b.label = 4;
547
+ case 4:
548
+ _i++;
549
+ return [3 /*break*/, 1];
550
+ case 5:
551
+ for (_a = 0, toDelete_1 = toDelete; _a < toDelete_1.length; _a++) {
552
+ d = toDelete_1[_a];
553
+ this.cache.delete(d);
554
+ }
555
+ return [2 /*return*/];
426
556
  }
427
- }
428
- }
429
- for (const d of toDelete) {
430
- this.cache.delete(d);
431
- }
432
- }
433
- _fetchResourceById(id, requestOptions) {
434
- const promise = () => this.connector.get('resource.item', requestOptions, { id });
557
+ });
558
+ });
559
+ };
560
+ ResourcesControl.prototype._fetchResourceById = function (id, requestOptions) {
561
+ var _this = this;
562
+ var promise = function () {
563
+ return _this.connector.get('resource.item', requestOptions, { id: id });
564
+ };
435
565
  return this.cache
436
566
  .add('resource.item', promise, {
437
- id,
567
+ id: id,
438
568
  })
439
- .catch((er) => {
569
+ .catch(function (er) {
440
570
  if (!(er instanceof ResourceNotFoundError)) {
441
571
  throw er;
442
572
  }
443
573
  return undefined;
444
574
  });
445
- }
446
- _fetchResourceBy(resource, requestOptions) {
447
- return this.getMany(resource, requestOptions).then((resources) => {
575
+ };
576
+ ResourcesControl.prototype._fetchResourceBy = function (resource, requestOptions) {
577
+ return this.getMany(resource, requestOptions).then(function (resources) {
448
578
  return resources[0];
449
579
  });
450
- }
451
- _resourceCacheFilter(resource) {
452
- return CancelablePromise.all(this.cache.matchAll('resource.item')).then((resources) => {
453
- const items = [];
454
- resources.filter((x) => {
580
+ };
581
+ ResourcesControl.prototype._resourceCacheFilter = function (resource) {
582
+ return CancelablePromise.all(this.cache.matchAll('resource.item')).then(function (resources) {
583
+ var items = [];
584
+ resources.filter(function (x) {
455
585
  if (x) {
456
586
  // identical by uniq props
457
587
  if (resource.keyname && x.resource.keyname) {
@@ -465,23 +595,24 @@ class ResourcesControl {
465
595
  });
466
596
  return items;
467
597
  });
468
- }
469
- }
598
+ };
599
+ return ResourcesControl;
600
+ }());
470
601
 
471
602
  function apiRequest(opt) {
472
- const params = opt.params;
473
- return new CancelablePromise((resolve, reject) => {
603
+ var params = opt.params;
604
+ return new CancelablePromise(function (resolve, reject) {
474
605
  opt.connector
475
606
  .connect()
476
- .then((apiItems) => {
477
- let apiItem = apiItems && apiItems[opt.name];
607
+ .then(function (apiItems) {
608
+ var apiItem = apiItems && apiItems[opt.name];
478
609
  if (apiItem) {
479
- apiItem = [...apiItem];
480
- let url = apiItem.shift();
610
+ apiItem = __spreadArray([], apiItem, true);
611
+ var url = apiItem.shift();
481
612
  if (apiItem.length) {
482
- const replaceParams = {};
483
- for (let fry = 0; fry < apiItem.length; fry++) {
484
- const arg = apiItem[fry];
613
+ var replaceParams = {};
614
+ for (var fry = 0; fry < apiItem.length; fry++) {
615
+ var arg = apiItem[fry];
485
616
  replaceParams[fry] = '{' + arg + '}';
486
617
  if (params[arg] === undefined) {
487
618
  throw new Error('`' + arg + '`' + ' url api argument is not specified');
@@ -493,21 +624,21 @@ function apiRequest(opt) {
493
624
  }
494
625
  // Transfer part of the parameters from `params` to the URL string
495
626
  if (params) {
496
- const paramArray = [];
497
- const paramList = params.paramList;
627
+ var paramArray_1 = [];
628
+ var paramList = params.paramList;
498
629
  if (Array.isArray(paramList)) {
499
630
  delete params.paramList;
500
- paramList.forEach((x) => {
501
- paramArray.push(`${x[0]}=${x[1]}`);
631
+ paramList.forEach(function (x) {
632
+ paramArray_1.push("".concat(x[0], "=").concat(x[1]));
502
633
  });
503
634
  }
504
- for (const p in params) {
635
+ for (var p in params) {
505
636
  if (apiItem.indexOf(p) === -1) {
506
- paramArray.push(`${p}=${params[p]}`);
637
+ paramArray_1.push("".concat(p, "=").concat(params[p]));
507
638
  }
508
639
  }
509
- if (paramArray.length) {
510
- url = url + '?' + paramArray.join('&');
640
+ if (paramArray_1.length) {
641
+ url = url + '?' + paramArray_1.join('&');
511
642
  }
512
643
  }
513
644
  if (url) {
@@ -521,20 +652,20 @@ function apiRequest(opt) {
521
652
  resolve(undefined);
522
653
  }
523
654
  })
524
- .catch((er) => {
655
+ .catch(function (er) {
525
656
  reject(er);
526
657
  });
527
658
  });
528
659
  }
529
660
 
530
- let ID = 0;
531
- class NgwConnector$1 {
532
- constructor(options) {
661
+ var ID = 0;
662
+ var NgwConnector$1 = /** @class */ (function () {
663
+ function NgwConnector(options) {
533
664
  this.options = options;
534
665
  this.id = ID++;
535
666
  this.emitter = new EventEmitter();
536
667
  this.routeStr = '/api/component/pyramid/route';
537
- const exist = findConnector(options);
668
+ var exist = findConnector(options);
538
669
  if (exist) {
539
670
  return exist;
540
671
  }
@@ -546,19 +677,19 @@ class NgwConnector$1 {
546
677
  addConnector(this);
547
678
  }
548
679
  }
549
- static create(options) {
680
+ NgwConnector.create = function (options) {
550
681
  return new this(options);
551
- }
682
+ };
552
683
  /**
553
684
  * Fast way to specify the connection address to NextGIS Web.
554
685
  * The current connection will be severed.
555
686
  * @param baseUrl - NGW url
556
687
  */
557
- setNgw(baseUrl) {
688
+ NgwConnector.prototype.setNgw = function (baseUrl) {
558
689
  this.logout();
559
690
  this.options.baseUrl = baseUrl;
560
691
  addConnector(this);
561
- }
692
+ };
562
693
  /**
563
694
  * Establishing a connection with NextGIS Web to fulfill all other requests.
564
695
  * @remarks
@@ -572,101 +703,105 @@ class NgwConnector$1 {
572
703
  * .catch((er) => console.log('Connection problem', er));
573
704
  * ```
574
705
  */
575
- connect() {
576
- const cache = new Cache();
577
- const auth = this.options.auth;
578
- const makeConnect = () => new CancelablePromise((resolve, reject) => {
579
- const makeQuery = () => {
580
- return this.makeQuery(this.routeStr, {}, {})
581
- .then((route) => {
582
- resolve(route);
583
- })
584
- .catch((er) => {
585
- reject(er);
586
- });
587
- };
588
- if (auth) {
589
- const { login, password } = auth;
590
- if (login && password) {
591
- return this.getUserInfo({ login, password })
592
- .then(() => {
593
- makeQuery();
706
+ NgwConnector.prototype.connect = function () {
707
+ var _this = this;
708
+ var cache = new Cache();
709
+ var auth = this.options.auth;
710
+ var makeConnect = function () {
711
+ return new CancelablePromise(function (resolve, reject) {
712
+ var makeQuery = function () {
713
+ return _this.makeQuery(_this.routeStr, {}, {})
714
+ .then(function (route) {
715
+ resolve(route);
594
716
  })
595
- .catch((er) => reject(er));
717
+ .catch(function (er) {
718
+ reject(er);
719
+ });
720
+ };
721
+ if (auth) {
722
+ var login = auth.login, password = auth.password;
723
+ if (login && password) {
724
+ return _this.getUserInfo({ login: login, password: password })
725
+ .then(function () {
726
+ makeQuery();
727
+ })
728
+ .catch(function (er) { return reject(er); });
729
+ }
596
730
  }
597
- }
598
- return makeQuery();
599
- });
731
+ return makeQuery();
732
+ });
733
+ };
600
734
  return cache.add('route', makeConnect, {
601
735
  id: this.id,
602
- auth,
736
+ auth: auth,
603
737
  baseUrl: this.options.baseUrl,
604
738
  });
605
- }
739
+ };
606
740
  /**
607
741
  * Quick way to change NextGIS Web user.
608
742
  * @param credentials - New user credentials
609
743
  */
610
- login(credentials) {
744
+ NgwConnector.prototype.login = function (credentials) {
611
745
  this.logout();
612
746
  addConnector(this);
613
747
  return this.getUserInfo(credentials);
614
- }
748
+ };
615
749
  /**
616
750
  * Disconnecting a user. Aborting all current requests
617
751
  */
618
- logout() {
752
+ NgwConnector.prototype.logout = function () {
619
753
  removeConnector(this);
620
754
  this.options.auth = undefined;
621
755
  this.user = undefined;
622
756
  this.emitter.emit('logout');
623
757
  this.resources.cache.clean();
624
- }
625
- getUserInfo(credentials) {
758
+ };
759
+ NgwConnector.prototype.getUserInfo = function (credentials) {
760
+ var _this = this;
626
761
  if (this.user && this.user.id) {
627
762
  return CancelablePromise.resolve(this.user);
628
763
  }
629
764
  if (credentials) {
630
765
  this.options.auth = credentials;
631
766
  }
632
- const options = {
767
+ var options = {
633
768
  headers: this.getAuthorizationHeaders(credentials),
634
769
  // withCredentials: true
635
770
  };
636
771
  // Do not use apiRequest('auth.current_user') to avoid circular-references
637
772
  return this.makeQuery('/api/component/auth/current_user', {}, options)
638
- .then((data) => {
639
- this.user = data;
640
- this.emitter.emit('login', data);
773
+ .then(function (data) {
774
+ _this.user = data;
775
+ _this.emitter.emit('login', data);
641
776
  return data;
642
777
  })
643
- .catch((er) => {
644
- this.emitter.emit('login:error', er);
778
+ .catch(function (er) {
779
+ _this.emitter.emit('login:error', er);
645
780
  throw er;
646
781
  });
647
- }
782
+ };
648
783
  /**
649
784
  * Obtaining the required Headers for authentication of requests in the NGW.
650
785
  */
651
- getAuthorizationHeaders(credentials) {
652
- const client = this.makeClientId(credentials);
786
+ NgwConnector.prototype.getAuthorizationHeaders = function (credentials) {
787
+ var client = this.makeClientId(credentials);
653
788
  if (client) {
654
789
  return {
655
790
  Authorization: 'Basic ' + client,
656
791
  };
657
792
  }
658
- }
659
- makeClientId(credentials) {
793
+ };
794
+ NgwConnector.prototype.makeClientId = function (credentials) {
660
795
  credentials = credentials || this.options.auth;
661
796
  if (credentials) {
662
- const { login, password } = credentials;
663
- const str = unescape(encodeURIComponent(`${login}:${password}`));
797
+ var login = credentials.login, password = credentials.password;
798
+ var str = unescape(encodeURIComponent("".concat(login, ":").concat(password)));
664
799
  // @ts-ignore
665
800
  {
666
801
  return window.btoa(str);
667
802
  }
668
803
  }
669
- }
804
+ };
670
805
  /**
671
806
  * Send request to NGW api router.
672
807
  * @param name - NGW route name from {@link https://docs.nextgis.com/docs_ngweb_dev/doc/developer/resource.html#routes | routes}
@@ -696,25 +831,27 @@ class NgwConnector$1 {
696
831
  *
697
832
  * ```
698
833
  */
699
- apiRequest(name, params_ = {}, requestOptions = {}) {
700
- const { method, headers, withCredentials, responseType } = requestOptions;
701
- const params = objectRemoveEmpty(params_);
702
- const makeApiRequest = () => apiRequest({ name, params, requestOptions, connector: this });
834
+ NgwConnector.prototype.apiRequest = function (name, params_, requestOptions) {
835
+ var _this = this;
836
+ if (params_ === void 0) { params_ = {}; }
837
+ if (requestOptions === void 0) { requestOptions = {}; }
838
+ var method = requestOptions.method, headers = requestOptions.headers, withCredentials = requestOptions.withCredentials, responseType = requestOptions.responseType;
839
+ var params = objectRemoveEmpty(params_);
840
+ var makeApiRequest = function () {
841
+ return apiRequest({ name: name, params: params, requestOptions: requestOptions, connector: _this });
842
+ };
703
843
  if (requestOptions.cache && method === 'GET') {
704
- const cache = new Cache();
705
- return cache.add(name, makeApiRequest, {
706
- params,
707
- ...objectRemoveEmpty({
708
- headers,
709
- withCredentials,
710
- responseType,
711
- baseUrl: this.options.baseUrl,
712
- auth: this.options.auth,
713
- }),
714
- });
844
+ var cache = new Cache();
845
+ return cache.add(name, makeApiRequest, __assign({ params: params }, objectRemoveEmpty({
846
+ headers: headers,
847
+ withCredentials: withCredentials,
848
+ responseType: responseType,
849
+ baseUrl: this.options.baseUrl,
850
+ auth: this.options.auth,
851
+ })));
715
852
  }
716
853
  return makeApiRequest();
717
- }
854
+ };
718
855
  /**
719
856
  * Shortcut method for send POST request to NGW.
720
857
  * @param name - NGW route name from {@link https://docs.nextgis.com/docs_ngweb_dev/doc/developer/resource.html#routes | routes}
@@ -728,62 +865,63 @@ class NgwConnector$1 {
728
865
  * .catch((error) => console.warn(error));
729
866
  * ```
730
867
  */
731
- post(name, options, params) {
868
+ NgwConnector.prototype.post = function (name, options, params) {
732
869
  options = options || {};
733
870
  options.method = 'POST';
734
871
  return this.apiRequest(name, params, options);
735
- }
872
+ };
736
873
  /**
737
874
  * Shortcut method for send GET request to NGW.
738
875
  * @param name - NGW route name from {@link https://docs.nextgis.com/docs_ngweb_dev/doc/developer/resource.html#routes | routes}
739
876
  * @param options - Request options
740
877
  * @param params - Request item params or query params
741
878
  */
742
- get(name, options, params) {
879
+ NgwConnector.prototype.get = function (name, options, params) {
743
880
  options = options || {};
744
881
  options.method = 'GET';
745
882
  return this.apiRequest(name, params, options);
746
- }
883
+ };
747
884
  /**
748
885
  * Shortcut method for send PATCH request to NGW.
749
886
  * @param name - NGW route name from {@link https://docs.nextgis.com/docs_ngweb_dev/doc/developer/resource.html#routes | routes}
750
887
  * @param options - Request options
751
888
  * @param params - Request item params or query params
752
889
  */
753
- patch(name, options, params) {
890
+ NgwConnector.prototype.patch = function (name, options, params) {
754
891
  options = options || {};
755
892
  options.method = 'PATCH';
756
893
  return this.apiRequest(name, params, options);
757
- }
894
+ };
758
895
  /**
759
896
  * Shortcut method for send PUT request to NGW.
760
897
  * @param name - NGW route name from {@link https://docs.nextgis.com/docs_ngweb_dev/doc/developer/resource.html#routes | routes}
761
898
  * @param options - Request options
762
899
  * @param params - Request item params or query params
763
900
  */
764
- put(name, options, params) {
901
+ NgwConnector.prototype.put = function (name, options, params) {
765
902
  options = options || {};
766
903
  options.method = 'PUT';
767
904
  return this.apiRequest(name, params, options);
768
- }
905
+ };
769
906
  /**
770
907
  * Shortcut method for send DELETE request to NGW.
771
908
  * @param name - NGW route name from {@link https://docs.nextgis.com/docs_ngweb_dev/doc/developer/resource.html#routes | routes}
772
909
  * @param options - Request options
773
910
  * @param params - Request item params or query params
774
911
  */
775
- delete(name, options, params) {
912
+ NgwConnector.prototype.delete = function (name, options, params) {
776
913
  options = options || {};
777
914
  options.method = 'DELETE';
778
915
  return this.apiRequest(name, params, options);
779
- }
916
+ };
780
917
  /**
781
918
  * Send request to NGW.
782
919
  * @param url - URL address to NGW
783
920
  * @param params - Query params
784
921
  * @param options - Request options
785
922
  */
786
- makeQuery(url, params, options = {}) {
923
+ NgwConnector.prototype.makeQuery = function (url, params, options) {
924
+ if (options === void 0) { options = {}; }
787
925
  url = (this.options.baseUrl ? this.options.baseUrl : '') + url;
788
926
  if (url) {
789
927
  if (params) {
@@ -796,112 +934,110 @@ class NgwConnector$1 {
796
934
  else {
797
935
  throw new Error('Empty `url` not allowed');
798
936
  }
799
- }
937
+ };
800
938
  // -------------------------------------------------------------------------
801
939
  // Resource Methods
802
940
  // -------------------------------------------------------------------------
803
941
  /**
804
942
  * {@inheritDoc ResourcesControl.getOne}
805
943
  */
806
- getResource(resource, requestOptions) {
944
+ NgwConnector.prototype.getResource = function (resource, requestOptions) {
807
945
  return this.resources.getOne(resource, requestOptions);
808
- }
946
+ };
809
947
  /**
810
948
  * {@inheritDoc ResourcesControl.getOneOrFail}
811
949
  */
812
- getResourceOrFail(resource, requestOptions) {
950
+ NgwConnector.prototype.getResourceOrFail = function (resource, requestOptions) {
813
951
  return this.resources.getOneOrFail(resource, requestOptions);
814
- }
952
+ };
815
953
  /**
816
954
  * @deprecated - use {@link NgwConnector.getResource}
817
955
  */
818
- getResourceBy(resource) {
956
+ NgwConnector.prototype.getResourceBy = function (resource) {
819
957
  return this.resources.getOne(resource);
820
- }
958
+ };
821
959
  /**
822
960
  * @deprecated - use {@link NgwConnector.getResource}
823
961
  */
824
- getResourceByKeyname(keyname) {
962
+ NgwConnector.prototype.getResourceByKeyname = function (keyname) {
825
963
  return this.resources.getOne(keyname);
826
- }
964
+ };
827
965
  /**
828
966
  * @deprecated - use {@link NgwConnector.getResource}
829
967
  */
830
- getResourceById(id) {
968
+ NgwConnector.prototype.getResourceById = function (id) {
831
969
  return this.resources.getOne(id);
832
- }
970
+ };
833
971
  /**
834
972
  * {@inheritDoc ResourcesControl.getId}
835
973
  */
836
- getResourceId(resource, requestOptions) {
974
+ NgwConnector.prototype.getResourceId = function (resource, requestOptions) {
837
975
  return this.resources.getId(resource, requestOptions);
838
- }
976
+ };
839
977
  /**
840
978
  * {@inheritDoc ResourcesControl.getIdOrFail}
841
979
  */
842
- getResourceIdOrFail(resource, requestOptions) {
980
+ NgwConnector.prototype.getResourceIdOrFail = function (resource, requestOptions) {
843
981
  return this.resources.getIdOrFail(resource, requestOptions);
844
- }
982
+ };
845
983
  /**
846
984
  * {@inheritDoc ResourcesControl.getMany}
847
985
  */
848
- getResourcesBy(resource, requestOptions) {
986
+ NgwConnector.prototype.getResourcesBy = function (resource, requestOptions) {
849
987
  return this.resources.getMany(resource, requestOptions);
850
- }
988
+ };
851
989
  /**
852
990
  * {@inheritDoc ResourcesControl.getParent}
853
991
  */
854
- getResourceParent(resource, requestOptions) {
992
+ NgwConnector.prototype.getResourceParent = function (resource, requestOptions) {
855
993
  return this.resources.getParent(resource, requestOptions);
856
- }
994
+ };
857
995
  /**
858
996
  * {@inheritDoc ResourcesControl.getChildrenOf}
859
997
  */
860
- getResourceChildren(resource, requestOptions) {
998
+ NgwConnector.prototype.getResourceChildren = function (resource, requestOptions) {
861
999
  return this.resources.getChildrenOf(resource, requestOptions);
862
- }
1000
+ };
863
1001
  /**
864
1002
  * {@inheritDoc ResourcesControl.update}
865
1003
  */
866
- updateResource(resource, data) {
1004
+ NgwConnector.prototype.updateResource = function (resource, data) {
867
1005
  return this.resources.update(resource, data);
868
- }
1006
+ };
869
1007
  /**
870
1008
  * {@inheritDoc ResourcesControl.delete}
871
1009
  */
872
- deleteResource(resource) {
1010
+ NgwConnector.prototype.deleteResource = function (resource) {
873
1011
  return this.resources.delete(resource);
874
- }
1012
+ };
875
1013
  /**
876
1014
  * @internal
877
1015
  */
878
- _loadData(url, options) {
1016
+ NgwConnector.prototype._loadData = function (url, options) {
1017
+ var _this = this;
879
1018
  options.responseType = options.responseType || 'json';
880
- return new CancelablePromise((resolve, reject, onCancel) => {
881
- if (this.user) {
1019
+ return new CancelablePromise(function (resolve, reject, onCancel) {
1020
+ if (_this.user) {
882
1021
  options = options || {};
883
1022
  // options.withCredentials = true;
884
- options.headers = {
885
- ...this.getAuthorizationHeaders(),
886
- ...options.headers,
887
- };
1023
+ options.headers = __assign(__assign({}, _this.getAuthorizationHeaders()), options.headers);
888
1024
  }
889
1025
  loadData(url, resolve, options, reject, onCancel);
890
- }).catch((httpError) => {
1026
+ }).catch(function (httpError) {
891
1027
  if (httpError instanceof CancelablePromise.CancelError) ;
892
1028
  else {
893
1029
  // @ts-ignore
894
1030
  if ((process.env.NODE_ENV !== 'production')) {
895
1031
  console.warn('DEV WARN', httpError);
896
1032
  }
897
- const er = this._handleHttpError(httpError);
1033
+ var er = _this._handleHttpError(httpError);
898
1034
  if (er) {
899
1035
  throw er;
900
1036
  }
901
1037
  }
902
1038
  });
903
- }
904
- _handleHttpError(er) {
1039
+ };
1040
+ NgwConnector.prototype._handleHttpError = function (er) {
905
1041
  if (er) {
906
1042
  if (er instanceof NgwError) {
907
1043
  if (er.exception === 'nextgisweb.resource.exception.ResourceNotFound') {
@@ -913,12 +1049,13 @@ class NgwConnector$1 {
913
1049
  }
914
1050
  }
915
1051
  return er;
916
- }
917
- }
918
- NgwConnector$1.errors = {
919
- NgwError,
920
- ResourceNotFoundError,
921
- };
1052
+ };
1053
+ NgwConnector.errors = {
1054
+ NgwError: NgwError,
1055
+ ResourceNotFoundError: ResourceNotFoundError,
1056
+ };
1057
+ return NgwConnector;
1058
+ }());
922
1059
 
923
1060
  /**
924
1061
  * A lightweight HTTP client optimized for use with {@link http://docs.nextgis.ru/docs_ngweb_dev/doc/developer/toc.html | NextGIS Web} API