armor-editor
Version:
Advanced rich text editor with premium armor-grade security, real-time collaboration, spell checking, track changes, and framework-agnostic design for React, Vue, Angular, Next.js, Nuxt.js
80 lines (79 loc) • 2.52 kB
TypeScript
export interface WorkflowStep {
id: string;
name: string;
type: 'approval' | 'review' | 'notification' | 'automation';
assignee?: string;
dueDate?: Date;
status: 'pending' | 'in_progress' | 'completed' | 'rejected';
conditions?: WorkflowCondition[];
actions?: WorkflowAction[];
}
export interface WorkflowCondition {
field: string;
operator: 'equals' | 'contains' | 'greater_than' | 'less_than';
value: any;
}
export interface WorkflowAction {
type: 'email' | 'webhook' | 'status_change' | 'assignment';
config: Record<string, any>;
}
export interface Workflow {
id: string;
name: string;
description: string;
trigger: WorkflowTrigger;
steps: WorkflowStep[];
isActive: boolean;
createdBy: string;
createdAt: Date;
}
export interface WorkflowTrigger {
event: 'document_created' | 'document_updated' | 'document_shared' | 'manual';
conditions?: WorkflowCondition[];
}
export declare class WorkflowSystem {
private workflows;
private activeWorkflows;
private editor;
constructor(editor: any);
private setupDefaultWorkflows;
private setupEventListeners;
startWorkflow(workflowId: string, documentId: string, initiatedBy: string): string;
approveStep(executionId: string, stepId: string, approver: string, comments?: string): boolean;
rejectStep(executionId: string, stepId: string, rejector: string, reason: string): boolean;
private processNextStep;
private executeActions;
private evaluateConditions;
private getContextValue;
private checkWorkflowTriggers;
private sendNotification;
private showWorkflowNotification;
private sendEmail;
private callWebhook;
private updateDocumentStatus;
private assignDocument;
private generateExecutionId;
getActiveWorkflows(): WorkflowExecution[];
getWorkflowHistory(documentId: string): WorkflowExecution[];
createWorkflow(workflow: Omit<Workflow, 'id' | 'createdAt'>): string;
showWorkflowDashboard(): void;
}
interface WorkflowExecution {
id: string;
workflowId: string;
documentId: string;
initiatedBy: string;
startedAt: Date;
completedAt?: Date;
status: 'running' | 'completed' | 'rejected' | 'paused';
currentStep: number;
stepHistory: {
stepId: string;
action: 'approved' | 'rejected' | 'completed';
actor: string;
timestamp: Date;
comments?: string;
}[];
context: Record<string, any>;
}
export {};