geo-engine-node 1.0.1 → 1.1.0
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/index.js +6 -6
- package/package.json +5 -2
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const DEFAULTS = {
|
|
2
2
|
managementUrl: 'https://api.geoengine.dev',
|
|
3
|
-
ingestUrl: '
|
|
3
|
+
ingestUrl: 'https://ingest.geoengine.dev',
|
|
4
4
|
timeout: 10000
|
|
5
5
|
};
|
|
6
6
|
|
|
@@ -14,7 +14,7 @@ class GeoEngine {
|
|
|
14
14
|
if (!apiKey) {
|
|
15
15
|
throw new Error('GeoEngine: API Key es requerida.');
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
this.apiKey = apiKey;
|
|
19
19
|
this.config = { ...DEFAULTS, ...options };
|
|
20
20
|
this.userAgent = 'GeoEngineNode/1.0.0';
|
|
@@ -49,13 +49,13 @@ class GeoEngine {
|
|
|
49
49
|
} catch (e) {
|
|
50
50
|
errorData = { error: await response.text() };
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
|
|
53
53
|
throw new Error(`GeoEngine API Error (${response.status}): ${errorData.error || JSON.stringify(errorData)}`);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
// Si la respuesta es 204 No Content o vacía, devolver null
|
|
57
57
|
if (response.status === 204) return null;
|
|
58
|
-
|
|
58
|
+
|
|
59
59
|
return await response.json();
|
|
60
60
|
|
|
61
61
|
} catch (error) {
|
|
@@ -94,8 +94,8 @@ class GeoEngine {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
// Convertir formato simple [[lat,lng]] a GeoJSON [Lng, Lat]
|
|
97
|
-
const polygon = coordinates.map(p => [p[1], p[0]]);
|
|
98
|
-
|
|
97
|
+
const polygon = coordinates.map(p => [p[1], p[0]]);
|
|
98
|
+
|
|
99
99
|
// Cerrar polígono automáticamente
|
|
100
100
|
const first = polygon[0];
|
|
101
101
|
const last = polygon[polygon.length - 1];
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "geo-engine-node",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"description": "SDK oficial para Geo-Engine. Rastreo de activos y gestión de geocercas.",
|
|
5
6
|
"main": "index.js",
|
|
6
7
|
"scripts": {
|
|
7
8
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
8
|
-
"example": "node examples/simulation.js"
|
|
9
|
+
"example": "node examples/simulation.js",
|
|
10
|
+
"release:patch": "npm version patch && npm publish --access public",
|
|
11
|
+
"release:minor": "npm version minor && npm publish --access public"
|
|
9
12
|
},
|
|
10
13
|
"keywords": [
|
|
11
14
|
"geofencing",
|