geoserver-node-client 1.2.4 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/dist/geoserver-rest-client.js +4 -25
- package/dist/package.json +15 -16
- package/dist/src/about.js +42 -70
- package/dist/src/datastore.js +513 -654
- package/dist/src/imagemosaic.js +112 -164
- package/dist/src/layer.js +591 -797
- package/dist/src/layergroup.js +275 -0
- package/dist/src/namespace.js +126 -186
- package/dist/src/reset-reload.js +49 -78
- package/dist/src/security.js +117 -169
- package/dist/src/settings.js +137 -198
- package/dist/src/style.js +260 -376
- package/dist/src/util/geoserver.js +12 -36
- package/dist/src/workspace.js +133 -190
- package/geoserver-rest-client.js +3 -0
- package/package.json +15 -16
- package/src/datastore.js +22 -1
- package/src/layergroup.js +176 -0
- package/src/workspace.js +4 -3
package/dist/src/datastore.js
CHANGED
|
@@ -1,28 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
|
|
14
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
-
|
|
16
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
-
|
|
18
12
|
var _nodeFetch = _interopRequireDefault(require("node-fetch"));
|
|
19
|
-
|
|
20
13
|
var _fs = _interopRequireDefault(require("fs"));
|
|
21
|
-
|
|
22
14
|
var _geoserver = require("./util/geoserver.js");
|
|
23
|
-
|
|
24
15
|
var _about = _interopRequireDefault(require("./about.js"));
|
|
25
|
-
|
|
26
16
|
/**
|
|
27
17
|
* Client for GeoServer data stores
|
|
28
18
|
*
|
|
@@ -40,6 +30,7 @@ var DatastoreClient = /*#__PURE__*/function () {
|
|
|
40
30
|
this.url = url;
|
|
41
31
|
this.auth = auth;
|
|
42
32
|
}
|
|
33
|
+
|
|
43
34
|
/**
|
|
44
35
|
* Get all DataStores in a workspace.
|
|
45
36
|
*
|
|
@@ -47,30 +38,23 @@ var DatastoreClient = /*#__PURE__*/function () {
|
|
|
47
38
|
*
|
|
48
39
|
* @returns {Object} An object containing store details
|
|
49
40
|
*/
|
|
50
|
-
|
|
51
|
-
|
|
52
41
|
(0, _createClass2["default"])(DatastoreClient, [{
|
|
53
42
|
key: "getDataStores",
|
|
54
43
|
value: function () {
|
|
55
44
|
var _getDataStores = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(workspace) {
|
|
56
45
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
57
|
-
while (1) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
case "end":
|
|
64
|
-
return _context.stop();
|
|
65
|
-
}
|
|
46
|
+
while (1) switch (_context.prev = _context.next) {
|
|
47
|
+
case 0:
|
|
48
|
+
return _context.abrupt("return", this.getStores(workspace, 'datastores'));
|
|
49
|
+
case 1:
|
|
50
|
+
case "end":
|
|
51
|
+
return _context.stop();
|
|
66
52
|
}
|
|
67
53
|
}, _callee, this);
|
|
68
54
|
}));
|
|
69
|
-
|
|
70
55
|
function getDataStores(_x) {
|
|
71
56
|
return _getDataStores.apply(this, arguments);
|
|
72
57
|
}
|
|
73
|
-
|
|
74
58
|
return getDataStores;
|
|
75
59
|
}()
|
|
76
60
|
/**
|
|
@@ -80,29 +64,23 @@ var DatastoreClient = /*#__PURE__*/function () {
|
|
|
80
64
|
*
|
|
81
65
|
* @returns {Object} An object containing store details
|
|
82
66
|
*/
|
|
83
|
-
|
|
84
67
|
}, {
|
|
85
68
|
key: "getCoverageStores",
|
|
86
69
|
value: function () {
|
|
87
70
|
var _getCoverageStores = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(workspace) {
|
|
88
71
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
89
|
-
while (1) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
case "end":
|
|
96
|
-
return _context2.stop();
|
|
97
|
-
}
|
|
72
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
73
|
+
case 0:
|
|
74
|
+
return _context2.abrupt("return", this.getStores(workspace, 'coveragestores'));
|
|
75
|
+
case 1:
|
|
76
|
+
case "end":
|
|
77
|
+
return _context2.stop();
|
|
98
78
|
}
|
|
99
79
|
}, _callee2, this);
|
|
100
80
|
}));
|
|
101
|
-
|
|
102
81
|
function getCoverageStores(_x2) {
|
|
103
82
|
return _getCoverageStores.apply(this, arguments);
|
|
104
83
|
}
|
|
105
|
-
|
|
106
84
|
return getCoverageStores;
|
|
107
85
|
}()
|
|
108
86
|
/**
|
|
@@ -112,29 +90,23 @@ var DatastoreClient = /*#__PURE__*/function () {
|
|
|
112
90
|
*
|
|
113
91
|
* @returns {Object} An object containing store details
|
|
114
92
|
*/
|
|
115
|
-
|
|
116
93
|
}, {
|
|
117
94
|
key: "getWmsStores",
|
|
118
95
|
value: function () {
|
|
119
96
|
var _getWmsStores = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(workspace) {
|
|
120
97
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
121
|
-
while (1) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
case "end":
|
|
128
|
-
return _context3.stop();
|
|
129
|
-
}
|
|
98
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
99
|
+
case 0:
|
|
100
|
+
return _context3.abrupt("return", this.getStores(workspace, 'wmsstores'));
|
|
101
|
+
case 1:
|
|
102
|
+
case "end":
|
|
103
|
+
return _context3.stop();
|
|
130
104
|
}
|
|
131
105
|
}, _callee3, this);
|
|
132
106
|
}));
|
|
133
|
-
|
|
134
107
|
function getWmsStores(_x3) {
|
|
135
108
|
return _getWmsStores.apply(this, arguments);
|
|
136
109
|
}
|
|
137
|
-
|
|
138
110
|
return getWmsStores;
|
|
139
111
|
}()
|
|
140
112
|
/**
|
|
@@ -144,29 +116,23 @@ var DatastoreClient = /*#__PURE__*/function () {
|
|
|
144
116
|
*
|
|
145
117
|
* @returns {Object} An object containing store details
|
|
146
118
|
*/
|
|
147
|
-
|
|
148
119
|
}, {
|
|
149
120
|
key: "getWmtsStores",
|
|
150
121
|
value: function () {
|
|
151
122
|
var _getWmtsStores = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(workspace) {
|
|
152
123
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
153
|
-
while (1) {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
case "end":
|
|
160
|
-
return _context4.stop();
|
|
161
|
-
}
|
|
124
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
125
|
+
case 0:
|
|
126
|
+
return _context4.abrupt("return", this.getStores(workspace, 'wmtsstores'));
|
|
127
|
+
case 1:
|
|
128
|
+
case "end":
|
|
129
|
+
return _context4.stop();
|
|
162
130
|
}
|
|
163
131
|
}, _callee4, this);
|
|
164
132
|
}));
|
|
165
|
-
|
|
166
133
|
function getWmtsStores(_x4) {
|
|
167
134
|
return _getWmtsStores.apply(this, arguments);
|
|
168
135
|
}
|
|
169
|
-
|
|
170
136
|
return getWmtsStores;
|
|
171
137
|
}()
|
|
172
138
|
/**
|
|
@@ -180,55 +146,44 @@ var DatastoreClient = /*#__PURE__*/function () {
|
|
|
180
146
|
* @returns {Object} An object containing store details or undefined if it cannot be found
|
|
181
147
|
* @private
|
|
182
148
|
*/
|
|
183
|
-
|
|
184
149
|
}, {
|
|
185
150
|
key: "getStores",
|
|
186
151
|
value: function () {
|
|
187
152
|
var _getStores = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(workspace, storeType) {
|
|
188
153
|
var response, geoServerResponse;
|
|
189
154
|
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
190
|
-
while (1) {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
Authorization: this.auth
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
case 2:
|
|
203
|
-
response = _context5.sent;
|
|
204
|
-
|
|
205
|
-
if (response.ok) {
|
|
206
|
-
_context5.next = 8;
|
|
207
|
-
break;
|
|
155
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
156
|
+
case 0:
|
|
157
|
+
_context5.next = 2;
|
|
158
|
+
return (0, _nodeFetch["default"])(this.url + 'workspaces/' + workspace + '/' + storeType + '.json', {
|
|
159
|
+
credentials: 'include',
|
|
160
|
+
method: 'GET',
|
|
161
|
+
headers: {
|
|
162
|
+
Authorization: this.auth
|
|
208
163
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
164
|
+
});
|
|
165
|
+
case 2:
|
|
166
|
+
response = _context5.sent;
|
|
167
|
+
if (response.ok) {
|
|
168
|
+
_context5.next = 8;
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
_context5.next = 6;
|
|
172
|
+
return (0, _geoserver.getGeoServerResponseText)(response);
|
|
173
|
+
case 6:
|
|
174
|
+
geoServerResponse = _context5.sent;
|
|
175
|
+
throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
|
|
176
|
+
case 8:
|
|
177
|
+
return _context5.abrupt("return", response.json());
|
|
178
|
+
case 9:
|
|
179
|
+
case "end":
|
|
180
|
+
return _context5.stop();
|
|
224
181
|
}
|
|
225
182
|
}, _callee5, this);
|
|
226
183
|
}));
|
|
227
|
-
|
|
228
184
|
function getStores(_x5, _x6) {
|
|
229
185
|
return _getStores.apply(this, arguments);
|
|
230
186
|
}
|
|
231
|
-
|
|
232
187
|
return getStores;
|
|
233
188
|
}()
|
|
234
189
|
/**
|
|
@@ -239,29 +194,23 @@ var DatastoreClient = /*#__PURE__*/function () {
|
|
|
239
194
|
*
|
|
240
195
|
* @returns {Object} An object containing store details or undefined if it cannot be found
|
|
241
196
|
*/
|
|
242
|
-
|
|
243
197
|
}, {
|
|
244
198
|
key: "getDataStore",
|
|
245
199
|
value: function () {
|
|
246
200
|
var _getDataStore = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(workspace, dataStore) {
|
|
247
201
|
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
248
|
-
while (1) {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
case "end":
|
|
255
|
-
return _context6.stop();
|
|
256
|
-
}
|
|
202
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
203
|
+
case 0:
|
|
204
|
+
return _context6.abrupt("return", this.getStore(workspace, dataStore, 'datastores'));
|
|
205
|
+
case 1:
|
|
206
|
+
case "end":
|
|
207
|
+
return _context6.stop();
|
|
257
208
|
}
|
|
258
209
|
}, _callee6, this);
|
|
259
210
|
}));
|
|
260
|
-
|
|
261
211
|
function getDataStore(_x7, _x8) {
|
|
262
212
|
return _getDataStore.apply(this, arguments);
|
|
263
213
|
}
|
|
264
|
-
|
|
265
214
|
return getDataStore;
|
|
266
215
|
}()
|
|
267
216
|
/**
|
|
@@ -272,29 +221,23 @@ var DatastoreClient = /*#__PURE__*/function () {
|
|
|
272
221
|
*
|
|
273
222
|
* @returns {Object} An object containing store details or undefined if it cannot be found
|
|
274
223
|
*/
|
|
275
|
-
|
|
276
224
|
}, {
|
|
277
225
|
key: "getCoverageStore",
|
|
278
226
|
value: function () {
|
|
279
227
|
var _getCoverageStore = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(workspace, covStore) {
|
|
280
228
|
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
281
|
-
while (1) {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
case "end":
|
|
288
|
-
return _context7.stop();
|
|
289
|
-
}
|
|
229
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
230
|
+
case 0:
|
|
231
|
+
return _context7.abrupt("return", this.getStore(workspace, covStore, 'coveragestores'));
|
|
232
|
+
case 1:
|
|
233
|
+
case "end":
|
|
234
|
+
return _context7.stop();
|
|
290
235
|
}
|
|
291
236
|
}, _callee7, this);
|
|
292
237
|
}));
|
|
293
|
-
|
|
294
238
|
function getCoverageStore(_x9, _x10) {
|
|
295
239
|
return _getCoverageStore.apply(this, arguments);
|
|
296
240
|
}
|
|
297
|
-
|
|
298
241
|
return getCoverageStore;
|
|
299
242
|
}()
|
|
300
243
|
/**
|
|
@@ -306,29 +249,23 @@ var DatastoreClient = /*#__PURE__*/function () {
|
|
|
306
249
|
* @returns {Object} An object containing store details or undefined if it cannot be found
|
|
307
250
|
*
|
|
308
251
|
*/
|
|
309
|
-
|
|
310
252
|
}, {
|
|
311
253
|
key: "getWmsStore",
|
|
312
254
|
value: function () {
|
|
313
255
|
var _getWmsStore = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(workspace, wmsStore) {
|
|
314
256
|
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
315
|
-
while (1) {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
case "end":
|
|
322
|
-
return _context8.stop();
|
|
323
|
-
}
|
|
257
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
258
|
+
case 0:
|
|
259
|
+
return _context8.abrupt("return", this.getStore(workspace, wmsStore, 'wmsstores'));
|
|
260
|
+
case 1:
|
|
261
|
+
case "end":
|
|
262
|
+
return _context8.stop();
|
|
324
263
|
}
|
|
325
264
|
}, _callee8, this);
|
|
326
265
|
}));
|
|
327
|
-
|
|
328
266
|
function getWmsStore(_x11, _x12) {
|
|
329
267
|
return _getWmsStore.apply(this, arguments);
|
|
330
268
|
}
|
|
331
|
-
|
|
332
269
|
return getWmsStore;
|
|
333
270
|
}()
|
|
334
271
|
/**
|
|
@@ -339,29 +276,23 @@ var DatastoreClient = /*#__PURE__*/function () {
|
|
|
339
276
|
*
|
|
340
277
|
* @returns {Object} An object containing store details or undefined if it cannot be found
|
|
341
278
|
*/
|
|
342
|
-
|
|
343
279
|
}, {
|
|
344
280
|
key: "getWmtsStore",
|
|
345
281
|
value: function () {
|
|
346
282
|
var _getWmtsStore = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(workspace, wmtsStore) {
|
|
347
283
|
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
348
|
-
while (1) {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
case "end":
|
|
355
|
-
return _context9.stop();
|
|
356
|
-
}
|
|
284
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
285
|
+
case 0:
|
|
286
|
+
return _context9.abrupt("return", this.getStore(workspace, wmtsStore, 'wmtsstores'));
|
|
287
|
+
case 1:
|
|
288
|
+
case "end":
|
|
289
|
+
return _context9.stop();
|
|
357
290
|
}
|
|
358
291
|
}, _callee9, this);
|
|
359
292
|
}));
|
|
360
|
-
|
|
361
293
|
function getWmtsStore(_x13, _x14) {
|
|
362
294
|
return _getWmtsStore.apply(this, arguments);
|
|
363
295
|
}
|
|
364
|
-
|
|
365
296
|
return getWmtsStore;
|
|
366
297
|
}()
|
|
367
298
|
/**
|
|
@@ -376,69 +307,55 @@ var DatastoreClient = /*#__PURE__*/function () {
|
|
|
376
307
|
* @returns {Object} An object containing store details or undefined if it cannot be found
|
|
377
308
|
* @private
|
|
378
309
|
*/
|
|
379
|
-
|
|
380
310
|
}, {
|
|
381
311
|
key: "getStore",
|
|
382
312
|
value: function () {
|
|
383
313
|
var _getStore = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(workspace, storeName, storeType) {
|
|
384
314
|
var url, response, grc, geoServerResponse;
|
|
385
315
|
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
386
|
-
while (1) {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
Authorization: this.auth
|
|
396
|
-
}
|
|
397
|
-
});
|
|
398
|
-
|
|
399
|
-
case 3:
|
|
400
|
-
response = _context10.sent;
|
|
401
|
-
|
|
402
|
-
if (response.ok) {
|
|
403
|
-
_context10.next = 16;
|
|
404
|
-
break;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
grc = new _about["default"](this.url, this.auth);
|
|
408
|
-
_context10.next = 8;
|
|
409
|
-
return grc.exists();
|
|
410
|
-
|
|
411
|
-
case 8:
|
|
412
|
-
if (!_context10.sent) {
|
|
413
|
-
_context10.next = 12;
|
|
414
|
-
break;
|
|
316
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
317
|
+
case 0:
|
|
318
|
+
url = this.url + 'workspaces/' + workspace + '/' + storeType + '/' + storeName + '.json';
|
|
319
|
+
_context10.next = 3;
|
|
320
|
+
return (0, _nodeFetch["default"])(url, {
|
|
321
|
+
credentials: 'include',
|
|
322
|
+
method: 'GET',
|
|
323
|
+
headers: {
|
|
324
|
+
Authorization: this.auth
|
|
415
325
|
}
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
_context10.next =
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
326
|
+
});
|
|
327
|
+
case 3:
|
|
328
|
+
response = _context10.sent;
|
|
329
|
+
if (response.ok) {
|
|
330
|
+
_context10.next = 16;
|
|
331
|
+
break;
|
|
332
|
+
}
|
|
333
|
+
grc = new _about["default"](this.url, this.auth);
|
|
334
|
+
_context10.next = 8;
|
|
335
|
+
return grc.exists();
|
|
336
|
+
case 8:
|
|
337
|
+
if (!_context10.sent) {
|
|
338
|
+
_context10.next = 12;
|
|
339
|
+
break;
|
|
340
|
+
}
|
|
341
|
+
return _context10.abrupt("return");
|
|
342
|
+
case 12:
|
|
343
|
+
_context10.next = 14;
|
|
344
|
+
return (0, _geoserver.getGeoServerResponseText)(response);
|
|
345
|
+
case 14:
|
|
346
|
+
geoServerResponse = _context10.sent;
|
|
347
|
+
throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
|
|
348
|
+
case 16:
|
|
349
|
+
return _context10.abrupt("return", response.json());
|
|
350
|
+
case 17:
|
|
351
|
+
case "end":
|
|
352
|
+
return _context10.stop();
|
|
434
353
|
}
|
|
435
354
|
}, _callee10, this);
|
|
436
355
|
}));
|
|
437
|
-
|
|
438
356
|
function getStore(_x15, _x16, _x17) {
|
|
439
357
|
return _getStore.apply(this, arguments);
|
|
440
358
|
}
|
|
441
|
-
|
|
442
359
|
return getStore;
|
|
443
360
|
}()
|
|
444
361
|
/**
|
|
@@ -456,66 +373,91 @@ var DatastoreClient = /*#__PURE__*/function () {
|
|
|
456
373
|
*
|
|
457
374
|
* @returns {String} The successful response text
|
|
458
375
|
*/
|
|
459
|
-
|
|
460
376
|
}, {
|
|
461
377
|
key: "createGeotiffFromFile",
|
|
462
378
|
value: function () {
|
|
463
379
|
var _createGeotiffFromFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(workspace, coverageStore, layerName, layerTitle, filePath) {
|
|
464
|
-
var
|
|
380
|
+
var stats, fileSizeInBytes, readStream;
|
|
465
381
|
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
|
466
|
-
while (1) {
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
_context11.next = 8;
|
|
476
|
-
return (0, _nodeFetch["default"])(url, {
|
|
477
|
-
credentials: 'include',
|
|
478
|
-
method: 'PUT',
|
|
479
|
-
headers: {
|
|
480
|
-
Authorization: this.auth,
|
|
481
|
-
'Content-Type': 'image/tiff',
|
|
482
|
-
'Content-length': fileSizeInBytes
|
|
483
|
-
},
|
|
484
|
-
body: readStream
|
|
485
|
-
});
|
|
486
|
-
|
|
487
|
-
case 8:
|
|
488
|
-
response = _context11.sent;
|
|
489
|
-
|
|
490
|
-
if (response.ok) {
|
|
491
|
-
_context11.next = 14;
|
|
492
|
-
break;
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
_context11.next = 12;
|
|
496
|
-
return (0, _geoserver.getGeoServerResponseText)(response);
|
|
497
|
-
|
|
498
|
-
case 12:
|
|
499
|
-
geoServerResponse = _context11.sent;
|
|
500
|
-
throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
|
|
501
|
-
|
|
502
|
-
case 14:
|
|
503
|
-
return _context11.abrupt("return", response.text());
|
|
504
|
-
|
|
505
|
-
case 15:
|
|
506
|
-
case "end":
|
|
507
|
-
return _context11.stop();
|
|
508
|
-
}
|
|
382
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
383
|
+
case 0:
|
|
384
|
+
stats = _fs["default"].statSync(filePath);
|
|
385
|
+
fileSizeInBytes = stats.size;
|
|
386
|
+
readStream = _fs["default"].createReadStream(filePath);
|
|
387
|
+
return _context11.abrupt("return", this.createGeotiffFromStream(workspace, coverageStore, layerName, layerTitle, readStream, fileSizeInBytes));
|
|
388
|
+
case 4:
|
|
389
|
+
case "end":
|
|
390
|
+
return _context11.stop();
|
|
509
391
|
}
|
|
510
392
|
}, _callee11, this);
|
|
511
393
|
}));
|
|
512
|
-
|
|
513
394
|
function createGeotiffFromFile(_x18, _x19, _x20, _x21, _x22) {
|
|
514
395
|
return _createGeotiffFromFile.apply(this, arguments);
|
|
515
396
|
}
|
|
516
|
-
|
|
517
397
|
return createGeotiffFromFile;
|
|
518
398
|
}()
|
|
399
|
+
/**
|
|
400
|
+
* Creates a GeoTIFF store from a file by stream and publishes it as layer.
|
|
401
|
+
* The GeoTIFF file is placed on the server, where your GeoServer
|
|
402
|
+
* is running.
|
|
403
|
+
*
|
|
404
|
+
* @param {String} workspace The workspace to create GeoTIFF store in
|
|
405
|
+
* @param {String} coverageStore The name of the new GeoTIFF store
|
|
406
|
+
* @param {String} layerName The published name of the new layer
|
|
407
|
+
* @param {String} layerTitle The published title of the new layer
|
|
408
|
+
* @param {Stream} readStream The stream of the GeoTIFF file
|
|
409
|
+
* @param {Number} fileSizeInBytes The number of bytes of the stream
|
|
410
|
+
*
|
|
411
|
+
* @throws Error if request fails
|
|
412
|
+
*
|
|
413
|
+
* @returns {String} The successful response text
|
|
414
|
+
*/
|
|
415
|
+
}, {
|
|
416
|
+
key: "createGeotiffFromStream",
|
|
417
|
+
value: function () {
|
|
418
|
+
var _createGeotiffFromStream = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(workspace, coverageStore, layerName, layerTitle, readStream, fileSizeInBytes) {
|
|
419
|
+
var lyrTitle, url, response, geoServerResponse;
|
|
420
|
+
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
|
421
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
422
|
+
case 0:
|
|
423
|
+
lyrTitle = layerTitle || layerName;
|
|
424
|
+
url = this.url + 'workspaces/' + workspace + '/coveragestores/' + coverageStore + '/file.geotiff';
|
|
425
|
+
url += '?filename=' + lyrTitle + '&coverageName=' + layerName;
|
|
426
|
+
_context12.next = 5;
|
|
427
|
+
return (0, _nodeFetch["default"])(url, {
|
|
428
|
+
credentials: 'include',
|
|
429
|
+
method: 'PUT',
|
|
430
|
+
headers: {
|
|
431
|
+
Authorization: this.auth,
|
|
432
|
+
'Content-Type': 'image/tiff',
|
|
433
|
+
'Content-length': fileSizeInBytes
|
|
434
|
+
},
|
|
435
|
+
body: readStream
|
|
436
|
+
});
|
|
437
|
+
case 5:
|
|
438
|
+
response = _context12.sent;
|
|
439
|
+
if (response.ok) {
|
|
440
|
+
_context12.next = 11;
|
|
441
|
+
break;
|
|
442
|
+
}
|
|
443
|
+
_context12.next = 9;
|
|
444
|
+
return (0, _geoserver.getGeoServerResponseText)(response);
|
|
445
|
+
case 9:
|
|
446
|
+
geoServerResponse = _context12.sent;
|
|
447
|
+
throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
|
|
448
|
+
case 11:
|
|
449
|
+
return _context12.abrupt("return", response.text());
|
|
450
|
+
case 12:
|
|
451
|
+
case "end":
|
|
452
|
+
return _context12.stop();
|
|
453
|
+
}
|
|
454
|
+
}, _callee12, this);
|
|
455
|
+
}));
|
|
456
|
+
function createGeotiffFromStream(_x23, _x24, _x25, _x26, _x27, _x28) {
|
|
457
|
+
return _createGeotiffFromStream.apply(this, arguments);
|
|
458
|
+
}
|
|
459
|
+
return createGeotiffFromStream;
|
|
460
|
+
}()
|
|
519
461
|
/**
|
|
520
462
|
* Creates a PostGIS based data store.
|
|
521
463
|
*
|
|
@@ -532,95 +474,85 @@ var DatastoreClient = /*#__PURE__*/function () {
|
|
|
532
474
|
*
|
|
533
475
|
* @throws Error if request fails
|
|
534
476
|
*/
|
|
535
|
-
|
|
536
477
|
}, {
|
|
537
478
|
key: "createPostgisStore",
|
|
538
479
|
value: function () {
|
|
539
|
-
var _createPostgisStore = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
480
|
+
var _createPostgisStore = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(workspace, namespaceUri, dataStore, pgHost, pgPort, pgUser, pgPassword, pgSchema, pgDb, exposePk) {
|
|
540
481
|
var body, url, response, geoServerResponse;
|
|
541
|
-
return _regenerator["default"].wrap(function
|
|
542
|
-
while (1) {
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
name: workspace
|
|
552
|
-
},
|
|
553
|
-
connectionParameters: {
|
|
554
|
-
entry: [{
|
|
555
|
-
'@key': 'dbtype',
|
|
556
|
-
$: 'postgis'
|
|
557
|
-
}, {
|
|
558
|
-
'@key': 'schema',
|
|
559
|
-
$: pgSchema
|
|
560
|
-
}, {
|
|
561
|
-
'@key': 'database',
|
|
562
|
-
$: pgDb
|
|
563
|
-
}, {
|
|
564
|
-
'@key': 'host',
|
|
565
|
-
$: pgHost
|
|
566
|
-
}, {
|
|
567
|
-
'@key': 'port',
|
|
568
|
-
$: pgPort
|
|
569
|
-
}, {
|
|
570
|
-
'@key': 'passwd',
|
|
571
|
-
$: pgPassword
|
|
572
|
-
}, {
|
|
573
|
-
'@key': 'namespace',
|
|
574
|
-
$: namespaceUri
|
|
575
|
-
}, {
|
|
576
|
-
'@key': 'user',
|
|
577
|
-
$: pgUser
|
|
578
|
-
}, {
|
|
579
|
-
'@key': 'Expose primary keys',
|
|
580
|
-
$: exposePk || false
|
|
581
|
-
}]
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
};
|
|
585
|
-
url = this.url + 'workspaces/' + workspace + '/datastores';
|
|
586
|
-
_context12.next = 4;
|
|
587
|
-
return (0, _nodeFetch["default"])(url, {
|
|
588
|
-
credentials: 'include',
|
|
589
|
-
method: 'POST',
|
|
590
|
-
headers: {
|
|
591
|
-
Authorization: this.auth,
|
|
592
|
-
'Content-Type': 'application/json'
|
|
482
|
+
return _regenerator["default"].wrap(function _callee13$(_context13) {
|
|
483
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
484
|
+
case 0:
|
|
485
|
+
body = {
|
|
486
|
+
dataStore: {
|
|
487
|
+
name: dataStore,
|
|
488
|
+
type: 'PostGIS',
|
|
489
|
+
enabled: true,
|
|
490
|
+
workspace: {
|
|
491
|
+
name: workspace
|
|
593
492
|
},
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
493
|
+
connectionParameters: {
|
|
494
|
+
entry: [{
|
|
495
|
+
'@key': 'dbtype',
|
|
496
|
+
$: 'postgis'
|
|
497
|
+
}, {
|
|
498
|
+
'@key': 'schema',
|
|
499
|
+
$: pgSchema
|
|
500
|
+
}, {
|
|
501
|
+
'@key': 'database',
|
|
502
|
+
$: pgDb
|
|
503
|
+
}, {
|
|
504
|
+
'@key': 'host',
|
|
505
|
+
$: pgHost
|
|
506
|
+
}, {
|
|
507
|
+
'@key': 'port',
|
|
508
|
+
$: pgPort
|
|
509
|
+
}, {
|
|
510
|
+
'@key': 'passwd',
|
|
511
|
+
$: pgPassword
|
|
512
|
+
}, {
|
|
513
|
+
'@key': 'namespace',
|
|
514
|
+
$: namespaceUri
|
|
515
|
+
}, {
|
|
516
|
+
'@key': 'user',
|
|
517
|
+
$: pgUser
|
|
518
|
+
}, {
|
|
519
|
+
'@key': 'Expose primary keys',
|
|
520
|
+
$: exposePk || false
|
|
521
|
+
}]
|
|
522
|
+
}
|
|
603
523
|
}
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
524
|
+
};
|
|
525
|
+
url = this.url + 'workspaces/' + workspace + '/datastores';
|
|
526
|
+
_context13.next = 4;
|
|
527
|
+
return (0, _nodeFetch["default"])(url, {
|
|
528
|
+
credentials: 'include',
|
|
529
|
+
method: 'POST',
|
|
530
|
+
headers: {
|
|
531
|
+
Authorization: this.auth,
|
|
532
|
+
'Content-Type': 'application/json'
|
|
533
|
+
},
|
|
534
|
+
body: JSON.stringify(body)
|
|
535
|
+
});
|
|
536
|
+
case 4:
|
|
537
|
+
response = _context13.sent;
|
|
538
|
+
if (response.ok) {
|
|
539
|
+
_context13.next = 10;
|
|
540
|
+
break;
|
|
541
|
+
}
|
|
542
|
+
_context13.next = 8;
|
|
543
|
+
return (0, _geoserver.getGeoServerResponseText)(response);
|
|
544
|
+
case 8:
|
|
545
|
+
geoServerResponse = _context13.sent;
|
|
546
|
+
throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
|
|
547
|
+
case 10:
|
|
548
|
+
case "end":
|
|
549
|
+
return _context13.stop();
|
|
616
550
|
}
|
|
617
|
-
},
|
|
551
|
+
}, _callee13, this);
|
|
618
552
|
}));
|
|
619
|
-
|
|
620
|
-
function createPostgisStore(_x23, _x24, _x25, _x26, _x27, _x28, _x29, _x30, _x31, _x32) {
|
|
553
|
+
function createPostgisStore(_x29, _x30, _x31, _x32, _x33, _x34, _x35, _x36, _x37, _x38) {
|
|
621
554
|
return _createPostgisStore.apply(this, arguments);
|
|
622
555
|
}
|
|
623
|
-
|
|
624
556
|
return createPostgisStore;
|
|
625
557
|
}()
|
|
626
558
|
/**
|
|
@@ -640,59 +572,48 @@ var DatastoreClient = /*#__PURE__*/function () {
|
|
|
640
572
|
*
|
|
641
573
|
* @returns {String} The response text
|
|
642
574
|
*/
|
|
643
|
-
|
|
644
575
|
}, {
|
|
645
576
|
key: "createImageMosaicStore",
|
|
646
577
|
value: function () {
|
|
647
|
-
var _createImageMosaicStore = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
578
|
+
var _createImageMosaicStore = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14(workspace, coverageStore, zipArchivePath) {
|
|
648
579
|
var readStream, url, response, geoServerResponse;
|
|
649
|
-
return _regenerator["default"].wrap(function
|
|
650
|
-
while (1) {
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
case 10:
|
|
682
|
-
return _context13.abrupt("return", response.text());
|
|
683
|
-
|
|
684
|
-
case 11:
|
|
685
|
-
case "end":
|
|
686
|
-
return _context13.stop();
|
|
687
|
-
}
|
|
580
|
+
return _regenerator["default"].wrap(function _callee14$(_context14) {
|
|
581
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
582
|
+
case 0:
|
|
583
|
+
readStream = _fs["default"].createReadStream(zipArchivePath);
|
|
584
|
+
url = this.url + 'workspaces/' + workspace + '/coveragestores/' + coverageStore + '/file.imagemosaic';
|
|
585
|
+
_context14.next = 4;
|
|
586
|
+
return (0, _nodeFetch["default"])(url, {
|
|
587
|
+
credentials: 'include',
|
|
588
|
+
method: 'PUT',
|
|
589
|
+
headers: {
|
|
590
|
+
Authorization: this.auth,
|
|
591
|
+
'Content-Type': 'application/zip'
|
|
592
|
+
},
|
|
593
|
+
body: readStream
|
|
594
|
+
});
|
|
595
|
+
case 4:
|
|
596
|
+
response = _context14.sent;
|
|
597
|
+
if (response.ok) {
|
|
598
|
+
_context14.next = 10;
|
|
599
|
+
break;
|
|
600
|
+
}
|
|
601
|
+
_context14.next = 8;
|
|
602
|
+
return (0, _geoserver.getGeoServerResponseText)(response);
|
|
603
|
+
case 8:
|
|
604
|
+
geoServerResponse = _context14.sent;
|
|
605
|
+
throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
|
|
606
|
+
case 10:
|
|
607
|
+
return _context14.abrupt("return", response.text());
|
|
608
|
+
case 11:
|
|
609
|
+
case "end":
|
|
610
|
+
return _context14.stop();
|
|
688
611
|
}
|
|
689
|
-
},
|
|
612
|
+
}, _callee14, this);
|
|
690
613
|
}));
|
|
691
|
-
|
|
692
|
-
function createImageMosaicStore(_x33, _x34, _x35) {
|
|
614
|
+
function createImageMosaicStore(_x39, _x40, _x41) {
|
|
693
615
|
return _createImageMosaicStore.apply(this, arguments);
|
|
694
616
|
}
|
|
695
|
-
|
|
696
617
|
return createImageMosaicStore;
|
|
697
618
|
}()
|
|
698
619
|
}, {
|
|
@@ -708,58 +629,49 @@ var DatastoreClient = /*#__PURE__*/function () {
|
|
|
708
629
|
* @throws Error if request fails
|
|
709
630
|
*/
|
|
710
631
|
function () {
|
|
711
|
-
var _createWmsStore = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
632
|
+
var _createWmsStore = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15(workspace, dataStore, wmsCapabilitiesUrl) {
|
|
712
633
|
var body, url, response, geoServerResponse;
|
|
713
|
-
return _regenerator["default"].wrap(function
|
|
714
|
-
while (1) {
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
capabilitiesURL: wmsCapabilitiesUrl
|
|
722
|
-
}
|
|
723
|
-
};
|
|
724
|
-
url = this.url + 'workspaces/' + workspace + '/wmsstores';
|
|
725
|
-
_context14.next = 4;
|
|
726
|
-
return (0, _nodeFetch["default"])(url, {
|
|
727
|
-
credentials: 'include',
|
|
728
|
-
method: 'POST',
|
|
729
|
-
headers: {
|
|
730
|
-
Authorization: this.auth,
|
|
731
|
-
'Content-Type': 'application/json'
|
|
732
|
-
},
|
|
733
|
-
body: JSON.stringify(body)
|
|
734
|
-
});
|
|
735
|
-
|
|
736
|
-
case 4:
|
|
737
|
-
response = _context14.sent;
|
|
738
|
-
|
|
739
|
-
if (response.ok) {
|
|
740
|
-
_context14.next = 10;
|
|
741
|
-
break;
|
|
634
|
+
return _regenerator["default"].wrap(function _callee15$(_context15) {
|
|
635
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
636
|
+
case 0:
|
|
637
|
+
body = {
|
|
638
|
+
wmsStore: {
|
|
639
|
+
name: dataStore,
|
|
640
|
+
type: 'WMS',
|
|
641
|
+
capabilitiesURL: wmsCapabilitiesUrl
|
|
742
642
|
}
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
643
|
+
};
|
|
644
|
+
url = this.url + 'workspaces/' + workspace + '/wmsstores';
|
|
645
|
+
_context15.next = 4;
|
|
646
|
+
return (0, _nodeFetch["default"])(url, {
|
|
647
|
+
credentials: 'include',
|
|
648
|
+
method: 'POST',
|
|
649
|
+
headers: {
|
|
650
|
+
Authorization: this.auth,
|
|
651
|
+
'Content-Type': 'application/json'
|
|
652
|
+
},
|
|
653
|
+
body: JSON.stringify(body)
|
|
654
|
+
});
|
|
655
|
+
case 4:
|
|
656
|
+
response = _context15.sent;
|
|
657
|
+
if (response.ok) {
|
|
658
|
+
_context15.next = 10;
|
|
659
|
+
break;
|
|
660
|
+
}
|
|
661
|
+
_context15.next = 8;
|
|
662
|
+
return (0, _geoserver.getGeoServerResponseText)(response);
|
|
663
|
+
case 8:
|
|
664
|
+
geoServerResponse = _context15.sent;
|
|
665
|
+
throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
|
|
666
|
+
case 10:
|
|
667
|
+
case "end":
|
|
668
|
+
return _context15.stop();
|
|
755
669
|
}
|
|
756
|
-
},
|
|
670
|
+
}, _callee15, this);
|
|
757
671
|
}));
|
|
758
|
-
|
|
759
|
-
function createWmsStore(_x36, _x37, _x38) {
|
|
672
|
+
function createWmsStore(_x42, _x43, _x44) {
|
|
760
673
|
return _createWmsStore.apply(this, arguments);
|
|
761
674
|
}
|
|
762
|
-
|
|
763
675
|
return createWmsStore;
|
|
764
676
|
}()
|
|
765
677
|
/**
|
|
@@ -771,62 +683,52 @@ var DatastoreClient = /*#__PURE__*/function () {
|
|
|
771
683
|
*
|
|
772
684
|
* @throws Error if request fails
|
|
773
685
|
*/
|
|
774
|
-
|
|
775
686
|
}, {
|
|
776
687
|
key: "createWmtsStore",
|
|
777
688
|
value: function () {
|
|
778
|
-
var _createWmtsStore = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
689
|
+
var _createWmtsStore = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee16(workspace, dataStore, wmtsCapabilitiesUrl) {
|
|
779
690
|
var body, url, response, geoServerResponse;
|
|
780
|
-
return _regenerator["default"].wrap(function
|
|
781
|
-
while (1) {
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
capabilitiesURL: wmtsCapabilitiesUrl
|
|
789
|
-
}
|
|
790
|
-
};
|
|
791
|
-
url = this.url + 'workspaces/' + workspace + '/wmtsstores';
|
|
792
|
-
_context15.next = 4;
|
|
793
|
-
return (0, _nodeFetch["default"])(url, {
|
|
794
|
-
credentials: 'include',
|
|
795
|
-
method: 'POST',
|
|
796
|
-
headers: {
|
|
797
|
-
Authorization: this.auth,
|
|
798
|
-
'Content-Type': 'application/json'
|
|
799
|
-
},
|
|
800
|
-
body: JSON.stringify(body)
|
|
801
|
-
});
|
|
802
|
-
|
|
803
|
-
case 4:
|
|
804
|
-
response = _context15.sent;
|
|
805
|
-
|
|
806
|
-
if (response.ok) {
|
|
807
|
-
_context15.next = 10;
|
|
808
|
-
break;
|
|
691
|
+
return _regenerator["default"].wrap(function _callee16$(_context16) {
|
|
692
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
693
|
+
case 0:
|
|
694
|
+
body = {
|
|
695
|
+
wmtsStore: {
|
|
696
|
+
name: dataStore,
|
|
697
|
+
type: 'WMTS',
|
|
698
|
+
capabilitiesURL: wmtsCapabilitiesUrl
|
|
809
699
|
}
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
700
|
+
};
|
|
701
|
+
url = this.url + 'workspaces/' + workspace + '/wmtsstores';
|
|
702
|
+
_context16.next = 4;
|
|
703
|
+
return (0, _nodeFetch["default"])(url, {
|
|
704
|
+
credentials: 'include',
|
|
705
|
+
method: 'POST',
|
|
706
|
+
headers: {
|
|
707
|
+
Authorization: this.auth,
|
|
708
|
+
'Content-Type': 'application/json'
|
|
709
|
+
},
|
|
710
|
+
body: JSON.stringify(body)
|
|
711
|
+
});
|
|
712
|
+
case 4:
|
|
713
|
+
response = _context16.sent;
|
|
714
|
+
if (response.ok) {
|
|
715
|
+
_context16.next = 10;
|
|
716
|
+
break;
|
|
717
|
+
}
|
|
718
|
+
_context16.next = 8;
|
|
719
|
+
return (0, _geoserver.getGeoServerResponseText)(response);
|
|
720
|
+
case 8:
|
|
721
|
+
geoServerResponse = _context16.sent;
|
|
722
|
+
throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
|
|
723
|
+
case 10:
|
|
724
|
+
case "end":
|
|
725
|
+
return _context16.stop();
|
|
822
726
|
}
|
|
823
|
-
},
|
|
727
|
+
}, _callee16, this);
|
|
824
728
|
}));
|
|
825
|
-
|
|
826
|
-
function createWmtsStore(_x39, _x40, _x41) {
|
|
729
|
+
function createWmtsStore(_x45, _x46, _x47) {
|
|
827
730
|
return _createWmtsStore.apply(this, arguments);
|
|
828
731
|
}
|
|
829
|
-
|
|
830
732
|
return createWmtsStore;
|
|
831
733
|
}()
|
|
832
734
|
/**
|
|
@@ -840,73 +742,63 @@ var DatastoreClient = /*#__PURE__*/function () {
|
|
|
840
742
|
*
|
|
841
743
|
* @throws Error if request fails
|
|
842
744
|
*/
|
|
843
|
-
|
|
844
745
|
}, {
|
|
845
746
|
key: "createWfsStore",
|
|
846
747
|
value: function () {
|
|
847
|
-
var _createWfsStore = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
748
|
+
var _createWfsStore = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee17(workspace, dataStore, wfsCapabilitiesUrl, namespaceUrl, useHttpConnectionPooling) {
|
|
848
749
|
var body, url, response, geoServerResponse;
|
|
849
|
-
return _regenerator["default"].wrap(function
|
|
850
|
-
while (1) {
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
}]
|
|
868
|
-
}
|
|
750
|
+
return _regenerator["default"].wrap(function _callee17$(_context17) {
|
|
751
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
752
|
+
case 0:
|
|
753
|
+
body = {
|
|
754
|
+
dataStore: {
|
|
755
|
+
name: dataStore,
|
|
756
|
+
type: 'Web Feature Server (NG)',
|
|
757
|
+
connectionParameters: {
|
|
758
|
+
entry: [{
|
|
759
|
+
'@key': 'WFSDataStoreFactory:GET_CAPABILITIES_URL',
|
|
760
|
+
$: wfsCapabilitiesUrl
|
|
761
|
+
}, {
|
|
762
|
+
'@key': 'namespace',
|
|
763
|
+
$: namespaceUrl
|
|
764
|
+
}, {
|
|
765
|
+
'@key': 'WFSDataStoreFactory:USE_HTTP_CONNECTION_POOLING',
|
|
766
|
+
$: useHttpConnectionPooling !== false ? 'true' : 'false'
|
|
767
|
+
}]
|
|
869
768
|
}
|
|
870
|
-
};
|
|
871
|
-
url = this.url + 'workspaces/' + workspace + '/datastores';
|
|
872
|
-
_context16.next = 4;
|
|
873
|
-
return (0, _nodeFetch["default"])(url, {
|
|
874
|
-
credentials: 'include',
|
|
875
|
-
method: 'POST',
|
|
876
|
-
headers: {
|
|
877
|
-
Authorization: this.auth,
|
|
878
|
-
'Content-Type': 'application/json'
|
|
879
|
-
},
|
|
880
|
-
body: JSON.stringify(body)
|
|
881
|
-
});
|
|
882
|
-
|
|
883
|
-
case 4:
|
|
884
|
-
response = _context16.sent;
|
|
885
|
-
|
|
886
|
-
if (response.ok) {
|
|
887
|
-
_context16.next = 10;
|
|
888
|
-
break;
|
|
889
769
|
}
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
770
|
+
};
|
|
771
|
+
url = this.url + 'workspaces/' + workspace + '/datastores';
|
|
772
|
+
_context17.next = 4;
|
|
773
|
+
return (0, _nodeFetch["default"])(url, {
|
|
774
|
+
credentials: 'include',
|
|
775
|
+
method: 'POST',
|
|
776
|
+
headers: {
|
|
777
|
+
Authorization: this.auth,
|
|
778
|
+
'Content-Type': 'application/json'
|
|
779
|
+
},
|
|
780
|
+
body: JSON.stringify(body)
|
|
781
|
+
});
|
|
782
|
+
case 4:
|
|
783
|
+
response = _context17.sent;
|
|
784
|
+
if (response.ok) {
|
|
785
|
+
_context17.next = 10;
|
|
786
|
+
break;
|
|
787
|
+
}
|
|
788
|
+
_context17.next = 8;
|
|
789
|
+
return (0, _geoserver.getGeoServerResponseText)(response);
|
|
790
|
+
case 8:
|
|
791
|
+
geoServerResponse = _context17.sent;
|
|
792
|
+
throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
|
|
793
|
+
case 10:
|
|
794
|
+
case "end":
|
|
795
|
+
return _context17.stop();
|
|
902
796
|
}
|
|
903
|
-
},
|
|
797
|
+
}, _callee17, this);
|
|
904
798
|
}));
|
|
905
|
-
|
|
906
|
-
function createWfsStore(_x42, _x43, _x44, _x45, _x46) {
|
|
799
|
+
function createWfsStore(_x48, _x49, _x50, _x51, _x52) {
|
|
907
800
|
return _createWfsStore.apply(this, arguments);
|
|
908
801
|
}
|
|
909
|
-
|
|
910
802
|
return createWfsStore;
|
|
911
803
|
}()
|
|
912
804
|
/**
|
|
@@ -918,54 +810,44 @@ var DatastoreClient = /*#__PURE__*/function () {
|
|
|
918
810
|
*
|
|
919
811
|
* @throws Error if request fails
|
|
920
812
|
*/
|
|
921
|
-
|
|
922
813
|
}, {
|
|
923
814
|
key: "deleteDataStore",
|
|
924
815
|
value: function () {
|
|
925
|
-
var _deleteDataStore = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
816
|
+
var _deleteDataStore = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee18(workspace, dataStore, recurse) {
|
|
926
817
|
var url, response, geoServerResponse;
|
|
927
|
-
return _regenerator["default"].wrap(function
|
|
928
|
-
while (1) {
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
Authorization: this.auth
|
|
939
|
-
}
|
|
940
|
-
});
|
|
941
|
-
|
|
942
|
-
case 4:
|
|
943
|
-
response = _context17.sent;
|
|
944
|
-
|
|
945
|
-
if (response.ok) {
|
|
946
|
-
_context17.next = 10;
|
|
947
|
-
break;
|
|
818
|
+
return _regenerator["default"].wrap(function _callee18$(_context18) {
|
|
819
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
820
|
+
case 0:
|
|
821
|
+
url = this.url + 'workspaces/' + workspace + '/datastores/' + dataStore;
|
|
822
|
+
url += '?recurse=' + recurse;
|
|
823
|
+
_context18.next = 4;
|
|
824
|
+
return (0, _nodeFetch["default"])(url, {
|
|
825
|
+
credentials: 'include',
|
|
826
|
+
method: 'DELETE',
|
|
827
|
+
headers: {
|
|
828
|
+
Authorization: this.auth
|
|
948
829
|
}
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
830
|
+
});
|
|
831
|
+
case 4:
|
|
832
|
+
response = _context18.sent;
|
|
833
|
+
if (response.ok) {
|
|
834
|
+
_context18.next = 10;
|
|
835
|
+
break;
|
|
836
|
+
}
|
|
837
|
+
_context18.next = 8;
|
|
838
|
+
return (0, _geoserver.getGeoServerResponseText)(response);
|
|
839
|
+
case 8:
|
|
840
|
+
geoServerResponse = _context18.sent;
|
|
841
|
+
throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
|
|
842
|
+
case 10:
|
|
843
|
+
case "end":
|
|
844
|
+
return _context18.stop();
|
|
961
845
|
}
|
|
962
|
-
},
|
|
846
|
+
}, _callee18, this);
|
|
963
847
|
}));
|
|
964
|
-
|
|
965
|
-
function deleteDataStore(_x47, _x48, _x49) {
|
|
848
|
+
function deleteDataStore(_x53, _x54, _x55) {
|
|
966
849
|
return _deleteDataStore.apply(this, arguments);
|
|
967
850
|
}
|
|
968
|
-
|
|
969
851
|
return deleteDataStore;
|
|
970
852
|
}()
|
|
971
853
|
/**
|
|
@@ -977,62 +859,50 @@ var DatastoreClient = /*#__PURE__*/function () {
|
|
|
977
859
|
*
|
|
978
860
|
* @throws Error if request fails
|
|
979
861
|
*/
|
|
980
|
-
|
|
981
862
|
}, {
|
|
982
863
|
key: "deleteCoverageStore",
|
|
983
864
|
value: function () {
|
|
984
|
-
var _deleteCoverageStore = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
865
|
+
var _deleteCoverageStore = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee19(workspace, coverageStore, recurse) {
|
|
985
866
|
var url, response, geoServerResponse;
|
|
986
|
-
return _regenerator["default"].wrap(function
|
|
987
|
-
while (1) {
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
Authorization: this.auth
|
|
998
|
-
}
|
|
999
|
-
});
|
|
1000
|
-
|
|
1001
|
-
case 4:
|
|
1002
|
-
response = _context18.sent;
|
|
1003
|
-
|
|
1004
|
-
if (response.ok) {
|
|
1005
|
-
_context18.next = 14;
|
|
1006
|
-
break;
|
|
867
|
+
return _regenerator["default"].wrap(function _callee19$(_context19) {
|
|
868
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
869
|
+
case 0:
|
|
870
|
+
url = this.url + 'workspaces/' + workspace + '/coveragestores/' + coverageStore;
|
|
871
|
+
url += '?recurse=' + recurse;
|
|
872
|
+
_context19.next = 4;
|
|
873
|
+
return (0, _nodeFetch["default"])(url, {
|
|
874
|
+
credentials: 'include',
|
|
875
|
+
method: 'DELETE',
|
|
876
|
+
headers: {
|
|
877
|
+
Authorization: this.auth
|
|
1007
878
|
}
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
geoServerResponse = _context18.sent;
|
|
1014
|
-
_context18.t0 = response.status;
|
|
1015
|
-
_context18.next = _context18.t0 === 401 ? 12 : 13;
|
|
879
|
+
});
|
|
880
|
+
case 4:
|
|
881
|
+
response = _context19.sent;
|
|
882
|
+
if (response.ok) {
|
|
883
|
+
_context19.next = 14;
|
|
1016
884
|
break;
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
885
|
+
}
|
|
886
|
+
_context19.next = 8;
|
|
887
|
+
return (0, _geoserver.getGeoServerResponseText)(response);
|
|
888
|
+
case 8:
|
|
889
|
+
geoServerResponse = _context19.sent;
|
|
890
|
+
_context19.t0 = response.status;
|
|
891
|
+
_context19.next = _context19.t0 === 401 ? 12 : 13;
|
|
892
|
+
break;
|
|
893
|
+
case 12:
|
|
894
|
+
throw new _geoserver.GeoServerResponseError('Deletion failed. There might be dependant objects to ' + 'this store. Delete them first or call this with "recurse=false"', geoServerResponse);
|
|
895
|
+
case 13:
|
|
896
|
+
throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
|
|
897
|
+
case 14:
|
|
898
|
+
case "end":
|
|
899
|
+
return _context19.stop();
|
|
1028
900
|
}
|
|
1029
|
-
},
|
|
901
|
+
}, _callee19, this);
|
|
1030
902
|
}));
|
|
1031
|
-
|
|
1032
|
-
function deleteCoverageStore(_x50, _x51, _x52) {
|
|
903
|
+
function deleteCoverageStore(_x56, _x57, _x58) {
|
|
1033
904
|
return _deleteCoverageStore.apply(this, arguments);
|
|
1034
905
|
}
|
|
1035
|
-
|
|
1036
906
|
return deleteCoverageStore;
|
|
1037
907
|
}()
|
|
1038
908
|
/**
|
|
@@ -1044,74 +914,63 @@ var DatastoreClient = /*#__PURE__*/function () {
|
|
|
1044
914
|
*
|
|
1045
915
|
* @throws Error if request fails
|
|
1046
916
|
*/
|
|
1047
|
-
|
|
1048
917
|
}, {
|
|
1049
918
|
key: "createGpkgStore",
|
|
1050
919
|
value: function () {
|
|
1051
|
-
var _createGpkgStore = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
920
|
+
var _createGpkgStore = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee20(workspace, dataStore, gpkgPath) {
|
|
1052
921
|
var body, url, response, geoServerResponse;
|
|
1053
|
-
return _regenerator["default"].wrap(function
|
|
1054
|
-
while (1) {
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
}]
|
|
1069
|
-
}
|
|
922
|
+
return _regenerator["default"].wrap(function _callee20$(_context20) {
|
|
923
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
924
|
+
case 0:
|
|
925
|
+
body = {
|
|
926
|
+
dataStore: {
|
|
927
|
+
name: dataStore,
|
|
928
|
+
type: 'GeoPackage',
|
|
929
|
+
connectionParameters: {
|
|
930
|
+
entry: [{
|
|
931
|
+
'@key': 'database',
|
|
932
|
+
$: "file:".concat(gpkgPath)
|
|
933
|
+
}, {
|
|
934
|
+
'@key': 'dbtype',
|
|
935
|
+
$: 'geopkg'
|
|
936
|
+
}]
|
|
1070
937
|
}
|
|
1071
|
-
};
|
|
1072
|
-
url = this.url + 'workspaces/' + workspace + '/datastores';
|
|
1073
|
-
_context19.next = 4;
|
|
1074
|
-
return (0, _nodeFetch["default"])(url, {
|
|
1075
|
-
credentials: 'include',
|
|
1076
|
-
method: 'POST',
|
|
1077
|
-
headers: {
|
|
1078
|
-
Authorization: this.auth,
|
|
1079
|
-
'Content-Type': 'application/json'
|
|
1080
|
-
},
|
|
1081
|
-
body: JSON.stringify(body)
|
|
1082
|
-
});
|
|
1083
|
-
|
|
1084
|
-
case 4:
|
|
1085
|
-
response = _context19.sent;
|
|
1086
|
-
|
|
1087
|
-
if (response.ok) {
|
|
1088
|
-
_context19.next = 10;
|
|
1089
|
-
break;
|
|
1090
938
|
}
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
939
|
+
};
|
|
940
|
+
url = this.url + 'workspaces/' + workspace + '/datastores';
|
|
941
|
+
_context20.next = 4;
|
|
942
|
+
return (0, _nodeFetch["default"])(url, {
|
|
943
|
+
credentials: 'include',
|
|
944
|
+
method: 'POST',
|
|
945
|
+
headers: {
|
|
946
|
+
Authorization: this.auth,
|
|
947
|
+
'Content-Type': 'application/json'
|
|
948
|
+
},
|
|
949
|
+
body: JSON.stringify(body)
|
|
950
|
+
});
|
|
951
|
+
case 4:
|
|
952
|
+
response = _context20.sent;
|
|
953
|
+
if (response.ok) {
|
|
954
|
+
_context20.next = 10;
|
|
955
|
+
break;
|
|
956
|
+
}
|
|
957
|
+
_context20.next = 8;
|
|
958
|
+
return (0, _geoserver.getGeoServerResponseText)(response);
|
|
959
|
+
case 8:
|
|
960
|
+
geoServerResponse = _context20.sent;
|
|
961
|
+
throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
|
|
962
|
+
case 10:
|
|
963
|
+
case "end":
|
|
964
|
+
return _context20.stop();
|
|
1103
965
|
}
|
|
1104
|
-
},
|
|
966
|
+
}, _callee20, this);
|
|
1105
967
|
}));
|
|
1106
|
-
|
|
1107
|
-
function createGpkgStore(_x53, _x54, _x55) {
|
|
968
|
+
function createGpkgStore(_x59, _x60, _x61) {
|
|
1108
969
|
return _createGpkgStore.apply(this, arguments);
|
|
1109
970
|
}
|
|
1110
|
-
|
|
1111
971
|
return createGpkgStore;
|
|
1112
972
|
}()
|
|
1113
973
|
}]);
|
|
1114
974
|
return DatastoreClient;
|
|
1115
975
|
}();
|
|
1116
|
-
|
|
1117
976
|
exports["default"] = DatastoreClient;
|