@centia-io/sdk 0.2.7 → 0.2.9
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 +17 -8
- package/dist/centia-io-sdk.cjs +53 -62
- package/dist/centia-io-sdk.d.cts +49 -22
- package/dist/centia-io-sdk.d.cts.map +1 -1
- package/dist/centia-io-sdk.d.ts +49 -22
- package/dist/centia-io-sdk.d.ts.map +1 -1
- package/dist/centia-io-sdk.js +53 -62
- package/dist/centia-io-sdk.js.map +1 -1
- package/dist/centia-io-sdk.umd.js +53 -62
- package/package.json +1 -1
|
@@ -2872,8 +2872,9 @@
|
|
|
2872
2872
|
/**
|
|
2873
2873
|
* OWS (WMS/WFS/UTFGRID) endpoint wrapper.
|
|
2874
2874
|
*
|
|
2875
|
-
*
|
|
2876
|
-
*
|
|
2875
|
+
* The endpoint accepts Bearer token, HTTP Basic and anonymous requests. A
|
|
2876
|
+
* Bearer token must match the `database` in the path; protected layers
|
|
2877
|
+
* challenge token-less requests with HTTP Basic auth.
|
|
2877
2878
|
*
|
|
2878
2879
|
* Responses are streamed from the backend and returned as text (XML) or, for
|
|
2879
2880
|
* JSON responses such as UTFGRID, as parsed JSON. Binary responses (e.g. WMS
|
|
@@ -2883,38 +2884,24 @@
|
|
|
2883
2884
|
constructor(client) {
|
|
2884
2885
|
this.client = client;
|
|
2885
2886
|
}
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
return this.client.request({
|
|
2889
|
-
path: `api/v4/ows/schema/${encodeURIComponent(schema)}`,
|
|
2890
|
-
method: "GET",
|
|
2891
|
-
query: toQuery$2(params),
|
|
2892
|
-
accept: "*/*"
|
|
2893
|
-
});
|
|
2894
|
-
}
|
|
2895
|
-
/** Token-authenticated OWS POST (WFS XML). */
|
|
2896
|
-
async postOws(schema, xml) {
|
|
2897
|
-
return this.client.request({
|
|
2898
|
-
path: `api/v4/ows/schema/${encodeURIComponent(schema)}`,
|
|
2899
|
-
method: "POST",
|
|
2900
|
-
body: xml,
|
|
2901
|
-
contentType: "text/xml",
|
|
2902
|
-
accept: "*/*"
|
|
2903
|
-
});
|
|
2887
|
+
basePath(schema, database) {
|
|
2888
|
+
return `api/v4/ows/schema/${encodeURIComponent(schema)}/database/${encodeURIComponent(database)}`;
|
|
2904
2889
|
}
|
|
2905
|
-
/**
|
|
2906
|
-
async
|
|
2907
|
-
|
|
2908
|
-
|
|
2890
|
+
/** OWS GET (WMS/WFS/UTFGRID). */
|
|
2891
|
+
async getOws(schema, database, params) {
|
|
2892
|
+
var _this = this;
|
|
2893
|
+
return _this.client.request({
|
|
2894
|
+
path: _this.basePath(schema, database),
|
|
2909
2895
|
method: "GET",
|
|
2910
2896
|
query: toQuery$2(params),
|
|
2911
2897
|
accept: "*/*"
|
|
2912
2898
|
});
|
|
2913
2899
|
}
|
|
2914
|
-
/**
|
|
2915
|
-
async
|
|
2916
|
-
|
|
2917
|
-
|
|
2900
|
+
/** OWS POST (WFS XML). */
|
|
2901
|
+
async postOws(schema, database, xml) {
|
|
2902
|
+
var _this2 = this;
|
|
2903
|
+
return _this2.client.request({
|
|
2904
|
+
path: _this2.basePath(schema, database),
|
|
2918
2905
|
method: "POST",
|
|
2919
2906
|
body: xml,
|
|
2920
2907
|
contentType: "text/xml",
|
|
@@ -2930,7 +2917,7 @@
|
|
|
2930
2917
|
if ((options === null || options === void 0 ? void 0 : options.timeSlice) != null && options.srs == null) throw new Error("timeSlice requires srs to be set");
|
|
2931
2918
|
if ((options === null || options === void 0 ? void 0 : options.srs) != null) {
|
|
2932
2919
|
path += `/srs/${encodeURIComponent(options.srs)}`;
|
|
2933
|
-
if (options.timeSlice != null) path +=
|
|
2920
|
+
if (options.timeSlice != null) path += `/ts/${encodeURIComponent(options.timeSlice)}`;
|
|
2934
2921
|
}
|
|
2935
2922
|
return path;
|
|
2936
2923
|
}
|
|
@@ -2943,50 +2930,33 @@
|
|
|
2943
2930
|
* WFS endpoint wrapper (GetCapabilities, DescribeFeatureType, GetFeature and
|
|
2944
2931
|
* WFS-T transactions).
|
|
2945
2932
|
*
|
|
2946
|
-
*
|
|
2947
|
-
*
|
|
2948
|
-
*
|
|
2933
|
+
* The endpoint accepts Bearer token, HTTP Basic and anonymous requests. A
|
|
2934
|
+
* Bearer token must match the `database` in the path; protected layers
|
|
2935
|
+
* challenge token-less requests with HTTP Basic auth, and transactions on a
|
|
2936
|
+
* protected layer require credentials. Responses are returned as XML text.
|
|
2949
2937
|
*/
|
|
2950
2938
|
var Wfs = class {
|
|
2951
2939
|
constructor(client) {
|
|
2952
2940
|
this.client = client;
|
|
2953
2941
|
}
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
return this.client.request({
|
|
2957
|
-
path: wfsPath(`api/v4/wfs/schema/${encodeURIComponent(schema)}`, options),
|
|
2958
|
-
method: "GET",
|
|
2959
|
-
query: toQuery$1(params),
|
|
2960
|
-
accept: "text/xml"
|
|
2961
|
-
});
|
|
2962
|
-
}
|
|
2963
|
-
/** Token-authenticated WFS POST (XML-encoded GetFeature or Transaction). */
|
|
2964
|
-
async postWfs(schema, xml, options) {
|
|
2965
|
-
return this.client.request({
|
|
2966
|
-
path: wfsPath(`api/v4/wfs/schema/${encodeURIComponent(schema)}`, options),
|
|
2967
|
-
method: "POST",
|
|
2968
|
-
body: xml,
|
|
2969
|
-
contentType: "text/xml",
|
|
2970
|
-
accept: "text/xml"
|
|
2971
|
-
});
|
|
2942
|
+
basePath(schema, database) {
|
|
2943
|
+
return `api/v4/wfs/schema/${encodeURIComponent(schema)}/database/${encodeURIComponent(database)}`;
|
|
2972
2944
|
}
|
|
2973
|
-
/**
|
|
2974
|
-
async
|
|
2975
|
-
var
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
path: wfsPath(base, options),
|
|
2945
|
+
/** WFS GET. */
|
|
2946
|
+
async getWfs(schema, database, params, options) {
|
|
2947
|
+
var _this = this;
|
|
2948
|
+
return _this.client.request({
|
|
2949
|
+
path: wfsPath(_this.basePath(schema, database), options),
|
|
2979
2950
|
method: "GET",
|
|
2980
2951
|
query: toQuery$1(params),
|
|
2981
2952
|
accept: "text/xml"
|
|
2982
2953
|
});
|
|
2983
2954
|
}
|
|
2984
|
-
/**
|
|
2985
|
-
async
|
|
2986
|
-
var
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
path: wfsPath(base, options),
|
|
2955
|
+
/** WFS POST (XML-encoded GetFeature or Transaction). */
|
|
2956
|
+
async postWfs(schema, database, xml, options) {
|
|
2957
|
+
var _this2 = this;
|
|
2958
|
+
return _this2.client.request({
|
|
2959
|
+
path: wfsPath(_this2.basePath(schema, database), options),
|
|
2990
2960
|
method: "POST",
|
|
2991
2961
|
body: xml,
|
|
2992
2962
|
contentType: "text/xml",
|
|
@@ -3047,6 +3017,27 @@
|
|
|
3047
3017
|
* request hook (e.g. MapLibre's `transformRequest` or OpenLayers'
|
|
3048
3018
|
* `tileLoadFunction`).
|
|
3049
3019
|
*/
|
|
3020
|
+
/**
|
|
3021
|
+
* Delete a tileset's cached tiles (optionally scoped by extent and zoom).
|
|
3022
|
+
* Runs `mapcache_seed -m delete` as a background job on the server and
|
|
3023
|
+
* returns the started job's info. Requires write/owner authorization for
|
|
3024
|
+
* the tileset's layer.
|
|
3025
|
+
*
|
|
3026
|
+
* `tileset` is the layer "schema.table" (vector variants "schema.table.mvt"/".json").
|
|
3027
|
+
*/
|
|
3028
|
+
async deleteMapcacheTileset(database, tileset, options) {
|
|
3029
|
+
var _this2 = this;
|
|
3030
|
+
const query = {};
|
|
3031
|
+
if ((options === null || options === void 0 ? void 0 : options.bbox) != null) query.bbox = options.bbox;
|
|
3032
|
+
if ((options === null || options === void 0 ? void 0 : options.zoom) != null) query.zoom = String(options.zoom);
|
|
3033
|
+
if ((options === null || options === void 0 ? void 0 : options.grid) != null) query.grid = options.grid;
|
|
3034
|
+
return _this2.client.request({
|
|
3035
|
+
path: `api/v4/mapcache/database/${encodeURIComponent(database)}/tileset/${encodeURIComponent(tileset)}`,
|
|
3036
|
+
method: "DELETE",
|
|
3037
|
+
query: Object.keys(query).length > 0 ? query : void 0,
|
|
3038
|
+
expectedStatus: 202
|
|
3039
|
+
});
|
|
3040
|
+
}
|
|
3050
3041
|
mapcacheUrl(database, path, params) {
|
|
3051
3042
|
let url = `${this.client.baseUrl}/${this.basePath(database, path)}`;
|
|
3052
3043
|
const query = toQuery(params);
|