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/settings.js
CHANGED
|
@@ -1,24 +1,16 @@
|
|
|
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 _geoserver = require("./util/geoserver.js");
|
|
21
|
-
|
|
22
14
|
/**
|
|
23
15
|
* Client for GeoServer settings.
|
|
24
16
|
*
|
|
@@ -36,6 +28,7 @@ var SettingsClient = /*#__PURE__*/function () {
|
|
|
36
28
|
this.url = url;
|
|
37
29
|
this.auth = auth;
|
|
38
30
|
}
|
|
31
|
+
|
|
39
32
|
/**
|
|
40
33
|
* Get the complete GeoServer settings object.
|
|
41
34
|
*
|
|
@@ -43,56 +36,44 @@ var SettingsClient = /*#__PURE__*/function () {
|
|
|
43
36
|
*
|
|
44
37
|
* @returns {Object} Settings object
|
|
45
38
|
*/
|
|
46
|
-
|
|
47
|
-
|
|
48
39
|
(0, _createClass2["default"])(SettingsClient, [{
|
|
49
40
|
key: "getSettings",
|
|
50
41
|
value: function () {
|
|
51
42
|
var _getSettings = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
52
43
|
var response, geoServerResponse;
|
|
53
44
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
54
|
-
while (1) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
Authorization: this.auth
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
case 2:
|
|
67
|
-
response = _context.sent;
|
|
68
|
-
|
|
69
|
-
if (response.ok) {
|
|
70
|
-
_context.next = 8;
|
|
71
|
-
break;
|
|
45
|
+
while (1) switch (_context.prev = _context.next) {
|
|
46
|
+
case 0:
|
|
47
|
+
_context.next = 2;
|
|
48
|
+
return (0, _nodeFetch["default"])(this.url + 'settings.json', {
|
|
49
|
+
credentials: 'include',
|
|
50
|
+
method: 'GET',
|
|
51
|
+
headers: {
|
|
52
|
+
Authorization: this.auth
|
|
72
53
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
54
|
+
});
|
|
55
|
+
case 2:
|
|
56
|
+
response = _context.sent;
|
|
57
|
+
if (response.ok) {
|
|
58
|
+
_context.next = 8;
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
_context.next = 6;
|
|
62
|
+
return (0, _geoserver.getGeoServerResponseText)(response);
|
|
63
|
+
case 6:
|
|
64
|
+
geoServerResponse = _context.sent;
|
|
65
|
+
throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
|
|
66
|
+
case 8:
|
|
67
|
+
return _context.abrupt("return", response.json());
|
|
68
|
+
case 9:
|
|
69
|
+
case "end":
|
|
70
|
+
return _context.stop();
|
|
88
71
|
}
|
|
89
72
|
}, _callee, this);
|
|
90
73
|
}));
|
|
91
|
-
|
|
92
74
|
function getSettings() {
|
|
93
75
|
return _getSettings.apply(this, arguments);
|
|
94
76
|
}
|
|
95
|
-
|
|
96
77
|
return getSettings;
|
|
97
78
|
}()
|
|
98
79
|
/**
|
|
@@ -100,54 +81,44 @@ var SettingsClient = /*#__PURE__*/function () {
|
|
|
100
81
|
*
|
|
101
82
|
* @param {Object} settings The adapted GeoServer settings object
|
|
102
83
|
*/
|
|
103
|
-
|
|
104
84
|
}, {
|
|
105
85
|
key: "updateSettings",
|
|
106
86
|
value: function () {
|
|
107
87
|
var _updateSettings = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(settings) {
|
|
108
88
|
var response, geoServerResponse;
|
|
109
89
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
110
|
-
while (1) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
geoServerResponse = _context2.sent;
|
|
137
|
-
throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
|
|
138
|
-
|
|
139
|
-
case 8:
|
|
140
|
-
case "end":
|
|
141
|
-
return _context2.stop();
|
|
142
|
-
}
|
|
90
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
91
|
+
case 0:
|
|
92
|
+
_context2.next = 2;
|
|
93
|
+
return (0, _nodeFetch["default"])(this.url + 'settings', {
|
|
94
|
+
credentials: 'include',
|
|
95
|
+
method: 'PUT',
|
|
96
|
+
headers: {
|
|
97
|
+
Authorization: this.auth,
|
|
98
|
+
'Content-Type': 'application/json'
|
|
99
|
+
},
|
|
100
|
+
body: JSON.stringify(settings)
|
|
101
|
+
});
|
|
102
|
+
case 2:
|
|
103
|
+
response = _context2.sent;
|
|
104
|
+
if (response.ok) {
|
|
105
|
+
_context2.next = 8;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
_context2.next = 6;
|
|
109
|
+
return (0, _geoserver.getGeoServerResponseText)(response);
|
|
110
|
+
case 6:
|
|
111
|
+
geoServerResponse = _context2.sent;
|
|
112
|
+
throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
|
|
113
|
+
case 8:
|
|
114
|
+
case "end":
|
|
115
|
+
return _context2.stop();
|
|
143
116
|
}
|
|
144
117
|
}, _callee2, this);
|
|
145
118
|
}));
|
|
146
|
-
|
|
147
119
|
function updateSettings(_x) {
|
|
148
120
|
return _updateSettings.apply(this, arguments);
|
|
149
121
|
}
|
|
150
|
-
|
|
151
122
|
return updateSettings;
|
|
152
123
|
}()
|
|
153
124
|
/**
|
|
@@ -155,47 +126,37 @@ var SettingsClient = /*#__PURE__*/function () {
|
|
|
155
126
|
*
|
|
156
127
|
* @param {String} proxyBaseUrl The proxy base URL
|
|
157
128
|
*/
|
|
158
|
-
|
|
159
129
|
}, {
|
|
160
130
|
key: "updateProxyBaseUrl",
|
|
161
131
|
value: function () {
|
|
162
132
|
var _updateProxyBaseUrl = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(proxyBaseUrl) {
|
|
163
133
|
var settingsJson;
|
|
164
134
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
165
|
-
while (1) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
_context3.next = 8;
|
|
185
|
-
return this.updateSettings(settingsJson);
|
|
186
|
-
|
|
187
|
-
case 8:
|
|
188
|
-
case "end":
|
|
189
|
-
return _context3.stop();
|
|
190
|
-
}
|
|
135
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
136
|
+
case 0:
|
|
137
|
+
_context3.next = 2;
|
|
138
|
+
return this.getSettings();
|
|
139
|
+
case 2:
|
|
140
|
+
settingsJson = _context3.sent;
|
|
141
|
+
if (!(!settingsJson.global && !settingsJson.global.settings)) {
|
|
142
|
+
_context3.next = 5;
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
return _context3.abrupt("return", false);
|
|
146
|
+
case 5:
|
|
147
|
+
// add proxyBaseUrl to settings
|
|
148
|
+
settingsJson.global.settings.proxyBaseUrl = proxyBaseUrl;
|
|
149
|
+
_context3.next = 8;
|
|
150
|
+
return this.updateSettings(settingsJson);
|
|
151
|
+
case 8:
|
|
152
|
+
case "end":
|
|
153
|
+
return _context3.stop();
|
|
191
154
|
}
|
|
192
155
|
}, _callee3, this);
|
|
193
156
|
}));
|
|
194
|
-
|
|
195
157
|
function updateProxyBaseUrl(_x2) {
|
|
196
158
|
return _updateProxyBaseUrl.apply(this, arguments);
|
|
197
159
|
}
|
|
198
|
-
|
|
199
160
|
return updateProxyBaseUrl;
|
|
200
161
|
}()
|
|
201
162
|
/**
|
|
@@ -205,55 +166,44 @@ var SettingsClient = /*#__PURE__*/function () {
|
|
|
205
166
|
*
|
|
206
167
|
* @returns {Object} An object with contact information
|
|
207
168
|
*/
|
|
208
|
-
|
|
209
169
|
}, {
|
|
210
170
|
key: "getContactInformation",
|
|
211
171
|
value: function () {
|
|
212
172
|
var _getContactInformation = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
213
173
|
var response, geoServerResponse;
|
|
214
174
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
215
|
-
while (1) {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
Authorization: this.auth
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
case 2:
|
|
228
|
-
response = _context4.sent;
|
|
229
|
-
|
|
230
|
-
if (response.ok) {
|
|
231
|
-
_context4.next = 8;
|
|
232
|
-
break;
|
|
175
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
176
|
+
case 0:
|
|
177
|
+
_context4.next = 2;
|
|
178
|
+
return (0, _nodeFetch["default"])(this.url + 'settings/contact', {
|
|
179
|
+
credentials: 'include',
|
|
180
|
+
method: 'GET',
|
|
181
|
+
headers: {
|
|
182
|
+
Authorization: this.auth
|
|
233
183
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
184
|
+
});
|
|
185
|
+
case 2:
|
|
186
|
+
response = _context4.sent;
|
|
187
|
+
if (response.ok) {
|
|
188
|
+
_context4.next = 8;
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
_context4.next = 6;
|
|
192
|
+
return (0, _geoserver.getGeoServerResponseText)(response);
|
|
193
|
+
case 6:
|
|
194
|
+
geoServerResponse = _context4.sent;
|
|
195
|
+
throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
|
|
196
|
+
case 8:
|
|
197
|
+
return _context4.abrupt("return", response.json());
|
|
198
|
+
case 9:
|
|
199
|
+
case "end":
|
|
200
|
+
return _context4.stop();
|
|
249
201
|
}
|
|
250
202
|
}, _callee4, this);
|
|
251
203
|
}));
|
|
252
|
-
|
|
253
204
|
function getContactInformation() {
|
|
254
205
|
return _getContactInformation.apply(this, arguments);
|
|
255
206
|
}
|
|
256
|
-
|
|
257
207
|
return getContactInformation;
|
|
258
208
|
}()
|
|
259
209
|
/**
|
|
@@ -273,73 +223,62 @@ var SettingsClient = /*#__PURE__*/function () {
|
|
|
273
223
|
*
|
|
274
224
|
* @throws Error if request fails
|
|
275
225
|
*/
|
|
276
|
-
|
|
277
226
|
}, {
|
|
278
227
|
key: "updateContactInformation",
|
|
279
228
|
value: function () {
|
|
280
229
|
var _updateContactInformation = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(address, city, country, postalCode, state, email, organization, contactPerson, phoneNumber) {
|
|
281
230
|
var contact, body, url, response, geoServerResponse;
|
|
282
231
|
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
283
|
-
while (1) {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
geoServerResponse = _context5.sent;
|
|
325
|
-
throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
|
|
326
|
-
|
|
327
|
-
case 11:
|
|
328
|
-
case "end":
|
|
329
|
-
return _context5.stop();
|
|
330
|
-
}
|
|
232
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
233
|
+
case 0:
|
|
234
|
+
contact = {
|
|
235
|
+
address: address,
|
|
236
|
+
addressCity: city,
|
|
237
|
+
addressCountry: country,
|
|
238
|
+
addressPostalCode: postalCode,
|
|
239
|
+
addressState: state,
|
|
240
|
+
contactEmail: email,
|
|
241
|
+
contactOrganization: organization,
|
|
242
|
+
contactPerson: contactPerson,
|
|
243
|
+
contactVoice: phoneNumber
|
|
244
|
+
};
|
|
245
|
+
body = {
|
|
246
|
+
contact: contact
|
|
247
|
+
};
|
|
248
|
+
url = this.url + 'settings/contact';
|
|
249
|
+
_context5.next = 5;
|
|
250
|
+
return (0, _nodeFetch["default"])(url, {
|
|
251
|
+
credentials: 'include',
|
|
252
|
+
method: 'PUT',
|
|
253
|
+
headers: {
|
|
254
|
+
Authorization: this.auth,
|
|
255
|
+
'Content-Type': 'application/json'
|
|
256
|
+
},
|
|
257
|
+
body: JSON.stringify(body)
|
|
258
|
+
});
|
|
259
|
+
case 5:
|
|
260
|
+
response = _context5.sent;
|
|
261
|
+
if (response.ok) {
|
|
262
|
+
_context5.next = 11;
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
_context5.next = 9;
|
|
266
|
+
return (0, _geoserver.getGeoServerResponseText)(response);
|
|
267
|
+
case 9:
|
|
268
|
+
geoServerResponse = _context5.sent;
|
|
269
|
+
throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
|
|
270
|
+
case 11:
|
|
271
|
+
case "end":
|
|
272
|
+
return _context5.stop();
|
|
331
273
|
}
|
|
332
274
|
}, _callee5, this);
|
|
333
275
|
}));
|
|
334
|
-
|
|
335
276
|
function updateContactInformation(_x3, _x4, _x5, _x6, _x7, _x8, _x9, _x10, _x11) {
|
|
336
277
|
return _updateContactInformation.apply(this, arguments);
|
|
337
278
|
}
|
|
338
|
-
|
|
339
279
|
return updateContactInformation;
|
|
340
280
|
}()
|
|
341
281
|
}]);
|
|
342
282
|
return SettingsClient;
|
|
343
283
|
}();
|
|
344
|
-
|
|
345
284
|
exports["default"] = SettingsClient;
|