ogcopenapis 0.0.11 → 0.0.12

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.
@@ -14,7 +14,7 @@ export class OgcOpenApiFeatureStore {
14
14
  this.dataUrl = options.dataUrl;
15
15
  this.outputFormat = options.outputFormat;
16
16
  const predictedFeatureUrl = this.dataUrl.replace(/\.[^/.]+$/, "");
17
- this.featureUrl = options.featureUrl ? OgcOpenApiFeatureStore.cleanUrl(options.featureUrl) : OgcOpenApiFeatureStore.cleanUrl(predictedFeatureUrl);
17
+ this.featureUrl = options.featureUrl ? OgcOpenApiFeatureStore.cleanUrl(options.featureUrl, true) : OgcOpenApiFeatureStore.cleanUrl(predictedFeatureUrl, true);
18
18
  this.baseUrl = OgcOpenApiFeatureStore.cleanUrl(this.dataUrl);
19
19
  this.dataFormat = OgcOpenApiFeatureStore.dataFormatInQuery(this.dataUrl);
20
20
  this.customCrs = options.crs === "http://www.opengis.net/def/crs/OGC/1.3/CRS84" ? undefined : options.crs;
@@ -109,7 +109,7 @@ export class OgcOpenApiFeatureStore {
109
109
  }
110
110
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
111
111
  query(receivedQuery, options) {
112
- return new Promise((resolve) => {
112
+ return new Promise((resolve, reject) => {
113
113
  const query = receivedQuery ? Object.assign({}, receivedQuery) : {};
114
114
  query.f = query.f ? query.f : this.dataFormat;
115
115
  query.crs = query.crs ? query.crs : this.customCrs;
@@ -165,6 +165,11 @@ export class OgcOpenApiFeatureStore {
165
165
  }
166
166
  });
167
167
  }
168
+ else {
169
+ reject();
170
+ }
171
+ }).catch(() => {
172
+ reject();
168
173
  });
169
174
  });
170
175
  }
@@ -217,10 +222,9 @@ export class OgcOpenApiFeatureStore {
217
222
  const newBounds = toTargetReference.transformBounds(bounds);
218
223
  return newBounds;
219
224
  }
