tango-app-api-client 3.3.3-beta.15 → 3.3.3-beta.17

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-client",
3
- "version": "3.3.3-beta.15",
3
+ "version": "3.3.3-beta.17",
4
4
  "description": "client",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1249,7 +1249,7 @@ export async function auditConfiguration( req, res ) {
1249
1249
  eventType: 'update',
1250
1250
  showTo: [ 'tango' ],
1251
1251
  changes: [ `Audit config for client id ${req.params?.id}` ],
1252
- previous: previousClient,
1252
+ previous: previousClient.auditConfigs,
1253
1253
  current: {
1254
1254
  clientId: req.params?.id,
1255
1255
  count: inputData.count,
@@ -2107,7 +2107,6 @@ export async function getActivityLogs( req, res ) {
2107
2107
  const logSubType =hit?._source?.logSubType;
2108
2108
  respo = findDifferences( previous, current, logType, logSubType );
2109
2109
  hit._source.updatedValue = respo;
2110
- // Object.keys( respo ).length === 0?null:
2111
2110
  temp.push( hit?._source );
2112
2111
  hit._source.changes =logSubType === 'ticketConfig'? Object.keys( respo ).map( ( item ) => item ) : hit._source.changes;
2113
2112
  } else {
@@ -2130,7 +2129,7 @@ function findDifferences( previous, current, logType, logSubType, path = '' ) {
2130
2129
  const dbKeys = JSON.parse( process.env.DB_KEYS );
2131
2130
  const ignoredKeys = new Set( [
2132
2131
  '_id', 'updatedAt', 'createdAt', 'password', 'clientId',
2133
- 'storeId', 'refreshToken', 'employeeId', 'fcmToken', 'permission',
2132
+ 'storeId', 'refreshToken', 'employeeId', 'fcmToken', 'permission', 'updateFeatureConfig',
2134
2133
  ] );
2135
2134
  const documents = dbKeys.DOCUMENTS;
2136
2135
  // Get correct key mapping based on logType
@@ -2145,21 +2144,28 @@ function findDifferences( previous, current, logType, logSubType, path = '' ) {
2145
2144
  const prevValue = previous[key];
2146
2145
  const currValue = current[key];
2147
2146
 
2148
- if ( typeof prevValue === 'object' && typeof currValue === 'object' && prevValue !== null && currValue !== null && !Array.isArray( prevValue ) && !Array.isArray( currValue ) ) {
2149
- const nestedDiffs = findDifferences( prevValue, currValue, logType, logSubType, `${path}${key}.` );
2150
- Object.assign( differences, nestedDiffs );
2151
- } else if ( Array.isArray( prevValue ) && prevValue.every( ( item ) => typeof item === 'object' && item !== null ) || Array.isArray( currValue ) && currValue.every( ( item ) => typeof item === 'object' && item !== null ) ) {
2152
- if ( _.isEqual( prevValue, currValue ) ) {
2153
- continue;
2154
- } else {
2155
- let result = compareArrayObjects( prevValue, currValue );
2156
- differences = { ...differences, ...result };
2157
- }
2158
- } else if ( Array.isArray( prevValue ) && Array.isArray( currValue ) && prevValue.length !== 0 && currValue.length !== 0 ) {
2147
+ if ( typeof prevValue === 'object' && typeof currValue === 'object' && prevValue !== null && currValue !== null ) {
2148
+ if ( logSubType!== 'userUpdated' ) {
2149
+ if ( key == 'spocDetails' ) {
2150
+ if ( _.isEqual( prevValue, currValue ) ) {
2151
+ continue;
2152
+ } else {
2153
+ let result = compareArrayObjects( prevValue, currValue );
2154
+ differences = { ...differences, ...result };
2155
+ }
2156
+ } else if ( Array.isArray( prevValue ) && prevValue.every( ( item ) => typeof item === 'string' ) ||Array.isArray( currValue ) && currValue.every( ( item ) => typeof item === 'string' ) ) {
2159
2157
  JSON.stringify( prevValue ) !== JSON.stringify( currValue )?
2160
2158
  differences[`${path}${key}`] = { previous: prevValue.length> 0 ? prevValue.join( ',' ): null, current: currValue.length > 0? currValue.join( ',' ): null } : null;
2161
2159
 
2162
- // differences[`${path}${key}`] = { previous: removed.length> 0 ? prevValue.join( ',' ): prevValue.join( ', ' ) :, current: added.length > 0? addedUsers.join( ', ' ) : currValue.join( ',' ) } : null;
2160
+ // differences[`${path}${key}`] = { previous: removed.length> 0 ? prevValue.join( ',' ): prevValue.join( ', ' ) :, current: added.length > 0? addedUsers.join( ', ' ) : currValue.join( ',' ) } : null;
2161
+ } else {
2162
+ const nestedDiffs = findDifferences( prevValue, currValue, logType, logSubType, `${path}${key}.` );
2163
+ Object.assign( differences, nestedDiffs );
2164
+ }
2165
+ } else {
2166
+ const nestedDiffs = findDifferences( prevValue, currValue, logType, logSubType, `${path}${key}.` );
2167
+ Object.assign( differences, nestedDiffs );
2168
+ }
2163
2169
  } else if ( prevValue !== currValue ) {
2164
2170
  if (
2165
2171
  ( prevValue === '' && currValue === '' ) ||
@@ -2187,7 +2193,7 @@ function findDifferences( previous, current, logType, logSubType, path = '' ) {
2187
2193
  if ( userFriendlyKey ) {
2188
2194
  newKey = userFriendlyKey;
2189
2195
  }
2190
- const binaryKeys = [ 'Two Factor Authentication', 'Mat Enabled', 'Audit', 'Infra Email Alert', 'Ip Whitelist', 'Excluded Area', 'Passer By Data', 'Normalized', 'Billing', 'Camera', 'Footfall Directory', 'Footfall Directory Audit', 'Footfall Directory Limit', 'NOB', 'New Traffic', 'Trax', 'Zone V1', 'Zone V2', 'Reports', 'New Dashboard' ];
2196
+ const binaryKeys = [ 'Two Factor Authentication', 'Mat Enabled', 'Audit Status', 'Infra Email Alert', 'Ip Whitelist', 'Excluded Area', 'Passer-by data', 'Normalized data during downtime', 'Billing', 'Camera Blurring', 'Footfall Directory', 'Footfall Directory Audit', 'Footfall Directory Limit', 'NOB Status', 'Traffic', 'Trax', 'Zone V1', 'Zone V2', 'Reports', 'Analyze' ];
2191
2197
  if ( binaryKeys.includes( newKey ) ) {
2192
2198
  diff.previous = ( diff.previous == true || diff.previous == 'Enabled' ) ? 'Enabled' : 'Disabled';
2193
2199
  diff.current = ( diff.current == true || diff.current == 'Enabled' ) ? 'Enabled' : 'Disabled';
@@ -2197,6 +2203,11 @@ function findDifferences( previous, current, logType, logSubType, path = '' ) {
2197
2203
  diff.current = ( diff.current == true || diff.current == 'Server' ) ? 'Server' : 'Serverless';
2198
2204
  }
2199
2205
 
2206
+ if ( newKey === 'Stream Type' ) {
2207
+ diff.previous = ( diff.previous == 'Edge' || diff.previous == 'Edge App' ) ? 'Edge App' : 'RTSP';
2208
+ diff.current = ( diff.current == 'Edge' || diff.current == 'Edge App' ) ? 'Edge App' : 'RTSP';
2209
+ }
2210
+
2200
2211
  // **Transform Roles Permission Keys**
2201
2212
  const rolesPermissionMatch = newKey.match( /rolespermission\.(\d+)\.modules\.(\d+)\.(isAdd|isEdit)/ );
2202
2213
  if ( rolesPermissionMatch ) {
@@ -2318,7 +2329,7 @@ export async function clientCsmAssignAction( req, res ) {
2318
2329
 
2319
2330
  function compareArrayObjects( prevArray, currArray ) {
2320
2331
  let changes = {};
2321
- logger.info( { prevArray: prevArray, currArray: currArray } );
2332
+ // logger.info( { prevArray: prevArray, currArray: currArray } );
2322
2333
  // Find the longest array length to avoid index mismatch
2323
2334
  let maxLength = Math.max( prevArray.length, currArray.length );
2324
2335