geoserver-node-client 1.6.0 → 1.6.2
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 +1 -1
- package/dist/geoserver-rest-client.js +38 -39
- package/dist/package.json +8 -8
- package/dist/src/about.js +35 -86
- package/dist/src/datastore.js +524 -950
- package/dist/src/imagemosaic.js +103 -211
- package/dist/src/layer.js +718 -1287
- package/dist/src/layergroup.js +128 -226
- package/dist/src/namespace.js +110 -222
- package/dist/src/reset-reload.js +41 -96
- package/dist/src/security.js +279 -567
- package/dist/src/settings.js +127 -255
- package/dist/src/style.js +228 -448
- package/dist/src/util/geoserver.js +17 -44
- package/dist/src/workspace.js +116 -229
- package/package.json +8 -8
package/dist/src/imagemosaic.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports
|
|
8
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
7
|
+
exports.default = void 0;
|
|
12
8
|
var _nodeFetch = _interopRequireDefault(require("node-fetch"));
|
|
13
9
|
var _geoserver = require("./util/geoserver.js");
|
|
14
10
|
/**
|
|
@@ -16,15 +12,14 @@ var _geoserver = require("./util/geoserver.js");
|
|
|
16
12
|
*
|
|
17
13
|
* @module ImageMosaicClient
|
|
18
14
|
*/
|
|
19
|
-
|
|
15
|
+
class ImageMosaicClient {
|
|
20
16
|
/**
|
|
21
17
|
* Creates a GeoServer REST ImageMosaicClient instance.
|
|
22
18
|
*
|
|
23
19
|
* @param {String} url The URL of the GeoServer REST API endpoint
|
|
24
20
|
* @param {String} auth The Basic Authentication string
|
|
25
21
|
*/
|
|
26
|
-
|
|
27
|
-
(0, _classCallCheck2["default"])(this, ImageMosaicClient);
|
|
22
|
+
constructor(url, auth) {
|
|
28
23
|
this.url = url;
|
|
29
24
|
this.auth = auth;
|
|
30
25
|
}
|
|
@@ -40,207 +35,104 @@ var ImageMosaicClient = exports["default"] = /*#__PURE__*/function () {
|
|
|
40
35
|
*
|
|
41
36
|
* @returns {Object} An object with the granules
|
|
42
37
|
*/
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
url = this.url + 'workspaces/' + workspace + '/coveragestores/' + coverageStore + '/coverages/' + coverage + '/index/granules.json';
|
|
52
|
-
_context.next = 1;
|
|
53
|
-
return (0, _nodeFetch["default"])(url, {
|
|
54
|
-
credentials: 'include',
|
|
55
|
-
method: 'GET',
|
|
56
|
-
headers: {
|
|
57
|
-
Authorization: this.auth,
|
|
58
|
-
'Content-type': 'text/plain'
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
case 1:
|
|
62
|
-
response = _context.sent;
|
|
63
|
-
if (response.ok) {
|
|
64
|
-
_context.next = 3;
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
_context.next = 2;
|
|
68
|
-
return (0, _geoserver.getGeoServerResponseText)(response);
|
|
69
|
-
case 2:
|
|
70
|
-
geoServerResponse = _context.sent;
|
|
71
|
-
throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
|
|
72
|
-
case 3:
|
|
73
|
-
return _context.abrupt("return", response.json());
|
|
74
|
-
case 4:
|
|
75
|
-
case "end":
|
|
76
|
-
return _context.stop();
|
|
77
|
-
}
|
|
78
|
-
}, _callee, this);
|
|
79
|
-
}));
|
|
80
|
-
function getGranules(_x, _x2, _x3) {
|
|
81
|
-
return _getGranules.apply(this, arguments);
|
|
38
|
+
async getGranules(workspace, coverageStore, coverage) {
|
|
39
|
+
const url = this.url + 'workspaces/' + workspace + '/coveragestores/' + coverageStore + '/coverages/' + coverage + '/index/granules.json';
|
|
40
|
+
const response = await (0, _nodeFetch.default)(url, {
|
|
41
|
+
credentials: 'include',
|
|
42
|
+
method: 'GET',
|
|
43
|
+
headers: {
|
|
44
|
+
Authorization: this.auth,
|
|
45
|
+
'Content-type': 'text/plain'
|
|
82
46
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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
|
-
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
'Content-type': 'text/plain'
|
|
166
|
-
},
|
|
167
|
-
body: filePath
|
|
168
|
-
});
|
|
169
|
-
case 1:
|
|
170
|
-
response = _context3.sent;
|
|
171
|
-
if (response.ok) {
|
|
172
|
-
_context3.next = 3;
|
|
173
|
-
break;
|
|
174
|
-
}
|
|
175
|
-
_context3.next = 2;
|
|
176
|
-
return (0, _geoserver.getGeoServerResponseText)(response);
|
|
177
|
-
case 2:
|
|
178
|
-
geoServerResponse = _context3.sent;
|
|
179
|
-
throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
|
|
180
|
-
case 3:
|
|
181
|
-
case "end":
|
|
182
|
-
return _context3.stop();
|
|
183
|
-
}
|
|
184
|
-
}, _callee3, this);
|
|
185
|
-
}));
|
|
186
|
-
function addGranuleByServerFile(_x7, _x8, _x9) {
|
|
187
|
-
return _addGranuleByServerFile.apply(this, arguments);
|
|
188
|
-
}
|
|
189
|
-
return addGranuleByServerFile;
|
|
190
|
-
}()
|
|
191
|
-
/**
|
|
192
|
-
* Deletes a single granule of an image mosaic.
|
|
193
|
-
*
|
|
194
|
-
* @param {String} workspace Workspace of image mosaic
|
|
195
|
-
* @param {String} coverageStore CoverageStore of image mosaic
|
|
196
|
-
* @param {String} coverage Name of image mosaic
|
|
197
|
-
* @param {String} covFileLocation Location of coverage file
|
|
198
|
-
*
|
|
199
|
-
* @throws Error if request fails
|
|
200
|
-
*/
|
|
201
|
-
)
|
|
202
|
-
}, {
|
|
203
|
-
key: "deleteSingleGranule",
|
|
204
|
-
value: (function () {
|
|
205
|
-
var _deleteSingleGranule = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(workspace, coverageStore, coverage, covFileLocation) {
|
|
206
|
-
var url, response, geoServerResponse;
|
|
207
|
-
return _regenerator["default"].wrap(function (_context4) {
|
|
208
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
209
|
-
case 0:
|
|
210
|
-
url = this.url + 'workspaces/' + workspace + '/coveragestores/' + coverageStore + '/coverages/' + coverage + '/index/granules.xml';
|
|
211
|
-
url += "?filter=location='" + covFileLocation + "'";
|
|
212
|
-
_context4.next = 1;
|
|
213
|
-
return (0, _nodeFetch["default"])(url, {
|
|
214
|
-
credentials: 'include',
|
|
215
|
-
method: 'DELETE',
|
|
216
|
-
headers: {
|
|
217
|
-
Authorization: this.auth,
|
|
218
|
-
'Content-type': 'text/plain'
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
case 1:
|
|
222
|
-
response = _context4.sent;
|
|
223
|
-
if (response.ok) {
|
|
224
|
-
_context4.next = 3;
|
|
225
|
-
break;
|
|
226
|
-
}
|
|
227
|
-
_context4.next = 2;
|
|
228
|
-
return (0, _geoserver.getGeoServerResponseText)(response);
|
|
229
|
-
case 2:
|
|
230
|
-
geoServerResponse = _context4.sent;
|
|
231
|
-
throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
|
|
232
|
-
case 3:
|
|
233
|
-
return _context4.abrupt("return", true);
|
|
234
|
-
case 4:
|
|
235
|
-
case "end":
|
|
236
|
-
return _context4.stop();
|
|
237
|
-
}
|
|
238
|
-
}, _callee4, this);
|
|
239
|
-
}));
|
|
240
|
-
function deleteSingleGranule(_x0, _x1, _x10, _x11) {
|
|
241
|
-
return _deleteSingleGranule.apply(this, arguments);
|
|
47
|
+
});
|
|
48
|
+
if (!response.ok) {
|
|
49
|
+
const geoServerResponse = await (0, _geoserver.getGeoServerResponseText)(response);
|
|
50
|
+
throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
|
|
51
|
+
}
|
|
52
|
+
return response.json();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Harvests all granules in the given folder for an image mosaic.
|
|
57
|
+
*
|
|
58
|
+
* @param {String} workspace Workspace of image mosaic
|
|
59
|
+
* @param {String} coverageStore CoverageStore of image mosaic
|
|
60
|
+
* @param {String} filePath Server path of folder to harvest
|
|
61
|
+
*
|
|
62
|
+
* @throws Error if request fails
|
|
63
|
+
*
|
|
64
|
+
* @returns {Object} An object with the granules
|
|
65
|
+
*/
|
|
66
|
+
async harvestGranules(workspace, coverageStore, filePath) {
|
|
67
|
+
const url = this.url + 'workspaces/' + workspace + '/coveragestores/' + coverageStore + '/external.imagemosaic';
|
|
68
|
+
const response = await (0, _nodeFetch.default)(url, {
|
|
69
|
+
credentials: 'include',
|
|
70
|
+
method: 'POST',
|
|
71
|
+
headers: {
|
|
72
|
+
Authorization: this.auth,
|
|
73
|
+
'Content-Type': 'text/plain'
|
|
74
|
+
},
|
|
75
|
+
body: filePath
|
|
76
|
+
});
|
|
77
|
+
if (!response.ok) {
|
|
78
|
+
const geoServerResponse = await (0, _geoserver.getGeoServerResponseText)(response);
|
|
79
|
+
throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
|
|
80
|
+
}
|
|
81
|
+
return response.json();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Adds a granule (defined by a server file) to an image mosaic.
|
|
86
|
+
*
|
|
87
|
+
* @param {String} workspace Workspace of image mosaic
|
|
88
|
+
* @param {String} coverageStore CoverageStore of image mosaic
|
|
89
|
+
* @param {String} filePath Server file path of new granule
|
|
90
|
+
*
|
|
91
|
+
* @throws Error if request fails
|
|
92
|
+
*/
|
|
93
|
+
async addGranuleByServerFile(workspace, coverageStore, filePath) {
|
|
94
|
+
const url = this.url + 'workspaces/' + workspace + '/coveragestores/' + coverageStore + '/external.imagemosaic';
|
|
95
|
+
const response = await (0, _nodeFetch.default)(url, {
|
|
96
|
+
credentials: 'include',
|
|
97
|
+
method: 'POST',
|
|
98
|
+
headers: {
|
|
99
|
+
Authorization: this.auth,
|
|
100
|
+
'Content-type': 'text/plain'
|
|
101
|
+
},
|
|
102
|
+
body: filePath
|
|
103
|
+
});
|
|
104
|
+
if (!response.ok) {
|
|
105
|
+
const geoServerResponse = await (0, _geoserver.getGeoServerResponseText)(response);
|
|
106
|
+
throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Deletes a single granule of an image mosaic.
|
|
112
|
+
*
|
|
113
|
+
* @param {String} workspace Workspace of image mosaic
|
|
114
|
+
* @param {String} coverageStore CoverageStore of image mosaic
|
|
115
|
+
* @param {String} coverage Name of image mosaic
|
|
116
|
+
* @param {String} covFileLocation Location of coverage file
|
|
117
|
+
*
|
|
118
|
+
* @throws Error if request fails
|
|
119
|
+
*/
|
|
120
|
+
async deleteSingleGranule(workspace, coverageStore, coverage, covFileLocation) {
|
|
121
|
+
let url = this.url + 'workspaces/' + workspace + '/coveragestores/' + coverageStore + '/coverages/' + coverage + '/index/granules.xml';
|
|
122
|
+
url += "?filter=location='" + covFileLocation + "'";
|
|
123
|
+
const response = await (0, _nodeFetch.default)(url, {
|
|
124
|
+
credentials: 'include',
|
|
125
|
+
method: 'DELETE',
|
|
126
|
+
headers: {
|
|
127
|
+
Authorization: this.auth,
|
|
128
|
+
'Content-type': 'text/plain'
|
|
242
129
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
130
|
+
});
|
|
131
|
+
if (!response.ok) {
|
|
132
|
+
const geoServerResponse = await (0, _geoserver.getGeoServerResponseText)(response);
|
|
133
|
+
throw new _geoserver.GeoServerResponseError(null, geoServerResponse);
|
|
134
|
+
}
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
exports.default = ImageMosaicClient;
|