Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions KeeperSdk/src/enterpriseReport/EnterpriseReportManager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import type { Auth } from '@keeper-security/keeperapi'
import { KeeperSdkError, ResultCodes } from '../utils'
import { runAuditReport } from './auditReport'
import { runActionReport } from './actionReport'
import type {
ActionReportOptions,
ActionReportResult,
AuditReportOptions,
AuditReportResult,
} from './reportTypes'
import type { AuthProvider } from './reportUtils'

export class EnterpriseReportManager {
private readonly authProvider: AuthProvider

constructor(authProvider: AuthProvider) {
this.authProvider = authProvider
}

public async runAuditReport(options: AuditReportOptions = {}): Promise<AuditReportResult> {
return runAuditReport(this.requireAuth(), options)
}

public async runActionReport(options: ActionReportOptions = {}): Promise<ActionReportResult> {
return runActionReport(this.requireAuth(), options)
}

private requireAuth(): Auth {
const auth = this.authProvider()
if (!auth) {
throw new KeeperSdkError('You are not logged in. Please log in first.', ResultCodes.NOT_LOGGED_IN)
}
return auth
}
}
Loading
Loading