diff --git a/package-lock.json b/package-lock.json index ffeacde..af423af 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "ISC", "dependencies": { "@sinclair/typebox": "^0.32.20", - "@tak-ps/etl": "^4.3.4" + "@tak-ps/etl": "^5.0.0" }, "devDependencies": { "@types/geojson": "^7946.0.10", @@ -373,10 +373,9 @@ "license": "MIT" }, "node_modules/@tak-ps/etl": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/@tak-ps/etl/-/etl-4.12.0.tgz", - "integrity": "sha512-jSRBgCL0Tp4lE4o/grOEUQY1CgWSb7YvCxuUpno+9qN/vgGFaMh20G0RXYITGkiiVRMmP+MztTk/YlbLw/BU5A==", - "license": "ISC", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@tak-ps/etl/-/etl-5.0.0.tgz", + "integrity": "sha512-XTJKuxe7zUrpbTiC/sJ7Ghe9+547POGWpf5a2wuWW1piI3CJnMOEzoynBaIRDzrBuiz0ZK4sfWGdnBnR3q7lIA==", "dependencies": { "@sinclair/typebox": "^0.32.20", "@types/geojson": "^7946.0.10", diff --git a/package.json b/package.json index 00ccd8c..2d499cf 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,6 @@ }, "dependencies": { "@sinclair/typebox": "^0.32.20", - "@tak-ps/etl": "^4.3.4" + "@tak-ps/etl": "^5.0.0" } } diff --git a/task.ts b/task.ts index 871cb95..4f2f7bd 100644 --- a/task.ts +++ b/task.ts @@ -13,21 +13,22 @@ const Env = Type.Object({ }), 'Query Dist': Type.String({ description: 'Distance from the provided LatLon to provide results', - default: 2650 + default: "2650" }), - 'Dist': Type.String({ description: 'Lat, Lon value to use for centering the API request' }), 'ADSBX_TOKEN': Type.String({ description: 'API Token for ADSBExchange' }), 'ADSBX_INCLUDES': Type.Array(Type.Object({ domain: Type.String({ description: 'Public Safety domain of the Aircraft', enum: ['EMS', 'FIRE', 'LAW'] }), - agency: Type.String({ description: 'Agency in control of the Aircraft' }), - callsign: Type.String({ description: 'Callsign of the Aircraft' }), - registration: Type.String({ description: 'Registration Number of the Aircraft' }), + agency: Type.Optional(Type.String({ description: 'Agency in control of the Aircraft' })), + callsign: Type.Optional(Type.String({ description: 'Callsign of the Aircraft' })), + registration: Type.Optional(Type.String({ description: 'Registration Number of the Aircraft' })), type: Type.String({ description: 'Type of Aircraft', + default: 'UNKNOWN', enum: [ + 'UNKNOWN', 'HELICOPTER', 'FIXED WING' ] @@ -42,21 +43,21 @@ const ADSBResponse = Type.Object({ flight: Type.Optional(Type.String()), r: Type.Optional(Type.String()), t: Type.Optional(Type.String()), - alt_baro: Type.Number(), - alt_geom: Type.Number(), - gs: Type.Number(), - track: Type.Number(), - baro_rate: Type.Number(), - squawk: Type.String(), - category: Type.String(), - nav_qnh: Type.Number(), - nav_altitude_mcp: Type.Number(), - nav_heading: Type.Number(), + alt_baro: Type.Optional(Type.Union([Type.Number(), Type.String()])), + alt_geom: Type.Optional(Type.Number()), + gs: Type.Optional(Type.Number()), + track: Type.Optional(Type.Number()), + baro_rate: Type.Optional(Type.Number()), + squawk: Type.Optional(Type.String()), + category: Type.Optional(Type.String()), + nav_qnh: Type.Optional(Type.Number()), + nav_altitude_mcp: Type.Optional(Type.Number()), + nav_heading: Type.Optional(Type.Number()), lat: Type.Number(), lon: Type.Number(), seen_pos: Type.Number(), seen: Type.Number(), - dst: Type.Number() + dst: Type.Optional(Type.Number()) }) export default class Task extends ETL { @@ -97,7 +98,7 @@ export default class Task extends ETL { const coordinates = [ac.lon, ac.lat]; // If alt. is present convert to meters - coordinates.push(ac.alt_geom * 0.3048); + if (ac.alt_geom) coordinates.push(ac.alt_geom * 0.3048); if (!id.trim().length) continue;