@@ -10,9 +10,7 @@ import { logger } from '@socketsecurity/registry/lib/logger'
1010import { fetchOrgAnalyticsData } from './fetch-org-analytics'
1111import { fetchRepoAnalyticsData } from './fetch-repo-analytics'
1212import constants from '../../constants'
13- import { AuthError } from '../../utils/errors'
1413import { mdTableStringNumber } from '../../utils/markdown'
15- import { getDefaultToken } from '../../utils/sdk'
1614
1715import type { SocketSdkReturnType } from '@socketsecurity/sdk'
1816import type { Widgets } from 'blessed' // Note: Widgets does not seem to actually work as code :'(
@@ -76,38 +74,6 @@ export async function displayAnalytics({
7674 repo : string
7775 outputKind : 'json' | 'markdown' | 'print'
7876 filePath : string
79- } ) : Promise < void > {
80- const apiToken = getDefaultToken ( )
81- if ( ! apiToken ) {
82- throw new AuthError (
83- 'User must be authenticated to run this command. To log in, run the command `socket login` and enter your API token.'
84- )
85- }
86-
87- await outputAnalyticsWithToken ( {
88- apiToken,
89- filePath,
90- outputKind,
91- repo,
92- scope,
93- time
94- } )
95- }
96-
97- async function outputAnalyticsWithToken ( {
98- apiToken,
99- filePath,
100- outputKind,
101- repo,
102- scope,
103- time
104- } : {
105- apiToken : string
106- scope : string
107- time : number
108- repo : string
109- outputKind : 'json' | 'markdown' | 'print'
110- filePath : string
11177} ) : Promise < void > {
11278 // Lazily access constants.spinner.
11379 const { spinner } = constants
@@ -119,9 +85,9 @@ async function outputAnalyticsWithToken({
11985 | SocketSdkReturnType < 'getOrgAnalytics' > [ 'data' ]
12086 | SocketSdkReturnType < 'getRepoAnalytics' > [ 'data' ]
12187 if ( scope === 'org' ) {
122- data = await fetchOrgAnalyticsData ( time , spinner , apiToken )
88+ data = await fetchOrgAnalyticsData ( time , spinner )
12389 } else if ( repo ) {
124- data = await fetchRepoAnalyticsData ( repo , time , spinner , apiToken )
90+ data = await fetchRepoAnalyticsData ( repo , time , spinner )
12591 }
12692
12793 // A message should already have been printed if we have no data here
0 commit comments