@mrck-labs/vanaheim-shared 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/types/linear.ts","../src/constants/index.ts","../src/utils/formatters.ts","../src/utils/generators.ts","../src/utils/validators.ts","../src/utils/calculations.ts"],"sourcesContent":["/**\n * @vanaheim/shared\n *\n * Shared types, constants, and utilities for Vanaheim apps.\n */\n\n// Types\nexport * from \"./types\";\n\n// Constants\nexport * from \"./constants\";\n\n// Utils\nexport * from \"./utils\";\n","/**\n * Linear API Types\n *\n * Types for interacting with Linear's GraphQL API.\n */\n\n// ============================================================================\n// User Types\n// ============================================================================\n\nexport interface LinearUser {\n id: string\n name: string\n email: string\n avatarUrl: string | null\n}\n\n// ============================================================================\n// Project Types\n// ============================================================================\n\nexport interface LinearProject {\n id: string\n name: string\n color: string\n}\n\n// ============================================================================\n// State Types\n// ============================================================================\n\nexport type LinearStateType =\n | 'backlog'\n | 'unstarted'\n | 'started'\n | 'completed'\n | 'canceled'\n\nexport interface LinearState {\n id: string\n name: string\n color: string\n type: LinearStateType\n}\n\n// ============================================================================\n// Issue Types\n// ============================================================================\n\nexport type LinearPriority = 0 | 1 | 2 | 3 | 4\n\nexport const LINEAR_PRIORITY_LABELS: Record<LinearPriority, string> = {\n 0: 'No priority',\n 1: 'Urgent',\n 2: 'High',\n 3: 'Medium',\n 4: 'Low',\n}\n\nexport interface LinearIssue {\n id: string\n identifier: string\n title: string\n description: string | null\n priority: LinearPriority\n priorityLabel: string\n dueDate: string | null\n url: string\n state: LinearState | null\n project: LinearProject | null\n createdAt: string\n updatedAt: string\n}\n\n// ============================================================================\n// Query Types\n// ============================================================================\n\nexport interface IssueQueryOptions {\n projectId?: string\n search?: string\n cursor?: string\n limit?: number\n}\n\nexport interface PaginatedIssues {\n issues: LinearIssue[]\n hasNextPage: boolean\n endCursor: string | null\n totalCount: number\n}\n\n","/**\n * Shared Constants\n *\n * Common constants used across Vanaheim apps.\n */\n\n// ============================================================================\n// Currency\n// ============================================================================\n\nexport const CURRENCIES = ['CHF', 'USD', 'EUR', 'PLN'] as const\nexport type Currency = (typeof CURRENCIES)[number]\n\nexport const CURRENCY_SYMBOLS: Record<Currency, string> = {\n CHF: 'CHF',\n USD: '$',\n EUR: '€',\n PLN: 'zł',\n}\n\nexport const CURRENCY_NAMES: Record<Currency, string> = {\n CHF: 'Swiss Franc',\n USD: 'US Dollar',\n EUR: 'Euro',\n PLN: 'Polish Złoty',\n}\n\n// ============================================================================\n// Frequency\n// ============================================================================\n\nexport const FREQUENCIES = [\n 'monthly',\n 'yearly',\n '6-monthly',\n 'weekly',\n 'one-time',\n] as const\nexport type Frequency = (typeof FREQUENCIES)[number]\n\nexport const FREQUENCY_LABELS: Record<Frequency, string> = {\n monthly: 'Monthly',\n yearly: 'Yearly',\n '6-monthly': 'Every 6 Months',\n weekly: 'Weekly',\n 'one-time': 'One Time',\n}\n\nexport const FREQUENCY_MULTIPLIERS: Record<Frequency, number> = {\n monthly: 12,\n yearly: 1,\n '6-monthly': 2,\n weekly: 52,\n 'one-time': 1,\n}\n\n// ============================================================================\n// Focus\n// ============================================================================\n\nexport const DEFAULT_FOCUS_DURATIONS = [15, 25, 30, 45, 60, 90] as const\nexport type FocusDuration = (typeof DEFAULT_FOCUS_DURATIONS)[number]\n\nexport const FOCUS_STATUS = ['active', 'completed', 'abandoned'] as const\nexport type FocusStatus = (typeof FOCUS_STATUS)[number]\n\n// ============================================================================\n// Linear\n// ============================================================================\n\nexport const LINEAR_PRIORITIES = [0, 1, 2, 3, 4] as const\nexport type LinearPriorityValue = (typeof LINEAR_PRIORITIES)[number]\n\nexport const LINEAR_PRIORITY_COLORS: Record<LinearPriorityValue, string> = {\n 0: '#6b7280', // No priority - gray\n 1: '#ef4444', // Urgent - red\n 2: '#f97316', // High - orange\n 3: '#eab308', // Medium - yellow\n 4: '#3b82f6', // Low - blue\n}\n\n// ============================================================================\n// Cloud Agents\n// ============================================================================\n\nexport const CLOUD_AGENT_STATUSES = [\n 'CREATING',\n 'RUNNING',\n 'FINISHED',\n 'FAILED',\n 'CANCELLED',\n] as const\n\nexport const CLOUD_AGENT_STATUS_EMOJI: Record<string, string> = {\n CREATING: '🔨',\n RUNNING: '⏳',\n FINISHED: '✅',\n FAILED: '❌',\n CANCELLED: '🚫',\n}\n\nexport const CLOUD_AGENT_STATUS_COLORS: Record<string, string> = {\n CREATING: '#3b82f6',\n RUNNING: '#3b82f6',\n FINISHED: '#10b981',\n FAILED: '#ef4444',\n CANCELLED: '#6b7280',\n}\n\n// ============================================================================\n// API URLs\n// ============================================================================\n\nexport const API_URLS = {\n CURSOR_CLOUD: 'https://api.cursor.com',\n LINEAR_GRAPHQL: 'https://api.linear.app/graphql',\n} as const\n\n// ============================================================================\n// Settings Keys\n// ============================================================================\n\nexport const SETTING_KEYS = {\n // AI\n AI_MODEL: 'ai_model',\n AI_REASONING_ENABLED: 'ai_reasoning_enabled',\n\n // API Keys\n OPENAI_API_KEY: 'openai_api_key',\n ANTHROPIC_API_KEY: 'anthropic_api_key',\n CURSOR_API_KEY: 'cursor_api_key',\n LINEAR_API_KEY: 'linear_api_key',\n\n // Google\n GOOGLE_CLIENT_ID: 'google_client_id',\n GOOGLE_CLIENT_SECRET: 'google_client_secret',\n GOOGLE_CALENDAR_TOKENS: 'google_calendar_tokens',\n SELECTED_CALENDAR_IDS: 'selected_calendar_ids',\n} as const\n\nexport type SettingKey = (typeof SETTING_KEYS)[keyof typeof SETTING_KEYS]\n\n","/**\n * Formatting Utilities\n *\n * Pure functions for formatting data.\n */\n\n/**\n * Format seconds into MM:SS format\n * @example formatTime(125) => \"02:05\"\n */\nexport function formatTime(seconds: number): string {\n const mins = Math.floor(seconds / 60)\n const secs = seconds % 60\n return `${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`\n}\n\n/**\n * Format seconds into human-readable total time\n * @example formatTotalTime(3700) => \"1h 1m\"\n * @example formatTotalTime(1800) => \"30m\"\n */\nexport function formatTotalTime(seconds: number): string {\n const hours = Math.floor(seconds / 3600)\n const mins = Math.floor((seconds % 3600) / 60)\n if (hours > 0) {\n return `${hours}h ${mins}m`\n }\n return `${mins}m`\n}\n\n/**\n * Format a number as currency\n * @example formatCurrency(1234.56, 'CHF') => \"CHF 1,234.56\"\n */\nexport function formatCurrency(\n amount: number,\n currency: string,\n locale: string = 'en-CH'\n): string {\n return new Intl.NumberFormat(locale, {\n style: 'currency',\n currency,\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n }).format(amount)\n}\n\n/**\n * Format a date as relative time (e.g., \"2h ago\", \"3d ago\")\n */\nexport function formatRelativeTime(dateStr: string): string {\n const date = new Date(dateStr)\n const now = new Date()\n const diffMs = now.getTime() - date.getTime()\n const diffMins = Math.floor(diffMs / 60000)\n const diffHours = Math.floor(diffMins / 60)\n const diffDays = Math.floor(diffHours / 24)\n\n if (diffMins < 1) return 'Just now'\n if (diffMins < 60) return `${diffMins}m ago`\n if (diffHours < 24) return `${diffHours}h ago`\n if (diffDays < 7) return `${diffDays}d ago`\n return date.toLocaleDateString()\n}\n\n/**\n * Format a date string to a readable format\n * @example formatDate('2024-01-15') => \"Jan 15, 2024\"\n */\nexport function formatDate(\n dateStr: string,\n options: Intl.DateTimeFormatOptions = {\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n }\n): string {\n return new Date(dateStr).toLocaleDateString('en-US', options)\n}\n\n/**\n * Format a due date with context (Today, Tomorrow, Overdue, etc.)\n */\nexport function formatDueDate(dueDate: string | null): {\n text: string\n isOverdue: boolean\n} {\n if (!dueDate) return { text: '', isOverdue: false }\n\n const due = new Date(dueDate)\n const today = new Date()\n today.setHours(0, 0, 0, 0)\n\n const tomorrow = new Date(today)\n tomorrow.setDate(tomorrow.getDate() + 1)\n\n const dueDay = new Date(due)\n dueDay.setHours(0, 0, 0, 0)\n\n const isOverdue = dueDay < today\n\n if (dueDay.getTime() === today.getTime()) {\n return { text: 'Today', isOverdue: false }\n } else if (dueDay.getTime() === tomorrow.getTime()) {\n return { text: 'Tomorrow', isOverdue: false }\n } else if (isOverdue) {\n const daysAgo = Math.ceil(\n (today.getTime() - dueDay.getTime()) / (1000 * 60 * 60 * 24)\n )\n return { text: `${daysAgo}d overdue`, isOverdue: true }\n } else {\n return {\n text: due.toLocaleDateString('en-US', { month: 'short', day: 'numeric' }),\n isOverdue: false,\n }\n }\n}\n\n/**\n * Truncate a string with ellipsis\n * @example truncate(\"Hello World\", 5) => \"Hello...\"\n */\nexport function truncate(str: string, maxLength: number): string {\n if (str.length <= maxLength) return str\n return str.slice(0, maxLength) + '...'\n}\n\n/**\n * Extract repo name from GitHub URL\n * @example getRepoName(\"https://github.com/owner/repo\") => \"owner/repo\"\n */\nexport function getRepoName(url: string): string {\n const match = url.match(/github\\.com\\/(.+)$/)\n return match ? match[1] : url\n}\n\n","/**\n * ID and Data Generators\n *\n * Pure functions for generating IDs and data.\n */\n\n/**\n * Generate a unique ID\n * Uses crypto.randomUUID if available, falls back to timestamp-based ID\n *\n * Note: This works in both Node.js and browser environments.\n * React Native needs the fallback since crypto.randomUUID isn't available.\n */\nexport function generateId(): string {\n // Check if crypto.randomUUID is available (Node.js 19+, modern browsers)\n if (\n typeof crypto !== 'undefined' &&\n typeof crypto.randomUUID === 'function'\n ) {\n return crypto.randomUUID()\n }\n\n // Fallback: UUID v4-like implementation\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0\n const v = c === 'x' ? r : (r & 0x3) | 0x8\n return v.toString(16)\n })\n}\n\n/**\n * Generate a short ID (timestamp + random)\n * Format: {timestamp}-{random7chars}\n * @example \"1732547123456-k8f3j2m\"\n */\nexport function generateShortId(): string {\n return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`\n}\n\n/**\n * Generate a random color in hex format\n */\nexport function generateRandomColor(): string {\n const colors = [\n '#ef4444', // red\n '#f97316', // orange\n '#eab308', // yellow\n '#22c55e', // green\n '#14b8a6', // teal\n '#3b82f6', // blue\n '#8b5cf6', // violet\n '#ec4899', // pink\n ]\n return colors[Math.floor(Math.random() * colors.length)]\n}\n\n","/**\n * Validation Utilities\n *\n * Pure functions for validating data.\n */\n\n/**\n * Check if a string is a valid email\n */\nexport function isValidEmail(email: string): boolean {\n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/\n return emailRegex.test(email)\n}\n\n/**\n * Check if a string is a valid URL\n */\nexport function isValidUrl(url: string): boolean {\n try {\n new URL(url)\n return true\n } catch {\n return false\n }\n}\n\n/**\n * Check if a string is a valid ISO date (YYYY-MM-DD)\n */\nexport function isValidISODate(dateStr: string): boolean {\n const regex = /^\\d{4}-\\d{2}-\\d{2}$/\n if (!regex.test(dateStr)) return false\n\n const date = new Date(dateStr)\n return !isNaN(date.getTime())\n}\n\n/**\n * Check if a value is a valid currency code\n */\nexport function isValidCurrency(currency: string): boolean {\n const validCurrencies = ['CHF', 'USD', 'EUR', 'PLN']\n return validCurrencies.includes(currency)\n}\n\n/**\n * Check if a value is a valid frequency\n */\nexport function isValidFrequency(frequency: string): boolean {\n const validFrequencies = ['monthly', 'yearly', '6-monthly', 'weekly', 'one-time']\n return validFrequencies.includes(frequency)\n}\n\n/**\n * Validate a positive number\n */\nexport function isPositiveNumber(value: unknown): value is number {\n return typeof value === 'number' && !isNaN(value) && value > 0\n}\n\n/**\n * Validate a non-empty string\n */\nexport function isNonEmptyString(value: unknown): value is string {\n return typeof value === 'string' && value.trim().length > 0\n}\n\n","/**\n * Calculation Utilities\n *\n * Pure functions for business logic calculations.\n */\n\nimport type { Expense, Income } from '../types/database'\nimport { FREQUENCY_MULTIPLIERS, type Frequency } from '../constants'\n\n/**\n * Convert an amount to yearly based on frequency\n */\nexport function toYearlyAmount(amount: number, frequency: Frequency): number {\n const multiplier = FREQUENCY_MULTIPLIERS[frequency] || 1\n return amount * multiplier\n}\n\n/**\n * Convert an amount to monthly based on frequency\n */\nexport function toMonthlyAmount(amount: number, frequency: Frequency): number {\n const yearly = toYearlyAmount(amount, frequency)\n return yearly / 12\n}\n\n/**\n * Calculate total expenses (monthly)\n */\nexport function calculateMonthlyExpenses(expenses: Expense[]): number {\n return expenses\n .filter((e) => e.isActive)\n .reduce((total, expense) => {\n const monthly = toMonthlyAmount(\n expense.amount,\n expense.frequency as Frequency\n )\n // Apply share percentage\n const myShare = (monthly * expense.sharePercentage) / 100\n return total + myShare\n }, 0)\n}\n\n/**\n * Calculate total income (monthly)\n */\nexport function calculateMonthlyIncome(incomes: Income[]): number {\n return incomes\n .filter((i) => i.isActive)\n .reduce((total, income) => {\n const monthly = toMonthlyAmount(income.amount, income.frequency as Frequency)\n return total + monthly\n }, 0)\n}\n\n/**\n * Calculate savings (income - expenses)\n */\nexport function calculateMonthlySavings(\n incomes: Income[],\n expenses: Expense[]\n): number {\n return calculateMonthlyIncome(incomes) - calculateMonthlyExpenses(expenses)\n}\n\n/**\n * Calculate savings rate as percentage\n */\nexport function calculateSavingsRate(\n incomes: Income[],\n expenses: Expense[]\n): number {\n const income = calculateMonthlyIncome(incomes)\n if (income === 0) return 0\n\n const savings = calculateMonthlySavings(incomes, expenses)\n return (savings / income) * 100\n}\n\n/**\n * Calculate lieu day balance\n */\nexport function calculateLieuBalance(\n lieuDays: Array<{ type: 'earned' | 'used' }>\n): number {\n return lieuDays.reduce((balance, day) => {\n return day.type === 'earned' ? balance + 1 : balance - 1\n }, 0)\n}\n\n/**\n * Calculate focus time stats for a period\n */\nexport function calculateFocusStats(\n sessions: Array<{ actualSeconds: number; status: string }>\n): {\n totalSeconds: number\n completedCount: number\n abandonedCount: number\n completionRate: number\n} {\n const completed = sessions.filter((s) => s.status === 'completed')\n const abandoned = sessions.filter((s) => s.status === 'abandoned')\n\n const totalSeconds = completed.reduce((sum, s) => sum + s.actualSeconds, 0)\n const completionRate =\n sessions.length > 0 ? (completed.length / sessions.length) * 100 : 0\n\n return {\n totalSeconds,\n completedCount: completed.length,\n abandonedCount: abandoned.length,\n completionRate,\n }\n}\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACmDO,IAAM,yBAAyD;AAAA,EACpE,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;;;AC/CO,IAAM,aAAa,CAAC,OAAO,OAAO,OAAO,KAAK;AAG9C,IAAM,mBAA6C;AAAA,EACxD,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AACP;AAEO,IAAM,iBAA2C;AAAA,EACtD,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AACP;AAMO,IAAM,cAAc;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGO,IAAM,mBAA8C;AAAA,EACzD,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,YAAY;AACd;AAEO,IAAM,wBAAmD;AAAA,EAC9D,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,YAAY;AACd;AAMO,IAAM,0BAA0B,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,EAAE;AAGvD,IAAM,eAAe,CAAC,UAAU,aAAa,WAAW;AAOxD,IAAM,oBAAoB,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC;AAGxC,IAAM,yBAA8D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
+ 0: "No priority",
4
+ 1: "Urgent",
5
+ 2: "High",
6
+ 3: "Medium",
7
+ 4: "Low"
8
+ };
9
+
10
+ // src/constants/index.ts
11
+ var CURRENCIES = ["CHF", "USD", "EUR", "PLN"];
12
+ var CURRENCY_SYMBOLS = {
13
+ CHF: "CHF",
14
+ USD: "$",
15
+ EUR: "\u20AC",
16
+ PLN: "z\u0142"
17
+ };
18
+ var CURRENCY_NAMES = {
19
+ CHF: "Swiss Franc",
20
+ USD: "US Dollar",
21
+ EUR: "Euro",
22
+ PLN: "Polish Z\u0142oty"
23
+ };
24
+ var FREQUENCIES = [
25
+ "monthly",
26
+ "yearly",
27
+ "6-monthly",
28
+ "weekly",
29
+ "one-time"
30
+ ];
31
+ var FREQUENCY_LABELS = {
32
+ monthly: "Monthly",
33
+ yearly: "Yearly",
34
+ "6-monthly": "Every 6 Months",
35
+ weekly: "Weekly",
36
+ "one-time": "One Time"
37
+ };
38
+ var FREQUENCY_MULTIPLIERS = {
39
+ monthly: 12,
40
+ yearly: 1,
41
+ "6-monthly": 2,
42
+ weekly: 52,
43
+ "one-time": 1
44
+ };
45
+ var DEFAULT_FOCUS_DURATIONS = [15, 25, 30, 45, 60, 90];
46
+ var FOCUS_STATUS = ["active", "completed", "abandoned"];
47
+ var LINEAR_PRIORITIES = [0, 1, 2, 3, 4];
48
+ var LINEAR_PRIORITY_COLORS = {
49
+ 0: "#6b7280",
50
+ // No priority - gray
51
+ 1: "#ef4444",
52
+ // Urgent - red
53
+ 2: "#f97316",
54
+ // High - orange
55
+ 3: "#eab308",
56
+ // Medium - yellow
57
+ 4: "#3b82f6"
58
+ // Low - blue
59
+ };
60
+ var CLOUD_AGENT_STATUSES = [
61
+ "CREATING",
62
+ "RUNNING",
63
+ "FINISHED",
64
+ "FAILED",
65
+ "CANCELLED"
66
+ ];
67
+ var CLOUD_AGENT_STATUS_EMOJI = {
68
+ CREATING: "\u{1F528}",
69
+ RUNNING: "\u23F3",
70
+ FINISHED: "\u2705",
71
+ FAILED: "\u274C",
72
+ CANCELLED: "\u{1F6AB}"
73
+ };
74
+ var CLOUD_AGENT_STATUS_COLORS = {
75
+ CREATING: "#3b82f6",
76
+ RUNNING: "#3b82f6",
77
+ FINISHED: "#10b981",
78
+ FAILED: "#ef4444",
79
+ CANCELLED: "#6b7280"
80
+ };
81
+ var API_URLS = {
82
+ CURSOR_CLOUD: "https://api.cursor.com",
83
+ LINEAR_GRAPHQL: "https://api.linear.app/graphql"
84
+ };
85
+ var SETTING_KEYS = {
86
+ // AI
87
+ AI_MODEL: "ai_model",
88
+ AI_REASONING_ENABLED: "ai_reasoning_enabled",
89
+ // API Keys
90
+ OPENAI_API_KEY: "openai_api_key",
91
+ ANTHROPIC_API_KEY: "anthropic_api_key",
92
+ CURSOR_API_KEY: "cursor_api_key",
93
+ LINEAR_API_KEY: "linear_api_key",
94
+ // Google
95
+ GOOGLE_CLIENT_ID: "google_client_id",
96
+ GOOGLE_CLIENT_SECRET: "google_client_secret",
97
+ GOOGLE_CALENDAR_TOKENS: "google_calendar_tokens",
98
+ SELECTED_CALENDAR_IDS: "selected_calendar_ids"
99
+ };
100
+
101
+ // src/utils/formatters.ts
102
+ function formatTime(seconds) {
103
+ const mins = Math.floor(seconds / 60);
104
+ const secs = seconds % 60;
105
+ return `${mins.toString().padStart(2, "0")}:${secs.toString().padStart(2, "0")}`;
106
+ }
107
+ function formatTotalTime(seconds) {
108
+ const hours = Math.floor(seconds / 3600);
109
+ const mins = Math.floor(seconds % 3600 / 60);
110
+ if (hours > 0) {
111
+ return `${hours}h ${mins}m`;
112
+ }
113
+ return `${mins}m`;
114
+ }
115
+ function formatCurrency(amount, currency, locale = "en-CH") {
116
+ return new Intl.NumberFormat(locale, {
117
+ style: "currency",
118
+ currency,
119
+ minimumFractionDigits: 2,
120
+ maximumFractionDigits: 2
121
+ }).format(amount);
122
+ }
123
+ function formatRelativeTime(dateStr) {
124
+ const date = new Date(dateStr);
125
+ const now = /* @__PURE__ */ new Date();
126
+ const diffMs = now.getTime() - date.getTime();
127
+ const diffMins = Math.floor(diffMs / 6e4);
128
+ const diffHours = Math.floor(diffMins / 60);
129
+ const diffDays = Math.floor(diffHours / 24);
130
+ if (diffMins < 1) return "Just now";
131
+ if (diffMins < 60) return `${diffMins}m ago`;
132
+ if (diffHours < 24) return `${diffHours}h ago`;
133
+ if (diffDays < 7) return `${diffDays}d ago`;
134
+ return date.toLocaleDateString();
135
+ }
136
+ function formatDate(dateStr, options = {
137
+ month: "short",
138
+ day: "numeric",
139
+ year: "numeric"
140
+ }) {
141
+ return new Date(dateStr).toLocaleDateString("en-US", options);
142
+ }
143
+ function formatDueDate(dueDate) {
144
+ if (!dueDate) return { text: "", isOverdue: false };
145
+ const due = new Date(dueDate);
146
+ const today = /* @__PURE__ */ new Date();
147
+ today.setHours(0, 0, 0, 0);
148
+ const tomorrow = new Date(today);
149
+ tomorrow.setDate(tomorrow.getDate() + 1);
150
+ const dueDay = new Date(due);
151
+ dueDay.setHours(0, 0, 0, 0);
152
+ const isOverdue = dueDay < today;
153
+ if (dueDay.getTime() === today.getTime()) {
154
+ return { text: "Today", isOverdue: false };
155
+ } else if (dueDay.getTime() === tomorrow.getTime()) {
156
+ return { text: "Tomorrow", isOverdue: false };
157
+ } else if (isOverdue) {
158
+ const daysAgo = Math.ceil(
159
+ (today.getTime() - dueDay.getTime()) / (1e3 * 60 * 60 * 24)
160
+ );
161
+ return { text: `${daysAgo}d overdue`, isOverdue: true };
162
+ } else {
163
+ return {
164
+ text: due.toLocaleDateString("en-US", { month: "short", day: "numeric" }),
165
+ isOverdue: false
166
+ };
167
+ }
168
+ }
169
+ function truncate(str, maxLength) {
170
+ if (str.length <= maxLength) return str;
171
+ return str.slice(0, maxLength) + "...";
172
+ }
173
+ function getRepoName(url) {
174
+ const match = url.match(/github\.com\/(.+)$/);
175
+ return match ? match[1] : url;
176
+ }
177
+
178
+ // src/utils/generators.ts
179
+ function generateId() {
180
+ if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
181
+ return crypto.randomUUID();
182
+ }
183
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
184
+ const r = Math.random() * 16 | 0;
185
+ const v = c === "x" ? r : r & 3 | 8;
186
+ return v.toString(16);
187
+ });
188
+ }
189
+ function generateShortId() {
190
+ return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
191
+ }
192
+ function generateRandomColor() {
193
+ const colors = [
194
+ "#ef4444",
195
+ // red
196
+ "#f97316",
197
+ // orange
198
+ "#eab308",
199
+ // yellow
200
+ "#22c55e",
201
+ // green
202
+ "#14b8a6",
203
+ // teal
204
+ "#3b82f6",
205
+ // blue
206
+ "#8b5cf6",
207
+ // violet
208
+ "#ec4899"
209
+ // pink
210
+ ];
211
+ return colors[Math.floor(Math.random() * colors.length)];
212
+ }
213
+
214
+ // src/utils/validators.ts
215
+ function isValidEmail(email) {
216
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
217
+ return emailRegex.test(email);
218
+ }
219
+ function isValidUrl(url) {
220
+ try {
221
+ new URL(url);
222
+ return true;
223
+ } catch {
224
+ return false;
225
+ }
226
+ }
227
+ function isValidISODate(dateStr) {
228
+ const regex = /^\d{4}-\d{2}-\d{2}$/;
229
+ if (!regex.test(dateStr)) return false;
230
+ const date = new Date(dateStr);
231
+ return !isNaN(date.getTime());
232
+ }
233
+ function isValidCurrency(currency) {
234
+ const validCurrencies = ["CHF", "USD", "EUR", "PLN"];
235
+ return validCurrencies.includes(currency);
236
+ }
237
+ function isValidFrequency(frequency) {
238
+ const validFrequencies = ["monthly", "yearly", "6-monthly", "weekly", "one-time"];
239
+ return validFrequencies.includes(frequency);
240
+ }
241
+ function isPositiveNumber(value) {
242
+ return typeof value === "number" && !isNaN(value) && value > 0;
243
+ }
244
+ function isNonEmptyString(value) {
245
+ return typeof value === "string" && value.trim().length > 0;
246
+ }
247
+
248
+ // src/utils/calculations.ts
249
+ function toYearlyAmount(amount, frequency) {
250
+ const multiplier = FREQUENCY_MULTIPLIERS[frequency] || 1;
251
+ return amount * multiplier;
252
+ }
253
+ function toMonthlyAmount(amount, frequency) {
254
+ const yearly = toYearlyAmount(amount, frequency);
255
+ return yearly / 12;
256
+ }
257
+ function calculateMonthlyExpenses(expenses) {
258
+ return expenses.filter((e) => e.isActive).reduce((total, expense) => {
259
+ const monthly = toMonthlyAmount(
260
+ expense.amount,
261
+ expense.frequency
262
+ );
263
+ const myShare = monthly * expense.sharePercentage / 100;
264
+ return total + myShare;
265
+ }, 0);
266
+ }
267
+ function calculateMonthlyIncome(incomes) {
268
+ return incomes.filter((i) => i.isActive).reduce((total, income) => {
269
+ const monthly = toMonthlyAmount(income.amount, income.frequency);
270
+ return total + monthly;
271
+ }, 0);
272
+ }
273
+ function calculateMonthlySavings(incomes, expenses) {
274
+ return calculateMonthlyIncome(incomes) - calculateMonthlyExpenses(expenses);
275
+ }
276
+ function calculateSavingsRate(incomes, expenses) {
277
+ const income = calculateMonthlyIncome(incomes);
278
+ if (income === 0) return 0;
279
+ const savings = calculateMonthlySavings(incomes, expenses);
280
+ return savings / income * 100;
281
+ }
282
+ function calculateLieuBalance(lieuDays) {
283
+ return lieuDays.reduce((balance, day) => {
284
+ return day.type === "earned" ? balance + 1 : balance - 1;
285
+ }, 0);
286
+ }
287
+ function calculateFocusStats(sessions) {
288
+ const completed = sessions.filter((s) => s.status === "completed");
289
+ const abandoned = sessions.filter((s) => s.status === "abandoned");
290
+ const totalSeconds = completed.reduce((sum, s) => sum + s.actualSeconds, 0);
291
+ const completionRate = sessions.length > 0 ? completed.length / sessions.length * 100 : 0;
292
+ return {
293
+ totalSeconds,
294
+ completedCount: completed.length,
295
+ abandonedCount: abandoned.length,
296
+ completionRate
297
+ };
298
+ }
299
+ export {
300
+ API_URLS,
301
+ CLOUD_AGENT_STATUSES,
302
+ CLOUD_AGENT_STATUS_COLORS,
303
+ CLOUD_AGENT_STATUS_EMOJI,
304
+ CURRENCIES,
305
+ CURRENCY_NAMES,
306
+ CURRENCY_SYMBOLS,
307
+ DEFAULT_FOCUS_DURATIONS,
308
+ FOCUS_STATUS,
309
+ FREQUENCIES,
310
+ FREQUENCY_LABELS,
311
+ FREQUENCY_MULTIPLIERS,
312
+ LINEAR_PRIORITIES,
313
+ LINEAR_PRIORITY_COLORS,
314
+ LINEAR_PRIORITY_LABELS,
315
+ SETTING_KEYS,
316
+ calculateFocusStats,
317
+ calculateLieuBalance,
318
+ calculateMonthlyExpenses,
319
+ calculateMonthlyIncome,
320
+ calculateMonthlySavings,
321
+ calculateSavingsRate,
322
+ formatCurrency,
323
+ formatDate,
324
+ formatDueDate,
325
+ formatRelativeTime,
326
+ formatTime,
327
+ formatTotalTime,
328
+ generateId,
329
+ generateRandomColor,
330
+ generateShortId,
331
+ getRepoName,
332
+ isNonEmptyString,
333
+ isPositiveNumber,
334
+ isValidCurrency,
335
+ isValidEmail,
336
+ isValidFrequency,
337
+ isValidISODate,
338
+ isValidUrl,
339
+ toMonthlyAmount,
340
+ toYearlyAmount,
341
+ truncate
342
+ };
343
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types/linear.ts","../src/constants/index.ts","../src/utils/formatters.ts","../src/utils/generators.ts","../src/utils/validators.ts","../src/utils/calculations.ts"],"sourcesContent":["/**\n * Linear API Types\n *\n * Types for interacting with Linear's GraphQL API.\n */\n\n// ============================================================================\n// User Types\n// ============================================================================\n\nexport interface LinearUser {\n id: string\n name: string\n email: string\n avatarUrl: string | null\n}\n\n// ============================================================================\n// Project Types\n// ============================================================================\n\nexport interface LinearProject {\n id: string\n name: string\n color: string\n}\n\n// ============================================================================\n// State Types\n// ============================================================================\n\nexport type LinearStateType =\n | 'backlog'\n | 'unstarted'\n | 'started'\n | 'completed'\n | 'canceled'\n\nexport interface LinearState {\n id: string\n name: string\n color: string\n type: LinearStateType\n}\n\n// ============================================================================\n// Issue Types\n// ============================================================================\n\nexport type LinearPriority = 0 | 1 | 2 | 3 | 4\n\nexport const LINEAR_PRIORITY_LABELS: Record<LinearPriority, string> = {\n 0: 'No priority',\n 1: 'Urgent',\n 2: 'High',\n 3: 'Medium',\n 4: 'Low',\n}\n\nexport interface LinearIssue {\n id: string\n identifier: string\n title: string\n description: string | null\n priority: LinearPriority\n priorityLabel: string\n dueDate: string | null\n url: string\n state: LinearState | null\n project: LinearProject | null\n createdAt: string\n updatedAt: string\n}\n\n// ============================================================================\n// Query Types\n// ============================================================================\n\nexport interface IssueQueryOptions {\n projectId?: string\n search?: string\n cursor?: string\n limit?: number\n}\n\nexport interface PaginatedIssues {\n issues: LinearIssue[]\n hasNextPage: boolean\n endCursor: string | null\n totalCount: number\n}\n\n","/**\n * Shared Constants\n *\n * Common constants used across Vanaheim apps.\n */\n\n// ============================================================================\n// Currency\n// ============================================================================\n\nexport const CURRENCIES = ['CHF', 'USD', 'EUR', 'PLN'] as const\nexport type Currency = (typeof CURRENCIES)[number]\n\nexport const CURRENCY_SYMBOLS: Record<Currency, string> = {\n CHF: 'CHF',\n USD: '$',\n EUR: '€',\n PLN: 'zł',\n}\n\nexport const CURRENCY_NAMES: Record<Currency, string> = {\n CHF: 'Swiss Franc',\n USD: 'US Dollar',\n EUR: 'Euro',\n PLN: 'Polish Złoty',\n}\n\n// ============================================================================\n// Frequency\n// ============================================================================\n\nexport const FREQUENCIES = [\n 'monthly',\n 'yearly',\n '6-monthly',\n 'weekly',\n 'one-time',\n] as const\nexport type Frequency = (typeof FREQUENCIES)[number]\n\nexport const FREQUENCY_LABELS: Record<Frequency, string> = {\n monthly: 'Monthly',\n yearly: 'Yearly',\n '6-monthly': 'Every 6 Months',\n weekly: 'Weekly',\n 'one-time': 'One Time',\n}\n\nexport const FREQUENCY_MULTIPLIERS: Record<Frequency, number> = {\n monthly: 12,\n yearly: 1,\n '6-monthly': 2,\n weekly: 52,\n 'one-time': 1,\n}\n\n// ============================================================================\n// Focus\n// ============================================================================\n\nexport const DEFAULT_FOCUS_DURATIONS = [15, 25, 30, 45, 60, 90] as const\nexport type FocusDuration = (typeof DEFAULT_FOCUS_DURATIONS)[number]\n\nexport const FOCUS_STATUS = ['active', 'completed', 'abandoned'] as const\nexport type FocusStatus = (typeof FOCUS_STATUS)[number]\n\n// ============================================================================\n// Linear\n// ============================================================================\n\nexport const LINEAR_PRIORITIES = [0, 1, 2, 3, 4] as const\nexport type LinearPriorityValue = (typeof LINEAR_PRIORITIES)[number]\n\nexport const LINEAR_PRIORITY_COLORS: Record<LinearPriorityValue, string> = {\n 0: '#6b7280', // No priority - gray\n 1: '#ef4444', // Urgent - red\n 2: '#f97316', // High - orange\n 3: '#eab308', // Medium - yellow\n 4: '#3b82f6', // Low - blue\n}\n\n// ============================================================================\n// Cloud Agents\n// ============================================================================\n\nexport const CLOUD_AGENT_STATUSES = [\n 'CREATING',\n 'RUNNING',\n 'FINISHED',\n 'FAILED',\n 'CANCELLED',\n] as const\n\nexport const CLOUD_AGENT_STATUS_EMOJI: Record<string, string> = {\n CREATING: '🔨',\n RUNNING: '⏳',\n FINISHED: '✅',\n FAILED: '❌',\n CANCELLED: '🚫',\n}\n\nexport const CLOUD_AGENT_STATUS_COLORS: Record<string, string> = {\n CREATING: '#3b82f6',\n RUNNING: '#3b82f6',\n FINISHED: '#10b981',\n FAILED: '#ef4444',\n CANCELLED: '#6b7280',\n}\n\n// ============================================================================\n// API URLs\n// ============================================================================\n\nexport const API_URLS = {\n CURSOR_CLOUD: 'https://api.cursor.com',\n LINEAR_GRAPHQL: 'https://api.linear.app/graphql',\n} as const\n\n// ============================================================================\n// Settings Keys\n// ============================================================================\n\nexport const SETTING_KEYS = {\n // AI\n AI_MODEL: 'ai_model',\n AI_REASONING_ENABLED: 'ai_reasoning_enabled',\n\n // API Keys\n OPENAI_API_KEY: 'openai_api_key',\n ANTHROPIC_API_KEY: 'anthropic_api_key',\n CURSOR_API_KEY: 'cursor_api_key',\n LINEAR_API_KEY: 'linear_api_key',\n\n // Google\n GOOGLE_CLIENT_ID: 'google_client_id',\n GOOGLE_CLIENT_SECRET: 'google_client_secret',\n GOOGLE_CALENDAR_TOKENS: 'google_calendar_tokens',\n SELECTED_CALENDAR_IDS: 'selected_calendar_ids',\n} as const\n\nexport type SettingKey = (typeof SETTING_KEYS)[keyof typeof SETTING_KEYS]\n\n","/**\n * Formatting Utilities\n *\n * Pure functions for formatting data.\n */\n\n/**\n * Format seconds into MM:SS format\n * @example formatTime(125) => \"02:05\"\n */\nexport function formatTime(seconds: number): string {\n const mins = Math.floor(seconds / 60)\n const secs = seconds % 60\n return `${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`\n}\n\n/**\n * Format seconds into human-readable total time\n * @example formatTotalTime(3700) => \"1h 1m\"\n * @example formatTotalTime(1800) => \"30m\"\n */\nexport function formatTotalTime(seconds: number): string {\n const hours = Math.floor(seconds / 3600)\n const mins = Math.floor((seconds % 3600) / 60)\n if (hours > 0) {\n return `${hours}h ${mins}m`\n }\n return `${mins}m`\n}\n\n/**\n * Format a number as currency\n * @example formatCurrency(1234.56, 'CHF') => \"CHF 1,234.56\"\n */\nexport function formatCurrency(\n amount: number,\n currency: string,\n locale: string = 'en-CH'\n): string {\n return new Intl.NumberFormat(locale, {\n style: 'currency',\n currency,\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n }).format(amount)\n}\n\n/**\n * Format a date as relative time (e.g., \"2h ago\", \"3d ago\")\n */\nexport function formatRelativeTime(dateStr: string): string {\n const date = new Date(dateStr)\n const now = new Date()\n const diffMs = now.getTime() - date.getTime()\n const diffMins = Math.floor(diffMs / 60000)\n const diffHours = Math.floor(diffMins / 60)\n const diffDays = Math.floor(diffHours / 24)\n\n if (diffMins < 1) return 'Just now'\n if (diffMins < 60) return `${diffMins}m ago`\n if (diffHours < 24) return `${diffHours}h ago`\n if (diffDays < 7) return `${diffDays}d ago`\n return date.toLocaleDateString()\n}\n\n/**\n * Format a date string to a readable format\n * @example formatDate('2024-01-15') => \"Jan 15, 2024\"\n */\nexport function formatDate(\n dateStr: string,\n options: Intl.DateTimeFormatOptions = {\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n }\n): string {\n return new Date(dateStr).toLocaleDateString('en-US', options)\n}\n\n/**\n * Format a due date with context (Today, Tomorrow, Overdue, etc.)\n */\nexport function formatDueDate(dueDate: string | null): {\n text: string\n isOverdue: boolean\n} {\n if (!dueDate) return { text: '', isOverdue: false }\n\n const due = new Date(dueDate)\n const today = new Date()\n today.setHours(0, 0, 0, 0)\n\n const tomorrow = new Date(today)\n tomorrow.setDate(tomorrow.getDate() + 1)\n\n const dueDay = new Date(due)\n dueDay.setHours(0, 0, 0, 0)\n\n const isOverdue = dueDay < today\n\n if (dueDay.getTime() === today.getTime()) {\n return { text: 'Today', isOverdue: false }\n } else if (dueDay.getTime() === tomorrow.getTime()) {\n return { text: 'Tomorrow', isOverdue: false }\n } else if (isOverdue) {\n const daysAgo = Math.ceil(\n (today.getTime() - dueDay.getTime()) / (1000 * 60 * 60 * 24)\n )\n return { text: `${daysAgo}d overdue`, isOverdue: true }\n } else {\n return {\n text: due.toLocaleDateString('en-US', { month: 'short', day: 'numeric' }),\n isOverdue: false,\n }\n }\n}\n\n/**\n * Truncate a string with ellipsis\n * @example truncate(\"Hello World\", 5) => \"Hello...\"\n */\nexport function truncate(str: string, maxLength: number): string {\n if (str.length <= maxLength) return str\n return str.slice(0, maxLength) + '...'\n}\n\n/**\n * Extract repo name from GitHub URL\n * @example getRepoName(\"https://github.com/owner/repo\") => \"owner/repo\"\n */\nexport function getRepoName(url: string): string {\n const match = url.match(/github\\.com\\/(.+)$/)\n return match ? match[1] : url\n}\n\n","/**\n * ID and Data Generators\n *\n * Pure functions for generating IDs and data.\n */\n\n/**\n * Generate a unique ID\n * Uses crypto.randomUUID if available, falls back to timestamp-based ID\n *\n * Note: This works in both Node.js and browser environments.\n * React Native needs the fallback since crypto.randomUUID isn't available.\n */\nexport function generateId(): string {\n // Check if crypto.randomUUID is available (Node.js 19+, modern browsers)\n if (\n typeof crypto !== 'undefined' &&\n typeof crypto.randomUUID === 'function'\n ) {\n return crypto.randomUUID()\n }\n\n // Fallback: UUID v4-like implementation\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0\n const v = c === 'x' ? r : (r & 0x3) | 0x8\n return v.toString(16)\n })\n}\n\n/**\n * Generate a short ID (timestamp + random)\n * Format: {timestamp}-{random7chars}\n * @example \"1732547123456-k8f3j2m\"\n */\nexport function generateShortId(): string {\n return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`\n}\n\n/**\n * Generate a random color in hex format\n */\nexport function generateRandomColor(): string {\n const colors = [\n '#ef4444', // red\n '#f97316', // orange\n '#eab308', // yellow\n '#22c55e', // green\n '#14b8a6', // teal\n '#3b82f6', // blue\n '#8b5cf6', // violet\n '#ec4899', // pink\n ]\n return colors[Math.floor(Math.random() * colors.length)]\n}\n\n","/**\n * Validation Utilities\n *\n * Pure functions for validating data.\n */\n\n/**\n * Check if a string is a valid email\n */\nexport function isValidEmail(email: string): boolean {\n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/\n return emailRegex.test(email)\n}\n\n/**\n * Check if a string is a valid URL\n */\nexport function isValidUrl(url: string): boolean {\n try {\n new URL(url)\n return true\n } catch {\n return false\n }\n}\n\n/**\n * Check if a string is a valid ISO date (YYYY-MM-DD)\n */\nexport function isValidISODate(dateStr: string): boolean {\n const regex = /^\\d{4}-\\d{2}-\\d{2}$/\n if (!regex.test(dateStr)) return false\n\n const date = new Date(dateStr)\n return !isNaN(date.getTime())\n}\n\n/**\n * Check if a value is a valid currency code\n */\nexport function isValidCurrency(currency: string): boolean {\n const validCurrencies = ['CHF', 'USD', 'EUR', 'PLN']\n return validCurrencies.includes(currency)\n}\n\n/**\n * Check if a value is a valid frequency\n */\nexport function isValidFrequency(frequency: string): boolean {\n const validFrequencies = ['monthly', 'yearly', '6-monthly', 'weekly', 'one-time']\n return validFrequencies.includes(frequency)\n}\n\n/**\n * Validate a positive number\n */\nexport function isPositiveNumber(value: unknown): value is number {\n return typeof value === 'number' && !isNaN(value) && value > 0\n}\n\n/**\n * Validate a non-empty string\n */\nexport function isNonEmptyString(value: unknown): value is string {\n return typeof value === 'string' && value.trim().length > 0\n}\n\n","/**\n * Calculation Utilities\n *\n * Pure functions for business logic calculations.\n */\n\nimport type { Expense, Income } from '../types/database'\nimport { FREQUENCY_MULTIPLIERS, type Frequency } from '../constants'\n\n/**\n * Convert an amount to yearly based on frequency\n */\nexport function toYearlyAmount(amount: number, frequency: Frequency): number {\n const multiplier = FREQUENCY_MULTIPLIERS[frequency] || 1\n return amount * multiplier\n}\n\n/**\n * Convert an amount to monthly based on frequency\n */\nexport function toMonthlyAmount(amount: number, frequency: Frequency): number {\n const yearly = toYearlyAmount(amount, frequency)\n return yearly / 12\n}\n\n/**\n * Calculate total expenses (monthly)\n */\nexport function calculateMonthlyExpenses(expenses: Expense[]): number {\n return expenses\n .filter((e) => e.isActive)\n .reduce((total, expense) => {\n const monthly = toMonthlyAmount(\n expense.amount,\n expense.frequency as Frequency\n )\n // Apply share percentage\n const myShare = (monthly * expense.sharePercentage) / 100\n return total + myShare\n }, 0)\n}\n\n/**\n * Calculate total income (monthly)\n */\nexport function calculateMonthlyIncome(incomes: Income[]): number {\n return incomes\n .filter((i) => i.isActive)\n .reduce((total, income) => {\n const monthly = toMonthlyAmount(income.amount, income.frequency as Frequency)\n return total + monthly\n }, 0)\n}\n\n/**\n * Calculate savings (income - expenses)\n */\nexport function calculateMonthlySavings(\n incomes: Income[],\n expenses: Expense[]\n): number {\n return calculateMonthlyIncome(incomes) - calculateMonthlyExpenses(expenses)\n}\n\n/**\n * Calculate savings rate as percentage\n */\nexport function calculateSavingsRate(\n incomes: Income[],\n expenses: Expense[]\n): number {\n const income = calculateMonthlyIncome(incomes)\n if (income === 0) return 0\n\n const savings = calculateMonthlySavings(incomes, expenses)\n return (savings / income) * 100\n}\n\n/**\n * Calculate lieu day balance\n */\nexport function calculateLieuBalance(\n lieuDays: Array<{ type: 'earned' | 'used' }>\n): number {\n return lieuDays.reduce((balance, day) => {\n return day.type === 'earned' ? balance + 1 : balance - 1\n }, 0)\n}\n\n/**\n * Calculate focus time stats for a period\n */\nexport function calculateFocusStats(\n sessions: Array<{ actualSeconds: number; status: string }>\n): {\n totalSeconds: number\n completedCount: number\n abandonedCount: number\n completionRate: number\n} {\n const completed = sessions.filter((s) => s.status === 'completed')\n const abandoned = sessions.filter((s) => s.status === 'abandoned')\n\n const totalSeconds = completed.reduce((sum, s) => sum + s.actualSeconds, 0)\n const completionRate =\n sessions.length > 0 ? (completed.length / sessions.length) * 100 : 0\n\n return {\n totalSeconds,\n completedCount: completed.length,\n abandonedCount: abandoned.length,\n completionRate,\n }\n}\n\n"],"mappings":";AAmDO,IAAM,yBAAyD;AAAA,EACpE,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;;;AC/CO,IAAM,aAAa,CAAC,OAAO,OAAO,OAAO,KAAK;AAG9C,IAAM,mBAA6C;AAAA,EACxD,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AACP;AAEO,IAAM,iBAA2C;AAAA,EACtD,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AACP;AAMO,IAAM,cAAc;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGO,IAAM,mBAA8C;AAAA,EACzD,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,YAAY;AACd;AAEO,IAAM,wBAAmD;AAAA,EAC9D,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,YAAY;AACd;AAMO,IAAM,0BAA0B,CAAC,IAAI,I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AAA,IAC1B,gBAAgB,UAAU;AAAA,IAC1B;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,135 @@
1
+ export { s as BankConnection, B as BankConnectionStatus, t as BankTransaction, k as ChatConversation, m as ChatMessage, C as ChatMessageRole, o as EFLink, u as ExchangeRate, a as Expense, E as ExpenseCategory, F as FocusCategory, h as FocusSession, j as FocusSessionFilters, g as FocusSessionStatus, d as Income, I as IncomeCategory, q as LieuDay, L as LieuDayType, l as NewChatConversation, n as NewChatMessage, p as NewEFLink, b as NewExpense, N as NewExpenseCategory, f as NewFocusCategory, i as NewFocusSession, e as NewIncome, c as NewIncomeCategory, r as NewLieuDay, S as Setting, T as TransactionType } from '../database-BKc0Oj26.mjs';
2
+
3
+ /**
4
+ * Cursor Cloud API Types
5
+ *
6
+ * Types for interacting with Cursor's Cloud Agents API.
7
+ */
8
+ type CloudAgentStatus = 'CREATING' | 'RUNNING' | 'FINISHED' | 'FAILED' | 'CANCELLED';
9
+ type CloudAgentModel = 'claude-4-opus-thinking' | 'claude-4.5-opus-high-thinking' | 'claude-4-sonnet-thinking' | 'o3';
10
+ interface CloudAgentSource {
11
+ repository: string;
12
+ ref: string;
13
+ }
14
+ interface CloudAgentTarget {
15
+ branchName?: string;
16
+ url?: string | null;
17
+ prUrl?: string | null;
18
+ autoCreatePr: boolean;
19
+ openAsCursorGithubApp?: boolean;
20
+ skipReviewerRequest?: boolean;
21
+ }
22
+ interface CloudAgent {
23
+ id: string;
24
+ name: string | null;
25
+ status: CloudAgentStatus;
26
+ source: CloudAgentSource;
27
+ target: CloudAgentTarget;
28
+ summary?: string | null;
29
+ createdAt: string;
30
+ }
31
+ type CloudAgentMessageType = 'user_message' | 'assistant_message';
32
+ interface CloudAgentMessage {
33
+ id: string;
34
+ type: CloudAgentMessageType;
35
+ text: string;
36
+ createdAt?: string;
37
+ }
38
+ interface CloudAgentConversation {
39
+ id?: string;
40
+ agentId?: string;
41
+ messages: CloudAgentMessage[];
42
+ }
43
+ interface CloudAgentPrompt {
44
+ text: string;
45
+ images?: Array<{
46
+ data: string;
47
+ dimension: {
48
+ width: number;
49
+ height: number;
50
+ };
51
+ }>;
52
+ }
53
+ interface LaunchAgentRequest {
54
+ prompt: CloudAgentPrompt;
55
+ source: CloudAgentSource;
56
+ target?: {
57
+ autoCreatePr?: boolean;
58
+ branchName?: string;
59
+ openAsCursorGithubApp?: boolean;
60
+ skipReviewerRequest?: boolean;
61
+ };
62
+ model?: CloudAgentModel;
63
+ }
64
+ interface ListAgentsResponse {
65
+ agents: CloudAgent[];
66
+ nextCursor?: string;
67
+ hasMore?: boolean;
68
+ }
69
+ interface ModelsResponse {
70
+ models: string[];
71
+ }
72
+ interface ApiKeyInfo {
73
+ apiKeyName?: string;
74
+ email?: string;
75
+ userEmail?: string;
76
+ createdAt?: string;
77
+ usage?: {
78
+ current: number;
79
+ limit: number;
80
+ };
81
+ }
82
+
83
+ /**
84
+ * Linear API Types
85
+ *
86
+ * Types for interacting with Linear's GraphQL API.
87
+ */
88
+ interface LinearUser {
89
+ id: string;
90
+ name: string;
91
+ email: string;
92
+ avatarUrl: string | null;
93
+ }
94
+ interface LinearProject {
95
+ id: string;
96
+ name: string;
97
+ color: string;
98
+ }
99
+ type LinearStateType = 'backlog' | 'unstarted' | 'started' | 'completed' | 'canceled';
100
+ interface LinearState {
101
+ id: string;
102
+ name: string;
103
+ color: string;
104
+ type: LinearStateType;
105
+ }
106
+ type LinearPriority = 0 | 1 | 2 | 3 | 4;
107
+ declare const LINEAR_PRIORITY_LABELS: Record<LinearPriority, string>;
108
+ interface LinearIssue {
109
+ id: string;
110
+ identifier: string;
111
+ title: string;
112
+ description: string | null;
113
+ priority: LinearPriority;
114
+ priorityLabel: string;
115
+ dueDate: string | null;
116
+ url: string;
117
+ state: LinearState | null;
118
+ project: LinearProject | null;
119
+ createdAt: string;
120
+ updatedAt: string;
121
+ }
122
+ interface IssueQueryOptions {
123
+ projectId?: string;
124
+ search?: string;
125
+ cursor?: string;
126
+ limit?: number;
127
+ }
128
+ interface PaginatedIssues {
129
+ issues: LinearIssue[];
130
+ hasNextPage: boolean;
131
+ endCursor: string | null;
132
+ totalCount: number;
133
+ }
134
+
135
+ export { type ApiKeyInfo, type CloudAgent, type CloudAgentConversation, type CloudAgentMessage, type CloudAgentMessageType, type CloudAgentModel, type CloudAgentPrompt, type CloudAgentSource, type CloudAgentStatus, type CloudAgentTarget, type IssueQueryOptions, LINEAR_PRIORITY_LABELS, type LaunchAgentRequest, type LinearIssue, type LinearPriority, type LinearProject, type LinearState, type LinearStateType, type LinearUser, type ListAgentsResponse, type ModelsResponse, type PaginatedIssues };