tango-app-api-analysis-traffic 3.1.0-alpha.1 → 3.1.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-analysis-traffic",
3
- "version": "3.1.0-alpha.1",
3
+ "version": "3.1.0-alpha.4",
4
4
  "description": "Traffic Analysis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -25,7 +25,7 @@
25
25
  "puppeteer": "^23.11.1",
26
26
  "swagger-ui-express": "^5.0.1",
27
27
  "tango-api-schema": "^2.2.7",
28
- "tango-app-api-middleware": "^3.1.47",
28
+ "tango-app-api-middleware": "^3.1.53",
29
29
  "winston": "^3.13.1",
30
30
  "winston-daily-rotate-file": "^5.0.0"
31
31
  },
@@ -32,7 +32,7 @@ async function LamdaServiceCall( url, data ) {
32
32
  const json = await response.json();
33
33
  return json;
34
34
  } catch ( error ) {
35
- logger.error( { error: error, message: data, function: 'LamdaServiceCall' } );
35
+ logger.error( { error: error, function: 'LamdaServiceCall' } );
36
36
  return false;
37
37
  }
38
38
  }
@@ -73,7 +73,7 @@ async function getClientConfig( clientId ) {
73
73
  }
74
74
  return getClientData;
75
75
  } catch ( error ) {
76
- logger.error( { error: error, message: data, function: 'getClientConfig' } );
76
+ logger.error( { error: error, function: 'getClientConfig' } );
77
77
  return false;
78
78
  }
79
79
  }
@@ -283,7 +283,7 @@ export const sendEmailers = async ( req, res ) => {
283
283
  storeCount: emailerSourceData._source.storeIds.length-1,
284
284
  storeBaseImage: cameraBaseImage,
285
285
  };
286
-
286
+ console.log( 'cameraBaseImage 1=>', cameraBaseImage );
287
287
  // // Get Client Data ///
288
288
  let clientData = await clientService.findOne( { clientId: emailerSourceData._source.clientId }, { clientId: 1, emailersConfig: 1, featureConfigs: 1, clientName: 1 } );
289
289
 
@@ -380,7 +380,7 @@ async function getLamdaMetricsData( templateData ) {
380
380
  // Default Value
381
381
  }
382
382
  } catch ( error ) {
383
- // console.log( 'error =>', error );
383
+ console.log( 'error getLamdaMetricsData=>', error );
384
384
  logger.error( { error: error, function: 'getLamdaMetricsData' } );
385
385
  return false;
386
386
  }
@@ -448,7 +448,8 @@ async function lamdaAPI1( templateData ) {
448
448
  }
449
449
  return lamdaAPIResultData;
450
450
  } catch ( error ) {
451
- logger.error( { error: error, message: data, function: 'lamdaAPI1' } );
451
+ console.log( 'error lamdaAPI1=>', error );
452
+ logger.error( { error: error, function: 'lamdaAPI1' } );
452
453
  return false;
453
454
  }
454
455
  }
@@ -519,7 +520,8 @@ async function lamdaAPI2( templateData ) {
519
520
  }
520
521
  return lamdaAPIResultData;
521
522
  } catch ( error ) {
522
- logger.error( { error: error, message: data, function: 'lamdaAPI2' } );
523
+ console.log( 'error lamdaAPI2=>', error );
524
+ logger.error( { error: error, function: 'lamdaAPI2' } );
523
525
  return false;
524
526
  }
525
527
  }
@@ -632,7 +634,8 @@ async function lamdaAPI3( templateData ) {
632
634
  }
633
635
  return lamdaAPIResultData;
634
636
  } catch ( error ) {
635
- logger.error( { error: error, message: data, function: 'lamdaAPI2' } );
637
+ console.log( 'error lamdaAPI3=>', error );
638
+ logger.error( { error: error, function: 'lamdaAPI3' } );
636
639
  return false;
637
640
  }
638
641
  }
@@ -754,7 +757,8 @@ async function lamdaAPI4( templateData ) {
754
757
  }
755
758
  return lamdaAPIResultData;
756
759
  } catch ( error ) {
757
- logger.error( { error: error, message: data, function: 'lamdaAPI4' } );
760
+ console.log( 'error lamdaAPI4=>', error );
761
+ logger.error( { error: error, function: 'lamdaAPI4' } );
758
762
  return false;
759
763
  }
760
764
  }
@@ -817,10 +821,10 @@ async function hourlyChartLamdaAPI( templateData ) {
817
821
  } else {
818
822
  throw new Error( 'S3 Upload failed for hourly chart' );
819
823
  }