220
- static cleanUrl(dataUrl) {
225
+ static cleanUrl(dataUrl, addSlash = false) {
221
226
  const parts = dataUrl.split('?');
222
- const cleanUrl = parts[0].endsWith('/') ? parts[0] : parts[0] + '/';
223
- return cleanUrl;
227
+ return parts[0].endsWith('/') ? parts[0] : (addSlash ? parts[0] + '/' : parts[0]);
224
228
  }
225
229
  static dataFormatInQuery(dataUrl) {
226
230
  let format;
@@ -24,6 +24,7 @@ declare class OgcOpenApiFetchTools {
24
24
  static fetch(input: string, options: RequestInit, serverOptions: FetchServerOptions): Promise<Response>;
25
25
  static addHostURL(url: string, HostUrl?: string): string;
26
26
  static cleanUrl(inputUrl: string): string;
27
+ static cleanUrlToAsset(inputUrl: string): string;
27
28
  static getHostURL(fullUrl: string): string;
28
29
  }
29
30
  export { OgcOpenApiFetchTools };
@@ -33,8 +33,10 @@ class OgcOpenApiFetchTools {
33
33
  return hostUrl + "/" + url;
34
34
  }
35
35
  static cleanUrl(inputUrl) {
36
- const url = inputUrl.split("?")[0].replace(/\/?$/, '/');
37
- return url;
36
+ return inputUrl.split("?")[0].replace(/\/?$/, '/');
37
+ }
38
+ static cleanUrlToAsset(inputUrl) {
39
+ return inputUrl.split("?")[0].replace(/\/?$/, '');
38
40
  }
39
41
  static getHostURL(fullUrl) {
40
42
  if (!fullUrl.startsWith("http"))
@@ -248,7 +248,7 @@ export class OgcOpenApiGetCapabilities {
248
248
  }
249
249
  let jsonLink = tileset.links.find(l => l.type ? l.type === "application/json" : false);
250
250
  jsonLink = jsonLink ? jsonLink : tileset.links[0];
251
- const href = OgcOpenApiFetchTools.cleanUrl(jsonLink.href);
251
+ const href = OgcOpenApiFetchTools.cleanUrlToAsset(jsonLink.href);
252
252
  OgcOpenApiFetchTools.fetch(href, {
253
253
  method: "GET",
254
254
  credentials: (options === null || options === void 0 ? void 0 : options.credentials) ? "same-origin" : "omit",
package/package.json CHANGED
@@ -1,39 +1,39 @@
1
- {
2
- "name": "ogcopenapis",
3
- "version": "0.0.11",
4
- "description": "Implements OGC OPEN API Features/Maps/Tiles capabilities and models for LuciadRIA",
5
- "files": [
6
- "lib/"
7
- ],
8
- "scripts": {
9
- "test": "jest",
10
- "transpile": "tsc -p tsconfig.json",
11
- "copyjs": "copyfiles -u 1 \"src/**/*.js\" ./lib",
12
- "copycss": "copyfiles -u 1 \"src/**/*.css\" ./lib",
13
- "copyscss": "copyfiles -u 1 \"src/**/*.scss\" ./lib",
14
- "copysvg": "copyfiles -u 1 \"src/**/*.svg\" ./lib",
15
- "copyfonts": "copyfiles -u 1 \"src/fonts/**\" ./lib",
16
- "build": "npm run transpile && npm run copyjs && npm run copycss && npm run copyscss && npm run copysvg && npm run copyfonts"
17
- },
18
- "keywords": [],
19
- "author": "",
20
- "license": "ISC",
21
- "devDependencies": {
22
- "@babel/preset-env": "^7.20.2",
23
- "@babel/preset-typescript": "^7.18.6",
24
- "@jest/globals": "^29.3.1",
25
- "copyfiles": "^2.3.0",
26
- "isomorphic-fetch": "^3.0.0",
27
- "jest": "^29.3.1",
28
- "jest-canvas-mock": "^2.4.0",
29
- "jest-environment-jsdom": "^29.3.1",
30
- "typescript": "^4.6.3"
31
- },
32
- "dependencies": {
33
- "@luciad/ria": ">=2020.0"
34
- },
35
- "repository": {
36
- "type": "git",
37
- "url": "git+https://github.com/felipecarrillo100/ogcopenapis"
38
- }
39
- }
1
+ {
2
+ "name": "ogcopenapis",
3
+ "version": "0.0.12",
4
+ "description": "Implements OGC OPEN API Features/Maps/Tiles capabilities and models for LuciadRIA",
5
+ "files": [
6
+ "lib/"
7
+ ],
8
+ "scripts": {
9
+ "test": "jest",
10
+ "transpile": "tsc -p tsconfig.json",
11
+ "copyjs": "copyfiles -u 1 \"src/**/*.js\" ./lib",
12
+ "copycss": "copyfiles -u 1 \"src/**/*.css\" ./lib",
13
+ "copyscss": "copyfiles -u 1 \"src/**/*.scss\" ./lib",
14
+ "copysvg": "copyfiles -u 1 \"src/**/*.svg\" ./lib",
15
+ "copyfonts": "copyfiles -u 1 \"src/fonts/**\" ./lib",
16
+ "build": "npm run transpile && npm run copyjs && npm run copycss && npm run copyscss && npm run copysvg && npm run copyfonts"
17
+ },
18
+ "keywords": [],
19
+ "author": "",
20
+ "license": "ISC",
21
+ "devDependencies": {
22
+ "@babel/preset-env": "^7.20.2",
23
+ "@babel/preset-typescript": "^7.18.6",
24
+ "@jest/globals": "^29.3.1",
25
+ "copyfiles": "^2.3.0",
26
+ "isomorphic-fetch": "^3.0.0",
27
+ "jest": "^29.3.1",
28
+ "jest-canvas-mock": "^2.4.0",
29
+ "jest-environment-jsdom": "^29.3.1",
30
+ "typescript": "^4.6.3"
31
+ },
32
+ "dependencies": {
33
+ "@luciad/ria": ">=2020.0"
34
+ },
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/felipecarrillo100/ogcopenapis"
38
+ }
39
+ }