UNPKG

business-as-code

Version:

Primitives for expressing business logic and processes as code

106 lines 3.32 kB
/** * Business goals definition and tracking * * Uses org.ai Goal types for standardized goal definitions across the ecosystem. */ import type { GoalDefinition } from './types.js'; import type { Goal as OrgGoal, Goals as OrgGoals, GoalStatus, GoalCategory, GoalPriority } from 'org.ai'; export type { OrgGoal, OrgGoals, GoalStatus, GoalCategory, GoalPriority }; /** * Convert a business-as-code GoalDefinition to an org.ai Goal * * @param definition - Business goal definition * @param id - Unique identifier for the goal * @returns org.ai Goal object */ export declare function toOrgGoal(definition: GoalDefinition, id: string): OrgGoal; /** * Convert an org.ai Goal to a business-as-code GoalDefinition * * @param goal - org.ai Goal object * @returns Business goal definition */ export declare function fromOrgGoal(goal: OrgGoal): GoalDefinition; /** * Define a business goal with metrics and tracking * * @example * ```ts * const goals = Goals([ * { * name: 'Launch MVP', * description: 'Ship minimum viable product to early customers', * category: 'strategic', * targetDate: new Date('2024-06-30'), * owner: 'Product Team', * metrics: ['User signups', 'Feature completion rate'], * status: 'in-progress', * progress: 65, * }, * { * name: 'Achieve Product-Market Fit', * description: 'Validate product value with target customers', * category: 'strategic', * targetDate: new Date('2024-12-31'), * owner: 'CEO', * metrics: ['NPS > 50', 'Churn < 5%', '100+ paying customers'], * status: 'in-progress', * progress: 30, * dependencies: ['Launch MVP'], * }, * ]) * ``` */ export declare function Goals(definitions: GoalDefinition[]): GoalDefinition[]; /** * Define a single goal */ export declare function Goal(definition: GoalDefinition): GoalDefinition; /** * Update goal progress */ export declare function updateProgress(goal: GoalDefinition, progress: number): GoalDefinition; /** * Mark goal as at-risk */ export declare function markAtRisk(goal: GoalDefinition): GoalDefinition; /** * Mark goal as completed */ export declare function complete(goal: GoalDefinition): GoalDefinition; /** * Check if goal is overdue */ export declare function isOverdue(goal: GoalDefinition): boolean; /** * Get goals by category */ export declare function getGoalsByCategory(goals: GoalDefinition[], category: GoalDefinition['category']): GoalDefinition[]; /** * Get goals by status */ export declare function getGoalsByStatus(goals: GoalDefinition[], status: GoalDefinition['status']): GoalDefinition[]; /** * Get goals by owner */ export declare function getGoalsByOwner(goals: GoalDefinition[], owner: string): GoalDefinition[]; /** * Calculate overall progress across all goals */ export declare function calculateOverallProgress(goals: GoalDefinition[]): number; /** * Check for circular dependencies */ export declare function hasCircularDependencies(goals: GoalDefinition[]): boolean; /** * Get goals in dependency order */ export declare function sortByDependencies(goals: GoalDefinition[]): GoalDefinition[]; /** * Validate goals */ export declare function validateGoals(goals: GoalDefinition[]): { valid: boolean; errors: string[]; }; //# sourceMappingURL=goals.d.ts.map