820
-
824
+ console.log( 'chartUrl hourlyChartLamdaAPI=>', hourlyChartUrl );
821
825
  return hourlyChartUrl;
822
826
  } catch ( error ) {
823
- // console.log( ' error hourlyChartLamdaAPI=>', error );
827
+ console.log( ' error hourlyChartLamdaAPI=>', error );
824
828
  logger.error( { error: error, function: 'hourlyChartLamdaAPI' } );
825
829
  return false;
826
830
  }
@@ -870,10 +874,10 @@ async function dailyChartLamdaAPI( templateData ) {
870
874
  } else {
871
875
  throw new Error( 'S3 Upload failed for overall chart' );
872
876
  }
873
-
877
+ console.log( 'chartUrl dailyChartLamdaAPI=>', chartUrl );
874
878
  return chartUrl;
875
879
  } catch ( error ) {
876
- logger.error( { error: error, message: data, function: 'dailyChartLamdaAPI' } );
880
+ logger.error( { error: error, function: 'dailyChartLamdaAPI' } );
877
881
  return false;
878
882
  }
879
883
  }
@@ -1067,10 +1071,11 @@ async function dailyFootfallTrendChartLamdaAPI( templateData ) {
1067
1071
  } else {
1068
1072
  throw new Error( 'S3 Upload failed for overall chart' );
1069
1073
  }
1070
-
1074
+ console.log( 'chartUrl dailyFootfallTrendChartLamdaAPI=>', chartUrl );
1071
1075
  return chartUrl;
1072
1076
  } catch ( error ) {
1073
- logger.error( { error: error, message: data, function: 'dailyFootfallTrendChartLamdaAPI' } );
1077
+ console.log( 'error dailyFootfallTrendChartLamdaAPI=>', error );
1078
+ logger.error( { error: error, function: 'dailyFootfallTrendChartLamdaAPI' } );
1074
1079
  return false;
1075
1080
  }
1076
1081
  }
@@ -1089,6 +1094,7 @@ async function getLamdaChartData( templateData ) {
1089
1094
  ] );
1090
1095
  resultLamdaChartData.dailyData = chartImagePath;
1091
1096
  resultLamdaChartData.hourlyData = hourlyChartImagePath;
1097
+ console.log( 'resultLamdaChartData 555=>', resultLamdaChartData );
1092
1098
  return resultLamdaChartData;
1093
1099
  } else {
1094
1100
  // Default Value
@@ -1096,7 +1102,7 @@ async function getLamdaChartData( templateData ) {
1096
1102
  return resultLamdaChartData;
1097
1103
  }
1098
1104
  } catch ( error ) {
1099
- // console.log( 'error =>', error );
1105
+ console.log( 'error getLamdaChartData=>', error );
1100
1106
  logger.error( { error: error, function: 'getLamdaChartData' } );
1101
1107
  return false;
1102
1108
  }
@@ -1172,13 +1178,14 @@ async function emailerSendEmail( storeData, clientData, lamdaMetrics, lamdaChart
1172
1178
 
1173
1179
  return true;
1174
1180
  } catch ( error ) {
1181
+ console.log( 'error emailerSendEmail=>', error );
1175
1182
  logger.error( { error: error, function: 'emailerSendEmail' } );
1176
1183
  return false;
1177
1184
  }
1178
1185
  }
1179
1186
 
1180
1187
  const overallChart = async ( data ) => {
1181
- // console.log( 'Generating footfall chart...' );
1188
+ console.log( 'Generating overallChart footfall chart...' );
1182
1189
 
1183
1190
  // let chartImagePath = path.resolve( __dirname, 'emailchart-image.png' );
1184
1191
  // console.log( 'Chart Image Path:', chartImagePath );
@@ -1296,7 +1303,7 @@ const overallChart = async ( data ) => {
1296
1303
  };
1297
1304
 
1298
1305
  const overallHourlyChart = async ( data ) => {
1299
- // console.log( 'Generating heatmap chart...' );
1306
+ console.log( 'Generating overallHourlyChart heatmap chart...' );
1300
1307
 
1301
1308
  const browser = await puppeteer.launch( { headless: true } );
1302
1309
  const page = await browser.newPage();
@@ -1469,7 +1476,7 @@ const overallHourlyChart = async ( data ) => {
1469
1476
  };
1470
1477
 
1471
1478
  const footfallTrend = async ( data ) => {
1472
- // console.log( 'Generating footfall chart...' );
1479
+ console.log( 'Generating footfallTrend footfall chart...' );
1473
1480
 
1474
1481
  const browser = await puppeteer.launch( { headless: true } );
1475
1482
  const page = await browser.newPage();