geoserver-node-client 1.6.2 → 2.0.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 +23 -22
- package/dist/package.json +12 -5
- package/dist/src/datastore.js +1 -1
- package/dist/src/layer.js +25 -25
- package/dist/types/geoserver-rest-client.d.ts +53 -0
- package/dist/types/src/about.d.ts +30 -0
- package/dist/types/src/datastore.d.ts +241 -0
- package/dist/types/src/imagemosaic.d.ts +61 -0
- package/dist/types/src/layer.d.ts +265 -0
- package/dist/types/src/layergroup.d.ts +60 -0
- package/dist/types/src/namespace.d.ts +53 -0
- package/dist/types/src/reset-reload.d.ts +36 -0
- package/dist/types/src/security.d.ts +110 -0
- package/dist/types/src/settings.d.ts +62 -0
- package/dist/types/src/style.d.ts +91 -0
- package/dist/types/src/util/geoserver.d.ts +22 -0
- package/dist/types/src/workspace.d.ts +55 -0
- package/package.json +12 -5
- package/src/datastore.js +1 -1
- package/src/layer.js +25 -25
package/README.md
CHANGED
|
@@ -18,8 +18,9 @@ Detailed [API-Docs](https://meggsimum.github.io/geoserver-node-client/) are auto
|
|
|
18
18
|
|
|
19
19
|
Compatible with [GeoServer](https://geoserver.org)
|
|
20
20
|
|
|
21
|
+
- v3.0.x
|
|
21
22
|
- v2.28.x
|
|
22
|
-
- v2.27.x
|
|
23
|
+
- v2.27.x (no more maintained and officially deprecated)
|
|
23
24
|
- v2.26.x (no more maintained and officially deprecated)
|
|
24
25
|
- v2.25.x (no more maintained and officially deprecated)
|
|
25
26
|
- v2.24.x (no more maintained and officially deprecated)
|
|
@@ -37,39 +38,39 @@ Compatible with [GeoServer](https://geoserver.org)
|
|
|
37
38
|
npm i geoserver-node-client
|
|
38
39
|
```
|
|
39
40
|
|
|
40
|
-
usage
|
|
41
|
+
usage as ES module (ES6)
|
|
41
42
|
|
|
42
43
|
```js
|
|
43
|
-
|
|
44
|
-
var GeoServerRestClient = grcImport.GeoServerRestClient;
|
|
44
|
+
import {GeoServerRestClient} from 'geoserver-node-client';
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
const url = 'http://localhost:8080/geoserver/rest/';
|
|
47
|
+
const user = 'admin';
|
|
48
|
+
const pw = 'geoserver';
|
|
49
|
+
const grc = new GeoServerRestClient(url, user, pw);
|
|
50
50
|
|
|
51
|
-
function main () {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
});
|
|
51
|
+
async function main () {
|
|
52
|
+
const result = await grc.about.exists();
|
|
53
|
+
console.log(result);
|
|
55
54
|
};
|
|
56
55
|
|
|
57
56
|
main();
|
|
58
57
|
```
|
|
59
58
|
|
|
60
|
-
usage
|
|
59
|
+
usage with require (ES5):
|
|
61
60
|
|
|
62
61
|
```js
|
|
63
|
-
|
|
62
|
+
var grcImport = require('geoserver-node-client');
|
|
63
|
+
var GeoServerRestClient = grcImport.GeoServerRestClient;
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
var url = 'http://localhost:8080/geoserver/rest/';
|
|
66
|
+
var user = 'admin';
|
|
67
|
+
var pw = 'geoserver';
|
|
68
|
+
var grc = new GeoServerRestClient(url, user, pw);
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
function main () {
|
|
71
|
+
grc.about.exists().then(function (result) {
|
|
72
72
|
console.log(result);
|
|
73
|
+
});
|
|
73
74
|
};
|
|
74
75
|
|
|
75
76
|
main();
|
|
@@ -117,14 +118,14 @@ A request either succeeds or throws the custom `GeoServerResponseError`. It has
|
|
|
117
118
|
First start a test setup using this Docker compose file:
|
|
118
119
|
|
|
119
120
|
```shell
|
|
120
|
-
GEOSERVER_VERSION=
|
|
121
|
+
GEOSERVER_VERSION=3.0.0 TEMP_DIR=/tmp/gs docker compose -f test/docker-compose.yml up
|
|
121
122
|
```
|
|
122
123
|
|
|
123
124
|
Then, in an other terminal, run:
|
|
124
125
|
|
|
125
126
|
```shell
|
|
126
127
|
# specify the GeoServer version and run the test suite
|
|
127
|
-
GEOSERVER_VERSION=
|
|
128
|
+
GEOSERVER_VERSION=3.0.0 npm run test
|
|
128
129
|
```
|
|
129
130
|
|
|
130
131
|
## Release
|
package/dist/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "geoserver-node-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Node.js client for GeoServer REST API",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "geoserver-rest-client.js",
|
|
7
|
+
"types": "./dist/types/geoserver-rest-client.d.ts",
|
|
7
8
|
"scripts": {
|
|
8
9
|
"demo": "node demo/index.js",
|
|
9
10
|
"docs": "./node_modules/.bin/jsdoc geoserver-rest-client.js src/*.js DOCS_HOME.md && cp img/*.png out/",
|
|
@@ -14,14 +15,18 @@
|
|
|
14
15
|
"test:reset-gs": "node test/reset-gs.js",
|
|
15
16
|
"release": "release-it",
|
|
16
17
|
"release:dry": "release-it --dry-run",
|
|
17
|
-
"build": "npm run build:clean && npm run build:babel && npm run build:fixup",
|
|
18
|
+
"build": "npm run build:clean && npm run build:babel && npm run build:types && npm run build:fixup",
|
|
18
19
|
"build:clean": "rm -rf dist",
|
|
19
20
|
"build:babel": "babel geoserver-rest-client.js -d dist && babel src -d dist/src",
|
|
21
|
+
"build:types": "tsc -p tsconfig.json",
|
|
20
22
|
"build:fixup": "node scripts/create-custom-package-json.js"
|
|
21
23
|
},
|
|
22
24
|
"exports": {
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/types/geoserver-rest-client.d.ts",
|
|
27
|
+
"import": "./geoserver-rest-client.js",
|
|
28
|
+
"require": "./dist/geoserver-rest-client.js"
|
|
29
|
+
}
|
|
25
30
|
},
|
|
26
31
|
"files": [
|
|
27
32
|
"geoserver-rest-client.js",
|
|
@@ -45,6 +50,7 @@
|
|
|
45
50
|
"@babel/plugin-transform-runtime": "^8.0.0",
|
|
46
51
|
"@babel/preset-env": "^8.0.0",
|
|
47
52
|
"@eslint/compat": "^2.0.0",
|
|
53
|
+
"@types/node": "^26.0.0",
|
|
48
54
|
"chai": "^6.0.1",
|
|
49
55
|
"eslint": "^9.29.0",
|
|
50
56
|
"eslint-config-prettier": "^10.1.5",
|
|
@@ -53,6 +59,7 @@
|
|
|
53
59
|
"mocha": "^11.7.1",
|
|
54
60
|
"neostandard": "^0.13.0",
|
|
55
61
|
"prettier": "^3.6.1",
|
|
56
|
-
"release-it": "^20.0.0"
|
|
62
|
+
"release-it": "^20.0.0",
|
|
63
|
+
"typescript": "^6.0.3"
|
|
57
64
|
}
|
|
58
65
|
}
|
package/dist/src/datastore.js
CHANGED
|
@@ -211,7 +211,7 @@ class DatastoreClient {
|
|
|
211
211
|
* @param {String} coverageStore The name of the new GeoTIFF store
|
|
212
212
|
* @param {String} layerName The published name of the new layer
|
|
213
213
|
* @param {String} layerTitle The published title of the new layer
|
|
214
|
-
* @param {
|
|
214
|
+
* @param {fs.ReadStream} readStream The stream of the GeoTIFF file
|
|
215
215
|
* @param {Number} fileSizeInBytes The number of bytes of the stream
|
|
216
216
|
*
|
|
217
217
|
* @throws Error if request fails
|
package/dist/src/layer.js
CHANGED
|
@@ -227,11 +227,11 @@ class LayerClient {
|
|
|
227
227
|
* Publishes a FeatureType in the default data store of the workspace.
|
|
228
228
|
*
|
|
229
229
|
* @param {String} workspace Workspace to publish FeatureType in
|
|
230
|
-
* @param {String}
|
|
231
|
-
* @param {String} name Published name of FeatureType
|
|
232
|
-
* @param {String} [title] Published title of FeatureType
|
|
230
|
+
* @param {String} nativeName Native name of FeatureType
|
|
231
|
+
* @param {String} [name] Published name of FeatureType, defaults to `nativeName`
|
|
232
|
+
* @param {String} [title] Published title of FeatureType, defaults to `name` or `nativeName`
|
|
233
233
|
* @param {String} [srs="EPSG:4326"] The SRS of the FeatureType
|
|
234
|
-
* @param {
|
|
234
|
+
* @param {Boolean} [enabled=true] Flag to enable FeatureType by default
|
|
235
235
|
* @param {String} [abstract] The abstract of the layer
|
|
236
236
|
*
|
|
237
237
|
* @throws Error if request fails
|
|
@@ -239,11 +239,11 @@ class LayerClient {
|
|
|
239
239
|
async publishFeatureTypeDefaultDataStore(workspace, nativeName, name, title, srs, enabled, abstract) {
|
|
240
240
|
const body = {
|
|
241
241
|
featureType: {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
title: title || name,
|
|
242
|
+
nativeName: nativeName,
|
|
243
|
+
name: name || nativeName,
|
|
244
|
+
title: title || name || nativeName,
|
|
245
245
|
srs: srs || 'EPSG:4326',
|
|
246
|
-
enabled: enabled,
|
|
246
|
+
enabled: typeof enabled === 'boolean' ? enabled : true,
|
|
247
247
|
abstract: abstract || ''
|
|
248
248
|
}
|
|
249
249
|
};
|
|
@@ -267,11 +267,11 @@ class LayerClient {
|
|
|
267
267
|
*
|
|
268
268
|
* @param {String} workspace Workspace to publish FeatureType in
|
|
269
269
|
* @param {String} dataStore The datastore where the FeatureType's data is in
|
|
270
|
-
* @param {String}
|
|
271
|
-
* @param {String} name Published name of FeatureType
|
|
272
|
-
* @param {String} [title] Published title of FeatureType
|
|
270
|
+
* @param {String} nativeName Native name of FeatureType
|
|
271
|
+
* @param {String} [name] Published name of FeatureType, defaults to `nativeName`
|
|
272
|
+
* @param {String} [title] Published title of FeatureType, defaults to `name` or `nativeName`
|
|
273
273
|
* @param {String} [srs="EPSG:4326"] The SRS of the FeatureType
|
|
274
|
-
* @param {
|
|
274
|
+
* @param {Boolean} [enabled=true] Flag to enable FeatureType by default
|
|
275
275
|
* @param {String} [abstract] The abstract of the layer
|
|
276
276
|
* @param {String} [nativeBoundingBox] The native BoundingBox of the FeatureType (has to be set if no data is in store at creation time)
|
|
277
277
|
*
|
|
@@ -287,11 +287,11 @@ class LayerClient {
|
|
|
287
287
|
}
|
|
288
288
|
const body = {
|
|
289
289
|
featureType: {
|
|
290
|
-
name: name || nativeName,
|
|
291
290
|
nativeName: nativeName,
|
|
292
|
-
|
|
291
|
+
name: name || nativeName,
|
|
292
|
+
title: title || name || nativeName,
|
|
293
293
|
srs: srs || 'EPSG:4326',
|
|
294
|
-
enabled: enabled,
|
|
294
|
+
enabled: typeof enabled === 'boolean' ? enabled : true,
|
|
295
295
|
abstract: abstract || '',
|
|
296
296
|
nativeBoundingBox: nativeBoundingBox
|
|
297
297
|
}
|
|
@@ -381,10 +381,10 @@ class LayerClient {
|
|
|
381
381
|
* @param {String} workspace Workspace to publish WMS layer in
|
|
382
382
|
* @param {String} dataStore The datastore where the WMS is connected
|
|
383
383
|
* @param {String} nativeName Native name of WMS layer
|
|
384
|
-
* @param {String} [name] Published name of WMS layer
|
|
385
|
-
* @param {String} [title] Published title of WMS layer
|
|
384
|
+
* @param {String} [name] Published name of WMS layer, defaults to `nativeName`
|
|
385
|
+
* @param {String} [title] Published title of WMS layer, defaults to `name` or `nativeName`
|
|
386
386
|
* @param {String} [srs="EPSG:4326"] The SRS of the WMS layer
|
|
387
|
-
* @param {
|
|
387
|
+
* @param {Boolean} [enabled=true] Flag to enable WMS layer by default
|
|
388
388
|
* @param {String} [abstract] The abstract of the layer
|
|
389
389
|
*
|
|
390
390
|
* @throws Error if request fails
|
|
@@ -392,11 +392,11 @@ class LayerClient {
|
|
|
392
392
|
async publishWmsLayer(workspace, dataStore, nativeName, name, title, srs, enabled, abstract) {
|
|
393
393
|
const body = {
|
|
394
394
|
wmsLayer: {
|
|
395
|
-
name: name || nativeName,
|
|
396
395
|
nativeName: nativeName,
|
|
396
|
+
name: name || nativeName,
|
|
397
397
|
title: title || name || nativeName,
|
|
398
398
|
srs: srs || 'EPSG:4326',
|
|
399
|
-
enabled: enabled,
|
|
399
|
+
enabled: typeof enabled === 'boolean' ? enabled : true,
|
|
400
400
|
abstract: abstract || ''
|
|
401
401
|
}
|
|
402
402
|
};
|
|
@@ -421,10 +421,10 @@ class LayerClient {
|
|
|
421
421
|
* @param {String} workspace Workspace to publish layer in
|
|
422
422
|
* @param {String} coverageStore The coveragestore where the layer's data is in
|
|
423
423
|
* @param {String} nativeName Native name of raster
|
|
424
|
-
* @param {String} name Published name of layer
|
|
425
|
-
* @param {String} [title] Published title of layer
|
|
424
|
+
* @param {String} [name] Published name of layer, defaults to `nativeName`
|
|
425
|
+
* @param {String} [title] Published title of layer, defaults to `name` or `nativeName`
|
|
426
426
|
* @param {String} [srs="EPSG:4326"] The SRS of the layer
|
|
427
|
-
* @param {
|
|
427
|
+
* @param {Boolean} [enabled=true] Flag to enable layer by default
|
|
428
428
|
* @param {String} [abstract] The abstract of the layer
|
|
429
429
|
*
|
|
430
430
|
* @throws Error if request fails
|
|
@@ -432,9 +432,9 @@ class LayerClient {
|
|
|
432
432
|
async publishDbRaster(workspace, coverageStore, nativeName, name, title, srs, enabled, abstract) {
|
|
433
433
|
const body = {
|
|
434
434
|
coverage: {
|
|
435
|
-
name: name || nativeName,
|
|
436
435
|
nativeName: nativeName,
|
|
437
|
-
|
|
436
|
+
name: name || nativeName,
|
|
437
|
+
title: title || name || nativeName,
|
|
438
438
|
srs: srs,
|
|
439
439
|
enabled: enabled,
|
|
440
440
|
abstract: abstract || ''
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export { GeoServerResponseError } from "./src/util/geoserver.js";
|
|
2
|
+
/**
|
|
3
|
+
* Client for GeoServer REST API.
|
|
4
|
+
* Has minimal basic functionality and offers REST client instances for
|
|
5
|
+
* sub-entities, like workspaces or datastores as member variables.
|
|
6
|
+
*
|
|
7
|
+
* @module GeoServerRestClient
|
|
8
|
+
*/
|
|
9
|
+
export class GeoServerRestClient {
|
|
10
|
+
/**
|
|
11
|
+
* Creates a GeoServerRestClient instance.
|
|
12
|
+
*
|
|
13
|
+
* @param {String} url The URL of the GeoServer REST API endpoint
|
|
14
|
+
* @param {String} user The user for the GeoServer REST API
|
|
15
|
+
* @param {String} password The password for the GeoServer REST API
|
|
16
|
+
*/
|
|
17
|
+
constructor(url: string, user: string, password: string);
|
|
18
|
+
url: string;
|
|
19
|
+
auth: string;
|
|
20
|
+
/** @member {LayerClient} layers GeoServer REST client instance for layers */
|
|
21
|
+
layers: LayerClient;
|
|
22
|
+
/** @member {LayerGroupClient} layers GeoServer REST client instance for layergroups */
|
|
23
|
+
layergroups: LayerGroupClient;
|
|
24
|
+
/** @member {StyleClient} styles GeoServer REST client instance for styles */
|
|
25
|
+
styles: StyleClient;
|
|
26
|
+
/** @member {WorkspaceClient} workspaces GeoServer REST client instance for workspaces */
|
|
27
|
+
workspaces: WorkspaceClient;
|
|
28
|
+
/** @member {NamespaceClient} namespaces GeoServer REST client instance for namespaces */
|
|
29
|
+
namespaces: NamespaceClient;
|
|
30
|
+
/** @member {DatastoreClient} datastores GeoServer REST client instance for data stores */
|
|
31
|
+
datastores: DatastoreClient;
|
|
32
|
+
/** @member {ImageMosaicClient} imagemosaics GeoServer REST client instance for image mosaics */
|
|
33
|
+
imagemosaics: ImageMosaicClient;
|
|
34
|
+
/** @member {SecurityClient} security GeoServer REST client instance for security related modifications */
|
|
35
|
+
security: SecurityClient;
|
|
36
|
+
/** @member {SettingsClient} settings GeoServer REST client instance for settings */
|
|
37
|
+
settings: SettingsClient;
|
|
38
|
+
/** @member {AboutClient} about GeoServer REST client instance for about endpoint */
|
|
39
|
+
about: AboutClient;
|
|
40
|
+
/** @member {ResetReloadClient} about GeoServer REST client instance for reset/reload endpoints */
|
|
41
|
+
resetReload: ResetReloadClient;
|
|
42
|
+
}
|
|
43
|
+
import LayerClient from './src/layer.js';
|
|
44
|
+
import LayerGroupClient from './src/layergroup.js';
|
|
45
|
+
import StyleClient from './src/style.js';
|
|
46
|
+
import WorkspaceClient from './src/workspace.js';
|
|
47
|
+
import NamespaceClient from './src/namespace.js';
|
|
48
|
+
import DatastoreClient from './src/datastore.js';
|
|
49
|
+
import ImageMosaicClient from './src/imagemosaic.js';
|
|
50
|
+
import SecurityClient from './src/security.js';
|
|
51
|
+
import SettingsClient from './src/settings.js';
|
|
52
|
+
import AboutClient from './src/about.js';
|
|
53
|
+
import ResetReloadClient from './src/reset-reload.js';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client for GeoServer "about" endpoint
|
|
3
|
+
*
|
|
4
|
+
* @module AboutClient
|
|
5
|
+
*/
|
|
6
|
+
export default class AboutClient {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a GeoServer REST AboutClient instance.
|
|
9
|
+
*
|
|
10
|
+
* @param {String} url The URL of the GeoServer REST API endpoint
|
|
11
|
+
* @param {String} auth The Basic Authentication string
|
|
12
|
+
*/
|
|
13
|
+
constructor(url: string, auth: string);
|
|
14
|
+
url: string;
|
|
15
|
+
auth: string;
|
|
16
|
+
/**
|
|
17
|
+
* Get the GeoServer version.
|
|
18
|
+
*
|
|
19
|
+
* @throws Error if request fails
|
|
20
|
+
*
|
|
21
|
+
* @returns {Object} The version of GeoServer
|
|
22
|
+
*/
|
|
23
|
+
getVersion(): Object;
|
|
24
|
+
/**
|
|
25
|
+
* Checks if the configured GeoServer REST connection exists.
|
|
26
|
+
*
|
|
27
|
+
* @returns {Boolean} If the connection exists
|
|
28
|
+
*/
|
|
29
|
+
exists(): boolean;
|
|
30
|
+
}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client for GeoServer data stores
|
|
3
|
+
*
|
|
4
|
+
* @module DatastoreClient
|
|
5
|
+
*/
|
|
6
|
+
export default class DatastoreClient {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a GeoServer REST DatastoreClient instance.
|
|
9
|
+
*
|
|
10
|
+
* @param {String} url The URL of the GeoServer REST API endpoint
|
|
11
|
+
* @param {String} auth The Basic Authentication string
|
|
12
|
+
*/
|
|
13
|
+
constructor(url: string, auth: string);
|
|
14
|
+
url: string;
|
|
15
|
+
auth: string;
|
|
16
|
+
/**
|
|
17
|
+
* Get all DataStores in a workspace.
|
|
18
|
+
*
|
|
19
|
+
* @param {String} workspace The workspace to get DataStores for
|
|
20
|
+
*
|
|
21
|
+
* @returns {Object} An object containing store details
|
|
22
|
+
*/
|
|
23
|
+
getDataStores(workspace: string): Object;
|
|
24
|
+
/**
|
|
25
|
+
* Get all CoverageStores in a workspace.
|
|
26
|
+
*
|
|
27
|
+
* @param {String} workspace The workspace to get CoverageStores for
|
|
28
|
+
*
|
|
29
|
+
* @returns {Object} An object containing store details
|
|
30
|
+
*/
|
|
31
|
+
getCoverageStores(workspace: string): Object;
|
|
32
|
+
/**
|
|
33
|
+
* Get all WmsStores in a workspace.
|
|
34
|
+
*
|
|
35
|
+
* @param {String} workspace The workspace to get WmsStores for
|
|
36
|
+
*
|
|
37
|
+
* @returns {Object} An object containing store details
|
|
38
|
+
*/
|
|
39
|
+
getWmsStores(workspace: string): Object;
|
|
40
|
+
/**
|
|
41
|
+
* Get all WmtsStores in a workspace.
|
|
42
|
+
*
|
|
43
|
+
* @param {String} workspace The workspace to get WmtsStores for
|
|
44
|
+
*
|
|
45
|
+
* @returns {Object} An object containing store details
|
|
46
|
+
*/
|
|
47
|
+
getWmtsStores(workspace: string): Object;
|
|
48
|
+
/**
|
|
49
|
+
* Get information about various store types in a workspace.
|
|
50
|
+
*
|
|
51
|
+
* @param {String} workspace The workspace name
|
|
52
|
+
* @param {String} storeType The type of store
|
|
53
|
+
*
|
|
54
|
+
* @throws Error if request fails
|
|
55
|
+
*
|
|
56
|
+
* @returns {Object} An object containing store details or undefined if it cannot be found
|
|
57
|
+
* @private
|
|
58
|
+
*/
|
|
59
|
+
private getStores;
|
|
60
|
+
/**
|
|
61
|
+
* Get specific DataStore by name in a workspace.
|
|
62
|
+
*
|
|
63
|
+
* @param {String} workspace The workspace to search DataStore in
|
|
64
|
+
* @param {String} dataStore DataStore name
|
|
65
|
+
*
|
|
66
|
+
* @returns {Object} An object containing store details or undefined if it cannot be found
|
|
67
|
+
*/
|
|
68
|
+
getDataStore(workspace: string, dataStore: string): Object;
|
|
69
|
+
/**
|
|
70
|
+
* Get specific CoverageStore by name in a workspace.
|
|
71
|
+
*
|
|
72
|
+
* @param {String} workspace The workspace to search CoverageStore in
|
|
73
|
+
* @param {String} covStore CoverageStore name
|
|
74
|
+
*
|
|
75
|
+
* @returns {Object} An object containing store details or undefined if it cannot be found
|
|
76
|
+
*/
|
|
77
|
+
getCoverageStore(workspace: string, covStore: string): Object;
|
|
78
|
+
/**
|
|
79
|
+
* Get specific WmsStore by name in a workspace.
|
|
80
|
+
*
|
|
81
|
+
* @param {String} workspace The workspace to search WmsStore in
|
|
82
|
+
* @param {String} wmsStore WmsStore name
|
|
83
|
+
*
|
|
84
|
+
* @returns {Object} An object containing store details or undefined if it cannot be found
|
|
85
|
+
*
|
|
86
|
+
*/
|
|
87
|
+
getWmsStore(workspace: string, wmsStore: string): Object;
|
|
88
|
+
/**
|
|
89
|
+
* Get specific WmtsStore by name in a workspace.
|
|
90
|
+
*
|
|
91
|
+
* @param {String} workspace The workspace to search WmtsStore in
|
|
92
|
+
* @param {String} wmtsStore WmtsStore name
|
|
93
|
+
*
|
|
94
|
+
* @returns {Object} An object containing store details or undefined if it cannot be found
|
|
95
|
+
*/
|
|
96
|
+
getWmtsStore(workspace: string, wmtsStore: string): Object;
|
|
97
|
+
/**
|
|
98
|
+
* Get GeoServer store by type
|
|
99
|
+
*
|
|
100
|
+
* @param {String} workspace The name of the workspace
|
|
101
|
+
* @param {String} storeName The name of the store
|
|
102
|
+
* @param {String} storeType The type of the store
|
|
103
|
+
*
|
|
104
|
+
* @throws Error if request fails
|
|
105
|
+
*
|
|
106
|
+
* @returns {Object} An object containing store details or undefined if it cannot be found
|
|
107
|
+
* @private
|
|
108
|
+
*/
|
|
109
|
+
private getStore;
|
|
110
|
+
/**
|
|
111
|
+
* Creates a GeoTIFF store from a file by path and publishes it as layer.
|
|
112
|
+
* The GeoTIFF file has to be placed on the server, where your GeoServer
|
|
113
|
+
* is running.
|
|
114
|
+
*
|
|
115
|
+
* @param {String} workspace The workspace to create GeoTIFF store in
|
|
116
|
+
* @param {String} coverageStore The name of the new GeoTIFF store
|
|
117
|
+
* @param {String} layerName The published name of the new layer
|
|
118
|
+
* @param {String} layerTitle The published title of the new layer
|
|
119
|
+
* @param {String} filePath The path to the GeoTIFF file on the server
|
|
120
|
+
*
|
|
121
|
+
* @throws Error if request fails
|
|
122
|
+
*
|
|
123
|
+
* @returns {String} The successful response text
|
|
124
|
+
*/
|
|
125
|
+
createGeotiffFromFile(workspace: string, coverageStore: string, layerName: string, layerTitle: string, filePath: string): string;
|
|
126
|
+
/**
|
|
127
|
+
* Creates a GeoTIFF store from a file by stream and publishes it as layer.
|
|
128
|
+
* The GeoTIFF file is placed on the server, where your GeoServer
|
|
129
|
+
* is running.
|
|
130
|
+
*
|
|
131
|
+
* @param {String} workspace The workspace to create GeoTIFF store in
|
|
132
|
+
* @param {String} coverageStore The name of the new GeoTIFF store
|
|
133
|
+
* @param {String} layerName The published name of the new layer
|
|
134
|
+
* @param {String} layerTitle The published title of the new layer
|
|
135
|
+
* @param {fs.ReadStream} readStream The stream of the GeoTIFF file
|
|
136
|
+
* @param {Number} fileSizeInBytes The number of bytes of the stream
|
|
137
|
+
*
|
|
138
|
+
* @throws Error if request fails
|
|
139
|
+
*
|
|
140
|
+
* @returns {String} The successful response text
|
|
141
|
+
*/
|
|
142
|
+
createGeotiffFromStream(workspace: string, coverageStore: string, layerName: string, layerTitle: string, readStream: fs.ReadStream, fileSizeInBytes: number): string;
|
|
143
|
+
/**
|
|
144
|
+
* Creates a PostGIS based data store.
|
|
145
|
+
*
|
|
146
|
+
* @param {String} workspace The WS to create the data store in
|
|
147
|
+
* @param {String} namespaceUri The namespace URI of the workspace
|
|
148
|
+
* @param {String} dataStore The data store name to be created
|
|
149
|
+
* @param {String} pgHost The PostGIS DB host
|
|
150
|
+
* @param {Number} pgPort The PostGIS DB port
|
|
151
|
+
* @param {String} pgUser The PostGIS DB user
|
|
152
|
+
* @param {String} pgPassword The PostGIS DB password
|
|
153
|
+
* @param {String} pgSchema The PostGIS DB schema
|
|
154
|
+
* @param {String} pgDb The PostGIS DB name
|
|
155
|
+
* @param {Boolean} [exposePk] expose primary key, defaults to false
|
|
156
|
+
*
|
|
157
|
+
* @throws Error if request fails
|
|
158
|
+
*/
|
|
159
|
+
createPostgisStore(workspace: string, namespaceUri: string, dataStore: string, pgHost: string, pgPort: number, pgUser: string, pgPassword: string, pgSchema: string, pgDb: string, exposePk?: boolean): Promise<void>;
|
|
160
|
+
/**
|
|
161
|
+
* Creates an ImageMosaic store from a zip archive with the 3 necessary files
|
|
162
|
+
* - datastore.properties
|
|
163
|
+
* - indexer.properties
|
|
164
|
+
* - timeregex.properties
|
|
165
|
+
*
|
|
166
|
+
* The zip archive has to be given as absolute path, so before it has to be
|
|
167
|
+
* placed on the server, where your GeoServer is running.
|
|
168
|
+
*
|
|
169
|
+
* @param {String} workspace The WS to create the data store in
|
|
170
|
+
* @param {String} dataStore The data store name
|
|
171
|
+
* @param {String} zipArchivePath Absolute path to zip archive with the 3 properties files
|
|
172
|
+
*
|
|
173
|
+
* @throws Error if request fails
|
|
174
|
+
*
|
|
175
|
+
* @returns {String} The response text
|
|
176
|
+
*/
|
|
177
|
+
createImageMosaicStore(workspace: string, coverageStore: any, zipArchivePath: string): string;
|
|
178
|
+
/**
|
|
179
|
+
* Creates a WMS based data store.
|
|
180
|
+
*
|
|
181
|
+
* @param {String} workspace The WS to create the data store in
|
|
182
|
+
* @param {String} dataStore The data store name
|
|
183
|
+
* @param {String} wmsCapabilitiesUrl Base WMS capabilities URL
|
|
184
|
+
*
|
|
185
|
+
* @throws Error if request fails
|
|
186
|
+
*/
|
|
187
|
+
createWmsStore(workspace: string, dataStore: string, wmsCapabilitiesUrl: string): Promise<void>;
|
|
188
|
+
/**
|
|
189
|
+
* Creates a WMTS based data store.
|
|
190
|
+
*
|
|
191
|
+
* @param {String} workspace The WS to create the data store in
|
|
192
|
+
* @param {String} dataStore The data store name
|
|
193
|
+
* @param {String} wmtsCapabilitiesUrl Base WMTS capabilities URL
|
|
194
|
+
*
|
|
195
|
+
* @throws Error if request fails
|
|
196
|
+
*/
|
|
197
|
+
createWmtsStore(workspace: string, dataStore: string, wmtsCapabilitiesUrl: string): Promise<void>;
|
|
198
|
+
/**
|
|
199
|
+
* Creates a WFS based data store.
|
|
200
|
+
*
|
|
201
|
+
* @param {String} workspace The WS to create the data store in
|
|
202
|
+
* @param {String} dataStore The data store name
|
|
203
|
+
* @param {String} wfsCapabilitiesUrl WFS capabilities URL
|
|
204
|
+
* @param {String} namespaceUrl URL of the GeoServer namespace
|
|
205
|
+
* @param {Boolean} [useHttpConnectionPooling=true] use HTTP connection pooling for WFS connection
|
|
206
|
+
*
|
|
207
|
+
* @throws Error if request fails
|
|
208
|
+
*/
|
|
209
|
+
createWfsStore(workspace: string, dataStore: string, wfsCapabilitiesUrl: string, namespaceUrl: string, useHttpConnectionPooling?: boolean): Promise<void>;
|
|
210
|
+
/**
|
|
211
|
+
* Deletes a data store.
|
|
212
|
+
*
|
|
213
|
+
* @param {String} workspace The workspace where the data store is in
|
|
214
|
+
* @param {String} coverageStore Name of data store to delete
|
|
215
|
+
* @param {String} recurse Flag to enable recursive deletion
|
|
216
|
+
*
|
|
217
|
+
* @throws Error if request fails
|
|
218
|
+
*/
|
|
219
|
+
deleteDataStore(workspace: string, dataStore: any, recurse: string): Promise<void>;
|
|
220
|
+
/**
|
|
221
|
+
* Deletes a CoverageStore.
|
|
222
|
+
*
|
|
223
|
+
* @param {String} workspace The workspace where the CoverageStore is in
|
|
224
|
+
* @param {String} coverageStore Name of CoverageStore to delete
|
|
225
|
+
* @param {String} recurse Flag to enable recursive deletion
|
|
226
|
+
*
|
|
227
|
+
* @throws Error if request fails
|
|
228
|
+
*/
|
|
229
|
+
deleteCoverageStore(workspace: string, coverageStore: string, recurse: string): Promise<void>;
|
|
230
|
+
/**
|
|
231
|
+
* Creates a GeoPackage store from a file placed in the geoserver_data dir.
|
|
232
|
+
*
|
|
233
|
+
* @param {String} workspace The WS to create the data store in
|
|
234
|
+
* @param {String} dataStore The data store name
|
|
235
|
+
* @param {String} gpkgPath Relative path to GeoPackage file within geoserver_data dir
|
|
236
|
+
*
|
|
237
|
+
* @throws Error if request fails
|
|
238
|
+
*/
|
|
239
|
+
createGpkgStore(workspace: string, dataStore: string, gpkgPath: string): Promise<void>;
|
|
240
|
+
}
|
|
241
|
+
import fs from 'fs';
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client for GeoServer image mosaics
|
|
3
|
+
*
|
|
4
|
+
* @module ImageMosaicClient
|
|
5
|
+
*/
|
|
6
|
+
export default class ImageMosaicClient {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a GeoServer REST ImageMosaicClient instance.
|
|
9
|
+
*
|
|
10
|
+
* @param {String} url The URL of the GeoServer REST API endpoint
|
|
11
|
+
* @param {String} auth The Basic Authentication string
|
|
12
|
+
*/
|
|
13
|
+
constructor(url: string, auth: string);
|
|
14
|
+
url: string;
|
|
15
|
+
auth: string;
|
|
16
|
+
/**
|
|
17
|
+
* Returns all granules of an image mosaic.
|
|
18
|
+
*
|
|
19
|
+
* @param {String} workspace Workspace of image mosaic
|
|
20
|
+
* @param {String} coverageStore CoverageStore of image mosaic
|
|
21
|
+
* @param {String} coverage Name of image mosaic
|
|
22
|
+
*
|
|
23
|
+
* @throws Error if request fails
|
|
24
|
+
*
|
|
25
|
+
* @returns {Object} An object with the granules
|
|
26
|
+
*/
|
|
27
|
+
getGranules(workspace: string, coverageStore: string, coverage: string): Object;
|
|
28
|
+
/**
|
|
29
|
+
* Harvests all granules in the given folder for an image mosaic.
|
|
30
|
+
*
|
|
31
|
+
* @param {String} workspace Workspace of image mosaic
|
|
32
|
+
* @param {String} coverageStore CoverageStore of image mosaic
|
|
33
|
+
* @param {String} filePath Server path of folder to harvest
|
|
34
|
+
*
|
|
35
|
+
* @throws Error if request fails
|
|
36
|
+
*
|
|
37
|
+
* @returns {Object} An object with the granules
|
|
38
|
+
*/
|
|
39
|
+
harvestGranules(workspace: string, coverageStore: string, filePath: string): Object;
|
|
40
|
+
/**
|
|
41
|
+
* Adds a granule (defined by a server file) to an image mosaic.
|
|
42
|
+
*
|
|
43
|
+
* @param {String} workspace Workspace of image mosaic
|
|
44
|
+
* @param {String} coverageStore CoverageStore of image mosaic
|
|
45
|
+
* @param {String} filePath Server file path of new granule
|
|
46
|
+
*
|
|
47
|
+
* @throws Error if request fails
|
|
48
|
+
*/
|
|
49
|
+
addGranuleByServerFile(workspace: string, coverageStore: string, filePath: string): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Deletes a single granule of an image mosaic.
|
|
52
|
+
*
|
|
53
|
+
* @param {String} workspace Workspace of image mosaic
|
|
54
|
+
* @param {String} coverageStore CoverageStore of image mosaic
|
|
55
|
+
* @param {String} coverage Name of image mosaic
|
|
56
|
+
* @param {String} covFileLocation Location of coverage file
|
|
57
|
+
*
|
|
58
|
+
* @throws Error if request fails
|
|
59
|
+
*/
|
|
60
|
+
deleteSingleGranule(workspace: string, coverageStore: string, coverage: string, covFileLocation: string): Promise<boolean>;
|
|
61
|
+
}
|