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
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions and classes
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Return the GeoServer response text if available.
|
|
6
|
+
*
|
|
7
|
+
* @param {Response} response The response of the GeoServer
|
|
8
|
+
*
|
|
9
|
+
* @returns {String} The response text if available
|
|
10
|
+
*/
|
|
11
|
+
export function getGeoServerResponseText(response: Response): string;
|
|
12
|
+
/**
|
|
13
|
+
* Generic GeoServer error
|
|
14
|
+
*/
|
|
15
|
+
export class GeoServerResponseError extends Error {
|
|
16
|
+
/**
|
|
17
|
+
* @param {String} [message=GeoServer Response Error] The error message
|
|
18
|
+
* @param {String} [geoServerOutput] The error output from GeoServer (useful for debugging)
|
|
19
|
+
*/
|
|
20
|
+
constructor(message?: string, geoServerOutput?: string);
|
|
21
|
+
geoServerOutput: string | undefined;
|
|
22
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client for GeoServer workspaces
|
|
3
|
+
*
|
|
4
|
+
* @module WorkspaceClient
|
|
5
|
+
*/
|
|
6
|
+
export default class WorkspaceClient {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a GeoServer REST WorkspaceClient instance.
|
|
9
|
+
*
|
|
10
|
+
* WARNING: For most cases the 'NameSpaceClient' seems to fit better.
|
|
11
|
+
*
|
|
12
|
+
* @param {String} url The URL of the GeoServer REST API endpoint
|
|
13
|
+
* @param {String} auth The Basic Authentication string
|
|
14
|
+
*/
|
|
15
|
+
constructor(url: string, auth: string);
|
|
16
|
+
url: string;
|
|
17
|
+
auth: string;
|
|
18
|
+
/**
|
|
19
|
+
* Returns all workspaces.
|
|
20
|
+
*
|
|
21
|
+
* @throws Error if request fails
|
|
22
|
+
*
|
|
23
|
+
* @returns {Object} An Object describing the workspaces
|
|
24
|
+
*/
|
|
25
|
+
getAll(): Object;
|
|
26
|
+
/**
|
|
27
|
+
* Returns a workspace.
|
|
28
|
+
*
|
|
29
|
+
* @param {String} name Name of the workspace
|
|
30
|
+
*
|
|
31
|
+
* @throws Error if request fails
|
|
32
|
+
*
|
|
33
|
+
* @returns {Object} An object describing the workspaces
|
|
34
|
+
*/
|
|
35
|
+
get(name: string): Object;
|
|
36
|
+
/**
|
|
37
|
+
* Creates a new workspace.
|
|
38
|
+
*
|
|
39
|
+
* @param {String} name Name of the new workspace
|
|
40
|
+
*
|
|
41
|
+
* @throws Error if request fails
|
|
42
|
+
*
|
|
43
|
+
* @returns {String} The name of the created workspace
|
|
44
|
+
*/
|
|
45
|
+
create(name: string): string;
|
|
46
|
+
/**
|
|
47
|
+
* Deletes a workspace.
|
|
48
|
+
*
|
|
49
|
+
* @param {String} name Name of the workspace to delete
|
|
50
|
+
* @param {Boolean} recurse Flag to enable recursive deletion
|
|
51
|
+
*
|
|
52
|
+
* @throws Error if request fails
|
|
53
|
+
*/
|
|
54
|
+
delete(name: string, recurse: boolean): Promise<void>;
|
|
55
|
+
}
|
package/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": "module",
|
|
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/src/datastore.js
CHANGED
|
@@ -214,7 +214,7 @@ export default class DatastoreClient {
|
|
|
214
214
|
* @param {String} coverageStore The name of the new GeoTIFF store
|
|
215
215
|
* @param {String} layerName The published name of the new layer
|
|
216
216
|
* @param {String} layerTitle The published title of the new layer
|
|
217
|
-
* @param {
|
|
217
|
+
* @param {fs.ReadStream} readStream The stream of the GeoTIFF file
|
|
218
218
|
* @param {Number} fileSizeInBytes The number of bytes of the stream
|
|
219
219
|
*
|
|
220
220
|
* @throws Error if request fails
|
package/src/layer.js
CHANGED
|
@@ -254,11 +254,11 @@ export default class LayerClient {
|
|
|
254
254
|
* Publishes a FeatureType in the default data store of the workspace.
|
|
255
255
|
*
|
|
256
256
|
* @param {String} workspace Workspace to publish FeatureType in
|
|
257
|
-
* @param {String}
|
|
258
|
-
* @param {String} name Published name of FeatureType
|
|
259
|
-
* @param {String} [title] Published title of FeatureType
|
|
257
|
+
* @param {String} nativeName Native name of FeatureType
|
|
258
|
+
* @param {String} [name] Published name of FeatureType, defaults to `nativeName`
|
|
259
|
+
* @param {String} [title] Published title of FeatureType, defaults to `name` or `nativeName`
|
|
260
260
|
* @param {String} [srs="EPSG:4326"] The SRS of the FeatureType
|
|
261
|
-
* @param {
|
|
261
|
+
* @param {Boolean} [enabled=true] Flag to enable FeatureType by default
|
|
262
262
|
* @param {String} [abstract] The abstract of the layer
|
|
263
263
|
*
|
|
264
264
|
* @throws Error if request fails
|
|
@@ -274,11 +274,11 @@ export default class LayerClient {
|
|
|
274
274
|
) {
|
|
275
275
|
const body = {
|
|
276
276
|
featureType: {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
title: title || name,
|
|
277
|
+
nativeName: nativeName,
|
|
278
|
+
name: name || nativeName,
|
|
279
|
+
title: title || name || nativeName,
|
|
280
280
|
srs: srs || 'EPSG:4326',
|
|
281
|
-
enabled: enabled,
|
|
281
|
+
enabled: typeof enabled === 'boolean' ? enabled : true,
|
|
282
282
|
abstract: abstract || ''
|
|
283
283
|
}
|
|
284
284
|
};
|
|
@@ -304,11 +304,11 @@ export default class LayerClient {
|
|
|
304
304
|
*
|
|
305
305
|
* @param {String} workspace Workspace to publish FeatureType in
|
|
306
306
|
* @param {String} dataStore The datastore where the FeatureType's data is in
|
|
307
|
-
* @param {String}
|
|
308
|
-
* @param {String} name Published name of FeatureType
|
|
309
|
-
* @param {String} [title] Published title of FeatureType
|
|
307
|
+
* @param {String} nativeName Native name of FeatureType
|
|
308
|
+
* @param {String} [name] Published name of FeatureType, defaults to `nativeName`
|
|
309
|
+
* @param {String} [title] Published title of FeatureType, defaults to `name` or `nativeName`
|
|
310
310
|
* @param {String} [srs="EPSG:4326"] The SRS of the FeatureType
|
|
311
|
-
* @param {
|
|
311
|
+
* @param {Boolean} [enabled=true] Flag to enable FeatureType by default
|
|
312
312
|
* @param {String} [abstract] The abstract of the layer
|
|
313
313
|
* @param {String} [nativeBoundingBox] The native BoundingBox of the FeatureType (has to be set if no data is in store at creation time)
|
|
314
314
|
*
|
|
@@ -335,11 +335,11 @@ export default class LayerClient {
|
|
|
335
335
|
|
|
336
336
|
const body = {
|
|
337
337
|
featureType: {
|
|
338
|
-
name: name || nativeName,
|
|
339
338
|
nativeName: nativeName,
|
|
340
|
-
|
|
339
|
+
name: name || nativeName,
|
|
340
|
+
title: title || name || nativeName,
|
|
341
341
|
srs: srs || 'EPSG:4326',
|
|
342
|
-
enabled: enabled,
|
|
342
|
+
enabled: typeof enabled === 'boolean' ? enabled : true,
|
|
343
343
|
abstract: abstract || '',
|
|
344
344
|
nativeBoundingBox: nativeBoundingBox
|
|
345
345
|
}
|
|
@@ -449,10 +449,10 @@ export default class LayerClient {
|
|
|
449
449
|
* @param {String} workspace Workspace to publish WMS layer in
|
|
450
450
|
* @param {String} dataStore The datastore where the WMS is connected
|
|
451
451
|
* @param {String} nativeName Native name of WMS layer
|
|
452
|
-
* @param {String} [name] Published name of WMS layer
|
|
453
|
-
* @param {String} [title] Published title of WMS layer
|
|
452
|
+
* @param {String} [name] Published name of WMS layer, defaults to `nativeName`
|
|
453
|
+
* @param {String} [title] Published title of WMS layer, defaults to `name` or `nativeName`
|
|
454
454
|
* @param {String} [srs="EPSG:4326"] The SRS of the WMS layer
|
|
455
|
-
* @param {
|
|
455
|
+
* @param {Boolean} [enabled=true] Flag to enable WMS layer by default
|
|
456
456
|
* @param {String} [abstract] The abstract of the layer
|
|
457
457
|
*
|
|
458
458
|
* @throws Error if request fails
|
|
@@ -460,11 +460,11 @@ export default class LayerClient {
|
|
|
460
460
|
async publishWmsLayer(workspace, dataStore, nativeName, name, title, srs, enabled, abstract) {
|
|
461
461
|
const body = {
|
|
462
462
|
wmsLayer: {
|
|
463
|
-
name: name || nativeName,
|
|
464
463
|
nativeName: nativeName,
|
|
464
|
+
name: name || nativeName,
|
|
465
465
|
title: title || name || nativeName,
|
|
466
466
|
srs: srs || 'EPSG:4326',
|
|
467
|
-
enabled: enabled,
|
|
467
|
+
enabled: typeof enabled === 'boolean' ? enabled : true,
|
|
468
468
|
abstract: abstract || ''
|
|
469
469
|
}
|
|
470
470
|
};
|
|
@@ -494,10 +494,10 @@ export default class LayerClient {
|
|
|
494
494
|
* @param {String} workspace Workspace to publish layer in
|
|
495
495
|
* @param {String} coverageStore The coveragestore where the layer's data is in
|
|
496
496
|
* @param {String} nativeName Native name of raster
|
|
497
|
-
* @param {String} name Published name of layer
|
|
498
|
-
* @param {String} [title] Published title of layer
|
|
497
|
+
* @param {String} [name] Published name of layer, defaults to `nativeName`
|
|
498
|
+
* @param {String} [title] Published title of layer, defaults to `name` or `nativeName`
|
|
499
499
|
* @param {String} [srs="EPSG:4326"] The SRS of the layer
|
|
500
|
-
* @param {
|
|
500
|
+
* @param {Boolean} [enabled=true] Flag to enable layer by default
|
|
501
501
|
* @param {String} [abstract] The abstract of the layer
|
|
502
502
|
*
|
|
503
503
|
* @throws Error if request fails
|
|
@@ -505,9 +505,9 @@ export default class LayerClient {
|
|
|
505
505
|
async publishDbRaster(workspace, coverageStore, nativeName, name, title, srs, enabled, abstract) {
|
|
506
506
|
const body = {
|
|
507
507
|
coverage: {
|
|
508
|
-
name: name || nativeName,
|
|
509
508
|
nativeName: nativeName,
|
|
510
|
-
|
|
509
|
+
name: name || nativeName,
|
|
510
|
+
title: title || name || nativeName,
|
|
511
511
|
srs: srs,
|
|
512
512
|
enabled: enabled,
|
|
513
513
|
abstract: abstract || ''
|