Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #222 from JupiterOne/INT-9845-fix-5
Browse files Browse the repository at this point in the history
INT-9845: add additional logs
  • Loading branch information
gastonyelmini authored Dec 14, 2023
2 parents 9d00719 + 507abfb commit 9c08370
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/gsuite/clients/GSuiteInstalledAppsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,21 @@ export class GSuiteInstalledAppsClient extends GSuiteChromeManagementClient {
): Promise<void> {
const client = await this.getAuthenticatedServiceClient();

const threeMonths = new Date();
threeMonths.setMonth(threeMonths.getMonth() - 3);
const threeMonthsFormatted = threeMonths.toISOString().split('T')[0]; // Format date to YYYY-MM-DD
const oneMonth = new Date();
oneMonth.setMonth(oneMonth.getMonth() - 1);
const oneMonthFormatted = oneMonth.toISOString().split('T')[0]; // Format date to YYYY-MM-DD

await this.iterateApi(
async () => {
return client.customers.reports.countInstalledApps({
customer: `customers/${this.accountId}`,
filter: `app_type=${appType} AND latest_profile_active_date>=${threeMonthsFormatted}`,
filter: `app_type=${appType} AND latest_profile_active_date>=${oneMonthFormatted} AND total_install_count>0`,
pageSize: 1000,
});
},
async (data) => {
// TEMP 9845:
this.logger.info(`Installed apps length ${data.installedApps?.length}`);
await pMap(
data.installedApps || [],
async (app) => {
Expand Down
4 changes: 2 additions & 2 deletions src/steps/chrome-extensions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { isAuthorizationError } from '../../utils/isAuthorizationError';
const APP_EXTENSION_TYPE = 'EXTENSION';

function isMultipleOfHundredThousand(num: number) {
return num % 100000 === 0;
return num % 1000 === 0;
}

export async function fetchChromeExtensions({
Expand All @@ -42,7 +42,7 @@ export async function fetchChromeExtensions({
}
await jobState.addEntity(createChromeExtensionEntity(app));

processedCount++;
processedCount = processedCount + 1;

if (isMultipleOfHundredThousand(processedCount)) {
logger.info(`Processing extensions: ${processedCount}`);
Expand Down

0 comments on commit 9c08370

Please sign in to comment.