geoserver-node-client 1.3.0 → 1.4.1
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 +450 -633
- 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/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;
|
|
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
|
|
405
325
|
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
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,33 +373,27 @@ 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
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
|
-
case "end":
|
|
476
|
-
return _context11.stop();
|
|
477
|
-
}
|
|
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();
|
|
478
391
|
}
|
|
479
392
|
}, _callee11, this);
|
|
480
393
|
}));
|
|
481
|
-
|
|
482
394
|
function createGeotiffFromFile(_x18, _x19, _x20, _x21, _x22) {
|
|
483
395
|
return _createGeotiffFromFile.apply(this, arguments);
|
|
484
396
|
}
|
|
485
|
-
|
|
486
397
|
return createGeotiffFromFile;
|
|
487
398
|
}()
|
|
488
399
|
/**
|
|
@@ -501,61 +412,50 @@ var DatastoreClient = /*#__PURE__*/function () {
|
|
|
501
412
|
*
|
|
502
413
|
* @returns {String} The successful response text
|
|
503
414
|
*/
|
|
504
|
-
|
|
505
415
|
}, {
|
|
506
416
|
key: "createGeotiffFromStream",
|
|
507
417
|
value: function () {
|
|
508
418
|
var _createGeotiffFromStream = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(workspace, coverageStore, layerName, layerTitle, readStream, fileSizeInBytes) {
|
|
509
419
|
var lyrTitle, url, response, geoServerResponse;
|
|
510
420
|
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
|
511
|
-
while (1) {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
case 11:
|
|
545
|
-
return _context12.abrupt("return", response.text());
|
|
546
|
-
|
|
547
|
-
case 12:
|
|
548
|
-
case "end":
|
|
549
|
-
return _context12.stop();
|
|
550
|
-
}
|
|
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();
|
|
551
453
|
}
|
|
552
454
|
}, _callee12, this);
|
|
553
455
|
}));
|
|
554
|
-
|
|
555
456
|
function createGeotiffFromStream(_x23, _x24, _x25, _x26, _x27, _x28) {
|
|
556
457
|
return _createGeotiffFromStream.apply(this, arguments);
|
|
557
458
|
}
|
|
558
|
-
|
|
559
459
|
return createGeotiffFromStream;
|
|
560
460
|
}()
|
|
561
461
|
/**
|
|
@@ -574,95 +474,85 @@ var DatastoreClient = /*#__PURE__*/function () {
|
|
|
574
474
|
*
|
|
575
475
|
* @throws Error if request fails
|
|
576
476
|
*/
|
|
577
|
-
|
|
578
477
|
}, {
|
|
579
478
|
key: "createPostgisStore",
|
|
580
479
|
value: function () {
|
|
581
480
|
var _createPostgisStore = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(workspace, namespaceUri, dataStore, pgHost, pgPort, pgUser, pgPassword, pgSchema, pgDb, exposePk) {
|
|
582
481
|
var body, url, response, geoServerResponse;
|
|
583
482
|
return _regenerator["default"].wrap(function _callee13$(_context13) {
|
|
584
|
-
while (1) {
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
name: workspace
|
|
594
|
-
},
|
|
595
|
-
connectionParameters: {
|
|
596
|
-
entry: [{
|
|
597
|
-
'@key': 'dbtype',
|
|
598
|
-
$: 'postgis'
|
|
599
|
-
}, {
|
|
600
|
-
'@key': 'schema',
|
|
601
|
-
$: pgSchema
|
|
602
|
-
}, {
|
|
603
|
-
'@key': 'database',
|
|
604
|
-
$: pgDb
|
|
605
|
-
}, {
|
|
606
|
-
'@key': 'host',
|
|
607
|
-
$: pgHost
|
|
608
|
-
}, {
|
|
609
|
-
'@key': 'port',
|
|
610
|
-
$: pgPort
|
|
611
|
-
}, {
|
|
612
|
-
'@key': 'passwd',
|
|
613
|
-
$: pgPassword
|
|
614
|
-
}, {
|
|
615
|
-
'@key': 'namespace',
|
|
616
|
-
$: namespaceUri
|
|
617
|
-
}, {
|
|
618
|
-
'@key': 'user',
|
|
619
|
-
$: pgUser
|
|
620
|
-
}, {
|
|
621
|
-
'@key': 'Expose primary keys',
|
|
622
|
-
$: exposePk || false
|
|
623
|
-
}]
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
};
|
|
627
|
-
url = this.url + 'workspaces/' + workspace + '/datastores';
|
|
628
|
-
_context13.next = 4;
|
|
629
|
-
return (0, _nodeFetch["default"])(url, {
|
|
630
|
-
credentials: 'include',
|
|
631
|
-
method: 'POST',
|
|
632
|
-
headers: {
|
|
633
|
-
Authorization: this.auth,
|
|
634
|
-
'Content-Type': 'application/json'
|
|
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
|
|
635
492
|
},
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
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
|
+
}
|
|
645
523
|
}
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
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();
|
|
658
550
|
}
|
|
659
551
|
}, _callee13, this);
|
|
660
552
|
}));
|
|
661
|
-
|
|
662
553
|
function createPostgisStore(_x29, _x30, _x31, _x32, _x33, _x34, _x35, _x36, _x37, _x38) {
|
|
663
554
|
return _createPostgisStore.apply(this, arguments);
|
|
664
555
|
}
|
|
665
|
-
|
|
666
556
|
return createPostgisStore;
|
|
667
557
|
}()
|
|
668
558
|
/**
|
|
@@ -682,59 +572,48 @@ var DatastoreClient = /*#__PURE__*/function () {
|
|
|
682
572
|
*
|
|
683
573
|
* @returns {String} The response text
|
|
684
574
|
*/
|
|
685
|
-
|
|
686
575
|
}, {
|
|
687
576
|
key: "createImageMosaicStore",
|
|
688
577
|
value: function () {
|
|
689
578
|
var _createImageMosaicStore = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14(workspace, coverageStore, zipArchivePath) {
|
|
690
579
|
var readStream, url, response, geoServerResponse;
|
|
691
580
|
return _regenerator["default"].wrap(function _callee14$(_context14) {
|
|
692
|
-
while (1) {
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
case 10:
|
|
724
|
-
return _context14.abrupt("return", response.text());
|
|
725
|
-
|
|
726
|
-
case 11:
|
|
727
|
-
case "end":
|
|
728
|
-
return _context14.stop();
|
|
729
|
-
}
|
|
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();
|
|
730
611
|
}
|
|
731
612
|
}, _callee14, this);
|
|
732
613
|
}));
|
|
733
|
-
|
|
734
614
|
function createImageMosaicStore(_x39, _x40, _x41) {
|
|
735
615
|
return _createImageMosaicStore.apply(this, arguments);
|
|
736
616
|
}
|
|
737
|
-
|
|
738
617
|
return createImageMosaicStore;
|
|
739
618
|
}()
|
|
740
619
|
}, {
|
|
@@ -753,55 +632,46 @@ var DatastoreClient = /*#__PURE__*/function () {
|
|
|
753
632
|
var _createWmsStore = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15(workspace, dataStore, wmsCapabilitiesUrl) {
|
|
754
633
|
var body, url, response, geoServerResponse;
|
|
755
634
|
return _regenerator["default"].wrap(function _callee15$(_context15) {
|
|
756
|
-
while (1) {
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
capabilitiesURL: wmsCapabilitiesUrl
|
|
764
|
-
}
|
|
765
|
-
};
|
|
766
|
-
url = this.url + 'workspaces/' + workspace + '/wmsstores';
|
|
767
|
-
_context15.next = 4;
|
|
768
|
-
return (0, _nodeFetch["default"])(url, {
|
|
769
|
-
credentials: 'include',
|
|
770
|
-
method: 'POST',
|
|
771
|
-
headers: {
|
|
772
|
-
Authorization: this.auth,
|
|
773
|
-
'Content-Type': 'application/json'
|
|
774
|
-
},
|
|
775
|
-
body: JSON.stringify(body)
|
|
776
|
-
});
|
|
777
|
-
|
|
778
|
-
case 4:
|
|
779
|
-
response = _context15.sent;
|
|
780
|
-
|
|
781
|
-
if (response.ok) {
|
|
782
|
-
_context15.next = 10;
|
|
783
|
-
break;
|
|
635
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
636
|
+
case 0:
|
|
637
|
+
body = {
|
|
638
|
+
wmsStore: {
|
|
639
|
+
name: dataStore,
|
|
640
|
+
type: 'WMS',
|
|
641
|
+
capabilitiesURL: wmsCapabilitiesUrl
|
|
784
642
|
}
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
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();
|
|
797
669
|
}
|
|
798
670
|
}, _callee15, this);
|
|
799
671
|
}));
|
|
800
|
-
|
|
801
672
|
function createWmsStore(_x42, _x43, _x44) {
|
|
802
673
|
return _createWmsStore.apply(this, arguments);
|
|
803
674
|
}
|
|
804
|
-
|
|
805
675
|
return createWmsStore;
|
|
806
676
|
}()
|
|
807
677
|
/**
|
|
@@ -813,62 +683,52 @@ var DatastoreClient = /*#__PURE__*/function () {
|
|
|
813
683
|
*
|
|
814
684
|
* @throws Error if request fails
|
|
815
685
|
*/
|
|
816
|
-
|
|
817
686
|
}, {
|
|
818
687
|
key: "createWmtsStore",
|
|
819
688
|
value: function () {
|
|
820
689
|
var _createWmtsStore = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee16(workspace, dataStore, wmtsCapabilitiesUrl) {
|
|
821
690
|
var body, url, response, geoServerResponse;
|
|
822
691
|
return _regenerator["default"].wrap(function _callee16$(_context16) {
|
|
823
|
-
while (1) {
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
capabilitiesURL: wmtsCapabilitiesUrl
|
|
831
|
-
}
|
|
832
|
-
};
|
|
833
|
-
url = this.url + 'workspaces/' + workspace + '/wmtsstores';
|
|
834
|
-
_context16.next = 4;
|
|
835
|
-
return (0, _nodeFetch["default"])(url, {
|
|
836
|
-
credentials: 'include',
|
|
837
|
-
method: 'POST',
|
|
838
|
-
headers: {
|
|
839
|
-
Authorization: this.auth,
|
|
840
|
-
'Content-Type': 'application/json'
|
|
841
|
-
},
|
|
842
|
-
body: JSON.stringify(body)
|
|
843
|
-
});
|
|
844
|
-
|
|
845
|
-
case 4:
|
|
846
|
-
response = _context16.sent;
|
|
847
|
-
|
|
848
|
-
if (response.ok) {
|
|
849
|
-
_context16.next = 10;
|
|
850
|
-
break;
|
|
692
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
693
|
+
case 0:
|
|
694
|
+
body = {
|
|
695
|
+
wmtsStore: {
|
|
696
|
+
name: dataStore,
|
|
697
|
+
type: 'WMTS',
|
|
698
|
+
capabilitiesURL: wmtsCapabilitiesUrl
|
|
851
699
|
}
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
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();
|
|
864
726
|
}
|
|
865
727
|
}, _callee16, this);
|
|
866
728
|
}));
|
|
867
|
-
|
|
868
729
|
function createWmtsStore(_x45, _x46, _x47) {
|
|
869
730
|
return _createWmtsStore.apply(this, arguments);
|
|
870
731
|
}
|
|
871
|
-
|
|
872
732
|
return createWmtsStore;
|
|
873
733
|
}()
|
|
874
734
|
/**
|
|
@@ -882,73 +742,63 @@ var DatastoreClient = /*#__PURE__*/function () {
|
|
|
882
742
|
*
|
|
883
743
|
* @throws Error if request fails
|
|
884
744
|
*/
|
|
885
|
-
|
|
886
745
|
}, {
|
|
887
746
|
key: "createWfsStore",
|
|
888
747
|
value: function () {
|
|
889
748
|
var _createWfsStore = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee17(workspace, dataStore, wfsCapabilitiesUrl, namespaceUrl, useHttpConnectionPooling) {
|
|
890
749
|
var body, url, response, geoServerResponse;
|
|
891
750
|
return _regenerator["default"].wrap(function _callee17$(_context17) {
|
|
892
|
-
while (1) {
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
}]
|
|
910
|
-
}
|
|
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
|
+
}]
|
|
911
768
|
}
|
|
912
|
-
};
|
|
913
|
-
url = this.url + 'workspaces/' + workspace + '/datastores';
|
|
914
|
-
_context17.next = 4;
|
|
915
|
-
return (0, _nodeFetch["default"])(url, {
|
|
916
|
-
credentials: 'include',
|
|
917
|
-
method: 'POST',
|
|
918
|
-
headers: {
|
|
919
|
-
Authorization: this.auth,
|
|
920
|
-
'Content-Type': 'application/json'
|
|
921
|
-
},
|
|
922
|
-
body: JSON.stringify(body)
|
|
923
|
-
});
|
|
924
|
-
|
|
925
|
-
case 4:
|
|
926
|
-
response = _context17.sent;
|
|
927
|
-
|
|
928
|
-
if (response.ok) {
|
|
929
|
-
_context17.next = 10;
|
|
930
|
-
break;
|
|
931
769
|
}
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
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();
|
|
944
796
|
}
|
|
945
797
|
}, _callee17, this);
|
|
946
798
|
}));
|
|
947
|
-
|
|
948
799
|
function createWfsStore(_x48, _x49, _x50, _x51, _x52) {
|
|
949
800
|
return _createWfsStore.apply(this, arguments);
|
|
950
801
|
}
|
|
951
|
-
|
|
952
802
|
return createWfsStore;
|
|
953
803
|
}()
|
|
954
804
|
/**
|
|
@@ -960,54 +810,44 @@ var DatastoreClient = /*#__PURE__*/function () {
|
|
|
960
810
|
*
|
|
961
811
|
* @throws Error if request fails
|
|
962
812
|
*/
|
|
963
|
-
|
|
964
813
|
}, {
|
|
965
814
|
key: "deleteDataStore",
|
|
966
815
|
value: function () {
|
|
967
816
|
var _deleteDataStore = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee18(workspace, dataStore, recurse) {
|
|
968
817
|
var url, response, geoServerResponse;
|
|
969
818
|
return _regenerator["default"].wrap(function _callee18$(_context18) {
|
|
970
|
-
while (1) {
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
Authorization: this.auth
|
|
981
|
-
}
|
|
982
|
-
});
|
|
983
|
-
|
|
984
|
-
case 4:
|
|
985
|
-
response = _context18.sent;
|
|
986
|
-
|
|
987
|
-
if (response.ok) {
|
|
988
|
-
_context18.next = 10;
|
|
989
|
-
break;
|
|
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
|
|
990
829
|
}
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
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();
|
|
1003
845
|
}
|
|
1004
846
|
}, _callee18, this);
|
|
1005
847
|
}));
|
|
1006
|
-
|
|
1007
848
|
function deleteDataStore(_x53, _x54, _x55) {
|
|
1008
849
|
return _deleteDataStore.apply(this, arguments);
|
|
1009
850
|
}
|
|
1010
|
-
|
|
1011
851
|
return deleteDataStore;
|
|
1012
852
|
}()
|
|
1013
853
|
/**
|
|
@@ -1019,62 +859,50 @@ var DatastoreClient = /*#__PURE__*/function () {
|
|
|
1019
859
|
*
|
|
1020
860
|
* @throws Error if request fails
|
|
1021
861
|
*/
|
|
1022
|
-
|
|
1023
862
|
}, {
|
|
1024
863
|
key: "deleteCoverageStore",
|
|
1025
864
|
value: function () {
|
|
1026
865
|
var _deleteCoverageStore = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee19(workspace, coverageStore, recurse) {
|
|
1027
866
|
var url, response, geoServerResponse;
|
|
1028
867
|
return _regenerator["default"].wrap(function _callee19$(_context19) {
|
|
1029
|
-
while (1) {
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
Authorization: this.auth
|
|
1040
|
-
}
|
|
1041
|
-
});
|
|
1042
|
-
|
|
1043
|
-
case 4:
|
|
1044
|
-
response = _context19.sent;
|
|
1045
|
-
|
|
1046
|
-
if (response.ok) {
|
|
1047
|
-
_context19.next = 14;
|
|
1048
|
-
break;
|
|
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
|
|
1049
878
|
}
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
geoServerResponse = _context19.sent;
|
|
1056
|
-
_context19.t0 = response.status;
|
|
1057
|
-
_context19.next = _context19.t0 === 401 ? 12 : 13;
|
|
879
|
+
});
|
|
880
|
+
case 4:
|
|
881
|
+
response = _context19.sent;
|
|
882
|
+
if (response.ok) {
|
|
883
|
+
_context19.next = 14;
|
|
1058
884
|
break;
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
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();
|
|
1070
900
|
}
|
|
1071
901
|
}, _callee19, this);
|
|
1072
902
|
}));
|
|
1073
|
-
|
|
1074
903
|
function deleteCoverageStore(_x56, _x57, _x58) {
|
|
1075
904
|
return _deleteCoverageStore.apply(this, arguments);
|
|
1076
905
|
}
|
|
1077
|
-
|
|
1078
906
|
return deleteCoverageStore;
|
|
1079
907
|
}()
|
|
1080
908
|
/**
|
|
@@ -1086,74 +914,63 @@ var DatastoreClient = /*#__PURE__*/function () {
|
|
|
1086
914
|
*
|
|
1087
915
|
* @throws Error if request fails
|
|
1088
916
|
*/
|
|
1089
|
-
|
|
1090
917
|
}, {
|
|
1091
918
|
key: "createGpkgStore",
|
|
1092
919
|
value: function () {
|
|
1093
920
|
var _createGpkgStore = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee20(workspace, dataStore, gpkgPath) {
|
|
1094
921
|
var body, url, response, geoServerResponse;
|
|
1095
922
|
return _regenerator["default"].wrap(function _callee20$(_context20) {
|
|
1096
|
-
while (1) {
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
}]
|
|
1111
|
-
}
|
|
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
|
+
}]
|
|
1112
937
|
}
|
|
1113
|
-
};
|
|
1114
|
-
url = this.url + 'workspaces/' + workspace + '/datastores';
|
|
1115
|
-
_context20.next = 4;
|
|
1116
|
-
return (0, _nodeFetch["default"])(url, {
|
|
1117
|
-
credentials: 'include',
|
|
1118
|
-
method: 'POST',
|
|
1119
|
-
headers: {
|
|
1120
|
-
Authorization: this.auth,
|
|
1121
|
-
'Content-Type': 'application/json'
|
|
1122
|
-
},
|
|
1123
|
-
body: JSON.stringify(body)
|
|
1124
|
-
});
|
|
1125
|
-
|
|
1126
|
-
case 4:
|
|
1127
|
-
response = _context20.sent;
|
|
1128
|
-
|
|
1129
|
-
if (response.ok) {
|
|
1130
|
-
_context20.next = 10;
|
|
1131
|
-
break;
|
|
1132
938
|
}
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
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();
|
|
1145
965
|
}
|
|
1146
966
|
}, _callee20, this);
|
|
1147
967
|
}));
|
|
1148
|
-
|
|
1149
968
|
function createGpkgStore(_x59, _x60, _x61) {
|
|
1150
969
|
return _createGpkgStore.apply(this, arguments);
|
|
1151
970
|
}
|
|
1152
|
-
|
|
1153
971
|
return createGpkgStore;
|
|
1154
972
|
}()
|
|
1155
973
|
}]);
|
|
1156
974
|
return DatastoreClient;
|
|
1157
975
|
}();
|
|
1158
|
-
|
|
1159
976
|
exports["default"] = DatastoreClient;
|