@activecollab/components
Version:
ActiveCollab Components
101 lines • 4.37 kB
TypeScript
import { ReactElement } from "react";
/**
* "Webhook Logs" — the VCS webhook delivery log, shown as a wide dialog with a
* filterable, expandable list. Extracted into `shared/` so it can be opened
* from more than one surface (the Apps & Integrations Repositories page and the
* project "..." menu on the Project Repos story).
*
* Mirrors the app's webhook log model:
* `vcs_webhook_logs` → connection_id, event_type, processing_status
* (received / unhandled / skipped / processed /
* failed / duplicate), delivery_identifier, payload,
* created_on
* `vcs_webhook_outcomes` → one row per outcome, each with a localized summary
*
* The status is derived from the outcomes server-side; here we render the
* stored value and map it to a palette colour. The connection glyph is the
* provider icon (GitHub / GitLab, Git for anything else).
*/
type WebhookStatus = "received" | "unhandled" | "skipped" | "processed" | "failed" | "duplicate";
export interface WebhookConnection {
id: string;
name: string;
service: "github" | "gitlab";
}
export interface WebhookRepository {
id: string;
/** Full repository path, e.g. activecollab/feather. */
path: string;
connectionId: string;
}
/**
* Normalized event kind. The processor layer maps each provider's raw event
* header (GitHub `issues` / GitLab `Issue Hook`, GitHub `pull_request` / GitLab
* `Merge Request Hook`, …) onto one provider-agnostic kind, so the same logical
* event reads — and filters — identically across connections instead of
* appearing once per provider. The set below mirrors the app's
* `EVENT_TYPE_OPTIONS` constant.
*/
type WebhookEventKind = "push" | "issue" | "pull_request" | "pull_request_review" | "repository" | "other";
/**
* The task an outcome created or referenced. In the app each
* `vcs_webhook_outcomes` row carries a nullable `task_id`; when it is set the
* outcome offers an "Open Task" link that opens the task in a sheet on top of
* the log dialog.
*/
export interface WebhookOutcomeTask {
id: number;
name: string;
projectName: string;
description: string;
}
export interface WebhookOutcome {
/** Localized outcome summary (the app's `getVerboseDescription`). */
summary: string;
/** Set when the outcome created or referenced a task. */
task?: WebhookOutcomeTask;
}
export interface WebhookLog {
id: string;
connectionId: string;
/** Repository the delivery belongs to (always within `connectionId`). */
repositoryId: string;
eventKind: WebhookEventKind;
status: WebhookStatus;
/** X-GitHub-Delivery GUID / X-Gitlab-Event-UUID. */
deliveryIdentifier: string;
/** Outcome rows; empty when we never reached that stage. */
outcomes: WebhookOutcome[];
/** Pretty-printed JSON payload; absent when no JSON body was logged. */
payload?: string;
/** Epoch seconds; drives sorting and the relative Time column. */
receivedAt: number;
}
export declare const WEBHOOK_CONNECTIONS: WebhookConnection[];
/**
* Repositories that belong to the connections above. A webhook delivery is
* always scoped to one repository, and a repository belongs to exactly one
* connection — so the Repository filter can be narrowed to the connection(s)
* currently selected in the Connection filter.
*/
export declare const WEBHOOK_REPOSITORIES: WebhookRepository[];
export interface WebhookLogsDialogProps {
open: boolean;
onClose: () => void;
/** Pre-filter to a single connection (used when opened from its row menu). */
initialConnectionId?: string;
/**
* Pre-filter to a set of connections (e.g. the connections a project's
* repositories belong to). Takes precedence over `initialConnectionId`.
*/
connectionIds?: string[];
/**
* Pre-filter to a set of repositories (e.g. the repositories connected to a
* project, when opened from the project "..." menu). Seeds the Repository
* filter; IDs should exist in `WEBHOOK_REPOSITORIES` so their chips render.
*/
repositoryIds?: string[];
}
export declare const WebhookLogsDialog: ({ open, onClose, initialConnectionId, connectionIds, repositoryIds, }: WebhookLogsDialogProps) => ReactElement;
export {};
//# sourceMappingURL=WebhookLogsDialog.d.ts.map