@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.
@@ -2857,7 +2857,7 @@ function createCentiaAdminClient(config) {
2857
2857
 
2858
2858
  //#endregion
2859
2859
  //#region src/ogc/Ows.ts
2860
- function toQuery$1(params) {
2860
+ function toQuery$2(params) {
2861
2861
  if (!params) return void 0;
2862
2862
  const query = {};
2863
2863
  for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== null) query[key] = String(value);
@@ -2882,7 +2882,7 @@ var Ows = class {
2882
2882
  return this.client.request({
2883
2883
  path: `api/v4/ows/schema/${encodeURIComponent(schema)}`,
2884
2884
  method: "GET",
2885
- query: toQuery$1(params),
2885
+ query: toQuery$2(params),
2886
2886
  accept: "*/*"
2887
2887
  });
2888
2888
  }
@@ -2901,7 +2901,7 @@ var Ows = class {
2901
2901
  return this.client.request({
2902
2902
  path: `api/v4/ows/schema/${encodeURIComponent(schema)}/database/${encodeURIComponent(database)}`,
2903
2903
  method: "GET",
2904
- query: toQuery$1(params),
2904
+ query: toQuery$2(params),
2905
2905
  accept: "*/*"
2906
2906
  });
2907
2907
  }
@@ -2928,7 +2928,7 @@ function wfsPath(base, options) {
2928
2928
  }
2929
2929
  return path;
2930
2930
  }
2931
- function toQuery(params) {
2931
+ function toQuery$1(params) {
2932
2932
  const query = { SERVICE: "WFS" };
2933
2933
  for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== null) query[key] = String(value);
2934
2934
  return query;
@@ -2950,7 +2950,7 @@ var Wfs = class {
2950
2950
  return this.client.request({
2951
2951
  path: wfsPath(`api/v4/wfs/schema/${encodeURIComponent(schema)}`, options),
2952
2952
  method: "GET",
2953
- query: toQuery(params),
2953
+ query: toQuery$1(params),
2954
2954
  accept: "text/xml"
2955
2955
  });
2956
2956
  }
@@ -2971,7 +2971,7 @@ var Wfs = class {
2971
2971
  return _this3.client.request({
2972
2972
  path: wfsPath(base, options),
2973
2973
  method: "GET",
2974
- query: toQuery(params),
2974
+ query: toQuery$1(params),
2975
2975
  accept: "text/xml"
2976
2976
  });
2977
2977
  }
@@ -2989,6 +2989,66 @@ var Wfs = class {
2989
2989
  }
2990
2990
  };
2991
2991
 
2992
+ //#endregion
2993
+ //#region src/ogc/Mapcache.ts
2994
+ function toQuery(params) {
2995
+ if (!params) return void 0;
2996
+ const query = {};
2997
+ for (const [key, value] of Object.entries(params)) if (value !== void 0 && value !== null) query[key] = String(value);
2998
+ return Object.keys(query).length > 0 ? query : void 0;
2999
+ }
3000
+ /**
3001
+ * Authorizing MapCache proxy wrapper (WMTS, TMS, WMS, Google Maps).
3002
+ *
3003
+ * The endpoint accepts anonymous, HTTP Basic and Bearer token requests; tile
3004
+ * requests are authorized against the tileset's layer.
3005
+ *
3006
+ * `getMapcache` fetches text responses (capabilities documents and other XML).
3007
+ * Binary tile responses (PNG/JPEG) are not supported by the fetch wrapper —
3008
+ * instead hand `mapcacheUrl(...)` to your map library as a tile URL template.
3009
+ */
3010
+ var Mapcache = class {
3011
+ constructor(client) {
3012
+ this.client = client;
3013
+ }
3014
+ basePath(database, path) {
3015
+ let p = `api/v4/mapcache/database/${encodeURIComponent(database)}`;
3016
+ if (path) p += `/${path.replace(/^\/+/, "")}`;
3017
+ return p;
3018
+ }
3019
+ /**
3020
+ * Fetch a MapCache resource, e.g. a WMTS/WMS capabilities document.
3021
+ * `path` is the MapCache service path, e.g. `wmts/1.0.0/WMTSCapabilities.xml` or `wms`.
3022
+ */
3023
+ async getMapcache(database, path, params) {
3024
+ var _this = this;
3025
+ return _this.client.request({
3026
+ path: _this.basePath(database, path),
3027
+ method: "GET",
3028
+ query: toQuery(params),
3029
+ accept: "*/*"
3030
+ });
3031
+ }
3032
+ /**
3033
+ * Build the full URL for a MapCache service path without fetching it.
3034
+ * Template placeholders such as `{z}/{x}/{y}` are preserved, so the result
3035
+ * can be used directly as a tile URL template in OpenLayers, MapLibre or
3036
+ * Leaflet, e.g. `tms/1.0.0/my_schema.my_table@g20/{z}/{x}/{y}.png`.
3037
+ *
3038
+ * The endpoint authorizes via the Authorization header (Bearer token or
3039
+ * HTTP Basic) — a token cannot be embedded in the URL itself. For protected
3040
+ * tilesets, inject the header per tile request through the map library's
3041
+ * request hook (e.g. MapLibre's `transformRequest` or OpenLayers'
3042
+ * `tileLoadFunction`).
3043
+ */
3044
+ mapcacheUrl(database, path, params) {
3045
+ let url = `${this.client.baseUrl}/${this.basePath(database, path)}`;
3046
+ const query = toQuery(params);
3047
+ if (query) url += `?${new URLSearchParams(query).toString()}`;
3048
+ return url;
3049
+ }
3050
+ };
3051
+
2992
3052
  //#endregion
2993
3053
  //#region src/auth/errors.ts
2994
3054
  /**
@@ -3111,5 +3171,5 @@ function isExpired(jwt, skewSeconds) {
3111
3171
  */
3112
3172
 
3113
3173
  //#endregion
3114
- export { CentiaApiError, Claims, CodeFlow, Gql, Meta, NotLoggedInError, Ows, PasswordFlow, Rpc, SessionExpiredError, SignUp, Sql, SqlNoToken, Stats, Status, Tables, Users, Wfs, Ws, createApi, createCentiaAdminClient, createCentiaClient, createSqlBuilder, createTokenProvider, isCentiaApiError };
3174
+ export { CentiaApiError, Claims, CodeFlow, Gql, Mapcache, Meta, NotLoggedInError, Ows, PasswordFlow, Rpc, SessionExpiredError, SignUp, Sql, SqlNoToken, Stats, Status, Tables, Users, Wfs, Ws, createApi, createCentiaAdminClient, createCentiaClient, createSqlBuilder, createTokenProvider, isCentiaApiError };
3115
3175
  //# sourceMappingURL=centia-io-sdk.js.map