@chykalophia/clickup-mcp-server 3.2.0
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.
- package/LICENSE +21 -0
- package/README.md +467 -0
- package/bin/clickup-mcp-server-ai.js +9 -0
- package/bin/clickup-mcp-server-basic.js +9 -0
- package/bin/clickup-mcp-server-efficiency.js +9 -0
- package/bin/clickup-mcp-server-enhanced.js +9 -0
- package/build/app.d.ts +1 -0
- package/build/app.js +2 -0
- package/build/app.js.map +1 -0
- package/build/clickup-client/attachments-enhanced.d.ts +128 -0
- package/build/clickup-client/attachments-enhanced.js +212 -0
- package/build/clickup-client/attachments-enhanced.js.map +1 -0
- package/build/clickup-client/auth.d.ts +254 -0
- package/build/clickup-client/auth.js +105 -0
- package/build/clickup-client/auth.js.map +1 -0
- package/build/clickup-client/chat-enhanced.d.ts +141 -0
- package/build/clickup-client/chat-enhanced.js +196 -0
- package/build/clickup-client/chat-enhanced.js.map +1 -0
- package/build/clickup-client/checklists.d.ts +87 -0
- package/build/clickup-client/checklists.js +63 -0
- package/build/clickup-client/checklists.js.map +1 -0
- package/build/clickup-client/comments-enhanced.d.ts +176 -0
- package/build/clickup-client/comments-enhanced.js +230 -0
- package/build/clickup-client/comments-enhanced.js.map +1 -0
- package/build/clickup-client/comments.d.ts +173 -0
- package/build/clickup-client/comments.js +312 -0
- package/build/clickup-client/comments.js.map +1 -0
- package/build/clickup-client/custom-fields-enhanced.d.ts +286 -0
- package/build/clickup-client/custom-fields-enhanced.js +416 -0
- package/build/clickup-client/custom-fields-enhanced.js.map +1 -0
- package/build/clickup-client/dependencies-enhanced.d.ts +144 -0
- package/build/clickup-client/dependencies-enhanced.js +142 -0
- package/build/clickup-client/dependencies-enhanced.js.map +1 -0
- package/build/clickup-client/docs-enhanced.d.ts +176 -0
- package/build/clickup-client/docs-enhanced.js +374 -0
- package/build/clickup-client/docs-enhanced.js.map +1 -0
- package/build/clickup-client/docs.d.ts +84 -0
- package/build/clickup-client/docs.js +156 -0
- package/build/clickup-client/docs.js.map +1 -0
- package/build/clickup-client/folders.d.ts +62 -0
- package/build/clickup-client/folders.js +53 -0
- package/build/clickup-client/folders.js.map +1 -0
- package/build/clickup-client/goals-enhanced.d.ts +163 -0
- package/build/clickup-client/goals-enhanced.js +309 -0
- package/build/clickup-client/goals-enhanced.js.map +1 -0
- package/build/clickup-client/index.d.ts +16 -0
- package/build/clickup-client/index.js +61 -0
- package/build/clickup-client/index.js.map +1 -0
- package/build/clickup-client/lists.d.ts +105 -0
- package/build/clickup-client/lists.js +108 -0
- package/build/clickup-client/lists.js.map +1 -0
- package/build/clickup-client/secure-client.d.ts +88 -0
- package/build/clickup-client/secure-client.js +275 -0
- package/build/clickup-client/secure-client.js.map +1 -0
- package/build/clickup-client/spaces.d.ts +58 -0
- package/build/clickup-client/spaces.js +28 -0
- package/build/clickup-client/spaces.js.map +1 -0
- package/build/clickup-client/tasks.d.ts +161 -0
- package/build/clickup-client/tasks.js +99 -0
- package/build/clickup-client/tasks.js.map +1 -0
- package/build/clickup-client/time-tracking-enhanced.d.ts +153 -0
- package/build/clickup-client/time-tracking-enhanced.js +292 -0
- package/build/clickup-client/time-tracking-enhanced.js.map +1 -0
- package/build/clickup-client/views-enhanced.d.ts +149 -0
- package/build/clickup-client/views-enhanced.js +210 -0
- package/build/clickup-client/views-enhanced.js.map +1 -0
- package/build/clickup-client/webhooks-enhanced.d.ts +119 -0
- package/build/clickup-client/webhooks-enhanced.js +169 -0
- package/build/clickup-client/webhooks-enhanced.js.map +1 -0
- package/build/controllers/lists.controller.d.ts +1 -0
- package/build/controllers/lists.controller.js +2 -0
- package/build/controllers/lists.controller.js.map +1 -0
- package/build/index-efficiency-simple.d.ts +2 -0
- package/build/index-efficiency-simple.js +379 -0
- package/build/index-efficiency-simple.js.map +1 -0
- package/build/index-enhanced-efficiency.d.ts +2 -0
- package/build/index-enhanced-efficiency.js +275 -0
- package/build/index-enhanced-efficiency.js.map +1 -0
- package/build/index-enhanced.d.ts +2 -0
- package/build/index-enhanced.js +74 -0
- package/build/index-enhanced.js.map +1 -0
- package/build/index.d.ts +2 -0
- package/build/index.js +77 -0
- package/build/index.js.map +1 -0
- package/build/resources/checklist-resources.d.ts +2 -0
- package/build/resources/checklist-resources.js +102 -0
- package/build/resources/checklist-resources.js.map +1 -0
- package/build/resources/comment-resources.d.ts +2 -0
- package/build/resources/comment-resources.js +152 -0
- package/build/resources/comment-resources.js.map +1 -0
- package/build/resources/doc-resources.d.ts +2 -0
- package/build/resources/doc-resources.js +77 -0
- package/build/resources/doc-resources.js.map +1 -0
- package/build/resources/folder-resources.d.ts +2 -0
- package/build/resources/folder-resources.js +160 -0
- package/build/resources/folder-resources.js.map +1 -0
- package/build/resources/list-resources.d.ts +2 -0
- package/build/resources/list-resources.js +104 -0
- package/build/resources/list-resources.js.map +1 -0
- package/build/resources/space-resources.d.ts +2 -0
- package/build/resources/space-resources.js +104 -0
- package/build/resources/space-resources.js.map +1 -0
- package/build/resources/task-resources.d.ts +2 -0
- package/build/resources/task-resources.js +57 -0
- package/build/resources/task-resources.js.map +1 -0
- package/build/routes/lists.routes.d.ts +1 -0
- package/build/routes/lists.routes.js +2 -0
- package/build/routes/lists.routes.js.map +1 -0
- package/build/schemas/attachments-schemas.d.ts +201 -0
- package/build/schemas/attachments-schemas.js +250 -0
- package/build/schemas/attachments-schemas.js.map +1 -0
- package/build/schemas/chat-schemas.d.ts +478 -0
- package/build/schemas/chat-schemas.js +173 -0
- package/build/schemas/chat-schemas.js.map +1 -0
- package/build/schemas/custom-field-schemas.d.ts +1617 -0
- package/build/schemas/custom-field-schemas.js +384 -0
- package/build/schemas/custom-field-schemas.js.map +1 -0
- package/build/schemas/dependencies-schemas.d.ts +274 -0
- package/build/schemas/dependencies-schemas.js +176 -0
- package/build/schemas/dependencies-schemas.js.map +1 -0
- package/build/schemas/document-schemas.d.ts +433 -0
- package/build/schemas/document-schemas.js +168 -0
- package/build/schemas/document-schemas.js.map +1 -0
- package/build/schemas/goals-schemas.d.ts +961 -0
- package/build/schemas/goals-schemas.js +293 -0
- package/build/schemas/goals-schemas.js.map +1 -0
- package/build/schemas/time-tracking-schemas.d.ts +741 -0
- package/build/schemas/time-tracking-schemas.js +234 -0
- package/build/schemas/time-tracking-schemas.js.map +1 -0
- package/build/schemas/views-schemas.d.ts +1168 -0
- package/build/schemas/views-schemas.js +221 -0
- package/build/schemas/views-schemas.js.map +1 -0
- package/build/schemas/webhook-schemas.d.ts +1127 -0
- package/build/schemas/webhook-schemas.js +137 -0
- package/build/schemas/webhook-schemas.js.map +1 -0
- package/build/services/lists.service.d.ts +1 -0
- package/build/services/lists.service.js +2 -0
- package/build/services/lists.service.js.map +1 -0
- package/build/tools/attachments-tools-setup.d.ts +2 -0
- package/build/tools/attachments-tools-setup.js +387 -0
- package/build/tools/attachments-tools-setup.js.map +1 -0
- package/build/tools/chat-tools-enhanced.d.ts +5 -0
- package/build/tools/chat-tools-enhanced.js +396 -0
- package/build/tools/chat-tools-enhanced.js.map +1 -0
- package/build/tools/chat-tools.d.ts +2 -0
- package/build/tools/chat-tools.js +614 -0
- package/build/tools/chat-tools.js.map +1 -0
- package/build/tools/checklist-tools.d.ts +2 -0
- package/build/tools/checklist-tools.js +139 -0
- package/build/tools/checklist-tools.js.map +1 -0
- package/build/tools/comment-tools.d.ts +2 -0
- package/build/tools/comment-tools.js +295 -0
- package/build/tools/comment-tools.js.map +1 -0
- package/build/tools/custom-field-tools.d.ts +2 -0
- package/build/tools/custom-field-tools.js +578 -0
- package/build/tools/custom-field-tools.js.map +1 -0
- package/build/tools/dependencies-tools-setup.d.ts +2 -0
- package/build/tools/dependencies-tools-setup.js +319 -0
- package/build/tools/dependencies-tools-setup.js.map +1 -0
- package/build/tools/doc-tools-enhanced.d.ts +2 -0
- package/build/tools/doc-tools-enhanced.js +417 -0
- package/build/tools/doc-tools-enhanced.js.map +1 -0
- package/build/tools/doc-tools.d.ts +2 -0
- package/build/tools/doc-tools.js +109 -0
- package/build/tools/doc-tools.js.map +1 -0
- package/build/tools/goals-tools.d.ts +2 -0
- package/build/tools/goals-tools.js +422 -0
- package/build/tools/goals-tools.js.map +1 -0
- package/build/tools/helper-tools.d.ts +2 -0
- package/build/tools/helper-tools.js +363 -0
- package/build/tools/helper-tools.js.map +1 -0
- package/build/tools/space-tools.d.ts +2 -0
- package/build/tools/space-tools.js +45 -0
- package/build/tools/space-tools.js.map +1 -0
- package/build/tools/task-tools.d.ts +2 -0
- package/build/tools/task-tools.js +415 -0
- package/build/tools/task-tools.js.map +1 -0
- package/build/tools/time-tracking-tools.d.ts +2 -0
- package/build/tools/time-tracking-tools.js +329 -0
- package/build/tools/time-tracking-tools.js.map +1 -0
- package/build/tools/views-tools-setup.d.ts +2 -0
- package/build/tools/views-tools-setup.js +358 -0
- package/build/tools/views-tools-setup.js.map +1 -0
- package/build/tools/webhook-tools-setup.d.ts +2 -0
- package/build/tools/webhook-tools-setup.js +304 -0
- package/build/tools/webhook-tools-setup.js.map +1 -0
- package/build/tools/webhook-tools.d.ts +4 -0
- package/build/tools/webhook-tools.js +345 -0
- package/build/tools/webhook-tools.js.map +1 -0
- package/build/utils/clickup-comment-formatter.d.ts +124 -0
- package/build/utils/clickup-comment-formatter.js +504 -0
- package/build/utils/clickup-comment-formatter.js.map +1 -0
- package/build/utils/context-aware-suggestions.d.ts +45 -0
- package/build/utils/context-aware-suggestions.js +360 -0
- package/build/utils/context-aware-suggestions.js.map +1 -0
- package/build/utils/error-handling.d.ts +140 -0
- package/build/utils/error-handling.js +392 -0
- package/build/utils/error-handling.js.map +1 -0
- package/build/utils/markdown-styling.d.ts +40 -0
- package/build/utils/markdown-styling.js +344 -0
- package/build/utils/markdown-styling.js.map +1 -0
- package/build/utils/markdown.d.ts +54 -0
- package/build/utils/markdown.js +243 -0
- package/build/utils/markdown.js.map +1 -0
- package/build/utils/security.d.ts +79 -0
- package/build/utils/security.js +303 -0
- package/build/utils/security.js.map +1 -0
- package/build/utils/tool-efficiency.d.ts +59 -0
- package/build/utils/tool-efficiency.js +247 -0
- package/build/utils/tool-efficiency.js.map +1 -0
- package/package.json +130 -0
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
// ========================================
|
|
3
|
+
// ENHANCED GOALS CLIENT
|
|
4
|
+
// ========================================
|
|
5
|
+
export class EnhancedGoalsClient {
|
|
6
|
+
constructor(client) {
|
|
7
|
+
this.client = client;
|
|
8
|
+
}
|
|
9
|
+
getAxiosInstance() {
|
|
10
|
+
return this.client.getAxiosInstance();
|
|
11
|
+
}
|
|
12
|
+
// ========================================
|
|
13
|
+
// GOAL MANAGEMENT
|
|
14
|
+
// ========================================
|
|
15
|
+
/**
|
|
16
|
+
* Get goals for a team
|
|
17
|
+
*/
|
|
18
|
+
async getGoals(teamId, includeCompleted = false) {
|
|
19
|
+
try {
|
|
20
|
+
const queryParams = new URLSearchParams();
|
|
21
|
+
if (includeCompleted)
|
|
22
|
+
queryParams.append('include_completed', 'true');
|
|
23
|
+
const endpoint = `/team/${teamId}/goal?${queryParams.toString()}`;
|
|
24
|
+
const response = await this.getAxiosInstance().get(endpoint);
|
|
25
|
+
return response.data.goals || [];
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
console.error('Error getting goals:', error);
|
|
29
|
+
throw this.handleError(error, `Failed to get goals for team ${teamId}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Create a new goal
|
|
34
|
+
*/
|
|
35
|
+
async createGoal(teamId, params) {
|
|
36
|
+
try {
|
|
37
|
+
const endpoint = `/team/${teamId}/goal`;
|
|
38
|
+
const response = await this.getAxiosInstance().post(endpoint, params);
|
|
39
|
+
return response.data.goal;
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
console.error('Error creating goal:', error);
|
|
43
|
+
throw this.handleError(error, `Failed to create goal for team ${teamId}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Update an existing goal
|
|
48
|
+
*/
|
|
49
|
+
async updateGoal(goalId, params) {
|
|
50
|
+
try {
|
|
51
|
+
const endpoint = `/goal/${goalId}`;
|
|
52
|
+
const response = await this.getAxiosInstance().put(endpoint, params);
|
|
53
|
+
return response.data.goal;
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
console.error('Error updating goal:', error);
|
|
57
|
+
throw this.handleError(error, `Failed to update goal ${goalId}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Delete a goal
|
|
62
|
+
*/
|
|
63
|
+
async deleteGoal(goalId) {
|
|
64
|
+
try {
|
|
65
|
+
const endpoint = `/goal/${goalId}`;
|
|
66
|
+
await this.getAxiosInstance().delete(endpoint);
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
console.error('Error deleting goal:', error);
|
|
70
|
+
throw this.handleError(error, `Failed to delete goal ${goalId}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Get a specific goal by ID
|
|
75
|
+
*/
|
|
76
|
+
async getGoal(goalId) {
|
|
77
|
+
try {
|
|
78
|
+
const endpoint = `/goal/${goalId}`;
|
|
79
|
+
const response = await this.getAxiosInstance().get(endpoint);
|
|
80
|
+
return response.data.goal;
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
console.error('Error getting goal:', error);
|
|
84
|
+
throw this.handleError(error, `Failed to get goal ${goalId}`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// ========================================
|
|
88
|
+
// GOAL TARGET MANAGEMENT
|
|
89
|
+
// ========================================
|
|
90
|
+
/**
|
|
91
|
+
* Create a goal target (key result)
|
|
92
|
+
*/
|
|
93
|
+
async createGoalTarget(goalId, params) {
|
|
94
|
+
try {
|
|
95
|
+
const endpoint = `/goal/${goalId}/target`;
|
|
96
|
+
const response = await this.getAxiosInstance().post(endpoint, params);
|
|
97
|
+
return response.data.target;
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
console.error('Error creating goal target:', error);
|
|
101
|
+
throw this.handleError(error, `Failed to create target for goal ${goalId}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Update a goal target
|
|
106
|
+
*/
|
|
107
|
+
async updateGoalTarget(goalId, targetId, params) {
|
|
108
|
+
try {
|
|
109
|
+
const endpoint = `/goal/${goalId}/target/${targetId}`;
|
|
110
|
+
const response = await this.getAxiosInstance().put(endpoint, params);
|
|
111
|
+
return response.data.target;
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
console.error('Error updating goal target:', error);
|
|
115
|
+
throw this.handleError(error, `Failed to update target ${targetId} for goal ${goalId}`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Delete a goal target
|
|
120
|
+
*/
|
|
121
|
+
async deleteGoalTarget(goalId, targetId) {
|
|
122
|
+
try {
|
|
123
|
+
const endpoint = `/goal/${goalId}/target/${targetId}`;
|
|
124
|
+
await this.getAxiosInstance().delete(endpoint);
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
console.error('Error deleting goal target:', error);
|
|
128
|
+
throw this.handleError(error, `Failed to delete target ${targetId} for goal ${goalId}`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
// ========================================
|
|
132
|
+
// GOAL ANALYTICS & REPORTING
|
|
133
|
+
// ========================================
|
|
134
|
+
/**
|
|
135
|
+
* Get goal summary and analytics for a team
|
|
136
|
+
*/
|
|
137
|
+
async getGoalSummary(teamId) {
|
|
138
|
+
try {
|
|
139
|
+
const goals = await this.getGoals(teamId, true);
|
|
140
|
+
const totalGoals = goals.length;
|
|
141
|
+
let completedGoals = 0;
|
|
142
|
+
let inProgressGoals = 0;
|
|
143
|
+
let overdueGoals = 0;
|
|
144
|
+
let totalProgress = 0;
|
|
145
|
+
const goalsByStatus = {};
|
|
146
|
+
const upcomingDeadlines = [];
|
|
147
|
+
const now = Date.now();
|
|
148
|
+
for (const goal of goals) {
|
|
149
|
+
const dueDate = new Date(goal.due_date).getTime();
|
|
150
|
+
const progress = goal.percent_completed;
|
|
151
|
+
totalProgress += progress;
|
|
152
|
+
// Categorize goals
|
|
153
|
+
if (progress >= 100) {
|
|
154
|
+
completedGoals++;
|
|
155
|
+
}
|
|
156
|
+
else if (now > dueDate) {
|
|
157
|
+
overdueGoals++;
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
inProgressGoals++;
|
|
161
|
+
}
|
|
162
|
+
// Get goal status
|
|
163
|
+
const status = this.getGoalStatus(progress, goal.due_date);
|
|
164
|
+
goalsByStatus[status] = (goalsByStatus[status] || 0) + 1;
|
|
165
|
+
// Check for upcoming deadlines (within 7 days)
|
|
166
|
+
const daysRemaining = Math.ceil((dueDate - now) / (1000 * 60 * 60 * 24));
|
|
167
|
+
if (daysRemaining > 0 && daysRemaining <= 7 && progress < 100) {
|
|
168
|
+
upcomingDeadlines.push({
|
|
169
|
+
goal_id: goal.id,
|
|
170
|
+
name: goal.name,
|
|
171
|
+
due_date: goal.due_date,
|
|
172
|
+
days_remaining: daysRemaining
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
// Sort upcoming deadlines by days remaining
|
|
177
|
+
upcomingDeadlines.sort((a, b) => a.days_remaining - b.days_remaining);
|
|
178
|
+
return {
|
|
179
|
+
total_goals: totalGoals,
|
|
180
|
+
completed_goals: completedGoals,
|
|
181
|
+
in_progress_goals: inProgressGoals,
|
|
182
|
+
overdue_goals: overdueGoals,
|
|
183
|
+
average_progress: totalGoals > 0 ? Math.round(totalProgress / totalGoals) : 0,
|
|
184
|
+
goals_by_status: goalsByStatus,
|
|
185
|
+
upcoming_deadlines: upcomingDeadlines
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
console.error('Error getting goal summary:', error);
|
|
190
|
+
throw this.handleError(error, `Failed to get goal summary for team ${teamId}`);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
// ========================================
|
|
194
|
+
// UTILITY METHODS
|
|
195
|
+
// ========================================
|
|
196
|
+
/**
|
|
197
|
+
* Calculate progress percentage for a target
|
|
198
|
+
*/
|
|
199
|
+
calculateTargetProgress(startValue, currentValue, targetValue) {
|
|
200
|
+
if (targetValue === startValue)
|
|
201
|
+
return 100; // Avoid division by zero
|
|
202
|
+
const progress = ((currentValue - startValue) / (targetValue - startValue)) * 100;
|
|
203
|
+
return Math.min(Math.max(progress, 0), 100); // Clamp between 0 and 100
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Check if a target is completed
|
|
207
|
+
*/
|
|
208
|
+
isTargetCompleted(currentValue, targetValue, type) {
|
|
209
|
+
switch (type) {
|
|
210
|
+
case 'boolean':
|
|
211
|
+
return currentValue >= 1;
|
|
212
|
+
case 'number':
|
|
213
|
+
case 'currency':
|
|
214
|
+
case 'task':
|
|
215
|
+
case 'list':
|
|
216
|
+
return currentValue >= targetValue;
|
|
217
|
+
default:
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Format currency value with unit
|
|
223
|
+
*/
|
|
224
|
+
formatCurrencyValue(value, unit = 'USD') {
|
|
225
|
+
const formatter = new Intl.NumberFormat('en-US', {
|
|
226
|
+
style: 'currency',
|
|
227
|
+
currency: unit.toUpperCase(),
|
|
228
|
+
minimumFractionDigits: 0,
|
|
229
|
+
maximumFractionDigits: 2
|
|
230
|
+
});
|
|
231
|
+
try {
|
|
232
|
+
return formatter.format(value);
|
|
233
|
+
}
|
|
234
|
+
catch (error) {
|
|
235
|
+
// Fallback for invalid currency codes
|
|
236
|
+
return `${unit} ${value.toLocaleString()}`;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Format number value with unit
|
|
241
|
+
*/
|
|
242
|
+
formatNumberValue(value, unit) {
|
|
243
|
+
const formattedNumber = value.toLocaleString();
|
|
244
|
+
return unit ? `${formattedNumber} ${unit}` : formattedNumber;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Get goal status based on progress and due date
|
|
248
|
+
*/
|
|
249
|
+
getGoalStatus(percentCompleted, dueDate) {
|
|
250
|
+
const now = Date.now();
|
|
251
|
+
const due = new Date(dueDate).getTime();
|
|
252
|
+
if (percentCompleted >= 100)
|
|
253
|
+
return 'completed';
|
|
254
|
+
if (now > due)
|
|
255
|
+
return 'overdue';
|
|
256
|
+
// Calculate if on track (simple heuristic: progress should match time elapsed)
|
|
257
|
+
const timeElapsed = now;
|
|
258
|
+
const totalTime = due;
|
|
259
|
+
const expectedProgress = (timeElapsed / totalTime) * 100;
|
|
260
|
+
if (percentCompleted >= expectedProgress * 0.8)
|
|
261
|
+
return 'on_track';
|
|
262
|
+
return 'at_risk';
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Calculate days until due date
|
|
266
|
+
*/
|
|
267
|
+
getDaysUntilDue(dueDate) {
|
|
268
|
+
const now = Date.now();
|
|
269
|
+
const due = new Date(dueDate).getTime();
|
|
270
|
+
return Math.ceil((due - now) / (1000 * 60 * 60 * 24));
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Validate goal date (must be in the future)
|
|
274
|
+
*/
|
|
275
|
+
validateGoalDate(dueDate) {
|
|
276
|
+
const now = Date.now();
|
|
277
|
+
return dueDate > now;
|
|
278
|
+
}
|
|
279
|
+
// ========================================
|
|
280
|
+
// ERROR HANDLING
|
|
281
|
+
// ========================================
|
|
282
|
+
handleError(error, context) {
|
|
283
|
+
if (axios.isAxiosError(error)) {
|
|
284
|
+
const status = error.response?.status;
|
|
285
|
+
const message = error.response?.data?.message || error.message;
|
|
286
|
+
switch (status) {
|
|
287
|
+
case 400:
|
|
288
|
+
return new Error(`${context}: Invalid request - ${message}`);
|
|
289
|
+
case 401:
|
|
290
|
+
return new Error(`${context}: Authentication failed - check API token`);
|
|
291
|
+
case 403:
|
|
292
|
+
return new Error(`${context}: Permission denied - insufficient access rights`);
|
|
293
|
+
case 404:
|
|
294
|
+
return new Error(`${context}: Resource not found - ${message}`);
|
|
295
|
+
case 429:
|
|
296
|
+
return new Error(`${context}: Rate limit exceeded - please retry later`);
|
|
297
|
+
case 500:
|
|
298
|
+
return new Error(`${context}: Server error - please try again`);
|
|
299
|
+
default:
|
|
300
|
+
return new Error(`${context}: ${message}`);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
return new Error(`${context}: ${error.message || 'Unknown error'}`);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
export const createEnhancedGoalsClient = (client) => {
|
|
307
|
+
return new EnhancedGoalsClient(client);
|
|
308
|
+
};
|
|
309
|
+
//# sourceMappingURL=goals-enhanced.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"goals-enhanced.js","sourceRoot":"","sources":["../../src/clickup-client/goals-enhanced.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAyG1B,2CAA2C;AAC3C,wBAAwB;AACxB,2CAA2C;AAE3C,MAAM,OAAO,mBAAmB;IAG9B,YAAY,MAAqB;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEO,gBAAgB;QACtB,OAAO,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;IACxC,CAAC;IAED,2CAA2C;IAC3C,kBAAkB;IAClB,2CAA2C;IAE3C;;OAEG;IACH,KAAK,CAAC,QAAQ,CAAC,MAAc,EAAE,mBAA4B,KAAK;QAC9D,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;YAC1C,IAAI,gBAAgB;gBAAE,WAAW,CAAC,MAAM,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;YAEtE,MAAM,QAAQ,GAAG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
import { AxiosInstance } from 'axios';
|
|
2
|
+
export interface ClickUpClientConfig {
|
|
3
|
+
apiToken: string;
|
|
4
|
+
baseUrl?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class ClickUpClient {
|
|
7
|
+
private axiosInstance;
|
|
8
|
+
constructor(config: ClickUpClientConfig);
|
|
9
|
+
getAxiosInstance(): AxiosInstance;
|
|
10
|
+
get<T = any>(endpoint: string, params?: any): Promise<T>;
|
|
11
|
+
post<T = any>(endpoint: string, data?: any): Promise<T>;
|
|
12
|
+
put<T = any>(endpoint: string, data?: any): Promise<T>;
|
|
13
|
+
patch<T = any>(endpoint: string, data?: any): Promise<T>;
|
|
14
|
+
delete<T = any>(endpoint: string): Promise<T>;
|
|
15
|
+
}
|
|
16
|
+
export declare const createClickUpClient: () => ClickUpClient;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
// ClickUp API base URL
|
|
3
|
+
const API_BASE_URL = 'https://api.clickup.com/api/v2';
|
|
4
|
+
export class ClickUpClient {
|
|
5
|
+
constructor(config) {
|
|
6
|
+
if (!config.apiToken) {
|
|
7
|
+
throw new Error('ClickUp API token is required');
|
|
8
|
+
}
|
|
9
|
+
this.axiosInstance = axios.create({
|
|
10
|
+
baseURL: config.baseUrl || API_BASE_URL,
|
|
11
|
+
headers: {
|
|
12
|
+
'accept': 'application/json',
|
|
13
|
+
'content-type': 'application/json',
|
|
14
|
+
'Authorization': config.apiToken
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
// Add response interceptor for error handling
|
|
18
|
+
this.axiosInstance.interceptors.response.use(response => response, error => {
|
|
19
|
+
if (error.response) {
|
|
20
|
+
// Format error message with status and data
|
|
21
|
+
const message = `ClickUp API Error (${error.response.status}): ${error.response.data?.err || error.message}`;
|
|
22
|
+
error.message = message;
|
|
23
|
+
}
|
|
24
|
+
return Promise.reject(error);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
// Helper method to get the axios instance for use in other modules
|
|
28
|
+
getAxiosInstance() {
|
|
29
|
+
return this.axiosInstance;
|
|
30
|
+
}
|
|
31
|
+
// Basic API methods that can be used directly
|
|
32
|
+
async get(endpoint, params) {
|
|
33
|
+
const response = await this.axiosInstance.get(endpoint, { params });
|
|
34
|
+
return response.data;
|
|
35
|
+
}
|
|
36
|
+
async post(endpoint, data) {
|
|
37
|
+
const response = await this.axiosInstance.post(endpoint, data);
|
|
38
|
+
return response.data;
|
|
39
|
+
}
|
|
40
|
+
async put(endpoint, data) {
|
|
41
|
+
const response = await this.axiosInstance.put(endpoint, data);
|
|
42
|
+
return response.data;
|
|
43
|
+
}
|
|
44
|
+
async patch(endpoint, data) {
|
|
45
|
+
const response = await this.axiosInstance.patch(endpoint, data);
|
|
46
|
+
return response.data;
|
|
47
|
+
}
|
|
48
|
+
async delete(endpoint) {
|
|
49
|
+
const response = await this.axiosInstance.delete(endpoint);
|
|
50
|
+
return response.data;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// Create a singleton instance using environment variables
|
|
54
|
+
export const createClickUpClient = () => {
|
|
55
|
+
const apiToken = process.env.CLICKUP_API_TOKEN;
|
|
56
|
+
if (!apiToken) {
|
|
57
|
+
throw new Error('CLICKUP_API_TOKEN environment variable is required');
|
|
58
|
+
}
|
|
59
|
+
return new ClickUpClient({ apiToken });
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/clickup-client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,uBAAuB;AACvB,MAAM,YAAY,GAAG,gCAAgC,CAAC;AAOtD,MAAM,OAAO,aAAa;IAGxB,YAAY,MAA2B;QACrC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;QACnD,CAA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;IAED,KAAK,CAAC,GAAG,CAAU,QAAgB,EAAE,IAAU;QAC7C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC9D,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,KAAK,CAAU,QAAgB,EAAE,IAAU;QAC/C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAChE,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,MAAM,CAAU,QAAgB;QACpC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC3D,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF;AAED,0DAA0D;AAC1D,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAkB,EAAE;IACrD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;IAE/C,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACxE,CAAC;IAED,OAAO,IAAI,aAAa,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;AACzC,CAAC,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { ClickUpClient } from './index.js';
|
|
2
|
+
export interface List {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
export interface GetListsParams {
|
|
7
|
+
}
|
|
8
|
+
export interface CreateListParams {
|
|
9
|
+
name: string;
|
|
10
|
+
}
|
|
11
|
+
export interface UpdateListParams {
|
|
12
|
+
name?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare class ListsClient {
|
|
15
|
+
private client;
|
|
16
|
+
constructor(client: ClickUpClient);
|
|
17
|
+
/**
|
|
18
|
+
* Get lists from a specific space
|
|
19
|
+
* @param spaceId The ID of the space to get lists from
|
|
20
|
+
* @param params Optional parameters for filtering lists
|
|
21
|
+
* @returns A list of lists
|
|
22
|
+
*/
|
|
23
|
+
getListsFromSpace(spaceId: string, params?: GetListsParams): Promise<{
|
|
24
|
+
lists: List[];
|
|
25
|
+
}>;
|
|
26
|
+
/**
|
|
27
|
+
* Get lists from a specific folder
|
|
28
|
+
* @param folderId The ID of the folder to get lists from
|
|
29
|
+
* @param params Optional parameters for filtering lists
|
|
30
|
+
* @returns A list of lists
|
|
31
|
+
*/
|
|
32
|
+
getListsFromFolder(folderId: string, params?: GetListsParams): Promise<{
|
|
33
|
+
lists: List[];
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* Create a new list in a folder
|
|
37
|
+
* @param folderId The ID of the folder to create the list in
|
|
38
|
+
* @param params The list parameters
|
|
39
|
+
* @returns The created list
|
|
40
|
+
*/
|
|
41
|
+
createListInFolder(folderId: string, params: CreateListParams): Promise<List>;
|
|
42
|
+
/**
|
|
43
|
+
* Create a new folderless list in a space
|
|
44
|
+
* @param spaceId The ID of the space to create the list in
|
|
45
|
+
* @param params The list parameters
|
|
46
|
+
* @returns The created list
|
|
47
|
+
*/
|
|
48
|
+
createFolderlessList(spaceId: string, params: CreateListParams): Promise<List>;
|
|
49
|
+
/**
|
|
50
|
+
* Get a specific list by ID
|
|
51
|
+
* @param listId The ID of the list to get
|
|
52
|
+
* @returns The list details
|
|
53
|
+
*/
|
|
54
|
+
getList(listId: string): Promise<List>;
|
|
55
|
+
/**
|
|
56
|
+
* Update an existing list
|
|
57
|
+
* @param listId The ID of the list to update
|
|
58
|
+
* @param params The list parameters to update
|
|
59
|
+
* @returns The updated list
|
|
60
|
+
*/
|
|
61
|
+
updateList(listId: string, params: UpdateListParams): Promise<List>;
|
|
62
|
+
/**
|
|
63
|
+
* Delete a list
|
|
64
|
+
* @param listId The ID of the list to delete
|
|
65
|
+
* @returns Success message
|
|
66
|
+
*/
|
|
67
|
+
deleteList(listId: string): Promise<{
|
|
68
|
+
success: boolean;
|
|
69
|
+
}>;
|
|
70
|
+
/**
|
|
71
|
+
* Add a task to a list
|
|
72
|
+
* @param listId The ID of the list to add the task to
|
|
73
|
+
* @param taskId The ID of the task to add
|
|
74
|
+
* @returns Success message
|
|
75
|
+
*/
|
|
76
|
+
addTaskToList(listId: string, taskId: string): Promise<{
|
|
77
|
+
success: boolean;
|
|
78
|
+
}>;
|
|
79
|
+
/**
|
|
80
|
+
* Remove a task from a list
|
|
81
|
+
* @param listId The ID of the list to remove the task from
|
|
82
|
+
* @param taskId The ID of the task to remove
|
|
83
|
+
* @returns Success message
|
|
84
|
+
*/
|
|
85
|
+
removeTaskFromList(listId: string, taskId: string): Promise<{
|
|
86
|
+
success: boolean;
|
|
87
|
+
}>;
|
|
88
|
+
/**
|
|
89
|
+
* Create a new list from a template in a folder
|
|
90
|
+
* @param folderId The ID of the folder to create the list in
|
|
91
|
+
* @param templateId The ID of the template to use
|
|
92
|
+
* @param params The list parameters
|
|
93
|
+
* @returns The created list
|
|
94
|
+
*/
|
|
95
|
+
createListFromTemplateInFolder(folderId: string, templateId: string, params: CreateListParams): Promise<List>;
|
|
96
|
+
/**
|
|
97
|
+
* Create a new list from a template in a space
|
|
98
|
+
* @param spaceId The ID of the space to create the list in
|
|
99
|
+
* @param templateId The ID of the template to use
|
|
100
|
+
* @param params The list parameters
|
|
101
|
+
* @returns The created list
|
|
102
|
+
*/
|
|
103
|
+
createListFromTemplateInSpace(spaceId: string, templateId: string, params: CreateListParams): Promise<List>;
|
|
104
|
+
}
|
|
105
|
+
export declare const createListsClient: (client: ClickUpClient) => ListsClient;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
export class ListsClient {
|
|
2
|
+
constructor(client) {
|
|
3
|
+
this.client = client;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Get lists from a specific space
|
|
7
|
+
* @param spaceId The ID of the space to get lists from
|
|
8
|
+
* @param params Optional parameters for filtering lists
|
|
9
|
+
* @returns A list of lists
|
|
10
|
+
*/
|
|
11
|
+
async getListsFromSpace(spaceId, params) {
|
|
12
|
+
return this.client.get(`/space/${spaceId}/list`, params);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get lists from a specific folder
|
|
16
|
+
* @param folderId The ID of the folder to get lists from
|
|
17
|
+
* @param params Optional parameters for filtering lists
|
|
18
|
+
* @returns A list of lists
|
|
19
|
+
*/
|
|
20
|
+
async getListsFromFolder(folderId, params) {
|
|
21
|
+
return this.client.get(`/folder/${folderId}/list`, params);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Create a new list in a folder
|
|
25
|
+
* @param folderId The ID of the folder to create the list in
|
|
26
|
+
* @param params The list parameters
|
|
27
|
+
* @returns The created list
|
|
28
|
+
*/
|
|
29
|
+
async createListInFolder(folderId, params) {
|
|
30
|
+
return this.client.post(`/folder/${folderId}/list`, params);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Create a new folderless list in a space
|
|
34
|
+
* @param spaceId The ID of the space to create the list in
|
|
35
|
+
* @param params The list parameters
|
|
36
|
+
* @returns The created list
|
|
37
|
+
*/
|
|
38
|
+
async createFolderlessList(spaceId, params) {
|
|
39
|
+
return this.client.post(`/space/${spaceId}/list`, params);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Get a specific list by ID
|
|
43
|
+
* @param listId The ID of the list to get
|
|
44
|
+
* @returns The list details
|
|
45
|
+
*/
|
|
46
|
+
async getList(listId) {
|
|
47
|
+
return this.client.get(`/list/${listId}`);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Update an existing list
|
|
51
|
+
* @param listId The ID of the list to update
|
|
52
|
+
* @param params The list parameters to update
|
|
53
|
+
* @returns The updated list
|
|
54
|
+
*/
|
|
55
|
+
async updateList(listId, params) {
|
|
56
|
+
return this.client.put(`/list/${listId}`, params);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Delete a list
|
|
60
|
+
* @param listId The ID of the list to delete
|
|
61
|
+
* @returns Success message
|
|
62
|
+
*/
|
|
63
|
+
async deleteList(listId) {
|
|
64
|
+
return this.client.delete(`/list/${listId}`);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Add a task to a list
|
|
68
|
+
* @param listId The ID of the list to add the task to
|
|
69
|
+
* @param taskId The ID of the task to add
|
|
70
|
+
* @returns Success message
|
|
71
|
+
*/
|
|
72
|
+
async addTaskToList(listId, taskId) {
|
|
73
|
+
return this.client.post(`/list/${listId}/task/${taskId}`);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Remove a task from a list
|
|
77
|
+
* @param listId The ID of the list to remove the task from
|
|
78
|
+
* @param taskId The ID of the task to remove
|
|
79
|
+
* @returns Success message
|
|
80
|
+
*/
|
|
81
|
+
async removeTaskFromList(listId, taskId) {
|
|
82
|
+
return this.client.delete(`/list/${listId}/task/${taskId}`);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Create a new list from a template in a folder
|
|
86
|
+
* @param folderId The ID of the folder to create the list in
|
|
87
|
+
* @param templateId The ID of the template to use
|
|
88
|
+
* @param params The list parameters
|
|
89
|
+
* @returns The created list
|
|
90
|
+
*/
|
|
91
|
+
async createListFromTemplateInFolder(folderId, templateId, params) {
|
|
92
|
+
return this.client.post(`/folder/${folderId}/list/template/${templateId}`, params);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Create a new list from a template in a space
|
|
96
|
+
* @param spaceId The ID of the space to create the list in
|
|
97
|
+
* @param templateId The ID of the template to use
|
|
98
|
+
* @param params The list parameters
|
|
99
|
+
* @returns The created list
|
|
100
|
+
*/
|
|
101
|
+
async createListFromTemplateInSpace(spaceId, templateId, params) {
|
|
102
|
+
return this.client.post(`/space/${spaceId}/list/template/${templateId}`, params);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
export const createListsClient = (client) => {
|
|
106
|
+
return new ListsClient(client);
|
|
107
|
+
};
|
|
108
|
+
//# sourceMappingURL=lists.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lists.js","sourceRoot":"","sources":["../../src/clickup-client/lists.ts"],"names":[],"mappings":"AAsBA,MAAM,OAAO,WAAW;IAGtB,YAAY,MAAqB;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,iBAAiB,CAAC,OAAe,EAAE,MAAuB;QAC9D,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,OAAO,OAAO,EAAE,MAAM,CAAC,CAAC;IAC3D,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,kBAAkB,CAAC,QAAgB,EAAE,MAAuB;QAChE,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,QAAQ,OAAO,EAAE,MAAM,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,kBAAkB,CAAC,QAAgB,EAAE,MAAwB;QACjE,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,QAAQ,OAAO,EAAE,MAAM,CAAC,CAAC;IAC9D,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,oBAAoB,CAAC,OAAe,EAAE,MAAwB;QAClE,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,OAAO,OAAO,EAAE,MAAM,CAAC,CAAC;IAC5D,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAAC,MAAc;QAC1B,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,UAAU,CAAC,MAAc,EAAE,MAAwB;QACvD,OAAO,IA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