@centia-io/sdk 0.2.8 → 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.
@@ -2866,8 +2866,9 @@ function toQuery$2(params) {
2866
2866
  /**
2867
2867
  * OWS (WMS/WFS/UTFGRID) endpoint wrapper.
2868
2868
  *
2869
- * Token-authenticated clients use `getOws`/`postOws`; anonymous and HTTP-Basic
2870
- * clients use the `...NoToken` variants, which include the database in the path.
2869
+ * The endpoint accepts Bearer token, HTTP Basic and anonymous requests. A
2870
+ * Bearer token must match the `database` in the path; protected layers
2871
+ * challenge token-less requests with HTTP Basic auth.
2871
2872
  *
2872
2873
  * Responses are streamed from the backend and returned as text (XML) or, for
2873
2874
  * JSON responses such as UTFGRID, as parsed JSON. Binary responses (e.g. WMS
@@ -2877,38 +2878,24 @@ var Ows = class {
2877
2878
  constructor(client) {
2878
2879
  this.client = client;
2879
2880
  }
2880
- /** Token-authenticated OWS GET (WMS/WFS/UTFGRID). */
2881
- async getOws(schema, params) {
2882
- return this.client.request({
2883
- path: `api/v4/ows/schema/${encodeURIComponent(schema)}`,
2884
- method: "GET",
2885
- query: toQuery$2(params),
2886
- accept: "*/*"
2887
- });
2881
+ basePath(schema, database) {
2882
+ return `api/v4/ows/schema/${encodeURIComponent(schema)}/database/${encodeURIComponent(database)}`;
2888
2883
  }
2889
- /** Token-authenticated OWS POST (WFS XML). */
2890
- async postOws(schema, xml) {
2891
- return this.client.request({
2892
- path: `api/v4/ows/schema/${encodeURIComponent(schema)}`,
2893
- method: "POST",
2894
- body: xml,
2895
- contentType: "text/xml",
2896
- accept: "*/*"
2897
- });
2898
- }
2899
- /** Anonymous/HTTP-Basic OWS GET (WMS/WFS/UTFGRID). */
2900
- async getOwsNoToken(schema, database, params) {
2901
- return this.client.request({
2902
- path: `api/v4/ows/schema/${encodeURIComponent(schema)}/database/${encodeURIComponent(database)}`,
2884
+ /** OWS GET (WMS/WFS/UTFGRID). */
2885
+ async getOws(schema, database, params) {
2886
+ var _this = this;
2887
+ return _this.client.request({
2888
+ path: _this.basePath(schema, database),
2903
2889
  method: "GET",
2904
2890
  query: toQuery$2(params),
2905
2891
  accept: "*/*"
2906
2892
  });
2907
2893
  }
2908
- /** Anonymous/HTTP-Basic OWS POST (WFS XML). */
2909
- async postOwsNoToken(schema, database, xml) {
2910
- return this.client.request({
2911
- path: `api/v4/ows/schema/${encodeURIComponent(schema)}/database/${encodeURIComponent(database)}`,
2894
+ /** OWS POST (WFS XML). */
2895
+ async postOws(schema, database, xml) {
2896
+ var _this2 = this;
2897
+ return _this2.client.request({
2898
+ path: _this2.basePath(schema, database),
2912
2899
  method: "POST",
2913
2900
  body: xml,
2914
2901
  contentType: "text/xml",
@@ -2924,7 +2911,7 @@ function wfsPath(base, options) {
2924
2911
  if ((options === null || options === void 0 ? void 0 : options.timeSlice) != null && options.srs == null) throw new Error("timeSlice requires srs to be set");
2925
2912
  if ((options === null || options === void 0 ? void 0 : options.srs) != null) {
2926
2913
  path += `/srs/${encodeURIComponent(options.srs)}`;
2927
- if (options.timeSlice != null) path += `/${encodeURIComponent(options.timeSlice)}`;
2914
+ if (options.timeSlice != null) path += `/ts/${encodeURIComponent(options.timeSlice)}`;
2928
2915
  }
2929
2916
  return path;
2930
2917
  }
@@ -2937,50 +2924,33 @@ function toQuery$1(params) {
2937
2924
  * WFS endpoint wrapper (GetCapabilities, DescribeFeatureType, GetFeature and
2938
2925
  * WFS-T transactions).
2939
2926
  *
2940
- * Token-authenticated clients use `getWfs`/`postWfs`; anonymous and HTTP-Basic
2941
- * clients (e.g. QGIS) use the `...NoToken` variants, which include the
2942
- * database in the path. Responses are returned as XML text.
2927
+ * The endpoint accepts Bearer token, HTTP Basic and anonymous requests. A
2928
+ * Bearer token must match the `database` in the path; protected layers
2929
+ * challenge token-less requests with HTTP Basic auth, and transactions on a
2930
+ * protected layer require credentials. Responses are returned as XML text.
2943
2931
  */
2944
2932
  var Wfs = class {
2945
2933
  constructor(client) {
2946
2934
  this.client = client;
2947
2935
  }
2948
- /** Token-authenticated WFS GET. */
2949
- async getWfs(schema, params, options) {
2950
- return this.client.request({
2951
- path: wfsPath(`api/v4/wfs/schema/${encodeURIComponent(schema)}`, options),
2952
- method: "GET",
2953
- query: toQuery$1(params),
2954
- accept: "text/xml"
2955
- });
2956
- }
2957
- /** Token-authenticated WFS POST (XML-encoded GetFeature or Transaction). */
2958
- async postWfs(schema, xml, options) {
2959
- return this.client.request({
2960
- path: wfsPath(`api/v4/wfs/schema/${encodeURIComponent(schema)}`, options),
2961
- method: "POST",
2962
- body: xml,
2963
- contentType: "text/xml",
2964
- accept: "text/xml"
2965
- });
2936
+ basePath(schema, database) {
2937
+ return `api/v4/wfs/schema/${encodeURIComponent(schema)}/database/${encodeURIComponent(database)}`;
2966
2938
  }
2967
- /** Anonymous/HTTP-Basic WFS GET. */
2968
- async getWfsNoToken(schema, database, params, options) {
2969
- var _this3 = this;
2970
- const base = `api/v4/wfs/schema/${encodeURIComponent(schema)}/database/${encodeURIComponent(database)}`;
2971
- return _this3.client.request({
2972
- path: wfsPath(base, options),
2939
+ /** WFS GET. */
2940
+ async getWfs(schema, database, params, options) {
2941
+ var _this = this;
2942
+ return _this.client.request({
2943
+ path: wfsPath(_this.basePath(schema, database), options),
2973
2944
  method: "GET",
2974
2945
  query: toQuery$1(params),
2975
2946
  accept: "text/xml"
2976
2947
  });
2977
2948
  }
2978
- /** Anonymous/HTTP-Basic WFS POST (XML-encoded GetFeature or Transaction). */
2979
- async postWfsNoToken(schema, database, xml, options) {
2980
- var _this4 = this;
2981
- const base = `api/v4/wfs/schema/${encodeURIComponent(schema)}/database/${encodeURIComponent(database)}`;
2982
- return _this4.client.request({
2983
- path: wfsPath(base, options),
2949
+ /** WFS POST (XML-encoded GetFeature or Transaction). */
2950
+ async postWfs(schema, database, xml, options) {
2951
+ var _this2 = this;
2952
+ return _this2.client.request({
2953
+ path: wfsPath(_this2.basePath(schema, database), options),
2984
2954
  method: "POST",
2985
2955
  body: xml,
2986
2956
  contentType: "text/xml",