feat: support governed cascade deletion

This commit is contained in:
hectorzhao
2026-08-09 19:08:38 +08:00
parent 6add563ee8
commit 7804f64ced
9 changed files with 476 additions and 47 deletions
+20 -2
View File
@@ -6,7 +6,17 @@ export const DEFAULT_CLIENT_TENANT_ID = 'tenant-a';
export type DeletionTargetType = 'channel' | 'signature' | 'template';
export type DeletionDependency = { kind: string; label: string; count: number; items: string[] };
export type DeletionResolutionAction = 'delete_associated_templates' | 'delete_associated_drainage' | 'abandon_associated_report_tasks';
export type DeletionDependency = { kind: string; label: string; count: number; items: string[]; detailsVisible: boolean };
export type DeletionRequiredSelection = {
action: DeletionResolutionAction;
dependencyKind: string;
label: string;
description: string;
count: number;
};
export type DeletionPreflight = {
type: DeletionTargetType;
@@ -14,13 +24,21 @@ export type DeletionPreflight = {
expectedUpdatedAt: string;
identity: Record<string, string>;
dependencies: DeletionDependency[];
requiredSelections: DeletionRequiredSelection[];
impacts: string[];
blockedReasons: string[];
allowedActions: Array<'delete'>;
recoverability: { mode: 'soft_delete'; description: string };
};
export type DeleteTargetRequest = { expectedUpdatedAt: string; idempotencyKey: string; reason: string };
export type DeleteTargetRequest = {
expectedUpdatedAt: string;
idempotencyKey: string;
reason?: string;
deleteAssociatedTemplates?: boolean;
deleteAssociatedDrainage?: boolean;
abandonAssociatedReportTasks?: boolean;
};
export type DeletionResult = { operationId: string; status: 'deleted'; replayed: boolean };