@geospatial-sdk/core 0.0.5-dev.33 → 0.0.5-dev.34

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.
@@ -1,4 +1,6 @@
1
+ import { EndpointError } from "@camptocamp/ogc-client";
1
2
  import { Feature } from "geojson";
3
+ import BaseEvent from "ol/events/Event";
2
4
  export declare const FeaturesClickEventType = "features-click";
3
5
  export interface FeaturesClickEvent {
4
6
  type: typeof FeaturesClickEventType;
@@ -18,5 +20,12 @@ export interface MapEventsByType {
18
20
  [FeaturesClickEventType]: FeaturesClickEvent;
19
21
  [FeaturesHoverEventType]: FeaturesHoverEvent;
20
22
  [MapClickEventType]: MapClickEvent;
23
+ [SourceLoadErrorType]: SourceLoadErrorEvent;
24
+ }
25
+ export declare const SourceLoadErrorType = "source-load-error";
26
+ export declare class SourceLoadErrorEvent extends BaseEvent {
27
+ message: string;
28
+ httpStatus?: number;
29
+ constructor(error: EndpointError | Error | Response);
21
30
  }
22
31
  //# sourceMappingURL=events.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../lib/model/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,eAAO,MAAM,sBAAsB,mBAAmB,CAAC;AACvD,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,OAAO,sBAAsB,CAAC;IACpC,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB;AAED,eAAO,MAAM,sBAAsB,mBAAmB,CAAC;AACvD,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,OAAO,sBAAsB,CAAC;IACpC,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB;AAED,eAAO,MAAM,iBAAiB,cAAc,CAAC;AAC7C,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,OAAO,iBAAiB,CAAC;IAC/B,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC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E,aAAa,GAAG,KAAK,GAAG,QAAQ;CAiBpD"}
@@ -1,3 +1,24 @@
1
+ import BaseEvent from "ol/events/Event";
1
2
  export const FeaturesClickEventType = "features-click";
2
3
  export const FeaturesHoverEventType = "features-hover";
3
4
  export const MapClickEventType = "map-click";
5
+ export const SourceLoadErrorType = "source-load-error";
6
+ export class SourceLoadErrorEvent extends BaseEvent {
7
+ constructor(error) {
8
+ super(SourceLoadErrorType);
9
+ if (error instanceof Response) {
10
+ this.message = error.statusText;
11
+ this.httpStatus = error.status;
12
+ }
13
+ else if (error instanceof Error &&
14
+ "isCrossOriginRelated" in error &&
15
+ "httpStatus" in error) {
16
+ const e = error;
17
+ this.message = e.message;
18
+ this.httpStatus = e.httpStatus;
19
+ }
20
+ else {
21
+ this.message = error.message;
22
+ }
23
+ }
24
+ }
@@ -1,4 +1,6 @@
1
+ import { EndpointError } from "@camptocamp/ogc-client";
1
2
  import { Feature } from "geojson";
3
+ import BaseEvent from "ol/events/Event";
2
4
 
3
5
  export const FeaturesClickEventType = "features-click";
4
6
  export interface FeaturesClickEvent {
@@ -22,4 +24,28 @@ export interface MapEventsByType {
22
24
  [FeaturesClickEventType]: FeaturesClickEvent;
23
25
  [FeaturesHoverEventType]: FeaturesHoverEvent;
24
26
  [MapClickEventType]: MapClickEvent;
27
+ [SourceLoadErrorType]: SourceLoadErrorEvent;
28
+ }
29
+
30
+ export const SourceLoadErrorType = "source-load-error";
31
+ export class SourceLoadErrorEvent extends BaseEvent {
32
+ message: string;
33
+ httpStatus?: number;
34
+ constructor(error: EndpointError | Error | Response) {
35
+ super(SourceLoadErrorType);
36
+ if (error instanceof Response) {
37
+ this.message = error.statusText;
38
+ this.httpStatus = error.status;
39
+ } else if (
40
+ error instanceof Error &&
41
+ "isCrossOriginRelated" in error &&
42
+ "httpStatus" in error
43
+ ) {
44
+ const e = error as EndpointError;
45
+ this.message = e.message;
46
+ this.httpStatus = e.httpStatus;
47
+ } else {
48
+ this.message = error.message;
49
+ }
50
+ }
25
51
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geospatial-sdk/core",
3
- "version": "0.0.5-dev.33+c11d24f",
3
+ "version": "0.0.5-dev.34+fa36a68",
4
4
  "description": "Core functions and models for the SDK",
5
5
  "author": "Olivia <olivia.guyot@camptocamp.com>",
6
6
  "homepage": "",
@@ -22,7 +22,7 @@
22
22
  "test": "vitest",
23
23
  "build": "tsc"
24
24
  },
25
- "gitHead": "c11d24f812fefab2aa4dec7d95b28e89ec90b581",
25
+ "gitHead": "fa36a68506520019014221820a92ce2ef8a10fd1",
26
26
  "dependencies": {
27
27
  "proj4": "^2.9.2"
28
28
  },