Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import { ReportFileApi } from "./report-file.api";
export class AccessReportApi extends BaseResponse {
id: string = "";
organizationId: string = "";
reports: string = "";
applications: string = "";
summary: string = "";
reportData: string = "";
applicationData: string = "";
summaryData: string = "";
memberRegistry: string = "";
creationDate: string = "";
contentEncryptionKey: string = "";
Expand All @@ -38,9 +38,9 @@ export class AccessReportApi extends BaseResponse {
this.id = this.getResponseProperty("id");
this.organizationId = this.getResponseProperty("organizationId");
this.creationDate = this.getResponseProperty("creationDate");
this.reports = this.getResponseProperty("reportData");
this.applications = this.getResponseProperty("applicationData");
this.summary = this.getResponseProperty("summaryData");
this.reportData = this.getResponseProperty("reportData");
this.applicationData = this.getResponseProperty("applicationData");
this.summaryData = this.getResponseProperty("summaryData");
this.memberRegistry = this.getResponseProperty("memberRegistry") ?? "";
this.contentEncryptionKey = this.getResponseProperty("contentEncryptionKey");
this.reportFileDownloadUrl = this.getResponseProperty("reportFileDownloadUrl") ?? undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export class AccessReportData {

this.id = response.id;
this.organizationId = response.organizationId;
this.reports = response.reports;
this.applications = response.applications;
this.summary = response.summary;
this.reports = response.reportData;
this.applications = response.applicationData;
this.summary = response.summaryData;
this.creationDate = response.creationDate;
this.contentEncryptionKey = response.contentEncryptionKey;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ export abstract class AccessIntelligenceApiService {
reportFileId: string,
): Observable<void>;

/** GET report data file from a blob storage download URL. Returns raw file text. */
abstract downloadReportFile$(url: string): Observable<string>;

/** GET /reports/organizations/{orgId}/{reportId}/file/download β€” Direct-upload file retrieval. */
abstract getReportFileData$(orgId: OrganizationId, reportId: string): Observable<string>;

/** GET /reports/organizations/{orgId}/data/summary?startDate=&endDate= */
abstract getSummaryDataByDateRange$(
orgId: OrganizationId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,30 @@ export class DefaultAccessIntelligenceApiService extends AccessIntelligenceApiSe

return from(response);
}

downloadReportFile$(url: string): Observable<string> {
return from(
this.apiService
.nativeFetch(new Request(url, { cache: "no-store" }))
.then(async (response) => {
if (response.status !== 200) {
throw new Error(`Failed to download report file: ${response.status}`);
}
const buffer = await response.arrayBuffer();
return new TextDecoder().decode(buffer);
}),
);
}

getReportFileData$(orgId: OrganizationId, reportId: string): Observable<string> {
return from(
this.apiService.send(
"GET",
`/reports/organizations/${orgId}/${reportId}/file/download`,
null,
true,
true,
) as Promise<string>,
);
}
}
Loading
Loading