geoserver-node-client 1.4.7 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/src/layer.js CHANGED
@@ -46,7 +46,7 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
46
46
  value: (function () {
47
47
  var _get = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(workspace, layerName) {
48
48
  var qualifiedName, response, grc, geoServerResponse;
49
- return _regenerator["default"].wrap(function _callee$(_context) {
49
+ return _regenerator["default"].wrap(function (_context) {
50
50
  while (1) switch (_context.prev = _context.next) {
51
51
  case 0:
52
52
  if (workspace) {
@@ -54,7 +54,7 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
54
54
  } else {
55
55
  qualifiedName = layerName;
56
56
  }
57
- _context.next = 3;
57
+ _context.next = 1;
58
58
  return (0, _nodeFetch["default"])(this.url + 'layers/' + qualifiedName + '.json', {
59
59
  credentials: 'include',
60
60
  method: 'GET',
@@ -62,30 +62,30 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
62
62
  Authorization: this.auth
63
63
  }
64
64
  });
65
- case 3:
65
+ case 1:
66
66
  response = _context.sent;
67
67
  if (response.ok) {
68
- _context.next = 16;
68
+ _context.next = 5;
69
69
  break;
70
70
  }
71
71
  grc = new _about["default"](this.url, this.auth);
72
- _context.next = 8;
72
+ _context.next = 2;
73
73
  return grc.exists();
74
- case 8:
74
+ case 2:
75
75
  if (!_context.sent) {
76
- _context.next = 12;
76
+ _context.next = 3;
77
77
  break;
78
78
  }
79
79
  return _context.abrupt("return");
80
- case 12:
81
- _context.next = 14;
80
+ case 3:
81
+ _context.next = 4;
82
82
  return (0, _geoserver.getGeoServerResponseText)(response);
83
- case 14:
83
+ case 4:
84
84
  geoServerResponse = _context.sent;
85
85
  throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
86
- case 16:
86
+ case 5:
87
87
  return _context.abrupt("return", response.json());
88
- case 17:
88
+ case 6:
89
89
  case "end":
90
90
  return _context.stop();
91
91
  }
@@ -112,7 +112,7 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
112
112
  value: (function () {
113
113
  var _modifyAttribution = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(workspace, layerName, attributionText, attributionLink) {
114
114
  var qualifiedName, jsonBody, url, response, geoServerResponse;
115
- return _regenerator["default"].wrap(function _callee2$(_context2) {
115
+ return _regenerator["default"].wrap(function (_context2) {
116
116
  while (1) switch (_context2.prev = _context2.next) {
117
117
  case 0:
118
118
  if (workspace) {
@@ -121,16 +121,16 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
121
121
  qualifiedName = layerName;
122
122
  }
123
123
  // take existing layer properties as template
124
- _context2.next = 3;
124
+ _context2.next = 1;
125
125
  return this.get(workspace, layerName);
126
- case 3:
126
+ case 1:
127
127
  jsonBody = _context2.sent;
128
128
  if (!(!jsonBody || !jsonBody.layer || !jsonBody.layer.attribution)) {
129
- _context2.next = 6;
129
+ _context2.next = 2;
130
130
  break;
131
131
  }
132
132
  throw new _geoserver.GeoServerResponseError("layer '".concat(workspace, ":").concat(layerName, "' misses the property 'attribution'"));
133
- case 6:
133
+ case 2:
134
134
  // set attribution text and link
135
135
  if (attributionText) {
136
136
  jsonBody.layer.attribution.title = attributionText;
@@ -139,7 +139,7 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
139
139
  jsonBody.layer.attribution.href = attributionLink;
140
140
  }
141
141
  url = this.url + 'layers/' + qualifiedName + '.json';
142
- _context2.next = 11;
142
+ _context2.next = 3;
143
143
  return (0, _nodeFetch["default"])(url, {
144
144
  credentials: 'include',
145
145
  method: 'PUT',
@@ -149,18 +149,18 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
149
149
  },
150
150
  body: JSON.stringify(jsonBody)
151
151
  });
152
- case 11:
152
+ case 3:
153
153
  response = _context2.sent;
154
154
  if (response.ok) {
155
- _context2.next = 17;
155
+ _context2.next = 5;
156
156
  break;
157
157
  }
158
- _context2.next = 15;
158
+ _context2.next = 4;
159
159
  return (0, _geoserver.getGeoServerResponseText)(response);
160
- case 15:
160
+ case 4:
161
161
  geoServerResponse = _context2.sent;
162
162
  throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
163
- case 17:
163
+ case 5:
164
164
  case "end":
165
165
  return _context2.stop();
166
166
  }
@@ -184,10 +184,10 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
184
184
  value: (function () {
185
185
  var _getAll = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3() {
186
186
  var response, geoServerResponse;
187
- return _regenerator["default"].wrap(function _callee3$(_context3) {
187
+ return _regenerator["default"].wrap(function (_context3) {
188
188
  while (1) switch (_context3.prev = _context3.next) {
189
189
  case 0:
190
- _context3.next = 2;
190
+ _context3.next = 1;
191
191
  return (0, _nodeFetch["default"])(this.url + 'layers.json', {
192
192
  credentials: 'include',
193
193
  method: 'GET',
@@ -195,20 +195,20 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
195
195
  Authorization: this.auth
196
196
  }
197
197
  });
198
- case 2:
198
+ case 1:
199
199
  response = _context3.sent;
200
200
  if (response.ok) {
201
- _context3.next = 8;
201
+ _context3.next = 3;
202
202
  break;
203
203
  }
204
- _context3.next = 6;
204
+ _context3.next = 2;
205
205
  return (0, _geoserver.getGeoServerResponseText)(response);
206
- case 6:
206
+ case 2:
207
207
  geoServerResponse = _context3.sent;
208
208
  throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
209
- case 8:
209
+ case 3:
210
210
  return _context3.abrupt("return", response.json());
211
- case 9:
211
+ case 4:
212
212
  case "end":
213
213
  return _context3.stop();
214
214
  }
@@ -234,10 +234,10 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
234
234
  value: (function () {
235
235
  var _getLayers = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(workspace) {
236
236
  var response, geoServerResponse;
237
- return _regenerator["default"].wrap(function _callee4$(_context4) {
237
+ return _regenerator["default"].wrap(function (_context4) {
238
238
  while (1) switch (_context4.prev = _context4.next) {
239
239
  case 0:
240
- _context4.next = 2;
240
+ _context4.next = 1;
241
241
  return (0, _nodeFetch["default"])(this.url + 'workspaces/' + workspace + '/layers.json', {
242
242
  credentials: 'include',
243
243
  method: 'GET',
@@ -245,23 +245,23 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
245
245
  Authorization: this.auth
246
246
  }
247
247
  });
248
- case 2:
248
+ case 1:
249
249
  response = _context4.sent;
250
250
  if (response.ok) {
251
- _context4.next = 8;
251
+ _context4.next = 3;
252
252
  break;
253
253
  }
254
- _context4.next = 6;
254
+ _context4.next = 2;
255
255
  return (0, _geoserver.getGeoServerResponseText)(response);
256
- case 6:
256
+ case 2:
257
257
  geoServerResponse = _context4.sent;
258
258
  throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
259
- case 8:
260
- _context4.next = 10;
259
+ case 3:
260
+ _context4.next = 4;
261
261
  return response.json();
262
- case 10:
262
+ case 4:
263
263
  return _context4.abrupt("return", _context4.sent);
264
- case 11:
264
+ case 5:
265
265
  case "end":
266
266
  return _context4.stop();
267
267
  }
@@ -289,10 +289,10 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
289
289
  value: (function () {
290
290
  var _getWmsLayer = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5(workspace, datastore, layerName) {
291
291
  var response, grc, geoServerResponse;
292
- return _regenerator["default"].wrap(function _callee5$(_context5) {
292
+ return _regenerator["default"].wrap(function (_context5) {
293
293
  while (1) switch (_context5.prev = _context5.next) {
294
294
  case 0:
295
- _context5.next = 2;
295
+ _context5.next = 1;
296
296
  return (0, _nodeFetch["default"])(this.url + 'workspaces/' + workspace + '/wmsstores/' + datastore + '/wmslayers/' + layerName + '.json', {
297
297
  credentials: 'include',
298
298
  method: 'GET',
@@ -300,39 +300,39 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
300
300
  Authorization: this.auth
301
301
  }
302
302
  });
303
- case 2:
303
+ case 1:
304
304
  response = _context5.sent;
305
305
  if (response.ok) {
306
- _context5.next = 15;
306
+ _context5.next = 5;
307
307
  break;
308
308
  }
309
309
  grc = new _about["default"](this.url, this.auth);
310
- _context5.next = 7;
310
+ _context5.next = 2;
311
311
  return grc.exists();
312
- case 7:
312
+ case 2:
313
313
  if (!_context5.sent) {
314
- _context5.next = 11;
314
+ _context5.next = 3;
315
315
  break;
316
316
  }
317
317
  return _context5.abrupt("return");
318
- case 11:
319
- _context5.next = 13;
318
+ case 3:
319
+ _context5.next = 4;
320
320
  return (0, _geoserver.getGeoServerResponseText)(response);
321
- case 13:
321
+ case 4:
322
322
  geoServerResponse = _context5.sent;
323
323
  throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
324
- case 15:
325
- _context5.next = 17;
324
+ case 5:
325
+ _context5.next = 6;
326
326
  return response.json();
327
- case 17:
327
+ case 6:
328
328
  return _context5.abrupt("return", _context5.sent);
329
- case 18:
329
+ case 7:
330
330
  case "end":
331
331
  return _context5.stop();
332
332
  }
333
333
  }, _callee5, this);
334
334
  }));
335
- function getWmsLayer(_x8, _x9, _x10) {
335
+ function getWmsLayer(_x8, _x9, _x0) {
336
336
  return _getWmsLayer.apply(this, arguments);
337
337
  }
338
338
  return getWmsLayer;
@@ -354,10 +354,10 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
354
354
  value: function () {
355
355
  var _getWmtsLayer = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee6(workspace, datastore, layerName) {
356
356
  var response, grc, geoServerResponse;
357
- return _regenerator["default"].wrap(function _callee6$(_context6) {
357
+ return _regenerator["default"].wrap(function (_context6) {
358
358
  while (1) switch (_context6.prev = _context6.next) {
359
359
  case 0:
360
- _context6.next = 2;
360
+ _context6.next = 1;
361
361
  return (0, _nodeFetch["default"])(this.url + 'workspaces/' + workspace + '/wmtsstores/' + datastore + '/layers/' + layerName + '.json', {
362
362
  credentials: 'include',
363
363
  method: 'GET',
@@ -365,39 +365,39 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
365
365
  Authorization: this.auth
366
366
  }
367
367
  });
368
- case 2:
368
+ case 1:
369
369
  response = _context6.sent;
370
370
  if (response.ok) {
371
- _context6.next = 15;
371
+ _context6.next = 5;
372
372
  break;
373
373
  }
374
374
  grc = new _about["default"](this.url, this.auth);
375
- _context6.next = 7;
375
+ _context6.next = 2;
376
376
  return grc.exists();
377
- case 7:
377
+ case 2:
378
378
  if (!_context6.sent) {
379
- _context6.next = 11;
379
+ _context6.next = 3;
380
380
  break;
381
381
  }
382
382
  return _context6.abrupt("return");
383
- case 11:
384
- _context6.next = 13;
383
+ case 3:
384
+ _context6.next = 4;
385
385
  return (0, _geoserver.getGeoServerResponseText)(response);
386
- case 13:
386
+ case 4:
387
387
  geoServerResponse = _context6.sent;
388
388
  throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
389
- case 15:
390
- _context6.next = 17;
389
+ case 5:
390
+ _context6.next = 6;
391
391
  return response.json();
392
- case 17:
392
+ case 6:
393
393
  return _context6.abrupt("return", _context6.sent);
394
- case 18:
394
+ case 7:
395
395
  case "end":
396
396
  return _context6.stop();
397
397
  }
398
398
  }, _callee6, this);
399
399
  }));
400
- function getWmtsLayer(_x11, _x12, _x13) {
400
+ function getWmtsLayer(_x1, _x10, _x11) {
401
401
  return _getWmtsLayer.apply(this, arguments);
402
402
  }
403
403
  return getWmtsLayer;
@@ -420,7 +420,7 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
420
420
  value: (function () {
421
421
  var _publishFeatureTypeDefaultDataStore = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee7(workspace, nativeName, name, title, srs, enabled, _abstract) {
422
422
  var body, response, geoServerResponse;
423
- return _regenerator["default"].wrap(function _callee7$(_context7) {
423
+ return _regenerator["default"].wrap(function (_context7) {
424
424
  while (1) switch (_context7.prev = _context7.next) {
425
425
  case 0:
426
426
  body = {
@@ -433,7 +433,7 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
433
433
  "abstract": _abstract || ''
434
434
  }
435
435
  };
436
- _context7.next = 3;
436
+ _context7.next = 1;
437
437
  return (0, _nodeFetch["default"])(this.url + 'workspaces/' + workspace + '/featuretypes', {
438
438
  credentials: 'include',
439
439
  method: 'POST',
@@ -443,24 +443,24 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
443
443
  },
444
444
  body: JSON.stringify(body)
445
445
  });
446
- case 3:
446
+ case 1:
447
447
  response = _context7.sent;
448
448
  if (response.ok) {
449
- _context7.next = 9;
449
+ _context7.next = 3;
450
450
  break;
451
451
  }
452
- _context7.next = 7;
452
+ _context7.next = 2;
453
453
  return (0, _geoserver.getGeoServerResponseText)(response);
454
- case 7:
454
+ case 2:
455
455
  geoServerResponse = _context7.sent;
456
456
  throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
457
- case 9:
457
+ case 3:
458
458
  case "end":
459
459
  return _context7.stop();
460
460
  }
461
461
  }, _callee7, this);
462
462
  }));
463
- function publishFeatureTypeDefaultDataStore(_x14, _x15, _x16, _x17, _x18, _x19, _x20) {
463
+ function publishFeatureTypeDefaultDataStore(_x12, _x13, _x14, _x15, _x16, _x17, _x18) {
464
464
  return _publishFeatureTypeDefaultDataStore.apply(this, arguments);
465
465
  }
466
466
  return publishFeatureTypeDefaultDataStore;
@@ -486,7 +486,7 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
486
486
  value: (function () {
487
487
  var _publishFeatureType = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee8(workspace, dataStore, nativeName, name, title, srs, enabled, _abstract2, nativeBoundingBox) {
488
488
  var body, response, geoServerResponse;
489
- return _regenerator["default"].wrap(function _callee8$(_context8) {
489
+ return _regenerator["default"].wrap(function (_context8) {
490
490
  while (1) switch (_context8.prev = _context8.next) {
491
491
  case 0:
492
492
  // apply CRS info for native BBOX if not provided
@@ -507,7 +507,7 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
507
507
  nativeBoundingBox: nativeBoundingBox
508
508
  }
509
509
  };
510
- _context8.next = 4;
510
+ _context8.next = 1;
511
511
  return (0, _nodeFetch["default"])(this.url + 'workspaces/' + workspace + '/datastores/' + dataStore + '/featuretypes', {
512
512
  credentials: 'include',
513
513
  method: 'POST',
@@ -517,24 +517,24 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
517
517
  },
518
518
  body: JSON.stringify(body)
519
519
  });
520
- case 4:
520
+ case 1:
521
521
  response = _context8.sent;
522
522
  if (response.ok) {
523
- _context8.next = 10;
523
+ _context8.next = 3;
524
524
  break;
525
525
  }
526
- _context8.next = 8;
526
+ _context8.next = 2;
527
527
  return (0, _geoserver.getGeoServerResponseText)(response);
528
- case 8:
528
+ case 2:
529
529
  geoServerResponse = _context8.sent;
530
530
  throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
531
- case 10:
531
+ case 3:
532
532
  case "end":
533
533
  return _context8.stop();
534
534
  }
535
535
  }, _callee8, this);
536
536
  }));
537
- function publishFeatureType(_x21, _x22, _x23, _x24, _x25, _x26, _x27, _x28, _x29) {
537
+ function publishFeatureType(_x19, _x20, _x21, _x22, _x23, _x24, _x25, _x26, _x27) {
538
538
  return _publishFeatureType.apply(this, arguments);
539
539
  }
540
540
  return publishFeatureType;
@@ -556,11 +556,11 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
556
556
  value: (function () {
557
557
  var _getFeatureType = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee9(workspace, datastore, name) {
558
558
  var url, response, grc, geoServerResponse;
559
- return _regenerator["default"].wrap(function _callee9$(_context9) {
559
+ return _regenerator["default"].wrap(function (_context9) {
560
560
  while (1) switch (_context9.prev = _context9.next) {
561
561
  case 0:
562
562
  url = this.url + 'workspaces/' + workspace + '/datastores/' + datastore + '/featuretypes/' + name + '.json';
563
- _context9.next = 3;
563
+ _context9.next = 1;
564
564
  return (0, _nodeFetch["default"])(url, {
565
565
  credentials: 'include',
566
566
  method: 'GET',
@@ -568,40 +568,103 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
568
568
  Authorization: this.auth
569
569
  }
570
570
  });
571
- case 3:
571
+ case 1:
572
572
  response = _context9.sent;
573
573
  if (response.ok) {
574
- _context9.next = 16;
574
+ _context9.next = 5;
575
575
  break;
576
576
  }
577
577
  grc = new _about["default"](this.url, this.auth);
578
- _context9.next = 8;
578
+ _context9.next = 2;
579
579
  return grc.exists();
580
- case 8:
580
+ case 2:
581
581
  if (!_context9.sent) {
582
- _context9.next = 12;
582
+ _context9.next = 3;
583
583
  break;
584
584
  }
585
585
  return _context9.abrupt("return");
586
- case 12:
587
- _context9.next = 14;
586
+ case 3:
587
+ _context9.next = 4;
588
588
  return (0, _geoserver.getGeoServerResponseText)(response);
589
- case 14:
589
+ case 4:
590
590
  geoServerResponse = _context9.sent;
591
591
  throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
592
- case 16:
592
+ case 5:
593
593
  return _context9.abrupt("return", response.json());
594
- case 17:
594
+ case 6:
595
595
  case "end":
596
596
  return _context9.stop();
597
597
  }
598
598
  }, _callee9, this);
599
599
  }));
600
- function getFeatureType(_x30, _x31, _x32) {
600
+ function getFeatureType(_x28, _x29, _x30) {
601
601
  return _getFeatureType.apply(this, arguments);
602
602
  }
603
603
  return getFeatureType;
604
604
  }()
605
+ /**
606
+ * Get detailed information about a FeatureType.
607
+ *
608
+ * @param {String} workspace The workspace of the FeatureType
609
+ * @param {String} name The name of the FeatureType
610
+ *
611
+ * @throws GeoServerResponseError if request fails or layer does not exist or lacks the right properties.
612
+ *
613
+ * @returns {Object} The object of the FeatureType
614
+ */
615
+ )
616
+ }, {
617
+ key: "getFeatureTypeFromLayer",
618
+ value: (function () {
619
+ var _getFeatureTypeFromLayer = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee0(workspace, layer) {
620
+ var _layerObj$layer;
621
+ var layerObj, url, response, geoServerResponse;
622
+ return _regenerator["default"].wrap(function (_context0) {
623
+ while (1) switch (_context0.prev = _context0.next) {
624
+ case 0:
625
+ _context0.next = 1;
626
+ return this.get(workspace, layer);
627
+ case 1:
628
+ layerObj = _context0.sent;
629
+ if (!(!layerObj || !layerObj.layer || !layerObj.layer.resource || !layerObj.layer.resource.href)) {
630
+ _context0.next = 2;
631
+ break;
632
+ }
633
+ throw new _geoserver.GeoServerResponseError("Layer '".concat(workspace, ":").concat(layer, "' does not exist or lacks the layer.resource.href property."));
634
+ case 2:
635
+ url = layerObj === null || layerObj === void 0 || (_layerObj$layer = layerObj.layer) === null || _layerObj$layer === void 0 || (_layerObj$layer = _layerObj$layer.resource) === null || _layerObj$layer === void 0 ? void 0 : _layerObj$layer.href;
636
+ _context0.next = 3;
637
+ return (0, _nodeFetch["default"])(url, {
638
+ credentials: 'include',
639
+ method: 'GET',
640
+ headers: {
641
+ Authorization: this.auth
642
+ }
643
+ });
644
+ case 3:
645
+ response = _context0.sent;
646
+ if (response.ok) {
647
+ _context0.next = 5;
648
+ break;
649
+ }
650
+ _context0.next = 4;
651
+ return (0, _geoserver.getGeoServerResponseText)(response);
652
+ case 4:
653
+ geoServerResponse = _context0.sent;
654
+ throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
655
+ case 5:
656
+ return _context0.abrupt("return", response.json());
657
+ case 6:
658
+ case "end":
659
+ return _context0.stop();
660
+ }
661
+ }, _callee0, this);
662
+ }));
663
+ function getFeatureTypeFromLayer(_x31, _x32) {
664
+ return _getFeatureTypeFromLayer.apply(this, arguments);
665
+ }
666
+ return getFeatureTypeFromLayer;
667
+ }()
605
668
  /**
606
669
  * Publishes a WMS layer.
607
670
  *
@@ -620,10 +683,10 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
620
683
  }, {
621
684
  key: "publishWmsLayer",
622
685
  value: (function () {
623
- var _publishWmsLayer = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee10(workspace, dataStore, nativeName, name, title, srs, enabled, _abstract3) {
686
+ var _publishWmsLayer = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee1(workspace, dataStore, nativeName, name, title, srs, enabled, _abstract3) {
624
687
  var body, response, geoServerResponse;
625
- return _regenerator["default"].wrap(function _callee10$(_context10) {
626
- while (1) switch (_context10.prev = _context10.next) {
688
+ return _regenerator["default"].wrap(function (_context1) {
689
+ while (1) switch (_context1.prev = _context1.next) {
627
690
  case 0:
628
691
  body = {
629
692
  wmsLayer: {
@@ -635,7 +698,7 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
635
698
  "abstract": _abstract3 || ''
636
699
  }
637
700
  };
638
- _context10.next = 3;
701
+ _context1.next = 1;
639
702
  return (0, _nodeFetch["default"])(this.url + 'workspaces/' + workspace + '/wmsstores/' + dataStore + '/wmslayers', {
640
703
  credentials: 'include',
641
704
  method: 'POST',
@@ -645,22 +708,22 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
645
708
  },
646
709
  body: JSON.stringify(body)
647
710
  });
648
- case 3:
649
- response = _context10.sent;
711
+ case 1:
712
+ response = _context1.sent;
650
713
  if (response.ok) {
651
- _context10.next = 9;
714
+ _context1.next = 3;
652
715
  break;
653
716
  }
654
- _context10.next = 7;
717
+ _context1.next = 2;
655
718
  return (0, _geoserver.getGeoServerResponseText)(response);
656
- case 7:
657
- geoServerResponse = _context10.sent;
719
+ case 2:
720
+ geoServerResponse = _context1.sent;
658
721
  throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
659
- case 9:
722
+ case 3:
660
723
  case "end":
661
- return _context10.stop();
724
+ return _context1.stop();
662
725
  }
663
- }, _callee10, this);
726
+ }, _callee1, this);
664
727
  }));
665
728
  function publishWmsLayer(_x33, _x34, _x35, _x36, _x37, _x38, _x39, _x40) {
666
729
  return _publishWmsLayer.apply(this, arguments);
@@ -685,10 +748,10 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
685
748
  }, {
686
749
  key: "publishDbRaster",
687
750
  value: (function () {
688
- var _publishDbRaster = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee11(workspace, coverageStore, nativeName, name, title, srs, enabled, _abstract4) {
751
+ var _publishDbRaster = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee10(workspace, coverageStore, nativeName, name, title, srs, enabled, _abstract4) {
689
752
  var body, response, geoServerResponse;
690
- return _regenerator["default"].wrap(function _callee11$(_context11) {
691
- while (1) switch (_context11.prev = _context11.next) {
753
+ return _regenerator["default"].wrap(function (_context10) {
754
+ while (1) switch (_context10.prev = _context10.next) {
692
755
  case 0:
693
756
  body = {
694
757
  coverage: {
@@ -700,7 +763,7 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
700
763
  "abstract": _abstract4 || ''
701
764
  }
702
765
  };
703
- _context11.next = 3;
766
+ _context10.next = 1;
704
767
  return (0, _nodeFetch["default"])(this.url + 'workspaces/' + workspace + '/coveragestores/' + coverageStore + '/coverages', {
705
768
  credentials: 'include',
706
769
  method: 'POST',
@@ -710,22 +773,22 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
710
773
  },
711
774
  body: JSON.stringify(body)
712
775
  });
713
- case 3:
714
- response = _context11.sent;
776
+ case 1:
777
+ response = _context10.sent;
715
778
  if (response.ok) {
716
- _context11.next = 9;
779
+ _context10.next = 3;
717
780
  break;
718
781
  }
719
- _context11.next = 7;
782
+ _context10.next = 2;
720
783
  return (0, _geoserver.getGeoServerResponseText)(response);
721
- case 7:
722
- geoServerResponse = _context11.sent;
784
+ case 2:
785
+ geoServerResponse = _context10.sent;
723
786
  throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
724
- case 9:
787
+ case 3:
725
788
  case "end":
726
- return _context11.stop();
789
+ return _context10.stop();
727
790
  }
728
- }, _callee11, this);
791
+ }, _callee10, this);
729
792
  }));
730
793
  function publishDbRaster(_x41, _x42, _x43, _x44, _x45, _x46, _x47, _x48) {
731
794
  return _publishDbRaster.apply(this, arguments);
@@ -746,12 +809,12 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
746
809
  }, {
747
810
  key: "deleteFeatureType",
748
811
  value: (function () {
749
- var _deleteFeatureType = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee12(workspace, datastore, name, recurse) {
812
+ var _deleteFeatureType = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee11(workspace, datastore, name, recurse) {
750
813
  var response, geoServerResponse;
751
- return _regenerator["default"].wrap(function _callee12$(_context12) {
752
- while (1) switch (_context12.prev = _context12.next) {
814
+ return _regenerator["default"].wrap(function (_context11) {
815
+ while (1) switch (_context11.prev = _context11.next) {
753
816
  case 0:
754
- _context12.next = 2;
817
+ _context11.next = 1;
755
818
  return (0, _nodeFetch["default"])(this.url + 'workspaces/' + workspace + '/datastores/' + datastore + '/featuretypes/' + name + '?recurse=' + recurse, {
756
819
  credentials: 'include',
757
820
  method: 'DELETE',
@@ -759,22 +822,22 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
759
822
  Authorization: this.auth
760
823
  }
761
824
  });
762
- case 2:
763
- response = _context12.sent;
825
+ case 1:
826
+ response = _context11.sent;
764
827
  if (response.ok) {
765
- _context12.next = 8;
828
+ _context11.next = 3;
766
829
  break;
767
830
  }
768
- _context12.next = 6;
831
+ _context11.next = 2;
769
832
  return (0, _geoserver.getGeoServerResponseText)(response);
770
- case 6:
771
- geoServerResponse = _context12.sent;
833
+ case 2:
834
+ geoServerResponse = _context11.sent;
772
835
  throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
773
- case 8:
836
+ case 3:
774
837
  case "end":
775
- return _context12.stop();
838
+ return _context11.stop();
776
839
  }
777
- }, _callee12, this);
840
+ }, _callee11, this);
778
841
  }));
779
842
  function deleteFeatureType(_x49, _x50, _x51, _x52) {
780
843
  return _deleteFeatureType.apply(this, arguments);
@@ -800,10 +863,10 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
800
863
  }, {
801
864
  key: "enableTimeCoverage",
802
865
  value: (function () {
803
- var _enableTimeCoverage = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee13(workspace, dataStore, name, presentation, resolution, defaultValue, nearestMatchEnabled, rawNearestMatchEnabled, acceptableInterval) {
866
+ var _enableTimeCoverage = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee12(workspace, dataStore, name, presentation, resolution, defaultValue, nearestMatchEnabled, rawNearestMatchEnabled, acceptableInterval) {
804
867
  var body, url, response, geoServerResponse;
805
- return _regenerator["default"].wrap(function _callee13$(_context13) {
806
- while (1) switch (_context13.prev = _context13.next) {
868
+ return _regenerator["default"].wrap(function (_context12) {
869
+ while (1) switch (_context12.prev = _context12.next) {
807
870
  case 0:
808
871
  body = {
809
872
  coverage: {
@@ -827,7 +890,7 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
827
890
  }
828
891
  };
829
892
  url = this.url + 'workspaces/' + workspace + '/coveragestores/' + dataStore + '/coverages/' + name + '.json';
830
- _context13.next = 4;
893
+ _context12.next = 1;
831
894
  return (0, _nodeFetch["default"])(url, {
832
895
  credentials: 'include',
833
896
  method: 'PUT',
@@ -837,22 +900,22 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
837
900
  },
838
901
  body: JSON.stringify(body)
839
902
  });
840
- case 4:
841
- response = _context13.sent;
903
+ case 1:
904
+ response = _context12.sent;
842
905
  if (response.ok) {
843
- _context13.next = 10;
906
+ _context12.next = 3;
844
907
  break;
845
908
  }
846
- _context13.next = 8;
909
+ _context12.next = 2;
847
910
  return (0, _geoserver.getGeoServerResponseText)(response);
848
- case 8:
849
- geoServerResponse = _context13.sent;
911
+ case 2:
912
+ geoServerResponse = _context12.sent;
850
913
  throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
851
- case 10:
914
+ case 3:
852
915
  case "end":
853
- return _context13.stop();
916
+ return _context12.stop();
854
917
  }
855
- }, _callee13, this);
918
+ }, _callee12, this);
856
919
  }));
857
920
  function enableTimeCoverage(_x53, _x54, _x55, _x56, _x57, _x58, _x59, _x60, _x61) {
858
921
  return _enableTimeCoverage.apply(this, arguments);
@@ -878,10 +941,10 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
878
941
  }, {
879
942
  key: "enableTimeFeatureType",
880
943
  value: (function () {
881
- var _enableTimeFeatureType = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee14(workspace, dataStore, name, attribute, presentation, resolution, defaultValue, nearestMatchEnabled, rawNearestMatchEnabled, acceptableInterval) {
944
+ var _enableTimeFeatureType = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee13(workspace, dataStore, name, attribute, presentation, resolution, defaultValue, nearestMatchEnabled, rawNearestMatchEnabled, acceptableInterval) {
882
945
  var body, url, response, geoServerResponse;
883
- return _regenerator["default"].wrap(function _callee14$(_context14) {
884
- while (1) switch (_context14.prev = _context14.next) {
946
+ return _regenerator["default"].wrap(function (_context13) {
947
+ while (1) switch (_context13.prev = _context13.next) {
885
948
  case 0:
886
949
  body = {
887
950
  featureType: {
@@ -905,7 +968,7 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
905
968
  }
906
969
  };
907
970
  url = this.url + 'workspaces/' + workspace + '/datastores/' + dataStore + '/featuretypes/' + name + '.json';
908
- _context14.next = 4;
971
+ _context13.next = 1;
909
972
  return (0, _nodeFetch["default"])(url, {
910
973
  credentials: 'include',
911
974
  method: 'PUT',
@@ -915,22 +978,22 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
915
978
  },
916
979
  body: JSON.stringify(body)
917
980
  });
918
- case 4:
919
- response = _context14.sent;
981
+ case 1:
982
+ response = _context13.sent;
920
983
  if (response.ok) {
921
- _context14.next = 10;
984
+ _context13.next = 3;
922
985
  break;
923
986
  }
924
- _context14.next = 8;
987
+ _context13.next = 2;
925
988
  return (0, _geoserver.getGeoServerResponseText)(response);
926
- case 8:
927
- geoServerResponse = _context14.sent;
989
+ case 2:
990
+ geoServerResponse = _context13.sent;
928
991
  throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
929
- case 10:
992
+ case 3:
930
993
  case "end":
931
- return _context14.stop();
994
+ return _context13.stop();
932
995
  }
933
- }, _callee14, this);
996
+ }, _callee13, this);
934
997
  }));
935
998
  function enableTimeFeatureType(_x62, _x63, _x64, _x65, _x66, _x67, _x68, _x69, _x70, _x71) {
936
999
  return _enableTimeFeatureType.apply(this, arguments);
@@ -952,13 +1015,13 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
952
1015
  }, {
953
1016
  key: "getCoverage",
954
1017
  value: (function () {
955
- var _getCoverage = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee15(workspace, coverageStore, name) {
1018
+ var _getCoverage = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee14(workspace, coverageStore, name) {
956
1019
  var url, response, grc, geoServerResponse;
957
- return _regenerator["default"].wrap(function _callee15$(_context15) {
958
- while (1) switch (_context15.prev = _context15.next) {
1020
+ return _regenerator["default"].wrap(function (_context14) {
1021
+ while (1) switch (_context14.prev = _context14.next) {
959
1022
  case 0:
960
1023
  url = this.url + 'workspaces/' + workspace + '/coveragestores/' + coverageStore + '/coverages/' + name + '.json';
961
- _context15.next = 3;
1024
+ _context14.next = 1;
962
1025
  return (0, _nodeFetch["default"])(url, {
963
1026
  credentials: 'include',
964
1027
  method: 'GET',
@@ -966,39 +1029,101 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
966
1029
  Authorization: this.auth
967
1030
  }
968
1031
  });
1032
+ case 1:
1033
+ response = _context14.sent;
1034
+ if (response.ok) {
1035
+ _context14.next = 5;
1036
+ break;
1037
+ }
1038
+ grc = new _about["default"](this.url, this.auth);
1039
+ _context14.next = 2;
1040
+ return grc.exists();
1041
+ case 2:
1042
+ if (!_context14.sent) {
1043
+ _context14.next = 3;
1044
+ break;
1045
+ }
1046
+ return _context14.abrupt("return");
969
1047
  case 3:
1048
+ _context14.next = 4;
1049
+ return (0, _geoserver.getGeoServerResponseText)(response);
1050
+ case 4:
1051
+ geoServerResponse = _context14.sent;
1052
+ throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
1053
+ case 5:
1054
+ return _context14.abrupt("return", response.json());
1055
+ case 6:
1056
+ case "end":
1057
+ return _context14.stop();
1058
+ }
1059
+ }, _callee14, this);
1060
+ }));
1061
+ function getCoverage(_x72, _x73, _x74) {
1062
+ return _getCoverage.apply(this, arguments);
1063
+ }
1064
+ return getCoverage;
1065
+ }()
1066
+ /**
1067
+ * Returns a dedicated coverage object.
1068
+ *
1069
+ * @param {String} workspace Workspace containing the coverage
1070
+ * @param {String} name Coverage to query
1071
+ *
1072
+ * @throws Error if request fails
1073
+ *
1074
+ * @returns {Object} An object with coverage information or undefined if it cannot be found
1075
+ */
1076
+ )
1077
+ }, {
1078
+ key: "getCoverageFromLayer",
1079
+ value: (function () {
1080
+ var _getCoverageFromLayer = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee15(workspace, name) {
1081
+ var url, response, grc, geoServerResponse;
1082
+ return _regenerator["default"].wrap(function (_context15) {
1083
+ while (1) switch (_context15.prev = _context15.next) {
1084
+ case 0:
1085
+ url = this.url + '/workspaces/' + workspace + '/coverages/' + name + '.json';
1086
+ _context15.next = 1;
1087
+ return (0, _nodeFetch["default"])(url, {
1088
+ credentials: 'include',
1089
+ method: 'GET',
1090
+ headers: {
1091
+ Authorization: this.auth
1092
+ }
1093
+ });
1094
+ case 1:
970
1095
  response = _context15.sent;
971
1096
  if (response.ok) {
972
- _context15.next = 16;
1097
+ _context15.next = 5;
973
1098
  break;
974
1099
  }
975
1100
  grc = new _about["default"](this.url, this.auth);
976
- _context15.next = 8;
1101
+ _context15.next = 2;
977
1102
  return grc.exists();
978
- case 8:
1103
+ case 2:
979
1104
  if (!_context15.sent) {
980
- _context15.next = 12;
1105
+ _context15.next = 3;
981
1106
  break;
982
1107
  }
983
1108
  return _context15.abrupt("return");
984
- case 12:
985
- _context15.next = 14;
1109
+ case 3:
1110
+ _context15.next = 4;
986
1111
  return (0, _geoserver.getGeoServerResponseText)(response);
987
- case 14:
1112
+ case 4:
988
1113
  geoServerResponse = _context15.sent;
989
1114
  throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
990
- case 16:
1115
+ case 5:
991
1116
  return _context15.abrupt("return", response.json());
992
- case 17:
1117
+ case 6:
993
1118
  case "end":
994
1119
  return _context15.stop();
995
1120
  }
996
1121
  }, _callee15, this);
997
1122
  }));
998
- function getCoverage(_x72, _x73, _x74) {
999
- return _getCoverage.apply(this, arguments);
1123
+ function getCoverageFromLayer(_x75, _x76) {
1124
+ return _getCoverageFromLayer.apply(this, arguments);
1000
1125
  }
1001
- return getCoverage;
1126
+ return getCoverageFromLayer;
1002
1127
  }()
1003
1128
  /**
1004
1129
  * Renames the existing bands of a coverage layer.
@@ -1018,7 +1143,7 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
1018
1143
  value: (function () {
1019
1144
  var _renameCoverageBands = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee16(workspace, dataStore, layername, bandNames) {
1020
1145
  var body, url, response, geoServerResponse;
1021
- return _regenerator["default"].wrap(function _callee16$(_context16) {
1146
+ return _regenerator["default"].wrap(function (_context16) {
1022
1147
  while (1) switch (_context16.prev = _context16.next) {
1023
1148
  case 0:
1024
1149
  body = {
@@ -1034,7 +1159,7 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
1034
1159
  });
1035
1160
  });
1036
1161
  url = this.url + 'workspaces/' + workspace + '/coveragestores/' + dataStore + '/coverages/' + layername + '.json';
1037
- _context16.next = 5;
1162
+ _context16.next = 1;
1038
1163
  return (0, _nodeFetch["default"])(url, {
1039
1164
  credentials: 'include',
1040
1165
  method: 'PUT',
@@ -1044,27 +1169,173 @@ var LayerClient = exports["default"] = /*#__PURE__*/function () {
1044
1169
  },
1045
1170
  body: JSON.stringify(body)
1046
1171
  });
1047
- case 5:
1172
+ case 1:
1048
1173
  response = _context16.sent;
1049
1174
  if (response.ok) {
1050
- _context16.next = 11;
1175
+ _context16.next = 3;
1051
1176
  break;
1052
1177
  }
1053
- _context16.next = 9;
1178
+ _context16.next = 2;
1054
1179
  return (0, _geoserver.getGeoServerResponseText)(response);
1055
- case 9:
1180
+ case 2:
1056
1181
  geoServerResponse = _context16.sent;
1057
1182
  throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
1058
- case 11:
1183
+ case 3:
1059
1184
  case "end":
1060
1185
  return _context16.stop();
1061
1186
  }
1062
1187
  }, _callee16, this);
1063
1188
  }));
1064
- function renameCoverageBands(_x75, _x76, _x77, _x78) {
1189
+ function renameCoverageBands(_x77, _x78, _x79, _x80) {
1065
1190
  return _renameCoverageBands.apply(this, arguments);
1066
1191
  }
1067
1192
  return renameCoverageBands;
1193
+ }()
1194
+ /**
1195
+ * Returns the data store of a layer.
1196
+ *
1197
+ * @param {String} workspace The workspace of the layer
1198
+ * @param {String} layer The name of the layer
1199
+ *
1200
+ * @throws GeoServerResponseError if request fails or layer does not exist or lacks a data store.
1201
+ *
1202
+ * @returns {Object} The data store object
1203
+ */
1204
+ )
1205
+ }, {
1206
+ key: "getDataStore",
1207
+ value: (function () {
1208
+ var _getDataStore = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee17(workspace, layer) {
1209
+ var _featureTypeObj$featu;
1210
+ var featureTypeObj, url, response, grc, geoServerResponse;
1211
+ return _regenerator["default"].wrap(function (_context17) {
1212
+ while (1) switch (_context17.prev = _context17.next) {
1213
+ case 0:
1214
+ _context17.next = 1;
1215
+ return this.getFeatureTypeFromLayer(workspace, layer);
1216
+ case 1:
1217
+ featureTypeObj = _context17.sent;
1218
+ if (!(!featureTypeObj || !featureTypeObj.featureType || !featureTypeObj.featureType.store || !featureTypeObj.featureType.store.name)) {
1219
+ _context17.next = 2;
1220
+ break;
1221
+ }
1222
+ throw new _geoserver.GeoServerResponseError("Layer '".concat(workspace, ":").concat(layer, "' lacks a feature type or the feature type lacks a data store."));
1223
+ case 2:
1224
+ url = featureTypeObj === null || featureTypeObj === void 0 || (_featureTypeObj$featu = featureTypeObj.featureType) === null || _featureTypeObj$featu === void 0 || (_featureTypeObj$featu = _featureTypeObj$featu.store) === null || _featureTypeObj$featu === void 0 ? void 0 : _featureTypeObj$featu.href;
1225
+ _context17.next = 3;
1226
+ return (0, _nodeFetch["default"])(url, {
1227
+ credentials: 'include',
1228
+ method: 'GET',
1229
+ headers: {
1230
+ Authorization: this.auth
1231
+ }
1232
+ });
1233
+ case 3:
1234
+ response = _context17.sent;
1235
+ if (response.ok) {
1236
+ _context17.next = 7;
1237
+ break;
1238
+ }
1239
+ grc = new _about["default"](this.url, this.auth);
1240
+ _context17.next = 4;
1241
+ return grc.exists();
1242
+ case 4:
1243
+ if (!_context17.sent) {
1244
+ _context17.next = 5;
1245
+ break;
1246
+ }
1247
+ return _context17.abrupt("return");
1248
+ case 5:
1249
+ _context17.next = 6;
1250
+ return (0, _geoserver.getGeoServerResponseText)(response);
1251
+ case 6:
1252
+ geoServerResponse = _context17.sent;
1253
+ throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
1254
+ case 7:
1255
+ return _context17.abrupt("return", response.json());
1256
+ case 8:
1257
+ case "end":
1258
+ return _context17.stop();
1259
+ }
1260
+ }, _callee17, this);
1261
+ }));
1262
+ function getDataStore(_x81, _x82) {
1263
+ return _getDataStore.apply(this, arguments);
1264
+ }
1265
+ return getDataStore;
1266
+ }()
1267
+ /**
1268
+ * Returns the coverage store of a layer.
1269
+ *
1270
+ * @param {String} workspace The workspace of the layer
1271
+ * @param {String} layer The name of the layer
1272
+ *
1273
+ * @throws GeoServerResponseError if request fails or layer does not exist or lacks a coverage store.
1274
+ *
1275
+ * @returns {Object} The coverage store object
1276
+ */
1277
+ )
1278
+ }, {
1279
+ key: "getCoverageStore",
1280
+ value: (function () {
1281
+ var _getCoverageStore = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee18(workspace, layer) {
1282
+ var _coverageObj$coverage;
1283
+ var coverageObj, url, response, grc, geoServerResponse;
1284
+ return _regenerator["default"].wrap(function (_context18) {
1285
+ while (1) switch (_context18.prev = _context18.next) {
1286
+ case 0:
1287
+ _context18.next = 1;
1288
+ return this.getCoverageFromLayer(workspace, layer);
1289
+ case 1:
1290
+ coverageObj = _context18.sent;
1291
+ if (!(!coverageObj || !coverageObj.coverage || !coverageObj.coverage.store || !coverageObj.coverage.store.name)) {
1292
+ _context18.next = 2;
1293
+ break;
1294
+ }
1295
+ throw new _geoserver.GeoServerResponseError("Layer '".concat(workspace, ":").concat(layer, "' lacks a coverage or the coverage lacks a coverage store."));
1296
+ case 2:
1297
+ url = coverageObj === null || coverageObj === void 0 || (_coverageObj$coverage = coverageObj.coverage) === null || _coverageObj$coverage === void 0 || (_coverageObj$coverage = _coverageObj$coverage.store) === null || _coverageObj$coverage === void 0 ? void 0 : _coverageObj$coverage.href;
1298
+ _context18.next = 3;
1299
+ return (0, _nodeFetch["default"])(url, {
1300
+ credentials: 'include',
1301
+ method: 'GET',
1302
+ headers: {
1303
+ Authorization: this.auth
1304
+ }
1305
+ });
1306
+ case 3:
1307
+ response = _context18.sent;
1308
+ if (response.ok) {
1309
+ _context18.next = 7;
1310
+ break;
1311
+ }
1312
+ grc = new _about["default"](this.url, this.auth);
1313
+ _context18.next = 4;
1314
+ return grc.exists();
1315
+ case 4:
1316
+ if (!_context18.sent) {
1317
+ _context18.next = 5;
1318
+ break;
1319
+ }
1320
+ return _context18.abrupt("return");
1321
+ case 5:
1322
+ _context18.next = 6;
1323
+ return (0, _geoserver.getGeoServerResponseText)(response);
1324
+ case 6:
1325
+ geoServerResponse = _context18.sent;
1326
+ throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
1327
+ case 7:
1328
+ return _context18.abrupt("return", response.json());
1329
+ case 8:
1330
+ case "end":
1331
+ return _context18.stop();
1332
+ }
1333
+ }, _callee18, this);
1334
+ }));
1335
+ function getCoverageStore(_x83, _x84) {
1336
+ return _getCoverageStore.apply(this, arguments);
1337
+ }
1338
+ return getCoverageStore;
1068
1339
  }())
1069
1340
  }]);
1070
1341
  }();