Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 1x 1x 6x 6x 1x 1x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 1x | import {env} from 'node:process';
import core from '@actions/core';
import GithubAction from "./services/githubAction.js";
import ManualAction from "./services/manualAction.js";
import UmamiService from "./services/umamiService.js";
import ReportGenerator from "./services/reportGenerator.js";
import UmamiServiceBeta from "./services/beta/umamiServiceBeta.js";
import {isSet, logStringifyOf} from "./services/util.js";
const UMAMI_OUTPUT_DIRECTORY = env["UMAMI_OUTPUT_DIRECTORY"] || './umami';
export default class UmamiReport {
static async githubActionReport() {
const result = {};
try {
const {
cloudApiKey, server, username, password, domain,
outputFile, reportContent,
period, unit, timezone,
prefetch
} = GithubAction.getActionInputParameters();
if (!isSet(cloudApiKey) && prefetch) {// hosted mode: optional to prevent flaky first connect timeout
await UmamiServiceBeta.prefetchUmamiServerApi(
{server, username, password}
);
}
const {
site,
siteStats,
sitePageViews,
siteEvents,
siteSessions,
siteMetricsUrl
} = await UmamiService.fetchUmamiData(
{
cloudApiKey, server, username, password, domain,
period, unit, timezone,
reportContent
});
const outputFilename = isSet(UMAMI_OUTPUT_DIRECTORY) && isSet(outputFile) ?
`${UMAMI_OUTPUT_DIRECTORY}/${outputFile}` : null;
const {
umamiOneLineReport,
umamiReport,
pageViews,
umamiReportFile = undefined
} = await ReportGenerator.produceReportData({
site, siteStats, sitePageViews, siteEvents, siteSessions, siteMetricsUrl,
outputFilename, reportContent, period
});
const reportResult = await GithubAction.reportResults({
pageViews,
umamiOneLineReport,
umamiReport,
umamiReportFile
});
result.success = reportResult
core.info(`RESULT : ${JSON.stringify(reportResult)}`);
return result;
} catch (error) {
console.info(`ERROR: ${error}`)
core.setFailed(error);
result.error = error
return result;
}
}
static getOptions(overrides = {}) {
return ManualAction.getOptions(overrides);
}
static async manualReport({
cloudApiKey, cloudDomain,
server, username, password, domain,
period, unit, timezone,
outputFile, reportContent,
prefetch = "false"
}) {
if (!isSet(cloudApiKey) && prefetch === "true") {// hosted mode : optional to prevent flaky first connect timeout
await UmamiServiceBeta.prefetchUmamiServerApi({server, username, password})
.then(logStringifyOf)
}
const {
site,
siteStats,
sitePageViews,
siteEvents,
siteSessions,
siteMetricsUrl
} = await UmamiService.fetchUmamiData(
{
cloudApiKey,
server, username, password,
"domain": isSet(cloudApiKey) ? cloudDomain : domain,
period, unit, timezone,
reportContent
}
);
const outputFilename = isSet(UMAMI_OUTPUT_DIRECTORY) && isSet(outputFile) ?
`${UMAMI_OUTPUT_DIRECTORY}/${outputFile}` : null;
const {
umamiOneLineReport,
umamiReport,
pageViews,
umamiReportFile = undefined,
} = await ReportGenerator.produceReportData({
site, siteStats, sitePageViews, siteEvents, siteSessions, siteMetricsUrl,
outputFilename, reportContent, period
});
return await ManualAction.report({
umamiOneLineReport, umamiReport, pageViews,
umamiReportFile
});
}
}
|