@centia-io/sdk 0.2.6 → 0.2.7
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 +18 -0
- package/dist/centia-io-sdk.cjs +67 -6
- package/dist/centia-io-sdk.d.cts +40 -2
- package/dist/centia-io-sdk.d.cts.map +1 -1
- package/dist/centia-io-sdk.d.ts +40 -2
- package/dist/centia-io-sdk.d.ts.map +1 -1
- package/dist/centia-io-sdk.js +67 -7
- package/dist/centia-io-sdk.js.map +1 -1
- package/dist/centia-io-sdk.umd.js +67 -6
- package/package.json +1 -1
|
@@ -2863,7 +2863,7 @@
|
|
|
2863
2863
|
|
|
2864
2864
|
//#endregion
|
|
2865
2865
|
//#region src/ogc/Ows.ts
|
|
2866
|
-
function toQuery$
|
|
2866
|
+
function toQuery$2(params) {
|
|
2867
2867
|
if (!params) return void 0;
|
|
2868
2868
|
const query = {};
|
|
2869
2869
|
for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== null) query[key] = String(value);
|
|
@@ -2888,7 +2888,7 @@
|
|
|
2888
2888
|
return this.client.request({
|
|
2889
2889
|
path: `api/v4/ows/schema/${encodeURIComponent(schema)}`,
|
|
2890
2890
|
method: "GET",
|
|
2891
|
-
query: toQuery$
|
|
2891
|
+
query: toQuery$2(params),
|
|
2892
2892
|
accept: "*/*"
|
|
2893
2893
|
});
|
|
2894
2894
|
}
|
|
@@ -2907,7 +2907,7 @@
|
|
|
2907
2907
|
return this.client.request({
|
|
2908
2908
|
path: `api/v4/ows/schema/${encodeURIComponent(schema)}/database/${encodeURIComponent(database)}`,
|
|
2909
2909
|
method: "GET",
|
|
2910
|
-
query: toQuery$
|
|
2910
|
+
query: toQuery$2(params),
|
|
2911
2911
|
accept: "*/*"
|
|
2912
2912
|
});
|
|
2913
2913
|
}
|
|
@@ -2934,7 +2934,7 @@
|
|
|
2934
2934
|
}
|
|
2935
2935
|
return path;
|
|
2936
2936
|
}
|
|
2937
|
-
function toQuery(params) {
|
|
2937
|
+
function toQuery$1(params) {
|
|
2938
2938
|
const query = { SERVICE: "WFS" };
|
|
2939
2939
|
for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== null) query[key] = String(value);
|
|
2940
2940
|
return query;
|
|
@@ -2956,7 +2956,7 @@
|
|
|
2956
2956
|
return this.client.request({
|
|
2957
2957
|
path: wfsPath(`api/v4/wfs/schema/${encodeURIComponent(schema)}`, options),
|
|
2958
2958
|
method: "GET",
|
|
2959
|
-
query: toQuery(params),
|
|
2959
|
+
query: toQuery$1(params),
|
|
2960
2960
|
accept: "text/xml"
|
|
2961
2961
|
});
|
|
2962
2962
|
}
|
|
@@ -2977,7 +2977,7 @@
|
|
|
2977
2977
|
return _this3.client.request({
|
|
2978
2978
|
path: wfsPath(base, options),
|
|
2979
2979
|
method: "GET",
|
|
2980
|
-
query: toQuery(params),
|
|
2980
|
+
query: toQuery$1(params),
|
|
2981
2981
|
accept: "text/xml"
|
|
2982
2982
|
});
|
|
2983
2983
|
}
|
|
@@ -2995,6 +2995,66 @@
|
|
|
2995
2995
|
}
|
|
2996
2996
|
};
|
|
2997
2997
|
|
|
2998
|
+
//#endregion
|
|
2999
|
+
//#region src/ogc/Mapcache.ts
|
|
3000
|
+
function toQuery(params) {
|
|
3001
|
+
if (!params) return void 0;
|
|
3002
|
+
const query = {};
|
|
3003
|
+
for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== null) query[key] = String(value);
|
|
3004
|
+
return Object.keys(query).length > 0 ? query : void 0;
|
|
3005
|
+
}
|
|
3006
|
+
/**
|
|
3007
|
+
* Authorizing MapCache proxy wrapper (WMTS, TMS, WMS, Google Maps).
|
|
3008
|
+
*
|
|
3009
|
+
* The endpoint accepts anonymous, HTTP Basic and Bearer token requests; tile
|
|
3010
|
+
* requests are authorized against the tileset's layer.
|
|
3011
|
+
*
|
|
3012
|
+
* `getMapcache` fetches text responses (capabilities documents and other XML).
|
|
3013
|
+
* Binary tile responses (PNG/JPEG) are not supported by the fetch wrapper —
|
|
3014
|
+
* instead hand `mapcacheUrl(...)` to your map library as a tile URL template.
|
|
3015
|
+
*/
|
|
3016
|
+
var Mapcache = class {
|
|
3017
|
+
constructor(client) {
|
|
3018
|
+
this.client = client;
|
|
3019
|
+
}
|
|
3020
|
+
basePath(database, path) {
|
|
3021
|
+
let p = `api/v4/mapcache/database/${encodeURIComponent(database)}`;
|
|
3022
|
+
if (path) p += `/${path.replace(/^\/+/, "")}`;
|
|
3023
|
+
return p;
|
|
3024
|
+
}
|
|
3025
|
+
/**
|
|
3026
|
+
* Fetch a MapCache resource, e.g. a WMTS/WMS capabilities document.
|
|
3027
|
+
* `path` is the MapCache service path, e.g. `wmts/1.0.0/WMTSCapabilities.xml` or `wms`.
|
|
3028
|
+
*/
|
|
3029
|
+
async getMapcache(database, path, params) {
|
|
3030
|
+
var _this = this;
|
|
3031
|
+
return _this.client.request({
|
|
3032
|
+
path: _this.basePath(database, path),
|
|
3033
|
+
method: "GET",
|
|
3034
|
+
query: toQuery(params),
|
|
3035
|
+
accept: "*/*"
|
|
3036
|
+
});
|
|
3037
|
+
}
|
|
3038
|
+
/**
|
|
3039
|
+
* Build the full URL for a MapCache service path without fetching it.
|
|
3040
|
+
* Template placeholders such as `{z}/{x}/{y}` are preserved, so the result
|
|
3041
|
+
* can be used directly as a tile URL template in OpenLayers, MapLibre or
|
|
3042
|
+
* Leaflet, e.g. `tms/1.0.0/my_schema.my_table@g20/{z}/{x}/{y}.png`.
|
|
3043
|
+
*
|
|
3044
|
+
* The endpoint authorizes via the Authorization header (Bearer token or
|
|
3045
|
+
* HTTP Basic) — a token cannot be embedded in the URL itself. For protected
|
|
3046
|
+
* tilesets, inject the header per tile request through the map library's
|
|
3047
|
+
* request hook (e.g. MapLibre's `transformRequest` or OpenLayers'
|
|
3048
|
+
* `tileLoadFunction`).
|
|
3049
|
+
*/
|
|
3050
|
+
mapcacheUrl(database, path, params) {
|
|
3051
|
+
let url = `${this.client.baseUrl}/${this.basePath(database, path)}`;
|
|
3052
|
+
const query = toQuery(params);
|
|
3053
|
+
if (query) url += `?${new URLSearchParams(query).toString()}`;
|
|
3054
|
+
return url;
|
|
3055
|
+
}
|
|
3056
|
+
};
|
|
3057
|
+
|
|
2998
3058
|
//#endregion
|
|
2999
3059
|
//#region src/auth/errors.ts
|
|
3000
3060
|
/**
|
|
@@ -3121,6 +3181,7 @@ exports.CentiaApiError = CentiaApiError;
|
|
|
3121
3181
|
exports.Claims = Claims;
|
|
3122
3182
|
exports.CodeFlow = CodeFlow;
|
|
3123
3183
|
exports.Gql = Gql;
|
|
3184
|
+
exports.Mapcache = Mapcache;
|
|
3124
3185
|
exports.Meta = Meta;
|
|
3125
3186
|
exports.NotLoggedInError = NotLoggedInError;
|
|
3126
3187
|
exports.Ows = Ows;
|