From 1731bb481530e2e71d9f60804d0e38497cb3d8b9 Mon Sep 17 00:00:00 2001 From: Natay Aberra Date: Wed, 8 Jan 2025 11:42:24 -0500 Subject: [PATCH] PDE-5641 only select keys --- packages/cli/src/utils/analytics.js | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/packages/cli/src/utils/analytics.js b/packages/cli/src/utils/analytics.js index 40c097955..95e756f76 100644 --- a/packages/cli/src/utils/analytics.js +++ b/packages/cli/src/utils/analytics.js @@ -21,27 +21,6 @@ const shouldSkipAnalytics = (mode) => process.env.DISABLE_ZAPIER_ANALYTICS || mode === ANALYTICS_MODES.disabled; -const cleanValues = (args) => { - // List of arguments we don't want to record. - const doNotRecord = [ - 'key-value pairs...', - 'keys...', - 'path', - 'email', - 'message', - 'user', - 'account', - 'redirect-uri', - 'inputData', - ]; - return Object.keys(args) - .filter((key) => !doNotRecord.includes(key)) - .reduce((obj, key) => { - obj[key] = args[key]; - return obj; - }, {}); -}; - const recordAnalytics = async (command, isValidCommand, args, flags) => { const analyticsMode = await currentAnalyticsMode(); @@ -49,10 +28,8 @@ const recordAnalytics = async (command, isValidCommand, args, flags) => { debug('skipping analytics'); return; } - const cleanedArgs = cleanValues(args); - const cleanedFlags = cleanValues(flags); const argKeys = Object.keys(args); - + const flagKeys = Object.keys(flags); const shouldRecordAnonymously = analyticsMode === ANALYTICS_MODES.anonymous; const integrationIDKey = argKeys.find( @@ -74,10 +51,10 @@ const recordAnalytics = async (command, isValidCommand, args, flags) => { numArgs: argKeys.length, appId: linkedAppId, flags: { - ...cleanedFlags, + ...flagKeys, ...(command === 'help' ? { helpCommand: argKeys[0] } : {}), // include the beginning of args so we know what they want help on }, - args: shouldRecordAnonymously ? undefined : cleanedArgs, + argsKeys: argKeys, cliVersion: pkg.version, os: shouldRecordAnonymously ? undefined : process.platform, };