Skip to content

Commit 8cc3538

Browse files
committed
feat(dashboard): Audit deep surface — filters, row detail, source badge, CSV export (A4) (#926)
Synced from sferarc/pgbeam@6a695fa
1 parent b3cccae commit 8cc3538

7 files changed

Lines changed: 221 additions & 4 deletions

File tree

src/generated/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ export type { AnomalyAlert, AnomalyAlertSeverityEnumKey, AnomalyAlertStatusEnumK
55
export type { ApprovalDecisionRequest } from "./types/ApprovalDecisionRequest";
66
export type { ApprovalRequest, ApprovalRequestStatusEnumKey } from "./types/ApprovalRequest";
77
export type { ApproveApprovalRequestData, ApproveApprovalRequestPathApprovalId, ApproveApprovalRequestPathProjectId, ApproveApprovalRequestRequestConfig, ApproveApprovalRequestResponse, ApproveApprovalRequestResponses, ApproveApprovalRequestStatus200, ApproveApprovalRequestStatus400, ApproveApprovalRequestStatus401, ApproveApprovalRequestStatus403, ApproveApprovalRequestStatus404, ApproveApprovalRequestStatus409 } from "./types/ApproveApprovalRequest";
8+
export type { AuditDecision, AuditDecisionKey } from "./types/AuditDecision";
89
export type { AuditLogEntry } from "./types/AuditLogEntry";
10+
export type { AuditSource, AuditSourceKey } from "./types/AuditSource";
911
export type { CacheConfig } from "./types/CacheConfig";
1012
export type { CacheRuleEntry, CacheRuleEntryQueryTypeEnumKey, CacheRuleEntryRecommendationEnumKey } from "./types/CacheRuleEntry";
1113
export type { CacheSummary } from "./types/CacheSummary";
@@ -43,6 +45,7 @@ export type { DiscardDatabaseBranchPathBranchId, DiscardDatabaseBranchPathProjec
4345
export type { DnsInstructions } from "./types/DnsInstructions";
4446
export type { Error } from "./types/Error";
4547
export type { ExportAccountDataRequestConfig, ExportAccountDataResponse, ExportAccountDataResponses, ExportAccountDataStatus200, ExportAccountDataStatus401, ExportAccountDataStatus404, ExportAccountDataStatus429 } from "./types/ExportAccountData";
48+
export type { ExportAuditLogsPathProjectId, ExportAuditLogsQueryCredentialId, ExportAuditLogsQueryDecision, ExportAuditLogsQueryEnd, ExportAuditLogsQueryEvent, ExportAuditLogsQuerySource, ExportAuditLogsQueryStart, ExportAuditLogsRequestConfig, ExportAuditLogsResponse, ExportAuditLogsResponses, ExportAuditLogsStatus200, ExportAuditLogsStatus400, ExportAuditLogsStatus401, ExportAuditLogsStatus403, ExportAuditLogsStatus404, ExportAuditLogsStatus429 } from "./types/ExportAuditLogs";
4649
export type { GetAgentCredentialPathAgentId, GetAgentCredentialPathProjectId, GetAgentCredentialRequestConfig, GetAgentCredentialResponse, GetAgentCredentialResponses, GetAgentCredentialStatus200, GetAgentCredentialStatus400, GetAgentCredentialStatus401, GetAgentCredentialStatus403, GetAgentCredentialStatus404 } from "./types/GetAgentCredential";
4750
export type { GetDatabasePathDatabaseId, GetDatabasePathProjectId, GetDatabaseRequestConfig, GetDatabaseResponse, GetDatabaseResponses, GetDatabaseStatus200, GetDatabaseStatus400, GetDatabaseStatus401, GetDatabaseStatus403, GetDatabaseStatus404, GetDatabaseStatus429 } from "./types/GetDatabase";
4851
export type { GetHealthRequestConfig, GetHealthResponse, GetHealthResponses, GetHealthStatus200, GetHealthStatus429 } from "./types/GetHealth";
@@ -67,7 +70,7 @@ export type { ListAnomalyAlertsPathProjectId, ListAnomalyAlertsQueryPageSize, Li
6770
export type { ListAnomalyAlertsResponse } from "./types/ListAnomalyAlertsResponse";
6871
export type { ListApprovalRequestsPathProjectId, ListApprovalRequestsQueryPageSize, ListApprovalRequestsQueryPageToken, ListApprovalRequestsQueryStatus, ListApprovalRequestsRequestConfig, ListApprovalRequestsResponses, ListApprovalRequestsStatus200, ListApprovalRequestsStatus400, ListApprovalRequestsStatus401, ListApprovalRequestsStatus403, ListApprovalRequestsStatus404, ListApprovalRequestsStatus429 } from "./types/ListApprovalRequests";
6972
export type { ListApprovalRequestsResponse } from "./types/ListApprovalRequestsResponse";
70-
export type { ListAuditLogsPathProjectId, ListAuditLogsQueryBefore, ListAuditLogsQueryCredentialId, ListAuditLogsQueryEvent, ListAuditLogsQueryPageSize, ListAuditLogsRequestConfig, ListAuditLogsResponses, ListAuditLogsStatus200, ListAuditLogsStatus400, ListAuditLogsStatus401, ListAuditLogsStatus403, ListAuditLogsStatus404, ListAuditLogsStatus429 } from "./types/ListAuditLogs";
73+
export type { ListAuditLogsPathProjectId, ListAuditLogsQueryBefore, ListAuditLogsQueryCredentialId, ListAuditLogsQueryDecision, ListAuditLogsQueryEnd, ListAuditLogsQueryEvent, ListAuditLogsQueryPageSize, ListAuditLogsQuerySource, ListAuditLogsQueryStart, ListAuditLogsRequestConfig, ListAuditLogsResponses, ListAuditLogsStatus200, ListAuditLogsStatus400, ListAuditLogsStatus401, ListAuditLogsStatus403, ListAuditLogsStatus404, ListAuditLogsStatus429 } from "./types/ListAuditLogs";
7174
export type { ListAuditLogsResponse } from "./types/ListAuditLogsResponse";
7275
export type { ListCacheRulesPathDatabaseId, ListCacheRulesPathProjectId, ListCacheRulesQueryPageSize, ListCacheRulesQueryPageToken, ListCacheRulesRequestConfig, ListCacheRulesResponses, ListCacheRulesStatus200, ListCacheRulesStatus400, ListCacheRulesStatus401, ListCacheRulesStatus403, ListCacheRulesStatus404, ListCacheRulesStatus429 } from "./types/ListCacheRules";
7376
export type { ListCacheRulesResponse } from "./types/ListCacheRulesResponse";
@@ -162,6 +165,8 @@ export type { WebhookTestResponse } from "./types/WebhookTestResponse";
162165
export { agentCredentialAuthMethodEnum, agentCredentialPrincipalTypeEnum, agentCredentialStatusEnum } from "./types/AgentCredential";
163166
export { anomalyAlertSeverityEnum, anomalyAlertStatusEnum } from "./types/AnomalyAlert";
164167
export { approvalRequestStatusEnum } from "./types/ApprovalRequest";
168+
export { auditDecision } from "./types/AuditDecision";
169+
export { auditSource } from "./types/AuditSource";
165170
export { cacheRuleEntryQueryTypeEnum, cacheRuleEntryRecommendationEnum } from "./types/CacheRuleEntry";
166171
export { createAgentCredentialRequestPrincipalTypeEnum } from "./types/CreateAgentCredentialRequest";
167172
export { createProjectRequestCloudEnum } from "./types/CreateProjectRequest";

src/generated/operations-map.gen.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import type { ListApprovalRequestsRequestConfig, ListApprovalRequestsStatus200 }
1616
import type { ApproveApprovalRequestRequestConfig, ApproveApprovalRequestStatus200 } from "./types/ApproveApprovalRequest";
1717
import type { RejectApprovalRequestRequestConfig, RejectApprovalRequestStatus200 } from "./types/RejectApprovalRequest";
1818
import type { ListAuditLogsRequestConfig, ListAuditLogsStatus200 } from "./types/ListAuditLogs";
19+
import type { ExportAuditLogsRequestConfig, ExportAuditLogsStatus200 } from "./types/ExportAuditLogs";
1920
import type { ListPlansStatus200 } from "./types/ListPlans";
2021
import type { GetOrganizationPlanRequestConfig, GetOrganizationPlanStatus200 } from "./types/GetOrganizationPlan";
2122
import type { UpdateSpendLimitRequestConfig, UpdateSpendLimitStatus200 } from "./types/UpdateSpendLimit";
@@ -84,6 +85,7 @@ export const operationsByTag = {
8485
revokeAgentCredential: { method: "DELETE", path: "/v1/projects/{project_id}/agents/{agent_id}" },
8586
rotateAgentCredential: { method: "POST", path: "/v1/projects/{project_id}/agents/{agent_id}/rotate" },
8687
listAuditLogs: { method: "GET", path: "/v1/projects/{project_id}/audit-logs" },
88+
exportAuditLogs: { method: "GET", path: "/v1/projects/{project_id}/audit-logs/export" },
8789
},
8890
anomalies: {
8991
listAnomalyAlerts: { method: "GET", path: "/v1/projects/{project_id}/anomalies" },
@@ -181,6 +183,7 @@ export const operationsByPath = {
181183
"POST /v1/projects/{project_id}/approvals/{approval_id}/approve": { method: "POST", path: "/v1/projects/{project_id}/approvals/{approval_id}/approve", operationId: "approveApprovalRequest" },
182184
"POST /v1/projects/{project_id}/approvals/{approval_id}/reject": { method: "POST", path: "/v1/projects/{project_id}/approvals/{approval_id}/reject", operationId: "rejectApprovalRequest" },
183185
"GET /v1/projects/{project_id}/audit-logs": { method: "GET", path: "/v1/projects/{project_id}/audit-logs", operationId: "listAuditLogs" },
186+
"GET /v1/projects/{project_id}/audit-logs/export": { method: "GET", path: "/v1/projects/{project_id}/audit-logs/export", operationId: "exportAuditLogs" },
184187
"GET /v1/plans": { method: "GET", path: "/v1/plans", operationId: "listPlans" },
185188
"GET /v1/organizations/{org_id}/plan": { method: "GET", path: "/v1/organizations/{org_id}/plan", operationId: "getOrganizationPlan" },
186189
"PUT /v1/organizations/{org_id}/spend-limit": { method: "PUT", path: "/v1/organizations/{org_id}/spend-limit", operationId: "updateSpendLimit" },
@@ -248,6 +251,7 @@ type ListApprovalRequestsParams = { pathParams: NonNullable<ListApprovalRequests
248251
type ApproveApprovalRequestParams = { pathParams: NonNullable<ApproveApprovalRequestRequestConfig["pathParams"]>; body: NonNullable<ApproveApprovalRequestRequestConfig["data"]> };
249252
type RejectApprovalRequestParams = { pathParams: NonNullable<RejectApprovalRequestRequestConfig["pathParams"]>; body: NonNullable<RejectApprovalRequestRequestConfig["data"]> };
250253
type ListAuditLogsParams = { pathParams: NonNullable<ListAuditLogsRequestConfig["pathParams"]>; queryParams?: NonNullable<ListAuditLogsRequestConfig["queryParams"]> };
254+
type ExportAuditLogsParams = { pathParams: NonNullable<ExportAuditLogsRequestConfig["pathParams"]>; queryParams?: NonNullable<ExportAuditLogsRequestConfig["queryParams"]> };
251255
type GetOrganizationPlanParams = { pathParams: NonNullable<GetOrganizationPlanRequestConfig["pathParams"]> };
252256
type UpdateSpendLimitParams = { pathParams: NonNullable<UpdateSpendLimitRequestConfig["pathParams"]>; body: NonNullable<UpdateSpendLimitRequestConfig["data"]> };
253257
type SubmitCancellationFeedbackParams = { pathParams: NonNullable<SubmitCancellationFeedbackRequestConfig["pathParams"]>; body: NonNullable<SubmitCancellationFeedbackRequestConfig["data"]> };
@@ -313,6 +317,7 @@ export interface ApiOperations {
313317
revokeAgentCredential(params: RevokeAgentCredentialParams): Promise<void>;
314318
rotateAgentCredential(params: RotateAgentCredentialParams): Promise<RotateAgentCredentialStatus200>;
315319
listAuditLogs(params: ListAuditLogsParams): Promise<ListAuditLogsStatus200>;
320+
exportAuditLogs(params: ExportAuditLogsParams): Promise<ExportAuditLogsStatus200>;
316321
};
317322
anomalies: {
318323
listAnomalyAlerts(params: ListAnomalyAlertsParams): Promise<ListAnomalyAlertsStatus200>;
@@ -410,6 +415,7 @@ export interface RequestMap {
410415
"POST /v1/projects/{project_id}/approvals/{approval_id}/approve": { params: ApproveApprovalRequestParams; response: ApproveApprovalRequestStatus200 };
411416
"POST /v1/projects/{project_id}/approvals/{approval_id}/reject": { params: RejectApprovalRequestParams; response: RejectApprovalRequestStatus200 };
412417
"GET /v1/projects/{project_id}/audit-logs": { params: ListAuditLogsParams; response: ListAuditLogsStatus200 };
418+
"GET /v1/projects/{project_id}/audit-logs/export": { params: ExportAuditLogsParams; response: ExportAuditLogsStatus200 };
413419
"GET /v1/plans": { params?: undefined; response: ListPlansStatus200 };
414420
"GET /v1/organizations/{org_id}/plan": { params: GetOrganizationPlanParams; response: GetOrganizationPlanStatus200 };
415421
"PUT /v1/organizations/{org_id}/spend-limit": { params: UpdateSpendLimitParams; response: UpdateSpendLimitStatus200 };
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Generated by Kubb (https://kubb.dev/).
3+
* Do not edit manually.
4+
*/
5+
6+
export const auditDecision = {
7+
allow: "allow",
8+
block: "block",
9+
mask: "mask",
10+
truncate: "truncate"
11+
} as const;
12+
13+
export type AuditDecisionKey = (typeof auditDecision)[keyof typeof auditDecision];
14+
15+
/**
16+
* @description Coarse outcome filter that groups events. `allow` = query; `block` = blocked, budget_exhausted, auth_failed, credential_expired; `mask` = masked; `truncate` = truncated.
17+
* @type string | undefined
18+
*/
19+
export type AuditDecision = AuditDecisionKey | undefined;

src/generated/types/AuditSource.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* Generated by Kubb (https://kubb.dev/).
3+
* Do not edit manually.
4+
*/
5+
6+
export const auditSource = {
7+
wire: "wire",
8+
mcp: "mcp",
9+
control: "control"
10+
} as const;
11+
12+
export type AuditSourceKey = (typeof auditSource)[keyof typeof auditSource];
13+
14+
/**
15+
* @description Filter by statement origin (wire, mcp, or control).
16+
* @type string | undefined
17+
*/
18+
export type AuditSource = AuditSourceKey | undefined;
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
/**
2+
* Generated by Kubb (https://kubb.dev/).
3+
* Do not edit manually.
4+
*/
5+
6+
import type { AuditDecisionKey } from "./AuditDecision";
7+
import type { AuditSourceKey } from "./AuditSource";
8+
import type { Error } from "./Error";
9+
10+
/**
11+
* @description Unique project identifier (prefixed, e.g. prj_xxx).
12+
* @pattern ^[a-zA-Z0-9_.-]+$
13+
* @type string
14+
*/
15+
export type ExportAuditLogsPathProjectId = string;
16+
17+
/**
18+
* @description Filter to a single agent credential.
19+
* @pattern ^[a-zA-Z0-9_.-]+$
20+
* @type string | undefined
21+
*/
22+
export type ExportAuditLogsQueryCredentialId = string | undefined;
23+
24+
/**
25+
* @description Filter to a single event type (e.g. blocked, masked, query).
26+
* @pattern ^[a-z_]+$
27+
* @type string | undefined
28+
*/
29+
export type ExportAuditLogsQueryEvent = string | undefined;
30+
31+
/**
32+
* @description Coarse outcome filter that groups events. `allow` = query; `block` = blocked, budget_exhausted, auth_failed, credential_expired; `mask` = masked; `truncate` = truncated.
33+
* @type string | undefined
34+
*/
35+
export type ExportAuditLogsQueryDecision = AuditDecisionKey | undefined;
36+
37+
/**
38+
* @description Filter by statement origin (wire, mcp, or control).
39+
* @type string | undefined
40+
*/
41+
export type ExportAuditLogsQuerySource = AuditSourceKey | undefined;
42+
43+
/**
44+
* @description Return entries at or after this timestamp (inclusive lower bound).
45+
* @type string | undefined
46+
*/
47+
export type ExportAuditLogsQueryStart = string | undefined;
48+
49+
/**
50+
* @description Return entries strictly older than this timestamp (cursor / upper bound).
51+
* @type string | undefined
52+
*/
53+
export type ExportAuditLogsQueryEnd = string | undefined;
54+
55+
/**
56+
* @type string
57+
*/
58+
export type ExportAuditLogsStatus200 = string;
59+
60+
/**
61+
* @description Standard error response envelope for PgBeam API requests.
62+
* @type object
63+
*/
64+
export type ExportAuditLogsStatus400 = Error;
65+
66+
/**
67+
* @description Standard error response envelope for PgBeam API requests.
68+
* @type object
69+
*/
70+
export type ExportAuditLogsStatus401 = Error;
71+
72+
/**
73+
* @description Standard error response envelope for PgBeam API requests.
74+
* @type object
75+
*/
76+
export type ExportAuditLogsStatus403 = Error;
77+
78+
/**
79+
* @description Standard error response envelope for PgBeam API requests.
80+
* @type object
81+
*/
82+
export type ExportAuditLogsStatus404 = Error;
83+
84+
/**
85+
* @description Standard error response envelope for PgBeam API requests.
86+
* @type object
87+
*/
88+
export type ExportAuditLogsStatus429 = Error;
89+
90+
/**
91+
* @type object
92+
*/
93+
export type ExportAuditLogsRequestConfig = {
94+
data?: never;
95+
/**
96+
* @type object
97+
*/
98+
pathParams: {
99+
project_id: ExportAuditLogsPathProjectId;
100+
};
101+
/**
102+
* @type object | undefined
103+
*/
104+
queryParams?: {
105+
credential_id?: ExportAuditLogsQueryCredentialId;
106+
event?: ExportAuditLogsQueryEvent;
107+
decision?: ExportAuditLogsQueryDecision;
108+
source?: ExportAuditLogsQuerySource;
109+
start?: ExportAuditLogsQueryStart;
110+
end?: ExportAuditLogsQueryEnd;
111+
};
112+
headerParams?: never;
113+
/**
114+
* @type string
115+
*/
116+
url: `/v1/projects/${string}/audit-logs/export`;
117+
};
118+
119+
/**
120+
* @type object
121+
*/
122+
export type ExportAuditLogsResponses = {
123+
"200": ExportAuditLogsStatus200;
124+
"400": ExportAuditLogsStatus400;
125+
"401": ExportAuditLogsStatus401;
126+
"403": ExportAuditLogsStatus403;
127+
"404": ExportAuditLogsStatus404;
128+
"429": ExportAuditLogsStatus429;
129+
};
130+
131+
/**
132+
* @description Union of all possible responses
133+
*/
134+
export type ExportAuditLogsResponse = (ExportAuditLogsStatus200 | ExportAuditLogsStatus400 | ExportAuditLogsStatus401 | ExportAuditLogsStatus403 | ExportAuditLogsStatus404 | ExportAuditLogsStatus429);

src/generated/types/ListAuditLogs.ts

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Do not edit manually.
44
*/
55

6+
import type { AuditDecisionKey } from "./AuditDecision";
7+
import type { AuditSourceKey } from "./AuditSource";
68
import type { Error } from "./Error";
79
import type { ListAuditLogsResponse } from "./ListAuditLogsResponse";
810

@@ -21,14 +23,38 @@ export type ListAuditLogsPathProjectId = string;
2123
export type ListAuditLogsQueryCredentialId = string | undefined;
2224

2325
/**
24-
* @description Filter to a single event type (e.g. blocked).
26+
* @description Filter to a single event type (e.g. blocked, masked, query).
2527
* @pattern ^[a-z_]+$
2628
* @type string | undefined
2729
*/
2830
export type ListAuditLogsQueryEvent = string | undefined;
2931

3032
/**
31-
* @description Return entries strictly older than this timestamp (cursor).
33+
* @description Coarse outcome filter that groups events. `allow` = query; `block` = blocked, budget_exhausted, auth_failed, credential_expired; `mask` = masked; `truncate` = truncated.
34+
* @type string | undefined
35+
*/
36+
export type ListAuditLogsQueryDecision = AuditDecisionKey | undefined;
37+
38+
/**
39+
* @description Filter by statement origin (wire, mcp, or control).
40+
* @type string | undefined
41+
*/
42+
export type ListAuditLogsQuerySource = AuditSourceKey | undefined;
43+
44+
/**
45+
* @description Return entries at or after this timestamp (inclusive lower bound).
46+
* @type string | undefined
47+
*/
48+
export type ListAuditLogsQueryStart = string | undefined;
49+
50+
/**
51+
* @description Return entries strictly older than this timestamp (cursor / upper bound).
52+
* @type string | undefined
53+
*/
54+
export type ListAuditLogsQueryEnd = string | undefined;
55+
56+
/**
57+
* @description Return entries strictly older than this timestamp (keyset pagination cursor).
3258
* @type string | undefined
3359
*/
3460
export type ListAuditLogsQueryBefore = string | undefined;
@@ -95,6 +121,10 @@ export type ListAuditLogsRequestConfig = {
95121
queryParams?: {
96122
credential_id?: ListAuditLogsQueryCredentialId;
97123
event?: ListAuditLogsQueryEvent;
124+
decision?: ListAuditLogsQueryDecision;
125+
source?: ListAuditLogsQuerySource;
126+
start?: ListAuditLogsQueryStart;
127+
end?: ListAuditLogsQueryEnd;
98128
before?: ListAuditLogsQueryBefore;
99129
page_size?: ListAuditLogsQueryPageSize;
100130
};

0 commit comments

Comments
 (0)