geo-engine-node 1.1.1 → 1.1.2

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/dist/index.cjs CHANGED
@@ -39,7 +39,7 @@ var GeoEngine = class {
39
39
  }
40
40
  this.apiKey = apiKey;
41
41
  this.config = { ...DEFAULTS, ...options };
42
- this.userAgent = "GeoEngineNode/1.0.0";
42
+ this.userAgent = "GeoEngineNode/1.1.2";
43
43
  }
44
44
  /**
45
45
  * Helper privado para hacer peticiones con timeout
@@ -60,13 +60,8 @@ var GeoEngine = class {
60
60
  });
61
61
  clearTimeout(id);
62
62
  if (!response.ok) {
63
- let errorData;
64
- try {
65
- errorData = await response.json();
66
- } catch (e) {
67
- errorData = { error: await response.text() };
68
- }
69
- throw new Error(`GeoEngine API Error (${response.status}): ${errorData.error || JSON.stringify(errorData)}`);
63
+ const errorText = await response.text();
64
+ throw new Error(`GeoEngine API Error (${response.status}): ${errorText}`);
70
65
  }
71
66
  if (response.status === 204) return null;
72
67
  return await response.json();
package/dist/index.d.cts CHANGED
@@ -17,7 +17,7 @@ class GeoEngine {
17
17
 
18
18
  this.apiKey = apiKey;
19
19
  this.config = { ...DEFAULTS, ...options };
20
- this.userAgent = 'GeoEngineNode/1.0.0';
20
+ this.userAgent = 'GeoEngineNode/1.1.2';
21
21
  }
22
22
 
23
23
  /**
@@ -42,22 +42,13 @@ class GeoEngine {
42
42
  clearTimeout(id);
43
43
 
44
44
  if (!response.ok) {
45
- // Intentar leer el error en JSON, si falla, leer texto
46
- let errorData;
47
- try {
48
- errorData = await response.json();
49
- } catch (e) {
50
- errorData = { error: await response.text() };
51
- }
52
-
53
- throw new Error(`GeoEngine API Error (${response.status}): ${errorData.error || JSON.stringify(errorData)}`);
45
+ const errorText = await response.text();
46
+ throw new Error(`GeoEngine API Error (${response.status}): ${errorText}`);
54
47
  }
55
48
 
56
- // Si la respuesta es 204 No Content o vacía, devolver null
57
49
  if (response.status === 204) return null;
58
50
 
59
51
  return await response.json();
60
-
61
52
  } catch (error) {
62
53
  clearTimeout(id);
63
54
  if (error.name === 'AbortError') {
package/dist/index.d.ts CHANGED
@@ -17,7 +17,7 @@ class GeoEngine {
17
17
 
18
18
  this.apiKey = apiKey;
19
19
  this.config = { ...DEFAULTS, ...options };
20
- this.userAgent = 'GeoEngineNode/1.0.0';
20
+ this.userAgent = 'GeoEngineNode/1.1.2';
21
21
  }
22
22
 
23
23
  /**
@@ -42,22 +42,13 @@ class GeoEngine {
42
42
  clearTimeout(id);
43
43
 
44
44
  if (!response.ok) {
45
- // Intentar leer el error en JSON, si falla, leer texto
46
- let errorData;
47
- try {
48
- errorData = await response.json();
49
- } catch (e) {
50
- errorData = { error: await response.text() };
51
- }
52
-
53
- throw new Error(`GeoEngine API Error (${response.status}): ${errorData.error || JSON.stringify(errorData)}`);
45
+ const errorText = await response.text();
46
+ throw new Error(`GeoEngine API Error (${response.status}): ${errorText}`);
54
47
  }
55
48
 
56
- // Si la respuesta es 204 No Content o vacía, devolver null
57
49
  if (response.status === 204) return null;
58
50
 
59
51
  return await response.json();
60
-
61
52
  } catch (error) {
62
53
  clearTimeout(id);
63
54
  if (error.name === 'AbortError') {
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ var GeoEngine = class {
16
16
  }
17
17
  this.apiKey = apiKey;
18
18
  this.config = { ...DEFAULTS, ...options };
19
- this.userAgent = "GeoEngineNode/1.0.0";
19
+ this.userAgent = "GeoEngineNode/1.1.2";
20
20
  }
21
21
  /**
22
22
  * Helper privado para hacer peticiones con timeout
@@ -37,13 +37,8 @@ var GeoEngine = class {
37
37
  });
38
38
  clearTimeout(id);
39
39
  if (!response.ok) {
40
- let errorData;
41
- try {
42
- errorData = await response.json();
43
- } catch (e) {
44
- errorData = { error: await response.text() };
45
- }
46
- throw new Error(`GeoEngine API Error (${response.status}): ${errorData.error || JSON.stringify(errorData)}`);
40
+ const errorText = await response.text();
41
+ throw new Error(`GeoEngine API Error (${response.status}): ${errorText}`);
47
42
  }
48
43
  if (response.status === 204) return null;
49
44
  return await response.json();
package/index.js CHANGED
@@ -17,7 +17,7 @@ class GeoEngine {
17
17
 
18
18
  this.apiKey = apiKey;
19
19
  this.config = { ...DEFAULTS, ...options };
20
- this.userAgent = 'GeoEngineNode/1.0.0';
20
+ this.userAgent = 'GeoEngineNode/1.1.2';
21
21
  }
22
22
 
23
23
  /**
@@ -42,22 +42,13 @@ class GeoEngine {
42
42
  clearTimeout(id);
43
43
 
44
44
  if (!response.ok) {
45
- // Intentar leer el error en JSON, si falla, leer texto
46
- let errorData;
47
- try {
48
- errorData = await response.json();
49
- } catch (e) {
50
- errorData = { error: await response.text() };
51
- }
52
-
53
- throw new Error(`GeoEngine API Error (${response.status}): ${errorData.error || JSON.stringify(errorData)}`);
45
+ const errorText = await response.text();
46
+ throw new Error(`GeoEngine API Error (${response.status}): ${errorText}`);
54
47
  }
55
48
 
56
- // Si la respuesta es 204 No Content o vacía, devolver null
57
49
  if (response.status === 204) return null;
58
50
 
59
51
  return await response.json();
60
-
61
52
  } catch (error) {
62
53
  clearTimeout(id);
63
54
  if (error.name === 'AbortError') {
package/package.json CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "geo-engine-node",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "type": "module",
5
- "description": "SDK oficial para Geo-Engine. Rastreo de activos y gestión de geocercas.",
6
- "main": "./dist/index.js",
7
- "module": "./dist/index.mjs",
5
+ "description": "SDK oficial para Geo-Engine...",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
- "import": "./dist/index.mjs",
12
- "require": "./dist/index.js"
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
13
14
  }
14
15
  },
15
16
  "scripts": {