From ddbbde869b9af19c03a075c09afd9b5400fa4609 Mon Sep 17 00:00:00 2001 From: Chad Johnson Date: Wed, 25 Sep 2024 11:44:02 -0700 Subject: [PATCH] Remove unecessary files from build --- README.md | 2 +- dist/flight-log-parser.es6.js | 654 +------------- dist/flight-log-parser.es6.js.map | 2 +- dist/flight-log-parser.js | 665 +------------- dist/flight-log-parser.js.map | 2 +- dist/lib/__test__/android.test.js | 112 --- dist/lib/__test__/android.test.js.map | 1 - dist/lib/__test__/invalid-logs.test.js | 34 - dist/lib/__test__/invalid-logs.test.js.map | 1 - dist/lib/__test__/ios.test.js | 245 ------ dist/lib/__test__/ios.test.js.map | 1 - dist/lib/__test__/json-info.test.js | 145 ---- dist/lib/__test__/json-info.test.js.map | 1 - dist/lib/__test__/parser.test.js | 301 ------- dist/lib/__test__/parser.test.js.map | 1 - dist/lib/__test__/testutil.js | 32 - dist/lib/__test__/testutil.js.map | 1 - dist/lib/field-types.js | 111 --- dist/lib/field-types.js.map | 1 - dist/lib/flight-log-parser.js | 13 - dist/lib/flight-log-parser.js.map | 1 - dist/lib/parser.js | 346 -------- dist/lib/parser.js.map | 1 - dist/lib/rollup.config.js | 37 - dist/lib/rollup.config.js.map | 1 - dist/lib/src/__test__/android.test.js | 112 --- dist/lib/src/__test__/android.test.js.map | 1 - dist/lib/src/__test__/invalid-logs.test.js | 34 - .../lib/src/__test__/invalid-logs.test.js.map | 1 - dist/lib/src/__test__/ios.test.js | 245 ------ dist/lib/src/__test__/ios.test.js.map | 1 - dist/lib/src/__test__/json-info.test.js | 145 ---- dist/lib/src/__test__/json-info.test.js.map | 1 - dist/lib/src/__test__/parser.test.js | 301 ------- dist/lib/src/__test__/parser.test.js.map | 1 - dist/lib/src/__test__/testutil.js | 32 - dist/lib/src/__test__/testutil.js.map | 1 - dist/lib/src/field-types.js | 111 --- dist/lib/src/field-types.js.map | 1 - dist/lib/src/flight-log-parser.js | 13 - dist/lib/src/flight-log-parser.js.map | 1 - dist/lib/src/parser.js | 346 -------- dist/lib/src/parser.js.map | 1 - dist/lib/src/types.js | 215 ----- dist/lib/src/types.js.map | 1 - dist/lib/types.js | 215 ----- dist/lib/types.js.map | 1 - dist/types/__test__/android.test.d.ts | 1 - dist/types/__test__/invalid-logs.test.d.ts | 1 - dist/types/__test__/ios.test.d.ts | 1 - dist/types/__test__/json-info.test.d.ts | 1 - dist/types/__test__/parser.test.d.ts | 1 - dist/types/__test__/testutil.d.ts | 6 - dist/types/field-types.d.ts | 10 +- dist/types/flight-log-parser.d.ts | 4 +- dist/types/parser.d.ts | 44 +- dist/types/rollup.config.d.ts | 20 - dist/types/src/__test__/android.test.d.ts | 1 - .../types/src/__test__/invalid-logs.test.d.ts | 1 - dist/types/src/__test__/ios.test.d.ts | 1 - dist/types/src/__test__/json-info.test.d.ts | 1 - dist/types/src/__test__/parser.test.d.ts | 1 - dist/types/src/__test__/testutil.d.ts | 6 - dist/types/src/field-types.d.ts | 5 - dist/types/src/flight-log-parser.d.ts | 2 - dist/types/src/parser.d.ts | 22 - dist/types/src/types.d.ts | 268 ------ dist/types/types.d.ts | 536 ++++++------ package-lock.json | 818 +++++++++--------- package.json | 5 +- rollup.config.mjs | 3 +- tsconfig.json | 5 +- 72 files changed, 713 insertions(+), 5542 deletions(-) delete mode 100644 dist/lib/__test__/android.test.js delete mode 100644 dist/lib/__test__/android.test.js.map delete mode 100644 dist/lib/__test__/invalid-logs.test.js delete mode 100644 dist/lib/__test__/invalid-logs.test.js.map delete mode 100644 dist/lib/__test__/ios.test.js delete mode 100644 dist/lib/__test__/ios.test.js.map delete mode 100644 dist/lib/__test__/json-info.test.js delete mode 100644 dist/lib/__test__/json-info.test.js.map delete mode 100644 dist/lib/__test__/parser.test.js delete mode 100644 dist/lib/__test__/parser.test.js.map delete mode 100644 dist/lib/__test__/testutil.js delete mode 100644 dist/lib/__test__/testutil.js.map delete mode 100644 dist/lib/field-types.js delete mode 100644 dist/lib/field-types.js.map delete mode 100644 dist/lib/flight-log-parser.js delete mode 100644 dist/lib/flight-log-parser.js.map delete mode 100644 dist/lib/parser.js delete mode 100644 dist/lib/parser.js.map delete mode 100644 dist/lib/rollup.config.js delete mode 100644 dist/lib/rollup.config.js.map delete mode 100644 dist/lib/src/__test__/android.test.js delete mode 100644 dist/lib/src/__test__/android.test.js.map delete mode 100644 dist/lib/src/__test__/invalid-logs.test.js delete mode 100644 dist/lib/src/__test__/invalid-logs.test.js.map delete mode 100644 dist/lib/src/__test__/ios.test.js delete mode 100644 dist/lib/src/__test__/ios.test.js.map delete mode 100644 dist/lib/src/__test__/json-info.test.js delete mode 100644 dist/lib/src/__test__/json-info.test.js.map delete mode 100644 dist/lib/src/__test__/parser.test.js delete mode 100644 dist/lib/src/__test__/parser.test.js.map delete mode 100644 dist/lib/src/__test__/testutil.js delete mode 100644 dist/lib/src/__test__/testutil.js.map delete mode 100644 dist/lib/src/field-types.js delete mode 100644 dist/lib/src/field-types.js.map delete mode 100644 dist/lib/src/flight-log-parser.js delete mode 100644 dist/lib/src/flight-log-parser.js.map delete mode 100644 dist/lib/src/parser.js delete mode 100644 dist/lib/src/parser.js.map delete mode 100644 dist/lib/src/types.js delete mode 100644 dist/lib/src/types.js.map delete mode 100644 dist/lib/types.js delete mode 100644 dist/lib/types.js.map delete mode 100644 dist/types/__test__/android.test.d.ts delete mode 100644 dist/types/__test__/invalid-logs.test.d.ts delete mode 100644 dist/types/__test__/ios.test.d.ts delete mode 100644 dist/types/__test__/json-info.test.d.ts delete mode 100644 dist/types/__test__/parser.test.d.ts delete mode 100644 dist/types/__test__/testutil.d.ts delete mode 100644 dist/types/rollup.config.d.ts delete mode 100644 dist/types/src/__test__/android.test.d.ts delete mode 100644 dist/types/src/__test__/invalid-logs.test.d.ts delete mode 100644 dist/types/src/__test__/ios.test.d.ts delete mode 100644 dist/types/src/__test__/json-info.test.d.ts delete mode 100644 dist/types/src/__test__/parser.test.d.ts delete mode 100644 dist/types/src/__test__/testutil.d.ts delete mode 100644 dist/types/src/field-types.d.ts delete mode 100644 dist/types/src/flight-log-parser.d.ts delete mode 100644 dist/types/src/parser.d.ts delete mode 100644 dist/types/src/types.d.ts diff --git a/README.md b/README.md index bffcc2b..6936cc7 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ enum FlightLogHeader { ```js { metaData : { - appVersion: '2.75.0', + appVersion: '5.50.0', session: { id: '12345678', start: 2018-06-05T05:29:00.000Z, diff --git a/dist/flight-log-parser.es6.js b/dist/flight-log-parser.es6.js index a7f64a6..e8e29b2 100644 --- a/dist/flight-log-parser.es6.js +++ b/dist/flight-log-parser.es6.js @@ -1,654 +1,2 @@ -import 'stream'; - -var FlightLogHeader; -(function (FlightLogHeader) { - FlightLogHeader["DateTime"] = "Date/Time (UTC)"; - FlightLogHeader["ElapsedTime"] = "Elapsed Time (sec)"; - FlightLogHeader["Info"] = "Info"; - FlightLogHeader["DeviceLatitude"] = "Device Latitude (Degrees)"; - FlightLogHeader["DeviceLongitude"] = "Device Longitude (Degrees)"; - FlightLogHeader["DeviceLocationLastUpdated"] = "Device Location Last Updated (ms)"; - FlightLogHeader["AircraftBatteryPowerPercent"] = "Aircraft Battery Power (%)"; - FlightLogHeader["AircraftBatteryCharge"] = "Aircraft Battery Charge (mAh)"; - FlightLogHeader["AircraftBatteryCurrent"] = "Aircraft Battery Current (mA)"; - FlightLogHeader["AircraftBatteryVoltage"] = "Aircraft Battery Voltage (mV)"; - FlightLogHeader["AircraftBatteryTemperature"] = "Aircraft Battery Temperature (Fahrenheit)"; - FlightLogHeader["AircraftBatteryLastUpdated"] = "Aircraft Battery Last Updated (ms)"; - FlightLogHeader["AircraftBatteryCell1Voltage"] = "Aircraft Battery Cell 1 Voltage"; - FlightLogHeader["AircraftBatteryCell2Voltage"] = "Aircraft Battery Cell 2 Voltage"; - FlightLogHeader["AircraftBatteryCell3Voltage"] = "Aircraft Battery Cell 3 Voltage"; - FlightLogHeader["AircraftBatteryCell4Voltage"] = "Aircraft Battery Cell 4 Voltage"; - FlightLogHeader["AircraftBatteryCellVoltageLastUpdated"] = "Aircraft Battery Cell Voltage Last Updated (ms)"; - FlightLogHeader["AircraftLatitude"] = "Aircraft Latitude (Degrees)"; - FlightLogHeader["AircraftLongitude"] = "Aircraft Longitude (Degrees)"; - FlightLogHeader["AircraftSpeed"] = "Aircraft Speed (mph)"; - FlightLogHeader["AircraftBarometricAltitude"] = "Aircraft Barometric Altitude (ft)"; - FlightLogHeader["AircraftHeading"] = "Aircraft Heading (Degrees)"; - FlightLogHeader["AircraftVelocityX"] = "Aircraft Vel - X (mph)"; - FlightLogHeader["AircraftVelocityY"] = "Aircraft Vel - Y (mph)"; - FlightLogHeader["AircraftVelocityZ"] = "Aircraft Vel - Z (mph)"; - FlightLogHeader["AircraftPitch"] = "Aircraft Pitch (Degrees)"; - FlightLogHeader["AircraftRoll"] = "Aircraft Roll (Degrees)"; - FlightLogHeader["AircraftSatellites"] = "Aircraft Satellites"; - FlightLogHeader["AircraftMotorsOn"] = "Aircraft Motors On"; - FlightLogHeader["AircraftFlying"] = "Aircraft Flying"; - FlightLogHeader["AircraftFlightMode"] = "Aircraft Flight Mode"; - FlightLogHeader["AircraftFlightModeValue"] = "Aircraft Flight Mode Value"; - FlightLogHeader["AircraftIMUPreheating"] = "Aircraft IMU Preheating"; - FlightLogHeader["AircraftUltrasonicOn"] = "Aircraft Ultrasonic On"; - FlightLogHeader["AircraftUltrasonicAltitude"] = "Aircraft Ultrasonic Altitude (ft)"; - FlightLogHeader["AircraftVisionOn"] = "Aircraft Vision On"; - FlightLogHeader["AircraftGPSSignal"] = "Aircraft GPS Signal"; - FlightLogHeader["AircraftGPSSignalValue"] = "Aircraft GPS Signal Value"; - FlightLogHeader["AircraftNoFly"] = "Aircraft No-fly"; - FlightLogHeader["AircraftNoFlyValue"] = "Aircraft No-fly Value"; - FlightLogHeader["AircraftNoFlyLatitude"] = "Aircraft No-fly Latitude (Degrees)"; - FlightLogHeader["AircraftNoFlyLongitude"] = "Aircraft No-fly Longitude (Degrees)"; - FlightLogHeader["AircraftNoFlyRadius"] = "Aircraft No-fly Radius (ft)"; - FlightLogHeader["HomeLatitude"] = "Home Latitude (Degrees)"; - FlightLogHeader["HomeLongitude"] = "Home Longitude (Degrees)"; - FlightLogHeader["AircraftSmartGoHomeFlightTimeRemaining"] = "Aircraft Smart Go-home Flight Time Remaining (sec)"; - FlightLogHeader["AircraftSmartGoHomeFlightReturnTime"] = "Aircraft Smart Go-home Flight Return Time (sec)"; - FlightLogHeader["AircraftSmartGoHomeLandingTime"] = "Aircraft Smart Go-home Landing Time (sec)"; - FlightLogHeader["AircraftSmartGoHomeReturnPower"] = "Aircraft Smart Go-home Return Power (%)"; - FlightLogHeader["AircraftSmartGoHomeLandingPower"] = "Aircraft Smart Go-home Landing Power (%)"; - FlightLogHeader["AircraftSmartGoHomeRadius"] = "Aircraft Smart Go-home Radius (ft)"; - FlightLogHeader["AircraftSmartGoHomeCountdown"] = "Aircraft Smart Go-home Countdown (sec)"; - FlightLogHeader["AircraftSmartGoHomeRequesting"] = "Aircraft Smart Go-home Requesting"; - FlightLogHeader["AircraftSystemStateLastUpdated"] = "Aircraft System State Last Updated (ms)"; - FlightLogHeader["GimbalPitch"] = "Gimbal Pitch (Degrees)"; - FlightLogHeader["GimbalRoll"] = "Gimbal Roll (Degrees)"; - FlightLogHeader["GimbalYaw"] = "Gimbal Yaw (Degrees)"; - FlightLogHeader["GimbalMode"] = "Gimbal Mode"; - FlightLogHeader["GimbalModeValue"] = "Gimbal Mode Value"; - FlightLogHeader["GimbalPitchAtStop"] = "Gimbal Pitch at Stop"; - FlightLogHeader["GimbalRollAtStop"] = "Gimbal Roll at Stop"; - FlightLogHeader["GimbalYawAtStop"] = "Gimbal Yaw at Stop"; - FlightLogHeader["GimbalStatusLastUpdated"] = "Gimbal Status Last Updated (ms)"; - FlightLogHeader["LandingGearIsMovable"] = "Landing Gear is Movable"; - FlightLogHeader["LandingGearStatus"] = "Landing Gear Status"; - FlightLogHeader["LandingGearStatusValue"] = "Landing Gear Status Value"; - FlightLogHeader["LandingGearMode"] = "Landing Gear Mode"; - FlightLogHeader["LandingGearModeValue"] = "Landing Gear Mode Value"; - FlightLogHeader["LandingGearLastUpdated"] = "Landing Gear Last Updated (ms)"; - FlightLogHeader["RCState"] = "RC State"; - FlightLogHeader["RCStateValue"] = "RC State Value"; - FlightLogHeader["RCLeftHorizontal"] = "RC Left Horizontal"; - FlightLogHeader["RCLeftVertical"] = "RC Left Vertical"; - FlightLogHeader["RCRightHorizontal"] = "RC Right Horizontal"; - FlightLogHeader["RCRightVertical"] = "RC Right Vertical"; - FlightLogHeader["RCLeftWheel"] = "RC Left Wheel"; - FlightLogHeader["RCRightWheel"] = "RC Right Wheel"; - FlightLogHeader["RCLandingGear"] = "RC Landing Gear"; - FlightLogHeader["RCLandingGearValue"] = "RC Landing Gear Value"; - FlightLogHeader["RCGoHome"] = "RC Go Home"; - FlightLogHeader["RCRecord"] = "RC Record "; - FlightLogHeader["RCShutter"] = "RC Shutter"; - FlightLogHeader["RCPlayback"] = "RC Playback"; - FlightLogHeader["RCPause"] = "RC Pause"; - FlightLogHeader["RCCustom1"] = "RC Custom 1"; - FlightLogHeader["RCCustom2"] = "RC Custom 2"; - FlightLogHeader["RCStateLastUpdated"] = "RC State Last Updated (ms)"; - FlightLogHeader["RCBatteryPercentRemaining"] = "RC Battery (%)"; - FlightLogHeader["RCBatteryStateLastUpdated"] = "RC Battery State Last Updated (ms)"; - FlightLogHeader["RCSattelites"] = "RC Sattelites"; - FlightLogHeader["RCHorizontalAccuaracy"] = "RC Horizontal Accuaracy (ft)"; - FlightLogHeader["RCLatitude"] = "RC Latitude (Degrees)"; - FlightLogHeader["RCLongitude"] = "RC Longitude (Degrees)"; - FlightLogHeader["RCGSPDataIsValid"] = "RC GSP Data is Valid"; - FlightLogHeader["RCGPSStateLastUpdated"] = "RC GPS State Last Updated (ms)"; - FlightLogHeader["RCSignal1"] = "RC Signal 1"; - FlightLogHeader["RCSignal2"] = "RC Signal 2"; - FlightLogHeader["RCSignalLastUpdated"] = "RC Signal Last Updated (ms)"; - FlightLogHeader["LBSignal1"] = "LB Signal 1"; - FlightLogHeader["LBSignal2"] = "LB Signal 2"; - FlightLogHeader["LBSignalLastUpdated"] = "LB Signal Last Updated (ms)"; - FlightLogHeader["AircraftCameraMode"] = "Aircraft Camera Mode"; - FlightLogHeader["AircraftCameraModeValue"] = "Aircraft Camera Mode Value"; - FlightLogHeader["AircraftCameraOverheated"] = "Aircraft Camera Overheated"; - FlightLogHeader["AircraftCameraSensorError"] = "Aircraft Camera Sensor Error"; - FlightLogHeader["AircraftCameraRecording"] = "Aircraft Camera Recording"; - FlightLogHeader["AircraftCameraRawCapture"] = "Aircraft Camera Raw Capture"; - FlightLogHeader["AircraftCameraIntervalCapture"] = "Aircraft Camera Interval Capture"; - FlightLogHeader["AircraftCameraBurstCapture"] = "Aircraft Camera Burst Capture"; - FlightLogHeader["AircraftCameraSingleCapture"] = "Aircraft Camera Single Capture"; - FlightLogHeader["AircraftCameraStoringPhoto"] = "Aircraft Camera Storing Photo"; - FlightLogHeader["AircraftCameraStateLastUpdated"] = "Aircraft Camera State Last Updated (ms)"; - FlightLogHeader["AircraftCameraSDCardExists"] = "Aircraft Camera SD Card Exists"; - FlightLogHeader["AircraftCameraSDCardRemainingPercent"] = "Aircraft Camera SD Card Remaining (%)"; - FlightLogHeader["AircraftCameraSDCardStateLastUpdated"] = "Aircraft Camera SD Card State Last Updated (ms)"; - FlightLogHeader["AircraftCameraChangeableLensSupported"] = "Aircraft Camera Changeable Lens Supported"; - FlightLogHeader["AircraftCameraLensInstalled"] = "Aircraft Camera Lens Installed"; - FlightLogHeader["AircraftCameraLensType"] = "Aircraft Camera Lens Type"; - FlightLogHeader["AircraftCameraLensAFEnabled"] = "Aircraft Camera Lens AF Enabled"; - FlightLogHeader["AircraftCameraLensFocusMode"] = "Aircraft Camera Lens Focus Mode"; - FlightLogHeader["AircraftCameraLensFocusModeValue"] = "Aircraft Camera Lens Focus Mode Value"; - FlightLogHeader["AircraftCameraLensFocusStatus"] = "Aircraft Camera Lens Focus Status"; - FlightLogHeader["AircraftCameraLensFocusStatusValue"] = "Aircraft Camera Lens Focus Status Value"; - FlightLogHeader["AircraftCameraLensMFAssistant"] = "Aircraft Camera Lens MF Assistant"; - FlightLogHeader["AircraftCameraLensAFAssistant"] = "Aircraft Camera Lens AF Assistant"; - FlightLogHeader["AircraftCameraLensAssistantWorking"] = "Aircraft Camera Lens Assistant Working"; - FlightLogHeader["AircraftCameraLensStateLastUpdated"] = "Aircraft Camera Lens State Last Updated (ms)"; - FlightLogHeader["CompassIndex"] = "Compass Index"; - FlightLogHeader["CompassSensorValue"] = "Compass Sensor Value"; - FlightLogHeader["CompassState"] = "Compass State"; - FlightLogHeader["CompassStateLastUpdated"] = "Compass State Last Updated (ms)"; - FlightLogHeader["CompassCalibrationState"] = "Compass Calibration State"; - FlightLogHeader["CompassCalibrationLastUpdated"] = "Compass Calibration Last Updated (ms)"; - FlightLogHeader["DeviceToAircraftDistance"] = "Device > Aircraft Distance - XY (ft)"; -})(FlightLogHeader || (FlightLogHeader = {})); -// based off of types in ios/android SDK FlightMode enums -const FLIGHT_MODE_MAPPING_V4 = { - 0: 'Manual', - 1: 'Attitude', - 2: 'Attitude Course Lock', - 3: 'Attitude Hover', - 4: 'Hover', - 5: 'GPS Brake', - 6: 'GPS Attitude', - 7: 'GPS Course Lock', - 8: 'GPS Home', - 9: 'GPS Hotpoint', - 10: 'Assisted Takeoff', - 11: 'Auto Takeoff', - 12: 'Auto Landing', - 13: 'Attitude Landing', - 14: 'GPS Waypoint', - 15: 'Go Home', - 16: 'Click Go', - 17: 'Joystick', - 18: 'Attitude Limited', - 19: 'Cinematic', - 23: 'Attitude Limited', - 24: 'Draw', - 25: 'GPS Follow Me', - 26: 'ActiveTrack', - 27: 'TapFly', - 28: 'Pano', - 29: 'Farming', - 30: 'FPV', - 31: 'GPS Sport', - 32: 'GPS Novice', - 33: 'Confirm Landing', - 35: 'Terrain Follow', - 36: 'Palm Control', - 37: 'Quick Shot', - 38: 'Tripod', - 39: 'ActiveTrack Spotlight', - 41: 'Motors Just Started', - 43: 'GPS Gentle', - 255: 'Unknown', -}; -const FLIGHT_MODE_MAPPING_V5 = { - 0: 'Manual', - 1: 'Attitude', - 2: 'GPS Normal', - 3: 'POI', - 4: 'Takeoff Ready', - 5: 'Auto Takeoff', - 6: 'Auto Landing', - 7: 'Waypoint', - 8: 'Go Home', - 9: 'Virtual Stick', - 10: 'Smart Flight', - 11: 'Pano', - 12: 'GPS Sport', - 13: 'GPS Tripod', - 14: 'Auto Avoidance', - 15: 'Smart Fly', - 16: 'Force Landing', - 17: 'Attitude Landing', - 18: 'Click Go', - 19: 'Cinematic', - 20: 'Draw', - 21: 'GPS Follow Me', - 22: 'GPS Novice', - 23: 'Quick Movie', - 24: 'Tap Fly', - 25: 'Master Shot', - 26: 'APAS', - 27: 'Timelapse', - 28: 'Motors Start', - 29: 'Unknown', -}; - -Buffer.from([239, 187, 191]); - -const INT_FIELDS = new Set([ - FlightLogHeader.AircraftBatteryCell1Voltage, - FlightLogHeader.AircraftBatteryCell2Voltage, - FlightLogHeader.AircraftBatteryCell3Voltage, - FlightLogHeader.AircraftBatteryCell4Voltage, - FlightLogHeader.AircraftBatteryCharge, - FlightLogHeader.AircraftBatteryCurrent, - FlightLogHeader.AircraftBatteryTemperature, - FlightLogHeader.AircraftBatteryVoltage, - FlightLogHeader.AircraftCameraLensFocusModeValue, - FlightLogHeader.AircraftCameraLensFocusStatusValue, - FlightLogHeader.AircraftCameraModeValue, - FlightLogHeader.AircraftFlightModeValue, - FlightLogHeader.AircraftGPSSignalValue, - FlightLogHeader.AircraftNoFlyValue, - FlightLogHeader.AircraftSatellites, - FlightLogHeader.GimbalModeValue, - FlightLogHeader.AircraftSmartGoHomeRadius, - FlightLogHeader.AircraftSmartGoHomeCountdown, - FlightLogHeader.AircraftVelocityX, - FlightLogHeader.AircraftVelocityY, - FlightLogHeader.AircraftVelocityZ, - FlightLogHeader.RCHorizontalAccuaracy, - FlightLogHeader.RCLatitude, - FlightLogHeader.RCLongitude, - FlightLogHeader.LandingGearStatusValue, - FlightLogHeader.LandingGearModeValue, - FlightLogHeader.RCStateValue, - FlightLogHeader.RCLandingGearValue, -]); -const FLOAT_FIELDS = new Set([ - FlightLogHeader.AircraftBarometricAltitude, - FlightLogHeader.AircraftBatteryPowerPercent, - FlightLogHeader.AircraftCameraSDCardRemainingPercent, - FlightLogHeader.AircraftHeading, - FlightLogHeader.AircraftLatitude, - FlightLogHeader.AircraftLongitude, - FlightLogHeader.AircraftNoFlyLatitude, - FlightLogHeader.AircraftNoFlyLongitude, - FlightLogHeader.AircraftNoFlyRadius, - FlightLogHeader.AircraftPitch, - FlightLogHeader.AircraftRoll, - FlightLogHeader.AircraftSmartGoHomeFlightReturnTime, - FlightLogHeader.AircraftSmartGoHomeFlightTimeRemaining, - FlightLogHeader.AircraftSmartGoHomeLandingPower, - FlightLogHeader.AircraftSmartGoHomeLandingTime, - FlightLogHeader.AircraftSmartGoHomeReturnPower, - FlightLogHeader.AircraftSpeed, - FlightLogHeader.AircraftUltrasonicAltitude, - FlightLogHeader.DeviceToAircraftDistance, - FlightLogHeader.ElapsedTime, - FlightLogHeader.GimbalPitch, - FlightLogHeader.GimbalPitchAtStop, - FlightLogHeader.GimbalRoll, - FlightLogHeader.GimbalRollAtStop, - FlightLogHeader.GimbalYaw, - FlightLogHeader.GimbalYawAtStop, - FlightLogHeader.HomeLatitude, - FlightLogHeader.HomeLongitude, - FlightLogHeader.RCBatteryPercentRemaining, - FlightLogHeader.RCLeftHorizontal, - FlightLogHeader.RCRightHorizontal, - FlightLogHeader.RCLeftVertical, - FlightLogHeader.RCRightVertical, -]); -const BOOL_FIELDS = new Set([ - FlightLogHeader.AircraftCameraBurstCapture, - FlightLogHeader.AircraftCameraIntervalCapture, - FlightLogHeader.AircraftCameraLensAFAssistant, - FlightLogHeader.AircraftCameraLensAFEnabled, - FlightLogHeader.AircraftCameraLensAssistantWorking, - FlightLogHeader.AircraftCameraOverheated, - FlightLogHeader.AircraftCameraRawCapture, - FlightLogHeader.AircraftCameraBurstCapture, - FlightLogHeader.AircraftCameraRecording, - FlightLogHeader.AircraftCameraSDCardExists, - FlightLogHeader.AircraftCameraSensorError, - FlightLogHeader.AircraftCameraSingleCapture, - FlightLogHeader.AircraftCameraStoringPhoto, - FlightLogHeader.AircraftFlying, - FlightLogHeader.AircraftIMUPreheating, - FlightLogHeader.AircraftMotorsOn, - FlightLogHeader.AircraftSmartGoHomeRequesting, - FlightLogHeader.AircraftUltrasonicOn, - FlightLogHeader.AircraftVisionOn, - FlightLogHeader.LandingGearIsMovable, - FlightLogHeader.RCGoHome, - FlightLogHeader.RCRecord, - FlightLogHeader.RCShutter, - FlightLogHeader.RCPlayback, - FlightLogHeader.RCPause, - FlightLogHeader.RCCustom1, - FlightLogHeader.RCCustom2, - FlightLogHeader.RCSattelites, - FlightLogHeader.RCGSPDataIsValid, - FlightLogHeader.RCLeftHorizontal, - FlightLogHeader.RCRightHorizontal, - FlightLogHeader.RCLeftVertical, - FlightLogHeader.RCRightVertical, - FlightLogHeader.AircraftCameraChangeableLensSupported, - FlightLogHeader.AircraftCameraLensInstalled, - FlightLogHeader.AircraftCameraLensMFAssistant, -]); -const DATE_FIELDS = new Set([ - FlightLogHeader.DateTime, -]); - -const syncParse = require('csv-parse/lib/sync'); -const META_REGEX = { - appVersion: /^#DroneDeploy\s+(.+)$/, - sessionId: /^Session ID\s+(.+)$/, - sessionStart: /^Session Start\s+(.+)$/, - sessionEnd: /^Date\/Time \(UTC\)\s+(.+)$/, - deviceModel: /^Device Model\s+(.+)$/, - deviceOS: /^Device Operating System\s+(.+)$/, - aircraftModel: /^Aircraft Model\s+(.+)$/, - aircraftName: /^Aircraft Name\s+(.+)$/, - aircraftFirmware: /^Aircraft Firmware\s+(.+)$/, - batteryChargeVolume: /^Full Charge Volume \(mAh\)\s+(.+)$/, - batteryRemainingLife: /^Remaining Life \(%\)\s+(.+)$/, - batteryDischarges: /^Discharges\s+(.+)$/, - batteryCells: /^Battery Cells Number\s+(.+)$/, - batterySerialNumber: /^Battery Serial Number\s+(.+)$/, - batteryFirmware: /^Battery Firmware\s+(.+)$/, - fcSerialNumber: /^Flight Controller Serial Number\s+(.+)$/, - fcFirmware: /^Flight Controller Firmware\s+(.+)$/, - footerLines: /^#Flight Recorder Session End|^Date\/Time \(UTC\)|^Elapsed Time \(sec\)/, - gimbalFirmware: /^Gimbal Firmware\s+(.+)$/, - rcSerialNumber: /^Remote Control Serial Number\s+(.+)$/, - rcFirmware: /^Remote Control Firmware\s+(.+)$/, - cameraSerialNumber: /^Camera Serial Number\s+(.+)$/, - elapsedTime: /^Elapsed Time \(sec\)\s+(.+)$/, - userId: /^User ID\s+(.+)$/, - organizationId: /^Organization ID\s+(.+)$/, - platform: /^Platform\s+(.+)$/, -}; -class QuasiSubject { - constructor() { - this.subscribers = []; - this.errorSubscribers = []; - this.completionSubscribers = []; - this.isFinished = false; - } - next(value) { - if (this.isFinished) { - return; - } - this.subscribers.forEach((s) => s(value)); - } - complete() { - if (this.isFinished) { - return; - } - this.isFinished = true; - this.completionSubscribers.forEach((sub) => sub()); - } - error(error) { - if (this.isFinished) { - return; - } - this.errorSubscribers.forEach((errSub) => errSub(error)); - this.complete(); - } - subscribe(sub, errSub, completionSub) { - this.subscribers.push(sub); - if (errSub) { - this.errorSubscribers.push(errSub); - } - if (completionSub) { - this.completionSubscribers.push(completionSub); - } - } - toPromise() { - const source = this; - return new Promise(function (resolve, reject) { - let value; - source.subscribe(function (v) { - value = v; - }, reject, function () { - resolve(value); - }); - }); - } -} -function parseLogStream(logStream) { - const headerMetaLines = []; - let meta = {}; - let rowHeaderLine; - let row; - const progress = { index: 0, completed: false }; - let end; - const result = new QuasiSubject(); - logStream.subscribe((line) => { - line = line.trim(); - if (!line.length) { - return; - } - if (!rowHeaderLine) { - if (line.startsWith(FlightLogHeader.DateTime.split(' ')[0])) { // Strip off timezone. - rowHeaderLine = line; - meta = parseMetaData(headerMetaLines, []); - result.next({ - meta, - rowIndex: progress.index - }); - } - else { - headerMetaLines.push(line); - progress.index++; - } - return; - } - if (META_REGEX.footerLines.test(line)) { - if (META_REGEX.sessionEnd.test(line)) { - end = fromUtcDateStr(findMatch([line], META_REGEX.sessionEnd)); - } - else if (META_REGEX.elapsedTime.test(line)) { - const elapsed = findMatch([line], META_REGEX.elapsedTime); - // This is the end of the parsing. Because normal lines are parsed through a Promise, they will be delivered - // asynchronously. So we must ensure that this result is also delivered asynchronously. - setTimeout(() => { - const parsedElapsed = elapsed === 'N/A' ? 0 : parseFloat(elapsed); - if (parsedElapsed) { - meta.session.elapsed = parsedElapsed; - } - if (end) { - meta.session.end = end; - } - result.next({ - meta, - rowIndex: progress.index++, - }); - result.complete(); - progress.completed = true; - }, 0); - } - } - else { - parseBody([rowHeaderLine, line]).then((rows) => { - row = rows[0]; - meta.session.end = row[FlightLogHeader.DateTime]; - meta.session.elapsed = row[FlightLogHeader.ElapsedTime]; - result.next({ - meta, - rowIndex: progress.index++, - row, - info: parseJsonInfo(row.Info), // Parsed Info column, if the column was populated with a JSON array. - }); - }); - } - }, (err) => { console.error('parsing error: ' + err); result.complete(); }, () => { - if (!progress.completed) { - setTimeout(() => { - result.complete(); - progress.completed = true; - }, 0); - } - }); - return result; -} -function parseLog(log) { - const lines = log.split('\n'); - const subject = new QuasiSubject(); - const parse = parseLogStream(subject); - const flightLog = { - metaData: {}, - rows: [], - infos: [] - }; - parse.subscribe((event) => { - // The metadata is updated as the file is parsed, so always grab the latest one. - flightLog.metaData = (event.meta) ? event.meta : flightLog.metaData; - if (event.row) { - flightLog.rows.push(event.row); - } - if (event.info) { - // @ts-ignore - flightLog.infos.push(event.info); - } - }); - lines.forEach(l => subject.next(l)); - subject.complete(); - return new Promise((resolve, reject) => { - parse.toPromise().then(() => resolve(flightLog)).catch((reason => reject(reason))); - }); -} -function parseBody(lines, sync) { - const text = lines.join('\n'); - const options = { - delimiter: '\t', - escape: null, - from: 1, - quote: null, - relax_column_count: true, - }; - return new Promise((resolve, reject) => { - const onResults = (err, result) => { - const [headers, ...rows] = result; - const logs = rows.map((row) => { - const log = {}; - for (let i = 0; i < headers.length; i++) { - const header = headers[i].trim(); - let value = row[i]; - if (INT_FIELDS.has(header)) { - value = parseInt(value, 10); - } - if (FLOAT_FIELDS.has(header)) { - value = parseFloat(value); - } - if (BOOL_FIELDS.has(header)) { - value = value !== '0'; - } - if (DATE_FIELDS.has(header)) { - value = fromUtcDateStr(value); - } - log[header] = value; - } - return log; - }); - resolve(logs); - }; - { - const results = syncParse(text, options); - onResults(undefined, results); - } - }); -} -function findMatch(search, regex, isNum) { - let match; - for (let str of search) { - match = str.match(regex); - if (match) { - break; - } - } - if (!match) { - return isNum ? '0' : 'N/A'; - } - return match[1]; -} -function isValidDate(d) { - return d instanceof Date && !isNaN(d); -} -function fromUtcDateStr(utcDateStr) { - if (isValidDate(utcDateStr)) { - return utcDateStr; - } - const isBadDate = !utcDateStr || !utcDateStr.trim().length || utcDateStr === 'N/A'; - if (isBadDate) { - return null; - } - if (!/Z$/.test(utcDateStr)) { - utcDateStr = utcDateStr + '.000Z'; - } - return new Date(utcDateStr); -} -function parseMetaData(headers, footers) { - const meta = [...headers, ...footers]; - let end = findMatch(meta, META_REGEX.sessionEnd); - let elapsed = findMatch(meta, META_REGEX.elapsedTime); - // if we weren't able to parse an end date or an elapsed time from our footer (which is really just the last three - // lines of the log file), it's likely that we have a truncated log file. if that's the case, we can still salvage - // some valid data by parsing the date and elapsed time from the very last log row in the file, which is what we're - // doing below. it's pretty brittle, but it's preferred to having an invalid end date and a NaN elapsed time. - if ((end === 'N/A' || elapsed === 'N/A') && footers.length > 0) { - const lastLine = footers[footers.length - 1]; - const pieces = lastLine.split('\t'); - // if we don't have at least two pieces, i don't know what is in `footer` so i'm just going to leave it alone - if (pieces.length >= 2) { - end = pieces[0]; - elapsed = pieces[1]; - } - } - return { - appVersion: findMatch(meta, META_REGEX.appVersion), - session: { - id: findMatch(meta, META_REGEX.sessionId), - start: fromUtcDateStr(findMatch(meta, META_REGEX.sessionStart)), - end: fromUtcDateStr(end), - elapsed: elapsed === 'N/A' ? 0 : parseFloat(elapsed), - }, - device: { - model: findMatch(meta, META_REGEX.deviceModel), - os: findMatch(meta, META_REGEX.deviceOS).replace(/\t/g, ' '), - platform: findMatch(meta, META_REGEX.platform), - }, - aircraft: { - model: findMatch(meta, META_REGEX.aircraftModel), - name: findMatch(meta, META_REGEX.aircraftName), - firmware: findMatch(meta, META_REGEX.aircraftFirmware), - }, - battery: { - chargeVolume: parseInt(findMatch(meta, META_REGEX.batteryChargeVolume, true), 10), - remainingLifePercent: parseInt(findMatch(meta, META_REGEX.batteryRemainingLife, true), 10), - discharges: parseInt(findMatch(meta, META_REGEX.batteryDischarges, true), 10), - cells: parseInt(findMatch(meta, META_REGEX.batteryCells, true), 10), - firmware: findMatch(meta, META_REGEX.batteryFirmware), - serialNumber: findMatch(meta, META_REGEX.batterySerialNumber), - }, - flightController: { - serialNumber: findMatch(meta, META_REGEX.fcSerialNumber), - firmware: findMatch(meta, META_REGEX.fcFirmware), - }, - gimbal: { - firmware: findMatch(meta, META_REGEX.gimbalFirmware), - }, - remoteController: { - serialNumber: findMatch(meta, META_REGEX.rcSerialNumber), - firmware: findMatch(meta, META_REGEX.rcFirmware), - }, - camera: { - serialNumber: findMatch(meta, META_REGEX.cameraSerialNumber), - }, - user: { - userId: findMatch(meta, META_REGEX.userId), - organizationId: findMatch(meta, META_REGEX.organizationId), - }, - }; -} -/** - * Parse out the given string and return an object if the string is JSON, return undefined otherwise. - * - * @param info - */ -function parseJsonInfo(info) { - if (!info) { - return undefined; - } - try { - return JSON.parse(info); - } - catch (e) { - return undefined; - } -} - -export { FLIGHT_MODE_MAPPING_V4, FLIGHT_MODE_MAPPING_V5, FlightLogHeader, QuasiSubject, fromUtcDateStr, parseLog, parseLogStream }; +import"stream";var a;!function(a){a.DateTime="Date/Time (UTC)",a.ElapsedTime="Elapsed Time (sec)",a.Info="Info",a.DeviceLatitude="Device Latitude (Degrees)",a.DeviceLongitude="Device Longitude (Degrees)",a.DeviceLocationLastUpdated="Device Location Last Updated (ms)",a.AircraftBatteryPowerPercent="Aircraft Battery Power (%)",a.AircraftBatteryCharge="Aircraft Battery Charge (mAh)",a.AircraftBatteryCurrent="Aircraft Battery Current (mA)",a.AircraftBatteryVoltage="Aircraft Battery Voltage (mV)",a.AircraftBatteryTemperature="Aircraft Battery Temperature (Fahrenheit)",a.AircraftBatteryLastUpdated="Aircraft Battery Last Updated (ms)",a.AircraftBatteryCell1Voltage="Aircraft Battery Cell 1 Voltage",a.AircraftBatteryCell2Voltage="Aircraft Battery Cell 2 Voltage",a.AircraftBatteryCell3Voltage="Aircraft Battery Cell 3 Voltage",a.AircraftBatteryCell4Voltage="Aircraft Battery Cell 4 Voltage",a.AircraftBatteryCellVoltageLastUpdated="Aircraft Battery Cell Voltage Last Updated (ms)",a.AircraftLatitude="Aircraft Latitude (Degrees)",a.AircraftLongitude="Aircraft Longitude (Degrees)",a.AircraftSpeed="Aircraft Speed (mph)",a.AircraftBarometricAltitude="Aircraft Barometric Altitude (ft)",a.AircraftHeading="Aircraft Heading (Degrees)",a.AircraftVelocityX="Aircraft Vel - X (mph)",a.AircraftVelocityY="Aircraft Vel - Y (mph)",a.AircraftVelocityZ="Aircraft Vel - Z (mph)",a.AircraftPitch="Aircraft Pitch (Degrees)",a.AircraftRoll="Aircraft Roll (Degrees)",a.AircraftSatellites="Aircraft Satellites",a.AircraftMotorsOn="Aircraft Motors On",a.AircraftFlying="Aircraft Flying",a.AircraftFlightMode="Aircraft Flight Mode",a.AircraftFlightModeValue="Aircraft Flight Mode Value",a.AircraftIMUPreheating="Aircraft IMU Preheating",a.AircraftUltrasonicOn="Aircraft Ultrasonic On",a.AircraftUltrasonicAltitude="Aircraft Ultrasonic Altitude (ft)",a.AircraftVisionOn="Aircraft Vision On",a.AircraftGPSSignal="Aircraft GPS Signal",a.AircraftGPSSignalValue="Aircraft GPS Signal Value",a.AircraftNoFly="Aircraft No-fly",a.AircraftNoFlyValue="Aircraft No-fly Value",a.AircraftNoFlyLatitude="Aircraft No-fly Latitude (Degrees)",a.AircraftNoFlyLongitude="Aircraft No-fly Longitude (Degrees)",a.AircraftNoFlyRadius="Aircraft No-fly Radius (ft)",a.HomeLatitude="Home Latitude (Degrees)",a.HomeLongitude="Home Longitude (Degrees)",a.AircraftSmartGoHomeFlightTimeRemaining="Aircraft Smart Go-home Flight Time Remaining (sec)",a.AircraftSmartGoHomeFlightReturnTime="Aircraft Smart Go-home Flight Return Time (sec)",a.AircraftSmartGoHomeLandingTime="Aircraft Smart Go-home Landing Time (sec)",a.AircraftSmartGoHomeReturnPower="Aircraft Smart Go-home Return Power (%)",a.AircraftSmartGoHomeLandingPower="Aircraft Smart Go-home Landing Power (%)",a.AircraftSmartGoHomeRadius="Aircraft Smart Go-home Radius (ft)",a.AircraftSmartGoHomeCountdown="Aircraft Smart Go-home Countdown (sec)",a.AircraftSmartGoHomeRequesting="Aircraft Smart Go-home Requesting",a.AircraftSystemStateLastUpdated="Aircraft System State Last Updated (ms)",a.GimbalPitch="Gimbal Pitch (Degrees)",a.GimbalRoll="Gimbal Roll (Degrees)",a.GimbalYaw="Gimbal Yaw (Degrees)",a.GimbalMode="Gimbal Mode",a.GimbalModeValue="Gimbal Mode Value",a.GimbalPitchAtStop="Gimbal Pitch at Stop",a.GimbalRollAtStop="Gimbal Roll at Stop",a.GimbalYawAtStop="Gimbal Yaw at Stop",a.GimbalStatusLastUpdated="Gimbal Status Last Updated (ms)",a.LandingGearIsMovable="Landing Gear is Movable",a.LandingGearStatus="Landing Gear Status",a.LandingGearStatusValue="Landing Gear Status Value",a.LandingGearMode="Landing Gear Mode",a.LandingGearModeValue="Landing Gear Mode Value",a.LandingGearLastUpdated="Landing Gear Last Updated (ms)",a.RCState="RC State",a.RCStateValue="RC State Value",a.RCLeftHorizontal="RC Left Horizontal",a.RCLeftVertical="RC Left Vertical",a.RCRightHorizontal="RC Right Horizontal",a.RCRightVertical="RC Right Vertical",a.RCLeftWheel="RC Left Wheel",a.RCRightWheel="RC Right Wheel",a.RCLandingGear="RC Landing Gear",a.RCLandingGearValue="RC Landing Gear Value",a.RCGoHome="RC Go Home",a.RCRecord="RC Record ",a.RCShutter="RC Shutter",a.RCPlayback="RC Playback",a.RCPause="RC Pause",a.RCCustom1="RC Custom 1",a.RCCustom2="RC Custom 2",a.RCStateLastUpdated="RC State Last Updated (ms)",a.RCBatteryPercentRemaining="RC Battery (%)",a.RCBatteryStateLastUpdated="RC Battery State Last Updated (ms)",a.RCSattelites="RC Sattelites",a.RCHorizontalAccuaracy="RC Horizontal Accuaracy (ft)",a.RCLatitude="RC Latitude (Degrees)",a.RCLongitude="RC Longitude (Degrees)",a.RCGSPDataIsValid="RC GSP Data is Valid",a.RCGPSStateLastUpdated="RC GPS State Last Updated (ms)",a.RCSignal1="RC Signal 1",a.RCSignal2="RC Signal 2",a.RCSignalLastUpdated="RC Signal Last Updated (ms)",a.LBSignal1="LB Signal 1",a.LBSignal2="LB Signal 2",a.LBSignalLastUpdated="LB Signal Last Updated (ms)",a.AircraftCameraMode="Aircraft Camera Mode",a.AircraftCameraModeValue="Aircraft Camera Mode Value",a.AircraftCameraOverheated="Aircraft Camera Overheated",a.AircraftCameraSensorError="Aircraft Camera Sensor Error",a.AircraftCameraRecording="Aircraft Camera Recording",a.AircraftCameraRawCapture="Aircraft Camera Raw Capture",a.AircraftCameraIntervalCapture="Aircraft Camera Interval Capture",a.AircraftCameraBurstCapture="Aircraft Camera Burst Capture",a.AircraftCameraSingleCapture="Aircraft Camera Single Capture",a.AircraftCameraStoringPhoto="Aircraft Camera Storing Photo",a.AircraftCameraStateLastUpdated="Aircraft Camera State Last Updated (ms)",a.AircraftCameraSDCardExists="Aircraft Camera SD Card Exists",a.AircraftCameraSDCardRemainingPercent="Aircraft Camera SD Card Remaining (%)",a.AircraftCameraSDCardStateLastUpdated="Aircraft Camera SD Card State Last Updated (ms)",a.AircraftCameraChangeableLensSupported="Aircraft Camera Changeable Lens Supported",a.AircraftCameraLensInstalled="Aircraft Camera Lens Installed",a.AircraftCameraLensType="Aircraft Camera Lens Type",a.AircraftCameraLensAFEnabled="Aircraft Camera Lens AF Enabled",a.AircraftCameraLensFocusMode="Aircraft Camera Lens Focus Mode",a.AircraftCameraLensFocusModeValue="Aircraft Camera Lens Focus Mode Value",a.AircraftCameraLensFocusStatus="Aircraft Camera Lens Focus Status",a.AircraftCameraLensFocusStatusValue="Aircraft Camera Lens Focus Status Value",a.AircraftCameraLensMFAssistant="Aircraft Camera Lens MF Assistant",a.AircraftCameraLensAFAssistant="Aircraft Camera Lens AF Assistant",a.AircraftCameraLensAssistantWorking="Aircraft Camera Lens Assistant Working",a.AircraftCameraLensStateLastUpdated="Aircraft Camera Lens State Last Updated (ms)",a.CompassIndex="Compass Index",a.CompassSensorValue="Compass Sensor Value",a.CompassState="Compass State",a.CompassStateLastUpdated="Compass State Last Updated (ms)",a.CompassCalibrationState="Compass Calibration State",a.CompassCalibrationLastUpdated="Compass Calibration Last Updated (ms)",a.DeviceToAircraftDistance="Device > Aircraft Distance - XY (ft)"}(a||(a={}));const e={0:"Manual",1:"Attitude",2:"Attitude Course Lock",3:"Attitude Hover",4:"Hover",5:"GPS Brake",6:"GPS Attitude",7:"GPS Course Lock",8:"GPS Home",9:"GPS Hotpoint",10:"Assisted Takeoff",11:"Auto Takeoff",12:"Auto Landing",13:"Attitude Landing",14:"GPS Waypoint",15:"Go Home",16:"Click Go",17:"Joystick",18:"Attitude Limited",19:"Cinematic",23:"Attitude Limited",24:"Draw",25:"GPS Follow Me",26:"ActiveTrack",27:"TapFly",28:"Pano",29:"Farming",30:"FPV",31:"GPS Sport",32:"GPS Novice",33:"Confirm Landing",35:"Terrain Follow",36:"Palm Control",37:"Quick Shot",38:"Tripod",39:"ActiveTrack Spotlight",41:"Motors Just Started",43:"GPS Gentle",255:"Unknown"},t={0:"Manual",1:"Attitude",2:"GPS Normal",3:"POI",4:"Takeoff Ready",5:"Auto Takeoff",6:"Auto Landing",7:"Waypoint",8:"Go Home",9:"Virtual Stick",10:"Smart Flight",11:"Pano",12:"GPS Sport",13:"GPS Tripod",14:"Auto Avoidance",15:"Smart Fly",16:"Force Landing",17:"Attitude Landing",18:"Click Go",19:"Cinematic",20:"Draw",21:"GPS Follow Me",22:"GPS Novice",23:"Quick Movie",24:"Tap Fly",25:"Master Shot",26:"APAS",27:"Timelapse",28:"Motors Start",29:"Unknown"};Buffer.from([239,187,191]);const r=new Set([a.AircraftBatteryCell1Voltage,a.AircraftBatteryCell2Voltage,a.AircraftBatteryCell3Voltage,a.AircraftBatteryCell4Voltage,a.AircraftBatteryCharge,a.AircraftBatteryCurrent,a.AircraftBatteryTemperature,a.AircraftBatteryVoltage,a.AircraftCameraLensFocusModeValue,a.AircraftCameraLensFocusStatusValue,a.AircraftCameraModeValue,a.AircraftFlightModeValue,a.AircraftGPSSignalValue,a.AircraftNoFlyValue,a.AircraftSatellites,a.GimbalModeValue,a.AircraftSmartGoHomeRadius,a.AircraftSmartGoHomeCountdown,a.AircraftVelocityX,a.AircraftVelocityY,a.AircraftVelocityZ,a.RCHorizontalAccuaracy,a.RCLatitude,a.RCLongitude,a.LandingGearStatusValue,a.LandingGearModeValue,a.RCStateValue,a.RCLandingGearValue]),i=new Set([a.AircraftBarometricAltitude,a.AircraftBatteryPowerPercent,a.AircraftCameraSDCardRemainingPercent,a.AircraftHeading,a.AircraftLatitude,a.AircraftLongitude,a.AircraftNoFlyLatitude,a.AircraftNoFlyLongitude,a.AircraftNoFlyRadius,a.AircraftPitch,a.AircraftRoll,a.AircraftSmartGoHomeFlightReturnTime,a.AircraftSmartGoHomeFlightTimeRemaining,a.AircraftSmartGoHomeLandingPower,a.AircraftSmartGoHomeLandingTime,a.AircraftSmartGoHomeReturnPower,a.AircraftSpeed,a.AircraftUltrasonicAltitude,a.DeviceToAircraftDistance,a.ElapsedTime,a.GimbalPitch,a.GimbalPitchAtStop,a.GimbalRoll,a.GimbalRollAtStop,a.GimbalYaw,a.GimbalYawAtStop,a.HomeLatitude,a.HomeLongitude,a.RCBatteryPercentRemaining,a.RCLeftHorizontal,a.RCRightHorizontal,a.RCLeftVertical,a.RCRightVertical]),o=new Set([a.AircraftCameraBurstCapture,a.AircraftCameraIntervalCapture,a.AircraftCameraLensAFAssistant,a.AircraftCameraLensAFEnabled,a.AircraftCameraLensAssistantWorking,a.AircraftCameraOverheated,a.AircraftCameraRawCapture,a.AircraftCameraBurstCapture,a.AircraftCameraRecording,a.AircraftCameraSDCardExists,a.AircraftCameraSensorError,a.AircraftCameraSingleCapture,a.AircraftCameraStoringPhoto,a.AircraftFlying,a.AircraftIMUPreheating,a.AircraftMotorsOn,a.AircraftSmartGoHomeRequesting,a.AircraftUltrasonicOn,a.AircraftVisionOn,a.LandingGearIsMovable,a.RCGoHome,a.RCRecord,a.RCShutter,a.RCPlayback,a.RCPause,a.RCCustom1,a.RCCustom2,a.RCSattelites,a.RCGSPDataIsValid,a.RCLeftHorizontal,a.RCRightHorizontal,a.RCLeftVertical,a.RCRightVertical,a.AircraftCameraChangeableLensSupported,a.AircraftCameraLensInstalled,a.AircraftCameraLensMFAssistant]),s=new Set([a.DateTime]),n=require("csv-parse/lib/sync"),c={appVersion:/^#DroneDeploy\s+(.+)$/,sessionId:/^Session ID\s+(.+)$/,sessionStart:/^Session Start\s+(.+)$/,sessionEnd:/^Date\/Time \(UTC\)\s+(.+)$/,deviceModel:/^Device Model\s+(.+)$/,deviceOS:/^Device Operating System\s+(.+)$/,aircraftModel:/^Aircraft Model\s+(.+)$/,aircraftName:/^Aircraft Name\s+(.+)$/,aircraftFirmware:/^Aircraft Firmware\s+(.+)$/,batteryChargeVolume:/^Full Charge Volume \(mAh\)\s+(.+)$/,batteryRemainingLife:/^Remaining Life \(%\)\s+(.+)$/,batteryDischarges:/^Discharges\s+(.+)$/,batteryCells:/^Battery Cells Number\s+(.+)$/,batterySerialNumber:/^Battery Serial Number\s+(.+)$/,batteryFirmware:/^Battery Firmware\s+(.+)$/,fcSerialNumber:/^Flight Controller Serial Number\s+(.+)$/,fcFirmware:/^Flight Controller Firmware\s+(.+)$/,footerLines:/^#Flight Recorder Session End|^Date\/Time \(UTC\)|^Elapsed Time \(sec\)/,gimbalFirmware:/^Gimbal Firmware\s+(.+)$/,rcSerialNumber:/^Remote Control Serial Number\s+(.+)$/,rcFirmware:/^Remote Control Firmware\s+(.+)$/,cameraSerialNumber:/^Camera Serial Number\s+(.+)$/,elapsedTime:/^Elapsed Time \(sec\)\s+(.+)$/,userId:/^User ID\s+(.+)$/,organizationId:/^Organization ID\s+(.+)$/,platform:/^Platform\s+(.+)$/};class l{constructor(){this.subscribers=[],this.errorSubscribers=[],this.completionSubscribers=[],this.isFinished=!1}next(a){this.isFinished||this.subscribers.forEach((e=>e(a)))}complete(){this.isFinished||(this.isFinished=!0,this.completionSubscribers.forEach((a=>a())))}error(a){this.isFinished||(this.errorSubscribers.forEach((e=>e(a))),this.complete())}subscribe(a,e,t){this.subscribers.push(a),e&&this.errorSubscribers.push(e),t&&this.completionSubscribers.push(t)}toPromise(){const a=this;return new Promise((function(e,t){let r;a.subscribe((function(a){r=a}),t,(function(){e(r)}))}))}}function m(e){const t=[];let m,f,C={};const S={index:0,completed:!1};let g;const p=new l;return e.subscribe((e=>{if((e=e.trim()).length)if(m)if(c.footerLines.test(e)){if(c.sessionEnd.test(e))g=A(d([e],c.sessionEnd));else if(c.elapsedTime.test(e)){const a=d([e],c.elapsedTime);setTimeout((()=>{const e="N/A"===a?0:parseFloat(a);e&&(C.session.elapsed=e),g&&(C.session.end=g),p.next({meta:C,rowIndex:S.index++}),p.complete(),S.completed=!0}),0)}}else(function(a){const e=a.join("\n"),t={delimiter:"\t",escape:null,from:1,quote:null,relax_column_count:!0};return new Promise(((a,c)=>{const l=(e,t)=>{const[n,...c]=t,l=c.map((a=>{const e={};for(let t=0;t{f=e[0],C.session.end=f[a.DateTime],C.session.elapsed=f[a.ElapsedTime],p.next({meta:C,rowIndex:S.index++,row:f,info:u(f.Info)})}));else e.startsWith(a.DateTime.split(" ")[0])?(m=e,C=function(a,e){const t=[...a,...e];let r=d(t,c.sessionEnd),i=d(t,c.elapsedTime);if(("N/A"===r||"N/A"===i)&&e.length>0){const a=e[e.length-1].split("\t");a.length>=2&&(r=a[0],i=a[1])}return{appVersion:d(t,c.appVersion),session:{id:d(t,c.sessionId),start:A(d(t,c.sessionStart)),end:A(r),elapsed:"N/A"===i?0:parseFloat(i)},device:{model:d(t,c.deviceModel),os:d(t,c.deviceOS).replace(/\t/g," "),platform:d(t,c.platform)},aircraft:{model:d(t,c.aircraftModel),name:d(t,c.aircraftName),firmware:d(t,c.aircraftFirmware)},battery:{chargeVolume:parseInt(d(t,c.batteryChargeVolume,!0),10),remainingLifePercent:parseInt(d(t,c.batteryRemainingLife,!0),10),discharges:parseInt(d(t,c.batteryDischarges,!0),10),cells:parseInt(d(t,c.batteryCells,!0),10),firmware:d(t,c.batteryFirmware),serialNumber:d(t,c.batterySerialNumber)},flightController:{serialNumber:d(t,c.fcSerialNumber),firmware:d(t,c.fcFirmware)},gimbal:{firmware:d(t,c.gimbalFirmware)},remoteController:{serialNumber:d(t,c.rcSerialNumber),firmware:d(t,c.rcFirmware)},camera:{serialNumber:d(t,c.cameraSerialNumber)},user:{userId:d(t,c.userId),organizationId:d(t,c.organizationId)}}}(t,[]),p.next({meta:C,rowIndex:S.index})):(t.push(e),S.index++)}),(a=>{console.error("parsing error: "+a),p.complete()}),(()=>{S.completed||setTimeout((()=>{p.complete(),S.completed=!0}),0)})),p}function f(a){const e=a.split("\n"),t=new l,r=m(t),i={metaData:{},rows:[],infos:[]};return r.subscribe((a=>{i.metaData=a.meta?a.meta:i.metaData,a.row&&i.rows.push(a.row),a.info&&i.infos.push(a.info)})),e.forEach((a=>t.next(a))),t.complete(),new Promise(((a,e)=>{r.toPromise().then((()=>a(i))).catch((a=>e(a)))}))}function d(a,e,t){let r;for(let t of a)if(r=t.match(e),r)break;return r?r[1]:t?"0":"N/A"}function A(a){if((e=a)instanceof Date&&!isNaN(e))return a;var e;return a&&a.trim().length&&"N/A"!==a?(/Z$/.test(a)||(a+=".000Z"),new Date(a)):null}function u(a){if(a)try{return JSON.parse(a)}catch(a){return}}export{e as FLIGHT_MODE_MAPPING_V4,t as FLIGHT_MODE_MAPPING_V5,a as FlightLogHeader,l as QuasiSubject,A as fromUtcDateStr,f as parseLog,m as parseLogStream}; //# sourceMappingURL=flight-log-parser.es6.js.map diff --git a/dist/flight-log-parser.es6.js.map b/dist/flight-log-parser.es6.js.map index 79da183..f1ee451 100644 --- a/dist/flight-log-parser.es6.js.map +++ b/dist/flight-log-parser.es6.js.map @@ -1 +1 @@ -{"version":3,"file":"flight-log-parser.es6.js","sources":["../src/types.ts","../node_modules/csv-parse/lib/index.js","../src/field-types.ts","../src/parser.ts"],"sourcesContent":["export enum FlightLogHeader {\n DateTime = 'Date/Time (UTC)',\n ElapsedTime = 'Elapsed Time (sec)',\n Info = 'Info',\n DeviceLatitude = 'Device Latitude (Degrees)',\n DeviceLongitude = 'Device Longitude (Degrees)',\n DeviceLocationLastUpdated = 'Device Location Last Updated (ms)',\n AircraftBatteryPowerPercent = 'Aircraft Battery Power (%)',\n AircraftBatteryCharge = 'Aircraft Battery Charge (mAh)',\n AircraftBatteryCurrent = 'Aircraft Battery Current (mA)',\n AircraftBatteryVoltage = 'Aircraft Battery Voltage (mV)',\n AircraftBatteryTemperature = 'Aircraft Battery Temperature (Fahrenheit)',\n AircraftBatteryLastUpdated = 'Aircraft Battery Last Updated (ms)',\n AircraftBatteryCell1Voltage = 'Aircraft Battery Cell 1 Voltage',\n AircraftBatteryCell2Voltage = 'Aircraft Battery Cell 2 Voltage',\n AircraftBatteryCell3Voltage = 'Aircraft Battery Cell 3 Voltage',\n AircraftBatteryCell4Voltage = 'Aircraft Battery Cell 4 Voltage',\n AircraftBatteryCellVoltageLastUpdated = 'Aircraft Battery Cell Voltage Last Updated (ms)',\n AircraftLatitude = 'Aircraft Latitude (Degrees)',\n AircraftLongitude = 'Aircraft Longitude (Degrees)',\n AircraftSpeed = 'Aircraft Speed (mph)',\n AircraftBarometricAltitude = 'Aircraft Barometric Altitude (ft)',\n AircraftHeading = 'Aircraft Heading (Degrees)',\n AircraftVelocityX = 'Aircraft Vel - X (mph)',\n AircraftVelocityY = 'Aircraft Vel - Y (mph)',\n AircraftVelocityZ = 'Aircraft Vel - Z (mph)',\n AircraftPitch = 'Aircraft Pitch (Degrees)',\n AircraftRoll = 'Aircraft Roll (Degrees)',\n AircraftSatellites = 'Aircraft Satellites',\n AircraftMotorsOn = 'Aircraft Motors On',\n AircraftFlying = 'Aircraft Flying',\n AircraftFlightMode = 'Aircraft Flight Mode',\n AircraftFlightModeValue = 'Aircraft Flight Mode Value',\n AircraftIMUPreheating = 'Aircraft IMU Preheating',\n AircraftUltrasonicOn = 'Aircraft Ultrasonic On',\n AircraftUltrasonicAltitude = 'Aircraft Ultrasonic Altitude (ft)',\n AircraftVisionOn = 'Aircraft Vision On',\n AircraftGPSSignal = 'Aircraft GPS Signal',\n AircraftGPSSignalValue = 'Aircraft GPS Signal Value',\n AircraftNoFly = 'Aircraft No-fly',\n AircraftNoFlyValue = 'Aircraft No-fly Value',\n AircraftNoFlyLatitude = 'Aircraft No-fly Latitude (Degrees)',\n AircraftNoFlyLongitude = 'Aircraft No-fly Longitude (Degrees)',\n AircraftNoFlyRadius = 'Aircraft No-fly Radius (ft)',\n HomeLatitude = 'Home Latitude (Degrees)',\n HomeLongitude = 'Home Longitude (Degrees)',\n AircraftSmartGoHomeFlightTimeRemaining = 'Aircraft Smart Go-home Flight Time Remaining (sec)',\n AircraftSmartGoHomeFlightReturnTime = 'Aircraft Smart Go-home Flight Return Time (sec)',\n AircraftSmartGoHomeLandingTime = 'Aircraft Smart Go-home Landing Time (sec)',\n AircraftSmartGoHomeReturnPower = 'Aircraft Smart Go-home Return Power (%)',\n AircraftSmartGoHomeLandingPower = 'Aircraft Smart Go-home Landing Power (%)',\n AircraftSmartGoHomeRadius = 'Aircraft Smart Go-home Radius (ft)',\n AircraftSmartGoHomeCountdown = 'Aircraft Smart Go-home Countdown (sec)',\n AircraftSmartGoHomeRequesting = 'Aircraft Smart Go-home Requesting',\n AircraftSystemStateLastUpdated = 'Aircraft System State Last Updated (ms)',\n GimbalPitch = 'Gimbal Pitch (Degrees)',\n GimbalRoll = 'Gimbal Roll (Degrees)',\n GimbalYaw = 'Gimbal Yaw (Degrees)',\n GimbalMode = 'Gimbal Mode',\n GimbalModeValue = 'Gimbal Mode Value',\n GimbalPitchAtStop = 'Gimbal Pitch at Stop',\n GimbalRollAtStop = 'Gimbal Roll at Stop',\n GimbalYawAtStop = 'Gimbal Yaw at Stop',\n GimbalStatusLastUpdated = 'Gimbal Status Last Updated (ms)',\n LandingGearIsMovable = 'Landing Gear is Movable',\n LandingGearStatus = 'Landing Gear Status',\n LandingGearStatusValue = 'Landing Gear Status Value',\n LandingGearMode = 'Landing Gear Mode',\n LandingGearModeValue = 'Landing Gear Mode Value',\n LandingGearLastUpdated = 'Landing Gear Last Updated (ms)',\n RCState = 'RC State',\n RCStateValue = 'RC State Value',\n RCLeftHorizontal = 'RC Left Horizontal',\n RCLeftVertical = 'RC Left Vertical',\n RCRightHorizontal = 'RC Right Horizontal',\n RCRightVertical = 'RC Right Vertical',\n RCLeftWheel = 'RC Left Wheel',\n RCRightWheel = 'RC Right Wheel',\n RCLandingGear = 'RC Landing Gear',\n RCLandingGearValue = 'RC Landing Gear Value',\n RCGoHome = 'RC Go Home',\n RCRecord = 'RC Record ',\n RCShutter = 'RC Shutter',\n RCPlayback = 'RC Playback',\n RCPause = 'RC Pause',\n RCCustom1 = 'RC Custom 1',\n RCCustom2 = 'RC Custom 2',\n RCStateLastUpdated = 'RC State Last Updated (ms)',\n RCBatteryPercentRemaining = 'RC Battery (%)',\n RCBatteryStateLastUpdated = 'RC Battery State Last Updated (ms)',\n RCSattelites = 'RC Sattelites',\n RCHorizontalAccuaracy = 'RC Horizontal Accuaracy (ft)',\n RCLatitude = 'RC Latitude (Degrees)',\n RCLongitude = 'RC Longitude (Degrees)',\n RCGSPDataIsValid = 'RC GSP Data is Valid',\n RCGPSStateLastUpdated = 'RC GPS State Last Updated (ms)',\n RCSignal1 = 'RC Signal 1',\n RCSignal2 = 'RC Signal 2',\n RCSignalLastUpdated = 'RC Signal Last Updated (ms)',\n LBSignal1 = 'LB Signal 1',\n LBSignal2 = 'LB Signal 2',\n LBSignalLastUpdated = 'LB Signal Last Updated (ms)',\n AircraftCameraMode = 'Aircraft Camera Mode',\n AircraftCameraModeValue = 'Aircraft Camera Mode Value',\n AircraftCameraOverheated = 'Aircraft Camera Overheated',\n AircraftCameraSensorError = 'Aircraft Camera Sensor Error',\n AircraftCameraRecording = 'Aircraft Camera Recording',\n AircraftCameraRawCapture = 'Aircraft Camera Raw Capture',\n AircraftCameraIntervalCapture = 'Aircraft Camera Interval Capture',\n AircraftCameraBurstCapture = 'Aircraft Camera Burst Capture',\n AircraftCameraSingleCapture = 'Aircraft Camera Single Capture',\n AircraftCameraStoringPhoto = 'Aircraft Camera Storing Photo',\n AircraftCameraStateLastUpdated = 'Aircraft Camera State Last Updated (ms)',\n AircraftCameraSDCardExists = 'Aircraft Camera SD Card Exists',\n AircraftCameraSDCardRemainingPercent = 'Aircraft Camera SD Card Remaining (%)',\n AircraftCameraSDCardStateLastUpdated = 'Aircraft Camera SD Card State Last Updated (ms)',\n AircraftCameraChangeableLensSupported = 'Aircraft Camera Changeable Lens Supported',\n AircraftCameraLensInstalled = 'Aircraft Camera Lens Installed',\n AircraftCameraLensType = 'Aircraft Camera Lens Type',\n AircraftCameraLensAFEnabled = 'Aircraft Camera Lens AF Enabled',\n AircraftCameraLensFocusMode = 'Aircraft Camera Lens Focus Mode',\n AircraftCameraLensFocusModeValue = 'Aircraft Camera Lens Focus Mode Value',\n AircraftCameraLensFocusStatus = 'Aircraft Camera Lens Focus Status',\n AircraftCameraLensFocusStatusValue = 'Aircraft Camera Lens Focus Status Value',\n AircraftCameraLensMFAssistant = 'Aircraft Camera Lens MF Assistant',\n AircraftCameraLensAFAssistant = 'Aircraft Camera Lens AF Assistant',\n AircraftCameraLensAssistantWorking = 'Aircraft Camera Lens Assistant Working',\n AircraftCameraLensStateLastUpdated = 'Aircraft Camera Lens State Last Updated (ms)',\n CompassIndex = \"Compass Index\",\n CompassSensorValue = \"Compass Sensor Value\",\n CompassState = \"Compass State\",\n CompassStateLastUpdated = \"Compass State Last Updated (ms)\",\n CompassCalibrationState = \"Compass Calibration State\",\n CompassCalibrationLastUpdated = \"Compass Calibration Last Updated (ms)\",\n DeviceToAircraftDistance = 'Device > Aircraft Distance - XY (ft)',\n}\n\nexport type FlightLogRow = {\n [prop in FlightLogHeader]: any // because csv\n};\n\nexport type FlightLogMetaData = {\n appVersion: string;\n session: {\n id: string;\n start: Date;\n end: Date | null;\n elapsed: number;\n };\n device: {\n model: string;\n os: string;\n platform: string;\n };\n aircraft: {\n model: string;\n name: string;\n firmware: string;\n };\n battery: {\n chargeVolume: number;\n remainingLifePercent: number;\n discharges: number;\n cells: number;\n firmware: string;\n serialNumber: string;\n };\n flightController: {\n serialNumber: string;\n firmware: string;\n };\n gimbal: {\n firmware: string;\n };\n remoteController: {\n serialNumber: string;\n firmware: string;\n };\n camera: {\n serialNumber: string;\n };\n user: {\n userId: string;\n organizationId: string;\n };\n};\n\nexport type FlightLog = {\n metaData: FlightLogMetaData;\n rows: FlightLogRow[];\n infos: any[];\n};\n\nexport type FlightLogEvent = {\n meta: FlightLogMetaData;\n rowIndex?: number;\n row?: FlightLogRow;\n info?: undefined|Array; // Empty string => undefined, else parsed JSON blob.\n};\n\n// based off of types in ios/android SDK FlightMode enums\nexport const FLIGHT_MODE_MAPPING_V4 = {\n 0: 'Manual',\n 1: 'Attitude',\n 2: 'Attitude Course Lock',\n 3: 'Attitude Hover',\n 4: 'Hover',\n 5: 'GPS Brake',\n 6: 'GPS Attitude',\n 7: 'GPS Course Lock',\n 8: 'GPS Home',\n 9: 'GPS Hotpoint',\n 10: 'Assisted Takeoff',\n 11: 'Auto Takeoff',\n 12: 'Auto Landing',\n 13: 'Attitude Landing',\n 14: 'GPS Waypoint',\n 15: 'Go Home',\n 16: 'Click Go',\n 17: 'Joystick',\n 18: 'Attitude Limited',\n 19: 'Cinematic',\n 23: 'Attitude Limited',\n 24: 'Draw',\n 25: 'GPS Follow Me',\n 26: 'ActiveTrack',\n 27: 'TapFly',\n 28: 'Pano',\n 29: 'Farming',\n 30: 'FPV',\n 31: 'GPS Sport',\n 32: 'GPS Novice',\n 33: 'Confirm Landing',\n 35: 'Terrain Follow',\n 36: 'Palm Control',\n 37: 'Quick Shot',\n 38: 'Tripod',\n 39: 'ActiveTrack Spotlight',\n 41: 'Motors Just Started',\n 43: 'GPS Gentle',\n 255: 'Unknown',\n};\n\nexport const FLIGHT_MODE_MAPPING_V5 = {\n 0: 'Manual',\n 1: 'Attitude',\n 2: 'GPS Normal',\n 3: 'POI',\n 4: 'Takeoff Ready',\n 5: 'Auto Takeoff',\n 6: 'Auto Landing',\n 7: 'Waypoint',\n 8: 'Go Home',\n 9: 'Virtual Stick',\n 10: 'Smart Flight',\n 11: 'Pano',\n 12: 'GPS Sport',\n 13: 'GPS Tripod',\n 14: 'Auto Avoidance',\n 15: 'Smart Fly',\n 16: 'Force Landing',\n 17: 'Attitude Landing',\n 18: 'Click Go',\n 19: 'Cinematic',\n 20: 'Draw',\n 21: 'GPS Follow Me',\n 22: 'GPS Novice',\n 23: 'Quick Movie',\n 24: 'Tap Fly',\n 25: 'Master Shot',\n 26: 'APAS',\n 27: 'Timelapse',\n 28: 'Motors Start',\n 29: 'Unknown',\n};\n","\n/*\nCSV Parse\n\nPlease look at the [project documentation](https://csv.js.org/parse/) for additional\ninformation.\n*/\n\nconst { Transform } = require('stream')\nconst ResizeableBuffer = require('./ResizeableBuffer')\n\nconst cr = 13\nconst nl = 10\nconst space = 32\nconst tab = 9\nconst bom_utf8 = Buffer.from([239, 187, 191])\n\nclass Parser extends Transform {\n constructor(opts = {}){\n super({...{readableObjectMode: true}, ...opts})\n const options = {}\n // Merge with user options\n for(let opt in opts){\n options[underscore(opt)] = opts[opt]\n }\n // Normalize option `bom`\n if(options.bom === undefined || options.bom === null || options.bom === false){\n options.bom = false\n }else if(options.bom !== true){\n throw new Error(`Invalid Option: bom must be true, got ${JSON.stringify(options.bom)}`)\n }\n // Normalize option `cast`\n let fnCastField = null\n if(options.cast === undefined || options.cast === null || options.cast === false || options.cast === ''){\n options.cast = undefined\n }else if(typeof options.cast === 'function'){\n fnCastField = options.cast\n options.cast = true\n }else if(options.cast !== true){\n throw new Error('Invalid Option: cast must be true or a function')\n }\n // Normalize option `cast_date`\n if(options.cast_date === undefined || options.cast_date === null || options.cast_date === false || options.cast_date === ''){\n options.cast_date = false\n }else if(options.cast_date === true){\n options.cast_date = function(value){\n const date = Date.parse(value)\n return !isNaN(date) ? new Date(date) : value\n }\n }else if(typeof options.cast_date !== 'function'){\n throw new Error('Invalid Option: cast_date must be true or a function')\n }\n // Normalize option `columns`\n let fnFirstLineToHeaders = null\n if(options.columns === true){\n // Fields in the first line are converted as-is to columns\n fnFirstLineToHeaders = undefined\n }else if(typeof options.columns === 'function'){\n fnFirstLineToHeaders = options.columns\n options.columns = true\n }else if(Array.isArray(options.columns)){\n options.columns = normalizeColumnsArray(options.columns)\n }else if(options.columns === undefined || options.columns === null || options.columns === false){\n options.columns = false\n }else{\n throw new Error(`Invalid Option columns: expect an object or true, got ${JSON.stringify(options.columns)}`)\n }\n // Normalize option `comment`\n if(options.comment === undefined || options.comment === null || options.comment === false || options.comment === ''){\n options.comment = null\n }else{\n if(typeof options.comment === 'string'){\n options.comment = Buffer.from(options.comment)\n }\n if(!Buffer.isBuffer(options.comment)){\n throw new Error(`Invalid Option: comment must be a buffer or a string, got ${JSON.stringify(options.comment)}`)\n }\n }\n // Normalize option `delimiter`\n if(options.delimiter === undefined || options.delimiter === null || options.delimiter === false){\n options.delimiter = Buffer.from(',')\n }else if(Buffer.isBuffer(options.delimiter)){\n if(options.delimiter.length === 0){\n throw new Error(`Invalid Option: delimiter must be a non empty buffer`)\n }\n // Great, nothing to do\n }else if(typeof options.delimiter === 'string'){\n if(options.delimiter.length === 0){\n throw new Error(`Invalid Option: delimiter must be a non empty string`)\n }\n options.delimiter = Buffer.from(options.delimiter)\n }else{\n throw new Error(`Invalid Option: delimiter must be a string or a buffer, got ${options.delimiter}`)\n }\n // Normalize option `escape`\n if(options.escape === undefined || options.escape === null){\n options.escape = Buffer.from('\"')\n }else if(typeof options.escape === 'string'){\n options.escape = Buffer.from(options.escape)\n }\n if(!Buffer.isBuffer(options.escape)){\n throw new Error(`Invalid Option: escape must be a buffer or a string, got ${JSON.stringify(options.escape)}`)\n }else if(options.escape.length !== 1){\n throw new Error(`Invalid Option Length: escape must be one character, got ${options.escape.length}`)\n }else{\n options.escape = options.escape[0]\n }\n // Normalize option `from`\n if(options.from === undefined || options.from === null){\n options.from = 1\n }else{\n if(typeof options.from === 'string' && /\\d+/.test(options.from)){\n options.from = parseInt(options.from)\n }\n if(Number.isInteger(options.from)){\n if(options.from < 0){\n throw new Error(`Invalid Option: from must be a positive integer, got ${JSON.stringify(opts.from)}`)\n }\n }else{\n throw new Error(`Invalid Option: from must be an integer, got ${JSON.stringify(options.from)}`)\n }\n }\n // Normalize option `from_line`\n if(options.from_line === undefined || options.from_line === null){\n options.from_line = 1\n }else{\n if(typeof options.from_line === 'string' && /\\d+/.test(options.from_line)){\n options.from_line = parseInt(options.from_line)\n }\n if(Number.isInteger(options.from_line)){\n if(options.from_line <= 0){\n throw new Error(`Invalid Option: from_line must be a positive integer greater than 0, got ${JSON.stringify(opts.from_line)}`)\n }\n }else{\n throw new Error(`Invalid Option: from_line must be an integer, got ${JSON.stringify(opts.from_line)}`)\n }\n }\n // Normalize option `info`\n if(options.info === undefined || options.info === null || options.info === false){\n options.info = false\n }else if(options.info !== true){\n throw new Error(`Invalid Option: info must be true, got ${JSON.stringify(options.info)}`)\n }\n // Normalize option `max_record_size`\n if(options.max_record_size === undefined || options.max_record_size === null || options.max_record_size === false){\n options.max_record_size = 0\n }else if(Number.isInteger(options.max_record_size) && options.max_record_size >= 0){\n // Great, nothing to do\n }else if(typeof options.max_record_size === 'string' && /\\d+/.test(options.max_record_size)){\n options.max_record_size = parseInt(options.max_record_size)\n }else{\n throw new Error(`Invalid Option: max_record_size must be a positive integer, got ${JSON.stringify(options.max_record_size)}`)\n }\n // Normalize option `objname`\n if(options.objname === undefined || options.objname === null || options.objname === false){\n options.objname = undefined\n }else if(Buffer.isBuffer(options.objname)){\n if(options.objname.length === 0){\n throw new Error(`Invalid Option: objname must be a non empty buffer`)\n }\n options.objname = options.objname.toString()\n }else if(typeof options.objname === 'string'){\n if(options.objname.length === 0){\n throw new Error(`Invalid Option: objname must be a non empty string`)\n }\n // Great, nothing to do\n }else{\n throw new Error(`Invalid Option: objname must be a string or a buffer, got ${options.objname}`)\n }\n // Normalize option `quote`\n if(options.quote === null || options.quote === false || options.quote === ''){\n options.quote = null\n }else{\n if(options.quote === undefined || options.quote === true){\n options.quote = Buffer.from('\"')\n }else if(typeof options.quote === 'string'){\n options.quote = Buffer.from(options.quote)\n }\n if(!Buffer.isBuffer(options.quote)){\n throw new Error(`Invalid Option: quote must be a buffer or a string, got ${JSON.stringify(options.quote)}`)\n }else if(options.quote.length !== 1){\n throw new Error(`Invalid Option Length: quote must be one character, got ${options.quote.length}`)\n }else{\n options.quote = options.quote[0]\n }\n }\n // Normalize option `raw`\n if(options.raw === undefined || options.raw === null || options.raw === false){\n options.raw = false\n }else if(options.raw !== true){\n throw new Error(`Invalid Option: raw must be true, got ${JSON.stringify(options.raw)}`)\n }\n // Normalize option `record_delimiter`\n if(!options.record_delimiter){\n options.record_delimiter = []\n }else if(!Array.isArray(options.record_delimiter)){\n options.record_delimiter = [options.record_delimiter]\n }\n options.record_delimiter = options.record_delimiter.map( function(rd){\n if(typeof rd === 'string'){\n rd = Buffer.from(rd)\n }\n return rd\n })\n // Normalize option `relax`\n if(typeof options.relax === 'boolean'){\n // Great, nothing to do\n }else if(options.relax === undefined || options.relax === null){\n options.relax = false\n }else{\n throw new Error(`Invalid Option: relax must be a boolean, got ${JSON.stringify(options.relax)}`)\n }\n // Normalize option `relax_column_count`\n if(typeof options.relax_column_count === 'boolean'){\n // Great, nothing to do\n }else if(options.relax_column_count === undefined || options.relax_column_count === null){\n options.relax_column_count = false\n }else{\n throw new Error(`Invalid Option: relax_column_count must be a boolean, got ${JSON.stringify(options.relax_column_count)}`)\n }\n // Normalize option `skip_empty_lines`\n if(typeof options.skip_empty_lines === 'boolean'){\n // Great, nothing to do\n }else if(options.skip_empty_lines === undefined || options.skip_empty_lines === null){\n options.skip_empty_lines = false\n }else{\n throw new Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(options.skip_empty_lines)}`)\n }\n // Normalize option `skip_lines_with_empty_values`\n if(typeof options.skip_lines_with_empty_values === 'boolean'){\n // Great, nothing to do\n }else if(options.skip_lines_with_empty_values === undefined || options.skip_lines_with_empty_values === null){\n options.skip_lines_with_empty_values = false\n }else{\n throw new Error(`Invalid Option: skip_lines_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_lines_with_empty_values)}`)\n }\n // Normalize option `skip_lines_with_error`\n if(typeof options.skip_lines_with_error === 'boolean'){\n // Great, nothing to do\n }else if(options.skip_lines_with_error === undefined || options.skip_lines_with_error === null){\n options.skip_lines_with_error = false\n }else{\n throw new Error(`Invalid Option: skip_lines_with_error must be a boolean, got ${JSON.stringify(options.skip_lines_with_error)}`)\n }\n // Normalize option `rtrim`\n if(options.rtrim === undefined || options.rtrim === null || options.rtrim === false){\n options.rtrim = false\n }else if(options.rtrim !== true){\n throw new Error(`Invalid Option: rtrim must be a boolean, got ${JSON.stringify(options.rtrim)}`)\n }\n // Normalize option `ltrim`\n if(options.ltrim === undefined || options.ltrim === null || options.ltrim === false){\n options.ltrim = false\n }else if(options.ltrim !== true){\n throw new Error(`Invalid Option: ltrim must be a boolean, got ${JSON.stringify(options.ltrim)}`)\n }\n // Normalize option `trim`\n if(options.trim === undefined || options.trim === null || options.trim === false){\n options.trim = false\n }else if(options.trim !== true){\n throw new Error(`Invalid Option: trim must be a boolean, got ${JSON.stringify(options.trim)}`)\n }\n // Normalize options `trim`, `ltrim` and `rtrim`\n if(options.trim === true && opts.ltrim !== false){\n options.ltrim = true\n }else if(options.ltrim !== true){\n options.ltrim = false\n }\n if(options.trim === true && opts.rtrim !== false){\n options.rtrim = true\n }else if(options.rtrim !== true){\n options.rtrim = false\n }\n // Normalize option `to`\n if(options.to === undefined || options.to === null){\n options.to = -1\n }else{\n if(typeof options.to === 'string' && /\\d+/.test(options.to)){\n options.to = parseInt(options.to)\n }\n if(Number.isInteger(options.to)){\n if(options.to <= 0){\n throw new Error(`Invalid Option: to must be a positive integer greater than 0, got ${JSON.stringify(opts.to)}`)\n }\n }else{\n throw new Error(`Invalid Option: to must be an integer, got ${JSON.stringify(opts.to)}`)\n }\n }\n // Normalize option `to_line`\n if(options.to_line === undefined || options.to_line === null){\n options.to_line = -1\n }else{\n if(typeof options.to_line === 'string' && /\\d+/.test(options.to_line)){\n options.to_line = parseInt(options.to_line)\n }\n if(Number.isInteger(options.to_line)){\n if(options.to_line <= 0){\n throw new Error(`Invalid Option: to_line must be a positive integer greater than 0, got ${JSON.stringify(opts.to_line)}`)\n }\n }else{\n throw new Error(`Invalid Option: to_line must be an integer, got ${JSON.stringify(opts.to_line)}`)\n }\n }\n this.info = {\n comment_lines: 0,\n empty_lines: 0,\n invalid_field_length: 0,\n lines: 1,\n records: 0\n }\n this.options = options\n this.state = {\n bomSkipped: false,\n castField: fnCastField,\n commenting: false,\n enabled: options.from_line === 1,\n escaping: false,\n escapeIsQuote: options.escape === options.quote,\n expectedRecordLength: options.columns === null ? 0 : options.columns.length,\n field: new ResizeableBuffer(20),\n firstLineToHeaders: fnFirstLineToHeaders,\n info: Object.assign({}, this.info),\n previousBuf: undefined,\n quoting: false,\n stop: false,\n rawBuffer: new ResizeableBuffer(100),\n record: [],\n recordHasError: false,\n record_length: 0,\n recordDelimiterMaxLength: options.record_delimiter.length === 0 ? 2 : Math.max(...options.record_delimiter.map( (v) => v.length)),\n trimChars: [Buffer.from(' ')[0], Buffer.from('\\t')[0]],\n wasQuoting: false,\n wasRowDelimiter: false\n }\n }\n // Implementation of `Transform._transform`\n _transform(buf, encoding, callback){\n if(this.state.stop === true){\n return\n }\n const err = this.__parse(buf, false)\n if(err !== undefined){\n this.state.stop = true\n }\n callback(err)\n }\n // Implementation of `Transform._flush`\n _flush(callback){\n if(this.state.stop === true){\n return\n }\n const err = this.__parse(undefined, true)\n callback(err)\n }\n // Central parser implementation\n __parse(nextBuf, end){\n const {bom, comment, escape, from, from_line, info, ltrim, max_record_size, quote, raw, relax, rtrim, skip_empty_lines, to, to_line} = this.options\n let {record_delimiter} = this.options\n const {bomSkipped, previousBuf, rawBuffer, escapeIsQuote, trimChars} = this.state\n let buf\n if(previousBuf === undefined){\n if(nextBuf === undefined){\n // Handle empty string\n this.push(null)\n return\n }else{\n buf = nextBuf\n }\n }else if(previousBuf !== undefined && nextBuf === undefined){\n buf = previousBuf\n }else{\n buf = Buffer.concat([previousBuf, nextBuf])\n }\n // Handle UTF BOM\n if(bomSkipped === false){\n if(bom === false){\n this.state.bomSkipped = true\n }else if(buf.length < 3){\n // No enough data\n if(end === false){\n // Wait for more data\n this.state.previousBuf = buf\n return\n }\n // skip BOM detect because data length < 3\n }else{\n if(bom_utf8.compare(buf, 0, 3) === 0){\n // Skip BOM\n buf = buf.slice(3)\n }\n this.state.bomSkipped = true\n }\n }\n const bufLen = buf.length\n let pos\n for(pos = 0; pos < bufLen; pos++){\n // Ensure we get enough space to look ahead\n // There should be a way to move this out of the loop\n if(this.__needMoreData(pos, bufLen, end)){\n break\n }\n if(this.state.wasRowDelimiter === true){\n this.info.lines++\n if(info === true && this.state.record.length === 0 && this.state.field.length === 0 && this.state.wasQuoting === false){\n this.state.info = Object.assign({}, this.info)\n }\n this.state.wasRowDelimiter = false\n }\n if(to_line !== -1 && this.info.lines > to_line){\n this.state.stop = true\n this.push(null)\n return\n }\n // Auto discovery of record_delimiter, unix, mac and windows supported\n if(this.state.quoting === false && record_delimiter.length === 0){\n const record_delimiterCount = this.__autoDiscoverRowDelimiter(buf, pos)\n if(record_delimiterCount){\n record_delimiter = this.options.record_delimiter\n }\n }\n const chr = buf[pos]\n if(raw === true){\n rawBuffer.append(chr)\n }\n if((chr === cr || chr === nl) && this.state.wasRowDelimiter === false ){\n this.state.wasRowDelimiter = true\n }\n // Previous char was a valid escape char\n // treat the current char as a regular char\n if(this.state.escaping === true){\n this.state.escaping = false\n }else{\n // Escape is only active inside quoted fields\n if(this.state.quoting === true && chr === escape && pos + 1 < bufLen){\n // We are quoting, the char is an escape chr and there is a chr to escape\n if(escapeIsQuote){\n if(buf[pos+1] === quote){\n this.state.escaping = true\n continue\n }\n }else{\n this.state.escaping = true\n continue\n }\n }\n // Not currently escaping and chr is a quote\n // TODO: need to compare bytes instead of single char\n if(this.state.commenting === false && chr === quote){\n if(this.state.quoting === true){\n const nextChr = buf[pos+1]\n const isNextChrTrimable = rtrim && this.__isCharTrimable(nextChr)\n // const isNextChrComment = nextChr === comment\n const isNextChrComment = comment !== null && this.__compareBytes(comment, buf, pos+1, nextChr)\n const isNextChrDelimiter = this.__isDelimiter(nextChr, buf, pos+1)\n const isNextChrRowDelimiter = record_delimiter.length === 0 ? this.__autoDiscoverRowDelimiter(buf, pos+1) : this.__isRecordDelimiter(nextChr, buf, pos+1)\n // Escape a quote\n // Treat next char as a regular character\n // TODO: need to compare bytes instead of single char\n if(chr === escape && nextChr === quote){\n pos++\n }else if(!nextChr || isNextChrDelimiter || isNextChrRowDelimiter || isNextChrComment || isNextChrTrimable){\n this.state.quoting = false\n this.state.wasQuoting = true\n continue\n }else if(relax === false){\n const err = this.__error(`Invalid Closing Quote: got \"${String.fromCharCode(nextChr)}\" at line ${this.info.lines} instead of delimiter, row delimiter, trimable character (if activated) or comment`)\n if(err !== undefined) return err\n }else{\n this.state.quoting = false\n this.state.wasQuoting = true\n // continue\n this.state.field.prepend(quote)\n }\n }else{\n if(this.state.field.length !== 0){\n // In relax mode, treat opening quote preceded by chrs as regular\n if( relax === false ){\n const err = this.__error(`Invalid opening quote at line ${this.info.lines}`)\n if(err !== undefined) return err\n }\n }else{\n this.state.quoting = true\n continue\n }\n }\n }\n if(this.state.quoting === false){\n let recordDelimiterLength = this.__isRecordDelimiter(chr, buf, pos)\n if(recordDelimiterLength !== 0){\n // Do not emit comments which take a full line\n const skipCommentLine = this.state.commenting && (this.state.wasQuoting === false && this.state.record.length === 0 && this.state.field.length === 0)\n if(skipCommentLine){\n this.info.comment_lines++\n // Skip full comment line\n }else{\n // Skip if line is empty and skip_empty_lines activated\n if(skip_empty_lines === true && this.state.wasQuoting === false && this.state.record.length === 0 && this.state.field.length === 0){\n this.info.empty_lines++\n pos += recordDelimiterLength - 1\n continue\n }\n // Activate records emition if above from_line\n if(this.state.enabled === false && this.info.lines + (this.state.wasRowDelimiter === true ? 1: 0 ) >= from_line){\n this.state.enabled = true\n this.__resetField()\n this.__resetRow()\n pos += recordDelimiterLength - 1\n continue\n }else{\n const errField = this.__onField()\n if(errField !== undefined) return errField\n const errRecord = this.__onRow()\n if(errRecord !== undefined) return errRecord\n }\n if(to !== -1 && this.info.records >= to){\n this.state.stop = true\n this.push(null)\n return\n }\n }\n this.state.commenting = false\n pos += recordDelimiterLength - 1\n continue\n }\n if(this.state.commenting){\n continue\n }\n const commentCount = comment === null ? 0 : this.__compareBytes(comment, buf, pos, chr)\n if(commentCount !== 0){\n this.state.commenting = true\n continue\n }\n let delimiterLength = this.__isDelimiter(chr, buf, pos)\n if(delimiterLength !== 0){\n const errField = this.__onField()\n if(errField !== undefined) return errField\n pos += delimiterLength - 1\n continue\n }\n }\n }\n if(this.state.commenting === false){\n if(max_record_size !== 0 && this.state.record_length + this.state.field.length > max_record_size){\n const err = this.__error(`Max Record Size: record exceed the maximum number of tolerated bytes of ${max_record_size} on line ${this.info.lines}`)\n if(err !== undefined) return err\n }\n }\n\n const lappend = ltrim === false || this.state.quoting === true || this.state.field.length !== 0 || !this.__isCharTrimable(chr)\n // rtrim in non quoting is handle in __onField\n const rappend = rtrim === false || this.state.wasQuoting === false\n if( lappend === true && rappend === true ){\n this.state.field.append(chr)\n }else if(rtrim === true && !this.__isCharTrimable(chr)){\n const err = this.__error(`Invalid Closing Quote: found non trimable byte after quote at line ${this.info.lines}`)\n if(err !== undefined) return err\n }\n }\n if(end === true){\n if(this.state.quoting === true){\n const err = this.__error(`Invalid Closing Quote: quote is not closed at line ${this.info.lines}`)\n if(err !== undefined) return err\n }else{\n // Skip last line if it has no characters\n if(this.state.wasQuoting === true || this.state.record.length !== 0 || this.state.field.length !== 0){\n const errField = this.__onField()\n if(errField !== undefined) return errField\n const errRecord = this.__onRow()\n if(errRecord !== undefined) return errRecord\n }else if(this.state.wasRowDelimiter === true){\n this.info.empty_lines++\n }else if(this.state.commenting === true){\n this.info.comment_lines++\n }\n }\n }else{\n this.state.previousBuf = buf.slice(pos)\n }\n if(this.state.wasRowDelimiter === true){\n this.info.lines++\n this.state.wasRowDelimiter = false\n }\n }\n // Helper to test if a character is a space or a line delimiter\n __isCharTrimable(chr){\n return chr === space || chr === tab || chr === cr || chr === nl\n }\n __onRow(){\n const {columns, info, from, relax_column_count, raw, skip_lines_with_empty_values} = this.options\n const {enabled, record} = this.state\n // Convert the first line into column names\n if(columns === true){\n return this.__firstLineToColumns(record)\n }\n const recordLength = record.length\n if(columns === false && this.info.records === 0){\n this.state.expectedRecordLength = recordLength\n }else if(enabled === true){\n if(recordLength !== this.state.expectedRecordLength){\n if(relax_column_count === true){\n this.info.invalid_field_length++\n }else{\n if(columns === false){\n const err = this.__error(`Invalid Record Length: expect ${this.state.expectedRecordLength}, got ${recordLength} on line ${this.info.lines}`)\n if(err !== undefined) return err\n }else{\n const err = this.__error(`Invalid Record Length: header length is ${columns.length}, got ${recordLength} on line ${this.info.lines}`)\n if(err !== undefined) return err\n }\n }\n }\n }\n if(enabled === false){\n return this.__resetRow()\n }\n if(skip_lines_with_empty_values === true){\n if(record.map( (field) => field.trim() ).join('') === ''){\n this.__resetRow()\n return\n }\n }\n if(this.state.recordHasError === true){\n this.__resetRow()\n this.state.recordHasError = false\n return\n }\n this.info.records++\n if(from === 1 || this.info.records >= from){\n if(columns !== false){\n const obj = {}\n // Transform record array to an object\n for(let i in record){\n if(columns[i] === undefined || columns[i].disabled) continue\n obj[columns[i].name] = record[i]\n }\n const {objname} = this.options\n if(objname === undefined){\n if(raw === true || info === true){\n this.push(Object.assign(\n {record: obj},\n (raw === true ? {raw: this.state.rawBuffer.toString()}: {}),\n (info === true ? {info: this.state.info}: {})\n ))\n }else{\n this.push(obj)\n }\n }else{\n if(raw === true || info === true){\n this.push(Object.assign(\n {record: [obj[objname], obj]},\n raw === true ? {raw: this.state.rawBuffer.toString()}: {},\n info === true ? {info: this.state.info}: {}\n ))\n }else{\n this.push([obj[objname], obj])\n }\n }\n }else{\n if(raw === true || info === true){\n this.push(Object.assign(\n {record: record},\n raw === true ? {raw: this.state.rawBuffer.toString()}: {},\n info === true ? {info: this.state.info}: {}\n ))\n }else{\n this.push(record)\n }\n }\n }\n this.__resetRow()\n }\n __firstLineToColumns(record){\n const {firstLineToHeaders} = this.state\n try{\n // record = record.filter(function(field){ return field !== undefined})\n const headers = firstLineToHeaders === undefined ? record : firstLineToHeaders.call(null, record)\n if(!Array.isArray(headers)){\n return this.__error(`Invalid Header Mapping: expect an array, got ${JSON.stringify(headers)}`)\n }\n const normalizedHeaders = normalizeColumnsArray(headers)\n this.state.expectedRecordLength = normalizedHeaders.length\n this.options.columns = normalizedHeaders\n this.__resetRow()\n return\n }catch(err){\n return err\n }\n }\n __resetRow(){\n const {info} = this.options\n if(this.options.raw === true){\n this.state.rawBuffer.reset()\n }\n this.state.record = []\n this.state.record_length = 0\n }\n __onField(){\n const {cast, rtrim, max_record_size} = this.options\n const {enabled, wasQuoting} = this.state\n // Deal with from_to options\n if(this.options.columns !== true && enabled === false){\n return this.__resetField()\n }\n let field = this.state.field.toString()\n if(rtrim === true && wasQuoting === false){\n field = field.trimRight()\n }\n if(cast === true){\n const [err, f] = this.__cast(field)\n if(err !== undefined) return err\n field = f\n }\n this.state.record.push(field)\n // Increment record length if record size must not exceed a limit\n if(max_record_size !== 0 && typeof field === 'string'){\n this.state.record_length += field.length\n }\n this.__resetField()\n }\n __resetField(){\n this.state.field.reset()\n this.state.wasQuoting = false\n }\n // Return a tuple with the error and the casted value\n __cast(field){\n const isColumns = Array.isArray(this.options.columns)\n // Dont loose time calling cast if the field wont be part of the final record\n if( isColumns === true && this.options.columns.length <= this.state.record.length ){\n return [undefined, undefined]\n }\n const context = {\n column: isColumns === true ?\n this.options.columns[this.state.record.length].name :\n this.state.record.length,\n empty_lines: this.info.empty_lines,\n header: this.options.columns === true,\n index: this.state.record.length,\n invalid_field_length: this.info.invalid_field_length,\n quoting: this.state.wasQuoting,\n lines: this.info.lines,\n records: this.info.records\n }\n if(this.state.castField !== null){\n try{\n return [undefined, this.state.castField.call(null, field, context)]\n }catch(err){\n return [err]\n }\n }\n if(this.__isFloat(field)){\n return [undefined, parseFloat(field)]\n }else if(this.options.cast_date !== false){\n return [undefined, this.options.cast_date.call(null, field, context)]\n }\n return [undefined, field]\n }\n // Keep it in case we implement the `cast_int` option\n // __isInt(value){\n // // return Number.isInteger(parseInt(value))\n // // return !isNaN( parseInt( obj ) );\n // return /^(\\-|\\+)?[1-9][0-9]*$/.test(value)\n // }\n __isFloat(value){\n return (value - parseFloat( value ) + 1) >= 0 // Borrowed from jquery\n }\n __compareBytes(sourceBuf, targetBuf, pos, firtByte){\n if(sourceBuf[0] !== firtByte) return 0\n const sourceLength = sourceBuf.length\n for(let i = 1; i < sourceLength; i++){\n if(sourceBuf[i] !== targetBuf[pos+i]) return 0\n }\n return sourceLength\n }\n __needMoreData(i, bufLen, end){\n if(end){\n return false\n }\n const {comment, delimiter, escape} = this.options\n const {quoting, recordDelimiterMaxLength} = this.state\n const numOfCharLeft = bufLen - i - 1\n const requiredLength = Math.max(\n // Skip if the remaining buffer smaller than comment\n comment ? comment.length : 0,\n // Skip if the remaining buffer smaller than row delimiter\n recordDelimiterMaxLength,\n // Skip if the remaining buffer can be row delimiter following the closing quote\n // 1 is for quote.length\n quoting ? (1 + recordDelimiterMaxLength) : 0,\n // Skip if the remaining buffer can be delimiter\n delimiter.length,\n // Skip if the remaining buffer can be escape sequence\n // 1 is for escape.length\n 1\n )\n return numOfCharLeft < requiredLength\n }\n __isDelimiter(chr, buf, pos){\n const {delimiter} = this.options\n const delLength = delimiter.length\n if(delimiter[0] !== chr) return 0\n for(let i = 1; i < delLength; i++){\n if(delimiter[i] !== buf[pos+i]) return 0\n }\n return delimiter.length\n }\n __isRecordDelimiter(chr, buf, pos){\n const {record_delimiter} = this.options\n const recordDelimiterLength = record_delimiter.length\n loop1: for(let i = 0; i < recordDelimiterLength; i++){\n const rd = record_delimiter[i]\n const rdLength = rd.length\n if(rd[0] !== chr){\n continue\n }\n for(let j = 1; j < rdLength; j++){\n if(rd[j] !== buf[pos+j]){\n continue loop1\n }\n }\n return rd.length\n }\n return 0\n }\n __autoDiscoverRowDelimiter(buf, pos){\n const chr = buf[pos]\n if(chr === cr){\n if(buf[pos+1] === nl){\n this.options.record_delimiter.push(Buffer.from('\\r\\n'))\n this.state.recordDelimiterMaxLength = 2\n return 2\n }else{\n this.options.record_delimiter.push(Buffer.from('\\r'))\n this.state.recordDelimiterMaxLength = 1\n return 1\n }\n }else if(chr === nl){\n this.options.record_delimiter.push(Buffer.from('\\n'))\n this.state.recordDelimiterMaxLength = 1\n return 1\n }\n return 0\n }\n __error(msg){\n const {skip_lines_with_error} = this.options\n const err = new Error(msg)\n if(skip_lines_with_error){\n this.state.recordHasError = true\n this.emit('skip', err)\n return undefined\n }else{\n return err\n }\n }\n}\n\nconst parse = function(){\n let data, options, callback\n for(let i in arguments){\n const argument = arguments[i]\n const type = typeof argument\n if(data === undefined && (typeof argument === 'string' || Buffer.isBuffer(argument))){\n data = argument\n }else if(options === undefined && isObject(argument)){\n options = argument\n }else if(callback === undefined && type === 'function'){\n callback = argument\n }else{\n throw new Error(`Invalid argument: got ${JSON.stringify(argument)} at index ${i}`)\n }\n }\n const parser = new Parser(options)\n if(callback){\n const records = options === undefined || options.objname === undefined ? [] : {}\n parser.on('readable', function(){\n let record\n while(record = this.read()){\n if(options === undefined || options.objname === undefined){\n records.push(record)\n }else{\n records[record[0]] = record[1]\n }\n }\n })\n parser.on('error', function(err){\n callback(err, undefined, parser.info)\n })\n parser.on('end', function(){\n callback(undefined, records, parser.info)\n })\n }\n if(data !== undefined){\n parser.write(data)\n parser.end()\n }\n return parser\n}\n\nparse.Parser = Parser\n\nmodule.exports = parse\n\nconst underscore = function(str){\n return str.replace(/([A-Z])/g, function(_, match, index){\n return '_' + match.toLowerCase()\n })\n}\n\nconst isObject = function(obj){\n return (typeof obj === 'object' && obj !== null && !Array.isArray(obj))\n}\n\nconst normalizeColumnsArray = function(columns){\n // console.log('columns', columns)\n const normalizedColumns = [];\n\n for(let i=0; i< columns.length; i++){\n const column = columns[i]\n if(column === undefined || column === null || column === false){\n normalizedColumns[i] = { disabled: true }\n }else if(typeof column === 'string'){\n normalizedColumns[i] = { name: column }\n }else if(isObject(column)){\n if(typeof column.name !== 'string'){\n throw new Error(`Invalid Option columns: property \"name\" is required at position ${i} when column is an object literal`)\n }\n normalizedColumns[i] = column\n }else{\n throw new Error(`Invalid Option columns: expect a string or an object, got ${JSON.stringify(column)} at position ${i}`)\n }\n }\n // console.log(normalizedColumns)\n return normalizedColumns;\n}\n","import { FlightLogHeader } from './types';\n\nexport const INT_FIELDS = new Set([\n FlightLogHeader.AircraftBatteryCell1Voltage,\n FlightLogHeader.AircraftBatteryCell2Voltage,\n FlightLogHeader.AircraftBatteryCell3Voltage,\n FlightLogHeader.AircraftBatteryCell4Voltage,\n FlightLogHeader.AircraftBatteryCharge,\n FlightLogHeader.AircraftBatteryCurrent,\n FlightLogHeader.AircraftBatteryTemperature,\n FlightLogHeader.AircraftBatteryVoltage,\n FlightLogHeader.AircraftCameraLensFocusModeValue,\n FlightLogHeader.AircraftCameraLensFocusStatusValue,\n FlightLogHeader.AircraftCameraModeValue,\n FlightLogHeader.AircraftFlightModeValue,\n FlightLogHeader.AircraftGPSSignalValue,\n FlightLogHeader.AircraftNoFlyValue,\n FlightLogHeader.AircraftSatellites,\n FlightLogHeader.GimbalModeValue,\n FlightLogHeader.AircraftSmartGoHomeRadius,\n FlightLogHeader.AircraftSmartGoHomeCountdown,\n FlightLogHeader.AircraftVelocityX,\n FlightLogHeader.AircraftVelocityY,\n FlightLogHeader.AircraftVelocityZ,\n FlightLogHeader.RCHorizontalAccuaracy,\n FlightLogHeader.RCLatitude,\n FlightLogHeader.RCLongitude,\n FlightLogHeader.LandingGearStatusValue,\n FlightLogHeader.LandingGearModeValue,\n FlightLogHeader.RCStateValue,\n FlightLogHeader.RCLandingGearValue,\n]);\n\nexport const FLOAT_FIELDS = new Set([\n FlightLogHeader.AircraftBarometricAltitude,\n FlightLogHeader.AircraftBatteryPowerPercent,\n FlightLogHeader.AircraftCameraSDCardRemainingPercent,\n FlightLogHeader.AircraftHeading,\n FlightLogHeader.AircraftLatitude,\n FlightLogHeader.AircraftLongitude,\n FlightLogHeader.AircraftNoFlyLatitude,\n FlightLogHeader.AircraftNoFlyLongitude,\n FlightLogHeader.AircraftNoFlyRadius,\n FlightLogHeader.AircraftPitch,\n FlightLogHeader.AircraftRoll,\n FlightLogHeader.AircraftSmartGoHomeFlightReturnTime,\n FlightLogHeader.AircraftSmartGoHomeFlightTimeRemaining,\n FlightLogHeader.AircraftSmartGoHomeLandingPower,\n FlightLogHeader.AircraftSmartGoHomeLandingTime,\n FlightLogHeader.AircraftSmartGoHomeReturnPower,\n FlightLogHeader.AircraftSpeed,\n FlightLogHeader.AircraftUltrasonicAltitude,\n FlightLogHeader.DeviceToAircraftDistance,\n FlightLogHeader.ElapsedTime,\n FlightLogHeader.GimbalPitch,\n FlightLogHeader.GimbalPitchAtStop,\n FlightLogHeader.GimbalRoll,\n FlightLogHeader.GimbalRollAtStop,\n FlightLogHeader.GimbalYaw,\n FlightLogHeader.GimbalYawAtStop,\n FlightLogHeader.HomeLatitude,\n FlightLogHeader.HomeLongitude,\n FlightLogHeader.RCBatteryPercentRemaining,\n FlightLogHeader.RCLeftHorizontal,\n FlightLogHeader.RCRightHorizontal,\n FlightLogHeader.RCLeftVertical,\n FlightLogHeader.RCRightVertical,\n]);\n\nexport const BOOL_FIELDS = new Set([\n FlightLogHeader.AircraftCameraBurstCapture,\n FlightLogHeader.AircraftCameraIntervalCapture,\n FlightLogHeader.AircraftCameraLensAFAssistant,\n FlightLogHeader.AircraftCameraLensAFEnabled,\n FlightLogHeader.AircraftCameraLensAssistantWorking,\n FlightLogHeader.AircraftCameraOverheated,\n FlightLogHeader.AircraftCameraRawCapture,\n FlightLogHeader.AircraftCameraBurstCapture,\n FlightLogHeader.AircraftCameraRecording,\n FlightLogHeader.AircraftCameraSDCardExists,\n FlightLogHeader.AircraftCameraSensorError,\n FlightLogHeader.AircraftCameraSingleCapture,\n FlightLogHeader.AircraftCameraStoringPhoto,\n FlightLogHeader.AircraftFlying,\n FlightLogHeader.AircraftIMUPreheating,\n FlightLogHeader.AircraftMotorsOn,\n FlightLogHeader.AircraftSmartGoHomeRequesting,\n FlightLogHeader.AircraftUltrasonicOn,\n FlightLogHeader.AircraftVisionOn,\n FlightLogHeader.LandingGearIsMovable,\n FlightLogHeader.RCGoHome,\n FlightLogHeader.RCRecord,\n FlightLogHeader.RCShutter,\n FlightLogHeader.RCPlayback,\n FlightLogHeader.RCPause,\n FlightLogHeader.RCCustom1,\n FlightLogHeader.RCCustom2,\n FlightLogHeader.RCSattelites,\n FlightLogHeader.RCGSPDataIsValid,\n FlightLogHeader.RCLeftHorizontal,\n FlightLogHeader.RCRightHorizontal,\n FlightLogHeader.RCLeftVertical,\n FlightLogHeader.RCRightVertical,\n FlightLogHeader.AircraftCameraChangeableLensSupported,\n FlightLogHeader.AircraftCameraLensInstalled,\n FlightLogHeader.AircraftCameraLensMFAssistant,\n]);\n\nexport const DATE_FIELDS = new Set([\n FlightLogHeader.DateTime,\n]);\n","import parse from 'csv-parse';\n\nimport { FlightLogRow, FlightLogHeader, FlightLogMetaData, FlightLog, FlightLogEvent } from './types';\nimport { INT_FIELDS, BOOL_FIELDS, FLOAT_FIELDS, DATE_FIELDS } from './field-types';\n\nconst syncParse = require('csv-parse/lib/sync');\n\n\nconst META_REGEX = {\n appVersion: /^#DroneDeploy\\s+(.+)$/,\n sessionId: /^Session ID\\s+(.+)$/,\n sessionStart: /^Session Start\\s+(.+)$/,\n sessionEnd: /^Date\\/Time \\(UTC\\)\\s+(.+)$/,\n deviceModel: /^Device Model\\s+(.+)$/,\n deviceOS: /^Device Operating System\\s+(.+)$/,\n aircraftModel: /^Aircraft Model\\s+(.+)$/,\n aircraftName: /^Aircraft Name\\s+(.+)$/,\n aircraftFirmware: /^Aircraft Firmware\\s+(.+)$/,\n batteryChargeVolume: /^Full Charge Volume \\(mAh\\)\\s+(.+)$/,\n batteryRemainingLife: /^Remaining Life \\(%\\)\\s+(.+)$/,\n batteryDischarges: /^Discharges\\s+(.+)$/,\n batteryCells: /^Battery Cells Number\\s+(.+)$/,\n batterySerialNumber: /^Battery Serial Number\\s+(.+)$/,\n batteryFirmware: /^Battery Firmware\\s+(.+)$/,\n fcSerialNumber: /^Flight Controller Serial Number\\s+(.+)$/,\n fcFirmware: /^Flight Controller Firmware\\s+(.+)$/,\n footerLines: /^#Flight Recorder Session End|^Date\\/Time \\(UTC\\)|^Elapsed Time \\(sec\\)/,\n gimbalFirmware: /^Gimbal Firmware\\s+(.+)$/,\n rcSerialNumber: /^Remote Control Serial Number\\s+(.+)$/,\n rcFirmware: /^Remote Control Firmware\\s+(.+)$/,\n cameraSerialNumber: /^Camera Serial Number\\s+(.+)$/,\n elapsedTime: /^Elapsed Time \\(sec\\)\\s+(.+)$/,\n userId: /^User ID\\s+(.+)$/,\n organizationId: /^Organization ID\\s+(.+)$/,\n platform: /^Platform\\s+(.+)$/,\n};\n\nexport type Subscriber = (value: T) => void;\nexport type ErrorSubscriber = (value: any) => void;\nexport type CompletionSubscriber = () => void;\n\nexport interface QuasiObservable {\n subscribe(sub: Subscriber, errSub?: ErrorSubscriber, completionSub?: CompletionSubscriber): void;\n toPromise(): Promise;\n}\n\nexport class QuasiSubject implements QuasiObservable {\n private subscribers: Subscriber[] = [];\n private errorSubscribers: ErrorSubscriber[] = [];\n private completionSubscribers: CompletionSubscriber[] = [];\n private isFinished = false;\n\n next(value: T) {\n if (this.isFinished) {\n return;\n }\n this.subscribers.forEach((s) => s(value));\n }\n\n complete() {\n if (this.isFinished) {\n return;\n }\n this.isFinished = true;\n this.completionSubscribers.forEach((sub) => sub());\n }\n\n error(error: any) {\n if (this.isFinished) {\n return;\n }\n this.errorSubscribers.forEach((errSub) => errSub(error));\n this.complete();\n }\n\n subscribe(sub: Subscriber, errSub?: ErrorSubscriber, completionSub?: CompletionSubscriber) {\n this.subscribers.push(sub);\n if (errSub) {\n this.errorSubscribers.push(errSub);\n }\n if (completionSub) {\n this.completionSubscribers.push(completionSub);\n }\n }\n\n toPromise(): Promise {\n const source = this;\n return new Promise(function (resolve, reject) {\n let value: T;\n source.subscribe(function (v) {\n value = v;\n }, reject, function () {\n resolve(value);\n });\n });\n }\n}\n\nexport function parseLogStream(logStream: QuasiSubject): QuasiObservable {\n const headerMetaLines: string[] = [];\n let meta = {} as FlightLogMetaData;\n let rowHeaderLine: string;\n let row: FlightLogRow;\n\n const progress = { index: 0, completed: false };\n let end: any;\n const result = new QuasiSubject();\n\n logStream.subscribe((line: string) => {\n line = line.trim();\n if (!line.length) {\n return;\n }\n\n if (!rowHeaderLine) {\n if (line.startsWith(FlightLogHeader.DateTime.split(' ')[0])) { // Strip off timezone.\n rowHeaderLine = line;\n meta = parseMetaData(headerMetaLines, []);\n result.next({\n meta,\n rowIndex: progress.index\n });\n } else {\n headerMetaLines.push(line);\n progress.index++;\n }\n return;\n }\n\n if (META_REGEX.footerLines.test(line)) {\n if (META_REGEX.sessionEnd.test(line)) {\n end = fromUtcDateStr(findMatch([line], META_REGEX.sessionEnd));\n } else if (META_REGEX.elapsedTime.test(line)) {\n const elapsed = findMatch([line], META_REGEX.elapsedTime);\n\n // This is the end of the parsing. Because normal lines are parsed through a Promise, they will be delivered\n // asynchronously. So we must ensure that this result is also delivered asynchronously.\n setTimeout(() => {\n const parsedElapsed = elapsed === 'N/A' ? 0 : parseFloat(elapsed);\n if (parsedElapsed) {\n meta.session.elapsed = parsedElapsed;\n }\n if (end) {\n meta.session.end = end;\n }\n result.next({\n meta,\n rowIndex: progress.index++,\n });\n result.complete();\n progress.completed = true;\n }, 0);\n }\n } else {\n parseBody([rowHeaderLine, line], true).then((rows) => {\n row = rows[0];\n meta.session.end = row[FlightLogHeader.DateTime];\n meta.session.elapsed = row[FlightLogHeader.ElapsedTime];\n result.next({\n meta,\n rowIndex: progress.index++,\n row,\n info: parseJsonInfo(row.Info), // Parsed Info column, if the column was populated with a JSON array.\n })\n });\n }\n\n }, (err) => { console.error('parsing error: ' + err); result.complete(); }, () => {\n if (!progress.completed) {\n setTimeout(() => {\n result.complete();\n progress.completed = true;\n }, 0);\n }\n });\n\n return result;\n}\n\nexport function parseLog(log: String): Promise {\n const lines = log.split('\\n');\n const subject = new QuasiSubject();\n const parse = parseLogStream(subject);\n\n const flightLog: FlightLog = {\n metaData: {} as FlightLogMetaData,\n rows: [],\n infos: []\n }\n parse.subscribe((event) => {\n // The metadata is updated as the file is parsed, so always grab the latest one.\n flightLog.metaData = (event.meta) ? event.meta : flightLog.metaData;\n if (event.row) {\n flightLog.rows.push(event.row);\n }\n if (event.info) {\n // @ts-ignore\n flightLog.infos.push(event.info);\n }\n });\n lines.forEach(l => subject.next(l));\n subject.complete();\n\n return new Promise((resolve, reject) => {\n parse.toPromise().then(() => resolve(flightLog)).catch((reason => reject(reason)));\n });\n}\n\nfunction parseBody(lines: string[], sync?: boolean): Promise {\n const text = lines.join('\\n');\n const options = {\n delimiter: '\\t',\n escape: null,\n from: 1,\n quote: null,\n relax_column_count: true,\n };\n\n return new Promise((resolve, reject) => {\n const onResults = (err: any, result: string[]) => {\n if (err) {\n return reject(err);\n }\n\n const [headers, ...rows] = result;\n\n const logs = rows.map((row) => {\n const log = {} as FlightLogRow;\n for (let i = 0; i < headers.length; i++) {\n const header = headers[i].trim() as FlightLogHeader;\n let value: any = row[i];\n\n if (INT_FIELDS.has(header)) {\n value = parseInt(value, 10);\n }\n\n if (FLOAT_FIELDS.has(header)) {\n value = parseFloat(value);\n }\n\n if (BOOL_FIELDS.has(header)) {\n value = value !== '0';\n }\n\n if (DATE_FIELDS.has(header)) {\n value = fromUtcDateStr(value);\n }\n\n log[header] = value;\n }\n\n return log;\n });\n\n resolve(logs);\n };\n if (sync) {\n const results = syncParse(text, options);\n onResults(undefined, results);\n } else {\n // @ts-ignore\n parse(text, options, onResults);\n }\n });\n}\n\nfunction findMatch(search: string[], regex: RegExp, isNum?: boolean) {\n let match;\n for (let str of search) {\n match = str.match(regex);\n if (match) {\n break;\n }\n }\n\n if (!match) {\n return isNum ? '0' : 'N/A';\n }\n\n return match[1];\n}\n\nfunction isValidDate(d: any) {\n return d instanceof Date && !isNaN(d as any);\n}\n\nexport function fromUtcDateStr(utcDateStr: string) {\n if (isValidDate(utcDateStr)) {\n return utcDateStr as any as Date;\n }\n const isBadDate = !utcDateStr || !utcDateStr.trim().length || utcDateStr === 'N/A';\n if (isBadDate) {\n return null;\n }\n if (!/Z$/.test(utcDateStr)) {\n utcDateStr = utcDateStr + '.000Z';\n }\n return new Date(utcDateStr);\n}\n\nfunction parseMetaData(headers: string[], footers: string[]): FlightLogMetaData {\n const meta = [...headers, ...footers];\n let end = findMatch(meta, META_REGEX.sessionEnd);\n let elapsed = findMatch(meta, META_REGEX.elapsedTime);\n\n // if we weren't able to parse an end date or an elapsed time from our footer (which is really just the last three\n // lines of the log file), it's likely that we have a truncated log file. if that's the case, we can still salvage\n // some valid data by parsing the date and elapsed time from the very last log row in the file, which is what we're\n // doing below. it's pretty brittle, but it's preferred to having an invalid end date and a NaN elapsed time.\n if ((end === 'N/A' || elapsed === 'N/A') && footers.length > 0) {\n const lastLine = footers[footers.length - 1];\n const pieces = lastLine.split('\\t');\n\n // if we don't have at least two pieces, i don't know what is in `footer` so i'm just going to leave it alone\n if (pieces.length >= 2) {\n end = pieces[0];\n elapsed = pieces[1];\n }\n }\n\n return {\n appVersion: findMatch(meta, META_REGEX.appVersion),\n session: {\n id: findMatch(meta, META_REGEX.sessionId),\n start: fromUtcDateStr(findMatch(meta, META_REGEX.sessionStart)) as Date,\n end: fromUtcDateStr(end),\n elapsed: elapsed === 'N/A' ? 0 : parseFloat(elapsed),\n },\n device: {\n model: findMatch(meta, META_REGEX.deviceModel),\n os: findMatch(meta, META_REGEX.deviceOS).replace(/\\t/g, ' '),\n platform: findMatch(meta, META_REGEX.platform),\n },\n aircraft: {\n model: findMatch(meta, META_REGEX.aircraftModel),\n name: findMatch(meta, META_REGEX.aircraftName),\n firmware: findMatch(meta, META_REGEX.aircraftFirmware),\n },\n battery: {\n chargeVolume: parseInt(findMatch(meta, META_REGEX.batteryChargeVolume, true), 10),\n remainingLifePercent: parseInt(findMatch(meta, META_REGEX.batteryRemainingLife, true), 10),\n discharges: parseInt(findMatch(meta, META_REGEX.batteryDischarges, true), 10),\n cells: parseInt(findMatch(meta, META_REGEX.batteryCells, true), 10),\n firmware: findMatch(meta, META_REGEX.batteryFirmware),\n serialNumber: findMatch(meta, META_REGEX.batterySerialNumber),\n },\n flightController: {\n serialNumber: findMatch(meta, META_REGEX.fcSerialNumber),\n firmware: findMatch(meta, META_REGEX.fcFirmware),\n },\n gimbal: {\n firmware: findMatch(meta, META_REGEX.gimbalFirmware),\n },\n remoteController: {\n serialNumber: findMatch(meta, META_REGEX.rcSerialNumber),\n firmware: findMatch(meta, META_REGEX.rcFirmware),\n },\n camera: {\n serialNumber: findMatch(meta, META_REGEX.cameraSerialNumber),\n },\n user: {\n userId: findMatch(meta, META_REGEX.userId),\n organizationId: findMatch(meta, META_REGEX.organizationId),\n },\n };\n}\n\n/**\n * Parse out the given string and return an object if the string is JSON, return undefined otherwise.\n *\n * @param info\n */\nfunction parseJsonInfo(info: string): undefined|Array {\n if (!info) {\n return undefined;\n }\n try {\n return JSON.parse(info);\n }\n catch (e) {\n return undefined;\n }\n}\n"],"names":[],"mappings":";;IAAY,gBAuIX;AAvID,CAAA,UAAY,eAAe,EAAA;AACzB,IAAA,eAAA,CAAA,UAAA,CAAA,GAAA,iBAA4B,CAAA;AAC5B,IAAA,eAAA,CAAA,aAAA,CAAA,GAAA,oBAAkC,CAAA;AAClC,IAAA,eAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,eAAA,CAAA,gBAAA,CAAA,GAAA,2BAA4C,CAAA;AAC5C,IAAA,eAAA,CAAA,iBAAA,CAAA,GAAA,4BAA8C,CAAA;AAC9C,IAAA,eAAA,CAAA,2BAAA,CAAA,GAAA,mCAA+D,CAAA;AAC/D,IAAA,eAAA,CAAA,6BAAA,CAAA,GAAA,4BAA0D,CAAA;AAC1D,IAAA,eAAA,CAAA,uBAAA,CAAA,GAAA,+BAAuD,CAAA;AACvD,IAAA,eAAA,CAAA,wBAAA,CAAA,GAAA,+BAAwD,CAAA;AACxD,IAAA,eAAA,CAAA,wBAAA,CAAA,GAAA,+BAAwD,CAAA;AACxD,IAAA,eAAA,CAAA,4BAAA,CAAA,GAAA,2CAAwE,CAAA;AACxE,IAAA,eAAA,CAAA,4BAAA,CAAA,GAAA,oCAAiE,CAAA;AACjE,IAAA,eAAA,CAAA,6BAAA,CAAA,GAAA,iCAA+D,C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,CAAC;YACxD,QAAQ,EAAE,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC,UAAU,CAAC;AACjD,SAAA;AACD,QAAA,MAAM,EAAE;YACN,QAAQ,EAAE,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC,cAAc,CAAC;AACrD,SAAA;AACD,QAAA,gBAAgB,EAAE;YAChB,YAAY,EAAE,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC,cAAc,CAAC;YACxD,QAAQ,EAAE,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC,UAAU,CAAC;AACjD,SAAA;AACD,QAAA,MAAM,EAAE;YACN,YAAY,EAAE,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC,kBAAkB,CAAC;AAC7D,SAAA;AACD,QAAA,IAAI,EAAE;YACJ,MAAM,EAAE,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC;YAC1C,cAAc,EAAE,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC,cAAc,CAAC;AAC3D,SAAA;KACF,CAAC;AACJ,CAAC;AAED;;;;AAIG;AACH,SAAS,aAAa,CAAC,IAAY,EAAA;IACjC,IAAI,CAAC,IAAI,EAAE;AACT,QAAA,OAAO,SAAS,CAAC;AAClB,KAAA;IACD,IAAI;AACF,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACzB,KAAA;AACD,IAAA,OAAO,CAAC,EAAE;AACR,QAAA,OAAO,SAAS,CAAC;AAClB,KAAA;AACH;;;;","x_google_ignoreList":[1]} \ No newline at end of file +{"version":3,"file":"flight-log-parser.es6.js","sources":["../src/types.ts","../node_modules/csv-parse/lib/index.js","../src/field-types.ts","../src/parser.ts"],"sourcesContent":["export enum FlightLogHeader {\n DateTime = 'Date/Time (UTC)',\n ElapsedTime = 'Elapsed Time (sec)',\n Info = 'Info',\n DeviceLatitude = 'Device Latitude (Degrees)',\n DeviceLongitude = 'Device Longitude (Degrees)',\n DeviceLocationLastUpdated = 'Device Location Last Updated (ms)',\n AircraftBatteryPowerPercent = 'Aircraft Battery Power (%)',\n AircraftBatteryCharge = 'Aircraft Battery Charge (mAh)',\n AircraftBatteryCurrent = 'Aircraft Battery Current (mA)',\n AircraftBatteryVoltage = 'Aircraft Battery Voltage (mV)',\n AircraftBatteryTemperature = 'Aircraft Battery Temperature (Fahrenheit)',\n AircraftBatteryLastUpdated = 'Aircraft Battery Last Updated (ms)',\n AircraftBatteryCell1Voltage = 'Aircraft Battery Cell 1 Voltage',\n AircraftBatteryCell2Voltage = 'Aircraft Battery Cell 2 Voltage',\n AircraftBatteryCell3Voltage = 'Aircraft Battery Cell 3 Voltage',\n AircraftBatteryCell4Voltage = 'Aircraft Battery Cell 4 Voltage',\n AircraftBatteryCellVoltageLastUpdated = 'Aircraft Battery Cell Voltage Last Updated (ms)',\n AircraftLatitude = 'Aircraft Latitude (Degrees)',\n AircraftLongitude = 'Aircraft Longitude (Degrees)',\n AircraftSpeed = 'Aircraft Speed (mph)',\n AircraftBarometricAltitude = 'Aircraft Barometric Altitude (ft)',\n AircraftHeading = 'Aircraft Heading (Degrees)',\n AircraftVelocityX = 'Aircraft Vel - X (mph)',\n AircraftVelocityY = 'Aircraft Vel - Y (mph)',\n AircraftVelocityZ = 'Aircraft Vel - Z (mph)',\n AircraftPitch = 'Aircraft Pitch (Degrees)',\n AircraftRoll = 'Aircraft Roll (Degrees)',\n AircraftSatellites = 'Aircraft Satellites',\n AircraftMotorsOn = 'Aircraft Motors On',\n AircraftFlying = 'Aircraft Flying',\n AircraftFlightMode = 'Aircraft Flight Mode',\n AircraftFlightModeValue = 'Aircraft Flight Mode Value',\n AircraftIMUPreheating = 'Aircraft IMU Preheating',\n AircraftUltrasonicOn = 'Aircraft Ultrasonic On',\n AircraftUltrasonicAltitude = 'Aircraft Ultrasonic Altitude (ft)',\n AircraftVisionOn = 'Aircraft Vision On',\n AircraftGPSSignal = 'Aircraft GPS Signal',\n AircraftGPSSignalValue = 'Aircraft GPS Signal Value',\n AircraftNoFly = 'Aircraft No-fly',\n AircraftNoFlyValue = 'Aircraft No-fly Value',\n AircraftNoFlyLatitude = 'Aircraft No-fly Latitude (Degrees)',\n AircraftNoFlyLongitude = 'Aircraft No-fly Longitude (Degrees)',\n AircraftNoFlyRadius = 'Aircraft No-fly Radius (ft)',\n HomeLatitude = 'Home Latitude (Degrees)',\n HomeLongitude = 'Home Longitude (Degrees)',\n AircraftSmartGoHomeFlightTimeRemaining = 'Aircraft Smart Go-home Flight Time Remaining (sec)',\n AircraftSmartGoHomeFlightReturnTime = 'Aircraft Smart Go-home Flight Return Time (sec)',\n AircraftSmartGoHomeLandingTime = 'Aircraft Smart Go-home Landing Time (sec)',\n AircraftSmartGoHomeReturnPower = 'Aircraft Smart Go-home Return Power (%)',\n AircraftSmartGoHomeLandingPower = 'Aircraft Smart Go-home Landing Power (%)',\n AircraftSmartGoHomeRadius = 'Aircraft Smart Go-home Radius (ft)',\n AircraftSmartGoHomeCountdown = 'Aircraft Smart Go-home Countdown (sec)',\n AircraftSmartGoHomeRequesting = 'Aircraft Smart Go-home Requesting',\n AircraftSystemStateLastUpdated = 'Aircraft System State Last Updated (ms)',\n GimbalPitch = 'Gimbal Pitch (Degrees)',\n GimbalRoll = 'Gimbal Roll (Degrees)',\n GimbalYaw = 'Gimbal Yaw (Degrees)',\n GimbalMode = 'Gimbal Mode',\n GimbalModeValue = 'Gimbal Mode Value',\n GimbalPitchAtStop = 'Gimbal Pitch at Stop',\n GimbalRollAtStop = 'Gimbal Roll at Stop',\n GimbalYawAtStop = 'Gimbal Yaw at Stop',\n GimbalStatusLastUpdated = 'Gimbal Status Last Updated (ms)',\n LandingGearIsMovable = 'Landing Gear is Movable',\n LandingGearStatus = 'Landing Gear Status',\n LandingGearStatusValue = 'Landing Gear Status Value',\n LandingGearMode = 'Landing Gear Mode',\n LandingGearModeValue = 'Landing Gear Mode Value',\n LandingGearLastUpdated = 'Landing Gear Last Updated (ms)',\n RCState = 'RC State',\n RCStateValue = 'RC State Value',\n RCLeftHorizontal = 'RC Left Horizontal',\n RCLeftVertical = 'RC Left Vertical',\n RCRightHorizontal = 'RC Right Horizontal',\n RCRightVertical = 'RC Right Vertical',\n RCLeftWheel = 'RC Left Wheel',\n RCRightWheel = 'RC Right Wheel',\n RCLandingGear = 'RC Landing Gear',\n RCLandingGearValue = 'RC Landing Gear Value',\n RCGoHome = 'RC Go Home',\n RCRecord = 'RC Record ',\n RCShutter = 'RC Shutter',\n RCPlayback = 'RC Playback',\n RCPause = 'RC Pause',\n RCCustom1 = 'RC Custom 1',\n RCCustom2 = 'RC Custom 2',\n RCStateLastUpdated = 'RC State Last Updated (ms)',\n RCBatteryPercentRemaining = 'RC Battery (%)',\n RCBatteryStateLastUpdated = 'RC Battery State Last Updated (ms)',\n RCSattelites = 'RC Sattelites',\n RCHorizontalAccuaracy = 'RC Horizontal Accuaracy (ft)',\n RCLatitude = 'RC Latitude (Degrees)',\n RCLongitude = 'RC Longitude (Degrees)',\n RCGSPDataIsValid = 'RC GSP Data is Valid',\n RCGPSStateLastUpdated = 'RC GPS State Last Updated (ms)',\n RCSignal1 = 'RC Signal 1',\n RCSignal2 = 'RC Signal 2',\n RCSignalLastUpdated = 'RC Signal Last Updated (ms)',\n LBSignal1 = 'LB Signal 1',\n LBSignal2 = 'LB Signal 2',\n LBSignalLastUpdated = 'LB Signal Last Updated (ms)',\n AircraftCameraMode = 'Aircraft Camera Mode',\n AircraftCameraModeValue = 'Aircraft Camera Mode Value',\n AircraftCameraOverheated = 'Aircraft Camera Overheated',\n AircraftCameraSensorError = 'Aircraft Camera Sensor Error',\n AircraftCameraRecording = 'Aircraft Camera Recording',\n AircraftCameraRawCapture = 'Aircraft Camera Raw Capture',\n AircraftCameraIntervalCapture = 'Aircraft Camera Interval Capture',\n AircraftCameraBurstCapture = 'Aircraft Camera Burst Capture',\n AircraftCameraSingleCapture = 'Aircraft Camera Single Capture',\n AircraftCameraStoringPhoto = 'Aircraft Camera Storing Photo',\n AircraftCameraStateLastUpdated = 'Aircraft Camera State Last Updated (ms)',\n AircraftCameraSDCardExists = 'Aircraft Camera SD Card Exists',\n AircraftCameraSDCardRemainingPercent = 'Aircraft Camera SD Card Remaining (%)',\n AircraftCameraSDCardStateLastUpdated = 'Aircraft Camera SD Card State Last Updated (ms)',\n AircraftCameraChangeableLensSupported = 'Aircraft Camera Changeable Lens Supported',\n AircraftCameraLensInstalled = 'Aircraft Camera Lens Installed',\n AircraftCameraLensType = 'Aircraft Camera Lens Type',\n AircraftCameraLensAFEnabled = 'Aircraft Camera Lens AF Enabled',\n AircraftCameraLensFocusMode = 'Aircraft Camera Lens Focus Mode',\n AircraftCameraLensFocusModeValue = 'Aircraft Camera Lens Focus Mode Value',\n AircraftCameraLensFocusStatus = 'Aircraft Camera Lens Focus Status',\n AircraftCameraLensFocusStatusValue = 'Aircraft Camera Lens Focus Status Value',\n AircraftCameraLensMFAssistant = 'Aircraft Camera Lens MF Assistant',\n AircraftCameraLensAFAssistant = 'Aircraft Camera Lens AF Assistant',\n AircraftCameraLensAssistantWorking = 'Aircraft Camera Lens Assistant Working',\n AircraftCameraLensStateLastUpdated = 'Aircraft Camera Lens State Last Updated (ms)',\n CompassIndex = \"Compass Index\",\n CompassSensorValue = \"Compass Sensor Value\",\n CompassState = \"Compass State\",\n CompassStateLastUpdated = \"Compass State Last Updated (ms)\",\n CompassCalibrationState = \"Compass Calibration State\",\n CompassCalibrationLastUpdated = \"Compass Calibration Last Updated (ms)\",\n DeviceToAircraftDistance = 'Device > Aircraft Distance - XY (ft)',\n}\n\nexport type FlightLogRow = {\n [prop in FlightLogHeader]: any // because csv\n};\n\nexport type FlightLogMetaData = {\n appVersion: string;\n session: {\n id: string;\n start: Date;\n end: Date | null;\n elapsed: number;\n };\n device: {\n model: string;\n os: string;\n platform: string;\n };\n aircraft: {\n model: string;\n name: string;\n firmware: string;\n };\n battery: {\n chargeVolume: number;\n remainingLifePercent: number;\n discharges: number;\n cells: number;\n firmware: string;\n serialNumber: string;\n };\n flightController: {\n serialNumber: string;\n firmware: string;\n };\n gimbal: {\n firmware: string;\n };\n remoteController: {\n serialNumber: string;\n firmware: string;\n };\n camera: {\n serialNumber: string;\n };\n user: {\n userId: string;\n organizationId: string;\n };\n};\n\nexport type FlightLog = {\n metaData: FlightLogMetaData;\n rows: FlightLogRow[];\n infos: any[];\n};\n\nexport type FlightLogEvent = {\n meta: FlightLogMetaData;\n rowIndex?: number;\n row?: FlightLogRow;\n info?: undefined|Array; // Empty string => undefined, else parsed JSON blob.\n};\n\n// based off of types in ios/android SDK FlightMode enums\nexport const FLIGHT_MODE_MAPPING_V4 = {\n 0: 'Manual',\n 1: 'Attitude',\n 2: 'Attitude Course Lock',\n 3: 'Attitude Hover',\n 4: 'Hover',\n 5: 'GPS Brake',\n 6: 'GPS Attitude',\n 7: 'GPS Course Lock',\n 8: 'GPS Home',\n 9: 'GPS Hotpoint',\n 10: 'Assisted Takeoff',\n 11: 'Auto Takeoff',\n 12: 'Auto Landing',\n 13: 'Attitude Landing',\n 14: 'GPS Waypoint',\n 15: 'Go Home',\n 16: 'Click Go',\n 17: 'Joystick',\n 18: 'Attitude Limited',\n 19: 'Cinematic',\n 23: 'Attitude Limited',\n 24: 'Draw',\n 25: 'GPS Follow Me',\n 26: 'ActiveTrack',\n 27: 'TapFly',\n 28: 'Pano',\n 29: 'Farming',\n 30: 'FPV',\n 31: 'GPS Sport',\n 32: 'GPS Novice',\n 33: 'Confirm Landing',\n 35: 'Terrain Follow',\n 36: 'Palm Control',\n 37: 'Quick Shot',\n 38: 'Tripod',\n 39: 'ActiveTrack Spotlight',\n 41: 'Motors Just Started',\n 43: 'GPS Gentle',\n 255: 'Unknown',\n};\n\nexport const FLIGHT_MODE_MAPPING_V5 = {\n 0: 'Manual',\n 1: 'Attitude',\n 2: 'GPS Normal',\n 3: 'POI',\n 4: 'Takeoff Ready',\n 5: 'Auto Takeoff',\n 6: 'Auto Landing',\n 7: 'Waypoint',\n 8: 'Go Home',\n 9: 'Virtual Stick',\n 10: 'Smart Flight',\n 11: 'Pano',\n 12: 'GPS Sport',\n 13: 'GPS Tripod',\n 14: 'Auto Avoidance',\n 15: 'Smart Fly',\n 16: 'Force Landing',\n 17: 'Attitude Landing',\n 18: 'Click Go',\n 19: 'Cinematic',\n 20: 'Draw',\n 21: 'GPS Follow Me',\n 22: 'GPS Novice',\n 23: 'Quick Movie',\n 24: 'Tap Fly',\n 25: 'Master Shot',\n 26: 'APAS',\n 27: 'Timelapse',\n 28: 'Motors Start',\n 29: 'Unknown',\n};\n","\n/*\nCSV Parse\n\nPlease look at the [project documentation](https://csv.js.org/parse/) for additional\ninformation.\n*/\n\nconst { Transform } = require('stream')\nconst ResizeableBuffer = require('./ResizeableBuffer')\n\nconst cr = 13\nconst nl = 10\nconst space = 32\nconst tab = 9\nconst bom_utf8 = Buffer.from([239, 187, 191])\n\nclass Parser extends Transform {\n constructor(opts = {}){\n super({...{readableObjectMode: true}, ...opts})\n const options = {}\n // Merge with user options\n for(let opt in opts){\n options[underscore(opt)] = opts[opt]\n }\n // Normalize option `bom`\n if(options.bom === undefined || options.bom === null || options.bom === false){\n options.bom = false\n }else if(options.bom !== true){\n throw new Error(`Invalid Option: bom must be true, got ${JSON.stringify(options.bom)}`)\n }\n // Normalize option `cast`\n let fnCastField = null\n if(options.cast === undefined || options.cast === null || options.cast === false || options.cast === ''){\n options.cast = undefined\n }else if(typeof options.cast === 'function'){\n fnCastField = options.cast\n options.cast = true\n }else if(options.cast !== true){\n throw new Error('Invalid Option: cast must be true or a function')\n }\n // Normalize option `cast_date`\n if(options.cast_date === undefined || options.cast_date === null || options.cast_date === false || options.cast_date === ''){\n options.cast_date = false\n }else if(options.cast_date === true){\n options.cast_date = function(value){\n const date = Date.parse(value)\n return !isNaN(date) ? new Date(date) : value\n }\n }else if(typeof options.cast_date !== 'function'){\n throw new Error('Invalid Option: cast_date must be true or a function')\n }\n // Normalize option `columns`\n let fnFirstLineToHeaders = null\n if(options.columns === true){\n // Fields in the first line are converted as-is to columns\n fnFirstLineToHeaders = undefined\n }else if(typeof options.columns === 'function'){\n fnFirstLineToHeaders = options.columns\n options.columns = true\n }else if(Array.isArray(options.columns)){\n options.columns = normalizeColumnsArray(options.columns)\n }else if(options.columns === undefined || options.columns === null || options.columns === false){\n options.columns = false\n }else{\n throw new Error(`Invalid Option columns: expect an object or true, got ${JSON.stringify(options.columns)}`)\n }\n // Normalize option `comment`\n if(options.comment === undefined || options.comment === null || options.comment === false || options.comment === ''){\n options.comment = null\n }else{\n if(typeof options.comment === 'string'){\n options.comment = Buffer.from(options.comment)\n }\n if(!Buffer.isBuffer(options.comment)){\n throw new Error(`Invalid Option: comment must be a buffer or a string, got ${JSON.stringify(options.comment)}`)\n }\n }\n // Normalize option `delimiter`\n if(options.delimiter === undefined || options.delimiter === null || options.delimiter === false){\n options.delimiter = Buffer.from(',')\n }else if(Buffer.isBuffer(options.delimiter)){\n if(options.delimiter.length === 0){\n throw new Error(`Invalid Option: delimiter must be a non empty buffer`)\n }\n // Great, nothing to do\n }else if(typeof options.delimiter === 'string'){\n if(options.delimiter.length === 0){\n throw new Error(`Invalid Option: delimiter must be a non empty string`)\n }\n options.delimiter = Buffer.from(options.delimiter)\n }else{\n throw new Error(`Invalid Option: delimiter must be a string or a buffer, got ${options.delimiter}`)\n }\n // Normalize option `escape`\n if(options.escape === undefined || options.escape === null){\n options.escape = Buffer.from('\"')\n }else if(typeof options.escape === 'string'){\n options.escape = Buffer.from(options.escape)\n }\n if(!Buffer.isBuffer(options.escape)){\n throw new Error(`Invalid Option: escape must be a buffer or a string, got ${JSON.stringify(options.escape)}`)\n }else if(options.escape.length !== 1){\n throw new Error(`Invalid Option Length: escape must be one character, got ${options.escape.length}`)\n }else{\n options.escape = options.escape[0]\n }\n // Normalize option `from`\n if(options.from === undefined || options.from === null){\n options.from = 1\n }else{\n if(typeof options.from === 'string' && /\\d+/.test(options.from)){\n options.from = parseInt(options.from)\n }\n if(Number.isInteger(options.from)){\n if(options.from < 0){\n throw new Error(`Invalid Option: from must be a positive integer, got ${JSON.stringify(opts.from)}`)\n }\n }else{\n throw new Error(`Invalid Option: from must be an integer, got ${JSON.stringify(options.from)}`)\n }\n }\n // Normalize option `from_line`\n if(options.from_line === undefined || options.from_line === null){\n options.from_line = 1\n }else{\n if(typeof options.from_line === 'string' && /\\d+/.test(options.from_line)){\n options.from_line = parseInt(options.from_line)\n }\n if(Number.isInteger(options.from_line)){\n if(options.from_line <= 0){\n throw new Error(`Invalid Option: from_line must be a positive integer greater than 0, got ${JSON.stringify(opts.from_line)}`)\n }\n }else{\n throw new Error(`Invalid Option: from_line must be an integer, got ${JSON.stringify(opts.from_line)}`)\n }\n }\n // Normalize option `info`\n if(options.info === undefined || options.info === null || options.info === false){\n options.info = false\n }else if(options.info !== true){\n throw new Error(`Invalid Option: info must be true, got ${JSON.stringify(options.info)}`)\n }\n // Normalize option `max_record_size`\n if(options.max_record_size === undefined || options.max_record_size === null || options.max_record_size === false){\n options.max_record_size = 0\n }else if(Number.isInteger(options.max_record_size) && options.max_record_size >= 0){\n // Great, nothing to do\n }else if(typeof options.max_record_size === 'string' && /\\d+/.test(options.max_record_size)){\n options.max_record_size = parseInt(options.max_record_size)\n }else{\n throw new Error(`Invalid Option: max_record_size must be a positive integer, got ${JSON.stringify(options.max_record_size)}`)\n }\n // Normalize option `objname`\n if(options.objname === undefined || options.objname === null || options.objname === false){\n options.objname = undefined\n }else if(Buffer.isBuffer(options.objname)){\n if(options.objname.length === 0){\n throw new Error(`Invalid Option: objname must be a non empty buffer`)\n }\n options.objname = options.objname.toString()\n }else if(typeof options.objname === 'string'){\n if(options.objname.length === 0){\n throw new Error(`Invalid Option: objname must be a non empty string`)\n }\n // Great, nothing to do\n }else{\n throw new Error(`Invalid Option: objname must be a string or a buffer, got ${options.objname}`)\n }\n // Normalize option `quote`\n if(options.quote === null || options.quote === false || options.quote === ''){\n options.quote = null\n }else{\n if(options.quote === undefined || options.quote === true){\n options.quote = Buffer.from('\"')\n }else if(typeof options.quote === 'string'){\n options.quote = Buffer.from(options.quote)\n }\n if(!Buffer.isBuffer(options.quote)){\n throw new Error(`Invalid Option: quote must be a buffer or a string, got ${JSON.stringify(options.quote)}`)\n }else if(options.quote.length !== 1){\n throw new Error(`Invalid Option Length: quote must be one character, got ${options.quote.length}`)\n }else{\n options.quote = options.quote[0]\n }\n }\n // Normalize option `raw`\n if(options.raw === undefined || options.raw === null || options.raw === false){\n options.raw = false\n }else if(options.raw !== true){\n throw new Error(`Invalid Option: raw must be true, got ${JSON.stringify(options.raw)}`)\n }\n // Normalize option `record_delimiter`\n if(!options.record_delimiter){\n options.record_delimiter = []\n }else if(!Array.isArray(options.record_delimiter)){\n options.record_delimiter = [options.record_delimiter]\n }\n options.record_delimiter = options.record_delimiter.map( function(rd){\n if(typeof rd === 'string'){\n rd = Buffer.from(rd)\n }\n return rd\n })\n // Normalize option `relax`\n if(typeof options.relax === 'boolean'){\n // Great, nothing to do\n }else if(options.relax === undefined || options.relax === null){\n options.relax = false\n }else{\n throw new Error(`Invalid Option: relax must be a boolean, got ${JSON.stringify(options.relax)}`)\n }\n // Normalize option `relax_column_count`\n if(typeof options.relax_column_count === 'boolean'){\n // Great, nothing to do\n }else if(options.relax_column_count === undefined || options.relax_column_count === null){\n options.relax_column_count = false\n }else{\n throw new Error(`Invalid Option: relax_column_count must be a boolean, got ${JSON.stringify(options.relax_column_count)}`)\n }\n // Normalize option `skip_empty_lines`\n if(typeof options.skip_empty_lines === 'boolean'){\n // Great, nothing to do\n }else if(options.skip_empty_lines === undefined || options.skip_empty_lines === null){\n options.skip_empty_lines = false\n }else{\n throw new Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(options.skip_empty_lines)}`)\n }\n // Normalize option `skip_lines_with_empty_values`\n if(typeof options.skip_lines_with_empty_values === 'boolean'){\n // Great, nothing to do\n }else if(options.skip_lines_with_empty_values === undefined || options.skip_lines_with_empty_values === null){\n options.skip_lines_with_empty_values = false\n }else{\n throw new Error(`Invalid Option: skip_lines_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_lines_with_empty_values)}`)\n }\n // Normalize option `skip_lines_with_error`\n if(typeof options.skip_lines_with_error === 'boolean'){\n // Great, nothing to do\n }else if(options.skip_lines_with_error === undefined || options.skip_lines_with_error === null){\n options.skip_lines_with_error = false\n }else{\n throw new Error(`Invalid Option: skip_lines_with_error must be a boolean, got ${JSON.stringify(options.skip_lines_with_error)}`)\n }\n // Normalize option `rtrim`\n if(options.rtrim === undefined || options.rtrim === null || options.rtrim === false){\n options.rtrim = false\n }else if(options.rtrim !== true){\n throw new Error(`Invalid Option: rtrim must be a boolean, got ${JSON.stringify(options.rtrim)}`)\n }\n // Normalize option `ltrim`\n if(options.ltrim === undefined || options.ltrim === null || options.ltrim === false){\n options.ltrim = false\n }else if(options.ltrim !== true){\n throw new Error(`Invalid Option: ltrim must be a boolean, got ${JSON.stringify(options.ltrim)}`)\n }\n // Normalize option `trim`\n if(options.trim === undefined || options.trim === null || options.trim === false){\n options.trim = false\n }else if(options.trim !== true){\n throw new Error(`Invalid Option: trim must be a boolean, got ${JSON.stringify(options.trim)}`)\n }\n // Normalize options `trim`, `ltrim` and `rtrim`\n if(options.trim === true && opts.ltrim !== false){\n options.ltrim = true\n }else if(options.ltrim !== true){\n options.ltrim = false\n }\n if(options.trim === true && opts.rtrim !== false){\n options.rtrim = true\n }else if(options.rtrim !== true){\n options.rtrim = false\n }\n // Normalize option `to`\n if(options.to === undefined || options.to === null){\n options.to = -1\n }else{\n if(typeof options.to === 'string' && /\\d+/.test(options.to)){\n options.to = parseInt(options.to)\n }\n if(Number.isInteger(options.to)){\n if(options.to <= 0){\n throw new Error(`Invalid Option: to must be a positive integer greater than 0, got ${JSON.stringify(opts.to)}`)\n }\n }else{\n throw new Error(`Invalid Option: to must be an integer, got ${JSON.stringify(opts.to)}`)\n }\n }\n // Normalize option `to_line`\n if(options.to_line === undefined || options.to_line === null){\n options.to_line = -1\n }else{\n if(typeof options.to_line === 'string' && /\\d+/.test(options.to_line)){\n options.to_line = parseInt(options.to_line)\n }\n if(Number.isInteger(options.to_line)){\n if(options.to_line <= 0){\n throw new Error(`Invalid Option: to_line must be a positive integer greater than 0, got ${JSON.stringify(opts.to_line)}`)\n }\n }else{\n throw new Error(`Invalid Option: to_line must be an integer, got ${JSON.stringify(opts.to_line)}`)\n }\n }\n this.info = {\n comment_lines: 0,\n empty_lines: 0,\n invalid_field_length: 0,\n lines: 1,\n records: 0\n }\n this.options = options\n this.state = {\n bomSkipped: false,\n castField: fnCastField,\n commenting: false,\n enabled: options.from_line === 1,\n escaping: false,\n escapeIsQuote: options.escape === options.quote,\n expectedRecordLength: options.columns === null ? 0 : options.columns.length,\n field: new ResizeableBuffer(20),\n firstLineToHeaders: fnFirstLineToHeaders,\n info: Object.assign({}, this.info),\n previousBuf: undefined,\n quoting: false,\n stop: false,\n rawBuffer: new ResizeableBuffer(100),\n record: [],\n recordHasError: false,\n record_length: 0,\n recordDelimiterMaxLength: options.record_delimiter.length === 0 ? 2 : Math.max(...options.record_delimiter.map( (v) => v.length)),\n trimChars: [Buffer.from(' ')[0], Buffer.from('\\t')[0]],\n wasQuoting: false,\n wasRowDelimiter: false\n }\n }\n // Implementation of `Transform._transform`\n _transform(buf, encoding, callback){\n if(this.state.stop === true){\n return\n }\n const err = this.__parse(buf, false)\n if(err !== undefined){\n this.state.stop = true\n }\n callback(err)\n }\n // Implementation of `Transform._flush`\n _flush(callback){\n if(this.state.stop === true){\n return\n }\n const err = this.__parse(undefined, true)\n callback(err)\n }\n // Central parser implementation\n __parse(nextBuf, end){\n const {bom, comment, escape, from, from_line, info, ltrim, max_record_size, quote, raw, relax, rtrim, skip_empty_lines, to, to_line} = this.options\n let {record_delimiter} = this.options\n const {bomSkipped, previousBuf, rawBuffer, escapeIsQuote, trimChars} = this.state\n let buf\n if(previousBuf === undefined){\n if(nextBuf === undefined){\n // Handle empty string\n this.push(null)\n return\n }else{\n buf = nextBuf\n }\n }else if(previousBuf !== undefined && nextBuf === undefined){\n buf = previousBuf\n }else{\n buf = Buffer.concat([previousBuf, nextBuf])\n }\n // Handle UTF BOM\n if(bomSkipped === false){\n if(bom === false){\n this.state.bomSkipped = true\n }else if(buf.length < 3){\n // No enough data\n if(end === false){\n // Wait for more data\n this.state.previousBuf = buf\n return\n }\n // skip BOM detect because data length < 3\n }else{\n if(bom_utf8.compare(buf, 0, 3) === 0){\n // Skip BOM\n buf = buf.slice(3)\n }\n this.state.bomSkipped = true\n }\n }\n const bufLen = buf.length\n let pos\n for(pos = 0; pos < bufLen; pos++){\n // Ensure we get enough space to look ahead\n // There should be a way to move this out of the loop\n if(this.__needMoreData(pos, bufLen, end)){\n break\n }\n if(this.state.wasRowDelimiter === true){\n this.info.lines++\n if(info === true && this.state.record.length === 0 && this.state.field.length === 0 && this.state.wasQuoting === false){\n this.state.info = Object.assign({}, this.info)\n }\n this.state.wasRowDelimiter = false\n }\n if(to_line !== -1 && this.info.lines > to_line){\n this.state.stop = true\n this.push(null)\n return\n }\n // Auto discovery of record_delimiter, unix, mac and windows supported\n if(this.state.quoting === false && record_delimiter.length === 0){\n const record_delimiterCount = this.__autoDiscoverRowDelimiter(buf, pos)\n if(record_delimiterCount){\n record_delimiter = this.options.record_delimiter\n }\n }\n const chr = buf[pos]\n if(raw === true){\n rawBuffer.append(chr)\n }\n if((chr === cr || chr === nl) && this.state.wasRowDelimiter === false ){\n this.state.wasRowDelimiter = true\n }\n // Previous char was a valid escape char\n // treat the current char as a regular char\n if(this.state.escaping === true){\n this.state.escaping = false\n }else{\n // Escape is only active inside quoted fields\n if(this.state.quoting === true && chr === escape && pos + 1 < bufLen){\n // We are quoting, the char is an escape chr and there is a chr to escape\n if(escapeIsQuote){\n if(buf[pos+1] === quote){\n this.state.escaping = true\n continue\n }\n }else{\n this.state.escaping = true\n continue\n }\n }\n // Not currently escaping and chr is a quote\n // TODO: need to compare bytes instead of single char\n if(this.state.commenting === false && chr === quote){\n if(this.state.quoting === true){\n const nextChr = buf[pos+1]\n const isNextChrTrimable = rtrim && this.__isCharTrimable(nextChr)\n // const isNextChrComment = nextChr === comment\n const isNextChrComment = comment !== null && this.__compareBytes(comment, buf, pos+1, nextChr)\n const isNextChrDelimiter = this.__isDelimiter(nextChr, buf, pos+1)\n const isNextChrRowDelimiter = record_delimiter.length === 0 ? this.__autoDiscoverRowDelimiter(buf, pos+1) : this.__isRecordDelimiter(nextChr, buf, pos+1)\n // Escape a quote\n // Treat next char as a regular character\n // TODO: need to compare bytes instead of single char\n if(chr === escape && nextChr === quote){\n pos++\n }else if(!nextChr || isNextChrDelimiter || isNextChrRowDelimiter || isNextChrComment || isNextChrTrimable){\n this.state.quoting = false\n this.state.wasQuoting = true\n continue\n }else if(relax === false){\n const err = this.__error(`Invalid Closing Quote: got \"${String.fromCharCode(nextChr)}\" at line ${this.info.lines} instead of delimiter, row delimiter, trimable character (if activated) or comment`)\n if(err !== undefined) return err\n }else{\n this.state.quoting = false\n this.state.wasQuoting = true\n // continue\n this.state.field.prepend(quote)\n }\n }else{\n if(this.state.field.length !== 0){\n // In relax mode, treat opening quote preceded by chrs as regular\n if( relax === false ){\n const err = this.__error(`Invalid opening quote at line ${this.info.lines}`)\n if(err !== undefined) return err\n }\n }else{\n this.state.quoting = true\n continue\n }\n }\n }\n if(this.state.quoting === false){\n let recordDelimiterLength = this.__isRecordDelimiter(chr, buf, pos)\n if(recordDelimiterLength !== 0){\n // Do not emit comments which take a full line\n const skipCommentLine = this.state.commenting && (this.state.wasQuoting === false && this.state.record.length === 0 && this.state.field.length === 0)\n if(skipCommentLine){\n this.info.comment_lines++\n // Skip full comment line\n }else{\n // Skip if line is empty and skip_empty_lines activated\n if(skip_empty_lines === true && this.state.wasQuoting === false && this.state.record.length === 0 && this.state.field.length === 0){\n this.info.empty_lines++\n pos += recordDelimiterLength - 1\n continue\n }\n // Activate records emition if above from_line\n if(this.state.enabled === false && this.info.lines + (this.state.wasRowDelimiter === true ? 1: 0 ) >= from_line){\n this.state.enabled = true\n this.__resetField()\n this.__resetRow()\n pos += recordDelimiterLength - 1\n continue\n }else{\n const errField = this.__onField()\n if(errField !== undefined) return errField\n const errRecord = this.__onRow()\n if(errRecord !== undefined) return errRecord\n }\n if(to !== -1 && this.info.records >= to){\n this.state.stop = true\n this.push(null)\n return\n }\n }\n this.state.commenting = false\n pos += recordDelimiterLength - 1\n continue\n }\n if(this.state.commenting){\n continue\n }\n const commentCount = comment === null ? 0 : this.__compareBytes(comment, buf, pos, chr)\n if(commentCount !== 0){\n this.state.commenting = true\n continue\n }\n let delimiterLength = this.__isDelimiter(chr, buf, pos)\n if(delimiterLength !== 0){\n const errField = this.__onField()\n if(errField !== undefined) return errField\n pos += delimiterLength - 1\n continue\n }\n }\n }\n if(this.state.commenting === false){\n if(max_record_size !== 0 && this.state.record_length + this.state.field.length > max_record_size){\n const err = this.__error(`Max Record Size: record exceed the maximum number of tolerated bytes of ${max_record_size} on line ${this.info.lines}`)\n if(err !== undefined) return err\n }\n }\n\n const lappend = ltrim === false || this.state.quoting === true || this.state.field.length !== 0 || !this.__isCharTrimable(chr)\n // rtrim in non quoting is handle in __onField\n const rappend = rtrim === false || this.state.wasQuoting === false\n if( lappend === true && rappend === true ){\n this.state.field.append(chr)\n }else if(rtrim === true && !this.__isCharTrimable(chr)){\n const err = this.__error(`Invalid Closing Quote: found non trimable byte after quote at line ${this.info.lines}`)\n if(err !== undefined) return err\n }\n }\n if(end === true){\n if(this.state.quoting === true){\n const err = this.__error(`Invalid Closing Quote: quote is not closed at line ${this.info.lines}`)\n if(err !== undefined) return err\n }else{\n // Skip last line if it has no characters\n if(this.state.wasQuoting === true || this.state.record.length !== 0 || this.state.field.length !== 0){\n const errField = this.__onField()\n if(errField !== undefined) return errField\n const errRecord = this.__onRow()\n if(errRecord !== undefined) return errRecord\n }else if(this.state.wasRowDelimiter === true){\n this.info.empty_lines++\n }else if(this.state.commenting === true){\n this.info.comment_lines++\n }\n }\n }else{\n this.state.previousBuf = buf.slice(pos)\n }\n if(this.state.wasRowDelimiter === true){\n this.info.lines++\n this.state.wasRowDelimiter = false\n }\n }\n // Helper to test if a character is a space or a line delimiter\n __isCharTrimable(chr){\n return chr === space || chr === tab || chr === cr || chr === nl\n }\n __onRow(){\n const {columns, info, from, relax_column_count, raw, skip_lines_with_empty_values} = this.options\n const {enabled, record} = this.state\n // Convert the first line into column names\n if(columns === true){\n return this.__firstLineToColumns(record)\n }\n const recordLength = record.length\n if(columns === false && this.info.records === 0){\n this.state.expectedRecordLength = recordLength\n }else if(enabled === true){\n if(recordLength !== this.state.expectedRecordLength){\n if(relax_column_count === true){\n this.info.invalid_field_length++\n }else{\n if(columns === false){\n const err = this.__error(`Invalid Record Length: expect ${this.state.expectedRecordLength}, got ${recordLength} on line ${this.info.lines}`)\n if(err !== undefined) return err\n }else{\n const err = this.__error(`Invalid Record Length: header length is ${columns.length}, got ${recordLength} on line ${this.info.lines}`)\n if(err !== undefined) return err\n }\n }\n }\n }\n if(enabled === false){\n return this.__resetRow()\n }\n if(skip_lines_with_empty_values === true){\n if(record.map( (field) => field.trim() ).join('') === ''){\n this.__resetRow()\n return\n }\n }\n if(this.state.recordHasError === true){\n this.__resetRow()\n this.state.recordHasError = false\n return\n }\n this.info.records++\n if(from === 1 || this.info.records >= from){\n if(columns !== false){\n const obj = {}\n // Transform record array to an object\n for(let i in record){\n if(columns[i] === undefined || columns[i].disabled) continue\n obj[columns[i].name] = record[i]\n }\n const {objname} = this.options\n if(objname === undefined){\n if(raw === true || info === true){\n this.push(Object.assign(\n {record: obj},\n (raw === true ? {raw: this.state.rawBuffer.toString()}: {}),\n (info === true ? {info: this.state.info}: {})\n ))\n }else{\n this.push(obj)\n }\n }else{\n if(raw === true || info === true){\n this.push(Object.assign(\n {record: [obj[objname], obj]},\n raw === true ? {raw: this.state.rawBuffer.toString()}: {},\n info === true ? {info: this.state.info}: {}\n ))\n }else{\n this.push([obj[objname], obj])\n }\n }\n }else{\n if(raw === true || info === true){\n this.push(Object.assign(\n {record: record},\n raw === true ? {raw: this.state.rawBuffer.toString()}: {},\n info === true ? {info: this.state.info}: {}\n ))\n }else{\n this.push(record)\n }\n }\n }\n this.__resetRow()\n }\n __firstLineToColumns(record){\n const {firstLineToHeaders} = this.state\n try{\n // record = record.filter(function(field){ return field !== undefined})\n const headers = firstLineToHeaders === undefined ? record : firstLineToHeaders.call(null, record)\n if(!Array.isArray(headers)){\n return this.__error(`Invalid Header Mapping: expect an array, got ${JSON.stringify(headers)}`)\n }\n const normalizedHeaders = normalizeColumnsArray(headers)\n this.state.expectedRecordLength = normalizedHeaders.length\n this.options.columns = normalizedHeaders\n this.__resetRow()\n return\n }catch(err){\n return err\n }\n }\n __resetRow(){\n const {info} = this.options\n if(this.options.raw === true){\n this.state.rawBuffer.reset()\n }\n this.state.record = []\n this.state.record_length = 0\n }\n __onField(){\n const {cast, rtrim, max_record_size} = this.options\n const {enabled, wasQuoting} = this.state\n // Deal with from_to options\n if(this.options.columns !== true && enabled === false){\n return this.__resetField()\n }\n let field = this.state.field.toString()\n if(rtrim === true && wasQuoting === false){\n field = field.trimRight()\n }\n if(cast === true){\n const [err, f] = this.__cast(field)\n if(err !== undefined) return err\n field = f\n }\n this.state.record.push(field)\n // Increment record length if record size must not exceed a limit\n if(max_record_size !== 0 && typeof field === 'string'){\n this.state.record_length += field.length\n }\n this.__resetField()\n }\n __resetField(){\n this.state.field.reset()\n this.state.wasQuoting = false\n }\n // Return a tuple with the error and the casted value\n __cast(field){\n const isColumns = Array.isArray(this.options.columns)\n // Dont loose time calling cast if the field wont be part of the final record\n if( isColumns === true && this.options.columns.length <= this.state.record.length ){\n return [undefined, undefined]\n }\n const context = {\n column: isColumns === true ?\n this.options.columns[this.state.record.length].name :\n this.state.record.length,\n empty_lines: this.info.empty_lines,\n header: this.options.columns === true,\n index: this.state.record.length,\n invalid_field_length: this.info.invalid_field_length,\n quoting: this.state.wasQuoting,\n lines: this.info.lines,\n records: this.info.records\n }\n if(this.state.castField !== null){\n try{\n return [undefined, this.state.castField.call(null, field, context)]\n }catch(err){\n return [err]\n }\n }\n if(this.__isFloat(field)){\n return [undefined, parseFloat(field)]\n }else if(this.options.cast_date !== false){\n return [undefined, this.options.cast_date.call(null, field, context)]\n }\n return [undefined, field]\n }\n // Keep it in case we implement the `cast_int` option\n // __isInt(value){\n // // return Number.isInteger(parseInt(value))\n // // return !isNaN( parseInt( obj ) );\n // return /^(\\-|\\+)?[1-9][0-9]*$/.test(value)\n // }\n __isFloat(value){\n return (value - parseFloat( value ) + 1) >= 0 // Borrowed from jquery\n }\n __compareBytes(sourceBuf, targetBuf, pos, firtByte){\n if(sourceBuf[0] !== firtByte) return 0\n const sourceLength = sourceBuf.length\n for(let i = 1; i < sourceLength; i++){\n if(sourceBuf[i] !== targetBuf[pos+i]) return 0\n }\n return sourceLength\n }\n __needMoreData(i, bufLen, end){\n if(end){\n return false\n }\n const {comment, delimiter, escape} = this.options\n const {quoting, recordDelimiterMaxLength} = this.state\n const numOfCharLeft = bufLen - i - 1\n const requiredLength = Math.max(\n // Skip if the remaining buffer smaller than comment\n comment ? comment.length : 0,\n // Skip if the remaining buffer smaller than row delimiter\n recordDelimiterMaxLength,\n // Skip if the remaining buffer can be row delimiter following the closing quote\n // 1 is for quote.length\n quoting ? (1 + recordDelimiterMaxLength) : 0,\n // Skip if the remaining buffer can be delimiter\n delimiter.length,\n // Skip if the remaining buffer can be escape sequence\n // 1 is for escape.length\n 1\n )\n return numOfCharLeft < requiredLength\n }\n __isDelimiter(chr, buf, pos){\n const {delimiter} = this.options\n const delLength = delimiter.length\n if(delimiter[0] !== chr) return 0\n for(let i = 1; i < delLength; i++){\n if(delimiter[i] !== buf[pos+i]) return 0\n }\n return delimiter.length\n }\n __isRecordDelimiter(chr, buf, pos){\n const {record_delimiter} = this.options\n const recordDelimiterLength = record_delimiter.length\n loop1: for(let i = 0; i < recordDelimiterLength; i++){\n const rd = record_delimiter[i]\n const rdLength = rd.length\n if(rd[0] !== chr){\n continue\n }\n for(let j = 1; j < rdLength; j++){\n if(rd[j] !== buf[pos+j]){\n continue loop1\n }\n }\n return rd.length\n }\n return 0\n }\n __autoDiscoverRowDelimiter(buf, pos){\n const chr = buf[pos]\n if(chr === cr){\n if(buf[pos+1] === nl){\n this.options.record_delimiter.push(Buffer.from('\\r\\n'))\n this.state.recordDelimiterMaxLength = 2\n return 2\n }else{\n this.options.record_delimiter.push(Buffer.from('\\r'))\n this.state.recordDelimiterMaxLength = 1\n return 1\n }\n }else if(chr === nl){\n this.options.record_delimiter.push(Buffer.from('\\n'))\n this.state.recordDelimiterMaxLength = 1\n return 1\n }\n return 0\n }\n __error(msg){\n const {skip_lines_with_error} = this.options\n const err = new Error(msg)\n if(skip_lines_with_error){\n this.state.recordHasError = true\n this.emit('skip', err)\n return undefined\n }else{\n return err\n }\n }\n}\n\nconst parse = function(){\n let data, options, callback\n for(let i in arguments){\n const argument = arguments[i]\n const type = typeof argument\n if(data === undefined && (typeof argument === 'string' || Buffer.isBuffer(argument))){\n data = argument\n }else if(options === undefined && isObject(argument)){\n options = argument\n }else if(callback === undefined && type === 'function'){\n callback = argument\n }else{\n throw new Error(`Invalid argument: got ${JSON.stringify(argument)} at index ${i}`)\n }\n }\n const parser = new Parser(options)\n if(callback){\n const records = options === undefined || options.objname === undefined ? [] : {}\n parser.on('readable', function(){\n let record\n while(record = this.read()){\n if(options === undefined || options.objname === undefined){\n records.push(record)\n }else{\n records[record[0]] = record[1]\n }\n }\n })\n parser.on('error', function(err){\n callback(err, undefined, parser.info)\n })\n parser.on('end', function(){\n callback(undefined, records, parser.info)\n })\n }\n if(data !== undefined){\n parser.write(data)\n parser.end()\n }\n return parser\n}\n\nparse.Parser = Parser\n\nmodule.exports = parse\n\nconst underscore = function(str){\n return str.replace(/([A-Z])/g, function(_, match, index){\n return '_' + match.toLowerCase()\n })\n}\n\nconst isObject = function(obj){\n return (typeof obj === 'object' && obj !== null && !Array.isArray(obj))\n}\n\nconst normalizeColumnsArray = function(columns){\n // console.log('columns', columns)\n const normalizedColumns = [];\n\n for(let i=0; i< columns.length; i++){\n const column = columns[i]\n if(column === undefined || column === null || column === false){\n normalizedColumns[i] = { disabled: true }\n }else if(typeof column === 'string'){\n normalizedColumns[i] = { name: column }\n }else if(isObject(column)){\n if(typeof column.name !== 'string'){\n throw new Error(`Invalid Option columns: property \"name\" is required at position ${i} when column is an object literal`)\n }\n normalizedColumns[i] = column\n }else{\n throw new Error(`Invalid Option columns: expect a string or an object, got ${JSON.stringify(column)} at position ${i}`)\n }\n }\n // console.log(normalizedColumns)\n return normalizedColumns;\n}\n","import { FlightLogHeader } from './types';\n\nexport const INT_FIELDS = new Set([\n FlightLogHeader.AircraftBatteryCell1Voltage,\n FlightLogHeader.AircraftBatteryCell2Voltage,\n FlightLogHeader.AircraftBatteryCell3Voltage,\n FlightLogHeader.AircraftBatteryCell4Voltage,\n FlightLogHeader.AircraftBatteryCharge,\n FlightLogHeader.AircraftBatteryCurrent,\n FlightLogHeader.AircraftBatteryTemperature,\n FlightLogHeader.AircraftBatteryVoltage,\n FlightLogHeader.AircraftCameraLensFocusModeValue,\n FlightLogHeader.AircraftCameraLensFocusStatusValue,\n FlightLogHeader.AircraftCameraModeValue,\n FlightLogHeader.AircraftFlightModeValue,\n FlightLogHeader.AircraftGPSSignalValue,\n FlightLogHeader.AircraftNoFlyValue,\n FlightLogHeader.AircraftSatellites,\n FlightLogHeader.GimbalModeValue,\n FlightLogHeader.AircraftSmartGoHomeRadius,\n FlightLogHeader.AircraftSmartGoHomeCountdown,\n FlightLogHeader.AircraftVelocityX,\n FlightLogHeader.AircraftVelocityY,\n FlightLogHeader.AircraftVelocityZ,\n FlightLogHeader.RCHorizontalAccuaracy,\n FlightLogHeader.RCLatitude,\n FlightLogHeader.RCLongitude,\n FlightLogHeader.LandingGearStatusValue,\n FlightLogHeader.LandingGearModeValue,\n FlightLogHeader.RCStateValue,\n FlightLogHeader.RCLandingGearValue,\n]);\n\nexport const FLOAT_FIELDS = new Set([\n FlightLogHeader.AircraftBarometricAltitude,\n FlightLogHeader.AircraftBatteryPowerPercent,\n FlightLogHeader.AircraftCameraSDCardRemainingPercent,\n FlightLogHeader.AircraftHeading,\n FlightLogHeader.AircraftLatitude,\n FlightLogHeader.AircraftLongitude,\n FlightLogHeader.AircraftNoFlyLatitude,\n FlightLogHeader.AircraftNoFlyLongitude,\n FlightLogHeader.AircraftNoFlyRadius,\n FlightLogHeader.AircraftPitch,\n FlightLogHeader.AircraftRoll,\n FlightLogHeader.AircraftSmartGoHomeFlightReturnTime,\n FlightLogHeader.AircraftSmartGoHomeFlightTimeRemaining,\n FlightLogHeader.AircraftSmartGoHomeLandingPower,\n FlightLogHeader.AircraftSmartGoHomeLandingTime,\n FlightLogHeader.AircraftSmartGoHomeReturnPower,\n FlightLogHeader.AircraftSpeed,\n FlightLogHeader.AircraftUltrasonicAltitude,\n FlightLogHeader.DeviceToAircraftDistance,\n FlightLogHeader.ElapsedTime,\n FlightLogHeader.GimbalPitch,\n FlightLogHeader.GimbalPitchAtStop,\n FlightLogHeader.GimbalRoll,\n FlightLogHeader.GimbalRollAtStop,\n FlightLogHeader.GimbalYaw,\n FlightLogHeader.GimbalYawAtStop,\n FlightLogHeader.HomeLatitude,\n FlightLogHeader.HomeLongitude,\n FlightLogHeader.RCBatteryPercentRemaining,\n FlightLogHeader.RCLeftHorizontal,\n FlightLogHeader.RCRightHorizontal,\n FlightLogHeader.RCLeftVertical,\n FlightLogHeader.RCRightVertical,\n]);\n\nexport const BOOL_FIELDS = new Set([\n FlightLogHeader.AircraftCameraBurstCapture,\n FlightLogHeader.AircraftCameraIntervalCapture,\n FlightLogHeader.AircraftCameraLensAFAssistant,\n FlightLogHeader.AircraftCameraLensAFEnabled,\n FlightLogHeader.AircraftCameraLensAssistantWorking,\n FlightLogHeader.AircraftCameraOverheated,\n FlightLogHeader.AircraftCameraRawCapture,\n FlightLogHeader.AircraftCameraBurstCapture,\n FlightLogHeader.AircraftCameraRecording,\n FlightLogHeader.AircraftCameraSDCardExists,\n FlightLogHeader.AircraftCameraSensorError,\n FlightLogHeader.AircraftCameraSingleCapture,\n FlightLogHeader.AircraftCameraStoringPhoto,\n FlightLogHeader.AircraftFlying,\n FlightLogHeader.AircraftIMUPreheating,\n FlightLogHeader.AircraftMotorsOn,\n FlightLogHeader.AircraftSmartGoHomeRequesting,\n FlightLogHeader.AircraftUltrasonicOn,\n FlightLogHeader.AircraftVisionOn,\n FlightLogHeader.LandingGearIsMovable,\n FlightLogHeader.RCGoHome,\n FlightLogHeader.RCRecord,\n FlightLogHeader.RCShutter,\n FlightLogHeader.RCPlayback,\n FlightLogHeader.RCPause,\n FlightLogHeader.RCCustom1,\n FlightLogHeader.RCCustom2,\n FlightLogHeader.RCSattelites,\n FlightLogHeader.RCGSPDataIsValid,\n FlightLogHeader.RCLeftHorizontal,\n FlightLogHeader.RCRightHorizontal,\n FlightLogHeader.RCLeftVertical,\n FlightLogHeader.RCRightVertical,\n FlightLogHeader.AircraftCameraChangeableLensSupported,\n FlightLogHeader.AircraftCameraLensInstalled,\n FlightLogHeader.AircraftCameraLensMFAssistant,\n]);\n\nexport const DATE_FIELDS = new Set([\n FlightLogHeader.DateTime,\n]);\n","import parse from 'csv-parse';\n\nimport { FlightLogRow, FlightLogHeader, FlightLogMetaData, FlightLog, FlightLogEvent } from './types';\nimport { INT_FIELDS, BOOL_FIELDS, FLOAT_FIELDS, DATE_FIELDS } from './field-types';\n\nconst syncParse = require('csv-parse/lib/sync');\n\n\nconst META_REGEX = {\n appVersion: /^#DroneDeploy\\s+(.+)$/,\n sessionId: /^Session ID\\s+(.+)$/,\n sessionStart: /^Session Start\\s+(.+)$/,\n sessionEnd: /^Date\\/Time \\(UTC\\)\\s+(.+)$/,\n deviceModel: /^Device Model\\s+(.+)$/,\n deviceOS: /^Device Operating System\\s+(.+)$/,\n aircraftModel: /^Aircraft Model\\s+(.+)$/,\n aircraftName: /^Aircraft Name\\s+(.+)$/,\n aircraftFirmware: /^Aircraft Firmware\\s+(.+)$/,\n batteryChargeVolume: /^Full Charge Volume \\(mAh\\)\\s+(.+)$/,\n batteryRemainingLife: /^Remaining Life \\(%\\)\\s+(.+)$/,\n batteryDischarges: /^Discharges\\s+(.+)$/,\n batteryCells: /^Battery Cells Number\\s+(.+)$/,\n batterySerialNumber: /^Battery Serial Number\\s+(.+)$/,\n batteryFirmware: /^Battery Firmware\\s+(.+)$/,\n fcSerialNumber: /^Flight Controller Serial Number\\s+(.+)$/,\n fcFirmware: /^Flight Controller Firmware\\s+(.+)$/,\n footerLines: /^#Flight Recorder Session End|^Date\\/Time \\(UTC\\)|^Elapsed Time \\(sec\\)/,\n gimbalFirmware: /^Gimbal Firmware\\s+(.+)$/,\n rcSerialNumber: /^Remote Control Serial Number\\s+(.+)$/,\n rcFirmware: /^Remote Control Firmware\\s+(.+)$/,\n cameraSerialNumber: /^Camera Serial Number\\s+(.+)$/,\n elapsedTime: /^Elapsed Time \\(sec\\)\\s+(.+)$/,\n userId: /^User ID\\s+(.+)$/,\n organizationId: /^Organization ID\\s+(.+)$/,\n platform: /^Platform\\s+(.+)$/,\n};\n\nexport type Subscriber = (value: T) => void;\nexport type ErrorSubscriber = (value: any) => void;\nexport type CompletionSubscriber = () => void;\n\nexport interface QuasiObservable {\n subscribe(sub: Subscriber, errSub?: ErrorSubscriber, completionSub?: CompletionSubscriber): void;\n toPromise(): Promise;\n}\n\nexport class QuasiSubject implements QuasiObservable {\n private subscribers: Subscriber[] = [];\n private errorSubscribers: ErrorSubscriber[] = [];\n private completionSubscribers: CompletionSubscriber[] = [];\n private isFinished = false;\n\n next(value: T) {\n if (this.isFinished) {\n return;\n }\n this.subscribers.forEach((s) => s(value));\n }\n\n complete() {\n if (this.isFinished) {\n return;\n }\n this.isFinished = true;\n this.completionSubscribers.forEach((sub) => sub());\n }\n\n error(error: any) {\n if (this.isFinished) {\n return;\n }\n this.errorSubscribers.forEach((errSub) => errSub(error));\n this.complete();\n }\n\n subscribe(sub: Subscriber, errSub?: ErrorSubscriber, completionSub?: CompletionSubscriber) {\n this.subscribers.push(sub);\n if (errSub) {\n this.errorSubscribers.push(errSub);\n }\n if (completionSub) {\n this.completionSubscribers.push(completionSub);\n }\n }\n\n toPromise(): Promise {\n const source = this;\n return new Promise(function (resolve, reject) {\n let value: T;\n source.subscribe(function (v) {\n value = v;\n }, reject, function () {\n resolve(value);\n });\n });\n }\n}\n\nexport function parseLogStream(logStream: QuasiSubject): QuasiObservable {\n const headerMetaLines: string[] = [];\n let meta = {} as FlightLogMetaData;\n let rowHeaderLine: string;\n let row: FlightLogRow;\n\n const progress = { index: 0, completed: false };\n let end: any;\n const result = new QuasiSubject();\n\n logStream.subscribe((line: string) => {\n line = line.trim();\n if (!line.length) {\n return;\n }\n\n if (!rowHeaderLine) {\n if (line.startsWith(FlightLogHeader.DateTime.split(' ')[0])) { // Strip off timezone.\n rowHeaderLine = line;\n meta = parseMetaData(headerMetaLines, []);\n result.next({\n meta,\n rowIndex: progress.index\n });\n } else {\n headerMetaLines.push(line);\n progress.index++;\n }\n return;\n }\n\n if (META_REGEX.footerLines.test(line)) {\n if (META_REGEX.sessionEnd.test(line)) {\n end = fromUtcDateStr(findMatch([line], META_REGEX.sessionEnd));\n } else if (META_REGEX.elapsedTime.test(line)) {\n const elapsed = findMatch([line], META_REGEX.elapsedTime);\n\n // This is the end of the parsing. Because normal lines are parsed through a Promise, they will be delivered\n // asynchronously. So we must ensure that this result is also delivered asynchronously.\n setTimeout(() => {\n const parsedElapsed = elapsed === 'N/A' ? 0 : parseFloat(elapsed);\n if (parsedElapsed) {\n meta.session.elapsed = parsedElapsed;\n }\n if (end) {\n meta.session.end = end;\n }\n result.next({\n meta,\n rowIndex: progress.index++,\n });\n result.complete();\n progress.completed = true;\n }, 0);\n }\n } else {\n parseBody([rowHeaderLine, line], true).then((rows) => {\n row = rows[0];\n meta.session.end = row[FlightLogHeader.DateTime];\n meta.session.elapsed = row[FlightLogHeader.ElapsedTime];\n result.next({\n meta,\n rowIndex: progress.index++,\n row,\n info: parseJsonInfo(row.Info), // Parsed Info column, if the column was populated with a JSON array.\n })\n });\n }\n\n }, (err) => { console.error('parsing error: ' + err); result.complete(); }, () => {\n if (!progress.completed) {\n setTimeout(() => {\n result.complete();\n progress.completed = true;\n }, 0);\n }\n });\n\n return result;\n}\n\nexport function parseLog(log: String): Promise {\n const lines = log.split('\\n');\n const subject = new QuasiSubject();\n const parse = parseLogStream(subject);\n\n const flightLog: FlightLog = {\n metaData: {} as FlightLogMetaData,\n rows: [],\n infos: []\n }\n parse.subscribe((event) => {\n // The metadata is updated as the file is parsed, so always grab the latest one.\n flightLog.metaData = (event.meta) ? event.meta : flightLog.metaData;\n if (event.row) {\n flightLog.rows.push(event.row);\n }\n if (event.info) {\n // @ts-ignore\n flightLog.infos.push(event.info);\n }\n });\n lines.forEach(l => subject.next(l));\n subject.complete();\n\n return new Promise((resolve, reject) => {\n parse.toPromise().then(() => resolve(flightLog)).catch((reason => reject(reason)));\n });\n}\n\nfunction parseBody(lines: string[], sync?: boolean): Promise {\n const text = lines.join('\\n');\n const options = {\n delimiter: '\\t',\n escape: null,\n from: 1,\n quote: null,\n relax_column_count: true,\n };\n\n return new Promise((resolve, reject) => {\n const onResults = (err: any, result: string[]) => {\n if (err) {\n return reject(err);\n }\n\n const [headers, ...rows] = result;\n\n const logs = rows.map((row) => {\n const log = {} as FlightLogRow;\n for (let i = 0; i < headers.length; i++) {\n const header = headers[i].trim() as FlightLogHeader;\n let value: any = row[i];\n\n if (INT_FIELDS.has(header)) {\n value = parseInt(value, 10);\n }\n\n if (FLOAT_FIELDS.has(header)) {\n value = parseFloat(value);\n }\n\n if (BOOL_FIELDS.has(header)) {\n value = value !== '0';\n }\n\n if (DATE_FIELDS.has(header)) {\n value = fromUtcDateStr(value);\n }\n\n log[header] = value;\n }\n\n return log;\n });\n\n resolve(logs);\n };\n if (sync) {\n const results = syncParse(text, options);\n onResults(undefined, results);\n } else {\n // @ts-ignore\n parse(text, options, onResults);\n }\n });\n}\n\nfunction findMatch(search: string[], regex: RegExp, isNum?: boolean) {\n let match;\n for (let str of search) {\n match = str.match(regex);\n if (match) {\n break;\n }\n }\n\n if (!match) {\n return isNum ? '0' : 'N/A';\n }\n\n return match[1];\n}\n\nfunction isValidDate(d: any) {\n return d instanceof Date && !isNaN(d as any);\n}\n\nexport function fromUtcDateStr(utcDateStr: string) {\n if (isValidDate(utcDateStr)) {\n return utcDateStr as any as Date;\n }\n const isBadDate = !utcDateStr || !utcDateStr.trim().length || utcDateStr === 'N/A';\n if (isBadDate) {\n return null;\n }\n if (!/Z$/.test(utcDateStr)) {\n utcDateStr = utcDateStr + '.000Z';\n }\n return new Date(utcDateStr);\n}\n\nfunction parseMetaData(headers: string[], footers: string[]): FlightLogMetaData {\n const meta = [...headers, ...footers];\n let end = findMatch(meta, META_REGEX.sessionEnd);\n let elapsed = findMatch(meta, META_REGEX.elapsedTime);\n\n // if we weren't able to parse an end date or an elapsed time from our footer (which is really just the last three\n // lines of the log file), it's likely that we have a truncated log file. if that's the case, we can still salvage\n // some valid data by parsing the date and elapsed time from the very last log row in the file, which is what we're\n // doing below. it's pretty brittle, but it's preferred to having an invalid end date and a NaN elapsed time.\n if ((end === 'N/A' || elapsed === 'N/A') && footers.length > 0) {\n const lastLine = footers[footers.length - 1];\n const pieces = lastLine.split('\\t');\n\n // if we don't have at least two pieces, i don't know what is in `footer` so i'm just going to leave it alone\n if (pieces.length >= 2) {\n end = pieces[0];\n elapsed = pieces[1];\n }\n }\n\n return {\n appVersion: findMatch(meta, META_REGEX.appVersion),\n session: {\n id: findMatch(meta, META_REGEX.sessionId),\n start: fromUtcDateStr(findMatch(meta, META_REGEX.sessionStart)) as Date,\n end: fromUtcDateStr(end),\n elapsed: elapsed === 'N/A' ? 0 : parseFloat(elapsed),\n },\n device: {\n model: findMatch(meta, META_REGEX.deviceModel),\n os: findMatch(meta, META_REGEX.deviceOS).replace(/\\t/g, ' '),\n platform: findMatch(meta, META_REGEX.platform),\n },\n aircraft: {\n model: findMatch(meta, META_REGEX.aircraftModel),\n name: findMatch(meta, META_REGEX.aircraftName),\n firmware: findMatch(meta, META_REGEX.aircraftFirmware),\n },\n battery: {\n chargeVolume: parseInt(findMatch(meta, META_REGEX.batteryChargeVolume, true), 10),\n remainingLifePercent: parseInt(findMatch(meta, META_REGEX.batteryRemainingLife, true), 10),\n discharges: parseInt(findMatch(meta, META_REGEX.batteryDischarges, true), 10),\n cells: parseInt(findMatch(meta, META_REGEX.batteryCells, true), 10),\n firmware: findMatch(meta, META_REGEX.batteryFirmware),\n serialNumber: findMatch(meta, META_REGEX.batterySerialNumber),\n },\n flightController: {\n serialNumber: findMatch(meta, META_REGEX.fcSerialNumber),\n firmware: findMatch(meta, META_REGEX.fcFirmware),\n },\n gimbal: {\n firmware: findMatch(meta, META_REGEX.gimbalFirmware),\n },\n remoteController: {\n serialNumber: findMatch(meta, META_REGEX.rcSerialNumber),\n firmware: findMatch(meta, META_REGEX.rcFirmware),\n },\n camera: {\n serialNumber: findMatch(meta, META_REGEX.cameraSerialNumber),\n },\n user: {\n userId: findMatch(meta, META_REGEX.userId),\n organizationId: findMatch(meta, META_REGEX.organizationId),\n },\n };\n}\n\n/**\n * Parse out the given string and return an object if the string is JSON, return undefined otherwise.\n *\n * @param info\n */\nfunction parseJsonInfo(info: string): undefined|Array {\n if (!info) {\n return undefined;\n }\n try {\n return JSON.parse(info);\n }\n catch (e) {\n return undefined;\n }\n}\n"],"names":["FlightLogHeader","FLIGHT_MODE_MAPPING_V4","FLIGHT_MODE_MAPPING_V5","Buffer","from","INT_FIELDS","Set","AircraftBatteryCell1Voltage","AircraftBatteryCell2Voltage","AircraftBatteryCell3Voltage","AircraftBatteryCell4Voltage","AircraftBatteryCharge","AircraftBatteryCurrent","AircraftBatteryTemperature","AircraftBatteryVoltage","AircraftCameraLensFocusModeValue","AircraftCameraLensFocusStatusValue","AircraftCameraModeValue","AircraftFlightModeValue","AircraftGPSSignalValue","AircraftNoFlyValue","AircraftSatellites","GimbalModeValue","AircraftSmartGoHomeRadius","AircraftSmartGoHomeCountdown","AircraftVelocityX","AircraftVelocityY","AircraftVelocityZ","RCHorizontalAccuaracy","RCLatitude","RCLongitude","LandingGearStatusValue","LandingGearModeValue","RCStateValue","RCLandingGearValue","FLOAT_FIELDS","AircraftBarometricAltitude","AircraftBatteryPowerPercent","AircraftCameraSDCardRemainingPercent","AircraftHeading","AircraftLatitude","AircraftLongitude","AircraftNoFlyLatitude","AircraftNoFlyLongitude","AircraftNoFlyRadius","AircraftPitch","AircraftRoll","AircraftSmartGoHomeFlightReturnTime","AircraftSmartGoHomeFlightTimeRemaining","AircraftSmartGoHomeLandingPower","AircraftSmartGoHomeLandingTime","AircraftSmartGoHomeReturnPower","AircraftSpeed","AircraftUltrasonicAltitude","DeviceToAircraftDistance","ElapsedTime","GimbalPitch","GimbalPitchAtStop","GimbalRoll","GimbalRollAtStop","GimbalYaw","GimbalYawAtStop","HomeLatitude","HomeLongitude","RCBatteryPercentRemaining","RCLeftHorizontal","RCRightHorizontal","RCLeftVertical","RCRightVertical","BOOL_FIELDS","AircraftCameraBurstCapture","AircraftCameraIntervalCapture","AircraftCameraLensAFAssistant","AircraftCameraLensAFEnabled","AircraftCameraLensAssistantWorking","AircraftCameraOverheated","AircraftCameraRawCapture","AircraftCameraRecording","AircraftCameraSDCardExists","AircraftCameraSensorError","AircraftCameraSingleCapture","AircraftCameraStoringPhoto","AircraftFlying","AircraftIMUPreheating","AircraftMotorsOn","AircraftSmartGoHomeRequesting","AircraftUltrasonicOn","AircraftVisionOn","LandingGearIsMovable","RCGoHome","RCRecord","RCShutter","RCPlayback","RCPause","RCCustom1","RCCustom2","RCSattelites","RCGSPDataIsValid","AircraftCameraChangeableLensSupported","AircraftCameraLensInstalled","AircraftCameraLensMFAssistant","DATE_FIELDS","DateTime","syncParse","require","META_REGEX","appVersion","sessionId","sessionStart","sessionEnd","deviceModel","deviceOS","aircraftModel","aircraftName","aircraftFirmware","batteryChargeVolume","batteryRemainingLife","batteryDischarges","batteryCells","batterySerialNumber","batteryFirmware","fcSerialNumber","fcFirmware","footerLines","gimbalFirmware","rcSerialNumber","rcFirmware","cameraSerialNumber","elapsedTime","userId","organizationId","platform","QuasiSubject","constructor","this","subscribers","errorSubscribers","completionSubscribers","isFinished","next","value","forEach","s","complete","sub","error","errSub","subscribe","completionSub","push","toPromise","source","Promise","resolve","reject","v","parseLogStream","logStream","headerMetaLines","rowHeaderLine","row","meta","progress","index","completed","end","result","line","trim","length","test","fromUtcDateStr","findMatch","elapsed","setTimeout","parsedElapsed","parseFloat","session","rowIndex","lines","text","join","options","delimiter","escape","quote","relax_column_count","onResults","err","headers","rows","logs","map","log","i","header","has","parseInt","undefined","parseBody","then","info","parseJsonInfo","Info","startsWith","split","footers","pieces","id","start","device","model","os","replace","aircraft","name","firmware","battery","chargeVolume","remainingLifePercent","discharges","cells","serialNumber","flightController","gimbal","remoteController","camera","user","parseMetaData","console","parseLog","subject","parse","flightLog","metaData","infos","event","l","catch","reason","search","regex","isNum","match","str","utcDateStr","d","Date","isNaN","JSON","e"],"mappings":"mBAAYA,GAAZ,SAAYA,GACVA,EAAA,SAAA,kBACAA,EAAA,YAAA,qBACAA,EAAA,KAAA,OACAA,EAAA,eAAA,4BACAA,EAAA,gBAAA,6BACAA,EAAA,0BAAA,oCACAA,EAAA,4BAAA,6BACAA,EAAA,sBAAA,gCACAA,EAAA,uBAAA,gCACAA,EAAA,uBAAA,gCACAA,EAAA,2BAAA,4CACAA,EAAA,2BAAA,qCACAA,EAAA,4BAAA,kCACAA,EAAA,4BAAA,kCACAA,EAAA,4BAAA,kCACAA,EAAA,4BAAA,kCACAA,EAAA,sCAAA,kDACAA,EAAA,iBAAA,8BACAA,EAAA,kBAAA,+BACAA,EAAA,cAAA,uBACAA,EAAA,2BAAA,oCACAA,EAAA,gBAAA,6BACAA,EAAA,kBAAA,yBACAA,EAAA,kBAAA,yBACAA,EAAA,kBAAA,yBACAA,EAAA,cAAA,2BACAA,E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IAGIE,CACT,CAEM,SAAUgE,EAASrC,GACvB,MAAMd,EAAQc,EAAIY,MAAM,MAClB0B,EAAU,IAAInG,EACdoG,EAAQ5E,EAAe2E,GAEvBE,EAAuB,CAC3BC,SAAU,CAAuB,EACjC5C,KAAM,GACN6C,MAAO,IAgBT,OAdAH,EAAMrF,WAAWyF,IAEfH,EAAUC,SAAYE,EAAU,KAAIA,EAAM3E,KAAOwE,EAAUC,SACvDE,EAAM5E,KACRyE,EAAU3C,KAAKzC,KAAKuF,EAAM5E,KAExB4E,EAAMnC,MAERgC,EAAUE,MAAMtF,KAAKuF,EAAMnC,KAC5B,IAEHtB,EAAMtC,SAAQgG,GAAKN,EAAQ5F,KAAKkG,KAChCN,EAAQxF,WAED,IAAIS,SAAmB,CAACC,EAASC,KACtC8E,EAAMlF,YAAYkD,MAAK,IAAM/C,EAAQgF,KAAYK,OAAOC,GAAUrF,EAAOqF,IAAS,GAEtF,CA4DA,SAASnE,EAAUoE,EAAkBC,EAAeC,GAClD,IAAIC,EACJ,IAAK,IAAIC,KAAOJ,EAEd,GADAG,EAAQC,EAAID,MAAMF,GACdE,EACF,MAIJ,OAAKA,EAIEA,EAAM,GAHJD,EAAQ,IAAM,KAIzB,CAMM,SAAUvE,EAAe0E,GAC7B,IALmBC,EAKHD,aAJIE,OAASC,MAAMF,GAKjC,OAAOD,EANX,IAAqBC,EASnB,OADmBD,GAAeA,EAAW7E,OAAOC,QAAyB,QAAf4E,GAIzD,KAAK3E,KAAK2E,KACbA,GAA0B,SAErB,IAAIE,KAAKF,IALP,IAMX,CA0EA,SAAS3C,EAAcD,GACrB,GAAKA,EAGL,IACE,OAAOgD,KAAKjB,MAAM/B,EACnB,CACD,MAAOiD,GACL,MACD,CACH","x_google_ignoreList":[1]} \ No newline at end of file diff --git a/dist/flight-log-parser.js b/dist/flight-log-parser.js index 741e890..525c72d 100644 --- a/dist/flight-log-parser.js +++ b/dist/flight-log-parser.js @@ -1,665 +1,2 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('stream')) : - typeof define === 'function' && define.amd ? define(['exports', 'stream'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.flightLogParser = {})); -})(this, (function (exports) { 'use strict'; - - exports.FlightLogHeader = void 0; - (function (FlightLogHeader) { - FlightLogHeader["DateTime"] = "Date/Time (UTC)"; - FlightLogHeader["ElapsedTime"] = "Elapsed Time (sec)"; - FlightLogHeader["Info"] = "Info"; - FlightLogHeader["DeviceLatitude"] = "Device Latitude (Degrees)"; - FlightLogHeader["DeviceLongitude"] = "Device Longitude (Degrees)"; - FlightLogHeader["DeviceLocationLastUpdated"] = "Device Location Last Updated (ms)"; - FlightLogHeader["AircraftBatteryPowerPercent"] = "Aircraft Battery Power (%)"; - FlightLogHeader["AircraftBatteryCharge"] = "Aircraft Battery Charge (mAh)"; - FlightLogHeader["AircraftBatteryCurrent"] = "Aircraft Battery Current (mA)"; - FlightLogHeader["AircraftBatteryVoltage"] = "Aircraft Battery Voltage (mV)"; - FlightLogHeader["AircraftBatteryTemperature"] = "Aircraft Battery Temperature (Fahrenheit)"; - FlightLogHeader["AircraftBatteryLastUpdated"] = "Aircraft Battery Last Updated (ms)"; - FlightLogHeader["AircraftBatteryCell1Voltage"] = "Aircraft Battery Cell 1 Voltage"; - FlightLogHeader["AircraftBatteryCell2Voltage"] = "Aircraft Battery Cell 2 Voltage"; - FlightLogHeader["AircraftBatteryCell3Voltage"] = "Aircraft Battery Cell 3 Voltage"; - FlightLogHeader["AircraftBatteryCell4Voltage"] = "Aircraft Battery Cell 4 Voltage"; - FlightLogHeader["AircraftBatteryCellVoltageLastUpdated"] = "Aircraft Battery Cell Voltage Last Updated (ms)"; - FlightLogHeader["AircraftLatitude"] = "Aircraft Latitude (Degrees)"; - FlightLogHeader["AircraftLongitude"] = "Aircraft Longitude (Degrees)"; - FlightLogHeader["AircraftSpeed"] = "Aircraft Speed (mph)"; - FlightLogHeader["AircraftBarometricAltitude"] = "Aircraft Barometric Altitude (ft)"; - FlightLogHeader["AircraftHeading"] = "Aircraft Heading (Degrees)"; - FlightLogHeader["AircraftVelocityX"] = "Aircraft Vel - X (mph)"; - FlightLogHeader["AircraftVelocityY"] = "Aircraft Vel - Y (mph)"; - FlightLogHeader["AircraftVelocityZ"] = "Aircraft Vel - Z (mph)"; - FlightLogHeader["AircraftPitch"] = "Aircraft Pitch (Degrees)"; - FlightLogHeader["AircraftRoll"] = "Aircraft Roll (Degrees)"; - FlightLogHeader["AircraftSatellites"] = "Aircraft Satellites"; - FlightLogHeader["AircraftMotorsOn"] = "Aircraft Motors On"; - FlightLogHeader["AircraftFlying"] = "Aircraft Flying"; - FlightLogHeader["AircraftFlightMode"] = "Aircraft Flight Mode"; - FlightLogHeader["AircraftFlightModeValue"] = "Aircraft Flight Mode Value"; - FlightLogHeader["AircraftIMUPreheating"] = "Aircraft IMU Preheating"; - FlightLogHeader["AircraftUltrasonicOn"] = "Aircraft Ultrasonic On"; - FlightLogHeader["AircraftUltrasonicAltitude"] = "Aircraft Ultrasonic Altitude (ft)"; - FlightLogHeader["AircraftVisionOn"] = "Aircraft Vision On"; - FlightLogHeader["AircraftGPSSignal"] = "Aircraft GPS Signal"; - FlightLogHeader["AircraftGPSSignalValue"] = "Aircraft GPS Signal Value"; - FlightLogHeader["AircraftNoFly"] = "Aircraft No-fly"; - FlightLogHeader["AircraftNoFlyValue"] = "Aircraft No-fly Value"; - FlightLogHeader["AircraftNoFlyLatitude"] = "Aircraft No-fly Latitude (Degrees)"; - FlightLogHeader["AircraftNoFlyLongitude"] = "Aircraft No-fly Longitude (Degrees)"; - FlightLogHeader["AircraftNoFlyRadius"] = "Aircraft No-fly Radius (ft)"; - FlightLogHeader["HomeLatitude"] = "Home Latitude (Degrees)"; - FlightLogHeader["HomeLongitude"] = "Home Longitude (Degrees)"; - FlightLogHeader["AircraftSmartGoHomeFlightTimeRemaining"] = "Aircraft Smart Go-home Flight Time Remaining (sec)"; - FlightLogHeader["AircraftSmartGoHomeFlightReturnTime"] = "Aircraft Smart Go-home Flight Return Time (sec)"; - FlightLogHeader["AircraftSmartGoHomeLandingTime"] = "Aircraft Smart Go-home Landing Time (sec)"; - FlightLogHeader["AircraftSmartGoHomeReturnPower"] = "Aircraft Smart Go-home Return Power (%)"; - FlightLogHeader["AircraftSmartGoHomeLandingPower"] = "Aircraft Smart Go-home Landing Power (%)"; - FlightLogHeader["AircraftSmartGoHomeRadius"] = "Aircraft Smart Go-home Radius (ft)"; - FlightLogHeader["AircraftSmartGoHomeCountdown"] = "Aircraft Smart Go-home Countdown (sec)"; - FlightLogHeader["AircraftSmartGoHomeRequesting"] = "Aircraft Smart Go-home Requesting"; - FlightLogHeader["AircraftSystemStateLastUpdated"] = "Aircraft System State Last Updated (ms)"; - FlightLogHeader["GimbalPitch"] = "Gimbal Pitch (Degrees)"; - FlightLogHeader["GimbalRoll"] = "Gimbal Roll (Degrees)"; - FlightLogHeader["GimbalYaw"] = "Gimbal Yaw (Degrees)"; - FlightLogHeader["GimbalMode"] = "Gimbal Mode"; - FlightLogHeader["GimbalModeValue"] = "Gimbal Mode Value"; - FlightLogHeader["GimbalPitchAtStop"] = "Gimbal Pitch at Stop"; - FlightLogHeader["GimbalRollAtStop"] = "Gimbal Roll at Stop"; - FlightLogHeader["GimbalYawAtStop"] = "Gimbal Yaw at Stop"; - FlightLogHeader["GimbalStatusLastUpdated"] = "Gimbal Status Last Updated (ms)"; - FlightLogHeader["LandingGearIsMovable"] = "Landing Gear is Movable"; - FlightLogHeader["LandingGearStatus"] = "Landing Gear Status"; - FlightLogHeader["LandingGearStatusValue"] = "Landing Gear Status Value"; - FlightLogHeader["LandingGearMode"] = "Landing Gear Mode"; - FlightLogHeader["LandingGearModeValue"] = "Landing Gear Mode Value"; - FlightLogHeader["LandingGearLastUpdated"] = "Landing Gear Last Updated (ms)"; - FlightLogHeader["RCState"] = "RC State"; - FlightLogHeader["RCStateValue"] = "RC State Value"; - FlightLogHeader["RCLeftHorizontal"] = "RC Left Horizontal"; - FlightLogHeader["RCLeftVertical"] = "RC Left Vertical"; - FlightLogHeader["RCRightHorizontal"] = "RC Right Horizontal"; - FlightLogHeader["RCRightVertical"] = "RC Right Vertical"; - FlightLogHeader["RCLeftWheel"] = "RC Left Wheel"; - FlightLogHeader["RCRightWheel"] = "RC Right Wheel"; - FlightLogHeader["RCLandingGear"] = "RC Landing Gear"; - FlightLogHeader["RCLandingGearValue"] = "RC Landing Gear Value"; - FlightLogHeader["RCGoHome"] = "RC Go Home"; - FlightLogHeader["RCRecord"] = "RC Record "; - FlightLogHeader["RCShutter"] = "RC Shutter"; - FlightLogHeader["RCPlayback"] = "RC Playback"; - FlightLogHeader["RCPause"] = "RC Pause"; - FlightLogHeader["RCCustom1"] = "RC Custom 1"; - FlightLogHeader["RCCustom2"] = "RC Custom 2"; - FlightLogHeader["RCStateLastUpdated"] = "RC State Last Updated (ms)"; - FlightLogHeader["RCBatteryPercentRemaining"] = "RC Battery (%)"; - FlightLogHeader["RCBatteryStateLastUpdated"] = "RC Battery State Last Updated (ms)"; - FlightLogHeader["RCSattelites"] = "RC Sattelites"; - FlightLogHeader["RCHorizontalAccuaracy"] = "RC Horizontal Accuaracy (ft)"; - FlightLogHeader["RCLatitude"] = "RC Latitude (Degrees)"; - FlightLogHeader["RCLongitude"] = "RC Longitude (Degrees)"; - FlightLogHeader["RCGSPDataIsValid"] = "RC GSP Data is Valid"; - FlightLogHeader["RCGPSStateLastUpdated"] = "RC GPS State Last Updated (ms)"; - FlightLogHeader["RCSignal1"] = "RC Signal 1"; - FlightLogHeader["RCSignal2"] = "RC Signal 2"; - FlightLogHeader["RCSignalLastUpdated"] = "RC Signal Last Updated (ms)"; - FlightLogHeader["LBSignal1"] = "LB Signal 1"; - FlightLogHeader["LBSignal2"] = "LB Signal 2"; - FlightLogHeader["LBSignalLastUpdated"] = "LB Signal Last Updated (ms)"; - FlightLogHeader["AircraftCameraMode"] = "Aircraft Camera Mode"; - FlightLogHeader["AircraftCameraModeValue"] = "Aircraft Camera Mode Value"; - FlightLogHeader["AircraftCameraOverheated"] = "Aircraft Camera Overheated"; - FlightLogHeader["AircraftCameraSensorError"] = "Aircraft Camera Sensor Error"; - FlightLogHeader["AircraftCameraRecording"] = "Aircraft Camera Recording"; - FlightLogHeader["AircraftCameraRawCapture"] = "Aircraft Camera Raw Capture"; - FlightLogHeader["AircraftCameraIntervalCapture"] = "Aircraft Camera Interval Capture"; - FlightLogHeader["AircraftCameraBurstCapture"] = "Aircraft Camera Burst Capture"; - FlightLogHeader["AircraftCameraSingleCapture"] = "Aircraft Camera Single Capture"; - FlightLogHeader["AircraftCameraStoringPhoto"] = "Aircraft Camera Storing Photo"; - FlightLogHeader["AircraftCameraStateLastUpdated"] = "Aircraft Camera State Last Updated (ms)"; - FlightLogHeader["AircraftCameraSDCardExists"] = "Aircraft Camera SD Card Exists"; - FlightLogHeader["AircraftCameraSDCardRemainingPercent"] = "Aircraft Camera SD Card Remaining (%)"; - FlightLogHeader["AircraftCameraSDCardStateLastUpdated"] = "Aircraft Camera SD Card State Last Updated (ms)"; - FlightLogHeader["AircraftCameraChangeableLensSupported"] = "Aircraft Camera Changeable Lens Supported"; - FlightLogHeader["AircraftCameraLensInstalled"] = "Aircraft Camera Lens Installed"; - FlightLogHeader["AircraftCameraLensType"] = "Aircraft Camera Lens Type"; - FlightLogHeader["AircraftCameraLensAFEnabled"] = "Aircraft Camera Lens AF Enabled"; - FlightLogHeader["AircraftCameraLensFocusMode"] = "Aircraft Camera Lens Focus Mode"; - FlightLogHeader["AircraftCameraLensFocusModeValue"] = "Aircraft Camera Lens Focus Mode Value"; - FlightLogHeader["AircraftCameraLensFocusStatus"] = "Aircraft Camera Lens Focus Status"; - FlightLogHeader["AircraftCameraLensFocusStatusValue"] = "Aircraft Camera Lens Focus Status Value"; - FlightLogHeader["AircraftCameraLensMFAssistant"] = "Aircraft Camera Lens MF Assistant"; - FlightLogHeader["AircraftCameraLensAFAssistant"] = "Aircraft Camera Lens AF Assistant"; - FlightLogHeader["AircraftCameraLensAssistantWorking"] = "Aircraft Camera Lens Assistant Working"; - FlightLogHeader["AircraftCameraLensStateLastUpdated"] = "Aircraft Camera Lens State Last Updated (ms)"; - FlightLogHeader["CompassIndex"] = "Compass Index"; - FlightLogHeader["CompassSensorValue"] = "Compass Sensor Value"; - FlightLogHeader["CompassState"] = "Compass State"; - FlightLogHeader["CompassStateLastUpdated"] = "Compass State Last Updated (ms)"; - FlightLogHeader["CompassCalibrationState"] = "Compass Calibration State"; - FlightLogHeader["CompassCalibrationLastUpdated"] = "Compass Calibration Last Updated (ms)"; - FlightLogHeader["DeviceToAircraftDistance"] = "Device > Aircraft Distance - XY (ft)"; - })(exports.FlightLogHeader || (exports.FlightLogHeader = {})); - // based off of types in ios/android SDK FlightMode enums - const FLIGHT_MODE_MAPPING_V4 = { - 0: 'Manual', - 1: 'Attitude', - 2: 'Attitude Course Lock', - 3: 'Attitude Hover', - 4: 'Hover', - 5: 'GPS Brake', - 6: 'GPS Attitude', - 7: 'GPS Course Lock', - 8: 'GPS Home', - 9: 'GPS Hotpoint', - 10: 'Assisted Takeoff', - 11: 'Auto Takeoff', - 12: 'Auto Landing', - 13: 'Attitude Landing', - 14: 'GPS Waypoint', - 15: 'Go Home', - 16: 'Click Go', - 17: 'Joystick', - 18: 'Attitude Limited', - 19: 'Cinematic', - 23: 'Attitude Limited', - 24: 'Draw', - 25: 'GPS Follow Me', - 26: 'ActiveTrack', - 27: 'TapFly', - 28: 'Pano', - 29: 'Farming', - 30: 'FPV', - 31: 'GPS Sport', - 32: 'GPS Novice', - 33: 'Confirm Landing', - 35: 'Terrain Follow', - 36: 'Palm Control', - 37: 'Quick Shot', - 38: 'Tripod', - 39: 'ActiveTrack Spotlight', - 41: 'Motors Just Started', - 43: 'GPS Gentle', - 255: 'Unknown', - }; - const FLIGHT_MODE_MAPPING_V5 = { - 0: 'Manual', - 1: 'Attitude', - 2: 'GPS Normal', - 3: 'POI', - 4: 'Takeoff Ready', - 5: 'Auto Takeoff', - 6: 'Auto Landing', - 7: 'Waypoint', - 8: 'Go Home', - 9: 'Virtual Stick', - 10: 'Smart Flight', - 11: 'Pano', - 12: 'GPS Sport', - 13: 'GPS Tripod', - 14: 'Auto Avoidance', - 15: 'Smart Fly', - 16: 'Force Landing', - 17: 'Attitude Landing', - 18: 'Click Go', - 19: 'Cinematic', - 20: 'Draw', - 21: 'GPS Follow Me', - 22: 'GPS Novice', - 23: 'Quick Movie', - 24: 'Tap Fly', - 25: 'Master Shot', - 26: 'APAS', - 27: 'Timelapse', - 28: 'Motors Start', - 29: 'Unknown', - }; - - Buffer.from([239, 187, 191]); - - const INT_FIELDS = new Set([ - exports.FlightLogHeader.AircraftBatteryCell1Voltage, - exports.FlightLogHeader.AircraftBatteryCell2Voltage, - exports.FlightLogHeader.AircraftBatteryCell3Voltage, - exports.FlightLogHeader.AircraftBatteryCell4Voltage, - exports.FlightLogHeader.AircraftBatteryCharge, - exports.FlightLogHeader.AircraftBatteryCurrent, - exports.FlightLogHeader.AircraftBatteryTemperature, - exports.FlightLogHeader.AircraftBatteryVoltage, - exports.FlightLogHeader.AircraftCameraLensFocusModeValue, - exports.FlightLogHeader.AircraftCameraLensFocusStatusValue, - exports.FlightLogHeader.AircraftCameraModeValue, - exports.FlightLogHeader.AircraftFlightModeValue, - exports.FlightLogHeader.AircraftGPSSignalValue, - exports.FlightLogHeader.AircraftNoFlyValue, - exports.FlightLogHeader.AircraftSatellites, - exports.FlightLogHeader.GimbalModeValue, - exports.FlightLogHeader.AircraftSmartGoHomeRadius, - exports.FlightLogHeader.AircraftSmartGoHomeCountdown, - exports.FlightLogHeader.AircraftVelocityX, - exports.FlightLogHeader.AircraftVelocityY, - exports.FlightLogHeader.AircraftVelocityZ, - exports.FlightLogHeader.RCHorizontalAccuaracy, - exports.FlightLogHeader.RCLatitude, - exports.FlightLogHeader.RCLongitude, - exports.FlightLogHeader.LandingGearStatusValue, - exports.FlightLogHeader.LandingGearModeValue, - exports.FlightLogHeader.RCStateValue, - exports.FlightLogHeader.RCLandingGearValue, - ]); - const FLOAT_FIELDS = new Set([ - exports.FlightLogHeader.AircraftBarometricAltitude, - exports.FlightLogHeader.AircraftBatteryPowerPercent, - exports.FlightLogHeader.AircraftCameraSDCardRemainingPercent, - exports.FlightLogHeader.AircraftHeading, - exports.FlightLogHeader.AircraftLatitude, - exports.FlightLogHeader.AircraftLongitude, - exports.FlightLogHeader.AircraftNoFlyLatitude, - exports.FlightLogHeader.AircraftNoFlyLongitude, - exports.FlightLogHeader.AircraftNoFlyRadius, - exports.FlightLogHeader.AircraftPitch, - exports.FlightLogHeader.AircraftRoll, - exports.FlightLogHeader.AircraftSmartGoHomeFlightReturnTime, - exports.FlightLogHeader.AircraftSmartGoHomeFlightTimeRemaining, - exports.FlightLogHeader.AircraftSmartGoHomeLandingPower, - exports.FlightLogHeader.AircraftSmartGoHomeLandingTime, - exports.FlightLogHeader.AircraftSmartGoHomeReturnPower, - exports.FlightLogHeader.AircraftSpeed, - exports.FlightLogHeader.AircraftUltrasonicAltitude, - exports.FlightLogHeader.DeviceToAircraftDistance, - exports.FlightLogHeader.ElapsedTime, - exports.FlightLogHeader.GimbalPitch, - exports.FlightLogHeader.GimbalPitchAtStop, - exports.FlightLogHeader.GimbalRoll, - exports.FlightLogHeader.GimbalRollAtStop, - exports.FlightLogHeader.GimbalYaw, - exports.FlightLogHeader.GimbalYawAtStop, - exports.FlightLogHeader.HomeLatitude, - exports.FlightLogHeader.HomeLongitude, - exports.FlightLogHeader.RCBatteryPercentRemaining, - exports.FlightLogHeader.RCLeftHorizontal, - exports.FlightLogHeader.RCRightHorizontal, - exports.FlightLogHeader.RCLeftVertical, - exports.FlightLogHeader.RCRightVertical, - ]); - const BOOL_FIELDS = new Set([ - exports.FlightLogHeader.AircraftCameraBurstCapture, - exports.FlightLogHeader.AircraftCameraIntervalCapture, - exports.FlightLogHeader.AircraftCameraLensAFAssistant, - exports.FlightLogHeader.AircraftCameraLensAFEnabled, - exports.FlightLogHeader.AircraftCameraLensAssistantWorking, - exports.FlightLogHeader.AircraftCameraOverheated, - exports.FlightLogHeader.AircraftCameraRawCapture, - exports.FlightLogHeader.AircraftCameraBurstCapture, - exports.FlightLogHeader.AircraftCameraRecording, - exports.FlightLogHeader.AircraftCameraSDCardExists, - exports.FlightLogHeader.AircraftCameraSensorError, - exports.FlightLogHeader.AircraftCameraSingleCapture, - exports.FlightLogHeader.AircraftCameraStoringPhoto, - exports.FlightLogHeader.AircraftFlying, - exports.FlightLogHeader.AircraftIMUPreheating, - exports.FlightLogHeader.AircraftMotorsOn, - exports.FlightLogHeader.AircraftSmartGoHomeRequesting, - exports.FlightLogHeader.AircraftUltrasonicOn, - exports.FlightLogHeader.AircraftVisionOn, - exports.FlightLogHeader.LandingGearIsMovable, - exports.FlightLogHeader.RCGoHome, - exports.FlightLogHeader.RCRecord, - exports.FlightLogHeader.RCShutter, - exports.FlightLogHeader.RCPlayback, - exports.FlightLogHeader.RCPause, - exports.FlightLogHeader.RCCustom1, - exports.FlightLogHeader.RCCustom2, - exports.FlightLogHeader.RCSattelites, - exports.FlightLogHeader.RCGSPDataIsValid, - exports.FlightLogHeader.RCLeftHorizontal, - exports.FlightLogHeader.RCRightHorizontal, - exports.FlightLogHeader.RCLeftVertical, - exports.FlightLogHeader.RCRightVertical, - exports.FlightLogHeader.AircraftCameraChangeableLensSupported, - exports.FlightLogHeader.AircraftCameraLensInstalled, - exports.FlightLogHeader.AircraftCameraLensMFAssistant, - ]); - const DATE_FIELDS = new Set([ - exports.FlightLogHeader.DateTime, - ]); - - const syncParse = require('csv-parse/lib/sync'); - const META_REGEX = { - appVersion: /^#DroneDeploy\s+(.+)$/, - sessionId: /^Session ID\s+(.+)$/, - sessionStart: /^Session Start\s+(.+)$/, - sessionEnd: /^Date\/Time \(UTC\)\s+(.+)$/, - deviceModel: /^Device Model\s+(.+)$/, - deviceOS: /^Device Operating System\s+(.+)$/, - aircraftModel: /^Aircraft Model\s+(.+)$/, - aircraftName: /^Aircraft Name\s+(.+)$/, - aircraftFirmware: /^Aircraft Firmware\s+(.+)$/, - batteryChargeVolume: /^Full Charge Volume \(mAh\)\s+(.+)$/, - batteryRemainingLife: /^Remaining Life \(%\)\s+(.+)$/, - batteryDischarges: /^Discharges\s+(.+)$/, - batteryCells: /^Battery Cells Number\s+(.+)$/, - batterySerialNumber: /^Battery Serial Number\s+(.+)$/, - batteryFirmware: /^Battery Firmware\s+(.+)$/, - fcSerialNumber: /^Flight Controller Serial Number\s+(.+)$/, - fcFirmware: /^Flight Controller Firmware\s+(.+)$/, - footerLines: /^#Flight Recorder Session End|^Date\/Time \(UTC\)|^Elapsed Time \(sec\)/, - gimbalFirmware: /^Gimbal Firmware\s+(.+)$/, - rcSerialNumber: /^Remote Control Serial Number\s+(.+)$/, - rcFirmware: /^Remote Control Firmware\s+(.+)$/, - cameraSerialNumber: /^Camera Serial Number\s+(.+)$/, - elapsedTime: /^Elapsed Time \(sec\)\s+(.+)$/, - userId: /^User ID\s+(.+)$/, - organizationId: /^Organization ID\s+(.+)$/, - platform: /^Platform\s+(.+)$/, - }; - class QuasiSubject { - constructor() { - this.subscribers = []; - this.errorSubscribers = []; - this.completionSubscribers = []; - this.isFinished = false; - } - next(value) { - if (this.isFinished) { - return; - } - this.subscribers.forEach((s) => s(value)); - } - complete() { - if (this.isFinished) { - return; - } - this.isFinished = true; - this.completionSubscribers.forEach((sub) => sub()); - } - error(error) { - if (this.isFinished) { - return; - } - this.errorSubscribers.forEach((errSub) => errSub(error)); - this.complete(); - } - subscribe(sub, errSub, completionSub) { - this.subscribers.push(sub); - if (errSub) { - this.errorSubscribers.push(errSub); - } - if (completionSub) { - this.completionSubscribers.push(completionSub); - } - } - toPromise() { - const source = this; - return new Promise(function (resolve, reject) { - let value; - source.subscribe(function (v) { - value = v; - }, reject, function () { - resolve(value); - }); - }); - } - } - function parseLogStream(logStream) { - const headerMetaLines = []; - let meta = {}; - let rowHeaderLine; - let row; - const progress = { index: 0, completed: false }; - let end; - const result = new QuasiSubject(); - logStream.subscribe((line) => { - line = line.trim(); - if (!line.length) { - return; - } - if (!rowHeaderLine) { - if (line.startsWith(exports.FlightLogHeader.DateTime.split(' ')[0])) { // Strip off timezone. - rowHeaderLine = line; - meta = parseMetaData(headerMetaLines, []); - result.next({ - meta, - rowIndex: progress.index - }); - } - else { - headerMetaLines.push(line); - progress.index++; - } - return; - } - if (META_REGEX.footerLines.test(line)) { - if (META_REGEX.sessionEnd.test(line)) { - end = fromUtcDateStr(findMatch([line], META_REGEX.sessionEnd)); - } - else if (META_REGEX.elapsedTime.test(line)) { - const elapsed = findMatch([line], META_REGEX.elapsedTime); - // This is the end of the parsing. Because normal lines are parsed through a Promise, they will be delivered - // asynchronously. So we must ensure that this result is also delivered asynchronously. - setTimeout(() => { - const parsedElapsed = elapsed === 'N/A' ? 0 : parseFloat(elapsed); - if (parsedElapsed) { - meta.session.elapsed = parsedElapsed; - } - if (end) { - meta.session.end = end; - } - result.next({ - meta, - rowIndex: progress.index++, - }); - result.complete(); - progress.completed = true; - }, 0); - } - } - else { - parseBody([rowHeaderLine, line]).then((rows) => { - row = rows[0]; - meta.session.end = row[exports.FlightLogHeader.DateTime]; - meta.session.elapsed = row[exports.FlightLogHeader.ElapsedTime]; - result.next({ - meta, - rowIndex: progress.index++, - row, - info: parseJsonInfo(row.Info), // Parsed Info column, if the column was populated with a JSON array. - }); - }); - } - }, (err) => { console.error('parsing error: ' + err); result.complete(); }, () => { - if (!progress.completed) { - setTimeout(() => { - result.complete(); - progress.completed = true; - }, 0); - } - }); - return result; - } - function parseLog(log) { - const lines = log.split('\n'); - const subject = new QuasiSubject(); - const parse = parseLogStream(subject); - const flightLog = { - metaData: {}, - rows: [], - infos: [] - }; - parse.subscribe((event) => { - // The metadata is updated as the file is parsed, so always grab the latest one. - flightLog.metaData = (event.meta) ? event.meta : flightLog.metaData; - if (event.row) { - flightLog.rows.push(event.row); - } - if (event.info) { - // @ts-ignore - flightLog.infos.push(event.info); - } - }); - lines.forEach(l => subject.next(l)); - subject.complete(); - return new Promise((resolve, reject) => { - parse.toPromise().then(() => resolve(flightLog)).catch((reason => reject(reason))); - }); - } - function parseBody(lines, sync) { - const text = lines.join('\n'); - const options = { - delimiter: '\t', - escape: null, - from: 1, - quote: null, - relax_column_count: true, - }; - return new Promise((resolve, reject) => { - const onResults = (err, result) => { - const [headers, ...rows] = result; - const logs = rows.map((row) => { - const log = {}; - for (let i = 0; i < headers.length; i++) { - const header = headers[i].trim(); - let value = row[i]; - if (INT_FIELDS.has(header)) { - value = parseInt(value, 10); - } - if (FLOAT_FIELDS.has(header)) { - value = parseFloat(value); - } - if (BOOL_FIELDS.has(header)) { - value = value !== '0'; - } - if (DATE_FIELDS.has(header)) { - value = fromUtcDateStr(value); - } - log[header] = value; - } - return log; - }); - resolve(logs); - }; - { - const results = syncParse(text, options); - onResults(undefined, results); - } - }); - } - function findMatch(search, regex, isNum) { - let match; - for (let str of search) { - match = str.match(regex); - if (match) { - break; - } - } - if (!match) { - return isNum ? '0' : 'N/A'; - } - return match[1]; - } - function isValidDate(d) { - return d instanceof Date && !isNaN(d); - } - function fromUtcDateStr(utcDateStr) { - if (isValidDate(utcDateStr)) { - return utcDateStr; - } - const isBadDate = !utcDateStr || !utcDateStr.trim().length || utcDateStr === 'N/A'; - if (isBadDate) { - return null; - } - if (!/Z$/.test(utcDateStr)) { - utcDateStr = utcDateStr + '.000Z'; - } - return new Date(utcDateStr); - } - function parseMetaData(headers, footers) { - const meta = [...headers, ...footers]; - let end = findMatch(meta, META_REGEX.sessionEnd); - let elapsed = findMatch(meta, META_REGEX.elapsedTime); - // if we weren't able to parse an end date or an elapsed time from our footer (which is really just the last three - // lines of the log file), it's likely that we have a truncated log file. if that's the case, we can still salvage - // some valid data by parsing the date and elapsed time from the very last log row in the file, which is what we're - // doing below. it's pretty brittle, but it's preferred to having an invalid end date and a NaN elapsed time. - if ((end === 'N/A' || elapsed === 'N/A') && footers.length > 0) { - const lastLine = footers[footers.length - 1]; - const pieces = lastLine.split('\t'); - // if we don't have at least two pieces, i don't know what is in `footer` so i'm just going to leave it alone - if (pieces.length >= 2) { - end = pieces[0]; - elapsed = pieces[1]; - } - } - return { - appVersion: findMatch(meta, META_REGEX.appVersion), - session: { - id: findMatch(meta, META_REGEX.sessionId), - start: fromUtcDateStr(findMatch(meta, META_REGEX.sessionStart)), - end: fromUtcDateStr(end), - elapsed: elapsed === 'N/A' ? 0 : parseFloat(elapsed), - }, - device: { - model: findMatch(meta, META_REGEX.deviceModel), - os: findMatch(meta, META_REGEX.deviceOS).replace(/\t/g, ' '), - platform: findMatch(meta, META_REGEX.platform), - }, - aircraft: { - model: findMatch(meta, META_REGEX.aircraftModel), - name: findMatch(meta, META_REGEX.aircraftName), - firmware: findMatch(meta, META_REGEX.aircraftFirmware), - }, - battery: { - chargeVolume: parseInt(findMatch(meta, META_REGEX.batteryChargeVolume, true), 10), - remainingLifePercent: parseInt(findMatch(meta, META_REGEX.batteryRemainingLife, true), 10), - discharges: parseInt(findMatch(meta, META_REGEX.batteryDischarges, true), 10), - cells: parseInt(findMatch(meta, META_REGEX.batteryCells, true), 10), - firmware: findMatch(meta, META_REGEX.batteryFirmware), - serialNumber: findMatch(meta, META_REGEX.batterySerialNumber), - }, - flightController: { - serialNumber: findMatch(meta, META_REGEX.fcSerialNumber), - firmware: findMatch(meta, META_REGEX.fcFirmware), - }, - gimbal: { - firmware: findMatch(meta, META_REGEX.gimbalFirmware), - }, - remoteController: { - serialNumber: findMatch(meta, META_REGEX.rcSerialNumber), - firmware: findMatch(meta, META_REGEX.rcFirmware), - }, - camera: { - serialNumber: findMatch(meta, META_REGEX.cameraSerialNumber), - }, - user: { - userId: findMatch(meta, META_REGEX.userId), - organizationId: findMatch(meta, META_REGEX.organizationId), - }, - }; - } - /** - * Parse out the given string and return an object if the string is JSON, return undefined otherwise. - * - * @param info - */ - function parseJsonInfo(info) { - if (!info) { - return undefined; - } - try { - return JSON.parse(info); - } - catch (e) { - return undefined; - } - } - - exports.FLIGHT_MODE_MAPPING_V4 = FLIGHT_MODE_MAPPING_V4; - exports.FLIGHT_MODE_MAPPING_V5 = FLIGHT_MODE_MAPPING_V5; - exports.QuasiSubject = QuasiSubject; - exports.fromUtcDateStr = fromUtcDateStr; - exports.parseLog = parseLog; - exports.parseLogStream = parseLogStream; - -})); +!function(e,a){"object"==typeof exports&&"undefined"!=typeof module?a(exports,require("stream")):"function"==typeof define&&define.amd?define(["exports","stream"],a):a((e="undefined"!=typeof globalThis?globalThis:e||self).flightLogParser={})}(this,(function(e){"use strict";var a;e.FlightLogHeader=void 0,(a=e.FlightLogHeader||(e.FlightLogHeader={})).DateTime="Date/Time (UTC)",a.ElapsedTime="Elapsed Time (sec)",a.Info="Info",a.DeviceLatitude="Device Latitude (Degrees)",a.DeviceLongitude="Device Longitude (Degrees)",a.DeviceLocationLastUpdated="Device Location Last Updated (ms)",a.AircraftBatteryPowerPercent="Aircraft Battery Power (%)",a.AircraftBatteryCharge="Aircraft Battery Charge (mAh)",a.AircraftBatteryCurrent="Aircraft Battery Current (mA)",a.AircraftBatteryVoltage="Aircraft Battery Voltage (mV)",a.AircraftBatteryTemperature="Aircraft Battery Temperature (Fahrenheit)",a.AircraftBatteryLastUpdated="Aircraft Battery Last Updated (ms)",a.AircraftBatteryCell1Voltage="Aircraft Battery Cell 1 Voltage",a.AircraftBatteryCell2Voltage="Aircraft Battery Cell 2 Voltage",a.AircraftBatteryCell3Voltage="Aircraft Battery Cell 3 Voltage",a.AircraftBatteryCell4Voltage="Aircraft Battery Cell 4 Voltage",a.AircraftBatteryCellVoltageLastUpdated="Aircraft Battery Cell Voltage Last Updated (ms)",a.AircraftLatitude="Aircraft Latitude (Degrees)",a.AircraftLongitude="Aircraft Longitude (Degrees)",a.AircraftSpeed="Aircraft Speed (mph)",a.AircraftBarometricAltitude="Aircraft Barometric Altitude (ft)",a.AircraftHeading="Aircraft Heading (Degrees)",a.AircraftVelocityX="Aircraft Vel - X (mph)",a.AircraftVelocityY="Aircraft Vel - Y (mph)",a.AircraftVelocityZ="Aircraft Vel - Z (mph)",a.AircraftPitch="Aircraft Pitch (Degrees)",a.AircraftRoll="Aircraft Roll (Degrees)",a.AircraftSatellites="Aircraft Satellites",a.AircraftMotorsOn="Aircraft Motors On",a.AircraftFlying="Aircraft Flying",a.AircraftFlightMode="Aircraft Flight Mode",a.AircraftFlightModeValue="Aircraft Flight Mode Value",a.AircraftIMUPreheating="Aircraft IMU Preheating",a.AircraftUltrasonicOn="Aircraft Ultrasonic On",a.AircraftUltrasonicAltitude="Aircraft Ultrasonic Altitude (ft)",a.AircraftVisionOn="Aircraft Vision On",a.AircraftGPSSignal="Aircraft GPS Signal",a.AircraftGPSSignalValue="Aircraft GPS Signal Value",a.AircraftNoFly="Aircraft No-fly",a.AircraftNoFlyValue="Aircraft No-fly Value",a.AircraftNoFlyLatitude="Aircraft No-fly Latitude (Degrees)",a.AircraftNoFlyLongitude="Aircraft No-fly Longitude (Degrees)",a.AircraftNoFlyRadius="Aircraft No-fly Radius (ft)",a.HomeLatitude="Home Latitude (Degrees)",a.HomeLongitude="Home Longitude (Degrees)",a.AircraftSmartGoHomeFlightTimeRemaining="Aircraft Smart Go-home Flight Time Remaining (sec)",a.AircraftSmartGoHomeFlightReturnTime="Aircraft Smart Go-home Flight Return Time (sec)",a.AircraftSmartGoHomeLandingTime="Aircraft Smart Go-home Landing Time (sec)",a.AircraftSmartGoHomeReturnPower="Aircraft Smart Go-home Return Power (%)",a.AircraftSmartGoHomeLandingPower="Aircraft Smart Go-home Landing Power (%)",a.AircraftSmartGoHomeRadius="Aircraft Smart Go-home Radius (ft)",a.AircraftSmartGoHomeCountdown="Aircraft Smart Go-home Countdown (sec)",a.AircraftSmartGoHomeRequesting="Aircraft Smart Go-home Requesting",a.AircraftSystemStateLastUpdated="Aircraft System State Last Updated (ms)",a.GimbalPitch="Gimbal Pitch (Degrees)",a.GimbalRoll="Gimbal Roll (Degrees)",a.GimbalYaw="Gimbal Yaw (Degrees)",a.GimbalMode="Gimbal Mode",a.GimbalModeValue="Gimbal Mode Value",a.GimbalPitchAtStop="Gimbal Pitch at Stop",a.GimbalRollAtStop="Gimbal Roll at Stop",a.GimbalYawAtStop="Gimbal Yaw at Stop",a.GimbalStatusLastUpdated="Gimbal Status Last Updated (ms)",a.LandingGearIsMovable="Landing Gear is Movable",a.LandingGearStatus="Landing Gear Status",a.LandingGearStatusValue="Landing Gear Status Value",a.LandingGearMode="Landing Gear Mode",a.LandingGearModeValue="Landing Gear Mode Value",a.LandingGearLastUpdated="Landing Gear Last Updated (ms)",a.RCState="RC State",a.RCStateValue="RC State Value",a.RCLeftHorizontal="RC Left Horizontal",a.RCLeftVertical="RC Left Vertical",a.RCRightHorizontal="RC Right Horizontal",a.RCRightVertical="RC Right Vertical",a.RCLeftWheel="RC Left Wheel",a.RCRightWheel="RC Right Wheel",a.RCLandingGear="RC Landing Gear",a.RCLandingGearValue="RC Landing Gear Value",a.RCGoHome="RC Go Home",a.RCRecord="RC Record ",a.RCShutter="RC Shutter",a.RCPlayback="RC Playback",a.RCPause="RC Pause",a.RCCustom1="RC Custom 1",a.RCCustom2="RC Custom 2",a.RCStateLastUpdated="RC State Last Updated (ms)",a.RCBatteryPercentRemaining="RC Battery (%)",a.RCBatteryStateLastUpdated="RC Battery State Last Updated (ms)",a.RCSattelites="RC Sattelites",a.RCHorizontalAccuaracy="RC Horizontal Accuaracy (ft)",a.RCLatitude="RC Latitude (Degrees)",a.RCLongitude="RC Longitude (Degrees)",a.RCGSPDataIsValid="RC GSP Data is Valid",a.RCGPSStateLastUpdated="RC GPS State Last Updated (ms)",a.RCSignal1="RC Signal 1",a.RCSignal2="RC Signal 2",a.RCSignalLastUpdated="RC Signal Last Updated (ms)",a.LBSignal1="LB Signal 1",a.LBSignal2="LB Signal 2",a.LBSignalLastUpdated="LB Signal Last Updated (ms)",a.AircraftCameraMode="Aircraft Camera Mode",a.AircraftCameraModeValue="Aircraft Camera Mode Value",a.AircraftCameraOverheated="Aircraft Camera Overheated",a.AircraftCameraSensorError="Aircraft Camera Sensor Error",a.AircraftCameraRecording="Aircraft Camera Recording",a.AircraftCameraRawCapture="Aircraft Camera Raw Capture",a.AircraftCameraIntervalCapture="Aircraft Camera Interval Capture",a.AircraftCameraBurstCapture="Aircraft Camera Burst Capture",a.AircraftCameraSingleCapture="Aircraft Camera Single Capture",a.AircraftCameraStoringPhoto="Aircraft Camera Storing Photo",a.AircraftCameraStateLastUpdated="Aircraft Camera State Last Updated (ms)",a.AircraftCameraSDCardExists="Aircraft Camera SD Card Exists",a.AircraftCameraSDCardRemainingPercent="Aircraft Camera SD Card Remaining (%)",a.AircraftCameraSDCardStateLastUpdated="Aircraft Camera SD Card State Last Updated (ms)",a.AircraftCameraChangeableLensSupported="Aircraft Camera Changeable Lens Supported",a.AircraftCameraLensInstalled="Aircraft Camera Lens Installed",a.AircraftCameraLensType="Aircraft Camera Lens Type",a.AircraftCameraLensAFEnabled="Aircraft Camera Lens AF Enabled",a.AircraftCameraLensFocusMode="Aircraft Camera Lens Focus Mode",a.AircraftCameraLensFocusModeValue="Aircraft Camera Lens Focus Mode Value",a.AircraftCameraLensFocusStatus="Aircraft Camera Lens Focus Status",a.AircraftCameraLensFocusStatusValue="Aircraft Camera Lens Focus Status Value",a.AircraftCameraLensMFAssistant="Aircraft Camera Lens MF Assistant",a.AircraftCameraLensAFAssistant="Aircraft Camera Lens AF Assistant",a.AircraftCameraLensAssistantWorking="Aircraft Camera Lens Assistant Working",a.AircraftCameraLensStateLastUpdated="Aircraft Camera Lens State Last Updated (ms)",a.CompassIndex="Compass Index",a.CompassSensorValue="Compass Sensor Value",a.CompassState="Compass State",a.CompassStateLastUpdated="Compass State Last Updated (ms)",a.CompassCalibrationState="Compass Calibration State",a.CompassCalibrationLastUpdated="Compass Calibration Last Updated (ms)",a.DeviceToAircraftDistance="Device > Aircraft Distance - XY (ft)";Buffer.from([239,187,191]);const t=new Set([e.FlightLogHeader.AircraftBatteryCell1Voltage,e.FlightLogHeader.AircraftBatteryCell2Voltage,e.FlightLogHeader.AircraftBatteryCell3Voltage,e.FlightLogHeader.AircraftBatteryCell4Voltage,e.FlightLogHeader.AircraftBatteryCharge,e.FlightLogHeader.AircraftBatteryCurrent,e.FlightLogHeader.AircraftBatteryTemperature,e.FlightLogHeader.AircraftBatteryVoltage,e.FlightLogHeader.AircraftCameraLensFocusModeValue,e.FlightLogHeader.AircraftCameraLensFocusStatusValue,e.FlightLogHeader.AircraftCameraModeValue,e.FlightLogHeader.AircraftFlightModeValue,e.FlightLogHeader.AircraftGPSSignalValue,e.FlightLogHeader.AircraftNoFlyValue,e.FlightLogHeader.AircraftSatellites,e.FlightLogHeader.GimbalModeValue,e.FlightLogHeader.AircraftSmartGoHomeRadius,e.FlightLogHeader.AircraftSmartGoHomeCountdown,e.FlightLogHeader.AircraftVelocityX,e.FlightLogHeader.AircraftVelocityY,e.FlightLogHeader.AircraftVelocityZ,e.FlightLogHeader.RCHorizontalAccuaracy,e.FlightLogHeader.RCLatitude,e.FlightLogHeader.RCLongitude,e.FlightLogHeader.LandingGearStatusValue,e.FlightLogHeader.LandingGearModeValue,e.FlightLogHeader.RCStateValue,e.FlightLogHeader.RCLandingGearValue]),r=new Set([e.FlightLogHeader.AircraftBarometricAltitude,e.FlightLogHeader.AircraftBatteryPowerPercent,e.FlightLogHeader.AircraftCameraSDCardRemainingPercent,e.FlightLogHeader.AircraftHeading,e.FlightLogHeader.AircraftLatitude,e.FlightLogHeader.AircraftLongitude,e.FlightLogHeader.AircraftNoFlyLatitude,e.FlightLogHeader.AircraftNoFlyLongitude,e.FlightLogHeader.AircraftNoFlyRadius,e.FlightLogHeader.AircraftPitch,e.FlightLogHeader.AircraftRoll,e.FlightLogHeader.AircraftSmartGoHomeFlightReturnTime,e.FlightLogHeader.AircraftSmartGoHomeFlightTimeRemaining,e.FlightLogHeader.AircraftSmartGoHomeLandingPower,e.FlightLogHeader.AircraftSmartGoHomeLandingTime,e.FlightLogHeader.AircraftSmartGoHomeReturnPower,e.FlightLogHeader.AircraftSpeed,e.FlightLogHeader.AircraftUltrasonicAltitude,e.FlightLogHeader.DeviceToAircraftDistance,e.FlightLogHeader.ElapsedTime,e.FlightLogHeader.GimbalPitch,e.FlightLogHeader.GimbalPitchAtStop,e.FlightLogHeader.GimbalRoll,e.FlightLogHeader.GimbalRollAtStop,e.FlightLogHeader.GimbalYaw,e.FlightLogHeader.GimbalYawAtStop,e.FlightLogHeader.HomeLatitude,e.FlightLogHeader.HomeLongitude,e.FlightLogHeader.RCBatteryPercentRemaining,e.FlightLogHeader.RCLeftHorizontal,e.FlightLogHeader.RCRightHorizontal,e.FlightLogHeader.RCLeftVertical,e.FlightLogHeader.RCRightVertical]),i=new Set([e.FlightLogHeader.AircraftCameraBurstCapture,e.FlightLogHeader.AircraftCameraIntervalCapture,e.FlightLogHeader.AircraftCameraLensAFAssistant,e.FlightLogHeader.AircraftCameraLensAFEnabled,e.FlightLogHeader.AircraftCameraLensAssistantWorking,e.FlightLogHeader.AircraftCameraOverheated,e.FlightLogHeader.AircraftCameraRawCapture,e.FlightLogHeader.AircraftCameraBurstCapture,e.FlightLogHeader.AircraftCameraRecording,e.FlightLogHeader.AircraftCameraSDCardExists,e.FlightLogHeader.AircraftCameraSensorError,e.FlightLogHeader.AircraftCameraSingleCapture,e.FlightLogHeader.AircraftCameraStoringPhoto,e.FlightLogHeader.AircraftFlying,e.FlightLogHeader.AircraftIMUPreheating,e.FlightLogHeader.AircraftMotorsOn,e.FlightLogHeader.AircraftSmartGoHomeRequesting,e.FlightLogHeader.AircraftUltrasonicOn,e.FlightLogHeader.AircraftVisionOn,e.FlightLogHeader.LandingGearIsMovable,e.FlightLogHeader.RCGoHome,e.FlightLogHeader.RCRecord,e.FlightLogHeader.RCShutter,e.FlightLogHeader.RCPlayback,e.FlightLogHeader.RCPause,e.FlightLogHeader.RCCustom1,e.FlightLogHeader.RCCustom2,e.FlightLogHeader.RCSattelites,e.FlightLogHeader.RCGSPDataIsValid,e.FlightLogHeader.RCLeftHorizontal,e.FlightLogHeader.RCRightHorizontal,e.FlightLogHeader.RCLeftVertical,e.FlightLogHeader.RCRightVertical,e.FlightLogHeader.AircraftCameraChangeableLensSupported,e.FlightLogHeader.AircraftCameraLensInstalled,e.FlightLogHeader.AircraftCameraLensMFAssistant]),o=new Set([e.FlightLogHeader.DateTime]),l=require("csv-parse/lib/sync"),s={appVersion:/^#DroneDeploy\s+(.+)$/,sessionId:/^Session ID\s+(.+)$/,sessionStart:/^Session Start\s+(.+)$/,sessionEnd:/^Date\/Time \(UTC\)\s+(.+)$/,deviceModel:/^Device Model\s+(.+)$/,deviceOS:/^Device Operating System\s+(.+)$/,aircraftModel:/^Aircraft Model\s+(.+)$/,aircraftName:/^Aircraft Name\s+(.+)$/,aircraftFirmware:/^Aircraft Firmware\s+(.+)$/,batteryChargeVolume:/^Full Charge Volume \(mAh\)\s+(.+)$/,batteryRemainingLife:/^Remaining Life \(%\)\s+(.+)$/,batteryDischarges:/^Discharges\s+(.+)$/,batteryCells:/^Battery Cells Number\s+(.+)$/,batterySerialNumber:/^Battery Serial Number\s+(.+)$/,batteryFirmware:/^Battery Firmware\s+(.+)$/,fcSerialNumber:/^Flight Controller Serial Number\s+(.+)$/,fcFirmware:/^Flight Controller Firmware\s+(.+)$/,footerLines:/^#Flight Recorder Session End|^Date\/Time \(UTC\)|^Elapsed Time \(sec\)/,gimbalFirmware:/^Gimbal Firmware\s+(.+)$/,rcSerialNumber:/^Remote Control Serial Number\s+(.+)$/,rcFirmware:/^Remote Control Firmware\s+(.+)$/,cameraSerialNumber:/^Camera Serial Number\s+(.+)$/,elapsedTime:/^Elapsed Time \(sec\)\s+(.+)$/,userId:/^User ID\s+(.+)$/,organizationId:/^Organization ID\s+(.+)$/,platform:/^Platform\s+(.+)$/};class n{constructor(){this.subscribers=[],this.errorSubscribers=[],this.completionSubscribers=[],this.isFinished=!1}next(e){this.isFinished||this.subscribers.forEach((a=>a(e)))}complete(){this.isFinished||(this.isFinished=!0,this.completionSubscribers.forEach((e=>e())))}error(e){this.isFinished||(this.errorSubscribers.forEach((a=>a(e))),this.complete())}subscribe(e,a,t){this.subscribers.push(e),a&&this.errorSubscribers.push(a),t&&this.completionSubscribers.push(t)}toPromise(){const e=this;return new Promise((function(a,t){let r;e.subscribe((function(e){r=e}),t,(function(){a(r)}))}))}}function c(a){const c=[];let f,A,L={};const u={index:0,completed:!1};let C;const h=new n;return a.subscribe((a=>{if((a=a.trim()).length)if(f)if(s.footerLines.test(a)){if(s.sessionEnd.test(a))C=d(g([a],s.sessionEnd));else if(s.elapsedTime.test(a)){const e=g([a],s.elapsedTime);setTimeout((()=>{const a="N/A"===e?0:parseFloat(e);a&&(L.session.elapsed=a),C&&(L.session.end=C),h.next({meta:L,rowIndex:u.index++}),h.complete(),u.completed=!0}),0)}}else(function(e){const a=e.join("\n"),s={delimiter:"\t",escape:null,from:1,quote:null,relax_column_count:!0};return new Promise(((e,n)=>{const c=(a,l)=>{const[s,...n]=l,c=n.map((e=>{const a={};for(let l=0;l{A=a[0],L.session.end=A[e.FlightLogHeader.DateTime],L.session.elapsed=A[e.FlightLogHeader.ElapsedTime],h.next({meta:L,rowIndex:u.index++,row:A,info:m(A.Info)})}));else a.startsWith(e.FlightLogHeader.DateTime.split(" ")[0])?(f=a,L=function(e,a){const t=[...e,...a];let r=g(t,s.sessionEnd),i=g(t,s.elapsedTime);if(("N/A"===r||"N/A"===i)&&a.length>0){const e=a[a.length-1].split("\t");e.length>=2&&(r=e[0],i=e[1])}return{appVersion:g(t,s.appVersion),session:{id:g(t,s.sessionId),start:d(g(t,s.sessionStart)),end:d(r),elapsed:"N/A"===i?0:parseFloat(i)},device:{model:g(t,s.deviceModel),os:g(t,s.deviceOS).replace(/\t/g," "),platform:g(t,s.platform)},aircraft:{model:g(t,s.aircraftModel),name:g(t,s.aircraftName),firmware:g(t,s.aircraftFirmware)},battery:{chargeVolume:parseInt(g(t,s.batteryChargeVolume,!0),10),remainingLifePercent:parseInt(g(t,s.batteryRemainingLife,!0),10),discharges:parseInt(g(t,s.batteryDischarges,!0),10),cells:parseInt(g(t,s.batteryCells,!0),10),firmware:g(t,s.batteryFirmware),serialNumber:g(t,s.batterySerialNumber)},flightController:{serialNumber:g(t,s.fcSerialNumber),firmware:g(t,s.fcFirmware)},gimbal:{firmware:g(t,s.gimbalFirmware)},remoteController:{serialNumber:g(t,s.rcSerialNumber),firmware:g(t,s.rcFirmware)},camera:{serialNumber:g(t,s.cameraSerialNumber)},user:{userId:g(t,s.userId),organizationId:g(t,s.organizationId)}}}(c,[]),h.next({meta:L,rowIndex:u.index})):(c.push(a),u.index++)}),(e=>{console.error("parsing error: "+e),h.complete()}),(()=>{u.completed||setTimeout((()=>{h.complete(),u.completed=!0}),0)})),h}function g(e,a,t){let r;for(let t of e)if(r=t.match(a),r)break;return r?r[1]:t?"0":"N/A"}function d(e){if((a=e)instanceof Date&&!isNaN(a))return e;var a;return e&&e.trim().length&&"N/A"!==e?(/Z$/.test(e)||(e+=".000Z"),new Date(e)):null}function m(e){if(e)try{return JSON.parse(e)}catch(e){return}}e.FLIGHT_MODE_MAPPING_V4={0:"Manual",1:"Attitude",2:"Attitude Course Lock",3:"Attitude Hover",4:"Hover",5:"GPS Brake",6:"GPS Attitude",7:"GPS Course Lock",8:"GPS Home",9:"GPS Hotpoint",10:"Assisted Takeoff",11:"Auto Takeoff",12:"Auto Landing",13:"Attitude Landing",14:"GPS Waypoint",15:"Go Home",16:"Click Go",17:"Joystick",18:"Attitude Limited",19:"Cinematic",23:"Attitude Limited",24:"Draw",25:"GPS Follow Me",26:"ActiveTrack",27:"TapFly",28:"Pano",29:"Farming",30:"FPV",31:"GPS Sport",32:"GPS Novice",33:"Confirm Landing",35:"Terrain Follow",36:"Palm Control",37:"Quick Shot",38:"Tripod",39:"ActiveTrack Spotlight",41:"Motors Just Started",43:"GPS Gentle",255:"Unknown"},e.FLIGHT_MODE_MAPPING_V5={0:"Manual",1:"Attitude",2:"GPS Normal",3:"POI",4:"Takeoff Ready",5:"Auto Takeoff",6:"Auto Landing",7:"Waypoint",8:"Go Home",9:"Virtual Stick",10:"Smart Flight",11:"Pano",12:"GPS Sport",13:"GPS Tripod",14:"Auto Avoidance",15:"Smart Fly",16:"Force Landing",17:"Attitude Landing",18:"Click Go",19:"Cinematic",20:"Draw",21:"GPS Follow Me",22:"GPS Novice",23:"Quick Movie",24:"Tap Fly",25:"Master Shot",26:"APAS",27:"Timelapse",28:"Motors Start",29:"Unknown"},e.QuasiSubject=n,e.fromUtcDateStr=d,e.parseLog=function(e){const a=e.split("\n"),t=new n,r=c(t),i={metaData:{},rows:[],infos:[]};return r.subscribe((e=>{i.metaData=e.meta?e.meta:i.metaData,e.row&&i.rows.push(e.row),e.info&&i.infos.push(e.info)})),a.forEach((e=>t.next(e))),t.complete(),new Promise(((e,a)=>{r.toPromise().then((()=>e(i))).catch((e=>a(e)))}))},e.parseLogStream=c})); //# sourceMappingURL=flight-log-parser.js.map diff --git a/dist/flight-log-parser.js.map b/dist/flight-log-parser.js.map index 28b05bf..e720aae 100644 --- a/dist/flight-log-parser.js.map +++ b/dist/flight-log-parser.js.map @@ -1 +1 @@ -{"version":3,"file":"flight-log-parser.js","sources":["../src/types.ts","../node_modules/csv-parse/lib/index.js","../src/field-types.ts","../src/parser.ts"],"sourcesContent":["export enum FlightLogHeader {\n DateTime = 'Date/Time (UTC)',\n ElapsedTime = 'Elapsed Time (sec)',\n Info = 'Info',\n DeviceLatitude = 'Device Latitude (Degrees)',\n DeviceLongitude = 'Device Longitude (Degrees)',\n DeviceLocationLastUpdated = 'Device Location Last Updated (ms)',\n AircraftBatteryPowerPercent = 'Aircraft Battery Power (%)',\n AircraftBatteryCharge = 'Aircraft Battery Charge (mAh)',\n AircraftBatteryCurrent = 'Aircraft Battery Current (mA)',\n AircraftBatteryVoltage = 'Aircraft Battery Voltage (mV)',\n AircraftBatteryTemperature = 'Aircraft Battery Temperature (Fahrenheit)',\n AircraftBatteryLastUpdated = 'Aircraft Battery Last Updated (ms)',\n AircraftBatteryCell1Voltage = 'Aircraft Battery Cell 1 Voltage',\n AircraftBatteryCell2Voltage = 'Aircraft Battery Cell 2 Voltage',\n AircraftBatteryCell3Voltage = 'Aircraft Battery Cell 3 Voltage',\n AircraftBatteryCell4Voltage = 'Aircraft Battery Cell 4 Voltage',\n AircraftBatteryCellVoltageLastUpdated = 'Aircraft Battery Cell Voltage Last Updated (ms)',\n AircraftLatitude = 'Aircraft Latitude (Degrees)',\n AircraftLongitude = 'Aircraft Longitude (Degrees)',\n AircraftSpeed = 'Aircraft Speed (mph)',\n AircraftBarometricAltitude = 'Aircraft Barometric Altitude (ft)',\n AircraftHeading = 'Aircraft Heading (Degrees)',\n AircraftVelocityX = 'Aircraft Vel - X (mph)',\n AircraftVelocityY = 'Aircraft Vel - Y (mph)',\n AircraftVelocityZ = 'Aircraft Vel - Z (mph)',\n AircraftPitch = 'Aircraft Pitch (Degrees)',\n AircraftRoll = 'Aircraft Roll (Degrees)',\n AircraftSatellites = 'Aircraft Satellites',\n AircraftMotorsOn = 'Aircraft Motors On',\n AircraftFlying = 'Aircraft Flying',\n AircraftFlightMode = 'Aircraft Flight Mode',\n AircraftFlightModeValue = 'Aircraft Flight Mode Value',\n AircraftIMUPreheating = 'Aircraft IMU Preheating',\n AircraftUltrasonicOn = 'Aircraft Ultrasonic On',\n AircraftUltrasonicAltitude = 'Aircraft Ultrasonic Altitude (ft)',\n AircraftVisionOn = 'Aircraft Vision On',\n AircraftGPSSignal = 'Aircraft GPS Signal',\n AircraftGPSSignalValue = 'Aircraft GPS Signal Value',\n AircraftNoFly = 'Aircraft No-fly',\n AircraftNoFlyValue = 'Aircraft No-fly Value',\n AircraftNoFlyLatitude = 'Aircraft No-fly Latitude (Degrees)',\n AircraftNoFlyLongitude = 'Aircraft No-fly Longitude (Degrees)',\n AircraftNoFlyRadius = 'Aircraft No-fly Radius (ft)',\n HomeLatitude = 'Home Latitude (Degrees)',\n HomeLongitude = 'Home Longitude (Degrees)',\n AircraftSmartGoHomeFlightTimeRemaining = 'Aircraft Smart Go-home Flight Time Remaining (sec)',\n AircraftSmartGoHomeFlightReturnTime = 'Aircraft Smart Go-home Flight Return Time (sec)',\n AircraftSmartGoHomeLandingTime = 'Aircraft Smart Go-home Landing Time (sec)',\n AircraftSmartGoHomeReturnPower = 'Aircraft Smart Go-home Return Power (%)',\n AircraftSmartGoHomeLandingPower = 'Aircraft Smart Go-home Landing Power (%)',\n AircraftSmartGoHomeRadius = 'Aircraft Smart Go-home Radius (ft)',\n AircraftSmartGoHomeCountdown = 'Aircraft Smart Go-home Countdown (sec)',\n AircraftSmartGoHomeRequesting = 'Aircraft Smart Go-home Requesting',\n AircraftSystemStateLastUpdated = 'Aircraft System State Last Updated (ms)',\n GimbalPitch = 'Gimbal Pitch (Degrees)',\n GimbalRoll = 'Gimbal Roll (Degrees)',\n GimbalYaw = 'Gimbal Yaw (Degrees)',\n GimbalMode = 'Gimbal Mode',\n GimbalModeValue = 'Gimbal Mode Value',\n GimbalPitchAtStop = 'Gimbal Pitch at Stop',\n GimbalRollAtStop = 'Gimbal Roll at Stop',\n GimbalYawAtStop = 'Gimbal Yaw at Stop',\n GimbalStatusLastUpdated = 'Gimbal Status Last Updated (ms)',\n LandingGearIsMovable = 'Landing Gear is Movable',\n LandingGearStatus = 'Landing Gear Status',\n LandingGearStatusValue = 'Landing Gear Status Value',\n LandingGearMode = 'Landing Gear Mode',\n LandingGearModeValue = 'Landing Gear Mode Value',\n LandingGearLastUpdated = 'Landing Gear Last Updated (ms)',\n RCState = 'RC State',\n RCStateValue = 'RC State Value',\n RCLeftHorizontal = 'RC Left Horizontal',\n RCLeftVertical = 'RC Left Vertical',\n RCRightHorizontal = 'RC Right Horizontal',\n RCRightVertical = 'RC Right Vertical',\n RCLeftWheel = 'RC Left Wheel',\n RCRightWheel = 'RC Right Wheel',\n RCLandingGear = 'RC Landing Gear',\n RCLandingGearValue = 'RC Landing Gear Value',\n RCGoHome = 'RC Go Home',\n RCRecord = 'RC Record ',\n RCShutter = 'RC Shutter',\n RCPlayback = 'RC Playback',\n RCPause = 'RC Pause',\n RCCustom1 = 'RC Custom 1',\n RCCustom2 = 'RC Custom 2',\n RCStateLastUpdated = 'RC State Last Updated (ms)',\n RCBatteryPercentRemaining = 'RC Battery (%)',\n RCBatteryStateLastUpdated = 'RC Battery State Last Updated (ms)',\n RCSattelites = 'RC Sattelites',\n RCHorizontalAccuaracy = 'RC Horizontal Accuaracy (ft)',\n RCLatitude = 'RC Latitude (Degrees)',\n RCLongitude = 'RC Longitude (Degrees)',\n RCGSPDataIsValid = 'RC GSP Data is Valid',\n RCGPSStateLastUpdated = 'RC GPS State Last Updated (ms)',\n RCSignal1 = 'RC Signal 1',\n RCSignal2 = 'RC Signal 2',\n RCSignalLastUpdated = 'RC Signal Last Updated (ms)',\n LBSignal1 = 'LB Signal 1',\n LBSignal2 = 'LB Signal 2',\n LBSignalLastUpdated = 'LB Signal Last Updated (ms)',\n AircraftCameraMode = 'Aircraft Camera Mode',\n AircraftCameraModeValue = 'Aircraft Camera Mode Value',\n AircraftCameraOverheated = 'Aircraft Camera Overheated',\n AircraftCameraSensorError = 'Aircraft Camera Sensor Error',\n AircraftCameraRecording = 'Aircraft Camera Recording',\n AircraftCameraRawCapture = 'Aircraft Camera Raw Capture',\n AircraftCameraIntervalCapture = 'Aircraft Camera Interval Capture',\n AircraftCameraBurstCapture = 'Aircraft Camera Burst Capture',\n AircraftCameraSingleCapture = 'Aircraft Camera Single Capture',\n AircraftCameraStoringPhoto = 'Aircraft Camera Storing Photo',\n AircraftCameraStateLastUpdated = 'Aircraft Camera State Last Updated (ms)',\n AircraftCameraSDCardExists = 'Aircraft Camera SD Card Exists',\n AircraftCameraSDCardRemainingPercent = 'Aircraft Camera SD Card Remaining (%)',\n AircraftCameraSDCardStateLastUpdated = 'Aircraft Camera SD Card State Last Updated (ms)',\n AircraftCameraChangeableLensSupported = 'Aircraft Camera Changeable Lens Supported',\n AircraftCameraLensInstalled = 'Aircraft Camera Lens Installed',\n AircraftCameraLensType = 'Aircraft Camera Lens Type',\n AircraftCameraLensAFEnabled = 'Aircraft Camera Lens AF Enabled',\n AircraftCameraLensFocusMode = 'Aircraft Camera Lens Focus Mode',\n AircraftCameraLensFocusModeValue = 'Aircraft Camera Lens Focus Mode Value',\n AircraftCameraLensFocusStatus = 'Aircraft Camera Lens Focus Status',\n AircraftCameraLensFocusStatusValue = 'Aircraft Camera Lens Focus Status Value',\n AircraftCameraLensMFAssistant = 'Aircraft Camera Lens MF Assistant',\n AircraftCameraLensAFAssistant = 'Aircraft Camera Lens AF Assistant',\n AircraftCameraLensAssistantWorking = 'Aircraft Camera Lens Assistant Working',\n AircraftCameraLensStateLastUpdated = 'Aircraft Camera Lens State Last Updated (ms)',\n CompassIndex = \"Compass Index\",\n CompassSensorValue = \"Compass Sensor Value\",\n CompassState = \"Compass State\",\n CompassStateLastUpdated = \"Compass State Last Updated (ms)\",\n CompassCalibrationState = \"Compass Calibration State\",\n CompassCalibrationLastUpdated = \"Compass Calibration Last Updated (ms)\",\n DeviceToAircraftDistance = 'Device > Aircraft Distance - XY (ft)',\n}\n\nexport type FlightLogRow = {\n [prop in FlightLogHeader]: any // because csv\n};\n\nexport type FlightLogMetaData = {\n appVersion: string;\n session: {\n id: string;\n start: Date;\n end: Date | null;\n elapsed: number;\n };\n device: {\n model: string;\n os: string;\n platform: string;\n };\n aircraft: {\n model: string;\n name: string;\n firmware: string;\n };\n battery: {\n chargeVolume: number;\n remainingLifePercent: number;\n discharges: number;\n cells: number;\n firmware: string;\n serialNumber: string;\n };\n flightController: {\n serialNumber: string;\n firmware: string;\n };\n gimbal: {\n firmware: string;\n };\n remoteController: {\n serialNumber: string;\n firmware: string;\n };\n camera: {\n serialNumber: string;\n };\n user: {\n userId: string;\n organizationId: string;\n };\n};\n\nexport type FlightLog = {\n metaData: FlightLogMetaData;\n rows: FlightLogRow[];\n infos: any[];\n};\n\nexport type FlightLogEvent = {\n meta: FlightLogMetaData;\n rowIndex?: number;\n row?: FlightLogRow;\n info?: undefined|Array; // Empty string => undefined, else parsed JSON blob.\n};\n\n// based off of types in ios/android SDK FlightMode enums\nexport const FLIGHT_MODE_MAPPING_V4 = {\n 0: 'Manual',\n 1: 'Attitude',\n 2: 'Attitude Course Lock',\n 3: 'Attitude Hover',\n 4: 'Hover',\n 5: 'GPS Brake',\n 6: 'GPS Attitude',\n 7: 'GPS Course Lock',\n 8: 'GPS Home',\n 9: 'GPS Hotpoint',\n 10: 'Assisted Takeoff',\n 11: 'Auto Takeoff',\n 12: 'Auto Landing',\n 13: 'Attitude Landing',\n 14: 'GPS Waypoint',\n 15: 'Go Home',\n 16: 'Click Go',\n 17: 'Joystick',\n 18: 'Attitude Limited',\n 19: 'Cinematic',\n 23: 'Attitude Limited',\n 24: 'Draw',\n 25: 'GPS Follow Me',\n 26: 'ActiveTrack',\n 27: 'TapFly',\n 28: 'Pano',\n 29: 'Farming',\n 30: 'FPV',\n 31: 'GPS Sport',\n 32: 'GPS Novice',\n 33: 'Confirm Landing',\n 35: 'Terrain Follow',\n 36: 'Palm Control',\n 37: 'Quick Shot',\n 38: 'Tripod',\n 39: 'ActiveTrack Spotlight',\n 41: 'Motors Just Started',\n 43: 'GPS Gentle',\n 255: 'Unknown',\n};\n\nexport const FLIGHT_MODE_MAPPING_V5 = {\n 0: 'Manual',\n 1: 'Attitude',\n 2: 'GPS Normal',\n 3: 'POI',\n 4: 'Takeoff Ready',\n 5: 'Auto Takeoff',\n 6: 'Auto Landing',\n 7: 'Waypoint',\n 8: 'Go Home',\n 9: 'Virtual Stick',\n 10: 'Smart Flight',\n 11: 'Pano',\n 12: 'GPS Sport',\n 13: 'GPS Tripod',\n 14: 'Auto Avoidance',\n 15: 'Smart Fly',\n 16: 'Force Landing',\n 17: 'Attitude Landing',\n 18: 'Click Go',\n 19: 'Cinematic',\n 20: 'Draw',\n 21: 'GPS Follow Me',\n 22: 'GPS Novice',\n 23: 'Quick Movie',\n 24: 'Tap Fly',\n 25: 'Master Shot',\n 26: 'APAS',\n 27: 'Timelapse',\n 28: 'Motors Start',\n 29: 'Unknown',\n};\n","\n/*\nCSV Parse\n\nPlease look at the [project documentation](https://csv.js.org/parse/) for additional\ninformation.\n*/\n\nconst { Transform } = require('stream')\nconst ResizeableBuffer = require('./ResizeableBuffer')\n\nconst cr = 13\nconst nl = 10\nconst space = 32\nconst tab = 9\nconst bom_utf8 = Buffer.from([239, 187, 191])\n\nclass Parser extends Transform {\n constructor(opts = {}){\n super({...{readableObjectMode: true}, ...opts})\n const options = {}\n // Merge with user options\n for(let opt in opts){\n options[underscore(opt)] = opts[opt]\n }\n // Normalize option `bom`\n if(options.bom === undefined || options.bom === null || options.bom === false){\n options.bom = false\n }else if(options.bom !== true){\n throw new Error(`Invalid Option: bom must be true, got ${JSON.stringify(options.bom)}`)\n }\n // Normalize option `cast`\n let fnCastField = null\n if(options.cast === undefined || options.cast === null || options.cast === false || options.cast === ''){\n options.cast = undefined\n }else if(typeof options.cast === 'function'){\n fnCastField = options.cast\n options.cast = true\n }else if(options.cast !== true){\n throw new Error('Invalid Option: cast must be true or a function')\n }\n // Normalize option `cast_date`\n if(options.cast_date === undefined || options.cast_date === null || options.cast_date === false || options.cast_date === ''){\n options.cast_date = false\n }else if(options.cast_date === true){\n options.cast_date = function(value){\n const date = Date.parse(value)\n return !isNaN(date) ? new Date(date) : value\n }\n }else if(typeof options.cast_date !== 'function'){\n throw new Error('Invalid Option: cast_date must be true or a function')\n }\n // Normalize option `columns`\n let fnFirstLineToHeaders = null\n if(options.columns === true){\n // Fields in the first line are converted as-is to columns\n fnFirstLineToHeaders = undefined\n }else if(typeof options.columns === 'function'){\n fnFirstLineToHeaders = options.columns\n options.columns = true\n }else if(Array.isArray(options.columns)){\n options.columns = normalizeColumnsArray(options.columns)\n }else if(options.columns === undefined || options.columns === null || options.columns === false){\n options.columns = false\n }else{\n throw new Error(`Invalid Option columns: expect an object or true, got ${JSON.stringify(options.columns)}`)\n }\n // Normalize option `comment`\n if(options.comment === undefined || options.comment === null || options.comment === false || options.comment === ''){\n options.comment = null\n }else{\n if(typeof options.comment === 'string'){\n options.comment = Buffer.from(options.comment)\n }\n if(!Buffer.isBuffer(options.comment)){\n throw new Error(`Invalid Option: comment must be a buffer or a string, got ${JSON.stringify(options.comment)}`)\n }\n }\n // Normalize option `delimiter`\n if(options.delimiter === undefined || options.delimiter === null || options.delimiter === false){\n options.delimiter = Buffer.from(',')\n }else if(Buffer.isBuffer(options.delimiter)){\n if(options.delimiter.length === 0){\n throw new Error(`Invalid Option: delimiter must be a non empty buffer`)\n }\n // Great, nothing to do\n }else if(typeof options.delimiter === 'string'){\n if(options.delimiter.length === 0){\n throw new Error(`Invalid Option: delimiter must be a non empty string`)\n }\n options.delimiter = Buffer.from(options.delimiter)\n }else{\n throw new Error(`Invalid Option: delimiter must be a string or a buffer, got ${options.delimiter}`)\n }\n // Normalize option `escape`\n if(options.escape === undefined || options.escape === null){\n options.escape = Buffer.from('\"')\n }else if(typeof options.escape === 'string'){\n options.escape = Buffer.from(options.escape)\n }\n if(!Buffer.isBuffer(options.escape)){\n throw new Error(`Invalid Option: escape must be a buffer or a string, got ${JSON.stringify(options.escape)}`)\n }else if(options.escape.length !== 1){\n throw new Error(`Invalid Option Length: escape must be one character, got ${options.escape.length}`)\n }else{\n options.escape = options.escape[0]\n }\n // Normalize option `from`\n if(options.from === undefined || options.from === null){\n options.from = 1\n }else{\n if(typeof options.from === 'string' && /\\d+/.test(options.from)){\n options.from = parseInt(options.from)\n }\n if(Number.isInteger(options.from)){\n if(options.from < 0){\n throw new Error(`Invalid Option: from must be a positive integer, got ${JSON.stringify(opts.from)}`)\n }\n }else{\n throw new Error(`Invalid Option: from must be an integer, got ${JSON.stringify(options.from)}`)\n }\n }\n // Normalize option `from_line`\n if(options.from_line === undefined || options.from_line === null){\n options.from_line = 1\n }else{\n if(typeof options.from_line === 'string' && /\\d+/.test(options.from_line)){\n options.from_line = parseInt(options.from_line)\n }\n if(Number.isInteger(options.from_line)){\n if(options.from_line <= 0){\n throw new Error(`Invalid Option: from_line must be a positive integer greater than 0, got ${JSON.stringify(opts.from_line)}`)\n }\n }else{\n throw new Error(`Invalid Option: from_line must be an integer, got ${JSON.stringify(opts.from_line)}`)\n }\n }\n // Normalize option `info`\n if(options.info === undefined || options.info === null || options.info === false){\n options.info = false\n }else if(options.info !== true){\n throw new Error(`Invalid Option: info must be true, got ${JSON.stringify(options.info)}`)\n }\n // Normalize option `max_record_size`\n if(options.max_record_size === undefined || options.max_record_size === null || options.max_record_size === false){\n options.max_record_size = 0\n }else if(Number.isInteger(options.max_record_size) && options.max_record_size >= 0){\n // Great, nothing to do\n }else if(typeof options.max_record_size === 'string' && /\\d+/.test(options.max_record_size)){\n options.max_record_size = parseInt(options.max_record_size)\n }else{\n throw new Error(`Invalid Option: max_record_size must be a positive integer, got ${JSON.stringify(options.max_record_size)}`)\n }\n // Normalize option `objname`\n if(options.objname === undefined || options.objname === null || options.objname === false){\n options.objname = undefined\n }else if(Buffer.isBuffer(options.objname)){\n if(options.objname.length === 0){\n throw new Error(`Invalid Option: objname must be a non empty buffer`)\n }\n options.objname = options.objname.toString()\n }else if(typeof options.objname === 'string'){\n if(options.objname.length === 0){\n throw new Error(`Invalid Option: objname must be a non empty string`)\n }\n // Great, nothing to do\n }else{\n throw new Error(`Invalid Option: objname must be a string or a buffer, got ${options.objname}`)\n }\n // Normalize option `quote`\n if(options.quote === null || options.quote === false || options.quote === ''){\n options.quote = null\n }else{\n if(options.quote === undefined || options.quote === true){\n options.quote = Buffer.from('\"')\n }else if(typeof options.quote === 'string'){\n options.quote = Buffer.from(options.quote)\n }\n if(!Buffer.isBuffer(options.quote)){\n throw new Error(`Invalid Option: quote must be a buffer or a string, got ${JSON.stringify(options.quote)}`)\n }else if(options.quote.length !== 1){\n throw new Error(`Invalid Option Length: quote must be one character, got ${options.quote.length}`)\n }else{\n options.quote = options.quote[0]\n }\n }\n // Normalize option `raw`\n if(options.raw === undefined || options.raw === null || options.raw === false){\n options.raw = false\n }else if(options.raw !== true){\n throw new Error(`Invalid Option: raw must be true, got ${JSON.stringify(options.raw)}`)\n }\n // Normalize option `record_delimiter`\n if(!options.record_delimiter){\n options.record_delimiter = []\n }else if(!Array.isArray(options.record_delimiter)){\n options.record_delimiter = [options.record_delimiter]\n }\n options.record_delimiter = options.record_delimiter.map( function(rd){\n if(typeof rd === 'string'){\n rd = Buffer.from(rd)\n }\n return rd\n })\n // Normalize option `relax`\n if(typeof options.relax === 'boolean'){\n // Great, nothing to do\n }else if(options.relax === undefined || options.relax === null){\n options.relax = false\n }else{\n throw new Error(`Invalid Option: relax must be a boolean, got ${JSON.stringify(options.relax)}`)\n }\n // Normalize option `relax_column_count`\n if(typeof options.relax_column_count === 'boolean'){\n // Great, nothing to do\n }else if(options.relax_column_count === undefined || options.relax_column_count === null){\n options.relax_column_count = false\n }else{\n throw new Error(`Invalid Option: relax_column_count must be a boolean, got ${JSON.stringify(options.relax_column_count)}`)\n }\n // Normalize option `skip_empty_lines`\n if(typeof options.skip_empty_lines === 'boolean'){\n // Great, nothing to do\n }else if(options.skip_empty_lines === undefined || options.skip_empty_lines === null){\n options.skip_empty_lines = false\n }else{\n throw new Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(options.skip_empty_lines)}`)\n }\n // Normalize option `skip_lines_with_empty_values`\n if(typeof options.skip_lines_with_empty_values === 'boolean'){\n // Great, nothing to do\n }else if(options.skip_lines_with_empty_values === undefined || options.skip_lines_with_empty_values === null){\n options.skip_lines_with_empty_values = false\n }else{\n throw new Error(`Invalid Option: skip_lines_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_lines_with_empty_values)}`)\n }\n // Normalize option `skip_lines_with_error`\n if(typeof options.skip_lines_with_error === 'boolean'){\n // Great, nothing to do\n }else if(options.skip_lines_with_error === undefined || options.skip_lines_with_error === null){\n options.skip_lines_with_error = false\n }else{\n throw new Error(`Invalid Option: skip_lines_with_error must be a boolean, got ${JSON.stringify(options.skip_lines_with_error)}`)\n }\n // Normalize option `rtrim`\n if(options.rtrim === undefined || options.rtrim === null || options.rtrim === false){\n options.rtrim = false\n }else if(options.rtrim !== true){\n throw new Error(`Invalid Option: rtrim must be a boolean, got ${JSON.stringify(options.rtrim)}`)\n }\n // Normalize option `ltrim`\n if(options.ltrim === undefined || options.ltrim === null || options.ltrim === false){\n options.ltrim = false\n }else if(options.ltrim !== true){\n throw new Error(`Invalid Option: ltrim must be a boolean, got ${JSON.stringify(options.ltrim)}`)\n }\n // Normalize option `trim`\n if(options.trim === undefined || options.trim === null || options.trim === false){\n options.trim = false\n }else if(options.trim !== true){\n throw new Error(`Invalid Option: trim must be a boolean, got ${JSON.stringify(options.trim)}`)\n }\n // Normalize options `trim`, `ltrim` and `rtrim`\n if(options.trim === true && opts.ltrim !== false){\n options.ltrim = true\n }else if(options.ltrim !== true){\n options.ltrim = false\n }\n if(options.trim === true && opts.rtrim !== false){\n options.rtrim = true\n }else if(options.rtrim !== true){\n options.rtrim = false\n }\n // Normalize option `to`\n if(options.to === undefined || options.to === null){\n options.to = -1\n }else{\n if(typeof options.to === 'string' && /\\d+/.test(options.to)){\n options.to = parseInt(options.to)\n }\n if(Number.isInteger(options.to)){\n if(options.to <= 0){\n throw new Error(`Invalid Option: to must be a positive integer greater than 0, got ${JSON.stringify(opts.to)}`)\n }\n }else{\n throw new Error(`Invalid Option: to must be an integer, got ${JSON.stringify(opts.to)}`)\n }\n }\n // Normalize option `to_line`\n if(options.to_line === undefined || options.to_line === null){\n options.to_line = -1\n }else{\n if(typeof options.to_line === 'string' && /\\d+/.test(options.to_line)){\n options.to_line = parseInt(options.to_line)\n }\n if(Number.isInteger(options.to_line)){\n if(options.to_line <= 0){\n throw new Error(`Invalid Option: to_line must be a positive integer greater than 0, got ${JSON.stringify(opts.to_line)}`)\n }\n }else{\n throw new Error(`Invalid Option: to_line must be an integer, got ${JSON.stringify(opts.to_line)}`)\n }\n }\n this.info = {\n comment_lines: 0,\n empty_lines: 0,\n invalid_field_length: 0,\n lines: 1,\n records: 0\n }\n this.options = options\n this.state = {\n bomSkipped: false,\n castField: fnCastField,\n commenting: false,\n enabled: options.from_line === 1,\n escaping: false,\n escapeIsQuote: options.escape === options.quote,\n expectedRecordLength: options.columns === null ? 0 : options.columns.length,\n field: new ResizeableBuffer(20),\n firstLineToHeaders: fnFirstLineToHeaders,\n info: Object.assign({}, this.info),\n previousBuf: undefined,\n quoting: false,\n stop: false,\n rawBuffer: new ResizeableBuffer(100),\n record: [],\n recordHasError: false,\n record_length: 0,\n recordDelimiterMaxLength: options.record_delimiter.length === 0 ? 2 : Math.max(...options.record_delimiter.map( (v) => v.length)),\n trimChars: [Buffer.from(' ')[0], Buffer.from('\\t')[0]],\n wasQuoting: false,\n wasRowDelimiter: false\n }\n }\n // Implementation of `Transform._transform`\n _transform(buf, encoding, callback){\n if(this.state.stop === true){\n return\n }\n const err = this.__parse(buf, false)\n if(err !== undefined){\n this.state.stop = true\n }\n callback(err)\n }\n // Implementation of `Transform._flush`\n _flush(callback){\n if(this.state.stop === true){\n return\n }\n const err = this.__parse(undefined, true)\n callback(err)\n }\n // Central parser implementation\n __parse(nextBuf, end){\n const {bom, comment, escape, from, from_line, info, ltrim, max_record_size, quote, raw, relax, rtrim, skip_empty_lines, to, to_line} = this.options\n let {record_delimiter} = this.options\n const {bomSkipped, previousBuf, rawBuffer, escapeIsQuote, trimChars} = this.state\n let buf\n if(previousBuf === undefined){\n if(nextBuf === undefined){\n // Handle empty string\n this.push(null)\n return\n }else{\n buf = nextBuf\n }\n }else if(previousBuf !== undefined && nextBuf === undefined){\n buf = previousBuf\n }else{\n buf = Buffer.concat([previousBuf, nextBuf])\n }\n // Handle UTF BOM\n if(bomSkipped === false){\n if(bom === false){\n this.state.bomSkipped = true\n }else if(buf.length < 3){\n // No enough data\n if(end === false){\n // Wait for more data\n this.state.previousBuf = buf\n return\n }\n // skip BOM detect because data length < 3\n }else{\n if(bom_utf8.compare(buf, 0, 3) === 0){\n // Skip BOM\n buf = buf.slice(3)\n }\n this.state.bomSkipped = true\n }\n }\n const bufLen = buf.length\n let pos\n for(pos = 0; pos < bufLen; pos++){\n // Ensure we get enough space to look ahead\n // There should be a way to move this out of the loop\n if(this.__needMoreData(pos, bufLen, end)){\n break\n }\n if(this.state.wasRowDelimiter === true){\n this.info.lines++\n if(info === true && this.state.record.length === 0 && this.state.field.length === 0 && this.state.wasQuoting === false){\n this.state.info = Object.assign({}, this.info)\n }\n this.state.wasRowDelimiter = false\n }\n if(to_line !== -1 && this.info.lines > to_line){\n this.state.stop = true\n this.push(null)\n return\n }\n // Auto discovery of record_delimiter, unix, mac and windows supported\n if(this.state.quoting === false && record_delimiter.length === 0){\n const record_delimiterCount = this.__autoDiscoverRowDelimiter(buf, pos)\n if(record_delimiterCount){\n record_delimiter = this.options.record_delimiter\n }\n }\n const chr = buf[pos]\n if(raw === true){\n rawBuffer.append(chr)\n }\n if((chr === cr || chr === nl) && this.state.wasRowDelimiter === false ){\n this.state.wasRowDelimiter = true\n }\n // Previous char was a valid escape char\n // treat the current char as a regular char\n if(this.state.escaping === true){\n this.state.escaping = false\n }else{\n // Escape is only active inside quoted fields\n if(this.state.quoting === true && chr === escape && pos + 1 < bufLen){\n // We are quoting, the char is an escape chr and there is a chr to escape\n if(escapeIsQuote){\n if(buf[pos+1] === quote){\n this.state.escaping = true\n continue\n }\n }else{\n this.state.escaping = true\n continue\n }\n }\n // Not currently escaping and chr is a quote\n // TODO: need to compare bytes instead of single char\n if(this.state.commenting === false && chr === quote){\n if(this.state.quoting === true){\n const nextChr = buf[pos+1]\n const isNextChrTrimable = rtrim && this.__isCharTrimable(nextChr)\n // const isNextChrComment = nextChr === comment\n const isNextChrComment = comment !== null && this.__compareBytes(comment, buf, pos+1, nextChr)\n const isNextChrDelimiter = this.__isDelimiter(nextChr, buf, pos+1)\n const isNextChrRowDelimiter = record_delimiter.length === 0 ? this.__autoDiscoverRowDelimiter(buf, pos+1) : this.__isRecordDelimiter(nextChr, buf, pos+1)\n // Escape a quote\n // Treat next char as a regular character\n // TODO: need to compare bytes instead of single char\n if(chr === escape && nextChr === quote){\n pos++\n }else if(!nextChr || isNextChrDelimiter || isNextChrRowDelimiter || isNextChrComment || isNextChrTrimable){\n this.state.quoting = false\n this.state.wasQuoting = true\n continue\n }else if(relax === false){\n const err = this.__error(`Invalid Closing Quote: got \"${String.fromCharCode(nextChr)}\" at line ${this.info.lines} instead of delimiter, row delimiter, trimable character (if activated) or comment`)\n if(err !== undefined) return err\n }else{\n this.state.quoting = false\n this.state.wasQuoting = true\n // continue\n this.state.field.prepend(quote)\n }\n }else{\n if(this.state.field.length !== 0){\n // In relax mode, treat opening quote preceded by chrs as regular\n if( relax === false ){\n const err = this.__error(`Invalid opening quote at line ${this.info.lines}`)\n if(err !== undefined) return err\n }\n }else{\n this.state.quoting = true\n continue\n }\n }\n }\n if(this.state.quoting === false){\n let recordDelimiterLength = this.__isRecordDelimiter(chr, buf, pos)\n if(recordDelimiterLength !== 0){\n // Do not emit comments which take a full line\n const skipCommentLine = this.state.commenting && (this.state.wasQuoting === false && this.state.record.length === 0 && this.state.field.length === 0)\n if(skipCommentLine){\n this.info.comment_lines++\n // Skip full comment line\n }else{\n // Skip if line is empty and skip_empty_lines activated\n if(skip_empty_lines === true && this.state.wasQuoting === false && this.state.record.length === 0 && this.state.field.length === 0){\n this.info.empty_lines++\n pos += recordDelimiterLength - 1\n continue\n }\n // Activate records emition if above from_line\n if(this.state.enabled === false && this.info.lines + (this.state.wasRowDelimiter === true ? 1: 0 ) >= from_line){\n this.state.enabled = true\n this.__resetField()\n this.__resetRow()\n pos += recordDelimiterLength - 1\n continue\n }else{\n const errField = this.__onField()\n if(errField !== undefined) return errField\n const errRecord = this.__onRow()\n if(errRecord !== undefined) return errRecord\n }\n if(to !== -1 && this.info.records >= to){\n this.state.stop = true\n this.push(null)\n return\n }\n }\n this.state.commenting = false\n pos += recordDelimiterLength - 1\n continue\n }\n if(this.state.commenting){\n continue\n }\n const commentCount = comment === null ? 0 : this.__compareBytes(comment, buf, pos, chr)\n if(commentCount !== 0){\n this.state.commenting = true\n continue\n }\n let delimiterLength = this.__isDelimiter(chr, buf, pos)\n if(delimiterLength !== 0){\n const errField = this.__onField()\n if(errField !== undefined) return errField\n pos += delimiterLength - 1\n continue\n }\n }\n }\n if(this.state.commenting === false){\n if(max_record_size !== 0 && this.state.record_length + this.state.field.length > max_record_size){\n const err = this.__error(`Max Record Size: record exceed the maximum number of tolerated bytes of ${max_record_size} on line ${this.info.lines}`)\n if(err !== undefined) return err\n }\n }\n\n const lappend = ltrim === false || this.state.quoting === true || this.state.field.length !== 0 || !this.__isCharTrimable(chr)\n // rtrim in non quoting is handle in __onField\n const rappend = rtrim === false || this.state.wasQuoting === false\n if( lappend === true && rappend === true ){\n this.state.field.append(chr)\n }else if(rtrim === true && !this.__isCharTrimable(chr)){\n const err = this.__error(`Invalid Closing Quote: found non trimable byte after quote at line ${this.info.lines}`)\n if(err !== undefined) return err\n }\n }\n if(end === true){\n if(this.state.quoting === true){\n const err = this.__error(`Invalid Closing Quote: quote is not closed at line ${this.info.lines}`)\n if(err !== undefined) return err\n }else{\n // Skip last line if it has no characters\n if(this.state.wasQuoting === true || this.state.record.length !== 0 || this.state.field.length !== 0){\n const errField = this.__onField()\n if(errField !== undefined) return errField\n const errRecord = this.__onRow()\n if(errRecord !== undefined) return errRecord\n }else if(this.state.wasRowDelimiter === true){\n this.info.empty_lines++\n }else if(this.state.commenting === true){\n this.info.comment_lines++\n }\n }\n }else{\n this.state.previousBuf = buf.slice(pos)\n }\n if(this.state.wasRowDelimiter === true){\n this.info.lines++\n this.state.wasRowDelimiter = false\n }\n }\n // Helper to test if a character is a space or a line delimiter\n __isCharTrimable(chr){\n return chr === space || chr === tab || chr === cr || chr === nl\n }\n __onRow(){\n const {columns, info, from, relax_column_count, raw, skip_lines_with_empty_values} = this.options\n const {enabled, record} = this.state\n // Convert the first line into column names\n if(columns === true){\n return this.__firstLineToColumns(record)\n }\n const recordLength = record.length\n if(columns === false && this.info.records === 0){\n this.state.expectedRecordLength = recordLength\n }else if(enabled === true){\n if(recordLength !== this.state.expectedRecordLength){\n if(relax_column_count === true){\n this.info.invalid_field_length++\n }else{\n if(columns === false){\n const err = this.__error(`Invalid Record Length: expect ${this.state.expectedRecordLength}, got ${recordLength} on line ${this.info.lines}`)\n if(err !== undefined) return err\n }else{\n const err = this.__error(`Invalid Record Length: header length is ${columns.length}, got ${recordLength} on line ${this.info.lines}`)\n if(err !== undefined) return err\n }\n }\n }\n }\n if(enabled === false){\n return this.__resetRow()\n }\n if(skip_lines_with_empty_values === true){\n if(record.map( (field) => field.trim() ).join('') === ''){\n this.__resetRow()\n return\n }\n }\n if(this.state.recordHasError === true){\n this.__resetRow()\n this.state.recordHasError = false\n return\n }\n this.info.records++\n if(from === 1 || this.info.records >= from){\n if(columns !== false){\n const obj = {}\n // Transform record array to an object\n for(let i in record){\n if(columns[i] === undefined || columns[i].disabled) continue\n obj[columns[i].name] = record[i]\n }\n const {objname} = this.options\n if(objname === undefined){\n if(raw === true || info === true){\n this.push(Object.assign(\n {record: obj},\n (raw === true ? {raw: this.state.rawBuffer.toString()}: {}),\n (info === true ? {info: this.state.info}: {})\n ))\n }else{\n this.push(obj)\n }\n }else{\n if(raw === true || info === true){\n this.push(Object.assign(\n {record: [obj[objname], obj]},\n raw === true ? {raw: this.state.rawBuffer.toString()}: {},\n info === true ? {info: this.state.info}: {}\n ))\n }else{\n this.push([obj[objname], obj])\n }\n }\n }else{\n if(raw === true || info === true){\n this.push(Object.assign(\n {record: record},\n raw === true ? {raw: this.state.rawBuffer.toString()}: {},\n info === true ? {info: this.state.info}: {}\n ))\n }else{\n this.push(record)\n }\n }\n }\n this.__resetRow()\n }\n __firstLineToColumns(record){\n const {firstLineToHeaders} = this.state\n try{\n // record = record.filter(function(field){ return field !== undefined})\n const headers = firstLineToHeaders === undefined ? record : firstLineToHeaders.call(null, record)\n if(!Array.isArray(headers)){\n return this.__error(`Invalid Header Mapping: expect an array, got ${JSON.stringify(headers)}`)\n }\n const normalizedHeaders = normalizeColumnsArray(headers)\n this.state.expectedRecordLength = normalizedHeaders.length\n this.options.columns = normalizedHeaders\n this.__resetRow()\n return\n }catch(err){\n return err\n }\n }\n __resetRow(){\n const {info} = this.options\n if(this.options.raw === true){\n this.state.rawBuffer.reset()\n }\n this.state.record = []\n this.state.record_length = 0\n }\n __onField(){\n const {cast, rtrim, max_record_size} = this.options\n const {enabled, wasQuoting} = this.state\n // Deal with from_to options\n if(this.options.columns !== true && enabled === false){\n return this.__resetField()\n }\n let field = this.state.field.toString()\n if(rtrim === true && wasQuoting === false){\n field = field.trimRight()\n }\n if(cast === true){\n const [err, f] = this.__cast(field)\n if(err !== undefined) return err\n field = f\n }\n this.state.record.push(field)\n // Increment record length if record size must not exceed a limit\n if(max_record_size !== 0 && typeof field === 'string'){\n this.state.record_length += field.length\n }\n this.__resetField()\n }\n __resetField(){\n this.state.field.reset()\n this.state.wasQuoting = false\n }\n // Return a tuple with the error and the casted value\n __cast(field){\n const isColumns = Array.isArray(this.options.columns)\n // Dont loose time calling cast if the field wont be part of the final record\n if( isColumns === true && this.options.columns.length <= this.state.record.length ){\n return [undefined, undefined]\n }\n const context = {\n column: isColumns === true ?\n this.options.columns[this.state.record.length].name :\n this.state.record.length,\n empty_lines: this.info.empty_lines,\n header: this.options.columns === true,\n index: this.state.record.length,\n invalid_field_length: this.info.invalid_field_length,\n quoting: this.state.wasQuoting,\n lines: this.info.lines,\n records: this.info.records\n }\n if(this.state.castField !== null){\n try{\n return [undefined, this.state.castField.call(null, field, context)]\n }catch(err){\n return [err]\n }\n }\n if(this.__isFloat(field)){\n return [undefined, parseFloat(field)]\n }else if(this.options.cast_date !== false){\n return [undefined, this.options.cast_date.call(null, field, context)]\n }\n return [undefined, field]\n }\n // Keep it in case we implement the `cast_int` option\n // __isInt(value){\n // // return Number.isInteger(parseInt(value))\n // // return !isNaN( parseInt( obj ) );\n // return /^(\\-|\\+)?[1-9][0-9]*$/.test(value)\n // }\n __isFloat(value){\n return (value - parseFloat( value ) + 1) >= 0 // Borrowed from jquery\n }\n __compareBytes(sourceBuf, targetBuf, pos, firtByte){\n if(sourceBuf[0] !== firtByte) return 0\n const sourceLength = sourceBuf.length\n for(let i = 1; i < sourceLength; i++){\n if(sourceBuf[i] !== targetBuf[pos+i]) return 0\n }\n return sourceLength\n }\n __needMoreData(i, bufLen, end){\n if(end){\n return false\n }\n const {comment, delimiter, escape} = this.options\n const {quoting, recordDelimiterMaxLength} = this.state\n const numOfCharLeft = bufLen - i - 1\n const requiredLength = Math.max(\n // Skip if the remaining buffer smaller than comment\n comment ? comment.length : 0,\n // Skip if the remaining buffer smaller than row delimiter\n recordDelimiterMaxLength,\n // Skip if the remaining buffer can be row delimiter following the closing quote\n // 1 is for quote.length\n quoting ? (1 + recordDelimiterMaxLength) : 0,\n // Skip if the remaining buffer can be delimiter\n delimiter.length,\n // Skip if the remaining buffer can be escape sequence\n // 1 is for escape.length\n 1\n )\n return numOfCharLeft < requiredLength\n }\n __isDelimiter(chr, buf, pos){\n const {delimiter} = this.options\n const delLength = delimiter.length\n if(delimiter[0] !== chr) return 0\n for(let i = 1; i < delLength; i++){\n if(delimiter[i] !== buf[pos+i]) return 0\n }\n return delimiter.length\n }\n __isRecordDelimiter(chr, buf, pos){\n const {record_delimiter} = this.options\n const recordDelimiterLength = record_delimiter.length\n loop1: for(let i = 0; i < recordDelimiterLength; i++){\n const rd = record_delimiter[i]\n const rdLength = rd.length\n if(rd[0] !== chr){\n continue\n }\n for(let j = 1; j < rdLength; j++){\n if(rd[j] !== buf[pos+j]){\n continue loop1\n }\n }\n return rd.length\n }\n return 0\n }\n __autoDiscoverRowDelimiter(buf, pos){\n const chr = buf[pos]\n if(chr === cr){\n if(buf[pos+1] === nl){\n this.options.record_delimiter.push(Buffer.from('\\r\\n'))\n this.state.recordDelimiterMaxLength = 2\n return 2\n }else{\n this.options.record_delimiter.push(Buffer.from('\\r'))\n this.state.recordDelimiterMaxLength = 1\n return 1\n }\n }else if(chr === nl){\n this.options.record_delimiter.push(Buffer.from('\\n'))\n this.state.recordDelimiterMaxLength = 1\n return 1\n }\n return 0\n }\n __error(msg){\n const {skip_lines_with_error} = this.options\n const err = new Error(msg)\n if(skip_lines_with_error){\n this.state.recordHasError = true\n this.emit('skip', err)\n return undefined\n }else{\n return err\n }\n }\n}\n\nconst parse = function(){\n let data, options, callback\n for(let i in arguments){\n const argument = arguments[i]\n const type = typeof argument\n if(data === undefined && (typeof argument === 'string' || Buffer.isBuffer(argument))){\n data = argument\n }else if(options === undefined && isObject(argument)){\n options = argument\n }else if(callback === undefined && type === 'function'){\n callback = argument\n }else{\n throw new Error(`Invalid argument: got ${JSON.stringify(argument)} at index ${i}`)\n }\n }\n const parser = new Parser(options)\n if(callback){\n const records = options === undefined || options.objname === undefined ? [] : {}\n parser.on('readable', function(){\n let record\n while(record = this.read()){\n if(options === undefined || options.objname === undefined){\n records.push(record)\n }else{\n records[record[0]] = record[1]\n }\n }\n })\n parser.on('error', function(err){\n callback(err, undefined, parser.info)\n })\n parser.on('end', function(){\n callback(undefined, records, parser.info)\n })\n }\n if(data !== undefined){\n parser.write(data)\n parser.end()\n }\n return parser\n}\n\nparse.Parser = Parser\n\nmodule.exports = parse\n\nconst underscore = function(str){\n return str.replace(/([A-Z])/g, function(_, match, index){\n return '_' + match.toLowerCase()\n })\n}\n\nconst isObject = function(obj){\n return (typeof obj === 'object' && obj !== null && !Array.isArray(obj))\n}\n\nconst normalizeColumnsArray = function(columns){\n // console.log('columns', columns)\n const normalizedColumns = [];\n\n for(let i=0; i< columns.length; i++){\n const column = columns[i]\n if(column === undefined || column === null || column === false){\n normalizedColumns[i] = { disabled: true }\n }else if(typeof column === 'string'){\n normalizedColumns[i] = { name: column }\n }else if(isObject(column)){\n if(typeof column.name !== 'string'){\n throw new Error(`Invalid Option columns: property \"name\" is required at position ${i} when column is an object literal`)\n }\n normalizedColumns[i] = column\n }else{\n throw new Error(`Invalid Option columns: expect a string or an object, got ${JSON.stringify(column)} at position ${i}`)\n }\n }\n // console.log(normalizedColumns)\n return normalizedColumns;\n}\n","import { FlightLogHeader } from './types';\n\nexport const INT_FIELDS = new Set([\n FlightLogHeader.AircraftBatteryCell1Voltage,\n FlightLogHeader.AircraftBatteryCell2Voltage,\n FlightLogHeader.AircraftBatteryCell3Voltage,\n FlightLogHeader.AircraftBatteryCell4Voltage,\n FlightLogHeader.AircraftBatteryCharge,\n FlightLogHeader.AircraftBatteryCurrent,\n FlightLogHeader.AircraftBatteryTemperature,\n FlightLogHeader.AircraftBatteryVoltage,\n FlightLogHeader.AircraftCameraLensFocusModeValue,\n FlightLogHeader.AircraftCameraLensFocusStatusValue,\n FlightLogHeader.AircraftCameraModeValue,\n FlightLogHeader.AircraftFlightModeValue,\n FlightLogHeader.AircraftGPSSignalValue,\n FlightLogHeader.AircraftNoFlyValue,\n FlightLogHeader.AircraftSatellites,\n FlightLogHeader.GimbalModeValue,\n FlightLogHeader.AircraftSmartGoHomeRadius,\n FlightLogHeader.AircraftSmartGoHomeCountdown,\n FlightLogHeader.AircraftVelocityX,\n FlightLogHeader.AircraftVelocityY,\n FlightLogHeader.AircraftVelocityZ,\n FlightLogHeader.RCHorizontalAccuaracy,\n FlightLogHeader.RCLatitude,\n FlightLogHeader.RCLongitude,\n FlightLogHeader.LandingGearStatusValue,\n FlightLogHeader.LandingGearModeValue,\n FlightLogHeader.RCStateValue,\n FlightLogHeader.RCLandingGearValue,\n]);\n\nexport const FLOAT_FIELDS = new Set([\n FlightLogHeader.AircraftBarometricAltitude,\n FlightLogHeader.AircraftBatteryPowerPercent,\n FlightLogHeader.AircraftCameraSDCardRemainingPercent,\n FlightLogHeader.AircraftHeading,\n FlightLogHeader.AircraftLatitude,\n FlightLogHeader.AircraftLongitude,\n FlightLogHeader.AircraftNoFlyLatitude,\n FlightLogHeader.AircraftNoFlyLongitude,\n FlightLogHeader.AircraftNoFlyRadius,\n FlightLogHeader.AircraftPitch,\n FlightLogHeader.AircraftRoll,\n FlightLogHeader.AircraftSmartGoHomeFlightReturnTime,\n FlightLogHeader.AircraftSmartGoHomeFlightTimeRemaining,\n FlightLogHeader.AircraftSmartGoHomeLandingPower,\n FlightLogHeader.AircraftSmartGoHomeLandingTime,\n FlightLogHeader.AircraftSmartGoHomeReturnPower,\n FlightLogHeader.AircraftSpeed,\n FlightLogHeader.AircraftUltrasonicAltitude,\n FlightLogHeader.DeviceToAircraftDistance,\n FlightLogHeader.ElapsedTime,\n FlightLogHeader.GimbalPitch,\n FlightLogHeader.GimbalPitchAtStop,\n FlightLogHeader.GimbalRoll,\n FlightLogHeader.GimbalRollAtStop,\n FlightLogHeader.GimbalYaw,\n FlightLogHeader.GimbalYawAtStop,\n FlightLogHeader.HomeLatitude,\n FlightLogHeader.HomeLongitude,\n FlightLogHeader.RCBatteryPercentRemaining,\n FlightLogHeader.RCLeftHorizontal,\n FlightLogHeader.RCRightHorizontal,\n FlightLogHeader.RCLeftVertical,\n FlightLogHeader.RCRightVertical,\n]);\n\nexport const BOOL_FIELDS = new Set([\n FlightLogHeader.AircraftCameraBurstCapture,\n FlightLogHeader.AircraftCameraIntervalCapture,\n FlightLogHeader.AircraftCameraLensAFAssistant,\n FlightLogHeader.AircraftCameraLensAFEnabled,\n FlightLogHeader.AircraftCameraLensAssistantWorking,\n FlightLogHeader.AircraftCameraOverheated,\n FlightLogHeader.AircraftCameraRawCapture,\n FlightLogHeader.AircraftCameraBurstCapture,\n FlightLogHeader.AircraftCameraRecording,\n FlightLogHeader.AircraftCameraSDCardExists,\n FlightLogHeader.AircraftCameraSensorError,\n FlightLogHeader.AircraftCameraSingleCapture,\n FlightLogHeader.AircraftCameraStoringPhoto,\n FlightLogHeader.AircraftFlying,\n FlightLogHeader.AircraftIMUPreheating,\n FlightLogHeader.AircraftMotorsOn,\n FlightLogHeader.AircraftSmartGoHomeRequesting,\n FlightLogHeader.AircraftUltrasonicOn,\n FlightLogHeader.AircraftVisionOn,\n FlightLogHeader.LandingGearIsMovable,\n FlightLogHeader.RCGoHome,\n FlightLogHeader.RCRecord,\n FlightLogHeader.RCShutter,\n FlightLogHeader.RCPlayback,\n FlightLogHeader.RCPause,\n FlightLogHeader.RCCustom1,\n FlightLogHeader.RCCustom2,\n FlightLogHeader.RCSattelites,\n FlightLogHeader.RCGSPDataIsValid,\n FlightLogHeader.RCLeftHorizontal,\n FlightLogHeader.RCRightHorizontal,\n FlightLogHeader.RCLeftVertical,\n FlightLogHeader.RCRightVertical,\n FlightLogHeader.AircraftCameraChangeableLensSupported,\n FlightLogHeader.AircraftCameraLensInstalled,\n FlightLogHeader.AircraftCameraLensMFAssistant,\n]);\n\nexport const DATE_FIELDS = new Set([\n FlightLogHeader.DateTime,\n]);\n","import parse from 'csv-parse';\n\nimport { FlightLogRow, FlightLogHeader, FlightLogMetaData, FlightLog, FlightLogEvent } from './types';\nimport { INT_FIELDS, BOOL_FIELDS, FLOAT_FIELDS, DATE_FIELDS } from './field-types';\n\nconst syncParse = require('csv-parse/lib/sync');\n\n\nconst META_REGEX = {\n appVersion: /^#DroneDeploy\\s+(.+)$/,\n sessionId: /^Session ID\\s+(.+)$/,\n sessionStart: /^Session Start\\s+(.+)$/,\n sessionEnd: /^Date\\/Time \\(UTC\\)\\s+(.+)$/,\n deviceModel: /^Device Model\\s+(.+)$/,\n deviceOS: /^Device Operating System\\s+(.+)$/,\n aircraftModel: /^Aircraft Model\\s+(.+)$/,\n aircraftName: /^Aircraft Name\\s+(.+)$/,\n aircraftFirmware: /^Aircraft Firmware\\s+(.+)$/,\n batteryChargeVolume: /^Full Charge Volume \\(mAh\\)\\s+(.+)$/,\n batteryRemainingLife: /^Remaining Life \\(%\\)\\s+(.+)$/,\n batteryDischarges: /^Discharges\\s+(.+)$/,\n batteryCells: /^Battery Cells Number\\s+(.+)$/,\n batterySerialNumber: /^Battery Serial Number\\s+(.+)$/,\n batteryFirmware: /^Battery Firmware\\s+(.+)$/,\n fcSerialNumber: /^Flight Controller Serial Number\\s+(.+)$/,\n fcFirmware: /^Flight Controller Firmware\\s+(.+)$/,\n footerLines: /^#Flight Recorder Session End|^Date\\/Time \\(UTC\\)|^Elapsed Time \\(sec\\)/,\n gimbalFirmware: /^Gimbal Firmware\\s+(.+)$/,\n rcSerialNumber: /^Remote Control Serial Number\\s+(.+)$/,\n rcFirmware: /^Remote Control Firmware\\s+(.+)$/,\n cameraSerialNumber: /^Camera Serial Number\\s+(.+)$/,\n elapsedTime: /^Elapsed Time \\(sec\\)\\s+(.+)$/,\n userId: /^User ID\\s+(.+)$/,\n organizationId: /^Organization ID\\s+(.+)$/,\n platform: /^Platform\\s+(.+)$/,\n};\n\nexport type Subscriber = (value: T) => void;\nexport type ErrorSubscriber = (value: any) => void;\nexport type CompletionSubscriber = () => void;\n\nexport interface QuasiObservable {\n subscribe(sub: Subscriber, errSub?: ErrorSubscriber, completionSub?: CompletionSubscriber): void;\n toPromise(): Promise;\n}\n\nexport class QuasiSubject implements QuasiObservable {\n private subscribers: Subscriber[] = [];\n private errorSubscribers: ErrorSubscriber[] = [];\n private completionSubscribers: CompletionSubscriber[] = [];\n private isFinished = false;\n\n next(value: T) {\n if (this.isFinished) {\n return;\n }\n this.subscribers.forEach((s) => s(value));\n }\n\n complete() {\n if (this.isFinished) {\n return;\n }\n this.isFinished = true;\n this.completionSubscribers.forEach((sub) => sub());\n }\n\n error(error: any) {\n if (this.isFinished) {\n return;\n }\n this.errorSubscribers.forEach((errSub) => errSub(error));\n this.complete();\n }\n\n subscribe(sub: Subscriber, errSub?: ErrorSubscriber, completionSub?: CompletionSubscriber) {\n this.subscribers.push(sub);\n if (errSub) {\n this.errorSubscribers.push(errSub);\n }\n if (completionSub) {\n this.completionSubscribers.push(completionSub);\n }\n }\n\n toPromise(): Promise {\n const source = this;\n return new Promise(function (resolve, reject) {\n let value: T;\n source.subscribe(function (v) {\n value = v;\n }, reject, function () {\n resolve(value);\n });\n });\n }\n}\n\nexport function parseLogStream(logStream: QuasiSubject): QuasiObservable {\n const headerMetaLines: string[] = [];\n let meta = {} as FlightLogMetaData;\n let rowHeaderLine: string;\n let row: FlightLogRow;\n\n const progress = { index: 0, completed: false };\n let end: any;\n const result = new QuasiSubject();\n\n logStream.subscribe((line: string) => {\n line = line.trim();\n if (!line.length) {\n return;\n }\n\n if (!rowHeaderLine) {\n if (line.startsWith(FlightLogHeader.DateTime.split(' ')[0])) { // Strip off timezone.\n rowHeaderLine = line;\n meta = parseMetaData(headerMetaLines, []);\n result.next({\n meta,\n rowIndex: progress.index\n });\n } else {\n headerMetaLines.push(line);\n progress.index++;\n }\n return;\n }\n\n if (META_REGEX.footerLines.test(line)) {\n if (META_REGEX.sessionEnd.test(line)) {\n end = fromUtcDateStr(findMatch([line], META_REGEX.sessionEnd));\n } else if (META_REGEX.elapsedTime.test(line)) {\n const elapsed = findMatch([line], META_REGEX.elapsedTime);\n\n // This is the end of the parsing. Because normal lines are parsed through a Promise, they will be delivered\n // asynchronously. So we must ensure that this result is also delivered asynchronously.\n setTimeout(() => {\n const parsedElapsed = elapsed === 'N/A' ? 0 : parseFloat(elapsed);\n if (parsedElapsed) {\n meta.session.elapsed = parsedElapsed;\n }\n if (end) {\n meta.session.end = end;\n }\n result.next({\n meta,\n rowIndex: progress.index++,\n });\n result.complete();\n progress.completed = true;\n }, 0);\n }\n } else {\n parseBody([rowHeaderLine, line], true).then((rows) => {\n row = rows[0];\n meta.session.end = row[FlightLogHeader.DateTime];\n meta.session.elapsed = row[FlightLogHeader.ElapsedTime];\n result.next({\n meta,\n rowIndex: progress.index++,\n row,\n info: parseJsonInfo(row.Info), // Parsed Info column, if the column was populated with a JSON array.\n })\n });\n }\n\n }, (err) => { console.error('parsing error: ' + err); result.complete(); }, () => {\n if (!progress.completed) {\n setTimeout(() => {\n result.complete();\n progress.completed = true;\n }, 0);\n }\n });\n\n return result;\n}\n\nexport function parseLog(log: String): Promise {\n const lines = log.split('\\n');\n const subject = new QuasiSubject();\n const parse = parseLogStream(subject);\n\n const flightLog: FlightLog = {\n metaData: {} as FlightLogMetaData,\n rows: [],\n infos: []\n }\n parse.subscribe((event) => {\n // The metadata is updated as the file is parsed, so always grab the latest one.\n flightLog.metaData = (event.meta) ? event.meta : flightLog.metaData;\n if (event.row) {\n flightLog.rows.push(event.row);\n }\n if (event.info) {\n // @ts-ignore\n flightLog.infos.push(event.info);\n }\n });\n lines.forEach(l => subject.next(l));\n subject.complete();\n\n return new Promise((resolve, reject) => {\n parse.toPromise().then(() => resolve(flightLog)).catch((reason => reject(reason)));\n });\n}\n\nfunction parseBody(lines: string[], sync?: boolean): Promise {\n const text = lines.join('\\n');\n const options = {\n delimiter: '\\t',\n escape: null,\n from: 1,\n quote: null,\n relax_column_count: true,\n };\n\n return new Promise((resolve, reject) => {\n const onResults = (err: any, result: string[]) => {\n if (err) {\n return reject(err);\n }\n\n const [headers, ...rows] = result;\n\n const logs = rows.map((row) => {\n const log = {} as FlightLogRow;\n for (let i = 0; i < headers.length; i++) {\n const header = headers[i].trim() as FlightLogHeader;\n let value: any = row[i];\n\n if (INT_FIELDS.has(header)) {\n value = parseInt(value, 10);\n }\n\n if (FLOAT_FIELDS.has(header)) {\n value = parseFloat(value);\n }\n\n if (BOOL_FIELDS.has(header)) {\n value = value !== '0';\n }\n\n if (DATE_FIELDS.has(header)) {\n value = fromUtcDateStr(value);\n }\n\n log[header] = value;\n }\n\n return log;\n });\n\n resolve(logs);\n };\n if (sync) {\n const results = syncParse(text, options);\n onResults(undefined, results);\n } else {\n // @ts-ignore\n parse(text, options, onResults);\n }\n });\n}\n\nfunction findMatch(search: string[], regex: RegExp, isNum?: boolean) {\n let match;\n for (let str of search) {\n match = str.match(regex);\n if (match) {\n break;\n }\n }\n\n if (!match) {\n return isNum ? '0' : 'N/A';\n }\n\n return match[1];\n}\n\nfunction isValidDate(d: any) {\n return d instanceof Date && !isNaN(d as any);\n}\n\nexport function fromUtcDateStr(utcDateStr: string) {\n if (isValidDate(utcDateStr)) {\n return utcDateStr as any as Date;\n }\n const isBadDate = !utcDateStr || !utcDateStr.trim().length || utcDateStr === 'N/A';\n if (isBadDate) {\n return null;\n }\n if (!/Z$/.test(utcDateStr)) {\n utcDateStr = utcDateStr + '.000Z';\n }\n return new Date(utcDateStr);\n}\n\nfunction parseMetaData(headers: string[], footers: string[]): FlightLogMetaData {\n const meta = [...headers, ...footers];\n let end = findMatch(meta, META_REGEX.sessionEnd);\n let elapsed = findMatch(meta, META_REGEX.elapsedTime);\n\n // if we weren't able to parse an end date or an elapsed time from our footer (which is really just the last three\n // lines of the log file), it's likely that we have a truncated log file. if that's the case, we can still salvage\n // some valid data by parsing the date and elapsed time from the very last log row in the file, which is what we're\n // doing below. it's pretty brittle, but it's preferred to having an invalid end date and a NaN elapsed time.\n if ((end === 'N/A' || elapsed === 'N/A') && footers.length > 0) {\n const lastLine = footers[footers.length - 1];\n const pieces = lastLine.split('\\t');\n\n // if we don't have at least two pieces, i don't know what is in `footer` so i'm just going to leave it alone\n if (pieces.length >= 2) {\n end = pieces[0];\n elapsed = pieces[1];\n }\n }\n\n return {\n appVersion: findMatch(meta, META_REGEX.appVersion),\n session: {\n id: findMatch(meta, META_REGEX.sessionId),\n start: fromUtcDateStr(findMatch(meta, META_REGEX.sessionStart)) as Date,\n end: fromUtcDateStr(end),\n elapsed: elapsed === 'N/A' ? 0 : parseFloat(elapsed),\n },\n device: {\n model: findMatch(meta, META_REGEX.deviceModel),\n os: findMatch(meta, META_REGEX.deviceOS).replace(/\\t/g, ' '),\n platform: findMatch(meta, META_REGEX.platform),\n },\n aircraft: {\n model: findMatch(meta, META_REGEX.aircraftModel),\n name: findMatch(meta, META_REGEX.aircraftName),\n firmware: findMatch(meta, META_REGEX.aircraftFirmware),\n },\n battery: {\n chargeVolume: parseInt(findMatch(meta, META_REGEX.batteryChargeVolume, true), 10),\n remainingLifePercent: parseInt(findMatch(meta, META_REGEX.batteryRemainingLife, true), 10),\n discharges: parseInt(findMatch(meta, META_REGEX.batteryDischarges, true), 10),\n cells: parseInt(findMatch(meta, META_REGEX.batteryCells, true), 10),\n firmware: findMatch(meta, META_REGEX.batteryFirmware),\n serialNumber: findMatch(meta, META_REGEX.batterySerialNumber),\n },\n flightController: {\n serialNumber: findMatch(meta, META_REGEX.fcSerialNumber),\n firmware: findMatch(meta, META_REGEX.fcFirmware),\n },\n gimbal: {\n firmware: findMatch(meta, META_REGEX.gimbalFirmware),\n },\n remoteController: {\n serialNumber: findMatch(meta, META_REGEX.rcSerialNumber),\n firmware: findMatch(meta, META_REGEX.rcFirmware),\n },\n camera: {\n serialNumber: findMatch(meta, META_REGEX.cameraSerialNumber),\n },\n user: {\n userId: findMatch(meta, META_REGEX.userId),\n organizationId: findMatch(meta, META_REGEX.organizationId),\n },\n };\n}\n\n/**\n * Parse out the given string and return an object if the string is JSON, return undefined otherwise.\n *\n * @param info\n */\nfunction parseJsonInfo(info: string): undefined|Array {\n if (!info) {\n return undefined;\n }\n try {\n return JSON.parse(info);\n }\n catch (e) {\n return undefined;\n }\n}\n"],"names":["FlightLogHeader"],"mappings":";;;;;;AAAYA,mCAuIX;EAvID,CAAA,UAAY,eAAe,EAAA;EACzB,IAAA,eAAA,CAAA,UAAA,CAAA,GAAA,iBAA4B,CAAA;EAC5B,IAAA,eAAA,CAAA,aAAA,CAAA,GAAA,oBAAkC,CAAA;EAClC,IAAA,eAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;EACb,IAAA,eAAA,CAAA,gBAAA,CAAA,GAAA,2BAA4C,CAAA;EAC5C,IAAA,eAAA,CAAA,iBAAA,CAAA,GAAA,4BAA8C,CAAA;EAC9C,IAAA,eAAA,CAAA,2BAAA,CAAA,GAAA,mCAA+D,CAAA;EAC/D,IAAA,eAAA,CAAA,6BAAA,CAAA,GAAA,4BAA0D,CAAA;EAC1D,IAAA,eAAA,CAAA,uBAAA,CAAA,GAAA,+BAAuD,CAAA;EACvD,IAAA,eA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AC,IAAI,EAAE;EACT,QAAA,OAAO,SAAS,CAAC;EAClB,KAAA;MACD,IAAI;EACF,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;EACzB,KAAA;EACD,IAAA,OAAO,CAAC,EAAE;EACR,QAAA,OAAO,SAAS,CAAC;EAClB,KAAA;EACH;;;;;;;;;;;;;","x_google_ignoreList":[1]} \ No newline at end of file +{"version":3,"file":"flight-log-parser.js","sources":["../src/types.ts","../node_modules/csv-parse/lib/index.js","../src/field-types.ts","../src/parser.ts"],"sourcesContent":["export enum FlightLogHeader {\n DateTime = 'Date/Time (UTC)',\n ElapsedTime = 'Elapsed Time (sec)',\n Info = 'Info',\n DeviceLatitude = 'Device Latitude (Degrees)',\n DeviceLongitude = 'Device Longitude (Degrees)',\n DeviceLocationLastUpdated = 'Device Location Last Updated (ms)',\n AircraftBatteryPowerPercent = 'Aircraft Battery Power (%)',\n AircraftBatteryCharge = 'Aircraft Battery Charge (mAh)',\n AircraftBatteryCurrent = 'Aircraft Battery Current (mA)',\n AircraftBatteryVoltage = 'Aircraft Battery Voltage (mV)',\n AircraftBatteryTemperature = 'Aircraft Battery Temperature (Fahrenheit)',\n AircraftBatteryLastUpdated = 'Aircraft Battery Last Updated (ms)',\n AircraftBatteryCell1Voltage = 'Aircraft Battery Cell 1 Voltage',\n AircraftBatteryCell2Voltage = 'Aircraft Battery Cell 2 Voltage',\n AircraftBatteryCell3Voltage = 'Aircraft Battery Cell 3 Voltage',\n AircraftBatteryCell4Voltage = 'Aircraft Battery Cell 4 Voltage',\n AircraftBatteryCellVoltageLastUpdated = 'Aircraft Battery Cell Voltage Last Updated (ms)',\n AircraftLatitude = 'Aircraft Latitude (Degrees)',\n AircraftLongitude = 'Aircraft Longitude (Degrees)',\n AircraftSpeed = 'Aircraft Speed (mph)',\n AircraftBarometricAltitude = 'Aircraft Barometric Altitude (ft)',\n AircraftHeading = 'Aircraft Heading (Degrees)',\n AircraftVelocityX = 'Aircraft Vel - X (mph)',\n AircraftVelocityY = 'Aircraft Vel - Y (mph)',\n AircraftVelocityZ = 'Aircraft Vel - Z (mph)',\n AircraftPitch = 'Aircraft Pitch (Degrees)',\n AircraftRoll = 'Aircraft Roll (Degrees)',\n AircraftSatellites = 'Aircraft Satellites',\n AircraftMotorsOn = 'Aircraft Motors On',\n AircraftFlying = 'Aircraft Flying',\n AircraftFlightMode = 'Aircraft Flight Mode',\n AircraftFlightModeValue = 'Aircraft Flight Mode Value',\n AircraftIMUPreheating = 'Aircraft IMU Preheating',\n AircraftUltrasonicOn = 'Aircraft Ultrasonic On',\n AircraftUltrasonicAltitude = 'Aircraft Ultrasonic Altitude (ft)',\n AircraftVisionOn = 'Aircraft Vision On',\n AircraftGPSSignal = 'Aircraft GPS Signal',\n AircraftGPSSignalValue = 'Aircraft GPS Signal Value',\n AircraftNoFly = 'Aircraft No-fly',\n AircraftNoFlyValue = 'Aircraft No-fly Value',\n AircraftNoFlyLatitude = 'Aircraft No-fly Latitude (Degrees)',\n AircraftNoFlyLongitude = 'Aircraft No-fly Longitude (Degrees)',\n AircraftNoFlyRadius = 'Aircraft No-fly Radius (ft)',\n HomeLatitude = 'Home Latitude (Degrees)',\n HomeLongitude = 'Home Longitude (Degrees)',\n AircraftSmartGoHomeFlightTimeRemaining = 'Aircraft Smart Go-home Flight Time Remaining (sec)',\n AircraftSmartGoHomeFlightReturnTime = 'Aircraft Smart Go-home Flight Return Time (sec)',\n AircraftSmartGoHomeLandingTime = 'Aircraft Smart Go-home Landing Time (sec)',\n AircraftSmartGoHomeReturnPower = 'Aircraft Smart Go-home Return Power (%)',\n AircraftSmartGoHomeLandingPower = 'Aircraft Smart Go-home Landing Power (%)',\n AircraftSmartGoHomeRadius = 'Aircraft Smart Go-home Radius (ft)',\n AircraftSmartGoHomeCountdown = 'Aircraft Smart Go-home Countdown (sec)',\n AircraftSmartGoHomeRequesting = 'Aircraft Smart Go-home Requesting',\n AircraftSystemStateLastUpdated = 'Aircraft System State Last Updated (ms)',\n GimbalPitch = 'Gimbal Pitch (Degrees)',\n GimbalRoll = 'Gimbal Roll (Degrees)',\n GimbalYaw = 'Gimbal Yaw (Degrees)',\n GimbalMode = 'Gimbal Mode',\n GimbalModeValue = 'Gimbal Mode Value',\n GimbalPitchAtStop = 'Gimbal Pitch at Stop',\n GimbalRollAtStop = 'Gimbal Roll at Stop',\n GimbalYawAtStop = 'Gimbal Yaw at Stop',\n GimbalStatusLastUpdated = 'Gimbal Status Last Updated (ms)',\n LandingGearIsMovable = 'Landing Gear is Movable',\n LandingGearStatus = 'Landing Gear Status',\n LandingGearStatusValue = 'Landing Gear Status Value',\n LandingGearMode = 'Landing Gear Mode',\n LandingGearModeValue = 'Landing Gear Mode Value',\n LandingGearLastUpdated = 'Landing Gear Last Updated (ms)',\n RCState = 'RC State',\n RCStateValue = 'RC State Value',\n RCLeftHorizontal = 'RC Left Horizontal',\n RCLeftVertical = 'RC Left Vertical',\n RCRightHorizontal = 'RC Right Horizontal',\n RCRightVertical = 'RC Right Vertical',\n RCLeftWheel = 'RC Left Wheel',\n RCRightWheel = 'RC Right Wheel',\n RCLandingGear = 'RC Landing Gear',\n RCLandingGearValue = 'RC Landing Gear Value',\n RCGoHome = 'RC Go Home',\n RCRecord = 'RC Record ',\n RCShutter = 'RC Shutter',\n RCPlayback = 'RC Playback',\n RCPause = 'RC Pause',\n RCCustom1 = 'RC Custom 1',\n RCCustom2 = 'RC Custom 2',\n RCStateLastUpdated = 'RC State Last Updated (ms)',\n RCBatteryPercentRemaining = 'RC Battery (%)',\n RCBatteryStateLastUpdated = 'RC Battery State Last Updated (ms)',\n RCSattelites = 'RC Sattelites',\n RCHorizontalAccuaracy = 'RC Horizontal Accuaracy (ft)',\n RCLatitude = 'RC Latitude (Degrees)',\n RCLongitude = 'RC Longitude (Degrees)',\n RCGSPDataIsValid = 'RC GSP Data is Valid',\n RCGPSStateLastUpdated = 'RC GPS State Last Updated (ms)',\n RCSignal1 = 'RC Signal 1',\n RCSignal2 = 'RC Signal 2',\n RCSignalLastUpdated = 'RC Signal Last Updated (ms)',\n LBSignal1 = 'LB Signal 1',\n LBSignal2 = 'LB Signal 2',\n LBSignalLastUpdated = 'LB Signal Last Updated (ms)',\n AircraftCameraMode = 'Aircraft Camera Mode',\n AircraftCameraModeValue = 'Aircraft Camera Mode Value',\n AircraftCameraOverheated = 'Aircraft Camera Overheated',\n AircraftCameraSensorError = 'Aircraft Camera Sensor Error',\n AircraftCameraRecording = 'Aircraft Camera Recording',\n AircraftCameraRawCapture = 'Aircraft Camera Raw Capture',\n AircraftCameraIntervalCapture = 'Aircraft Camera Interval Capture',\n AircraftCameraBurstCapture = 'Aircraft Camera Burst Capture',\n AircraftCameraSingleCapture = 'Aircraft Camera Single Capture',\n AircraftCameraStoringPhoto = 'Aircraft Camera Storing Photo',\n AircraftCameraStateLastUpdated = 'Aircraft Camera State Last Updated (ms)',\n AircraftCameraSDCardExists = 'Aircraft Camera SD Card Exists',\n AircraftCameraSDCardRemainingPercent = 'Aircraft Camera SD Card Remaining (%)',\n AircraftCameraSDCardStateLastUpdated = 'Aircraft Camera SD Card State Last Updated (ms)',\n AircraftCameraChangeableLensSupported = 'Aircraft Camera Changeable Lens Supported',\n AircraftCameraLensInstalled = 'Aircraft Camera Lens Installed',\n AircraftCameraLensType = 'Aircraft Camera Lens Type',\n AircraftCameraLensAFEnabled = 'Aircraft Camera Lens AF Enabled',\n AircraftCameraLensFocusMode = 'Aircraft Camera Lens Focus Mode',\n AircraftCameraLensFocusModeValue = 'Aircraft Camera Lens Focus Mode Value',\n AircraftCameraLensFocusStatus = 'Aircraft Camera Lens Focus Status',\n AircraftCameraLensFocusStatusValue = 'Aircraft Camera Lens Focus Status Value',\n AircraftCameraLensMFAssistant = 'Aircraft Camera Lens MF Assistant',\n AircraftCameraLensAFAssistant = 'Aircraft Camera Lens AF Assistant',\n AircraftCameraLensAssistantWorking = 'Aircraft Camera Lens Assistant Working',\n AircraftCameraLensStateLastUpdated = 'Aircraft Camera Lens State Last Updated (ms)',\n CompassIndex = \"Compass Index\",\n CompassSensorValue = \"Compass Sensor Value\",\n CompassState = \"Compass State\",\n CompassStateLastUpdated = \"Compass State Last Updated (ms)\",\n CompassCalibrationState = \"Compass Calibration State\",\n CompassCalibrationLastUpdated = \"Compass Calibration Last Updated (ms)\",\n DeviceToAircraftDistance = 'Device > Aircraft Distance - XY (ft)',\n}\n\nexport type FlightLogRow = {\n [prop in FlightLogHeader]: any // because csv\n};\n\nexport type FlightLogMetaData = {\n appVersion: string;\n session: {\n id: string;\n start: Date;\n end: Date | null;\n elapsed: number;\n };\n device: {\n model: string;\n os: string;\n platform: string;\n };\n aircraft: {\n model: string;\n name: string;\n firmware: string;\n };\n battery: {\n chargeVolume: number;\n remainingLifePercent: number;\n discharges: number;\n cells: number;\n firmware: string;\n serialNumber: string;\n };\n flightController: {\n serialNumber: string;\n firmware: string;\n };\n gimbal: {\n firmware: string;\n };\n remoteController: {\n serialNumber: string;\n firmware: string;\n };\n camera: {\n serialNumber: string;\n };\n user: {\n userId: string;\n organizationId: string;\n };\n};\n\nexport type FlightLog = {\n metaData: FlightLogMetaData;\n rows: FlightLogRow[];\n infos: any[];\n};\n\nexport type FlightLogEvent = {\n meta: FlightLogMetaData;\n rowIndex?: number;\n row?: FlightLogRow;\n info?: undefined|Array; // Empty string => undefined, else parsed JSON blob.\n};\n\n// based off of types in ios/android SDK FlightMode enums\nexport const FLIGHT_MODE_MAPPING_V4 = {\n 0: 'Manual',\n 1: 'Attitude',\n 2: 'Attitude Course Lock',\n 3: 'Attitude Hover',\n 4: 'Hover',\n 5: 'GPS Brake',\n 6: 'GPS Attitude',\n 7: 'GPS Course Lock',\n 8: 'GPS Home',\n 9: 'GPS Hotpoint',\n 10: 'Assisted Takeoff',\n 11: 'Auto Takeoff',\n 12: 'Auto Landing',\n 13: 'Attitude Landing',\n 14: 'GPS Waypoint',\n 15: 'Go Home',\n 16: 'Click Go',\n 17: 'Joystick',\n 18: 'Attitude Limited',\n 19: 'Cinematic',\n 23: 'Attitude Limited',\n 24: 'Draw',\n 25: 'GPS Follow Me',\n 26: 'ActiveTrack',\n 27: 'TapFly',\n 28: 'Pano',\n 29: 'Farming',\n 30: 'FPV',\n 31: 'GPS Sport',\n 32: 'GPS Novice',\n 33: 'Confirm Landing',\n 35: 'Terrain Follow',\n 36: 'Palm Control',\n 37: 'Quick Shot',\n 38: 'Tripod',\n 39: 'ActiveTrack Spotlight',\n 41: 'Motors Just Started',\n 43: 'GPS Gentle',\n 255: 'Unknown',\n};\n\nexport const FLIGHT_MODE_MAPPING_V5 = {\n 0: 'Manual',\n 1: 'Attitude',\n 2: 'GPS Normal',\n 3: 'POI',\n 4: 'Takeoff Ready',\n 5: 'Auto Takeoff',\n 6: 'Auto Landing',\n 7: 'Waypoint',\n 8: 'Go Home',\n 9: 'Virtual Stick',\n 10: 'Smart Flight',\n 11: 'Pano',\n 12: 'GPS Sport',\n 13: 'GPS Tripod',\n 14: 'Auto Avoidance',\n 15: 'Smart Fly',\n 16: 'Force Landing',\n 17: 'Attitude Landing',\n 18: 'Click Go',\n 19: 'Cinematic',\n 20: 'Draw',\n 21: 'GPS Follow Me',\n 22: 'GPS Novice',\n 23: 'Quick Movie',\n 24: 'Tap Fly',\n 25: 'Master Shot',\n 26: 'APAS',\n 27: 'Timelapse',\n 28: 'Motors Start',\n 29: 'Unknown',\n};\n","\n/*\nCSV Parse\n\nPlease look at the [project documentation](https://csv.js.org/parse/) for additional\ninformation.\n*/\n\nconst { Transform } = require('stream')\nconst ResizeableBuffer = require('./ResizeableBuffer')\n\nconst cr = 13\nconst nl = 10\nconst space = 32\nconst tab = 9\nconst bom_utf8 = Buffer.from([239, 187, 191])\n\nclass Parser extends Transform {\n constructor(opts = {}){\n super({...{readableObjectMode: true}, ...opts})\n const options = {}\n // Merge with user options\n for(let opt in opts){\n options[underscore(opt)] = opts[opt]\n }\n // Normalize option `bom`\n if(options.bom === undefined || options.bom === null || options.bom === false){\n options.bom = false\n }else if(options.bom !== true){\n throw new Error(`Invalid Option: bom must be true, got ${JSON.stringify(options.bom)}`)\n }\n // Normalize option `cast`\n let fnCastField = null\n if(options.cast === undefined || options.cast === null || options.cast === false || options.cast === ''){\n options.cast = undefined\n }else if(typeof options.cast === 'function'){\n fnCastField = options.cast\n options.cast = true\n }else if(options.cast !== true){\n throw new Error('Invalid Option: cast must be true or a function')\n }\n // Normalize option `cast_date`\n if(options.cast_date === undefined || options.cast_date === null || options.cast_date === false || options.cast_date === ''){\n options.cast_date = false\n }else if(options.cast_date === true){\n options.cast_date = function(value){\n const date = Date.parse(value)\n return !isNaN(date) ? new Date(date) : value\n }\n }else if(typeof options.cast_date !== 'function'){\n throw new Error('Invalid Option: cast_date must be true or a function')\n }\n // Normalize option `columns`\n let fnFirstLineToHeaders = null\n if(options.columns === true){\n // Fields in the first line are converted as-is to columns\n fnFirstLineToHeaders = undefined\n }else if(typeof options.columns === 'function'){\n fnFirstLineToHeaders = options.columns\n options.columns = true\n }else if(Array.isArray(options.columns)){\n options.columns = normalizeColumnsArray(options.columns)\n }else if(options.columns === undefined || options.columns === null || options.columns === false){\n options.columns = false\n }else{\n throw new Error(`Invalid Option columns: expect an object or true, got ${JSON.stringify(options.columns)}`)\n }\n // Normalize option `comment`\n if(options.comment === undefined || options.comment === null || options.comment === false || options.comment === ''){\n options.comment = null\n }else{\n if(typeof options.comment === 'string'){\n options.comment = Buffer.from(options.comment)\n }\n if(!Buffer.isBuffer(options.comment)){\n throw new Error(`Invalid Option: comment must be a buffer or a string, got ${JSON.stringify(options.comment)}`)\n }\n }\n // Normalize option `delimiter`\n if(options.delimiter === undefined || options.delimiter === null || options.delimiter === false){\n options.delimiter = Buffer.from(',')\n }else if(Buffer.isBuffer(options.delimiter)){\n if(options.delimiter.length === 0){\n throw new Error(`Invalid Option: delimiter must be a non empty buffer`)\n }\n // Great, nothing to do\n }else if(typeof options.delimiter === 'string'){\n if(options.delimiter.length === 0){\n throw new Error(`Invalid Option: delimiter must be a non empty string`)\n }\n options.delimiter = Buffer.from(options.delimiter)\n }else{\n throw new Error(`Invalid Option: delimiter must be a string or a buffer, got ${options.delimiter}`)\n }\n // Normalize option `escape`\n if(options.escape === undefined || options.escape === null){\n options.escape = Buffer.from('\"')\n }else if(typeof options.escape === 'string'){\n options.escape = Buffer.from(options.escape)\n }\n if(!Buffer.isBuffer(options.escape)){\n throw new Error(`Invalid Option: escape must be a buffer or a string, got ${JSON.stringify(options.escape)}`)\n }else if(options.escape.length !== 1){\n throw new Error(`Invalid Option Length: escape must be one character, got ${options.escape.length}`)\n }else{\n options.escape = options.escape[0]\n }\n // Normalize option `from`\n if(options.from === undefined || options.from === null){\n options.from = 1\n }else{\n if(typeof options.from === 'string' && /\\d+/.test(options.from)){\n options.from = parseInt(options.from)\n }\n if(Number.isInteger(options.from)){\n if(options.from < 0){\n throw new Error(`Invalid Option: from must be a positive integer, got ${JSON.stringify(opts.from)}`)\n }\n }else{\n throw new Error(`Invalid Option: from must be an integer, got ${JSON.stringify(options.from)}`)\n }\n }\n // Normalize option `from_line`\n if(options.from_line === undefined || options.from_line === null){\n options.from_line = 1\n }else{\n if(typeof options.from_line === 'string' && /\\d+/.test(options.from_line)){\n options.from_line = parseInt(options.from_line)\n }\n if(Number.isInteger(options.from_line)){\n if(options.from_line <= 0){\n throw new Error(`Invalid Option: from_line must be a positive integer greater than 0, got ${JSON.stringify(opts.from_line)}`)\n }\n }else{\n throw new Error(`Invalid Option: from_line must be an integer, got ${JSON.stringify(opts.from_line)}`)\n }\n }\n // Normalize option `info`\n if(options.info === undefined || options.info === null || options.info === false){\n options.info = false\n }else if(options.info !== true){\n throw new Error(`Invalid Option: info must be true, got ${JSON.stringify(options.info)}`)\n }\n // Normalize option `max_record_size`\n if(options.max_record_size === undefined || options.max_record_size === null || options.max_record_size === false){\n options.max_record_size = 0\n }else if(Number.isInteger(options.max_record_size) && options.max_record_size >= 0){\n // Great, nothing to do\n }else if(typeof options.max_record_size === 'string' && /\\d+/.test(options.max_record_size)){\n options.max_record_size = parseInt(options.max_record_size)\n }else{\n throw new Error(`Invalid Option: max_record_size must be a positive integer, got ${JSON.stringify(options.max_record_size)}`)\n }\n // Normalize option `objname`\n if(options.objname === undefined || options.objname === null || options.objname === false){\n options.objname = undefined\n }else if(Buffer.isBuffer(options.objname)){\n if(options.objname.length === 0){\n throw new Error(`Invalid Option: objname must be a non empty buffer`)\n }\n options.objname = options.objname.toString()\n }else if(typeof options.objname === 'string'){\n if(options.objname.length === 0){\n throw new Error(`Invalid Option: objname must be a non empty string`)\n }\n // Great, nothing to do\n }else{\n throw new Error(`Invalid Option: objname must be a string or a buffer, got ${options.objname}`)\n }\n // Normalize option `quote`\n if(options.quote === null || options.quote === false || options.quote === ''){\n options.quote = null\n }else{\n if(options.quote === undefined || options.quote === true){\n options.quote = Buffer.from('\"')\n }else if(typeof options.quote === 'string'){\n options.quote = Buffer.from(options.quote)\n }\n if(!Buffer.isBuffer(options.quote)){\n throw new Error(`Invalid Option: quote must be a buffer or a string, got ${JSON.stringify(options.quote)}`)\n }else if(options.quote.length !== 1){\n throw new Error(`Invalid Option Length: quote must be one character, got ${options.quote.length}`)\n }else{\n options.quote = options.quote[0]\n }\n }\n // Normalize option `raw`\n if(options.raw === undefined || options.raw === null || options.raw === false){\n options.raw = false\n }else if(options.raw !== true){\n throw new Error(`Invalid Option: raw must be true, got ${JSON.stringify(options.raw)}`)\n }\n // Normalize option `record_delimiter`\n if(!options.record_delimiter){\n options.record_delimiter = []\n }else if(!Array.isArray(options.record_delimiter)){\n options.record_delimiter = [options.record_delimiter]\n }\n options.record_delimiter = options.record_delimiter.map( function(rd){\n if(typeof rd === 'string'){\n rd = Buffer.from(rd)\n }\n return rd\n })\n // Normalize option `relax`\n if(typeof options.relax === 'boolean'){\n // Great, nothing to do\n }else if(options.relax === undefined || options.relax === null){\n options.relax = false\n }else{\n throw new Error(`Invalid Option: relax must be a boolean, got ${JSON.stringify(options.relax)}`)\n }\n // Normalize option `relax_column_count`\n if(typeof options.relax_column_count === 'boolean'){\n // Great, nothing to do\n }else if(options.relax_column_count === undefined || options.relax_column_count === null){\n options.relax_column_count = false\n }else{\n throw new Error(`Invalid Option: relax_column_count must be a boolean, got ${JSON.stringify(options.relax_column_count)}`)\n }\n // Normalize option `skip_empty_lines`\n if(typeof options.skip_empty_lines === 'boolean'){\n // Great, nothing to do\n }else if(options.skip_empty_lines === undefined || options.skip_empty_lines === null){\n options.skip_empty_lines = false\n }else{\n throw new Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(options.skip_empty_lines)}`)\n }\n // Normalize option `skip_lines_with_empty_values`\n if(typeof options.skip_lines_with_empty_values === 'boolean'){\n // Great, nothing to do\n }else if(options.skip_lines_with_empty_values === undefined || options.skip_lines_with_empty_values === null){\n options.skip_lines_with_empty_values = false\n }else{\n throw new Error(`Invalid Option: skip_lines_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_lines_with_empty_values)}`)\n }\n // Normalize option `skip_lines_with_error`\n if(typeof options.skip_lines_with_error === 'boolean'){\n // Great, nothing to do\n }else if(options.skip_lines_with_error === undefined || options.skip_lines_with_error === null){\n options.skip_lines_with_error = false\n }else{\n throw new Error(`Invalid Option: skip_lines_with_error must be a boolean, got ${JSON.stringify(options.skip_lines_with_error)}`)\n }\n // Normalize option `rtrim`\n if(options.rtrim === undefined || options.rtrim === null || options.rtrim === false){\n options.rtrim = false\n }else if(options.rtrim !== true){\n throw new Error(`Invalid Option: rtrim must be a boolean, got ${JSON.stringify(options.rtrim)}`)\n }\n // Normalize option `ltrim`\n if(options.ltrim === undefined || options.ltrim === null || options.ltrim === false){\n options.ltrim = false\n }else if(options.ltrim !== true){\n throw new Error(`Invalid Option: ltrim must be a boolean, got ${JSON.stringify(options.ltrim)}`)\n }\n // Normalize option `trim`\n if(options.trim === undefined || options.trim === null || options.trim === false){\n options.trim = false\n }else if(options.trim !== true){\n throw new Error(`Invalid Option: trim must be a boolean, got ${JSON.stringify(options.trim)}`)\n }\n // Normalize options `trim`, `ltrim` and `rtrim`\n if(options.trim === true && opts.ltrim !== false){\n options.ltrim = true\n }else if(options.ltrim !== true){\n options.ltrim = false\n }\n if(options.trim === true && opts.rtrim !== false){\n options.rtrim = true\n }else if(options.rtrim !== true){\n options.rtrim = false\n }\n // Normalize option `to`\n if(options.to === undefined || options.to === null){\n options.to = -1\n }else{\n if(typeof options.to === 'string' && /\\d+/.test(options.to)){\n options.to = parseInt(options.to)\n }\n if(Number.isInteger(options.to)){\n if(options.to <= 0){\n throw new Error(`Invalid Option: to must be a positive integer greater than 0, got ${JSON.stringify(opts.to)}`)\n }\n }else{\n throw new Error(`Invalid Option: to must be an integer, got ${JSON.stringify(opts.to)}`)\n }\n }\n // Normalize option `to_line`\n if(options.to_line === undefined || options.to_line === null){\n options.to_line = -1\n }else{\n if(typeof options.to_line === 'string' && /\\d+/.test(options.to_line)){\n options.to_line = parseInt(options.to_line)\n }\n if(Number.isInteger(options.to_line)){\n if(options.to_line <= 0){\n throw new Error(`Invalid Option: to_line must be a positive integer greater than 0, got ${JSON.stringify(opts.to_line)}`)\n }\n }else{\n throw new Error(`Invalid Option: to_line must be an integer, got ${JSON.stringify(opts.to_line)}`)\n }\n }\n this.info = {\n comment_lines: 0,\n empty_lines: 0,\n invalid_field_length: 0,\n lines: 1,\n records: 0\n }\n this.options = options\n this.state = {\n bomSkipped: false,\n castField: fnCastField,\n commenting: false,\n enabled: options.from_line === 1,\n escaping: false,\n escapeIsQuote: options.escape === options.quote,\n expectedRecordLength: options.columns === null ? 0 : options.columns.length,\n field: new ResizeableBuffer(20),\n firstLineToHeaders: fnFirstLineToHeaders,\n info: Object.assign({}, this.info),\n previousBuf: undefined,\n quoting: false,\n stop: false,\n rawBuffer: new ResizeableBuffer(100),\n record: [],\n recordHasError: false,\n record_length: 0,\n recordDelimiterMaxLength: options.record_delimiter.length === 0 ? 2 : Math.max(...options.record_delimiter.map( (v) => v.length)),\n trimChars: [Buffer.from(' ')[0], Buffer.from('\\t')[0]],\n wasQuoting: false,\n wasRowDelimiter: false\n }\n }\n // Implementation of `Transform._transform`\n _transform(buf, encoding, callback){\n if(this.state.stop === true){\n return\n }\n const err = this.__parse(buf, false)\n if(err !== undefined){\n this.state.stop = true\n }\n callback(err)\n }\n // Implementation of `Transform._flush`\n _flush(callback){\n if(this.state.stop === true){\n return\n }\n const err = this.__parse(undefined, true)\n callback(err)\n }\n // Central parser implementation\n __parse(nextBuf, end){\n const {bom, comment, escape, from, from_line, info, ltrim, max_record_size, quote, raw, relax, rtrim, skip_empty_lines, to, to_line} = this.options\n let {record_delimiter} = this.options\n const {bomSkipped, previousBuf, rawBuffer, escapeIsQuote, trimChars} = this.state\n let buf\n if(previousBuf === undefined){\n if(nextBuf === undefined){\n // Handle empty string\n this.push(null)\n return\n }else{\n buf = nextBuf\n }\n }else if(previousBuf !== undefined && nextBuf === undefined){\n buf = previousBuf\n }else{\n buf = Buffer.concat([previousBuf, nextBuf])\n }\n // Handle UTF BOM\n if(bomSkipped === false){\n if(bom === false){\n this.state.bomSkipped = true\n }else if(buf.length < 3){\n // No enough data\n if(end === false){\n // Wait for more data\n this.state.previousBuf = buf\n return\n }\n // skip BOM detect because data length < 3\n }else{\n if(bom_utf8.compare(buf, 0, 3) === 0){\n // Skip BOM\n buf = buf.slice(3)\n }\n this.state.bomSkipped = true\n }\n }\n const bufLen = buf.length\n let pos\n for(pos = 0; pos < bufLen; pos++){\n // Ensure we get enough space to look ahead\n // There should be a way to move this out of the loop\n if(this.__needMoreData(pos, bufLen, end)){\n break\n }\n if(this.state.wasRowDelimiter === true){\n this.info.lines++\n if(info === true && this.state.record.length === 0 && this.state.field.length === 0 && this.state.wasQuoting === false){\n this.state.info = Object.assign({}, this.info)\n }\n this.state.wasRowDelimiter = false\n }\n if(to_line !== -1 && this.info.lines > to_line){\n this.state.stop = true\n this.push(null)\n return\n }\n // Auto discovery of record_delimiter, unix, mac and windows supported\n if(this.state.quoting === false && record_delimiter.length === 0){\n const record_delimiterCount = this.__autoDiscoverRowDelimiter(buf, pos)\n if(record_delimiterCount){\n record_delimiter = this.options.record_delimiter\n }\n }\n const chr = buf[pos]\n if(raw === true){\n rawBuffer.append(chr)\n }\n if((chr === cr || chr === nl) && this.state.wasRowDelimiter === false ){\n this.state.wasRowDelimiter = true\n }\n // Previous char was a valid escape char\n // treat the current char as a regular char\n if(this.state.escaping === true){\n this.state.escaping = false\n }else{\n // Escape is only active inside quoted fields\n if(this.state.quoting === true && chr === escape && pos + 1 < bufLen){\n // We are quoting, the char is an escape chr and there is a chr to escape\n if(escapeIsQuote){\n if(buf[pos+1] === quote){\n this.state.escaping = true\n continue\n }\n }else{\n this.state.escaping = true\n continue\n }\n }\n // Not currently escaping and chr is a quote\n // TODO: need to compare bytes instead of single char\n if(this.state.commenting === false && chr === quote){\n if(this.state.quoting === true){\n const nextChr = buf[pos+1]\n const isNextChrTrimable = rtrim && this.__isCharTrimable(nextChr)\n // const isNextChrComment = nextChr === comment\n const isNextChrComment = comment !== null && this.__compareBytes(comment, buf, pos+1, nextChr)\n const isNextChrDelimiter = this.__isDelimiter(nextChr, buf, pos+1)\n const isNextChrRowDelimiter = record_delimiter.length === 0 ? this.__autoDiscoverRowDelimiter(buf, pos+1) : this.__isRecordDelimiter(nextChr, buf, pos+1)\n // Escape a quote\n // Treat next char as a regular character\n // TODO: need to compare bytes instead of single char\n if(chr === escape && nextChr === quote){\n pos++\n }else if(!nextChr || isNextChrDelimiter || isNextChrRowDelimiter || isNextChrComment || isNextChrTrimable){\n this.state.quoting = false\n this.state.wasQuoting = true\n continue\n }else if(relax === false){\n const err = this.__error(`Invalid Closing Quote: got \"${String.fromCharCode(nextChr)}\" at line ${this.info.lines} instead of delimiter, row delimiter, trimable character (if activated) or comment`)\n if(err !== undefined) return err\n }else{\n this.state.quoting = false\n this.state.wasQuoting = true\n // continue\n this.state.field.prepend(quote)\n }\n }else{\n if(this.state.field.length !== 0){\n // In relax mode, treat opening quote preceded by chrs as regular\n if( relax === false ){\n const err = this.__error(`Invalid opening quote at line ${this.info.lines}`)\n if(err !== undefined) return err\n }\n }else{\n this.state.quoting = true\n continue\n }\n }\n }\n if(this.state.quoting === false){\n let recordDelimiterLength = this.__isRecordDelimiter(chr, buf, pos)\n if(recordDelimiterLength !== 0){\n // Do not emit comments which take a full line\n const skipCommentLine = this.state.commenting && (this.state.wasQuoting === false && this.state.record.length === 0 && this.state.field.length === 0)\n if(skipCommentLine){\n this.info.comment_lines++\n // Skip full comment line\n }else{\n // Skip if line is empty and skip_empty_lines activated\n if(skip_empty_lines === true && this.state.wasQuoting === false && this.state.record.length === 0 && this.state.field.length === 0){\n this.info.empty_lines++\n pos += recordDelimiterLength - 1\n continue\n }\n // Activate records emition if above from_line\n if(this.state.enabled === false && this.info.lines + (this.state.wasRowDelimiter === true ? 1: 0 ) >= from_line){\n this.state.enabled = true\n this.__resetField()\n this.__resetRow()\n pos += recordDelimiterLength - 1\n continue\n }else{\n const errField = this.__onField()\n if(errField !== undefined) return errField\n const errRecord = this.__onRow()\n if(errRecord !== undefined) return errRecord\n }\n if(to !== -1 && this.info.records >= to){\n this.state.stop = true\n this.push(null)\n return\n }\n }\n this.state.commenting = false\n pos += recordDelimiterLength - 1\n continue\n }\n if(this.state.commenting){\n continue\n }\n const commentCount = comment === null ? 0 : this.__compareBytes(comment, buf, pos, chr)\n if(commentCount !== 0){\n this.state.commenting = true\n continue\n }\n let delimiterLength = this.__isDelimiter(chr, buf, pos)\n if(delimiterLength !== 0){\n const errField = this.__onField()\n if(errField !== undefined) return errField\n pos += delimiterLength - 1\n continue\n }\n }\n }\n if(this.state.commenting === false){\n if(max_record_size !== 0 && this.state.record_length + this.state.field.length > max_record_size){\n const err = this.__error(`Max Record Size: record exceed the maximum number of tolerated bytes of ${max_record_size} on line ${this.info.lines}`)\n if(err !== undefined) return err\n }\n }\n\n const lappend = ltrim === false || this.state.quoting === true || this.state.field.length !== 0 || !this.__isCharTrimable(chr)\n // rtrim in non quoting is handle in __onField\n const rappend = rtrim === false || this.state.wasQuoting === false\n if( lappend === true && rappend === true ){\n this.state.field.append(chr)\n }else if(rtrim === true && !this.__isCharTrimable(chr)){\n const err = this.__error(`Invalid Closing Quote: found non trimable byte after quote at line ${this.info.lines}`)\n if(err !== undefined) return err\n }\n }\n if(end === true){\n if(this.state.quoting === true){\n const err = this.__error(`Invalid Closing Quote: quote is not closed at line ${this.info.lines}`)\n if(err !== undefined) return err\n }else{\n // Skip last line if it has no characters\n if(this.state.wasQuoting === true || this.state.record.length !== 0 || this.state.field.length !== 0){\n const errField = this.__onField()\n if(errField !== undefined) return errField\n const errRecord = this.__onRow()\n if(errRecord !== undefined) return errRecord\n }else if(this.state.wasRowDelimiter === true){\n this.info.empty_lines++\n }else if(this.state.commenting === true){\n this.info.comment_lines++\n }\n }\n }else{\n this.state.previousBuf = buf.slice(pos)\n }\n if(this.state.wasRowDelimiter === true){\n this.info.lines++\n this.state.wasRowDelimiter = false\n }\n }\n // Helper to test if a character is a space or a line delimiter\n __isCharTrimable(chr){\n return chr === space || chr === tab || chr === cr || chr === nl\n }\n __onRow(){\n const {columns, info, from, relax_column_count, raw, skip_lines_with_empty_values} = this.options\n const {enabled, record} = this.state\n // Convert the first line into column names\n if(columns === true){\n return this.__firstLineToColumns(record)\n }\n const recordLength = record.length\n if(columns === false && this.info.records === 0){\n this.state.expectedRecordLength = recordLength\n }else if(enabled === true){\n if(recordLength !== this.state.expectedRecordLength){\n if(relax_column_count === true){\n this.info.invalid_field_length++\n }else{\n if(columns === false){\n const err = this.__error(`Invalid Record Length: expect ${this.state.expectedRecordLength}, got ${recordLength} on line ${this.info.lines}`)\n if(err !== undefined) return err\n }else{\n const err = this.__error(`Invalid Record Length: header length is ${columns.length}, got ${recordLength} on line ${this.info.lines}`)\n if(err !== undefined) return err\n }\n }\n }\n }\n if(enabled === false){\n return this.__resetRow()\n }\n if(skip_lines_with_empty_values === true){\n if(record.map( (field) => field.trim() ).join('') === ''){\n this.__resetRow()\n return\n }\n }\n if(this.state.recordHasError === true){\n this.__resetRow()\n this.state.recordHasError = false\n return\n }\n this.info.records++\n if(from === 1 || this.info.records >= from){\n if(columns !== false){\n const obj = {}\n // Transform record array to an object\n for(let i in record){\n if(columns[i] === undefined || columns[i].disabled) continue\n obj[columns[i].name] = record[i]\n }\n const {objname} = this.options\n if(objname === undefined){\n if(raw === true || info === true){\n this.push(Object.assign(\n {record: obj},\n (raw === true ? {raw: this.state.rawBuffer.toString()}: {}),\n (info === true ? {info: this.state.info}: {})\n ))\n }else{\n this.push(obj)\n }\n }else{\n if(raw === true || info === true){\n this.push(Object.assign(\n {record: [obj[objname], obj]},\n raw === true ? {raw: this.state.rawBuffer.toString()}: {},\n info === true ? {info: this.state.info}: {}\n ))\n }else{\n this.push([obj[objname], obj])\n }\n }\n }else{\n if(raw === true || info === true){\n this.push(Object.assign(\n {record: record},\n raw === true ? {raw: this.state.rawBuffer.toString()}: {},\n info === true ? {info: this.state.info}: {}\n ))\n }else{\n this.push(record)\n }\n }\n }\n this.__resetRow()\n }\n __firstLineToColumns(record){\n const {firstLineToHeaders} = this.state\n try{\n // record = record.filter(function(field){ return field !== undefined})\n const headers = firstLineToHeaders === undefined ? record : firstLineToHeaders.call(null, record)\n if(!Array.isArray(headers)){\n return this.__error(`Invalid Header Mapping: expect an array, got ${JSON.stringify(headers)}`)\n }\n const normalizedHeaders = normalizeColumnsArray(headers)\n this.state.expectedRecordLength = normalizedHeaders.length\n this.options.columns = normalizedHeaders\n this.__resetRow()\n return\n }catch(err){\n return err\n }\n }\n __resetRow(){\n const {info} = this.options\n if(this.options.raw === true){\n this.state.rawBuffer.reset()\n }\n this.state.record = []\n this.state.record_length = 0\n }\n __onField(){\n const {cast, rtrim, max_record_size} = this.options\n const {enabled, wasQuoting} = this.state\n // Deal with from_to options\n if(this.options.columns !== true && enabled === false){\n return this.__resetField()\n }\n let field = this.state.field.toString()\n if(rtrim === true && wasQuoting === false){\n field = field.trimRight()\n }\n if(cast === true){\n const [err, f] = this.__cast(field)\n if(err !== undefined) return err\n field = f\n }\n this.state.record.push(field)\n // Increment record length if record size must not exceed a limit\n if(max_record_size !== 0 && typeof field === 'string'){\n this.state.record_length += field.length\n }\n this.__resetField()\n }\n __resetField(){\n this.state.field.reset()\n this.state.wasQuoting = false\n }\n // Return a tuple with the error and the casted value\n __cast(field){\n const isColumns = Array.isArray(this.options.columns)\n // Dont loose time calling cast if the field wont be part of the final record\n if( isColumns === true && this.options.columns.length <= this.state.record.length ){\n return [undefined, undefined]\n }\n const context = {\n column: isColumns === true ?\n this.options.columns[this.state.record.length].name :\n this.state.record.length,\n empty_lines: this.info.empty_lines,\n header: this.options.columns === true,\n index: this.state.record.length,\n invalid_field_length: this.info.invalid_field_length,\n quoting: this.state.wasQuoting,\n lines: this.info.lines,\n records: this.info.records\n }\n if(this.state.castField !== null){\n try{\n return [undefined, this.state.castField.call(null, field, context)]\n }catch(err){\n return [err]\n }\n }\n if(this.__isFloat(field)){\n return [undefined, parseFloat(field)]\n }else if(this.options.cast_date !== false){\n return [undefined, this.options.cast_date.call(null, field, context)]\n }\n return [undefined, field]\n }\n // Keep it in case we implement the `cast_int` option\n // __isInt(value){\n // // return Number.isInteger(parseInt(value))\n // // return !isNaN( parseInt( obj ) );\n // return /^(\\-|\\+)?[1-9][0-9]*$/.test(value)\n // }\n __isFloat(value){\n return (value - parseFloat( value ) + 1) >= 0 // Borrowed from jquery\n }\n __compareBytes(sourceBuf, targetBuf, pos, firtByte){\n if(sourceBuf[0] !== firtByte) return 0\n const sourceLength = sourceBuf.length\n for(let i = 1; i < sourceLength; i++){\n if(sourceBuf[i] !== targetBuf[pos+i]) return 0\n }\n return sourceLength\n }\n __needMoreData(i, bufLen, end){\n if(end){\n return false\n }\n const {comment, delimiter, escape} = this.options\n const {quoting, recordDelimiterMaxLength} = this.state\n const numOfCharLeft = bufLen - i - 1\n const requiredLength = Math.max(\n // Skip if the remaining buffer smaller than comment\n comment ? comment.length : 0,\n // Skip if the remaining buffer smaller than row delimiter\n recordDelimiterMaxLength,\n // Skip if the remaining buffer can be row delimiter following the closing quote\n // 1 is for quote.length\n quoting ? (1 + recordDelimiterMaxLength) : 0,\n // Skip if the remaining buffer can be delimiter\n delimiter.length,\n // Skip if the remaining buffer can be escape sequence\n // 1 is for escape.length\n 1\n )\n return numOfCharLeft < requiredLength\n }\n __isDelimiter(chr, buf, pos){\n const {delimiter} = this.options\n const delLength = delimiter.length\n if(delimiter[0] !== chr) return 0\n for(let i = 1; i < delLength; i++){\n if(delimiter[i] !== buf[pos+i]) return 0\n }\n return delimiter.length\n }\n __isRecordDelimiter(chr, buf, pos){\n const {record_delimiter} = this.options\n const recordDelimiterLength = record_delimiter.length\n loop1: for(let i = 0; i < recordDelimiterLength; i++){\n const rd = record_delimiter[i]\n const rdLength = rd.length\n if(rd[0] !== chr){\n continue\n }\n for(let j = 1; j < rdLength; j++){\n if(rd[j] !== buf[pos+j]){\n continue loop1\n }\n }\n return rd.length\n }\n return 0\n }\n __autoDiscoverRowDelimiter(buf, pos){\n const chr = buf[pos]\n if(chr === cr){\n if(buf[pos+1] === nl){\n this.options.record_delimiter.push(Buffer.from('\\r\\n'))\n this.state.recordDelimiterMaxLength = 2\n return 2\n }else{\n this.options.record_delimiter.push(Buffer.from('\\r'))\n this.state.recordDelimiterMaxLength = 1\n return 1\n }\n }else if(chr === nl){\n this.options.record_delimiter.push(Buffer.from('\\n'))\n this.state.recordDelimiterMaxLength = 1\n return 1\n }\n return 0\n }\n __error(msg){\n const {skip_lines_with_error} = this.options\n const err = new Error(msg)\n if(skip_lines_with_error){\n this.state.recordHasError = true\n this.emit('skip', err)\n return undefined\n }else{\n return err\n }\n }\n}\n\nconst parse = function(){\n let data, options, callback\n for(let i in arguments){\n const argument = arguments[i]\n const type = typeof argument\n if(data === undefined && (typeof argument === 'string' || Buffer.isBuffer(argument))){\n data = argument\n }else if(options === undefined && isObject(argument)){\n options = argument\n }else if(callback === undefined && type === 'function'){\n callback = argument\n }else{\n throw new Error(`Invalid argument: got ${JSON.stringify(argument)} at index ${i}`)\n }\n }\n const parser = new Parser(options)\n if(callback){\n const records = options === undefined || options.objname === undefined ? [] : {}\n parser.on('readable', function(){\n let record\n while(record = this.read()){\n if(options === undefined || options.objname === undefined){\n records.push(record)\n }else{\n records[record[0]] = record[1]\n }\n }\n })\n parser.on('error', function(err){\n callback(err, undefined, parser.info)\n })\n parser.on('end', function(){\n callback(undefined, records, parser.info)\n })\n }\n if(data !== undefined){\n parser.write(data)\n parser.end()\n }\n return parser\n}\n\nparse.Parser = Parser\n\nmodule.exports = parse\n\nconst underscore = function(str){\n return str.replace(/([A-Z])/g, function(_, match, index){\n return '_' + match.toLowerCase()\n })\n}\n\nconst isObject = function(obj){\n return (typeof obj === 'object' && obj !== null && !Array.isArray(obj))\n}\n\nconst normalizeColumnsArray = function(columns){\n // console.log('columns', columns)\n const normalizedColumns = [];\n\n for(let i=0; i< columns.length; i++){\n const column = columns[i]\n if(column === undefined || column === null || column === false){\n normalizedColumns[i] = { disabled: true }\n }else if(typeof column === 'string'){\n normalizedColumns[i] = { name: column }\n }else if(isObject(column)){\n if(typeof column.name !== 'string'){\n throw new Error(`Invalid Option columns: property \"name\" is required at position ${i} when column is an object literal`)\n }\n normalizedColumns[i] = column\n }else{\n throw new Error(`Invalid Option columns: expect a string or an object, got ${JSON.stringify(column)} at position ${i}`)\n }\n }\n // console.log(normalizedColumns)\n return normalizedColumns;\n}\n","import { FlightLogHeader } from './types';\n\nexport const INT_FIELDS = new Set([\n FlightLogHeader.AircraftBatteryCell1Voltage,\n FlightLogHeader.AircraftBatteryCell2Voltage,\n FlightLogHeader.AircraftBatteryCell3Voltage,\n FlightLogHeader.AircraftBatteryCell4Voltage,\n FlightLogHeader.AircraftBatteryCharge,\n FlightLogHeader.AircraftBatteryCurrent,\n FlightLogHeader.AircraftBatteryTemperature,\n FlightLogHeader.AircraftBatteryVoltage,\n FlightLogHeader.AircraftCameraLensFocusModeValue,\n FlightLogHeader.AircraftCameraLensFocusStatusValue,\n FlightLogHeader.AircraftCameraModeValue,\n FlightLogHeader.AircraftFlightModeValue,\n FlightLogHeader.AircraftGPSSignalValue,\n FlightLogHeader.AircraftNoFlyValue,\n FlightLogHeader.AircraftSatellites,\n FlightLogHeader.GimbalModeValue,\n FlightLogHeader.AircraftSmartGoHomeRadius,\n FlightLogHeader.AircraftSmartGoHomeCountdown,\n FlightLogHeader.AircraftVelocityX,\n FlightLogHeader.AircraftVelocityY,\n FlightLogHeader.AircraftVelocityZ,\n FlightLogHeader.RCHorizontalAccuaracy,\n FlightLogHeader.RCLatitude,\n FlightLogHeader.RCLongitude,\n FlightLogHeader.LandingGearStatusValue,\n FlightLogHeader.LandingGearModeValue,\n FlightLogHeader.RCStateValue,\n FlightLogHeader.RCLandingGearValue,\n]);\n\nexport const FLOAT_FIELDS = new Set([\n FlightLogHeader.AircraftBarometricAltitude,\n FlightLogHeader.AircraftBatteryPowerPercent,\n FlightLogHeader.AircraftCameraSDCardRemainingPercent,\n FlightLogHeader.AircraftHeading,\n FlightLogHeader.AircraftLatitude,\n FlightLogHeader.AircraftLongitude,\n FlightLogHeader.AircraftNoFlyLatitude,\n FlightLogHeader.AircraftNoFlyLongitude,\n FlightLogHeader.AircraftNoFlyRadius,\n FlightLogHeader.AircraftPitch,\n FlightLogHeader.AircraftRoll,\n FlightLogHeader.AircraftSmartGoHomeFlightReturnTime,\n FlightLogHeader.AircraftSmartGoHomeFlightTimeRemaining,\n FlightLogHeader.AircraftSmartGoHomeLandingPower,\n FlightLogHeader.AircraftSmartGoHomeLandingTime,\n FlightLogHeader.AircraftSmartGoHomeReturnPower,\n FlightLogHeader.AircraftSpeed,\n FlightLogHeader.AircraftUltrasonicAltitude,\n FlightLogHeader.DeviceToAircraftDistance,\n FlightLogHeader.ElapsedTime,\n FlightLogHeader.GimbalPitch,\n FlightLogHeader.GimbalPitchAtStop,\n FlightLogHeader.GimbalRoll,\n FlightLogHeader.GimbalRollAtStop,\n FlightLogHeader.GimbalYaw,\n FlightLogHeader.GimbalYawAtStop,\n FlightLogHeader.HomeLatitude,\n FlightLogHeader.HomeLongitude,\n FlightLogHeader.RCBatteryPercentRemaining,\n FlightLogHeader.RCLeftHorizontal,\n FlightLogHeader.RCRightHorizontal,\n FlightLogHeader.RCLeftVertical,\n FlightLogHeader.RCRightVertical,\n]);\n\nexport const BOOL_FIELDS = new Set([\n FlightLogHeader.AircraftCameraBurstCapture,\n FlightLogHeader.AircraftCameraIntervalCapture,\n FlightLogHeader.AircraftCameraLensAFAssistant,\n FlightLogHeader.AircraftCameraLensAFEnabled,\n FlightLogHeader.AircraftCameraLensAssistantWorking,\n FlightLogHeader.AircraftCameraOverheated,\n FlightLogHeader.AircraftCameraRawCapture,\n FlightLogHeader.AircraftCameraBurstCapture,\n FlightLogHeader.AircraftCameraRecording,\n FlightLogHeader.AircraftCameraSDCardExists,\n FlightLogHeader.AircraftCameraSensorError,\n FlightLogHeader.AircraftCameraSingleCapture,\n FlightLogHeader.AircraftCameraStoringPhoto,\n FlightLogHeader.AircraftFlying,\n FlightLogHeader.AircraftIMUPreheating,\n FlightLogHeader.AircraftMotorsOn,\n FlightLogHeader.AircraftSmartGoHomeRequesting,\n FlightLogHeader.AircraftUltrasonicOn,\n FlightLogHeader.AircraftVisionOn,\n FlightLogHeader.LandingGearIsMovable,\n FlightLogHeader.RCGoHome,\n FlightLogHeader.RCRecord,\n FlightLogHeader.RCShutter,\n FlightLogHeader.RCPlayback,\n FlightLogHeader.RCPause,\n FlightLogHeader.RCCustom1,\n FlightLogHeader.RCCustom2,\n FlightLogHeader.RCSattelites,\n FlightLogHeader.RCGSPDataIsValid,\n FlightLogHeader.RCLeftHorizontal,\n FlightLogHeader.RCRightHorizontal,\n FlightLogHeader.RCLeftVertical,\n FlightLogHeader.RCRightVertical,\n FlightLogHeader.AircraftCameraChangeableLensSupported,\n FlightLogHeader.AircraftCameraLensInstalled,\n FlightLogHeader.AircraftCameraLensMFAssistant,\n]);\n\nexport const DATE_FIELDS = new Set([\n FlightLogHeader.DateTime,\n]);\n","import parse from 'csv-parse';\n\nimport { FlightLogRow, FlightLogHeader, FlightLogMetaData, FlightLog, FlightLogEvent } from './types';\nimport { INT_FIELDS, BOOL_FIELDS, FLOAT_FIELDS, DATE_FIELDS } from './field-types';\n\nconst syncParse = require('csv-parse/lib/sync');\n\n\nconst META_REGEX = {\n appVersion: /^#DroneDeploy\\s+(.+)$/,\n sessionId: /^Session ID\\s+(.+)$/,\n sessionStart: /^Session Start\\s+(.+)$/,\n sessionEnd: /^Date\\/Time \\(UTC\\)\\s+(.+)$/,\n deviceModel: /^Device Model\\s+(.+)$/,\n deviceOS: /^Device Operating System\\s+(.+)$/,\n aircraftModel: /^Aircraft Model\\s+(.+)$/,\n aircraftName: /^Aircraft Name\\s+(.+)$/,\n aircraftFirmware: /^Aircraft Firmware\\s+(.+)$/,\n batteryChargeVolume: /^Full Charge Volume \\(mAh\\)\\s+(.+)$/,\n batteryRemainingLife: /^Remaining Life \\(%\\)\\s+(.+)$/,\n batteryDischarges: /^Discharges\\s+(.+)$/,\n batteryCells: /^Battery Cells Number\\s+(.+)$/,\n batterySerialNumber: /^Battery Serial Number\\s+(.+)$/,\n batteryFirmware: /^Battery Firmware\\s+(.+)$/,\n fcSerialNumber: /^Flight Controller Serial Number\\s+(.+)$/,\n fcFirmware: /^Flight Controller Firmware\\s+(.+)$/,\n footerLines: /^#Flight Recorder Session End|^Date\\/Time \\(UTC\\)|^Elapsed Time \\(sec\\)/,\n gimbalFirmware: /^Gimbal Firmware\\s+(.+)$/,\n rcSerialNumber: /^Remote Control Serial Number\\s+(.+)$/,\n rcFirmware: /^Remote Control Firmware\\s+(.+)$/,\n cameraSerialNumber: /^Camera Serial Number\\s+(.+)$/,\n elapsedTime: /^Elapsed Time \\(sec\\)\\s+(.+)$/,\n userId: /^User ID\\s+(.+)$/,\n organizationId: /^Organization ID\\s+(.+)$/,\n platform: /^Platform\\s+(.+)$/,\n};\n\nexport type Subscriber = (value: T) => void;\nexport type ErrorSubscriber = (value: any) => void;\nexport type CompletionSubscriber = () => void;\n\nexport interface QuasiObservable {\n subscribe(sub: Subscriber, errSub?: ErrorSubscriber, completionSub?: CompletionSubscriber): void;\n toPromise(): Promise;\n}\n\nexport class QuasiSubject implements QuasiObservable {\n private subscribers: Subscriber[] = [];\n private errorSubscribers: ErrorSubscriber[] = [];\n private completionSubscribers: CompletionSubscriber[] = [];\n private isFinished = false;\n\n next(value: T) {\n if (this.isFinished) {\n return;\n }\n this.subscribers.forEach((s) => s(value));\n }\n\n complete() {\n if (this.isFinished) {\n return;\n }\n this.isFinished = true;\n this.completionSubscribers.forEach((sub) => sub());\n }\n\n error(error: any) {\n if (this.isFinished) {\n return;\n }\n this.errorSubscribers.forEach((errSub) => errSub(error));\n this.complete();\n }\n\n subscribe(sub: Subscriber, errSub?: ErrorSubscriber, completionSub?: CompletionSubscriber) {\n this.subscribers.push(sub);\n if (errSub) {\n this.errorSubscribers.push(errSub);\n }\n if (completionSub) {\n this.completionSubscribers.push(completionSub);\n }\n }\n\n toPromise(): Promise {\n const source = this;\n return new Promise(function (resolve, reject) {\n let value: T;\n source.subscribe(function (v) {\n value = v;\n }, reject, function () {\n resolve(value);\n });\n });\n }\n}\n\nexport function parseLogStream(logStream: QuasiSubject): QuasiObservable {\n const headerMetaLines: string[] = [];\n let meta = {} as FlightLogMetaData;\n let rowHeaderLine: string;\n let row: FlightLogRow;\n\n const progress = { index: 0, completed: false };\n let end: any;\n const result = new QuasiSubject();\n\n logStream.subscribe((line: string) => {\n line = line.trim();\n if (!line.length) {\n return;\n }\n\n if (!rowHeaderLine) {\n if (line.startsWith(FlightLogHeader.DateTime.split(' ')[0])) { // Strip off timezone.\n rowHeaderLine = line;\n meta = parseMetaData(headerMetaLines, []);\n result.next({\n meta,\n rowIndex: progress.index\n });\n } else {\n headerMetaLines.push(line);\n progress.index++;\n }\n return;\n }\n\n if (META_REGEX.footerLines.test(line)) {\n if (META_REGEX.sessionEnd.test(line)) {\n end = fromUtcDateStr(findMatch([line], META_REGEX.sessionEnd));\n } else if (META_REGEX.elapsedTime.test(line)) {\n const elapsed = findMatch([line], META_REGEX.elapsedTime);\n\n // This is the end of the parsing. Because normal lines are parsed through a Promise, they will be delivered\n // asynchronously. So we must ensure that this result is also delivered asynchronously.\n setTimeout(() => {\n const parsedElapsed = elapsed === 'N/A' ? 0 : parseFloat(elapsed);\n if (parsedElapsed) {\n meta.session.elapsed = parsedElapsed;\n }\n if (end) {\n meta.session.end = end;\n }\n result.next({\n meta,\n rowIndex: progress.index++,\n });\n result.complete();\n progress.completed = true;\n }, 0);\n }\n } else {\n parseBody([rowHeaderLine, line], true).then((rows) => {\n row = rows[0];\n meta.session.end = row[FlightLogHeader.DateTime];\n meta.session.elapsed = row[FlightLogHeader.ElapsedTime];\n result.next({\n meta,\n rowIndex: progress.index++,\n row,\n info: parseJsonInfo(row.Info), // Parsed Info column, if the column was populated with a JSON array.\n })\n });\n }\n\n }, (err) => { console.error('parsing error: ' + err); result.complete(); }, () => {\n if (!progress.completed) {\n setTimeout(() => {\n result.complete();\n progress.completed = true;\n }, 0);\n }\n });\n\n return result;\n}\n\nexport function parseLog(log: String): Promise {\n const lines = log.split('\\n');\n const subject = new QuasiSubject();\n const parse = parseLogStream(subject);\n\n const flightLog: FlightLog = {\n metaData: {} as FlightLogMetaData,\n rows: [],\n infos: []\n }\n parse.subscribe((event) => {\n // The metadata is updated as the file is parsed, so always grab the latest one.\n flightLog.metaData = (event.meta) ? event.meta : flightLog.metaData;\n if (event.row) {\n flightLog.rows.push(event.row);\n }\n if (event.info) {\n // @ts-ignore\n flightLog.infos.push(event.info);\n }\n });\n lines.forEach(l => subject.next(l));\n subject.complete();\n\n return new Promise((resolve, reject) => {\n parse.toPromise().then(() => resolve(flightLog)).catch((reason => reject(reason)));\n });\n}\n\nfunction parseBody(lines: string[], sync?: boolean): Promise {\n const text = lines.join('\\n');\n const options = {\n delimiter: '\\t',\n escape: null,\n from: 1,\n quote: null,\n relax_column_count: true,\n };\n\n return new Promise((resolve, reject) => {\n const onResults = (err: any, result: string[]) => {\n if (err) {\n return reject(err);\n }\n\n const [headers, ...rows] = result;\n\n const logs = rows.map((row) => {\n const log = {} as FlightLogRow;\n for (let i = 0; i < headers.length; i++) {\n const header = headers[i].trim() as FlightLogHeader;\n let value: any = row[i];\n\n if (INT_FIELDS.has(header)) {\n value = parseInt(value, 10);\n }\n\n if (FLOAT_FIELDS.has(header)) {\n value = parseFloat(value);\n }\n\n if (BOOL_FIELDS.has(header)) {\n value = value !== '0';\n }\n\n if (DATE_FIELDS.has(header)) {\n value = fromUtcDateStr(value);\n }\n\n log[header] = value;\n }\n\n return log;\n });\n\n resolve(logs);\n };\n if (sync) {\n const results = syncParse(text, options);\n onResults(undefined, results);\n } else {\n // @ts-ignore\n parse(text, options, onResults);\n }\n });\n}\n\nfunction findMatch(search: string[], regex: RegExp, isNum?: boolean) {\n let match;\n for (let str of search) {\n match = str.match(regex);\n if (match) {\n break;\n }\n }\n\n if (!match) {\n return isNum ? '0' : 'N/A';\n }\n\n return match[1];\n}\n\nfunction isValidDate(d: any) {\n return d instanceof Date && !isNaN(d as any);\n}\n\nexport function fromUtcDateStr(utcDateStr: string) {\n if (isValidDate(utcDateStr)) {\n return utcDateStr as any as Date;\n }\n const isBadDate = !utcDateStr || !utcDateStr.trim().length || utcDateStr === 'N/A';\n if (isBadDate) {\n return null;\n }\n if (!/Z$/.test(utcDateStr)) {\n utcDateStr = utcDateStr + '.000Z';\n }\n return new Date(utcDateStr);\n}\n\nfunction parseMetaData(headers: string[], footers: string[]): FlightLogMetaData {\n const meta = [...headers, ...footers];\n let end = findMatch(meta, META_REGEX.sessionEnd);\n let elapsed = findMatch(meta, META_REGEX.elapsedTime);\n\n // if we weren't able to parse an end date or an elapsed time from our footer (which is really just the last three\n // lines of the log file), it's likely that we have a truncated log file. if that's the case, we can still salvage\n // some valid data by parsing the date and elapsed time from the very last log row in the file, which is what we're\n // doing below. it's pretty brittle, but it's preferred to having an invalid end date and a NaN elapsed time.\n if ((end === 'N/A' || elapsed === 'N/A') && footers.length > 0) {\n const lastLine = footers[footers.length - 1];\n const pieces = lastLine.split('\\t');\n\n // if we don't have at least two pieces, i don't know what is in `footer` so i'm just going to leave it alone\n if (pieces.length >= 2) {\n end = pieces[0];\n elapsed = pieces[1];\n }\n }\n\n return {\n appVersion: findMatch(meta, META_REGEX.appVersion),\n session: {\n id: findMatch(meta, META_REGEX.sessionId),\n start: fromUtcDateStr(findMatch(meta, META_REGEX.sessionStart)) as Date,\n end: fromUtcDateStr(end),\n elapsed: elapsed === 'N/A' ? 0 : parseFloat(elapsed),\n },\n device: {\n model: findMatch(meta, META_REGEX.deviceModel),\n os: findMatch(meta, META_REGEX.deviceOS).replace(/\\t/g, ' '),\n platform: findMatch(meta, META_REGEX.platform),\n },\n aircraft: {\n model: findMatch(meta, META_REGEX.aircraftModel),\n name: findMatch(meta, META_REGEX.aircraftName),\n firmware: findMatch(meta, META_REGEX.aircraftFirmware),\n },\n battery: {\n chargeVolume: parseInt(findMatch(meta, META_REGEX.batteryChargeVolume, true), 10),\n remainingLifePercent: parseInt(findMatch(meta, META_REGEX.batteryRemainingLife, true), 10),\n discharges: parseInt(findMatch(meta, META_REGEX.batteryDischarges, true), 10),\n cells: parseInt(findMatch(meta, META_REGEX.batteryCells, true), 10),\n firmware: findMatch(meta, META_REGEX.batteryFirmware),\n serialNumber: findMatch(meta, META_REGEX.batterySerialNumber),\n },\n flightController: {\n serialNumber: findMatch(meta, META_REGEX.fcSerialNumber),\n firmware: findMatch(meta, META_REGEX.fcFirmware),\n },\n gimbal: {\n firmware: findMatch(meta, META_REGEX.gimbalFirmware),\n },\n remoteController: {\n serialNumber: findMatch(meta, META_REGEX.rcSerialNumber),\n firmware: findMatch(meta, META_REGEX.rcFirmware),\n },\n camera: {\n serialNumber: findMatch(meta, META_REGEX.cameraSerialNumber),\n },\n user: {\n userId: findMatch(meta, META_REGEX.userId),\n organizationId: findMatch(meta, META_REGEX.organizationId),\n },\n };\n}\n\n/**\n * Parse out the given string and return an object if the string is JSON, return undefined otherwise.\n *\n * @param info\n */\nfunction parseJsonInfo(info: string): undefined|Array {\n if (!info) {\n return undefined;\n }\n try {\n return JSON.parse(info);\n }\n catch (e) {\n return undefined;\n }\n}\n"],"names":["FlightLogHeader","exports","Buffer","from","INT_FIELDS","Set","AircraftBatteryCell1Voltage","AircraftBatteryCell2Voltage","AircraftBatteryCell3Voltage","AircraftBatteryCell4Voltage","AircraftBatteryCharge","AircraftBatteryCurrent","AircraftBatteryTemperature","AircraftBatteryVoltage","AircraftCameraLensFocusModeValue","AircraftCameraLensFocusStatusValue","AircraftCameraModeValue","AircraftFlightModeValue","AircraftGPSSignalValue","AircraftNoFlyValue","AircraftSatellites","GimbalModeValue","AircraftSmartGoHomeRadius","AircraftSmartGoHomeCountdown","AircraftVelocityX","AircraftVelocityY","AircraftVelocityZ","RCHorizontalAccuaracy","RCLatitude","RCLongitude","LandingGearStatusValue","LandingGearModeValue","RCStateValue","RCLandingGearValue","FLOAT_FIELDS","AircraftBarometricAltitude","AircraftBatteryPowerPercent","AircraftCameraSDCardRemainingPercent","AircraftHeading","AircraftLatitude","AircraftLongitude","AircraftNoFlyLatitude","AircraftNoFlyLongitude","AircraftNoFlyRadius","AircraftPitch","AircraftRoll","AircraftSmartGoHomeFlightReturnTime","AircraftSmartGoHomeFlightTimeRemaining","AircraftSmartGoHomeLandingPower","AircraftSmartGoHomeLandingTime","AircraftSmartGoHomeReturnPower","AircraftSpeed","AircraftUltrasonicAltitude","DeviceToAircraftDistance","ElapsedTime","GimbalPitch","GimbalPitchAtStop","GimbalRoll","GimbalRollAtStop","GimbalYaw","GimbalYawAtStop","HomeLatitude","HomeLongitude","RCBatteryPercentRemaining","RCLeftHorizontal","RCRightHorizontal","RCLeftVertical","RCRightVertical","BOOL_FIELDS","AircraftCameraBurstCapture","AircraftCameraIntervalCapture","AircraftCameraLensAFAssistant","AircraftCameraLensAFEnabled","AircraftCameraLensAssistantWorking","AircraftCameraOverheated","AircraftCameraRawCapture","AircraftCameraRecording","AircraftCameraSDCardExists","AircraftCameraSensorError","AircraftCameraSingleCapture","AircraftCameraStoringPhoto","AircraftFlying","AircraftIMUPreheating","AircraftMotorsOn","AircraftSmartGoHomeRequesting","AircraftUltrasonicOn","AircraftVisionOn","LandingGearIsMovable","RCGoHome","RCRecord","RCShutter","RCPlayback","RCPause","RCCustom1","RCCustom2","RCSattelites","RCGSPDataIsValid","AircraftCameraChangeableLensSupported","AircraftCameraLensInstalled","AircraftCameraLensMFAssistant","DATE_FIELDS","DateTime","syncParse","require","META_REGEX","appVersion","sessionId","sessionStart","sessionEnd","deviceModel","deviceOS","aircraftModel","aircraftName","aircraftFirmware","batteryChargeVolume","batteryRemainingLife","batteryDischarges","batteryCells","batterySerialNumber","batteryFirmware","fcSerialNumber","fcFirmware","footerLines","gimbalFirmware","rcSerialNumber","rcFirmware","cameraSerialNumber","elapsedTime","userId","organizationId","platform","QuasiSubject","constructor","this","subscribers","errorSubscribers","completionSubscribers","isFinished","next","value","forEach","s","complete","sub","error","errSub","subscribe","completionSub","push","toPromise","source","Promise","resolve","reject","v","parseLogStream","logStream","headerMetaLines","rowHeaderLine","row","meta","progress","index","completed","end","result","line","trim","length","test","fromUtcDateStr","findMatch","elapsed","setTimeout","parsedElapsed","parseFloat","session","rowIndex","lines","text","join","options","delimiter","escape","quote","relax_column_count","onResults","err","headers","rows","logs","map","log","i","header","has","parseInt","undefined","parseBody","then","info","parseJsonInfo","Info","startsWith","split","footers","pieces","id","start","device","model","os","replace","aircraft","name","firmware","battery","chargeVolume","remainingLifePercent","discharges","cells","serialNumber","flightController","gimbal","remoteController","camera","user","parseMetaData","console","search","regex","isNum","match","str","utcDateStr","d","Date","isNaN","JSON","parse","e","subject","flightLog","metaData","infos","event","l","catch","reason"],"mappings":"kRAAA,IAAYA,EAuIXC,EAAAD,qBAAA,GAvIWA,EAAAA,oBAAAA,EAAAA,gBAuIX,CAAA,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AI,OACJ,GAAI,gBACJ,GAAI,cACJ,GAAI,SACJ,GAAI,OACJ,GAAI,UACJ,GAAI,MACJ,GAAI,YACJ,GAAI,aACJ,GAAI,kBACJ,GAAI,iBACJ,GAAI,eACJ,GAAI,aACJ,GAAI,SACJ,GAAI,wBACJ,GAAI,sBACJ,GAAI,aACJ,IAAK,oCAG+B,CACpC,EAAG,SACH,EAAG,WACH,EAAG,aACH,EAAG,MACH,EAAG,gBACH,EAAG,eACH,EAAG,eACH,EAAG,WACH,EAAG,UACH,EAAG,gBACH,GAAI,eACJ,GAAI,OACJ,GAAI,YACJ,GAAI,aACJ,GAAI,iBACJ,GAAI,YACJ,GAAI,gBACJ,GAAI,mBACJ,GAAI,WACJ,GAAI,YACJ,GAAI,OACJ,GAAI,gBACJ,GAAI,aACJ,GAAI,cACJ,GAAI,UACJ,GAAI,cACJ,GAAI,OACJ,GAAI,YACJ,GAAI,eACJ,GAAI,0DG9FA,SAAmBhD,GACvB,MAAMd,EAAQc,EAAIY,MAAM,MAClBqC,EAAU,IAAI9G,EACd4G,EAAQpF,EAAesF,GAEvBC,EAAuB,CAC3BC,SAAU,CAAuB,EACjCtD,KAAM,GACNuD,MAAO,IAgBT,OAdAL,EAAM7F,WAAWmG,IAEfH,EAAUC,SAAYE,EAAU,KAAIA,EAAMrF,KAAOkF,EAAUC,SACvDE,EAAMtF,KACRmF,EAAUrD,KAAKzC,KAAKiG,EAAMtF,KAExBsF,EAAM7C,MAER0C,EAAUE,MAAMhG,KAAKiG,EAAM7C,KAC5B,IAEHtB,EAAMtC,SAAQ0G,GAAKL,EAAQvG,KAAK4G,KAChCL,EAAQnG,WAED,IAAIS,SAAmB,CAACC,EAASC,KACtCsF,EAAM1F,YAAYkD,MAAK,IAAM/C,EAAQ0F,KAAYK,OAAOC,GAAU/F,EAAO+F,IAAS,GAEtF","x_google_ignoreList":[1]} \ No newline at end of file diff --git a/dist/lib/__test__/android.test.js b/dist/lib/__test__/android.test.js deleted file mode 100644 index 6023ff7..0000000 --- a/dist/lib/__test__/android.test.js +++ /dev/null @@ -1,112 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -require("jest"); -const parser_1 = require("../parser"); -const types_1 = require("../types"); -const path = require('path'); -const readFileAsync = require('fs').promises.readFile; -const androidFilePath = path.join(__dirname, '/../../testlog/pixel2-inspire2.log'); -describe('test parse android logs', () => { - let androidLogs; - beforeAll(() => __awaiter(void 0, void 0, void 0, function* () { - androidLogs = { - pixel2: yield readFileAsync(androidFilePath, { encoding: 'utf8' }), - // other: await readFileAsync(otherPath, {encoding: 'utf8'}), - }; - })); - it('fsRead log should exist', () => __awaiter(void 0, void 0, void 0, function* () { - expect(androidLogs).toBeTruthy(); - })); - describe('test pixel2 log', () => { - let pixel2Log; - beforeAll(() => __awaiter(void 0, void 0, void 0, function* () { - pixel2Log = yield (0, parser_1.parseLog)(androidLogs.pixel2); - })); - it('parsed log should exist', () => __awaiter(void 0, void 0, void 0, function* () { - expect(pixel2Log).toBeTruthy(); - })); - it('parsed log should have correct os', () => __awaiter(void 0, void 0, void 0, function* () { - const pixel2LogMetaData = pixel2Log.metaData; - const os = pixel2LogMetaData.device.os; - const re = /(android \d+(\.\d)*)/i; - const result = os.match(re); - expect(result).toBeTruthy(); - })); - describe('pixel2 log rows', () => { - it('has proper key for each row', () => { - const pixel2LogRows = pixel2Log.rows; - const firstRow = pixel2LogRows[0]; - const { AircraftBatteryPowerPercent } = types_1.FlightLogHeader; - expect(firstRow).toHaveProperty(AircraftBatteryPowerPercent); - }); - }); - describe('pixel2-inspire2 log metaData test', () => { - it('parsed log should have correct session info', () => { - const pixel2LogMetaData = pixel2Log.metaData; - const { session } = pixel2LogMetaData; - const { id, start, end, elapsed } = session; - const startDate = (0, parser_1.fromUtcDateStr)('06/04/2018 20:32:30'); - const endDate = (0, parser_1.fromUtcDateStr)('06/04/2018 20:34:55'); - expect(id).toEqual('12345678'); - expect(start).toEqual(startDate); - expect(end).toEqual(endDate); - expect(elapsed).toEqual(145.0); - }); - it('parsed log should have correct aircraft info', () => { - const pixel2LogMetaData = pixel2Log.metaData; - const { aircraft } = pixel2LogMetaData; - const { model, name, firmware } = aircraft; - expect(model).toEqual('Inspire 2'); - expect(name).toEqual('123'); - expect(firmware).toEqual('01.02.0100'); - }); - it('parsed log should have correct battery info', () => { - const pixel2LogMetaData = pixel2Log.metaData; - const { battery } = pixel2LogMetaData; - const { chargeVolume, remainingLifePercent, discharges, cells, firmware, serialNumber, } = battery; - expect(serialNumber).toEqual('12345678'); - expect(chargeVolume).toEqual(4152); - expect(remainingLifePercent).toEqual(98); - expect(discharges).toEqual(27); - expect(cells).toEqual(6); - expect(firmware).toEqual('01.00.00.65'); - }); - it('parsed log should have correct flightController info', () => { - const pixel2LogMetaData = pixel2Log.metaData; - const { flightController } = pixel2LogMetaData; - const { serialNumber, firmware } = flightController; - expect(serialNumber).toEqual('12345678'); - expect(firmware).toEqual('03.02.44.09'); - }); - it('parsed log should have correct gimbal info', () => { - const pixel2LogMetaData = pixel2Log.metaData; - const { gimbal } = pixel2LogMetaData; - const { firmware } = gimbal; - expect(firmware).toEqual('01.01.00.20'); - }); - it('parsed log should have correct remoteController info', () => { - const pixel2LogMetaData = pixel2Log.metaData; - const { remoteController } = pixel2LogMetaData; - const { serialNumber, firmware } = remoteController; - expect(serialNumber).toEqual('12345678'); - expect(firmware).toEqual('01.01.0010'); - }); - it('parsed log should have correct Camera info', () => { - const pixel2LogMetaData = pixel2Log.metaData; - const { camera } = pixel2LogMetaData; - const { serialNumber } = camera; - expect(serialNumber).toEqual('12345678'); - }); - }); - }); -}); -//# sourceMappingURL=android.test.js.map \ No newline at end of file diff --git a/dist/lib/__test__/android.test.js.map b/dist/lib/__test__/android.test.js.map deleted file mode 100644 index 8076678..0000000 --- a/dist/lib/__test__/android.test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"android.test.js","sourceRoot":"","sources":["../../../src/__test__/android.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,gBAAc;AAEd,sCAAmD;AACnD,oCAA2C;AAE3C,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;AAEtD,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,oCAAoC,CAAC,CAAC;AAEnF,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,IAAI,WAAgB,CAAC;IACrB,SAAS,CAAC,GAAS,EAAE;QACnB,WAAW,GAAG;YACZ,MAAM,EAAE,MAAM,aAAa,CAAC,eAAe,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;YAClE,6DAA6D;SAC9D,CAAC;IACJ,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,yBAAyB,EAAE,GAAS,EAAE;QACvC,MAAM,CAAC,WAAW,CAAC,CAAC,UAAU,EAAE,CAAC;IACnC,CAAC,CAAA,CAAC,CAAC;IAEH,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;QAC/B,IAAI,SAAc,CAAC;QACnB,SAAS,CAAC,GAAS,EAAE;YACnB,SAAS,GAAG,MAAM,IAAA,iBAAQ,EAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QACjD,CAAC,CAAA,CAAC,CAAC;QAEH,EAAE,CAAC,yBAAyB,EAAE,GAAS,EAAE;YACvC,MAAM,CAAC,S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AAC,CAAC;YAEH,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;gBACpD,MAAM,iBAAiB,GAAG,SAAS,CAAC,QAAQ,CAAC;gBAC7C,MAAM,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAC;gBACrC,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC;gBAEhC,MAAM,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;YAC3C,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/lib/__test__/invalid-logs.test.js b/dist/lib/__test__/invalid-logs.test.js deleted file mode 100644 index 55b097b..0000000 --- a/dist/lib/__test__/invalid-logs.test.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -require("jest"); -const parser_1 = require("../parser"); -const path = require('path'); -const fs = require('fs'); -const truncatedLog = path.join(__dirname, '/../../testlog/truncated.log'); -describe('test parsing troublesome logs', () => { - describe('truncated log file', () => { - let parsedLog; - beforeEach(() => __awaiter(void 0, void 0, void 0, function* () { - const log = fs.readFileSync(truncatedLog, { encoding: 'utf8' }); - parsedLog = yield (0, parser_1.parseLog)(log); - })); - it('should approximate a valid elapsed time based on the last log row', () => { - const { metaData } = parsedLog; - expect(metaData.session.elapsed).toBe(8.074); - }); - it('should approximate a valid end date based on the last log row', () => { - const { metaData } = parsedLog; - expect(metaData.session.end.toISOString()).toBe('2018-06-04T20:32:38.000Z'); - }); - }); -}); -//# sourceMappingURL=invalid-logs.test.js.map \ No newline at end of file diff --git a/dist/lib/__test__/invalid-logs.test.js.map b/dist/lib/__test__/invalid-logs.test.js.map deleted file mode 100644 index 792cee9..0000000 --- a/dist/lib/__test__/invalid-logs.test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"invalid-logs.test.js","sourceRoot":"","sources":["../../../src/__test__/invalid-logs.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,gBAAc;AAEd,sCAAqC;AAGrC,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACzB,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,8BAA8B,CAAC,CAAC;AAE1E,QAAQ,CAAC,+BAA+B,EAAE,GAAG,EAAE;IAC7C,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;QAClC,IAAI,SAAoB,CAAC;QAEzB,UAAU,CAAC,GAAS,EAAE;YACpB,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;YAChE,SAAS,GAAG,MAAM,IAAA,iBAAQ,EAAC,GAAG,CAAC,CAAC;QAClC,CAAC,CAAA,CAAC,CAAC;QAEH,EAAE,CAAC,mEAAmE,EAAE,GAAG,EAAE;YAC3E,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAC;YAE/B,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,+DAA+D,EAAE,GAAG,EAAE;YACvE,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAC;YAE/B,MAAM,CAAE,QAAQ,CAAC,OAAO,CAAC,GAAY,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;QACxF,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/lib/__test__/ios.test.js b/dist/lib/__test__/ios.test.js deleted file mode 100644 index 89e774b..0000000 --- a/dist/lib/__test__/ios.test.js +++ /dev/null @@ -1,245 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -require("jest"); -const parser_1 = require("../parser"); -const types_1 = require("../types"); -const testutil_1 = require("./testutil"); -describe('test parse ios logs', () => { - let iosLogs; - beforeAll(() => __awaiter(void 0, void 0, void 0, function* () { - iosLogs = yield (0, testutil_1.getIosLogs)(); - })); - it('fsRead log should exist', () => __awaiter(void 0, void 0, void 0, function* () { - expect(iosLogs).toBeTruthy(); - })); - describe('test sampleErrLog log', () => { - let sampleErrLog; - beforeAll(() => __awaiter(void 0, void 0, void 0, function* () { - sampleErrLog = yield (0, parser_1.parseLog)(iosLogs.errorLog); - })); - describe('sampleErrLog detail test', () => { - it('parsed log should have correct falsy value when session info has no value', () => { - const sampleErrLogMetaData = sampleErrLog.metaData; - const { session } = sampleErrLogMetaData; - const { id, start, end, elapsed } = session; - expect(id).toEqual('N/A'); - expect(start).toBeNull(); - expect(end).toEqual(new Date('2018-06-04T22:31:40.000Z')); - expect(elapsed).toEqual(160.313); - }); - it('parsed log should have correct falsy value when aircraft info has no value', () => { - const sampleErrLogMetaData = sampleErrLog.metaData; - const { aircraft } = sampleErrLogMetaData; - const { model, name, firmware } = aircraft; - expect(model).toEqual('N/A'); - expect(name).toEqual('N/A'); - expect(firmware).toEqual('N/A'); - }); - it('parsed log should have correct falsy value when battery info has no value', () => { - const sampleErrLogMetaData = sampleErrLog.metaData; - const { battery } = sampleErrLogMetaData; - const { chargeVolume, remainingLifePercent, discharges, cells, firmware, serialNumber, } = battery; - expect(serialNumber).toEqual('N/A'); - expect(chargeVolume).toEqual(0); - expect(remainingLifePercent).toEqual(0); - expect(discharges).toEqual(0); - expect(cells).toEqual(0); - expect(firmware).toEqual('N/A'); - }); - it('parsed log should have correct falsy value when gimbal info has no value', () => { - const sampleErrLogMetaData = sampleErrLog.metaData; - const { gimbal } = sampleErrLogMetaData; - const { firmware } = gimbal; - expect(firmware).toEqual('N/A'); - }); - it('parsed log should have correct falsy value when flightController info has no value', () => { - const sampleErrLogMetaData = sampleErrLog.metaData; - const { flightController } = sampleErrLogMetaData; - const { serialNumber, firmware } = flightController; - expect(serialNumber).toEqual('N/A'); - expect(firmware).toEqual('N/A'); - }); - it('parsed log should have correct falsy value when remoteController info has no value', () => { - const sampleErrLogMetaData = sampleErrLog.metaData; - const { remoteController } = sampleErrLogMetaData; - const { serialNumber, firmware } = remoteController; - expect(serialNumber).toEqual('N/A'); - expect(firmware).toEqual('N/A'); - }); - it('parsed log should have correct falsy value when camera info has no value', () => { - const sampleErrLogMetaData = sampleErrLog.metaData; - const { camera } = sampleErrLogMetaData; - const { serialNumber } = camera; - expect(serialNumber).toEqual('N/A'); - }); - }); - }); - describe('test iphone log', () => { - let iphoneLog; - beforeAll(() => __awaiter(void 0, void 0, void 0, function* () { - iphoneLog = yield (0, parser_1.parseLog)(iosLogs.iphone); - })); - it('parsed log should have correct os', () => { - const iphoneLogMetaData = iphoneLog.metaData; - const os = iphoneLogMetaData.device.os; - const re = /(ios \d+(\.\d)*)/i; - const result = os.match(re); - expect(result).toBeTruthy(); - }); - describe('iphone log rows', () => { - it('has proper key for each row', () => { - const iphoneLogRows = iphoneLog.rows; - const firstRow = iphoneLogRows[0]; - const { AircraftBatteryPowerPercent } = types_1.FlightLogHeader; - expect(firstRow).toHaveProperty(AircraftBatteryPowerPercent); - }); - }); - describe('iphone-ios11-inspire metaData detail test', () => { - it('parsed log should have correct session info', () => { - const iphoneLogMetaData = iphoneLog.metaData; - const { session } = iphoneLogMetaData; - const { id, start, end, elapsed } = session; - const startDate = (0, parser_1.fromUtcDateStr)('06/04/2018 22:29:00'); - const endDate = (0, parser_1.fromUtcDateStr)('06/04/2018 22:31:40'); - expect(id).toEqual('12345678'); - expect(start).toEqual(startDate); - expect(end).toEqual(endDate); - expect(elapsed).toEqual(160.408); - }); - it('parsed log should have correct aircraft info', () => { - const iphoneLogMetaData = iphoneLog.metaData; - const { aircraft } = iphoneLogMetaData; - const { model, name, firmware } = aircraft; - expect(model).toEqual('Inspire 1 Pro'); - expect(name).toEqual('123'); - expect(firmware).toEqual('1.11.01.50'); - }); - it('parsed log should have correct battery info', () => { - const iphoneLogMetaData = iphoneLog.metaData; - const { battery } = iphoneLogMetaData; - const { chargeVolume, remainingLifePercent, discharges, cells, firmware, serialNumber, } = battery; - expect(serialNumber).toEqual('12345678'); - expect(chargeVolume).toEqual(4287); - expect(remainingLifePercent).toEqual(83); - expect(discharges).toEqual(69); - expect(cells).toEqual(6); - expect(firmware).toEqual('03.09.00.00'); - }); - it('parsed log should have correct flightController info', () => { - const iphoneLogMetaData = iphoneLog.metaData; - const { flightController } = iphoneLogMetaData; - const { serialNumber, firmware } = flightController; - expect(serialNumber).toEqual('N/A'); - expect(firmware).toEqual('02.04.20.50'); - }); - it('parsed log should have correct gimbal info', () => { - const iphoneLogMetaData = iphoneLog.metaData; - const { gimbal } = iphoneLogMetaData; - const { firmware } = gimbal; - expect(firmware).toEqual('01.31.01.67'); - }); - it('parsed log should have correct remoteController info', () => { - const iphoneLogMetaData = iphoneLog.metaData; - const { remoteController } = iphoneLogMetaData; - const { serialNumber, firmware } = remoteController; - expect(serialNumber).toEqual('12345678'); - expect(firmware).toEqual('1.2.0.17'); - }); - it('parsed log should have correct Camera info', () => { - const iphoneLogMetaData = iphoneLog.metaData; - const { camera } = iphoneLogMetaData; - const { serialNumber } = camera; - expect(serialNumber).toEqual('N/A'); - }); - }); - }); - describe('test ipad log', () => { - let ipadLog; - beforeAll(() => __awaiter(void 0, void 0, void 0, function* () { - ipadLog = yield (0, parser_1.parseLog)(iosLogs.ipad); - })); - it('parsed log should have correct os', () => { - const ipadLogMetaData = ipadLog.metaData; - const os = ipadLogMetaData.device.os; - const re = /(ios \d+(\.\d)*)/i; - const result = os.match(re); - expect(result).toBeTruthy(); - }); - describe('ipadLog rows', () => { - it('has proper key for each row', () => { - const ipadLogRows = ipadLog.rows; - const firstRow = ipadLogRows[0]; - const { AircraftBatteryPowerPercent } = types_1.FlightLogHeader; - expect(firstRow).toHaveProperty(AircraftBatteryPowerPercent); - }); - }); - describe('ipad-ios11-phantom4 metaData test', () => { - it('parsed log should have correct session info', () => { - const ipadLogMetaData = ipadLog.metaData; - const { session } = ipadLogMetaData; - const { id, start, end, elapsed } = session; - const startDate = (0, parser_1.fromUtcDateStr)('05/23/2018 20:50:18'); - const endDate = (0, parser_1.fromUtcDateStr)('05/23/2018 20:54:12'); - expect(id).toEqual('12345678'); - expect(start).toEqual(startDate); - expect(end).toEqual(endDate); - expect(elapsed).toEqual(233.217); - }); - it('parsed log should have correct aircraft info', () => { - const ipadLogMetaData = ipadLog.metaData; - const { aircraft } = ipadLogMetaData; - const { model, name, firmware } = aircraft; - expect(model).toEqual('Phantom 4 Pro'); - expect(name).toEqual('123'); - expect(firmware).toEqual('01.05.0600'); - }); - it('parsed log should have correct battery info', () => { - const ipadLogMetaData = ipadLog.metaData; - const { battery } = ipadLogMetaData; - const { chargeVolume, remainingLifePercent, discharges, cells, firmware, serialNumber, } = battery; - expect(serialNumber).toEqual('N/A'); - expect(chargeVolume).toEqual(5842); - expect(remainingLifePercent).toEqual(0); - expect(discharges).toEqual(28); - expect(cells).toEqual(4); - expect(firmware).toEqual('02.00.07.31'); - }); - it('parsed log should have correct gimbal info', () => { - const ipadLogMetaData = ipadLog.metaData; - const { gimbal } = ipadLogMetaData; - const { firmware } = gimbal; - expect(firmware).toEqual('01.50.13.17'); - }); - it('parsed log should have correct flightController info', () => { - const ipadLogMetaData = ipadLog.metaData; - const { flightController } = ipadLogMetaData; - const { serialNumber, firmware } = flightController; - expect(serialNumber).toEqual('12345678'); - expect(firmware).toEqual('03.02.44.07'); - }); - it('parsed log should have correct remoteController info', () => { - const ipadLogMetaData = ipadLog.metaData; - const { remoteController } = ipadLogMetaData; - const { serialNumber, firmware } = remoteController; - expect(serialNumber).toEqual('12345678'); - expect(firmware).toEqual('01.04.01.00'); - }); - it('parsed log should have correct Camera info', () => { - const ipadLogMetaData = ipadLog.metaData; - const { camera } = ipadLogMetaData; - const { serialNumber } = camera; - expect(serialNumber).toEqual('N/A'); - }); - }); - }); -}); -//# sourceMappingURL=ios.test.js.map \ No newline at end of file diff --git a/dist/lib/__test__/ios.test.js.map b/dist/lib/__test__/ios.test.js.map deleted file mode 100644 index 7cf440d..0000000 --- a/dist/lib/__test__/ios.test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ios.test.js","sourceRoot":"","sources":["../../../src/__test__/ios.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,gBAAc;AACd,sCAAqD;AACrD,oCAA2C;AAC3C,yCAAwC;AAExC,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,IAAI,OAAY,CAAC;IACjB,SAAS,CAAC,GAAS,EAAE;QACnB,OAAO,GAAG,MAAM,IAAA,qBAAU,GAAE,CAAC;IAC/B,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,yBAAyB,EAAE,GAAS,EAAE;QACvC,MAAM,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,CA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AE,gBAAgB,EAAE,GAAG,eAAe,CAAC;gBAC7C,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,gBAAgB,CAAC;gBAEpD,MAAM,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;gBACzC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;YAC1C,CAAC,CAAC,CAAC;YAEH,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;gBACpD,MAAM,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC;gBACzC,MAAM,EAAE,MAAM,EAAE,GAAG,eAAe,CAAC;gBACnC,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC;gBAEhC,MAAM,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACtC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AAEL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/lib/__test__/json-info.test.js b/dist/lib/__test__/json-info.test.js deleted file mode 100644 index a7e0ba3..0000000 --- a/dist/lib/__test__/json-info.test.js +++ /dev/null @@ -1,145 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -require("jest"); -const parser_1 = require("../parser"); -const path = require('path'); -const readFileAsync = require('fs').promises.readFile; -const jsonInfoLogFilePath = path.join(__dirname, '../../testlog/json-info.log'); -const jsonInfoLogFilePath2 = path.join(__dirname, '../../testlog/json-info-2-plans.log'); -describe('Test parseLog on log file with JSON Info column', () => { - let log; - let log2; - beforeAll(() => __awaiter(void 0, void 0, void 0, function* () { - let tempLog; - tempLog = yield readFileAsync(jsonInfoLogFilePath, { encoding: 'utf-8' }); - if (Buffer.isBuffer(tempLog)) { - log = tempLog.toString(); - } - else { - log = tempLog; - } - tempLog = yield readFileAsync(jsonInfoLogFilePath2, { encoding: 'utf-8' }); - if (Buffer.isBuffer(tempLog)) { - log2 = tempLog.toString(); - } - else { - log2 = tempLog; - } - })); - it('log files exists', () => __awaiter(void 0, void 0, void 0, function* () { - expect(log).toBeTruthy(); - expect(log2).toBeTruthy(); - })); - describe('parsed json-info log', () => { - let metadata; - const rows = []; - const info = []; - beforeAll(() => __awaiter(void 0, void 0, void 0, function* () { - const lines = log.split('\n'); - const subject = new parser_1.QuasiSubject(); - const parse = (0, parser_1.parseLogStream)(subject); - parse.subscribe((event) => { - metadata = (event.meta) ? event.meta : metadata; - if (event.row) - rows.push(event.row); - if (event.info) - info.push(event.info); - }); - lines.forEach(l => subject.next(l)); - subject.complete(); - })); - it('should have correct metadata', () => __awaiter(void 0, void 0, void 0, function* () { - const expected = { - "aircraft": { - "firmware": "Fake Aircraft Firmware Package", - "model": "Phantom 4 Pro", - "name": "Fake Aircraft Name" - }, - "appVersion": "4.21.0.1517", - "battery": { - "cells": 0, - "chargeVolume": 1, - "discharges": 4, - "firmware": "Fake Battery Firmware", - "remainingLifePercent": 1, - "serialNumber": "Fake Battery Serial" - }, - "camera": { - "serialNumber": "Fake Camera Serial" - }, - "device": { - "model": "iPad", - "os": "iOS 14.1", - "platform": "N/A" - }, - "flightController": { - "firmware": "Fake FC Firwmare", - "serialNumber": "Fake FC Serial" - }, - "gimbal": { - "firmware": "Fake Gimbal Firmware" - }, - "remoteController": { - "firmware": "Fake RC Firmware", - "serialNumber": "Fake RC Serial" - }, - "session": { - "elapsed": 221.819, - "end": (0, parser_1.fromUtcDateStr)("2020-11-13T01:16:22.000Z"), - "id": "unknown_plan_id", - "start": (0, parser_1.fromUtcDateStr)("2020-11-13T01:12:40.000Z") - }, - "user": { - "organizationId": "5ce4361f919c5f0001530f71", - "userId": "58adcdaff6b11d0001fff143" - } - }; - expect(metadata).toEqual(expected); - })); - it('should have correct flight log rows', () => __awaiter(void 0, void 0, void 0, function* () { - expect(rows.length).toEqual(1170); - })); - it('should have correct JSON Info', () => __awaiter(void 0, void 0, void 0, function* () { - expect(info.length).toEqual(1); - expect(info[0].length).toEqual(2); - expect(info[0][0]).toEqual({ message: "Mission did take off" }); - expect(info[0][1]).toEqual({ - planId: "5faddd83440520a955fb31c2", - projectId: "5e5da0be976932beb266c15f", - templateId: "5f1b24bb3fd4e17d4952cf4b" - }); - })); - }); - describe('parsed json-info log with 2 plans', () => { - let metadata; - const rows = []; - const info = []; - beforeAll(() => __awaiter(void 0, void 0, void 0, function* () { - const lines = log2.split('\n'); - const subject = new parser_1.QuasiSubject(); - const parse = (0, parser_1.parseLogStream)(subject); - parse.subscribe((event) => { - metadata = (event.meta) ? event.meta : metadata; - if (event.row) - rows.push(event.row); - if (event.info) - info.push(event.info); - }); - lines.forEach(l => subject.next(l)); - subject.complete(); - })); - it('should have 2 plans', () => { - expect(info.length).toEqual(2); - }); - }); -}); -//# sourceMappingURL=json-info.test.js.map \ No newline at end of file diff --git a/dist/lib/__test__/json-info.test.js.map b/dist/lib/__test__/json-info.test.js.map deleted file mode 100644 index e1b01c8..0000000 --- a/dist/lib/__test__/json-info.test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"json-info.test.js","sourceRoot":"","sources":["../../../src/__test__/json-info.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,gBAAa;AACb,sCAAyE;AAGzE,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;AAEtD,MAAM,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js b/dist/lib/__test__/parser.test.js deleted file mode 100644 index 8975fbc..0000000 --- a/dist/lib/__test__/parser.test.js +++ /dev/null @@ -1,301 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -require("jest"); -const parser_1 = require("../parser"); -const testutil_1 = require("./testutil"); -const _ = require('lodash'); -describe('parser', () => { - let iosLogs; - beforeAll(() => __awaiter(void 0, void 0, void 0, function* () { - iosLogs = yield (0, testutil_1.getIosLogs)(); - })); - describe('fromUtcDateStr', () => { - it('should parse tz-aware timestamps correctly', () => { - const noonPacific = '05/23/2018 20:00:00.000Z'; - expect((0, parser_1.fromUtcDateStr)(noonPacific).toISOString()).toBe('2018-05-23T20:00:00.000Z'); - const noonUtc = '05/23/2018 12:00:00.000Z'; - expect((0, parser_1.fromUtcDateStr)(noonUtc).toISOString()).toBe('2018-05-23T12:00:00.000Z'); - }); - it('should parse tz-naive timestamps as UTC', () => { - const noon = '05/23/2018 12:00:00'; - expect((0, parser_1.fromUtcDateStr)(noon).toISOString()).toBe('2018-05-23T12:00:00.000Z'); - const onePm = '2018-05-23 13:00:00'; - expect((0, parser_1.fromUtcDateStr)(onePm).toISOString()).toBe('2018-05-23T13:00:00.000Z'); - }); - }); - describe('parseLogStream', () => { - it('should parse the ios stream correctly', () => { - const subj = new parser_1.QuasiSubject(); - const events = []; - const parseLogStreamObs = (0, parser_1.parseLogStream)(subj); - parseLogStreamObs.subscribe((logEvent) => { - events.push(_.cloneDeep(logEvent)); - }); - iosLogs.ipadmin.split('\n').forEach((line) => subj.next(line)); - const meta = { - aircraft: { - firmware: '01.05.0600', - model: 'Phantom 4 Pro', - name: '123', - }, - appVersion: '0.0.0', - battery: { - cells: 4, - chargeVolume: 5842, - discharges: 28, - firmware: '02.00.07.31', - remainingLifePercent: 0, - serialNumber: 'N/A', - }, - camera: { - serialNumber: 'N/A', - }, - device: { - model: 'iPad', - os: 'iOS 11.2.6', - platform: 'N/A', - }, - flightController: { - firmware: '03.02.44.07', - serialNumber: '12345678', - }, - gimbal: { - firmware: '01.50.13.17', - }, - remoteController: { - firmware: '01.04.01.00', - serialNumber: '12345678', - }, - session: { - elapsed: 233.217, - end: new Date('2018-05-23T20:54:12.000Z'), - id: '12345678', - start: new Date('2018-05-23T20:50:18.000Z'), - }, - user: { - userId: 'N/A', - organizationId: 'N/A', - }, - }; - return parseLogStreamObs.toPromise().then(() => { - expect(events.length).toBe(9); - expect(events[0]).toEqual({ - meta: _.merge(_.cloneDeep(meta), { - session: { - elapsed: 0, - end: null, - }, - }), - rowIndex: 27, - }); - expect(events[events.length - 2]).toEqual({ - info: undefined, - meta: _.merge(_.cloneDeep(meta), { - session: { - elapsed: 233.121, - end: new Date('2018-05-23T20:54:11.000Z'), - }, - }), - row: { - 'Aircraft Barometric Altitude (ft)': 2.952756, - 'Aircraft Battery Cell 1 Voltage': 4001, - 'Aircraft Battery Cell 2 Voltage': 3999, - 'Aircraft Battery Cell 3 Voltage': 4002, - 'Aircraft Battery Cell 4 Voltage': 3981, - 'Aircraft Battery Cell Voltage Last Updated (ms)': '0', - 'Aircraft Battery Charge (mAh)': 4907, - 'Aircraft Battery Current (mA)': -11762, - 'Aircraft Battery Last Updated (ms)': '323', - 'Aircraft Battery Power (%)': 84, - 'Aircraft Battery Temperature (Fahrenheit)': 94, - 'Aircraft Battery Voltage (mV)': 15931, - 'Aircraft Camera Burst Capture': false, - 'Aircraft Camera Changeable Lens Supported': false, - 'Aircraft Camera Interval Capture': false, - 'Aircraft Camera Lens AF Assistant': false, - 'Aircraft Camera Lens AF Enabled': false, - 'Aircraft Camera Lens Assistant Working': false, - 'Aircraft Camera Lens Focus Mode': 'Manual', - 'Aircraft Camera Lens Focus Mode Value': 0, - 'Aircraft Camera Lens Focus Status': 'Idle', - 'Aircraft Camera Lens Focus Status Value': 0, - 'Aircraft Camera Lens Installed': false, - 'Aircraft Camera Lens MF Assistant': false, - 'Aircraft Camera Lens State Last Updated (ms)': 'No Data', - 'Aircraft Camera Lens Type': 'Unknown', - 'Aircraft Camera Mode': 'Shoot Photo', - 'Aircraft Camera Mode Value': 0, - 'Aircraft Camera Overheated': false, - 'Aircraft Camera Raw Capture': false, - 'Aircraft Camera Recording': false, - 'Aircraft Camera SD Card Exists': true, - 'Aircraft Camera SD Card Remaining (%)': 59.53524, - 'Aircraft Camera SD Card State Last Updated (ms)': '25', - 'Aircraft Camera Sensor Error': false, - 'Aircraft Camera Single Capture': false, - 'Aircraft Camera State Last Updated (ms)': '25', - 'Aircraft Camera Storing Photo': false, - 'Aircraft Flight Mode': 'Landing', - 'Aircraft Flight Mode Value': 12, - 'Aircraft Flying': true, - 'Aircraft GPS Signal': 'Very Good', - 'Aircraft GPS Signal Value': 4, - 'Aircraft Heading (Degrees)': 48.3, - 'Aircraft IMU Preheating': false, - 'Aircraft Latitude (Degrees)': 37.77181958553695, - 'Aircraft Longitude (Degrees)': -122.4074142850207, - 'Aircraft Motors On': true, - 'Aircraft No-fly': 'Fly Zone Airport', - 'Aircraft No-fly Latitude (Degrees)': 0, - 'Aircraft No-fly Longitude (Degrees)': 0, - 'Aircraft No-fly Radius (ft)': 0, - 'Aircraft No-fly Value': 0, - 'Aircraft Pitch (Degrees)': -0.5, - 'Aircraft Roll (Degrees)': 0.4, - 'Aircraft Satellites': 15, - 'Aircraft Smart Go-home Countdown (sec)': 0, - 'Aircraft Smart Go-home Flight Return Time (sec)': 0, - 'Aircraft Smart Go-home Flight Time Remaining (sec)': 1497, - 'Aircraft Smart Go-home Landing Power (%)': 10, - 'Aircraft Smart Go-home Landing Time (sec)': 0, - 'Aircraft Smart Go-home Radius (ft)': 19154, - 'Aircraft Smart Go-home Requesting': false, - 'Aircraft Smart Go-home Return Power (%)': 15, - 'Aircraft Speed (mph)': 0, - 'Aircraft System State Last Updated (ms)': '27', - 'Aircraft Ultrasonic Altitude (ft)': 0.328084, - 'Aircraft Ultrasonic On': true, - 'Aircraft Vel - X (mph)': 0, - 'Aircraft Vel - Y (mph)': 0, - 'Aircraft Vel - Z (mph)': 0, - 'Aircraft Vision On': false, - 'Date/Time (UTC)': new Date('2018-05-23T20:54:11.000Z'), - 'Device > Aircraft Distance - XY (ft)': 19.92750419698512, - 'Device Latitude (Degrees)': '37.77179522443355', - 'Device Location Last Updated (ms)': '233114', - 'Device Longitude (Degrees)': '-122.4074760173656', - 'Elapsed Time (sec)': 233.121, - 'Gimbal Mode': 'Yaw Follow', - 'Gimbal Mode Value': 2, - 'Gimbal Pitch (Degrees)': 0, - 'Gimbal Pitch at Stop': 0, - 'Gimbal Roll (Degrees)': 0, - 'Gimbal Roll at Stop': 0, - 'Gimbal Status Last Updated (ms)': '26', - 'Gimbal Yaw (Degrees)': 47.79999923706055, - 'Gimbal Yaw at Stop': 0, - 'Home Latitude (Degrees)': 37.77180618457626, - 'Home Longitude (Degrees)': -122.4074297098351, - 'Info': '', - 'LB Signal 1': 'N/A', - 'LB Signal 2': 'N/A', - 'LB Signal Last Updated (ms)': 'No Data', - 'Landing Gear Last Updated (ms)': 'No Data', - 'Landing Gear Mode': 'Unknown', - 'Landing Gear Mode Value': 3, - 'Landing Gear Status': 'Unknown', - 'Landing Gear Status Value': 0, - 'Landing Gear is Movable': false, - 'RC Battery (%)': 88, - 'RC Battery State Last Updated (ms)': '125', - 'RC Custom 1': false, - 'RC Custom 2': false, - 'RC GPS State Last Updated (ms)': 'No Data', - 'RC GSP Data is Valid': false, - 'RC Go Home': false, - 'RC Horizontal Accuaracy (ft)': 0, - 'RC Landing Gear': 'No Present', - 'RC Landing Gear Value': 0, - 'RC Latitude (Degrees)': 0, - 'RC Left Horizontal': true, - 'RC Left Vertical': true, - 'RC Left Wheel': '0', - 'RC Longitude (Degrees)': 0, - 'RC Pause': false, - 'RC Playback': false, - 'RC Record': '0', - 'RC Right Horizontal': true, - 'RC Right Vertical': true, - 'RC Right Wheel': '0', - 'RC Sattelites': false, - 'RC Shutter': false, - 'RC Signal 1': 'N/A', - 'RC Signal 2': 'N/A', - 'RC Signal Last Updated (ms)': 'No Data', - 'RC State': '3', - 'RC State Last Updated (ms)': '26', - 'RC State Value': 2, - }, - rowIndex: 33, - }); - expect(events[events.length - 1]).toEqual({ - meta, - rowIndex: 34, - }); - }); - }); - describe('error log', () => { - let sampleErrLog; - let events; - beforeAll(() => __awaiter(void 0, void 0, void 0, function* () { - const subj = new parser_1.QuasiSubject(); - const parseLogStreamObs = (0, parser_1.parseLogStream)(subj); - events = []; - parseLogStreamObs.subscribe((logEvent) => { - events.push(_.cloneDeep(logEvent)); - }); - iosLogs.errorLog.split('\n').forEach((line) => subj.next(line)); - })); - describe('sampleErrLog detail test', () => { - it('parsed log should have correct falsy value when session info has no value', () => { - const { id, start, end, elapsed } = events[events.length - 1].meta.session; - expect(id).toEqual('N/A'); - expect(start).toBeNull(); - }); - it('parsed log should have correct falsy value when aircraft info has no value', () => { - const { model, name, firmware } = events[events.length - 1].meta.aircraft; - expect(model).toEqual('N/A'); - expect(name).toEqual('N/A'); - expect(firmware).toEqual('N/A'); - }); - it('parsed log should have correct falsy value when battery info has no value', () => { - const { chargeVolume, remainingLifePercent, discharges, cells, firmware, serialNumber, } = events[events.length - 1].meta.battery; - expect(serialNumber).toEqual('N/A'); - expect(chargeVolume).toEqual(0); - expect(remainingLifePercent).toEqual(0); - expect(discharges).toEqual(0); - expect(cells).toEqual(0); - expect(firmware).toEqual('N/A'); - }); - it('parsed log should have correct falsy value when gimbal info has no value', () => { - const { firmware } = events[events.length - 1].meta.gimbal; - expect(firmware).toEqual('N/A'); - }); - it('parsed log should have correct falsy value when flightController info has no value', () => { - const { serialNumber, firmware } = events[events.length - 1].meta.flightController; - expect(serialNumber).toEqual('N/A'); - expect(firmware).toEqual('N/A'); - }); - it('parsed log should have correct falsy value when remoteController info has no value', () => { - const { serialNumber, firmware } = events[events.length - 1].meta.remoteController; - expect(serialNumber).toEqual('N/A'); - expect(firmware).toEqual('N/A'); - }); - it('parsed log should have correct falsy value when camera info has no value', () => { - const { serialNumber } = events[events.length - 1].meta.camera; - expect(serialNumber).toEqual('N/A'); - }); - }); - }); - }); -}); -//# sourceMappingURL=parser.test.js.map \ No newline at end of file diff --git a/dist/lib/__test__/parser.test.js.map b/dist/lib/__test__/parser.test.js.map deleted file mode 100644 index 8e8542b..0000000 --- a/dist/lib/__test__/parser.test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parser.test.js","sourceRoot":"","sources":["../../../src/__test__/parser.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,gBAAc;AACd,sCAAyE;AACzE,yCAAwC;AAIxC,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAG5B,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IAEtB,IAAI,OAAY,CAAC;IACjB,SAAS,CAAC,GAAS,EAAE;QACnB,OAAO,GAAG,MAAM,IAAA,qBAAU,GAAE,CAAC;IAC/B,CAAC,CAAA,CAAC,CAAC;IAEH,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;QAC9B,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;YACpD,MAAM,WAAW,GAAG,0BAA0B,CAAC;YAC/C,MAAM,CAAE,IAAA,uBAAc,EAAC,WAAW,CAAU,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;YAC7F,MAAM,OAAO,GAAG,0BAA0B,CAAC;YAC3C,MAAM,CAAE,IAAA,uBAAc,EAAC,OAAO,CAAU,CAAC,WAAW,EAAE,CAAC,CAAC,IAA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C,CAAC;gBACtC,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/lib/__test__/testutil.js b/dist/lib/__test__/testutil.js deleted file mode 100644 index 2a6227c..0000000 --- a/dist/lib/__test__/testutil.js +++ /dev/null @@ -1,32 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getIosLogs = void 0; -const path = require('path'); -const readFileAsync = require('fs').promises.readFile; -// Maybe we can read all files from one folder? -const ipadFilePath = path.join(__dirname, '/../../testlog/ipad-ios11-phantom4.log'); -const ipadMinimalFilePath = path.join(__dirname, '/../../testlog/ipad-ios11-phantom4-minimal.log'); -const iphoneFilePath = path.join(__dirname, '/../../testlog/iphone-ios11-inspire.log'); -const errorLogFilePath = path.join(__dirname, '/../../testlog/errorLog.log'); -function getIosLogs() { - return __awaiter(this, void 0, void 0, function* () { - const iosLogs = { - ipad: yield readFileAsync(ipadFilePath, { encoding: 'utf8' }), - ipadmin: yield readFileAsync(ipadMinimalFilePath, { encoding: 'utf8' }), - iphone: yield readFileAsync(iphoneFilePath, { encoding: 'utf8' }), - errorLog: yield readFileAsync(errorLogFilePath, { encoding: 'utf8' }), - }; - return iosLogs; - }); -} -exports.getIosLogs = getIosLogs; -//# sourceMappingURL=testutil.js.map \ No newline at end of file diff --git a/dist/lib/__test__/testutil.js.map b/dist/lib/__test__/testutil.js.map deleted file mode 100644 index a811d26..0000000 --- a/dist/lib/__test__/testutil.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"testutil.js","sourceRoot":"","sources":["../../../src/__test__/testutil.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;AACtD,+CAA+C;AAE/C,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,wCAAwC,CAAC,CAAC;AACpF,MAAM,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,gDAAgD,CAAC,CAAC;AACnG,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,yCAAyC,CAAC,CAAC;AACvF,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,6BAA6B,CAAC,CAAC;AAE7E,SAAsB,UAAU;;QAC5B,MAAM,OAAO,GAAG;YACZ,IAAI,EAAE,MAAM,aAAa,CAAC,YAAY,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;YAC7D,OAAO,EAAE,MAAM,aAAa,CAAC,mBAAmB,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;YACvE,MAAM,EAAE,MAAM,aAAa,CAAC,cAAc,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;YACjE,QAAQ,EAAE,MAAM,aAAa,CAAC,gBAAgB,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;SACxE,CAAC;QACF,OAAO,OAAO,CAAC;IACnB,CAAC;CAAA;AARD,gCAQC"} \ No newline at end of file diff --git a/dist/lib/field-types.js b/dist/lib/field-types.js deleted file mode 100644 index 24051b3..0000000 --- a/dist/lib/field-types.js +++ /dev/null @@ -1,111 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DATE_FIELDS = exports.BOOL_FIELDS = exports.FLOAT_FIELDS = exports.INT_FIELDS = void 0; -const types_1 = require("./types"); -exports.INT_FIELDS = new Set([ - types_1.FlightLogHeader.AircraftBatteryCell1Voltage, - types_1.FlightLogHeader.AircraftBatteryCell2Voltage, - types_1.FlightLogHeader.AircraftBatteryCell3Voltage, - types_1.FlightLogHeader.AircraftBatteryCell4Voltage, - types_1.FlightLogHeader.AircraftBatteryCharge, - types_1.FlightLogHeader.AircraftBatteryCurrent, - types_1.FlightLogHeader.AircraftBatteryTemperature, - types_1.FlightLogHeader.AircraftBatteryVoltage, - types_1.FlightLogHeader.AircraftCameraLensFocusModeValue, - types_1.FlightLogHeader.AircraftCameraLensFocusStatusValue, - types_1.FlightLogHeader.AircraftCameraModeValue, - types_1.FlightLogHeader.AircraftFlightModeValue, - types_1.FlightLogHeader.AircraftGPSSignalValue, - types_1.FlightLogHeader.AircraftNoFlyValue, - types_1.FlightLogHeader.AircraftSatellites, - types_1.FlightLogHeader.GimbalModeValue, - types_1.FlightLogHeader.AircraftSmartGoHomeRadius, - types_1.FlightLogHeader.AircraftSmartGoHomeCountdown, - types_1.FlightLogHeader.AircraftVelocityX, - types_1.FlightLogHeader.AircraftVelocityY, - types_1.FlightLogHeader.AircraftVelocityZ, - types_1.FlightLogHeader.RCHorizontalAccuaracy, - types_1.FlightLogHeader.RCLatitude, - types_1.FlightLogHeader.RCLongitude, - types_1.FlightLogHeader.LandingGearStatusValue, - types_1.FlightLogHeader.LandingGearModeValue, - types_1.FlightLogHeader.RCStateValue, - types_1.FlightLogHeader.RCLandingGearValue, -]); -exports.FLOAT_FIELDS = new Set([ - types_1.FlightLogHeader.AircraftBarometricAltitude, - types_1.FlightLogHeader.AircraftBatteryPowerPercent, - types_1.FlightLogHeader.AircraftCameraSDCardRemainingPercent, - types_1.FlightLogHeader.AircraftHeading, - types_1.FlightLogHeader.AircraftLatitude, - types_1.FlightLogHeader.AircraftLongitude, - types_1.FlightLogHeader.AircraftNoFlyLatitude, - types_1.FlightLogHeader.AircraftNoFlyLongitude, - types_1.FlightLogHeader.AircraftNoFlyRadius, - types_1.FlightLogHeader.AircraftPitch, - types_1.FlightLogHeader.AircraftRoll, - types_1.FlightLogHeader.AircraftSmartGoHomeFlightReturnTime, - types_1.FlightLogHeader.AircraftSmartGoHomeFlightTimeRemaining, - types_1.FlightLogHeader.AircraftSmartGoHomeLandingPower, - types_1.FlightLogHeader.AircraftSmartGoHomeLandingTime, - types_1.FlightLogHeader.AircraftSmartGoHomeReturnPower, - types_1.FlightLogHeader.AircraftSpeed, - types_1.FlightLogHeader.AircraftUltrasonicAltitude, - types_1.FlightLogHeader.DeviceToAircraftDistance, - types_1.FlightLogHeader.ElapsedTime, - types_1.FlightLogHeader.GimbalPitch, - types_1.FlightLogHeader.GimbalPitchAtStop, - types_1.FlightLogHeader.GimbalRoll, - types_1.FlightLogHeader.GimbalRollAtStop, - types_1.FlightLogHeader.GimbalYaw, - types_1.FlightLogHeader.GimbalYawAtStop, - types_1.FlightLogHeader.HomeLatitude, - types_1.FlightLogHeader.HomeLongitude, - types_1.FlightLogHeader.RCBatteryPercentRemaining, - types_1.FlightLogHeader.RCLeftHorizontal, - types_1.FlightLogHeader.RCRightHorizontal, - types_1.FlightLogHeader.RCLeftVertical, - types_1.FlightLogHeader.RCRightVertical, -]); -exports.BOOL_FIELDS = new Set([ - types_1.FlightLogHeader.AircraftCameraBurstCapture, - types_1.FlightLogHeader.AircraftCameraIntervalCapture, - types_1.FlightLogHeader.AircraftCameraLensAFAssistant, - types_1.FlightLogHeader.AircraftCameraLensAFEnabled, - types_1.FlightLogHeader.AircraftCameraLensAssistantWorking, - types_1.FlightLogHeader.AircraftCameraOverheated, - types_1.FlightLogHeader.AircraftCameraRawCapture, - types_1.FlightLogHeader.AircraftCameraBurstCapture, - types_1.FlightLogHeader.AircraftCameraRecording, - types_1.FlightLogHeader.AircraftCameraSDCardExists, - types_1.FlightLogHeader.AircraftCameraSensorError, - types_1.FlightLogHeader.AircraftCameraSingleCapture, - types_1.FlightLogHeader.AircraftCameraStoringPhoto, - types_1.FlightLogHeader.AircraftFlying, - types_1.FlightLogHeader.AircraftIMUPreheating, - types_1.FlightLogHeader.AircraftMotorsOn, - types_1.FlightLogHeader.AircraftSmartGoHomeRequesting, - types_1.FlightLogHeader.AircraftUltrasonicOn, - types_1.FlightLogHeader.AircraftVisionOn, - types_1.FlightLogHeader.LandingGearIsMovable, - types_1.FlightLogHeader.RCGoHome, - types_1.FlightLogHeader.RCRecord, - types_1.FlightLogHeader.RCShutter, - types_1.FlightLogHeader.RCPlayback, - types_1.FlightLogHeader.RCPause, - types_1.FlightLogHeader.RCCustom1, - types_1.FlightLogHeader.RCCustom2, - types_1.FlightLogHeader.RCSattelites, - types_1.FlightLogHeader.RCGSPDataIsValid, - types_1.FlightLogHeader.RCLeftHorizontal, - types_1.FlightLogHeader.RCRightHorizontal, - types_1.FlightLogHeader.RCLeftVertical, - types_1.FlightLogHeader.RCRightVertical, - types_1.FlightLogHeader.AircraftCameraChangeableLensSupported, - types_1.FlightLogHeader.AircraftCameraLensInstalled, - types_1.FlightLogHeader.AircraftCameraLensMFAssistant, -]); -exports.DATE_FIELDS = new Set([ - types_1.FlightLogHeader.DateTime, -]); -//# sourceMappingURL=field-types.js.map \ No newline at end of file diff --git a/dist/lib/field-types.js.map b/dist/lib/field-types.js.map deleted file mode 100644 index 6348c39..0000000 --- a/dist/lib/field-types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"field-types.js","sourceRoot":"","sources":["../../src/field-types.ts"],"names":[],"mappings":";;;AAAA,mCAA0C;AAE7B,QAAA,UAAU,GAAG,IAAI,GAAG,CAAC;IAChC,uBAAe,CAAC,2BAA2B;IAC3C,uBAAe,CAAC,2BAA2B;IAC3C,uBAAe,CAAC,2BAA2B;IAC3C,uBAAe,CAAC,2BAA2B;IAC3C,uBAAe,CAAC,qBAAqB;IACrC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AAC,gBAAgB;IAChC,uBAAe,CAAC,iBAAiB;IACjC,uBAAe,CAAC,cAAc;IAC9B,uBAAe,CAAC,eAAe;IAC/B,uBAAe,CAAC,qCAAqC;IACrD,uBAAe,CAAC,2BAA2B;IAC3C,uBAAe,CAAC,6BAA6B;CAC9C,CAAC,CAAC;AAEU,QAAA,WAAW,GAAG,IAAI,GAAG,CAAC;IAC/B,uBAAe,CAAC,QAAQ;CAC3B,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/lib/flight-log-parser.js b/dist/lib/flight-log-parser.js deleted file mode 100644 index 1a59eb4..0000000 --- a/dist/lib/flight-log-parser.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.fromUtcDateStr = exports.QuasiSubject = exports.parseLogStream = exports.parseLog = exports.FLIGHT_MODE_MAPPING_V5 = exports.FLIGHT_MODE_MAPPING_V4 = exports.FlightLogHeader = void 0; -var types_1 = require("./types"); -Object.defineProperty(exports, "FlightLogHeader", { enumerable: true, get: function () { return types_1.FlightLogHeader; } }); -Object.defineProperty(exports, "FLIGHT_MODE_MAPPING_V4", { enumerable: true, get: function () { return types_1.FLIGHT_MODE_MAPPING_V4; } }); -Object.defineProperty(exports, "FLIGHT_MODE_MAPPING_V5", { enumerable: true, get: function () { return types_1.FLIGHT_MODE_MAPPING_V5; } }); -var parser_1 = require("./parser"); -Object.defineProperty(exports, "parseLog", { enumerable: true, get: function () { return parser_1.parseLog; } }); -Object.defineProperty(exports, "parseLogStream", { enumerable: true, get: function () { return parser_1.parseLogStream; } }); -Object.defineProperty(exports, "QuasiSubject", { enumerable: true, get: function () { return parser_1.QuasiSubject; } }); -Object.defineProperty(exports, "fromUtcDateStr", { enumerable: true, get: function () { return parser_1.fromUtcDateStr; } }); -//# sourceMappingURL=flight-log-parser.js.map \ No newline at end of file diff --git a/dist/lib/flight-log-parser.js.map b/dist/lib/flight-log-parser.js.map deleted file mode 100644 index 4a53e20..0000000 --- a/dist/lib/flight-log-parser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"flight-log-parser.js","sourceRoot":"","sources":["../../src/flight-log-parser.ts"],"names":[],"mappings":";;;AAAA,iCAQiB;AALf,wGAAA,eAAe,OAAA;AAGf,+GAAA,sBAAsB,OAAA;AACtB,+GAAA,sBAAsB,OAAA;AAExB,mCAAmG;AAA1F,kGAAA,QAAQ,OAAA;AAAE,wGAAA,cAAc,OAAA;AAAE,sGAAA,YAAY,OAAA;AAAmB,wGAAA,cAAc,OAAA"} \ No newline at end of file diff --git a/dist/lib/parser.js b/dist/lib/parser.js deleted file mode 100644 index 524a7c1..0000000 --- a/dist/lib/parser.js +++ /dev/null @@ -1,346 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.fromUtcDateStr = exports.parseLog = exports.parseLogStream = exports.QuasiSubject = void 0; -const csv_parse_1 = require("csv-parse"); -const types_1 = require("./types"); -const field_types_1 = require("./field-types"); -const syncParse = require('csv-parse/lib/sync'); -const META_REGEX = { - appVersion: /^#DroneDeploy\s+(.+)$/, - sessionId: /^Session ID\s+(.+)$/, - sessionStart: /^Session Start\s+(.+)$/, - sessionEnd: /^Date\/Time \(UTC\)\s+(.+)$/, - deviceModel: /^Device Model\s+(.+)$/, - deviceOS: /^Device Operating System\s+(.+)$/, - aircraftModel: /^Aircraft Model\s+(.+)$/, - aircraftName: /^Aircraft Name\s+(.+)$/, - aircraftFirmware: /^Aircraft Firmware\s+(.+)$/, - batteryChargeVolume: /^Full Charge Volume \(mAh\)\s+(.+)$/, - batteryRemainingLife: /^Remaining Life \(%\)\s+(.+)$/, - batteryDischarges: /^Discharges\s+(.+)$/, - batteryCells: /^Battery Cells Number\s+(.+)$/, - batterySerialNumber: /^Battery Serial Number\s+(.+)$/, - batteryFirmware: /^Battery Firmware\s+(.+)$/, - fcSerialNumber: /^Flight Controller Serial Number\s+(.+)$/, - fcFirmware: /^Flight Controller Firmware\s+(.+)$/, - footerLines: /^#Flight Recorder Session End|^Date\/Time \(UTC\)|^Elapsed Time \(sec\)/, - gimbalFirmware: /^Gimbal Firmware\s+(.+)$/, - rcSerialNumber: /^Remote Control Serial Number\s+(.+)$/, - rcFirmware: /^Remote Control Firmware\s+(.+)$/, - cameraSerialNumber: /^Camera Serial Number\s+(.+)$/, - elapsedTime: /^Elapsed Time \(sec\)\s+(.+)$/, - userId: /^User ID\s+(.+)$/, - organizationId: /^Organization ID\s+(.+)$/, - platform: /^Platform\s+(.+)$/, -}; -class QuasiSubject { - constructor() { - this.subscribers = []; - this.errorSubscribers = []; - this.completionSubscribers = []; - this.isFinished = false; - } - next(value) { - if (this.isFinished) { - return; - } - this.subscribers.forEach((s) => s(value)); - } - complete() { - if (this.isFinished) { - return; - } - this.isFinished = true; - this.completionSubscribers.forEach((sub) => sub()); - } - error(error) { - if (this.isFinished) { - return; - } - this.errorSubscribers.forEach((errSub) => errSub(error)); - this.complete(); - } - subscribe(sub, errSub, completionSub) { - this.subscribers.push(sub); - if (errSub) { - this.errorSubscribers.push(errSub); - } - if (completionSub) { - this.completionSubscribers.push(completionSub); - } - } - toPromise() { - const source = this; - return new Promise(function (resolve, reject) { - let value; - source.subscribe(function (v) { - value = v; - }, reject, function () { - resolve(value); - }); - }); - } -} -exports.QuasiSubject = QuasiSubject; -function parseLogStream(logStream) { - const headerMetaLines = []; - let meta = {}; - let rowHeaderLine; - let row; - const progress = { index: 0, completed: false }; - let end; - const result = new QuasiSubject(); - logStream.subscribe((line) => { - line = line.trim(); - if (!line.length) { - return; - } - if (!rowHeaderLine) { - if (line.startsWith(types_1.FlightLogHeader.DateTime.split(' ')[0])) { // Strip off timezone. - rowHeaderLine = line; - meta = parseMetaData(headerMetaLines, []); - result.next({ - meta, - rowIndex: progress.index - }); - } - else { - headerMetaLines.push(line); - progress.index++; - } - return; - } - if (META_REGEX.footerLines.test(line)) { - if (META_REGEX.sessionEnd.test(line)) { - end = fromUtcDateStr(findMatch([line], META_REGEX.sessionEnd)); - } - else if (META_REGEX.elapsedTime.test(line)) { - const elapsed = findMatch([line], META_REGEX.elapsedTime); - // This is the end of the parsing. Because normal lines are parsed through a Promise, they will be delivered - // asynchronously. So we must ensure that this result is also delivered asynchronously. - setTimeout(() => { - const parsedElapsed = elapsed === 'N/A' ? 0 : parseFloat(elapsed); - if (parsedElapsed) { - meta.session.elapsed = parsedElapsed; - } - if (end) { - meta.session.end = end; - } - result.next({ - meta, - rowIndex: progress.index++, - }); - result.complete(); - progress.completed = true; - }, 0); - } - } - else { - parseBody([rowHeaderLine, line], true).then((rows) => { - row = rows[0]; - meta.session.end = row[types_1.FlightLogHeader.DateTime]; - meta.session.elapsed = row[types_1.FlightLogHeader.ElapsedTime]; - result.next({ - meta, - rowIndex: progress.index++, - row, - info: parseJsonInfo(row.Info), // Parsed Info column, if the column was populated with a JSON array. - }); - }); - } - }, (err) => { console.error('parsing error: ' + err); result.complete(); }, () => { - if (!progress.completed) { - setTimeout(() => { - result.complete(); - progress.completed = true; - }, 0); - } - }); - return result; -} -exports.parseLogStream = parseLogStream; -function parseLog(log) { - const lines = log.split('\n'); - const subject = new QuasiSubject(); - const parse = parseLogStream(subject); - const flightLog = { - metaData: {}, - rows: [], - infos: [] - }; - parse.subscribe((event) => { - // The metadata is updated as the file is parsed, so always grab the latest one. - flightLog.metaData = (event.meta) ? event.meta : flightLog.metaData; - if (event.row) { - flightLog.rows.push(event.row); - } - if (event.info) { - // @ts-ignore - flightLog.infos.push(event.info); - } - }); - lines.forEach(l => subject.next(l)); - subject.complete(); - return new Promise((resolve, reject) => { - parse.toPromise().then(() => resolve(flightLog)).catch((reason => reject(reason))); - }); -} -exports.parseLog = parseLog; -function parseBody(lines, sync) { - const text = lines.join('\n'); - const options = { - delimiter: '\t', - escape: null, - from: 1, - quote: null, - relax_column_count: true, - }; - return new Promise((resolve, reject) => { - const onResults = (err, result) => { - if (err) { - return reject(err); - } - const [headers, ...rows] = result; - const logs = rows.map((row) => { - const log = {}; - for (let i = 0; i < headers.length; i++) { - const header = headers[i].trim(); - let value = row[i]; - if (field_types_1.INT_FIELDS.has(header)) { - value = parseInt(value, 10); - } - if (field_types_1.FLOAT_FIELDS.has(header)) { - value = parseFloat(value); - } - if (field_types_1.BOOL_FIELDS.has(header)) { - value = value !== '0'; - } - if (field_types_1.DATE_FIELDS.has(header)) { - value = fromUtcDateStr(value); - } - log[header] = value; - } - return log; - }); - resolve(logs); - }; - if (sync) { - const results = syncParse(text, options); - onResults(undefined, results); - } - else { - // @ts-ignore - (0, csv_parse_1.default)(text, options, onResults); - } - }); -} -function findMatch(search, regex, isNum) { - let match; - for (let str of search) { - match = str.match(regex); - if (match) { - break; - } - } - if (!match) { - return isNum ? '0' : 'N/A'; - } - return match[1]; -} -function isValidDate(d) { - return d instanceof Date && !isNaN(d); -} -function fromUtcDateStr(utcDateStr) { - if (isValidDate(utcDateStr)) { - return utcDateStr; - } - const isBadDate = !utcDateStr || !utcDateStr.trim().length || utcDateStr === 'N/A'; - if (isBadDate) { - return null; - } - if (!/Z$/.test(utcDateStr)) { - utcDateStr = utcDateStr + '.000Z'; - } - return new Date(utcDateStr); -} -exports.fromUtcDateStr = fromUtcDateStr; -function parseMetaData(headers, footers) { - const meta = [...headers, ...footers]; - let end = findMatch(meta, META_REGEX.sessionEnd); - let elapsed = findMatch(meta, META_REGEX.elapsedTime); - // if we weren't able to parse an end date or an elapsed time from our footer (which is really just the last three - // lines of the log file), it's likely that we have a truncated log file. if that's the case, we can still salvage - // some valid data by parsing the date and elapsed time from the very last log row in the file, which is what we're - // doing below. it's pretty brittle, but it's preferred to having an invalid end date and a NaN elapsed time. - if ((end === 'N/A' || elapsed === 'N/A') && footers.length > 0) { - const lastLine = footers[footers.length - 1]; - const pieces = lastLine.split('\t'); - // if we don't have at least two pieces, i don't know what is in `footer` so i'm just going to leave it alone - if (pieces.length >= 2) { - end = pieces[0]; - elapsed = pieces[1]; - } - } - return { - appVersion: findMatch(meta, META_REGEX.appVersion), - session: { - id: findMatch(meta, META_REGEX.sessionId), - start: fromUtcDateStr(findMatch(meta, META_REGEX.sessionStart)), - end: fromUtcDateStr(end), - elapsed: elapsed === 'N/A' ? 0 : parseFloat(elapsed), - }, - device: { - model: findMatch(meta, META_REGEX.deviceModel), - os: findMatch(meta, META_REGEX.deviceOS).replace(/\t/g, ' '), - platform: findMatch(meta, META_REGEX.platform), - }, - aircraft: { - model: findMatch(meta, META_REGEX.aircraftModel), - name: findMatch(meta, META_REGEX.aircraftName), - firmware: findMatch(meta, META_REGEX.aircraftFirmware), - }, - battery: { - chargeVolume: parseInt(findMatch(meta, META_REGEX.batteryChargeVolume, true), 10), - remainingLifePercent: parseInt(findMatch(meta, META_REGEX.batteryRemainingLife, true), 10), - discharges: parseInt(findMatch(meta, META_REGEX.batteryDischarges, true), 10), - cells: parseInt(findMatch(meta, META_REGEX.batteryCells, true), 10), - firmware: findMatch(meta, META_REGEX.batteryFirmware), - serialNumber: findMatch(meta, META_REGEX.batterySerialNumber), - }, - flightController: { - serialNumber: findMatch(meta, META_REGEX.fcSerialNumber), - firmware: findMatch(meta, META_REGEX.fcFirmware), - }, - gimbal: { - firmware: findMatch(meta, META_REGEX.gimbalFirmware), - }, - remoteController: { - serialNumber: findMatch(meta, META_REGEX.rcSerialNumber), - firmware: findMatch(meta, META_REGEX.rcFirmware), - }, - camera: { - serialNumber: findMatch(meta, META_REGEX.cameraSerialNumber), - }, - user: { - userId: findMatch(meta, META_REGEX.userId), - organizationId: findMatch(meta, META_REGEX.organizationId), - }, - }; -} -/** - * Parse out the given string and return an object if the string is JSON, return undefined otherwise. - * - * @param info - */ -function parseJsonInfo(info) { - if (!info) { - return undefined; - } - try { - return JSON.parse(info); - } - catch (e) { - return undefined; - } -} -//# sourceMappingURL=parser.js.map \ No newline at end of file diff --git a/dist/lib/parser.js.map b/dist/lib/parser.js.map deleted file mode 100644 index 100e4e4..0000000 --- a/dist/lib/parser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parser.js","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,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;KACzB;IACD,OAAO,CAAC,EAAE;QACR,OAAO,SAAS,CAAC;KAClB;AACH,CAAC"} \ No newline at end of file diff --git a/dist/lib/rollup.config.js b/dist/lib/rollup.config.js deleted file mode 100644 index 8920338..0000000 --- a/dist/lib/rollup.config.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const rollup_plugin_node_resolve_1 = require("rollup-plugin-node-resolve"); -const rollup_plugin_commonjs_1 = require("rollup-plugin-commonjs"); -const rollup_plugin_sourcemaps_1 = require("rollup-plugin-sourcemaps"); -const lodash_camelcase_1 = require("lodash.camelcase"); -const rollup_plugin_typescript2_1 = require("rollup-plugin-typescript2"); -const rollup_plugin_json_1 = require("rollup-plugin-json"); -const pkg = require('./package.json'); -const libraryName = 'flight-log-parser'; -exports.default = { - input: `src/${libraryName}.ts`, - output: [ - { file: pkg.main, name: (0, lodash_camelcase_1.default)(libraryName), format: 'umd', sourcemap: true }, - { file: pkg.module, format: 'es', sourcemap: true }, - ], - // Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash') - external: [], - watch: { - include: 'src/**', - }, - plugins: [ - // Allow json resolution - (0, rollup_plugin_json_1.default)(), - // Compile TypeScript files - (0, rollup_plugin_typescript2_1.default)({ useTsconfigDeclarationDir: true }), - // Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs) - (0, rollup_plugin_commonjs_1.default)(), - // Allow node_modules resolution, so you can use 'external' to control - // which external modules to include in the bundle - // https://github.com/rollup/rollup-plugin-node-resolve#usage - (0, rollup_plugin_node_resolve_1.default)(), - // Resolve source maps to the original source - (0, rollup_plugin_sourcemaps_1.default)(), - ], -}; -//# sourceMappingURL=rollup.config.js.map \ No newline at end of file diff --git a/dist/lib/rollup.config.js.map b/dist/lib/rollup.config.js.map deleted file mode 100644 index 59c32a7..0000000 --- a/dist/lib/rollup.config.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rollup.config.js","sourceRoot":"","sources":["../../rollup.config.ts"],"names":[],"mappings":";;AAAA,2EAAgD;AAChD,mEAA6C;AAC7C,uEAAiD;AACjD,uDAAwC;AACxC,yEAAkD;AAClD,2DAAqC;AAErC,MAAM,GAAG,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;AAErC,MAAM,WAAW,GAAG,mBAAmB,CAAA;AAEvC,kBAAe;IACb,KAAK,EAAE,OAAO,WAAW,KAAK;IAC9B,MAAM,EAAE;QACN,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAA,0BAAS,EAAC,WAAW,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE;QAChF,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE;KACpD;IACD,yFAAyF;IACzF,QAAQ,EAAE,EAAE;IACZ,KAAK,EAAE;QACL,OAAO,EAAE,QAAQ;KAClB;IACD,OAAO,EAAE;QACP,wBAAwB;QACxB,IAAA,4BAAI,GAAE;QACN,2BAA2B;QAC3B,IAAA,mCAAU,EAAC,EAAE,yBAAyB,EAAE,IAAI,EAAE,CAAC;QAC/C,6EAA6E;QAC7E,IAAA,gCAAQ,GAAE;QACV,sEAAsE;QACtE,kDAAkD;QAClD,6DAA6D;QAC7D,IAAA,oCAAO,GAAE;QAET,6CAA6C;QAC7C,IAAA,kCAAU,GAAE;KACb;CACF,CAAA"} \ No newline at end of file diff --git a/dist/lib/src/__test__/android.test.js b/dist/lib/src/__test__/android.test.js deleted file mode 100644 index 6023ff7..0000000 --- a/dist/lib/src/__test__/android.test.js +++ /dev/null @@ -1,112 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -require("jest"); -const parser_1 = require("../parser"); -const types_1 = require("../types"); -const path = require('path'); -const readFileAsync = require('fs').promises.readFile; -const androidFilePath = path.join(__dirname, '/../../testlog/pixel2-inspire2.log'); -describe('test parse android logs', () => { - let androidLogs; - beforeAll(() => __awaiter(void 0, void 0, void 0, function* () { - androidLogs = { - pixel2: yield readFileAsync(androidFilePath, { encoding: 'utf8' }), - // other: await readFileAsync(otherPath, {encoding: 'utf8'}), - }; - })); - it('fsRead log should exist', () => __awaiter(void 0, void 0, void 0, function* () { - expect(androidLogs).toBeTruthy(); - })); - describe('test pixel2 log', () => { - let pixel2Log; - beforeAll(() => __awaiter(void 0, void 0, void 0, function* () { - pixel2Log = yield (0, parser_1.parseLog)(androidLogs.pixel2); - })); - it('parsed log should exist', () => __awaiter(void 0, void 0, void 0, function* () { - expect(pixel2Log).toBeTruthy(); - })); - it('parsed log should have correct os', () => __awaiter(void 0, void 0, void 0, function* () { - const pixel2LogMetaData = pixel2Log.metaData; - const os = pixel2LogMetaData.device.os; - const re = /(android \d+(\.\d)*)/i; - const result = os.match(re); - expect(result).toBeTruthy(); - })); - describe('pixel2 log rows', () => { - it('has proper key for each row', () => { - const pixel2LogRows = pixel2Log.rows; - const firstRow = pixel2LogRows[0]; - const { AircraftBatteryPowerPercent } = types_1.FlightLogHeader; - expect(firstRow).toHaveProperty(AircraftBatteryPowerPercent); - }); - }); - describe('pixel2-inspire2 log metaData test', () => { - it('parsed log should have correct session info', () => { - const pixel2LogMetaData = pixel2Log.metaData; - const { session } = pixel2LogMetaData; - const { id, start, end, elapsed } = session; - const startDate = (0, parser_1.fromUtcDateStr)('06/04/2018 20:32:30'); - const endDate = (0, parser_1.fromUtcDateStr)('06/04/2018 20:34:55'); - expect(id).toEqual('12345678'); - expect(start).toEqual(startDate); - expect(end).toEqual(endDate); - expect(elapsed).toEqual(145.0); - }); - it('parsed log should have correct aircraft info', () => { - const pixel2LogMetaData = pixel2Log.metaData; - const { aircraft } = pixel2LogMetaData; - const { model, name, firmware } = aircraft; - expect(model).toEqual('Inspire 2'); - expect(name).toEqual('123'); - expect(firmware).toEqual('01.02.0100'); - }); - it('parsed log should have correct battery info', () => { - const pixel2LogMetaData = pixel2Log.metaData; - const { battery } = pixel2LogMetaData; - const { chargeVolume, remainingLifePercent, discharges, cells, firmware, serialNumber, } = battery; - expect(serialNumber).toEqual('12345678'); - expect(chargeVolume).toEqual(4152); - expect(remainingLifePercent).toEqual(98); - expect(discharges).toEqual(27); - expect(cells).toEqual(6); - expect(firmware).toEqual('01.00.00.65'); - }); - it('parsed log should have correct flightController info', () => { - const pixel2LogMetaData = pixel2Log.metaData; - const { flightController } = pixel2LogMetaData; - const { serialNumber, firmware } = flightController; - expect(serialNumber).toEqual('12345678'); - expect(firmware).toEqual('03.02.44.09'); - }); - it('parsed log should have correct gimbal info', () => { - const pixel2LogMetaData = pixel2Log.metaData; - const { gimbal } = pixel2LogMetaData; - const { firmware } = gimbal; - expect(firmware).toEqual('01.01.00.20'); - }); - it('parsed log should have correct remoteController info', () => { - const pixel2LogMetaData = pixel2Log.metaData; - const { remoteController } = pixel2LogMetaData; - const { serialNumber, firmware } = remoteController; - expect(serialNumber).toEqual('12345678'); - expect(firmware).toEqual('01.01.0010'); - }); - it('parsed log should have correct Camera info', () => { - const pixel2LogMetaData = pixel2Log.metaData; - const { camera } = pixel2LogMetaData; - const { serialNumber } = camera; - expect(serialNumber).toEqual('12345678'); - }); - }); - }); -}); -//# sourceMappingURL=android.test.js.map \ No newline at end of file diff --git a/dist/lib/src/__test__/android.test.js.map b/dist/lib/src/__test__/android.test.js.map deleted file mode 100644 index 1edc4d5..0000000 --- a/dist/lib/src/__test__/android.test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"android.test.js","sourceRoot":"","sources":["../../../../src/__test__/android.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,gBAAc;AAEd,sCAAmD;AACnD,oCAA2C;AAE3C,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;AAEtD,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,oCAAoC,CAAC,CAAC;AAEnF,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,IAAI,WAAgB,CAAC;IACrB,SAAS,CAAC,GAAS,EAAE;QACnB,WAAW,GAAG;YACZ,MAAM,EAAE,MAAM,aAAa,CAAC,eAAe,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;YAClE,6DAA6D;SAC9D,CAAC;IACJ,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,yBAAyB,EAAE,GAAS,EAAE;QACvC,MAAM,CAAC,WAAW,CAAC,CAAC,UAAU,EAAE,CAAC;IACnC,CAAC,CAAA,CAAC,CAAC;IAEH,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;QAC/B,IAAI,SAAc,CAAC;QACnB,SAAS,CAAC,GAAS,EAAE;YACnB,SAAS,GAAG,MAAM,IAAA,iBAAQ,EAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QACjD,CAAC,CAAA,CAAC,CAAC;QAEH,EAAE,CAAC,yBAAyB,EAAE,GAAS,EAAE;YACvC,MAAM,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,CAAC;QACjC,CAAC,CAAA,CAAC,CAAC;QAEH,EAAE,CAAC,mCAAmC,EAAE,GAAS,EAAE;YACjD,MAAM,iBAAiB,GAAG,SAAS,CAAC,QAAQ,CAAC;YAC7C,MAAM,EAAE,GAAG,i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AAE,GAAG,MAAM,CAAC;gBAEhC,MAAM,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;YAC3C,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/lib/src/__test__/invalid-logs.test.js b/dist/lib/src/__test__/invalid-logs.test.js deleted file mode 100644 index 55b097b..0000000 --- a/dist/lib/src/__test__/invalid-logs.test.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -require("jest"); -const parser_1 = require("../parser"); -const path = require('path'); -const fs = require('fs'); -const truncatedLog = path.join(__dirname, '/../../testlog/truncated.log'); -describe('test parsing troublesome logs', () => { - describe('truncated log file', () => { - let parsedLog; - beforeEach(() => __awaiter(void 0, void 0, void 0, function* () { - const log = fs.readFileSync(truncatedLog, { encoding: 'utf8' }); - parsedLog = yield (0, parser_1.parseLog)(log); - })); - it('should approximate a valid elapsed time based on the last log row', () => { - const { metaData } = parsedLog; - expect(metaData.session.elapsed).toBe(8.074); - }); - it('should approximate a valid end date based on the last log row', () => { - const { metaData } = parsedLog; - expect(metaData.session.end.toISOString()).toBe('2018-06-04T20:32:38.000Z'); - }); - }); -}); -//# sourceMappingURL=invalid-logs.test.js.map \ No newline at end of file diff --git a/dist/lib/src/__test__/invalid-logs.test.js.map b/dist/lib/src/__test__/invalid-logs.test.js.map deleted file mode 100644 index 38996f1..0000000 --- a/dist/lib/src/__test__/invalid-logs.test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"invalid-logs.test.js","sourceRoot":"","sources":["../../../../src/__test__/invalid-logs.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,gBAAc;AAEd,sCAAqC;AAGrC,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACzB,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,8BAA8B,CAAC,CAAC;AAE1E,QAAQ,CAAC,+BAA+B,EAAE,GAAG,EAAE;IAC7C,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;QAClC,IAAI,SAAoB,CAAC;QAEzB,UAAU,CAAC,GAAS,EAAE;YACpB,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;YAChE,SAAS,GAAG,MAAM,IAAA,iBAAQ,EAAC,GAAG,CAAC,CAAC;QAClC,CAAC,CAAA,CAAC,CAAC;QAEH,EAAE,CAAC,mEAAmE,EAAE,GAAG,EAAE;YAC3E,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAC;YAE/B,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,+DAA+D,EAAE,GAAG,EAAE;YACvE,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAC;YAE/B,MAAM,CAAE,QAAQ,CAAC,OAAO,CAAC,GAAY,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;QACxF,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/lib/src/__test__/ios.test.js b/dist/lib/src/__test__/ios.test.js deleted file mode 100644 index 89e774b..0000000 --- a/dist/lib/src/__test__/ios.test.js +++ /dev/null @@ -1,245 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -require("jest"); -const parser_1 = require("../parser"); -const types_1 = require("../types"); -const testutil_1 = require("./testutil"); -describe('test parse ios logs', () => { - let iosLogs; - beforeAll(() => __awaiter(void 0, void 0, void 0, function* () { - iosLogs = yield (0, testutil_1.getIosLogs)(); - })); - it('fsRead log should exist', () => __awaiter(void 0, void 0, void 0, function* () { - expect(iosLogs).toBeTruthy(); - })); - describe('test sampleErrLog log', () => { - let sampleErrLog; - beforeAll(() => __awaiter(void 0, void 0, void 0, function* () { - sampleErrLog = yield (0, parser_1.parseLog)(iosLogs.errorLog); - })); - describe('sampleErrLog detail test', () => { - it('parsed log should have correct falsy value when session info has no value', () => { - const sampleErrLogMetaData = sampleErrLog.metaData; - const { session } = sampleErrLogMetaData; - const { id, start, end, elapsed } = session; - expect(id).toEqual('N/A'); - expect(start).toBeNull(); - expect(end).toEqual(new Date('2018-06-04T22:31:40.000Z')); - expect(elapsed).toEqual(160.313); - }); - it('parsed log should have correct falsy value when aircraft info has no value', () => { - const sampleErrLogMetaData = sampleErrLog.metaData; - const { aircraft } = sampleErrLogMetaData; - const { model, name, firmware } = aircraft; - expect(model).toEqual('N/A'); - expect(name).toEqual('N/A'); - expect(firmware).toEqual('N/A'); - }); - it('parsed log should have correct falsy value when battery info has no value', () => { - const sampleErrLogMetaData = sampleErrLog.metaData; - const { battery } = sampleErrLogMetaData; - const { chargeVolume, remainingLifePercent, discharges, cells, firmware, serialNumber, } = battery; - expect(serialNumber).toEqual('N/A'); - expect(chargeVolume).toEqual(0); - expect(remainingLifePercent).toEqual(0); - expect(discharges).toEqual(0); - expect(cells).toEqual(0); - expect(firmware).toEqual('N/A'); - }); - it('parsed log should have correct falsy value when gimbal info has no value', () => { - const sampleErrLogMetaData = sampleErrLog.metaData; - const { gimbal } = sampleErrLogMetaData; - const { firmware } = gimbal; - expect(firmware).toEqual('N/A'); - }); - it('parsed log should have correct falsy value when flightController info has no value', () => { - const sampleErrLogMetaData = sampleErrLog.metaData; - const { flightController } = sampleErrLogMetaData; - const { serialNumber, firmware } = flightController; - expect(serialNumber).toEqual('N/A'); - expect(firmware).toEqual('N/A'); - }); - it('parsed log should have correct falsy value when remoteController info has no value', () => { - const sampleErrLogMetaData = sampleErrLog.metaData; - const { remoteController } = sampleErrLogMetaData; - const { serialNumber, firmware } = remoteController; - expect(serialNumber).toEqual('N/A'); - expect(firmware).toEqual('N/A'); - }); - it('parsed log should have correct falsy value when camera info has no value', () => { - const sampleErrLogMetaData = sampleErrLog.metaData; - const { camera } = sampleErrLogMetaData; - const { serialNumber } = camera; - expect(serialNumber).toEqual('N/A'); - }); - }); - }); - describe('test iphone log', () => { - let iphoneLog; - beforeAll(() => __awaiter(void 0, void 0, void 0, function* () { - iphoneLog = yield (0, parser_1.parseLog)(iosLogs.iphone); - })); - it('parsed log should have correct os', () => { - const iphoneLogMetaData = iphoneLog.metaData; - const os = iphoneLogMetaData.device.os; - const re = /(ios \d+(\.\d)*)/i; - const result = os.match(re); - expect(result).toBeTruthy(); - }); - describe('iphone log rows', () => { - it('has proper key for each row', () => { - const iphoneLogRows = iphoneLog.rows; - const firstRow = iphoneLogRows[0]; - const { AircraftBatteryPowerPercent } = types_1.FlightLogHeader; - expect(firstRow).toHaveProperty(AircraftBatteryPowerPercent); - }); - }); - describe('iphone-ios11-inspire metaData detail test', () => { - it('parsed log should have correct session info', () => { - const iphoneLogMetaData = iphoneLog.metaData; - const { session } = iphoneLogMetaData; - const { id, start, end, elapsed } = session; - const startDate = (0, parser_1.fromUtcDateStr)('06/04/2018 22:29:00'); - const endDate = (0, parser_1.fromUtcDateStr)('06/04/2018 22:31:40'); - expect(id).toEqual('12345678'); - expect(start).toEqual(startDate); - expect(end).toEqual(endDate); - expect(elapsed).toEqual(160.408); - }); - it('parsed log should have correct aircraft info', () => { - const iphoneLogMetaData = iphoneLog.metaData; - const { aircraft } = iphoneLogMetaData; - const { model, name, firmware } = aircraft; - expect(model).toEqual('Inspire 1 Pro'); - expect(name).toEqual('123'); - expect(firmware).toEqual('1.11.01.50'); - }); - it('parsed log should have correct battery info', () => { - const iphoneLogMetaData = iphoneLog.metaData; - const { battery } = iphoneLogMetaData; - const { chargeVolume, remainingLifePercent, discharges, cells, firmware, serialNumber, } = battery; - expect(serialNumber).toEqual('12345678'); - expect(chargeVolume).toEqual(4287); - expect(remainingLifePercent).toEqual(83); - expect(discharges).toEqual(69); - expect(cells).toEqual(6); - expect(firmware).toEqual('03.09.00.00'); - }); - it('parsed log should have correct flightController info', () => { - const iphoneLogMetaData = iphoneLog.metaData; - const { flightController } = iphoneLogMetaData; - const { serialNumber, firmware } = flightController; - expect(serialNumber).toEqual('N/A'); - expect(firmware).toEqual('02.04.20.50'); - }); - it('parsed log should have correct gimbal info', () => { - const iphoneLogMetaData = iphoneLog.metaData; - const { gimbal } = iphoneLogMetaData; - const { firmware } = gimbal; - expect(firmware).toEqual('01.31.01.67'); - }); - it('parsed log should have correct remoteController info', () => { - const iphoneLogMetaData = iphoneLog.metaData; - const { remoteController } = iphoneLogMetaData; - const { serialNumber, firmware } = remoteController; - expect(serialNumber).toEqual('12345678'); - expect(firmware).toEqual('1.2.0.17'); - }); - it('parsed log should have correct Camera info', () => { - const iphoneLogMetaData = iphoneLog.metaData; - const { camera } = iphoneLogMetaData; - const { serialNumber } = camera; - expect(serialNumber).toEqual('N/A'); - }); - }); - }); - describe('test ipad log', () => { - let ipadLog; - beforeAll(() => __awaiter(void 0, void 0, void 0, function* () { - ipadLog = yield (0, parser_1.parseLog)(iosLogs.ipad); - })); - it('parsed log should have correct os', () => { - const ipadLogMetaData = ipadLog.metaData; - const os = ipadLogMetaData.device.os; - const re = /(ios \d+(\.\d)*)/i; - const result = os.match(re); - expect(result).toBeTruthy(); - }); - describe('ipadLog rows', () => { - it('has proper key for each row', () => { - const ipadLogRows = ipadLog.rows; - const firstRow = ipadLogRows[0]; - const { AircraftBatteryPowerPercent } = types_1.FlightLogHeader; - expect(firstRow).toHaveProperty(AircraftBatteryPowerPercent); - }); - }); - describe('ipad-ios11-phantom4 metaData test', () => { - it('parsed log should have correct session info', () => { - const ipadLogMetaData = ipadLog.metaData; - const { session } = ipadLogMetaData; - const { id, start, end, elapsed } = session; - const startDate = (0, parser_1.fromUtcDateStr)('05/23/2018 20:50:18'); - const endDate = (0, parser_1.fromUtcDateStr)('05/23/2018 20:54:12'); - expect(id).toEqual('12345678'); - expect(start).toEqual(startDate); - expect(end).toEqual(endDate); - expect(elapsed).toEqual(233.217); - }); - it('parsed log should have correct aircraft info', () => { - const ipadLogMetaData = ipadLog.metaData; - const { aircraft } = ipadLogMetaData; - const { model, name, firmware } = aircraft; - expect(model).toEqual('Phantom 4 Pro'); - expect(name).toEqual('123'); - expect(firmware).toEqual('01.05.0600'); - }); - it('parsed log should have correct battery info', () => { - const ipadLogMetaData = ipadLog.metaData; - const { battery } = ipadLogMetaData; - const { chargeVolume, remainingLifePercent, discharges, cells, firmware, serialNumber, } = battery; - expect(serialNumber).toEqual('N/A'); - expect(chargeVolume).toEqual(5842); - expect(remainingLifePercent).toEqual(0); - expect(discharges).toEqual(28); - expect(cells).toEqual(4); - expect(firmware).toEqual('02.00.07.31'); - }); - it('parsed log should have correct gimbal info', () => { - const ipadLogMetaData = ipadLog.metaData; - const { gimbal } = ipadLogMetaData; - const { firmware } = gimbal; - expect(firmware).toEqual('01.50.13.17'); - }); - it('parsed log should have correct flightController info', () => { - const ipadLogMetaData = ipadLog.metaData; - const { flightController } = ipadLogMetaData; - const { serialNumber, firmware } = flightController; - expect(serialNumber).toEqual('12345678'); - expect(firmware).toEqual('03.02.44.07'); - }); - it('parsed log should have correct remoteController info', () => { - const ipadLogMetaData = ipadLog.metaData; - const { remoteController } = ipadLogMetaData; - const { serialNumber, firmware } = remoteController; - expect(serialNumber).toEqual('12345678'); - expect(firmware).toEqual('01.04.01.00'); - }); - it('parsed log should have correct Camera info', () => { - const ipadLogMetaData = ipadLog.metaData; - const { camera } = ipadLogMetaData; - const { serialNumber } = camera; - expect(serialNumber).toEqual('N/A'); - }); - }); - }); -}); -//# sourceMappingURL=ios.test.js.map \ No newline at end of file diff --git a/dist/lib/src/__test__/ios.test.js.map b/dist/lib/src/__test__/ios.test.js.map deleted file mode 100644 index 83a0c93..0000000 --- a/dist/lib/src/__test__/ios.test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ios.test.js","sourceRoot":"","sources":["../../../../src/__test__/ios.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,gBAAc;AACd,sCAAqD;AACrD,oCAA2C;AAC3C,yCAAwC;AAExC,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,IAAI,OAAY,CAAC;IACjB,SAAS,CAAC,GAAS,EAAE;QACnB,OAAO,GAAG,MAAM,IAAA,qBAAU,GAAE,CAAC;IAC/B,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,yBAAyB,EAAE,GAAS,EAAE;QACvC,MAAM,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,CAAC;IAC/B,CAAC,CAAA,CAAC,CAAC;IAEH,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;QACrC,IAAI,YAAiB,CAAC;QACtB,SAAS,CAAC,GAAS,EAAE;YACnB,YAAY,GAAG,MA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U,CAAC,CAAC;gBACzC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;YAC1C,CAAC,CAAC,CAAC;YAEH,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;gBACpD,MAAM,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC;gBACzC,MAAM,EAAE,MAAM,EAAE,GAAG,eAAe,CAAC;gBACnC,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC;gBAEhC,MAAM,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACtC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AAEL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/lib/src/__test__/json-info.test.js b/dist/lib/src/__test__/json-info.test.js deleted file mode 100644 index a7e0ba3..0000000 --- a/dist/lib/src/__test__/json-info.test.js +++ /dev/null @@ -1,145 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -require("jest"); -const parser_1 = require("../parser"); -const path = require('path'); -const readFileAsync = require('fs').promises.readFile; -const jsonInfoLogFilePath = path.join(__dirname, '../../testlog/json-info.log'); -const jsonInfoLogFilePath2 = path.join(__dirname, '../../testlog/json-info-2-plans.log'); -describe('Test parseLog on log file with JSON Info column', () => { - let log; - let log2; - beforeAll(() => __awaiter(void 0, void 0, void 0, function* () { - let tempLog; - tempLog = yield readFileAsync(jsonInfoLogFilePath, { encoding: 'utf-8' }); - if (Buffer.isBuffer(tempLog)) { - log = tempLog.toString(); - } - else { - log = tempLog; - } - tempLog = yield readFileAsync(jsonInfoLogFilePath2, { encoding: 'utf-8' }); - if (Buffer.isBuffer(tempLog)) { - log2 = tempLog.toString(); - } - else { - log2 = tempLog; - } - })); - it('log files exists', () => __awaiter(void 0, void 0, void 0, function* () { - expect(log).toBeTruthy(); - expect(log2).toBeTruthy(); - })); - describe('parsed json-info log', () => { - let metadata; - const rows = []; - const info = []; - beforeAll(() => __awaiter(void 0, void 0, void 0, function* () { - const lines = log.split('\n'); - const subject = new parser_1.QuasiSubject(); - const parse = (0, parser_1.parseLogStream)(subject); - parse.subscribe((event) => { - metadata = (event.meta) ? event.meta : metadata; - if (event.row) - rows.push(event.row); - if (event.info) - info.push(event.info); - }); - lines.forEach(l => subject.next(l)); - subject.complete(); - })); - it('should have correct metadata', () => __awaiter(void 0, void 0, void 0, function* () { - const expected = { - "aircraft": { - "firmware": "Fake Aircraft Firmware Package", - "model": "Phantom 4 Pro", - "name": "Fake Aircraft Name" - }, - "appVersion": "4.21.0.1517", - "battery": { - "cells": 0, - "chargeVolume": 1, - "discharges": 4, - "firmware": "Fake Battery Firmware", - "remainingLifePercent": 1, - "serialNumber": "Fake Battery Serial" - }, - "camera": { - "serialNumber": "Fake Camera Serial" - }, - "device": { - "model": "iPad", - "os": "iOS 14.1", - "platform": "N/A" - }, - "flightController": { - "firmware": "Fake FC Firwmare", - "serialNumber": "Fake FC Serial" - }, - "gimbal": { - "firmware": "Fake Gimbal Firmware" - }, - "remoteController": { - "firmware": "Fake RC Firmware", - "serialNumber": "Fake RC Serial" - }, - "session": { - "elapsed": 221.819, - "end": (0, parser_1.fromUtcDateStr)("2020-11-13T01:16:22.000Z"), - "id": "unknown_plan_id", - "start": (0, parser_1.fromUtcDateStr)("2020-11-13T01:12:40.000Z") - }, - "user": { - "organizationId": "5ce4361f919c5f0001530f71", - "userId": "58adcdaff6b11d0001fff143" - } - }; - expect(metadata).toEqual(expected); - })); - it('should have correct flight log rows', () => __awaiter(void 0, void 0, void 0, function* () { - expect(rows.length).toEqual(1170); - })); - it('should have correct JSON Info', () => __awaiter(void 0, void 0, void 0, function* () { - expect(info.length).toEqual(1); - expect(info[0].length).toEqual(2); - expect(info[0][0]).toEqual({ message: "Mission did take off" }); - expect(info[0][1]).toEqual({ - planId: "5faddd83440520a955fb31c2", - projectId: "5e5da0be976932beb266c15f", - templateId: "5f1b24bb3fd4e17d4952cf4b" - }); - })); - }); - describe('parsed json-info log with 2 plans', () => { - let metadata; - const rows = []; - const info = []; - beforeAll(() => __awaiter(void 0, void 0, void 0, function* () { - const lines = log2.split('\n'); - const subject = new parser_1.QuasiSubject(); - const parse = (0, parser_1.parseLogStream)(subject); - parse.subscribe((event) => { - metadata = (event.meta) ? event.meta : metadata; - if (event.row) - rows.push(event.row); - if (event.info) - info.push(event.info); - }); - lines.forEach(l => subject.next(l)); - subject.complete(); - })); - it('should have 2 plans', () => { - expect(info.length).toEqual(2); - }); - }); -}); -//# sourceMappingURL=json-info.test.js.map \ No newline at end of file diff --git a/dist/lib/src/__test__/json-info.test.js.map b/dist/lib/src/__test__/json-info.test.js.map deleted file mode 100644 index 7c8b50f..0000000 --- a/dist/lib/src/__test__/json-info.test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"json-info.test.js","sourceRoot":"","sources":["../../../../src/__test__/json-info.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,gBAAa;AACb,sCAAyE;AAGzE,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;AAEtD,MAAM,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,6BAA6B,CAAC,CAAC;AAChF,MAAM,oBAAoB,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,qCAAq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AE;QACjD,IAAI,QAA2B,CAAC;QAChC,MAAM,IAAI,GAAmB,EAAE,CAAC;QAChC,MAAM,IAAI,GAAU,EAAE,CAAC;QACvB,SAAS,CAAC,GAAS,EAAE;YACnB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC/B,MAAM,OAAO,GAAG,IAAI,qBAAY,EAAU,CAAC;YAC3C,MAAM,KAAK,GAAG,IAAA,uBAAc,EAAC,OAAO,CAAC,CAAC;YACtC,KAAK,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;gBACxB,QAAQ,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;gBAChD,IAAI,KAAK,CAAC,GAAG;oBAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACpC,IAAI,KAAK,CAAC,IAAI;oBAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACxC,CAAC,CAAC,CAAC;YACH,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YACpC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACrB,CAAC,CAAA,CAAC,CAAC;QAEH,EAAE,CAAC,qBAAqB,EAAE,GAAG,EAAE;YAC7B,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/lib/src/__test__/parser.test.js b/dist/lib/src/__test__/parser.test.js deleted file mode 100644 index 8975fbc..0000000 --- a/dist/lib/src/__test__/parser.test.js +++ /dev/null @@ -1,301 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -require("jest"); -const parser_1 = require("../parser"); -const testutil_1 = require("./testutil"); -const _ = require('lodash'); -describe('parser', () => { - let iosLogs; - beforeAll(() => __awaiter(void 0, void 0, void 0, function* () { - iosLogs = yield (0, testutil_1.getIosLogs)(); - })); - describe('fromUtcDateStr', () => { - it('should parse tz-aware timestamps correctly', () => { - const noonPacific = '05/23/2018 20:00:00.000Z'; - expect((0, parser_1.fromUtcDateStr)(noonPacific).toISOString()).toBe('2018-05-23T20:00:00.000Z'); - const noonUtc = '05/23/2018 12:00:00.000Z'; - expect((0, parser_1.fromUtcDateStr)(noonUtc).toISOString()).toBe('2018-05-23T12:00:00.000Z'); - }); - it('should parse tz-naive timestamps as UTC', () => { - const noon = '05/23/2018 12:00:00'; - expect((0, parser_1.fromUtcDateStr)(noon).toISOString()).toBe('2018-05-23T12:00:00.000Z'); - const onePm = '2018-05-23 13:00:00'; - expect((0, parser_1.fromUtcDateStr)(onePm).toISOString()).toBe('2018-05-23T13:00:00.000Z'); - }); - }); - describe('parseLogStream', () => { - it('should parse the ios stream correctly', () => { - const subj = new parser_1.QuasiSubject(); - const events = []; - const parseLogStreamObs = (0, parser_1.parseLogStream)(subj); - parseLogStreamObs.subscribe((logEvent) => { - events.push(_.cloneDeep(logEvent)); - }); - iosLogs.ipadmin.split('\n').forEach((line) => subj.next(line)); - const meta = { - aircraft: { - firmware: '01.05.0600', - model: 'Phantom 4 Pro', - name: '123', - }, - appVersion: '0.0.0', - battery: { - cells: 4, - chargeVolume: 5842, - discharges: 28, - firmware: '02.00.07.31', - remainingLifePercent: 0, - serialNumber: 'N/A', - }, - camera: { - serialNumber: 'N/A', - }, - device: { - model: 'iPad', - os: 'iOS 11.2.6', - platform: 'N/A', - }, - flightController: { - firmware: '03.02.44.07', - serialNumber: '12345678', - }, - gimbal: { - firmware: '01.50.13.17', - }, - remoteController: { - firmware: '01.04.01.00', - serialNumber: '12345678', - }, - session: { - elapsed: 233.217, - end: new Date('2018-05-23T20:54:12.000Z'), - id: '12345678', - start: new Date('2018-05-23T20:50:18.000Z'), - }, - user: { - userId: 'N/A', - organizationId: 'N/A', - }, - }; - return parseLogStreamObs.toPromise().then(() => { - expect(events.length).toBe(9); - expect(events[0]).toEqual({ - meta: _.merge(_.cloneDeep(meta), { - session: { - elapsed: 0, - end: null, - }, - }), - rowIndex: 27, - }); - expect(events[events.length - 2]).toEqual({ - info: undefined, - meta: _.merge(_.cloneDeep(meta), { - session: { - elapsed: 233.121, - end: new Date('2018-05-23T20:54:11.000Z'), - }, - }), - row: { - 'Aircraft Barometric Altitude (ft)': 2.952756, - 'Aircraft Battery Cell 1 Voltage': 4001, - 'Aircraft Battery Cell 2 Voltage': 3999, - 'Aircraft Battery Cell 3 Voltage': 4002, - 'Aircraft Battery Cell 4 Voltage': 3981, - 'Aircraft Battery Cell Voltage Last Updated (ms)': '0', - 'Aircraft Battery Charge (mAh)': 4907, - 'Aircraft Battery Current (mA)': -11762, - 'Aircraft Battery Last Updated (ms)': '323', - 'Aircraft Battery Power (%)': 84, - 'Aircraft Battery Temperature (Fahrenheit)': 94, - 'Aircraft Battery Voltage (mV)': 15931, - 'Aircraft Camera Burst Capture': false, - 'Aircraft Camera Changeable Lens Supported': false, - 'Aircraft Camera Interval Capture': false, - 'Aircraft Camera Lens AF Assistant': false, - 'Aircraft Camera Lens AF Enabled': false, - 'Aircraft Camera Lens Assistant Working': false, - 'Aircraft Camera Lens Focus Mode': 'Manual', - 'Aircraft Camera Lens Focus Mode Value': 0, - 'Aircraft Camera Lens Focus Status': 'Idle', - 'Aircraft Camera Lens Focus Status Value': 0, - 'Aircraft Camera Lens Installed': false, - 'Aircraft Camera Lens MF Assistant': false, - 'Aircraft Camera Lens State Last Updated (ms)': 'No Data', - 'Aircraft Camera Lens Type': 'Unknown', - 'Aircraft Camera Mode': 'Shoot Photo', - 'Aircraft Camera Mode Value': 0, - 'Aircraft Camera Overheated': false, - 'Aircraft Camera Raw Capture': false, - 'Aircraft Camera Recording': false, - 'Aircraft Camera SD Card Exists': true, - 'Aircraft Camera SD Card Remaining (%)': 59.53524, - 'Aircraft Camera SD Card State Last Updated (ms)': '25', - 'Aircraft Camera Sensor Error': false, - 'Aircraft Camera Single Capture': false, - 'Aircraft Camera State Last Updated (ms)': '25', - 'Aircraft Camera Storing Photo': false, - 'Aircraft Flight Mode': 'Landing', - 'Aircraft Flight Mode Value': 12, - 'Aircraft Flying': true, - 'Aircraft GPS Signal': 'Very Good', - 'Aircraft GPS Signal Value': 4, - 'Aircraft Heading (Degrees)': 48.3, - 'Aircraft IMU Preheating': false, - 'Aircraft Latitude (Degrees)': 37.77181958553695, - 'Aircraft Longitude (Degrees)': -122.4074142850207, - 'Aircraft Motors On': true, - 'Aircraft No-fly': 'Fly Zone Airport', - 'Aircraft No-fly Latitude (Degrees)': 0, - 'Aircraft No-fly Longitude (Degrees)': 0, - 'Aircraft No-fly Radius (ft)': 0, - 'Aircraft No-fly Value': 0, - 'Aircraft Pitch (Degrees)': -0.5, - 'Aircraft Roll (Degrees)': 0.4, - 'Aircraft Satellites': 15, - 'Aircraft Smart Go-home Countdown (sec)': 0, - 'Aircraft Smart Go-home Flight Return Time (sec)': 0, - 'Aircraft Smart Go-home Flight Time Remaining (sec)': 1497, - 'Aircraft Smart Go-home Landing Power (%)': 10, - 'Aircraft Smart Go-home Landing Time (sec)': 0, - 'Aircraft Smart Go-home Radius (ft)': 19154, - 'Aircraft Smart Go-home Requesting': false, - 'Aircraft Smart Go-home Return Power (%)': 15, - 'Aircraft Speed (mph)': 0, - 'Aircraft System State Last Updated (ms)': '27', - 'Aircraft Ultrasonic Altitude (ft)': 0.328084, - 'Aircraft Ultrasonic On': true, - 'Aircraft Vel - X (mph)': 0, - 'Aircraft Vel - Y (mph)': 0, - 'Aircraft Vel - Z (mph)': 0, - 'Aircraft Vision On': false, - 'Date/Time (UTC)': new Date('2018-05-23T20:54:11.000Z'), - 'Device > Aircraft Distance - XY (ft)': 19.92750419698512, - 'Device Latitude (Degrees)': '37.77179522443355', - 'Device Location Last Updated (ms)': '233114', - 'Device Longitude (Degrees)': '-122.4074760173656', - 'Elapsed Time (sec)': 233.121, - 'Gimbal Mode': 'Yaw Follow', - 'Gimbal Mode Value': 2, - 'Gimbal Pitch (Degrees)': 0, - 'Gimbal Pitch at Stop': 0, - 'Gimbal Roll (Degrees)': 0, - 'Gimbal Roll at Stop': 0, - 'Gimbal Status Last Updated (ms)': '26', - 'Gimbal Yaw (Degrees)': 47.79999923706055, - 'Gimbal Yaw at Stop': 0, - 'Home Latitude (Degrees)': 37.77180618457626, - 'Home Longitude (Degrees)': -122.4074297098351, - 'Info': '', - 'LB Signal 1': 'N/A', - 'LB Signal 2': 'N/A', - 'LB Signal Last Updated (ms)': 'No Data', - 'Landing Gear Last Updated (ms)': 'No Data', - 'Landing Gear Mode': 'Unknown', - 'Landing Gear Mode Value': 3, - 'Landing Gear Status': 'Unknown', - 'Landing Gear Status Value': 0, - 'Landing Gear is Movable': false, - 'RC Battery (%)': 88, - 'RC Battery State Last Updated (ms)': '125', - 'RC Custom 1': false, - 'RC Custom 2': false, - 'RC GPS State Last Updated (ms)': 'No Data', - 'RC GSP Data is Valid': false, - 'RC Go Home': false, - 'RC Horizontal Accuaracy (ft)': 0, - 'RC Landing Gear': 'No Present', - 'RC Landing Gear Value': 0, - 'RC Latitude (Degrees)': 0, - 'RC Left Horizontal': true, - 'RC Left Vertical': true, - 'RC Left Wheel': '0', - 'RC Longitude (Degrees)': 0, - 'RC Pause': false, - 'RC Playback': false, - 'RC Record': '0', - 'RC Right Horizontal': true, - 'RC Right Vertical': true, - 'RC Right Wheel': '0', - 'RC Sattelites': false, - 'RC Shutter': false, - 'RC Signal 1': 'N/A', - 'RC Signal 2': 'N/A', - 'RC Signal Last Updated (ms)': 'No Data', - 'RC State': '3', - 'RC State Last Updated (ms)': '26', - 'RC State Value': 2, - }, - rowIndex: 33, - }); - expect(events[events.length - 1]).toEqual({ - meta, - rowIndex: 34, - }); - }); - }); - describe('error log', () => { - let sampleErrLog; - let events; - beforeAll(() => __awaiter(void 0, void 0, void 0, function* () { - const subj = new parser_1.QuasiSubject(); - const parseLogStreamObs = (0, parser_1.parseLogStream)(subj); - events = []; - parseLogStreamObs.subscribe((logEvent) => { - events.push(_.cloneDeep(logEvent)); - }); - iosLogs.errorLog.split('\n').forEach((line) => subj.next(line)); - })); - describe('sampleErrLog detail test', () => { - it('parsed log should have correct falsy value when session info has no value', () => { - const { id, start, end, elapsed } = events[events.length - 1].meta.session; - expect(id).toEqual('N/A'); - expect(start).toBeNull(); - }); - it('parsed log should have correct falsy value when aircraft info has no value', () => { - const { model, name, firmware } = events[events.length - 1].meta.aircraft; - expect(model).toEqual('N/A'); - expect(name).toEqual('N/A'); - expect(firmware).toEqual('N/A'); - }); - it('parsed log should have correct falsy value when battery info has no value', () => { - const { chargeVolume, remainingLifePercent, discharges, cells, firmware, serialNumber, } = events[events.length - 1].meta.battery; - expect(serialNumber).toEqual('N/A'); - expect(chargeVolume).toEqual(0); - expect(remainingLifePercent).toEqual(0); - expect(discharges).toEqual(0); - expect(cells).toEqual(0); - expect(firmware).toEqual('N/A'); - }); - it('parsed log should have correct falsy value when gimbal info has no value', () => { - const { firmware } = events[events.length - 1].meta.gimbal; - expect(firmware).toEqual('N/A'); - }); - it('parsed log should have correct falsy value when flightController info has no value', () => { - const { serialNumber, firmware } = events[events.length - 1].meta.flightController; - expect(serialNumber).toEqual('N/A'); - expect(firmware).toEqual('N/A'); - }); - it('parsed log should have correct falsy value when remoteController info has no value', () => { - const { serialNumber, firmware } = events[events.length - 1].meta.remoteController; - expect(serialNumber).toEqual('N/A'); - expect(firmware).toEqual('N/A'); - }); - it('parsed log should have correct falsy value when camera info has no value', () => { - const { serialNumber } = events[events.length - 1].meta.camera; - expect(serialNumber).toEqual('N/A'); - }); - }); - }); - }); -}); -//# sourceMappingURL=parser.test.js.map \ No newline at end of file diff --git a/dist/lib/src/__test__/parser.test.js.map b/dist/lib/src/__test__/parser.test.js.map deleted file mode 100644 index 0b272bc..0000000 --- a/dist/lib/src/__test__/parser.test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parser.test.js","sourceRoot":"","sources":["../../../../src/__test__/parser.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,gBAAc;AACd,sCAAyE;AACzE,yCAAwC;AAIxC,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAG5B,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IAEtB,IAAI,OAAY,CAAC;IACjB,SAAS,CAAC,GAAS,EAAE;QACnB,OAAO,GAAG,MAAM,IAAA,qBAAU,GAAE,CAAC;IAC/B,CAAC,CAAA,CAAC,CAAC;IAEH,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;QAC9B,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;YACpD,MAAM,WAAW,GAAG,0BAA0B,CAAC;YAC/C,MAAM,CAAE,IAAA,uBAAc,EAAC,WAAW,CAAU,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;YAC7F,MAAM,OAAO,GAAG,0BAA0B,CAAC;YAC3C,MAAM,CAAE,IAAA,uBAAc,EAAC,OAAO,CAAU,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;QAC3F,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;YACjD,MAAM,IAAI,GAAG,q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"} \ No newline at end of file diff --git a/dist/lib/src/__test__/testutil.js b/dist/lib/src/__test__/testutil.js deleted file mode 100644 index 2a6227c..0000000 --- a/dist/lib/src/__test__/testutil.js +++ /dev/null @@ -1,32 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getIosLogs = void 0; -const path = require('path'); -const readFileAsync = require('fs').promises.readFile; -// Maybe we can read all files from one folder? -const ipadFilePath = path.join(__dirname, '/../../testlog/ipad-ios11-phantom4.log'); -const ipadMinimalFilePath = path.join(__dirname, '/../../testlog/ipad-ios11-phantom4-minimal.log'); -const iphoneFilePath = path.join(__dirname, '/../../testlog/iphone-ios11-inspire.log'); -const errorLogFilePath = path.join(__dirname, '/../../testlog/errorLog.log'); -function getIosLogs() { - return __awaiter(this, void 0, void 0, function* () { - const iosLogs = { - ipad: yield readFileAsync(ipadFilePath, { encoding: 'utf8' }), - ipadmin: yield readFileAsync(ipadMinimalFilePath, { encoding: 'utf8' }), - iphone: yield readFileAsync(iphoneFilePath, { encoding: 'utf8' }), - errorLog: yield readFileAsync(errorLogFilePath, { encoding: 'utf8' }), - }; - return iosLogs; - }); -} -exports.getIosLogs = getIosLogs; -//# sourceMappingURL=testutil.js.map \ No newline at end of file diff --git a/dist/lib/src/__test__/testutil.js.map b/dist/lib/src/__test__/testutil.js.map deleted file mode 100644 index 31237f6..0000000 --- a/dist/lib/src/__test__/testutil.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"testutil.js","sourceRoot":"","sources":["../../../../src/__test__/testutil.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;AACtD,+CAA+C;AAE/C,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,wCAAwC,CAAC,CAAC;AACpF,MAAM,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,gDAAgD,CAAC,CAAC;AACnG,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,yCAAyC,CAAC,CAAC;AACvF,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,6BAA6B,CAAC,CAAC;AAE7E,SAAsB,UAAU;;QAC5B,MAAM,OAAO,GAAG;YACZ,IAAI,EAAE,MAAM,aAAa,CAAC,YAAY,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;YAC7D,OAAO,EAAE,MAAM,aAAa,CAAC,mBAAmB,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;YACvE,MAAM,EAAE,MAAM,aAAa,CAAC,cAAc,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;YACjE,QAAQ,EAAE,MAAM,aAAa,CAAC,gBAAgB,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;SACxE,CAAC;QACF,OAAO,OAAO,CAAC;IACnB,CAAC;CAAA;AARD,gCAQC"} \ No newline at end of file diff --git a/dist/lib/src/field-types.js b/dist/lib/src/field-types.js deleted file mode 100644 index 24051b3..0000000 --- a/dist/lib/src/field-types.js +++ /dev/null @@ -1,111 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DATE_FIELDS = exports.BOOL_FIELDS = exports.FLOAT_FIELDS = exports.INT_FIELDS = void 0; -const types_1 = require("./types"); -exports.INT_FIELDS = new Set([ - types_1.FlightLogHeader.AircraftBatteryCell1Voltage, - types_1.FlightLogHeader.AircraftBatteryCell2Voltage, - types_1.FlightLogHeader.AircraftBatteryCell3Voltage, - types_1.FlightLogHeader.AircraftBatteryCell4Voltage, - types_1.FlightLogHeader.AircraftBatteryCharge, - types_1.FlightLogHeader.AircraftBatteryCurrent, - types_1.FlightLogHeader.AircraftBatteryTemperature, - types_1.FlightLogHeader.AircraftBatteryVoltage, - types_1.FlightLogHeader.AircraftCameraLensFocusModeValue, - types_1.FlightLogHeader.AircraftCameraLensFocusStatusValue, - types_1.FlightLogHeader.AircraftCameraModeValue, - types_1.FlightLogHeader.AircraftFlightModeValue, - types_1.FlightLogHeader.AircraftGPSSignalValue, - types_1.FlightLogHeader.AircraftNoFlyValue, - types_1.FlightLogHeader.AircraftSatellites, - types_1.FlightLogHeader.GimbalModeValue, - types_1.FlightLogHeader.AircraftSmartGoHomeRadius, - types_1.FlightLogHeader.AircraftSmartGoHomeCountdown, - types_1.FlightLogHeader.AircraftVelocityX, - types_1.FlightLogHeader.AircraftVelocityY, - types_1.FlightLogHeader.AircraftVelocityZ, - types_1.FlightLogHeader.RCHorizontalAccuaracy, - types_1.FlightLogHeader.RCLatitude, - types_1.FlightLogHeader.RCLongitude, - types_1.FlightLogHeader.LandingGearStatusValue, - types_1.FlightLogHeader.LandingGearModeValue, - types_1.FlightLogHeader.RCStateValue, - types_1.FlightLogHeader.RCLandingGearValue, -]); -exports.FLOAT_FIELDS = new Set([ - types_1.FlightLogHeader.AircraftBarometricAltitude, - types_1.FlightLogHeader.AircraftBatteryPowerPercent, - types_1.FlightLogHeader.AircraftCameraSDCardRemainingPercent, - types_1.FlightLogHeader.AircraftHeading, - types_1.FlightLogHeader.AircraftLatitude, - types_1.FlightLogHeader.AircraftLongitude, - types_1.FlightLogHeader.AircraftNoFlyLatitude, - types_1.FlightLogHeader.AircraftNoFlyLongitude, - types_1.FlightLogHeader.AircraftNoFlyRadius, - types_1.FlightLogHeader.AircraftPitch, - types_1.FlightLogHeader.AircraftRoll, - types_1.FlightLogHeader.AircraftSmartGoHomeFlightReturnTime, - types_1.FlightLogHeader.AircraftSmartGoHomeFlightTimeRemaining, - types_1.FlightLogHeader.AircraftSmartGoHomeLandingPower, - types_1.FlightLogHeader.AircraftSmartGoHomeLandingTime, - types_1.FlightLogHeader.AircraftSmartGoHomeReturnPower, - types_1.FlightLogHeader.AircraftSpeed, - types_1.FlightLogHeader.AircraftUltrasonicAltitude, - types_1.FlightLogHeader.DeviceToAircraftDistance, - types_1.FlightLogHeader.ElapsedTime, - types_1.FlightLogHeader.GimbalPitch, - types_1.FlightLogHeader.GimbalPitchAtStop, - types_1.FlightLogHeader.GimbalRoll, - types_1.FlightLogHeader.GimbalRollAtStop, - types_1.FlightLogHeader.GimbalYaw, - types_1.FlightLogHeader.GimbalYawAtStop, - types_1.FlightLogHeader.HomeLatitude, - types_1.FlightLogHeader.HomeLongitude, - types_1.FlightLogHeader.RCBatteryPercentRemaining, - types_1.FlightLogHeader.RCLeftHorizontal, - types_1.FlightLogHeader.RCRightHorizontal, - types_1.FlightLogHeader.RCLeftVertical, - types_1.FlightLogHeader.RCRightVertical, -]); -exports.BOOL_FIELDS = new Set([ - types_1.FlightLogHeader.AircraftCameraBurstCapture, - types_1.FlightLogHeader.AircraftCameraIntervalCapture, - types_1.FlightLogHeader.AircraftCameraLensAFAssistant, - types_1.FlightLogHeader.AircraftCameraLensAFEnabled, - types_1.FlightLogHeader.AircraftCameraLensAssistantWorking, - types_1.FlightLogHeader.AircraftCameraOverheated, - types_1.FlightLogHeader.AircraftCameraRawCapture, - types_1.FlightLogHeader.AircraftCameraBurstCapture, - types_1.FlightLogHeader.AircraftCameraRecording, - types_1.FlightLogHeader.AircraftCameraSDCardExists, - types_1.FlightLogHeader.AircraftCameraSensorError, - types_1.FlightLogHeader.AircraftCameraSingleCapture, - types_1.FlightLogHeader.AircraftCameraStoringPhoto, - types_1.FlightLogHeader.AircraftFlying, - types_1.FlightLogHeader.AircraftIMUPreheating, - types_1.FlightLogHeader.AircraftMotorsOn, - types_1.FlightLogHeader.AircraftSmartGoHomeRequesting, - types_1.FlightLogHeader.AircraftUltrasonicOn, - types_1.FlightLogHeader.AircraftVisionOn, - types_1.FlightLogHeader.LandingGearIsMovable, - types_1.FlightLogHeader.RCGoHome, - types_1.FlightLogHeader.RCRecord, - types_1.FlightLogHeader.RCShutter, - types_1.FlightLogHeader.RCPlayback, - types_1.FlightLogHeader.RCPause, - types_1.FlightLogHeader.RCCustom1, - types_1.FlightLogHeader.RCCustom2, - types_1.FlightLogHeader.RCSattelites, - types_1.FlightLogHeader.RCGSPDataIsValid, - types_1.FlightLogHeader.RCLeftHorizontal, - types_1.FlightLogHeader.RCRightHorizontal, - types_1.FlightLogHeader.RCLeftVertical, - types_1.FlightLogHeader.RCRightVertical, - types_1.FlightLogHeader.AircraftCameraChangeableLensSupported, - types_1.FlightLogHeader.AircraftCameraLensInstalled, - types_1.FlightLogHeader.AircraftCameraLensMFAssistant, -]); -exports.DATE_FIELDS = new Set([ - types_1.FlightLogHeader.DateTime, -]); -//# sourceMappingURL=field-types.js.map \ No newline at end of file diff --git a/dist/lib/src/field-types.js.map b/dist/lib/src/field-types.js.map deleted file mode 100644 index 7d1fca8..0000000 --- a/dist/lib/src/field-types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"field-types.js","sourceRoot":"","sources":["../../../src/field-types.ts"],"names":[],"mappings":";;;AAAA,mCAA0C;AAE7B,QAAA,UAAU,GAAG,IAAI,GAAG,CAAC;IAChC,uBAAe,CAAC,2BAA2B;IAC3C,uBAAe,CAAC,2BAA2B;IAC3C,uBAAe,CAAC,2BAA2B;IAC3C,uBAAe,CAAC,2BAA2B;IAC3C,uBAAe,CAAC,qBAAqB;IACrC,uBAAe,CAAC,sBAAsB;IACtC,uBAAe,CAAC,0BAA0B;IAC1C,uBAAe,CAAC,sBAAsB;IACtC,uBA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Ae;IAC/B,uBAAe,CAAC,qCAAqC;IACrD,uBAAe,CAAC,2BAA2B;IAC3C,uBAAe,CAAC,6BAA6B;CAC9C,CAAC,CAAC;AAEU,QAAA,WAAW,GAAG,IAAI,GAAG,CAAC;IAC/B,uBAAe,CAAC,QAAQ;CAC3B,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/lib/src/flight-log-parser.js b/dist/lib/src/flight-log-parser.js deleted file mode 100644 index 1a59eb4..0000000 --- a/dist/lib/src/flight-log-parser.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.fromUtcDateStr = exports.QuasiSubject = exports.parseLogStream = exports.parseLog = exports.FLIGHT_MODE_MAPPING_V5 = exports.FLIGHT_MODE_MAPPING_V4 = exports.FlightLogHeader = void 0; -var types_1 = require("./types"); -Object.defineProperty(exports, "FlightLogHeader", { enumerable: true, get: function () { return types_1.FlightLogHeader; } }); -Object.defineProperty(exports, "FLIGHT_MODE_MAPPING_V4", { enumerable: true, get: function () { return types_1.FLIGHT_MODE_MAPPING_V4; } }); -Object.defineProperty(exports, "FLIGHT_MODE_MAPPING_V5", { enumerable: true, get: function () { return types_1.FLIGHT_MODE_MAPPING_V5; } }); -var parser_1 = require("./parser"); -Object.defineProperty(exports, "parseLog", { enumerable: true, get: function () { return parser_1.parseLog; } }); -Object.defineProperty(exports, "parseLogStream", { enumerable: true, get: function () { return parser_1.parseLogStream; } }); -Object.defineProperty(exports, "QuasiSubject", { enumerable: true, get: function () { return parser_1.QuasiSubject; } }); -Object.defineProperty(exports, "fromUtcDateStr", { enumerable: true, get: function () { return parser_1.fromUtcDateStr; } }); -//# sourceMappingURL=flight-log-parser.js.map \ No newline at end of file diff --git a/dist/lib/src/flight-log-parser.js.map b/dist/lib/src/flight-log-parser.js.map deleted file mode 100644 index e64ef48..0000000 --- a/dist/lib/src/flight-log-parser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"flight-log-parser.js","sourceRoot":"","sources":["../../../src/flight-log-parser.ts"],"names":[],"mappings":";;;AAAA,iCAQiB;AALf,wGAAA,eAAe,OAAA;AAGf,+GAAA,sBAAsB,OAAA;AACtB,+GAAA,sBAAsB,OAAA;AAExB,mCAAmG;AAA1F,kGAAA,QAAQ,OAAA;AAAE,wGAAA,cAAc,OAAA;AAAE,sGAAA,YAAY,OAAA;AAAmB,wGAAA,cAAc,OAAA"} \ No newline at end of file diff --git a/dist/lib/src/parser.js b/dist/lib/src/parser.js deleted file mode 100644 index 524a7c1..0000000 --- a/dist/lib/src/parser.js +++ /dev/null @@ -1,346 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.fromUtcDateStr = exports.parseLog = exports.parseLogStream = exports.QuasiSubject = void 0; -const csv_parse_1 = require("csv-parse"); -const types_1 = require("./types"); -const field_types_1 = require("./field-types"); -const syncParse = require('csv-parse/lib/sync'); -const META_REGEX = { - appVersion: /^#DroneDeploy\s+(.+)$/, - sessionId: /^Session ID\s+(.+)$/, - sessionStart: /^Session Start\s+(.+)$/, - sessionEnd: /^Date\/Time \(UTC\)\s+(.+)$/, - deviceModel: /^Device Model\s+(.+)$/, - deviceOS: /^Device Operating System\s+(.+)$/, - aircraftModel: /^Aircraft Model\s+(.+)$/, - aircraftName: /^Aircraft Name\s+(.+)$/, - aircraftFirmware: /^Aircraft Firmware\s+(.+)$/, - batteryChargeVolume: /^Full Charge Volume \(mAh\)\s+(.+)$/, - batteryRemainingLife: /^Remaining Life \(%\)\s+(.+)$/, - batteryDischarges: /^Discharges\s+(.+)$/, - batteryCells: /^Battery Cells Number\s+(.+)$/, - batterySerialNumber: /^Battery Serial Number\s+(.+)$/, - batteryFirmware: /^Battery Firmware\s+(.+)$/, - fcSerialNumber: /^Flight Controller Serial Number\s+(.+)$/, - fcFirmware: /^Flight Controller Firmware\s+(.+)$/, - footerLines: /^#Flight Recorder Session End|^Date\/Time \(UTC\)|^Elapsed Time \(sec\)/, - gimbalFirmware: /^Gimbal Firmware\s+(.+)$/, - rcSerialNumber: /^Remote Control Serial Number\s+(.+)$/, - rcFirmware: /^Remote Control Firmware\s+(.+)$/, - cameraSerialNumber: /^Camera Serial Number\s+(.+)$/, - elapsedTime: /^Elapsed Time \(sec\)\s+(.+)$/, - userId: /^User ID\s+(.+)$/, - organizationId: /^Organization ID\s+(.+)$/, - platform: /^Platform\s+(.+)$/, -}; -class QuasiSubject { - constructor() { - this.subscribers = []; - this.errorSubscribers = []; - this.completionSubscribers = []; - this.isFinished = false; - } - next(value) { - if (this.isFinished) { - return; - } - this.subscribers.forEach((s) => s(value)); - } - complete() { - if (this.isFinished) { - return; - } - this.isFinished = true; - this.completionSubscribers.forEach((sub) => sub()); - } - error(error) { - if (this.isFinished) { - return; - } - this.errorSubscribers.forEach((errSub) => errSub(error)); - this.complete(); - } - subscribe(sub, errSub, completionSub) { - this.subscribers.push(sub); - if (errSub) { - this.errorSubscribers.push(errSub); - } - if (completionSub) { - this.completionSubscribers.push(completionSub); - } - } - toPromise() { - const source = this; - return new Promise(function (resolve, reject) { - let value; - source.subscribe(function (v) { - value = v; - }, reject, function () { - resolve(value); - }); - }); - } -} -exports.QuasiSubject = QuasiSubject; -function parseLogStream(logStream) { - const headerMetaLines = []; - let meta = {}; - let rowHeaderLine; - let row; - const progress = { index: 0, completed: false }; - let end; - const result = new QuasiSubject(); - logStream.subscribe((line) => { - line = line.trim(); - if (!line.length) { - return; - } - if (!rowHeaderLine) { - if (line.startsWith(types_1.FlightLogHeader.DateTime.split(' ')[0])) { // Strip off timezone. - rowHeaderLine = line; - meta = parseMetaData(headerMetaLines, []); - result.next({ - meta, - rowIndex: progress.index - }); - } - else { - headerMetaLines.push(line); - progress.index++; - } - return; - } - if (META_REGEX.footerLines.test(line)) { - if (META_REGEX.sessionEnd.test(line)) { - end = fromUtcDateStr(findMatch([line], META_REGEX.sessionEnd)); - } - else if (META_REGEX.elapsedTime.test(line)) { - const elapsed = findMatch([line], META_REGEX.elapsedTime); - // This is the end of the parsing. Because normal lines are parsed through a Promise, they will be delivered - // asynchronously. So we must ensure that this result is also delivered asynchronously. - setTimeout(() => { - const parsedElapsed = elapsed === 'N/A' ? 0 : parseFloat(elapsed); - if (parsedElapsed) { - meta.session.elapsed = parsedElapsed; - } - if (end) { - meta.session.end = end; - } - result.next({ - meta, - rowIndex: progress.index++, - }); - result.complete(); - progress.completed = true; - }, 0); - } - } - else { - parseBody([rowHeaderLine, line], true).then((rows) => { - row = rows[0]; - meta.session.end = row[types_1.FlightLogHeader.DateTime]; - meta.session.elapsed = row[types_1.FlightLogHeader.ElapsedTime]; - result.next({ - meta, - rowIndex: progress.index++, - row, - info: parseJsonInfo(row.Info), // Parsed Info column, if the column was populated with a JSON array. - }); - }); - } - }, (err) => { console.error('parsing error: ' + err); result.complete(); }, () => { - if (!progress.completed) { - setTimeout(() => { - result.complete(); - progress.completed = true; - }, 0); - } - }); - return result; -} -exports.parseLogStream = parseLogStream; -function parseLog(log) { - const lines = log.split('\n'); - const subject = new QuasiSubject(); - const parse = parseLogStream(subject); - const flightLog = { - metaData: {}, - rows: [], - infos: [] - }; - parse.subscribe((event) => { - // The metadata is updated as the file is parsed, so always grab the latest one. - flightLog.metaData = (event.meta) ? event.meta : flightLog.metaData; - if (event.row) { - flightLog.rows.push(event.row); - } - if (event.info) { - // @ts-ignore - flightLog.infos.push(event.info); - } - }); - lines.forEach(l => subject.next(l)); - subject.complete(); - return new Promise((resolve, reject) => { - parse.toPromise().then(() => resolve(flightLog)).catch((reason => reject(reason))); - }); -} -exports.parseLog = parseLog; -function parseBody(lines, sync) { - const text = lines.join('\n'); - const options = { - delimiter: '\t', - escape: null, - from: 1, - quote: null, - relax_column_count: true, - }; - return new Promise((resolve, reject) => { - const onResults = (err, result) => { - if (err) { - return reject(err); - } - const [headers, ...rows] = result; - const logs = rows.map((row) => { - const log = {}; - for (let i = 0; i < headers.length; i++) { - const header = headers[i].trim(); - let value = row[i]; - if (field_types_1.INT_FIELDS.has(header)) { - value = parseInt(value, 10); - } - if (field_types_1.FLOAT_FIELDS.has(header)) { - value = parseFloat(value); - } - if (field_types_1.BOOL_FIELDS.has(header)) { - value = value !== '0'; - } - if (field_types_1.DATE_FIELDS.has(header)) { - value = fromUtcDateStr(value); - } - log[header] = value; - } - return log; - }); - resolve(logs); - }; - if (sync) { - const results = syncParse(text, options); - onResults(undefined, results); - } - else { - // @ts-ignore - (0, csv_parse_1.default)(text, options, onResults); - } - }); -} -function findMatch(search, regex, isNum) { - let match; - for (let str of search) { - match = str.match(regex); - if (match) { - break; - } - } - if (!match) { - return isNum ? '0' : 'N/A'; - } - return match[1]; -} -function isValidDate(d) { - return d instanceof Date && !isNaN(d); -} -function fromUtcDateStr(utcDateStr) { - if (isValidDate(utcDateStr)) { - return utcDateStr; - } - const isBadDate = !utcDateStr || !utcDateStr.trim().length || utcDateStr === 'N/A'; - if (isBadDate) { - return null; - } - if (!/Z$/.test(utcDateStr)) { - utcDateStr = utcDateStr + '.000Z'; - } - return new Date(utcDateStr); -} -exports.fromUtcDateStr = fromUtcDateStr; -function parseMetaData(headers, footers) { - const meta = [...headers, ...footers]; - let end = findMatch(meta, META_REGEX.sessionEnd); - let elapsed = findMatch(meta, META_REGEX.elapsedTime); - // if we weren't able to parse an end date or an elapsed time from our footer (which is really just the last three - // lines of the log file), it's likely that we have a truncated log file. if that's the case, we can still salvage - // some valid data by parsing the date and elapsed time from the very last log row in the file, which is what we're - // doing below. it's pretty brittle, but it's preferred to having an invalid end date and a NaN elapsed time. - if ((end === 'N/A' || elapsed === 'N/A') && footers.length > 0) { - const lastLine = footers[footers.length - 1]; - const pieces = lastLine.split('\t'); - // if we don't have at least two pieces, i don't know what is in `footer` so i'm just going to leave it alone - if (pieces.length >= 2) { - end = pieces[0]; - elapsed = pieces[1]; - } - } - return { - appVersion: findMatch(meta, META_REGEX.appVersion), - session: { - id: findMatch(meta, META_REGEX.sessionId), - start: fromUtcDateStr(findMatch(meta, META_REGEX.sessionStart)), - end: fromUtcDateStr(end), - elapsed: elapsed === 'N/A' ? 0 : parseFloat(elapsed), - }, - device: { - model: findMatch(meta, META_REGEX.deviceModel), - os: findMatch(meta, META_REGEX.deviceOS).replace(/\t/g, ' '), - platform: findMatch(meta, META_REGEX.platform), - }, - aircraft: { - model: findMatch(meta, META_REGEX.aircraftModel), - name: findMatch(meta, META_REGEX.aircraftName), - firmware: findMatch(meta, META_REGEX.aircraftFirmware), - }, - battery: { - chargeVolume: parseInt(findMatch(meta, META_REGEX.batteryChargeVolume, true), 10), - remainingLifePercent: parseInt(findMatch(meta, META_REGEX.batteryRemainingLife, true), 10), - discharges: parseInt(findMatch(meta, META_REGEX.batteryDischarges, true), 10), - cells: parseInt(findMatch(meta, META_REGEX.batteryCells, true), 10), - firmware: findMatch(meta, META_REGEX.batteryFirmware), - serialNumber: findMatch(meta, META_REGEX.batterySerialNumber), - }, - flightController: { - serialNumber: findMatch(meta, META_REGEX.fcSerialNumber), - firmware: findMatch(meta, META_REGEX.fcFirmware), - }, - gimbal: { - firmware: findMatch(meta, META_REGEX.gimbalFirmware), - }, - remoteController: { - serialNumber: findMatch(meta, META_REGEX.rcSerialNumber), - firmware: findMatch(meta, META_REGEX.rcFirmware), - }, - camera: { - serialNumber: findMatch(meta, META_REGEX.cameraSerialNumber), - }, - user: { - userId: findMatch(meta, META_REGEX.userId), - organizationId: findMatch(meta, META_REGEX.organizationId), - }, - }; -} -/** - * Parse out the given string and return an object if the string is JSON, return undefined otherwise. - * - * @param info - */ -function parseJsonInfo(info) { - if (!info) { - return undefined; - } - try { - return JSON.parse(info); - } - catch (e) { - return undefined; - } -} -//# sourceMappingURL=parser.js.map \ No newline at end of file diff --git a/dist/lib/src/parser.js.map b/dist/lib/src/parser.js.map deleted file mode 100644 index 740afcf..0000000 --- a/dist/lib/src/parser.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../src/parser.ts"],"names":[],"mappings":";;;AAAA,yCAA8B;A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EAAE;QACR,OAAO,SAAS,CAAC;KAClB;AACH,CAAC"} \ No newline at end of file diff --git a/dist/lib/src/types.js b/dist/lib/src/types.js deleted file mode 100644 index 0663d6b..0000000 --- a/dist/lib/src/types.js +++ /dev/null @@ -1,215 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FLIGHT_MODE_MAPPING_V5 = exports.FLIGHT_MODE_MAPPING_V4 = exports.FlightLogHeader = void 0; -var FlightLogHeader; -(function (FlightLogHeader) { - FlightLogHeader["DateTime"] = "Date/Time (UTC)"; - FlightLogHeader["ElapsedTime"] = "Elapsed Time (sec)"; - FlightLogHeader["Info"] = "Info"; - FlightLogHeader["DeviceLatitude"] = "Device Latitude (Degrees)"; - FlightLogHeader["DeviceLongitude"] = "Device Longitude (Degrees)"; - FlightLogHeader["DeviceLocationLastUpdated"] = "Device Location Last Updated (ms)"; - FlightLogHeader["AircraftBatteryPowerPercent"] = "Aircraft Battery Power (%)"; - FlightLogHeader["AircraftBatteryCharge"] = "Aircraft Battery Charge (mAh)"; - FlightLogHeader["AircraftBatteryCurrent"] = "Aircraft Battery Current (mA)"; - FlightLogHeader["AircraftBatteryVoltage"] = "Aircraft Battery Voltage (mV)"; - FlightLogHeader["AircraftBatteryTemperature"] = "Aircraft Battery Temperature (Fahrenheit)"; - FlightLogHeader["AircraftBatteryLastUpdated"] = "Aircraft Battery Last Updated (ms)"; - FlightLogHeader["AircraftBatteryCell1Voltage"] = "Aircraft Battery Cell 1 Voltage"; - FlightLogHeader["AircraftBatteryCell2Voltage"] = "Aircraft Battery Cell 2 Voltage"; - FlightLogHeader["AircraftBatteryCell3Voltage"] = "Aircraft Battery Cell 3 Voltage"; - FlightLogHeader["AircraftBatteryCell4Voltage"] = "Aircraft Battery Cell 4 Voltage"; - FlightLogHeader["AircraftBatteryCellVoltageLastUpdated"] = "Aircraft Battery Cell Voltage Last Updated (ms)"; - FlightLogHeader["AircraftLatitude"] = "Aircraft Latitude (Degrees)"; - FlightLogHeader["AircraftLongitude"] = "Aircraft Longitude (Degrees)"; - FlightLogHeader["AircraftSpeed"] = "Aircraft Speed (mph)"; - FlightLogHeader["AircraftBarometricAltitude"] = "Aircraft Barometric Altitude (ft)"; - FlightLogHeader["AircraftHeading"] = "Aircraft Heading (Degrees)"; - FlightLogHeader["AircraftVelocityX"] = "Aircraft Vel - X (mph)"; - FlightLogHeader["AircraftVelocityY"] = "Aircraft Vel - Y (mph)"; - FlightLogHeader["AircraftVelocityZ"] = "Aircraft Vel - Z (mph)"; - FlightLogHeader["AircraftPitch"] = "Aircraft Pitch (Degrees)"; - FlightLogHeader["AircraftRoll"] = "Aircraft Roll (Degrees)"; - FlightLogHeader["AircraftSatellites"] = "Aircraft Satellites"; - FlightLogHeader["AircraftMotorsOn"] = "Aircraft Motors On"; - FlightLogHeader["AircraftFlying"] = "Aircraft Flying"; - FlightLogHeader["AircraftFlightMode"] = "Aircraft Flight Mode"; - FlightLogHeader["AircraftFlightModeValue"] = "Aircraft Flight Mode Value"; - FlightLogHeader["AircraftIMUPreheating"] = "Aircraft IMU Preheating"; - FlightLogHeader["AircraftUltrasonicOn"] = "Aircraft Ultrasonic On"; - FlightLogHeader["AircraftUltrasonicAltitude"] = "Aircraft Ultrasonic Altitude (ft)"; - FlightLogHeader["AircraftVisionOn"] = "Aircraft Vision On"; - FlightLogHeader["AircraftGPSSignal"] = "Aircraft GPS Signal"; - FlightLogHeader["AircraftGPSSignalValue"] = "Aircraft GPS Signal Value"; - FlightLogHeader["AircraftNoFly"] = "Aircraft No-fly"; - FlightLogHeader["AircraftNoFlyValue"] = "Aircraft No-fly Value"; - FlightLogHeader["AircraftNoFlyLatitude"] = "Aircraft No-fly Latitude (Degrees)"; - FlightLogHeader["AircraftNoFlyLongitude"] = "Aircraft No-fly Longitude (Degrees)"; - FlightLogHeader["AircraftNoFlyRadius"] = "Aircraft No-fly Radius (ft)"; - FlightLogHeader["HomeLatitude"] = "Home Latitude (Degrees)"; - FlightLogHeader["HomeLongitude"] = "Home Longitude (Degrees)"; - FlightLogHeader["AircraftSmartGoHomeFlightTimeRemaining"] = "Aircraft Smart Go-home Flight Time Remaining (sec)"; - FlightLogHeader["AircraftSmartGoHomeFlightReturnTime"] = "Aircraft Smart Go-home Flight Return Time (sec)"; - FlightLogHeader["AircraftSmartGoHomeLandingTime"] = "Aircraft Smart Go-home Landing Time (sec)"; - FlightLogHeader["AircraftSmartGoHomeReturnPower"] = "Aircraft Smart Go-home Return Power (%)"; - FlightLogHeader["AircraftSmartGoHomeLandingPower"] = "Aircraft Smart Go-home Landing Power (%)"; - FlightLogHeader["AircraftSmartGoHomeRadius"] = "Aircraft Smart Go-home Radius (ft)"; - FlightLogHeader["AircraftSmartGoHomeCountdown"] = "Aircraft Smart Go-home Countdown (sec)"; - FlightLogHeader["AircraftSmartGoHomeRequesting"] = "Aircraft Smart Go-home Requesting"; - FlightLogHeader["AircraftSystemStateLastUpdated"] = "Aircraft System State Last Updated (ms)"; - FlightLogHeader["GimbalPitch"] = "Gimbal Pitch (Degrees)"; - FlightLogHeader["GimbalRoll"] = "Gimbal Roll (Degrees)"; - FlightLogHeader["GimbalYaw"] = "Gimbal Yaw (Degrees)"; - FlightLogHeader["GimbalMode"] = "Gimbal Mode"; - FlightLogHeader["GimbalModeValue"] = "Gimbal Mode Value"; - FlightLogHeader["GimbalPitchAtStop"] = "Gimbal Pitch at Stop"; - FlightLogHeader["GimbalRollAtStop"] = "Gimbal Roll at Stop"; - FlightLogHeader["GimbalYawAtStop"] = "Gimbal Yaw at Stop"; - FlightLogHeader["GimbalStatusLastUpdated"] = "Gimbal Status Last Updated (ms)"; - FlightLogHeader["LandingGearIsMovable"] = "Landing Gear is Movable"; - FlightLogHeader["LandingGearStatus"] = "Landing Gear Status"; - FlightLogHeader["LandingGearStatusValue"] = "Landing Gear Status Value"; - FlightLogHeader["LandingGearMode"] = "Landing Gear Mode"; - FlightLogHeader["LandingGearModeValue"] = "Landing Gear Mode Value"; - FlightLogHeader["LandingGearLastUpdated"] = "Landing Gear Last Updated (ms)"; - FlightLogHeader["RCState"] = "RC State"; - FlightLogHeader["RCStateValue"] = "RC State Value"; - FlightLogHeader["RCLeftHorizontal"] = "RC Left Horizontal"; - FlightLogHeader["RCLeftVertical"] = "RC Left Vertical"; - FlightLogHeader["RCRightHorizontal"] = "RC Right Horizontal"; - FlightLogHeader["RCRightVertical"] = "RC Right Vertical"; - FlightLogHeader["RCLeftWheel"] = "RC Left Wheel"; - FlightLogHeader["RCRightWheel"] = "RC Right Wheel"; - FlightLogHeader["RCLandingGear"] = "RC Landing Gear"; - FlightLogHeader["RCLandingGearValue"] = "RC Landing Gear Value"; - FlightLogHeader["RCGoHome"] = "RC Go Home"; - FlightLogHeader["RCRecord"] = "RC Record "; - FlightLogHeader["RCShutter"] = "RC Shutter"; - FlightLogHeader["RCPlayback"] = "RC Playback"; - FlightLogHeader["RCPause"] = "RC Pause"; - FlightLogHeader["RCCustom1"] = "RC Custom 1"; - FlightLogHeader["RCCustom2"] = "RC Custom 2"; - FlightLogHeader["RCStateLastUpdated"] = "RC State Last Updated (ms)"; - FlightLogHeader["RCBatteryPercentRemaining"] = "RC Battery (%)"; - FlightLogHeader["RCBatteryStateLastUpdated"] = "RC Battery State Last Updated (ms)"; - FlightLogHeader["RCSattelites"] = "RC Sattelites"; - FlightLogHeader["RCHorizontalAccuaracy"] = "RC Horizontal Accuaracy (ft)"; - FlightLogHeader["RCLatitude"] = "RC Latitude (Degrees)"; - FlightLogHeader["RCLongitude"] = "RC Longitude (Degrees)"; - FlightLogHeader["RCGSPDataIsValid"] = "RC GSP Data is Valid"; - FlightLogHeader["RCGPSStateLastUpdated"] = "RC GPS State Last Updated (ms)"; - FlightLogHeader["RCSignal1"] = "RC Signal 1"; - FlightLogHeader["RCSignal2"] = "RC Signal 2"; - FlightLogHeader["RCSignalLastUpdated"] = "RC Signal Last Updated (ms)"; - FlightLogHeader["LBSignal1"] = "LB Signal 1"; - FlightLogHeader["LBSignal2"] = "LB Signal 2"; - FlightLogHeader["LBSignalLastUpdated"] = "LB Signal Last Updated (ms)"; - FlightLogHeader["AircraftCameraMode"] = "Aircraft Camera Mode"; - FlightLogHeader["AircraftCameraModeValue"] = "Aircraft Camera Mode Value"; - FlightLogHeader["AircraftCameraOverheated"] = "Aircraft Camera Overheated"; - FlightLogHeader["AircraftCameraSensorError"] = "Aircraft Camera Sensor Error"; - FlightLogHeader["AircraftCameraRecording"] = "Aircraft Camera Recording"; - FlightLogHeader["AircraftCameraRawCapture"] = "Aircraft Camera Raw Capture"; - FlightLogHeader["AircraftCameraIntervalCapture"] = "Aircraft Camera Interval Capture"; - FlightLogHeader["AircraftCameraBurstCapture"] = "Aircraft Camera Burst Capture"; - FlightLogHeader["AircraftCameraSingleCapture"] = "Aircraft Camera Single Capture"; - FlightLogHeader["AircraftCameraStoringPhoto"] = "Aircraft Camera Storing Photo"; - FlightLogHeader["AircraftCameraStateLastUpdated"] = "Aircraft Camera State Last Updated (ms)"; - FlightLogHeader["AircraftCameraSDCardExists"] = "Aircraft Camera SD Card Exists"; - FlightLogHeader["AircraftCameraSDCardRemainingPercent"] = "Aircraft Camera SD Card Remaining (%)"; - FlightLogHeader["AircraftCameraSDCardStateLastUpdated"] = "Aircraft Camera SD Card State Last Updated (ms)"; - FlightLogHeader["AircraftCameraChangeableLensSupported"] = "Aircraft Camera Changeable Lens Supported"; - FlightLogHeader["AircraftCameraLensInstalled"] = "Aircraft Camera Lens Installed"; - FlightLogHeader["AircraftCameraLensType"] = "Aircraft Camera Lens Type"; - FlightLogHeader["AircraftCameraLensAFEnabled"] = "Aircraft Camera Lens AF Enabled"; - FlightLogHeader["AircraftCameraLensFocusMode"] = "Aircraft Camera Lens Focus Mode"; - FlightLogHeader["AircraftCameraLensFocusModeValue"] = "Aircraft Camera Lens Focus Mode Value"; - FlightLogHeader["AircraftCameraLensFocusStatus"] = "Aircraft Camera Lens Focus Status"; - FlightLogHeader["AircraftCameraLensFocusStatusValue"] = "Aircraft Camera Lens Focus Status Value"; - FlightLogHeader["AircraftCameraLensMFAssistant"] = "Aircraft Camera Lens MF Assistant"; - FlightLogHeader["AircraftCameraLensAFAssistant"] = "Aircraft Camera Lens AF Assistant"; - FlightLogHeader["AircraftCameraLensAssistantWorking"] = "Aircraft Camera Lens Assistant Working"; - FlightLogHeader["AircraftCameraLensStateLastUpdated"] = "Aircraft Camera Lens State Last Updated (ms)"; - FlightLogHeader["CompassIndex"] = "Compass Index"; - FlightLogHeader["CompassSensorValue"] = "Compass Sensor Value"; - FlightLogHeader["CompassState"] = "Compass State"; - FlightLogHeader["CompassStateLastUpdated"] = "Compass State Last Updated (ms)"; - FlightLogHeader["CompassCalibrationState"] = "Compass Calibration State"; - FlightLogHeader["CompassCalibrationLastUpdated"] = "Compass Calibration Last Updated (ms)"; - FlightLogHeader["DeviceToAircraftDistance"] = "Device > Aircraft Distance - XY (ft)"; -})(FlightLogHeader = exports.FlightLogHeader || (exports.FlightLogHeader = {})); -// based off of types in ios/android SDK FlightMode enums -exports.FLIGHT_MODE_MAPPING_V4 = { - 0: 'Manual', - 1: 'Attitude', - 2: 'Attitude Course Lock', - 3: 'Attitude Hover', - 4: 'Hover', - 5: 'GPS Brake', - 6: 'GPS Attitude', - 7: 'GPS Course Lock', - 8: 'GPS Home', - 9: 'GPS Hotpoint', - 10: 'Assisted Takeoff', - 11: 'Auto Takeoff', - 12: 'Auto Landing', - 13: 'Attitude Landing', - 14: 'GPS Waypoint', - 15: 'Go Home', - 16: 'Click Go', - 17: 'Joystick', - 18: 'Attitude Limited', - 19: 'Cinematic', - 23: 'Attitude Limited', - 24: 'Draw', - 25: 'GPS Follow Me', - 26: 'ActiveTrack', - 27: 'TapFly', - 28: 'Pano', - 29: 'Farming', - 30: 'FPV', - 31: 'GPS Sport', - 32: 'GPS Novice', - 33: 'Confirm Landing', - 35: 'Terrain Follow', - 36: 'Palm Control', - 37: 'Quick Shot', - 38: 'Tripod', - 39: 'ActiveTrack Spotlight', - 41: 'Motors Just Started', - 43: 'GPS Gentle', - 255: 'Unknown', -}; -exports.FLIGHT_MODE_MAPPING_V5 = { - 0: 'Manual', - 1: 'Attitude', - 2: 'GPS Normal', - 3: 'POI', - 4: 'Takeoff Ready', - 5: 'Auto Takeoff', - 6: 'Auto Landing', - 7: 'Waypoint', - 8: 'Go Home', - 9: 'Virtual Stick', - 10: 'Smart Flight', - 11: 'Pano', - 12: 'GPS Sport', - 13: 'GPS Tripod', - 14: 'Auto Avoidance', - 15: 'Smart Fly', - 16: 'Force Landing', - 17: 'Attitude Landing', - 18: 'Click Go', - 19: 'Cinematic', - 20: 'Draw', - 21: 'GPS Follow Me', - 22: 'GPS Novice', - 23: 'Quick Movie', - 24: 'Tap Fly', - 25: 'Master Shot', - 26: 'APAS', - 27: 'Timelapse', - 28: 'Motors Start', - 29: 'Unknown', -}; -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/dist/lib/src/types.js.map b/dist/lib/src/types.js.map deleted file mode 100644 index 16f1a19..0000000 --- a/dist/lib/src/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":";;;AAAA,IAAY,eAuIX;AAvID,WAAY,eAAe;IACzB,+CAA4B,CAAA;IAC5B,qDAAkC,CAAA;IAClC,gCAAa,CAAA;IACb,+DAA4C,CAAA;IAC5C,iEAA8C,CAAA;IAC9C,kFAA+D,CAAA;IAC/D,6EAA0D,CAAA;IAC1D,0EAAuD,CAAA;IACvD,2EAAwD,CAAA;IACxD,2EAAwD,CAAA;IACxD,2FAAwE,CAAA;IACxE,oFAAiE,CAAA;IACjE,kFAA+D,CAAA;IAC/D,kFAA+D,CAAA;IAC/D,kFAA+D,CAAA;IAC/D,kFAA+D,CAAA;IAC/D,4GAAyF,CAAA;IACzF,mEAAgD,CAAA;IAChD,qEAAkD,CAAA;IAClD,yDAAsC,CAAA;IACtC,mFAAgE,CAAA;IAChE,iEAA8C,CAAA;IAC9C,+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AAE,EAAE,MAAM;IACV,EAAE,EAAE,WAAW;IACf,EAAE,EAAE,YAAY;IAChB,EAAE,EAAE,gBAAgB;IACpB,EAAE,EAAE,WAAW;IACf,EAAE,EAAE,eAAe;IACnB,EAAE,EAAE,kBAAkB;IACtB,EAAE,EAAE,UAAU;IACd,EAAE,EAAE,WAAW;IACf,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,eAAe;IACnB,EAAE,EAAE,YAAY;IAChB,EAAE,EAAE,aAAa;IACjB,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,aAAa;IACjB,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,WAAW;IACf,EAAE,EAAE,cAAc;IAClB,EAAE,EAAE,SAAS;CACd,CAAC"} \ No newline at end of file diff --git a/dist/lib/types.js b/dist/lib/types.js deleted file mode 100644 index 0663d6b..0000000 --- a/dist/lib/types.js +++ /dev/null @@ -1,215 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FLIGHT_MODE_MAPPING_V5 = exports.FLIGHT_MODE_MAPPING_V4 = exports.FlightLogHeader = void 0; -var FlightLogHeader; -(function (FlightLogHeader) { - FlightLogHeader["DateTime"] = "Date/Time (UTC)"; - FlightLogHeader["ElapsedTime"] = "Elapsed Time (sec)"; - FlightLogHeader["Info"] = "Info"; - FlightLogHeader["DeviceLatitude"] = "Device Latitude (Degrees)"; - FlightLogHeader["DeviceLongitude"] = "Device Longitude (Degrees)"; - FlightLogHeader["DeviceLocationLastUpdated"] = "Device Location Last Updated (ms)"; - FlightLogHeader["AircraftBatteryPowerPercent"] = "Aircraft Battery Power (%)"; - FlightLogHeader["AircraftBatteryCharge"] = "Aircraft Battery Charge (mAh)"; - FlightLogHeader["AircraftBatteryCurrent"] = "Aircraft Battery Current (mA)"; - FlightLogHeader["AircraftBatteryVoltage"] = "Aircraft Battery Voltage (mV)"; - FlightLogHeader["AircraftBatteryTemperature"] = "Aircraft Battery Temperature (Fahrenheit)"; - FlightLogHeader["AircraftBatteryLastUpdated"] = "Aircraft Battery Last Updated (ms)"; - FlightLogHeader["AircraftBatteryCell1Voltage"] = "Aircraft Battery Cell 1 Voltage"; - FlightLogHeader["AircraftBatteryCell2Voltage"] = "Aircraft Battery Cell 2 Voltage"; - FlightLogHeader["AircraftBatteryCell3Voltage"] = "Aircraft Battery Cell 3 Voltage"; - FlightLogHeader["AircraftBatteryCell4Voltage"] = "Aircraft Battery Cell 4 Voltage"; - FlightLogHeader["AircraftBatteryCellVoltageLastUpdated"] = "Aircraft Battery Cell Voltage Last Updated (ms)"; - FlightLogHeader["AircraftLatitude"] = "Aircraft Latitude (Degrees)"; - FlightLogHeader["AircraftLongitude"] = "Aircraft Longitude (Degrees)"; - FlightLogHeader["AircraftSpeed"] = "Aircraft Speed (mph)"; - FlightLogHeader["AircraftBarometricAltitude"] = "Aircraft Barometric Altitude (ft)"; - FlightLogHeader["AircraftHeading"] = "Aircraft Heading (Degrees)"; - FlightLogHeader["AircraftVelocityX"] = "Aircraft Vel - X (mph)"; - FlightLogHeader["AircraftVelocityY"] = "Aircraft Vel - Y (mph)"; - FlightLogHeader["AircraftVelocityZ"] = "Aircraft Vel - Z (mph)"; - FlightLogHeader["AircraftPitch"] = "Aircraft Pitch (Degrees)"; - FlightLogHeader["AircraftRoll"] = "Aircraft Roll (Degrees)"; - FlightLogHeader["AircraftSatellites"] = "Aircraft Satellites"; - FlightLogHeader["AircraftMotorsOn"] = "Aircraft Motors On"; - FlightLogHeader["AircraftFlying"] = "Aircraft Flying"; - FlightLogHeader["AircraftFlightMode"] = "Aircraft Flight Mode"; - FlightLogHeader["AircraftFlightModeValue"] = "Aircraft Flight Mode Value"; - FlightLogHeader["AircraftIMUPreheating"] = "Aircraft IMU Preheating"; - FlightLogHeader["AircraftUltrasonicOn"] = "Aircraft Ultrasonic On"; - FlightLogHeader["AircraftUltrasonicAltitude"] = "Aircraft Ultrasonic Altitude (ft)"; - FlightLogHeader["AircraftVisionOn"] = "Aircraft Vision On"; - FlightLogHeader["AircraftGPSSignal"] = "Aircraft GPS Signal"; - FlightLogHeader["AircraftGPSSignalValue"] = "Aircraft GPS Signal Value"; - FlightLogHeader["AircraftNoFly"] = "Aircraft No-fly"; - FlightLogHeader["AircraftNoFlyValue"] = "Aircraft No-fly Value"; - FlightLogHeader["AircraftNoFlyLatitude"] = "Aircraft No-fly Latitude (Degrees)"; - FlightLogHeader["AircraftNoFlyLongitude"] = "Aircraft No-fly Longitude (Degrees)"; - FlightLogHeader["AircraftNoFlyRadius"] = "Aircraft No-fly Radius (ft)"; - FlightLogHeader["HomeLatitude"] = "Home Latitude (Degrees)"; - FlightLogHeader["HomeLongitude"] = "Home Longitude (Degrees)"; - FlightLogHeader["AircraftSmartGoHomeFlightTimeRemaining"] = "Aircraft Smart Go-home Flight Time Remaining (sec)"; - FlightLogHeader["AircraftSmartGoHomeFlightReturnTime"] = "Aircraft Smart Go-home Flight Return Time (sec)"; - FlightLogHeader["AircraftSmartGoHomeLandingTime"] = "Aircraft Smart Go-home Landing Time (sec)"; - FlightLogHeader["AircraftSmartGoHomeReturnPower"] = "Aircraft Smart Go-home Return Power (%)"; - FlightLogHeader["AircraftSmartGoHomeLandingPower"] = "Aircraft Smart Go-home Landing Power (%)"; - FlightLogHeader["AircraftSmartGoHomeRadius"] = "Aircraft Smart Go-home Radius (ft)"; - FlightLogHeader["AircraftSmartGoHomeCountdown"] = "Aircraft Smart Go-home Countdown (sec)"; - FlightLogHeader["AircraftSmartGoHomeRequesting"] = "Aircraft Smart Go-home Requesting"; - FlightLogHeader["AircraftSystemStateLastUpdated"] = "Aircraft System State Last Updated (ms)"; - FlightLogHeader["GimbalPitch"] = "Gimbal Pitch (Degrees)"; - FlightLogHeader["GimbalRoll"] = "Gimbal Roll (Degrees)"; - FlightLogHeader["GimbalYaw"] = "Gimbal Yaw (Degrees)"; - FlightLogHeader["GimbalMode"] = "Gimbal Mode"; - FlightLogHeader["GimbalModeValue"] = "Gimbal Mode Value"; - FlightLogHeader["GimbalPitchAtStop"] = "Gimbal Pitch at Stop"; - FlightLogHeader["GimbalRollAtStop"] = "Gimbal Roll at Stop"; - FlightLogHeader["GimbalYawAtStop"] = "Gimbal Yaw at Stop"; - FlightLogHeader["GimbalStatusLastUpdated"] = "Gimbal Status Last Updated (ms)"; - FlightLogHeader["LandingGearIsMovable"] = "Landing Gear is Movable"; - FlightLogHeader["LandingGearStatus"] = "Landing Gear Status"; - FlightLogHeader["LandingGearStatusValue"] = "Landing Gear Status Value"; - FlightLogHeader["LandingGearMode"] = "Landing Gear Mode"; - FlightLogHeader["LandingGearModeValue"] = "Landing Gear Mode Value"; - FlightLogHeader["LandingGearLastUpdated"] = "Landing Gear Last Updated (ms)"; - FlightLogHeader["RCState"] = "RC State"; - FlightLogHeader["RCStateValue"] = "RC State Value"; - FlightLogHeader["RCLeftHorizontal"] = "RC Left Horizontal"; - FlightLogHeader["RCLeftVertical"] = "RC Left Vertical"; - FlightLogHeader["RCRightHorizontal"] = "RC Right Horizontal"; - FlightLogHeader["RCRightVertical"] = "RC Right Vertical"; - FlightLogHeader["RCLeftWheel"] = "RC Left Wheel"; - FlightLogHeader["RCRightWheel"] = "RC Right Wheel"; - FlightLogHeader["RCLandingGear"] = "RC Landing Gear"; - FlightLogHeader["RCLandingGearValue"] = "RC Landing Gear Value"; - FlightLogHeader["RCGoHome"] = "RC Go Home"; - FlightLogHeader["RCRecord"] = "RC Record "; - FlightLogHeader["RCShutter"] = "RC Shutter"; - FlightLogHeader["RCPlayback"] = "RC Playback"; - FlightLogHeader["RCPause"] = "RC Pause"; - FlightLogHeader["RCCustom1"] = "RC Custom 1"; - FlightLogHeader["RCCustom2"] = "RC Custom 2"; - FlightLogHeader["RCStateLastUpdated"] = "RC State Last Updated (ms)"; - FlightLogHeader["RCBatteryPercentRemaining"] = "RC Battery (%)"; - FlightLogHeader["RCBatteryStateLastUpdated"] = "RC Battery State Last Updated (ms)"; - FlightLogHeader["RCSattelites"] = "RC Sattelites"; - FlightLogHeader["RCHorizontalAccuaracy"] = "RC Horizontal Accuaracy (ft)"; - FlightLogHeader["RCLatitude"] = "RC Latitude (Degrees)"; - FlightLogHeader["RCLongitude"] = "RC Longitude (Degrees)"; - FlightLogHeader["RCGSPDataIsValid"] = "RC GSP Data is Valid"; - FlightLogHeader["RCGPSStateLastUpdated"] = "RC GPS State Last Updated (ms)"; - FlightLogHeader["RCSignal1"] = "RC Signal 1"; - FlightLogHeader["RCSignal2"] = "RC Signal 2"; - FlightLogHeader["RCSignalLastUpdated"] = "RC Signal Last Updated (ms)"; - FlightLogHeader["LBSignal1"] = "LB Signal 1"; - FlightLogHeader["LBSignal2"] = "LB Signal 2"; - FlightLogHeader["LBSignalLastUpdated"] = "LB Signal Last Updated (ms)"; - FlightLogHeader["AircraftCameraMode"] = "Aircraft Camera Mode"; - FlightLogHeader["AircraftCameraModeValue"] = "Aircraft Camera Mode Value"; - FlightLogHeader["AircraftCameraOverheated"] = "Aircraft Camera Overheated"; - FlightLogHeader["AircraftCameraSensorError"] = "Aircraft Camera Sensor Error"; - FlightLogHeader["AircraftCameraRecording"] = "Aircraft Camera Recording"; - FlightLogHeader["AircraftCameraRawCapture"] = "Aircraft Camera Raw Capture"; - FlightLogHeader["AircraftCameraIntervalCapture"] = "Aircraft Camera Interval Capture"; - FlightLogHeader["AircraftCameraBurstCapture"] = "Aircraft Camera Burst Capture"; - FlightLogHeader["AircraftCameraSingleCapture"] = "Aircraft Camera Single Capture"; - FlightLogHeader["AircraftCameraStoringPhoto"] = "Aircraft Camera Storing Photo"; - FlightLogHeader["AircraftCameraStateLastUpdated"] = "Aircraft Camera State Last Updated (ms)"; - FlightLogHeader["AircraftCameraSDCardExists"] = "Aircraft Camera SD Card Exists"; - FlightLogHeader["AircraftCameraSDCardRemainingPercent"] = "Aircraft Camera SD Card Remaining (%)"; - FlightLogHeader["AircraftCameraSDCardStateLastUpdated"] = "Aircraft Camera SD Card State Last Updated (ms)"; - FlightLogHeader["AircraftCameraChangeableLensSupported"] = "Aircraft Camera Changeable Lens Supported"; - FlightLogHeader["AircraftCameraLensInstalled"] = "Aircraft Camera Lens Installed"; - FlightLogHeader["AircraftCameraLensType"] = "Aircraft Camera Lens Type"; - FlightLogHeader["AircraftCameraLensAFEnabled"] = "Aircraft Camera Lens AF Enabled"; - FlightLogHeader["AircraftCameraLensFocusMode"] = "Aircraft Camera Lens Focus Mode"; - FlightLogHeader["AircraftCameraLensFocusModeValue"] = "Aircraft Camera Lens Focus Mode Value"; - FlightLogHeader["AircraftCameraLensFocusStatus"] = "Aircraft Camera Lens Focus Status"; - FlightLogHeader["AircraftCameraLensFocusStatusValue"] = "Aircraft Camera Lens Focus Status Value"; - FlightLogHeader["AircraftCameraLensMFAssistant"] = "Aircraft Camera Lens MF Assistant"; - FlightLogHeader["AircraftCameraLensAFAssistant"] = "Aircraft Camera Lens AF Assistant"; - FlightLogHeader["AircraftCameraLensAssistantWorking"] = "Aircraft Camera Lens Assistant Working"; - FlightLogHeader["AircraftCameraLensStateLastUpdated"] = "Aircraft Camera Lens State Last Updated (ms)"; - FlightLogHeader["CompassIndex"] = "Compass Index"; - FlightLogHeader["CompassSensorValue"] = "Compass Sensor Value"; - FlightLogHeader["CompassState"] = "Compass State"; - FlightLogHeader["CompassStateLastUpdated"] = "Compass State Last Updated (ms)"; - FlightLogHeader["CompassCalibrationState"] = "Compass Calibration State"; - FlightLogHeader["CompassCalibrationLastUpdated"] = "Compass Calibration Last Updated (ms)"; - FlightLogHeader["DeviceToAircraftDistance"] = "Device > Aircraft Distance - XY (ft)"; -})(FlightLogHeader = exports.FlightLogHeader || (exports.FlightLogHeader = {})); -// based off of types in ios/android SDK FlightMode enums -exports.FLIGHT_MODE_MAPPING_V4 = { - 0: 'Manual', - 1: 'Attitude', - 2: 'Attitude Course Lock', - 3: 'Attitude Hover', - 4: 'Hover', - 5: 'GPS Brake', - 6: 'GPS Attitude', - 7: 'GPS Course Lock', - 8: 'GPS Home', - 9: 'GPS Hotpoint', - 10: 'Assisted Takeoff', - 11: 'Auto Takeoff', - 12: 'Auto Landing', - 13: 'Attitude Landing', - 14: 'GPS Waypoint', - 15: 'Go Home', - 16: 'Click Go', - 17: 'Joystick', - 18: 'Attitude Limited', - 19: 'Cinematic', - 23: 'Attitude Limited', - 24: 'Draw', - 25: 'GPS Follow Me', - 26: 'ActiveTrack', - 27: 'TapFly', - 28: 'Pano', - 29: 'Farming', - 30: 'FPV', - 31: 'GPS Sport', - 32: 'GPS Novice', - 33: 'Confirm Landing', - 35: 'Terrain Follow', - 36: 'Palm Control', - 37: 'Quick Shot', - 38: 'Tripod', - 39: 'ActiveTrack Spotlight', - 41: 'Motors Just Started', - 43: 'GPS Gentle', - 255: 'Unknown', -}; -exports.FLIGHT_MODE_MAPPING_V5 = { - 0: 'Manual', - 1: 'Attitude', - 2: 'GPS Normal', - 3: 'POI', - 4: 'Takeoff Ready', - 5: 'Auto Takeoff', - 6: 'Auto Landing', - 7: 'Waypoint', - 8: 'Go Home', - 9: 'Virtual Stick', - 10: 'Smart Flight', - 11: 'Pano', - 12: 'GPS Sport', - 13: 'GPS Tripod', - 14: 'Auto Avoidance', - 15: 'Smart Fly', - 16: 'Force Landing', - 17: 'Attitude Landing', - 18: 'Click Go', - 19: 'Cinematic', - 20: 'Draw', - 21: 'GPS Follow Me', - 22: 'GPS Novice', - 23: 'Quick Movie', - 24: 'Tap Fly', - 25: 'Master Shot', - 26: 'APAS', - 27: 'Timelapse', - 28: 'Motors Start', - 29: 'Unknown', -}; -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/dist/lib/types.js.map b/dist/lib/types.js.map deleted file mode 100644 index 6fde9d4..0000000 --- a/dist/lib/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAAA,IAAY,eAuIX;AAvID,WAAY,eAAe;IACzB,+CAA4B,CAAA;IAC5B,qDAAkC,CAAA;IAClC,gCAAa,CAAA;IACb,+DAA4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EAAE,uBAAuB;IAC3B,EAAE,EAAE,qBAAqB;IACzB,EAAE,EAAE,YAAY;IAChB,GAAG,EAAE,SAAS;CACf,CAAC;AAEW,QAAA,sBAAsB,GAAG;IACpC,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,UAAU;IACb,CAAC,EAAE,YAAY;IACf,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,eAAe;IAClB,CAAC,EAAE,cAAc;IACjB,CAAC,EAAE,cAAc;IACjB,CAAC,EAAE,UAAU;IACb,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,eAAe;IAClB,EAAE,EAAE,cAAc;IAClB,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,WAAW;IACf,EAAE,EAAE,YAAY;IAChB,EAAE,EAAE,gBAAgB;IACpB,EAAE,EAAE,WAAW;IACf,EAAE,EAAE,eAAe;IACnB,EAAE,EAAE,kBAAkB;IACtB,EAAE,EAAE,UAAU;IACd,EAAE,EAAE,WAAW;IACf,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,eAAe;IACnB,EAAE,EAAE,YAAY;IAChB,EAAE,EAAE,aAAa;IACjB,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,aAAa;IACjB,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,WAAW;IACf,EAAE,EAAE,cAAc;IAClB,EAAE,EAAE,SAAS;CACd,CAAC"} \ No newline at end of file diff --git a/dist/types/__test__/android.test.d.ts b/dist/types/__test__/android.test.d.ts deleted file mode 100644 index d73a958..0000000 --- a/dist/types/__test__/android.test.d.ts +++ /dev/null @@ -1 +0,0 @@ -import 'jest'; diff --git a/dist/types/__test__/invalid-logs.test.d.ts b/dist/types/__test__/invalid-logs.test.d.ts deleted file mode 100644 index d73a958..0000000 --- a/dist/types/__test__/invalid-logs.test.d.ts +++ /dev/null @@ -1 +0,0 @@ -import 'jest'; diff --git a/dist/types/__test__/ios.test.d.ts b/dist/types/__test__/ios.test.d.ts deleted file mode 100644 index d73a958..0000000 --- a/dist/types/__test__/ios.test.d.ts +++ /dev/null @@ -1 +0,0 @@ -import 'jest'; diff --git a/dist/types/__test__/json-info.test.d.ts b/dist/types/__test__/json-info.test.d.ts deleted file mode 100644 index d73a958..0000000 --- a/dist/types/__test__/json-info.test.d.ts +++ /dev/null @@ -1 +0,0 @@ -import 'jest'; diff --git a/dist/types/__test__/parser.test.d.ts b/dist/types/__test__/parser.test.d.ts deleted file mode 100644 index d73a958..0000000 --- a/dist/types/__test__/parser.test.d.ts +++ /dev/null @@ -1 +0,0 @@ -import 'jest'; diff --git a/dist/types/__test__/testutil.d.ts b/dist/types/__test__/testutil.d.ts deleted file mode 100644 index ea1b401..0000000 --- a/dist/types/__test__/testutil.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare function getIosLogs(): Promise<{ - ipad: any; - ipadmin: any; - iphone: any; - errorLog: any; -}>; diff --git a/dist/types/field-types.d.ts b/dist/types/field-types.d.ts index db8b23a..df6380a 100644 --- a/dist/types/field-types.d.ts +++ b/dist/types/field-types.d.ts @@ -1,5 +1,5 @@ -import { FlightLogHeader } from './types'; -export declare const INT_FIELDS: Set; -export declare const FLOAT_FIELDS: Set; -export declare const BOOL_FIELDS: Set; -export declare const DATE_FIELDS: Set; +import { FlightLogHeader } from './types'; +export declare const INT_FIELDS: Set; +export declare const FLOAT_FIELDS: Set; +export declare const BOOL_FIELDS: Set; +export declare const DATE_FIELDS: Set; diff --git a/dist/types/flight-log-parser.d.ts b/dist/types/flight-log-parser.d.ts index 5d416fe..6937b92 100644 --- a/dist/types/flight-log-parser.d.ts +++ b/dist/types/flight-log-parser.d.ts @@ -1,2 +1,2 @@ -export { FlightLog, FlightLogEvent, FlightLogHeader, FlightLogMetaData, FlightLogRow, FLIGHT_MODE_MAPPING_V4, FLIGHT_MODE_MAPPING_V5, } from './types'; -export { parseLog, parseLogStream, QuasiSubject, QuasiObservable, fromUtcDateStr } from './parser'; +export { FlightLog, FlightLogEvent, FlightLogHeader, FlightLogMetaData, FlightLogRow, FLIGHT_MODE_MAPPING_V4, FLIGHT_MODE_MAPPING_V5, } from './types'; +export { parseLog, parseLogStream, QuasiSubject, QuasiObservable, fromUtcDateStr } from './parser'; diff --git a/dist/types/parser.d.ts b/dist/types/parser.d.ts index b831c42..5a11c21 100644 --- a/dist/types/parser.d.ts +++ b/dist/types/parser.d.ts @@ -1,22 +1,22 @@ -import { FlightLog, FlightLogEvent } from './types'; -export type Subscriber = (value: T) => void; -export type ErrorSubscriber = (value: any) => void; -export type CompletionSubscriber = () => void; -export interface QuasiObservable { - subscribe(sub: Subscriber, errSub?: ErrorSubscriber, completionSub?: CompletionSubscriber): void; - toPromise(): Promise; -} -export declare class QuasiSubject implements QuasiObservable { - private subscribers; - private errorSubscribers; - private completionSubscribers; - private isFinished; - next(value: T): void; - complete(): void; - error(error: any): void; - subscribe(sub: Subscriber, errSub?: ErrorSubscriber, completionSub?: CompletionSubscriber): void; - toPromise(): Promise; -} -export declare function parseLogStream(logStream: QuasiSubject): QuasiObservable; -export declare function parseLog(log: String): Promise; -export declare function fromUtcDateStr(utcDateStr: string): Date | null; +import { FlightLog, FlightLogEvent } from './types'; +export type Subscriber = (value: T) => void; +export type ErrorSubscriber = (value: any) => void; +export type CompletionSubscriber = () => void; +export interface QuasiObservable { + subscribe(sub: Subscriber, errSub?: ErrorSubscriber, completionSub?: CompletionSubscriber): void; + toPromise(): Promise; +} +export declare class QuasiSubject implements QuasiObservable { + private subscribers; + private errorSubscribers; + private completionSubscribers; + private isFinished; + next(value: T): void; + complete(): void; + error(error: any): void; + subscribe(sub: Subscriber, errSub?: ErrorSubscriber, completionSub?: CompletionSubscriber): void; + toPromise(): Promise; +} +export declare function parseLogStream(logStream: QuasiSubject): QuasiObservable; +export declare function parseLog(log: String): Promise; +export declare function fromUtcDateStr(utcDateStr: string): Date | null; diff --git a/dist/types/rollup.config.d.ts b/dist/types/rollup.config.d.ts deleted file mode 100644 index d81fdb5..0000000 --- a/dist/types/rollup.config.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -declare const _default: { - input: string; - output: ({ - file: any; - name: any; - format: string; - sourcemap: boolean; - } | { - file: any; - format: string; - sourcemap: boolean; - name?: undefined; - })[]; - external: never[]; - watch: { - include: string; - }; - plugins: any[]; -}; -export default _default; diff --git a/dist/types/src/__test__/android.test.d.ts b/dist/types/src/__test__/android.test.d.ts deleted file mode 100644 index d73a958..0000000 --- a/dist/types/src/__test__/android.test.d.ts +++ /dev/null @@ -1 +0,0 @@ -import 'jest'; diff --git a/dist/types/src/__test__/invalid-logs.test.d.ts b/dist/types/src/__test__/invalid-logs.test.d.ts deleted file mode 100644 index d73a958..0000000 --- a/dist/types/src/__test__/invalid-logs.test.d.ts +++ /dev/null @@ -1 +0,0 @@ -import 'jest'; diff --git a/dist/types/src/__test__/ios.test.d.ts b/dist/types/src/__test__/ios.test.d.ts deleted file mode 100644 index d73a958..0000000 --- a/dist/types/src/__test__/ios.test.d.ts +++ /dev/null @@ -1 +0,0 @@ -import 'jest'; diff --git a/dist/types/src/__test__/json-info.test.d.ts b/dist/types/src/__test__/json-info.test.d.ts deleted file mode 100644 index d73a958..0000000 --- a/dist/types/src/__test__/json-info.test.d.ts +++ /dev/null @@ -1 +0,0 @@ -import 'jest'; diff --git a/dist/types/src/__test__/parser.test.d.ts b/dist/types/src/__test__/parser.test.d.ts deleted file mode 100644 index d73a958..0000000 --- a/dist/types/src/__test__/parser.test.d.ts +++ /dev/null @@ -1 +0,0 @@ -import 'jest'; diff --git a/dist/types/src/__test__/testutil.d.ts b/dist/types/src/__test__/testutil.d.ts deleted file mode 100644 index ea1b401..0000000 --- a/dist/types/src/__test__/testutil.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare function getIosLogs(): Promise<{ - ipad: any; - ipadmin: any; - iphone: any; - errorLog: any; -}>; diff --git a/dist/types/src/field-types.d.ts b/dist/types/src/field-types.d.ts deleted file mode 100644 index db8b23a..0000000 --- a/dist/types/src/field-types.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { FlightLogHeader } from './types'; -export declare const INT_FIELDS: Set; -export declare const FLOAT_FIELDS: Set; -export declare const BOOL_FIELDS: Set; -export declare const DATE_FIELDS: Set; diff --git a/dist/types/src/flight-log-parser.d.ts b/dist/types/src/flight-log-parser.d.ts deleted file mode 100644 index 5d416fe..0000000 --- a/dist/types/src/flight-log-parser.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { FlightLog, FlightLogEvent, FlightLogHeader, FlightLogMetaData, FlightLogRow, FLIGHT_MODE_MAPPING_V4, FLIGHT_MODE_MAPPING_V5, } from './types'; -export { parseLog, parseLogStream, QuasiSubject, QuasiObservable, fromUtcDateStr } from './parser'; diff --git a/dist/types/src/parser.d.ts b/dist/types/src/parser.d.ts deleted file mode 100644 index b831c42..0000000 --- a/dist/types/src/parser.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { FlightLog, FlightLogEvent } from './types'; -export type Subscriber = (value: T) => void; -export type ErrorSubscriber = (value: any) => void; -export type CompletionSubscriber = () => void; -export interface QuasiObservable { - subscribe(sub: Subscriber, errSub?: ErrorSubscriber, completionSub?: CompletionSubscriber): void; - toPromise(): Promise; -} -export declare class QuasiSubject implements QuasiObservable { - private subscribers; - private errorSubscribers; - private completionSubscribers; - private isFinished; - next(value: T): void; - complete(): void; - error(error: any): void; - subscribe(sub: Subscriber, errSub?: ErrorSubscriber, completionSub?: CompletionSubscriber): void; - toPromise(): Promise; -} -export declare function parseLogStream(logStream: QuasiSubject): QuasiObservable; -export declare function parseLog(log: String): Promise; -export declare function fromUtcDateStr(utcDateStr: string): Date | null; diff --git a/dist/types/src/types.d.ts b/dist/types/src/types.d.ts deleted file mode 100644 index 1807597..0000000 --- a/dist/types/src/types.d.ts +++ /dev/null @@ -1,268 +0,0 @@ -export declare enum FlightLogHeader { - DateTime = "Date/Time (UTC)", - ElapsedTime = "Elapsed Time (sec)", - Info = "Info", - DeviceLatitude = "Device Latitude (Degrees)", - DeviceLongitude = "Device Longitude (Degrees)", - DeviceLocationLastUpdated = "Device Location Last Updated (ms)", - AircraftBatteryPowerPercent = "Aircraft Battery Power (%)", - AircraftBatteryCharge = "Aircraft Battery Charge (mAh)", - AircraftBatteryCurrent = "Aircraft Battery Current (mA)", - AircraftBatteryVoltage = "Aircraft Battery Voltage (mV)", - AircraftBatteryTemperature = "Aircraft Battery Temperature (Fahrenheit)", - AircraftBatteryLastUpdated = "Aircraft Battery Last Updated (ms)", - AircraftBatteryCell1Voltage = "Aircraft Battery Cell 1 Voltage", - AircraftBatteryCell2Voltage = "Aircraft Battery Cell 2 Voltage", - AircraftBatteryCell3Voltage = "Aircraft Battery Cell 3 Voltage", - AircraftBatteryCell4Voltage = "Aircraft Battery Cell 4 Voltage", - AircraftBatteryCellVoltageLastUpdated = "Aircraft Battery Cell Voltage Last Updated (ms)", - AircraftLatitude = "Aircraft Latitude (Degrees)", - AircraftLongitude = "Aircraft Longitude (Degrees)", - AircraftSpeed = "Aircraft Speed (mph)", - AircraftBarometricAltitude = "Aircraft Barometric Altitude (ft)", - AircraftHeading = "Aircraft Heading (Degrees)", - AircraftVelocityX = "Aircraft Vel - X (mph)", - AircraftVelocityY = "Aircraft Vel - Y (mph)", - AircraftVelocityZ = "Aircraft Vel - Z (mph)", - AircraftPitch = "Aircraft Pitch (Degrees)", - AircraftRoll = "Aircraft Roll (Degrees)", - AircraftSatellites = "Aircraft Satellites", - AircraftMotorsOn = "Aircraft Motors On", - AircraftFlying = "Aircraft Flying", - AircraftFlightMode = "Aircraft Flight Mode", - AircraftFlightModeValue = "Aircraft Flight Mode Value", - AircraftIMUPreheating = "Aircraft IMU Preheating", - AircraftUltrasonicOn = "Aircraft Ultrasonic On", - AircraftUltrasonicAltitude = "Aircraft Ultrasonic Altitude (ft)", - AircraftVisionOn = "Aircraft Vision On", - AircraftGPSSignal = "Aircraft GPS Signal", - AircraftGPSSignalValue = "Aircraft GPS Signal Value", - AircraftNoFly = "Aircraft No-fly", - AircraftNoFlyValue = "Aircraft No-fly Value", - AircraftNoFlyLatitude = "Aircraft No-fly Latitude (Degrees)", - AircraftNoFlyLongitude = "Aircraft No-fly Longitude (Degrees)", - AircraftNoFlyRadius = "Aircraft No-fly Radius (ft)", - HomeLatitude = "Home Latitude (Degrees)", - HomeLongitude = "Home Longitude (Degrees)", - AircraftSmartGoHomeFlightTimeRemaining = "Aircraft Smart Go-home Flight Time Remaining (sec)", - AircraftSmartGoHomeFlightReturnTime = "Aircraft Smart Go-home Flight Return Time (sec)", - AircraftSmartGoHomeLandingTime = "Aircraft Smart Go-home Landing Time (sec)", - AircraftSmartGoHomeReturnPower = "Aircraft Smart Go-home Return Power (%)", - AircraftSmartGoHomeLandingPower = "Aircraft Smart Go-home Landing Power (%)", - AircraftSmartGoHomeRadius = "Aircraft Smart Go-home Radius (ft)", - AircraftSmartGoHomeCountdown = "Aircraft Smart Go-home Countdown (sec)", - AircraftSmartGoHomeRequesting = "Aircraft Smart Go-home Requesting", - AircraftSystemStateLastUpdated = "Aircraft System State Last Updated (ms)", - GimbalPitch = "Gimbal Pitch (Degrees)", - GimbalRoll = "Gimbal Roll (Degrees)", - GimbalYaw = "Gimbal Yaw (Degrees)", - GimbalMode = "Gimbal Mode", - GimbalModeValue = "Gimbal Mode Value", - GimbalPitchAtStop = "Gimbal Pitch at Stop", - GimbalRollAtStop = "Gimbal Roll at Stop", - GimbalYawAtStop = "Gimbal Yaw at Stop", - GimbalStatusLastUpdated = "Gimbal Status Last Updated (ms)", - LandingGearIsMovable = "Landing Gear is Movable", - LandingGearStatus = "Landing Gear Status", - LandingGearStatusValue = "Landing Gear Status Value", - LandingGearMode = "Landing Gear Mode", - LandingGearModeValue = "Landing Gear Mode Value", - LandingGearLastUpdated = "Landing Gear Last Updated (ms)", - RCState = "RC State", - RCStateValue = "RC State Value", - RCLeftHorizontal = "RC Left Horizontal", - RCLeftVertical = "RC Left Vertical", - RCRightHorizontal = "RC Right Horizontal", - RCRightVertical = "RC Right Vertical", - RCLeftWheel = "RC Left Wheel", - RCRightWheel = "RC Right Wheel", - RCLandingGear = "RC Landing Gear", - RCLandingGearValue = "RC Landing Gear Value", - RCGoHome = "RC Go Home", - RCRecord = "RC Record ", - RCShutter = "RC Shutter", - RCPlayback = "RC Playback", - RCPause = "RC Pause", - RCCustom1 = "RC Custom 1", - RCCustom2 = "RC Custom 2", - RCStateLastUpdated = "RC State Last Updated (ms)", - RCBatteryPercentRemaining = "RC Battery (%)", - RCBatteryStateLastUpdated = "RC Battery State Last Updated (ms)", - RCSattelites = "RC Sattelites", - RCHorizontalAccuaracy = "RC Horizontal Accuaracy (ft)", - RCLatitude = "RC Latitude (Degrees)", - RCLongitude = "RC Longitude (Degrees)", - RCGSPDataIsValid = "RC GSP Data is Valid", - RCGPSStateLastUpdated = "RC GPS State Last Updated (ms)", - RCSignal1 = "RC Signal 1", - RCSignal2 = "RC Signal 2", - RCSignalLastUpdated = "RC Signal Last Updated (ms)", - LBSignal1 = "LB Signal 1", - LBSignal2 = "LB Signal 2", - LBSignalLastUpdated = "LB Signal Last Updated (ms)", - AircraftCameraMode = "Aircraft Camera Mode", - AircraftCameraModeValue = "Aircraft Camera Mode Value", - AircraftCameraOverheated = "Aircraft Camera Overheated", - AircraftCameraSensorError = "Aircraft Camera Sensor Error", - AircraftCameraRecording = "Aircraft Camera Recording", - AircraftCameraRawCapture = "Aircraft Camera Raw Capture", - AircraftCameraIntervalCapture = "Aircraft Camera Interval Capture", - AircraftCameraBurstCapture = "Aircraft Camera Burst Capture", - AircraftCameraSingleCapture = "Aircraft Camera Single Capture", - AircraftCameraStoringPhoto = "Aircraft Camera Storing Photo", - AircraftCameraStateLastUpdated = "Aircraft Camera State Last Updated (ms)", - AircraftCameraSDCardExists = "Aircraft Camera SD Card Exists", - AircraftCameraSDCardRemainingPercent = "Aircraft Camera SD Card Remaining (%)", - AircraftCameraSDCardStateLastUpdated = "Aircraft Camera SD Card State Last Updated (ms)", - AircraftCameraChangeableLensSupported = "Aircraft Camera Changeable Lens Supported", - AircraftCameraLensInstalled = "Aircraft Camera Lens Installed", - AircraftCameraLensType = "Aircraft Camera Lens Type", - AircraftCameraLensAFEnabled = "Aircraft Camera Lens AF Enabled", - AircraftCameraLensFocusMode = "Aircraft Camera Lens Focus Mode", - AircraftCameraLensFocusModeValue = "Aircraft Camera Lens Focus Mode Value", - AircraftCameraLensFocusStatus = "Aircraft Camera Lens Focus Status", - AircraftCameraLensFocusStatusValue = "Aircraft Camera Lens Focus Status Value", - AircraftCameraLensMFAssistant = "Aircraft Camera Lens MF Assistant", - AircraftCameraLensAFAssistant = "Aircraft Camera Lens AF Assistant", - AircraftCameraLensAssistantWorking = "Aircraft Camera Lens Assistant Working", - AircraftCameraLensStateLastUpdated = "Aircraft Camera Lens State Last Updated (ms)", - CompassIndex = "Compass Index", - CompassSensorValue = "Compass Sensor Value", - CompassState = "Compass State", - CompassStateLastUpdated = "Compass State Last Updated (ms)", - CompassCalibrationState = "Compass Calibration State", - CompassCalibrationLastUpdated = "Compass Calibration Last Updated (ms)", - DeviceToAircraftDistance = "Device > Aircraft Distance - XY (ft)" -} -export type FlightLogRow = { - [prop in FlightLogHeader]: any; -}; -export type FlightLogMetaData = { - appVersion: string; - session: { - id: string; - start: Date; - end: Date | null; - elapsed: number; - }; - device: { - model: string; - os: string; - platform: string; - }; - aircraft: { - model: string; - name: string; - firmware: string; - }; - battery: { - chargeVolume: number; - remainingLifePercent: number; - discharges: number; - cells: number; - firmware: string; - serialNumber: string; - }; - flightController: { - serialNumber: string; - firmware: string; - }; - gimbal: { - firmware: string; - }; - remoteController: { - serialNumber: string; - firmware: string; - }; - camera: { - serialNumber: string; - }; - user: { - userId: string; - organizationId: string; - }; -}; -export type FlightLog = { - metaData: FlightLogMetaData; - rows: FlightLogRow[]; - infos: any[]; -}; -export type FlightLogEvent = { - meta: FlightLogMetaData; - rowIndex?: number; - row?: FlightLogRow; - info?: undefined | Array; -}; -export declare const FLIGHT_MODE_MAPPING_V4: { - 0: string; - 1: string; - 2: string; - 3: string; - 4: string; - 5: string; - 6: string; - 7: string; - 8: string; - 9: string; - 10: string; - 11: string; - 12: string; - 13: string; - 14: string; - 15: string; - 16: string; - 17: string; - 18: string; - 19: string; - 23: string; - 24: string; - 25: string; - 26: string; - 27: string; - 28: string; - 29: string; - 30: string; - 31: string; - 32: string; - 33: string; - 35: string; - 36: string; - 37: string; - 38: string; - 39: string; - 41: string; - 43: string; - 255: string; -}; -export declare const FLIGHT_MODE_MAPPING_V5: { - 0: string; - 1: string; - 2: string; - 3: string; - 4: string; - 5: string; - 6: string; - 7: string; - 8: string; - 9: string; - 10: string; - 11: string; - 12: string; - 13: string; - 14: string; - 15: string; - 16: string; - 17: string; - 18: string; - 19: string; - 20: string; - 21: string; - 22: string; - 23: string; - 24: string; - 25: string; - 26: string; - 27: string; - 28: string; - 29: string; -}; diff --git a/dist/types/types.d.ts b/dist/types/types.d.ts index 1807597..b2079e9 100644 --- a/dist/types/types.d.ts +++ b/dist/types/types.d.ts @@ -1,268 +1,268 @@ -export declare enum FlightLogHeader { - DateTime = "Date/Time (UTC)", - ElapsedTime = "Elapsed Time (sec)", - Info = "Info", - DeviceLatitude = "Device Latitude (Degrees)", - DeviceLongitude = "Device Longitude (Degrees)", - DeviceLocationLastUpdated = "Device Location Last Updated (ms)", - AircraftBatteryPowerPercent = "Aircraft Battery Power (%)", - AircraftBatteryCharge = "Aircraft Battery Charge (mAh)", - AircraftBatteryCurrent = "Aircraft Battery Current (mA)", - AircraftBatteryVoltage = "Aircraft Battery Voltage (mV)", - AircraftBatteryTemperature = "Aircraft Battery Temperature (Fahrenheit)", - AircraftBatteryLastUpdated = "Aircraft Battery Last Updated (ms)", - AircraftBatteryCell1Voltage = "Aircraft Battery Cell 1 Voltage", - AircraftBatteryCell2Voltage = "Aircraft Battery Cell 2 Voltage", - AircraftBatteryCell3Voltage = "Aircraft Battery Cell 3 Voltage", - AircraftBatteryCell4Voltage = "Aircraft Battery Cell 4 Voltage", - AircraftBatteryCellVoltageLastUpdated = "Aircraft Battery Cell Voltage Last Updated (ms)", - AircraftLatitude = "Aircraft Latitude (Degrees)", - AircraftLongitude = "Aircraft Longitude (Degrees)", - AircraftSpeed = "Aircraft Speed (mph)", - AircraftBarometricAltitude = "Aircraft Barometric Altitude (ft)", - AircraftHeading = "Aircraft Heading (Degrees)", - AircraftVelocityX = "Aircraft Vel - X (mph)", - AircraftVelocityY = "Aircraft Vel - Y (mph)", - AircraftVelocityZ = "Aircraft Vel - Z (mph)", - AircraftPitch = "Aircraft Pitch (Degrees)", - AircraftRoll = "Aircraft Roll (Degrees)", - AircraftSatellites = "Aircraft Satellites", - AircraftMotorsOn = "Aircraft Motors On", - AircraftFlying = "Aircraft Flying", - AircraftFlightMode = "Aircraft Flight Mode", - AircraftFlightModeValue = "Aircraft Flight Mode Value", - AircraftIMUPreheating = "Aircraft IMU Preheating", - AircraftUltrasonicOn = "Aircraft Ultrasonic On", - AircraftUltrasonicAltitude = "Aircraft Ultrasonic Altitude (ft)", - AircraftVisionOn = "Aircraft Vision On", - AircraftGPSSignal = "Aircraft GPS Signal", - AircraftGPSSignalValue = "Aircraft GPS Signal Value", - AircraftNoFly = "Aircraft No-fly", - AircraftNoFlyValue = "Aircraft No-fly Value", - AircraftNoFlyLatitude = "Aircraft No-fly Latitude (Degrees)", - AircraftNoFlyLongitude = "Aircraft No-fly Longitude (Degrees)", - AircraftNoFlyRadius = "Aircraft No-fly Radius (ft)", - HomeLatitude = "Home Latitude (Degrees)", - HomeLongitude = "Home Longitude (Degrees)", - AircraftSmartGoHomeFlightTimeRemaining = "Aircraft Smart Go-home Flight Time Remaining (sec)", - AircraftSmartGoHomeFlightReturnTime = "Aircraft Smart Go-home Flight Return Time (sec)", - AircraftSmartGoHomeLandingTime = "Aircraft Smart Go-home Landing Time (sec)", - AircraftSmartGoHomeReturnPower = "Aircraft Smart Go-home Return Power (%)", - AircraftSmartGoHomeLandingPower = "Aircraft Smart Go-home Landing Power (%)", - AircraftSmartGoHomeRadius = "Aircraft Smart Go-home Radius (ft)", - AircraftSmartGoHomeCountdown = "Aircraft Smart Go-home Countdown (sec)", - AircraftSmartGoHomeRequesting = "Aircraft Smart Go-home Requesting", - AircraftSystemStateLastUpdated = "Aircraft System State Last Updated (ms)", - GimbalPitch = "Gimbal Pitch (Degrees)", - GimbalRoll = "Gimbal Roll (Degrees)", - GimbalYaw = "Gimbal Yaw (Degrees)", - GimbalMode = "Gimbal Mode", - GimbalModeValue = "Gimbal Mode Value", - GimbalPitchAtStop = "Gimbal Pitch at Stop", - GimbalRollAtStop = "Gimbal Roll at Stop", - GimbalYawAtStop = "Gimbal Yaw at Stop", - GimbalStatusLastUpdated = "Gimbal Status Last Updated (ms)", - LandingGearIsMovable = "Landing Gear is Movable", - LandingGearStatus = "Landing Gear Status", - LandingGearStatusValue = "Landing Gear Status Value", - LandingGearMode = "Landing Gear Mode", - LandingGearModeValue = "Landing Gear Mode Value", - LandingGearLastUpdated = "Landing Gear Last Updated (ms)", - RCState = "RC State", - RCStateValue = "RC State Value", - RCLeftHorizontal = "RC Left Horizontal", - RCLeftVertical = "RC Left Vertical", - RCRightHorizontal = "RC Right Horizontal", - RCRightVertical = "RC Right Vertical", - RCLeftWheel = "RC Left Wheel", - RCRightWheel = "RC Right Wheel", - RCLandingGear = "RC Landing Gear", - RCLandingGearValue = "RC Landing Gear Value", - RCGoHome = "RC Go Home", - RCRecord = "RC Record ", - RCShutter = "RC Shutter", - RCPlayback = "RC Playback", - RCPause = "RC Pause", - RCCustom1 = "RC Custom 1", - RCCustom2 = "RC Custom 2", - RCStateLastUpdated = "RC State Last Updated (ms)", - RCBatteryPercentRemaining = "RC Battery (%)", - RCBatteryStateLastUpdated = "RC Battery State Last Updated (ms)", - RCSattelites = "RC Sattelites", - RCHorizontalAccuaracy = "RC Horizontal Accuaracy (ft)", - RCLatitude = "RC Latitude (Degrees)", - RCLongitude = "RC Longitude (Degrees)", - RCGSPDataIsValid = "RC GSP Data is Valid", - RCGPSStateLastUpdated = "RC GPS State Last Updated (ms)", - RCSignal1 = "RC Signal 1", - RCSignal2 = "RC Signal 2", - RCSignalLastUpdated = "RC Signal Last Updated (ms)", - LBSignal1 = "LB Signal 1", - LBSignal2 = "LB Signal 2", - LBSignalLastUpdated = "LB Signal Last Updated (ms)", - AircraftCameraMode = "Aircraft Camera Mode", - AircraftCameraModeValue = "Aircraft Camera Mode Value", - AircraftCameraOverheated = "Aircraft Camera Overheated", - AircraftCameraSensorError = "Aircraft Camera Sensor Error", - AircraftCameraRecording = "Aircraft Camera Recording", - AircraftCameraRawCapture = "Aircraft Camera Raw Capture", - AircraftCameraIntervalCapture = "Aircraft Camera Interval Capture", - AircraftCameraBurstCapture = "Aircraft Camera Burst Capture", - AircraftCameraSingleCapture = "Aircraft Camera Single Capture", - AircraftCameraStoringPhoto = "Aircraft Camera Storing Photo", - AircraftCameraStateLastUpdated = "Aircraft Camera State Last Updated (ms)", - AircraftCameraSDCardExists = "Aircraft Camera SD Card Exists", - AircraftCameraSDCardRemainingPercent = "Aircraft Camera SD Card Remaining (%)", - AircraftCameraSDCardStateLastUpdated = "Aircraft Camera SD Card State Last Updated (ms)", - AircraftCameraChangeableLensSupported = "Aircraft Camera Changeable Lens Supported", - AircraftCameraLensInstalled = "Aircraft Camera Lens Installed", - AircraftCameraLensType = "Aircraft Camera Lens Type", - AircraftCameraLensAFEnabled = "Aircraft Camera Lens AF Enabled", - AircraftCameraLensFocusMode = "Aircraft Camera Lens Focus Mode", - AircraftCameraLensFocusModeValue = "Aircraft Camera Lens Focus Mode Value", - AircraftCameraLensFocusStatus = "Aircraft Camera Lens Focus Status", - AircraftCameraLensFocusStatusValue = "Aircraft Camera Lens Focus Status Value", - AircraftCameraLensMFAssistant = "Aircraft Camera Lens MF Assistant", - AircraftCameraLensAFAssistant = "Aircraft Camera Lens AF Assistant", - AircraftCameraLensAssistantWorking = "Aircraft Camera Lens Assistant Working", - AircraftCameraLensStateLastUpdated = "Aircraft Camera Lens State Last Updated (ms)", - CompassIndex = "Compass Index", - CompassSensorValue = "Compass Sensor Value", - CompassState = "Compass State", - CompassStateLastUpdated = "Compass State Last Updated (ms)", - CompassCalibrationState = "Compass Calibration State", - CompassCalibrationLastUpdated = "Compass Calibration Last Updated (ms)", - DeviceToAircraftDistance = "Device > Aircraft Distance - XY (ft)" -} -export type FlightLogRow = { - [prop in FlightLogHeader]: any; -}; -export type FlightLogMetaData = { - appVersion: string; - session: { - id: string; - start: Date; - end: Date | null; - elapsed: number; - }; - device: { - model: string; - os: string; - platform: string; - }; - aircraft: { - model: string; - name: string; - firmware: string; - }; - battery: { - chargeVolume: number; - remainingLifePercent: number; - discharges: number; - cells: number; - firmware: string; - serialNumber: string; - }; - flightController: { - serialNumber: string; - firmware: string; - }; - gimbal: { - firmware: string; - }; - remoteController: { - serialNumber: string; - firmware: string; - }; - camera: { - serialNumber: string; - }; - user: { - userId: string; - organizationId: string; - }; -}; -export type FlightLog = { - metaData: FlightLogMetaData; - rows: FlightLogRow[]; - infos: any[]; -}; -export type FlightLogEvent = { - meta: FlightLogMetaData; - rowIndex?: number; - row?: FlightLogRow; - info?: undefined | Array; -}; -export declare const FLIGHT_MODE_MAPPING_V4: { - 0: string; - 1: string; - 2: string; - 3: string; - 4: string; - 5: string; - 6: string; - 7: string; - 8: string; - 9: string; - 10: string; - 11: string; - 12: string; - 13: string; - 14: string; - 15: string; - 16: string; - 17: string; - 18: string; - 19: string; - 23: string; - 24: string; - 25: string; - 26: string; - 27: string; - 28: string; - 29: string; - 30: string; - 31: string; - 32: string; - 33: string; - 35: string; - 36: string; - 37: string; - 38: string; - 39: string; - 41: string; - 43: string; - 255: string; -}; -export declare const FLIGHT_MODE_MAPPING_V5: { - 0: string; - 1: string; - 2: string; - 3: string; - 4: string; - 5: string; - 6: string; - 7: string; - 8: string; - 9: string; - 10: string; - 11: string; - 12: string; - 13: string; - 14: string; - 15: string; - 16: string; - 17: string; - 18: string; - 19: string; - 20: string; - 21: string; - 22: string; - 23: string; - 24: string; - 25: string; - 26: string; - 27: string; - 28: string; - 29: string; -}; +export declare enum FlightLogHeader { + DateTime = "Date/Time (UTC)", + ElapsedTime = "Elapsed Time (sec)", + Info = "Info", + DeviceLatitude = "Device Latitude (Degrees)", + DeviceLongitude = "Device Longitude (Degrees)", + DeviceLocationLastUpdated = "Device Location Last Updated (ms)", + AircraftBatteryPowerPercent = "Aircraft Battery Power (%)", + AircraftBatteryCharge = "Aircraft Battery Charge (mAh)", + AircraftBatteryCurrent = "Aircraft Battery Current (mA)", + AircraftBatteryVoltage = "Aircraft Battery Voltage (mV)", + AircraftBatteryTemperature = "Aircraft Battery Temperature (Fahrenheit)", + AircraftBatteryLastUpdated = "Aircraft Battery Last Updated (ms)", + AircraftBatteryCell1Voltage = "Aircraft Battery Cell 1 Voltage", + AircraftBatteryCell2Voltage = "Aircraft Battery Cell 2 Voltage", + AircraftBatteryCell3Voltage = "Aircraft Battery Cell 3 Voltage", + AircraftBatteryCell4Voltage = "Aircraft Battery Cell 4 Voltage", + AircraftBatteryCellVoltageLastUpdated = "Aircraft Battery Cell Voltage Last Updated (ms)", + AircraftLatitude = "Aircraft Latitude (Degrees)", + AircraftLongitude = "Aircraft Longitude (Degrees)", + AircraftSpeed = "Aircraft Speed (mph)", + AircraftBarometricAltitude = "Aircraft Barometric Altitude (ft)", + AircraftHeading = "Aircraft Heading (Degrees)", + AircraftVelocityX = "Aircraft Vel - X (mph)", + AircraftVelocityY = "Aircraft Vel - Y (mph)", + AircraftVelocityZ = "Aircraft Vel - Z (mph)", + AircraftPitch = "Aircraft Pitch (Degrees)", + AircraftRoll = "Aircraft Roll (Degrees)", + AircraftSatellites = "Aircraft Satellites", + AircraftMotorsOn = "Aircraft Motors On", + AircraftFlying = "Aircraft Flying", + AircraftFlightMode = "Aircraft Flight Mode", + AircraftFlightModeValue = "Aircraft Flight Mode Value", + AircraftIMUPreheating = "Aircraft IMU Preheating", + AircraftUltrasonicOn = "Aircraft Ultrasonic On", + AircraftUltrasonicAltitude = "Aircraft Ultrasonic Altitude (ft)", + AircraftVisionOn = "Aircraft Vision On", + AircraftGPSSignal = "Aircraft GPS Signal", + AircraftGPSSignalValue = "Aircraft GPS Signal Value", + AircraftNoFly = "Aircraft No-fly", + AircraftNoFlyValue = "Aircraft No-fly Value", + AircraftNoFlyLatitude = "Aircraft No-fly Latitude (Degrees)", + AircraftNoFlyLongitude = "Aircraft No-fly Longitude (Degrees)", + AircraftNoFlyRadius = "Aircraft No-fly Radius (ft)", + HomeLatitude = "Home Latitude (Degrees)", + HomeLongitude = "Home Longitude (Degrees)", + AircraftSmartGoHomeFlightTimeRemaining = "Aircraft Smart Go-home Flight Time Remaining (sec)", + AircraftSmartGoHomeFlightReturnTime = "Aircraft Smart Go-home Flight Return Time (sec)", + AircraftSmartGoHomeLandingTime = "Aircraft Smart Go-home Landing Time (sec)", + AircraftSmartGoHomeReturnPower = "Aircraft Smart Go-home Return Power (%)", + AircraftSmartGoHomeLandingPower = "Aircraft Smart Go-home Landing Power (%)", + AircraftSmartGoHomeRadius = "Aircraft Smart Go-home Radius (ft)", + AircraftSmartGoHomeCountdown = "Aircraft Smart Go-home Countdown (sec)", + AircraftSmartGoHomeRequesting = "Aircraft Smart Go-home Requesting", + AircraftSystemStateLastUpdated = "Aircraft System State Last Updated (ms)", + GimbalPitch = "Gimbal Pitch (Degrees)", + GimbalRoll = "Gimbal Roll (Degrees)", + GimbalYaw = "Gimbal Yaw (Degrees)", + GimbalMode = "Gimbal Mode", + GimbalModeValue = "Gimbal Mode Value", + GimbalPitchAtStop = "Gimbal Pitch at Stop", + GimbalRollAtStop = "Gimbal Roll at Stop", + GimbalYawAtStop = "Gimbal Yaw at Stop", + GimbalStatusLastUpdated = "Gimbal Status Last Updated (ms)", + LandingGearIsMovable = "Landing Gear is Movable", + LandingGearStatus = "Landing Gear Status", + LandingGearStatusValue = "Landing Gear Status Value", + LandingGearMode = "Landing Gear Mode", + LandingGearModeValue = "Landing Gear Mode Value", + LandingGearLastUpdated = "Landing Gear Last Updated (ms)", + RCState = "RC State", + RCStateValue = "RC State Value", + RCLeftHorizontal = "RC Left Horizontal", + RCLeftVertical = "RC Left Vertical", + RCRightHorizontal = "RC Right Horizontal", + RCRightVertical = "RC Right Vertical", + RCLeftWheel = "RC Left Wheel", + RCRightWheel = "RC Right Wheel", + RCLandingGear = "RC Landing Gear", + RCLandingGearValue = "RC Landing Gear Value", + RCGoHome = "RC Go Home", + RCRecord = "RC Record ", + RCShutter = "RC Shutter", + RCPlayback = "RC Playback", + RCPause = "RC Pause", + RCCustom1 = "RC Custom 1", + RCCustom2 = "RC Custom 2", + RCStateLastUpdated = "RC State Last Updated (ms)", + RCBatteryPercentRemaining = "RC Battery (%)", + RCBatteryStateLastUpdated = "RC Battery State Last Updated (ms)", + RCSattelites = "RC Sattelites", + RCHorizontalAccuaracy = "RC Horizontal Accuaracy (ft)", + RCLatitude = "RC Latitude (Degrees)", + RCLongitude = "RC Longitude (Degrees)", + RCGSPDataIsValid = "RC GSP Data is Valid", + RCGPSStateLastUpdated = "RC GPS State Last Updated (ms)", + RCSignal1 = "RC Signal 1", + RCSignal2 = "RC Signal 2", + RCSignalLastUpdated = "RC Signal Last Updated (ms)", + LBSignal1 = "LB Signal 1", + LBSignal2 = "LB Signal 2", + LBSignalLastUpdated = "LB Signal Last Updated (ms)", + AircraftCameraMode = "Aircraft Camera Mode", + AircraftCameraModeValue = "Aircraft Camera Mode Value", + AircraftCameraOverheated = "Aircraft Camera Overheated", + AircraftCameraSensorError = "Aircraft Camera Sensor Error", + AircraftCameraRecording = "Aircraft Camera Recording", + AircraftCameraRawCapture = "Aircraft Camera Raw Capture", + AircraftCameraIntervalCapture = "Aircraft Camera Interval Capture", + AircraftCameraBurstCapture = "Aircraft Camera Burst Capture", + AircraftCameraSingleCapture = "Aircraft Camera Single Capture", + AircraftCameraStoringPhoto = "Aircraft Camera Storing Photo", + AircraftCameraStateLastUpdated = "Aircraft Camera State Last Updated (ms)", + AircraftCameraSDCardExists = "Aircraft Camera SD Card Exists", + AircraftCameraSDCardRemainingPercent = "Aircraft Camera SD Card Remaining (%)", + AircraftCameraSDCardStateLastUpdated = "Aircraft Camera SD Card State Last Updated (ms)", + AircraftCameraChangeableLensSupported = "Aircraft Camera Changeable Lens Supported", + AircraftCameraLensInstalled = "Aircraft Camera Lens Installed", + AircraftCameraLensType = "Aircraft Camera Lens Type", + AircraftCameraLensAFEnabled = "Aircraft Camera Lens AF Enabled", + AircraftCameraLensFocusMode = "Aircraft Camera Lens Focus Mode", + AircraftCameraLensFocusModeValue = "Aircraft Camera Lens Focus Mode Value", + AircraftCameraLensFocusStatus = "Aircraft Camera Lens Focus Status", + AircraftCameraLensFocusStatusValue = "Aircraft Camera Lens Focus Status Value", + AircraftCameraLensMFAssistant = "Aircraft Camera Lens MF Assistant", + AircraftCameraLensAFAssistant = "Aircraft Camera Lens AF Assistant", + AircraftCameraLensAssistantWorking = "Aircraft Camera Lens Assistant Working", + AircraftCameraLensStateLastUpdated = "Aircraft Camera Lens State Last Updated (ms)", + CompassIndex = "Compass Index", + CompassSensorValue = "Compass Sensor Value", + CompassState = "Compass State", + CompassStateLastUpdated = "Compass State Last Updated (ms)", + CompassCalibrationState = "Compass Calibration State", + CompassCalibrationLastUpdated = "Compass Calibration Last Updated (ms)", + DeviceToAircraftDistance = "Device > Aircraft Distance - XY (ft)" +} +export type FlightLogRow = { + [prop in FlightLogHeader]: any; +}; +export type FlightLogMetaData = { + appVersion: string; + session: { + id: string; + start: Date; + end: Date | null; + elapsed: number; + }; + device: { + model: string; + os: string; + platform: string; + }; + aircraft: { + model: string; + name: string; + firmware: string; + }; + battery: { + chargeVolume: number; + remainingLifePercent: number; + discharges: number; + cells: number; + firmware: string; + serialNumber: string; + }; + flightController: { + serialNumber: string; + firmware: string; + }; + gimbal: { + firmware: string; + }; + remoteController: { + serialNumber: string; + firmware: string; + }; + camera: { + serialNumber: string; + }; + user: { + userId: string; + organizationId: string; + }; +}; +export type FlightLog = { + metaData: FlightLogMetaData; + rows: FlightLogRow[]; + infos: any[]; +}; +export type FlightLogEvent = { + meta: FlightLogMetaData; + rowIndex?: number; + row?: FlightLogRow; + info?: undefined | Array; +}; +export declare const FLIGHT_MODE_MAPPING_V4: { + 0: string; + 1: string; + 2: string; + 3: string; + 4: string; + 5: string; + 6: string; + 7: string; + 8: string; + 9: string; + 10: string; + 11: string; + 12: string; + 13: string; + 14: string; + 15: string; + 16: string; + 17: string; + 18: string; + 19: string; + 23: string; + 24: string; + 25: string; + 26: string; + 27: string; + 28: string; + 29: string; + 30: string; + 31: string; + 32: string; + 33: string; + 35: string; + 36: string; + 37: string; + 38: string; + 39: string; + 41: string; + 43: string; + 255: string; +}; +export declare const FLIGHT_MODE_MAPPING_V5: { + 0: string; + 1: string; + 2: string; + 3: string; + 4: string; + 5: string; + 6: string; + 7: string; + 8: string; + 9: string; + 10: string; + 11: string; + 12: string; + 13: string; + 14: string; + 15: string; + 16: string; + 17: string; + 18: string; + 19: string; + 20: string; + 21: string; + 22: string; + 23: string; + 24: string; + 25: string; + 26: string; + 27: string; + 28: string; + 29: string; +}; diff --git a/package-lock.json b/package-lock.json index e4116ba..9dd8a6d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,14 +14,10 @@ "lodash": "^4.17.15" }, "devDependencies": { + "@rollup/plugin-terser": "^0.4.4", "@types/csv-parse": "^1.2.2", "@types/jest": "^29.2.5", - "@types/lodash": "^4.17.9", "@types/node": "^14.18.36", - "@types/rollup-plugin-commonjs": "^9.3.1", - "@types/rollup-plugin-json": "^3.0.7", - "@types/rollup-plugin-node-resolve": "^4.1.0", - "@types/rollup-plugin-sourcemaps": "^0.5.0", "jest": "^29.3.1", "lodash.camelcase": "^4.3.0", "prettier": "^1.13.7", @@ -30,7 +26,7 @@ "rollup-plugin-json": "^3.0.0", "rollup-plugin-node-resolve": "^3.0.0", "rollup-plugin-sourcemaps": "^0.4.2", - "rollup-plugin-typescript2": "^0.11.1", + "rollup-plugin-typescript2": "^0.36.0", "ts-jest": "^29.0.3", "ts-node": "^6.0.0", "tslint": "^5.10.0", @@ -921,12 +917,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "node_modules/@jest/core/node_modules/graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "node_modules/@jest/core/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -1145,12 +1135,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/@jest/reporters/node_modules/graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "node_modules/@jest/reporters/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -1198,12 +1182,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/@jest/source-map/node_modules/graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "node_modules/@jest/test-result": { "version": "29.3.1", "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.3.1.tgz", @@ -1234,12 +1212,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/@jest/test-sequencer/node_modules/graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "node_modules/@jest/transform": { "version": "29.3.1", "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.3.1.tgz", @@ -1315,12 +1287,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "node_modules/@jest/transform/node_modules/graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "node_modules/@jest/transform/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -1465,14 +1431,38 @@ } }, "node_modules/@jridgewell/set-array": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", - "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", "dev": true, "engines": { "node": ">=6.0.0" } }, + "node_modules/@jridgewell/source-map": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.6.tgz", + "integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25" + } + }, + "node_modules/@jridgewell/source-map/node_modules/@jridgewell/gen-mapping": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", + "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", + "dev": true, + "dependencies": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/@jridgewell/sourcemap-codec": { "version": "1.4.14", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", @@ -1480,15 +1470,56 @@ "dev": true }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.17", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz", - "integrity": "sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==", + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@rollup/plugin-terser": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/@rollup/plugin-terser/-/plugin-terser-0.4.4.tgz", + "integrity": "sha512-XHeJC5Bgvs8LfukDwWZp7yeqin6ns8RTl2B9avbejt6tZqsqvVoWI7ZTQrcNsfKEDWBTnTxM8nMDkO2IFFbd0A==", + "dev": true, + "dependencies": { + "serialize-javascript": "^6.0.1", + "smob": "^1.0.0", + "terser": "^5.17.4" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/pluginutils": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-4.2.1.tgz", + "integrity": "sha512-iKnFXr7NkdZAIHiIWE+BX5ULi/ucVFYWD6TbAV+rZctiRTY2PL6tsIKhoIOaoskiWAkgu+VsbXgUVDNLHf+InQ==", "dev": true, "dependencies": { - "@jridgewell/resolve-uri": "3.1.0", - "@jridgewell/sourcemap-codec": "1.4.14" + "estree-walker": "^2.0.1", + "picomatch": "^2.2.2" + }, + "engines": { + "node": ">= 8.0.0" } }, + "node_modules/@rollup/pluginutils/node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true + }, "node_modules/@rollup/rollup-android-arm-eabi": { "version": "4.22.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.22.4.tgz", @@ -1821,12 +1852,6 @@ "pretty-format": "^29.0.0" } }, - "node_modules/@types/lodash": { - "version": "4.17.9", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.9.tgz", - "integrity": "sha512-w9iWudx1XWOHW5lQRS9iKpK/XuRhnN+0T7HvdCCd802FYkT1AMTnxndJHGrNJwRoRHkslGr4S29tjm1cT7x/7w==", - "dev": true - }, "node_modules/@types/node": { "version": "14.18.36", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.36.tgz", @@ -1839,64 +1864,6 @@ "integrity": "sha512-ri0UmynRRvZiiUJdiz38MmIblKK+oH30MztdBVR95dv/Ubw6neWSb8u1XpRb72L4qsZOhz+L+z9JD40SJmfWow==", "dev": true }, - "node_modules/@types/rollup-plugin-commonjs": { - "version": "9.3.1", - "resolved": "https://registry.npmjs.org/@types/rollup-plugin-commonjs/-/rollup-plugin-commonjs-9.3.1.tgz", - "integrity": "sha512-pV/yokxkMBh81P52iqnZ2FRYCKtvgAPCCmE9Emwr6yyWGrCnpvHs6bvAZQgP+g9LJSAtogs+faF/k/yDPGAuwg==", - "deprecated": "This is a stub types definition. rollup-plugin-commonjs provides its own type definitions, so you do not need this installed.", - "dev": true, - "dependencies": { - "rollup-plugin-commonjs": "*" - } - }, - "node_modules/@types/rollup-plugin-json": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/@types/rollup-plugin-json/-/rollup-plugin-json-3.0.7.tgz", - "integrity": "sha512-9WocRS41o1NHmIC1THS/Jrku2hBkcxYR1E/n/xehe3Si8B71xBVdCbVOMe24hcsKfhjbTvuvy5oJub8d8FgPig==", - "dev": true, - "dependencies": { - "rollup": "^0.63.4" - } - }, - "node_modules/@types/rollup-plugin-json/node_modules/@types/estree": { - "version": "0.0.39", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", - "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", - "dev": true - }, - "node_modules/@types/rollup-plugin-json/node_modules/rollup": { - "version": "0.63.5", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-0.63.5.tgz", - "integrity": "sha512-dFf8LpUNzIj3oE0vCvobX6rqOzHzLBoblyFp+3znPbjiSmSvOoK2kMKx+Fv9jYduG1rvcCfCveSgEaQHjWRF6g==", - "dev": true, - "dependencies": { - "@types/estree": "0.0.39", - "@types/node": "*" - }, - "bin": { - "rollup": "bin/rollup" - } - }, - "node_modules/@types/rollup-plugin-node-resolve": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@types/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-4.1.0.tgz", - "integrity": "sha512-mqg2+9WoIiP9CKd5OmdYqNjiuo26BzhJHz/Lz0wG7uZHGeqXV118GjLbplto/CVP9ix6EaC6C2E8YP6QslBohw==", - "deprecated": "This is a stub types definition. rollup-plugin-node-resolve provides its own type definitions, so you do not need this installed.", - "dev": true, - "dependencies": { - "rollup-plugin-node-resolve": "*" - } - }, - "node_modules/@types/rollup-plugin-sourcemaps": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@types/rollup-plugin-sourcemaps/-/rollup-plugin-sourcemaps-0.5.0.tgz", - "integrity": "sha512-3FP7u5/ljvEamdp45agnWrui/6Zw9GpxlsKqTqu+94jsOrjIQEpb4NVC8jIF4O1QBH46gvpCTmnh4L5QrH90zw==", - "deprecated": "This is a stub types definition. rollup-plugin-sourcemaps provides its own type definitions, so you do not need this installed.", - "dev": true, - "dependencies": { - "rollup-plugin-sourcemaps": "*" - } - }, "node_modules/@types/stack-utils": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", @@ -1918,6 +1885,18 @@ "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", "dev": true }, + "node_modules/acorn": { + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/ansi-escapes": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", @@ -2133,12 +2112,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "node_modules/babel-jest/node_modules/graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "node_modules/babel-jest/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -2440,9 +2413,15 @@ "dev": true }, "node_modules/commander": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", "dev": true }, "node_modules/concat-map": { @@ -2726,6 +2705,23 @@ "node": ">=8" } }, + "node_modules/find-cache-dir": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", + "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", + "dev": true, + "dependencies": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/avajs/find-cache-dir?sponsor=1" + } + }, "node_modules/find-up": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", @@ -2739,6 +2735,20 @@ "node": ">=8" } }, + "node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -2831,13 +2841,10 @@ } }, "node_modules/graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true, - "engines": { - "node": ">=0.4.0" - } + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true }, "node_modules/has": { "version": "1.0.3", @@ -3370,12 +3377,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/jest-config/node_modules/graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "node_modules/jest-config/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -3644,12 +3645,6 @@ "fsevents": "^2.3.2" } }, - "node_modules/jest-haste-map/node_modules/graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "node_modules/jest-haste-map/node_modules/micromatch": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", @@ -3830,12 +3825,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "node_modules/jest-message-util/node_modules/graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "node_modules/jest-message-util/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -3992,12 +3981,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "node_modules/jest-resolve/node_modules/graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "node_modules/jest-resolve/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -4117,12 +4100,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "node_modules/jest-runner/node_modules/graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "node_modules/jest-runner/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -4271,12 +4248,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/jest-runtime/node_modules/graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "node_modules/jest-runtime/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -4382,12 +4353,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "node_modules/jest-snapshot/node_modules/graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "node_modules/jest-snapshot/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -4490,12 +4455,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "node_modules/jest-util/node_modules/graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "node_modules/jest-util/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -4793,12 +4752,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "node_modules/jest/node_modules/graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "node_modules/jest/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -4904,10 +4857,13 @@ } }, "node_modules/jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", "dev": true, + "dependencies": { + "universalify": "^2.0.0" + }, "optionalDependencies": { "graceful-fs": "^4.1.6" } @@ -5301,6 +5257,15 @@ "node": ">= 6" } }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, "node_modules/react-is": { "version": "18.2.0", "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", @@ -5468,40 +5433,39 @@ } }, "node_modules/rollup-plugin-typescript2": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.11.1.tgz", - "integrity": "sha512-slniBE8s9mkLfE3PIcy8xT3utV8oofYqOMBTxMVvkyFz3FNslLJ1ssEdZpWsB7A52+awpqIwjjWXH5e/4/i6dQ==", + "version": "0.36.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.36.0.tgz", + "integrity": "sha512-NB2CSQDxSe9+Oe2ahZbf+B4bh7pHwjV5L+RSYpCu7Q5ROuN94F9b6ioWwKfz3ueL3KTtmX4o2MUH2cgHDIEUsw==", "dev": true, "dependencies": { - "fs-extra": "^5.0.0", - "resolve": "^1.5.0", - "rollup-pluginutils": "^2.0.1", - "tslib": "^1.9.0" + "@rollup/pluginutils": "^4.1.2", + "find-cache-dir": "^3.3.2", + "fs-extra": "^10.0.0", + "semver": "^7.5.4", + "tslib": "^2.6.2" }, "peerDependencies": { - "rollup": ">=0.50.0", + "rollup": ">=1.26.3", "typescript": ">=2.4.0" } }, - "node_modules/rollup-plugin-typescript2/node_modules/fs-extra": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-5.0.0.tgz", - "integrity": "sha512-66Pm4RYbjzdyeuqudYqhFiNBbCIuI9kgRqLPSHIlXHidW8NIQtVdkM1yeZ4lXwuhbTETv3EUGMNHAAw6hiundQ==", + "node_modules/rollup-plugin-typescript2/node_modules/semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", "dev": true, - "dependencies": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" } }, - "node_modules/rollup-plugin-typescript2/node_modules/resolve": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.7.1.tgz", - "integrity": "sha512-c7rwLofp8g1U+h1KNyHL/jicrKg1Ek4q+Lr33AL65uZTinUZHe30D5HlyN5V9NW0JX1D5dXQ4jqW5l7Sy/kGfw==", - "dev": true, - "dependencies": { - "path-parse": "^1.0.5" - } + "node_modules/rollup-plugin-typescript2/node_modules/tslib": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", + "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==", + "dev": true }, "node_modules/rollup-pluginutils": { "version": "2.8.2", @@ -5518,6 +5482,26 @@ "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", "dev": true }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", @@ -5527,6 +5511,15 @@ "semver": "bin/semver.js" } }, + "node_modules/serialize-javascript": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", + "dev": true, + "dependencies": { + "randombytes": "^2.1.0" + } + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -5569,6 +5562,12 @@ "node": ">=8" } }, + "node_modules/smob": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/smob/-/smob-1.5.0.tgz", + "integrity": "sha512-g6T+p7QO8npa+/hNx9ohv1E5pVCmWrVCUzUXJyLdMmftX6ER0oiWY/w9knEonLpnOp6b6FenKnMfR8gqwWdwig==", + "dev": true + }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -5593,9 +5592,9 @@ } }, "node_modules/source-map-support": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.6.tgz", - "integrity": "sha512-N4KXEz7jcKqPf2b2vZF11lQIz9W5ZMuUcIOGj243lduidkf2fjkVKJS9vNxVWn3u/uxX38AcE8U9nnH9FPcq+g==", + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", "dev": true, "dependencies": { "buffer-from": "^1.0.0", @@ -5738,6 +5737,24 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/terser": { + "version": "5.33.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.33.0.tgz", + "integrity": "sha512-JuPVaB7s1gdFKPKTelwUyRq5Sid2A3Gko2S0PncwdBq7kN9Ti9HPWDQ06MPsEDGsZeVESjKEnyGy68quBk1w6g==", + "dev": true, + "dependencies": { + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.8.2", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "bin": { + "terser": "bin/terser" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", @@ -6024,10 +6041,13 @@ } }, "node_modules/universalify": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.1.tgz", - "integrity": "sha1-+nG63UQ3r0wUiEHjs7Fl+enlkLc=", - "dev": true + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "engines": { + "node": ">= 10.0.0" + } }, "node_modules/update-browserslist-db": { "version": "1.0.10", @@ -6910,12 +6930,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -7080,12 +7094,6 @@ "path-is-absolute": "^1.0.0" } }, - "graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -7121,14 +7129,6 @@ "@jridgewell/trace-mapping": "^0.3.15", "callsites": "^3.0.0", "graceful-fs": "^4.2.9" - }, - "dependencies": { - "graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - } } }, "@jest/test-result": { @@ -7153,14 +7153,6 @@ "graceful-fs": "^4.2.9", "jest-haste-map": "^29.3.1", "slash": "^3.0.0" - }, - "dependencies": { - "graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - } } }, "@jest/transform": { @@ -7220,12 +7212,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -7335,11 +7321,34 @@ "dev": true }, "@jridgewell/set-array": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", - "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", "dev": true }, + "@jridgewell/source-map": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.6.tgz", + "integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==", + "dev": true, + "requires": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25" + }, + "dependencies": { + "@jridgewell/gen-mapping": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", + "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", + "dev": true, + "requires": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + } + } + } + }, "@jridgewell/sourcemap-codec": { "version": "1.4.14", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", @@ -7347,13 +7356,42 @@ "dev": true }, "@jridgewell/trace-mapping": { - "version": "0.3.17", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz", - "integrity": "sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==", + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "@rollup/plugin-terser": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/@rollup/plugin-terser/-/plugin-terser-0.4.4.tgz", + "integrity": "sha512-XHeJC5Bgvs8LfukDwWZp7yeqin6ns8RTl2B9avbejt6tZqsqvVoWI7ZTQrcNsfKEDWBTnTxM8nMDkO2IFFbd0A==", "dev": true, "requires": { - "@jridgewell/resolve-uri": "3.1.0", - "@jridgewell/sourcemap-codec": "1.4.14" + "serialize-javascript": "^6.0.1", + "smob": "^1.0.0", + "terser": "^5.17.4" + } + }, + "@rollup/pluginutils": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-4.2.1.tgz", + "integrity": "sha512-iKnFXr7NkdZAIHiIWE+BX5ULi/ucVFYWD6TbAV+rZctiRTY2PL6tsIKhoIOaoskiWAkgu+VsbXgUVDNLHf+InQ==", + "dev": true, + "requires": { + "estree-walker": "^2.0.1", + "picomatch": "^2.2.2" + }, + "dependencies": { + "estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true + } } }, "@rollup/rollup-android-arm-eabi": { @@ -7591,12 +7629,6 @@ "pretty-format": "^29.0.0" } }, - "@types/lodash": { - "version": "4.17.9", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.9.tgz", - "integrity": "sha512-w9iWudx1XWOHW5lQRS9iKpK/XuRhnN+0T7HvdCCd802FYkT1AMTnxndJHGrNJwRoRHkslGr4S29tjm1cT7x/7w==", - "dev": true - }, "@types/node": { "version": "14.18.36", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.36.tgz", @@ -7609,60 +7641,6 @@ "integrity": "sha512-ri0UmynRRvZiiUJdiz38MmIblKK+oH30MztdBVR95dv/Ubw6neWSb8u1XpRb72L4qsZOhz+L+z9JD40SJmfWow==", "dev": true }, - "@types/rollup-plugin-commonjs": { - "version": "9.3.1", - "resolved": "https://registry.npmjs.org/@types/rollup-plugin-commonjs/-/rollup-plugin-commonjs-9.3.1.tgz", - "integrity": "sha512-pV/yokxkMBh81P52iqnZ2FRYCKtvgAPCCmE9Emwr6yyWGrCnpvHs6bvAZQgP+g9LJSAtogs+faF/k/yDPGAuwg==", - "dev": true, - "requires": { - "rollup-plugin-commonjs": "*" - } - }, - "@types/rollup-plugin-json": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/@types/rollup-plugin-json/-/rollup-plugin-json-3.0.7.tgz", - "integrity": "sha512-9WocRS41o1NHmIC1THS/Jrku2hBkcxYR1E/n/xehe3Si8B71xBVdCbVOMe24hcsKfhjbTvuvy5oJub8d8FgPig==", - "dev": true, - "requires": { - "rollup": "^0.63.4" - }, - "dependencies": { - "@types/estree": { - "version": "0.0.39", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", - "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", - "dev": true - }, - "rollup": { - "version": "0.63.5", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-0.63.5.tgz", - "integrity": "sha512-dFf8LpUNzIj3oE0vCvobX6rqOzHzLBoblyFp+3znPbjiSmSvOoK2kMKx+Fv9jYduG1rvcCfCveSgEaQHjWRF6g==", - "dev": true, - "requires": { - "@types/estree": "0.0.39", - "@types/node": "*" - } - } - } - }, - "@types/rollup-plugin-node-resolve": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@types/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-4.1.0.tgz", - "integrity": "sha512-mqg2+9WoIiP9CKd5OmdYqNjiuo26BzhJHz/Lz0wG7uZHGeqXV118GjLbplto/CVP9ix6EaC6C2E8YP6QslBohw==", - "dev": true, - "requires": { - "rollup-plugin-node-resolve": "*" - } - }, - "@types/rollup-plugin-sourcemaps": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@types/rollup-plugin-sourcemaps/-/rollup-plugin-sourcemaps-0.5.0.tgz", - "integrity": "sha512-3FP7u5/ljvEamdp45agnWrui/6Zw9GpxlsKqTqu+94jsOrjIQEpb4NVC8jIF4O1QBH46gvpCTmnh4L5QrH90zw==", - "dev": true, - "requires": { - "rollup-plugin-sourcemaps": "*" - } - }, "@types/stack-utils": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", @@ -7684,6 +7662,12 @@ "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", "dev": true }, + "acorn": { + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", + "dev": true + }, "ansi-escapes": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", @@ -7843,12 +7827,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -8074,9 +8052,15 @@ "dev": true }, "commander": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", "dev": true }, "concat-map": { @@ -8293,6 +8277,17 @@ "to-regex-range": "^5.0.1" } }, + "find-cache-dir": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", + "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + } + }, "find-up": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", @@ -8303,6 +8298,17 @@ "path-exists": "^4.0.0" } }, + "fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -8367,9 +8373,9 @@ "dev": true }, "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, "has": { @@ -8605,12 +8611,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -8834,12 +8834,6 @@ "path-is-absolute": "^1.0.0" } }, - "graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -9043,12 +9037,6 @@ "walker": "^1.0.8" }, "dependencies": { - "graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "micromatch": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", @@ -9185,12 +9173,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -9293,12 +9275,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -9400,12 +9376,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -9520,12 +9490,6 @@ "path-is-absolute": "^1.0.0" } }, - "graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -9609,12 +9573,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -9689,12 +9647,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -9914,12 +9866,13 @@ "dev": true }, "jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", "dev": true, "requires": { - "graceful-fs": "^4.1.6" + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" } }, "kleur": { @@ -10217,6 +10170,15 @@ "sisteransi": "^1.0.5" } }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, "react-is": { "version": "18.2.0", "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", @@ -10350,36 +10312,29 @@ } }, "rollup-plugin-typescript2": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.11.1.tgz", - "integrity": "sha512-slniBE8s9mkLfE3PIcy8xT3utV8oofYqOMBTxMVvkyFz3FNslLJ1ssEdZpWsB7A52+awpqIwjjWXH5e/4/i6dQ==", + "version": "0.36.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.36.0.tgz", + "integrity": "sha512-NB2CSQDxSe9+Oe2ahZbf+B4bh7pHwjV5L+RSYpCu7Q5ROuN94F9b6ioWwKfz3ueL3KTtmX4o2MUH2cgHDIEUsw==", "dev": true, "requires": { - "fs-extra": "^5.0.0", - "resolve": "^1.5.0", - "rollup-pluginutils": "^2.0.1", - "tslib": "^1.9.0" + "@rollup/pluginutils": "^4.1.2", + "find-cache-dir": "^3.3.2", + "fs-extra": "^10.0.0", + "semver": "^7.5.4", + "tslib": "^2.6.2" }, "dependencies": { - "fs-extra": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-5.0.0.tgz", - "integrity": "sha512-66Pm4RYbjzdyeuqudYqhFiNBbCIuI9kgRqLPSHIlXHidW8NIQtVdkM1yeZ4lXwuhbTETv3EUGMNHAAw6hiundQ==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } + "semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true }, - "resolve": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.7.1.tgz", - "integrity": "sha512-c7rwLofp8g1U+h1KNyHL/jicrKg1Ek4q+Lr33AL65uZTinUZHe30D5HlyN5V9NW0JX1D5dXQ4jqW5l7Sy/kGfw==", - "dev": true, - "requires": { - "path-parse": "^1.0.5" - } + "tslib": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", + "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==", + "dev": true } } }, @@ -10400,12 +10355,27 @@ } } }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + }, "semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true }, + "serialize-javascript": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } + }, "shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -10439,6 +10409,12 @@ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true }, + "smob": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/smob/-/smob-1.5.0.tgz", + "integrity": "sha512-g6T+p7QO8npa+/hNx9ohv1E5pVCmWrVCUzUXJyLdMmftX6ER0oiWY/w9knEonLpnOp6b6FenKnMfR8gqwWdwig==", + "dev": true + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -10459,9 +10435,9 @@ } }, "source-map-support": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.6.tgz", - "integrity": "sha512-N4KXEz7jcKqPf2b2vZF11lQIz9W5ZMuUcIOGj243lduidkf2fjkVKJS9vNxVWn3u/uxX38AcE8U9nnH9FPcq+g==", + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", "dev": true, "requires": { "buffer-from": "^1.0.0", @@ -10568,6 +10544,18 @@ "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", "dev": true }, + "terser": { + "version": "5.33.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.33.0.tgz", + "integrity": "sha512-JuPVaB7s1gdFKPKTelwUyRq5Sid2A3Gko2S0PncwdBq7kN9Ti9HPWDQ06MPsEDGsZeVESjKEnyGy68quBk1w6g==", + "dev": true, + "requires": { + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.8.2", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + } + }, "test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", @@ -10765,9 +10753,9 @@ "dev": true }, "universalify": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.1.tgz", - "integrity": "sha1-+nG63UQ3r0wUiEHjs7Fl+enlkLc=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", "dev": true }, "update-browserslist-db": { diff --git a/package.json b/package.json index aacb9a8..e474969 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "repository": "https://www.github.com/dronedeploy/flight-log-parser", "license": "MIT", "scripts": { - "build": "tsc --module commonjs && rollup -c rollup.config.mjs", + "build": "tsc --emitDeclarationOnly && rollup -c rollup.config.mjs", "lint": "tslint -t codeFrame 'src/**/*.ts' 'test/**/*.ts'", "test": "jest", "postinstall": "rm -rf node_modules/@types/node/ts4.8" @@ -41,6 +41,7 @@ "lodash": "^4.17.15" }, "devDependencies": { + "@rollup/plugin-terser": "^0.4.4", "@types/csv-parse": "^1.2.2", "@types/jest": "^29.2.5", "@types/node": "^14.18.36", @@ -52,7 +53,7 @@ "rollup-plugin-json": "^3.0.0", "rollup-plugin-node-resolve": "^3.0.0", "rollup-plugin-sourcemaps": "^0.4.2", - "rollup-plugin-typescript2": "^0.11.1", + "rollup-plugin-typescript2": "^0.36.0", "ts-jest": "^29.0.3", "ts-node": "^6.0.0", "tslint": "^5.10.0", diff --git a/rollup.config.mjs b/rollup.config.mjs index 78b3fdd..d82507f 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -4,6 +4,7 @@ import sourceMaps from 'rollup-plugin-sourcemaps' import camelCase from 'lodash.camelcase' import typescript from 'rollup-plugin-typescript2' import json from 'rollup-plugin-json' +import terser from '@rollup/plugin-terser'; import pkg from './package.json' assert { type: 'json' }; const libraryName = 'flight-log-parser' @@ -30,8 +31,8 @@ export default { // which external modules to include in the bundle // https://github.com/rollup/rollup-plugin-node-resolve#usage resolve(), - // Resolve source maps to the original source sourceMaps(), + terser(), ], } diff --git a/tsconfig.json b/tsconfig.json index e1202d0..7697310 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,8 @@ { "compilerOptions": { "target": "es6", - "module":"commonjs", + "module": "ES2015", + "moduleResolution": "node", "strict": true, "sourceMap": true, "skipLibCheck": true, @@ -19,7 +20,7 @@ "node_modules/@types", ], "exclude": [ - "src/tests" + "src/__test__" ], "atom": { "rewriteTsconfig": false